@piecemaker-legal/piecemaker 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/dist/assets/FindReplaceDialog-KU5TEIBJ-CQ76sPaJ.js +1 -0
  2. package/dist/assets/FootnotePropertiesDialog-W3YHM4BV-BpgYQvvd.js +1 -0
  3. package/dist/assets/HyperlinkDialog-ZYH7ZHRF-qIPBOssF.css +1 -0
  4. package/dist/assets/HyperlinkDialog-ZYH7ZHRF-z08UbYbL.js +144 -0
  5. package/dist/assets/ImagePositionDialog-HEWYR6Q3-CFzOnzAt.js +1 -0
  6. package/dist/assets/ImagePropertiesDialog-RAB47C6M-D-ThGU-b.js +1 -0
  7. package/dist/assets/PageSetupDialog-AIGIXO3E-_PYIO8eb.js +1 -0
  8. package/dist/assets/SplitCellDialog-IFBKYCD6-Cb9uQOB8.js +1 -0
  9. package/dist/assets/TablePropertiesDialog-TMLKGOOW-12vmjb6B.js +1 -0
  10. package/dist/assets/WatermarkDialog-KRL7WMIS-C-d8rzt2.js +1 -0
  11. package/dist/assets/{abnfDiagram-VCTEODGH-WrsSAHOe.js → abnfDiagram-VCTEODGH-B4OsX7eF.js} +1 -1
  12. package/dist/assets/arc-BK1oUIk7.js +1 -0
  13. package/dist/assets/architectureDiagram-5GKGNRK7-CfaFI6L7.js +36 -0
  14. package/dist/assets/{blockDiagram-I7D4REHJ-zGMnF7Ox.js → blockDiagram-I7D4REHJ-DQEI2azY.js} +1 -1
  15. package/dist/assets/{c4Diagram-7LVT6UL2-ClWw3bqt.js → c4Diagram-7LVT6UL2-DbravpVi.js} +1 -1
  16. package/dist/assets/channel-DVyNr2Yg.js +1 -0
  17. package/dist/assets/{chunk-2Q5K7J3B-C-9ICPHv.js → chunk-2Q5K7J3B-BLpZ9huC.js} +1 -1
  18. package/dist/assets/{chunk-5VM5RSS4-Bawy3teT.js → chunk-5VM5RSS4-BLlEdmX9.js} +1 -1
  19. package/dist/assets/{chunk-F27PBJKO-DQ375RQO.js → chunk-F27PBJKO-D-ZNhI6q.js} +1 -1
  20. package/dist/assets/{chunk-IMKFNOWR-CflNF2f6.js → chunk-IMKFNOWR-vzSiKnhh.js} +1 -1
  21. package/dist/assets/{chunk-JWPE2WC7-CIXQv0gc.js → chunk-JWPE2WC7-DfF0k4nb.js} +1 -1
  22. package/dist/assets/{chunk-POPQ4Y6H-Cza5j6Qw.js → chunk-POPQ4Y6H-BnwCYsPP.js} +1 -1
  23. package/dist/assets/{chunk-SVP7TREG-GQ_VvWZR.js → chunk-SVP7TREG-DRxc8fhq.js} +1 -1
  24. package/dist/assets/{chunk-TICWLB2K-BEmU16W5.js → chunk-TICWLB2K-Dd2Q-md-.js} +1 -1
  25. package/dist/assets/{chunk-XXDRQBXY-C1KpkLYH.js → chunk-XXDRQBXY-DBjkEUp_.js} +1 -1
  26. package/dist/assets/classDiagram-ZZMXUADV-2pGPHl5H.js +1 -0
  27. package/dist/assets/classDiagram-v2-VYDZK3BY-2pGPHl5H.js +1 -0
  28. package/dist/assets/{cose-bilkent-JH36ORCC-CZE48TRG.js → cose-bilkent-JH36ORCC-By6PS4oe.js} +1 -1
  29. package/dist/assets/{cynefin-OW5HDTMX-L-tx1eC-.js → cynefin-OW5HDTMX-YxWpjc5W.js} +1 -1
  30. package/dist/assets/{cynefinDiagram-5FMLGOSQ-Coa8oJwR.js → cynefinDiagram-5FMLGOSQ-DrtXzz3p.js} +1 -1
  31. package/dist/assets/{dagre-GXQ25YYZ-Bu_3Y75K.js → dagre-GXQ25YYZ-BDpTLKqZ.js} +1 -1
  32. package/dist/assets/{diagram-S7CK7UJ4-CFiiV4es.js → diagram-S7CK7UJ4-C4LvqeCs.js} +1 -1
  33. package/dist/assets/{diagram-UQ7AKVKN-CCXheGAA.js → diagram-UQ7AKVKN-BTpnMeHp.js} +1 -1
  34. package/dist/assets/{diagram-VSXAHHWV-B70m4lr_.js → diagram-VSXAHHWV-DucHHWev.js} +1 -1
  35. package/dist/assets/{diagram-VX7I27RA-CHkiMOVA.js → diagram-VX7I27RA-DYHZNmmH.js} +1 -1
  36. package/dist/assets/{diagram-Z3DM3KII-_awpc4Bs.js → diagram-Z3DM3KII-BHIH2BGN.js} +1 -1
  37. package/dist/assets/{ebnfDiagram-PWID7BFC-CZzjH86H.js → ebnfDiagram-PWID7BFC-CGiEkwj0.js} +1 -1
  38. package/dist/assets/{erDiagram-RLTQ6QDP-9DgiHZg9.js → erDiagram-RLTQ6QDP-AJMHi2Us.js} +1 -1
  39. package/dist/assets/{flowDiagram-HODETNUW-DHY_503b.js → flowDiagram-HODETNUW-BqzANBh2.js} +1 -1
  40. package/dist/assets/{ganttDiagram-EL5Y4UJY-DPiiYZ_l.js → ganttDiagram-EL5Y4UJY-B0xPDY2_.js} +1 -1
  41. package/dist/assets/{gitGraphDiagram-WWUBYQGX-Ddd_evm7.js → gitGraphDiagram-WWUBYQGX-CzPX5CNO.js} +1 -1
  42. package/dist/assets/{index-tibHq7Qp.js → index-Bk2iXKnJ.js} +140 -140
  43. package/dist/assets/index-Dc9wNuS4.css +1 -0
  44. package/dist/assets/{infoDiagram-27XIBGKW-BPRNhfwb.js → infoDiagram-27XIBGKW-Cjc44H0O.js} +1 -1
  45. package/dist/assets/{ishikawaDiagram-5VMMS53U-BXx6aqkq.js → ishikawaDiagram-5VMMS53U-BWhr2v7r.js} +1 -1
  46. package/dist/assets/{journeyDiagram-3NMN7TZE-BK8TZM29.js → journeyDiagram-3NMN7TZE-Bl4r6RrP.js} +1 -1
  47. package/dist/assets/{kanban-definition-UXKFOSKX-CHioRmxz.js → kanban-definition-UXKFOSKX-FV-T0Vy1.js} +6 -6
  48. package/dist/assets/layout-CTfb1sAF.js +1 -0
  49. package/dist/assets/{linear-CTEhUcKG.js → linear-Dfgi6vlo.js} +1 -1
  50. package/dist/assets/{mermaid.core-DYUb_UUB.js → mermaid.core-DOCGsdlo.js} +7 -7
  51. package/dist/assets/{mindmap-definition-YA3MSWOX-D7ODZ4oS.js → mindmap-definition-YA3MSWOX-CymQ86ir.js} +1 -1
  52. package/dist/assets/{pegDiagram-XKGWAZYB-8J-_2_kw.js → pegDiagram-XKGWAZYB-1VMq_vi0.js} +1 -1
  53. package/dist/assets/{pieDiagram-E7YTZNPT-ebg0yfMi.js → pieDiagram-E7YTZNPT-C5GgXtJU.js} +1 -1
  54. package/dist/assets/processTemplate-GPFDLQMX-B1sVV2O0.js +22 -0
  55. package/dist/assets/{quadrantDiagram-AXDQQJYC-BoWkDiFb.js → quadrantDiagram-AXDQQJYC-C6zpryYf.js} +1 -1
  56. package/dist/assets/{railroadDiagram-O6MQD6OU-BRJ77ldz.js → railroadDiagram-O6MQD6OU-D-sv4SWi.js} +1 -1
  57. package/dist/assets/{requirementDiagram-BXWQKSXE-Z0JJgktA.js → requirementDiagram-BXWQKSXE-CkjY-z4B.js} +1 -1
  58. package/dist/assets/sankeyDiagram-P5KCCOFB-De-d8Q6L.js +40 -0
  59. package/dist/assets/{sequenceDiagram-WJ2MYXX4-BPAjtXwp.js → sequenceDiagram-WJ2MYXX4-DCsGSJa9.js} +1 -1
  60. package/dist/assets/{server.browser-BzI1jrZw.js → server.browser-BY3bL-IX.js} +1 -1
  61. package/dist/assets/{sizeCapture-INFHLROL-BGZPCzM4.js → sizeCapture-INFHLROL-xINZhgER.js} +1 -1
  62. package/dist/assets/stateDiagram-D77RDMKH-CuLUTWSL.js +1 -0
  63. package/dist/assets/stateDiagram-v2-MP3YSRHH-Cnbs-M92.js +1 -0
  64. package/dist/assets/{swimlanes-42K2YHIH-DvuB15qF.js → swimlanes-42K2YHIH-BwxARD7N.js} +1 -1
  65. package/dist/assets/swimlanesDiagram-VR7AAH4N-D7p8qZI2.js +8 -0
  66. package/dist/assets/{timeline-definition-24CTP7MA-ZIziYCIF.js → timeline-definition-24CTP7MA-BIOvnn-l.js} +3 -3
  67. package/dist/assets/{vendor-codemirror-CjW0lHR5.js → vendor-codemirror-CN-sJePf.js} +2 -2
  68. package/dist/assets/{vendor-react-D809iwXR.js → vendor-react-B22wqN3J.js} +5 -5
  69. package/dist/assets/{vennDiagram-4TSXK5OY-C5_B9gWa.js → vennDiagram-4TSXK5OY-BSD6Pfmt.js} +4 -4
  70. package/dist/assets/{wardleyDiagram-VM6X3IG4-DMlH9Afw.js → wardleyDiagram-VM6X3IG4-7Zz2iRkF.js} +1 -1
  71. package/dist/assets/{xychartDiagram-S5SC5T6Z-BldhJt7i.js → xychartDiagram-S5SC5T6Z-Ctx17Y1D.js} +1 -1
  72. package/dist/index.html +4 -4
  73. package/dist/sw.js +1 -1
  74. package/dist-server/server/modules/providers/list/mistral/mistral-models.provider.js +4 -53
  75. package/dist-server/server/modules/providers/list/mistral/mistral-models.provider.js.map +1 -1
  76. package/dist-server/server/modules/providers/list/mistral/mistral-runtime.provider.js +2 -3
  77. package/dist-server/server/modules/providers/list/mistral/mistral-runtime.provider.js.map +1 -1
  78. package/dist-server/server/modules/providers/list/mistral/mistral-vibe-models.js +30 -0
  79. package/dist-server/server/modules/providers/list/mistral/mistral-vibe-models.js.map +1 -0
  80. package/dist-server/server/modules/providers/tests/mistral-vibe-models.test.js +24 -0
  81. package/dist-server/server/modules/providers/tests/mistral-vibe-models.test.js.map +1 -0
  82. package/dist-server/server/piecemaker/anonymizer/lifecycle.js +2 -3
  83. package/dist-server/server/piecemaker/anonymizer/lifecycle.js.map +1 -1
  84. package/dist-server/server/piecemaker/docx-document.js +50 -0
  85. package/dist-server/server/piecemaker/docx-document.js.map +1 -0
  86. package/dist-server/server/piecemaker/index.js +9 -2
  87. package/dist-server/server/piecemaker/index.js.map +1 -1
  88. package/dist-server/server/piecemaker/model-discovery/codex-catalog.js +46 -0
  89. package/dist-server/server/piecemaker/model-discovery/codex-catalog.js.map +1 -0
  90. package/dist-server/server/piecemaker/model-discovery/index.js +42 -0
  91. package/dist-server/server/piecemaker/model-discovery/index.js.map +1 -0
  92. package/dist-server/server/piecemaker/model-discovery/mistral-catalog.js +19 -0
  93. package/dist-server/server/piecemaker/model-discovery/mistral-catalog.js.map +1 -0
  94. package/dist-server/server/piecemaker/model-discovery/stdio-rpc.js +61 -0
  95. package/dist-server/server/piecemaker/model-discovery/stdio-rpc.js.map +1 -0
  96. package/dist-server/server/piecemaker/project-registry.js +29 -0
  97. package/dist-server/server/piecemaker/project-registry.js.map +1 -0
  98. package/package.json +12 -1
  99. package/scripts/piecemaker/cli/disable-anonymizer.mjs +19 -0
  100. package/scripts/piecemaker/cli/lib/config.mjs +0 -1
  101. package/scripts/piecemaker/cli/lib/services.mjs +1 -10
  102. package/scripts/piecemaker/cli/piecemaker.mjs +0 -3
  103. package/server/modules/providers/list/mistral/mistral-models.provider.ts +4 -53
  104. package/server/modules/providers/list/mistral/mistral-runtime.provider.ts +2 -3
  105. package/server/modules/providers/list/mistral/mistral-vibe-models.ts +43 -0
  106. package/server/modules/providers/tests/mistral-vibe-models.test.ts +27 -0
  107. package/server/piecemaker/anonymizer/client-config.cjs +92 -92
  108. package/server/piecemaker/anonymizer/hudsucker-fixture.cjs +9 -16
  109. package/server/piecemaker/anonymizer/hudsucker-proxy/Cargo.toml +1 -1
  110. package/server/piecemaker/anonymizer/hudsucker-proxy/src/main.rs +251 -268
  111. package/server/piecemaker/anonymizer/lifecycle.ts +2 -3
  112. package/server/piecemaker/anonymizer/rewriter-bridge.cjs +6 -0
  113. package/server/piecemaker/anonymizer/service.cjs +103 -174
  114. package/server/piecemaker/docx-document.ts +54 -0
  115. package/server/piecemaker/harness/decisions.cjs +1 -1
  116. package/server/piecemaker/harness/index.cjs +2 -3
  117. package/server/piecemaker/harness/verification.cjs +1 -1
  118. package/server/piecemaker/index.ts +11 -3
  119. package/server/piecemaker/model-discovery/codex-catalog.ts +67 -0
  120. package/server/piecemaker/model-discovery/index.ts +69 -0
  121. package/server/piecemaker/model-discovery/mistral-catalog.ts +36 -0
  122. package/server/piecemaker/model-discovery/stdio-rpc.ts +79 -0
  123. package/server/piecemaker/project-registry.ts +34 -0
  124. package/server/piecemaker/router.cjs +6 -7
  125. package/server/piecemaker/vendor/installer/bin/piecemaker.mjs +31 -77
  126. package/server/piecemaker/vendor/installer/lib/codex-skills.mjs +2 -84
  127. package/server/piecemaker/vendor/installer/lib/service.mjs +4 -24
  128. package/server/piecemaker/vendor/installer/steps/06-hooks.mjs +10 -21
  129. package/server/piecemaker/vendor/installer/steps/09-claude-assets.mjs +0 -11
  130. package/server/piecemaker/vendor/installer/steps/09-codex-plugin.mjs +6 -36
  131. package/server/piecemaker/vendor/installer/steps/13-garde-secrets.mjs +30 -12
  132. package/server/piecemaker/vendor/piecemaker-plugin/README.md +2 -9
  133. package/server/piecemaker/vendor/piecemaker-plugin/scripts/billing-track.mjs +5 -5
  134. package/server/piecemaker/vendor/piecemaker-plugin/scripts/classify-ai-documents.mjs +8 -8
  135. package/server/piecemaker/vendor/piecemaker-plugin/scripts/commit-track.mjs +2 -2
  136. package/server/piecemaker/vendor/piecemaker-plugin/scripts/compile-recherche.mjs +4 -6
  137. package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/case-folders.cjs +71 -38
  138. package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/mapping.cjs +8 -38
  139. package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/protection.cjs +82 -61
  140. package/server/piecemaker/vendor/piecemaker-plugin/scripts/protect-originals.mjs +4 -55
  141. package/server/piecemaker/vendor/piecemaker-plugin/scripts/statusline.mjs +24 -117
  142. package/server/piecemaker/vendor/piecemaker-plugin/skills/tamponnage/SKILL.md +2 -2
  143. package/server/piecemaker/vendor/websocket-server/admin-routes.cjs +15 -121
  144. package/server/piecemaker/vendor/websocket-server/case-registry.cjs +16 -32
  145. package/server/piecemaker/vendor/websocket-server/claude-hooks.cjs +0 -73
  146. package/server/piecemaker/vendor/websocket-server/originals-pipeline.cjs +0 -7
  147. package/server/piecemaker/vendor/websocket-server/stamping-routes.cjs +3 -12
  148. package/server/piecemaker/vendor/websocket-server/workspace-paths.cjs +6 -6
  149. package/dist/assets/arc-DAA6wH-C.js +0 -1
  150. package/dist/assets/architectureDiagram-5GKGNRK7-BGNHr7ef.js +0 -36
  151. package/dist/assets/channel-BAQyfMll.js +0 -1
  152. package/dist/assets/classDiagram-ZZMXUADV-BNGCuvrR.js +0 -1
  153. package/dist/assets/classDiagram-v2-VYDZK3BY-BNGCuvrR.js +0 -1
  154. package/dist/assets/index-WwknP0l4.css +0 -1
  155. package/dist/assets/layout-DEnkyfTY.js +0 -1
  156. package/dist/assets/sankeyDiagram-P5KCCOFB-4PW5HTOP.js +0 -40
  157. package/dist/assets/stateDiagram-D77RDMKH-o-vEcKwz.js +0 -1
  158. package/dist/assets/stateDiagram-v2-MP3YSRHH-BsuDaKkN.js +0 -1
  159. package/dist/assets/swimlanesDiagram-VR7AAH4N-DcCAyKlT.js +0 -8
  160. package/scripts/piecemaker/cli/lib/piecemaker-anonymizer.mjs +0 -78
  161. package/scripts/piecemaker/hooks/proxy-guard.mjs +0 -251
  162. package/server/piecemaker/anonymizer/providers.cjs +0 -120
  163. package/server/piecemaker/vendor/installer/steps/08-telegram.mjs +0 -482
  164. package/server/piecemaker/vendor/piecemaker-plugin/scripts/lib/central-mapping.cjs +0 -0
  165. package/server/piecemaker/vendor/websocket-server/telegram-admin.cjs +0 -602
@@ -0,0 +1,144 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bk2iXKnJ.js","assets/vendor-codemirror-CN-sJePf.js","assets/vendor-react-B22wqN3J.js","assets/vendor-xterm-BWUgpGtR.js","assets/index-Dc9wNuS4.css","assets/processTemplate-GPFDLQMX-B1sVV2O0.js","assets/FindReplaceDialog-KU5TEIBJ-CQ76sPaJ.js","assets/TablePropertiesDialog-TMLKGOOW-12vmjb6B.js","assets/SplitCellDialog-IFBKYCD6-Cb9uQOB8.js","assets/ImagePositionDialog-HEWYR6Q3-CFzOnzAt.js","assets/ImagePropertiesDialog-RAB47C6M-D-ThGU-b.js","assets/FootnotePropertiesDialog-W3YHM4BV-BpgYQvvd.js","assets/PageSetupDialog-AIGIXO3E-_PYIO8eb.js","assets/WatermarkDialog-KRL7WMIS-C-d8rzt2.js"])))=>i.map(i=>d[i]);
2
+ var sm=t=>{throw TypeError(t)};var cm=(t,e,n)=>e.has(t)||sm("Cannot "+n);var Wt=(t,e,n)=>(cm(t,e,"read from private field"),n?n.call(t):e.get(t)),dm=(t,e,n)=>e.has(t)?sm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gd=(t,e,n,r)=>(cm(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);import{j as b,B as n$,H as r$}from"./vendor-codemirror-CN-sJePf.js";import{a as S,j as o$,c as Ql,q as ae,e as i$}from"./vendor-react-B22wqN3J.js";import{u as Qt,c as pc,a as Fl,b as wr,d as hc,P as un,e as ln,f as l$,g as a$,h as Vf,i as s$,k as c$,R as d$,F as u$,D as f$,l as um,m as wb,n as Ts,_ as Vn,o as p$,q as fm,r as h$}from"./index-Bk2iXKnJ.js";var m$={_lang:"en",common:{cancel:"Cancel",insert:"Insert",apply:"Apply",close:"Close",delete:"Delete",update:"Update",save:"Save",retry:"Retry",send:"Send",edit:"Edit",comment:"Comment",reply:"Reply",accept:"Accept",reject:"Reject",dismiss:"Dismiss",change:"Change",clear:"Clear",px:"px",closeDialog:"Close dialog"},toolbar:{ariaLabel:"Formatting toolbar",file:"File",format:"Format",insert:"Insert",open:"Open",openShortcut:"Ctrl+O",save:"Save",saveShortcut:"Ctrl+S",print:"Print",printShortcut:"Ctrl+P",pageSetup:"Page setup",leftToRight:"Left-to-right text",rightToLeft:"Right-to-left text",image:"Image",table:"Table",break:"Break",pageBreak:"Page break",sectionBreakNextPage:"Section break (next page)",sectionBreakContinuous:"Section break (continuous)",tableOfContents:"Table of contents",symbol:"Symbol",watermark:"Watermark",help:"Help",reportIssue:"Report issue"},formattingBar:{groups:{history:"History",zoom:"Zoom",styles:"Styles",font:"Font",textFormatting:"Text formatting",script:"Script",alignment:"Alignment",listFormatting:"List formatting",image:"Image",table:"Table"},undo:"Undo",undoShortcut:"Undo (Ctrl+Z)",redo:"Redo",redoShortcut:"Redo (Ctrl+Y)",bold:"Bold",boldShortcut:"Bold (Ctrl+B)",italic:"Italic",italicShortcut:"Italic (Ctrl+I)",underline:"Underline",underlineShortcut:"Underline (Ctrl+U)",strikethrough:"Strikethrough",fontColor:"Font Color",highlightColor:"Text Highlight Color",insertLink:"Insert link",insertLinkShortcut:"Insert link (Ctrl+K)",superscript:"Superscript",superscriptShortcut:"Superscript (Ctrl+Shift+=)",subscript:"Subscript",subscriptShortcut:"Subscript (Ctrl+=)",imageProperties:"Image properties",imagePropertiesShortcut:"Image properties (alt text, border)...",clearFormatting:"Clear formatting",commentsAndChanges:"Comments & Changes",moreItems:"{count, plural, one {# more item} other {# more items}}"},alignment:{alignLeft:"Align Left",alignLeftShortcut:"Ctrl+L",center:"Center",centerShortcut:"Ctrl+E",alignRight:"Align Right",alignRightShortcut:"Ctrl+R",justify:"Justify",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"List formatting",typeAriaLabel:"List type",indentationAriaLabel:"List indentation",bulletList:"Bullet List",numberedList:"Numbered List",decreaseIndent:"Decrease Indent",increaseIndent:"Increase Indent"},lineSpacing:{label:"Line spacing",single:"Single",double:"Double",lineSpacingTitle:"Line spacing: {label}",paragraphSpacing:"Paragraph spacing"},styles:{selectAriaLabel:"Select paragraph style",normalText:"Normal text",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},font:{selectAriaLabel:"Select font family",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace",other:"Other",documentFonts:"Document fonts"},fontSize:{decrease:"Decrease font size",increase:"Increase font size",label:"Font size",listLabel:"Font sizes"},zoom:{ariaLabel:"Zoom: {label}",zoomOut:"Zoom out",zoomIn:"Zoom in",zoomLevel:"Zoom level"},colorPicker:{ariaLabel:"{type} color picker",highlightColors:"Highlight Colors",customColor:"Custom Color",noColor:"No Color",automatic:"Automatic",themeColors:"Theme Colors",standardColors:"Standard Colors",colors:{black:"Black",darkRed:"Dark Red",red:"Red",orange:"Orange",yellow:"Yellow",darkYellow:"Dark Yellow",green:"Green",darkGreen:"Dark Green",teal:"Teal",darkTeal:"Dark Teal",blue:"Blue",darkBlue:"Dark Blue",purple:"Purple",darkPurple:"Dark Purple",brown:"Brown",grey50:"Grey 50%",grey25:"Grey 25%",grey10:"Grey 10%",white:"White",lightRed:"Light Red",lightOrange:"Light Orange",lightYellow:"Light Yellow",lightGreen:"Light Green",lightBlue:"Light Blue",lightPurple:"Light Purple",pink:"Pink",rose:"Rose",gold:"Gold",aqua:"Aqua",lavender:"Lavender",silver:"Silver",darkOrange:"Dark Orange",darkGray:"Dark Gray",gray:"Gray",cyan:"Cyan",magenta:"Magenta",paleGreen:"Pale Green",lightCyan:"Light Cyan",skyBlue:"Sky Blue",lightBlue2:"Light Blue 2",lightMagenta:"Light Magenta",brightGreen:"Bright Green",violet:"Violet"}},dialogs:{findReplace:{titleFind:"Find",titleFindReplace:"Find and Replace",findLabel:"Find:",findPlaceholder:"Enter text to find...",findAriaLabel:"Find text",findPrevious:"Find previous",findPreviousTitle:"Find Previous (Shift+Enter)",findNext:"Find next",findNextTitle:"Find Next (Enter)",matchCount:"{current} of {total} matches",noResults:"No results found",replaceLabel:"Replace:",replacePlaceholder:"Enter replacement text...",replaceAriaLabel:"Replace text",replaceButton:"Replace",replaceCurrentTitle:"Replace current match",replaceAllButton:"Replace All",replaceAllTitle:"Replace all matches",matchCase:"Match case",wholeWords:"Whole words",matchesFound:"{total} matches",toggleReplace:"+ Replace"},hyperlink:{titleEdit:"Edit Hyperlink",titleInsert:"Insert Hyperlink",tabWebAddress:"Web Address",tabBookmark:"Bookmark",urlLabel:"URL",urlPlaceholder:"https://example.com",urlHint:"Enter a web address, email (mailto:), or phone (tel:)",bookmarkLabel:"Bookmark",bookmarkPlaceholder:"Select a bookmark...",displayTextLabel:"Display Text",displayTextPlaceholder:"Text to display (optional)",displayTextHint:"Leave empty to use the selected text",tooltipLabel:"Tooltip (optional)",tooltipPlaceholder:"Text shown on hover",removeLink:"Remove Link",invalidUrl:"Please enter a valid URL",urlRequired:"URL is required"},insertTable:{title:"Insert Table",hoverToSelect:"Hover to select size",tableSize:"{cols} x {rows} Table",orSpecifySize:"or specify size",rowsLabel:"Rows:",columnsLabel:"Columns:",insertButton:"Insert Table",sizeSelector:"Table size selector",columnWidthLabel:"Column width",fixedWidth:"Fixed",autofit:"Auto-fit to contents",tableStyleLabel:"Table style",validationHint:"Rows: {minRows}-{maxRows}, Columns: {minCols}-{maxCols}"},watermark:{title:"Watermark",noWatermark:"No watermark",picture:"Picture watermark",text:"Text watermark",selectPicture:"Select Picture...",scale:"Scale",washout:"Washout",textLabel:"Text",fontLabel:"Font",sizeLabel:"Size",sizeAuto:"Auto",colorLabel:"Color",layoutLabel:"Layout",diagonal:"Diagonal",horizontal:"Horizontal",semitransparent:"Semitransparent",presetLabel:"Preset",applyButton:"Apply",cancelButton:"Cancel"},splitCell:{title:"Split Cell",description:"Set how many rows and columns to split the selected cell into.",rowsLabel:"Rows:",columnsLabel:"Columns:",currentMinimum:"Minimum from current span: {rows} row(s) x {cols} column(s)",minValue:"Use at least {rows} row(s) and {cols} column(s).",notOneByOne:"Choose at least two resulting cells."},insertImage:{title:"Insert Image",uploadAriaLabel:"Click or drag to upload image",uploadText:"Click to select or drag and drop an image",uploadSubtext:"PNG, JPG, GIF up to 10MB",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",aspectRatioLocked:"Aspect ratio locked",aspectRatioUnlocked:"Aspect ratio unlocked",altTextLabel:"Alt Text (optional)",altTextPlaceholder:"Describe the image for accessibility",insertButton:"Insert Image",invalidFile:"Please select a valid image file",fileTooLarge:"Image file is too large (max 10MB)",readFailed:"Failed to read image file",loadFailed:"Failed to load image",preview:"Preview"},insertSymbol:{title:"Insert Symbol",searchPlaceholder:"Search symbols (character or Unicode)...",noResultsEmpty:"No symbols found",noResults:'No symbols found for "{query}"',decimal:"Decimal: {value}",recent:"Recent:",categories:{common:"Common",arrows:"Arrows",math:"Math",greek:"Greek",shapes:"Shapes",punctuation:"Punctuation",currency:"Currency",music:"Music",emoji:"Emoji"}},imageProperties:{title:"Image Properties",altText:"Alt Text",altTextPlaceholder:"Describe this image for accessibility...",border:"Border",width:"Width",style:"Style",color:"Color",preview:"Preview",textWrapping:"Text wrapping",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",lockAspectRatio:"Lock aspect ratio",wrapOptions:{inline:"Inline with text",wrapRight:"Wrap text, float left",wrapLeft:"Wrap text, float right",topAndBottom:"Top and bottom",behind:"Behind text",inFront:"In front of text"},borderStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"}},imagePosition:{title:"Image Position",horizontal:"Horizontal",vertical:"Vertical",position:"Position",alignment:"Alignment",offset:"Offset",offsetPx:"Offset (px)",align:"Align",relativeTo:"Relative to",alignOptions:{left:"Left",center:"Center",right:"Right",top:"Top",bottom:"Bottom"},relativeOptions:{page:"Page",column:"Column",margin:"Margin",character:"Character",paragraph:"Paragraph",line:"Line"}},pageSetup:{title:"Page Setup",pageSize:"PAGE SIZE",sizeLabel:"Size",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"MARGINS",top:"Top",bottom:"Bottom",left:"Left",right:"Right",pageSizes:{letter:'Letter (8.5" × 11")',a4:'A4 (8.27" × 11.69")',legal:'Legal (8.5" × 14")',a3:'A3 (11.69" × 16.54")',a5:'A5 (5.83" × 8.27")',b5:'B5 (6.93" × 9.84")',executive:'Executive (7.25" × 10.5")'}},tableProperties:{title:"Table Properties",widthType:"Width type",widthLabel:"Width",alignmentLabel:"Alignment",widthTypes:{auto:"Auto",fixed:"Fixed (twips)",percentage:"Percentage"},units:{fiftiethsPercent:"(50ths of %)",twips:"tw"},alignOptions:{left:"Left",center:"Center",right:"Right"}},pasteSpecial:{title:"Paste Special",keepFormatting:"Keep Source Formatting",keepFormattingDescription:"Paste with original formatting",keepFormattingShortcut:"Ctrl+V",plainText:"Paste as Plain Text",plainTextDescription:"Paste without any formatting",plainTextShortcut:"Ctrl+Shift+V",readingClipboard:"Reading clipboard...",preview:"Preview:",noContent:"No content available to paste",clipboardError:"Unable to read clipboard. Please use Ctrl+V to paste."},footnoteProperties:{title:"Footnote & Endnote Properties",footnotes:"Footnotes",endnotes:"Endnotes",position:"Position",numberFormat:"Number format",startAt:"Start at",numbering:"Numbering",footnotePositions:{bottomOfPage:"Bottom of page",belowText:"Below text"},endnotePositions:{endOfDocument:"End of document",endOfSection:"End of section"},numberingOptions:{continuous:"Continuous",restartSection:"Restart each section",restartPage:"Restart each page"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, †, ‡, ..."}},keyboardShortcuts:{ariaLabel:"Keyboard Shortcuts",searchPlaceholder:"Search shortcuts...",categories:{editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},shortcuts:{save:"Save",saveDescription:"Save document",print:"Print",printDescription:"Print document",undo:"Undo",undoDescription:"Undo last action",redo:"Redo",redoDescription:"Redo last action",delete:"Delete",deleteDescription:"Delete selected text",find:"Find",findDescription:"Find text in document",findReplace:"Find & Replace",findReplaceDescription:"Find and replace text",cut:"Cut",cutDescription:"Cut selected text",copy:"Copy",copyDescription:"Copy selected text",paste:"Paste",pasteDescription:"Paste from clipboard",pastePlainText:"Paste as Plain Text",pastePlainTextDescription:"Paste without formatting",bold:"Bold",boldDescription:"Toggle bold formatting",italic:"Italic",italicDescription:"Toggle italic formatting",underline:"Underline",underlineDescription:"Toggle underline formatting",strikethrough:"Strikethrough",strikethroughDescription:"Toggle strikethrough",subscript:"Subscript",subscriptDescription:"Toggle subscript",superscript:"Superscript",superscriptDescription:"Toggle superscript",alignLeft:"Align Left",alignLeftDescription:"Left align paragraph",alignCenter:"Align Center",alignCenterDescription:"Center align paragraph",alignRight:"Align Right",alignRightDescription:"Right align paragraph",justify:"Justify",justifyDescription:"Justify paragraph",increaseIndent:"Increase Indent",increaseIndentDescription:"Increase paragraph indent",decreaseIndent:"Decrease Indent",decreaseIndentDescription:"Decrease paragraph indent",selectAll:"Select All",selectAllDescription:"Select all content",selectWord:"Select Word",selectWordDescription:"Select current word",selectParagraph:"Select Paragraph",selectParagraphDescription:"Select current paragraph",extendSelectionByWord:"Extend Selection by Word",extendSelectionByWordDescription:"Extend selection to next/previous word",extendSelectionToLineEdge:"Extend Selection to Line Edge",extendSelectionToLineEdgeDescription:"Extend selection to line start/end",moveByWord:"Move by Word",moveByWordDescription:"Move cursor to next/previous word",moveToLineStart:"Move to Line Start",moveToLineStartDescription:"Move cursor to start of line",moveToLineEnd:"Move to Line End",moveToLineEndDescription:"Move cursor to end of line",moveToDocumentStart:"Move to Document Start",moveToDocumentStartDescription:"Move cursor to start of document",moveToDocumentEnd:"Move to Document End",moveToDocumentEndDescription:"Move cursor to end of document",pageUp:"Page Up",pageUpDescription:"Scroll up one page",pageDown:"Page Down",pageDownDescription:"Scroll down one page",zoomIn:"Zoom In",zoomInDescription:"Increase zoom level",zoomOut:"Zoom Out",zoomOutDescription:"Decrease zoom level",resetZoom:"Reset Zoom",resetZoomDescription:"Reset zoom to 100%",keyboardShortcuts:"Keyboard Shortcuts",keyboardShortcutsDescription:"Show this help dialog",insertLink:"Insert Link",insertLinkDescription:"Insert or edit hyperlink"},noResults:'No shortcuts found matching "{query}"',pressEscToClose:"Press {key} to close",or:"or"}},comments:{resolved:"Resolved",resolve:"Resolve",reopen:"Reopen",moreOptions:"More options",unknown:"Unknown",addComment:"Add a comment...",replyPlaceholder:"Reply or add others with @",replyCount:"{count, plural, one {# reply} other {# replies}}"},trackedChanges:{unknown:"Unknown",replaced:"Replaced",with:"with",added:"Added",deleted:"Deleted"},revisions:{paragraphMarkInserted:"Inserted paragraph break",paragraphMarkDeleted:"Deleted paragraph break",paragraphPropertiesChanged:"Changed paragraph properties",rowInserted:"Inserted row",rowDeleted:"Deleted row",rowPropertiesChanged:"Changed row properties",cellInserted:"Inserted cell",cellDeleted:"Deleted cell",cellMerged:"Merged cells",cellPropertiesChanged:"Changed cell properties",tablePropertiesChanged:"Changed table properties",tableInserted:"Inserted table",tableDeleted:"Deleted table"},contextMenu:{ariaLabel:"AI actions menu",textMenuAriaLabel:"Text editing menu",customPromptPlaceholder:"Enter custom prompt...",cut:"Cut",cutShortcut:"Ctrl+X",copy:"Copy",copyShortcut:"Ctrl+C",paste:"Paste",pasteShortcut:"Ctrl+V",pastePlainText:"Paste as Plain Text",pastePlainTextShortcut:"Ctrl+Shift+V",delete:"Delete",deleteShortcut:"Del",selectAll:"Select All",selectAllShortcut:"Ctrl+A",selected:"Selected:",aiActions:{askAi:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom"}},documentOutline:{ariaLabel:"Document outline",closeAriaLabel:"Close outline",closeTitle:"Close outline",title:"Outline",noHeadings:"No headings found. Add headings to your document to see them here."},sidebar:{ariaLabel:"Annotations sidebar"},viewer:{pageIndicator:"{current} of {total}"},titleBar:{untitled:"Untitled",documentNameAriaLabel:"Document name",menuBarAriaLabel:"Menu bar"},errors:{loadingDocument:"Loading document...",noDocumentLoaded:"No document loaded",failedToLoad:"Failed to Load Document",unableToParse:"Unable to Parse Document",somethingWentWrong:"Something went wrong",errorDescription:"An error occurred while rendering this component. Please try again or contact support if the problem persists.",errorLabel:"Error:",componentStack:"Component Stack:",tryAgain:"Try Again",showDetails:"Show details",hideDetails:"Hide details",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?"},table:{insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",selectTable:"Select entire table",mergeCells:"Merge cells",splitCell:"Split cell",editingTools:"Table editing tools",label:"Table:",cellFillColor:"Cell Fill Color",borderColor:"Border Color",borderWidth:"Border width",unknownAction:"Unknown Action",borders:{all:"All borders",outside:"Outside borders",inside:"Inside borders",none:"No borders",remove:"Remove borders",top:"Top border",bottom:"Bottom border",left:"Left border",right:"Right border",styleAriaLabel:"Border style",tooltip:"Borders"},moreOptions:"More table options",styles:{title:"Table Styles",label:"Styles",normalTable:"Normal Table",tableGrid:"Table Grid",gridTableLight:"Grid Table Light",plainTable1:"Plain Table 1",plainTable2:"Plain Table 2",plainTable3:"Plain Table 3",plainTable4:"Plain Table 4",gridTable1Light:"Grid Table 1 Light",gridTable4Accent1:"Grid Table 4 Accent 1",gridTable5Dark:"Grid Table 5 Dark",listTable3Accent2:"List Table 3 Accent 2",listTable4Accent3:"List Table 4 Accent 3",gridTable4Accent5:"Grid Table 4 Accent 5",gridTable4Accent6:"Grid Table 4 Accent 6"}},tableAdvanced:{verticalAlignment:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",cellMargins:"Cell margins",textDirection:"Text direction",textDirections:{horizontal:"Horizontal (LR)",verticalRL:"Vertical (top-bottom, RL)",verticalLR:"Vertical (bottom-top, LR)"},toggleNoWrap:"Toggle no-wrap",rowHeight:"Row height",heightRules:{auto:"Auto",atLeast:"At least",exact:"Exact"},rule:"Rule",height:"Height",toggleHeaderRow:"Toggle header row",distributeColumns:"Distribute columns evenly",autoFit:"Auto-fit to contents",tableProperties:"Table properties...",tableAlignment:"Table alignment",alignTableLeft:"Align table left",alignTableCenter:"Align table center",alignTableRight:"Align table right",tableOptionsMenu:"Table options menu",tableOptions:"Table options"},imageTransform:{tooltip:"Transform",rotateClockwise:"Rotate clockwise",rotateCounterClockwise:"Rotate counter-clockwise",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical"},imageWrap:{inline:"In Line with Text",floatLeft:"Square Left",floatRight:"Square Right",topAndBottom:"Top and Bottom",behindText:"Behind Text",inFrontOfText:"In Front of Text",tooltipPrefix:"Wrap: {label}",menu:{inLineWithText:"In Line with Text",squareLeft:"Square Left",squareRight:"Square Right",behindText:"Behind Text",inFrontOfText:"In Front of Text",ariaLabel:"Image layout options",imageProperties:"Image properties…"},menuDesc:{inLineWithText:"Image flows in the line as a glyph",squareLeft:"Image floats left, text wraps on the right",squareRight:"Image floats right, text wraps on the left",behindText:"Image paints behind body text",inFrontOfText:"Image paints over body text"}},responsePreview:{loading:"{action}...",result:"{action} Result",closeEsc:"Close (Esc)",editPrompt:"Edit the result before accepting:",changes:"Changes:",original:"Original:",new:"New:",cancelEdit:"Cancel Edit"},commentMarkers:{resolvedComment:"Resolved comment",comment:"Comment"},editor:{toggleCommentsSidebar:"Toggle comments sidebar",showDocumentOutline:"Show document outline",editing:"Editing",editingDescription:"Edit document directly",suggesting:"Suggesting",suggestingDescription:"Edits become suggestions",viewing:"Viewing",viewingDescription:"Read-only, no edits",failedToParse:"Failed to parse document",linkRemoved:"Link removed",linkCopied:"Link copied to clipboard",failedToSave:"Failed to save document"},hyperlinkPopup:{displayTextPlaceholder:"Display text",urlPlaceholder:"https://example.com",copyLink:"Copy link",editLink:"Edit link",removeLink:"Remove link"},headerFooter:{header:"Header",footer:"Footer",options:"Options",insertPageNumber:"Insert current page number",insertTotalPages:"Insert total page count",remove:"Remove {label}",closeEditing:"Close {label} editing"},image:{placeholder:"Image placeholder",placeholderText:"[Image]",editableAriaLabel:"Editable image"},imageOverlay:{rotate:"Rotate",imageProperties:"Image properties",deleteImage:"Delete image",replaceImage:"Replace image…"},ruler:{horizontal:"Horizontal ruler",vertical:"Vertical ruler",firstLineIndent:"First line indent",leftIndent:"Left indent",rightIndent:"Right indent",topMargin:"Top margin",bottomMargin:"Bottom margin"},print:{label:"Print",allPages:"All ({totalPages} pages)",singlePage:"Page {start}",pageRange:"Pages {start}-{end}"},unsaved:{unsaved:"Unsaved",saved:"Saved",unsavedTitle:"Document has unsaved changes",savedTitle:"All changes saved",unsavedAriaLabel:"Unsaved changes",savedAriaLabel:"All changes saved"},loading:{label:"Loading"},agentPanel:{defaultTitle:"Assistant",toggle:"Open assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant…",send:"Send",timeline:{working:"Working… {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}},gi=m$;function Iu(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function xb(t,e){if(!e)return t;const n={...t};for(const r of Object.keys(e)){const o=e[r];o!==null&&(Iu(t[r])&&Iu(o)?n[r]=xb(t[r],o):o!==void 0&&(n[r]=o))}return n}function g$(t,e){let n=t;for(const r of e.split(".")){if(!Iu(n))return;n=n[r]}return typeof n=="string"?n:void 0}function y$(t){const e={},n=/(=\d+|\w+)\s*\{([^}]*)\}/g;let r;for(;(r=n.exec(t))!==null;)e[r[1]]=r[2];return e}function b$(t,e,n){return e?t.replace(/\{(\w+),\s*plural,((?:[^{}]|\{[^{}]*\})*)\}/g,(o,i,l)=>{const a=Number(e[i]);if(isNaN(a))return o;const s=y$(l),c=s[`=${a}`];if(c!==void 0)return c.replace(/#/g,String(a));let d;try{d=new Intl.PluralRules(n||"en").select(a)}catch{d=a===1?"one":"other"}return(s[d]??s.other??"").replace(/#/g,String(a))}).replace(/\{(\w+)\}/g,(o,i)=>{const l=e[i];return l!==void 0?String(l):`{${i}}`}):t}function w$(t,e="en"){return(n,r)=>{const o=g$(t,n);return b$(o??n,r,e)}}var vb=S.createContext(gi),kb=S.createContext("en");function x$({i18n:t,children:e}){let n=typeof t?._lang=="string"?t._lang:"en",r=S.useMemo(()=>xb(gi,t),[t]);return b.jsx(kb.Provider,{value:n,children:b.jsx(vb.Provider,{value:r,children:e})})}function Re(){let t=S.useContext(vb),e=S.useContext(kb);return{t:S.useMemo(()=>w$(t,e),[t,e])}}var v$=340,k$=12,mc=176,C$=/[\p{L}\p{N}\p{M}_''\-]/u,S$=/\s/;function yd(t){return!t||t.length===0?!1:C$.test(t)}function bd(t){return!t||t.length===0?!1:S$.test(t)}function T$(t,e){if(!t||t.length===0)return[0,0];e=Math.max(0,Math.min(e,t.length-1));let n=t[e];if(bd(n)){let r=e,o=e;for(;r>0&&bd(t[r-1]);)r--;for(;o<t.length&&bd(t[o]);)o++;return[r,o]}if(yd(n)){let r=e,o=e;for(;r>0&&yd(t[r-1]);)r--;for(;o<t.length&&yd(t[o]);)o++;return[r,o]}return[e,e+1]}var wd={};const $$={},I$=Object.freeze(Object.defineProperty({__proto__:null,default:$$},Symbol.toStringTag,{value:"Module"})),M$=o$(I$);var pm;function R$(){return pm||(pm=1,(function(t){(function(e){e.parser=function(A,P){return new r(A,P)},e.SAXParser=r,e.SAXStream=u,e.createStream=c,e.MAX_BUFFER_LENGTH=64*1024;var n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(A,P){if(!(this instanceof r))return new r(A,P);var _=this;i(_),_.q=_.c="",_.bufferCheckPosition=e.MAX_BUFFER_LENGTH,_.encoding=null,_.opt=P||{},_.opt.lowercase=_.opt.lowercase||_.opt.lowercasetags,_.looseCase=_.opt.lowercase?"toLowerCase":"toUpperCase",_.opt.maxEntityCount=_.opt.maxEntityCount||512,_.opt.maxEntityDepth=_.opt.maxEntityDepth||4,_.entityCount=_.entityDepth=0,_.tags=[],_.closed=_.closedRoot=_.sawRoot=!1,_.tag=_.error=null,_.strict=!!A,_.noscript=!!(A||_.opt.noscript),_.state=I.BEGIN,_.strictEntities=_.opt.strictEntities,_.ENTITIES=_.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),_.attribList=[],_.opt.xmlns&&(_.ns=Object.create(y)),_.opt.unquotedAttributeValues===void 0&&(_.opt.unquotedAttributeValues=!A),_.trackPosition=_.opt.position!==!1,_.trackPosition&&(_.position=_.line=_.column=0),E(_,"onready")}Object.create||(Object.create=function(A){function P(){}P.prototype=A;var _=new P;return _}),Object.keys||(Object.keys=function(A){var P=[];for(var _ in A)A.hasOwnProperty(_)&&P.push(_);return P});function o(A){for(var P=Math.max(e.MAX_BUFFER_LENGTH,10),_=0,H=0,le=n.length;H<le;H++){var ue=A[n[H]].length;if(ue>P)switch(n[H]){case"textNode":z(A);break;case"cdata":O(A,"oncdata",A.cdata),A.cdata="";break;case"script":O(A,"onscript",A.script),A.script="";break;default:q(A,"Max buffer length exceeded: "+n[H])}_=Math.max(_,ue)}var ve=e.MAX_BUFFER_LENGTH-_;A.bufferCheckPosition=ve+A.position}function i(A){for(var P=0,_=n.length;P<_;P++)A[n[P]]=""}function l(A){z(A),A.cdata!==""&&(O(A,"oncdata",A.cdata),A.cdata=""),A.script!==""&&(O(A,"onscript",A.script),A.script="")}r.prototype={end:function(){Q(this)},write:te,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){l(this)}};var a;try{a=M$.Stream}catch{a=function(){}}a||(a=function(){});var s=e.EVENTS.filter(function(A){return A!=="error"&&A!=="end"});function c(A,P){return new u(A,P)}function d(A,P){if(A.length>=2){if(A[0]===255&&A[1]===254)return"utf-16le";if(A[0]===254&&A[1]===255)return"utf-16be"}return A.length>=3&&A[0]===239&&A[1]===187&&A[2]===191?"utf8":A.length>=4?A[0]===60&&A[1]===0&&A[2]===63&&A[3]===0?"utf-16le":A[0]===0&&A[1]===60&&A[2]===0&&A[3]===63?"utf-16be":"utf8":P?"utf8":null}function u(A,P){if(!(this instanceof u))return new u(A,P);a.apply(this),this._parser=new r(A,P),this.writable=!0,this.readable=!0;var _=this;this._parser.onend=function(){_.emit("end")},this._parser.onerror=function(H){_.emit("error",H),_._parser.error=null},this._decoder=null,this._decoderBuffer=null,s.forEach(function(H){Object.defineProperty(_,"on"+H,{get:function(){return _._parser["on"+H]},set:function(le){if(!le)return _.removeAllListeners(H),_._parser["on"+H]=le,le;_.on(H,le)},enumerable:!0,configurable:!1})})}u.prototype=Object.create(a.prototype,{constructor:{value:u}}),u.prototype._decodeBuffer=function(A,P){if(this._decoderBuffer&&(A=Buffer.concat([this._decoderBuffer,A]),this._decoderBuffer=null),!this._decoder){var _=d(A,P);if(!_)return this._decoderBuffer=A,"";this._parser.encoding=_,this._decoder=new TextDecoder(_)}return this._decoder.decode(A,{stream:!P})},u.prototype.write=function(A){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(A))A=this._decodeBuffer(A,!1);else if(this._decoderBuffer){var P=this._decodeBuffer(Buffer.alloc(0),!0);P&&(this._parser.write(P),this.emit("data",P))}return this._parser.write(A.toString()),this.emit("data",A),!0},u.prototype.end=function(A){if(A&&A.length&&this.write(A),this._decoderBuffer){var P=this._decodeBuffer(Buffer.alloc(0),!0);P&&(this._parser.write(P),this.emit("data",P))}else if(this._decoder){var _=this._decoder.decode();_&&(this._parser.write(_),this.emit("data",_))}return this._parser.end(),!0},u.prototype.on=function(A,P){var _=this;return!_._parser["on"+A]&&s.indexOf(A)!==-1&&(_._parser["on"+A]=function(){var H=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);H.splice(0,0,A),_.emit.apply(_,H)}),a.prototype.on.call(_,A,P)};var f=/^\[CDATA\[$/i,h=/^DOCTYPE$/i,p="http://www.w3.org/XML/1998/namespace",m="http://www.w3.org/2000/xmlns/",y={xml:p,xmlns:m},w=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,C=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,g=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,v=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function k(A){return A===" "||A===`
3
+ `||A==="\r"||A===" "}function x(A){return A==='"'||A==="'"}function T(A){return A===">"||k(A)}function $(A,P){return A.test(P)}function M(A,P){return!$(A,P)}var I=0;e.STATE={BEGIN:I++,BEGIN_WHITESPACE:I++,TEXT:I++,TEXT_ENTITY:I++,OPEN_WAKA:I++,SGML_DECL:I++,SGML_DECL_QUOTED:I++,DOCTYPE:I++,DOCTYPE_QUOTED:I++,DOCTYPE_DTD:I++,DOCTYPE_DTD_QUOTED:I++,COMMENT_STARTING:I++,COMMENT:I++,COMMENT_ENDING:I++,COMMENT_ENDED:I++,CDATA:I++,CDATA_ENDING:I++,CDATA_ENDING_2:I++,PROC_INST:I++,PROC_INST_BODY:I++,PROC_INST_ENDING:I++,OPEN_TAG:I++,OPEN_TAG_SLASH:I++,ATTRIB:I++,ATTRIB_NAME:I++,ATTRIB_NAME_SAW_WHITE:I++,ATTRIB_VALUE:I++,ATTRIB_VALUE_QUOTED:I++,ATTRIB_VALUE_CLOSED:I++,ATTRIB_VALUE_UNQUOTED:I++,ATTRIB_VALUE_ENTITY_Q:I++,ATTRIB_VALUE_ENTITY_U:I++,CLOSE_TAG:I++,CLOSE_TAG_SAW_WHITE:I++,SCRIPT:I++,SCRIPT_ENDING:I++},e.XML_ENTITIES=Object.assign(Object.create(null),{amp:"&",gt:">",lt:"<",quot:'"',apos:"'"}),e.ENTITIES=Object.assign(Object.create(null),{amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830}),Object.keys(e.ENTITIES).forEach(function(A){var P=e.ENTITIES[A],_=typeof P=="number"?String.fromCharCode(P):P;e.ENTITIES[A]=_});for(var F in e.STATE)e.STATE[e.STATE[F]]=F;I=e.STATE;function E(A,P,_){A[P]&&A[P](_)}function R(A){var P=A&&A.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return P?P[2]:null}function N(A){return A?A.toLowerCase().replace(/[^a-z0-9]/g,""):null}function B(A,P){const _=N(A),H=N(P);return!_||!H?!0:H==="utf16"?_==="utf16le"||_==="utf16be":_===H}function j(A,P){if(!(!A.strict||!A.encoding||!P||P.name!=="xml")){var _=R(P.body);_&&!B(A.encoding,_)&&X(A,"XML declaration encoding "+_+" does not match detected stream encoding "+A.encoding.toUpperCase())}}function O(A,P,_){A.textNode&&z(A),E(A,P,_)}function z(A){A.textNode=W(A.opt,A.textNode),A.textNode&&E(A,"ontext",A.textNode),A.textNode=""}function W(A,P){return A.trim&&(P=P.trim()),A.normalize&&(P=P.replace(/\s+/g," ")),P}function q(A,P){return z(A),A.trackPosition&&(P+=`
4
+ Line: `+A.line+`
5
+ Column: `+A.column+`
6
+ Char: `+A.c),P=new Error(P),A.error=P,E(A,"onerror",P),A}function Q(A){return A.sawRoot&&!A.closedRoot&&X(A,"Unclosed root tag"),A.state!==I.BEGIN&&A.state!==I.BEGIN_WHITESPACE&&A.state!==I.TEXT&&q(A,"Unexpected end"),z(A),A.c="",A.closed=!0,E(A,"onend"),r.call(A,A.strict,A.opt),A}function X(A,P){if(typeof A!="object"||!(A instanceof r))throw new Error("bad call to strictFail");A.strict&&q(A,P)}function se(A){A.strict||(A.tagName=A.tagName[A.looseCase]());var P=A.tags[A.tags.length-1]||A,_=A.tag={name:A.tagName,attributes:{}};A.opt.xmlns&&(_.ns=P.ns),A.attribList.length=0,O(A,"onopentagstart",_)}function ie(A,P){var _=A.indexOf(":"),H=_<0?["",A]:A.split(":"),le=H[0],ue=H[1];return P&&A==="xmlns"&&(le="xmlns",ue=""),{prefix:le,local:ue}}function ce(A){if(A.strict||(A.attribName=A.attribName[A.looseCase]()),A.attribList.indexOf(A.attribName)!==-1||A.tag.attributes.hasOwnProperty(A.attribName)){A.attribName=A.attribValue="";return}if(A.opt.xmlns){var P=ie(A.attribName,!0),_=P.prefix,H=P.local;if(_==="xmlns")if(H==="xml"&&A.attribValue!==p)X(A,"xml: prefix must be bound to "+p+`
7
+ Actual: `+A.attribValue);else if(H==="xmlns"&&A.attribValue!==m)X(A,"xmlns: prefix must be bound to "+m+`
8
+ Actual: `+A.attribValue);else{var le=A.tag,ue=A.tags[A.tags.length-1]||A;le.ns===ue.ns&&(le.ns=Object.create(ue.ns)),le.ns[H]=A.attribValue}A.attribList.push([A.attribName,A.attribValue])}else A.tag.attributes[A.attribName]=A.attribValue,O(A,"onattribute",{name:A.attribName,value:A.attribValue});A.attribName=A.attribValue=""}function Y(A,P){if(A.opt.xmlns){var _=A.tag,H=ie(A.tagName);_.prefix=H.prefix,_.local=H.local,_.uri=_.ns[H.prefix]||"",_.prefix&&!_.uri&&(X(A,"Unbound namespace prefix: "+JSON.stringify(A.tagName)),_.uri=H.prefix);var le=A.tags[A.tags.length-1]||A;_.ns&&le.ns!==_.ns&&Object.keys(_.ns).forEach(function(Lt){O(A,"onopennamespace",{prefix:Lt,uri:_.ns[Lt]})});for(var ue=0,ve=A.attribList.length;ue<ve;ue++){var Pe=A.attribList[ue],be=Pe[0],pe=Pe[1],Fe=ie(be,!0),Ae=Fe.prefix,yt=Fe.local,Me=Ae===""?"":_.ns[Ae]||"",Ue={name:be,value:pe,prefix:Ae,local:yt,uri:Me};Ae&&Ae!=="xmlns"&&!Me&&(X(A,"Unbound namespace prefix: "+JSON.stringify(Ae)),Ue.uri=Ae),A.tag.attributes[be]=Ue,O(A,"onattribute",Ue)}A.attribList.length=0}A.tag.isSelfClosing=!!P,A.sawRoot=!0,A.tags.push(A.tag),O(A,"onopentag",A.tag),P||(!A.noscript&&A.tagName.toLowerCase()==="script"?A.state=I.SCRIPT:A.state=I.TEXT,A.tag=null,A.tagName=""),A.attribName=A.attribValue="",A.attribList.length=0}function V(A){if(!A.tagName){X(A,"Weird empty close tag."),A.textNode+="</>",A.state=I.TEXT;return}if(A.script){if(A.tagName!=="script"){A.script+="</"+A.tagName+">",A.tagName="",A.state=I.SCRIPT;return}O(A,"onscript",A.script),A.script=""}var P=A.tags.length,_=A.tagName;A.strict||(_=_[A.looseCase]());for(var H=_;P--;){var le=A.tags[P];if(le.name!==H)X(A,"Unexpected close tag");else break}if(P<0){X(A,"Unmatched closing tag: "+A.tagName),A.textNode+="</"+A.tagName+">",A.state=I.TEXT;return}A.tagName=_;for(var ue=A.tags.length;ue-- >P;){var ve=A.tag=A.tags.pop();A.tagName=A.tag.name,O(A,"onclosetag",A.tagName);var Pe={};for(var be in ve.ns)Pe[be]=ve.ns[be];var pe=A.tags[A.tags.length-1]||A;A.opt.xmlns&&ve.ns!==pe.ns&&Object.keys(ve.ns).forEach(function(Fe){var Ae=ve.ns[Fe];O(A,"onclosenamespace",{prefix:Fe,uri:Ae})})}P===0&&(A.closedRoot=!0),A.tagName=A.attribValue=A.attribName="",A.attribList.length=0,A.state=I.TEXT}function Z(A){var P=A.entity,_=P.toLowerCase(),H,le="";return A.ENTITIES[P]?A.ENTITIES[P]:A.ENTITIES[_]?A.ENTITIES[_]:(P=_,P.charAt(0)==="#"&&(P.charAt(1)==="x"?(P=P.slice(2),H=parseInt(P,16),le=H.toString(16)):(P=P.slice(1),H=parseInt(P,10),le=H.toString(10))),P=P.replace(/^0+/,""),isNaN(H)||le.toLowerCase()!==P||H<0||H>1114111||!K(H)?(X(A,"Invalid character entity"),"&"+A.entity+";"):String.fromCodePoint(H))}function K(A){return A===9||A===10||A===13||A>=32&&A<=55295||A>=57344&&A<=65533||A>=65536&&A<=1114111}function ee(A,P){P==="<"?(A.state=I.OPEN_WAKA,A.startTagPosition=A.position):k(P)||(X(A,"Non-whitespace before first tag."),A.textNode=P,A.state=I.TEXT)}function G(A,P){var _="";return P<A.length&&(_=A.charAt(P)),_}function te(A){var P=this;if(this.error)throw this.error;if(P.closed)return q(P,"Cannot write after close. Assign an onready handler.");if(A===null)return Q(P);typeof A=="object"&&(A=A.toString());for(var _=0,H="";H=G(A,_++),P.c=H,!!H;)switch(P.trackPosition&&(P.position++,H===`
9
+ `?(P.line++,P.column=0):P.column++),P.state){case I.BEGIN:if(P.state=I.BEGIN_WHITESPACE,H==="\uFEFF")continue;ee(P,H);continue;case I.BEGIN_WHITESPACE:ee(P,H);continue;case I.TEXT:if(P.sawRoot&&!P.closedRoot){for(var ue=_-1;H&&H!=="<"&&H!=="&";)H=G(A,_++),H&&P.trackPosition&&(P.position++,H===`
10
+ `?(P.line++,P.column=0):P.column++);P.textNode+=A.substring(ue,_-1)}H==="<"&&!(P.sawRoot&&P.closedRoot&&!P.strict)?(P.state=I.OPEN_WAKA,P.startTagPosition=P.position):(!k(H)&&(!P.sawRoot||P.closedRoot)&&X(P,"Text data outside of root node."),H==="&"?P.state=I.TEXT_ENTITY:P.textNode+=H);continue;case I.SCRIPT:H==="<"?P.state=I.SCRIPT_ENDING:P.script+=H;continue;case I.SCRIPT_ENDING:H==="/"?P.state=I.CLOSE_TAG:(P.script+="<"+H,P.state=I.SCRIPT);continue;case I.OPEN_WAKA:if(H==="!")P.state=I.SGML_DECL,P.sgmlDecl="";else if(!k(H))if($(w,H))P.state=I.OPEN_TAG,P.tagName=H;else if(H==="/")P.state=I.CLOSE_TAG,P.tagName="";else if(H==="?")P.state=I.PROC_INST,P.procInstName=P.procInstBody="";else{if(X(P,"Unencoded <"),P.startTagPosition+1<P.position){var le=P.position-P.startTagPosition;H=new Array(le).join(" ")+H}P.textNode+="<"+H,P.state=I.TEXT}continue;case I.SGML_DECL:if(P.sgmlDecl+H==="--"){P.state=I.COMMENT,P.comment="",P.sgmlDecl="";continue}P.doctype&&P.doctype!==!0&&P.sgmlDecl?(P.state=I.DOCTYPE_DTD,P.doctype+="<!"+P.sgmlDecl+H,P.sgmlDecl=""):f.test(P.sgmlDecl+H)?(O(P,"onopencdata"),P.state=I.CDATA,P.sgmlDecl="",P.cdata=""):h.test(P.sgmlDecl+H)?(P.state=I.DOCTYPE,(P.doctype||P.sawRoot)&&X(P,"Inappropriately located doctype declaration"),P.doctype="",P.sgmlDecl=""):H===">"?(O(P,"onsgmldeclaration",P.sgmlDecl),P.sgmlDecl="",P.state=I.TEXT):(x(H)&&(P.state=I.SGML_DECL_QUOTED),P.sgmlDecl+=H);continue;case I.SGML_DECL_QUOTED:H===P.q&&(P.state=I.SGML_DECL,P.q=""),P.sgmlDecl+=H;continue;case I.DOCTYPE:H===">"?(P.state=I.TEXT,O(P,"ondoctype",P.doctype),P.doctype=!0):(P.doctype+=H,H==="["?P.state=I.DOCTYPE_DTD:x(H)&&(P.state=I.DOCTYPE_QUOTED,P.q=H));continue;case I.DOCTYPE_QUOTED:P.doctype+=H,H===P.q&&(P.q="",P.state=I.DOCTYPE);continue;case I.DOCTYPE_DTD:H==="]"?(P.doctype+=H,P.state=I.DOCTYPE):H==="<"?(P.state=I.OPEN_WAKA,P.startTagPosition=P.position):x(H)?(P.doctype+=H,P.state=I.DOCTYPE_DTD_QUOTED,P.q=H):P.doctype+=H;continue;case I.DOCTYPE_DTD_QUOTED:P.doctype+=H,H===P.q&&(P.state=I.DOCTYPE_DTD,P.q="");continue;case I.COMMENT:H==="-"?P.state=I.COMMENT_ENDING:P.comment+=H;continue;case I.COMMENT_ENDING:H==="-"?(P.state=I.COMMENT_ENDED,P.comment=W(P.opt,P.comment),P.comment&&O(P,"oncomment",P.comment),P.comment=""):(P.comment+="-"+H,P.state=I.COMMENT);continue;case I.COMMENT_ENDED:H!==">"?(X(P,"Malformed comment"),P.comment+="--"+H,P.state=I.COMMENT):P.doctype&&P.doctype!==!0?P.state=I.DOCTYPE_DTD:P.state=I.TEXT;continue;case I.CDATA:for(var ue=_-1;H&&H!=="]";)H=G(A,_++),H&&P.trackPosition&&(P.position++,H===`
11
+ `?(P.line++,P.column=0):P.column++);P.cdata+=A.substring(ue,_-1),H==="]"&&(P.state=I.CDATA_ENDING);continue;case I.CDATA_ENDING:H==="]"?P.state=I.CDATA_ENDING_2:(P.cdata+="]"+H,P.state=I.CDATA);continue;case I.CDATA_ENDING_2:H===">"?(P.cdata&&O(P,"oncdata",P.cdata),O(P,"onclosecdata"),P.cdata="",P.state=I.TEXT):H==="]"?P.cdata+="]":(P.cdata+="]]"+H,P.state=I.CDATA);continue;case I.PROC_INST:H==="?"?P.state=I.PROC_INST_ENDING:k(H)?P.state=I.PROC_INST_BODY:P.procInstName+=H;continue;case I.PROC_INST_BODY:if(!P.procInstBody&&k(H))continue;H==="?"?P.state=I.PROC_INST_ENDING:P.procInstBody+=H;continue;case I.PROC_INST_ENDING:if(H===">"){const pe={name:P.procInstName,body:P.procInstBody};j(P,pe),O(P,"onprocessinginstruction",pe),P.procInstName=P.procInstBody="",P.state=I.TEXT}else P.procInstBody+="?"+H,P.state=I.PROC_INST_BODY;continue;case I.OPEN_TAG:$(C,H)?P.tagName+=H:(se(P),H===">"?Y(P):H==="/"?P.state=I.OPEN_TAG_SLASH:(k(H)||X(P,"Invalid character in tag name"),P.state=I.ATTRIB));continue;case I.OPEN_TAG_SLASH:H===">"?(Y(P,!0),V(P)):(X(P,"Forward-slash in opening tag not followed by >"),P.state=I.ATTRIB);continue;case I.ATTRIB:if(k(H))continue;H===">"?Y(P):H==="/"?P.state=I.OPEN_TAG_SLASH:$(w,H)?(P.attribName=H,P.attribValue="",P.state=I.ATTRIB_NAME):X(P,"Invalid attribute name");continue;case I.ATTRIB_NAME:H==="="?P.state=I.ATTRIB_VALUE:H===">"?(X(P,"Attribute without value"),P.attribValue=P.attribName,ce(P),Y(P)):k(H)?P.state=I.ATTRIB_NAME_SAW_WHITE:$(C,H)?P.attribName+=H:X(P,"Invalid attribute name");continue;case I.ATTRIB_NAME_SAW_WHITE:if(H==="=")P.state=I.ATTRIB_VALUE;else{if(k(H))continue;X(P,"Attribute without value"),P.tag.attributes[P.attribName]="",P.attribValue="",O(P,"onattribute",{name:P.attribName,value:""}),P.attribName="",H===">"?Y(P):$(w,H)?(P.attribName=H,P.state=I.ATTRIB_NAME):(X(P,"Invalid attribute name"),P.state=I.ATTRIB)}continue;case I.ATTRIB_VALUE:if(k(H))continue;x(H)?(P.q=H,P.state=I.ATTRIB_VALUE_QUOTED):(P.opt.unquotedAttributeValues||q(P,"Unquoted attribute value"),P.state=I.ATTRIB_VALUE_UNQUOTED,P.attribValue=H);continue;case I.ATTRIB_VALUE_QUOTED:if(H!==P.q){H==="&"?P.state=I.ATTRIB_VALUE_ENTITY_Q:P.attribValue+=H;continue}ce(P),P.q="",P.state=I.ATTRIB_VALUE_CLOSED;continue;case I.ATTRIB_VALUE_CLOSED:k(H)?P.state=I.ATTRIB:H===">"?Y(P):H==="/"?P.state=I.OPEN_TAG_SLASH:$(w,H)?(X(P,"No whitespace between attributes"),P.attribName=H,P.attribValue="",P.state=I.ATTRIB_NAME):X(P,"Invalid attribute name");continue;case I.ATTRIB_VALUE_UNQUOTED:if(!T(H)){H==="&"?P.state=I.ATTRIB_VALUE_ENTITY_U:P.attribValue+=H;continue}ce(P),H===">"?Y(P):P.state=I.ATTRIB;continue;case I.CLOSE_TAG:if(P.tagName)H===">"?V(P):$(C,H)?P.tagName+=H:P.script?(P.script+="</"+P.tagName+H,P.tagName="",P.state=I.SCRIPT):(k(H)||X(P,"Invalid tagname in closing tag"),P.state=I.CLOSE_TAG_SAW_WHITE);else{if(k(H))continue;M(w,H)?P.script?(P.script+="</"+H,P.state=I.SCRIPT):X(P,"Invalid tagname in closing tag."):P.tagName=H}continue;case I.CLOSE_TAG_SAW_WHITE:if(k(H))continue;H===">"?V(P):X(P,"Invalid characters in closing tag");continue;case I.TEXT_ENTITY:case I.ATTRIB_VALUE_ENTITY_Q:case I.ATTRIB_VALUE_ENTITY_U:var ve,Pe;switch(P.state){case I.TEXT_ENTITY:ve=I.TEXT,Pe="textNode";break;case I.ATTRIB_VALUE_ENTITY_Q:ve=I.ATTRIB_VALUE_QUOTED,Pe="attribValue";break;case I.ATTRIB_VALUE_ENTITY_U:ve=I.ATTRIB_VALUE_UNQUOTED,Pe="attribValue";break}if(H===";"){var be=Z(P);P.opt.unparsedEntities&&!Object.values(e.XML_ENTITIES).includes(be)?((P.entityCount+=1)>P.opt.maxEntityCount&&q(P,"Parsed entity count exceeds max entity count"),(P.entityDepth+=1)>P.opt.maxEntityDepth&&q(P,"Parsed entity depth exceeds max entity depth"),P.entity="",P.state=ve,P.write(be),P.entityDepth-=1):(P[Pe]+=be,P.entity="",P.state=ve)}else $(P.entity.length?v:g,H)?P.entity+=H:(X(P,"Invalid character in entity name"),P[Pe]+="&"+P.entity+H,P.entity="",P.state=ve);continue;default:throw new Error(P,"Unknown state: "+P.state)}return P.position>=P.bufferCheckPosition&&o(P),P}String.fromCodePoint||(function(){var A=String.fromCharCode,P=Math.floor,_=function(){var H=16384,le=[],ue,ve,Pe=-1,be=arguments.length;if(!be)return"";for(var pe="";++Pe<be;){var Fe=Number(arguments[Pe]);if(!isFinite(Fe)||Fe<0||Fe>1114111||P(Fe)!==Fe)throw RangeError("Invalid code point: "+Fe);Fe<=65535?le.push(Fe):(Fe-=65536,ue=(Fe>>10)+55296,ve=Fe%1024+56320,le.push(ue,ve)),(Pe+1===be||le.length>H)&&(pe+=A.apply(null,le),le.length=0)}return pe};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:_,configurable:!0,writable:!0}):String.fromCodePoint=_})()})(t)})(wd)),wd}var xd,hm;function qf(){return hm||(hm=1,xd={isArray:function(t){return Array.isArray?Array.isArray(t):Object.prototype.toString.call(t)==="[object Array]"}}),xd}var vd,mm;function Zf(){if(mm)return vd;mm=1;var t=qf().isArray;return vd={copyOptions:function(e){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r},ensureFlagExists:function(e,n){(!(e in n)||typeof n[e]!="boolean")&&(n[e]=!1)},ensureSpacesExists:function(e){(!("spaces"in e)||typeof e.spaces!="number"&&typeof e.spaces!="string")&&(e.spaces=0)},ensureAlwaysArrayExists:function(e){(!("alwaysArray"in e)||typeof e.alwaysArray!="boolean"&&!t(e.alwaysArray))&&(e.alwaysArray=!1)},ensureKeyExists:function(e,n){(!(e+"Key"in n)||typeof n[e+"Key"]!="string")&&(n[e+"Key"]=n.compact?"_"+e:e)},checkFnExists:function(e,n){return e+"Fn"in n}},vd}var kd,gm;function Cb(){if(gm)return kd;gm=1;var t=R$(),e=Zf(),n=qf().isArray,r,o;function i(w){return r=e.copyOptions(w),e.ensureFlagExists("ignoreDeclaration",r),e.ensureFlagExists("ignoreInstruction",r),e.ensureFlagExists("ignoreAttributes",r),e.ensureFlagExists("ignoreText",r),e.ensureFlagExists("ignoreComment",r),e.ensureFlagExists("ignoreCdata",r),e.ensureFlagExists("ignoreDoctype",r),e.ensureFlagExists("compact",r),e.ensureFlagExists("alwaysChildren",r),e.ensureFlagExists("addParent",r),e.ensureFlagExists("trim",r),e.ensureFlagExists("nativeType",r),e.ensureFlagExists("nativeTypeAttributes",r),e.ensureFlagExists("sanitize",r),e.ensureFlagExists("instructionHasAttributes",r),e.ensureFlagExists("captureSpacesBetweenElements",r),e.ensureAlwaysArrayExists(r),e.ensureKeyExists("declaration",r),e.ensureKeyExists("instruction",r),e.ensureKeyExists("attributes",r),e.ensureKeyExists("text",r),e.ensureKeyExists("comment",r),e.ensureKeyExists("cdata",r),e.ensureKeyExists("doctype",r),e.ensureKeyExists("type",r),e.ensureKeyExists("name",r),e.ensureKeyExists("elements",r),e.ensureKeyExists("parent",r),e.checkFnExists("doctype",r),e.checkFnExists("instruction",r),e.checkFnExists("cdata",r),e.checkFnExists("comment",r),e.checkFnExists("text",r),e.checkFnExists("instructionName",r),e.checkFnExists("elementName",r),e.checkFnExists("attributeName",r),e.checkFnExists("attributeValue",r),e.checkFnExists("attributes",r),r}function l(w){var C=Number(w);if(!isNaN(C))return C;var g=w.toLowerCase();return g==="true"?!0:g==="false"?!1:w}function a(w,C){var g;if(r.compact){if(!o[r[w+"Key"]]&&(n(r.alwaysArray)?r.alwaysArray.indexOf(r[w+"Key"])!==-1:r.alwaysArray)&&(o[r[w+"Key"]]=[]),o[r[w+"Key"]]&&!n(o[r[w+"Key"]])&&(o[r[w+"Key"]]=[o[r[w+"Key"]]]),w+"Fn"in r&&typeof C=="string"&&(C=r[w+"Fn"](C,o)),w==="instruction"&&("instructionFn"in r||"instructionNameFn"in r)){for(g in C)if(C.hasOwnProperty(g))if("instructionFn"in r)C[g]=r.instructionFn(C[g],g,o);else{var v=C[g];delete C[g],C[r.instructionNameFn(g,v,o)]=v}}n(o[r[w+"Key"]])?o[r[w+"Key"]].push(C):o[r[w+"Key"]]=C}else{o[r.elementsKey]||(o[r.elementsKey]=[]);var k={};if(k[r.typeKey]=w,w==="instruction"){for(g in C)if(C.hasOwnProperty(g))break;k[r.nameKey]="instructionNameFn"in r?r.instructionNameFn(g,C,o):g,r.instructionHasAttributes?(k[r.attributesKey]=C[g][r.attributesKey],"instructionFn"in r&&(k[r.attributesKey]=r.instructionFn(k[r.attributesKey],g,o))):("instructionFn"in r&&(C[g]=r.instructionFn(C[g],g,o)),k[r.instructionKey]=C[g])}else w+"Fn"in r&&(C=r[w+"Fn"](C,o)),k[r[w+"Key"]]=C;r.addParent&&(k[r.parentKey]=o),o[r.elementsKey].push(k)}}function s(w){if("attributesFn"in r&&w&&(w=r.attributesFn(w,o)),(r.trim||"attributeValueFn"in r||"attributeNameFn"in r||r.nativeTypeAttributes)&&w){var C;for(C in w)if(w.hasOwnProperty(C)&&(r.trim&&(w[C]=w[C].trim()),r.nativeTypeAttributes&&(w[C]=l(w[C])),"attributeValueFn"in r&&(w[C]=r.attributeValueFn(w[C],C,o)),"attributeNameFn"in r)){var g=w[C];delete w[C],w[r.attributeNameFn(C,w[C],o)]=g}}return w}function c(w){var C={};if(w.body&&(w.name.toLowerCase()==="xml"||r.instructionHasAttributes)){for(var g=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,v;(v=g.exec(w.body))!==null;)C[v[1]]=v[2]||v[3]||v[4];C=s(C)}if(w.name.toLowerCase()==="xml"){if(r.ignoreDeclaration)return;o[r.declarationKey]={},Object.keys(C).length&&(o[r.declarationKey][r.attributesKey]=C),r.addParent&&(o[r.declarationKey][r.parentKey]=o)}else{if(r.ignoreInstruction)return;r.trim&&(w.body=w.body.trim());var k={};r.instructionHasAttributes&&Object.keys(C).length?(k[w.name]={},k[w.name][r.attributesKey]=C):k[w.name]=w.body,a("instruction",k)}}function d(w,C){var g;if(typeof w=="object"&&(C=w.attributes,w=w.name),C=s(C),"elementNameFn"in r&&(w=r.elementNameFn(w,o)),r.compact){if(g={},!r.ignoreAttributes&&C&&Object.keys(C).length){g[r.attributesKey]={};var v;for(v in C)C.hasOwnProperty(v)&&(g[r.attributesKey][v]=C[v])}!(w in o)&&(n(r.alwaysArray)?r.alwaysArray.indexOf(w)!==-1:r.alwaysArray)&&(o[w]=[]),o[w]&&!n(o[w])&&(o[w]=[o[w]]),n(o[w])?o[w].push(g):o[w]=g}else o[r.elementsKey]||(o[r.elementsKey]=[]),g={},g[r.typeKey]="element",g[r.nameKey]=w,!r.ignoreAttributes&&C&&Object.keys(C).length&&(g[r.attributesKey]=C),r.alwaysChildren&&(g[r.elementsKey]=[]),o[r.elementsKey].push(g);g[r.parentKey]=o,o=g}function u(w){r.ignoreText||!w.trim()&&!r.captureSpacesBetweenElements||(r.trim&&(w=w.trim()),r.nativeType&&(w=l(w)),r.sanitize&&(w=w.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")),a("text",w))}function f(w){r.ignoreComment||(r.trim&&(w=w.trim()),a("comment",w))}function h(w){var C=o[r.parentKey];r.addParent||delete o[r.parentKey],o=C}function p(w){r.ignoreCdata||(r.trim&&(w=w.trim()),a("cdata",w))}function m(w){r.ignoreDoctype||(w=w.replace(/^ /,""),r.trim&&(w=w.trim()),a("doctype",w))}function y(w){w.note=w}return kd=function(w,C){var g=t.parser(!0,{}),v={};if(o=v,r=i(C),g.opt={strictEntities:!0},g.onopentag=d,g.ontext=u,g.oncomment=f,g.onclosetag=h,g.onerror=y,g.oncdata=p,g.ondoctype=m,g.onprocessinginstruction=c,g.write(w).close(),v[r.elementsKey]){var k=v[r.elementsKey];delete v[r.elementsKey],v[r.elementsKey]=k,delete v.text}return v},kd}var Cd,ym;function P$(){if(ym)return Cd;ym=1;var t=Zf(),e=Cb();function n(r){var o=t.copyOptions(r);return t.ensureSpacesExists(o),o}return Cd=function(r,o){var i,l,a,s;return i=n(o),l=e(r,i),s="compact"in i&&i.compact?"_parent":"parent","addParent"in i&&i.addParent?a=JSON.stringify(l,function(c,d){return c===s?"_":d},i.spaces):a=JSON.stringify(l,null,i.spaces),a.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Cd}var Sd,bm;function Sb(){if(bm)return Sd;bm=1;var t=Zf(),e=qf().isArray,n,r;function o(g){var v=t.copyOptions(g);return t.ensureFlagExists("ignoreDeclaration",v),t.ensureFlagExists("ignoreInstruction",v),t.ensureFlagExists("ignoreAttributes",v),t.ensureFlagExists("ignoreText",v),t.ensureFlagExists("ignoreComment",v),t.ensureFlagExists("ignoreCdata",v),t.ensureFlagExists("ignoreDoctype",v),t.ensureFlagExists("compact",v),t.ensureFlagExists("indentText",v),t.ensureFlagExists("indentCdata",v),t.ensureFlagExists("indentAttributes",v),t.ensureFlagExists("indentInstruction",v),t.ensureFlagExists("fullTagEmptyElement",v),t.ensureFlagExists("noQuotesForNativeAttributes",v),t.ensureSpacesExists(v),typeof v.spaces=="number"&&(v.spaces=Array(v.spaces+1).join(" ")),t.ensureKeyExists("declaration",v),t.ensureKeyExists("instruction",v),t.ensureKeyExists("attributes",v),t.ensureKeyExists("text",v),t.ensureKeyExists("comment",v),t.ensureKeyExists("cdata",v),t.ensureKeyExists("doctype",v),t.ensureKeyExists("type",v),t.ensureKeyExists("name",v),t.ensureKeyExists("elements",v),t.checkFnExists("doctype",v),t.checkFnExists("instruction",v),t.checkFnExists("cdata",v),t.checkFnExists("comment",v),t.checkFnExists("text",v),t.checkFnExists("instructionName",v),t.checkFnExists("elementName",v),t.checkFnExists("attributeName",v),t.checkFnExists("attributeValue",v),t.checkFnExists("attributes",v),t.checkFnExists("fullTagEmptyElement",v),v}function i(g,v,k){return(!k&&g.spaces?`
12
+ `:"")+Array(v+1).join(g.spaces)}function l(g,v,k){if(v.ignoreAttributes)return"";"attributesFn"in v&&(g=v.attributesFn(g,r,n));var x,T,$,M,I=[];for(x in g)g.hasOwnProperty(x)&&g[x]!==null&&g[x]!==void 0&&(M=v.noQuotesForNativeAttributes&&typeof g[x]!="string"?"":'"',T=""+g[x],T=T.replace(/"/g,"&quot;"),$="attributeNameFn"in v?v.attributeNameFn(x,T,r,n):x,I.push(v.spaces&&v.indentAttributes?i(v,k+1,!1):" "),I.push($+"="+M+("attributeValueFn"in v?v.attributeValueFn(T,x,r,n):T)+M));return g&&Object.keys(g).length&&v.spaces&&v.indentAttributes&&I.push(i(v,k,!1)),I.join("")}function a(g,v,k){return n=g,r="xml",v.ignoreDeclaration?"":"<?xml"+l(g[v.attributesKey],v,k)+"?>"}function s(g,v,k){if(v.ignoreInstruction)return"";var x;for(x in g)if(g.hasOwnProperty(x))break;var T="instructionNameFn"in v?v.instructionNameFn(x,g[x],r,n):x;if(typeof g[x]=="object")return n=g,r=T,"<?"+T+l(g[x][v.attributesKey],v,k)+"?>";var $=g[x]?g[x]:"";return"instructionFn"in v&&($=v.instructionFn($,x,r,n)),"<?"+T+($?" "+$:"")+"?>"}function c(g,v){return v.ignoreComment?"":"<!--"+("commentFn"in v?v.commentFn(g,r,n):g)+"-->"}function d(g,v){return v.ignoreCdata?"":"<![CDATA["+("cdataFn"in v?v.cdataFn(g,r,n):g.replace("]]>","]]]]><![CDATA[>"))+"]]>"}function u(g,v){return v.ignoreDoctype?"":"<!DOCTYPE "+("doctypeFn"in v?v.doctypeFn(g,r,n):g)+">"}function f(g,v){return v.ignoreText?"":(g=""+g,g=g.replace(/&amp;/g,"&"),g=g.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),"textFn"in v?v.textFn(g,r,n):g)}function h(g,v){var k;if(g.elements&&g.elements.length)for(k=0;k<g.elements.length;++k)switch(g.elements[k][v.typeKey]){case"text":if(v.indentText)return!0;break;case"cdata":if(v.indentCdata)return!0;break;case"instruction":if(v.indentInstruction)return!0;break;case"doctype":case"comment":case"element":return!0;default:return!0}return!1}function p(g,v,k){n=g,r=g.name;var x=[],T="elementNameFn"in v?v.elementNameFn(g.name,g):g.name;x.push("<"+T),g[v.attributesKey]&&x.push(l(g[v.attributesKey],v,k));var $=g[v.elementsKey]&&g[v.elementsKey].length||g[v.attributesKey]&&g[v.attributesKey]["xml:space"]==="preserve";return $||("fullTagEmptyElementFn"in v?$=v.fullTagEmptyElementFn(g.name,g):$=v.fullTagEmptyElement),$?(x.push(">"),g[v.elementsKey]&&g[v.elementsKey].length&&(x.push(m(g[v.elementsKey],v,k+1)),n=g,r=g.name),x.push(v.spaces&&h(g,v)?`
13
+ `+Array(k+1).join(v.spaces):""),x.push("</"+T+">")):x.push("/>"),x.join("")}function m(g,v,k,x){return g.reduce(function(T,$){var M=i(v,k,x&&!T);switch($.type){case"element":return T+M+p($,v,k);case"comment":return T+M+c($[v.commentKey],v);case"doctype":return T+M+u($[v.doctypeKey],v);case"cdata":return T+(v.indentCdata?M:"")+d($[v.cdataKey],v);case"text":return T+(v.indentText?M:"")+f($[v.textKey],v);case"instruction":var I={};return I[$[v.nameKey]]=$[v.attributesKey]?$:$[v.instructionKey],T+(v.indentInstruction?M:"")+s(I,v,k)}},"")}function y(g,v,k){var x;for(x in g)if(g.hasOwnProperty(x))switch(x){case v.parentKey:case v.attributesKey:break;case v.textKey:if(v.indentText||k)return!0;break;case v.cdataKey:if(v.indentCdata||k)return!0;break;case v.instructionKey:if(v.indentInstruction||k)return!0;break;case v.doctypeKey:case v.commentKey:return!0;default:return!0}return!1}function w(g,v,k,x,T){n=g,r=v;var $="elementNameFn"in k?k.elementNameFn(v,g):v;if(typeof g>"u"||g===null||g==="")return"fullTagEmptyElementFn"in k&&k.fullTagEmptyElementFn(v,g)||k.fullTagEmptyElement?"<"+$+"></"+$+">":"<"+$+"/>";var M=[];if(v){if(M.push("<"+$),typeof g!="object")return M.push(">"+f(g,k)+"</"+$+">"),M.join("");g[k.attributesKey]&&M.push(l(g[k.attributesKey],k,x));var I=y(g,k,!0)||g[k.attributesKey]&&g[k.attributesKey]["xml:space"]==="preserve";if(I||("fullTagEmptyElementFn"in k?I=k.fullTagEmptyElementFn(v,g):I=k.fullTagEmptyElement),I)M.push(">");else return M.push("/>"),M.join("")}return M.push(C(g,k,x+1,!1)),n=g,r=v,v&&M.push((T?i(k,x,!1):"")+"</"+$+">"),M.join("")}function C(g,v,k,x){var T,$,M,I=[];for($ in g)if(g.hasOwnProperty($))for(M=e(g[$])?g[$]:[g[$]],T=0;T<M.length;++T){switch($){case v.declarationKey:I.push(a(M[T],v,k));break;case v.instructionKey:I.push((v.indentInstruction?i(v,k,x):"")+s(M[T],v,k));break;case v.attributesKey:case v.parentKey:break;case v.textKey:I.push((v.indentText?i(v,k,x):"")+f(M[T],v));break;case v.cdataKey:I.push((v.indentCdata?i(v,k,x):"")+d(M[T],v));break;case v.doctypeKey:I.push(i(v,k,x)+u(M[T],v));break;case v.commentKey:I.push(i(v,k,x)+c(M[T],v));break;default:I.push(i(v,k,x)+w(M[T],$,v,k,y(M[T],v)))}x=x&&!I.length}return I.join("")}return Sd=function(g,v){v=o(v);var k=[];return n=g,r="_root_",v.compact?k.push(C(g,v,0,!0)):(g[v.declarationKey]&&k.push(a(g[v.declarationKey],v,0)),g[v.elementsKey]&&g[v.elementsKey].length&&k.push(m(g[v.elementsKey],v,0,!k.length))),k.join("")},Sd}var Td,wm;function E$(){if(wm)return Td;wm=1;var t=Sb();return Td=function(e,n){e instanceof Buffer&&(e=e.toString());var r=null;if(typeof e=="string")try{r=JSON.parse(e)}catch{throw new Error("The JSON structure is invalid")}else r=e;return t(r,n)},Td}var $d,xm;function F$(){if(xm)return $d;xm=1;var t=Cb(),e=P$(),n=Sb(),r=E$();return $d={xml2js:t,xml2json:e,js2xml:n,json2xml:r},$d}var Tb=F$(),A$=/&(?!(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#x[0-9a-fA-F]+);)/g;function D$(t){return t.replace(A$,"&amp;")}function Tr(t){let e=D$(t);try{return Tb.xml2js(e,{compact:!1,ignoreComment:!0,ignoreInstruction:!0,ignoreDoctype:!0,alwaysArray:!1,trim:!1,captureSpacesBetweenElements:!0,attributesKey:"attributes",textKey:"text"})}catch(n){if(!(n instanceof Error))throw n;let r=n.message.match(/Column:\s*(\d+)/);if(r){let o=parseInt(r[1],10),i=Math.max(0,o-30),l=JSON.stringify(e.slice(i,o+30)),a=new Error(`${n.message}
14
+ Near: ${l}`);throw a.stack=n.stack,a}throw n}}function Al(t){return Tb.js2xml({elements:[t]},{compact:!1,spaces:0})}function Go(t){try{let e=Tr(t);return e.elements&&e.elements.length>0?e.elements.find(n=>n.type==="element")??null:e}catch(e){return console.warn("Failed to parse XML:",e),null}}function Mn(t){let e=t.indexOf(":");return e>=0?t.substring(e+1):t}function $b(t,e,n){if(!t.name)return!1;let r=`${e}:${n}`;return t.name===r||Mn(t.name)===n}function L(t,e,n){if(!t||!t.elements)return null;let r=`${e}:${n}`;for(let o of t.elements)if(o.type==="element"&&(o.name===r||Mn(o.name||"")===n))return o;return null}function ht(t,e,n){if(!t||!t.elements)return[];let r=`${e}:${n}`,o=[];for(let i of t.elements)i.type==="element"&&(i.name===r||Mn(i.name||"")===n)&&o.push(i);return o}function Be(t,e){if(!t||!t.elements)return null;for(let n of t.elements)if(n.type==="element"&&n.name===e)return n;return null}function je(t){return!t||!t.elements?[]:t.elements.filter(e=>e.type==="element")}function D(t,e,n){if(!t||!t.attributes)return null;let r=t.attributes;if(e){let o=`${e}:${n}`;if(o in r)return r[o]}return n in r?r[n]:null}function Do(t){if(!t)return"";if("text"in t&&typeof t.text=="string")return t.text;if(!t.elements)return"";let e="";for(let n of t.elements)n.type==="text"&&"text"in n?e+=n.text??"":n.type==="element"&&(e+=Do(n));return e}function J(t,e,n,r=1){let o=D(t,e,n);if(o===null)return;let i=parseInt(o,10);if(!isNaN(i))return i*r}function fe(t,e="w"){if(!t)return!1;let n=D(t,e,"val");return n===null?!0:!(n==="0"||n==="false"||n==="off")}function Ib(t,e,n){if(!t)return null;if($b(t,e,n))return t;if(t.elements)for(let r of t.elements){if(r.type!=="element")continue;let o=Ib(r,e,n);if(o)return o}return null}function ll(t,e,n){let r=[];function o(i){if(i&&($b(i,e,n)&&r.push(i),i.elements))for(let l of i.elements)l.type==="element"&&o(l)}return o(t),r}var pt={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",footnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",endnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",webSettings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",oleObject:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",diagramData:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",customProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",customXml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};function $s(t){let e=new Map;if(!t||t.trim().length===0)return e;let n=Go(t);if(!n)return console.warn("Failed to parse relationships XML"),e;let r=je(n);for(let o of r){let i=o.name||"";if(!i.endsWith("Relationship")&&!i.includes(":Relationship"))continue;let l=D(o,null,"Id"),a=D(o,null,"Type"),s=D(o,null,"Target"),c=D(o,null,"TargetMode");if(!l||!a||!s){console.warn("Relationship missing required attributes:",{id:l,type:a,target:s});continue}let d={id:l,type:a,target:s};c==="External"?d.targetMode="External":c==="Internal"&&(d.targetMode="Internal"),e.set(l,d)}return e}function Mb(t,e){return t.get(e)?.target}var N$={calibri:{googleFont:"Carlito",category:"sans-serif",fallbackStack:["Calibri","Carlito","Arial","Helvetica","sans-serif"],singleLineRatio:1.2207},cambria:{googleFont:"Caladea",category:"serif",fallbackStack:["Cambria","Caladea","Georgia","serif"],singleLineRatio:1.2676},arial:{googleFont:"Arimo",category:"sans-serif",fallbackStack:["Arial","Arimo","Helvetica","sans-serif"],singleLineRatio:1.1172},"times new roman":{googleFont:"Tinos",category:"serif",fallbackStack:["Times New Roman","Tinos","Times","serif"],singleLineRatio:1.1074},"courier new":{googleFont:"Cousine",category:"monospace",fallbackStack:["Courier New","Cousine","Courier","monospace"],singleLineRatio:1.1328},georgia:{googleFont:"Tinos",category:"serif",fallbackStack:["Georgia","Tinos","Times New Roman","serif"],singleLineRatio:1.1362},verdana:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Verdana","Open Sans","Arial","sans-serif"],singleLineRatio:1.2153},tahoma:{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Tahoma","Open Sans","Arial","sans-serif"],singleLineRatio:1.2075},"trebuchet ms":{googleFont:"Fira Sans",category:"sans-serif",fallbackStack:["Trebuchet MS","Fira Sans","Arial","sans-serif"],singleLineRatio:1.1431},"comic sans ms":{googleFont:"Comic Neue",category:"cursive",fallbackStack:["Comic Sans MS","Comic Neue","cursive"],singleLineRatio:1.3936},impact:{googleFont:"Anton",category:"sans-serif",fallbackStack:["Impact","Anton","Arial Black","sans-serif"],singleLineRatio:1.2197},"palatino linotype":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Palatino Linotype","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},"book antiqua":{googleFont:"EB Garamond",category:"serif",fallbackStack:["Book Antiqua","EB Garamond","Palatino","Georgia","serif"],singleLineRatio:1.0259},garamond:{googleFont:"EB Garamond",category:"serif",fallbackStack:["Garamond","EB Garamond","Georgia","serif"],singleLineRatio:1.068},"century gothic":{googleFont:"Questrial",category:"sans-serif",fallbackStack:["Century Gothic","Questrial","Arial","sans-serif"],singleLineRatio:1.1611},"lucida sans":{googleFont:"Open Sans",category:"sans-serif",fallbackStack:["Lucida Sans","Open Sans","Arial","sans-serif"],singleLineRatio:1.1655},"lucida console":{googleFont:"Cousine",category:"monospace",fallbackStack:["Lucida Console","Cousine","Courier New","monospace"],singleLineRatio:1.1387},consolas:{googleFont:"Inconsolata",category:"monospace",fallbackStack:["Consolas","Inconsolata","Cousine","Courier New","monospace"],singleLineRatio:1.1626},"ms mincho":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","Noto Serif JP","serif"],singleLineRatio:1.15},"ms 明朝":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS Mincho","MS 明朝","Noto Serif JP","serif"],singleLineRatio:1.15},"ms p明朝":{googleFont:"Noto Serif JP",category:"serif",fallbackStack:["MS PMincho","MS P明朝","Noto Serif JP","serif"],singleLineRatio:1.15},"ms gothic":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","Noto Sans JP","sans-serif"],singleLineRatio:1.15},"ms ゴシック":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS Gothic","MS ゴシック","Noto Sans JP","sans-serif"],singleLineRatio:1.15},"ms pゴシック":{googleFont:"Noto Sans JP",category:"sans-serif",fallbackStack:["MS PGothic","MS Pゴシック","Noto Sans JP","sans-serif"],singleLineRatio:1.15},simhei:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","Noto Sans SC","sans-serif"],singleLineRatio:1.15},simsun:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","Noto Serif SC","serif"],singleLineRatio:1.15},"malgun gothic":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","Noto Sans KR","sans-serif"],singleLineRatio:1.15},宋体:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["SimSun","宋体","Noto Serif SC","serif"],singleLineRatio:1.15},黑体:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["SimHei","黑体","Noto Sans SC","sans-serif"],singleLineRatio:1.15},微软雅黑:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["Microsoft YaHei","微软雅黑","Noto Sans SC","sans-serif"],singleLineRatio:1.15},等线:{googleFont:"Noto Sans SC",category:"sans-serif",fallbackStack:["DengXian","等线","Noto Sans SC","sans-serif"],singleLineRatio:1.15},仿宋:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["FangSong","仿宋","Noto Serif SC","serif"],singleLineRatio:1.15},楷体:{googleFont:"Noto Serif SC",category:"serif",fallbackStack:["KaiTi","楷体","Noto Serif SC","serif"],singleLineRatio:1.15},新細明體:{googleFont:"Noto Serif TC",category:"serif",fallbackStack:["PMingLiU","新細明體","Noto Serif TC","serif"],singleLineRatio:1.15},細明體:{googleFont:"Noto Serif TC",category:"serif",fallbackStack:["MingLiU","細明體","Noto Serif TC","serif"],singleLineRatio:1.15},微軟正黑體:{googleFont:"Noto Sans TC",category:"sans-serif",fallbackStack:["Microsoft JhengHei","微軟正黑體","Noto Sans TC","sans-serif"],singleLineRatio:1.15},標楷體:{googleFont:"Noto Serif TC",category:"serif",fallbackStack:["DFKai-SB","標楷體","Noto Serif TC","serif"],singleLineRatio:1.15},"맑은 고딕":{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Malgun Gothic","맑은 고딕","Noto Sans KR","sans-serif"],singleLineRatio:1.15},굴림:{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Gulim","굴림","Noto Sans KR","sans-serif"],singleLineRatio:1.15},돋움:{googleFont:"Noto Sans KR",category:"sans-serif",fallbackStack:["Dotum","돋움","Noto Sans KR","sans-serif"],singleLineRatio:1.15},바탕:{googleFont:"Noto Serif KR",category:"serif",fallbackStack:["Batang","바탕","Noto Serif KR","serif"],singleLineRatio:1.15},궁서:{googleFont:"Noto Serif KR",category:"serif",fallbackStack:["Gungsuh","궁서","Noto Serif KR","serif"],singleLineRatio:1.15}},L$={"sans-serif":"Arial, Helvetica, sans-serif",serif:"Times New Roman, Times, serif",monospace:"Courier New, Courier, monospace",cursive:"cursive",fantasy:"fantasy","system-ui":"system-ui, sans-serif"};function B$(t){let e=t.toLowerCase();return e.includes("mono")||e.includes("courier")||e.includes("consolas")||e.includes("console")||e.includes("code")||e.includes("terminal")?"monospace":e.includes("times")||e.includes("georgia")||e.includes("garamond")||e.includes("palatino")||e.includes("baskerville")||e.includes("bodoni")||e.includes("cambria")||e.includes("mincho")||e.includes("明朝")||e.includes("明體")||e.includes("宋")||e.includes("ming")||e.includes("song")||e.includes("serif")?"serif":e.includes("script")||e.includes("cursive")||e.includes("comic")||e.includes("brush")||e.includes("hand")?"cursive":"sans-serif"}var O$={"microsoft yahei":"微软雅黑",dengxian:"等线",fangsong:"仿宋",kaiti:"楷体",pmingliu:"新細明體",mingliu:"細明體","microsoft jhenghei":"微軟正黑體","dfkai-sb":"標楷體",gulim:"굴림",dotum:"돋움",batang:"바탕",gungsuh:"궁서",meiryo:"ms gothic",メイリオ:"ms gothic","yu gothic":"ms gothic",游ゴシック:"ms gothic","yu mincho":"ms mincho",游明朝:"ms mincho"};function $r(t){let e=t.trim().toLowerCase(),n=N$[O$[e]??e];if(n)return{googleFont:n.googleFont,cssFallback:n.fallbackStack.map(vm).join(", "),originalFont:t,hasGoogleEquivalent:!0,singleLineRatio:n.singleLineRatio};let r=B$(t),o=L$[r];return{googleFont:null,cssFallback:`${vm(t)}, ${o}`,originalFont:t,hasGoogleEquivalent:!1,singleLineRatio:1.15}}var j$={"\n":"\\a ","\r":"\\d ","\f":"\\c "};function z$(t){return t.replace(/["\\]/g,"\\$&").replace(/[\n\r\f]/g,e=>j$[e])}function vm(t){return["serif","sans-serif","monospace","cursive","fantasy","system-ui"].includes(t.toLowerCase())?t:/[\s,'"()]/.test(t)?`"${z$(t)}"`:t}var vi=new Set,yi=new Map,Kf=new Set,Jn=new Map,Mu=new Set,Is=new Set,H$=!0,gc=new Set,Ru=new Set;function Dl(t,e){let n=t instanceof Error?t.message:String(t),r=new Error(`[font] ${e}: ${n}`,{cause:t});if(Is.size>0)for(let o of Is)try{o(r)}catch(i){console.error("Font error subscriber threw:",i)}else console.warn(r.message)}function Rb(t,e="normal",n="normal"){return`${t.trim()}|${e}|${n}`}function Pu(t){return gc.has(t)?!1:Ru.has(t)?!0:Eb(t)?(Ru.add(t),queueMicrotask(()=>Uf([t])),!0):!1}function _$(t){let e=`${t}|`,n=[];for(let[r,o]of Jn)r.startsWith(e)&&n.push(o);return n}function Pb(t,e){Kf.add(t),vi.add(e),Uf([e])}function W$(t,e=[400,700],n=["normal","italic"]){let r=encodeURIComponent(t),o=[];for(let l of n){let a=l==="italic"?1:0;for(let s of e)o.push(`${a},${s}`)}o.sort();let i=o.join(";");return`https://fonts.googleapis.com/css2?family=${r}:ital,wght@${i}&display=swap`}async function km(t,e){if(typeof document>"u")return!1;let n=t.trim();if(vi.has(n))return!0;let r=yi.get(n);if(r)return r;if(Pu(n))return!0;let o=_$(n),i=(async()=>{try{if(o.length>0&&(await Promise.all(o),vi.has(n)||!e&&Pu(n)))return!0;let l=W$(n,e?.weights,e?.styles),a=document.createElement("link");return a.rel="stylesheet",a.href=l,await new Promise(s=>{let c=setTimeout(()=>s(!1),5e3);a.onload=()=>{clearTimeout(c),s(!0)},a.onerror=()=>{clearTimeout(c),s(!1)},document.head.appendChild(a)})?(await Xf(n,3e3),vi.add(n),Uf([n]),!0):!1}catch(l){return Dl(l,`failed to load "${n}"`),!1}finally{yi.delete(n),yi.size===0&&Jn.size}})();return yi.set(n,i),i}function V$(t){let e=t.trim();return vi.has(e)||Ru.has(e)}function q$(t){return Mu.add(t),()=>{Mu.delete(t)}}function Uf(t){for(let e of Mu)try{e(t)}catch(n){Dl(n,"load callback threw")}}function Z$(t){return Is.add(t),()=>{Is.delete(t)}}async function Xf(t,e){if("fonts"in document)try{let n=`400 16px "${t}"`;return await Promise.race([document.fonts.load(n),new Promise(r=>setTimeout(r,e))]),document.fonts.check(n)}catch{}return await new Promise(n=>setTimeout(n,100)),!0}var Gi,Cm=new Map,K$="abcdefghijklmnopqrstuvwxyz0123456789";function U$(){return Gi===void 0&&(Gi=document.createElement("canvas").getContext("2d"),Gi&&(Gi.textBaseline="top")),Gi}function Eb(t,e="sans-serif"){if(typeof document>"u")return!1;let n=U$();if(!n)return!1;let r=i=>(n.font=i,n.measureText(K$).width),o=i=>{let l=Cm.get(i);return l===void 0&&(l=r(`72px ${i}`),Cm.set(i,l)),r(`72px "${t}", ${i}`)!==l};return o(e)||o(e==="sans-serif"?"serif":"sans-serif")}var X$={"<":"\\3c ",">":"\\3e ","\n":"\\a ","\r":"\\d ","\f":"\\c "},Fb=t=>t.replace(/["\\]/g,"\\$&").replace(/[<>\n\r\f]/g,e=>X$[e]);async function G$(t,e,n){if(typeof document>"u")return!1;let r=t.trim(),o=n?.style??"normal",i=Rb(r,n?.weight,o);if(gc.add(r),Kf.has(i))return!0;let l=Jn.get(i);if(l)return l;let a=(async()=>{try{let s=new Blob([e],{type:"font/ttf"}),c=URL.createObjectURL(s),d=document.createElement("style");return d.textContent=`
15
+ @font-face {
16
+ font-family: "${Fb(r)}";
17
+ src: url(${c}) format('truetype');
18
+ font-weight: ${n?.weight??"normal"};
19
+ font-style: ${o};
20
+ font-display: swap;
21
+ }
22
+ `,document.head.appendChild(d),await Xf(r,3e3),Pb(i,r),!0}catch(s){return Dl(s,`failed to load "${r}" from buffer`),!1}finally{Jn.delete(i),yi.size===0&&Jn.size}})();return Jn.set(i,a),a}function Y$(t){let e=t.split("?")[0].split("#")[0].toLowerCase();return e.endsWith(".woff2")?"woff2":e.endsWith(".woff")?"woff":e.endsWith(".otf")?"opentype":"truetype"}async function J$(t,e,n){if(typeof document>"u")return!1;if(/[<>]/.test(e))return Dl(new Error(`invalid src URL for "${t}": contains '<' or '>'`),"rejected src"),!1;let r=t.trim(),o=Rb(r,n?.weight);if(gc.add(r),Kf.has(o))return!0;let i=Jn.get(o);if(i)return i;let l=(async()=>{try{let a=document.createElement("style");return a.textContent=`
23
+ @font-face {
24
+ font-family: "${Fb(r)}";
25
+ src: url(${JSON.stringify(e)}) format('${Y$(e)}');
26
+ font-weight: ${n?.weight??"normal"};
27
+ font-display: swap;
28
+ }
29
+ `,document.head.appendChild(a),await Xf(r,3e3),Pb(o,r),!0}catch(a){return Dl(a,`failed to load "${r}" from ${e}`),!1}finally{Jn.delete(o),yi.size===0&&Jn.size}})();return Jn.set(o,l),l}async function Q$(t){!t||t.length===0||await Promise.all(t.map(e=>J$(e.family,e.src,{weight:e.weight})))}var eI={Calibri:"Carlito",Cambria:"Caladea",Arial:"Arimo","Times New Roman":"Tinos","Courier New":"Cousine",Garamond:"EB Garamond","Book Antiqua":"EB Garamond",Georgia:"Tinos",Verdana:"Open Sans",Tahoma:"Open Sans","Trebuchet MS":"Source Sans Pro","Century Gothic":"Poppins","Franklin Gothic":"Libre Franklin",Palatino:"EB Garamond","Palatino Linotype":"EB Garamond","Lucida Sans":"Open Sans","Segoe UI":"Open Sans",Impact:"Anton","Comic Sans MS":"Comic Neue",Consolas:"Inconsolata","Lucida Console":"Inconsolata",Monaco:"Fira Code"};function tI(t){let e=t.trim();return eI[e]||$r(e).googleFont||e}async function nI(t){let e=t.trim(),n=tI(e);if(n!==e){if(!gc.has(e)&&V$(e)||Pu(e))return!0;let r=await km(n);return r&&vi.add(e),r}return km(n)}async function Ab(t){let e=[...new Set(t.map(n=>n.trim()))];await Promise.all(e.map(n=>nI(n)))}function rI(t){let e=new Set,n=t;if(!n?.package)return e;let r=n.package?.document?.content;if(Array.isArray(r)){for(let i of r)if(i?.type==="paragraph"&&Array.isArray(i.content)){for(let l of i.content)if(l?.type==="run"&&l.formatting?.fontFamily){let{ascii:a,hAnsi:s}=l.formatting.fontFamily;a&&e.add(a),s&&s!==a&&e.add(s)}}}let o=n.package?.styles?.styles;if(Array.isArray(o)){for(let i of o)if(i?.runProperties?.fontFamily){let{ascii:l,hAnsi:a}=i.runProperties.fontFamily;l&&e.add(l),a&&a!==l&&e.add(a)}}return e}async function oI(t){let e=rI(t);e.size!==0&&await Ab(Array.from(e))}function Db(t){let e=t.replace(/[^0-9a-fA-F]/g,"");if(e.length!==32)return null;let n=new Uint8Array(16);for(let o=0;o<16;o++){let i=Number.parseInt(e.slice(o*2,o*2+2),16);if(Number.isNaN(i))return null;n[o]=i}let r=new Uint8Array(16);for(let o=0;o<16;o++)r[o]=n[15-o];return r}function iI(t){return t?Db(t)!==null:!1}function lI(t,e){let n=Db(e);if(!n)throw new Error(`Invalid embedded-font key: "${e}"`);let r=new Uint8Array(t.slice(0)),o=Math.min(32,r.length);for(let i=0;i<o;i++)r[i]^=n[i%16];return r.buffer}function aI(t){let e=new Set;if(!t)return e;for(let n of t.fonts)(n.embedRegular||n.embedBold||n.embedItalic||n.embedBoldItalic)&&e.add(n.name);return e}var sI=[{key:"embedRegular",weight:"normal",style:"normal"},{key:"embedBold",weight:"bold",style:"normal"},{key:"embedItalic",weight:"normal",style:"italic"},{key:"embedBoldItalic",weight:"bold",style:"italic"}];function cI(t,e){let n=t.replace(/^\/+/,""),r=(n.toLowerCase().startsWith("word/")?n:`word/${n}`).toLowerCase();for(let[o,i]of e)if(o.toLowerCase()===r)return i}function dI(t,e,n,r,o){let i=o.get(e.relId);if(!i)return null;let l=cI(i,r);if(!l)return null;let a;if(e.fontKey&&iI(e.fontKey))try{a=lI(l,e.fontKey)}catch{return null}else a=l.slice(0);return{family:t,weight:n.weight,style:n.style,data:a,subsetted:e.subsetted??!1}}function uI(t,e,n){if(!t||t.fonts.length===0)return[];if(!n||e.size===0)return[];let r=$s(n),o=new Map;for(let[l,a]of r)o.set(l,a.target);let i=[];for(let l of t.fonts)for(let a of sI){let s=l[a.key];if(!s)continue;let c=dI(l.name,s,a,e,o);c&&i.push(c)}return i}async function fI(t,e,n){let r=uI(t,e,n),o=new Set;return r.length===0||await Promise.all(r.map(async i=>{await G$(i.family,i.data,{weight:i.weight,style:i.style})?o.add(i.family):typeof document<"u"&&console.warn(`[embeddedFonts] embedded face "${i.family}" (${i.weight} ${i.style}) failed to load; text using it falls back to the CSS stack`)})),o}async function pI(t){if(t instanceof ArrayBuffer)return t;if(t instanceof Uint8Array){let e=new ArrayBuffer(t.byteLength);return new Uint8Array(e).set(t),e}if(t instanceof Blob)return t.arrayBuffer();throw new TypeError(`Unsupported DocxInput type: ${typeof t}`)}function Nb(t,e,n){let r=0;for(let o=e;o<e+n&&o<t.length;o++)r+=t[o];return r}function Lb(t,e,n,r){let o=Nb(t,e,n),i=Math.floor(o/Math.max(r,1)),l=o-i*r,a=Array.from({length:r},(s,c)=>i+(c<l?1:0));return[...t.slice(0,e),...a,...t.slice(e+n)]}function Bb(t,e,n,r,o,i){let l=n-e.rowspan,a=r-e.colspan,s=o+l,c=e.row+e.rowspan,d=e.col+e.colspan,u=[];for(let f of t){if(f===e)continue;let h=f.row+f.rowspan,p=f.col+f.colspan,m=f.row<c&&h>e.row,y=f.col<d&&p>e.col;u.push({data:f.data,row:f.row>=c?f.row+l:f.row,col:f.col>=d?f.col+a:f.col,rowspan:f.rowspan+(l>0&&m&&!y?l:0),colspan:f.colspan+(a>0&&y&&!m?a:0)})}for(let f=0;f<n;f++)for(let h=0;h<r;h++){let p=f===0&&h===0;u.push({data:i(p,f,h),row:e.row+f,col:e.col+h,rowspan:1,colspan:1})}return{anchors:u,deltaRows:l,deltaCols:a,newRowCount:s}}function hI(t){let e=new Map,n=new Map;for(let r of t){e.set(`${r.row}-${r.col}`,r);for(let o=r.row;o<r.row+r.rowspan;o++)for(let i=r.col;i<r.col+r.colspan;i++)n.set(`${o}-${i}`,r)}return{byStart:e,byCoveredSlot:n}}function Ob(t,e){let n=t>1||e>1;return{minRows:t,minCols:e,initialRows:t,initialCols:n?e:e+1}}var Ms={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},mI={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},Eu={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function Sm(t){if(!t)return 1;let e=parseInt(t,16);return isNaN(e)?1:e/255}function jb(t){let e=t.padStart(6,"0").slice(0,6),n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return{r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(o)?0:o}}function zb(t,e,n){let r=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`${r(t)}${r(e)}${r(n)}`.toUpperCase()}function Hb(t,e){if(e>=1)return t;if(e<=0)return"FFFFFF";let n=jb(t);return zb(Math.min(255,Math.max(0,Math.round(n.r*e+255*(1-e)))),Math.min(255,Math.max(0,Math.round(n.g*e+255*(1-e)))),Math.min(255,Math.max(0,Math.round(n.b*e+255*(1-e)))))}function _b(t,e){if(e>=1)return t;if(e<=0)return"000000";let n=jb(t);return zb(Math.min(255,Math.max(0,Math.round(n.r*e))),Math.min(255,Math.max(0,Math.round(n.g*e))),Math.min(255,Math.max(0,Math.round(n.b*e))))}function gI(t,e){let n=Eu[e]??e,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],o=i=>r.includes(i);return t?.colorScheme?o(n)?t.colorScheme[n]??Ms[n]??"000000":"000000":o(n)?Ms[n]??"000000":"000000"}function yI(t){if(!t)return null;let e=t.toLowerCase();return Eu[t]??Eu[e]??null}function nr(t,e,n="000000"){if(!t)return`#${n}`;if(t.auto)return`#${n}`;let r;if(t.themeColor){let o=yI(t.themeColor);if(o?r=gI(e,o):r=t.rgb??n,t.themeTint){let i=Sm(t.themeTint);r=Hb(r,i)}else if(t.themeShade){let i=Sm(t.themeShade);r=_b(r,i)}}else t.rgb?r=t.rgb==="auto"?n:t.rgb:r=n;return`#${r.toUpperCase().replace(/^#/,"")}`}function No(t,e){if(!(!t||t.auto)){if(t.themeColor&&e)return nr(t,e).slice(1);if(t.rgb&&t.rgb!=="auto")return t.rgb.toUpperCase().replace(/^#/,"")}}function Wb(t){if(!t||t==="none")return"";let e=mI[t];return e?`#${e}`:""}function Id(t,e){return t?t.auto?"transparent":nr(t,e):""}function Vb(t){return t.startsWith("#")?t:`#${t}`}function Gf(t){return Wb(t)||Vb(t)}var bI=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],wI=[{type:"base",value:0,hexValue:"",labelSuffix:""},{type:"tint",value:.8,hexValue:"CC",labelSuffix:", Lighter 80%"},{type:"tint",value:.6,hexValue:"99",labelSuffix:", Lighter 60%"},{type:"tint",value:.4,hexValue:"66",labelSuffix:", Lighter 40%"},{type:"shade",value:.75,hexValue:"BF",labelSuffix:", Darker 25%"},{type:"shade",value:.5,hexValue:"80",labelSuffix:", Darker 50%"}];function xI(t){let e=t??Ms;return wI.map(n=>bI.map(r=>{let o=e[r.slot]??Ms[r.slot]??"000000",i;n.type==="base"?i=o.toUpperCase():n.type==="tint"?i=Hb(o,1-n.value):i=_b(o,n.value);let l={hex:i,themeSlot:r.slot,label:`${r.name}${n.labelSuffix}`};return n.type==="tint"&&n.hexValue?l.tint=n.hexValue:n.type==="shade"&&n.hexValue&&(l.shade=n.hexValue),l}))}var BJ=1440;function ut(t){return t/1440*96}function qb(t){return t/96*1440}function _e(t){return t==null||isNaN(t)?0:Math.round(t*96/914400)}function He(t){return Math.round(t/96*914400)}function Zb(t){return t/72*96}function Kb(t){return t/144*96}function Yf(t){return t/2}function Ub(t){return t*2}function vI(t){return t/576*96}function kI(t,e=2){let n=Math.pow(10,e);return Math.round(t*n)/n}function rt(t){return`${kI(t)}px`}function CI(t,e){if(!t)return{};let n={};if(t.fontFamily){let l=null;if(t.fontFamily.asciiTheme&&e?.fontScheme,l||(l=t.fontFamily.ascii||t.fontFamily.hAnsi||t.fontFamily.eastAsia||t.fontFamily.cs||null),l){let a=$r(l);n.fontFamily=a.cssFallback}}if(t.fontSize!==void 0&&(n.fontSize=`${Yf(t.fontSize)}pt`),t.bold&&(n.fontWeight="bold"),t.italic&&(n.fontStyle="italic"),t.color&&(n.color=nr(t.color,e)),t.highlight&&t.highlight!=="none"&&(n.backgroundColor=Gf(t.highlight)),t.shading){let l=Xb(t.shading,e);l&&!n.backgroundColor&&(n.backgroundColor=l)}let r=[],o=[],i=[];if(t.underline&&t.underline.style!=="none"){r.push("underline");let l=TI(t.underline.style);l!=="solid"&&o.push(l),t.underline.color&&i.push(nr(t.underline.color,e))}if(t.strike&&r.push("line-through"),t.doubleStrike&&r.push("line-through"),r.length>0&&(n.textDecoration=r.join(" "),o.length>0&&(n.textDecorationStyle=o[0]),i.length>0&&(n.textDecorationColor=i[0])),t.vertAlign)switch(t.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(t.position&&t.position!==0){let l=Kb(t.position);n.position="relative",n.top=rt(-l)}return t.allCaps?n.textTransform="uppercase":t.smallCaps&&(n.fontVariant="small-caps"),t.spacing!==void 0&&t.spacing!==0&&(n.letterSpacing=rt(ut(t.spacing))),t.scale!==void 0&&t.scale!==100&&(n.transform=`scaleX(${t.scale/100})`,n.display="inline-block"),t.hidden&&(n.display="none"),t.emboss&&(n.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),t.imprint&&(n.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),t.outline&&(n.WebkitTextStroke="1px currentColor",n.WebkitTextFillColor="transparent"),t.shadow&&!t.emboss&&!t.imprint&&(n.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),t.rtl&&(n.direction="rtl"),n}function SI(t,e){if(!t)return{};let n={};if(t.alignment&&(n.textAlign=$I(t.alignment)),t.beforeAutospacing?n.marginTop=rt(14):t.spaceBefore!==void 0&&(n.marginTop=rt(ut(t.spaceBefore))),t.afterAutospacing?n.marginBottom=rt(14):t.spaceAfter!==void 0&&(n.marginBottom=rt(ut(t.spaceAfter))),t.lineSpacing!==void 0&&t.lineSpacing>0)switch(t.lineSpacingRule){case"exact":{let r=ut(t.lineSpacing);r>0&&(n.lineHeight=rt(r));break}case"atLeast":{let r=ut(t.lineSpacing);r>0&&(n.minHeight=rt(r),n.lineHeight=rt(r));break}default:{let r=t.lineSpacing/240;r>0&&(n.lineHeight=r.toString());break}}if(t.indentLeft!==void 0&&(n.marginLeft=rt(ut(t.indentLeft))),t.indentRight!==void 0&&(n.marginRight=rt(ut(t.indentRight))),t.indentFirstLine!==void 0&&(t.hangingIndent,n.textIndent=rt(ut(t.indentFirstLine))),t.borders&&(t.borders.top&&Object.assign(n,al(t.borders.top,"Top",e)),t.borders.bottom&&Object.assign(n,al(t.borders.bottom,"Bottom",e)),t.borders.left&&Object.assign(n,al(t.borders.left,"Left",e)),t.borders.right&&Object.assign(n,al(t.borders.right,"Right",e))),t.shading){let r=Xb(t.shading,e);r&&(n.backgroundColor=r)}return t.bidi&&(n.direction="rtl"),t.pageBreakBefore&&(n.pageBreakBefore="always"),t.keepNext&&(n.pageBreakAfter="avoid"),t.keepLines&&(n.pageBreakInside="avoid"),n}function al(t,e="",n){if(!t||t.style==="none"||t.style==="nil")return{};let r={},o=t.size?vI(t.size):1,i=t.color?nr(t.color,n):"#000000",l=II(t.style),a=`border${e}Width`,s=`border${e}Style`,c=`border${e}Color`;return r[a]=rt(Math.max(1,o)),r[s]=l,r[c]=i,r}function Xb(t,e){return!t||t.pattern==="clear"||t.pattern==="nil"?"":t.fill?t.fill.auto||t.fill.rgb==="auto"||t.fill.rgb==="FFFFFF"?"":Id(t.fill,e):t.pattern==="solid"&&t.color||t.pattern&&t.pattern.startsWith("pct")&&t.color?Id(t.color,e):""}function TI(t){switch(t){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 $I(t){switch(t){case"center":return"center";case"right":return"right";case"both":case"distribute":return"justify";default:return"left"}}function II(t){switch(t){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 MI(t){if(!t)return[];let e=()=>{if(!t.items||t.items.length===0)return[];let c=[];for(let d of Array.from(t.items)){if(d.kind!=="file"||!d.type.startsWith("image/"))continue;let u=d.getAsFile();u&&c.push(u)}return c},n=()=>!t.files||t.files.length===0?[]:Array.from(t.files).filter(c=>c.type.startsWith("image/")),r=e(),o=r.length?r:n();if(o.length<=1)return o;let i=["image/png","image/jpeg","image/webp","image/gif","image/svg+xml","image/bmp","image/tiff"],l=c=>{let d=c[0],u=i.indexOf(d.type);u<0&&(u=Number.MAX_SAFE_INTEGER);for(let f of c.slice(1)){let h=i.indexOf(f.type);if(h<0&&(h=Number.MAX_SAFE_INTEGER),h<u){d=f,u=h;continue}h===u&&f.size>d.size&&(d=f)}return d},a=new Map;for(let c of o){let d=c.name?.trim()??"",u=(d?d.replace(/\.[^/.]+$/,"").toLowerCase():"")||`size:${c.size}`,f=a.get(u);f?f.push(c):a.set(u,[c])}let s=[];for(let c of a.values())s.push(l(c));return s}function Rs(t){let e=[];return t.descendants((n,r)=>{if(n.type.name==="paragraph"){let o=n.attrs.outlineLevel,i=n.attrs.styleId,l=o;if(l==null&&i){let a=i.match(/^[Hh]eading(\d)$/);a&&(l=parseInt(a[1],10)-1)}if(l!=null&&l>=0&&l<=8){let a="";n.forEach(s=>{s.isText&&(a+=s.text||"")}),a.trim()&&e.push({text:a.trim(),level:l,pmPos:r})}}}),e}var RI=/^[a-z][a-z0-9+.-]*:/i,PI=/^(https?|mailto|tel|ftp):/i;function yc(t){if(!t)return;let e=t.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(e)return RI.test(e)?PI.test(e)?t:void 0:t}var EI=Object.defineProperty,Gb=t=>{throw TypeError(t)},FI=(t,e,n)=>e in t?EI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ze=(t,e,n)=>FI(t,typeof e!="symbol"?e+"":e,n),Jf=(t,e,n)=>e.has(t)||Gb("Cannot "+n),Yt=(t,e,n)=>(Jf(t,e,"read from private field"),n?n.call(t):e.get(t)),ri=(t,e,n)=>e.has(t)?Gb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Nn=(t,e,n,r)=>(Jf(t,e,"write to private field"),e.set(t,n),n),Md=(t,e,n)=>(Jf(t,e,"access private method"),n),AI=(t,e,n,r)=>({set _(o){Nn(t,e,o)},get _(){return Yt(t,e,r)}});function DI(t){let e=new Set,n=t.package;if(n.theme&&NI(n.theme,e),n.styles&&LI(n.styles,e),n.document)for(let r of n.document.content)ea(r,e);if(n.headers)for(let r of n.headers.values())$m(r,e);if(n.footers)for(let r of n.footers.values())$m(r,e);if(n.footnotes)for(let r of n.footnotes)VI(r,e);if(n.endnotes)for(let r of n.endnotes)qI(r,e);return Array.from(e).sort()}function NI(t,e){let n=t.fontScheme;n&&(n.majorFont&&Tm(n.majorFont,e),n.minorFont&&Tm(n.minorFont,e))}function Tm(t,e){if(t.latin&&e.add(t.latin),t.ea&&e.add(t.ea),t.cs&&e.add(t.cs),t.fonts)for(let n of Object.values(t.fonts))n&&e.add(n)}function LI(t,e){t.docDefaults&&(t.docDefaults.rPr&&bi(t.docDefaults.rPr,e),t.docDefaults.pPr?.runProperties&&bi(t.docDefaults.pPr.runProperties,e));for(let n of t.styles)n.rPr&&bi(n.rPr,e),n.pPr?.runProperties&&bi(n.pPr.runProperties,e)}function bi(t,e){let n=t.fontFamily;n&&(n.ascii&&e.add(n.ascii),n.hAnsi&&e.add(n.hAnsi),n.eastAsia&&e.add(n.eastAsia),n.cs&&e.add(n.cs))}function BI(t,e){t.runProperties&&bi(t.runProperties,e)}function ea(t,e){t.type==="paragraph"?OI(t,e):t.type==="table"&&HI(t,e)}function OI(t,e){t.formatting&&BI(t.formatting,e);for(let n of t.content)jI(n,e)}function jI(t,e){if(t.type==="run")us(t,e);else if(t.type==="hyperlink")zI(t,e);else if(t.type==="simpleField"||t.type==="complexField"){if("content"in t)for(let n of t.content)n.type==="run"&&us(n,e);if("fieldResult"in t)for(let n of t.fieldResult)us(n,e)}}function us(t,e){t.formatting&&bi(t.formatting,e)}function zI(t,e){for(let n of t.children)n.type==="run"&&us(n,e)}function HI(t,e){for(let n of t.rows)_I(n,e)}function _I(t,e){for(let n of t.cells)WI(n,e)}function WI(t,e){for(let n of t.content)ea(n,e)}function $m(t,e){for(let n of t.content)ea(n,e)}function VI(t,e){for(let n of t.content)ea(n,e)}function qI(t,e){for(let n of t.content)ea(n,e)}var ZI=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function KI(t,e={}){let n=e.canRender??Eb,r=new Set;for(let a of e.exclude??[])r.add(a.trim().toLowerCase());let o=new Set;for(let a of e.embeddedFamilies??[])o.add(a.trim().toLowerCase());let i=[],l=new Set;for(let a of t){let s=a.trim(),c=s.toLowerCase();!s||ZI.has(c)||r.has(c)||l.has(c)||!o.has(c)&&!n(s)||(l.add(c),i.push({name:s,fontFamily:$r(s).cssFallback,category:"other"}))}return i}function UI(t,e={}){return KI(DI(t),e)}function XI(t,e){if(!t||t.length===0)return[];let n=new Set;for(let i of e)n.add(i.trim().toLowerCase());let r=new Set,o=[];for(let i of t){let l=i.name.trim().toLowerCase();n.has(l)||r.has(l)||(r.add(l),o.push(i))}return o}var GI="rgba(255, 235, 59, 0.55)",Rd="docx-paragraph-flash",Pd=new WeakMap;function YI(t){let e=globalThis;return typeof e.CSS?.escape=="function"?e.CSS.escape(t):t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function JI(t){return t?.color?.trim()||GI}function QI(t){let e=t?.durationMs;return e==null||!Number.isFinite(e)||e<0?1200:e}function eM(t,e){if(!e||!e.trim())return[];let n=YI(e);return Array.from(t.querySelectorAll(`.layout-paragraph[data-para-id="${n}"]`))}function tM(t,e){let n=0,r=JI(e),o=QI(e);for(let i of t){n++;let l=Pd.get(i);l!==void 0&&clearTimeout(l),i.classList.remove(Rd),i.offsetWidth,i.style.setProperty("--docx-paragraph-flash-color",r),i.style.setProperty("--docx-paragraph-flash-duration",`${o}ms`),i.classList.add(Rd);let a=setTimeout(()=>{i.classList.remove(Rd),i.style.removeProperty("--docx-paragraph-flash-color"),i.style.removeProperty("--docx-paragraph-flash-duration"),Pd.delete(i)},o);Pd.set(i,a)}return n}function nM(t,e,n){let r=eM(t,e);return tM(r,n)>0}async function rM(t){let e=t.target;if(!e||!e.files)return null;let n=e.files[0];return e.value="",n?{buffer:await n.arrayBuffer(),name:n.name.replace(/\.docx$/i,"")}:null}var Yb="(prefers-color-scheme: dark)";function Jb(){return typeof window<"u"&&typeof window.matchMedia=="function"}function oM(){return Jb()?window.matchMedia(Yb).matches:!1}function iM(t,e){return t==="dark"||t==="system"&&e}function lM(t){if(!Jb())return()=>{};let e=window.matchMedia(Yb);t(e.matches);let n=r=>t(r.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)}function Yo({isOpen:t,onClose:e,align:n="left"}){let r=S.useRef(null),o=S.useRef(null),[i,l]=S.useState({top:0,left:0});S.useEffect(()=>{if(!t||!r.current)return;let c=r.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(o.current){let d=o.current.getBoundingClientRect();l({top:c.bottom+4,left:c.right-d.width})}else l({top:c.bottom+4,left:c.left})}):l({top:c.bottom+4,left:c.left})},[t,n]),S.useEffect(()=>{if(!t)return;let c=f=>{let h=f.target;r.current&&!r.current.contains(h)&&o.current&&!o.current.contains(h)&&e()},d=f=>{f.key==="Escape"&&e()},u=f=>{let h=f.target;h&&o.current&&o.current.contains(h)||e()};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d),window.removeEventListener("scroll",u,!0)}},[t,e]);let a=S.useCallback(c=>{c.preventDefault(),c.stopPropagation()},[]),s={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return{containerRef:r,dropdownRef:o,dropdownStyle:s,handleMouseDown:a}}function aM(t,e){let n=t.rows.length,r=Nl(t),o=!!(e.selectedCells&&(e.selectedCells.startRow!==e.selectedCells.endRow||e.selectedCells.startCol!==e.selectedCells.endCol)),i=!!sM(t,e.rowIndex,e.columnIndex)&&!o;return{table:t,selection:e,hasMultiCellSelection:o,canSplitCell:i,rowCount:n,columnCount:r}}function Nl(t){if(!t.rows.length)return 0;let e=0;for(let n of t.rows){let r=0;for(let o of n.cells)r+=o.formatting?.gridSpan??1;e=Math.max(e,r)}return e}function sM(t,e,n){let r=t.rows[e];if(!r)return null;let o=0;for(let i of r.cells){let l=i.formatting?.gridSpan??1;if(n>=o&&n<o+l)return i;o+=l}return null}function cM(t,e){let n=[],r=0;for(let o of t.cells){let i=o.formatting?.gridSpan??1;n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{...o.formatting,vMerge:void 0}}),r+=i}for(;r<e;)n.push({type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}),r++;return{type:"tableRow",cells:n,formatting:{...t.formatting,header:!1}}}function dM(){return{type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:{}}}function uM(t,e){let n=0;for(let r of t.cells){let o=r.formatting?.gridSpan??1;if(n===e)return r;n+=o}return null}function Qb(t){let e=[],n=0;for(let r=0;r<t.rows.length;r++){let o=t.rows[r],i=0;for(let l of o.cells){let a=l.formatting?.gridSpan??1;if(l.formatting?.vMerge!=="continue"){let s=1;if(l.formatting?.vMerge==="restart")for(let c=r+1;c<t.rows.length;c++){let d=uM(t.rows[c],i);if(!d||d.formatting?.vMerge!=="continue")break;s+=1}e.push({data:l,row:r,col:i,rowspan:s,colspan:a})}i+=a,n=Math.max(n,i)}}return{anchors:e,totalCols:n}}function Ed(t,e,n){let r={...t.formatting??{}};return e>1?r.gridSpan=e:delete r.gridSpan,n>1?r.vMerge="restart":delete r.vMerge,Object.keys(r).length?r:void 0}function fM(t,e){let n={...t.formatting??{}};return e>1?n.gridSpan=e:delete n.gridSpan,n.vMerge="continue",n}function pM(t,e,n){let{anchors:r}=Qb(t),o=r.find(i=>e>=i.row&&e<i.row+i.rowspan&&n>=i.col&&n<i.col+i.colspan);return o?Ob(o.rowspan,o.colspan):null}function hM(t,e,n,r,o){if(r<1||o<1)return t;let{anchors:i,totalCols:l}=Qb(t),a=i.find(y=>e>=y.row&&e<y.row+y.rowspan&&n>=y.col&&n<y.col+y.colspan);if(!a||r<a.rowspan||o<a.colspan||r===1&&o===1)return t;let s=t.columnWidths&&t.columnWidths.length>0?[...t.columnWidths]:Array.from({length:l},()=>1440),c=Lb(s,a.col,a.colspan,o),d=Bb(i,a,r,o,t.rows.length,y=>y?{...a.data,formatting:Ed(a.data,1,1)}:{type:"tableCell",content:[{type:"paragraph",content:[],formatting:{}}],formatting:Ed(a.data,1,1)}),{byStart:u,byCoveredSlot:f}=hI(d.anchors),h=a.row+a.rowspan,p=l+d.deltaCols,m=[];for(let y=0;y<d.newRowCount;y++){let w=y<h?t.rows[y]:y<a.row+r?t.rows[h-1]:t.rows[y-d.deltaRows],C=[];for(let g=0;g<p;){let v=u.get(`${y}-${g}`);if(v){C.push({...v.data,formatting:Ed(v.data,v.colspan,v.rowspan)}),g+=v.colspan;continue}let k=f.get(`${y}-${g}`);if(!k){g+=1;continue}C.push({...k.data,content:[],formatting:fM(k.data,k.colspan)}),g+=k.colspan}m.push({type:"tableRow",formatting:w?.formatting?{...w.formatting}:void 0,cells:C})}return{...t,rows:m,columnWidths:c}}function Im(t,e,n="after"){let r=[...t.rows],o=n==="before"?e:e+1,i=t.rows[e]||t.rows[0],l=Nl(t),a=cM(i,l);return r.splice(o,0,a),{...t,rows:r}}function mM(t,e){if(t.rows.length<=1)return t;let n=t.rows.filter((r,o)=>o!==e);return{...t,rows:n}}function Mm(t,e,n="after"){let r=n==="before"?e:e+1,o=t.rows.map(l=>{let a=[...l.cells],s=0,c=0;for(let d=0;d<l.cells.length;d++){let u=l.cells[d].formatting?.gridSpan??1;if(r<=s+u){c=n==="before"?d:d+1;break}s+=u,c=d+1}return a.splice(c,0,dM()),{...l,cells:a}}),i=t.columnWidths;if(t.columnWidths&&t.columnWidths.length>0){i=[...t.columnWidths];let l=t.columnWidths[e]||t.columnWidths[0]||1440;i.splice(r,0,l)}return{...t,rows:o,columnWidths:i}}function gM(t,e){if(Nl(t)<=1)return t;let n=t.rows.map(o=>{let i=0,l=[];for(let a of o.cells){let s=a.formatting?.gridSpan??1;e>=i&&e<i+s?s>1&&l.push({...a,formatting:{...a.formatting,gridSpan:s-1}}):l.push(a),i+=s}return{...o,cells:l}}),r=t.columnWidths;return t.columnWidths&&t.columnWidths.length>e&&(r=t.columnWidths.filter((o,i)=>i!==e)),{...t,rows:n,columnWidths:r}}function yM(t,e){if(!e.selectedCells)return t;let{startRow:n,startCol:r,endRow:o,endCol:i}=e.selectedCells,l=o-n+1,a=i-r+1,s=t.rows.map((c,d)=>{if(d<n||d>o)return c;let u=[],f=0;for(let h of c.cells){let p=h.formatting?.gridSpan??1,m=f+p-1;f<=i&&m>=r?d===n&&f===r?u.push({...h,formatting:{...h.formatting,gridSpan:a,vMerge:l>1?"restart":void 0}}):d>n&&f===r&&u.push({...h,formatting:{...h.formatting,gridSpan:a,vMerge:"continue"}}):u.push(h),f+=p}return{...c,cells:u}});return{...t,rows:s}}function ne({size:t=20,className:e="",style:n,children:r}){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 -960 960 960",fill:"currentColor",className:e,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:r})}function bM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function wM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function xM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function vM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function kM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function CM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function SM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function TM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function $M(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function IM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function MM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function RM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function PM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function EM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function FM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function AM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function DM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function ew(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function NM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function LM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function BM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function OM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function jM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function zM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function HM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function _M(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function WM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function VM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function qM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function ZM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function KM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function Rm(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function UM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function XM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function GM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function YM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function JM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function QM(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function eR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function tR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function nR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function rR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function oR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function iR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function lR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function aR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function sR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function cR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function dR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function uR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function fR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function pR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function hR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function mR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function gR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function yR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function bR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function wR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function xR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function vR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function kR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function CR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function SR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function TR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function $R(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function IR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function MR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function RR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function PR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function ER(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function FR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function AR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function DR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function NR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function LR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function BR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function OR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function jR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function zR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function HR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function _R(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function WR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function VR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function qR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function ZR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function KR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function UR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function XR(t){return b.jsxs(ne,{...t,children:[b.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),b.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function GR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function YR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function JR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function QR(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function eP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function tP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function nP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function rP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function oP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function iP(t){return b.jsx(ne,{...t,children:b.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var lP={undo:bM,redo:wM,print:xM,file_download:vM,file_upload:kM,format_bold:CM,format_italic:SM,format_underlined:TM,strikethrough_s:$M,superscript:IM,subscript:MM,link:RM,format_clear:PM,format_align_left:EM,format_align_center:FM,format_align_right:AM,format_align_justify:DM,format_line_spacing:ew,format_list_bulleted:NM,format_list_numbered:LM,format_indent_increase:BM,format_indent_decrease:OM,format_color_text:jM,ink_highlighter:zM,format_color_reset:HM,arrow_drop_down:_M,table:WM,table_chart:VM,grid_on:qM,table_rows:ZM,view_column:KM,border_all:Rm,select_all:Rm,border_outer:UM,border_inner:XM,border_clear:GM,add:YM,remove:JM,delete:QM,delete_sweep:eR,call_merge:tR,call_split:nR,drag_indicator:rR,image:oR,format_image_left:iR,format_image_right:lR,horizontal_rule:aR,flip_to_back:sR,flip_to_front:cR,open_with:dR,tune:uR,rotate_right:fR,rotate_left:pR,swap_horiz:hR,swap_vert:mR,shapes:gR,format_paint:yR,expand_more:bR,expand_less:wR,border_top:xR,border_bottom:vR,border_left:kR,border_right:CR,border_horizontal:SR,border_vertical:TR,padding:$R,text_rotation_none:IR,wrap_text:MR,height:RR,fit_width:PR,settings:ER,border_color:FR,format_color_fill:AR,vertical_align_top:DR,vertical_align_center:NR,vertical_align_bottom:LR,line_weight:BR,keyboard_arrow_up:OR,keyboard_arrow_down:jR,keyboard_arrow_left:zR,keyboard_arrow_right:HR,more_vert:_R,page_break:WR,branding_watermark:VR,arrow_back:qR,done_all:ZR,check_circle:KR,chat_bubble_outline:UR,chat_bubble_check:XR,check:GR,close:YR,add_comment:JR,comment:QR,edit_note:eP,rate_review:tP,visibility:nP,format_textdirection_l_to_r:rP,format_textdirection_r_to_l:oP,"agent-sparkle":iP};function we({name:t,size:e=20,className:n="",style:r}){let o=lP[t];return o?b.jsx(o,{size:e,className:n,style:r}):(console.warn(`Icon not found: ${t}`),b.jsx("span",{className:n,style:{fontSize:e,width:e,height:e,...r},children:t}))}function aP(){return{type:"none",level:0,isInList:!1}}var sP=Object.defineProperty,cP=(t,e)=>sP(t,"name",{value:e,configurable:!0});function Fu(t,[e,n]){return Math.min(n,Math.max(e,t))}cP(Fu,"clamp");var dP=Object.defineProperty,At=(t,e)=>dP(t,"name",{value:e,configurable:!0});function tw(t){const e=t+"CollectionProvider",[n,r]=pc(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=At(m=>{const{scope:y,children:w}=m,C=S.useRef(null),g=S.useRef(new Map).current;return b.jsx(o,{scope:y,itemMap:g,collectionRef:C,children:w})},"CollectionProvider");l.displayName=e;const a=t+"CollectionSlot",s=Fl(a),c=S.forwardRef((m,y)=>{const{scope:w,children:C}=m,g=i(a,w),v=Qt(y,g.collectionRef);return b.jsx(s,{ref:v,children:C})});c.displayName=a;const d=t+"CollectionItemSlot",u="data-radix-collection-item",f=Fl(d),h=S.forwardRef((m,y)=>{const{scope:w,children:C,...g}=m,v=S.useRef(null),k=Qt(y,v),x=i(d,w);return S.useEffect(()=>(x.itemMap.set(v,{ref:v,...g}),()=>{x.itemMap.delete(v)})),b.jsx(f,{[u]:"",ref:k,children:C})});h.displayName=d;function p(m){const y=i(t+"CollectionConsumer",m);return S.useCallback(()=>{const C=y.collectionRef.current;if(!C)return[];const g=Array.from(C.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((x,T)=>g.indexOf(x.ref.current)-g.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return At(p,"useCollection"),[{Provider:l,Slot:c,ItemSlot:h},p,r]}At(tw,"createCollection");var Pm=new WeakMap,Ct,gn,Fd=(gn=class extends Map{constructor(n){super(n);dm(this,Ct);gd(this,Ct,[...super.keys()]),Pm.set(this,!0)}set(n,r){return Pm.get(this)&&(this.has(n)?Wt(this,Ct)[Wt(this,Ct).indexOf(n)]=n:Wt(this,Ct).push(n)),super.set(n,r),this}insert(n,r,o){const i=this.has(r),l=Wt(this,Ct).length,a=Qf(n);let s=a>=0?a:l+a;const c=s<0||s>=l?-1:s;if(c===this.size||i&&c===this.size-1||c===-1)return this.set(r,o),this;const d=this.size+(i?0:1);a<0&&s++;const u=[...Wt(this,Ct)];let f,h=!1;for(let p=s;p<d;p++)if(s===p){let m=u[p];u[p]===r&&(m=u[p+1]),i&&this.delete(r),f=this.get(m),this.set(r,o)}else{!h&&u[p-1]===r&&(h=!0);const m=u[h?p:p-1],y=f;f=this.get(m),this.delete(m),this.set(m,y)}return this}with(n,r,o){const i=new gn(this);return i.insert(n,r,o),i}before(n){const r=Wt(this,Ct).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const i=Wt(this,Ct).indexOf(n);return i===-1?this:this.insert(i,r,o)}after(n){let r=Wt(this,Ct).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const i=Wt(this,Ct).indexOf(n);return i===-1?this:this.insert(i+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return gd(this,Ct,[]),super.clear()}delete(n){const r=super.delete(n);return r&&Wt(this,Ct).splice(Wt(this,Ct).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=fs(Wt(this,Ct),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=fs(Wt(this,Ct),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return Wt(this,Ct).indexOf(n)}keyAt(n){return fs(Wt(this,Ct),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let i=o+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let i=o+r;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(n,r){let o=0;for(const i of this){if(Reflect.apply(n,r,[i,o,this]))return i;o++}}findIndex(n,r){let o=0;for(const i of this){if(Reflect.apply(n,r,[i,o,this]))return o;o++}return-1}filter(n,r){const o=[];let i=0;for(const l of this)Reflect.apply(n,r,[l,i,this])&&o.push(l),i++;return new gn(o)}map(n,r){const o=[];let i=0;for(const l of this)o.push([l[0],Reflect.apply(n,r,[l,i,this])]),i++;return new gn(o)}reduce(...n){const[r,o]=n;let i=0,l=o??this.at(0);for(const a of this)i===0&&n.length===1?l=a:l=Reflect.apply(r,this,[l,a,i,this]),i++;return l}reduceRight(...n){const[r,o]=n;let i=o??this.at(-1);for(let l=this.size-1;l>=0;l--){const a=this.at(l);l===this.size-1&&n.length===1?i=a:i=Reflect.apply(r,this,[i,a,l,this])}return i}toSorted(n){const r=[...this.entries()].sort(n);return new gn(r)}toReversed(){const n=new gn;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),i=this.get(o);n.set(o,i)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new gn(r)}slice(n,r){const o=new gn;let i=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(i=r-1);for(let l=n;l<=i;l++){const a=this.keyAt(l),s=this.get(a);o.set(a,s)}return o}every(n,r){let o=0;for(const i of this){if(!Reflect.apply(n,r,[i,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const i of this){if(Reflect.apply(n,r,[i,o,this]))return!0;o++}return!1}},Ct=new WeakMap,At(gn,"OrderedDict"),gn);function fs(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=nw(t,e);return n===-1?void 0:t[n]}At(fs,"at");function nw(t,e){const n=t.length,r=Qf(e),o=r>=0?r:n+r;return o<0||o>=n?-1:o}At(nw,"toSafeIndex");function Qf(t){return t!==t||t===0?0:Math.trunc(t)}At(Qf,"toSafeInteger");function uP(t){const e=t+"CollectionProvider",[n,r]=pc(e),[o,i]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Fd,setItemMap:At(()=>{},"setItemMap")}),l=At(({state:g,...v})=>g?b.jsx(s,{...v,state:g}):b.jsx(a,{...v}),"CollectionProvider");l.displayName=e;const a=At(g=>{const v=y();return b.jsx(s,{...g,state:v})},"CollectionInit");a.displayName=e+"Init";const s=At(g=>{const{scope:v,children:k,state:x}=g,T=S.useRef(null),[$,M]=S.useState(null),I=Qt(T,M),[F,E]=x;return S.useEffect(()=>{if(!$)return;const R=iw(()=>{});return R.observe($,{childList:!0,subtree:!0}),()=>{R.disconnect()}},[$]),b.jsx(o,{scope:v,itemMap:F,setItemMap:E,collectionRef:I,collectionRefObject:T,collectionElement:$,children:k})},"CollectionProviderImpl");s.displayName=e+"Impl";const c=t+"CollectionSlot",d=Fl(c),u=S.forwardRef((g,v)=>{const{scope:k,children:x}=g,T=i(c,k),$=Qt(v,T.collectionRef);return b.jsx(d,{ref:$,children:x})});u.displayName=c;const f=t+"CollectionItemSlot",h="data-radix-collection-item",p=Fl(f),m=S.forwardRef((g,v)=>{const{scope:k,children:x,...T}=g,$=S.useRef(null),[M,I]=S.useState(null),F=Qt(v,$,I),E=i(f,k),{setItemMap:R}=E,N=S.useRef(T);rw(N.current,T)||(N.current=T);const B=N.current;return S.useEffect(()=>{const j=B;return R(O=>M?O.has(M)?O.set(M,{...j,element:M}).toSorted(Au):(O.set(M,{...j,element:M}),O.toSorted(Au)):O),()=>{R(O=>!M||!O.has(M)?O:(O.delete(M),new Fd(O)))}},[M,B,R]),b.jsx(p,{[h]:"",ref:F,children:x})});m.displayName=f;function y(){return S.useState(new Fd)}At(y,"useInitCollection");function w(g){const{itemMap:v}=i(t+"CollectionConsumer",g);return v}return At(w,"useCollection"),[{Provider:l,Slot:u,ItemSlot:m},{createCollectionScope:r,useCollection:w,useInitCollection:y}]}At(uP,"createCollection");function rw(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||t[o]!==e[o])return!1;return!0}At(rw,"shallowEqual");function ow(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}At(ow,"isElementPreceding");function Au(t,e){return!t[1].element||!e[1].element?0:ow(t[1].element,e[1].element)?-1:1}At(Au,"sortByDocumentPosition");function iw(t){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){t();return}})}At(iw,"getChildListObserver");var fP=Object.defineProperty,pP=(t,e)=>fP(t,"name",{value:e,configurable:!0}),hP=S.createContext(void 0);function lw(t){const e=S.useContext(hP);return t||e||"ltr"}pP(lw,"useDirection");const mP=["top","right","bottom","left"],to=Math.min,xr=Math.max,Ps=Math.round,Ia=Math.floor,vr=t=>({x:t,y:t}),gP={left:"right",right:"left",bottom:"top",top:"bottom"};function aw(t,e,n){return xr(t,to(e,n))}function Cr(t,e){return typeof t=="function"?t(e):t}function no(t){return t.split("-")[0]}function Ni(t){return t.split("-")[1]}function ep(t){return t==="x"?"y":"x"}function tp(t){return t==="y"?"height":"width"}function Qn(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function np(t){return ep(Qn(t))}function yP(t,e,n){n===void 0&&(n=!1);const r=Ni(t),o=np(t),i=tp(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=Es(l)),[l,Es(l)]}function bP(t){const e=Es(t);return[Du(t),e,Du(e)]}function Du(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Em=["left","right"],Fm=["right","left"],wP=["top","bottom"],xP=["bottom","top"];function vP(t,e,n){switch(t){case"top":case"bottom":return n?e?Fm:Em:e?Em:Fm;case"left":case"right":return e?wP:xP;default:return[]}}function kP(t,e,n,r){const o=Ni(t);let i=vP(no(t),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),e&&(i=i.concat(i.map(Du)))),i}function Es(t){const e=no(t);return gP[e]+t.slice(e.length)}function CP(t){var e,n,r,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(o=t.left)!=null?o:0}}function sw(t){return typeof t!="number"?CP(t):{top:t,right:t,bottom:t,left:t}}function Fs(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function Am(t,e,n){let{reference:r,floating:o}=t;const i=Qn(e),l=np(e),a=tp(l),s=no(e),c=i==="y",d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(s){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-o.width,y:u};break;default:h={x:r.x,y:r.y}}const p=Ni(e);return p&&(h[l]+=f*(p==="end"?1:-1)*(n&&c?-1:1)),h}async function SP(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=Cr(e,t),p=sw(h),y=a[f?u==="floating"?"reference":"floating":u],w=Fs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:s})),C=u==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),v=await(i.isElement==null?void 0:i.isElement(g))&&await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1},k=Fs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:g,strategy:s}):C);return{top:(w.top-k.top+p.top)/v.y,bottom:(k.bottom-w.bottom+p.bottom)/v.y,left:(w.left-k.left+p.left)/v.x,right:(k.right-w.right+p.right)/v.x}}const TP=50,$P=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=l.detectOverflow?l:{...l,detectOverflow:SP},s=await(l.isRTL==null?void 0:l.isRTL(e));let c=await l.getElementRects({reference:t,floating:e,strategy:o}),{x:d,y:u}=Am(c,r,s),f=r,h=0;const p={};for(let m=0;m<i.length;m++){const y=i[m];if(!y)continue;const{name:w,fn:C}=y,{x:g,y:v,data:k,reset:x}=await C({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:t,floating:e}});d=g??d,u=v??u,p[w]={...p[w],...k},x&&h<TP&&(h++,typeof x=="object"&&(x.placement&&(f=x.placement),x.rects&&(c=x.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:o}):x.rects),{x:d,y:u}=Am(c,f,s)),m=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}},IP=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:l,elements:a,middlewareData:s}=e,{element:c,padding:d=0}=Cr(t,e)||{};if(c==null)return{};const u=sw(d),f={x:n,y:r},h=np(o),p=tp(h),m=await l.getDimensions(c),y=h==="y",w=y?"top":"left",C=y?"bottom":"right",g=y?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[h]-f[h]-i.floating[p],k=f[h]-i.reference[h],x=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let T=x?x[g]:0;(!T||!await(l.isElement==null?void 0:l.isElement(x)))&&(T=a.floating[g]||i.floating[p]);const $=v/2-k/2,M=T/2-m[p]/2-1,I=to(u[w],M),F=to(u[C],M),E=T-m[p]-F,R=T/2-m[p]/2+$,N=aw(I,R,E),B=!s.arrow&&Ni(o)!=null&&R!==N&&i.reference[p]/2-(R<I?I:F)-m[p]/2<0,j=B?R<I?R-I:R-E:0;return{[h]:f[h]+j,data:{[h]:N,centerOffset:R-N-j,...B&&{alignmentOffset:j}},reset:B}}}),MP=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Cr(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=no(o),C=Qn(a),g=no(a)===a,v=await(s.isRTL==null?void 0:s.isRTL(c.floating)),k=f||(g||!m?[Es(a)]:bP(a)),x=p!=="none";!f&&x&&k.push(...kP(a,m,p,v));const T=[a,...k],$=await s.detectOverflow(e,y),M=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&M.push($[w]),u){const N=yP(o,l,v);M.push($[N[0]],$[N[1]])}if(I=[...I,{placement:o,overflows:M}],!M.every(N=>N<=0)){var F,E;const N=(((F=i.flip)==null?void 0:F.index)||0)+1,B=T[N];if(B&&(!(u==="alignment"?C!==Qn(B):!1)||I.every(z=>Qn(z.placement)===C?z.overflows[0]>0:!0)))return{data:{index:N,overflows:I},reset:{placement:B}};let j=(E=I.filter(O=>O.overflows[0]<=0).sort((O,z)=>O.overflows[1]-z.overflows[1])[0])==null?void 0:E.placement;if(!j)switch(h){case"bestFit":{var R;const O=(R=I.filter(z=>{if(x){const W=Qn(z.placement);return W===C||W==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(W=>W>0).reduce((W,q)=>W+q,0)]).sort((z,W)=>z[1]-W[1])[0])==null?void 0:R[0];O&&(j=O);break}case"initialPlacement":j=a;break}if(o!==j)return{reset:{placement:j}}}return{}}}};function Dm(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Nm(t){return mP.some(e=>t[e]>=0)}const RP=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=Cr(t,e);switch(o){case"referenceHidden":{const l=await r.detectOverflow(e,{...i,elementContext:"reference"}),a=Dm(l,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Nm(a)}}}case"escaped":{const l=await r.detectOverflow(e,{...i,altBoundary:!0}),a=Dm(l,n.floating);return{data:{escapedOffsets:a,escaped:Nm(a)}}}default:return{}}}}},cw=new Set(["left","top"]);async function PP(t,e){const{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=no(n),a=Ni(n),s=Qn(n)==="y",c=cw.has(l)?-1:1,d=i&&s?-1:1,u=Cr(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),s?{x:h*d,y:f*c}:{x:f*c,y:h*d}}const EP=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:l,middlewareData:a}=e,s=await PP(e,t);return l===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}},FP=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o,platform:i}=e,{mainAxis:l=!0,crossAxis:a=!1,limiter:s={fn:C=>{let{x:g,y:v}=C;return{x:g,y:v}}},...c}=Cr(t,e),d={x:n,y:r},u=await i.detectOverflow(e,c),f=Qn(o),h=ep(f);let p=d[h],m=d[f];const y=(C,g)=>aw(g+u[C==="y"?"top":"left"],g,g-u[C==="y"?"bottom":"right"]);l&&(p=y(h,p)),a&&(m=y(f,m));const w=s.fn({...e,[h]:p,[f]:m});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:l,[f]:a}}}}}},AP=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;const{x:o,y:i,placement:l,rects:a,middlewareData:s}=e,{offset:c=0,mainAxis:d=!0,crossAxis:u=!0}=Cr(t,e),f={x:o,y:i},h=Qn(l),p=ep(h);let m=f[p],y=f[h];const w=Cr(c,e),C=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(d){const k=p==="y"?"height":"width",x=a.reference[p]-a.floating[k]+C.mainAxis,T=a.reference[p]+a.reference[k]-C.mainAxis;m<x?m=x:m>T&&(m=T)}if(u){var g,v;const k=p==="y"?"width":"height",x=cw.has(no(l)),T=a.reference[h]-a.floating[k]+(x&&((g=s.offset)==null?void 0:g[h])||0)+(x?0:C.crossAxis),$=a.reference[h]+a.reference[k]+(x?0:((v=s.offset)==null?void 0:v[h])||0)-(x?C.crossAxis:0);y<T?y=T:y>$&&(y=$)}return{[p]:m,[h]:y}}}},DP=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:o,elements:i}=e,{apply:l=()=>{},...a}=Cr(t,e),s=await o.detectOverflow(e,a),c=no(n),d=Ni(n),u=Qn(n)==="y",{width:f,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=d===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=d==="end"?"top":"bottom");const y=h-s.top-s.bottom,w=f-s.left-s.right,C=to(h-s[p],y),g=to(f-s[m],w),v=e.middlewareData.shift,k=!v;let x=C,T=g;v!=null&&v.enabled.x&&(T=w),v!=null&&v.enabled.y&&(x=y),k&&!d&&(u?T=f-2*xr(s.left,s.right):x=h-2*xr(s.top,s.bottom)),await l({...e,availableWidth:T,availableHeight:x});const $=await o.getDimensions(i.floating);return f!==$.width||h!==$.height?{reset:{rects:!0}}:{}}}};function bc(){return typeof window<"u"}function Li(t){return dw(t)?(t.nodeName||"").toLowerCase():"#document"}function an(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ir(t){var e;return(e=(dw(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function dw(t){return bc()?t instanceof Node||t instanceof an(t).Node:!1}function rr(t){return bc()?t instanceof Element||t instanceof an(t).Element:!1}function ao(t){return bc()?t instanceof HTMLElement||t instanceof an(t).HTMLElement:!1}function Lm(t){return!bc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof an(t).ShadowRoot}function wc(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=or(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function NP(t){return/^(table|td|th)$/.test(Li(t))}function xc(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const LP=/transform|translate|scale|rotate|perspective|filter/,BP=/paint|layout|strict|content/,go=t=>!!t&&t!=="none";let Ad;function rp(t){const e=rr(t)?or(t):t;return go(e.transform)||go(e.translate)||go(e.scale)||go(e.rotate)||go(e.perspective)||!op()&&(go(e.backdropFilter)||go(e.filter))||LP.test(e.willChange||"")||BP.test(e.contain||"")}function OP(t){let e=Lo(t);for(;ao(e)&&!Ll(e);){if(rp(e))return e;if(xc(e))return null;e=Lo(e)}return null}function op(){return Ad==null&&(Ad=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ad}function Ll(t){return/^(html|body|#document)$/.test(Li(t))}function or(t){return an(t).getComputedStyle(t)}function vc(t){return rr(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lo(t){if(Li(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lm(t)&&t.host||Ir(t);return Lm(e)?e.host:e}function uw(t){const e=Lo(t);return Ll(e)?(t.ownerDocument||t).body:ao(e)&&wc(e)?e:uw(e)}function Bl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=uw(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),l=an(o);if(i){const a=Nu(l);return e.concat(l,l.visualViewport||[],wc(o)?o:[],a&&n?Bl(a):[])}else return e.concat(o,Bl(o,[],n))}function Nu(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function fw(t){const e=or(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=ao(t),i=o?t.offsetWidth:n,l=o?t.offsetHeight:r,a=Ps(n)!==i||Ps(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function ip(t){return rr(t)?t:t.contextElement}function ki(t){const e=ip(t);if(!ao(e))return vr(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=fw(e);let l=(i?Ps(n.width):n.width)/r,a=(i?Ps(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const jP=vr(0);function pw(t){const e=an(t);return!op()||!e.visualViewport?jP:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function zP(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===an(t)}function Bo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=ip(t);let l=vr(1);e&&(r?rr(r)&&(l=ki(r)):l=ki(t));const a=zP(i,n,r)?pw(i):vr(0);let s=(o.left+a.x)/l.x,c=(o.top+a.y)/l.y,d=o.width/l.x,u=o.height/l.y;if(i&&r){const f=an(i),h=rr(r)?an(r):r;let p=f,m=Nu(p);for(;m&&h!==p;){const y=ki(m),w=m.getBoundingClientRect(),C=or(m),g=w.left+(m.clientLeft+parseFloat(C.paddingLeft))*y.x,v=w.top+(m.clientTop+parseFloat(C.paddingTop))*y.y;s*=y.x,c*=y.y,d*=y.x,u*=y.y,s+=g,c+=v,p=an(m),m=Nu(p)}}return Fs({width:d,height:u,x:s,y:c})}function kc(t,e){const n=vc(t).scrollLeft;return e?e.left+n:Bo(Ir(t)).left+n}function hw(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kc(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function HP(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i=o==="fixed",l=Ir(r),a=e?xc(e.floating):!1;if(r===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=vr(1);const d=vr(0),u=ao(r);if((u||!i)&&((Li(r)!=="body"||wc(l))&&(s=vc(r)),u)){const h=Bo(r);c=ki(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=l&&!u&&!i?hw(l,s):vr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-s.scrollTop*c.y+d.y+f.y}}function _P(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function WP(t){const e=vc(t),n=t.ownerDocument.body,r=xr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=xr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-e.scrollLeft+kc(t);const l=-e.scrollTop;return or(n).direction==="rtl"&&(i+=xr(t.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:l}}const VP=25;function qP(t,e,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=an(t),i=Ir(t),l=o.visualViewport;let a=i.clientWidth,s=i.clientHeight,c=0,d=0;if(l){const f=!op()||e==="fixed";r?f||(c=-l.offsetLeft,d=-l.offsetTop):(a=l.width,s=l.height,f&&(c=l.offsetLeft,d=l.offsetTop))}if(kc(i)<=0){const f=i.ownerDocument,h=f.body,p=getComputedStyle(h),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-h.clientWidth-m),w=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;w<=VP&&(a-=w)}return{width:a,height:s,x:c,y:d}}function ZP(t,e){const n=Bo(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=ki(t),l=t.clientWidth*i.x,a=t.clientHeight*i.y,s=o*i.x,c=r*i.y;return{width:l,height:a,x:s,y:c}}function Bm(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=qP(t,n,e);else if(e==="document")r=WP(Ir(t));else if(rr(e))r=ZP(e,n);else{const o=pw(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Fs(r)}function KP(t,e){const n=e.get(t);if(n)return n;let r=Bl(t,[],!1).filter(a=>rr(a)&&Li(a)!=="body"),o=null;const i=or(t).position==="fixed";let l=i?Lo(t):t;for(;rr(l)&&!Ll(l);){const a=or(l),s=rp(l),c=o?o.position:i?"fixed":"";!s&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(u=>u!==l):o=a,l=Lo(l)}return e.set(t,r),r}function UP(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const l=[...n==="clippingAncestors"?xc(e)?[]:KP(e,this._c):[].concat(n),r],a=Bm(e,l[0],o);let s=a.top,c=a.right,d=a.bottom,u=a.left;for(let f=1;f<l.length;f++){const h=Bm(e,l[f],o);s=xr(h.top,s),c=to(h.right,c),d=to(h.bottom,d),u=xr(h.left,u)}return{width:c-u,height:d-s,x:u,y:s}}function XP(t){const{width:e,height:n}=fw(t);return{width:e,height:n}}function GP(t,e,n){const r=ao(e),o=Ir(e),i=n==="fixed",l=Bo(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const s=vr(0);if((r||!i)&&((Li(e)!=="body"||wc(o))&&(a=vc(e)),r)){const f=Bo(e,!0,i,e);s.x=f.x+e.clientLeft,s.y=f.y+e.clientTop}!r&&o&&(s.x=kc(o));const c=o&&!r&&!i?hw(o,a):vr(0),d=l.left+a.scrollLeft-s.x-c.x,u=l.top+a.scrollTop-s.y-c.y;return{x:d,y:u,width:l.width,height:l.height}}function Dd(t){return or(t).position==="static"}function Om(t,e){if(!ao(t)||or(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ir(t)===n&&(n=n.ownerDocument.body),n}function mw(t,e){const n=an(t);if(xc(t))return n;if(!ao(t)){let o=Lo(t);for(;o&&!Ll(o);){if(rr(o)&&!Dd(o))return o;o=Lo(o)}return n}let r=Om(t,e);for(;r&&NP(r)&&Dd(r);)r=Om(r,e);return r&&Ll(r)&&Dd(r)&&!rp(r)?n:r||OP(t)||n}const YP=async function(t){const e=this.getOffsetParent||mw,n=this.getDimensions,r=await n(t.floating);return{reference:GP(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JP(t){return or(t).direction==="rtl"}const QP={convertOffsetParentRelativeRectToViewportRelativeRect:HP,getDocumentElement:Ir,getClippingRect:UP,getOffsetParent:mw,getElementRects:YP,getClientRects:_P,getDimensions:XP,getScale:ki,isElement:rr,isRTL:JP};function gw(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function eE(t,e,n){let r=null,o;const i=Ir(t);function l(){var d;clearTimeout(o),(d=r)==null||d.disconnect(),r=null}function a(d,u){d===void 0&&(d=!1),u===void 0&&(u=1),l();const f=t.getBoundingClientRect(),{left:h,top:p,width:m,height:y}=f;if(d||e(),!m||!y)return;const w=Ia(p),C=Ia(i.clientWidth-(h+m)),g=Ia(i.clientHeight-(p+y)),v=Ia(h),x={rootMargin:-w+"px "+-C+"px "+-g+"px "+-v+"px",threshold:xr(0,to(1,u))||1};let T=!0;function $(M){const I=M[0].intersectionRatio;if(!gw(f,t.getBoundingClientRect()))return a();if(I!==u){if(!T)return a();I?a(!1,I):o=setTimeout(()=>{a(!1,1e-7)},1e3)}T=!1}try{r=new IntersectionObserver($,{...x,root:i.ownerDocument})}catch{r=new IntersectionObserver($,x)}r.observe(t)}const s=an(t),c=()=>a(n);return s.addEventListener("resize",c),a(!0),()=>{s.removeEventListener("resize",c),l()}}function tE(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:s=!1}=r,c=ip(t),d=o||i?[...c?Bl(c):[],...e?Bl(e):[]]:[];d.forEach(w=>{o&&w.addEventListener("scroll",n),i&&w.addEventListener("resize",n)});const u=c&&a?eE(c,n,i):null;let f=-1,h=null;l&&(h=new ResizeObserver(w=>{let[C]=w;C&&C.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(e)})),n()}),c&&!s&&h.observe(c),e&&h.observe(e));let p,m=s?Bo(t):null;s&&y();function y(){const w=Bo(t);m&&!gw(m,w)&&n(),m=w,p=requestAnimationFrame(y)}return n(),()=>{var w;d.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),u?.(),(w=h)==null||w.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const nE=EP,rE=FP,oE=MP,iE=DP,lE=RP,jm=IP,aE=AP,sE=(t,e,n)=>{const r=new Map,o=n??{},i={...QP,...o.platform,_c:r};return $P(t,e,{...o,platform:i})};var cE=typeof document<"u",dE=function(){},ps=cE?S.useLayoutEffect:dE;function As(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!As(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!As(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function yw(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function zm(t,e){const n=yw(t);return Math.round(e*n)/n}function Nd(t){const e=S.useRef(t);return ps(()=>{e.current=t}),e}function uE(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:a=!0,whileElementsMounted:s,open:c}=t,[d,u]=S.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=S.useState(r);As(f,r)||h(r);const[p,m]=S.useState(null),[y,w]=S.useState(null),C=S.useCallback(z=>{z!==x.current&&(x.current=z,m(z))},[]),g=S.useCallback(z=>{z!==T.current&&(T.current=z,w(z))},[]),v=i||p,k=l||y,x=S.useRef(null),T=S.useRef(null),$=S.useRef(d),M=s!=null,I=Nd(s),F=Nd(o),E=Nd(c),R=S.useCallback(()=>{if(!x.current||!T.current)return;const z={placement:e,strategy:n,middleware:f};F.current&&(z.platform=F.current),sE(x.current,T.current,z).then(W=>{const q={...W,isPositioned:E.current!==!1};N.current&&!As($.current,q)&&($.current=q,Ql.flushSync(()=>{u(q)}))})},[f,e,n,F,E]);ps(()=>{c===!1&&$.current.isPositioned&&($.current.isPositioned=!1,u(z=>({...z,isPositioned:!1})))},[c]);const N=S.useRef(!1);ps(()=>(N.current=!0,()=>{N.current=!1}),[]),ps(()=>{if(v&&(x.current=v),k&&(T.current=k),v&&k){if(I.current)return I.current(v,k,R);R()}},[v,k,R,I,M]);const B=S.useMemo(()=>({reference:x,floating:T,setReference:C,setFloating:g}),[C,g]),j=S.useMemo(()=>({reference:v,floating:k}),[v,k]),O=S.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const W=zm(j.floating,d.x),q=zm(j.floating,d.y);return a?{...z,transform:"translate("+W+"px, "+q+"px)",...yw(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:q}},[n,a,j.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:R,refs:B,elements:j,floatingStyles:O}),[d,R,B,j,O])}const fE=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?jm({element:r.current,padding:o}).fn(n):{}:r?jm({element:r,padding:o}).fn(n):{}}}},pE=(t,e)=>{const n=nE(t);return{name:n.name,fn:n.fn,options:[t,e]}},hE=(t,e)=>{const n=rE(t);return{name:n.name,fn:n.fn,options:[t,e]}},mE=(t,e)=>({fn:aE(t).fn,options:[t,e]}),gE=(t,e)=>{const n=oE(t);return{name:n.name,fn:n.fn,options:[t,e]}},yE=(t,e)=>{const n=iE(t);return{name:n.name,fn:n.fn,options:[t,e]}},bE=(t,e)=>{const n=lE(t);return{name:n.name,fn:n.fn,options:[t,e]}},wE=(t,e)=>{const n=fE(t);return{name:n.name,fn:n.fn,options:[t,e]}};var xE=Object.defineProperty,vE=(t,e)=>xE(t,"name",{value:e,configurable:!0});function bw(t){const[e,n]=S.useState(void 0);return wr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,a;if("borderBoxSize"in i){const s=i.borderBoxSize,c=Array.isArray(s)?s[0]:s;l=c.inlineSize,a=c.blockSize}else l=t.offsetWidth,a=t.offsetHeight;n({width:l,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}vE(bw,"useSize");var kE=Object.defineProperty,Zr=(t,e)=>kE(t,"name",{value:e,configurable:!0}),ww="Popper",[xw,vw]=pc(ww),[CE,kw]=xw(ww),SE=Zr(t=>{const{__scopePopper:e,children:n}=t,[r,o]=S.useState(null),[i,l]=S.useState(void 0);return b.jsx(CE,{scope:e,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:l,children:n})},"Popper"),TE="PopperAnchor",$E=S.forwardRef(Zr(function(e,n){const{__scopePopper:r,virtualRef:o,...i}=e,l=kw(TE,r),a=S.useRef(null),s=l.onAnchorChange,c=S.useCallback(m=>{a.current=m,m&&s(m)},[s]),d=Qt(n,c),u=S.useRef(null);S.useEffect(()=>{if(!o)return;const m=u.current;u.current=o.current,m!==u.current&&s(u.current)});const f=l.placementState&&Cc(l.placementState),h=f?.[0],p=f?.[1];return o?null:b.jsx(un.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...i,ref:d})},"PopperAnchor")),Cw="PopperContent",[IE,OJ]=xw(Cw),ME=S.forwardRef(Zr(function(e,n){const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:l="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:m,...y}=e,w=kw(Cw,r),[C,g]=S.useState(null),v=Qt(n,g),[k,x]=S.useState(null),T=bw(k),$=T?.width??0,M=T?.height??0,I=o+(l!=="center"?"-"+l:""),F=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},E=Array.isArray(d)?d:[d],R=E.length>0,N={padding:F,boundary:E.filter(Sw),altBoundary:R},{refs:B,floatingStyles:j,placement:O,isPositioned:z,middlewareData:W}=uE({strategy:"fixed",placement:I,whileElementsMounted:Zr((...K)=>tE(...K,{animationFrame:p==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[pE({mainAxis:i+M,alignmentAxis:a}),c&&hE({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?mE():void 0,...N}),c&&gE({...N}),yE({...N,apply:Zr(({elements:K,rects:ee,availableWidth:G,availableHeight:te})=>{const{width:A,height:P}=ee.reference,_=K.floating.style;_.setProperty("--radix-popper-available-width",`${G}px`),_.setProperty("--radix-popper-available-height",`${te}px`),_.setProperty("--radix-popper-anchor-width",`${A}px`),_.setProperty("--radix-popper-anchor-height",`${P}px`)},"apply")}),k&&wE({element:k,padding:s}),RE({arrowWidth:$,arrowHeight:M}),h&&bE({strategy:"referenceHidden",...N,boundary:R?N.boundary:void 0})]}),q=w.setPlacementState;wr(()=>(q(O),()=>{q(void 0)}),[O,q]);const[Q,X]=Cc(O),se=hc(m);wr(()=>{z&&se?.()},[z,se]);const ie=W.arrow?.x,ce=W.arrow?.y,Y=W.arrow?.centerOffset!==0,[V,Z]=S.useState();return wr(()=>{C&&Z(window.getComputedStyle(C).zIndex)},[C]),b.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:z?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:b.jsx(IE,{scope:r,placedSide:Q,placedAlign:X,onArrowChange:x,arrowX:ie,arrowY:ce,shouldHideArrow:Y,children:b.jsx(un.div,{"data-side":Q,"data-align":X,...y,ref:v,style:{...y.style,animation:z?y.style?.animation:"none"}})})})},"PopperContent"));function Sw(t){return t!==null}Zr(Sw,"isNotNull");var RE=Zr(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,l=o.arrow?.centerOffset!==0,a=l?0:t.arrowWidth,s=l?0:t.arrowHeight,[c,d]=Cc(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+s/2;let p="",m="";return c==="bottom"?(p=l?u:`${f}px`,m=`${-s}px`):c==="top"?(p=l?u:`${f}px`,m=`${r.floating.height+s}px`):c==="right"?(p=`${-s}px`,m=l?u:`${h}px`):c==="left"&&(p=`${r.floating.width+s}px`,m=l?u:`${h}px`),{data:{x:p,y:m}}}}),"transformOrigin");function Cc(t){const[e,n="center"]=t.split("-");return[e,n]}Zr(Cc,"getSideAndAlignFromPlacement");var PE=SE,EE=$E,FE=ME,AE=Object.defineProperty,DE=(t,e)=>AE(t,"name",{value:e,configurable:!0});function Tw(t){const e=S.useRef({value:t,previous:t});return S.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}DE(Tw,"usePrevious");var NE=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),LE=Object.defineProperty,Ke=(t,e)=>LE(t,"name",{value:e,configurable:!0}),BE=[" ","Enter","ArrowUp","ArrowDown"],OE=[" ","Enter"],$i="Select",[Sc,lp,jE]=tw($i),[Jo,jJ]=pc($i,[jE,vw]),ap=vw(),[zE,so]=Jo($i),[HE,_E]=Jo($i);function $w(t){const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:i,value:l,defaultValue:a,onValueChange:s,dir:c,name:d,autoComplete:u,disabled:f,required:h,form:p,internal_do_not_use_render:m}=t,y=ap(e),[w,C]=S.useState(null),[g,v]=S.useState(null),[k,x]=S.useState(!1),T=lw(c),[$,M]=um({prop:r,defaultProp:o??!1,onChange:i,caller:$i}),[I,F]=um({prop:l,defaultProp:a,onChange:s,caller:$i}),E=S.useRef(null),R=S.useRef(I);S.useEffect(()=>{const X=p?w?.ownerDocument.getElementById(p):w?.form;if(X instanceof HTMLFormElement){const se=Ke(()=>F(R.current),"reset");return X.addEventListener("reset",se),()=>X.removeEventListener("reset",se)}},[p,w,F]);const N=w?!!p||!!w.closest("form"):!0,[B,j]=S.useState(new Set),O=Vf(),z=Array.from(B).map(X=>X.props.value).join(";"),W=S.useCallback(X=>{j(se=>new Set(se).add(X))},[]),q=S.useCallback(X=>{j(se=>{const ie=new Set(se);return ie.delete(X),ie})},[]),Q={required:h,trigger:w,onTriggerChange:C,valueNode:g,onValueNodeChange:v,valueNodeHasChildren:k,onValueNodeHasChildrenChange:x,contentId:O,value:I,onValueChange:F,open:$,onOpenChange:M,dir:T,triggerPointerDownPosRef:E,disabled:f,name:d,autoComplete:u,form:p,nativeOptions:B,nativeSelectKey:z,isFormControl:N};return b.jsx(PE,{...y,children:b.jsx(zE,{scope:e,...Q,children:b.jsx(Sc.Provider,{scope:e,children:b.jsx(HE,{scope:e,onNativeOptionAdd:W,onNativeOptionRemove:q,children:Rw(m)?m(Q):n})})})})}Ke($w,"SelectProvider");var WE=Ke(t=>{const{__scopeSelect:e,children:n,...r}=t;return b.jsx($w,{__scopeSelect:e,...r,internal_do_not_use_render:({isFormControl:o})=>b.jsxs(b.Fragment,{children:[n,o?b.jsx(xF,{__scopeSelect:e}):null]})})},"Select"),VE="SelectTrigger",qE=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,disabled:o=!1,...i}=e,l=ap(r),a=so(VE,r),s=a.disabled||o,c=Qt(n,a.onTriggerChange),d=lp(r),u=S.useRef("touch"),[f,h,p]=sp(y=>{const w=d().filter(v=>!v.disabled),C=w.find(v=>v.value===a.value),g=cp(w,y,C);g!==void 0&&a.onValueChange(g.value)}),m=Ke(y=>{s||(a.onOpenChange(!0),p()),y&&(a.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return b.jsx(EE,{asChild:!0,...l,children:b.jsx(un.button,{type:"button",role:"combobox","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":ta(a.value)?"":void 0,...i,ref:c,onClick:ln(i.onClick,y=>{y.currentTarget.focus(),u.current!=="mouse"&&m(y)}),onPointerDown:ln(i.onPointerDown,y=>{u.current=y.pointerType;const w=y.target;w.hasPointerCapture(y.pointerId)&&w.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(m(y),y.preventDefault())}),onKeyDown:ln(i.onKeyDown,y=>{const w=f.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&h(y.key),!(w&&y.key===" ")&&BE.includes(y.key)&&(m(),y.preventDefault())})})})},"SelectTrigger")),ZE="SelectValue",KE=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,className:o,style:i,children:l,placeholder:a="",...s}=e,c=so(ZE,r),{onValueNodeHasChildrenChange:d}=c,u=l!==void 0,f=Qt(n,c.onValueNodeChange);wr(()=>{d(u)},[d,u]);const h=ta(c.value);return b.jsx(un.span,{...s,asChild:h?!1:s.asChild,ref:f,style:{pointerEvents:"none"},children:b.jsx(S.Fragment,{children:h?a:l},h?"placeholder":"value")})},"SelectValue")),UE=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,children:o,...i}=e;return b.jsx(un.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})},"SelectIcon")),XE="SelectPortal",[GE,YE]=Jo(XE,{forceMount:void 0}),JE=Ke(t=>{const{__scopeSelect:e,forceMount:n,...r}=t;return b.jsx(GE,{scope:t.__scopeSelect,forceMount:n,children:b.jsx(l$,{asChild:!0,...r})})},"SelectPortal"),Oo="SelectContent",QE=S.forwardRef(Ke(function(e,n){const r=YE(Oo,e.__scopeSelect),{forceMount:o=r.forceMount,...i}=e,l=so(Oo,e.__scopeSelect),[a,s]=S.useState();return wr(()=>{s(new DocumentFragment)},[]),b.jsx(a$,{present:o||l.open,children:({present:c})=>c?b.jsx(nF,{...i,ref:n}):b.jsx(eF,{...i,fragment:a})})},"SelectContent")),eF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,children:o,fragment:i}=e;return i?Ql.createPortal(b.jsx(Iw,{scope:r,children:b.jsx(Sc.Slot,{scope:r,children:b.jsx("div",{ref:n,children:o})})}),i):null},"SelectContentFragment")),Ln=10,[Iw,Tc]=Jo(Oo),tF=Fl("SelectContent.RemoveScroll"),nF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r}=e,{position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:a,side:s,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:y,avoidCollisions:w,...C}=e,g=so(Oo,r),[v,k]=S.useState(null),[x,T]=S.useState(null),$=Qt(n,k),[M,I]=S.useState(null),[F,E]=S.useState(null),R=lp(r),[N,B]=S.useState(!1),j=S.useRef(!1);S.useEffect(()=>{if(v)return s$(v)},[v]),c$();const O=S.useCallback(Z=>{const[K,...ee]=R().map(A=>A.ref.current),[G]=ee.slice(-1),te=document.activeElement;for(const A of Z)if(A===te||(A?.scrollIntoView({block:"nearest"}),A===K&&x&&(x.scrollTop=0),A===G&&x&&(x.scrollTop=x.scrollHeight),A?.focus(),document.activeElement!==te))return},[R,x]),z=S.useCallback(()=>O([M,v]),[O,M,v]);S.useEffect(()=>{N&&z()},[N,z]);const{onOpenChange:W,triggerPointerDownPosRef:q}=g;S.useEffect(()=>{if(v){let Z={x:0,y:0};const K=Ke(G=>{Z={x:Math.abs(Math.round(G.pageX)-(q.current?.x??0)),y:Math.abs(Math.round(G.pageY)-(q.current?.y??0))}},"handlePointerMove"),ee=Ke(G=>{Z.x<=10&&Z.y<=10?G.preventDefault():G.composedPath().includes(v)||W(!1),document.removeEventListener("pointermove",K),q.current=null},"handlePointerUp");return q.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",ee,{capture:!0})}}},[v,W,q]),S.useEffect(()=>{const Z=Ke(()=>W(!1),"close");return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[W]);const[Q,X]=sp(Z=>{const K=R().filter(te=>!te.disabled),ee=K.find(te=>te.ref.current===document.activeElement),G=cp(K,Z,ee);G&&setTimeout(()=>G.ref.current?.focus())}),se=S.useCallback((Z,K,ee)=>{const G=!j.current&&!ee;(g.value!==void 0&&g.value===K||G)&&(I(Z),G&&(j.current=!0))},[g.value]),ie=S.useCallback(()=>v?.focus(),[v]),ce=S.useCallback((Z,K,ee)=>{const G=!j.current&&!ee;(g.value!==void 0&&g.value===K||G)&&E(Z)},[g.value]),Y=o==="popper"?Hm:rF,V=Y===Hm?{side:s,sideOffset:c,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:y,avoidCollisions:w}:{};return b.jsx(Iw,{scope:r,content:v,viewport:x,onViewportChange:T,itemRefCallback:se,selectedItem:M,onItemLeave:ie,itemTextRefCallback:ce,focusSelectedItem:z,selectedItemText:F,position:o,isPositioned:N,searchRef:Q,children:b.jsx(d$,{as:tF,allowPinchZoom:!0,children:b.jsx(u$,{asChild:!0,trapped:g.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:ln(i,Z=>{g.trigger?.focus({preventScroll:!0}),Z.preventDefault()}),children:b.jsx(f$,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:b.jsx(Y,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:Z=>Z.preventDefault(),...C,...V,onPlaced:()=>B(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ln(C.onKeyDown,Z=>{const K=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!K&&Z.key.length===1&&X(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let G=R().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(G=G.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const te=Z.target,A=G.indexOf(te);G=G.slice(A+1)}setTimeout(()=>O(G)),Z.preventDefault()}})})})})})})},"SelectContentImpl")),rF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,onPlaced:o,...i}=e,l=so(Oo,r),a=Tc(Oo,r),[s,c]=S.useState(null),[d,u]=S.useState(null),f=Qt(n,u),h=lp(r),p=S.useRef(!1),m=S.useRef(!0),{viewport:y,selectedItem:w,selectedItemText:C,focusSelectedItem:g}=a,v=S.useCallback(()=>{if(l.trigger&&l.valueNode&&s&&d&&y&&w&&C){const $=l.trigger.getBoundingClientRect(),M=d.getBoundingClientRect(),I=l.valueNode.getBoundingClientRect(),F=C.getBoundingClientRect();if(l.dir!=="rtl"){const te=F.left-M.left,A=I.left-te,P=$.left-A,_=$.width+P,H=Math.max(_,M.width),le=window.innerWidth-Ln,ue=Fu(A,[Ln,Math.max(Ln,le-H)]);s.style.minWidth=_+"px",s.style.left=ue+"px"}else{const te=M.right-F.right,A=window.innerWidth-I.right-te,P=window.innerWidth-$.right-A,_=$.width+P,H=Math.max(_,M.width),le=window.innerWidth-Ln,ue=Fu(A,[Ln,Math.max(Ln,le-H)]);s.style.minWidth=_+"px",s.style.right=ue+"px"}const E=h(),R=window.innerHeight-Ln*2,N=y.scrollHeight,B=window.getComputedStyle(d),j=parseInt(B.borderTopWidth,10),O=parseInt(B.paddingTop,10),z=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),q=j+O+N+W+z,Q=Math.min(w.offsetHeight*5,q),X=window.getComputedStyle(y),se=parseInt(X.paddingTop,10),ie=parseInt(X.paddingBottom,10),ce=$.top+$.height/2-Ln,Y=R-ce,V=w.offsetHeight/2,Z=w.offsetTop+V,K=j+O+Z,ee=q-K;if(K<=ce){const te=E.length>0&&w===E[E.length-1].ref.current;s.style.bottom="0px";const A=d.clientHeight-y.offsetTop-y.offsetHeight,P=Math.max(Y,V+(te?ie:0)+A+z),_=K+P;s.style.height=_+"px"}else{const te=E.length>0&&w===E[0].ref.current;s.style.top="0px";const P=Math.max(ce,j+y.offsetTop+(te?se:0)+V)+ee;s.style.height=P+"px",y.scrollTop=K-ce+y.offsetTop}s.style.margin=`${Ln}px 0`,s.style.minHeight=Q+"px",s.style.maxHeight=R+"px",o?.(),requestAnimationFrame(()=>p.current=!0)}},[h,l.trigger,l.valueNode,s,d,y,w,C,l.dir,o]);wr(()=>v(),[v]);const[k,x]=S.useState();wr(()=>{d&&x(window.getComputedStyle(d).zIndex)},[d]);const T=S.useCallback($=>{$&&m.current===!0&&(v(),g?.(),m.current=!1)},[v,g]);return b.jsx(oF,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:b.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:b.jsx(un.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})},"SelectItemAlignedPosition")),Hm=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,align:o="start",collisionPadding:i=Ln,...l}=e,a=ap(r);return b.jsx(FE,{...a,...l,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[oF,iF]=Jo(Oo,{}),_m="SelectViewport",lF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,nonce:o,...i}=e,l=Tc(_m,r),a=iF(_m,r),s=Qt(n,l.onViewportChange),c=S.useRef(0);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),b.jsx(Sc.Slot,{scope:r,children:b.jsx(un.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ln(i.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const p=Math.abs(c.current-u.scrollTop);if(p>0){const m=window.innerHeight-Ln*2,y=parseFloat(f.style.minHeight),w=parseFloat(f.style.height),C=Math.max(y,w);if(C<m){const g=C+p,v=Math.min(m,g),k=g-v;f.style.height=v+"px",f.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})},"SelectViewport")),aF="SelectGroup",[sF,cF]=Jo(aF),dF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,...o}=e,i=Vf();return b.jsx(sF,{scope:r,id:i,children:b.jsx(un.div,{role:"group","aria-labelledby":i,...o,ref:n})})},"SelectGroup")),uF="SelectLabel",fF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,...o}=e,i=cF(uF,r);return b.jsx(un.div,{id:i.id,...o,ref:n})},"SelectLabel")),Lu="SelectItem",[pF,Mw]=Jo(Lu),hF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,value:o,disabled:i=!1,textValue:l,...a}=e,s=so(Lu,r),c=Tc(Lu,r),d=s.value===o,[u,f]=S.useState(l??""),[h,p]=S.useState(!1),m=hc(v=>c.itemRefCallback?.(v,o,i)),y=Qt(n,m),w=Vf(),C=S.useRef("touch"),g=Ke(()=>{i||(s.onValueChange(o),s.onOpenChange(!1))},"handleSelect");return b.jsx(pF,{scope:r,value:o,disabled:i,textId:w,isSelected:d,onItemTextChange:S.useCallback(v=>{f(k=>k||(v?.textContent??"").trim())},[]),children:b.jsx(Sc.ItemSlot,{scope:r,value:o,disabled:i,textValue:u,children:b.jsx(un.div,{role:"option","aria-labelledby":w,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:y,onFocus:ln(a.onFocus,()=>p(!0)),onBlur:ln(a.onBlur,()=>p(!1)),onClick:ln(a.onClick,()=>{C.current!=="mouse"&&g()}),onPointerUp:ln(a.onPointerUp,()=>{C.current==="mouse"&&g()}),onPointerDown:ln(a.onPointerDown,v=>{C.current=v.pointerType}),onPointerMove:ln(a.onPointerMove,v=>{C.current=v.pointerType,i?c.onItemLeave?.():C.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ln(a.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ln(a.onKeyDown,v=>{i||v.target!==v.currentTarget||c.searchRef?.current!==""&&v.key===" "||(OE.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})},"SelectItem")),Ma="SelectItemText",mF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,className:o,style:i,...l}=e,a=so(Ma,r),s=Tc(Ma,r),c=Mw(Ma,r),d=_E(Ma,r),[u,f]=S.useState(null),h=hc(g=>s.itemTextRefCallback?.(g,c.value,c.disabled)),p=Qt(n,f,c.onItemTextChange,h),m=u?.textContent,y=S.useMemo(()=>b.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:w,onNativeOptionRemove:C}=d;return wr(()=>(w(y),()=>C(y)),[w,C,y]),b.jsxs(b.Fragment,{children:[b.jsx(un.span,{id:c.textId,...l,ref:p}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren&&!ta(a.value)?Ql.createPortal(l.children,a.valueNode):null]})},"SelectItemText")),gF="SelectItemIndicator",yF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,...o}=e;return Mw(gF,r).isSelected?b.jsx(un.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),bF=S.forwardRef(Ke(function(e,n){const{__scopeSelect:r,...o}=e;return b.jsx(un.div,{"aria-hidden":!0,...o,ref:n})},"SelectSeparator")),wF="SelectBubbleInput",xF=S.forwardRef(Ke(function({__scopeSelect:e,...n},r){const o=so(wF,e),{value:i,onValueChange:l,required:a,disabled:s,name:c,autoComplete:d,form:u}=o,{nativeOptions:f,nativeSelectKey:h}=o,p=S.useRef(null),m=Qt(r,p),y=i??"",w=Tw(y),C=Array.from(f).some(g=>(g.props.value??"")==="");return S.useEffect(()=>{const g=p.current;if(!g)return;const v=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(v,"value").set;if(w!==y&&x){const T=new Event("change",{bubbles:!0});x.call(g,y),g.dispatchEvent(T)}},[w,y]),b.jsxs(un.select,{"aria-hidden":!0,required:a,tabIndex:-1,name:c,autoComplete:d,disabled:s,form:u,onChange:g=>l(g.target.value),...n,style:{...NE,...n.style},ref:m,defaultValue:y,children:[ta(i)&&!C?b.jsx("option",{value:""}):null,Array.from(f)]},h)},"SelectBubbleInput"));function Rw(t){return typeof t=="function"}Ke(Rw,"isFunction");function ta(t){return t===""||t===void 0}Ke(ta,"shouldShowPlaceholder");function sp(t){const e=hc(t),n=S.useRef(""),r=S.useRef(0),o=S.useCallback(l=>{const a=n.current+l;e(a),Ke((function s(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>s(""),1e3))}),"updateSearch")(a)},[e]),i=S.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}Ke(sp,"useTypeaheadSearch");function cp(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let l=Pw(t,Math.max(i,0));o.length===1&&(l=l.filter(c=>c!==n));const s=l.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return s!==n?s:void 0}Ke(cp,"findNextItem");function Pw(t,e){return t.map((n,r)=>t[(e+r)%t.length])}Ke(Pw,"wrapArray");var vF={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},kF=new Set(["Title","Heading1","Heading2","Heading3"]),CF={Subtitle:"666666"},SF="#4a6c8c";function TF(t){let e=vF[t.styleId],n={fontSize:e?`${e}px`:`${Math.min(Math.max(t.fontSize?t.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(t.bold??kF.has(t.styleId))&&(n.fontWeight="bold"),t.italic&&(n.fontStyle="italic");let r=t.color??CF[t.styleId];return r?n.color=`#${r}`:t.styleId.startsWith("Heading")&&(n.color=SF),n}function $F(t){return!t||t.length===0?[]:t.filter(e=>e.type==="paragraph").filter(e=>e.qFormat?!0:!(e.hidden||e.semiHidden)).map(e=>({styleId:e.styleId,name:e.name||e.styleId,priority:e.uiPriority??99,fontSize:e.rPr?.fontSize,bold:e.rPr?.bold,italic:e.rPr?.italic,color:e.rPr?.color?.rgb})).sort((e,n)=>e.priority-n.priority)}function IF(t){return t===void 0?void 0:t.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n)}var MF={FFFF00:"yellow","00FF00":"green","00FFFF":"cyan",FF00FF:"magenta","0000FF":"blue",FF0000:"red","00008B":"darkBlue","008080":"darkCyan","008000":"darkGreen",800080:"darkMagenta","8B0000":"darkRed",808e3:"darkYellow",808080:"darkGray",C0C0C0:"lightGray","000000":"black",FFFFFF:"white"};function Ew(t){let e=t.replace(/^#/,"").toUpperCase();return MF[e]||null}var RF="https://github.com/eigenpal/docx-editor/issues/new";function PF(t={}){let e=t.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=t.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${t.pageUrl??(typeof window<"u"?window.location.href:"")}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${e}`,""].join(`
30
+ `),o=new URLSearchParams({title:"[Bug] ",body:r});return`${RF}?${o.toString()}`}function EF(t){typeof window>"u"||window.open(PF(t),"_blank","noopener,noreferrer")}var Wm=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Vm=wb,FF=(t,e)=>n=>{var r;if(e?.variants==null)return Vm(t,n?.class,n?.className);let{variants:o,defaultVariants:i}=e,l=Object.keys(o).map(c=>{let d=n?.[c],u=i?.[c];if(d===null)return null;let f=Wm(d)||Wm(u);return o[c][f]}),a=n&&Object.entries(n).reduce((c,d)=>{let[u,f]=d;return f===void 0||(c[u]=f),c},{}),s=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:f,...h}=d;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...i,...a}[m]):{...i,...a}[m]===y})?[...c,u,f]:c},[]);return Vm(t,l,s,n?.class,n?.className)};function We(...t){return wb(t)}var AF=FF("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),_n=S.forwardRef(({className:t,variant:e,size:n,...r},o)=>b.jsx("button",{className:We(AF({variant:e,size:n,className:t})),ref:o,...r}));_n.displayName="Button";var DF=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],NF=1,LF=400;function qm(t,e,n){for(let r of e)if(r>t)return r;return Math.min(t+1,n)}function Zm(t,e,n){for(let r=e.length-1;r>=0;r--)if(e[r]<t)return e[r];return Math.max(t-1,n)}function BF({value:t,onChange:e,sizes:n=DF,disabled:r=!1,className:o,placeholder:i="11",minSize:l=NF,maxSize:a=LF}){let{t:s}=Re(),[c,d]=S.useState(!1),[u,f]=S.useState(""),[h,p]=S.useState(!1),m=S.useRef(null),y=S.useCallback(()=>{p(!1),d(!1)},[]),{containerRef:w,dropdownRef:C,dropdownStyle:g}=Yo({isOpen:h,onClose:y}),v=t??(parseInt(i,10)||11),k=t!==void 0?t.toString():i,x=S.useCallback(N=>{if(N.preventDefault(),r)return;let B=Zm(v,n,l);e?.(B)},[v,n,l,r,e]),T=S.useCallback(N=>{if(N.preventDefault(),r)return;let B=qm(v,n,a);e?.(B)},[v,n,a,r,e]),$=S.useCallback(N=>{N.preventDefault(),!r&&(d(!0),f(k),p(!0),requestAnimationFrame(()=>{m.current?.focus(),m.current?.select()}))},[r,k]),M=S.useCallback(N=>{f(N.target.value)},[]),I=S.useCallback(()=>{d(!1);let N=parseFloat(u);if(!isNaN(N)&&N>=l&&N<=a){let B=Math.round(N*2)/2;e?.(B)}},[u,l,a,e]),F=S.useCallback(N=>{if(N.key==="Enter")N.preventDefault(),I(),p(!1);else if(N.key==="Escape")d(!1),p(!1);else if(N.key==="ArrowUp"){N.preventDefault();let B=qm(v,n,a);f(B.toString()),e?.(B)}else if(N.key==="ArrowDown"){N.preventDefault();let B=Zm(v,n,l);f(B.toString()),e?.(B)}},[I,v,n,a,l,e]),E=S.useCallback(N=>{e?.(N),p(!1),d(!1)},[e]),R=S.useCallback(N=>{N.target.tagName!=="INPUT"&&N.preventDefault()},[]);return b.jsxs("div",{ref:w,className:We("flex items-center",o),onMouseDown:R,children:[b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:r||v<=l,"aria-label":s("fontSize.decrease"),"data-testid":"font-size-decrease",children:b.jsx(we,{name:"remove",size:18})}),b.jsx("div",{className:"relative",children:c?b.jsx("input",{ref:m,type:"text",value:u,onChange:M,onBlur:I,onKeyDown:F,className:We("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":s("fontSize.label"),"data-testid":"font-size-input"}):b.jsx("button",{type:"button",onClick:$,className:We("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",r&&"opacity-50 cursor-not-allowed"),disabled:r,"aria-label":s("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":h,"data-testid":"font-size-display",children:k})}),h&&b.jsx("div",{ref:C,style:{...g,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":s("fontSize.listLabel"),children:n.map(N=>b.jsx("button",{type:"button",onClick:()=>E(N),className:We("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",N===v&&"bg-muted font-medium"),role:"option","aria-selected":N===v,children:N},N))}),b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",r&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:r||v>=a,"aria-label":s("fontSize.increase"),"data-testid":"font-size-increase",children:b.jsx(we,{name:"add",size:18})})]})}var OF={display:"inline-flex",alignItems:"center",gap:"4px"},Km={display:"inline-flex",alignItems:"center",gap:"4px"},$c={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},jF={...$c,backgroundColor:"var(--doc-bg-hover)"},zF={...$c,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},HF={...$c,cursor:"default",opacity:.38},_F={width:"28px",height:"28px",padding:"2px"},WF={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Ra=20;function Pa({active:t=!1,disabled:e=!1,title:n,onClick:r,children:o,className:i,style:l}){let[a,s]=S.useState(!1),c={...e?HF:t?zF:a?jF:$c,...l},d=u=>{u.preventDefault()};return b.jsx("button",{type:"button",className:`docx-list-button ${t?"docx-list-button-active":""} ${e?"docx-list-button-disabled":""} ${i||""}`,style:c,onMouseDown:d,onClick:e?void 0:r,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),disabled:e,title:n,"aria-label":n,"aria-pressed":t,role:"button",children:o})}function VF({listState:t,onBulletList:e,onNumberedList:n,onIndent:r,onOutdent:o,disabled:i=!1,className:l,style:a,showIndentButtons:s=!0,compact:c=!1,hasIndent:d=!1}){let{t:u}=Re(),f=S.useCallback(()=>c?{..._F}:{},[c]),h=t?.type==="bullet",p=t?.type==="numbered",m=(t?.isInList||h||p)&&(t?.level??0)>0||d;return b.jsxs("div",{className:`docx-list-buttons ${l||""}`,style:{...OF,...a},role:"group","aria-label":u("lists.ariaLabel"),children:[b.jsxs("div",{style:Km,role:"group","aria-label":u("lists.typeAriaLabel"),children:[b.jsx(Pa,{active:h,disabled:i,title:u("lists.bulletList"),onClick:e,style:f(),children:b.jsx(we,{name:"format_list_bulleted",size:Ra})}),b.jsx(Pa,{active:p,disabled:i,title:u("lists.numberedList"),onClick:n,style:f(),children:b.jsx(we,{name:"format_list_numbered",size:Ra})})]}),s&&b.jsxs(b.Fragment,{children:[b.jsx("div",{style:WF,role:"separator"}),b.jsxs("div",{style:Km,role:"group","aria-label":u("lists.indentationAriaLabel"),children:[b.jsx(Pa,{active:!1,disabled:i||!m,title:u("lists.decreaseIndent"),onClick:o,style:f(),children:b.jsx(we,{name:"format_indent_decrease",size:Ra})}),b.jsx(Pa,{active:!1,disabled:i,title:u("lists.increaseIndent"),onClick:r,style:f(),children:b.jsx(we,{name:"format_indent_increase",size:Ra})})]})]})]})}var ro={hfInlineEditor:10,ruler:30,outline:40,dropdown:100,toolbar:100,contextMenu:1e4},qF=[{action:"cut",labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut"},{action:"copy",labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut"},{action:"paste",labelKey:"contextMenu.paste",shortcutKey:"contextMenu.pasteShortcut"},{action:"pasteAsPlainText",labelKey:"contextMenu.pastePlainText",shortcutKey:"contextMenu.pastePlainTextShortcut",dividerAfter:!0},{action:"delete",labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",dividerAfter:!0},{action:"selectAll",labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut"}],ZF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("circle",{cx:"4",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("circle",{cx:"12",cy:"12",r:"2",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M5.5 10.5L10.5 3M10.5 10.5L5.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),KF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"5",y:"5",width:"8",height:"9",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M11 5V3a1 1 0 00-1-1H4a1 1 0 00-1 1v8a1 1 0 001 1h2",stroke:"currentColor",strokeWidth:"1.5"})]}),UF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"3",y:"3",width:"10",height:"11",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M6 3V2a1 1 0 011-1h2a1 1 0 011 1v1",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M6 8h4M6 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),XF=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),GF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2"}),b.jsx("rect",{x:"4",y:"4",width:"8",height:"8",fill:"currentColor",opacity:"0.3"})]}),YF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M8 1v3M6.5 2.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),JF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M8 12v3M6.5 13.5h3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),QF=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"2",y:"6",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),b.jsx("rect",{x:"2",y:"10",width:"12",height:"4",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M5 8h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M3 8H0.5M1.75 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),tA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M13 8h2.5M14.25 6.5v3",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),nA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"6",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2",opacity:"0.3"}),b.jsx("rect",{x:"10",y:"2",width:"4",height:"12",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M8 5v6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),rA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("rect",{x:"10",y:"4",width:"4",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M7 8h2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),b.jsx("path",{d:"M8 7l1 1-1 1",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),oA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"4",width:"12",height:"8",rx:"0.5",stroke:"currentColor",strokeWidth:"1.2"}),b.jsx("path",{d:"M8 4v8",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2 1"}),b.jsx("path",{d:"M6.5 8h-1M9.5 8h1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),iA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 1.5"}),b.jsx("path",{d:"M8 2v12M2 8h12",stroke:"currentColor",strokeWidth:"1.2"})]}),lA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),b.jsx("path",{d:"M5 2v12M2 8h11",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.6"}),b.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),aA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M3 3h10a1 1 0 011 1v6a1 1 0 01-1 1H6l-3 2.5V11H3a1 1 0 01-1-1V4a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.3"}),b.jsx("path",{d:"M5 6h6M5 8.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});function sA(t){switch(t){case"cut":return b.jsx(ZF,{});case"copy":return b.jsx(KF,{});case"paste":case"pasteAsPlainText":return b.jsx(UF,{});case"delete":return b.jsx(XF,{});case"selectAll":return b.jsx(GF,{});case"addRowAbove":return b.jsx(YF,{});case"addRowBelow":return b.jsx(JF,{});case"deleteRow":return b.jsx(QF,{});case"addColumnLeft":return b.jsx(eA,{});case"addColumnRight":return b.jsx(tA,{});case"deleteColumn":return b.jsx(nA,{});case"mergeCells":return b.jsx(rA,{});case"splitCell":return b.jsx(oA,{});case"selectTable":return b.jsx(iA,{});case"deleteTable":return b.jsx(lA,{});case"addComment":return b.jsx(aA,{});default:return null}}var cA=({item:t,onClick:e,isHighlighted:n,onMouseEnter:r})=>t.action==="separator"?b.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}}):b.jsxs(b.Fragment,{children:[b.jsxs("button",{type:"button",className:`docx-text-context-menu-item ${n?"docx-text-context-menu-item-highlighted":""} ${t.disabled?"docx-text-context-menu-item-disabled":""}`,onClick:e,onMouseEnter:r,disabled:t.disabled,role:"menuitem","aria-disabled":t.disabled,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:n&&!t.disabled?"var(--doc-primary-light)":"transparent",cursor:t.disabled?"not-allowed":"pointer",fontSize:"13px",color:t.disabled?"var(--doc-text-subtle)":"var(--doc-text)",textAlign:"left",opacity:t.disabled?.6:1},children:[b.jsx("span",{style:{display:"flex",color:t.disabled?"var(--doc-border)":"var(--doc-text-muted)"},children:sA(t.action)}),b.jsx("span",{style:{flex:1},children:t.label}),t.shortcut&&b.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:t.shortcut})]}),t.dividerAfter&&b.jsx("div",{className:"docx-text-context-menu-separator",style:{height:"1px",backgroundColor:"var(--doc-border)",margin:"4px 12px"}})]}),dA=({isOpen:t,position:e,hasSelection:n,isEditable:r,hasClipboardContent:o=!0,onAction:i,onClose:l,items:a,className:s=""})=>{let c=S.useRef(null),[d,u]=S.useState(0),{t:f}=Re(),h=S.useMemo(()=>qF.map(C=>({action:C.action,label:f(C.labelKey),shortcut:C.shortcutKey?f(C.shortcutKey):void 0,dividerAfter:C.dividerAfter})),[f]),p=(a||h).map(C=>{let g=(()=>{if(C.disabled!==void 0)return C.disabled;switch(C.action){case"cut":case"copy":case"delete":return!n;case"paste":case"pasteAsPlainText":return!r||!o;default:return!1}})();return{...C,disabled:g}}),m=p.filter(C=>C.action!=="separator");S.useEffect(()=>{if(!t)return;let C=v=>{c.current&&!c.current.contains(v.target)&&l()},g=setTimeout(()=>{document.addEventListener("mousedown",C)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",C)}},[t,l]),S.useEffect(()=>{if(!t)return;let C=g=>{switch(g.key){case"Escape":g.preventDefault(),l();break;case"ArrowDown":g.preventDefault(),u(k=>{let x=(k+1)%m.length;for(;m[x]?.disabled&&x!==k;)x=(x+1)%m.length;return x});break;case"ArrowUp":g.preventDefault(),u(k=>{let x=(k-1+m.length)%m.length;for(;m[x]?.disabled&&x!==k;)x=(x-1+m.length)%m.length;return x});break;case"Enter":g.preventDefault();let v=m[d];v&&!v.disabled&&(i(v.action),l());break}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[t,d,m,i,l]),S.useEffect(()=>{t&&u(0)},[t]);let y=S.useCallback(()=>{let C=p.length*36+16,g=e.x,v=e.y;return typeof window<"u"&&(g+220>window.innerWidth&&(g=window.innerWidth-220-10),v+C>window.innerHeight&&(v=window.innerHeight-C-10),g<10&&(g=10),v<10&&(v=10)),{position:"fixed",top:v,left:g,minWidth:220,background:"var(--doc-surface)",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px var(--doc-shadow)",zIndex:ro.contextMenu,padding:"4px 0",overflow:"hidden"}},[e,p.length]),w=C=>{C.disabled||(i(C.action),l())};return t?b.jsx("div",{ref:c,className:`docx-text-context-menu ${s}`,style:y(),role:"menu","aria-label":f("contextMenu.textMenuAriaLabel"),children:p.map((C,g)=>{let v=m.findIndex(k=>k===C);return b.jsx(cA,{item:C,onClick:()=>w(C),isHighlighted:v===d,onMouseEnter:()=>{v>=0&&!C.disabled&&u(v)}},`${C.action}-${g}`)})}):null},Ic=WE,di=dF,Fw=KE;function Mc({className:t,children:e,onMouseDown:n,...r}){return b.jsxs(qE,{className:We("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",t),onMouseDown:o=>{o.preventDefault(),n?.(o)},...r,children:[e,b.jsx(UE,{asChild:!0,children:b.jsx(uA,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Rc({className:t,children:e,position:n="popper",onCloseAutoFocus:r,...o}){let i=typeof document<"u"&&!!document.querySelector(".ep-root.dark");return b.jsx(JE,{children:b.jsx("div",{className:We("ep-root",i&&"dark"),children:b.jsx(QE,{className:We("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",t),position:n,onCloseAutoFocus:l=>{l.preventDefault(),r?.(l)},...o,children:b.jsx(lF,{className:We("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:l=>l.preventDefault(),children:e})})})})}function sl({className:t,...e}){return b.jsx(fF,{className:We("px-2 py-1.5 text-xs font-medium text-muted-foreground",t),...e})}function Or({className:t,children:e,onMouseDown:n,...r}){return b.jsxs(hF,{className:We("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),onMouseDown:o=>{o.preventDefault(),n?.(o)},...r,children:[b.jsx(mF,{children:e}),b.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:b.jsx(yF,{children:b.jsx(fA,{className:"h-4 w-4"})})})]})}function cl({className:t,...e}){return b.jsx(bF,{className:We("-mx-1 my-1 h-px bg-muted",t),...e})}function uA({className:t}){return b.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function fA({className:t}){return b.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:b.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function Um(t){let e=t.trim();if(!e)return"";let n=null,r="";for(let o of e){if((o==='"'||o==="'")&&n===null){n=o,r+=o;continue}if(o===n){n=null,r+=o;continue}if(o===","&&n===null)break;r+=o}return r.trim().replace(/^['"]|['"]$/g,"")}var pA=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function hA({value:t,onChange:e,fonts:n=pA,documentFonts:r,disabled:o=!1,className:i,placeholder:l="Arial",width:a=120,showPreview:s=!0}){let{t:c}=Re(),d=S.useMemo(()=>XI(r,n.map(m=>m.name)),[r,n]),u=S.useMemo(()=>[...d,...n],[d,n]),f=S.useMemo(()=>t?u.find(m=>m.fontFamily===t||m.name.toLowerCase()===t.toLowerCase()||Um(m.fontFamily).toLowerCase()===t.toLowerCase())?.name||t:l,[t,u,l]),h=S.useCallback(m=>{let y=u.find(w=>w.name===m);y&&e?.(Um(y.fontFamily)||y.name)},[e,u]),p=S.useMemo(()=>{let m={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(y=>{let w=y.category||"other";m[w].push(y)}),m},[n]);return b.jsxs(Ic,{value:f,onValueChange:h,disabled:o,children:[b.jsx(Mc,{className:We("h-8 text-sm",i),style:{minWidth:typeof a=="number"?`${a}px`:a},"aria-label":c("font.selectAriaLabel"),children:b.jsx(Fw,{placeholder:l,children:f})}),b.jsxs(Rc,{className:"max-h-[300px]",children:[d.length>0&&b.jsxs(b.Fragment,{children:[b.jsxs(di,{children:[b.jsx(sl,{children:c("font.documentFonts")}),d.map(m=>b.jsx(Or,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},`doc-${m.name}`))]}),b.jsx(cl,{})]}),p["sans-serif"].length>0&&b.jsxs(di,{children:[b.jsx(sl,{children:c("font.sansSerif")}),p["sans-serif"].map(m=>b.jsx(Or,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]}),p.serif.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(cl,{}),b.jsxs(di,{children:[b.jsx(sl,{children:c("font.serif")}),p.serif.map(m=>b.jsx(Or,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]})]}),p.monospace.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(cl,{}),b.jsxs(di,{children:[b.jsx(sl,{children:c("font.monospace")}),p.monospace.map(m=>b.jsx(Or,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))]})]}),p.other.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(cl,{}),b.jsx(di,{children:p.other.map(m=>b.jsx(Or,{value:m.name,style:s?{fontFamily:m.fontFamily}:void 0,children:m.name},m.name))})]})]})]})}var mA=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],Ds=18,gA=2,yA={position:"relative",display:"inline-block"},bA={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},wA={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Ld={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Bd={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Aw={display:"grid",gap:`${gA}px`},Pc={width:`${Ds}px`,height:`${Ds}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Dw={...Pc,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},Nw={...Pc,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},xA={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},vA={display:"flex",alignItems:"center",gap:"6px"},kA={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},CA={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Xm={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},SA={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},TA={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},$A={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function Od(t,e,n){return t?typeof t=="string"?e==="highlight"?Wb(t)||(t==="none"?"transparent":t.startsWith("#")?t:`#${t}`):t.startsWith("#")?t:`#${t}`:nr(t,n):e==="text"||e==="border"?"#000000":"transparent"}function Gm(t){let e=t.replace(/^#/,"");if(e.length!==6)return!1;let n=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return(n*299+r*587+o*114)/1e3>230}function Lw(t,e,n){return t?(typeof t=="string"?t.replace(/^#/,"").toUpperCase():No(t,n))===e.toUpperCase():!1}function IA({matrix:t,selectedColor:e,theme:n,onSelect:r}){let[o,i]=S.useState(null);return b.jsx("div",{style:{...Aw,gridTemplateColumns:`repeat(10, ${Ds}px)`},children:t.flatMap((l,a)=>l.map((s,c)=>{let d=`${a}-${c}`,u=o===d,f=Lw(e,s.hex,n);return b.jsx("button",{type:"button",style:{...f?Nw:u?Dw:Pc,backgroundColor:`#${s.hex}`},title:s.label,"aria-label":s.label,"aria-selected":f,onClick:()=>r(s),onMouseDown:h=>h.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function MA({selectedColor:t,theme:e,onSelect:n}){let[r,o]=S.useState(null),{t:i}=Re();return b.jsx("div",{style:{...Aw,gridTemplateColumns:`repeat(10, ${Ds}px)`},children:mA.map((l,a)=>{let s=r===a,c=Lw(t,l.hex,e),d=i(l.nameKey);return b.jsx("button",{type:"button",style:{...c?Nw:s?Dw:Pc,backgroundColor:`#${l.hex}`},title:d,"aria-label":d,"aria-selected":c,onClick:()=>n(l.hex),onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>o(a),onMouseLeave:()=>o(null)},l.hex)})})}function Ns({mode:t,value:e,onChange:n,theme:r,disabled:o=!1,className:i,style:l,title:a,icon:s,autoLabel:c,splitButton:d=!0,defaultColor:u}){let[f,h]=S.useState(!1),[p,m]=S.useState(!1),[y,w]=S.useState(!1),[C,g]=S.useState(!1),[v,k]=S.useState(""),[x,T]=S.useState(()=>u??(t==="highlight"?"FFFF00":t==="border"?{rgb:"000000"}:{rgb:"FF0000"})),{t:$}=Re();S.useEffect(()=>{let Y=Od(e,t,r).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(Y)&&k(Y.toUpperCase())},[e,t,r]);let M=S.useCallback(()=>h(!1),[]),{containerRef:I,dropdownRef:F,dropdownStyle:E}=Yo({isOpen:f,onClose:M}),R=r?.colorScheme??null,N=S.useMemo(()=>xI(R),[R]),B=S.useMemo(()=>Od(e,t,r),[e,t,r]),j=S.useMemo(()=>Od(x,t,r),[x,t,r]),O=S.useCallback(()=>{o||h(Y=>!Y)},[o]),z=S.useCallback(Y=>{let V;if(t==="highlight")V=Y.hex;else{let Z={themeColor:Y.themeSlot,rgb:Y.hex};Y.tint&&(Z.themeTint=Y.tint),Y.shade&&(Z.themeShade=Y.shade),V=Z}T(V),n?.(V),h(!1)},[t,n]),W=S.useCallback(Y=>{let V=t==="highlight"?Y:{rgb:Y};T(V),n?.(V),h(!1)},[t,n]),q=S.useCallback(()=>{n?.(t==="highlight"?"none":{auto:!0}),h(!1)},[t,n]),Q=S.useCallback(()=>{let Y=v.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(Y)){let V=t==="highlight"?Y:{rgb:Y};T(V),n?.(V),h(!1),k("")}},[t,v,n]),X=S.useCallback(()=>{o||n?.(x)},[o,x,n]),se={...bA,...o?{cursor:"default",opacity:.38}:f?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:p?{backgroundColor:"var(--doc-bg-hover)"}:{}},ie=$(t==="text"?"formattingBar.fontColor":t==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ce=s??(t==="text"?"format_color_text":t==="highlight"?"ink_highlighter":"border_color");return b.jsxs("div",{ref:I,className:`docx-color-picker ${i||""}`,style:{...yA,...l},children:[d?b.jsxs("div",{className:"docx-color-picker-split",style:{...SA,...o?{opacity:.38,cursor:"default"}:null},children:[b.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...TA,...o?{cursor:"default"}:y?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:X,onMouseDown:Y=>Y.preventDefault(),onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),disabled:o,title:a||ie,"aria-label":a||ie,children:[b.jsx(we,{name:ce,size:18}),b.jsx("div",{style:{...Xm,backgroundColor:j==="transparent"?"#fff":j,outline:j==="transparent"||Gm(j)?"1px solid #bbb":"none"}})]}),b.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...$A,...o?{cursor:"default"}:f?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:C?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:O,onMouseDown:Y=>Y.preventDefault(),onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),disabled:o,title:a||ie,"aria-label":a||ie,"aria-haspopup":"true","aria-expanded":f,children:b.jsx(we,{name:"arrow_drop_down",size:18})})]}):b.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:O,onMouseDown:Y=>Y.preventDefault(),onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),disabled:o,title:a||ie,"aria-label":a||ie,"aria-haspopup":"true","aria-expanded":f,children:[b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[b.jsx(we,{name:ce,size:18}),b.jsx("div",{style:{...Xm,backgroundColor:B==="transparent"?"#fff":B,outline:B==="transparent"||Gm(B)?"1px solid #bbb":"none"}})]}),b.jsx(we,{name:"arrow_drop_down",size:14})]}),f&&b.jsx("div",{ref:F,className:"docx-color-picker-dropdown",style:{...E,...wA},role:"dialog","aria-label":`${ie} picker`,onMouseDown:Y=>{Y.target.tagName!=="INPUT"&&Y.preventDefault()},children:b.jsxs(b.Fragment,{children:[b.jsxs("button",{type:"button",style:xA,onClick:q,onMouseDown:Y=>Y.preventDefault(),children:[t==="highlight"?b.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:b.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):b.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),c??$(t==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),b.jsx("div",{style:Bd}),b.jsx("div",{style:Ld,children:$("colorPicker.themeColors")}),b.jsx(IA,{matrix:N,selectedColor:e,theme:r,onSelect:z}),b.jsx("div",{style:Bd}),b.jsx("div",{style:Ld,children:$("colorPicker.standardColors")}),b.jsx(MA,{selectedColor:e,theme:r,onSelect:W}),b.jsx("div",{style:Bd}),b.jsx("div",{style:Ld,children:$("colorPicker.customColor")}),b.jsxs("div",{style:vA,children:[b.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),b.jsx("input",{type:"text",style:kA,value:v,onChange:Y=>k(Y.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:Y=>{Y.key==="Enter"&&Q()},onMouseDown:Y=>{Y.stopPropagation()},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),b.jsx("button",{type:"button",style:{...CA,opacity:/^[0-9A-Fa-f]{6}$/.test(v)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(v)?"pointer":"default"},onClick:Q,onMouseDown:Y=>Y.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(v),children:$("common.apply")})]})]})})]})}function Qo({content:t,children:e,side:n="bottom",delayMs:r=400}){let[o,i]=S.useState(!1),[l,a]=S.useState({x:0,y:0}),s=S.useRef(null),c=S.useRef(null),d=S.useCallback(()=>{c.current=setTimeout(()=>{if(s.current){let p=s.current.getBoundingClientRect(),m=p.left+p.width/2,y=n==="top"?p.top-8:p.bottom+8;a({x:m,y})}i(!0)},r)},[r,n]),u=S.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),i(!1)},[]);S.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);let f=e.props,h=S.cloneElement(e,{ref:s,onMouseEnter:p=>{d(),f.onMouseEnter?.(p)},onMouseLeave:p=>{u(),f.onMouseLeave?.(p)}});return b.jsxs(b.Fragment,{children:[h,o&&b.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:l.x,top:l.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:t})]})}var dl=20,jd=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:b.jsx(we,{name:"format_align_left",size:dl}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:b.jsx(we,{name:"format_align_center",size:dl}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:b.jsx(we,{name:"format_align_right",size:dl}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:b.jsx(we,{name:"format_align_justify",size:dl}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function RA({value:t="left",onChange:e,disabled:n=!1}){let{t:r}=Re(),[o,i]=S.useState(!1),l=S.useCallback(()=>i(!1),[]),{containerRef:a,dropdownRef:s,dropdownStyle:c,handleMouseDown:d}=Yo({isOpen:o,onClose:l}),u=S.useCallback(w=>{n||e?.(w),i(!1)},[n,e]),f=jd.find(w=>w.value===t)||jd[0],h=r(f.labelKey),p=f.shortcutKey?r(f.shortcutKey):void 0,m=`${h}${p?` (${p})`:""}`,y=b.jsxs(_n,{variant:"ghost",size:"icon-sm",className:We("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&i(w=>!w),disabled:n,"aria-label":m,"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[b.jsx(we,{name:f.iconName,size:dl}),b.jsx(we,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return b.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?y:b.jsx(Qo,{content:m,children:y}),o&&!n&&b.jsx("div",{ref:s,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:w=>w.stopPropagation(),children:b.jsx("div",{style:{display:"flex",gap:2},children:jd.map(w=>{let C=t===w.value,g=r(w.labelKey),v=w.shortcutKey?r(w.shortcutKey):void 0;return b.jsx("button",{type:"button",title:`${g}${v?` (${v})`:""}`,"data-testid":`alignment-${w.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:C?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:C?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:k=>k.preventDefault(),onMouseEnter:k=>{C||(k.currentTarget.style.backgroundColor="var(--doc-bg-hover)")},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=C?"var(--doc-primary-light)":"transparent"},onClick:()=>u(w.value),children:b.jsx(we,{name:w.iconName,size:18})},w.value)})})})]})}var PA=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function EA({value:t,onChange:e,options:n=PA,disabled:r=!1,className:o}){let{t:i}=Re(),l=S.useMemo(()=>t===void 0?n[0]:n.find(c=>c.twipsValue===t)||n[0],[t,n]),a=S.useCallback(c=>{let d=parseInt(c,10);isNaN(d)||e?.(d)},[e]),s=c=>c.labelKey?i(c.labelKey):c.label;return b.jsxs(Ic,{value:l.twipsValue.toString(),onValueChange:a,disabled:r,children:[b.jsx(Mc,{className:We("h-8 text-sm gap-0.5 px-2",o),style:{width:"auto"},title:i("lineSpacing.lineSpacingTitle",{label:s(l)}),children:b.jsx(ew,{className:"h-5 w-5 shrink-0"})}),b.jsxs(Rc,{children:[n.map(c=>b.jsx(Or,{value:c.twipsValue.toString(),children:s(c)},c.twipsValue)),b.jsx(cl,{}),b.jsx(di,{children:b.jsx(sl,{children:i("lineSpacing.paragraphSpacing")})})]})]})}var Ym=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:!0,priority:0,qFormat:!0,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:!0,fontSize:52,bold:!0},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:!0,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:!0,fontSize:40,bold:!0},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:!0,fontSize:32,bold:!0},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:!0,fontSize:28,bold:!0}];function FA({value:t,onChange:e,styles:n,disabled:r=!1,className:o,width:i=120}){let{t:l}=Re(),a=S.useMemo(()=>{let h=$F(n);return h.length===0?Ym:h.map(p=>({...p,type:"paragraph",nameKey:Ym.find(m=>m.styleId===p.styleId)?.nameKey}))},[n]),s=S.useCallback(h=>{e?.(h)},[e]),c=h=>h.nameKey?l(h.nameKey):h.name,d=t||"Normal",u=a.find(h=>h.styleId===d),f=u?c(u):d;return b.jsxs(Ic,{value:d,onValueChange:s,disabled:r,children:[b.jsx(Mc,{className:We("h-8 text-sm",o),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":l("styles.selectAriaLabel"),children:b.jsx("span",{className:"truncate",children:f})}),b.jsx(Rc,{className:"min-w-[260px] max-h-[400px]",children:a.map(h=>b.jsx(Or,{value:h.styleId,className:"py-2.5 px-3",children:b.jsx("span",{style:TF(h),children:c(h)})},h.styleId))})]})}var AA=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function DA({value:t=1,onChange:e,levels:n=AA,disabled:r=!1,className:o,compact:i=!1}){let{t:l}=Re(),a=S.useMemo(()=>{let h=n.find(p=>Math.abs(p.value-t)<.001);return h?h.label:`${Math.round(t*100)}%`},[n,t]),s=S.useCallback(h=>{let p=parseFloat(h);isNaN(p)||e?.(p)},[e]),c=S.useMemo(()=>[...n].sort((h,p)=>h.value-p.value),[n]),d=S.useMemo(()=>[...c].reverse().find(h=>h.value<t-.001),[c,t]),u=S.useMemo(()=>c.find(h=>h.value>t+.001),[c,t]),f=i?"h-7 w-7":"h-8 w-8";return b.jsxs("div",{className:"flex items-center",children:[b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We(f,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(r||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&e?.(d.value),disabled:r||!d,"aria-label":l("zoom.zoomOut"),children:b.jsx(we,{name:"remove",size:18})}),b.jsxs(Ic,{value:t.toString(),onValueChange:s,disabled:r,children:[b.jsx(Mc,{className:We(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",o),"aria-label":l("zoom.ariaLabel",{label:a}),children:b.jsx(Fw,{placeholder:"100%",children:a})}),b.jsx(Rc,{children:n.map(h=>b.jsx(Or,{value:h.value.toString(),children:h.label},h.value))})]}),b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We(f,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(r||!u)&&"opacity-30 cursor-not-allowed"),onClick:()=>u&&e?.(u.value),disabled:r||!u,"aria-label":l("zoom.zoomIn"),children:b.jsx(we,{name:"add",size:18})})]})}var NA=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function LA({onAction:t,disabled:e=!1}){let{t:n}=Re(),[r,o]=S.useState(!1),i=S.useCallback(()=>o(!1),[]),{containerRef:l,dropdownRef:a,dropdownStyle:s,handleMouseDown:c}=Yo({isOpen:r,onClose:i}),d=S.useCallback(f=>{t(f),o(!1)},[t]),u=b.jsxs(_n,{variant:"ghost",size:"icon-sm",className:We("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",e&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!e&&o(f=>!f),disabled:e,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[b.jsx(we,{name:"border_all",size:20}),b.jsx(we,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return b.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r?u:b.jsx(Qo,{content:n("table.borders.tooltip"),children:u}),r&&!e&&b.jsx("div",{ref:a,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:f=>f.stopPropagation(),children:b.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:NA.map(({action:f,icon:h,labelKey:p})=>b.jsx("button",{type:"button",title:n(p),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:m=>m.preventDefault(),onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--doc-bg-hover)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent"},onClick:()=>d(f),children:b.jsx(we,{name:h,size:18})},typeof f=="string"?f:f.type))})})]})}function BA({onAction:t,disabled:e=!1,theme:n,value:r}){let{t:o}=Re(),i=S.useCallback(l=>{typeof l=="string"?t({type:"borderColor",color:l.replace(/^#/,"")}):l.rgb?t({type:"borderColor",color:l.rgb.replace(/^#/,"")}):l.auto&&t({type:"borderColor",color:"000000"})},[t]);return b.jsx(Ns,{mode:"border",value:r,onChange:i,theme:n,disabled:e,title:o("table.borderColor")})}var OA=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function jA({onAction:t,disabled:e=!1}){let[n,r]=S.useState(!1),{t:o}=Re(),i=S.useCallback(()=>r(!1),[]),{containerRef:l,dropdownRef:a,dropdownStyle:s,handleMouseDown:c}=Yo({isOpen:n,onClose:i}),d=S.useCallback(f=>{t({type:"borderWidth",size:f}),r(!1)},[t]),u=b.jsxs(_n,{variant:"ghost",size:"icon-sm",className:We("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",e&&"opacity-30 cursor-not-allowed"),onMouseDown:c,onClick:()=>!e&&r(f=>!f),disabled:e,"aria-label":o("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[b.jsx(we,{name:"line_weight",size:20}),b.jsx(we,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return b.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[n?u:b.jsx(Qo,{content:o("table.borderWidth"),children:u}),n&&!e&&b.jsx("div",{ref:a,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:f=>f.stopPropagation(),children:OA.map(({size:f,label:h,thickness:p})=>b.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:m=>m.preventDefault(),onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--doc-bg-hover)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent"},onClick:()=>d(f),children:[b.jsx("div",{style:{width:50,height:Math.max(p,1),backgroundColor:"#000",borderRadius:p>2?1:0}}),b.jsx("span",{children:h})]},f))})]})}function zA({onAction:t,disabled:e=!1,theme:n,value:r}){let{t:o}=Re(),i=S.useCallback(l=>{typeof l=="string"&&t(l==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:l.replace(/^#/,"")})},[t]);return b.jsx(Ns,{mode:"highlight",value:r,onChange:i,theme:n,disabled:e,title:o("table.cellFillColor"),icon:"format_color_fill",autoLabel:o("colorPicker.noColor")})}var HA={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},yo={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Jm={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function _A({onAction:t,disabled:e=!1,tableContext:n}){let{t:r}=Re(),[o,i]=S.useState(!1),[l,a]=S.useState(null),s=S.useCallback(()=>i(!1),[]),{containerRef:c,dropdownRef:d,dropdownStyle:u,handleMouseDown:f}=Yo({isOpen:o,onClose:s,align:"right"}),h=n?.table?.attrs?.justification??"left",p=S.useCallback(w=>{t(w),i(!1)},[t]),m=(w,C,g,v,k)=>{let x=e||k?.itemDisabled;return b.jsxs("button",{type:"button",role:"menuitem",style:{...HA,backgroundColor:l===w&&!x?"var(--doc-bg-hover)":"transparent",color:x?"var(--doc-text-muted)":k?.danger?"var(--doc-error)":"var(--doc-text)",cursor:x?"not-allowed":"pointer"},onClick:()=>!x&&p(v),onMouseEnter:()=>a(w),onMouseLeave:()=>a(null),disabled:x,children:[b.jsx(we,{name:C,size:16,className:k?.danger&&!x?"text-destructive":""}),b.jsx("span",{style:{flex:1},children:g})]},w)},y=b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",e&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!e&&i(w=>!w),disabled:e,"aria-label":r("table.moreOptions"),"aria-expanded":o,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:b.jsx(we,{name:"more_vert",size:20})});return b.jsxs("div",{ref:c,style:{position:"relative",display:"inline-block"},children:[o?y:b.jsx(Qo,{content:r("table.moreOptions"),children:y}),o&&!e&&b.jsxs("div",{ref:d,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:w=>w.stopPropagation(),children:[m("addRowAbove","add",r("table.insertRowAbove"),"addRowAbove"),m("addRowBelow","add",r("table.insertRowBelow"),"addRowBelow"),m("addColumnLeft","add",r("table.insertColumnLeft"),"addColumnLeft"),m("addColumnRight","add",r("table.insertColumnRight"),"addColumnRight"),b.jsx("div",{style:yo,role:"separator"}),m("mergeCells","call_merge",r("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),m("splitCell","call_split",r("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),b.jsx("div",{style:yo,role:"separator"}),m("selectTable","select_all",r("table.selectTable"),"selectTable"),b.jsx("div",{style:yo,role:"separator"}),m("deleteRow","delete",r("table.deleteRow"),"deleteRow",{danger:!0,itemDisabled:(n?.rowCount??0)<=1}),m("deleteColumn","delete",r("table.deleteColumn"),"deleteColumn",{danger:!0,itemDisabled:(n?.columnCount??0)<=1}),m("deleteTable","delete",r("table.deleteTable"),"deleteTable",{danger:!0}),b.jsx("div",{style:yo,role:"separator"}),b.jsx("div",{style:Jm,children:r("tableAdvanced.verticalAlignment")}),b.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(w=>{let C={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return b.jsx("button",{type:"button",title:r({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[w]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:g=>g.preventDefault(),onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--doc-bg-hover)"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},onClick:()=>p({type:"cellVerticalAlign",align:w}),children:b.jsx(we,{name:C[w],size:16})},w)})}),b.jsx("div",{style:yo,role:"separator"}),b.jsx("div",{style:Jm,children:r("tableAdvanced.tableAlignment")}),b.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(w=>{let C={left:"format_align_left",center:"format_align_center",right:"format_align_right"},g=h===w;return b.jsx("button",{type:"button",title:r({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[w]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:g?"var(--doc-primary-light)":"transparent",borderColor:g?"var(--doc-primary)":"var(--doc-border)",color:g?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onClick:()=>p({type:"tableProperties",props:{justification:w}}),children:b.jsx(we,{name:C[w],size:16})},w)})}),b.jsx("div",{style:yo,role:"separator"}),m("headerRow","table_rows",r("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),m("distribute","view_column",r("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),m("autoFit","fit_width",r("tableAdvanced.autoFit"),{type:"autoFitContents"}),m("noWrap","wrap_text",r("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),b.jsx("div",{style:yo,role:"separator"}),m("properties","settings",r("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var WA=20;function Bw({options:t,activeValue:e,triggerIcon:n,tooltipContent:r,onSelect:o,disabled:i=!1,ariaLabel:l,testId:a,showLabels:s=!1}){let[c,d]=S.useState(!1),u=S.useCallback(()=>d(!1),[]),{containerRef:f,dropdownRef:h,dropdownStyle:p,handleMouseDown:m}=Yo({isOpen:c,onClose:u}),y=S.useCallback(C=>{i||o(C),d(!1)},[i,o]),w=b.jsxs(_n,{variant:"ghost",size:"icon-sm",className:We("text-muted-foreground hover:text-foreground hover:bg-muted/80",c&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!i&&d(C=>!C),disabled:i,"aria-label":l??r,"aria-expanded":c,"aria-haspopup":"true","data-testid":a,children:[b.jsx(we,{name:n,size:WA}),b.jsx(we,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return b.jsxs("div",{ref:f,style:{position:"relative",display:"inline-block"},children:[c?w:b.jsx(Qo,{content:r,children:w}),c&&!i&&b.jsx("div",{ref:h,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:C=>C.stopPropagation(),children:b.jsx("div",{style:{display:"flex",flexDirection:s?"column":"row",gap:s?1:2,minWidth:s?200:void 0},children:t.map(C=>{let g=e===C.value;return b.jsxs("button",{type:"button",title:C.label,"data-testid":a?`${a}-${C.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:g?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:g?"var(--doc-primary)":"var(--doc-text)",...s?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{g||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)")},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=g?"var(--doc-primary-light)":"transparent"},onClick:()=>y(C.value),children:[b.jsx(we,{name:C.iconName,size:18}),s&&b.jsx("span",{style:{flex:1},children:C.label})]},C.value)})})})]})}var VA=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function qA(t){return t.displayMode==="float"&&t.cssFloat==="left"?"wrapRight":t.displayMode==="float"&&t.cssFloat==="right"?"wrapLeft":t.wrapType}function ZA({imageContext:t,onChange:e,disabled:n=!1}){let{t:r}=Re(),o=VA.map(a=>({...a,label:r(a.labelKey)})),i=qA(t),l=o.find(a=>a.value===i)||o[0];return b.jsx(Bw,{options:o,activeValue:i,triggerIcon:l.iconName,tooltipContent:`Wrap: ${l.label}`,onSelect:e,disabled:n,testId:"toolbar-image-wrap",showLabels:!0})}var KA=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function UA({onTransform:t,disabled:e=!1}){let{t:n}=Re(),r=KA.map(o=>({...o,label:n(o.labelKey)}));return b.jsx(Bw,{options:r,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:t,disabled:e,testId:"toolbar-image-transform"})}var dp=S.createContext(null);function XA(){let t=S.useContext(dp);if(!t)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return t}var An=18;function mn({active:t=!1,disabled:e=!1,title:n,onClick:r,children:o,className:i,ariaLabel:l}){let a=l?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),s=d=>{d.preventDefault()},c=b.jsx(_n,{variant:"ghost",size:"icon-sm",className:We("ep-toolbar-toggle text-muted-foreground",e&&"opacity-30 cursor-not-allowed",i),"data-active":t?"true":void 0,onMouseDown:s,onClick:e?void 0:r,disabled:e,"aria-pressed":t,"aria-label":l||n,"data-testid":a?`toolbar-${a}`:void 0,children:o});return n?b.jsx(Qo,{content:n,children:c}):c}function Zn({label:t,children:e,className:n}){return b.jsx("div",{className:We("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":t,children:e})}function zd(){return b.jsx("div",{className:"w-px h-6 bg-border mx-1.5",role:"separator"})}function GA(t){let e=ae.useContext(dp);return e?{...e,...YA(t)}:t}function YA(t){let e={};for(let n of Object.keys(t))t[n]!==void 0&&(e[n]=t[n]);return e}function JA(t){let{t:e}=Re(),n=GA(t),{currentFormatting:r={},onFormat:o,onUndo:i,onRedo:l,canUndo:a=!1,canRedo:s=!1,disabled:c=!1,className:d,style:u,enableShortcuts:f=!0,editorRef:h,children:p,showFontPicker:m=!0,fontFamilies:y,documentFonts:w,showFontSizePicker:C=!0,showTextColorPicker:g=!0,showHighlightColorPicker:v=!0,showAlignmentButtons:k=!0,showListButtons:x=!0,showLineSpacingPicker:T=!0,showStylePicker:$=!0,documentStyles:M,theme:I,showZoomControl:F=!0,zoom:E,onZoomChange:R,onRefocusEditor:N,imageContext:B,onImageWrapType:j,onImageTransform:O,onOpenImageProperties:z,tableContext:W,onTableAction:q,inline:Q=!1}=n,X=S.useRef(null),se=S.useCallback(be=>{!c&&o&&o(be)},[c,o]),ie=S.useCallback(()=>{!c&&a&&i&&i()},[c,a,i]),ce=S.useCallback(()=>{!c&&s&&l&&l()},[c,s,l]),Y=S.useCallback(be=>{!c&&o&&(o({type:"fontFamily",value:be}),requestAnimationFrame(()=>N?.()))},[c,o,N]),V=ae.useMemo(()=>IF(y),[y]),Z=S.useCallback(be=>{!c&&o&&(o({type:"fontSize",value:be}),requestAnimationFrame(()=>N?.()))},[c,o,N]),K=S.useCallback(be=>{!c&&o&&(o({type:"textColor",value:be}),requestAnimationFrame(()=>N?.()))},[c,o,N]),ee=S.useCallback(be=>{!c&&o&&(o({type:"highlightColor",value:typeof be=="string"?be:""}),requestAnimationFrame(()=>N?.()))},[c,o,N]),G=S.useCallback(be=>{!c&&o&&o({type:"alignment",value:be})},[c,o]),te=S.useCallback(()=>{!c&&o&&o("bulletList")},[c,o]),A=S.useCallback(()=>{!c&&o&&o("numberedList")},[c,o]),P=S.useCallback(()=>{!c&&o&&o("indent")},[c,o]),_=S.useCallback(()=>{!c&&o&&o("outdent")},[c,o]),H=S.useCallback(be=>{!c&&o&&(o({type:"lineSpacing",value:be}),requestAnimationFrame(()=>N?.()))},[c,o,N]),le=S.useCallback(be=>{!c&&o&&(o({type:"applyStyle",value:be}),requestAnimationFrame(()=>N?.()))},[c,o,N]),ue=S.useCallback(be=>{!c&&q&&(q(be),requestAnimationFrame(()=>N?.()))},[c,q,N]);S.useEffect(()=>{if(!f)return;let be=pe=>{let Fe=pe.target,Ae=h?.current,yt=X.current,Me=Ae?.contains(Fe),Ue=yt?.contains(Fe);if(!(!Me&&!Ue)&&(pe.ctrlKey||pe.metaKey)&&!pe.altKey)switch(pe.key.toLowerCase()){case"b":pe.preventDefault(),se("bold");break;case"i":pe.preventDefault(),se("italic");break;case"u":pe.preventDefault(),se("underline");break;case"=":pe.shiftKey?(pe.preventDefault(),se("superscript")):(pe.preventDefault(),se("subscript"));break;case"l":pe.preventDefault(),G("left");break;case"e":pe.preventDefault(),G("center");break;case"r":pe.preventDefault(),G("right");break;case"j":pe.preventDefault(),G("both");break;case"k":pe.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",be),()=>{document.removeEventListener("keydown",be)}},[f,se,G,h]);let ve=S.useCallback(be=>{let pe=be.target;pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.tagName==="SELECT"||pe.tagName==="OPTION"||be.preventDefault()},[]),Pe=S.useCallback(be=>{let pe=be.target,Fe=document.activeElement;pe.tagName==="SELECT"||pe.tagName==="OPTION"||Fe?.tagName==="SELECT"||requestAnimationFrame(()=>{N?.()})},[N]);return b.jsxs("div",{ref:X,className:We(!Q&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:Q?{display:"contents",...u}:u,role:Q?void 0:"toolbar","aria-label":Q?void 0:e("toolbar.ariaLabel"),"data-testid":Q?void 0:"formatting-bar",onMouseDown:Q?void 0:ve,onMouseUp:Q?void 0:Pe,children:[b.jsxs(Zn,{label:e("formattingBar.groups.history"),children:[b.jsx(mn,{onClick:ie,disabled:c||!a,title:e("formattingBar.undoShortcut"),ariaLabel:e("formattingBar.undo"),children:b.jsx(we,{name:"undo",size:An})}),b.jsx(mn,{onClick:ce,disabled:c||!s,title:e("formattingBar.redoShortcut"),ariaLabel:e("formattingBar.redo"),children:b.jsx(we,{name:"redo",size:An})})]}),F&&b.jsx(Zn,{label:e("formattingBar.groups.zoom"),children:b.jsx(DA,{value:E,onChange:R,disabled:c,compact:!0})}),$&&b.jsx(Zn,{label:e("formattingBar.groups.styles"),children:b.jsx(FA,{value:r.styleId||"Normal",onChange:le,styles:M,theme:I,disabled:c,width:120})}),(m||C)&&b.jsxs(Zn,{label:e("formattingBar.groups.font"),children:[m&&b.jsx(hA,{value:r.fontFamily||"Arial",onChange:Y,fonts:V,documentFonts:w,disabled:c,width:60,placeholder:"Arial"}),C&&b.jsx(BF,{value:r.fontSize!==void 0?Yf(r.fontSize):11,onChange:Z,disabled:c,width:42,placeholder:"11"})]}),b.jsxs(Zn,{label:e("formattingBar.groups.textFormatting"),children:[b.jsx(mn,{onClick:()=>se("bold"),active:r.bold,disabled:c,title:e("formattingBar.boldShortcut"),ariaLabel:e("formattingBar.bold"),children:b.jsx(we,{name:"format_bold",size:An})}),b.jsx(mn,{onClick:()=>se("italic"),active:r.italic,disabled:c,title:e("formattingBar.italicShortcut"),ariaLabel:e("formattingBar.italic"),children:b.jsx(we,{name:"format_italic",size:An})}),b.jsx(mn,{onClick:()=>se("underline"),active:r.underline,disabled:c,title:e("formattingBar.underlineShortcut"),ariaLabel:e("formattingBar.underline"),children:b.jsx(we,{name:"format_underlined",size:An})}),b.jsx(mn,{onClick:()=>se("strikethrough"),active:r.strike,disabled:c,title:e("formattingBar.strikethrough"),ariaLabel:e("formattingBar.strikethrough"),children:b.jsx(we,{name:"strikethrough_s",size:An})}),g&&b.jsx(Ns,{mode:"text",value:r.color?.replace(/^#/,""),onChange:K,theme:I,disabled:c,title:e("formattingBar.fontColor")}),v&&b.jsx(Ns,{mode:"highlight",value:r.highlight,onChange:ee,theme:I,disabled:c,title:e("formattingBar.highlightColor")}),b.jsx(mn,{onClick:()=>se("insertLink"),disabled:c,title:e("formattingBar.insertLinkShortcut"),ariaLabel:e("formattingBar.insertLink"),children:b.jsx(we,{name:"link",size:An})})]}),b.jsxs(Zn,{label:e("formattingBar.groups.script"),children:[b.jsx(mn,{onClick:()=>se("superscript"),active:r.superscript,disabled:c,title:e("formattingBar.superscriptShortcut"),ariaLabel:e("formattingBar.superscript"),children:b.jsx(we,{name:"superscript",size:An})}),b.jsx(mn,{onClick:()=>se("subscript"),active:r.subscript,disabled:c,title:e("formattingBar.subscriptShortcut"),ariaLabel:e("formattingBar.subscript"),children:b.jsx(we,{name:"subscript",size:An})})]}),k&&b.jsx(Zn,{label:e("formattingBar.groups.alignment"),children:b.jsx(RA,{value:r.alignment||"left",onChange:G,disabled:c})}),(x||T)&&b.jsxs(Zn,{label:e("formattingBar.groups.listFormatting"),children:[x&&b.jsx(VF,{listState:r.listState||aP(),onBulletList:te,onNumberedList:A,onIndent:P,onOutdent:_,disabled:c,showIndentButtons:!0,compact:!0,hasIndent:(r.indentLeft??0)>0}),T&&b.jsx(EA,{value:r.lineSpacing,onChange:H,disabled:c})]}),B&&j&&b.jsxs(Zn,{label:e("formattingBar.groups.image"),children:[b.jsx(ZA,{imageContext:B,onChange:j,disabled:c}),O&&b.jsx(UA,{onTransform:O,disabled:c}),z&&b.jsx(mn,{onClick:z,disabled:c,title:e("formattingBar.imagePropertiesShortcut"),ariaLabel:e("formattingBar.imageProperties"),children:b.jsx(we,{name:"tune",size:An})})]}),W?.isInTable&&q&&b.jsxs(Zn,{label:e("formattingBar.groups.table"),children:[b.jsx(LA,{onAction:ue,disabled:c}),b.jsx(BA,{onAction:ue,disabled:c,theme:I,value:No(W?.cellBorderColor,I)}),b.jsx(jA,{onAction:ue,disabled:c}),b.jsx(zA,{onAction:ue,disabled:c,theme:I,value:W?.cellBackgroundColor}),b.jsx(_A,{onAction:ue,disabled:c,tableContext:W})]}),b.jsx(mn,{onClick:()=>se("clearFormatting"),disabled:c,title:e("formattingBar.clearFormatting"),ariaLabel:e("formattingBar.clearFormatting"),children:b.jsx(we,{name:"format_clear",size:An})}),p]})}function QA(t){return"type"in t&&t.type==="separator"}var Ow={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},e6={...Ow,background:"var(--doc-bg-hover)"},jw={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},t6={...jw,opacity:.4,cursor:"default"},n6={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},r6={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},o6={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function Ea({label:t,items:e,disabled:n,showChevron:r=!1}){let[o,i]=S.useState(!1),[l,a]=S.useState(null),s=S.useRef(null),c=S.useRef(null),[d,u]=S.useState({top:0,left:0}),f=S.useCallback(()=>{i(!1),a(null)},[]);S.useEffect(()=>{if(!o||!s.current)return;let p=s.current.getBoundingClientRect();u({top:p.bottom+2,left:p.left})},[o]),S.useEffect(()=>{if(!o)return;function p(w){let C=w.target;s.current&&!s.current.contains(C)&&c.current&&!c.current.contains(C)&&f()}function m(w){w.key==="Escape"&&f()}function y(){f()}return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),window.addEventListener("scroll",y,!0),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m),window.removeEventListener("scroll",y,!0)}},[o,f]);let h=p=>{p.disabled||p.submenuContent||p.onClick&&(p.onClick(),f())};return b.jsxs("div",{style:{position:"relative"},children:[b.jsxs("button",{ref:s,type:"button",onClick:()=>!n&&i(!o),onMouseDown:p=>p.preventDefault(),disabled:n,style:o?e6:Ow,children:[t,r&&b.jsx(we,{name:"arrow_drop_down",size:16})]}),o&&b.jsx("div",{ref:c,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:p=>p.preventDefault(),children:e.map((p,m)=>{if(QA(p))return b.jsx("div",{style:n6},`sep-${m}`);let y=p;if(y.customContent)return b.jsx("div",{onMouseDown:g=>g.preventDefault(),children:y.customContent},y.label);let w=!!y.submenuContent,C=l===y.label;return b.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>w&&a(y.label),onMouseLeave:()=>w&&a(null),children:[b.jsxs("button",{type:"button",style:y.disabled?t6:jw,onClick:()=>h(y),onMouseDown:g=>g.preventDefault(),onMouseOver:g=>{y.disabled||(g.currentTarget.style.backgroundColor="var(--doc-bg-hover)")},onMouseOut:g=>{g.currentTarget.style.backgroundColor="transparent"},disabled:y.disabled,children:[y.icon&&b.jsx(we,{name:y.icon,size:18}),b.jsx("span",{children:y.label}),y.shortcut&&b.jsx("span",{style:r6,children:y.shortcut}),w&&b.jsx("span",{style:{marginLeft:"auto"},children:b.jsx(we,{name:"keyboard_arrow_right",size:16})})]}),w&&C&&b.jsx("div",{style:o6,onMouseDown:g=>g.preventDefault(),children:y.submenuContent(f)})]},y.label)})})]})}var Bu=18,i6=2,zw={width:Bu,height:Bu,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},l6={...zw,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},a6={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function s6({onInsert:t,gridRows:e=6,gridColumns:n=6}){let[r,o]=S.useState(0),[i,l]=S.useState(0),a=S.useCallback(()=>{r>0&&i>0&&t(r,i)},[r,i,t]),s=[];for(let d=1;d<=e;d++)for(let u=1;u<=n;u++){let f=d<=r&&u<=i;s.push(b.jsx("div",{style:f?l6:zw,onMouseEnter:()=>{o(d),l(u)},onClick:a,role:"gridcell","aria-selected":f},`${d}-${u}`))}let c=r>0&&i>0?`${i} × ${r}`:"Select size";return b.jsxs("div",{children:[b.jsx("div",{style:{display:"grid",gap:i6,gridTemplateColumns:`repeat(${n}, ${Bu}px)`},onMouseLeave:()=>{o(0),l(0)},role:"grid","aria-label":"Table size selector",children:s}),b.jsx("div",{style:a6,children:c})]})}function c6({items:t,closeMenu:e}){return b.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:t.map(n=>{let r=!n.onClick;return b.jsxs("button",{type:"button",disabled:r,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:r?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:r?.4:1},onMouseDown:o=>o.preventDefault(),onClick:()=>{r||(n.onClick?.(),e())},onMouseOver:o=>{r||(o.currentTarget.style.backgroundColor="var(--doc-bg-hover)")},onMouseOut:o=>{o.currentTarget.style.backgroundColor="transparent"},children:[b.jsx(we,{name:n.icon,size:18}),b.jsx("span",{children:n.label})]},n.label)})})}function d6(){return b.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),b.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),b.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),b.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),b.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Hw({children:t}){return b.jsx("div",{className:"flex items-center flex-shrink-0",children:t})}function u6(t){return t.replace(/\.docx$/i,"")}function f6({value:t,onChange:e,placeholder:n,editable:r=!0}){let{t:o}=Re(),i=n??o("titleBar.untitled"),l=u6(t)??"";return r?b.jsx("input",{type:"text",value:l,onChange:a=>{let s=a.target.value;e?.(s.endsWith(".docx")?s:s+".docx")},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":o("titleBar.documentNameAriaLabel")}):b.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:l||i})}function _w({children:t}){return b.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:t})}function Ww(){let{t}=Re(),e=XA(),{disabled:n=!1,onFormat:r,onPrint:o,onOpen:i,onSave:l,onPageSetup:a,onInsertImage:s,onInsertTable:c,showTableInsert:d=!0,showHelpMenu:u=!0,onInsertPageBreak:f,onInsertSectionBreakNextPage:h,onInsertSectionBreakContinuous:p,onInsertTOC:m,onWatermark:y,onRefocusEditor:w}=e,C=S.useCallback(x=>{!n&&r&&r(x)},[n,r]),g=S.useCallback((x,T)=>{!n&&c&&(c(x,T),requestAnimationFrame(()=>w?.()))},[n,c,w]),v=!!o||!!a,k=v||i||l;return b.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":t("titleBar.menuBarAriaLabel"),children:[k&&b.jsx(Ea,{label:t("toolbar.file"),disabled:n,items:[...i?[{icon:"file_upload",label:t("toolbar.open"),shortcut:t("toolbar.openShortcut"),onClick:i}]:[],...l?[{icon:"file_download",label:t("toolbar.save"),shortcut:t("toolbar.saveShortcut"),onClick:l}]:[],...(i||l)&&v?[{type:"separator"}]:[],...o?[{icon:"print",label:t("toolbar.print"),shortcut:t("toolbar.printShortcut"),onClick:o}]:[],...a?[{icon:"settings",label:t("toolbar.pageSetup"),onClick:a}]:[]]}),b.jsx(Ea,{label:t("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:t("toolbar.leftToRight"),onClick:()=>C("setLtr")},{icon:"format_textdirection_r_to_l",label:t("toolbar.rightToLeft"),onClick:()=>C("setRtl")}]}),b.jsx(Ea,{label:t("toolbar.insert"),disabled:n,items:[...s?[{icon:"image",label:t("toolbar.image"),onClick:s}]:[],...d&&c?[{icon:"grid_on",label:t("toolbar.table"),submenuContent:x=>b.jsx(s6,{onInsert:(T,$)=>{g(T,$),x()}})}]:[],...s||d&&c?[{type:"separator"}]:[],{icon:"page_break",label:t("toolbar.break"),submenuContent:x=>b.jsx(c6,{closeMenu:x,items:[{icon:"page_break",label:t("toolbar.pageBreak"),onClick:f},{icon:"horizontal_rule",label:t("toolbar.sectionBreakNextPage"),onClick:h},{icon:"border_horizontal",label:t("toolbar.sectionBreakContinuous"),onClick:p}]})},{icon:"format_list_numbered",label:t("toolbar.tableOfContents"),onClick:m,disabled:!m},...y?[{icon:"branding_watermark",label:t("toolbar.watermark"),onClick:y}]:[]]}),u&&b.jsx(Ea,{label:t("toolbar.help"),disabled:n,items:[{label:t("toolbar.reportIssue"),onClick:()=>EF()}]})]})}function p6({children:t}){let e=null,n=null,r=[],o=[];S.Children.forEach(t,l=>{S.isValidElement(l)&&(l.type===Hw?e=l:l.type===_w?n=l:l.type===Ww?o.push(l):r.push(l))});let i=S.useCallback(l=>{let a=l.target;a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.tagName==="SELECT"||a.tagName==="OPTION"||l.preventDefault()},[]);return b.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[b.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:e||b.jsx(d6,{})}),b.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[r.length>0&&b.jsx("div",{className:"flex items-center gap-2 px-1",children:r}),o.length>0&&b.jsx("div",{className:"flex items-center px-1",children:o})]}),n&&b.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}function h6({children:t,className:e,style:n,...r}){return b.jsx(dp.Provider,{value:r,children:b.jsx("div",{className:We("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",e),style:{position:"relative",zIndex:ro.toolbar,...n},"data-testid":"editor-toolbar",children:t})})}var yn=h6;yn.TitleBar=p6;yn.Logo=Hw;yn.DocumentName=f6;yn.MenuBar=Ww;yn.TitleBarRight=_w;yn.Toolbar=JA;var m6=12240,Qm=1440,Vw=1440,qw=567,Hd=22,g6="var(--doc-text-muted)",y6="var(--doc-text-subtle)",eg="var(--doc-shadow-subtle)",b6="var(--doc-primary)",w6="var(--doc-primary-hover)",x6="var(--doc-primary-hover)",bo=5;function v6(t,e){return e==="inch"?(t/Vw).toFixed(2)+'"':(t/qw).toFixed(1)+" cm"}function k6({sectionProps:t,zoom:e=1,editable:n=!1,onLeftMarginChange:r,onRightMarginChange:o,onFirstLineIndentChange:i,showFirstLineIndent:l=!1,firstLineIndent:a=0,hangingIndent:s=!1,indentLeft:c=0,indentRight:d=0,onIndentLeftChange:u,onIndentRightChange:f,unit:h="inch",className:p="",style:m,tabStops:y,onTabStopRemove:w}){let{t:C}=Re(),[g,v]=S.useState(null),[k,x]=S.useState(null),[T,$]=S.useState(null),[M,I]=S.useState(null),F=S.useRef(null),E=t?.pageWidth??m6,R=t?.marginLeft??Qm,N=t?.marginRight??Qm,B=E-R-N,j=ut(E)*e,O=ut(R)*e,z=ut(N)*e,W=ut(c)*e,q=ut(d)*e,Q=s?-a:a,X=ut(Q)*e,se=O+W,ie=j-z-q,ce=O+W+X,Y=S.useCallback((ee,G)=>{n&&(ee.preventDefault(),ee.stopPropagation(),v(G))},[n]),V=S.useCallback(ee=>{if(!g||!F.current)return;let G=F.current.getBoundingClientRect(),te=ee.clientX-G.left;I(te);let A=qb(te/e);if(g==="leftMargin"){let P=E-N-720,_=Math.round(Math.max(0,Math.min(A,P)));$(_),r?.(_)}else if(g==="rightMargin"){let P=E-A,_=E-R-720,H=Math.round(Math.max(0,Math.min(P,_)));$(H),o?.(H)}else if(g==="firstLineIndent"){let P=R+c,_=A-P,H=B-c-d-720,le=Math.round(Math.max(-c,Math.min(_,H)));$(le),i?.(le)}else if(g==="leftIndent"){let P=A-R,_=B-d-720,H=Math.round(Math.max(0,Math.min(P,_)));$(H),u?.(H)}else if(g==="rightIndent"){let P=E-N-A,_=B-c-720,H=Math.round(Math.max(0,Math.min(P,_)));$(H),f?.(H)}},[g,e,E,R,N,B,c,d,r,o,i,u,f]),Z=S.useCallback(()=>{v(null),$(null),I(null)},[]);S.useEffect(()=>{if(g)return document.addEventListener("mousemove",V),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",Z)}},[g,V,Z]);let K=I6(E,e,h);return b.jsxs("div",{ref:F,className:`docx-horizontal-ruler ${p}`,style:{position:"relative",width:rt(j),height:Hd,backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:g?"ew-resize":"default",...m},role:"slider","aria-label":C("ruler.horizontal"),"aria-valuemin":0,"aria-valuemax":E,children:[b.jsx("div",{style:{position:"absolute",top:0,left:0,width:rt(O),height:Hd,backgroundColor:eg,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onMouseDown:n&&r?ee=>Y(ee,"leftMargin"):void 0}),b.jsx("div",{style:{position:"absolute",top:0,right:0,width:rt(z),height:Hd,backgroundColor:eg,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onMouseDown:n&&o?ee=>Y(ee,"rightMargin"):void 0}),b.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:K.map((ee,G)=>b.jsx(C6,{tick:ee},G))}),l&&b.jsx(_d,{direction:"down",positionPx:ce,editable:n,isDragging:g==="firstLineIndent",isHovered:k==="firstLineIndent",onMouseEnter:()=>x("firstLineIndent"),onMouseLeave:()=>x(null),onMouseDown:ee=>Y(ee,"firstLineIndent"),label:C("ruler.firstLineIndent")}),n&&u&&b.jsx(_d,{direction:"up",positionPx:se,editable:n,isDragging:g==="leftIndent",isHovered:k==="leftIndent",onMouseEnter:()=>x("leftIndent"),onMouseLeave:()=>x(null),onMouseDown:ee=>Y(ee,"leftIndent"),label:C("ruler.leftIndent")}),n&&f&&b.jsx(_d,{direction:"down",positionPx:ie,editable:n,isDragging:g==="rightIndent",isHovered:k==="rightIndent",onMouseEnter:()=>x("rightIndent"),onMouseLeave:()=>x(null),onMouseDown:ee=>Y(ee,"rightIndent"),label:C("ruler.rightIndent")}),y?.map(ee=>b.jsx($6,{tabStop:ee,positionPx:ut(ee.position)*e,onDoubleClick:()=>w?.(ee.position)},ee.position)),g&&T!==null&&M!==null&&b.jsx(S6,{value:v6(T,h),positionPx:M})]})}function C6({tick:t}){return b.jsxs(b.Fragment,{children:[b.jsx("div",{style:{position:"absolute",left:rt(t.position),bottom:0,width:1,height:t.height,backgroundColor:y6}}),t.label&&b.jsx("div",{style:{position:"absolute",left:rt(t.position),top:3,transform:"translateX(-50%)",fontSize:"9px",color:g6,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:t.label})]})}function _d({direction:t,positionPx:e,editable:n,isDragging:r,isHovered:o,onMouseEnter:i,onMouseLeave:l,onMouseDown:a,label:s}){let c=r?x6:o?w6:b6,d=Math.round(bo*1.6),u={position:"absolute",left:rt(e-bo),width:bo*2,height:d+2,cursor:n?"ew-resize":"default",zIndex:r?10:4,...t==="down"?{top:0}:{bottom:0}},f=t==="down"?{position:"absolute",top:1,left:0,width:0,height:0,borderLeft:`${bo}px solid transparent`,borderRight:`${bo}px solid transparent`,borderTop:`${d}px solid ${c}`,transition:"border-top-color 0.1s"}:{position:"absolute",bottom:1,left:0,width:0,height:0,borderLeft:`${bo}px solid transparent`,borderRight:`${bo}px solid transparent`,borderBottom:`${d}px solid ${c}`,transition:"border-bottom-color 0.1s"};return b.jsx("div",{className:"docx-ruler-indent",style:u,onMouseEnter:i,onMouseLeave:l,onMouseDown:a,role:"slider","aria-label":s,"aria-orientation":"horizontal",tabIndex:n?0:-1,children:b.jsx("div",{style:f})})}function S6({value:t,positionPx:e}){return b.jsx("div",{style:{position:"absolute",left:rt(e),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:t})}var T6={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function $6({tabStop:t,positionPx:e,onDoubleClick:n}){return b.jsx("div",{style:{position:"absolute",left:rt(e-5),bottom:0,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:r=>{r.stopPropagation(),n()},title:`${t.alignment} tab at ${(t.position/1440).toFixed(2)}"`,children:T6[t.alignment]||"L"})}function I6(t,e,n){let r=[];if(n==="inch"){let o=Vw/8,i=Math.ceil(t/o);for(let l=0;l<=i;l++){let a=l*o;if(a>t)break;let s=ut(a)*e;l%8===0?r.push({position:s,height:10,label:l/8>0?String(l/8):void 0}):l%4===0?r.push({position:s,height:6}):l%2===0?r.push({position:s,height:4}):r.push({position:s,height:2})}}else{let o=qw/10,i=Math.ceil(t/o);for(let l=0;l<=i;l++){let a=l*o;if(a>t)break;let s=ut(a)*e;l%10===0?r.push({position:s,height:10,label:l/10>0?String(l/10):void 0}):l%5===0?r.push({position:s,height:6}):r.push({position:s,height:3})}}return r}function M6(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function Kn(t){return M6()?t.replace(/Ctrl\+/g,"⌘").replace(/Alt\+/g,"⌥").replace(/Shift\+/g,"⇧"):t}var Zw=Object.defineProperty,R6=Object.getOwnPropertyDescriptor,P6=Object.getOwnPropertyNames,E6=Object.prototype.hasOwnProperty,F6=(t,e,n)=>e in t?Zw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,A6=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of P6(e))!E6.call(t,o)&&o!==n&&Zw(t,o,{get:()=>e[o],enumerable:!(r=R6(e,o))||r.enumerable});return t},D6=(t,e,n)=>(A6(t,e,"default"),n),N6=(t,e,n)=>F6(t,e+"",n);function Bt(t){this.content=t}Bt.prototype={constructor:Bt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Bt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Bt(n)},addToStart:function(t,e){return new Bt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Bt(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Bt(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Bt.from(t),t.size?new Bt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Bt.from(t),t.size?new Bt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Bt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Bt.from=function(t){if(t instanceof Bt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Bt(e)};function Kw(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let l=o.text,a=i.text,s=0;for(;l[s]==a[s];s++)n++;return s&&s<l.length&&s<a.length&&Gw(l.charCodeAt(s-1))&&Xw(l.charCodeAt(s))&&n--,n}if(o.content.size||i.content.size){let l=Kw(o.content,i.content,n+1);if(l!=null)return l}n+=o.nodeSize}}function Uw(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let l=t.child(--o),a=e.child(--i),s=l.nodeSize;if(l==a){n-=s,r-=s;continue}if(!l.sameMarkup(a))return{a:n,b:r};if(l.isText&&l.text!=a.text){let c=l.text,d=a.text,u=c.length,f=d.length;for(;u>0&&f>0&&c[u-1]==d[f-1];)u--,f--,n--,r--;return u&&f&&u<c.length&&Gw(c.charCodeAt(u-1))&&Xw(c.charCodeAt(u))&&(n++,r++),{a:n,b:r}}if(l.content.size||a.content.size){let c=Uw(l.content,a.content,n-1,r-1);if(c)return c}n-=s,r-=s}}function Xw(t){return t>=56320&&t<57344}function Gw(t){return t>=55296&&t<56320}class oe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let l=0,a=0;a<n;l++){let s=this.content[l],c=a+s.nodeSize;if(c>e&&r(s,o+a,i||null,l)!==!1&&s.content.size){let d=a+1;s.nodesBetween(Math.max(0,e-d),Math.min(s.content.size,n-d),r,o+d)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",l=!0;return this.nodesBetween(e,n,(a,s)=>{let c=a.isText?a.text.slice(Math.max(e,s)-s,n-s):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(l?l=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new oe(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,l=0;l<n;i++){let a=this.content[i],s=l+a.nodeSize;s>e&&((l<e||s>n)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,n-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,n-l-1))),r.push(a),o+=a.nodeSize),l=s}return new oe(r,o)}cutByIndex(e,n){return e==n?oe.empty:e==0&&n==this.content.length?this:new oe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new oe(o,i)}addToStart(e){return new oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Kw(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Uw(this,e,n,r)}findIndex(e){if(e==0)return Fa(0,e);if(e==this.size)return Fa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Fa(n+1,i):Fa(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return oe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return oe.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return oe.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new oe(n||e,r)}static from(e){if(!e)return oe.empty;if(e instanceof oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}oe.empty=new oe([],0);const Wd={index:0,offset:0};function Fa(t,e){return Wd.index=t,Wd.offset=e,Wd}function Ls(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Ls(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Ls(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class Xe{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ls(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Xe.none;if(e instanceof Xe)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}}Xe.none=[];class Ol extends Error{}class he{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Jw(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new he(r,this.openStart,this.openEnd)}removeBetween(e,n){return new he(Yw(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return he.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new he(oe.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new he(e,r,o)}}he.empty=new he(oe.empty,0,0);function Yw(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:l,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Yw(i.content,e-o-1,n-o-1)))}function Jw(t,e,n,r,o,i){let{index:l,offset:a}=t.findIndex(e),s=t.maybeChild(l);if(a==e||s.isText)return i&&r<=0&&o<=0&&!i.canReplace(l,l,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Jw(s.content,e-a-1,n,l==0?r-1:0,l==t.childCount-1?o-1:0,s);return c&&t.replaceChild(l,s.copy(c))}function L6(t,e,n){if(n.openStart>t.depth)throw new Ol("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ol("Inconsistent open depths");return Qw(t,e,n,0)}function Qw(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let l=Qw(t,e,n,r+1);return i.copy(i.content.replaceChild(o,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,a=l.content;return Mo(l,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:l,end:a}=B6(n,t);return Mo(i,tx(t,l,a,e,r))}else return Mo(i,Bs(t,e,r))}function ex(t,e){if(!e.type.compatibleContent(t.type))throw new Ol("Cannot join "+e.type.name+" onto "+t.type.name)}function Ou(t,e,n){let r=t.node(n);return ex(r,e.node(n)),r}function Io(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Cl(t,e,n,r){let o=(e||t).node(n),i=0,l=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Io(t.nodeAfter,r),i++));for(let a=i;a<l;a++)Io(o.child(a),r);e&&e.depth==n&&e.textOffset&&Io(e.nodeBefore,r)}function Mo(t,e){if(!t.type.validContent(e))throw new Ol("Invalid content for node "+t.type.name);return t.copy(e)}function tx(t,e,n,r,o){let i=t.depth>o&&Ou(t,e,o+1),l=r.depth>o&&Ou(n,r,o+1),a=[];return Cl(null,t,o,a),i&&l&&e.index(o)==n.index(o)?(ex(i,l),Io(Mo(i,tx(t,e,n,r,o+1)),a)):(i&&Io(Mo(i,Bs(t,e,o+1)),a),Cl(e,n,o,a),l&&Io(Mo(l,Bs(n,r,o+1)),a)),Cl(r,null,o,a),new oe(a)}function Bs(t,e,n){let r=[];if(Cl(null,t,n,r),t.depth>n){let o=Ou(t,e,n+1);Io(Mo(o,Bs(t,e,n+1)),r)}return Cl(e,null,n,r),new oe(r)}function B6(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(oe.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}class jl{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Xe.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let a=r;r=o,o=a}let i=r.marks;for(var l=0;l<i.length;l++)i[l].type.spec.inclusive===!1&&(!o||!i[l].isInSet(o.marks))&&(i=i[l--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new z6(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let l=e;;){let{index:a,offset:s}=l.content.findIndex(i),c=i-s;if(r.push(l,a,o+s),!c||(l=l.child(a),l.isText))break;i=c-1,o+=s+1}return new jl(n,r,i)}static resolveCached(e,n){let r=tg.get(e);if(r)for(let i=0;i<r.elts.length;i++){let l=r.elts[i];if(l.pos==n)return l}else tg.set(e,r=new O6);let o=r.elts[r.i]=jl.resolve(e,n);return r.i=(r.i+1)%j6,o}}class O6{constructor(){this.elts=[],this.i=0}}const j6=12,tg=new WeakMap;class z6{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const H6=Object.create(null);let Ro=class ju{constructor(e,n,r,o=Xe.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Ls(this.attrs,n||e.defaultAttrs||H6)&&Xe.sameSet(this.marks,r||Xe.none)}copy(e=null){return e==this.content?this:new ju(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ju(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return he.empty;let o=this.resolve(e),i=this.resolve(n),l=r?0:o.sharedDepth(n),a=o.start(l),c=o.node(l).content.cut(o.pos-a,i.pos-a);return new he(c,o.depth-l,i.depth-l)}replace(e,n,r){return L6(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return jl.resolveCached(this,e)}resolveNoCache(e){return jl.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),nx(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=oe.empty,o=0,i=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,o,i),a=l&&l.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let s=o;s<i;s++)if(!this.type.allowsMarks(r.child(s).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),l=i&&i.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),ng(this.type.attrs,this.attrs,"node",this.type.name);let e=Xe.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];ng(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Xe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=oe.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};Ro.prototype.text=void 0;class Os extends Ro{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nx(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Os(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Os(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function nx(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function ng(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}class jo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new _6(e,n);if(r.next==null)return jo.empty;let o=rx(r);r.next&&r.err("Unexpected trailing text");let i=X6(U6(o));return G6(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(l,a){let s=l.matchFragment(e,r);if(s&&(!n||s.validEnd))return oe.from(a.map(c=>c.createAndFill()));for(let c=0;c<l.next.length;c++){let{type:d,next:u}=l.next[c];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(u)==-1){o.push(u);let f=i(u,a.concat(d));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let l=[];for(let a=o;a.type;a=a.via)l.push(a.type);return l.reverse()}for(let l=0;l<i.next.length;l++){let{type:a,next:s}=i.next[l];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!o.type||s.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)i+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return i}).join(`
31
+ `)}}jo.empty=new jo(!0);class _6{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function rx(t){let e=[];do e.push(W6(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function W6(t){let e=[];do e.push(V6(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function V6(t){let e=K6(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=q6(t,e);else break;return e}function rg(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function q6(t,e){let n=rg(t),r=n;return t.eat(",")&&(t.next!="}"?r=rg(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Z6(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let l=n[i];l.isInGroup(e)&&o.push(l)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function K6(t){if(t.eat("(")){let e=rx(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Z6(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function U6(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(l,a,s){let c={term:s,to:a};return e[l].push(c),c}function o(l,a){l.forEach(s=>s.to=a)}function i(l,a){if(l.type=="choice")return l.exprs.reduce((s,c)=>s.concat(i(c,a)),[]);if(l.type=="seq")for(let s=0;;s++){let c=i(l.exprs[s],a);if(s==l.exprs.length-1)return c;o(c,a=n())}else if(l.type=="star"){let s=n();return r(a,s),o(i(l.expr,s),s),[r(s)]}else if(l.type=="plus"){let s=n();return o(i(l.expr,a),s),o(i(l.expr,s),s),[r(s)]}else{if(l.type=="opt")return[r(a)].concat(i(l.expr,a));if(l.type=="range"){let s=a;for(let c=0;c<l.min;c++){let d=n();o(i(l.expr,s),d),s=d}if(l.max==-1)o(i(l.expr,s),s);else for(let c=l.min;c<l.max;c++){let d=n();r(s,d),o(i(l.expr,s),d),s=d}return[r(s)]}else{if(l.type=="name")return[r(a,void 0,l.value)];throw new Error("Unknown expr type")}}}}function ox(t,e){return e-t}function og(t,e){let n=[];return r(e),n.sort(ox);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let l=0;l<i.length;l++){let{term:a,to:s}=i[l];!a&&n.indexOf(s)==-1&&r(s)}}}function X6(t){let e=Object.create(null);return n(og(t,0));function n(r){let o=[];r.forEach(l=>{t[l].forEach(({term:a,to:s})=>{if(!a)return;let c;for(let d=0;d<o.length;d++)o[d][0]==a&&(c=o[d][1]);og(t,s).forEach(d=>{c||o.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new jo(r.indexOf(t.length-1)>-1);for(let l=0;l<o.length;l++){let a=o[l][1].sort(ox);i.next.push({type:o[l][0],next:e[a.join(",")]||n(a)})}return i}}function G6(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,l=[];for(let a=0;a<o.next.length;a++){let{type:s,next:c}=o.next[a];l.push(s.name),i&&!(s.isText||s.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ix(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function lx(t,e){let n=Object.create(null);for(let r in t){let o=t[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function ax(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new J6(t,r,e[r]);return n}let ig=class sx{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ax(e,r.attrs),this.defaultAttrs=ix(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==jo.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:lx(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ro(this,this.computeAttrs(e),oe.from(n),Xe.setFrom(r))}createChecked(e=null,n,r){return n=oe.from(n),this.checkContent(n),new Ro(this,this.computeAttrs(e),n,Xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=oe.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(oe.empty,!0);return i?new Ro(this,e,n.append(i),Xe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Xe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,l)=>r[i]=new sx(i,n,l));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Y6(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class J6{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Y6(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ec{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=ax(e,o.attrs),this.excluded=null;let i=ix(this.attrs);this.instance=i?new Xe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,lx(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,l)=>r[i]=new Ec(i,o++,n,l)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}}class Q6{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Bt.from(e.nodes),n.marks=Bt.from(e.marks||{}),this.nodes=ig.compile(this.spec.nodes,this),this.marks=Ec.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],l=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[l]||(r[l]=jo.parse(l,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?lg(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],l=i.spec.excludes;i.excluded=l==null?[i]:l==""?[]:lg(this,l.split(" "))}this.nodeFromJSON=o=>Ro.fromJSON(this,o),this.markFromJSON=o=>Xe.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ig){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new Os(r,r.defaultAttrs,e,Xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function lg(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],l=i;if(i)n.push(i);else for(let a in t.marks){let s=t.marks[a];(o=="_"||s.spec.group&&s.spec.group.split(" ").indexOf(o)>-1)&&n.push(l=s)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function e5(t){return t.tag!=null}function t5(t){return t.style!=null}let cx=class zu{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(e5(o))this.tags.push(o);else if(t5(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new sg(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new sg(this,n,!0);return r.addAll(e,Xe.none,n.from,n.to),he.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(o5(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let l=i.getAttrs(e);if(l===!1)continue;i.attrs=l||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let l=this.styles[i],a=l.style;if(!(a.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(l.getAttrs){let s=l.getAttrs(n);if(s===!1)continue;l.attrs=s||void 0}return l}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,l=0;for(;l<n.length;l++){let a=n[l];if((a.priority==null?50:a.priority)<i)break}n.splice(l,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(l=>{r(l=cg(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(l=>{r(l=cg(l)),l.node||l.ignore||l.mark||(l.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zu(e,zu.schemaRules(e)))}};const dx={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},n5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ux={ol:!0,ul:!0},zl=1,Hu=2,Sl=4;function ag(t,e,n){return e!=null?(e?zl:0)|(e==="full"?Hu:0):t&&t.whitespace=="pre"?zl|Hu:n&~Sl}class Aa{constructor(e,n,r,o,i,l){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=l,this.content=[],this.activeMarks=Xe.none,this.match=i||(l&Sl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(oe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&zl)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=oe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!dx.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class sg{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,l=ag(null,n.preserveWhitespace,0)|(r?Sl:0);o?i=new Aa(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,l):r?i=new Aa(null,null,Xe.none,!0,null,l):i=new Aa(e.schema.topNodeType,null,Xe.none,!0,null,l),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Hu?"full":this.localPreserveWS||(o.options&zl)>0,{schema:l}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
32
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let s=0;s<a.length;s++)s&&this.insertNode(l.linebreakReplacement.create(),n,!0),a[s]&&this.insertNode(l.text(a[s]),n,!/\S/.test(a[s]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],s=e.previousSibling;(!a||s&&s.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),a;ux.hasOwnProperty(l)&&this.parser.normalizeLists&&r5(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(s?s.ignore:n5.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let c,d=this.needsBlock;if(dx.hasOwnProperty(l))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let u=s&&s.skip?n:this.readStyles(e,n);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=d}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,s,c,s.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
33
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],l=r.getPropertyValue(i);if(l)for(let a=void 0;;){let s=this.parser.matchStyle(i,l,this,a);if(!s)break;if(s.ignore)return null;if(s.clearMark?n=n.filter(c=>!s.clearMark(c)):n=n.concat(this.parser.schema.marks[s.mark].create(s.attrs)),s.consuming===!1)a=s;else break}}return n}addElementByRule(e,n,r,o){let i,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let s=this.enter(l,n.attrs||null,r,n.preserveWhitespace);s&&(i=!0,r=s)}else{let s=this.parser.schema.marks[n.mark];r=r.concat(s.create(n.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(s=>this.insertNode(s,r,!1));else{let s=e;typeof n.contentElement=="string"?s=e.querySelector(n.contentElement):typeof n.contentElement=="function"?s=n.contentElement(e):n.contentElement&&(s=n.contentElement),this.findAround(e,s,!0),this.addAll(s,r),this.findAround(e,s,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let l=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];l!=a;l=l.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(l,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let l=this.open,a=0;l>=0;l--){let s=this.nodes[l],c=s.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=s,!c.length))break;if(s.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let l=0;l<o.length;l++)n=this.enterInner(o[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let l=Xe.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):dg(a.type,e.type))&&(l=a.addToSet(l));return i.content.push(e.mark(l)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let a=ag(e,i,l.options);l.options&Sl&&l.content.length==0&&(a|=Sl);let s=Xe.none;return r=r.filter(c=>(l.type?l.type.allowsMarkType(c.type):dg(c.type,e))?(s=c.addToSet(s),!1):!0),this.nodes.push(new Aa(e,n,s,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=zl)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),l=(a,s)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;s>=i;s--)if(l(a-1,s))return!0;return!1}else{let d=s>0||s==0&&o?this.nodes[s].type:r&&s>=i?r.node(s-i).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;s--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function r5(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ux.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function o5(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cg(t){let e={};for(let n in t)e[n]=t[n];return e}function dg(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],l=a=>{i.push(a);for(let s=0;s<a.edgeCount;s++){let{type:c,next:d}=a.edge(s);if(c==e||i.indexOf(d)<0&&l(d))return!0}};if(l(o.contentMatch))return!0}}class Bi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Da(n).createDocumentFragment());let o=r,i=[];return e.forEach(l=>{if(i.length||l.marks.length){let a=0,s=0;for(;a<i.length&&s<l.marks.length;){let c=l.marks[s];if(!this.marks[c.type.name]){s++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,s++}for(;a<i.length;)o=i.pop()[1];for(;s<l.marks.length;){let c=l.marks[s++],d=this.serializeMark(c,l.isInline,n);d&&(i.push([c,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){if(e.isText)return Da(n).createTextNode(e.text);let{dom:r,contentDOM:o}=hs(Da(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&hs(Da(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return typeof n=="string"?{dom:e.createTextNode(n)}:hs(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Bi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=ug(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return ug(e.marks)}}function ug(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Da(t){return t.document||window.document}const fg=new WeakMap;function i5(t){let e=fg.get(t);return e===void 0&&fg.set(t,e=l5(t)),e}function l5(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function hs(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=i5(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=o.indexOf(" ");l>0&&(n=o.slice(0,l),o=o.slice(l+1));let a,s=n?t.createElementNS(n,o):t.createElement(o),c=e[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let f=u.indexOf(" ");f>0?s.setAttributeNS(u.slice(0,f),u.slice(f+1),c[u]):u=="style"&&s.style?s.style.cssText=c[u]:s.setAttribute(u,c[u])}}for(let u=d;u<e.length;u++){let f=e[u];if(f===0){if(u<e.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}else if(typeof f=="string")s.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=hs(t,f,n,r);if(s.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:s,contentDOM:a}}const fx=65535,px=Math.pow(2,16);function a5(t,e){return t+e*px}function pg(t){return t&fx}function s5(t){return(t-(t&fx))/px}const hx=1,mx=2,ms=4,gx=8;class _u{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&gx)>0}get deletedBefore(){return(this.delInfo&(hx|ms))>0}get deletedAfter(){return(this.delInfo&(mx|ms))>0}get deletedAcross(){return(this.delInfo&ms)>0}}class bn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&bn.empty)return bn.empty}recover(e){let n=0,r=pg(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+s5(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let s=this.ranges[a]-(this.inverted?o:0);if(s>e)break;let c=this.ranges[a+i],d=this.ranges[a+l],u=s+c;if(e<=u){let f=c?e==s?-1:e==u?1:n:n,h=s+o+(f<0?0:d);if(r)return h;let p=e==(n<0?s:u)?null:a5(a/3,e-s),m=0;return c&&(m|=e==s?mx:e==u?hx:ms,(n<0?e!=s:e!=u)&&(m|=gx)),new _u(h,m,p)}o+=d-c}return r?e+o:new _u(e+o,0,null)}touches(e,n){let r=0,o=pg(n),i=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[a+i],d=s+c;if(e<=d&&a==o*3)return!0;r+=this.ranges[a+l]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let l=this.ranges[o],a=l-(this.inverted?i:0),s=l+(this.inverted?0:i),c=this.ranges[o+n],d=this.ranges[o+r];e(a,a+c,s,s+d),i+=d-c}}invert(){return new bn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?bn.empty:new bn(e<0?[0,-e,0]:[0,0,e])}}bn.empty=new bn([]);class Hl{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Hl(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Hl;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let l=this._maps[i],a=l.mapResult(e,n);if(a.recover!=null){let s=this.getMirror(i);if(s!=null&&s>i&&s<this.to){i=s,e=this._maps[s].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new _u(e,o,null)}}const Vd=Object.create(null);class Ut{getMap(){return bn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Vd[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Vd)throw new RangeError("Duplicate use of step JSON ID "+e);return Vd[e]=n,n.prototype.jsonID=e,n}}class St{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new St(e,null)}static fail(e){return new St(null,e)}static fromReplace(e,n,r,o){try{return St.ok(e.replace(n,r,o))}catch(i){if(i instanceof Ol)return St.fail(i.message);throw i}}}function up(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(up(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return oe.fromArray(r)}class hr extends Ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new he(up(n.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),o),n.openStart,n.openEnd);return St.fromReplace(e,this.from,this.to,i)}invert(){return new zn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new hr(n.pos,r.pos,this.mark)}merge(e){return e instanceof hr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new hr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hr(n.from,n.to,e.markFromJSON(n.mark))}}Ut.jsonID("addMark",hr);class zn extends Ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new he(up(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return St.fromReplace(e,this.from,this.to,r)}invert(){return new hr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new zn(n.pos,r.pos,this.mark)}merge(e){return e instanceof zn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zn(n.from,n.to,e.markFromJSON(n.mark))}}Ut.jsonID("removeMark",zn);class mr extends Ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return St.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return St.fromReplace(e,this.pos,this.pos+1,new he(oe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new mr(this.pos,n.marks[o]);return new mr(this.pos,this.mark)}}return new oo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new mr(n.pos,e.markFromJSON(n.mark))}}Ut.jsonID("addNodeMark",mr);class oo extends Ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return St.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return St.fromReplace(e,this.pos,this.pos+1,new he(oe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new mr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new oo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new oo(n.pos,e.markFromJSON(n.mark))}}Ut.jsonID("removeNodeMark",oo);class Ft extends Ut{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Wu(e,this.from,this.to)?St.fail("Structure replace would overwrite content"):St.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new bn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ft(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Ft.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Ft(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ft)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?he.empty:new he(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ft(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?he.empty:new he(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ft(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ft(n.from,n.to,he.fromJSON(e,n.slice),!!n.structure)}}Ft.MAP_BIAS=1;Ut.jsonID("replace",Ft);class xn extends Ut{constructor(e,n,r,o,i,l,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Wu(e,this.from,this.gapFrom)||Wu(e,this.gapTo,this.to)))return St.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return St.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?St.fromReplace(e,this.from,this.to,r):St.fail("Content does not fit in gap")}getMap(){return new bn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new xn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new xn(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new xn(n.from,n.to,n.gapFrom,n.gapTo,he.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ut.jsonID("replaceAround",xn);function Wu(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let l=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,o--}}return!1}function c5(t,e,n,r){let o=[],i=[],l,a;t.doc.nodesBetween(e,n,(s,c,d)=>{if(!s.isInline)return;let u=s.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+s.nodeSize,n),p=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(l&&l.to==f&&l.mark.eq(u[m])?l.to=h:o.push(l=new zn(f,h,u[m])));a&&a.to==f?a.to=h:i.push(a=new hr(f,h,r))}}),o.forEach(s=>t.step(s)),i.forEach(s=>t.step(s))}function d5(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(l,a)=>{if(!l.isInline)return;i++;let s=null;if(r instanceof Ec){let c=l.marks,d;for(;d=r.isInSet(c);)(s||(s=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(l.marks)&&(s=[r]):s=l.marks;if(s&&s.length){let c=Math.min(a+l.nodeSize,n);for(let d=0;d<s.length;d++){let u=s[d],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&u.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:u,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(l=>t.step(new zn(l.from,l.to,l.style)))}function fp(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),l=[],a=e+1;for(let s=0;s<i.childCount;s++){let c=i.child(s),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)l.push(new Ft(a,d,he.empty));else{r=u;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new zn(a,d,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new he(oe.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),l.push(new Ft(a+f.index,a+f.index+f[0].length,p))}}a=d}if(!r.validEnd){let s=r.fillBefore(oe.empty,!0);t.replace(a,a,new he(s,0,0))}for(let s=l.length-1;s>=0;s--)t.step(l[s])}function u5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function pp(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let l=t.$from.node(r),a=t.$from.index(r)+o,s=t.$to.indexAfter(r)-i;if(r<t.depth&&l.canReplace(a,s,n))return r;if(r==0||l.type.spec.isolating||!u5(l,a,s))break;a&&(o=1),s<l.childCount&&(i=1)}return null}function f5(t,e,n){let{$from:r,$to:o,depth:i}=e,l=r.before(i+1),a=o.after(i+1),s=l,c=a,d=oe.empty,u=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,d=oe.from(r.node(p).copy(d)),u++):s--;let f=oe.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=oe.from(o.node(p).copy(f)),h++):c++;t.step(new xn(s,c,l,a,new he(d.append(f),u,h),d.size-u,!0))}function p5(t,e,n){let r=oe.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let a=n[l].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=oe.from(n[l].type.create(n[l].attrs,r))}let o=e.start,i=e.end;t.step(new xn(o,i,o,i,new he(r,0,0),n.length,!0))}function h5(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(l,a)=>{let s=typeof o=="function"?o(l):o;if(l.isTextblock&&!l.hasMarkup(r,s)&&m5(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&bx(t,l,a,i),fp(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let d=t.mapping.slice(i),u=d.map(a,1),f=d.map(a+l.nodeSize,1);return t.step(new xn(u,f,u+1,f-1,new he(oe.from(r.create(s,null,l.marks)),0,0),1,!0)),c===!0&&yx(t,l,a,i),!1}})}function yx(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(o.text);){let s=t.mapping.slice(r).map(n+1+i+l.index);t.replaceWith(s,s+1,e.type.schema.linebreakReplacement.create())}}})}function bx(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+i);t.replaceWith(l,l+1,e.type.schema.text(`
34
+ `))}})}function m5(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function g5(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let l=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,l);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new xn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new he(oe.from(l),0,0),1,!0))}function gs(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,l=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!l.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(h))return!1}let a=o.indexAfter(i),s=r&&r[0];return o.node(i).canReplaceWith(a,a,s?s.type:o.node(i+1).type)}function y5(t,e,n=1,r){let o=t.doc.resolve(e),i=oe.empty,l=oe.empty;for(let a=o.depth,s=o.depth-n,c=n-1;a>s;a--,c--){i=oe.from(o.node(a).copy(i));let d=r&&r[c];l=oe.from(d?d.type.create(d.attrs,l):o.node(a).copy(l))}t.step(new Ft(e,e,new he(i.append(l),n,n),!0))}function wx(t,e){let n=t.resolve(e),r=n.index();return w5(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function b5(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),l=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function w5(t,e){return!!(t&&e&&!t.isLeaf&&b5(t,e))}function x5(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),l=i.node().type;if(o&&l.inlineContent){let d=l.whitespace=="pre",u=!!l.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);bx(t,d.node(),d.before(),a)}l.inlineContent&&fp(t,e+n-1,l,i.node().contentMatchAt(i.index()),r==null);let s=t.mapping.slice(a),c=s.map(e-n);if(t.step(new Ft(c,s.map(e+n,-1),he.empty,!0)),r===!0){let d=t.doc.resolve(c);yx(t,d.node(),d.before(),t.steps.length)}return t}function v5(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function xx(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let l=r.depth;l>=0;l--){let a=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,s=r.index(l)+(a>0?1:0),c=r.node(l),d=!1;if(i==1)d=c.canReplace(s,s,o);else{let u=c.contentMatchAt(s).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(s,s,u[0])}if(d)return a==0?r.pos:a<0?r.before(l+1):r.after(l+1)}return null}function hp(t,e,n=e,r=he.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return vx(o,i,r)?new Ft(e,n,r):new k5(o,i,r).fit()}function vx(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class k5{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=oe.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=oe.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,l=r.depth,a=o.depth;for(;l&&a&&i.childCount==1;)i=i.firstChild.content,l--,a--;let s=new he(i,l,a);return e>-1?new xn(r.pos,e,this.$to.pos,this.$to.end(),s,n):s.size||r.pos!=this.$to.pos?new Ft(r.pos,o.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=hg(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let l=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:s,match:c}=this.frontier[a],d,u=null;if(n==1&&(l?c.matchType(l.type)||(u=c.fillBefore(oe.from(l),!1)):i&&s.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:u};if(n==2&&l&&(d=c.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return mg(e,-1)<=n?!1:(this.unplaced.size>1&&mg(e,1)>r&&r++,this.unplaced=new he(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=hg(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new he(ul(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new he(ul(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let l=this.unplaced,a=r?r.content:l.content,s=l.openStart-e,c=0,d=[],{match:u,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)d.push(o.child(m));u=u.matchFragment(o)}let h=a.size+e-(l.content.size-l.openEnd);for(;c<a.childCount;){let m=a.child(c),y=u.matchType(m.type);if(!y)break;c++,(c>1||s==0||m.content.size)&&(u=y,d.push(kx(m.mark(f.allowedMarks(m.marks)),c==1?s:0,c==a.childCount?h:-1)))}let p=c==a.childCount;p||(h=-1),this.placed=fl(this.placed,n,oe.from(d)),this.frontier[n].match=u,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<h;m++){let w=y.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),y=w.content}this.unplaced=p?e==0?he.empty:new he(ul(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new he(ul(l.content,e,c),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!qd(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),l=qd(e,n,o,r,i);if(l){for(let a=n-1;a>=0;a--){let{match:s,type:c}=this.frontier[a],d=qd(e,a,c,s,!0);if(!d||d.childCount)continue e}return{depth:n,fit:l,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=fl(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=fl(this.placed,this.depth,oe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(oe.empty,!0);n.childCount&&(this.placed=fl(this.placed,this.frontier.length,n))}}function ul(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(ul(t.firstChild.content,e-1,n)))}function fl(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(fl(t.lastChild.content,e-1,n)))}function hg(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kx(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kx(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(oe.empty,!0)))),t.copy(r)}function qd(t,e,n,r,o){let i=t.node(e),l=o?t.indexAfter(e):t.index(e);if(l==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,l);return a&&!C5(n,i.content,l)?a:null}function C5(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function S5(t){return t.spec.defining||t.spec.definingForContent}function mg(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function T5(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(vx(o,i,r))return t.step(new Ft(e,n,r));let l=Sx(o,i);l[l.length-1]==0&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;l.indexOf(f)>-1?a=f:o.before(f)==h&&l.splice(1,0,-f)}let s=l.indexOf(a),c=[],d=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=d-1;f>=0;f--){let h=c[f],p=S5(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(a)-1)))d=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+d+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<l.length;m++){let y=l[(m+s)%l.length],w=!0;y<0&&(w=!1,y=-y);let C=o.node(y-1),g=o.index(y-1);if(C.canReplaceWith(g,g,p.type,p.marks))return t.replace(o.before(y),w?i.after(y):n,new he(Cx(r.content,0,r.openStart,h),h,r.openEnd))}}let u=t.steps.length;for(let f=l.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>u));f--){let h=l[f];h<0||(e=o.before(h),n=i.after(h))}}function Cx(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Cx(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),l=i.fillBefore(t).append(t);t=l.append(i.matchFragment(l).fillBefore(oe.empty,!0))}return t}function $5(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=v5(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new he(oe.from(r),0,0))}function I5(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let l=r.sharedDepth(n),a=!1;for(let s=r.depth;s>l;s--)r.node(s).type.spec.isolating&&(a=!0);for(let s=o.depth;s>l;s--)o.node(s).type.spec.isolating&&(a=!0);if(!a){for(let s=r.depth;s>0&&e==r.start(s);s--)e=r.before(s);for(let s=o.depth;s>0&&n==o.start(s);s--)n=o.before(s);r=t.doc.resolve(e),o=t.doc.resolve(n)}}let i=Sx(r,o);for(let l=0;l<i.length;l++){let a=i[l],s=l==i.length-1;if(s&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(s||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let l=1;l<=r.depth&&l<=o.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&o.end(l)-n!=o.depth-l&&r.start(l-1)==o.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),o.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function Sx(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class Ci extends Ut{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return St.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return St.fromReplace(e,this.pos,this.pos+1,new he(oe.from(o),0,n.isLeaf?0:1))}getMap(){return bn.empty}invert(e){return new Ci(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ci(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ci(n.pos,n.attr,n.value)}}Ut.jsonID("attr",Ci);class _l extends Ut{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return St.ok(r)}getMap(){return bn.empty}invert(e){return new _l(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new _l(n.attr,n.value)}}Ut.jsonID("docAttr",_l);let Ii=class extends Error{};Ii=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ii.prototype=Object.create(Error.prototype);Ii.prototype.constructor=Ii;Ii.prototype.name="TransformError";class Tx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ii(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((i,l,a,s)=>{e=Math.min(e,a),n=Math.max(n,s)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=he.empty){let o=hp(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new he(oe.from(r),0,0))}delete(e,n){return this.replace(e,n,he.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return T5(this,e,n,r),this}replaceRangeWith(e,n,r){return $5(this,e,n,r),this}deleteRange(e,n){return I5(this,e,n),this}lift(e,n){return f5(this,e,n),this}join(e,n=1){return x5(this,e,n),this}wrap(e,n){return p5(this,e,n),this}setBlockType(e,n=e,r,o=null){return h5(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return g5(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Ci(e,n,r)),this}setDocAttribute(e,n){return this.step(new _l(e,n)),this}addNodeMark(e,n){return this.step(new mr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new oo(e,n));else{let o=r.marks,i,l=[];for(;i=n.isInSet(o);)l.push(new oo(e,i)),o=i.removeFromSet(o);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(e,n=1,r){return y5(this,e,n,r),this}addMark(e,n,r){return c5(this,e,n,r),this}removeMark(e,n,r){return d5(this,e,n,r),this}clearIncompatible(e,n,r){return fp(this,e,n,r),this}}const Zd=Object.create(null);class Le{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new $x(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=he.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:s,$to:c}=l[a],d=e.mapping.slice(i);e.replaceRange(d.map(s.pos),d.map(c.pos),a?he.empty:n),a==0&&bg(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:l,$to:a}=o[i],s=e.mapping.slice(r),c=s.map(l.pos),d=s.map(a.pos);i?e.deleteRange(c,d):(e.replaceRangeWith(c,d,n),bg(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new ye(e):ui(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let l=n<0?ui(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ui(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new vn(e.node(0))}static atStart(e){return ui(e,e,0,0,1)||new vn(e)}static atEnd(e){return ui(e,e,e.content.size,e.childCount,-1)||new vn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Zd[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Zd)throw new RangeError("Duplicate use of selection JSON ID "+e);return Zd[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ye.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class $x{constructor(e,n){this.$from=e,this.$to=n}}let gg=!1;function yg(t){!gg&&!t.parent.inlineContent&&(gg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ye extends Le{constructor(e,n=e){yg(e),yg(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Le.near(r);let o=e.resolve(n.map(this.anchor));return new ye(o.parent.inlineContent?o:r,r)}replace(e,n=he.empty){if(super.replace(e,n),n==he.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ye&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Fc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ye(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(i)n=i.$head;else return Le.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new ye(e,n)}}Le.jsonID("text",ye);class Fc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Fc(e.map(this.anchor),e.map(this.head))}resolve(e){return ye.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ie extends Le{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?Le.near(i):new Ie(i)}content(){return new he(oe.from(this.node),0,0)}eq(e){return e instanceof Ie&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mp(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ie(e.resolve(n.anchor))}static create(e,n){return new Ie(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ie.prototype.visible=!1;Le.jsonID("node",Ie);class mp{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Fc(r,r):new mp(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ie.isSelectable(r)?new Ie(n):Le.near(n)}}class vn extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=he.empty){if(n==he.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new vn(e)}map(e){return new vn(e)}eq(e){return e instanceof vn}getBookmark(){return M5}}Le.jsonID("all",vn);const M5={map(){return this},resolve(t){return new vn(t)}};function ui(t,e,n,r,o,i=!1){if(e.inlineContent)return ye.create(t,n);for(let l=r-(o>0?0:1);o>0?l<e.childCount:l>=0;l+=o){let a=e.child(l);if(a.isAtom){if(!i&&Ie.isSelectable(a))return Ie.create(t,n-(o<0?a.nodeSize:0))}else{let s=ui(t,a,n+o,o<0?a.childCount:0,o,i);if(s)return s}n+=a.nodeSize*o}return null}function bg(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof Ft||o instanceof xn))return;let i=t.mapping.maps[r],l;i.forEach((a,s,c,d)=>{l==null&&(l=d)}),t.setSelection(Le.near(t.doc.resolve(l),n))}const wg=1,Na=2,xg=4;class R5 extends Tx{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|wg)&~Na,this.storedMarks=null,this}get selectionSet(){return(this.updated&wg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Na,this}ensureMarks(e){return Xe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Na)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Na,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let l=this.doc.resolve(n);i=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=xg,this}get scrolledIntoView(){return(this.updated&xg)>0}}function vg(t,e){return!e||!t?t:t.bind(e)}class pl{constructor(e,n,r){this.name=e,this.init=vg(n.init,r),this.apply=vg(n.apply,r)}}const P5=[new pl("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new pl("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new pl("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new pl("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Kd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=P5.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new pl(r.key,r.spec.state,r))})}}class ko{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let l=0;l<this.config.plugins.length;l++){let a=this.config.plugins[l];if(a.spec.appendTransaction){let s=o?o[l].n:0,c=o?o[l].state:this,d=s<n.length&&a.spec.appendTransaction.call(a,s?n.slice(s):n,c,r);if(d&&r.filterTransaction(d,l)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let u=0;u<this.config.plugins.length;u++)o.push(u<l?{state:r,n:n.length}:{state:this,n:0})}n.push(d),r=r.applyInner(d),i=!0}o&&(o[l]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ko(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new R5(this)}static create(e){let n=new Kd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ko(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Kd(this.schema,e.plugins),r=n.fields,o=new ko(n);for(let i=0;i<r.length;i++){let l=r[i].name;o[l]=this.hasOwnProperty(l)?this[l]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Kd(e.schema,e.plugins),i=new ko(o);return o.fields.forEach(l=>{if(l.name=="doc")i.doc=Ro.fromJSON(e.schema,n.doc);else if(l.name=="selection")i.selection=Le.fromJSON(i.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let s=r[a],c=s.spec.state;if(s.key==l.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[l.name]=c.fromJSON.call(s,e,n[a],i);return}}i[l.name]=l.init(e,i)}}),i}}function Ix(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ix(o,e,{})),n[r]=o}return n}class zt{constructor(e){this.spec=e,this.props={},e.props&&Ix(e.props,this,this.props),this.key=e.key?e.key.key:Mx("plugin")}getState(e){return e[this.key]}}const Ud=Object.create(null);function Mx(t){return t in Ud?t+"$"+ ++Ud[t]:(Ud[t]=0,t+"$")}class fn{constructor(e="key"){this.key=Mx(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}function Qe(t){return t/1440*96}function Rx(t,e,n){if(!n||e<=n)return{width:t,height:e};let r=n/e;return{width:Math.round(t*r),height:n}}var E5=0;function io(){return`block-${++E5}`}var wi={top:4,bottom:4,left:7,right:7},Vu=200;function gp(t,e){let n=t.kind??"<unknown>";throw new Error(`${e}: unhandled FlowBlock kind "${n}". Add the case alongside the other FlowBlock switches (see types.ts).`)}var F5={accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",tx1:"text1",tx2:"text2",bg1:"background1",bg2:"background2",hlink:"hlink",folHlink:"folHlink"},kg={black:"000000",white:"FFFFFF",red:"FF0000",green:"00FF00",blue:"0000FF",yellow:"FFFF00",cyan:"00FFFF",magenta:"FF00FF"};function Cg(t,e){let n=je(e),r=n.find(i=>i.name==="a:shade");if(r){let i=D(r,null,"val");i&&(t.themeShade=Math.round(parseInt(i,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase())}let o=n.find(i=>i.name==="a:tint");if(o){let i=D(o,null,"val");i&&(t.themeTint=Math.round(parseInt(i,10)/1e5*255).toString(16).padStart(2,"0").toUpperCase())}return t}function Px(t){if(!t)return;let e=je(t),n=e.find(l=>l.name==="a:srgbClr");if(n){let l=D(n,null,"val");if(l)return Cg({rgb:l},n)}let r=e.find(l=>l.name==="a:schemeClr");if(r){let l=D(r,null,"val");if(l){let a={themeColor:F5[l]??"dk1"};return Cg(a,r)}}let o=e.find(l=>l.name==="a:sysClr");if(o)return{rgb:D(o,null,"lastClr")??"000000"};let i=e.find(l=>l.name==="a:prstClr");if(i){let l=D(i,null,"val");if(l&&kg[l])return{rgb:kg[l]}}}function A5(t){if(!t)return;let e=je(t);if(e.find(r=>r.name==="a:noFill"))return{type:"none"};let n=e.find(r=>r.name==="a:solidFill");if(n)return{type:"solid",color:Px(n)};if(e.find(r=>r.name==="a:gradFill"))return{type:"gradient"}}function D5(t){let e=t?Be(t,"a:ln"):null;if(!e)return;let n=je(e);if(n.find(a=>a.name==="a:noFill"))return;let r={},o=D(e,null,"w");o&&(r.width=parseInt(o,10));let i=n.find(a=>a.name==="a:solidFill");i&&(r.color=Px(i));let l=n.find(a=>a.name==="a:prstDash");if(l){let a=D(l,null,"val");a&&(r.style=a)}return r}function Ex(t){if(!t)return;let e=D(t,null,"relativeFrom")??"column",n=Be(t,"wp:align");if(n){let o=Do(n);return{relativeTo:e,alignment:o}}let r=Be(t,"wp:posOffset");if(r){let o=Do(r),i=parseInt(o,10);return{relativeTo:e,posOffset:isNaN(i)?0:i}}return{relativeTo:e}}function Fx(t){if(!t)return;let e=D(t,null,"relativeFrom")??"paragraph",n=Be(t,"wp:align");if(n){let o=Do(n);return{relativeTo:e,alignment:o}}let r=Be(t,"wp:posOffset");if(r){let o=Do(r),i=parseInt(o,10);return{relativeTo:e,posOffset:isNaN(i)?0:i}}return{relativeTo:e}}function N5(t){let e=Be(t,"wp:positionH"),n=Be(t,"wp:positionV");if(!(!e&&!n))return{horizontal:Ex(e)??{relativeTo:"column"},vertical:Fx(n)??{relativeTo:"paragraph"}}}var Ax=["wp:wrapNone","wp:wrapSquare","wp:wrapTight","wp:wrapThrough","wp:wrapTopAndBottom"];function Dx(t,e,n){if(!t){let u={type:e?"behind":"inFront"};return n?.distT!==void 0&&(u.distT=n.distT),n?.distB!==void 0&&(u.distB=n.distB),n?.distL!==void 0&&(u.distL=n.distL),n?.distR!==void 0&&(u.distR=n.distR),u}let r=(t.name||"").replace("wp:",""),o;switch(r){case"wrapNone":o=e?"behind":"inFront";break;case"wrapSquare":o="square";break;case"wrapTight":o="tight";break;case"wrapThrough":o="through";break;case"wrapTopAndBottom":o="topAndBottom";break;default:o="square"}let i={type:o},l=D(t,null,"wrapText");l&&(i.wrapText=l);let a=J(t,null,"distT")??n?.distT,s=J(t,null,"distB")??n?.distB,c=J(t,null,"distL")??n?.distL,d=J(t,null,"distR")??n?.distR;return a!==void 0&&(i.distT=a),s!==void 0&&(i.distB=s),c!==void 0&&(i.distL=c),d!==void 0&&(i.distR=d),i}function L5(t){let e=je(t),n=D(t,null,"behindDoc")==="1",r=e.find(i=>Ax.includes(i.name??"")),o={distT:J(t,null,"distT")??void 0,distB:J(t,null,"distB")??void 0,distL:J(t,null,"distL")??void 0,distR:J(t,null,"distR")??void 0};return Dx(r??null,n,o)}function B5(t){if(!t)return{};let e={},n=J(t,null,"lIns"),r=J(t,null,"rIns"),o=J(t,null,"tIns"),i=J(t,null,"bIns");return(n!==void 0||r!==void 0||o!==void 0||i!==void 0)&&(e.margins={left:n,right:r,top:o,bottom:i}),e}function O5(t,e,n,r,o,i,l,a){if(!t)return[];let s=[],c=je(t);for(let d of c){let u=d.name||"",f=u.indexOf(":");if((f>=0?u.substring(f+1):u)==="p"){let p=e(d,r,o,i,l);s.push(p)}}return s}function Nx(t){let e=je(t).find(i=>i.name==="wp:inline"||i.name==="wp:anchor");if(!e)return!1;let n=Be(e,"a:graphic");if(!n)return!1;let r=Be(n,"a:graphicData");if(!r)return!1;let o=Be(r,"wps:wsp");return o?Be(o,"wps:txbx")!==null:!1}function j5(t){let e=je(t).find(g=>g.name==="wp:inline"||g.name==="wp:anchor");if(!e)return null;let n=e.name==="wp:anchor",r=Be(e,"a:graphic");if(!r)return null;let o=Be(r,"a:graphicData");if(!o)return null;let i=Be(o,"wps:wsp");if(!i||!Be(i,"wps:txbx"))return null;let l=je(i),a=l.find(g=>g.name==="wps:spPr"),s=l.find(g=>g.name==="wps:bodyPr"),c=Be(e,"wp:extent"),d=J(c,null,"cx")??0,u=J(c,null,"cy")??0,f={width:d,height:u},h=Be(e,"wp:docPr"),p=h?D(h,null,"id")??void 0:void 0,m=A5(a??null),y=D5(a??null),w=B5(s??null),C={type:"textBox",size:f,content:[]};if(p&&(C.id=p),m&&(C.fill=m),y&&(C.outline=y),w.margins&&(C.margins=w.margins),n){let g=N5(e);g&&(C.position=g);let v=L5(e);v&&(C.wrap=v)}return C}function z5(t){let e=Be(t,"wps:txbx");return e?Be(e,"w:txbxContent"):null}function H5(t){if(!t)return;let e=parseInt(t,10);if(!isNaN(e))return e/6e4}function _5(t,e){let n=je(t);for(let r of n)if(e.includes(r.name||""))return r;return null}function Lx(t){if(!t)return{width:0,height:0};let e=J(t,null,"cx")??0,n=J(t,null,"cy")??0;return{width:e,height:n}}function Bx(t){if(!t)return;let e=J(t,null,"l")??0,n=J(t,null,"t")??0,r=J(t,null,"r")??0,o=J(t,null,"b")??0;if(!(e===0&&n===0&&r===0&&o===0))return{left:e,top:n,right:r,bottom:o}}function Ox(t){if(!t)return{};let e=D(t,null,"id")??void 0,n=D(t,null,"name")??void 0,r=D(t,null,"descr")??void 0,o=D(t,null,"title")??void 0,i=D(t,null,"decorative")==="1",l=L(t,"a","hlinkClick"),a=l?D(l,"r","id")??void 0:void 0;return{id:e,name:n,alt:r,title:o,decorative:i||void 0,hlinkRId:a}}function jx(t){if(!t)return;let e=D(t,null,"rot"),n=D(t,null,"flipH")==="1",r=D(t,null,"flipV")==="1",o=H5(e);if(o===void 0&&!n&&!r)return;let i={};return o!==void 0&&(i.rotation=o),n&&(i.flipH=!0),r&&(i.flipV=!0),i}function zx(t){let e=Be(t,"a:graphic");if(!e)return{blipFill:null,blip:null};let n=Be(e,"a:graphicData");if(!n)return{blipFill:null,blip:null};let r=Be(n,"pic:pic");if(!r)return{blipFill:null,blip:null};let o=Be(r,"pic:blipFill");return o?{blipFill:o,blip:Be(o,"a:blip")}:{blipFill:null,blip:null}}function Hx(t){if(!t)return;let e=Be(t,"a:srcRect");if(!e)return;let n=s=>{let c=J(e,null,s);if(!(c===void 0||c===0))return c/1e5},r=n("l"),o=n("t"),i=n("r"),l=n("b");if(r===void 0&&o===void 0&&i===void 0&&l===void 0)return;let a={};return r!==void 0&&(a.left=r),o!==void 0&&(a.top=o),i!==void 0&&(a.right=i),l!==void 0&&(a.bottom=l),a}function _x(t){if(!t)return;let e=Be(t,"a:alphaModFix");if(!e)return;let n=J(e,null,"amt");if(!(n===void 0||n>=1e5))return Math.max(0,Math.min(1,n/1e5))}function Wx(t){if(!t)return"";let e=D(t,"r","embed");if(e)return e;let n=D(t,null,"embed");return n||D(t,"r","link")||""}function Vx(t){let e=Be(t,"a:graphic");if(!e)return null;let n=Be(e,"a:graphicData");if(!n)return null;let r=Be(n,"pic:pic");if(!r)return null;let o=Be(r,"pic:spPr");return o?Be(o,"a:xfrm"):null}function W5(t){if(!t)return t;let e=t.replace(/^\/+/,"");return e.startsWith("media/")?e=`word/${e}`:e.startsWith("word/")||(e=`word/${e}`),e}function V5(t){let e=t.split(".").pop()?.toLowerCase()??"";return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",svg:"image/svg+xml",emf:"image/x-emf",wmf:"image/x-wmf"}[e]??"application/octet-stream"}function yp(t,e,n){if(!t||!e)return{};let r=e.get(t);if(!r)return{};let o=r.target;if(!o)return{};let i=W5(o),l=o.split("/").pop(),a=(s,c)=>{let d=c.toLowerCase();for(let[u,f]of s.entries())if(u.toLowerCase()===d)return f};if(n){let s=a(n,i);if(s)return{src:s.dataUrl||s.base64,mimeType:s.mimeType,filename:l};let c=o.replace(/^\/+/,""),d=a(n,c);if(d)return{src:d.dataUrl||d.base64,mimeType:d.mimeType,filename:l};let u=`word/${c}`,f=a(n,u);if(f)return{src:f.dataUrl||f.base64,mimeType:f.mimeType,filename:l}}return{mimeType:V5(o),filename:l}}function q5(t,e,n){let r=Be(t,"wp:extent"),o=Lx(r),i=Be(t,"wp:effectExtent"),l=Bx(i),a=Be(t,"wp:docPr"),s=Ox(a),{blip:c,blipFill:d}=zx(t),u=Wx(c),f=Hx(d),h=_x(c),p=yp(u,e,n),m=Vx(t),y=jx(m),w=J(t,null,"distT")??void 0,C=J(t,null,"distB")??void 0,g=J(t,null,"distL")??void 0,v=J(t,null,"distR")??void 0,k={type:"inline"};w!==void 0&&(k.distT=w),C!==void 0&&(k.distB=C),g!==void 0&&(k.distL=g),v!==void 0&&(k.distR=v);let x={type:"image",rId:u,size:o,wrap:k};if(s.id&&(x.id=s.id),s.alt&&(x.alt=s.alt),s.title&&(x.title=s.title),s.decorative&&(x.decorative=!0),p.src&&(x.src=p.src),p.mimeType&&(x.mimeType=p.mimeType),p.filename&&(x.filename=p.filename),l&&(x.padding=l),y&&(x.transform=y),f&&(x.crop=f),h!==void 0&&(x.opacity=h),s.hlinkRId&&e){let T=yc(Mb(e,s.hlinkRId));T&&(x.hlinkHref=T)}return x}function Z5(t,e,n){let r=Be(t,"wp:extent"),o=Lx(r),i=Be(t,"wp:effectExtent"),l=Bx(i),a=Be(t,"wp:docPr"),s=Ox(a),c=D(t,null,"behindDoc")==="1",d=D(t,null,"layoutInCell"),u=d===null?void 0:d==="1",f=D(t,null,"allowOverlap"),h=f===null?void 0:f==="1",p={distT:J(t,null,"distT")??void 0,distB:J(t,null,"distB")??void 0,distL:J(t,null,"distL")??void 0,distR:J(t,null,"distR")??void 0},m=_5(t,Ax),y=Dx(m,c,p),w=Be(t,"wp:positionH"),C=Be(t,"wp:positionV"),g=Ex(w),v=Fx(C),k;(g||v)&&(k={horizontal:g??{relativeTo:"column"},vertical:v??{relativeTo:"paragraph"}});let{blip:x,blipFill:T}=zx(t),$=Wx(x),M=Hx(T),I=_x(x),F=yp($,e,n),E=Vx(t),R=jx(E),N={type:"image",rId:$,size:o,wrap:y};if(s.id&&(N.id=s.id),s.alt&&(N.alt=s.alt),s.title&&(N.title=s.title),s.decorative&&(N.decorative=!0),F.src&&(N.src=F.src),F.mimeType&&(N.mimeType=F.mimeType),F.filename&&(N.filename=F.filename),k&&(N.position=k),l&&(N.padding=l),R&&(N.transform=R),M&&(N.crop=M),I!==void 0&&(N.opacity=I),u!==void 0&&(N.layoutInCell=u),h!==void 0&&(N.allowOverlap=h),s.hlinkRId&&e){let B=yc(Mb(e,s.hlinkRId));B&&(N.hlinkHref=B)}return N}function K5(t,e,n){if(Nx(t))return null;let r=je(t);for(let o of r){let i=o.name||"";if(i==="wp:inline"||i==="wp:anchor")return i==="wp:inline"?q5(o,e,n):Z5(o,e,n)}return null}function U5(t,e,n){return K5(t,e,n)}function zo(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}var X5=/^[0-9A-Fa-f]{8}$/;function qx(t){return!t||!X5.test(t)?!1:parseInt(t,16)<2147483647}function Sg(t){if(t!=null)return qx(t)?t:zo()}function G5(t){let e={abstractNums:[],nums:[]};if(!t)return ys(e);let n=Go(t);if(!n)return ys(e);let r=ht(n,"w","abstractNum");for(let i of r){let l=Y5(i);l&&e.abstractNums.push(l)}let o=ht(n,"w","num");for(let i of o){let l=J5(i);l&&e.nums.push(l)}return ys(e)}function Y5(t){let e=D(t,"w","abstractNumId");if(e===null)return null;let n=parseInt(e,10);if(isNaN(n))return null;let r={abstractNumId:n,levels:[]},o=L(t,"w","multiLevelType");if(o){let c=D(o,"w","val");(c==="hybridMultilevel"||c==="multilevel"||c==="singleLevel")&&(r.multiLevelType=c)}let i=L(t,"w","name");i&&(r.name=D(i,"w","val")??void 0);let l=L(t,"w","numStyleLink");l&&(r.numStyleLink=D(l,"w","val")??void 0);let a=L(t,"w","styleLink");a&&(r.styleLink=D(a,"w","val")??void 0);let s=ht(t,"w","lvl");for(let c of s){let d=Zx(c);d&&r.levels.push(d)}return r.levels.sort((c,d)=>c.ilvl-d.ilvl),r}function J5(t){let e=D(t,"w","numId");if(e===null)return null;let n=parseInt(e,10);if(isNaN(n))return null;let r=L(t,"w","abstractNumId");if(!r)return null;let o=D(r,"w","val");if(o===null)return null;let i=parseInt(o,10);if(isNaN(i))return null;let l={numId:n,abstractNumId:i},a=ht(t,"w","lvlOverride");if(a.length>0){l.levelOverrides=[];for(let s of a){let c=D(s,"w","ilvl");if(c===null)continue;let d=parseInt(c,10);if(isNaN(d))continue;let u={ilvl:d},f=L(s,"w","startOverride");if(f){let p=D(f,"w","val");if(p!==null){let m=parseInt(p,10);isNaN(m)||(u.startOverride=m)}}let h=L(s,"w","lvl");h&&(u.lvl=Zx(h)??void 0),l.levelOverrides.push(u)}}return l}function Zx(t){let e=D(t,"w","ilvl");if(e===null)return null;let n=parseInt(e,10);if(isNaN(n)||n<0||n>8)return null;let r={ilvl:n,numFmt:"decimal",lvlText:""},o=L(t,"w","start");if(o){let p=D(o,"w","val");if(p!==null){let m=parseInt(p,10);isNaN(m)||(r.start=m)}}let i=L(t,"w","numFmt");if(i)r.numFmt=Xd(i)??"decimal";else{let p=L(t,"mc","AlternateContent");if(p){let m=Xd(L(L(p,"mc","Choice"),"w","numFmt")),y=Xd(L(L(p,"mc","Fallback"),"w","numFmt"));r.numFmt=m??y??r.numFmt}}let l=L(t,"w","lvlText");l&&(r.lvlText=D(l,"w","val")??"");let a=L(t,"w","lvlJc");if(a){let p=D(a,"w","val");(p==="left"||p==="center"||p==="right")&&(r.lvlJc=p)}let s=L(t,"w","suff");if(s){let p=D(s,"w","val");(p==="tab"||p==="space"||p==="nothing")&&(r.suffix=p)}let c=L(t,"w","isLgl");c&&(r.isLgl=fe(c));let d=L(t,"w","lvlRestart");if(d){let p=D(d,"w","val");if(p!==null){let m=parseInt(p,10);isNaN(m)||(r.lvlRestart=m)}}let u=L(t,"w","legacy");u&&(r.legacy={legacy:fe(u),legacySpace:J(u,"w","legacySpace"),legacyIndent:J(u,"w","legacyIndent")});let f=L(t,"w","pPr");f&&(r.pPr=tD(f));let h=L(t,"w","rPr");return h&&(r.rPr=oD(h)),r}var Q5={decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",hex:"hex",chicago:"chicago",bullet:"bullet",none:"none",decimalZero:"decimalZero",ganada:"ganada",chosung:"chosung",ideographDigital:"ideographDigital",japaneseCounting:"japaneseCounting",aiueo:"aiueo",iroha:"iroha",decimalFullWidth:"decimalFullWidth",decimalHalfWidth:"decimalHalfWidth",japaneseLegal:"japaneseLegal",japaneseDigitalTenThousand:"japaneseDigitalTenThousand",decimalEnclosedCircle:"decimalEnclosedCircle",decimalFullWidth2:"decimalFullWidth2",aiueoFullWidth:"aiueoFullWidth",irohaFullWidth:"irohaFullWidth",decimalEnclosedFullstop:"decimalEnclosedFullstop",decimalEnclosedParen:"decimalEnclosedParen",decimalEnclosedCircleChinese:"decimalEnclosedCircleChinese",ideographEnclosedCircle:"ideographEnclosedCircle",ideographTraditional:"ideographTraditional",ideographZodiac:"ideographZodiac",ideographZodiacTraditional:"ideographZodiacTraditional",taiwaneseCounting:"taiwaneseCounting",ideographLegalTraditional:"ideographLegalTraditional",taiwaneseCountingThousand:"taiwaneseCountingThousand",taiwaneseDigital:"taiwaneseDigital",chineseCounting:"chineseCounting",chineseLegalSimplified:"chineseLegalSimplified",chineseCountingThousand:"chineseCountingThousand",koreanDigital:"koreanDigital",koreanCounting:"koreanCounting",koreanLegal:"koreanLegal",koreanDigital2:"koreanDigital2",vietnameseCounting:"vietnameseCounting",russianLower:"russianLower",russianUpper:"russianUpper",numberInDash:"numberInDash",hebrew1:"hebrew1",hebrew2:"hebrew2",arabicAlpha:"arabicAlpha",arabicAbjad:"arabicAbjad",hindiVowels:"hindiVowels",hindiConsonants:"hindiConsonants",hindiNumbers:"hindiNumbers",hindiCounting:"hindiCounting",thaiLetters:"thaiLetters",thaiNumbers:"thaiNumbers",thaiCounting:"thaiCounting"};function Xd(t){if(!t)return null;let e=D(t,"w","val");return e?e==="custom"?eD(D(t,"w","format")):Q5[e]??null:null}function eD(t){let e=t?.split(",")[0]?.trim()??"";if(/^0+1$/.test(e))switch(Math.min(e.length,5)){case 2:return"decimalZero";case 3:return"decimalZero3";case 4:return"decimalZero4";case 5:return"decimalZero5"}return null}function tD(t){let e={},n=L(t,"w","ind");if(n){let o=J(n,"w","left"),i=J(n,"w","right"),l=J(n,"w","start"),a=J(n,"w","end"),s=J(n,"w","firstLine"),c=J(n,"w","hanging"),d=o??l,u=i??a;d!==void 0&&(e.indentLeft=d),u!==void 0&&(e.indentRight=u),c!==void 0?(e.indentFirstLine=-c,e.hangingIndent=!0):s!==void 0&&(e.indentFirstLine=s)}let r=L(t,"w","tabs");if(r){e.tabs=[];let o=ht(r,"w","tab");for(let i of o){let l=J(i,"w","pos"),a=D(i,"w","val"),s=D(i,"w","leader");l!==void 0&&a&&e.tabs.push({position:l,alignment:nD(a),leader:rD(s)})}}return e}function nD(t){switch(t){case"left":return"left";case"center":return"center";case"right":return"right";case"decimal":return"decimal";case"bar":return"bar";case"clear":return"clear";case"num":return"num";default:return"left"}}function rD(t){if(t)switch(t){case"none":return"none";case"dot":return"dot";case"hyphen":return"hyphen";case"underscore":return"underscore";case"heavy":return"heavy";case"middleDot":return"middleDot";default:return}}function oD(t){let e={},n=L(t,"w","rFonts");n&&(e.fontFamily={ascii:D(n,"w","ascii")??void 0,hAnsi:D(n,"w","hAnsi")??void 0,eastAsia:D(n,"w","eastAsia")??void 0,cs:D(n,"w","cs")??void 0});let r=L(t,"w","sz");if(r){let s=J(r,"w","val");s!==void 0&&(e.fontSize=s)}let o=L(t,"w","color");if(o){let s=D(o,"w","val"),c=D(o,"w","themeColor");s==="auto"?e.color={auto:!0}:c?e.color={themeColor:c,themeTint:D(o,"w","themeTint")??void 0,themeShade:D(o,"w","themeShade")??void 0}:s&&(e.color={rgb:s})}let i=L(t,"w","b");i&&(e.bold=fe(i));let l=L(t,"w","i");l&&(e.italic=fe(l));let a=L(t,"w","vanish");return a&&(e.hidden=fe(a)),e}var Tg=new WeakMap;function Kx(t){let e=Tg.get(t);return e||(e=ys(t),Tg.set(t,e)),e}function ys(t){let e=new Map;for(let r of t.abstractNums)e.set(r.abstractNumId,r);let n=new Map;for(let r of t.nums)n.set(r.numId,r);return{definitions:t,getLevel(r,o){let i=n.get(r);if(!i)return null;if(i.levelOverrides){let a=i.levelOverrides.find(s=>s.ilvl===o);if(a){if(a.lvl)return a.lvl;let s=e.get(i.abstractNumId);if(s){let c=s.levels.find(d=>d.ilvl===o);if(c&&a.startOverride!==void 0)return{...c,start:a.startOverride}}}}let l=e.get(i.abstractNumId);if(!l)return null;if(l.numStyleLink&&l.levels.length===0){for(let a of e.values())if(a.styleLink===l.numStyleLink&&a.levels.length>0){l=a;break}}return l.levels.find(a=>a.ilvl===o)??null},getAbstract(r){return e.get(r)??null},getInstance(r){return n.get(r)??null},hasNumbering(r){return n.has(r)}}}function Ux(t,e){let{numId:n,ilvl:r=0}=t;if(n===void 0||n===0)return null;let o=e.getLevel(n,r);if(!o)return null;let i=[];for(let s=0;s<=r;s+=1){let c=e.getLevel(n,s);i.push(c?.numFmt??"decimal")}let l=e.getInstance(n),a=l?.levelOverrides?.find(s=>s.ilvl===r);return{level:r,numId:n,marker:o.lvlText,isBullet:o.numFmt==="bullet",numFmt:o.numFmt,markerHidden:o.rPr?.hidden||void 0,markerFontFamily:o.rPr?.fontFamily?.ascii||o.rPr?.fontFamily?.hAnsi||void 0,markerFontSize:o.rPr?.fontSize?o.rPr.fontSize/2:void 0,markerSuffix:o.suffix,levelNumFmts:i,abstractNumId:l?.abstractNumId,startOverride:a?.startOverride}}function La(t,e){return t<0?t.toString():t.toString().padStart(e,"0")}var Xx={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},Ac={majorFont:{latin:"Calibri Light",ea:"",cs:"",fonts:{}},minorFont:{latin:"Calibri",ea:"",cs:"",fonts:{}}},Gd={name:"Office Theme",colorScheme:Xx,fontScheme:Ac},iD=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"];function lD(t){if(!t)return null;switch(Mn(t.name||"")){case"srgbClr":return D(t,"a","val")??D(t,null,"val")??null;case"sysClr":{let e=D(t,"a","lastClr")??D(t,null,"lastClr");if(e)return e;switch(D(t,"a","val")??D(t,null,"val")){case"windowText":case"menuText":case"captionText":case"btnText":return"000000";case"window":case"menu":case"btnFace":case"btnHighlight":return"FFFFFF";case"highlight":return"0078D7";case"highlightText":return"FFFFFF";case"grayText":return"808080";default:return null}}case"schemeClr":return D(t,"a","val")??D(t,null,"val"),null;default:return null}}function aD(t){let e={...Xx};if(!t)return e;for(let n of iD){let r=L(t,"a",n);if(r){let o=je(r);if(o.length>0){let i=lD(o[0]);i&&(e[n]=i)}}}return e}function $g(t){let e={latin:"",ea:"",cs:"",fonts:{}};if(!t)return e;let n=L(t,"a","latin");n&&(e.latin=D(n,"a","typeface")??D(n,null,"typeface")??"");let r=L(t,"a","ea");r&&(e.ea=D(r,"a","typeface")??D(r,null,"typeface")??"");let o=L(t,"a","cs");o&&(e.cs=D(o,"a","typeface")??D(o,null,"typeface")??"");let i=ht(t,"a","font");for(let l of i){let a=D(l,"a","script")??D(l,null,"script"),s=D(l,"a","typeface")??D(l,null,"typeface");a&&s&&(e.fonts=e.fonts||{},e.fonts[a]=s)}return e}function sD(t){let e={...Ac};if(!t)return e;let n=L(t,"a","majorFont");n&&(e.majorFont=$g(n));let r=L(t,"a","minorFont");return r&&(e.minorFont=$g(r)),e}function cD(t){if(!t)return{...Gd};try{let e=Go(t);if(!e)return{...Gd};let n=D(e,"a","name")??D(e,null,"name")??"Office Theme",r=L(e,"a","themeElements"),o=L(r,"a","clrScheme"),i=aD(o),l=L(r,"a","fontScheme"),a=sD(l);return{name:n,colorScheme:i,fontScheme:a}}catch(e){return console.warn("Failed to parse theme:",e),{...Gd}}}function dD(t){let e=t.toLowerCase();return e.startsWith("ja")?"Jpan":e.startsWith("ko")?"Hang":e.startsWith("zh")?e.includes("hant")||/-(tw|hk|mo)\b/.test(e)?"Hant":"Hans":null}function uD(t){let e=t.toLowerCase();return e.startsWith("ar")?"Arab":e.startsWith("he")||e.startsWith("iw")?"Hebr":e.startsWith("th")?"Thai":e.startsWith("hi")||e.startsWith("mr")||e.startsWith("ne")?"Deva":null}function fD(t,e){if(!t?.fontScheme||!e)return;let n=e.eastAsia?dD(e.eastAsia):null,r=e.bidi?uD(e.bidi):null;for(let o of[t.fontScheme.majorFont,t.fontScheme.minorFont])o&&(!o.ea&&n&&o.fonts?.[n]&&(o.ea=o.fonts[n]),!o.cs&&r&&o.fonts?.[r]&&(o.cs=o.fonts[r]))}function pD(t,e="latin"){if(!t?.fontScheme?.majorFont)return Ac.majorFont?.latin??"Calibri Light";let n=t.fontScheme.majorFont;return e==="latin"?n.latin||"Calibri Light":e==="ea"?n.ea||"":e==="cs"?n.cs||"":n.fonts?.[e]?n.fonts[e]:n.latin||"Calibri Light"}function Ig(t,e="latin"){if(!t?.fontScheme?.minorFont)return Ac.minorFont?.latin??"Calibri";let n=t.fontScheme.minorFont;return e==="latin"?n.latin||"Calibri":e==="ea"?n.ea||"":e==="cs"?n.cs||"":n.fonts?.[e]?n.fonts[e]:n.latin||"Calibri"}function Hr(t,e){if(!e)return"Calibri";let n=e.toLowerCase().includes("major"),r=e.toLowerCase().includes("minor"),o="latin",i=e.toLowerCase();return i.includes("eastasia")?o="ea":(i.includes("bidi")||i.includes("cs"))&&(o="cs"),n?pD(t,o):r?Ig(t,o):Ig(t,"latin")}function qu(t,e,n,r){let o={};return t&&t!=="auto"?o.rgb=t:t==="auto"&&(o.auto=!0),e&&(o.themeColor=e),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function Dc(t){if(!t)return;let e={},n=D(t,"w","color");n&&n!=="auto"&&(e.color={rgb:n});let r=D(t,"w","fill");r&&r!=="auto"&&(e.fill={rgb:r});let o=D(t,"w","themeFill");o&&(e.fill=e.fill||{},e.fill.themeColor=o);let i=D(t,"w","themeFillTint");i&&e.fill&&(e.fill.themeTint=i);let l=D(t,"w","themeFillShade");l&&e.fill&&(e.fill.themeShade=l);let a=D(t,"w","val");return a&&(e.pattern=a),Object.keys(e).length>0?e:void 0}function js(t,e){if(!t)return;let n={},r=L(t,"w","b");r&&(n.bold=fe(r));let o=L(t,"w","bCs");o&&(n.boldCs=fe(o));let i=L(t,"w","i");i&&(n.italic=fe(i));let l=L(t,"w","iCs");l&&(n.italicCs=fe(l));let a=L(t,"w","u");if(a){let O=D(a,"w","val");if(O){n.underline={style:O};let z=D(a,"w","color"),W=D(a,"w","themeColor");(z||W)&&(n.underline.color=qu(z,W,D(a,"w","themeTint"),D(a,"w","themeShade")))}}let s=L(t,"w","strike");s&&(n.strike=fe(s));let c=L(t,"w","dstrike");c&&(n.doubleStrike=fe(c));let d=L(t,"w","vertAlign");if(d){let O=D(d,"w","val");(O==="superscript"||O==="subscript"||O==="baseline")&&(n.vertAlign=O)}let u=L(t,"w","smallCaps");u&&(n.smallCaps=fe(u));let f=L(t,"w","caps");f&&(n.allCaps=fe(f));let h=L(t,"w","vanish");h&&(n.hidden=fe(h));let p=L(t,"w","color");p&&(n.color=qu(D(p,"w","val"),D(p,"w","themeColor"),D(p,"w","themeTint"),D(p,"w","themeShade")));let m=L(t,"w","highlight");if(m){let O=D(m,"w","val");O&&(n.highlight=O)}let y=L(t,"w","shd");y&&(n.shading=Dc(y));let w=L(t,"w","sz");if(w){let O=J(w,"w","val");O!==void 0&&(n.fontSize=O)}let C=L(t,"w","szCs");if(C){let O=J(C,"w","val");O!==void 0&&(n.fontSizeCs=O)}let g=L(t,"w","rFonts");if(g){n.fontFamily={ascii:D(g,"w","ascii")??void 0,hAnsi:D(g,"w","hAnsi")??void 0,eastAsia:D(g,"w","eastAsia")??void 0,cs:D(g,"w","cs")??void 0};let O=D(g,"w","asciiTheme");O&&(n.fontFamily.asciiTheme=O,e&&!n.fontFamily.ascii&&(n.fontFamily.ascii=Hr(e,O)));let z=D(g,"w","hAnsiTheme");z&&(n.fontFamily.hAnsiTheme=z,e&&!n.fontFamily.hAnsi&&(n.fontFamily.hAnsi=Hr(e,z)));let W=D(g,"w","eastAsiaTheme");W&&(n.fontFamily.eastAsiaTheme=W,e&&!n.fontFamily.eastAsia&&(n.fontFamily.eastAsia=Hr(e,W)));let q=D(g,"w","cstheme");q&&(n.fontFamily.csTheme=q,e&&!n.fontFamily.cs&&(n.fontFamily.cs=Hr(e,q)))}let v=L(t,"w","spacing");if(v){let O=J(v,"w","val");O!==void 0&&(n.spacing=O)}let k=L(t,"w","position");if(k){let O=J(k,"w","val");O!==void 0&&(n.position=O)}let x=L(t,"w","w");if(x){let O=J(x,"w","val");O!==void 0&&(n.scale=O)}let T=L(t,"w","kern");if(T){let O=J(T,"w","val");O!==void 0&&(n.kerning=O)}let $=L(t,"w","effect");if($){let O=D($,"w","val");O&&(n.effect=O)}let M=L(t,"w","em");if(M){let O=D(M,"w","val");O&&(n.emphasisMark=O)}let I=L(t,"w","emboss");I&&(n.emboss=fe(I));let F=L(t,"w","imprint");F&&(n.imprint=fe(F));let E=L(t,"w","outline");E&&(n.outline=fe(E));let R=L(t,"w","shadow");R&&(n.shadow=fe(R));let N=L(t,"w","rtl");N&&(n.rtl=fe(N));let B=L(t,"w","cs");B&&(n.cs=fe(B));let j=L(t,"w","rStyle");if(j){let O=D(j,"w","val");O&&(n.styleId=O)}return Object.keys(n).length>0?n:void 0}function Bn(t){if(!t)return;let e={style:D(t,"w","val")??"none"},n=J(t,"w","sz");n!==void 0&&(e.size=n);let r=J(t,"w","space");r!==void 0&&(e.space=r);let o=D(t,"w","color"),i=D(t,"w","themeColor"),l=D(t,"w","themeTint"),a=D(t,"w","themeShade");(o||i||l||a)&&(e.color=qu(o,i,l,a));let s=D(t,"w","shadow");(s==="1"||s==="true")&&(e.shadow=!0);let c=D(t,"w","frame");return(c==="1"||c==="true")&&(e.frame=!0),e}function Nc(t){if(!t)return;let e={},n=Bn(L(t,"w","top"));n&&(e.top=n);let r=Bn(L(t,"w","bottom"));r&&(e.bottom=r);let o=Bn(L(t,"w","left")??L(t,"w","start"));o&&(e.left=o);let i=Bn(L(t,"w","right")??L(t,"w","end"));i&&(e.right=i);let l=Bn(L(t,"w","insideH"));l&&(e.insideH=l);let a=Bn(L(t,"w","insideV"));if(a&&(e.insideV=a),Object.keys(e).length!==0)return e}function Gx(t){if(!t)return;let e={};for(let n of["top","bottom","left","right","between","bar"]){let r=Bn(L(t,"w",n));r&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}function hD(t){if(!t)return;let e=J(t,"w","w")??0,n=D(t,"w","type")??"dxa",r="dxa";return(n==="auto"||n==="dxa"||n==="nil"||n==="pct")&&(r=n),{value:e,type:r}}function _r(t){return hD(t)}function Si(t){let e=D(t,"w","id"),n=e?parseInt(e,10):0,r=(D(t,"w","author")??"").trim(),o=(D(t,"w","date")??"").trim();return{id:Number.isInteger(n)&&n>=0?n:0,author:r.length>0?r:"Unknown",date:o.length>0?o:void 0}}function bp(t){return Si(t)}function Yx(t){if(!t)return;let e={},n=_r(L(t,"w","top"));n&&(e.top=n);let r=_r(L(t,"w","bottom"));r&&(e.bottom=r);let o=_r(L(t,"w","left")??L(t,"w","start"));o&&(e.left=o);let i=_r(L(t,"w","right")??L(t,"w","end"));if(i&&(e.right=i),Object.keys(e).length!==0)return e}function Jx(t){if(!t)return;let e={},n=D(t,"w","fill");n&&n!=="auto"&&(e.fill={rgb:n});let r=D(t,"w","themeFill");if(r){e.fill={themeColor:r};let l=D(t,"w","themeFillTint");l&&e.fill&&(e.fill.themeTint=l);let a=D(t,"w","themeFillShade");a&&e.fill&&(e.fill.themeShade=a)}let o=D(t,"w","color");o&&o!=="auto"&&(e.color={rgb:o});let i=D(t,"w","val");if(i&&(e.pattern=i),Object.keys(e).length!==0)return e}function mD(t){if(!t)return;let e={},n=D(t,"w","firstRow");(n==="1"||n==="true")&&(e.firstRow=!0);let r=D(t,"w","lastRow");(r==="1"||r==="true")&&(e.lastRow=!0);let o=D(t,"w","firstColumn");(o==="1"||o==="true")&&(e.firstColumn=!0);let i=D(t,"w","lastColumn");(i==="1"||i==="true")&&(e.lastColumn=!0);let l=D(t,"w","noHBand");(l==="1"||l==="true")&&(e.noHBand=!0);let a=D(t,"w","noVBand");(a==="1"||a==="true")&&(e.noVBand=!0);let s=D(t,"w","val");if(s){let c=parseInt(s,16);isNaN(c)||(c&32&&(e.firstRow=!0),c&64&&(e.lastRow=!0),c&128&&(e.firstColumn=!0),c&256&&(e.lastColumn=!0),c&512&&(e.noHBand=!0),c&1024&&(e.noVBand=!0))}if(Object.keys(e).length!==0)return e}function gD(t){if(!t)return;let e={},n=D(t,"w","horzAnchor");(n==="margin"||n==="page"||n==="text")&&(e.horzAnchor=n);let r=D(t,"w","vertAnchor");(r==="margin"||r==="page"||r==="text")&&(e.vertAnchor=r);let o=J(t,"w","tblpX");o!==void 0&&(e.tblpX=o);let i=D(t,"w","tblpXSpec");i&&(e.tblpXSpec=i);let l=J(t,"w","tblpY");l!==void 0&&(e.tblpY=l);let a=D(t,"w","tblpYSpec");a&&(e.tblpYSpec=a);let s=J(t,"w","topFromText");s!==void 0&&(e.topFromText=s);let c=J(t,"w","bottomFromText");c!==void 0&&(e.bottomFromText=c);let d=J(t,"w","leftFromText");d!==void 0&&(e.leftFromText=d);let u=J(t,"w","rightFromText");if(u!==void 0&&(e.rightFromText=u),Object.keys(e).length!==0)return e}var yD={richText:"richText",text:"plainText",date:"date",dropDownList:"dropDownList",comboBox:"comboBox",picture:"picture",docPartObj:"buildingBlockGallery",docPartList:"buildingBlockGallery",group:"group",equation:"equation",citation:"citation",bibliography:"bibliography",checkbox:"checkbox"};function bD(t){if(!t||!t.elements)return"richText";for(let e of t.elements){if(e.type!=="element"||!e.name)continue;let n=Mn(e.name),r=yD[n];if(r)return r}return"richText"}function wD(t){let e=[];for(let n of t.elements??[])n.type==="element"&&Mn(n.name||"")==="listItem"&&e.push({displayText:D(n,"w","displayText")||"",value:D(n,"w","value")||""});return e}function Qx(t,e){let n={sdtType:bD(t)};if(t){n.rawPropertiesXml=Al(t);for(let r of t.elements??[])if(!(r.type!=="element"||!r.name))switch(Mn(r.name)){case"id":{let o=D(r,"w","val");if(o!=null){let i=parseInt(o,10);Number.isNaN(i)||(n.id=i)}break}case"alias":n.alias=D(r,"w","val")??void 0;break;case"tag":n.tag=D(r,"w","val")??void 0;break;case"lock":n.lock=D(r,"w","val")??"unlocked";break;case"placeholder":{let o=L(r,"w","docPart");o&&(n.placeholder=D(o,"w","val")??void 0);break}case"showingPlcHdr":{let o=D(r,"w","val");n.showingPlaceholder=o==null||!/^(0|false|off)$/i.test(o);break}case"date":{let o=L(r,"w","dateFormat");o&&(n.dateFormat=D(o,"w","val")??void 0);break}case"dropDownList":case"comboBox":n.listItems=wD(r);break;case"checkbox":{let o=L(r,"w14","checked")??L(r,"w","checked");n.checked=o?D(o,"w14","val")==="1"||D(o,"w","val")==="1":!1;break}case"dataBinding":{let o={},i=D(r,"w","xpath"),l=D(r,"w","storeItemID"),a=D(r,"w","prefixMappings");i!=null&&(o.xpath=i),l!=null&&(o.storeItemID=l),a!=null&&(o.prefixMappings=a),n.dataBinding=o;break}}}return e&&(n.rawEndPropertiesXml=Al(e)),n}var Mg={183:"•",111:"○",167:"■",252:"✓",110:"■",113:"○",117:"◆",118:"❖",168:"✓",251:"✓",254:"✓",61623:"•",61550:"■",61551:"○",61607:"■",61692:"✓",8226:"•",9679:"●",9675:"○",9632:"■",9633:"□",9670:"◆",9671:"◇",8211:"–",8212:"—",62:">",45:"-"};function ev(t){if(!t||t.trim()==="")return"•";let e=t.charCodeAt(0);return Mg[e]?Mg[e]:e>=57344&&e<=63743||e<32||e>=127&&e<160?"•":t}function xD(t){let e=t.listRendering;e&&e.isBullet&&(e.marker=ev(e.marker||""))}function vD(t,e,n,r,o,i,l){if(t.content.length===0)return;let a=je(e),s=0;function c(d){if(!Nx(d))return;let u=j5(d);if(!u)return;let f=Ib(d,"wps","wsp");if(f){let y=z5(f);y&&(u.content=O5(y,Lc,null,n,r,o,i??void 0))}let h={type:"shape",shapeType:"rect",size:u.size,position:u.position,wrap:u.wrap,fill:u.fill,outline:u.outline,textBody:{content:u.content,margins:u.margins}};u.id&&(h.id=u.id);let p={type:"shape",shape:h},m=s;if(m>=t.content.length){m=-1;for(let y=t.content.length-1;y>=0;y--)if(t.content[y].type==="run"){m=y;break}}if(m>=0){let y=t.content[m];y.type==="run"&&y.content.push(p)}}for(let d of a){if(Mn(d.name??"")!=="r")continue;let u=je(d);for(let f of u){let h=Mn(f.name??"");if(h==="drawing")c(f);else if(h==="AlternateContent"){let p=je(f),m=p.find(y=>Mn(y.name??"")==="Choice")??p.find(y=>Mn(y.name??"")==="Fallback");if(m)for(let y of je(m))Mn(y.name??"")==="drawing"&&c(y)}}s++}}function na(t,e,n,r,o,i,l){let a=[],s=je(t);for(let c of s){let d=c.name??"";if(d==="w:p"||d.endsWith(":p")){let u=Lc(c,e,n,r,o,i,l);vD(u,c,e,n,r,o),xD(u),a.push(u)}else if(d==="w:tbl"||d.endsWith(":tbl")){let u=yv(c,e,n,r,o,i,l);a.push(u)}else(d==="w:sdt"||d.endsWith(":sdt"))&&a.push(kD(c,e,n,r,o,i,l))}return a}function kD(t,e,n,r,o,i,l){let a=L(t,"w","sdtPr"),s=L(t,"w","sdtEndPr"),c=L(t,"w","sdtContent"),d=Qx(a,s),u=c?na(c,e,n,r,o,i,l):[];return{type:"blockSdt",properties:d,content:u}}function Zu(t){let e={};if(!t)return e;for(let n of t.split(";")){let r=n.indexOf(":");if(r<0)continue;let o=n.slice(0,r).trim().toLowerCase(),i=n.slice(r+1).trim();o&&(e[o]=i)}return e}function CD(t){if(!t)return"#C0C0C0";let e=t.trim();return e.startsWith("#")?e:/^[0-9a-fA-F]{6}$/.test(e)?`#${e}`:e}function Rg(t){if(!t)return;let e=t.match(/^(-?[0-9.]+)(pt|px|in|cm|mm)?$/);if(!e)return;let n=parseFloat(e[1]);if(!isNaN(n))switch(e[2]){case"in":return n*96;case"cm":return n/2.54*96;case"mm":return n/25.4*96;case"px":return n;default:return n*96/72}}var Pg=914400/96;function SD(t,e,n){if(!t||!e)return{};let r=e.get(t);if(!r?.target)return{};let o=r.target,i=o.split("/").pop()??o,l=[o,o.replace(/^\/+/,""),`word/${o.replace(/^\/+/,"")}`,`word/media/${i}`,`media/${i}`];if(n)for(let a of l){let s=a.toLowerCase();for(let[c,d]of n.entries())if(c.toLowerCase()===s)return{dataUrl:d.dataUrl??d.base64,mediaPath:d.path,contentType:d.mimeType}}return{}}function tv(t,e){if(e.includes("watermark")||(D(t,null,"type")??"").includes("_t136"))return!0;let n=je(t).find(r=>r.name==="v:imagedata"||r.name?.endsWith(":imagedata"));return!!(n&&(D(n,null,"gain")||D(n,"o","gain")||D(n,null,"blacklevel")))}function TD(t,e=null,n=null){if(!t)return;let r=ll(t,"v","shape");for(let o of r){let i=(D(o,null,"id")??"").toLowerCase(),l=je(o),a=l.find(f=>f.name==="v:textpath"||f.name?.endsWith(":textpath")),s=l.find(f=>f.name==="v:imagedata"||f.name?.endsWith(":imagedata"));if(!tv(o,i)&&!a)continue;let c=Zu(D(o,null,"style")),d=parseFloat(c.rotation??"0")||0,u=Math.abs(d)>5;if(a){let f=D(a,null,"string")??"",h=(Zu(D(a,null,"style"))["font-family"]??"Calibri").replace(/["']/g,"").replace(/^&quot;|&quot;$/g,"").trim()||"Calibri",p=l.find(w=>w.name==="v:fill"||w.name?.endsWith(":fill")),m=p?D(p,null,"opacity"):null,y=m!=null&&parseFloat(m)<1;return{kind:"text",text:f,font:h,color:CD(D(o,null,"fillcolor")),semitransparent:y,layout:u?"diagonal":"horizontal",fontSize:void 0}}if(s){let f=D(s,"r","id")??D(s,"r","embed")??D(s,null,"id")??"",{dataUrl:h,mediaPath:p,contentType:m}=SD(f,e,n),y=D(s,null,"gain"),w=D(s,null,"blacklevel"),C=y!=null||w!=null,g=Rg(c.width),v=Rg(c.height);return{kind:"picture",relId:f||void 0,mediaPath:p,contentType:m,dataUrl:h,scale:1,washout:C,widthEmu:g!=null?Math.round(g*Pg):void 0,heightEmu:v!=null?Math.round(v*Pg):void 0}}}}function nv(t){switch(t){case"first":return"first";case"even":return"even";default:return"default"}}function $D(t){let e=D(t,"w","type"),n=D(t,"r","id")??"";return{type:nv(e),rId:n}}function ID(t){let e=D(t,"w","type"),n=D(t,"r","id")??"";return{type:nv(e),rId:n}}function MD(t,e="default",n=null,r=null,o=null,i=null,l=null){let a={type:"header",hdrFtrType:e,content:[]};if(!t)return a;let s=Tr(t);if(!s)return a;let c=s.elements?.find(u=>u.type==="element"&&(u.name==="w:hdr"||u.name?.endsWith(":hdr")));if(!c)return a;a.content=na(c,n,r,o,i,l,{inHeaderFooter:!0});let d=TD(c,i,l);return d&&(a.watermark=d),a}function RD(t,e="default",n=null,r=null,o=null,i=null,l=null){let a={type:"footer",hdrFtrType:e,content:[]};if(!t)return a;let s=Tr(t);if(!s)return a;let c=s.elements?.find(d=>d.type==="element"&&(d.name==="w:ftr"||d.name?.endsWith(":ftr")));return c&&(a.content=na(c,n,r,o,i,l,{inHeaderFooter:!0})),a}function rv(t){switch(t){case"separator":return"separator";case"continuationSeparator":return"continuationSeparator";case"continuationNotice":return"continuationNotice";default:return"normal"}}function ov(t,e,n,r,o,i){let l=na(t,e,n,r,o,i),a=!1;for(let s of je(t)){let c=s.name??"";if(c==="w:bookmarkStart"||c.endsWith(":bookmarkStart")||c==="w:bookmarkEnd"||c.endsWith(":bookmarkEnd")||c==="w:customXml"||c.endsWith(":customXml")){a=!0;break}}return{blocks:l,hasUnmodeled:a}}function PD(t,e,n,r,o,i){let l=J(t,"w","id")??0,a=D(t,"w","type"),s=rv(a),{blocks:c,hasUnmodeled:d}=ov(t,e,n,r,o,i);return{type:"footnote",id:l,noteType:s,content:c,...d?{verbatimXml:Al(t)}:{}}}function ED(t,e=null,n=null,r=null,o=null,i=null){let l=new Map,a=[];if(!t)return Ba(l,a);let s=Tr(t);if(!s)return Ba(l,a);let c=s.elements?.find(u=>u.type==="element"&&(u.name==="w:footnotes"||u.name?.endsWith(":footnotes")));if(!c)return Ba(l,a);let d=ht(c,"w","footnote");for(let u of d){let f=PD(u,e,n,r,o,i);l.set(f.id,f),a.push(f)}return Ba(l,a)}function Ba(t,e){return{byId:t,footnotes:e,getFootnote(n){return t.get(n)},hasFootnote(n){return t.has(n)},getNormalFootnotes(){return e.filter(n=>n.noteType==="normal")},getSeparator(){return e.find(n=>n.noteType==="separator")},getContinuationSeparator(){return e.find(n=>n.noteType==="continuationSeparator")}}}function FD(t,e,n,r,o,i){let l=J(t,"w","id")??0,a=D(t,"w","type"),s=rv(a),{blocks:c,hasUnmodeled:d}=ov(t,e,n,r,o,i);return{type:"endnote",id:l,noteType:s,content:c,...d?{verbatimXml:Al(t)}:{}}}function AD(t,e=null,n=null,r=null,o=null,i=null){let l=new Map,a=[];if(!t)return Oa(l,a);let s=Tr(t);if(!s)return Oa(l,a);let c=s.elements?.find(u=>u.type==="element"&&(u.name==="w:endnotes"||u.name?.endsWith(":endnotes")));if(!c)return Oa(l,a);let d=ht(c,"w","endnote");for(let u of d){let f=FD(u,e,n,r,o,i);l.set(f.id,f),a.push(f)}return Oa(l,a)}function Oa(t,e){return{byId:t,endnotes:e,getEndnote(n){return t.get(n)},hasEndnote(n){return t.has(n)},getNormalEndnotes(){return e.filter(n=>n.noteType==="normal")},getSeparator(){return e.find(n=>n.noteType==="separator")},getContinuationSeparator(){return e.find(n=>n.noteType==="continuationSeparator")}}}function iv(t){return t?{decimal:"decimal",upperRoman:"upperRoman",lowerRoman:"lowerRoman",upperLetter:"upperLetter",lowerLetter:"lowerLetter",ordinal:"ordinal",cardinalText:"cardinalText",ordinalText:"ordinalText",bullet:"bullet",chicago:"chicago",none:"none"}[t]:void 0}function DD(t){switch(t){case"pageBottom":return"pageBottom";case"beneathText":return"beneathText";case"sectEnd":return"sectEnd";case"docEnd":return"docEnd";default:return}}function ND(t){switch(t){case"sectEnd":return"sectEnd";case"docEnd":return"docEnd";default:return}}function lv(t){switch(t){case"continuous":return"continuous";case"eachSect":return"eachSect";case"eachPage":return"eachPage";default:return}}function LD(t){let e={};if(!t)return e;let n=L(t,"w","pos");if(n){let l=D(n,"w","val");e.position=DD(l)}let r=L(t,"w","numFmt");if(r){let l=D(r,"w","val");e.numFmt=iv(l)}let o=L(t,"w","numStart");o&&(e.numStart=J(o,"w","val")??void 0);let i=L(t,"w","numRestart");if(i){let l=D(i,"w","val");e.numRestart=lv(l)}return e}function BD(t){let e={};if(!t)return e;let n=L(t,"w","pos");if(n){let l=D(n,"w","val");e.position=ND(l)}let r=L(t,"w","numFmt");if(r){let l=D(r,"w","val");e.numFmt=iv(l)}let o=L(t,"w","numStart");o&&(e.numStart=J(o,"w","val")??void 0);let i=L(t,"w","numRestart");if(i){let l=D(i,"w","val");e.numRestart=lv(l)}return e}function OD(t){let e=[];for(let n of t.content){if(n.type!=="paragraph")continue;let r=[];for(let o of n.content)if(o.type==="run")for(let i of o.content)i.type==="text"&&r.push(i.text);e.push(r.join(""))}return e.join(`
35
+ `)}function jD(t){return t.noteType==="separator"||t.noteType==="continuationSeparator"||t.noteType==="continuationNotice"}function zD(t){return t.noteType==="separator"||t.noteType==="continuationSeparator"||t.noteType==="continuationNotice"}function HD(t){switch(t){case"landscape":return"landscape";case"portrait":return"portrait";default:return}}function _D(t){switch(t){case"continuous":return"continuous";case"nextPage":return"nextPage";case"oddPage":return"oddPage";case"evenPage":return"evenPage";case"nextColumn":return"nextColumn";default:return}}function WD(t){switch(t){case"top":return"top";case"center":return"center";case"both":return"both";case"bottom":return"bottom";default:return}}function VD(t){switch(t){case"continuous":return"continuous";case"newPage":return"newPage";case"newSection":return"newSection";default:return}}function av(t,e){let n={};if(!t)return n;let r=L(t,"w","pgSz");if(r){let k=J(r,"w","w");k!==void 0&&(n.pageWidth=k);let x=J(r,"w","h");x!==void 0&&(n.pageHeight=x);let T=D(r,"w","orient"),$=HD(T);$&&(n.orientation=$)}let o=L(t,"w","pgMar");if(o){let k=J(o,"w","top");k!==void 0&&(n.marginTop=k);let x=J(o,"w","bottom");x!==void 0&&(n.marginBottom=x);let T=J(o,"w","left");T!==void 0&&(n.marginLeft=T);let $=J(o,"w","right");$!==void 0&&(n.marginRight=$);let M=J(o,"w","header");M!==void 0&&(n.headerDistance=M);let I=J(o,"w","footer");I!==void 0&&(n.footerDistance=I);let F=J(o,"w","gutter");F!==void 0&&(n.gutter=F)}let i=L(t,"w","cols");if(i){let k=J(i,"w","num");k!==void 0&&(n.columnCount=k);let x=J(i,"w","space");x!==void 0&&(n.columnSpace=x);let T=D(i,"w","equalWidth");T==="1"||T==="true"?n.equalWidth=!0:(T==="0"||T==="false")&&(n.equalWidth=!1);let $=D(i,"w","sep");($==="1"||$==="true")&&(n.separator=!0);let M=ht(i,"w","col");if(M.length>0){n.columns=[];for(let I of M){let F={},E=J(I,"w","w");E!==void 0&&(F.width=E);let R=J(I,"w","space");R!==void 0&&(F.space=R),n.columns.push(F)}n.columnCount===void 0&&(n.columnCount=M.length)}}let l=L(t,"w15","footnoteColumns");if(l){let k=J(l,"w","val");k!==void 0&&k>0&&(n.footnoteColumns=k)}let a=L(t,"w","type");if(a){let k=D(a,"w","val"),x=_D(k);x&&(n.sectionStart=x)}let s=L(t,"w","vAlign");if(s){let k=D(s,"w","val"),x=WD(k);x&&(n.verticalAlign=x)}let c=L(t,"w","bidi");c&&(n.bidi=fe(c));let d=ht(t,"w","headerReference");d.length>0&&(n.headerReferences=d.map(k=>$D(k)));let u=ht(t,"w","footerReference");u.length>0&&(n.footerReferences=u.map(k=>ID(k)));let f=L(t,"w","titlePg");f&&(n.titlePg=fe(f));let h=L(t,"w","evenAndOddHeaders");h&&(n.evenAndOddHeaders=fe(h));let p=L(t,"w","lnNumType");if(p){n.lineNumbers={};let k=J(p,"w","start");k!==void 0&&(n.lineNumbers.start=k);let x=J(p,"w","countBy");x!==void 0&&(n.lineNumbers.countBy=x);let T=J(p,"w","distance");T!==void 0&&(n.lineNumbers.distance=T);let $=D(p,"w","restart"),M=VD($);M&&(n.lineNumbers.restart=M)}let m=L(t,"w","pgBorders");if(m){n.pageBorders={};let k=Bn(L(m,"w","top"));k&&(n.pageBorders.top=k);let x=Bn(L(m,"w","bottom"));x&&(n.pageBorders.bottom=x);let T=Bn(L(m,"w","left"));T&&(n.pageBorders.left=T);let $=Bn(L(m,"w","right"));$&&(n.pageBorders.right=$);let M=D(m,"w","display");(M==="allPages"||M==="firstPage"||M==="notFirstPage")&&(n.pageBorders.display=M);let I=D(m,"w","offsetFrom");(I==="page"||I==="text")&&(n.pageBorders.offsetFrom=I);let F=D(m,"w","zOrder");(F==="front"||F==="back")&&(n.pageBorders.zOrder=F)}let y=L(t,"w","background");if(y){n.background={};let k=D(y,"w","color");k&&k!=="auto"&&(n.background.color={rgb:k});let x=D(y,"w","themeColor");x&&(n.background.themeColor=x);let T=D(y,"w","themeTint");T&&(n.background.themeTint=T);let $=D(y,"w","themeShade");$&&(n.background.themeShade=$)}let w=L(t,"w","footnotePr");if(w){let k=LD(w);Object.keys(k).length>0&&(n.footnotePr=k)}let C=L(t,"w","endnotePr");if(C){let k=BD(C);Object.keys(k).length>0&&(n.endnotePr=k)}let g=L(t,"w","docGrid");if(g){n.docGrid={};let k=D(g,"w","type");(k==="default"||k==="lines"||k==="linesAndChars"||k==="snapToChars")&&(n.docGrid.type=k);let x=J(g,"w","linePitch");x!==void 0&&(n.docGrid.linePitch=x);let T=J(g,"w","charSpace");T!==void 0&&(n.docGrid.charSpace=T)}let v=L(t,"w","paperSrc");if(v){let k=J(v,"w","first");k!==void 0&&(n.paperSrcFirst=k);let x=J(v,"w","other");x!==void 0&&(n.paperSrcOther=x)}return n}function qD(){return{pageWidth:12240,pageHeight:15840,orientation:"portrait",marginTop:1440,marginBottom:1440,marginLeft:1440,marginRight:1440,headerDistance:720,footerDistance:720,gutter:0,columnCount:1,columnSpace:720,equalWidth:!0,sectionStart:"nextPage",verticalAlign:"top"}}function Eg(t,e){if(!e||e.length===0)return t;let n=new Set((t??[]).map(o=>o.type)),r=e.filter(o=>!n.has(o.type));return r.length===0?t:[...t??[],...r]}function ZD(t){if(t.length<2)return t;let e=[t[0]];for(let n=1;n<t.length;n++){let r=e[n-1].properties,o=t[n].properties,i=Eg(o.headerReferences,r.headerReferences),l=Eg(o.footerReferences,r.footerReferences),a=o.titlePg!==void 0?o.titlePg:r.titlePg;if(i===o.headerReferences&&l===o.footerReferences&&a===o.titlePg){e.push(t[n]);continue}e.push({...t[n],properties:{...o,headerReferences:i,footerReferences:l,titlePg:a}})}return e}function Fg(t){if(!t)return;let e=/^(-?[\d.]+)\s*(pt|in|px|cm|mm|pc)?$/.exec(t.trim());if(!e)return;let n=parseFloat(e[1]);if(!isNaN(n))switch(e[2]){case"pt":return n/72*96;case"in":return n*96;case"cm":return n/2.54*96;case"mm":return n/25.4*96;case"pc":return n/6*96;case"px":case void 0:return n;default:return}}function KD(t){return D(t,"r","id")??D(t,"r","embed")??D(t,null,"id")??""}function UD(t){if(!t)return null;let e;if(t.startsWith("data:")){let n=t.indexOf(",");if(n<0)return null;e=t.slice(n+1)}else if(/^[A-Za-z0-9+/]/.test(t)&&!t.includes(":"))e=t;else return null;try{let n=typeof atob=="function"?atob(e):globalThis.Buffer?.from(e,"base64").toString("binary");if(typeof n!="string")return null;let r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return r}catch{return null}}function XD(t){if(!t||t.length<24)return null;let e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71)return{width:e.getUint32(16),height:e.getUint32(20)};if(t[0]===71&&t[1]===73&&t[2]===70)return{width:t[6]|t[7]<<8,height:t[8]|t[9]<<8};if(t[0]===66&&t[1]===77&&t.length>=26)return{width:e.getInt32(18,!0),height:Math.abs(e.getInt32(22,!0))};if(t[0]===255&&t[1]===216){let n=2;for(;n+9<t.length;){if(t[n]!==255){n++;continue}let r=t[n+1];if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{height:t[n+5]<<8|t[n+6],width:t[n+7]<<8|t[n+8]};let o=t[n+2]<<8|t[n+3];if(o<2)break;n+=2+o}}return null}function GD(t,e,n){let r=[...ll(t,"v","shape"),...ll(t,"v","rect"),...ll(t,"v","roundrect"),...ll(t,"v","oval")];for(let o of r){let i=je(o).find(y=>y.name==="v:imagedata"||y.name?.endsWith(":imagedata"));if(!i)continue;let l=KD(i);if(!l)continue;let a=(D(o,null,"id")??"").toLowerCase();if(tv(o,a))continue;let{src:s,mimeType:c,filename:d}=yp(l,e??void 0,n??void 0),u=Zu(D(o,null,"style")),f=Fg(u.width),h=Fg(u.height);if(f==null||h==null){let y=XD(UD(s));y&&y.width>0&&y.height>0&&(f==null&&h==null?(f=y.width,h=y.height):f==null?f=h*(y.width/y.height):h=f*(y.height/y.width))}let p={type:"image",rId:l,size:{width:f!=null?He(f):0,height:h!=null?He(h):0},wrap:{type:"inline"}};s&&(p.src=s),c&&(p.mimeType=c),d&&(p.filename=d);let m=D(i,"o","title")??void 0;return m&&(p.title=m),{type:"drawing",image:p}}return null}function Ag(t,e,n,r){let o={};return t&&t!=="auto"?o.rgb=t:t==="auto"&&(o.auto=!0),e&&(o.themeColor=e),n&&(o.themeTint=n),r&&(o.themeShade=r),o}function YD(t){if(!t)return;let e={},n=D(t,"w","color");n&&n!=="auto"&&(e.color={rgb:n});let r=D(t,"w","fill");r&&r!=="auto"&&(e.fill={rgb:r});let o=D(t,"w","themeFill");o&&(e.fill=e.fill||{},e.fill.themeColor=o);let i=D(t,"w","themeFillTint");i&&e.fill&&(e.fill.themeTint=i);let l=D(t,"w","themeFillShade");l&&e.fill&&(e.fill.themeShade=l);let a=D(t,"w","val");return a&&(e.pattern=a),Object.keys(e).length>0?e:void 0}function wp(t,e,n){if(!t)return;let r={},o=L(t,"w","b");o&&(r.bold=fe(o));let i=L(t,"w","bCs");i&&(r.boldCs=fe(i));let l=L(t,"w","i");l&&(r.italic=fe(l));let a=L(t,"w","iCs");a&&(r.italicCs=fe(a));let s=L(t,"w","u");if(s){let z=D(s,"w","val");if(z){r.underline={style:z};let W=D(s,"w","color"),q=D(s,"w","themeColor");(W||q)&&(r.underline.color=Ag(W,q,D(s,"w","themeTint"),D(s,"w","themeShade")))}}let c=L(t,"w","strike");c&&(r.strike=fe(c));let d=L(t,"w","dstrike");d&&(r.doubleStrike=fe(d));let u=L(t,"w","vertAlign");if(u){let z=D(u,"w","val");(z==="superscript"||z==="subscript"||z==="baseline")&&(r.vertAlign=z)}let f=L(t,"w","smallCaps");f&&(r.smallCaps=fe(f));let h=L(t,"w","caps");h&&(r.allCaps=fe(h));let p=L(t,"w","vanish");p&&(r.hidden=fe(p));let m=L(t,"w","color");m&&(r.color=Ag(D(m,"w","val"),D(m,"w","themeColor"),D(m,"w","themeTint"),D(m,"w","themeShade")));let y=L(t,"w","highlight");if(y){let z=D(y,"w","val");z&&(r.highlight=z)}let w=L(t,"w","shd");w&&(r.shading=YD(w));let C=L(t,"w","sz");if(C){let z=J(C,"w","val");z!==void 0&&(r.fontSize=z)}let g=L(t,"w","szCs");if(g){let z=J(g,"w","val");z!==void 0&&(r.fontSizeCs=z)}let v=L(t,"w","rFonts");if(v){r.fontFamily={ascii:D(v,"w","ascii")??void 0,hAnsi:D(v,"w","hAnsi")??void 0,eastAsia:D(v,"w","eastAsia")??void 0,cs:D(v,"w","cs")??void 0};let z=D(v,"w","asciiTheme");z&&(r.fontFamily.asciiTheme=z,e&&!r.fontFamily.ascii&&(r.fontFamily.ascii=Hr(e,z)));let W=D(v,"w","hAnsiTheme");W&&(r.fontFamily.hAnsiTheme=W,e&&!r.fontFamily.hAnsi&&(r.fontFamily.hAnsi=Hr(e,W)));let q=D(v,"w","eastAsiaTheme");q&&(r.fontFamily.eastAsiaTheme=q,e&&!r.fontFamily.eastAsia&&(r.fontFamily.eastAsia=Hr(e,q)));let Q=D(v,"w","cstheme");Q&&(r.fontFamily.csTheme=Q,e&&!r.fontFamily.cs&&(r.fontFamily.cs=Hr(e,Q)))}let k=L(t,"w","spacing");if(k){let z=J(k,"w","val");z!==void 0&&(r.spacing=z)}let x=L(t,"w","position");if(x){let z=J(x,"w","val");z!==void 0&&(r.position=z)}let T=L(t,"w","w");if(T){let z=J(T,"w","val");z!==void 0&&(r.scale=z)}let $=L(t,"w","kern");if($){let z=J($,"w","val");z!==void 0&&(r.kerning=z)}let M=L(t,"w","effect");if(M){let z=D(M,"w","val");z&&(r.effect=z)}let I=L(t,"w","em");if(I){let z=D(I,"w","val");z&&(r.emphasisMark=z)}let F=L(t,"w","emboss");F&&(r.emboss=fe(F));let E=L(t,"w","imprint");E&&(r.imprint=fe(E));let R=L(t,"w","outline");R&&(r.outline=fe(R));let N=L(t,"w","shadow");N&&(r.shadow=fe(N));let B=L(t,"w","rtl");B&&(r.rtl=fe(B));let j=L(t,"w","cs");j&&(r.cs=fe(j));let O=L(t,"w","rStyle");if(O){let z=D(O,"w","val");z&&(r.styleId=z)}return Object.keys(r).length>0?r:void 0}function JD(t){let e=D(t,"w","id"),n=e?parseInt(e,10):0,r=(D(t,"w","author")??"").trim(),o=(D(t,"w","date")??"").trim(),i=(D(t,"w","rsid")??"").trim();return{id:Number.isInteger(n)&&n>=0?n:0,author:r.length>0?r:"Unknown",date:o.length>0?o:void 0,rsid:i.length>0?i:void 0}}function QD(t,e,n,r){if(!t)return;let o=ht(t,"w","rPrChange").map(i=>{let l=L(i,"w","rPr");return{type:"runPropertyChange",info:JD(i),previousFormatting:wp(l,e),currentFormatting:r}}).filter(i=>i.previousFormatting||i.currentFormatting);return o.length>0?o:void 0}function e8(t){let e=Do(t),n=D(t,"xml","space")==="preserve";return{type:"text",text:e,preserveSpace:n||void 0}}function t8(){return{type:"tab"}}function n8(t){let e=D(t,"w","type"),n=D(t,"w","clear"),r={type:"break"};return(e==="page"||e==="column"||e==="textWrapping")&&(r.breakType=e),(n==="none"||n==="left"||n==="right"||n==="all")&&(r.clear=n),r}function r8(t){let e=D(t,"w","font")??"",n=D(t,"w","char")??"";return{type:"symbol",font:e,char:n}}function o8(t){return{type:"footnoteRef",id:J(t,"w","id")??0}}function i8(t){return{type:"endnoteRef",id:J(t,"w","id")??0}}function l8(t){let e=D(t,"w","fldCharType"),n=D(t,"w","fldLock")==="true"||D(t,"w","fldLock")==="1",r=D(t,"w","dirty")==="true"||D(t,"w","dirty")==="1",o="begin";return e==="separate"?o="separate":e==="end"&&(o="end"),{type:"fieldChar",charType:o,fldLock:n||void 0,dirty:r||void 0}}function a8(t){return{type:"instrText",text:Do(t)}}function Dg(t,e,n){let r=U5(t,e??void 0,n??void 0);return r?{type:"drawing",image:r}:null}function ja(t){if(!t)return"";let e=t.indexOf(":");return e>=0?t.substring(e+1):t}function s8(t,e,n){let r=[],o=je(t);for(let i of o)switch(ja(i.name)){case"t":r.push(e8(i));break;case"tab":r.push(t8());break;case"br":r.push(n8(i));break;case"sym":r.push(r8(i));break;case"footnoteReference":r.push(o8(i));break;case"endnoteReference":r.push(i8(i));break;case"fldChar":r.push(l8(i));break;case"instrText":r.push(a8(i));break;case"softHyphen":r.push({type:"softHyphen"});break;case"noBreakHyphen":r.push({type:"noBreakHyphen"});break;case"drawing":let l=Dg(i,e,n);l&&r.push(l);break;case"pict":case"object":{let a=GD(i,e,n);a&&r.push(a);break}case"rPr":break;case"lastRenderedPageBreak":break;case"cr":r.push({type:"break",breakType:"textWrapping"});break;case"AlternateContent":{let a=je(i).find(s=>ja(s.name)==="Choice")??je(i).find(s=>ja(s.name)==="Fallback");if(a){for(let s of je(a))if(ja(s.name)==="drawing"){let c=Dg(s,e,n);c?.image?.src&&r.push(c)}}break}case"footnoteRef":r.push({type:"footnoteRefMark"});break;case"endnoteRef":r.push({type:"endnoteRefMark"});break;case"separator":r.push({type:"separator"});break;case"continuationSeparator":r.push({type:"continuationSeparator"});break}return r}function xp(t,e,n,r=null,o=null){let i={type:"run",content:[]},l=L(t,"w","rPr");return l&&(i.formatting=wp(l,n),i.propertyChanges=QD(l,n,e,i.formatting)),i.content=s8(t,r,o),i}function c8(t){if(!t)return;let e={},n=D(t,"w","color");n&&n!=="auto"&&(e.color={rgb:n});let r=D(t,"w","fill");r&&r!=="auto"&&(e.fill={rgb:r});let o=D(t,"w","themeFill");o&&(e.fill=e.fill||{},e.fill.themeColor=o);let i=D(t,"w","themeFillTint");i&&e.fill&&(e.fill.themeTint=i);let l=D(t,"w","themeFillShade");l&&e.fill&&(e.fill.themeShade=l);let a=D(t,"w","val");return a&&(e.pattern=a),Object.keys(e).length>0?e:void 0}function d8(t){if(!t)return;let e=ht(t,"w","tab");if(e.length===0)return;let n=[];for(let r of e){let o=J(r,"w","pos"),i=D(r,"w","val");if(o!==void 0&&i){let l={position:o,alignment:i},a=D(r,"w","leader");a&&(l.leader=a),n.push(l)}}return n.length>0?n:void 0}function u8(t){if(!t)return;let e={},n=J(t,"w","w");n!==void 0&&(e.width=n);let r=J(t,"w","h");r!==void 0&&(e.height=r);let o=D(t,"w","hAnchor");(o==="text"||o==="margin"||o==="page")&&(e.hAnchor=o);let i=D(t,"w","vAnchor");(i==="text"||i==="margin"||i==="page")&&(e.vAnchor=i);let l=J(t,"w","x");l!==void 0&&(e.x=l);let a=J(t,"w","y");a!==void 0&&(e.y=a);let s=D(t,"w","xAlign");s&&(e.xAlign=s);let c=D(t,"w","yAlign");c&&(e.yAlign=c);let d=D(t,"w","wrap");return d&&(e.wrap=d),Object.keys(e).length>0?e:void 0}function sv(t,e,n){if(!t)return;let r={},o=L(t,"w","jc");if(o){let T=D(o,"w","val");T&&(r.alignment=T)}let i=L(t,"w","bidi");i&&(r.bidi=fe(i));let l=L(t,"w","spacing");if(l){let T=J(l,"w","before");T!==void 0&&(r.spaceBefore=T);let $=J(l,"w","after");$!==void 0&&(r.spaceAfter=$);let M=J(l,"w","line");M!==void 0&&(r.lineSpacing=M);let I={};T!==void 0&&(I.before=!0),$!==void 0&&(I.after=!0),(I.before||I.after)&&(r.spacingExplicit=I);let F=D(l,"w","lineRule");F&&(r.lineSpacingRule=F);let E=D(l,"w","beforeAutospacing");E&&(r.beforeAutospacing=E==="1"||E==="true");let R=D(l,"w","afterAutospacing");R&&(r.afterAutospacing=R==="1"||R==="true")}let a=L(t,"w","ind");if(a){let T=J(a,"w","left");T!==void 0&&(r.indentLeft=T);let $=J(a,"w","right");$!==void 0&&(r.indentRight=$);let M=J(a,"w","firstLine");M!==void 0&&(r.indentFirstLine=M);let I=J(a,"w","hanging");I!==void 0&&(r.indentFirstLine=-I,r.hangingIndent=!0);let F=J(a,"w","start");F!==void 0&&r.indentLeft===void 0&&(r.indentLeft=F);let E=J(a,"w","end");E!==void 0&&r.indentRight===void 0&&(r.indentRight=E)}let s=Gx(L(t,"w","pBdr"));s&&(r.borders=s);let c=L(t,"w","shd");c&&(r.shading=c8(c));let d=L(t,"w","tabs");d&&(r.tabs=d8(d));let u=L(t,"w","keepNext");u&&(r.keepNext=fe(u));let f=L(t,"w","keepLines");f&&(r.keepLines=fe(f));let h=L(t,"w","widowControl");h&&(r.widowControl=fe(h));let p=L(t,"w","pageBreakBefore");p&&(r.pageBreakBefore=fe(p));let m=L(t,"w","contextualSpacing");m&&(r.contextualSpacing=fe(m));let y=L(t,"w","numPr");if(y){let T=L(y,"w","numId"),$=L(y,"w","ilvl");if(T||$){if(r.numPr={},T){let M=J(T,"w","val");M!==void 0&&(r.numPr.numId=M)}if($){let M=J($,"w","val");M!==void 0&&(r.numPr.ilvl=M)}}}let w=L(t,"w","outlineLvl");if(w){let T=J(w,"w","val");T!==void 0&&(r.outlineLevel=T)}let C=L(t,"w","pStyle");if(C){let T=D(C,"w","val");T&&(r.styleId=T)}let g=L(t,"w","framePr");g&&(r.frame=u8(g));let v=L(t,"w","suppressLineNumbers");v&&(r.suppressLineNumbers=fe(v));let k=L(t,"w","suppressAutoHyphens");k&&(r.suppressAutoHyphens=fe(k));let x=L(t,"w","rPr");return x&&(r.runProperties=wp(x,e)),Object.keys(r).length>0?r:void 0}function f8(t){if(!t)return"";let e=t.indexOf(":");return e>=0?t.substring(e+1):t}function p8(t){let e=J(t,"w","id")??0,n=D(t,"w","name")??"",r={type:"bookmarkStart",id:e,name:n},o=J(t,"w","colFirst");o!==void 0&&(r.colFirst=o);let i=J(t,"w","colLast");return i!==void 0&&(r.colLast=i),r}function h8(t){return{type:"bookmarkEnd",id:J(t,"w","id")??0}}function m8(t,e,n=null,r=null,o=null){let i={type:"hyperlink",children:[]},l=D(t,"r","id");if(l&&(i.rId=l,e)){let h=e.get(l);h&&(i.href=yc(h.target))}let a=D(t,"w","anchor");a&&(i.anchor=a,i.href||(i.href=`#${a}`));let s=D(t,"w","tooltip");s&&(i.tooltip=s);let c=D(t,"w","tgtFrame");c&&(i.target=c);let d=D(t,"w","history");(d==="1"||d==="true")&&(i.history=!0);let u=D(t,"w","docLocation");u&&(i.docLocation=u);let f=je(t);for(let h of f)switch(f8(h.name)){case"r":i.children.push(xp(h,n,r,e,o));break;case"bookmarkStart":i.children.push(p8(h));break;case"bookmarkEnd":i.children.push(h8(h));break}return i}function g8(t){let e=J(t,"w","id")??0,n=D(t,"w","name")??"",r={type:"bookmarkStart",id:e,name:n},o=J(t,"w","colFirst");o!==void 0&&(r.colFirst=o);let i=J(t,"w","colLast");return i!==void 0&&(r.colLast=i),r}function y8(t){return{type:"bookmarkEnd",id:J(t,"w","id")??0}}function cv(t){let e="";if(t.type==="text"&&typeof t.text=="string")return t.text;if(t.elements)for(let n of t.elements)if((n.name?.replace(/^.*:/,"")??"")==="t"&&n.elements)for(let r of n.elements)r.type==="text"&&typeof r.text=="string"&&(e+=r.text);else e+=cv(n);return e}function Wl(t){if(!t)return"";let e=t.indexOf(":");return e>=0?t.substring(e+1):t}function b8(t){let e=new Set(["hyperlink","smartTag","sdt","sdtContent","fldSimple","customXml","ins","del","moveFrom","moveTo"]),n=new Set(["pPr","proofErr","bookmarkStart","bookmarkEnd","commentRangeStart","commentRangeEnd","commentReference","permStart","permEnd","rsidR"]),r=new Set(["t","tab","br","cr","sym","drawing","pict","object","softHyphen","noBreakHyphen","fldChar","instrText","pgNum","separator","continuationSeparator","footnoteRef","endnoteRef","footnoteReference","endnoteReference","ptab","monthShort","monthLong","yearShort","yearLong","dayShort","dayLong"]),o=!1;function i(a){for(let s of je(a)){let c=Wl(s.name);if(!n.has(c)){if(c==="lastRenderedPageBreak"){o=!0;continue}if(c==="r"){for(let d of je(s)){let u=Wl(d.name);if(u!=="rPr"){if(u==="lastRenderedPageBreak"){o=!0;continue}if(u==="br"&&D(d,"w","type")==="page")return"forced";if(r.has(u))return"visible"}}continue}if(e.has(c)){let d=i(s);if(d!=="continue")return d;continue}return"continue"}}return"continue"}let l=i(t);return l==="forced"?!0:l==="visible"?o:!1}function Ng(t,e){if(!t)return`w:${e}`;let n=t.indexOf(":");return n<0?e:`${t.substring(0,n+1)}${e}`}function dv(t){if(t.type!=="element")return t;let e=Wl(t.name),n=t.name;return e==="delText"?n=Ng(t.name,"t"):e==="delInstrText"&&(n=Ng(t.name,"instrText")),{...t,name:n,elements:t.elements?.map(dv)}}function hl(t){let e=D(t,"w","id"),n=e?parseInt(e,10):0,r=D(t,"w","author"),o=D(t,"w","date"),i=r?.trim()??"",l=o?.trim()??"";return{id:Number.isInteger(n)&&n>=0?n:0,author:i.length>0?i:"Unknown",date:l.length>0?l:void 0}}function w8(t){return hl(t)}function x8(t,e,n,r){if(!t)return;let o=ht(t,"w","pPrChange").map(i=>{let l=L(i,"w","pPr");return{type:"paragraphPropertyChange",info:w8(i),previousFormatting:sv(l,e),currentFormatting:r}}).filter(i=>i.previousFormatting||i.currentFormatting);return o.length>0?o:void 0}function v8(t,e,n,r,o){return m8(t,e,n,r,o)}function k8(t){return g8(t)}function C8(t){return y8(t)}function uv(t){let e=t.trim().match(/^\\?([A-Z]+)/i);if(!e)return"UNKNOWN";let n=e[1].toUpperCase();return["PAGE","NUMPAGES","NUMWORDS","NUMCHARS","DATE","TIME","CREATEDATE","SAVEDATE","PRINTDATE","AUTHOR","TITLE","SUBJECT","KEYWORDS","COMMENTS","FILENAME","FILESIZE","TEMPLATE","DOCPROPERTY","DOCVARIABLE","REF","PAGEREF","NOTEREF","HYPERLINK","TOC","TOA","INDEX","SEQ","STYLEREF","AUTONUM","AUTONUMLGL","AUTONUMOUT","IF","MERGEFIELD","NEXT","NEXTIF","ASK","SET","QUOTE","INCLUDETEXT","INCLUDEPICTURE","SYMBOL","ADVANCE","EDITTIME","REVNUM","SECTION","SECTIONPAGES","USERADDRESS","USERNAME","USERINITIALS"].includes(n)?n:"UNKNOWN"}function S8(t,e,n,r,o){let i=D(t,"w","instr")??"",l=uv(i),a={type:"simpleField",instruction:i,fieldType:l,content:[]},s=D(t,"w","fldLock");(s==="1"||s==="true")&&(a.fldLock=!0);let c=D(t,"w","dirty");(c==="1"||c==="true")&&(a.dirty=!0);let d=je(t);for(let u of d)Wl(u.name)==="r"&&a.content.push(xp(u,e,n,r,o));return a}function fi(t,e,n,r,o,i,l="default"){let a=[],s=je(t),c=!1,d="",u=[],f=[],h=!1,p=!1,m=!1,y;for(let w of s){let C=Wl(w.name);switch(C){case"r":{let g=l==="deletion"?dv(w):w,v=xp(g,e,n,o,i),k=!1,x=!1,T=!1,$="";for(let M of v.content)M.type==="fieldChar"?M.charType==="begin"?(k=!0,M.fldLock&&(p=!0),M.dirty&&(m=!0)):M.charType==="separate"?x=!0:M.charType==="end"&&(T=!0):M.type==="instrText"&&($+=M.text);if(k&&(c=!0,h=!1,d="",u=[],f=[],p=!1,m=!1,y=v.formatting),c){if($&&(d+=$),!y&&v.formatting&&(y=v.formatting),x&&(h=!0),h&&!T?x||f.push(v):!h&&!k&&u.push(v),T){let M={type:"complexField",instruction:d.trim(),fieldType:uv(d),fieldCode:u,fieldResult:f};y&&(M.formatting=y),p&&(M.fldLock=!0),m&&(M.dirty=!0),a.push(M),c=!1}}else a.push(v);break}case"hyperlink":a.push(v8(w,o,e,n,i));break;case"bookmarkStart":a.push(k8(w));break;case"bookmarkEnd":a.push(C8(w));break;case"fldSimple":a.push(S8(w,e,n,o,i));break;case"pPr":break;case"proofErr":case"permStart":case"permEnd":case"customXml":break;case"sdt":{let g=(w.elements??[]).find(k=>k.type==="element"&&(k.name==="w:sdtPr"||k.name?.endsWith(":sdtPr"))),v=(w.elements??[]).find(k=>k.type==="element"&&(k.name==="w:sdtContent"||k.name?.endsWith(":sdtContent")));if(v){let k=fi(v,e,n,null,o,i,l),x={type:"inlineSdt",properties:Qx(g??null),content:k.filter(T=>T.type==="run"||T.type==="hyperlink"||T.type==="simpleField"||T.type==="complexField"||T.type==="inlineSdt"||T.type==="mathEquation")};a.push(x)}break}case"ins":{let g=hl(w),v=fi(w,e,n,null,o,i),k={type:"insertion",info:g,content:v.filter(x=>x.type==="run"||x.type==="hyperlink")};a.push(k);break}case"del":{let g=hl(w),v=fi(w,e,n,null,o,i,"deletion"),k={type:"deletion",info:g,content:v.filter(x=>x.type==="run"||x.type==="hyperlink")};a.push(k);break}case"moveFrom":{let g=hl(w),v=fi(w,e,n,null,o,i,"deletion"),k={type:"moveFrom",info:g,content:v.filter(x=>x.type==="run"||x.type==="hyperlink")};a.push(k);break}case"moveTo":{let g=hl(w),v=fi(w,e,n,null,o,i),k={type:"moveTo",info:g,content:v.filter(x=>x.type==="run"||x.type==="hyperlink")};a.push(k);break}case"smartTag":break;case"moveFromRangeStart":{let g=parseInt(D(w,"w","id")??"0",10),v=D(w,"w","name")??"";a.push({type:"moveFromRangeStart",id:g,name:v});break}case"moveFromRangeEnd":{let g=parseInt(D(w,"w","id")??"0",10);a.push({type:"moveFromRangeEnd",id:g});break}case"moveToRangeStart":{let g=parseInt(D(w,"w","id")??"0",10),v=D(w,"w","name")??"";a.push({type:"moveToRangeStart",id:g,name:v});break}case"moveToRangeEnd":{let g=parseInt(D(w,"w","id")??"0",10);a.push({type:"moveToRangeEnd",id:g});break}case"commentRangeStart":{let g=parseInt(D(w,"w","id")??"0",10);a.push({type:"commentRangeStart",id:g});break}case"commentRangeEnd":{let g=parseInt(D(w,"w","id")??"0",10);a.push({type:"commentRangeEnd",id:g});break}case"oMath":case"oMathPara":{let g=C==="oMathPara",v=Al(w),k=cv(w),x={type:"mathEquation",display:g?"block":"inline",ommlXml:v,plainText:k||void 0};a.push(x);break}}}return a}function fv(t){let e="";for(let n of t.content)if(n.type==="run")for(let r of n.content)r.type==="text"?e+=r.text:r.type==="tab"?e+=" ":r.type==="break"&&(r.breakType==="page"?e+="\f":e+=`
36
+ `);else if(n.type==="hyperlink"){for(let r of n.children)if(r.type==="run")for(let o of r.content)o.type==="text"&&(e+=o.text)}else if(n.type==="simpleField"){for(let r of n.content)if(r.type==="run")for(let o of r.content)o.type==="text"&&(e+=o.text)}else if(n.type==="complexField")for(let r of n.fieldResult)for(let o of r.content)o.type==="text"&&(e+=o.text);return e}function Lg(t){let e=D(t,"w","id");if(e==null)return null;let n=parseInt(e,10);if(Number.isNaN(n))return null;let r=D(t,"w","author")??"",o=D(t,"w","date")??void 0,i={id:n,author:r};return o&&(i.date=o),i}function Lc(t,e,n,r,o=null,i=null,l){let a={type:"paragraph",content:[]},s=D(t,"w14","paraId")??D(t,"w","paraId");s&&(a.paraId=Sg(s));let c=D(t,"w14","textId")??D(t,"w","textId");c&&(a.textId=Sg(c)),!l?.inHeaderFooter&&b8(t)&&(a.renderedPageBreakBefore=!0);let d=L(t,"w","pPr");if(d){a.formatting=sv(d,n),a.propertyChanges=x8(d,n,e,a.formatting);let p=L(d,"w","rPr");if(p){let y=L(p,"w","ins");if(y){let C=Lg(y);C&&(a.pPrIns=C)}let w=L(p,"w","del");if(w){let C=Lg(w);C&&(a.pPrDel=C)}}let m=L(d,"w","sectPr");m&&(a.sectionProperties=av(m))}let u=fi(t,e,n,r,o,i);a.content=u;let f=a.formatting?.numPr,h=!1;if(!f&&a.formatting?.styleId&&e){let p=e.get(a.formatting.styleId);p?.pPr?.numPr&&(f=p.pPr.numPr,h=!0,a.formatting||(a.formatting={}),a.formatting.numPr=f,a.formatting.numPrFromStyle=f)}if(f&&r){let p=Ux(f,r);if(p){a.listRendering=p;let m=h?T8(a.formatting?.styleId,e):{left:!1,firstLine:!1},y=r.getLevel(p.numId,p.level);if(y?.pPr){a.formatting||(a.formatting={});let w=d?L(d,"w","ind"):null,C=w!=null&&(D(w,"w","left")!==null||D(w,"w","start")!==null),g=k=>{let x=w?D(w,"w",k):null;if(x===null)return!1;let T=parseInt(x,10);return Number.isNaN(T)||T!==0},v=w!=null&&(g("firstLine")||g("hanging"));!C&&!m.left&&y.pPr.indentLeft!==void 0&&(a.formatting.indentLeft=y.pPr.indentLeft),!v&&!m.firstLine&&(y.pPr.indentFirstLine!==void 0&&(a.formatting.indentFirstLine=y.pPr.indentFirstLine),y.pPr.hangingIndent!==void 0&&(a.formatting.hangingIndent=y.pPr.hangingIndent))}}}return a}function T8(t,e){let n={left:!1,firstLine:!1};if(!t||!e)return n;let r=new Set,o=t;for(;o&&!r.has(o);){r.add(o);let i=e.get(o);if(!i)break;let l=i.pPr;if(l&&(n.left||(n.left=l.indentLeft!==void 0),n.firstLine||(n.firstLine=l.indentFirstLine!==void 0||l.hangingIndent!==void 0)),n.left&&n.firstLine)break;o=i.basedOn}return n}function pv(t){if(!t)return;let e={},n=_r(L(t,"w","tblW"));n&&(e.width=n);let r=L(t,"w","jc");if(r){let p=D(r,"w","val");(p==="left"||p==="center"||p==="right"||p==="start")&&(e.justification=p==="start"?"left":p)}let o=_r(L(t,"w","tblCellSpacing"));o&&(e.cellSpacing=o);let i=_r(L(t,"w","tblInd"));i&&(e.indent=i);let l=Nc(L(t,"w","tblBorders"));l&&(e.borders=l);let a=Yx(L(t,"w","tblCellMar"));a&&(e.cellMargins=a);let s=L(t,"w","tblLayout");if(s){let p=D(s,"w","type");(p==="fixed"||p==="autofit")&&(e.layout=p)}let c=L(t,"w","tblStyle");if(c){let p=D(c,"w","val");p&&(e.styleId=p)}let d=mD(L(t,"w","tblLook"));d&&(e.look=d);let u=Jx(L(t,"w","shd"));u&&(e.shading=u);let f=L(t,"w","tblOverlap");if(f){let p=D(f,"w","val");(p==="never"||p==="overlap")&&(e.overlap=p)}let h=gD(L(t,"w","tblpPr"));if(h&&(e.floating=h),fe(L(t,"w","bidiVisual"))&&(e.bidi=!0),Object.keys(e).length!==0)return e}function $8(t,e){if(!t)return;let n=ht(t,"w","tblPrChange").map(r=>{let o=L(r,"w","tblPr");return{type:"tablePropertyChange",info:bp(r),previousFormatting:pv(o),currentFormatting:e}}).filter(r=>r.previousFormatting||r.currentFormatting);return n.length>0?n:void 0}function I8(t,e){if(!t)return;let n=ht(t,"w","trPrChange").map(r=>{let o=L(r,"w","trPr");return{type:"tableRowPropertyChange",info:bp(r),previousFormatting:hv(o),currentFormatting:e}}).filter(r=>r.previousFormatting||r.currentFormatting);return n.length>0?n:void 0}function M8(t,e){if(!t)return;let n=ht(t,"w","tcPrChange").map(r=>{let o=L(r,"w","tcPr");return{type:"tableCellPropertyChange",info:bp(r),previousFormatting:gv(o),currentFormatting:e}}).filter(r=>r.previousFormatting||r.currentFormatting);return n.length>0?n:void 0}function R8(t){if(!t)return;let e=L(t,"w","ins");if(e)return{type:"tableRowInsertion",info:Si(e)};let n=L(t,"w","del");if(n)return{type:"tableRowDeletion",info:Si(n)}}function P8(t){if(!t)return;let e=L(t,"w","cellIns");if(e)return{type:"tableCellInsertion",info:Si(e)};let n=L(t,"w","cellDel");if(n)return{type:"tableCellDeletion",info:Si(n)};let r=L(t,"w","cellMerge");if(r){let o=D(r,"w","vMerge"),i=D(r,"w","vMergeOrig"),l=a=>a==="rest"||a==="cont";return{type:"tableCellMerge",info:Si(r),...l(o)?{vMerge:o}:{},...l(i)?{vMergeOrig:i}:{}}}}function hv(t){if(!t)return;let e={},n=L(t,"w","trHeight");if(n){let i=J(n,"w","val");i!==void 0&&i>0&&(e.height={value:i,type:"dxa"});let l=D(n,"w","hRule");(l==="auto"||l==="atLeast"||l==="exact")&&(e.heightRule=l)}fe(L(t,"w","tblHeader"))&&(e.header=!0),fe(L(t,"w","cantSplit"))&&(e.cantSplit=!0);let r=L(t,"w","jc");if(r){let i=D(r,"w","val");(i==="left"||i==="center"||i==="right")&&(e.justification=i)}fe(L(t,"w","hidden"))&&(e.hidden=!0);let o=mv(L(t,"w","cnfStyle"));if(o&&(e.conditionalFormat=o),Object.keys(e).length!==0)return e}function mv(t){if(!t)return;let e={},n=D(t,"w","firstRow");(n==="1"||n==="true")&&(e.firstRow=!0);let r=D(t,"w","lastRow");(r==="1"||r==="true")&&(e.lastRow=!0);let o=D(t,"w","firstColumn");(o==="1"||o==="true")&&(e.firstColumn=!0);let i=D(t,"w","lastColumn");(i==="1"||i==="true")&&(e.lastColumn=!0);let l=D(t,"w","oddHBand");(l==="1"||l==="true")&&(e.oddHBand=!0);let a=D(t,"w","evenHBand");(a==="1"||a==="true")&&(e.evenHBand=!0);let s=D(t,"w","oddVBand");(s==="1"||s==="true")&&(e.oddVBand=!0);let c=D(t,"w","evenVBand");(c==="1"||c==="true")&&(e.evenVBand=!0);let d=D(t,"w","firstRowFirstColumn");(d==="1"||d==="true")&&(e.nwCell=!0);let u=D(t,"w","firstRowLastColumn");(u==="1"||u==="true")&&(e.neCell=!0);let f=D(t,"w","lastRowFirstColumn");(f==="1"||f==="true")&&(e.swCell=!0);let h=D(t,"w","lastRowLastColumn");(h==="1"||h==="true")&&(e.seCell=!0);let p=D(t,"w","val");if(p&&p.length===12&&(p[0]==="1"&&(e.firstRow=!0),p[1]==="1"&&(e.lastRow=!0),p[2]==="1"&&(e.firstColumn=!0),p[3]==="1"&&(e.lastColumn=!0),p[4]==="1"&&(e.oddVBand=!0),p[5]==="1"&&(e.evenVBand=!0),p[6]==="1"&&(e.oddHBand=!0),p[7]==="1"&&(e.evenHBand=!0),p[8]==="1"&&(e.nwCell=!0),p[9]==="1"&&(e.neCell=!0),p[10]==="1"&&(e.swCell=!0),p[11]==="1"&&(e.seCell=!0)),Object.keys(e).length!==0)return e}function gv(t){if(!t)return;let e={},n=_r(L(t,"w","tcW"));n&&(e.width=n);let r=Nc(L(t,"w","tcBorders"));r&&(e.borders=r);let o=Yx(L(t,"w","tcMar"));o&&(e.margins=o);let i=Jx(L(t,"w","shd"));i&&(e.shading=i);let l=L(t,"w","vAlign");if(l){let u=D(l,"w","val");(u==="top"||u==="center"||u==="bottom")&&(e.verticalAlign=u)}let a=L(t,"w","textDirection");if(a){let u=D(a,"w","val");u&&(e.textDirection=u)}let s=L(t,"w","gridSpan");if(s){let u=J(s,"w","val");u!==void 0&&u>1&&(e.gridSpan=u)}let c=L(t,"w","vMerge");c&&(D(c,"w","val")==="restart"?e.vMerge="restart":e.vMerge="continue"),fe(L(t,"w","tcFitText"))&&(e.fitText=!0),fe(L(t,"w","noWrap"))&&(e.noWrap=!0),fe(L(t,"w","hideMark"))&&(e.hideMark=!0);let d=mv(L(t,"w","cnfStyle"));if(d&&(e.conditionalFormat=d),Object.keys(e).length!==0)return e}function E8(t,e,n,r,o,i,l){let a=[],s=t.elements||[];for(let c of s){if(!c.name)continue;let d=c.name.split(":").pop();if(d==="p"){let u=Lc(c,e,n,r,o,i,l);a.push(u)}else if(d==="tbl"){let u=yv(c,e,n,r,o,i,l);a.push(u)}}return a.length===0&&a.push({type:"paragraph",content:[]}),a}function F8(t,e,n,r,o,i,l){let a={type:"tableCell",content:[]},s=L(t,"w","tcPr"),c=gv(s);return c&&(a.formatting=c),a.propertyChanges=M8(s,c),a.structuralChange=P8(s),a.content=E8(t,e,n,r,o,i,l),a}function A8(t,e,n,r,o,i,l){let a={type:"tableRow",cells:[]},s=L(t,"w","trPr"),c=hv(s);c&&(a.formatting=c),a.propertyChanges=I8(s,c),a.structuralChange=R8(s);let d=ht(t,"w","tc");for(let u of d){let f=F8(u,e,n,r,o,i,l);a.cells.push(f)}return a}function D8(t){if(!t)return;let e=[],n=ht(t,"w","gridCol");for(let r of n){let o=J(r,"w","w")??0;e.push(o)}if(!(e.length>0&&e.every(r=>r<=0)))return e.length>0?e:void 0}function N8(t){return t.cells.reduce((e,n)=>e+(n.formatting?.gridSpan??1),0)}function L8(t){let e=Math.max(t.columnWidths?.length??0,...t.rows.map(n=>N8(n)));if(!(e<=1))for(let n of t.rows){if(n.cells.length!==1)continue;let r=n.cells[0];(r.formatting?.gridSpan??1)>=e||r.formatting?.vMerge||r.formatting?.gridSpan==null&&(r.formatting={...r.formatting??{},gridSpan:e})}}function yv(t,e,n,r,o,i,l){let a={type:"table",rows:[]},s=L(t,"w","tblPr"),c=pv(s);c&&(a.formatting=c),a.propertyChanges=$8(s,c);let d=D8(L(t,"w","tblGrid"));d&&(a.columnWidths=d);let u=ht(t,"w","tr");for(let f of u){let h=A8(f,e,n,r,o,i,l);a.rows.push(h)}return L8(a),a}function za(t,e){let n={};for(let r of t)switch(r.type.name){case"bold":n.bold=!0;break;case"italic":n.italic=!0;break;case"underline":{let o=r.attrs;if(o.style||o.color){let i=o.color?nr(o.color,e):void 0;n.underline={style:o.style,color:i}}else n.underline=!0;break}case"strike":n.strike=!0;break;case"textColor":{let o=r.attrs;(o.themeColor||o.rgb)&&(n.color=nr({rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade},e));break}case"highlight":n.highlight=Gf(r.attrs.color);break;case"fontSize":{let o=r.attrs,i=t.some(l=>l.type.name==="rtl")&&o.sizeCs!=null?o.sizeCs:o.size;i!=null&&(n.fontSize=i/2);break}case"fontFamily":{let o=r.attrs,i=t.some(l=>l.type.name==="rtl");n.fontFamily=i&&o.cs?o.cs:o.ascii||o.hAnsi;break}case"characterSpacing":{let o=r.attrs;o.spacing!=null&&o.spacing!==0&&(n.letterSpacing=Qe(o.spacing)),o.position!=null&&o.position!==0&&(n.positionPx=Kb(o.position)),o.scale!=null&&o.scale!==100&&(n.horizontalScale=o.scale),o.kerning!=null&&o.kerning>0&&(n.kerningMinPt=Yf(o.kerning));break}case"allCaps":n.allCaps=!0;break;case"smallCaps":n.smallCaps=!0;break;case"emboss":n.emboss=!0;break;case"imprint":n.imprint=!0;break;case"textShadow":n.textShadow=!0;break;case"textOutline":n.textOutline=!0;break;case"hidden":n.hidden=!0;break;case"rtl":n.rtl=!0;break;case"textEffect":{let o=r.attrs.effect;(o==="blinkBackground"||o==="lights"||o==="antsBlack"||o==="antsRed"||o==="shimmer"||o==="sparkle")&&(n.textEffect=o);break}case"emphasisMark":{let o=r.attrs.type;o==="dot"||o==="comma"||o==="circle"||o==="underDot"?n.emphasisMark=o:n.emphasisMark="dot";break}case"superscript":n.superscript=!0;break;case"subscript":n.subscript=!0;break;case"hyperlink":{let o=r.attrs;n.hyperlink={href:o.href,tooltip:o.tooltip};break}case"footnoteRef":{let o=r.attrs,i=typeof o.id=="string"?parseInt(o.id,10):o.id;o.noteType==="endnote"?n.endnoteRefId=i:n.footnoteRefId=i,n.superscript=!0;break}case"comment":{let o=r.attrs.commentId;o&&(n.commentIds||(n.commentIds=[]),n.commentIds.push(o));break}case"insertion":n.isInsertion=!0,n.changeAuthor=r.attrs.author,n.changeDate=r.attrs.date,n.changeRevisionId=r.attrs.revisionId;break;case"deletion":n.isDeletion=!0,n.changeAuthor=r.attrs.author,n.changeDate=r.attrs.date,n.changeRevisionId=r.attrs.revisionId;break}return n}function B8(t){let e=t.defaultTextFormatting;if(!e)return{};let n={};if(e.fontFamily){let r=e.fontFamily.ascii||e.fontFamily.hAnsi;r&&(n.fontFamily=r)}return e.fontSize!=null&&(n.fontSize=e.fontSize/2),n}function Bg(t){t.hyperlink&&(t.hyperlink={...t.hyperlink,noDefaultStyle:!0},delete t.color,delete t.underline)}function O8(t){return t==="contentLocked"||t==="sdtContentLocked"}function j8(t,e){let n=t.attrs;if(n.sdtType==="checkbox"&&!(O8(n.lock)||n.dataBinding!=null))return{kind:"checkbox",groupId:`sdt@${e}`,pos:e,tag:n.tag!=null?String(n.tag):void 0,alias:n.alias!=null?String(n.alias):void 0,checked:typeof n.checked=="boolean"?n.checked:void 0}}function z8(t,e,n){let r=[],o=e+1,i=n.theme,l=B8(t.attrs),a=t.attrs.styleId,s=typeof a=="string"&&/^TOC\d*$/i.test(a);function c(d,u,f){if(d.isText&&d.text){let h=za(d.marks,i);s&&Bg(h);let p={kind:"text",text:d.text,...l,...h,pmStart:u,pmEnd:u+d.nodeSize,inlineSdtWidget:f};r.push(p)}else if(d.type.name==="hardBreak")r.push({kind:"lineBreak",pmStart:u,pmEnd:u+d.nodeSize});else if(d.type.name==="tab"){let h=za(d.marks,i),p={kind:"tab",...l,...h,pmStart:u,pmEnd:u+d.nodeSize};r.push(p)}else if(d.type.name==="image"){let h=d.attrs,p=Rx(h.width||100,h.height||100,n.pageContentHeight),m=za(d.marks,i),y={kind:"image",src:h.src,width:p.width,height:p.height,alt:h.alt,transform:h.transform,wrapType:h.wrapType,displayMode:h.displayMode,cssFloat:h.cssFloat,distTop:h.distTop,distBottom:h.distBottom,distLeft:h.distLeft,distRight:h.distRight,position:h.position,cropTop:h.cropTop,cropRight:h.cropRight,cropBottom:h.cropBottom,cropLeft:h.cropLeft,opacity:h.opacity,isInsertion:m.isInsertion,isDeletion:m.isDeletion,changeAuthor:m.changeAuthor,changeDate:m.changeDate,changeRevisionId:m.changeRevisionId,pmStart:u,pmEnd:u+d.nodeSize};r.push(y)}else if(d.type.name==="field"){let h=d.attrs.fieldType,p=h==="PAGE"?"PAGE":h==="NUMPAGES"?"NUMPAGES":h==="DATE"?"DATE":h==="TIME"?"TIME":"OTHER",m=za(d.marks,i);s&&Bg(m),r.push({kind:"field",fieldType:p,fallback:d.attrs.displayText||"",...l,...m,pmStart:u,pmEnd:u+d.nodeSize})}else if(d.type.name==="math"){let h=d.attrs.plainText||"[equation]";r.push({kind:"text",text:h,italic:!0,fontFamily:"Cambria Math",pmStart:u,pmEnd:u+d.nodeSize})}else if(d.type.name==="sdt"){let h=j8(d,u)??f,p=u+1;d.forEach((m,y)=>{c(m,p+y,h)})}}return t.forEach((d,u)=>{c(d,o+u)}),r}function H8(t){return Math.max(1,Math.round(t/8*1.333))}var _8={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 bv(t,e){if(!t||!t.style||t.style==="none"||t.style==="nil")return;let n={style:_8[t.style]||"solid",width:H8(t.size??0),color:t.color?nr(t.color,e):"#000000"};return t.space!==void 0&&(n.space=Zb(t.space)),n}function W8(t,e){let n=t.borders;if(!n)return;let r={},o=["top","bottom","left","right"];for(let i of o){let l=n[i],a=l?bv(l,e):void 0;r[i]=a??{width:0,style:"none"}}return Object.keys(r).length>0?r:void 0}function V8(t,e){let n=[];for(let r=0;r<=e;r+=1){let o=t[r]??0;if(o<=0)break;n.push(o)}return n.length===0?"1.":`${n.join(".")}.`}var q8=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];function Og(t,e){if(t<=0)return"";let n=t,r="";for(let[o,i]of q8)for(;n>=o;)r+=i,n-=o;return e?r:r.toLowerCase()}function jg(t,e){if(t<=0)return"";let n=t,r="";for(;n>0;){let o=(n-1)%26;r=String.fromCharCode(65+o)+r,n=Math.floor((n-1)/26)}return e?r:r.toLowerCase()}function Z8(t,e){if(t<=0)return"";switch(e){case"upperRoman":return Og(t,!0);case"lowerRoman":return Og(t,!1);case"upperLetter":return jg(t,!0);case"lowerLetter":return jg(t,!1);case"decimalZero":return La(t,2);case"decimalZero3":return La(t,3);case"decimalZero4":return La(t,4);case"decimalZero5":return La(t,5);case"none":return"";default:return String(t)}}function K8(t,e,n){return t.replace(/%(\d)([.):\]])?/g,(r,o,i="")=>{let l=parseInt(o,10)-1;if(l<0)return"";let a=e[l]??0,s=n?.[l]??"decimal",c=Z8(a,s);return c?c+i:""})}function U8(t,e,n){let r=t.numPr;if(!r)return null;let o=r.numId;if(o==null||o===0)return null;if(t.listIsBullet)return ev(t.listMarker||"");let i=r.ilvl??0;if((t.listLevelNumFmts?.[i]??t.listNumFmt)==="none")return t.listMarker?t.listMarker:null;let l=t.listAbstractNumId??o,a=e.get(l)??new Array(9).fill(0),s=`${o}:${i}`;n.has(s)||(n.add(s),t.listStartOverride!=null&&(a[i]=t.listStartOverride-1)),a[i]=(a[i]??0)+1;for(let c=i+1;c<a.length;c+=1)a[c]=0;return e.set(l,a),t.listMarker&&t.listMarker.includes("%")?K8(t.listMarker,a,t.listLevelNumFmts??void 0):t.listMarker?t.listMarker:V8(a,i)}var X8="Calibri",G8=11;function Y8(t,e,n,r,o){let i={};if(t.alignment){let p=t.alignment;p==="both"||p==="distribute"?i.alignment="justify":p==="left"?i.alignment="left":p==="center"?i.alignment="center":p==="right"&&(i.alignment="right")}let l=t._originalFormatting?.beforeAutospacing,a=t._originalFormatting?.afterAutospacing;(l||a||t.spaceBefore!=null||t.spaceAfter!=null||t.lineSpacing!=null)&&(i.spacing={},l?i.spacing.before=14:t.spaceBefore!=null&&(i.spacing.before=Qe(t.spaceBefore)),a?i.spacing.after=14:t.spaceAfter!=null&&(i.spacing.after=Qe(t.spaceAfter)),t.lineSpacing!=null&&(t.lineSpacingRule==="exact"||t.lineSpacingRule==="atLeast"?(i.spacing.line=Qe(t.lineSpacing),i.spacing.lineUnit="px",i.spacing.lineRule=t.lineSpacingRule):(i.spacing.line=t.lineSpacing/240,i.spacing.lineUnit="multiplier",i.spacing.lineRule="auto"))),t.spacingExplicit&&(i.spacingExplicit=t.spacingExplicit);let s=t.indentLeft,c=t.indentFirstLine,d=t.hangingIndent;if(t.numPr?.numId&&s==null&&(s=((t.numPr.ilvl??0)+1)*720,c==null&&(c=-360,d=!0)),(s!=null||t.indentRight!=null||c!=null)&&(i.indent={},s!=null&&(i.indent.left=Qe(s)),t.indentRight!=null&&(i.indent.right=Qe(t.indentRight)),c!=null&&(d?i.indent.hanging=Math.abs(Qe(c)):i.indent.firstLine=Qe(c))),t.styleId&&(i.styleId=t.styleId),t.borders){let p=t.borders;i.borders={};let m=y=>y?bv(y,e):void 0;p.top&&(i.borders.top=m(p.top)),p.bottom&&(i.borders.bottom=m(p.bottom)),p.left&&(i.borders.left=m(p.left)),p.right&&(i.borders.right=m(p.right)),p.between&&(i.borders.between=m(p.between)),p.bar&&(i.borders.bar=m(p.bar)),!i.borders.top&&!i.borders.bottom&&!i.borders.left&&!i.borders.right&&!i.borders.between&&!i.borders.bar&&delete i.borders}let u=No(t.shading?.fill,e);u&&(i.shading=`#${u}`),t.tabs&&t.tabs.length>0&&(i.tabs=t.tabs.map(p=>({val:J8(p.alignment),pos:p.position,leader:p.leader}))),t.pageBreakBefore&&(i.pageBreakBefore=!0),t.keepNext&&(i.keepNext=!0),t.keepLines&&(i.keepLines=!0),t.contextualSpacing&&(i.contextualSpacing=!0),t.bidi&&(i.bidi=!0),t.styleId&&(i.styleId=t.styleId),t.numPr&&(i.numPr={numId:t.numPr.numId,ilvl:t.numPr.ilvl});let f=n&&r?U8(t,n,r):null;f!=null?i.listMarker=f:t.listMarker&&(i.listMarker=t.listMarker),t.listIsBullet!=null&&(i.listIsBullet=t.listIsBullet),t.listMarkerHidden&&(i.listMarkerHidden=!0),t.listMarkerFontFamily&&(i.listMarkerFontFamily=t.listMarkerFontFamily),t.listMarkerFontSize&&(i.listMarkerFontSize=t.listMarkerFontSize),t.listMarkerSuffix&&(i.listMarkerSuffix=t.listMarkerSuffix),o!==void 0&&(i.defaultTabStopTwips=o);let h=t.defaultTextFormatting;if(h&&(h.fontSize!=null&&(i.defaultFontSize=h.fontSize/2),h.fontFamily&&(i.defaultFontFamily=h.fontFamily.ascii||h.fontFamily.hAnsi)),t.pPrIns&&(i.pPrIns=t.pPrIns),t.pPrDel&&(i.pPrDel=t.pPrDel),t.numPr){let p=t.pPrChange,m=Array.isArray(p)&&p.some(y=>!y?.previousFormatting?.numPr);t.pPrDel?i.listMarkerRevision="del":(t.pPrIns||m)&&(i.listMarkerRevision="ins")}return i}function J8(t){switch(t){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 vp(t,e,n){let r=t.attrs,o=z8(t,e,n),i=Y8(r,n.theme,n.listCounters,n.listSeenNumIds,n.defaultTabStopTwips);return{kind:"paragraph",id:io(),paraId:r.paraId||void 0,runs:o,attrs:i,pmStart:e,pmEnd:e+t.nodeSize}}function Q8(t,e,n,r){let o=[],i=e+1;t.forEach(p=>{p.type.name==="paragraph"?o.push(vp(p,i,n)):p.type.name==="table"&&o.push(wv(p,i,n)),i+=p.nodeSize});let l=t.attrs,a=l.width,s=l.widthType,c=a&&(!s||s==="dxa"||s==="auto")?Qe(a):void 0,d=l.margins,u=(p,m)=>{if(p!=null){let y=Qe(p);if(y>0)return y}if(m!=null){let y=Qe(m);if(y>=0)return y}return 0},f={top:u(d?.top,r?.top),right:u(d?.right,r?.right),bottom:u(d?.bottom,r?.bottom),left:u(d?.left,r?.left)},h=l.cellMarker;return{id:io(),blocks:o,colSpan:l.colspan,rowSpan:l.rowspan,width:c,widthValue:a,widthType:s,verticalAlign:l.verticalAlign,background:l.backgroundColor?`#${l.backgroundColor}`:void 0,borders:W8(l,n.theme),padding:f,noWrap:l.noWrap||void 0,trackedMarker:h??void 0}}function eN(t,e,n,r){let o=[],i=e+1;t.forEach(s=>{(s.type.name==="tableCell"||s.type.name==="tableHeader")&&o.push(Q8(s,i,n,r)),i+=s.nodeSize});let l=t.attrs,a=l._originalFormatting;return{id:io(),cells:o,height:l.height?Qe(l.height):void 0,heightRule:l.heightRule??void 0,isHeader:l.isHeader,cantSplit:a?.cantSplit||void 0,trackedIns:l.trIns??void 0,trackedDel:l.trDel??void 0}}function wv(t,e,n){let r=[],o=e+1,i=t.attrs.cellMargins;t.forEach(p=>{p.type.name==="tableRow"&&r.push(eN(p,o,n,i)),o+=p.nodeSize});let l=t.attrs.columnWidths?.map(Qe),a=t.attrs.width,s=t.attrs.widthType;if(!l&&r.length>0){let p=r[0].cells.map(m=>m.width);p.every(m=>m!==void 0&&m>0)&&(l=p)}let c=t.attrs.justification,d=t.attrs._originalFormatting,u=d?.indent?.value&&d.indent.type==="dxa"?Qe(d.indent.value):void 0,f=t.attrs.floating,h=f?{horzAnchor:f.horzAnchor,vertAnchor:f.vertAnchor,tblpX:f.tblpX!==void 0?Qe(f.tblpX):void 0,tblpXSpec:f.tblpXSpec,tblpY:f.tblpY!==void 0?Qe(f.tblpY):void 0,tblpYSpec:f.tblpYSpec,topFromText:f.topFromText!==void 0?Qe(f.topFromText):void 0,bottomFromText:f.bottomFromText!==void 0?Qe(f.bottomFromText):void 0,leftFromText:f.leftFromText!==void 0?Qe(f.leftFromText):void 0,rightFromText:f.rightFromText!==void 0?Qe(f.rightFromText):void 0}:void 0;return{kind:"table",id:io(),rows:r,columnWidths:l,width:a,widthType:s,justification:c,bidi:t.attrs.bidi||void 0,indent:u,floating:h,pmStart:e,pmEnd:e+t.nodeSize}}function tN(t,e,n){let r=t.attrs,o=r.wrapType,i=o==="behind"||o==="inFront",l=Rx(r.width||100,r.height||100,n);return{kind:"image",id:io(),src:r.src,width:l.width,height:l.height,alt:r.alt,transform:r.transform,anchor:i?{isAnchored:!0,offsetH:r.distLeft,offsetV:r.distTop,behindDoc:o==="behind"}:void 0,hlinkHref:r.hlinkHref,pmStart:e,pmEnd:e+t.nodeSize}}function nN(t,e,n){let r=t.attrs,o=[];return t.forEach((i,l)=>{if(i.type.name==="paragraph"){let a=vp(i,e+1+l,n);o.push(a)}}),{kind:"textBox",id:io(),width:r.width??Vu,height:r.height??void 0,fillColor:r.fillColor,outlineWidth:r.outlineWidth,outlineColor:r.outlineColor,outlineStyle:r.outlineStyle,margins:{top:r.marginTop??wi.top,bottom:r.marginBottom??wi.bottom,left:r.marginLeft??wi.left,right:r.marginRight??wi.right},content:o,displayMode:r.displayMode,cssFloat:r.cssFloat,wrapType:r.wrapType,wrapText:r.wrapText,anchorTarget:r.anchorTarget,position:r.position,distTop:r.distTop,distBottom:r.distBottom,distLeft:r.distLeft,distRight:r.distRight,pmStart:e,pmEnd:e+t.nodeSize}}function kp(t,e={}){let n=t.attrs?.defaultTabStopTwips,r={...e,defaultFont:e.defaultFont??X8,defaultSize:e.defaultSize??G8,defaultTabStopTwips:e.defaultTabStopTwips??n},o=[],i=0,l={top:1440,bottom:1440,left:1440,right:1440};r.listCounters||(r.listCounters=new Map),r.listSeenNumIds||(r.listSeenNumIds=new Set);let a=(s,c,d)=>{if(s.type.name==="blockSdt"){let f=s.attrs,h={id:`sdt@${c}`,sdtType:typeof f.sdtType=="string"?f.sdtType:"richText",tag:f.tag!=null?String(f.tag):void 0,alias:f.alias!=null?String(f.alias):void 0,lock:f.lock!=null?String(f.lock):void 0,checked:typeof f.checked=="boolean"?f.checked:void 0,bound:f.dataBinding!=null?!0:void 0,repeatingItem:/<w15:repeatingSectionItem[\s/>]/.test(String(f.rawPropertiesXml??""))?!0:void 0},p=[...d,h];s.forEach((m,y)=>{a(m,c+1+y,p)});return}let u=o.length;switch(s.type.name){case"paragraph":{let f=vp(s,c,r),h=s.attrs;o.push(f);let p=h._sectionProperties;if(p||h.sectionBreakType){let m={kind:"sectionBreak",id:io(),type:p?.sectionStart??h.sectionBreakType};if(p){if((p.pageWidth!==void 0||p.pageHeight!==void 0)&&(m.pageSize={w:Qe(p.pageWidth??12240),h:Qe(p.pageHeight??15840)}),p.marginTop!==void 0||p.marginBottom!==void 0||p.marginLeft!==void 0||p.marginRight!==void 0){let w={top:p.marginTop??l.top,bottom:p.marginBottom??l.bottom,left:p.marginLeft??l.left,right:p.marginRight??l.right};m.margins={top:Qe(w.top),bottom:Qe(w.bottom),left:Qe(w.left),right:Qe(w.right)},l=w}let y=p.columnCount??1;if(y>1){let w={count:y,gap:Qe(p.columnSpace??720),equalWidth:p.equalWidth??!0,separator:p.separator};m.columns=w}}o.push(m)}}break;case"table":o.push(wv(s,c,r));break;case"image":o.push(tN(s,c,r.pageContentHeight));break;case"textBox":o.push(nN(s,c,r));break;case"horizontalRule":case"pageBreak":{let f={kind:"pageBreak",id:io(),pmStart:c,pmEnd:c+s.nodeSize};o.push(f);break}}if(d.length>0)for(let f=u;f<o.length;f++)o[f].sdtGroups=d};return t.forEach((s,c)=>{a(s,i+c,[])}),o}var xv=720,rN=31680;function oN(t){let e=t?Go(t):null,n=e?L(e,"w","defaultTabStop"):null,r=n?parseInt(D(n,"w","val")??"",10):NaN,o=Number.isFinite(r)&&r>0&&r<=rN,i=e?L(e,"w","defaultTableStyle"):null,l=i&&(D(i,"w","val")??void 0)||void 0,a=e?L(e,"w","themeFontLang"):null,s=a&&D(a,"w","eastAsia")||void 0,c=a&&D(a,"w","bidi")||void 0,d=s||c?{...s?{eastAsia:s}:{},...c?{bidi:c}:{}}:void 0;return{defaultTabStop:o?r:xv,...l?{defaultTableStyle:l}:{},...d?{themeFontLang:d}:{}}}var vv=["square","tight","through"],iN=["behind","inFront"],lN=[...vv,...iN];function Cp(t){return!!t&&lN.includes(t)}function ra(t){return t==="behind"||t==="inFront"}function kv(t){return!!t&&vv.includes(t)}function Ha(t,e,n,r){let o=t-e-n,i=(r.count-1)*r.gap;return(o-i)/r.count}function aN(t){let e={...t.pageSize},n={...t.margins},r=t.columns??{count:1,gap:0},o=!1,i,l,a=[],s=[];function c(){return e.h-n.bottom}function d(){return c()-n.top}function u(){return e.w-n.left-n.right}if(d()<=0)throw new Error(`Paginator: page size and margins yield no content area (pageSize=${Math.round(e.w)}x${Math.round(e.h)} margins top=${Math.round(n.top)} bottom=${Math.round(n.bottom)} left=${Math.round(n.left)} right=${Math.round(n.right)})`);let f=Ha(e.w,n.left,n.right,r),h=n.top;function p(I){return n.left+I*(f+r.gap)}function m(){(i||l)&&(i&&(e=i),l&&(n=l),i=void 0,l=void 0,f=Ha(e.w,n.left,n.right,r));let I=a.length+1,F=n.top,E=c(),R=t.footnoteReservedHeights?.get(I)??0,N=E-R,B={number:I,fragments:[],margins:{...n},size:{...e},footnoteReservedHeight:R>0?R:void 0,columns:r.count>1?{...r}:void 0},j={page:B,cursorY:F,columnIndex:0,topMargin:F,contentBottom:N,trailingSpacing:0};return a.push(B),s.push(j),h=F,t.onNewPage&&t.onNewPage(j),j}function y(){return s.length===0?m():s[s.length-1]}function w(I){return I.contentBottom-I.cursorY}function C(I,F){let E=F||y();return w(E)>=I}function g(I){return I.columnIndex<r.count-1?(I.columnIndex+=1,I.cursorY=h,I.trailingSpacing=0,I):m()}function v(I){let F=y(),E=Number.isFinite(I)&&I>0?I:0;for(;!C(E,F);){let R=F.contentBottom-F.topMargin;if(E>R)return o||(o=!0,console.warn(`Paginator: fragment height ${E.toFixed(0)}px exceeds page content height ${R.toFixed(0)}px; placing with overflow.`)),F.cursorY!==F.topMargin&&(F=g(F)),F;F=g(F)}return F}function k(I,F,E=0,R=0){let N=Math.max(E,y().trailingSpacing),B=N+F,j=v(B),O=N,z=p(j.columnIndex),W=j.cursorY+O;return I.x=z,I.y=W,j.page.fragments.push(I),j.cursorY=W+F,j.trailingSpacing=R,{state:j,x:z,y:W}}function x(){if(s.length>0){let I=s[s.length-1];if(I.page.fragments.length===0&&I.cursorY===I.topMargin)return I}return m()}function T(){let I=y();return g(I)}function $(I){r=I,f=Ha(e.w,n.left,n.right,r);let F=y();F.page.columns=r.count>1?{...r}:void 0,h=F.cursorY,F.columnIndex=0}function M(I,F,E=!0){if(!E){i=I?{...I}:i,l=F?{...F}:l;return}if(I&&(e={...I}),F&&(n={...F}),d()<=0)throw new Error("Paginator: section page size and margins yield no content area");f=Ha(e.w,n.left,n.right,r),i=void 0,l=void 0}return{pages:a,states:s,get columnWidth(){return f},get columns(){return{...r}},getCurrentState:y,getAvailableHeight:()=>w(y()),getContentWidth:u,fits:I=>C(I),ensureFits:v,addFragment:k,forcePageBreak:x,forceColumnBreak:T,getColumnX:p,updateColumns:$,updatePageLayout:M}}function sN(t){let e=new Map,n=new Set;for(let r=0;r<t.length;r++){if(n.has(r))continue;let o=t[r];if(o.kind!=="paragraph"||!o.attrs?.keepNext)continue;let i=[r],l=r;for(let c=r+1;c<t.length;c++){let d=t[c];if(d.kind==="sectionBreak"||d.kind==="pageBreak"||d.kind==="columnBreak"||d.kind!=="paragraph")break;if(d.attrs?.keepNext)i.push(c),l=c,n.add(c);else break}let a=l+1,s=-1;if(a<t.length){let c=t[a];c.kind!=="sectionBreak"&&c.kind!=="pageBreak"&&c.kind!=="columnBreak"&&(s=a)}e.set(r,{startIndex:r,endIndex:l,memberIndices:i,anchorIndex:s})}return e}function cN(t,e,n){let r=0;for(let o of t.memberIndices){let i=e[o],l=n[o];if(i.kind!=="paragraph"||l.kind!=="paragraph")continue;let a=i,s=l,c=a.attrs?.spacing?.before??0;r+=c,r+=s.totalHeight;let d=a.attrs?.spacing?.after??0;r+=d}if(t.anchorIndex!==-1){let o=n[t.anchorIndex];if(o?.kind==="paragraph"){let i=o;i.lines.length>0&&(r+=i.lines[0].lineHeight)}}return r}function dN(t){let e=new Set;for(let n of t.values())for(let r=1;r<n.memberIndices.length;r++)e.add(n.memberIndices[r]);return e}function uN(t){return t.kind!=="paragraph"?!1:t.attrs?.pageBreakBefore===!0}function oa(t){return t.displayMode==="float"||Cp(t.wrapType)||t.wrapType==="topAndBottom"}function fN(t){return oa(t)&&t.wrapType==="topAndBottom"}function pN(t){return oa(t)&&!ra(t.wrapType)&&t.wrapType!=="topAndBottom"}function zs(t,e,n){if(!(!t||t<=0)){if(e==="pct")return n*t/5e3;if(!e||e==="dxa"||e==="auto")return ut(t)}}function Sp(t){let e=new Map,n=[];for(let r=0;r<t.rows.length;r++){let o=t.rows[r]?.cells??[],i=e.get(r)??new Set,l=0;for(;i.has(l);)l++;for(let a=0;a<o.length;a++){let s=o[a];if(!s)continue;let c=s.colSpan??1,d=s.rowSpan??1;if(n.push({rowIndex:r,cellIndex:a,columnIndex:l,colSpan:c,rowSpan:d}),d>1)for(let u=r+1;u<r+d;u++){e.has(u)||e.set(u,new Set);let f=e.get(u);for(let h=0;h<c;h++)f.add(l+h)}for(l+=c;i.has(l);)l++}}return n}function hN(t){return Math.max(1,...t.rows.map(e=>e.cells.reduce((n,r)=>n+Math.max(1,r.colSpan??1),0)))}function mN(t,e,n){if(e<=0)return[];let r=n>0?n/e:0;if(t.length===0)return Array(e).fill(r);let o=t.slice(0,e),i=e-o.length;if(i>0){let d=o.filter(f=>f>0),u=d.length>0?d.reduce((f,h)=>f+h,0)/d.length:r;o=o.concat(Array(i).fill(u))}let l=o.reduce((d,u)=>d+(u>0?u:0),0),a=o.filter(d=>d<=0).length;if(l<=0)return Array(e).fill(r);if(a===0)return o;let s=Math.max(0,n-l),c=s>0?s/a:l/Math.max(1,e-a);return o.map(d=>d>0?d:c)}function Cv(t,e){let n=t.columnWidths??[],r=zs(t.width,t.widthType,e),o=hN(t),i=r??e;if(t.rows.length>0&&(n=mN(n,o,i)),n.length>0&&r){let l=n.reduce((a,s)=>a+s,0);if(l>0&&Math.abs(l-r)>1){let a=r/l;n=n.map(s=>s*a)}}return n}function gN(t,e){let n=Cv(t,e),r=zs(t.width,t.widthType,e);return n.reduce((o,i)=>o+i,0)||r||e}function Sv(t,e,n){let r=[],o=[],i=n,l=0,a=e?.length??0;for(let s=0;s<a;s++){let c=e[s],d=t?.[s];if(d?.kind==="paragraph"&&c?.kind==="paragraph"){let u=d.attrs?.spacing;i+=Math.max(l,u?.before??0);let f=[];for(let h of c.lines)i+=h.floatSkipBefore??0,f.push(i),i+=h.lineHeight,o.push(i);r.push(f),l=u?.after??0}else c&&"totalHeight"in c&&typeof c.totalHeight=="number"?(i+=l+c.totalHeight,r.push([]),o.push(i),l=0):r.push([])}return{lineTops:r,flatBottoms:o,contentHeight:i-n+l}}function yN(t,e){let n=e.rows.length,r=[],o=0;for(let a=0;a<n;a++)r.push(o),o+=e.rows[a]?.height??0;r.push(o);let i=Sp(t),l=[];for(let a=0;a<n;a++){let s=e.rows[a]?.height??0,c=new Set;c.add(s);for(let d of i){if(d.rowIndex>a||d.rowIndex+d.rowSpan-1<a)continue;let u=t.rows[d.rowIndex]?.cells?.[d.cellIndex],f=e.rows[d.rowIndex]?.cells?.[d.cellIndex];if(!u||!f)continue;let h=u.padding?.top??0,{flatBottoms:p}=Sv(u.blocks,f.blocks,h),m=r[a]-r[d.rowIndex];for(let y of p){let w=y-m;w>0&&w<s&&c.add(w)}}l.push([...c].sort((d,u)=>d-u))}return{rowTops:r,breakOffsets:l}}function bN(t,e,n,r){let o=t.breakOffsets[e];if(!o||o.length===0)return 0;let i=n+r,l=0;for(let a of o)if(!(a<=n))if(a<=i)l=a-n;else break;return l}var wN=96,Tv=11,$v="Calibri",xN=1,vN=.8,kN=.2,ml=null;function Tp(){if(!ml){let t=typeof document<"u"?document.createElement("canvas"):null;if(!t)throw new Error("Canvas not available. Ensure this runs in a DOM environment.");if(ml=t.getContext("2d"),!ml)throw new Error("Failed to get 2D context from canvas")}return ml}function CN(){ml=null}var zg=new Map;function Iv(t){let e=zg.get(t);if(e===void 0){let n=$r(t);e={cssFallback:n.cssFallback,singleLineRatio:n.singleLineRatio},zg.set(t,e)}return e}function SN(t){return Iv(t).cssFallback}function $p(t){let e=[];t.italic&&e.push("italic"),t.bold&&e.push("bold");let n=t.fontSize??Tv,r=Ho(n);e.push(`${r}px`);let o=t.fontFamily??$v;return e.push(SN(o)),e.join(" ")}function Ip(t){let e=t.fontSize??Tv,n=t.fontFamily??$v,r=Ho(e),o=r*vN,i=r*kN,l=r*xN;try{let s=Tp();s.font=$p(t);let c=s.measureText("Hg");typeof c.actualBoundingBoxAscent=="number"&&typeof c.actualBoundingBoxDescent=="number"&&(o=c.actualBoundingBoxAscent,i=c.actualBoundingBoxDescent)}catch{}l=Math.max(l,o+i);let a=Iv(n).singleLineRatio;return{fontSize:e,ascent:o,descent:i,lineHeight:l,fontFamily:n,singleLineRatio:a}}function Yn(t,e){if(!t)return 0;let n=Tp();n.font=$p(e);let r=n.measureText(t).width;return e.letterSpacing&&t.length>1&&(r+=e.letterSpacing*(t.length-1)),r}function Ku(t,e){let n=Ip(e);if(!t)return{width:0,charWidths:[],metrics:n};let r=Tp();r.font=$p(e);let o=e.letterSpacing??0,i=[],l=0;for(let a=0;a<t.length;a++){let s=t[a],c=r.measureText(s).width;o&&a<t.length-1&&(c+=o),i.push(c),l+=c}return{width:l,charWidths:i,metrics:n}}function TN(t,e){if(e.length===0||t<=0)return 0;let n=0;for(let r=0;r<e.length;r++){let o=e[r],i=n+o/2;if(t<=i)return r;n+=o}return e.length}function Ho(t){return t*wN/72}function Yd(t){return t/1440*96}function Mv(t){return t/96*1440}function $N(t){let{explicitStops:e=[],defaultTabInterval:n=720,leftIndent:r=0}=t,o=e.filter(d=>d.val!=="clear").filter(d=>d.pos>=r),i=e.filter(d=>d.val==="clear").map(d=>d.pos),l=o.reduce((d,u)=>Math.max(d,u.pos),0),a=[...o];r>0&&!o.some(d=>d.pos<=r)&&(i.some(d=>Math.abs(d-r)<20)||a.push({val:"start",pos:r,leader:"none"}));let s=l>0?Math.max(l,r):r,c=r+14400;for(;s<c;){s+=n;let d=o.some(h=>Math.abs(h.pos-s)<20),u=i.some(h=>Math.abs(h-s)<20),f=r>0&&Math.abs(s-r)<20;!d&&!u&&!f&&a.push({val:"start",pos:s,leader:"none"})}return a.sort((d,u)=>d.pos-u.pos)}function Rv(t,e,n={}){let{defaultTabInterval:r=720}=e,o=Mv(t),i=$N(e).find(a=>a.pos>o);if(!i){let a=Yd(r),s=a-t%a;return s<=0&&(s=a),{width:s,alignment:"default"}}let l=Yd(i.pos)-t;if(i.val==="center")l-=(n.followingWidth??0)/2;else if(i.val==="end")l-=n.followingWidth??0;else if(i.val==="decimal")l-=n.decimalPrefixWidth??0;else if(i.val==="bar")return{width:0,leader:i.leader,alignment:"bar"};if(l<1){let a=Yd(r),s=a-t%a;return s<=0&&(s=a),{width:s,alignment:"default"}}return{width:l,leader:i.leader,alignment:i.val}}var IN="Calibri",MN=11;function Pv(t){let e=t.attrs,n=t.runs?.find(i=>i.kind==="text"),r=e?.listMarkerFontFamily??n?.fontFamily??e?.defaultFontFamily??IN,o=e?.listMarkerFontSize??n?.fontSize??e?.defaultFontSize??MN;return{fontFamily:r,fontSize:o}}function Ev(t){let e=t.attrs;if(!e?.listMarker||e.listMarkerHidden)return 0;let n=e.indent,r=n?.hanging??0;if(r>0)return r;let{fontFamily:o,fontSize:i}=Pv(t),l={fontFamily:o,fontSize:i},a=Yn(e.listMarker,l),s=e.listMarkerSuffix??"tab";if(s==="nothing")return a;if(s==="space")return a+Yn(" ",l);let c=n?.left??0,d=n?.firstLine??0,u=c+d,f=u+a,h=(e.tabs??[]).filter(w=>w.val!=="clear"&&w.val!=="bar").map(w=>Qe(w.pos)).filter(w=>w>=f).sort((w,C)=>w-C)[0],p=Qe(e.defaultTabStopTwips??xv),m=p>0?(Math.floor(f/p)+1)*p:void 0,y;return h!==void 0&&m!==void 0?y=Math.min(h,m):y=h??m,y===void 0?a+Ho(i)*.5:y-u}var Xn=11,Ti="Calibri",RN=1.15,Hs=1,Ar=.5;function Hg(t,e,n,r=!1){let o=1,i=t.length,l=0;for(;o<=i;){let a=o+i>>>1;Yn(t.slice(0,a),e)<=n?(l=a,o=a+1):i=a-1}return r&&l===0?1:l}function bs(t){return{fontFamily:t.fontFamily??Ti,fontSize:t.fontSize??Xn,bold:t.bold,italic:t.italic,letterSpacing:t.letterSpacing}}function Fv(t,e,n){let r=Ho(t),o=n?.ascent??r*.8,i=n?.descent??r*.2,l=n?.singleLineRatio??1.15,a=r*l,s;if(e?.lineRule==="exact"&&e.line!==void 0)s=e.line;else if(e?.lineRule==="atLeast"&&e.line!==void 0){let c=a*Hs;s=Math.max(e.line,c)}else e?.line!==void 0&&e?.lineUnit==="multiplier"?s=a*e.line:e?.line!==void 0&&e?.lineUnit==="px"?s=e.line:s=a*Hs;return{ascent:o,descent:i,lineHeight:s}}function _g(t,e,n){let r=Ip({fontSize:t,fontFamily:n??Ti}),o=Fv(t,e,r),i=e?.lineRule??"auto";if(i==="auto"||i==="atLeast"){let l=Ho(t),a=Math.max(o.lineHeight,l*RN);if(a!==o.lineHeight)return{...o,lineHeight:a}}return o}function ws(t){return t.kind==="text"}function Av(t){return t.kind==="tab"}function Dv(t){return t.kind==="image"}function Nv(t){return t.kind==="lineBreak"}function Lv(t){return t.kind==="field"}function PN(t){return!t.text||t.text.replace(/\u00a0/g," ").trim().length===0}function EN(t,e){let n=0;for(let r=e+1;r<t.length;r++){let o=t[r];if(Av(o)||Nv(o))break;if(ws(o))n+=Yn(o.text||"",bs(o));else if(Lv(o)){let i={fontFamily:o.fontFamily??Ti,fontSize:o.fontSize??Xn,bold:o.bold,italic:o.italic};n+=Yn(o.fallback||"1",i)}else Dv(o)&&(n+=o.width||0)}return n}function FN(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];(r===" "||r==="-"||r===" ")&&e.push(n+1)}return e}function Mp(t,e,n){let r=Math.max(1,n),o=Math.max(0,t),i=Math.max(0,e);return o>=r||i>=r||o+i>=r?{leftMargin:0,rightMargin:0}:{leftMargin:o,rightMargin:i}}function _s(t,e,n){let r=t.runs,o=t.attrs,i=o?.spacing,l=n?.floatingZones,a=n?.paragraphYOffset??0,s=o?.indent,c=s?.left??0,d=s?.right??0,u=(s?.firstLine??0)-(s?.hanging??0),f=Math.max(1,e-c-d),h=(s?.hanging??0)===0?Ev(t):0,p=Math.max(1,f-u-h),m=0,y=0,w=Ho(Xn)*Hs,C=(E,R)=>{if(!l||l.length===0)return;let N=a+m,B=DN(N,E,l,R,_o)-N;B>0&&(m+=B,y+=B)};C(w,p);let g=Xu(m,w,l,a),v=Math.max(1,Uu(g,p)),k=[];if(r.length===0){if(o?.suppressEmptyParagraphHeight)return k.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,ascent:0,descent:0,lineHeight:0}),{kind:"paragraph",lines:k,totalHeight:0};let E=o?.defaultFontSize??Xn,R=o?.defaultFontFamily??Ti,N=_g(E,i,R);k.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...N});let B=N.lineHeight;return i?.before&&(B+=i.before),i?.after&&(B+=i.after),{kind:"paragraph",lines:k,totalHeight:B}}if(r.length===1&&ws(r[0])&&PN(r[0])){let E=r[0],R=E.fontSize??o?.defaultFontSize??Xn,N=E.fontFamily??o?.defaultFontFamily??Ti,B=_g(R,i,N);k.push({fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,...B});let j=B.lineHeight;return i?.before&&(j+=i.before),i?.after&&(j+=i.after),{kind:"paragraph",lines:k,totalHeight:j}}let x={fromRun:0,fromChar:0,toRun:0,toChar:0,width:0,maxFontSize:Xn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:v,leftOffset:g.leftMargin,rightOffset:g.rightMargin,segmentZones:g.segments},T=()=>{let E=Fv(x.maxFontSize,i,x.maxFontMetrics),R={...E};if(x.maxImageHeightPx>R.lineHeight){let B=x.maxImageHeightPx,j=R.descent;x.fromRun===x.toRun?(R.lineHeight=B+j*2,R.ascent=B+j):(R.lineHeight=B+j,R.ascent=B)}let N={fromRun:x.fromRun,fromChar:x.fromChar,toRun:x.toRun,toChar:x.toChar,width:x.width,...R};x.leftOffset>0&&(N.leftOffset=x.leftOffset),x.rightOffset>0&&(N.rightOffset=x.rightOffset),x.segmentZones?.length&&(N.segments=$(N,x.segmentZones)),y>0&&(N.floatSkipBefore=y,y=0),k.push(N),m+=E.lineHeight},$=(E,R)=>{let N=R[0],B=R[1];if(!N)return;if(!B||E.width<=N.availableWidth+Ar)return[{fromRun:E.fromRun,fromChar:E.fromChar,toRun:E.toRun,toChar:E.toChar,width:E.width,leftOffset:N.leftOffset,availableWidth:N.availableWidth}];if(E.fromRun!==E.toRun)return;let j=r[E.fromRun];if(!j||!ws(j))return;let O=j,z=O.text.slice(E.fromChar,E.toChar),W=bs(O),q=Hg(z,W,N.availableWidth);if(q<=0||q>=z.length)return;let Q=E.fromChar+q,X=z.slice(0,q),se=z.slice(q);return[{fromRun:E.fromRun,fromChar:E.fromChar,toRun:E.toRun,toChar:Q,width:Yn(X,W),leftOffset:N.leftOffset,availableWidth:N.availableWidth},{fromRun:E.fromRun,fromChar:Q,toRun:E.toRun,toChar:E.toChar,width:Yn(se,W),leftOffset:B.leftOffset,availableWidth:B.availableWidth}]},M=(E,R)=>{T();let N=Ho(Xn)*Hs;C(N,f);let B=Xu(m,N,l,a),j=Math.max(1,Uu(B,f));x={fromRun:E,fromChar:R,toRun:E,toChar:R,width:0,maxFontSize:Xn,maxFontMetrics:null,maxImageHeightPx:0,availableWidth:j,leftOffset:B.leftMargin,rightOffset:B.rightMargin,segmentZones:B.segments}},I=E=>{let R=E.fontSize??Xn;(!x.maxFontMetrics||R>x.maxFontSize)&&(x.maxFontSize=R,x.maxFontMetrics=Ip(E))};for(let E=0;E<r.length;E++){let R=r[E];if(Nv(R)){x.toRun=E,x.toChar=0,M(E+1,0);continue}if(Av(R)){let N=bs(R);I(N);let B=EN(r,E),j=x.width+(x.leftOffset??0),O=k.length===0,z=c+(O?u:0)+j,W={explicitStops:o?.tabs,leftIndent:Mv(c)},q=Rv(z,W,{followingWidth:B}).width;if(j+q>x.availableWidth+Ar){let Q=x.availableWidth-j-B;Q>1&&(q=Q)}x.width+q>x.availableWidth+Ar&&(M(E,0),I(N)),x.width+=q,x.toRun=E,x.toChar=1;continue}if(Dv(R)){let N=R.wrapType,B=R.displayMode==="float"||kv(N);if(R.position&&B){x.toRun=E,x.toChar=1;continue}if(N==="topAndBottom"||R.displayMode==="block"){x.width>0&&M(E,0);let q=R.height,Q=R.distTop??6,X=R.distBottom??6;x.toRun=E,x.toChar=1,x.maxImageHeightPx=q+Q+X,M(E+1,0);continue}let j=R.width,O=R.height;x.width+j>x.availableWidth+Ar&&M(E,0);let z=j>0&&j>x.availableWidth?x.availableWidth/j:1,W=O*z+(R.distTop??0)+(R.distBottom??0);W>x.maxImageHeightPx&&(x.maxImageHeightPx=W),x.width+=j,x.toRun=E,x.toChar=1;continue}if(Lv(R)){let N=R.fallback||"1",B={fontFamily:R.fontFamily??Ti,fontSize:R.fontSize??Xn,bold:R.bold,italic:R.italic};I(B);let j=Yn(N,B);x.width>0&&x.width+j>x.availableWidth+Ar&&(M(E,0),I(B)),x.width+=j,x.toRun=E,x.toChar=1;continue}if(ws(R)){let N=R,B=N.text,j=bs(N);if(I(j),!B||B.length===0){x.toRun=E,x.toChar=0;continue}let O=FN(B),z=0;for(;z<B.length;){let W=B.length;for(let X of O)if(X>z){W=X;break}let q=B.slice(z,W),Q=Yn(q,j);if(Q>x.availableWidth+Ar){let X=0;for(;X<q.length;){let se=x.availableWidth-x.width+Ar,ie=q.slice(X),ce=Hg(ie,j,se);if(ce===0){if(x.width>0){M(E,z+X),I(j);continue}ce=1}let Y=X+ce,V=q.slice(X,Y),Z=Yn(V,j);x.width+=Z,x.toRun=E,x.toChar=z+Y,X=Y,X<q.length&&(M(E,z+X),I(j))}z=W;continue}x.width>0&&x.width+Q>x.availableWidth+Ar&&(M(E,z),I(j)),x.width+=Q,x.toRun=E,x.toChar=W,z=W}}}T();let F=k.reduce((E,R)=>E+R.lineHeight+(R.floatSkipBefore??0),0);return i?.before&&(F+=i.before),i?.after&&(F+=i.after),{kind:"paragraph",lines:k,totalHeight:F}}function AN(t,e){return t.map(n=>{let r=n.x-n.distLeft,o=n.x+n.width+n.distRight,i=n.y-n.distTop,l=n.y+n.height+n.distBottom;if(n.wrapType==="topAndBottom")return{leftMargin:0,rightMargin:0,topY:i,bottomY:l,fullWidthBlock:!0};let a=0,s=0,c,d=n.wrapText??"bothSides";d==="right"?a=Gu(o):d==="left"?s=Yu(r,e):d==="largest"?{leftMargin:a,rightMargin:s}=ON(r,o,e):LN(r,o,e)?c=BN(r,o,e):n.side==="left"?a=Gu(o):s=Yu(r,e);let u=Mp(a,s,e);return{leftMargin:u.leftMargin,rightMargin:u.rightMargin,topY:i,bottomY:l,segments:c}})}function Uu(t,e){return t.segments?.reduce((n,r)=>n+r.availableWidth,0)??e-t.leftMargin-t.rightMargin}function Xu(t,e,n,r){if(!n||n.length===0)return{leftMargin:0,rightMargin:0};let o=0,i=0,l,a=r+t,s=a+e;for(let c of n)if(!(s<=c.topY||a>=c.bottomY)){if(c.fullWidthBlock)return{leftMargin:0,rightMargin:0,segments:[{leftOffset:0,availableWidth:0}]};if(c.segments?.length){l=l?NN(l,c.segments):c.segments;continue}o=Math.max(o,c.leftMargin),i=Math.max(i,c.rightMargin)}return{leftMargin:o,rightMargin:i,segments:l}}function DN(t,e,n,r,o){if(!n||n.length===0)return t;let i=t;for(let l=0;l<n.length+2;l++){let a=Xu(i,e,n,0);if(Uu(a,r)>=o)return i;let s=i+e,c=1/0;for(let d of n)s<=d.topY||i>=d.bottomY||d.bottomY>i&&d.bottomY<c&&(c=d.bottomY);if(!Number.isFinite(c)||c<=i)return i;i=c}return i}function NN(t,e){let n=[];for(let r of t)for(let o of e){let i=Math.max(r.leftOffset,o.leftOffset),l=Math.min(r.leftOffset+r.availableWidth,o.leftOffset+o.availableWidth);l>i&&n.push({leftOffset:i,availableWidth:l-i})}return n}var _o=24;function LN(t,e,n){return t>_o&&e+_o<n}function BN(t,e,n){return[{leftOffset:0,availableWidth:Math.max(0,t)},{leftOffset:Math.max(0,e),availableWidth:Math.max(0,n-e)}].filter(r=>r.availableWidth>1)}function ON(t,e,n){let r=Math.max(0,t);return Math.max(0,n-e)>=r?{leftMargin:Gu(e),rightMargin:0}:{leftMargin:0,rightMargin:Yu(t,n)}}function Gu(t){return Math.max(0,t)}function Yu(t,e){return Math.max(0,e-t)}function jN(t,e){return t==null||!Number.isFinite(t)?0:Math.max(0,Math.min(e,t))}function _a(t,e,n){if(t)return t.kind==="text"?typeof t.pmStart=="number"?t.pmStart+jN(e,t.text.length):n==="end"?t.pmEnd:void 0:n==="end"?typeof t.pmEnd=="number"?t.pmEnd:typeof t.pmStart=="number"?t.pmStart+1:void 0:t.pmStart}function zN(t,e,n,r){if(e.lines.length===0||n>=r)return{pmStart:t.pmStart,pmEnd:t.pmEnd};let o=e.lines[n],i=e.lines[r-1],l=o?t.runs[o.fromRun]:void 0,a=i?t.runs[i.toRun]:void 0,s=n===0?t.pmStart??_a(l,o?.fromChar??0,"start"):_a(l,o?.fromChar??0,"start"),c=r>=e.lines.length?t.pmEnd??_a(a,i?.toChar??0,"end"):_a(a,i?.toChar??0,"end");return s==null&&(s=t.pmStart),c==null&&(c=t.pmEnd),s!=null&&c!=null&&c<=s&&(c=s+1),{pmStart:s,pmEnd:c}}function Bv(t){if(t.runs.length===0)return!0;if(t.runs.length!==1)return!1;let e=t.runs[0];return e.kind==="text"&&(e.text??"")===""}function Ju(t){let e=t.attrs?.spacing?.before??0;return Bv(t)&&!t.attrs?.spacingExplicit?.before?0:e}function Qu(t){let e=t.attrs?.spacing?.after??0;return Bv(t)&&!t.attrs?.spacingExplicit?.after?0:e}function HN(t,e,n,r){let o=0,i=!1;for(let l=n;l<r;l++){let a=t[l],s=e[l];if(a.kind==="paragraph"&&s.kind==="paragraph"){o+=Ju(a)+s.totalHeight+Qu(a),i=i||s.lines.length>0;continue}if(a.kind!=="sectionBreak")return null}return i?o:null}function _N(t,e){let n=t.columns;if(n.count<=1||!Number.isFinite(e)||e<=0)return;let r=t.getCurrentState(),o=r.cursorY,i=r.contentBottom-o;if(i<=0||e>i*n.count)return;let l=Math.ceil(e/n.count);l<=0||l>=i||(r.contentBottom=o+l)}function WN({blocks:t,measures:e,paginator:n,start:r,end:o}){let i=HN(t,e,r,o);i!==null&&_N(n,i)}function Wg(t,e){for(let n=0;n<t.pages.length;n++)for(let r of t.pages[n].fragments){if(r.pmStart==null)continue;let o=r.pmStart,i=r.pmEnd??o+1;if(e>=o&&e<i)return n}return null}var VN={w:816,h:1056},oi={top:96,right:96,bottom:96,left:96},Ov={count:1,gap:0};function jv(t,e,n){let r=[],o=[],i=e;for(let l=0;l<t.length;l++){if(t[l].kind!=="sectionBreak")continue;let a=t[l],s={pageSize:a.pageSize??i.pageSize,margins:a.margins??i.margins,columns:a.columns};r.push(s),o.push(l),i=s}return r.push(n),{configs:r,breakIndices:o}}function zv(t){for(let e=0;e<t.length-1;e++){let n=t[e],r=t[e+1];if(n.kind!=="paragraph"||r.kind!=="paragraph")continue;let o=n.attrs,i=r.attrs;o?.contextualSpacing&&i?.contextualSpacing&&o.styleId&&o.styleId===i.styleId&&(o.spacing&&(o.spacing={...o.spacing,after:0}),i.spacing&&(i.spacing={...i.spacing,before:0}))}for(let e of t)if(e.kind==="table")for(let n of e.rows)for(let r of n.cells)zv(r.blocks)}function Tl(t,e,n={}){if(t.length!==e.length)throw new Error(`layoutDocument: expected one measure per block (blocks=${t.length}, measures=${e.length})`);let r=n.pageSize??VN,o={top:n.margins?.top??oi.top,right:n.margins?.right??oi.right,bottom:n.margins?.bottom??oi.bottom,left:n.margins?.left??oi.left,header:n.margins?.header??n.margins?.top??oi.top,footer:n.margins?.footer??n.margins?.bottom??oi.bottom};n.headerContentHeights,n.footerContentHeights,n.titlePage,n.evenAndOddHeaders;let i={...o},l=n.finalPageSize??r,a=n.finalMargins??i;if(r.w-i.left-i.right<=0)throw new Error("layoutDocument: page size and margins yield no content area");let s={pageSize:r,margins:i,columns:n.columns},c={pageSize:l,margins:a,columns:n.columns},{configs:d,breakIndices:u}=jv(t,s,c),f=[...u.map(C=>t[C].type),n.bodyBreakType],h=d[0]??s,p=aN({pageSize:h.pageSize,margins:h.margins,columns:h.columns??Ov,footnoteReservedHeights:n.footnoteReservedHeights});zv(t);let m=sN(t),y=dN(m),w=0;for(let C=0;C<t.length;C++){let g=t[C],v=e[C];uN(g)&&p.forcePageBreak();let k=m.get(C);if(k&&!y.has(C)){let x=cN(k,t,e),T=p.getCurrentState(),$=p.getAvailableHeight(),M=T.contentBottom-T.topMargin;x<=M&&x>$&&T.page.fragments.length>0&&p.forcePageBreak()}switch(g.kind){case"paragraph":qN(g,v,p,p.getContentWidth());break;case"table":g.floating?UN(g,v,p,p.getContentWidth()):KN(g,v,p);break;case"image":XN(g,v,p);break;case"textBox":YN(g,v,p);break;case"pageBreak":p.forcePageBreak();break;case"columnBreak":p.forceColumnBreak();break;case"sectionBreak":{let x=f[w+1]??f[w],T=d[w+1]??h;JN(g,p,T,x),u[w+1]===void 0&&(x??"nextPage")==="continuous"&&(T.columns?.count??1)>1&&WN({blocks:t,measures:e,paginator:p,start:C+1,end:t.length}),w++;break}default:gp(g,"runLayoutPipeline")}}return p.pages.length===0&&p.getCurrentState(),{pageSize:r,pages:p.pages,columns:n.columns,pageGap:n.pageGap}}function qN(t,e,n,r){if(e.kind!=="paragraph")throw new Error("layoutParagraph: expected paragraph measure");let o=e.lines;if(o.length===0){let s=Ju(t),c=Qu(t),d=n.getCurrentState(),u={kind:"paragraph",blockId:t.id,x:n.getColumnX(d.columnIndex),y:d.cursorY+s,width:r,height:0,fromLine:0,toLine:0,pmStart:t.pmStart,pmEnd:t.pmEnd};n.addFragment(u,0,s,c);return}let i=Ju(t),l=Qu(t),a=0;for(;a<o.length;){let s=n.getCurrentState(),c=a===0?Math.max(i,s.trailingSpacing):0,d=n.getAvailableHeight()-c,u=0,f=0;for(let v=a;v<o.length;v++){let k=o[v].lineHeight+(o[v].floatSkipBefore??0),x=u+k;if(x<=d||f===0)u=x,f++;else break}let h=a===0,p=a+f>=o.length,m=h?i:0,y=p?l:0,w=zN(t,e,a,a+f),C={kind:"paragraph",blockId:t.id,x:n.getColumnX(s.columnIndex),y:0,width:r,height:u,fromLine:a,toLine:a+f,pmStart:w.pmStart,pmEnd:w.pmEnd,continuesFromPrev:!h,continuesOnNext:!p},g=n.addFragment(C,u,m,y);C.y=g.y,a+=f,a<o.length&&n.ensureFits(o[a].lineHeight)}}function ZN(t){let e=0;for(let n of t.rows)if(n.isHeader)e++;else break;return e}function Rp(t,e){let n=0;for(let r=0;r<e&&r<t.rows.length;r++)n+=t.rows[r].height;return n}function KN(t,e,n){if(e.kind!=="table")throw new Error("layoutTable: expected table measure");let r=e.rows;if(r.length===0)return;let o=ZN(t),i=Rp(e,o),l=yN(t,e),a=0,s=0;for(;a<r.length;){let c=n.getCurrentState(),d=a===0&&s===0,u=d?c.trailingSpacing:0,f=!d&&o>0?i:0,h=n.getAvailableHeight()-u-f,p=a,m=s,y=0,w=a,C=s,g=a,v,k=!1;for(;w<r.length;){let F=r[w].height,E=w===p?C:0,R=F-E;if(y+R<=h){y+=R,w+=1,g=w;continue}let N=h-y,B=t.rows[w]?.cantSplit?0:bN(l,w,E,N);B>0?(y+=B,g=w+1,v=E+B,k=!0):g>p||(y+=R,g=w+1);break}let x=f+y,T=g===r.length&&!k,$=n.getColumnX(c.columnIndex);t.justification==="center"?$=$+(n.columnWidth-e.totalWidth)/2:t.justification==="right"?$=$+n.columnWidth-e.totalWidth:t.indent&&($+=t.indent);let M={kind:"table",blockId:t.id,x:$,y:0,width:e.totalWidth,height:x,fromRow:p,toRow:g,pmStart:t.pmStart,pmEnd:t.pmEnd,continuesFromPrev:!d,continuesOnNext:!T,headerRowCount:!d&&o>0?o:void 0,topClip:m>0?m:void 0,bottomClip:v},I=n.addFragment(M,x,0,0);if(M.y=I.y,M.x=$,k?(a=g-1,s=v??0):(a=g,s=0),a<r.length){let F=(o>0?i:0)+(r[a].height-s);n.ensureFits(F)}}}function UN(t,e,n,r){if(e.kind!=="table")throw new Error("layoutFloatingTable: expected table measure");let o=n.getCurrentState(),i=t.floating,l=o.page,a=l.margins,s=e.totalWidth,c=e.totalHeight,d=l.size.h-a.top-a.bottom,u=a.left,f=a.top;i?.horzAnchor==="page"&&(u=0),i?.vertAnchor==="page"&&(f=0),i?.vertAnchor==="text"&&(f=o.cursorY);let h=n.getColumnX(o.columnIndex);if(i?.tblpX!==void 0)h=u+i.tblpX;else if(i?.tblpXSpec){let T=i.tblpXSpec;T==="left"||T==="inside"?h=u:T==="right"||T==="outside"?h=u+r-s:T==="center"&&(h=u+(r-s)/2)}else t.justification==="center"?h=u+(r-s)/2:t.justification==="right"&&(h=u+r-s);let p=o.cursorY,m=!1;if(i?.tblpY!==void 0)p=f+i.tblpY,m=!0;else if(i?.tblpYSpec){m=!0;let T=i.tblpYSpec;T==="top"?p=f:T==="bottom"?p=f+d-c:T==="center"&&(p=f+(d-c)/2)}m||(p=n.ensureFits(c).cursorY);let y=a.left,w=a.left+r-s;Number.isFinite(w)&&(h=Math.max(y,Math.min(h,w)));let C={kind:"table",blockId:t.id,x:h,y:p,width:s,height:c,fromRow:0,toRow:t.rows.length,pmStart:t.pmStart,pmEnd:t.pmEnd,isFloating:!0};o.page.fragments.push(C);let g=i?.leftFromText??0,v=i?.rightFromText??0,k=h-a.left-g,x=a.left+r-(h+s)-v;if(k<_o&&x<_o){let T=p+c+(i?.bottomFromText??0);T>o.cursorY&&(o.cursorY=T)}}function XN(t,e,n){if(e.kind!=="image")throw new Error("layoutImage: expected image measure");if(t.anchor?.isAnchored){GN(t,e,n);return}let r=n.ensureFits(e.height),o={kind:"image",blockId:t.id,x:n.getColumnX(r.columnIndex),y:0,width:e.width,height:e.height,pmStart:t.pmStart,pmEnd:t.pmEnd},i=n.addFragment(o,e.height,0,0);o.y=i.y}function GN(t,e,n){let r=n.getCurrentState(),o=t.anchor,i=o.offsetH??n.getColumnX(r.columnIndex),l=o.offsetV??r.cursorY,a={kind:"image",blockId:t.id,x:i,y:l,width:e.width,height:e.height,pmStart:t.pmStart,pmEnd:t.pmEnd,isAnchored:!0,zIndex:o.behindDoc?-1:1};r.page.fragments.push(a)}function YN(t,e,n){if(e.kind!=="textBox")throw new Error("layoutTextBox: expected textBox measure");if(oa(t)){let l=n.getCurrentState(),a={kind:"textBox",blockId:t.id,x:n.getColumnX(l.columnIndex),y:l.cursorY,width:e.width,height:e.height,pmStart:t.pmStart,pmEnd:t.pmEnd,isFloating:!0,zIndex:t.wrapType==="behind"?-1:1};l.page.fragments.push(a);return}let r=n.ensureFits(e.height),o={kind:"textBox",blockId:t.id,x:n.getColumnX(r.columnIndex),y:0,width:e.width,height:e.height,pmStart:t.pmStart,pmEnd:t.pmEnd},i=n.addFragment(o,e.height,0,0);o.y=i.y}function JN(t,e,n,r){switch(r??"nextPage"){case"nextPage":e.updatePageLayout(n.pageSize,n.margins),e.forcePageBreak();break;case"evenPage":{e.updatePageLayout(n.pageSize,n.margins),e.forcePageBreak().page.number%2!==0&&e.forcePageBreak();break}case"oddPage":{e.updatePageLayout(n.pageSize,n.margins),e.forcePageBreak().page.number%2===0&&e.forcePageBreak();break}case"continuous":{let o=e.getCurrentState().page.size,i=n.pageSize;i!=null&&(Math.round(i.w)!==Math.round(o.w)||Math.round(i.h)!==Math.round(o.h))?(e.updatePageLayout(n.pageSize,n.margins),e.forcePageBreak()):e.updatePageLayout(n.pageSize,n.margins,!1);break}}e.updateColumns(n.columns??Ov)}function Pp(t){return{sdtType:t.sdtType,id:t.id??null,alias:t.alias??null,tag:t.tag??null,lock:t.lock??null,placeholder:t.placeholder??null,showingPlaceholder:t.showingPlaceholder??!1,dateFormat:t.dateFormat??null,listItems:t.listItems?JSON.stringify(t.listItems):null,checked:t.checked??null,dataBinding:t.dataBinding?JSON.stringify(t.dataBinding):null,rawPropertiesXml:t.rawPropertiesXml??null,rawEndPropertiesXml:t.rawEndPropertiesXml??null}}function Ep(t){let e={sdtType:t.sdtType??"richText"};if(typeof t.id=="number"&&(e.id=t.id),t.alias!=null&&(e.alias=String(t.alias)),t.tag!=null&&(e.tag=String(t.tag)),t.lock!=null&&(e.lock=t.lock),t.placeholder!=null&&(e.placeholder=String(t.placeholder)),t.showingPlaceholder&&(e.showingPlaceholder=!0),t.dateFormat!=null&&(e.dateFormat=String(t.dateFormat)),typeof t.listItems=="string"&&t.listItems)try{e.listItems=JSON.parse(t.listItems)}catch{}if(t.checked!=null&&(e.checked=t.checked),typeof t.dataBinding=="string"&&t.dataBinding)try{e.dataBinding=JSON.parse(t.dataBinding)}catch{}return t.rawPropertiesXml!=null&&(e.rawPropertiesXml=String(t.rawPropertiesXml)),t.rawEndPropertiesXml!=null&&(e.rawEndPropertiesXml=String(t.rawEndPropertiesXml)),e}function Hv(t){return!!t.wrap&&t.wrap.type!=="inline"}function QN(t){let e=t.wrap?.type??"inline",n=t.wrap?.wrapText,r=t.position?.horizontal?.alignment;return{displayMode:r4(e),cssFloat:i4(e,n,r),wrapType:e,wrapText:n,anchorTarget:Hv(t)?"followingBlock":void 0,position:t.position?l4(t.position):void 0,distTop:t.wrap?.distT!=null?_e(t.wrap.distT):void 0,distBottom:t.wrap?.distB!=null?_e(t.wrap.distB):void 0,distLeft:t.wrap?.distL!=null?_e(t.wrap.distL):void 0,distRight:t.wrap?.distR!=null?_e(t.wrap.distR):void 0}}function e4(t){return t.anchorTarget==="followingBlock"||o4(t)}function t4(t){let e=t.position;if(!(!e?.horizontal&&!e?.vertical))return{horizontal:{relativeTo:e.horizontal?.relativeTo??"margin",alignment:e.horizontal?.align,posOffset:e.horizontal?.posOffset},vertical:{relativeTo:e.vertical?.relativeTo??"paragraph",alignment:e.vertical?.align,posOffset:e.vertical?.posOffset}}}function n4(t){let e=t.wrapType??(t.displayMode==="float"?"square":"inline");if(!e||e==="inline")return;let n={type:e};return t.wrapText&&(n.wrapText=t.wrapText),t.distTop!=null&&(n.distT=He(t.distTop)),t.distBottom!=null&&(n.distB=He(t.distBottom)),t.distLeft!=null&&(n.distL=He(t.distLeft)),t.distRight!=null&&(n.distR=He(t.distRight)),n}function r4(t){return t==="inline"?"inline":t==="topAndBottom"?"block":"float"}function o4(t){return t.displayMode==="float"||Cp(t.wrapType)}function i4(t,e,n){return t==="inline"||t==="topAndBottom"?"none":e==="left"?"right":e==="right"||n==="left"?"left":n==="right"?"right":"none"}function l4(t){return{horizontal:t.horizontal?{relativeTo:t.horizontal.relativeTo,posOffset:t.horizontal.posOffset,align:t.horizontal.alignment}:void 0,vertical:t.vertical?{relativeTo:t.vertical.relativeTo,posOffset:t.vertical.posOffset,align:t.vertical.alignment}:void 0}}var _v=new Set(["hyperlink"]),Wv=new Set(["hyperlink","comment"]);function Fp(t,e=_v){let n=t.filter(r=>!e.has(r.type.name));return n.length===0?"":n.map(r=>`${r.type.name}:${JSON.stringify(r.attrs)}`).sort().join("|")}function Vv(t){let e=t?.package.headers;if(e){for(let n of e.values())if(n.watermark)return n.watermark}}function a4(t){let e=t.package.headers;if(!e||e.size===0)return t;let n=!1,r=new Map;for(let[o,i]of e)if(i.watermark){let{watermark:l,...a}=i;r.set(o,a),n=!0}else r.set(o,i);return n?{...t,package:{...t.package,headers:r}}:t}function s4(t,e){let n=t.package.headers;if(!n||n.size===0)return t;let r=new Map;for(let[o,i]of n)r.set(o,{...i,watermark:{...e}});return{...t,package:{...t.package,headers:r}}}function c4(t){let e=t.package.document,n=[];if(e.sections)for(let r of e.sections)r.properties&&n.push(r.properties);return e.finalSectionProperties&&n.push(e.finalSectionProperties),n}function d4(t,e){let n=t.package,r=n.document,o=n.headers,i=c4(t),l=new Set;if(o)for(let $ of o.values())l.add($.hdrFtrType);let a=!o||o.size===0,s=i.some($=>$.titlePg),c=i.some($=>$.evenAndOddHeaders),d=a,u=s&&!l.has("first"),f=c&&!l.has("even");if(!d&&!u&&!f)return t;let h=n.relationships?new Map(n.relationships):new Map,p=new Map(o??[]),m=new Set;for(let $ of h.values())$.target&&m.add($.target.replace(/^\/?word\//,"").toLowerCase());function y(){let $=1;for(;m.has(`header${$}.xml`);)$++;let M=`header${$}.xml`;return m.add(M.toLowerCase()),M}function w($){let M=`rIdWmHdr${$[0].toUpperCase()}${$.slice(1)}`,I=1;for(;h.has(M);)M=`rIdWmHdr${$[0].toUpperCase()}${$.slice(1)}${I++}`;return h.set(M,{id:M,type:pt.header,target:y()}),p.set(M,{type:"header",hdrFtrType:$,content:[],watermark:{...e}}),M}let C={};function g($){return C[$]??(C[$]=w($))}function v($,M){let I=$?.headerReferences?[...$.headerReferences]:[];return I.some(F=>F.type===M)?$??{}:(I.push({type:M,rId:g(M)}),{...$??{},headerReferences:I})}function k($){let M=$;return d&&(M=v(M,"default")),u&&M?.titlePg&&(M=v(M,"first")),f&&M?.evenAndOddHeaders&&(M=v(M,"even")),M}let x=k(r.finalSectionProperties),T=r.sections?.map($=>({...$,properties:k($.properties)??$.properties}));return{...t,package:{...n,relationships:h,headers:p,document:{...r,finalSectionProperties:x,...T?{sections:T}:{}}}}}function u4(t,e){if(!e)return a4(t);let n=s4(t,e);return d4(n,e)}function qv(t,e){let n=t?{...t}:{},r=e,o=[["ascii","asciiTheme"],["hAnsi","hAnsiTheme"],["eastAsia","eastAsiaTheme"],["cs","csTheme"]],i=new Set;for(let[l,a]of o)i.add(l),i.add(a),(r[l]!==void 0||r[a]!==void 0)&&(delete n[l],delete n[a],r[l]!==void 0&&(n[l]=r[l]),r[a]!==void 0&&(n[a]=r[a]));for(let l of Object.keys(r))!i.has(l)&&r[l]!==void 0&&(n[l]=r[l]);return n}function dn(t,e){if(!e&&!t)return;if(!e)return t;if(!t)return{...e};let n={...t};for(let r of Object.keys(e)){let o=e[r];if(o!==void 0){if(r==="fontFamily"&&typeof o=="object"&&o!==null){n.fontFamily=qv(t.fontFamily,o);continue}if(r==="color"&&typeof o=="object"&&o!==null){let i=o,l=!!(i.rgb||i.themeColor||i.themeTint||i.themeShade);(!i.auto||l)&&(n.color=i);continue}if(typeof o=="object"&&o!==null&&!Array.isArray(o)){n[r]={...t[r]??{},...o};continue}n[r]=o}}return n}var f4={styleId:"Normal",type:"paragraph",name:"Normal",default:!0,pPr:{spaceAfter:160,lineSpacing:259,lineSpacingRule:"auto"}},Zv=class{constructor(e){if(Ze(this,"stylesById"),Ze(this,"docDefaults"),Ze(this,"defaultParagraphStyle"),Ze(this,"defaultTableStyle"),Ze(this,"defaultCharacterStyle"),this.stylesById=new Map,this.docDefaults=e?.docDefaults,e?.styles)for(let n of e.styles)n.styleId&&this.stylesById.set(n.styleId,n);this.defaultParagraphStyle=this.findDefaultStyle("paragraph"),this.defaultTableStyle=this.findDefaultStyle("table"),this.defaultCharacterStyle=this.findDefaultStyle("character")}getStyle(e){return this.stylesById.get(e)}getParagraphStyles(){let e=[];for(let n of this.stylesById.values())n.type==="paragraph"&&!n.hidden&&!n.semiHidden&&e.push(n);return e.sort((n,r)=>{let o=n.uiPriority??99,i=r.uiPriority??99;return o!==i?o-i:(n.name??n.styleId).localeCompare(r.name??r.styleId)})}hasParagraphStyle(e){return this.stylesById.get(e)?.type==="paragraph"}resolveParagraphStyle(e){let n={};if(this.docDefaults?.pPr&&(n.paragraphFormatting={...this.docDefaults.pPr}),this.docDefaults?.rPr&&(n.runFormatting={...this.docDefaults.rPr}),!e)return this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n;let r=this.stylesById.get(e);return r?(this.mergeStyleIntoResult(n,r),n):(this.defaultParagraphStyle&&this.mergeStyleIntoResult(n,this.defaultParagraphStyle),n)}getNextStyleId(e){if(!e)return null;let n=this.stylesById.get(e)?.next;return n&&n!==e?n:null}getTableStyles(){let e=[];for(let n of this.stylesById.values())n.type==="table"&&!n.hidden&&!n.semiHidden&&e.push(n);return e.sort((n,r)=>{let o=n.uiPriority??99,i=r.uiPriority??99;return o!==i?o-i:(n.name??n.styleId).localeCompare(r.name??r.styleId)})}resolveRunStyle(e){let n={};if(this.docDefaults?.rPr&&(n={...this.docDefaults.rPr}),this.defaultCharacterStyle?.rPr&&(n=this.mergeTextFormatting(n,this.defaultCharacterStyle.rPr)??n),!e)return Object.keys(n).length>0?n:void 0;let r=this.stylesById.get(e);if(!r?.rPr)return Object.keys(n).length>0?n:void 0;let o=this.mergeTextFormatting(n,r.rPr);return o&&Object.keys(o).length>0?o:void 0}getRunStyleOwnProperties(e){if(!e)return;let n=this.stylesById.get(e);if(n?.rPr)return Object.keys(n.rPr).length>0?{...n.rPr}:void 0}getDocDefaults(){return this.docDefaults}getDefaultParagraphStyle(){return this.defaultParagraphStyle}getDefaultTableStyle(){return this.defaultTableStyle}getDefaultCharacterStyle(){return this.defaultCharacterStyle}hasStyle(e){return this.stylesById.has(e)}findDefaultStyle(e){for(let n of this.stylesById.values())if(n.type===e&&n.default)return n;if(e==="paragraph")return this.stylesById.get("Normal")??(this.docDefaults?void 0:f4)}mergeStyleIntoResult(e,n){n.pPr&&(e.paragraphFormatting=this.mergeParagraphFormatting(e.paragraphFormatting,n.pPr)),n.rPr&&(e.runFormatting=this.mergeTextFormatting(e.runFormatting,n.rPr))}mergeParagraphFormatting(e,n){if(!n)return e;if(!e)return n?{...n}:void 0;let r={...e};for(let o of Object.keys(n)){let i=n[o];if(i!==void 0)if(o==="runProperties")r.runProperties=this.mergeTextFormatting(r.runProperties,n.runProperties);else if(o==="borders"||o==="numPr"||o==="frame"){let l=r[o],a=i;r[o]={...l||{},...a||{}}}else o==="tabs"&&Array.isArray(i)?r.tabs=[...i]:r[o]=i}return r}mergeTextFormatting(e,n){return dn(e,n)}};function ia(t){return new Zv(t)}var ei={High:50,Default:100,Low:150};function Cn(t){return e=>{let n={...t.defaultOptions,...e};return{type:"extension",config:{name:t.name,priority:t.priority??ei.Default,options:n},onSchemaReady(r){return t.onSchemaReady(r,n)}}}}function Nt(t){return e=>{let n={...t.defaultOptions,...e},r=typeof t.nodeSpec=="function"?t.nodeSpec(n):t.nodeSpec;return{type:"node",config:{name:t.name,priority:t.priority??ei.Default,options:n,schemaNodeName:t.schemaNodeName,nodeSpec:r},onSchemaReady(o){return t.onSchemaReady?.(o,n)??{}}}}}function it(t){return e=>{let n={...t.defaultOptions,...e},r=typeof t.markSpec=="function"?t.markSpec(n):t.markSpec;return{type:"mark",config:{name:t.name,priority:t.priority??ei.Default,options:n,schemaMarkName:t.schemaMarkName,markSpec:r},onSchemaReady(o){return t.onSchemaReady?.(o,n)??{}}}}}var Vt=new fn("suggestionMode"),En="suggestionModeApplied",Kv="suggestionModeBypass",p4=Date.now();function Uv(){return p4++}function Oi(t){let e=Vt.getState(t);return e?.active?{revisionId:Uv(),author:e.author,date:new Date().toISOString()}:null}var Xv=new fn("documentStyles");function Gv(t){let e=t instanceof Zv?t:t?ia(t):null;return new zt({key:Xv,state:{init:()=>e,apply:(n,r)=>r}})}function Ap(t){return Xv.getState(t)??null}var Dp=new fn("documentContext");function Yv(t){let e={theme:t?.theme??null,defaultTableStyleId:t?.defaultTableStyleId??null};return new zt({key:Dp,state:{init:()=>e,apply:(n,r)=>r}})}function h4(t){return Dp.getState(t)?.theme??null}function m4(t){return Dp.getState(t)?.defaultTableStyleId??null}const Ws=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function g4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Jv=(t,e,n)=>{let r=g4(t,n);if(!r)return!1;let o=Qv(r);if(!o){let l=r.blockRange(),a=l&&pp(l);return a==null?!1:(e&&e(t.tr.lift(l,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(o1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Mi(i,"end")||Ie.isSelectable(i)))for(let l=r.depth;;l--){let a=hp(t.doc,r.before(l),r.after(l),he.empty);if(a&&a.slice.size<a.to-a.from){if(e){let s=t.tr.step(a);s.setSelection(Mi(i,"end")?Le.findFrom(s.doc.resolve(s.mapping.map(o.pos,-1)),-1):Ie.create(s.doc,o.pos-i.nodeSize)),e(s.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function Mi(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const y4=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Qv(r)}let l=i&&i.nodeBefore;return!l||!Ie.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,i.pos-l.nodeSize)).scrollIntoView()),!0)};function Qv(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function b4(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const e1=(t,e,n)=>{let r=b4(t,n);if(!r)return!1;let o=t1(r);if(!o)return!1;let i=o.nodeAfter;if(o1(t,o,e,1))return!0;if(r.parent.content.size==0&&(Mi(i,"start")||Ie.isSelectable(i))){let l=hp(t.doc,r.before(),r.after(),he.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Mi(i,"start")?Le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Ie.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},w4=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=t1(r)}let l=i&&i.nodeAfter;return!l||!Ie.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,i.pos)).scrollIntoView()),!0)};function t1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const x4=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
37
+ `).scrollIntoView()),!0)};function Np(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const v4=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),l=Np(o.contentMatchAt(i));if(!l||!o.canReplaceWith(i,i,l))return!1;if(e){let a=n.after(),s=t.tr.replaceWith(a,a,l.createAndFill());s.setSelection(Le.near(s.doc.resolve(a),1)),e(s.scrollIntoView())}return!0},k4=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof vn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Np(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let l=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(l,i.createAndFill());a.setSelection(ye.create(a.doc,l+1)),e(a.scrollIntoView())}return!0},C4=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(gs(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&pp(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function S4(t){return(e,n)=>{if(e.selection instanceof Ie&&e.selection.node.isBlock){let{$from:h}=e.selection;return!h.parentOffset||!gs(e.doc,h.pos)?!1:(n&&n(e.tr.split(h.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof ye||e.selection instanceof vn)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,l=[],a,s,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),s=Np(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),l.unshift(c&&s?{type:s}:null),a=h;break}else{if(h==1)return!1;l.unshift(null)}let u=o.pos,f=gs(r.doc,u,l.length,l);if(f||(l[0]=s?{type:s}:null,f=gs(r.doc,u,l.length,l)),!f)return!1;if(r.split(u,l.length,l),!c&&d&&o.node(a).type!=s){let h=r.mapping.slice(i),p=h.map(o.before(a)),m=r.doc.resolve(p);s&&o.node(a-1).canReplaceWith(m.index(),m.index()+1,s)&&r.setNodeMarkup(h.map(o.before(a)),s)}return n&&n(r.scrollIntoView()),!0}}const n1=S4(),T4=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(Ie.create(t.doc,o))),!0)},r1=(t,e)=>(e&&e(t.tr.setSelection(new vn(t.doc))),!0);function $4(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||wx(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function o1(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,l,a,s=o.type.spec.isolating||i.type.spec.isolating;if(!s&&$4(t,e,n))return!0;let c=!s&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(l=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(l[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=oe.empty;for(let w=l.length-1;w>=0;w--)p=oe.from(l[w].create(null,p));p=oe.from(o.copy(p));let m=t.tr.step(new xn(e.pos-1,h,e.pos,h,new he(p,1,0),l.length,!0)),y=m.doc.resolve(h+2*l.length);y.nodeAfter&&y.nodeAfter.type==o.type&&wx(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&s?null:Le.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&pp(u);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(u,f).scrollIntoView()),!0;if(c&&Mi(i,"start",!0)&&Mi(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let w=oe.empty;for(let g=p.length-1;g>=0;g--)w=oe.from(p[g].copy(w));let C=t.tr.step(new xn(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new he(w,p.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function i1(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(ye.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const I4=i1(-1),M4=i1(1);function R4(t,e,n,r){for(let o=0;o<e.length;o++){let{$from:i,$to:l}=e[o],a=i.depth==0?t.inlineContent&&t.type.allowsMarkType(n):!1;if(t.nodesBetween(i.pos,l.pos,(s,c)=>{if(a)return!1;a=s.inlineContent&&s.type.allowsMarkType(n)}),a)return!0}return!1}function Sr(t,e=null,n){return function(r,o){let{empty:i,$cursor:l,ranges:a}=r.selection;if(i&&!l||!R4(r.doc,a,t))return!1;if(o)if(l)t.isInSet(r.storedMarks||l.marks())?o(r.tr.removeStoredMark(t)):o(r.tr.addStoredMark(t.create(e)));else{let s,c=r.tr;s=!a.some(d=>r.doc.rangeHasMark(d.$from.pos,d.$to.pos,t));for(let d=0;d<a.length;d++){let{$from:u,$to:f}=a[d];if(!s)c.removeMark(u.pos,f.pos,t);else{let h=u.pos,p=f.pos,m=u.nodeAfter,y=f.nodeBefore,w=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,C=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;h+w<p&&(h+=w,p-=C),c.addMark(h,p,t.create(e))}}o(c.scrollIntoView())}return!0}}function Vl(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}let Jd=Vl(Ws,Jv,y4),Vg=Vl(Ws,e1,w4);const pr={Enter:Vl(x4,k4,C4,n1),"Mod-Enter":v4,Backspace:Jd,"Mod-Backspace":Jd,"Shift-Backspace":Jd,Delete:Vg,"Mod-Delete":Vg,"Mod-a":r1},l1={"Ctrl-h":pr.Backspace,"Alt-Backspace":pr["Mod-Backspace"],"Ctrl-d":pr.Delete,"Ctrl-Alt-Backspace":pr["Mod-Delete"],"Alt-Delete":pr["Mod-Delete"],"Alt-d":pr["Mod-Delete"],"Ctrl-a":I4,"Ctrl-e":M4};for(let t in pr)l1[t]=pr[t];const P4=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,E4=P4?l1:pr;function F4(t){let e={};for(let n of t)switch(n.type.name){case"bold":e.bold=!0;break;case"italic":e.italic=!0;break;case"underline":e.underline={style:n.attrs.style||"single"};break;case"strike":e.strike=!0;break;case"textColor":e.color=n.attrs;break;case"highlight":e.highlight=n.attrs.color;break;case"fontSize":e.fontSize=n.attrs.size??n.attrs.sizeCs,n.attrs.sizeCs!=null&&(e.fontSizeCs=n.attrs.sizeCs);break;case"fontFamily":e.fontFamily={ascii:n.attrs.ascii,hAnsi:n.attrs.hAnsi};break;case"superscript":e.vertAlign="superscript";break;case"subscript":e.vertAlign="subscript";break;case"rtl":e.rtl=!0;break}return e}function a1(t,e,n){let{$from:r}=t.selection,o=r.parent;if(o.type.name!=="paragraph"||o.textContent.length>0)return e;if(n.length===0)return e.setNodeMarkup(r.before(),void 0,{...o.attrs,defaultTextFormatting:null});let i=F4(n);return e.setNodeMarkup(r.before(),void 0,{...o.attrs,defaultTextFormatting:i})}function s1(t,e,n){let r=t.tr;r=a1(t,r,n),r.setStoredMarks(n),e(r)}function la(t,e){return(n,r)=>{let{from:o,to:i,empty:l}=n.selection,a=t.create(e);if(l){if(r){let s=n.storedMarks||n.selection.$from.marks(),c=t.isInSet(s)?s.filter(d=>d.type!==t):s;s1(n,r,[...c,a])}return!0}return r&&r(n.tr.addMark(o,i,a).scrollIntoView()),!0}}function Ri(t){return(e,n)=>{let{from:r,to:o,empty:i}=e.selection;if(i){if(n){let l=(e.storedMarks||e.selection.$from.marks()).filter(a=>a.type!==t);s1(e,n,l)}return!0}return n&&n(e.tr.removeMark(r,o,t).scrollIntoView()),!0}}function Lp(t,e){let n=[];return t.bold&&n.push(e.marks.bold.create()),t.italic&&n.push(e.marks.italic.create()),t.underline&&n.push(e.marks.underline.create({style:t.underline.style||"single",color:t.underline.color})),t.strike&&n.push(e.marks.strike.create()),t.doubleStrike&&n.push(e.marks.strike.create({double:!0})),t.color&&n.push(e.marks.textColor.create({rgb:t.color.rgb,themeColor:t.color.themeColor,themeTint:t.color.themeTint,themeShade:t.color.themeShade})),t.highlight&&n.push(e.marks.highlight.create({color:t.highlight})),t.fontSize&&n.push(e.marks.fontSize.create({size:t.fontSize,sizeCs:t.fontSizeCs??t.fontSize})),t.fontFamily&&n.push(e.marks.fontFamily.create({ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi,asciiTheme:t.fontFamily.asciiTheme})),t.vertAlign==="superscript"&&n.push(e.marks.superscript.create()),t.vertAlign==="subscript"&&n.push(e.marks.subscript.create()),t.rtl&&n.push(e.marks.rtl.create()),n}var A4=(t,e)=>{let{from:n,to:r,empty:o}=t.selection;if(o){if(e){let i=a1(t,t.tr,[]);i.setStoredMarks([]),e(i)}return!0}if(e){let i=t.tr;t.doc.nodesBetween(n,r,(l,a)=>{if(l.isText&&l.marks.length>0){let s=Math.max(n,a),c=Math.min(r,a+l.nodeSize);for(let d of l.marks)i=i.removeMark(s,c,d.type)}}),e(i.scrollIntoView())}return!0};function c1(t){let e=t.paragraphFormatting,n=t.runFormatting,r=!!n&&Object.keys(n).length>0;return{alignment:e?.alignment??null,spaceBefore:e?.spaceBefore??null,spaceAfter:e?.spaceAfter??null,lineSpacing:e?.lineSpacing??null,lineSpacingRule:e?.lineSpacingRule??null,indentLeft:e?.indentLeft??null,indentRight:e?.indentRight??null,indentFirstLine:e?.indentFirstLine??null,hangingIndent:e?.hangingIndent??null,contextualSpacing:e?.contextualSpacing??null,keepNext:e?.keepNext??null,keepLines:e?.keepLines??null,pageBreakBefore:e?.pageBreakBefore??null,outlineLevel:e?.outlineLevel??null,defaultTextFormatting:r?n:null}}function D4(t,e){let n=t.paragraphFormatting?.numPr;if(!n||n.numId===void 0||n.numId===0)return null;let r=e?Ux(n,e):null,o=e?.getLevel(n.numId,n.ilvl??0),i={numPr:{numId:n.numId,ilvl:n.ilvl??0},numPrFromStyle:{numId:n.numId,ilvl:n.ilvl??0},listNumFmt:r?.numFmt??null,listIsBullet:r?.isBullet??null,listMarker:r?.marker??null,listMarkerHidden:r?.markerHidden??null,listMarkerFontFamily:r?.markerFontFamily??null,listMarkerFontSize:r?.markerFontSize??null,listMarkerSuffix:r?.markerSuffix??null,listLevelNumFmts:r?.levelNumFmts??null,listAbstractNumId:r?.abstractNumId??null,listStartOverride:r?.startOverride??null},l=t.paragraphFormatting;return o?.pPr&&(l?.indentLeft===void 0&&o.pPr.indentLeft!==void 0&&(i.indentLeft=o.pPr.indentLeft),l?.indentFirstLine!==void 0||l?.hangingIndent!==void 0||(o.pPr.indentFirstLine!==void 0&&(i.indentFirstLine=o.pPr.indentFirstLine),o.pPr.hangingIndent!==void 0&&(i.hangingIndent=o.pPr.hangingIndent))),i}function qg(...t){return(e,n,r)=>{for(let o of t)if(o(e,n,r))return!0;return!1}}var N4=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parentOffset!==0||n.parent.type.name!=="paragraph")return!1;let r=n.parent.attrs,o=r.indentFirstLine!=null&&r.indentFirstLine>0,i=!!r.hangingIndent,l=r.indentLeft!=null&&r.indentLeft>0;if(!o&&!i&&!l)return!1;if(e){let a=n.before(),s=t.tr.setNodeMarkup(a,void 0,{...r,indentFirstLine:null,hangingIndent:null,indentLeft:null});e(s.scrollIntoView())}return!0},L4=["defaultTextFormatting","styleId","lineSpacing","lineSpacingRule","spaceAfter","spaceBefore","contextualSpacing"],Bp=new Set(["fontFamily","fontSize","textColor"]);function B4(t,e,n,r,o,i){let l=o.resolveParagraphStyle(r);t.setNodeMarkup(e,void 0,{...n.attrs,styleId:r,...c1(l),borders:null}),t.setStoredMarks(l.runFormatting?Lp(l.runFormatting,i):[])}function d1(t,e,n,r,o){let{$from:i}=t.selection,l=i.parent;if(l.type.name!=="paragraph")return;if(o&&e&&l.textContent.length===0){let f=o.getNextStyleId(e.attrs.styleId);if(f){B4(t,i.before(),l,f,o,r);return}}let a={...l.attrs},s=!1;if(e)for(let f of L4){let h=e.attrs[f];h!=null&&a[f]==null&&(a[f]=h,s=!0)}if(a.borders&&(a.borders=null,s=!0),s&&t.setNodeMarkup(i.before(),void 0,a),l.textContent.length!==0)return;let c=[...n];if(c.length===0&&e){let f=e.attrs.defaultTextFormatting;f&&(c=Lp(f,r).filter(h=>Bp.has(h.type.name)))}if(c.length===0)return;let d={...a.defaultTextFormatting??{}},u=!1;for(let f of c){if(f.type.name==="fontSize"){let h=f.attrs.size??f.attrs.sizeCs;h!==d.fontSize&&(d.fontSize=h,u=!0);let p=f.attrs.sizeCs;p!=null&&p!==d.fontSizeCs&&(d.fontSizeCs=p,u=!0)}if(f.type.name==="fontFamily"){let h=f.attrs.ascii;h&&(!d.fontFamily||d.fontFamily.ascii!==h)&&(d.fontFamily=qv(d.fontFamily,{ascii:h,hAnsi:f.attrs.hAnsi}),u=!0)}}u&&t.setNodeMarkup(i.before(),void 0,{...a,defaultTextFormatting:d}),t.setStoredMarks(c)}var O4=(t,e,n)=>{let{$from:r}=t.selection,o=r.parent.type.name==="paragraph"?r.parent:null,i=(t.storedMarks||r.marks()).filter(a=>Bp.has(a.type.name)),l=null;if(!n1(t,e?a=>{l=a}:void 0,n))return!1;if(e&&l!==null){let a=l;d1(a,o,i,t.schema,Ap(t)),e(a.scrollIntoView())}return!0},j4=Cn({name:"baseKeymap",priority:ei.Low,onSchemaReady(t){return{keyboardShortcuts:{...E4,Enter:O4,Backspace:qg(Ws,N4,Jv),Delete:qg(Ws,e1),"Mod-a":r1,Escape:T4}}}}),Zg=new fn("selectionTracker");function ef(t){let{selection:e,doc:n}=t,{from:r,to:o,empty:i}=e,l=n.resolve(r),a=0,s=0;n.forEach((v,k,x)=>{if(k>o)return!1;k<=r&&(a=x),k<=o&&(s=x)});let c=z4(t),d=l.parent,u={};d.type.name==="paragraph"&&(d.attrs.alignment&&(u.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(u.lineSpacing=d.attrs.lineSpacing,u.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.indentLeft&&(u.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(u.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(u.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(u.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(u.tabs=d.attrs.tabs),d.attrs.numPr&&(u.numPr=d.attrs.numPr),d.attrs.styleId&&(u.styleId=d.attrs.styleId));let f=d.attrs?.numPr,h=!!f?.numId,p=f?.numId===1?"bullet":f?.numId?"numbered":void 0,m=f?.ilvl,y=t.storedMarks||(i?l.marks():[]),w=[],C=!1,g=!1;for(let v of y)v.type.name==="comment"&&v.attrs.commentId&&w.push(v.attrs.commentId),v.type.name==="insertion"&&(C=!0),v.type.name==="deletion"&&(g=!0);return{hasSelection:!i,isMultiParagraph:a!==s,textFormatting:c,paragraphFormatting:u,startParagraphIndex:a,endParagraphIndex:s,inList:h,listType:p,listLevel:m,activeCommentIds:w,inInsertion:C,inDeletion:g}}function z4(t){let{selection:e,doc:n}=t,{empty:r,$from:o,from:i,to:l}=e,a=t.storedMarks;if(!a)if(r)a=o.marks();else{let c=null;n.nodesBetween(i,l,d=>c?!1:d.isText?(c=d.marks,!1):!0),a=c??o.marks()}let s={};for(let c of a)switch(c.type.name){case"bold":s.bold=!0;break;case"italic":s.italic=!0;break;case"underline":s.underline={style:c.attrs.style||"single",color:c.attrs.color};break;case"strike":c.attrs.double?s.doubleStrike=!0:s.strike=!0;break;case"textColor":s.color={rgb:c.attrs.rgb,themeColor:c.attrs.themeColor,themeTint:c.attrs.themeTint,themeShade:c.attrs.themeShade};break;case"highlight":s.highlight=c.attrs.color;break;case"fontSize":s.fontSize=c.attrs.size??c.attrs.sizeCs,c.attrs.sizeCs!=null&&(s.fontSizeCs=c.attrs.sizeCs);break;case"fontFamily":s.fontFamily={ascii:c.attrs.ascii,hAnsi:c.attrs.hAnsi,asciiTheme:c.attrs.asciiTheme};break;case"superscript":s.vertAlign="superscript";break;case"subscript":s.vertAlign="subscript";break}return s}function H4(t){return new zt({key:Zg,state:{init(e,n){return ef(n)},apply(e,n,r,o){if(!e.selectionSet&&!e.docChanged)return n;let i=ef(o);return t&&!W4(n,i)&&setTimeout(()=>t(i),0),i}},view(){return{update(e,n){if(!t||e.state.selection.eq(n.selection)&&e.state.doc.eq(n.doc))return;let r=Zg.getState(e.state);r&&t(r)}}}})}function _4(t,e){if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function W4(t,e){return t.hasSelection===e.hasSelection&&t.isMultiParagraph===e.isMultiParagraph&&t.startParagraphIndex===e.startParagraphIndex&&t.endParagraphIndex===e.endParagraphIndex&&t.inList===e.inList&&t.listType===e.listType&&t.listLevel===e.listLevel&&t.inInsertion===e.inInsertion&&t.inDeletion===e.inDeletion&&_4(t.activeCommentIds,e.activeCommentIds)&&JSON.stringify(t.textFormatting)===JSON.stringify(e.textFormatting)&&JSON.stringify(t.paragraphFormatting)===JSON.stringify(e.paragraphFormatting)}var u1={firstRow:!0,firstColumn:!0,lastRow:!1,lastColumn:!1,noHBand:!1,noVBand:!0};function V4(t,e){if(t.toLowerCase()==="tablenormal")return!0;let n=e?.trim().toLowerCase();return n==="table normal"||n==="normal table"}function f1(t,e){if(!e)return;if(t&&e.hasStyle(t))return t;let n=e.getDefaultTableStyle();if(n?.styleId&&!V4(n.styleId,n.name))return n.styleId}const Ot=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let tf=null;const dr=function(t,e,n){let r=tf||(tf=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},q4=function(){tf=null},Wo=function(t,e,n,r){return n&&(Kg(t,e,n,r,-1)||Kg(t,e,n,r,1))},Z4=/^(img|br|input|textarea|hr)$/i;function Kg(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Zt(t))){let l=t.parentNode;if(!l||!Te(l)||aa(t)||Z4.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ot(t)+(o<0?0:1),t=l}else if(Te(t)){let l=t.childNodes[e+(o<0?-1:0)];if(Te(l)&&l.contentEditable=="false")if(!((i=l.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=l,e=o<0?Zt(t):0}else return!1}}function Zt(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Te(t){return t.nodeType==1}function Mt(t){return t.nodeType==3}function Vo(t,e){return e?t.contains(Te(e)?e:e.parentNode):!1}function K4(t,e){for(;;){if(Mt(t)&&e)return t;if(Te(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Zt(t)}else if(t.parentNode&&!aa(t))e=Ot(t),t=t.parentNode;else return null}}function U4(t,e){for(;;){if(Mt(t)&&e<t.nodeValue.length)return t;if(Te(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!aa(t))e=Ot(t)+1,t=t.parentNode;else return null}}function X4(t,e,n){for(let r=e==0,o=e==Zt(t);r||o;){if(t==n)return!0;let i=Ot(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Zt(t)}}function aa(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Bc=function(t){return t.focusNode&&Wo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function vo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function G4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Y4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Zt(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Zt(r.startContainer),r.startOffset)}}}const ir=typeof navigator<"u"?navigator:null,Ug=typeof document<"u"?document:null,co=ir&&ir.userAgent||"",nf=/Edge\/(\d+)/.exec(co),p1=/MSIE \d/.exec(co),rf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(co),sn=!!(p1||rf||nf),Kr=p1?document.documentMode:rf?+rf[1]:nf?+nf[1]:0,kn=!sn&&/gecko\/(\d+)/i.test(co);kn&&+(/Firefox\/(\d+)/.exec(co)||[0,0])[1];const of=!sn&&/Chrome\/(\d+)/.exec(co),jt=!!of,h1=of?+of[1]:0,Kt=!sn&&!!ir&&/Apple Computer/.test(ir.vendor),Ei=Kt&&(/Mobile\/\w+/.test(co)||!!ir&&ir.maxTouchPoints>2),In=Ei||(ir?/Mac/.test(ir.platform):!1),m1=ir?/Win/.test(ir.platform):!1,gr=/Android \d/.test(co),Oc=!!Ug&&"webkitFontSmoothing"in Ug.documentElement.style,J4=Oc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Q4(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function sr(t,e){return typeof t=="number"?t:t[e]}function eL(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Xg(t,e,n){if(!lf(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(!Te(l)){l=Pi(l);continue}let a=l==i.body,s=a?Q4(i):eL(l),c=0,d=0;if(e.top<s.top+sr(r,"top")?d=-(s.top-e.top+sr(o,"top")):e.bottom>s.bottom-sr(r,"bottom")&&(d=e.bottom-e.top>s.bottom-s.top?e.top+sr(o,"top")-s.top:e.bottom-s.bottom+sr(o,"bottom")),e.left<s.left+sr(r,"left")?c=-(s.left-e.left+sr(o,"left")):e.right>s.right-sr(r,"right")&&(c=e.right-s.right+sr(o,"right")),c||d)if(a)i.defaultView.scrollBy(c,d);else{let f=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let p=l.scrollLeft-f,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}let u=a?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(u))break;l=u=="absolute"?l.offsetParent:Pi(l)}}function tL(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let a=t.root.elementFromPoint(i,l);if(!a||a==t.dom||!t.dom.contains(a))continue;let s=a.getBoundingClientRect();if(s.top>=n-20){r=a,o=s.top;break}}return{refDOM:r,refTop:o,stack:g1(t.dom)}}function g1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pi(r));return e}function nL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;y1(n,r==0?0:r-e)}function y1(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ii=null;function rL(t){if(t.setActive)return t.setActive();if(ii)return t.focus(ii);let e=g1(t);t.focus(ii==null?{get preventScroll(){return ii={preventScroll:!0},!0}}:void 0),ii||(ii=!1,y1(e,0))}function b1(t,e){let n,r=2e8,o,i=0,l=e.top,a=e.top,s,c;for(let d=t.firstChild,u=0;d;d=d.nextSibling,u++){let f;if(Te(d))f=d.getClientRects();else if(Mt(d))f=dr(d).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=l&&p.bottom>=a){l=Math.max(p.bottom,l),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=d,r=m,o=m&&Mt(n)?{left:p.right<e.left?p.right:p.left,top:e.top}:e,Te(d)&&m&&(i=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!s&&p.left<=e.left&&p.right>=e.left&&(s=d,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=u+1)}}return!n&&s&&(n=s,o=c,r=0),n&&Mt(n)?oL(n,o):!n||r?{node:t,offset:i}:b1(n,o)}function oL(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let l=Dr(r,1);if(l.top!=l.bottom&&Op(e,l)){o={node:t,offset:i+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function Op(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function iL(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function lL(t,e,n){let{node:r,offset:o}=b1(e,n),i=-1;if(Te(r)&&!r.firstChild){let l=r.getBoundingClientRect();i=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function aL(t,e,n,r){let o=-1;for(let i=e,l=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),s;if(!a)return null;if(Te(a.dom)&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((s=a.dom.getBoundingClientRect()).width||s.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&s.left>r.left||s.top>r.top?o=a.posBefore:(!l&&s.right<r.left||s.bottom<r.top)&&(o=a.posAfter),l=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function w1(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let l=t.childNodes[i];if(Te(l)){let a=l.getClientRects();for(let s=0;s<a.length;s++){let c=a[s];if(Op(e,c))return w1(l,e,c)}}if((i=(i+1)%r)==o)break}return t}function sL(t,e){let n=t.dom.ownerDocument,r,o=0,i=Y4(n,e.left,e.top);i&&({node:r,offset:o}=i);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!l||!t.dom.contains(l)){let c=t.dom.getBoundingClientRect();if(!Op(e,c)||(l=w1(t.dom,e,c),!l))return null}if(Kt)for(let c=l;r&&c;c=Pi(c))c.draggable&&(r=void 0);if(l=iL(l,e),r){if(kn&&Te(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],u;d.nodeName=="IMG"&&(u=d.getBoundingClientRect()).right<=e.left&&u.bottom>e.top&&o++}let c;Oc&&o&&Te(r)&&Te(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&Te(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||!Te(r)||r.childNodes[o-1].nodeName!="BR")&&(a=aL(t,r,o,e))}a==null&&(a=lL(t,l,e));let s=t.docView.nearestDesc(l,!0);return{pos:a,inside:s?s.posAtStart-s.border:-1}}function lf(t){return t.top<t.bottom||t.left<t.right}function Dr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(lf(r))return r}return Array.prototype.find.call(n,lf)||t.getBoundingClientRect()}const cL=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function x1(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),l=Oc||kn;if(Mt(r))if(l&&(cL.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let s=Dr(dr(r,o,o),n);if(kn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Dr(dr(r,o-1,o-1),-1);if(c.top==s.top){let d=Dr(dr(r,o,o+1),-1);if(d.top!=s.top)return Yi(d,d.left<c.left)}}return s}else{let s=o,c=o,d=n<0?1:-1;return n<0&&!o?(c++,d=-1):n>=0&&o==r.nodeValue.length?(s--,d=1):n<0?s--:c++,Yi(Dr(dr(r,s,c),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Zt(r))){let s=r.childNodes[o-1];if(Te(s))return Qd(s.getBoundingClientRect(),!1)}if(i==null&&o<Zt(r)){let s=r.childNodes[o];if(Te(s))return Qd(s.getBoundingClientRect(),!0)}return Qd(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Zt(r))){let s=r.childNodes[o-1],c=Mt(s)?dr(s,Zt(s)-(l?0:1)):Te(s)&&(s.nodeName!="BR"||!s.nextSibling)?s:null;if(c)return Yi(Dr(c,1),!1)}if(i==null&&o<Zt(r)){let s=r.childNodes[o];for(;s.pmViewDesc&&s.pmViewDesc.ignoreForCoords;)s=s.nextSibling;let c=s?Mt(s)?dr(s,0,l?0:1):Te(s)?s:null:null;if(c)return Yi(Dr(c,-1),!0)}return Yi(Dr(Mt(r)?dr(r):r,-n),n>=0)}function Yi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Qd(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function v1(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function dL(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return v1(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let l=x1(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let s;if(Te(a))s=a.getClientRects();else if(Mt(a))s=dr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<s.length;c++){let d=s[c];if(d.bottom>d.top+1&&(n=="up"?l.top-d.top>(d.bottom-l.top)*2:d.bottom-l.bottom>(l.bottom-d.top)*2))return!1}}return!0})}const uL=/[\u0590-\u08ac]/;function fL(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,l=o==r.parent.content.size,a=t.domSelection();return a?!uL.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:l:v1(t,e,()=>{let{focusNode:s,focusOffset:c,anchorNode:d,anchorOffset:u}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!Vo(h,p)||s==p&&c==m;try{a.collapse(d,u),s&&(s!=d||c!=u)&&a.extend&&a.extend(s,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Gg=null,Yg=null,Jg=!1;function pL(t,e,n){return Gg==e&&Yg==n?Jg:(Gg=e,Yg=n,Jg=n=="up"||n=="down"?dL(t,e,n):fL(t,e,n))}const Pn=0,Qg=1,Co=2,Hn=3;class sa{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Pn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&Vo(this.contentDOM,e))if(r<0){let i,l;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((l=i.pmViewDesc)&&l.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(l)+l.size:this.posAtStart}else{let i,l;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((l=i.pmViewDesc)&&l.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(l):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>Ot(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),l;if(i&&(!n||i.node))if(r&&(l=i.nodeDOM)&&!(Te(l)?Vo(l,e):l==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let l=0;l<o.children.length;l++){let a=o.children[l];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let l=this.children[r],a=i+l.size;if(a>e){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof C1||i instanceof k1&&i.side>=0))break}if(n<=0){let i,l=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,l=!1);return i&&n&&l&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Ot(i.dom)+1:0}}else{let i,l=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,l=!1);return i&&l&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?Ot(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let l=r,a=0;;a++){let s=this.children[a],c=l+s.size;if(o==-1&&e<=c){let d=l+s.border;if(e>=d&&n<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,n,d);e=l;for(let u=a;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=Ot(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){i=Ot(u.dom);break}n+=u.size}i==-1&&(i=this.contentDOM.childNodes.length);break}l=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(!Te(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),l=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(i>p&&l<y)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=y}let a=this.domFromPos(e,e?-1:1),s=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),d=r.domSelectionRange(),u=!1;if((kn||Kt)&&e==n){let{node:h,offset:p}=a;if(Mt(h)){if(u=!!(p&&h.nodeValue[p-1]==`
38
+ `),u&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=s={node:y.parentNode,offset:Ot(y)+1});break}let w=m.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{let m=h.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(kn&&d.focusNode&&d.focusNode!=s.node&&Te(d.focusNode)){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||u&&Kt)&&Wo(a.node,a.offset,d.anchorNode,d.anchorOffset)&&Wo(s.node,s.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(u&&kn)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(s.node,s.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=s,s=p}let h=document.createRange();h.setEnd(s.node,s.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],l=r+i.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let a=r+i.border,s=l-i.border;if(e>=a&&n<=s){this.dirty=e==r||n==l?Co:Qg,e==a&&n==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Hn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Co:Hn}r=l}this.dirty=Co}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Co:Qg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class k1 extends sa{constructor(e,n,r,o){let i,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){let a=Te(l)?l:document.createElement("span");a!=l&&a.appendChild(l),a.hasAttribute("contenteditable")||(a.contentEditable="false"),a.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Pn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class hL extends sa{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ur extends sa{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],l=i&&i(n,o,r);return(!l||!l.dom)&&(l=Bi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ur(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Hn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Hn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Pn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Pn}}slice(e,n,r){let o=Ur.create(this.parent,this.mark,!0,r),i=this.children,l=this.size;n<l&&(i=sf(i,n,l,r)),e>0&&(i=sf(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Xr extends sa{constructor(e,n,r,o,i,l,a){super(e,[],i,l),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,l){let a=i.nodeViews[n.type.name],s,c=a&&a(n,i,()=>{if(!s)return l;if(s.parent)return s.parent.posBeforeChild(s)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(!Mt(d))throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=Bi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!u&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let f=d;return d=$1(d,r,n),c?s=new mL(e,n,r,o,d,u||null,f,c):n.isText?new jc(e,n,r,o,d,f):new Xr(e,n,r,o,d,u||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let o=this.children[r];if(this.dom.contains(o.dom.parentNode)){n.contentElement=o.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(o=>Te(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?n.contentElement=r:n.getContent=()=>oe.empty}}return n}matchesNode(e,n,r){return this.dirty==Pn&&e.eq(this.node)&&Vs(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,l=i&&i.pos>-1?i:null,a=i&&i.pos<0,s=new yL(this,l&&l.node,e),c=this.node.inlineContent,d=c&&this.node.isBlock;xL(this.node,this.innerDeco,(u,f,h)=>{u.spec.marks?s.syncToMarks(u.spec.marks,r,e,f):u.type.side>=0&&!h&&s.syncToMarks(f==this.node.childCount?Xe.none:this.node.child(f).marks,r,e,f),s.placeWidget(u,e,o)},(u,f,h,p)=>{s.syncToMarks(u.marks,r,e,p),d&&u.isAtom&&!u.isText&&s.addHackNode("IMG",s.top);let m;s.findNodeMatch(u,f,h,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+u.nodeSize&&(m=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(u,f,h,m,e)||s.updateNextNode(u,f,h,e,p,o)||s.addNode(u,f,h,e,o),o+=u.nodeSize,c&&(d=u.isAtom&&!u.isText)}),s.syncToMarks([],r,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Co)&&(l&&this.protectLocalComposition(e,l),S1(this.contentDOM,this.children,e),Ei&&vL(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof ye)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let l=i.nodeValue,a=kL(this.node.content,l,r-n,o-n);return a<0?null:{node:i,pos:a,text:l}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let l=new hL(this,i,n,o);e.input.compositionNodes.push(l),this.children=sf(this.children,r,r+o.length,e,l)}update(e,n,r,o){return this.dirty==Hn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Pn}updateOuterDeco(e){if(Vs(e,this.outerDeco))return;let n=!Te(this.nodeDOM),r=this.dom;this.dom=T1(this.dom,this.nodeDOM,af(this.outerDeco,this.node,n),af(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){Te(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){Te(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function e0(t,e,n,r,o){$1(r,e,t);let i=new Xr(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(o,0),i}class jc extends Xr{constructor(e,n,r,o,i,l){super(e,n,r,o,i,null,l)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Hn||this.dirty!=Pn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Pn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Pn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new jc(this.parent,o,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Hn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class C1 extends sa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Pn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class mL extends Xr{constructor(e,n,r,o,i,l,a,s){super(e,n,r,o,i,l,a),this.spec=s}update(e,n,r,o){if(this.dirty==Hn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function S1(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let l=e[i],a=l.dom;if(a.parentNode==t){for(;a!=r;)r=t0(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(l instanceof Ur){let s=r?r.previousSibling:t.lastChild;S1(l.contentDOM,l.children,n),r=s?s.nextSibling:t.firstChild}}for(;r;)r=t0(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const $l=function(t){t&&(this.nodeName=t)};$l.prototype=Object.create(null);const So=[new $l];function af(t,e,n){if(t.length==0)return So;let r=n?So[0]:new $l,o=[r];for(let i=0;i<t.length;i++){let l=t[i].type.attrs;if(l){l.nodeName&&o.push(r=new $l(l.nodeName));for(let a in l){let s=l[a];s!=null&&(n&&o.length==1&&o.push(r=new $l(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+s:a=="style"?r.style=(r.style?r.style+";":"")+s:a!="nodeName"&&(r[a]=s))}}}return o}function T1(t,e,n,r){if(n==So&&r==So)return e;let o=e;for(let i=0;i<r.length;i++){let l=r[i],a=n[i];if(i){let s;a&&a.nodeName==l.nodeName&&o!=t&&(s=o.parentNode)&&s.nodeName.toLowerCase()==l.nodeName||(s=document.createElement(l.nodeName),s.pmIsDeco=!0,s.appendChild(o),a=So[0]),o=s}gL(o,a||So[0],l)}return o}function gL(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function $1(t,e,n){return T1(t,t,So,af(e,n,!Te(t)))}function Vs(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function t0(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class yL{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=bL(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,o){let i=0,l=this.stack.length>>1,a=Math.min(l,e.length);for(;i<a&&(i==l-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<l;)this.destroyRest(),this.top.dirty=Pn,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let s=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let d=this.index;d<c;d++){let u=this.top.children[d];if(u.matchesMark(e[l])&&!this.isLocked(u.dom)){s=d;break}}if(s<0&&this.index<this.top.children.length){let d=this.top.children[this.index];d instanceof Ur&&d.dirty!=Hn&&d.mark.type==e[l].type&&d.spec.update&&!this.isLocked(d.dom)&&d.spec.update(e[l])&&(d.mark=e[l],s=this.index,this.changed=!0)}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{let d=Ur.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,o){let i=-1,l;if(o>=this.preMatch.index&&(l=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))i=this.top.children.indexOf(l,this.index);else for(let a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let l=this.top.children[o];return l.dirty==Hn&&l.dom==l.contentDOM&&(l.dirty=Co),l.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,l){for(let a=this.index;a<this.top.children.length;a++){let s=this.top.children[a];if(s instanceof Xr){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let d=s.dom,u,f=this.isLocked(d)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Hn&&Vs(n,s.outerDeco));if(!f&&s.update(e,n,r,o))return this.destroyBetween(this.index,a),s.dom!=d&&(this.changed=!0),this.index++,!0;if(!f&&(u=this.recreateWrapper(s,e,n,r,o,l)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Co,u.updateChildren(o,l+1),u.dirty=Pn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Vs(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Xr.create(this.top,n,r,o,i,l);if(a.contentDOM){a.children=e.children,e.children=[];for(let s of a.children)s.parent=a}return e.destroy(),a}addNode(e,n,r,o,i){let l=Xr.create(this.top,e,n,r,o,i);l.contentDOM&&l.updateChildren(o,i+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new k1(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ur;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof jc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Kt||jt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new C1(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||Te(e)&&e.contains(this.lock.parentNode))}}function bL(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,l=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ur)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let s=a.node;if(s){if(s!=t.child(o-1))break;--o,i.set(a,o),l.push(a)}}return{index:o,matched:i,matches:l.reverse()}}function wL(t,e){return t.type.side-e.type.side}function xL(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let d=t.child(c);r(d,o,e.forChild(i,d),c),i+=d.nodeSize}return}let l=0,a=[],s=null;for(let c=0;;){let d,u;for(;l<o.length&&o[l].to==i;){let y=o[l++];y.widget&&(d?(u||(u=[d])).push(y):d=y)}if(d)if(u){u.sort(wL);for(let y=0;y<u.length;y++)n(u[y],c,!!s)}else n(d,c,!!s);let f,h;if(s)h=-1,f=s,s=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;l<o.length&&o[l].from<=i&&o[l].to>i;)a.push(o[l++]);let p=i+f.nodeSize;if(f.isText){let y=p;l<o.length&&o[l].from<y&&(y=o[l].from);for(let w=0;w<a.length;w++)a[w].to<y&&(y=a[w].to);y<p&&(s=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;l<o.length&&o[l].to<p;)l++;let m=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,m,e.forChild(i,f),h),i=p}}function vL(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function kL(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let l=t.child(o++),a=i;if(i+=l.nodeSize,!l.isText)continue;let s=l.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;s+=c.text}if(i>=n){if(i>=r&&s.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?s.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&s.length>=r+e.length-a&&s.slice(r-a,r-a+e.length)==e)return r}}return-1}function sf(t,e,n,r,o){let i=[];for(let l=0,a=0;l<t.length;l++){let s=t[l],c=a,d=a+=s.size;c>=n||d<=e?i.push(s):(c<e&&i.push(s.slice(0,e-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(s.slice(n-c,s.size,r)))}return i}function jp(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let a=r.resolve(l),s,c;if(Bc(n)){for(s=l;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&Ie.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&X4(n.focusNode,n.focusOffset,o.dom))){let u=o.posBefore;c=new Ie(l==u?a:r.resolve(u))}else if(kn&&e=="key"&&l>t.state.selection.to&&Te(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&o&&o.posAtStart>t.state.selection.to)for(let u=n.focusNode;;u=u.parentNode){if(getComputedStyle(u).overflow!="visible"){c=Le.findFrom(r.resolve(o.posAtStart),1);break}if(u==o.dom||u.nextSibling||!u.parentNode||!Te(u.parentNode))break}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let u=l,f=l;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);u=Math.min(u,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(u<0)return null;[s,l]=f==t.state.selection.anchor?[f,u]:[u,f],a=r.resolve(l)}else s=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(s<0)return null}let d=r.resolve(s);if(!c){let u=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=zp(t,d,a,u)}return c}function I1(t){return t.editable?t.hasFocus():R1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function kr(t,e=!1){let n=t.state.selection;if(M1(t,n),!I1(t))return;let r=t.input.mouseDown;if(!e&&jt&&r){let o=t.domSelectionRange(),i=t.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&Wo(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)SL(t);else{let{anchor:o,head:i}=n,l,a;n0&&!(n instanceof ye)&&(n.$from.parent.inlineContent||(l=r0(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=r0(t,n.to))),t.docView.setSelection(o,i,t,e),n0&&(l&&o0(l),a&&o0(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&CL(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const n0=Kt||jt&&h1<63;function r0(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Kt&&o&&o.contentEditable=="false")return eu(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return eu(o);if(i)return eu(i)}}function eu(t){return t.contentEditable="true",Kt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function o0(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function CL(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!I1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function SL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ot(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&sn&&Kr<=11&&(n.disabled=!0,n.disabled=!1)}function M1(t,e){if(e instanceof Ie){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(i0(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else i0(t)}function i0(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function zp(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||ye.between(e,n,r)}function l0(t){return t.editable&&!t.hasFocus()?!1:R1(t)}function R1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return Vo(t.dom,e.anchorNode)&&(t.editable||Vo(t.dom,e.focusNode))}catch{return!1}}function TL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Wo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function cf(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Le.findFrom(i,e)}function Lr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function a0(t,e,n){let r=t.state.selection;if(r instanceof ye)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let l=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return Lr(t,new ye(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=cf(t.state,e);return o&&o instanceof Ie?Lr(t,o):!1}else if(!(In&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,l;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(l=t.docView.descAt(a))&&!l.contentDOM?Ie.isSelectable(i)?Lr(t,new Ie(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Lr(t,new ye(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1}}else return!1;else{if(r instanceof Ie&&r.node.isInline)return Lr(t,new ye(e>0?r.$to:r.$from));{let o=cf(t.state,e);return o?Lr(t,o):!1}}}function Il(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):Te(t)&&t.contentEditable=="false"}function li(t,e){return e<0?$L(t):IL(t)}function $L(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,l=!1;for(kn&&Te(n)&&r<Zt(n)&&Il(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(!Te(n))break;let a=n.childNodes[r-1];if(Il(a,-1))o=n,i=--r;else if(Mt(a))n=a,r=n.nodeValue.length;else break}else{if(P1(n))break;{let a=n.previousSibling;for(;a&&Il(a,-1);)o=n.parentNode,i=Ot(a),a=a.previousSibling;if(a)n=a,r=Zt(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?df(t,n,r):o&&df(t,o,i)}function IL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Zt(n),i,l;for(;;)if(r<o){if(!Te(n))break;let a=n.childNodes[r];if(Il(a,1))i=n,l=++r;else break}else{if(P1(n))break;{let a=n.nextSibling;for(;a&&Il(a,1);)i=a.parentNode,l=Ot(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Zt(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&df(t,i,l)}function P1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function ML(t,e){for(;t&&e==t.childNodes.length&&!aa(t);)e=Ot(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(Mt(n))return n;if(Te(n)&&n.contentEditable=="false")break;t=n,e=0}}function RL(t,e){for(;t&&!e&&!aa(t);)e=Ot(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(Mt(n))return n;if(Te(n)&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function df(t,e,n){if(!Mt(e)){let i,l;(l=ML(e,n))?(e=l,n=0):(i=RL(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Bc(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&kr(t)},50)}function s0(t,e){let n=t.state.doc.resolve(e);if(!(jt||m1)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),l=(i.top+i.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(i.left-o.left)>1)return i.left<o.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),l=(i.top+i.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(i.left-o.left)>1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function c0(t,e,n){let r=t.state.selection;if(r instanceof ye&&!r.empty||n.indexOf("s")>-1||In&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=cf(t.state,e);if(l&&l instanceof Ie)return Lr(t,l)}if(!o.parent.inlineContent){let l=e<0?o:i,a=r instanceof vn?Le.near(l,e):Le.findFrom(l,e);return a?Lr(t,a):!1}return!1}function d0(t,e){if(!(t.state.selection instanceof ye))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let l=t.state.tr;return e<0?l.delete(n.pos-i.nodeSize,n.pos):l.delete(n.pos,n.pos+i.nodeSize),t.dispatch(l),!0}return!1}function u0(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function PL(t){if(!Kt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&Te(e)&&n==0&&e.firstChild&&Te(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;u0(t,r,"true"),setTimeout(()=>u0(t,r,"false"),20)}return!1}function EL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function FL(t,e){let n=e.keyCode,r=EL(e);if(n==8||In&&n==72&&r=="c")return d0(t,-1)||li(t,-1);if(n==46&&!e.shiftKey||In&&n==68&&r=="c")return d0(t,1)||li(t,1);if(n==13||n==27)return!0;if(n==37||In&&n==66&&r=="c"){let o=n==37?s0(t,t.state.selection.from)=="ltr"?-1:1:-1;return a0(t,o,r)||li(t,o)}else if(n==39||In&&n==70&&r=="c"){let o=n==39?s0(t,t.state.selection.from)=="ltr"?1:-1:1;return a0(t,o,r)||li(t,o)}else{if(n==38||In&&n==80&&r=="c")return c0(t,-1,r)||li(t,-1);if(n==40||In&&n==78&&r=="c")return PL(t)||c0(t,1,r)||li(t,1);if(r==(In?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Hp(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let l=t.someProp("clipboardSerializer")||Bi.fromSchema(t.state.schema),a=L1(),s=a.createElement("div");s.appendChild(l.serializeFragment(r,{document:a}));let c=s.firstChild,d,u=0;for(;c&&Te(c)&&(d=N1[c.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let p=a.createElement(d[h]);for(;s.firstChild;)p.appendChild(s.firstChild);s.appendChild(p),u++}c=s.firstChild}c&&Te(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
39
+
40
+ `);return{dom:s,text:f,slice:e}}function E1(t,e,n,r,o){let i=o.parent.type.spec.code,l,a;if(!n&&!e)return null;let s=!!e&&(r||i||!n);if(s){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return a=new he(oe.from(t.state.schema.text(e.replace(/\r\n?/g,`
41
+ `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let u=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(u)a=u;else{let f=o.marks(),{schema:h}=t.state,p=Bi.fromSchema(h);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=l.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",u=>{n=u(n,t)}),l=LL(n),Oc&&BL(l);let c=l&&l.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=l.firstChild;for(;f&&!Te(f);)f=f.nextSibling;if(!f)break;l=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||cx.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(s||d),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!AL.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)a=OL(f0(a,+d[1],+d[2]),d[4]);else if(a=he.maxOpen(DL(a.content,o),!0),a.openStart||a.openEnd){let u=0,f=0;for(let h=a.content.firstChild;u<a.openStart&&!h.type.spec.isolating;u++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=f0(a,u,f)}return t.someProp("transformPasted",u=>{a=u(a,t,s)}),a}const AL=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function DL(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,l=[];if(t.forEach(a=>{if(!l)return;let s=o.findWrapping(a.type),c;if(!s)return l=null;if(c=l.length&&i.length&&A1(s,i,a,l[l.length-1],0))l[l.length-1]=c;else{l.length&&(l[l.length-1]=D1(l[l.length-1],i.length));let d=F1(a,s);l.push(d),o=o.matchType(d.type),i=s}}),l)return oe.from(l)}return t}function F1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,oe.from(t));return t}function A1(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=A1(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(oe.from(F1(n,t,o+1))))}}function D1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,D1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(oe.empty,!0);return t.copy(n.append(r))}function uf(t,e,n,r,o,i){let l=e<0?t.firstChild:t.lastChild,a=l.content;return t.childCount>1&&(i=0),o<r-1&&(a=uf(a,e,n,r,o+1,i)),o>=n&&(a=e<0?l.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(oe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(a))}function f0(t,e,n){return e<t.openStart&&(t=new he(uf(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new he(uf(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const N1={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function L1(){return document.implementation.createHTMLDocument("title")}let Ji=null;function NL(t){let e=window.trustedTypes;if(!e)return t;if(!Ji){if(Ji=e.defaultPolicy)try{return Ji.createHTML(t)}catch{}Ji=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Ji.createHTML(t)}function LL(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=L1(),r=n.body,o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&N1[o[1].toLowerCase()])&&(t=i.map(l=>"<"+l+">").join("")+t+i.map(l=>"</"+l+">").reverse().join("")),r.innerHTML=NL(t),i)for(let l=0;l<i.length;l++)r=r.querySelector(i[l])||r;for(let l=0;l<n.styleSheets.length;l++){let a=n.styleSheets[l];for(let s=0;s<a.rules.length;s++){let c=a.rules[s];if(c instanceof CSSStyleRule){let d=r.querySelectorAll(c.selectorText);for(let u=0;u<d.length;u++)d[u].style.cssText+=c.style.cssText}}}return r}function BL(t){let e=t.querySelectorAll(jt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function OL(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:l}=t;for(let a=r.length-2;a>=0;a-=2){let s=n.nodes[r[a]];if(!s||s.hasRequiredAttrs())break;try{o=oe.from(s.create(r[a+1],o))}catch{break}i++,l++}return new he(o,i,l)}const en={},tn={},jL={touchstart:!0,touchmove:!0};class zL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function HL(t){for(let e in en){let n=en[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{WL(t,r)&&!_p(t,r)&&(t.editable||!(r.type in tn))&&n(t,r)},jL[e]?{passive:!0}:void 0)}Kt&&t.dom.addEventListener("input",()=>null),ff(t)}function yr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function _L(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ff(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>_p(t,r))})}function _p(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function WL(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function VL(t,e){!_p(t,e)&&en[e.type]&&(t.editable||!(e.type in tn))&&en[e.type](t,e)}tn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!z1(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(gr&&jt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ei&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,vo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||FL(t,n)?n.preventDefault():yr(t,"key")};tn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};tn.keypress=(t,e)=>{let n=e;if(z1(t)||!n.charCode||n.ctrlKey&&!n.altKey||In&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ye)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function ca(t){return{left:t.clientX,top:t.clientY}}function qL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Wp(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let l=i.depth+1;l>0;l--)if(t.someProp(e,a=>l>i.depth?a(t,n,i.nodeAfter,i.before(l),o,!0):a(t,n,i.node(l),i.before(l),o,!1)))return!0;return!1}function da(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function ZL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ie.isSelectable(r)?(da(t,new Ie(n)),!0):!1}function KL(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Ie&&(r=n.node);let i=t.state.doc.resolve(e);for(let l=i.depth+1;l>0;l--){let a=l>i.depth?i.nodeAfter:i.node(l);if(Ie.isSelectable(a)){r&&n.$from.depth>0&&l>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(l);break}}return o!=null?(da(t,Ie.create(t.state.doc,o)),!0):!1}function UL(t,e,n,r,o){return Wp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?KL(t,n):ZL(t,n))}function XL(t,e,n,r){return Wp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function GL(t,e,n,r){return Wp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||YL(t,n,r)}function YL(t,e,n){if(n.button!=0)return!1;let r=B1(t,e,!0),o=t.state.doc;return r?(da(t,r),r instanceof ye&&o.eq(t.state.doc)&&(t.input.mouseDown=new QL(t,r)),!0):!1}function B1(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?ye.create(r,0,r.content.size):null;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let l=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(l.inlineContent)return ye.create(r,a+1,a+1+l.content.size);if(n&&Ie.isSelectable(l))return Ie.create(r,a)}return null}function Vp(t){return qs(t)}const O1=In?"metaKey":"ctrlKey";en.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Vp(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&qL(n,t.input.lastClick)&&!n[O1]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let l=t.posAtCoords(ca(n));l&&(i=="singleClick"?t.input.mouseDown=new JL(t,l,n,!!r):(i=="doubleClick"?XL:GL)(t,l.pos,l.inside,n)?n.preventDefault():yr(t,"pointer"))};class j1{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class JL extends j1{constructor(e,n,r,o){super(e),this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[O1],this.allowDefault=r.shiftKey;let i,l;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),l=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,l=d.depth?d.before():0}const a=o?null:r.target,s=a?e.docView.nearestDesc(a,!0):null;this.target=s&&Te(s.nodeDOM)?s.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Ie&&c.from<=l&&c.to>l)&&(this.mightDrag={node:i,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&kn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),yr(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||kr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(ca(e))),this.updateAllowDefault(e),this.allowDefault||!n?yr(this.view,"pointer"):UL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Kt&&this.mightDrag&&!this.mightDrag.node.isAtom||jt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(da(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):yr(this.view,"pointer")}move(e){this.updateAllowDefault(e),yr(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class QL extends j1{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),yr(this.view,"pointer");let n=this.view.posAtCoords(ca(e)),r=n&&B1(this.view,n.inside,!1);if(!r)return;let{doc:o}=this.view.state,i=this.startSelection,[l,a]=r.from<i.from?[i.to,r.from]:[i.from,r.to];da(this.view,ye.create(o,l,a))}}en.touchstart=t=>{t.input.lastTouch=Date.now(),Vp(t),yr(t,"pointer")};en.touchmove=t=>{t.input.lastTouch=Date.now(),yr(t,"pointer")};en.contextmenu=t=>Vp(t);function z1(t,e){return t.composing?!0:Kt&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const eB=gr?5e3:-1;tn.compositionstart=tn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ye&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||jt&&m1&&tB(t)))t.markCursor=t.state.storedMarks||n.marks(),qs(t,!0),t.markCursor=null;else if(qs(t,!e.selection.empty),kn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&Te(o)&&i!=0;){let l=i<0?o.lastChild:o.childNodes[i-1];if(!l)break;if(Mt(l)){let a=t.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else o=l,i=-1}}t.input.composing=!0}H1(t,eB)};function tB(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||!Te(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return Te(r)&&r.contentEditable=="false"}tn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,H1(t,20))};function H1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qs(t),e))}function _1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function nB(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=K4(e.focusNode,e.focusOffset),r=U4(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function qs(t,e=!1){if(!(gr&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),_1(t),e||t.docView&&t.docView.dirty){let n=jp(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function rB(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ql=sn&&Kr<15||Ei&&J4<604;en.copy=tn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=ql?null:n.clipboardData,l=r.content(),{dom:a,text:s}=Hp(t,l);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",s)):rB(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function oB(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function iB(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Zl(t,r.value,null,o,e):Zl(t,r.textContent,r.innerHTML,o,e)},50)}function Zl(t,e,n,r,o){let i=E1(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",s=>s(t,o,i||he.empty)))return!0;if(!i)return!1;let l=oB(i),a=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function W1(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}tn.paste=(t,e)=>{let n=e;if(t.composing&&!gr)return;let r=ql?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Zl(t,W1(r),r.getData("text/html"),o,n)?n.preventDefault():iB(t,n)};class V1{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const lB=In?"altKey":"ctrlKey";function q1(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[lB]}en.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(ca(n)),l;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Ie?o.to-1:o.to))){if(r&&r.mightDrag)l=Ie.create(t.state.doc,r.mightDrag.pos);else if(n.target&&Te(n.target)){let u=t.docView.nearestDesc(n.target,!0);u&&u.node.type.spec.draggable&&u!=t.docView&&(l=Ie.create(t.state.doc,u.posBefore))}}let a=(l||t.state.selection).content(),{dom:s,text:c,slice:d}=Hp(t,a);(!n.dataTransfer.files.length||!jt||h1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ql?"Text":"text/html",s.innerHTML),n.dataTransfer.effectAllowed="copyMove",ql||n.dataTransfer.setData("text/plain",c),t.dragging=new V1(d,q1(t,n),l)};en.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};tn.dragover=tn.dragenter=(t,e)=>e.preventDefault();tn.drop=(t,e)=>{try{aB(t,e,t.dragging)}finally{t.dragging=null}};function aB(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ca(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=E1(t,W1(e.dataTransfer),ql?null:e.dataTransfer.getData("text/html"),!1,o);let l=!!(n&&q1(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||he.empty,l))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?xx(t.state.doc,o.pos,i):o.pos;a==null&&(a=o.pos);let s=t.state.tr;if(l){let{node:h}=n;h?h.replace(s):s.deleteSelection()}let c=s.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,u=s.doc;if(d?s.replaceRangeWith(c,c,i.content.firstChild):s.replaceRange(c,c,i),s.doc.eq(u))return;let f=s.doc.resolve(c);if(d&&Ie.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))s.setSelection(new Ie(f));else{let h=s.mapping.map(a);s.mapping.maps[s.mapping.maps.length-1].forEach((p,m,y,w)=>h=w),s.setSelection(zp(t,f,s.doc.resolve(h)))}t.focus(),t.dispatch(s.setMeta("uiEvent","drop"))}en.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&kr(t)},20))};en.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};en.beforeinput=(t,e)=>{if(gr&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,vo(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in tn)en[t]=tn[t];function Kl(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Zs{constructor(e,n){this.toDOM=e,this.spec=n||Po,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:l}=e.mapResult(n.from+o,this.side<0?-1:1);return l?null:new Jt(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Zs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Kl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Gr{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=l?null:new Jt(i,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Gr&&Kl(this.attrs,e.attrs)&&Kl(this.spec,e.spec)}static is(e){return e.type instanceof Gr}destroy(){}}class qp{constructor(e,n){this.attrs=e,this.spec=n||Po}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let l=e.mapResult(n.to+o,-1);return l.deleted||l.pos<=i.pos?null:new Jt(i.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof qp&&Kl(this.attrs,e.attrs)&&Kl(this.spec,e.spec)}destroy(){}}class Jt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Jt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Jt(e,e,new Zs(n,r))}static inline(e,n,r,o){return new Jt(e,n,new Gr(r,o))}static node(e,n,r,o){return new Jt(e,n,new qp(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Gr}get widget(){return this.type instanceof Zs}}const pi=[],Po={};class ft{constructor(e,n){this.local=e.length?e:pi,this.children=n.length?n:pi}static create(e,n){return n.length?Ks(n,e,0,Po):qt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let l=0;l<this.local.length;l++){let a=this.local[l];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let a=this.children[l]+1;this.children[l+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==qt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Po)}mapInner(e,n,r,o,i){let l;for(let a=0;a<this.local.length;a++){let s=this.local[a].map(e,r,o);s&&s.type.valid(n,s)?(l||(l=[])).push(s):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?sB(this.children,l||[],e,n,r,o,i):l?new ft(l.sort(Eo),pi):qt}add(e,n){return n.length?this==qt?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,s)=>{let c=s+r,d;if(d=K1(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<s;)i+=3;o[i]==s?o[i+2]=o[i+2].addInner(a,d,c+1):o.splice(i,0,s,s+a.nodeSize,Ks(d,a,c+1,Po)),i+=3}});let l=Z1(i?U1(n):n,-r);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||l.splice(a--,1);return new ft(l.length?this.local.concat(l).sort(Eo):this.local,o||this.children)}remove(e){return e.length==0||this==qt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let l,a=r[i]+n,s=r[i+1]+n;for(let d=0,u;d<e.length;d++)(u=e[d])&&u.from>a&&u.to<s&&(e[d]=null,(l||(l=[])).push(u));if(!l)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(l,a+1);c!=qt?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,l;i<e.length;i++)if(l=e[i])for(let a=0;a<o.length;a++)o[a].eq(l,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ft(o,r):qt}forChild(e,n){if(this==qt)return this;if(n.isLeaf)return ft.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,l=i+n.content.size;for(let a=0;a<this.local.length;a++){let s=this.local[a];if(s.from<l&&s.to>i&&s.type instanceof Gr){let c=Math.max(i,s.from)-i,d=Math.min(l,s.to)-i;c<d&&(o||(o=[])).push(s.copy(c,d))}}if(o){let a=new ft(o.sort(Eo),pi);return r?new jr([a,r]):a}return r||qt}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Zp(this.localsInner(e))}localsInner(e){if(this==qt)return pi;if(e.inlineContent||!this.local.some(Gr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Gr||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]);ft.removeOverlap=Zp;const qt=ft.empty;class jr{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Po));return jr.from(r)}forChild(e,n){if(n.isLeaf)return ft.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=qt&&(i instanceof jr?r=r.concat(i.members):r.push(i))}return jr.from(r)}eq(e){if(!(e instanceof jr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let l=0;l<i.length;l++)n.push(i[l])}}return n?Zp(r?n:n.sort(Eo)):pi}static from(e){switch(e.length){case 0:return qt;case 1:return e[0];default:return new jr(e.every(n=>n instanceof ft)?e:e.reduce((n,r)=>n.concat(r instanceof ft?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function sB(t,e,n,r,o,i,l){let a=t.slice();for(let c=0,d=i;c<n.maps.length;c++){let u=0;n.maps[c].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let w=0;w<a.length;w+=3){let C=a[w+1];if(C<0||f>C+d-u)continue;let g=a[w]+d-u;h>=g?a[w+1]=f<=g?-2:-1:f>=d&&y&&(a[w]+=y,a[w+1]+=y)}u+=y}),d=n.maps[c].map(d,-1)}let s=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){s=!0,a[c+1]=-1;continue}let d=n.map(t[c]+i),u=d-o;if(u<0||u>=r.content.size){s=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(u),y=r.maybeChild(p);if(y&&m==u&&m+y.nodeSize==h){let w=a[c+2].mapInner(n,y,d+1,t[c]+i+1,l);w!=qt?(a[c]=u,a[c+1]=h,a[c+2]=w):(a[c+1]=-2,s=!0)}else s=!0}if(s){let c=cB(a,t,e,n,o,i,l),d=Ks(c,r,0,l);e=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,f=0;u<d.children.length;u+=3){let h=d.children[u];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,d.children[u],d.children[u+1],d.children[u+2])}}return new ft(e.sort(Eo),a)}function Z1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Jt(o.from+e,o.to+e,o.type))}return n}function cB(t,e,n,r,o,i,l){function a(s,c){for(let d=0;d<s.local.length;d++){let u=s.local[d].map(r,o,c);u?n.push(u):l.onRemove&&l.onRemove(s.local[d].spec)}for(let d=0;d<s.children.length;d+=3)a(s.children[d+2],s.children[d]+c+1)}for(let s=0;s<t.length;s+=3)t[s+1]==-1&&a(t[s+2],e[s]+i+1);return n}function K1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,l;i<t.length;i++)(l=t[i])&&l.from>n&&l.to<r&&((o||(o=[])).push(l),t[i]=null);return o}function U1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ks(t,e,n,r){let o=[],i=!1;e.forEach((a,s)=>{let c=K1(t,a,s+n);if(c){i=!0;let d=Ks(c,a,n+s+1,r);d!=qt&&o.push(s,s+a.nodeSize,d)}});let l=Z1(i?U1(t):t,-n).sort(Eo);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||(r.onRemove&&r.onRemove(l[a].spec),l.splice(a--,1));return l.length||o.length?new ft(l,o):qt}function Eo(t,e){return t.from-e.from||t.to-e.to}function Zp(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),p0(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),p0(e,o,r.copy(i.from,r.to)));break}}}return e}function p0(t,e,n){for(;e<t.length&&Eo(n,t[e])>0;)e++;t.splice(e,0,n)}function tu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=qt&&e.push(r)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),jr.from(e)}const dB={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},uB=sn&&Kr<=11;class fB{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class pB{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new fB,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);sn&&Kr<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Kt&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),uB&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,dB)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(l0(this.view)){if(this.suppressingSelectionUpdates)return kr(this.view);if(sn&&Kr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Wo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Pi(i))n.add(i);for(let i=e.anchorNode;i;i=Pi(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:Mt(r)?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&l0(e)&&!this.ignoreSelectionChange(r),i=-1,l=-1,a=!1,s=[];if(e.editable)for(let d=0;d<n.length;d++){let u=this.registerMutation(n[d],s);u&&(i=i<0?u.from:Math.min(u.from,i),l=l<0?u.to:Math.max(u.to,l),u.typeOver&&(a=!0))}if(s.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||jt&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of s)if(d.nodeName=="BR"&&d.parentNode){let u=d.nextSibling;for(;u&&Te(u);){if(u.contentEditable=="false"){d.parentNode.removeChild(d);break}u=u.firstChild}}}else if(kn&&s.length){let d=s.filter(u=>u.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let h=f.parentNode;h&&h.nodeName=="LI"&&(!u||gB(e,u)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Bc(r)&&(c=jp(e))&&c.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,kr(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,l),hB(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,yB(e,s)),this.handleDOMChange(i,l,a,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||kr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let u=e.addedNodes[d];n.push(u),Mt(u)&&(this.lastChangedTextNode=u)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(sn&&Kr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:u,nextSibling:f}=e.addedNodes[d];(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(o=u),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let l=o&&o.parentNode==e.target?Ot(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),s=i&&i.parentNode==e.target?Ot(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,s,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let h0=new WeakMap,m0=!1;function hB(t){if(!h0.has(t)&&(h0.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=kn,m0)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),m0=!0}}function g0(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return Wo(l.node,l.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function mB(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return g0(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?g0(t,n):null}function gB(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function yB(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=i.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let a=l;for(;;){let s=a.firstChild;if(!s||!Te(s)||s.contentEditable=="false"||/^(BR|IMG)$/.test(s.nodeName))break;a=s}a.insertBefore(i,a.firstChild),r==i&&t.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function bB(t,e,n,r){let{node:o,fromOffset:i,toOffset:l,from:a,to:s}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&Vo(t.dom,u)&&(d=[{node:u,offset:c.anchorOffset}],Bc(c)||d.push({node:c.focusNode,offset:c.focusOffset})),jt&&t.input.lastKeyCode===8)for(let w=l;w>i;w--){let C=o.childNodes[w-1],g=C.pmViewDesc;if(C.nodeName=="BR"&&!g){l=w;break}if(!g||g.size)break}let f=t.state.doc,h=t.someProp("domParser")||cx.fromSchema(t.state.schema),p=f.resolve(a),m=null,y=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:l,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:wB(r),context:p});if(d&&d[0].pos!=null){let w=d[0].pos,C=d[1]&&d[1].pos;C==null&&(C=w),m={anchor:w+a,head:C+a}}return{doc:y,sel:m,from:a,to:s}}const wB=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(Kt&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||Kt&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},xB=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function vB(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let T=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=jp(t,T);if($&&!t.state.selection.eq($)){if(jt&&gr&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",I=>I(t,vo(13,"Enter"))))return;let M=t.state.tr.setSelection($);T=="pointer"?M.setMeta("pointer",!0):T=="key"&&M.scrollIntoView(),i&&M.setMeta("composition",i),t.dispatch(M)}return}let l=t.state.doc.resolve(e),a=l.sharedDepth(n);e=l.before(a+1),n=t.state.doc.resolve(n).after(a+1);let s=t.state.selection,c=bB(t,e,n,o),d=t.state.doc,u=d.slice(c.from,c.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=TB(u.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Ei&&t.input.lastIOSEnter>Date.now()-225||gr)&&o.some(T=>Te(T)&&!xB.test(T.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",T=>T(t,vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&s instanceof ye&&!s.empty&&s.$head.sameParent(s.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:s.from,endA:s.to,endB:s.to};else{if(c.sel){let T=y0(t,t.state.doc,c.sel);if(T&&!T.eq(t.state.selection)){let $=t.state.tr.setSelection(T);i&&$.setMeta("composition",i),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ye&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),sn&&Kr<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),w=d.resolve(p.start),C=m.sameParent(y)&&m.parent.inlineContent&&w.end()>=p.endA;if((Ei&&t.input.lastIOSEnter>Date.now()-225&&(!C||o.some(T=>T.nodeName=="DIV"||T.nodeName=="P"))||!C&&SB(c.doc,m.pos,y.pos))&&t.someProp("handleKeyDown",T=>T(t,vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&CB(d,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",T=>T(t,vo(8,"Backspace")))){gr&&jt&&t.domObserver.suppressSelectionUpdates();return}jt&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),gr&&!C&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(T){return T(t,vo(13,"Enter"))})},20));let g=p.start,v=p.endA,k=T=>{let $=T||t.state.tr.replace(g,v,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let M=y0(t,$.doc,c.sel);M&&!(jt&&t.composing&&M.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(M.head==g||M.head==$.mapping.map(v)-1)||sn&&M.empty&&M.head==g)&&$.setSelection(M)}return i&&$.setMeta("composition",i),$.scrollIntoView()},x;if(C)if(m.pos==y.pos){sn&&Kr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>kr(t),20));let T=k(t.state.tr.delete(g,v)),$=d.resolve(p.start).marksAcross(d.resolve(p.endA));$&&T.ensureMarks($),t.dispatch(T)}else if(p.endA==p.endB&&(x=kB(m.parent.content.cut(m.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,p.endA-w.start())))){let T=k(t.state.tr);x.type=="add"?T.addMark(g,v,x.mark):T.removeMark(g,v,x.mark),t.dispatch(T)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let T=m.parent.textBetween(m.parentOffset,y.parentOffset),$=()=>k(t.state.tr.insertText(T,g,v));t.someProp("handleTextInput",M=>M(t,g,v,T,$))||t.dispatch($())}else t.dispatch(k());else t.dispatch(k())}function y0(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:zp(t,e.resolve(n.anchor),e.resolve(n.head))}function kB(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,l,a,s;for(let d=0;d<r.length;d++)o=r[d].removeFromSet(o);for(let d=0;d<n.length;d++)i=n[d].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],l="add",s=d=>d.mark(a.addToSet(d.marks));else if(o.length==0&&i.length==1)a=i[0],l="remove",s=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<e.childCount;d++)c.push(s(e.child(d)));if(oe.from(c).eq(t))return{mark:a,type:l}}function CB(t,e,n,r,o){if(n-e<=o.pos-r.pos||nu(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let l=t.resolve(nu(i,!0,!0));return!l.parent.isTextblock||l.pos>n||nu(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function SB(t,e,n){let r=0,o=0;return t.nodesBetween(e,n,(i,l)=>{i.isTextblock&&l>=e&&l<n?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-l),Math.min(i.nodeSize,n-l))):i.isLeaf)&&o++}),o==0&&r==1}function nu(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function TB(t,e,n,r,o){let i=t.findDiffStart(e,n),l=n+t.size,a=n+e.size;if(i==null)return null;let{a:s,b:c}=t.findDiffEnd(e,l,a);if(o=="end"){let d=Math.max(0,i-Math.min(s,c));r-=s+d-i}if(s<i&&l<a){let d=r<=i&&r>=s?i-r:0;i-=d,c=i+(c-s),s=i}else if(c<i){let d=r<=i&&r>=c?i-r:0;i-=d,s=i+(s-c),c=i}return{start:i,endA:s,endB:c}}class Kp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new zL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(k0),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=x0(this),w0(this),this.nodeViews=v0(this),this.docView=e0(this.state.doc,b0(this),tu(this),this.dom,this),this.domObserver=new pB(this,(r,o,i,l)=>vB(this,r,o,i,l)),this.domObserver.start(),HL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ff(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(k0),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,l=!1;e.storedMarks&&this.composing&&(_1(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=v0(this);IB(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ff(this),this.editable=x0(this),w0(this);let s=tu(this),c=b0(this),d=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",u=i||!this.docView.matchesNode(e.doc,c,s);(u||!e.selection.eq(o.selection))&&(l=!0);let f=d=="preserve"&&l&&this.dom.style.overflowAnchor==null&&tL(this);if(l){this.domObserver.stop();let h=u&&(sn||jt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&$B(o.selection,e.selection);if(u){let m=jt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=nB(this)),(i||!this.docView.update(e.doc,c,s,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=e0(e.doc,c,s,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&TL(this)&&p.delaySelUpdate())?kr(this,h):(M1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&nL(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!Vo(this.dom,e))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ie){let n=this.docView.domAfterPos(this.state.selection.from);Te(n)&&Xg(this,n.getBoundingClientRect(),e)}else Xg(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new V1(e.slice,e.move,o<0?void 0:Ie.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let l=0;l<i.length;l++){let a=i[l].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(sn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&rL(this.dom),kr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return sL(this,e)}coordsAtPos(e,n=1){return x1(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return pL(this,n||this.state,e)}pasteHTML(e,n){return Zl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Zl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Hp(this,e)}destroy(){this.docView&&(_L(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],tu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,q4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return VL(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?Kt&&this.root.nodeType===11&&G4(this.dom.ownerDocument)==this.dom&&mB(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Kp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function b0(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Jt.node(0,t.state.doc.content.size,e)]}function w0(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Jt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function x0(t){return!t.someProp("editable",e=>e(t.state)===!1)}function $B(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function v0(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function IB(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function k0(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const MB=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),RB=typeof navigator<"u"&&/Win/.test(navigator.platform);function PB(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,l;for(let a=0;a<e.length-1;a++){let s=e[a];if(/^(cmd|meta|m)$/i.test(s))l=!0;else if(/^a(lt)?$/i.test(s))r=!0;else if(/^(c|ctrl|control)$/i.test(s))o=!0;else if(/^s(hift)?$/i.test(s))i=!0;else if(/^mod$/i.test(s))MB?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+s)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),l&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function EB(t){let e=Object.create(null);for(let n in t)e[PB(n)]=t[n];return e}function ru(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function FB(t){return new zt({props:{handleKeyDown:X1(t)}})}function X1(t){let e=EB(t);return function(n,r){let o=n$(r),i,l=e[ru(o,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[ru(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(RB&&r.ctrlKey&&r.altKey)&&(i=r$[r.keyCode])&&i!=o){let a=e[ru(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}let pf,hf;if(typeof WeakMap<"u"){let t=new WeakMap;pf=e=>t.get(e),hf=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;pf=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},hf=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var xt=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,l=o+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;l<this.height&&this.map[e+this.width*a]==n;a++)l++;return{left:r,top:o,right:i,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:i,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:l==this.height)?null:this.map[r+this.width*(n<0?i-1:l)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:l,right:a,top:s,bottom:c}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(o,s),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const i=r*this.width+o,l=this.map[i];n[l]||(n[l]=!0,!(o==t.left&&o&&this.map[i-1]==l||r==t.top&&r&&this.map[i-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const a=(t+1)*this.width;for(;l<a&&this.map[l]<o;)l++;return l==a?i-1:this.map[l]}o=i}}static get(t){return pf(t)||hf(t,AB(t))}};function AB(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=DB(t),n=t.childCount,r=[];let o=0,i=null;const l=[];for(let c=0,d=e*n;c<d;c++)r[c]=0;for(let c=0,d=0;c<n;c++){const u=t.child(c);d++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==u.childCount)break;const m=u.child(p),{colspan:y,rowspan:w,colwidth:C}=m.attrs;for(let g=0;g<w;g++){if(g+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:w-g});break}const v=o+g*e;for(let k=0;k<y;k++){r[v+k]==0?r[v+k]=d:(i||(i=[])).push({type:"collision",row:c,pos:d,n:y-k});const x=C&&C[k];if(x){const T=(v+k)%e*2,$=l[T];$==null||$!=x&&l[T+1]==1?(l[T]=x,l[T+1]=1):$==x&&l[T+1]++}}}o+=y,d+=m.nodeSize}const f=(c+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),d++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new xt(e,n,r,i);let s=!1;for(let c=0;!s&&c<l.length;c+=2)l[c]!=null&&l[c+1]<n&&(s=!0);return s&&NB(a,l,t),a}function DB(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let i=0;if(n)for(let l=0;l<r;l++){const a=t.child(l);for(let s=0;s<a.childCount;s++){const c=a.child(s);l+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let l=0;l<o.childCount;l++){const a=o.child(l);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function NB(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const i=t.map[o];if(r[i])continue;r[i]=!0;const l=n.nodeAt(i);if(!l)throw new RangeError(`No cell with offset ${i} found`);let a=null;const s=l.attrs;for(let c=0;c<s.colspan;c++){const d=e[(o+c)%t.width*2];d!=null&&(!s.colwidth||s.colwidth[c]!=d)&&((a||(a=LB(s)))[c]=d)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function LB(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Wn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}const zr=new fn("selectingCells");function qo(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function BB(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Up(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function G1(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=qo(e.$head)||OB(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function OB(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function mf(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Xp(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Y1(t,e,n){const r=t.node(-1),o=xt.get(r),i=t.start(-1),l=o.nextCell(t.pos-i,e,n);return l==null?null:t.node(0).resolve(i+l)}function Fi(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function jB(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}var Ve=class cr extends Le{constructor(e,n=e){const r=e.node(-1),o=xt.get(r),i=e.start(-1),l=o.rectBetween(e.pos-i,n.pos-i),a=e.node(0),s=o.cellsInRect(l).filter(d=>d!=n.pos-i);s.unshift(n.pos-i);const c=s.map(d=>{const u=r.nodeAt(d);if(!u)throw new RangeError(`No cell with offset ${d} found`);const f=i+d+1;return new $x(a.resolve(f),a.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(mf(r)&&mf(o)&&Xp(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?cr.rowSelection(r,o):i&&this.isColSelection()?cr.colSelection(r,o):new cr(r,o)}return ye.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=xt.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},l=[];for(let s=o.top;s<o.bottom;s++){const c=[];for(let d=s*n.width+o.left,u=o.left;u<o.right;u++,d++){const f=n.map[d];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=o.left-h.left,y=h.right-o.right;if(m>0||y>0){let w=p.attrs;if(m>0&&(w=Fi(w,0,m)),y>0&&(w=Fi(w,w.colspan-y,y)),h.left<o.left){if(p=p.type.createAndFill(w),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<o.top||h.bottom>o.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}l.push(e.child(s).copy(oe.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new he(oe.from(a),1,1)}replace(e,n=he.empty){const r=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){const{$from:a,$to:s}=o[l],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(s.pos),l?he.empty:n)}const i=Le.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new he(oe.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=xt.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let l=0;l<i.length;l++)e(n.nodeAt(i[l]),o+i[l])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=xt.get(r),i=e.start(-1),l=o.findCell(e.pos-i),a=o.findCell(n.pos-i),s=e.node(0);return l.top<=a.top?(l.top>0&&(e=s.resolve(i+o.map[l.left])),a.bottom<o.height&&(n=s.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=s.resolve(i+o.map[a.left])),l.bottom<o.height&&(e=s.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))),new cr(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=xt.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const l=o+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==n.width}eq(e){return e instanceof cr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=xt.get(r),i=e.start(-1),l=o.findCell(e.pos-i),a=o.findCell(n.pos-i),s=e.node(0);return l.left<=a.left?(l.left>0&&(e=s.resolve(i+o.map[l.top*o.width])),a.right<o.width&&(n=s.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=s.resolve(i+o.map[a.top*o.width])),l.right<o.width&&(e=s.resolve(i+o.map[o.width*(l.top+1)-1]))),new cr(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new cr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new cr(e.resolve(n),e.resolve(r))}getBookmark(){return new zB(this.$anchorCell.pos,this.$headCell.pos)}};Ve.prototype.visible=!1;Le.jsonID("cell",Ve);var zB=class J1{constructor(e,n){this.anchor=e,this.head=n}map(e){return new J1(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Xp(n,r)?new Ve(n,r):Le.near(r,1)}};function HB(t){if(!(t.selection instanceof Ve))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ft.create(t.doc,e)}function _B({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function WB({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function VB(t,e,n){const r=(e||t).selection,o=(e||t).doc;let i,l;if(r instanceof Ie&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")i=Ve.create(o,r.from);else if(l=="row"){const a=o.resolve(r.from+1);i=Ve.rowSelection(a,a)}else if(!n){const a=xt.get(r.node),s=r.from+1,c=s+a.map[a.width*a.height-1];i=Ve.create(o,s+1,c)}}else r instanceof ye&&_B(r)?i=ye.create(o,r.from):r instanceof ye&&WB(r)&&(i=ye.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const qB=new fn("fix-tables");function Q1(t,e,n,r){const o=t.childCount,i=e.childCount;e:for(let l=0,a=0;l<i;l++){const s=e.child(l);for(let c=a,d=Math.min(o,l+3);c<d;c++)if(t.child(c)==s){a=c+1,n+=s.nodeSize;continue e}r(s,n),a<o&&t.child(a).sameMarkup(s)?Q1(t.child(a),s,n+1,r):s.nodesBetween(0,s.content.size,r,n+1),n+=s.nodeSize}}function ZB(t,e){let n;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=KB(t,o,i,n))};return e?e.doc!=t.doc&&Q1(e.doc,t.doc,0,r):t.doc.descendants(r),n}function KB(t,e,n,r){const o=xt.get(e);if(!o.problems)return r;r||(r=t.tr);const i=[];for(let s=0;s<o.height;s++)i.push(0);for(let s=0;s<o.problems.length;s++){const c=o.problems[s];if(c.type=="collision"){const d=e.nodeAt(c.pos);if(!d)continue;const u=d.attrs;for(let f=0;f<u.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Fi(u,u.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const d=e.nodeAt(c.pos);if(!d)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...d.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const d=r.mapping.map(n);r.delete(d,d+e.nodeSize)}}let l,a;for(let s=0;s<i.length;s++)i[s]&&(l==null&&(l=s),a=s);for(let s=0,c=n+1;s<o.height;s++){const d=e.child(s),u=c+d.nodeSize,f=i[s];if(f>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<f;y++){const w=Wn(t.schema)[h].createAndFill();w&&p.push(w)}const m=(s==0||l==s-1)&&a==s?c+1:u-1;r.insert(r.mapping.map(m),p)}c=u}return r.setMeta(qB,{fixTables:!0})}function ua(t){const e=t.selection,n=G1(t),r=n.node(-1),o=n.start(-1),i=xt.get(r);return{...e instanceof Ve?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function C0(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function UB({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,l=(r.bottom-1)*t+r.left,a=o+(r.right-r.left-1);for(let s=r.top;s<r.bottom;s++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[a]==n[a+1])return!0;i+=t,a+=t}for(let s=r.left;s<r.right;s++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[l]==n[l+t])return!0;o++,l++}return!1}function XB(t,e){const n=t.selection;if(!(n instanceof Ve)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=ua(t),{map:o}=r;if(UB(o,r))return!1;if(e){const i=t.tr,l={};let a=oe.empty,s,c;for(let d=r.top;d<r.bottom;d++)for(let u=r.left;u<r.right;u++){const f=o.map[d*o.width+u],h=r.table.nodeAt(f);if(!(l[f]||!h))if(l[f]=!0,s==null)s=f,c=h;else{C0(h)||(a=a.append(h.content));const p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(s==null||c==null)return!0;if(i.setNodeMarkup(s+r.tableStart,null,{...jB(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const d=s+1+c.content.size,u=C0(c)?s+1:d;i.replaceWith(u+r.tableStart,d+r.tableStart,a)}i.setSelection(new Ve(i.doc.resolve(s+r.tableStart))),e(i)}return!0}function GB(t,e){const n=Wn(t.schema);return YB(({node:r})=>n[r.type.spec.tableRole])(t,e)}function YB(t){return(e,n)=>{const r=e.selection;let o,i;if(r instanceof Ve){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var l;if(o=BB(r.$from),!o)return!1;i=(l=qo(r.$from))===null||l===void 0?void 0:l.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let a=o.attrs;const s=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const d=ua(e),u=e.tr;for(let h=0;h<d.right-d.left;h++)s.push(c?{...a,colwidth:c&&c[h]?[c[h]]:null}:a);let f;for(let h=d.top;h<d.bottom;h++){let p=d.map.positionAt(h,d.left,d.table);h==d.top&&(p+=o.nodeSize);for(let m=d.left,y=0;m<d.right;m++,y++)m==d.left&&h==d.top||u.insert(f=u.mapping.map(p+d.tableStart,1),t({node:o,row:h,col:m}).createAndFill(s[y]))}u.setNodeMarkup(i,t({node:o,row:d.top,col:d.left}),s[0]),r instanceof Ve&&u.setSelection(new Ve(u.doc.resolve(r.$anchorCell.pos),f?u.doc.resolve(f):void 0)),n(u)}return!0}}function JB(t){return function(e,n){if(!Up(e))return!1;if(n){const r=Wn(e.schema),o=ua(e),i=e.tr,l=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=l.map(s=>o.table.nodeAt(s));for(let s=0;s<l.length;s++)a[s].type==r.header_cell&&i.setNodeMarkup(o.tableStart+l[s],r.cell,a[s].attrs);if(i.steps.length===0)for(let s=0;s<l.length;s++)i.setNodeMarkup(o.tableStart+l[s],r.header_cell,a[s].attrs);n(i)}return!0}}function S0(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function Gp(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?JB(t):function(n,r){if(!Up(n))return!1;if(r){const o=Wn(n.schema),i=ua(n),l=n.tr,a=S0("row",i,o),s=S0("column",i,o),c=(t==="column"?a:t==="row"&&s)?1:0,d=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,u=t=="column"?s?o.cell:o.header_cell:t=="row"?a?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(f=>{const h=f+i.tableStart,p=l.doc.nodeAt(h);p&&l.setNodeMarkup(h,u,p.attrs)}),r(l)}return!0}}Gp("row",{useDeprecatedLogic:!0});Gp("column",{useDeprecatedLogic:!0});Gp("cell",{useDeprecatedLogic:!0});function Wa(t,e){const n=t.selection;if(!(n instanceof Ve))return!1;if(e){const r=t.tr,o=Wn(t.schema).cell.createAndFill().content;n.forEachCell((i,l)=>{i.content.eq(o)||r.replace(r.mapping.map(l+1),r.mapping.map(l+i.nodeSize-1),new he(o,0,0))}),r.docChanged&&e(r)}return!0}function QB(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,l=o.type.schema,a=[];if(i=="row")for(let s=0;s<e.childCount;s++){let c=e.child(s).content;const d=s?0:Math.max(0,n-1),u=s<e.childCount-1?0:Math.max(0,r-1);(d||u)&&(c=gf(Wn(l).row,new he(c,d,u)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?gf(Wn(l).row,new he(e,n,r)).content:e);else return null;return eO(l,a)}function eO(t,e){const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(let l=i.childCount-1;l>=0;l--){const{rowspan:a,colspan:s}=i.child(l).attrs;for(let c=o;c<o+a;c++)n[c]=(n[c]||0)+s}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(oe.empty),n[o]<r){const i=Wn(t).cell.createAndFill(),l=[];for(let a=n[o];a<r;a++)l.push(i);e[o]=e[o].append(oe.from(l))}return{height:e.length,width:r,rows:e}}function gf(t,e){const n=t.createAndFill();return new Tx(n).replace(0,n.content.size,e).doc}function tO({width:t,height:e,rows:n},r,o){if(t!=r){const i=[],l=[];for(let a=0;a<n.length;a++){const s=n[a],c=[];for(let d=i[a]||0,u=0;d<r;u++){let f=s.child(u%s.childCount);d+f.attrs.colspan>r&&(f=f.type.createChecked(Fi(f.attrs,f.attrs.colspan,d+f.attrs.colspan-r),f.content)),c.push(f),d+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+f.attrs.colspan}l.push(oe.from(c))}n=l,t=r}if(e!=o){const i=[];for(let l=0,a=0;l<o;l++,a++){const s=[],c=n[a%e];for(let d=0;d<c.childCount;d++){let u=c.child(d);l+u.attrs.rowspan>o&&(u=u.type.create({...u.attrs,rowspan:Math.max(1,o-u.attrs.rowspan)},u.content)),s.push(u)}i.push(oe.from(s))}n=i,e=o}return{width:t,height:e,rows:n}}function nO(t,e,n,r,o,i,l){const a=t.doc.type.schema,s=Wn(a);let c,d;if(o>e.width)for(let u=0,f=0;u<e.height;u++){const h=n.child(u);f+=h.nodeSize;const p=[];let m;h.lastChild==null||h.lastChild.type==s.cell?m=c||(c=s.cell.createAndFill()):m=d||(d=s.header_cell.createAndFill());for(let y=e.width;y<o;y++)p.push(m);t.insert(t.mapping.slice(l).map(f-1+r),p)}if(i>e.height){const u=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){const y=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==s.header_cell;u.push(y?d||(d=s.header_cell.createAndFill()):c||(c=s.cell.createAndFill()))}const f=s.row.create(null,oe.from(u)),h=[];for(let p=e.height;p<i;p++)h.push(f);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),h)}return!!(c||d)}function T0(t,e,n,r,o,i,l,a){if(l==0||l==e.height)return!1;let s=!1;for(let c=o;c<i;c++){const d=l*e.width+c,u=e.map[d];if(e.map[d-e.width]==u){s=!0;const f=n.nodeAt(u),{top:h,left:p}=e.findCell(u);t.setNodeMarkup(t.mapping.slice(a).map(u+r),null,{...f.attrs,rowspan:l-h}),t.insert(t.mapping.slice(a).map(e.positionAt(l,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-l})),c+=f.attrs.colspan-1}}return s}function $0(t,e,n,r,o,i,l,a){if(l==0||l==e.width)return!1;let s=!1;for(let c=o;c<i;c++){const d=c*e.width+l,u=e.map[d];if(e.map[d-1]==u){s=!0;const f=n.nodeAt(u),h=e.colCount(u),p=t.mapping.slice(a).map(u+r);t.setNodeMarkup(p,null,Fi(f.attrs,l-h,f.attrs.colspan-(l-h))),t.insert(p+f.nodeSize,f.type.createAndFill(Fi(f.attrs,0,l-h))),c+=f.attrs.rowspan-1}}return s}function I0(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let l=xt.get(i);const{top:a,left:s}=r,c=s+o.width,d=a+o.height,u=t.tr;let f=0;function h(){if(i=n?u.doc.nodeAt(n-1):u.doc,!i)throw new Error("No table found");l=xt.get(i),f=u.mapping.maps.length}nO(u,l,i,n,c,d,f)&&h(),T0(u,l,i,n,s,c,a,f)&&h(),T0(u,l,i,n,s,c,d,f)&&h(),$0(u,l,i,n,a,d,s,f)&&h(),$0(u,l,i,n,a,d,c,f)&&h();for(let p=a;p<d;p++){const m=l.positionAt(p,s,i),y=l.positionAt(p,c,i);u.replace(u.mapping.slice(f).map(m+n),u.mapping.slice(f).map(y+n),new he(o.rows[p-a],0,0))}h(),u.setSelection(new Ve(u.doc.resolve(n+l.positionAt(a,s,i)),u.doc.resolve(n+l.positionAt(d-1,c-1,i)))),e(u)}const rO=X1({ArrowLeft:Va("horiz",-1),ArrowRight:Va("horiz",1),ArrowUp:Va("vert",-1),ArrowDown:Va("vert",1),"Shift-ArrowLeft":qa("horiz",-1),"Shift-ArrowRight":qa("horiz",1),"Shift-ArrowUp":qa("vert",-1),"Shift-ArrowDown":qa("vert",1),Backspace:Wa,"Mod-Backspace":Wa,Delete:Wa,"Mod-Delete":Wa});function xs(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Va(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Ve)return xs(n,r,Le.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const l=ek(o,t,e);if(l==null)return!1;if(t=="horiz")return xs(n,r,Le.near(n.doc.resolve(i.head+e),e));{const a=n.doc.resolve(l),s=Y1(a,t,e);let c;return s?c=Le.near(s,1):e<0?c=Le.near(n.doc.resolve(a.before(-1)),-1):c=Le.near(n.doc.resolve(a.after(-1)),1),xs(n,r,c)}}}function qa(t,e){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let l;if(i instanceof Ve)l=i;else{const s=ek(o,t,e);if(s==null)return!1;l=new Ve(n.doc.resolve(s))}const a=Y1(l.$headCell,t,e);return a?xs(n,r,new Ve(l.$anchorCell,a)):!1}}function oO(t,e){const n=t.state.doc,r=qo(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ve(r))),!0):!1}function iO(t,e,n){if(!Up(t.state))return!1;let r=QB(n);const o=t.state.selection;if(o instanceof Ve){r||(r={width:1,height:1,rows:[oe.from(gf(Wn(t.state.schema).cell,n))]});const i=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=xt.get(i).rectBetween(o.$anchorCell.pos-l,o.$headCell.pos-l);return r=tO(r,a.right-a.left,a.bottom-a.top),I0(t.state,t.dispatch,l,a,r),!0}else if(r){const i=G1(t.state),l=i.start(-1);return I0(t.state,t.dispatch,l,xt.get(i.node(-1)).findCell(i.pos-l),r),!0}else return!1}function lO(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=M0(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof Ve)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=qo(t.state.selection.$anchor))!=null&&((n=ou(t,e))===null||n===void 0?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(s,c){let d=ou(t,c);const u=zr.getState(t.state)==null;if(!d||!Xp(s,d))if(u)d=s;else return;const f=new Ve(s,d);if(u||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);u&&h.setMeta(zr,s.pos),t.dispatch(h)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",a),zr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(zr,-1))}function a(s){const c=s,d=zr.getState(t.state);let u;if(d!=null)u=t.state.doc.resolve(d);else if(M0(t,c.target)!=r&&(u=ou(t,e),!u))return l();u&&i(u,c)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",a)}function ek(t,e,n){if(!(t.state.selection instanceof ye))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?l:null}}return null}function M0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ou(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&qo(t.state.doc.resolve(r))||qo(t.state.doc.resolve(o))}var aO=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),yf(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,yf(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function yf(t,e,n,r,o,i){let l=0,a=!0,s=e.firstChild;const c=t.firstChild;if(c){for(let u=0,f=0;u<c.childCount;u++){const{colspan:h,colwidth:p}=c.child(u).attrs;for(let m=0;m<h;m++,f++){const y=o==f?i:p&&p[m],w=y?y+"px":"";if(l+=y||r,y||(a=!1),s)s.style.width!=w&&(s.style.width=w),s=s.nextSibling;else{const C=document.createElement("col");C.style.width=w,e.appendChild(C)}}}for(;s;){var d;const u=s.nextSibling;(d=s.parentNode)===null||d===void 0||d.removeChild(s),s=u}a?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const wn=new fn("tableColumnResizing");function sO({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=aO,lastColumnResizable:o=!0}={}){const i=new zt({key:wn,state:{init(l,a){var s;const c=(s=i.spec)===null||s===void 0||(s=s.props)===null||s===void 0?void 0:s.nodeViews,d=Wn(a.schema).table.name;return r&&c&&(c[d]=(u,f)=>new r(u,n,f)),new cO(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=wn.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{dO(l,a,t,o)},mouseleave:l=>{uO(l)},mousedown:(l,a)=>{fO(l,a,e,n)}},decorations:l=>{const a=wn.getState(l);if(a&&a.activeHandle>-1)return yO(l,a.activeHandle)},nodeViews:{}}});return i}var cO=class vs{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(wn);if(r&&r.setHandle!=null)return new vs(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new vs(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return mf(e.doc.resolve(o))||(o=-1),new vs(o,n.dragging)}return n}};function dO(t,e,n,r){if(!t.editable)return;const o=wn.getState(t.state);if(o&&!o.dragging){const i=hO(e.target);let l=-1;if(i){const{left:a,right:s}=i.getBoundingClientRect();e.clientX-a<=n?l=R0(t,e,"left",n):s-e.clientX<=n&&(l=R0(t,e,"right",n))}if(l!=o.activeHandle){if(!r&&l!==-1){const a=t.state.doc.resolve(l),s=a.node(-1),c=xt.get(s),d=a.start(-1);if(c.colCount(a.pos-d)+a.nodeAfter.attrs.colspan-1==c.width-1)return}tk(t,l)}}}function uO(t){if(!t.editable)return;const e=wn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&tk(t,-1)}function fO(t,e,n,r){var o;if(!t.editable)return!1;const i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,l=wn.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=t.state.doc.nodeAt(l.activeHandle),s=pO(t,l.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(wn,{setDragging:{startX:e.clientX,startWidth:s}}));function c(u){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const f=wn.getState(t.state);f?.dragging&&(mO(t,f.activeHandle,P0(f.dragging,u,n)),t.dispatch(t.state.tr.setMeta(wn,{setDragging:null})))}function d(u){if(!u.which)return c(u);const f=wn.getState(t.state);if(f&&f.dragging){const h=P0(f.dragging,u,n);E0(t,f.activeHandle,h,r)}}return E0(t,l.activeHandle,s,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),e.preventDefault(),!0}function pO(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=t.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let s=0;s<n;s++)r[s]&&(l-=r[s],a--);return l/a}function hO(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function R0(t,e,n,r){const o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:l}=i,a=qo(t.state.doc.resolve(l));if(!a)return-1;if(n=="right")return a.pos;const s=xt.get(a.node(-1)),c=a.start(-1),d=s.map.indexOf(a.pos-c);return d%s.width==0?-1:c+s.map[d-1]}function P0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function tk(t,e){t.dispatch(t.state.tr.setMeta(wn,{setHandle:e}))}function mO(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),i=xt.get(o),l=r.start(-1),a=i.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,s=t.state.tr;for(let c=0;c<i.height;c++){const d=c*i.width+a;if(c&&i.map[d]==i.map[d-i.width])continue;const u=i.map[d],f=o.nodeAt(u).attrs,h=f.colspan==1?0:a-i.colCount(u);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():gO(f.colspan);p[h]=n,s.setNodeMarkup(l+u,null,{...f,colwidth:p})}s.docChanged&&t.dispatch(s)}function E0(t,e,n,r){const o=t.state.doc.resolve(e),i=o.node(-1),l=o.start(-1),a=xt.get(i).colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;let s=t.domAtPos(o.start(-1)).node;for(;s&&s.nodeName!="TABLE";)s=s.parentNode;s&&yf(i,s.firstChild,s,r,a,n)}function gO(t){return Array(t).fill(0)}function yO(t,e){const n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return ft.empty;const i=xt.get(o),l=r.start(-1),a=i.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){const d=a+c*i.width;if((a==i.width-1||i.map[d]!=i.map[d+1])&&(c==0||i.map[d]!=i.map[d-i.width])){var s;const u=i.map[d],f=l+u+o.nodeAt(u).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((s=wn.getState(t))===null||s===void 0)&&s.dragging&&n.push(Jt.node(l+u,l+u+o.nodeAt(u).nodeSize,{class:"column-resize-dragging"})),n.push(Jt.widget(f,h))}}return ft.create(t.doc,n)}function bO({allowTableNodeSelection:t=!1}={}){return new zt({key:zr,state:{init(){return null},apply(e,n){const r=e.getMeta(zr);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:HB,handleDOMEvents:{mousedown:lO},createSelectionBetween(e){return zr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:oO,handleKeyDown:rO,handlePaste:iO},appendTransaction(e,n,r){return VB(r,ZB(r,n),t)}})}function wO(t){switch(t.toLowerCase()){case"solid":return"single";case"double":return"double";case"dotted":return"dotted";case"dashed":return"dashed";case"groove":return"threeDEngrave";case"ridge":return"threeDEmboss";case"inset":return"inset";case"outset":return"outset";default:return"single"}}function xO(t){if(!t)return 8;let e=t.trim().toLowerCase();if(e==="thin")return 4;if(e==="medium")return 8;if(e==="thick")return 16;let n=parseFloat(e);return isNaN(n)?8:e.endsWith("pt")?Math.round(n*8):(e.endsWith("px"),Math.round(n*6))}function nk(t){if(!t||t==="transparent"||t==="inherit")return null;let e=t.match(/#([0-9a-fA-F]{6})/);if(e)return{rgb:e[1].toUpperCase()};let n=t.match(/#([0-9a-fA-F]{3})$/);if(n){let[o,i,l]=n[1];return{rgb:(o+o+i+i+l+l).toUpperCase()}}let r=t.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return r?{rgb:[r[1],r[2],r[3]].map(o=>parseInt(o).toString(16).padStart(2,"0")).join("").toUpperCase()}:null}function vO(t){let e=(l,a,s)=>{if(!(!l||l==="none"||l==="hidden"))return{style:wO(l),color:nk(a)||void 0,size:xO(s)}},n=e(t.borderTopStyle,t.borderTopColor,t.borderTopWidth),r=e(t.borderBottomStyle,t.borderBottomColor,t.borderBottomWidth),o=e(t.borderLeftStyle,t.borderLeftColor,t.borderLeftWidth),i=e(t.borderRightStyle,t.borderRightColor,t.borderRightWidth);return!n&&!r&&!o&&!i?null:{top:n,bottom:r,left:o,right:i}}function kO(t){let e=l=>{if(!l||l==="0px")return;let a=parseFloat(l);if(!(isNaN(a)||a===0))return l.endsWith("pt")?Math.round(a*20):Math.round(a*15)},n=e(t.paddingTop),r=e(t.paddingRight),o=e(t.paddingBottom),i=e(t.paddingLeft);return n===void 0&&r===void 0&&o===void 0&&i===void 0?null:{top:n,right:r,bottom:o,left:i}}function CO(t){if(t)switch(t.toLowerCase()){case"top":return"top";case"middle":return"center";case"bottom":return"bottom";default:return}}function SO(t){return nk(t)?.rgb}function rk(t){let e=t.style,n=vO(e),r=kO(e);return{colspan:t.colSpan||1,rowspan:t.rowSpan||1,verticalAlign:t.dataset.valign||CO(e.verticalAlign)||void 0,backgroundColor:t.dataset.bgcolor||SO(e.backgroundColor)||void 0,borders:n||void 0,margins:r||void 0}}var TO={content:"tableRow+",group:"block",tableRole:"table",isolating:!0,attrs:{styleId:{default:null},width:{default:null},widthType:{default:null},justification:{default:null},columnWidths:{default:null},tableLayout:{default:null},floating:{default:null},cellMargins:{default:null},look:{default:null},bidi:{default:null},_originalFormatting:{default:null},tblPrChange:{default:null}},parseDOM:[{tag:"table",getAttrs(t){let e=t;return{styleId:e.dataset.styleId||void 0,justification:e.dataset.justification,bidi:e.dataset.bidi==="true"||e.dir==="rtl"||void 0}}}],toDOM(t){let e=t.attrs,n={class:"docx-table"};e.styleId&&(n["data-style-id"]=e.styleId),e.bidi&&(n["data-bidi"]="true",n.dir="rtl");let r=["border-collapse: collapse"];if(e.bidi&&r.push("direction: rtl"),e.width&&e.widthType==="pct")r.push(`width: ${e.width/50}%`),r.push("table-layout: fixed");else if(e.width&&e.widthType==="dxa"){let o=Math.round(e.width/20*1.333);r.push(`width: ${o}px`),r.push("table-layout: fixed")}else r.push("width: 100%"),r.push("table-layout: fixed");if(e.justification==="center"?r.push("margin-left: auto","margin-right: auto"):e.justification==="right"&&r.push("margin-left: auto"),n.style=r.join("; "),Array.isArray(e.tblPrChange)&&e.tblPrChange.length>0){let o=e.tblPrChange[0];n.class+=" ep-revision-prop-change",n["data-revision-id"]=String(o.info.id),n["data-revision-author"]=o.info.author,o.info.date&&(n["data-revision-date"]=o.info.date)}return["table",n,["tbody",0]]}},$O={content:"(tableCell | tableHeader)+",tableRole:"row",attrs:{height:{default:null},heightRule:{default:null},isHeader:{default:!1},_originalFormatting:{default:null},trIns:{default:null},trDel:{default:null},trPrChange:{default:null}},parseDOM:[{tag:"tr"}],toDOM(t){let e=t.attrs,n={};if(e.height){let r=Math.round(e.height/20*1.333);n.style=`height: ${r}px`}if(e.trIns||e.trDel){let r=e.trIns??e.trDel,o=e.trIns?"ep-revision-ins":"ep-revision-del";n.class="ep-revision-row "+o,n["data-revision-id"]=String(r.revisionId),n["data-revision-author"]=r.author,r.date&&(n["data-revision-date"]=r.date)}else if(Array.isArray(e.trPrChange)&&e.trPrChange.length>0){let r=e.trPrChange[0];n.class="ep-revision-prop-change",n["data-revision-id"]=String(r.info.id),n["data-revision-author"]=r.info.author,r.info.date&&(n["data-revision-date"]=r.info.date)}return["tr",n,0]}},IO={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 ok(t){let e=[],n=t.borders;if(!n)return e;let r=o=>{if(!o||!o.style||o.style==="none"||o.style==="nil")return"none";let i=o.size?Math.max(1,Math.round(o.size/8*1.333)):1,l=IO[o.style]||"solid",a=nr(o.color,void 0);return`${i}px ${l} ${a}`};return e.push(`border-top: ${r(n.top)}`),e.push(`border-bottom: ${r(n.bottom)}`),e.push(`border-left: ${r(n.left)}`),e.push(`border-right: ${r(n.right)}`),e}function ik(t){let e=t.margins;if(!e){let a=Math.round(7.1982);return[`padding: ${a}px ${a}px`]}let n=a=>a?Math.round(a/20*1.333):0,r=n(e.top),o=n(e.right),i=n(e.bottom),l=n(e.left);return[`padding: ${r}px ${o}px ${i}px ${l}px`]}function lk(t){if(!t)return[];let e=[];switch(t){case"tbRl":case"tbRlV":e.push("writing-mode: vertical-rl");break;case"btLr":e.push("writing-mode: vertical-lr","transform: rotate(180deg)");break;case"rl":case"rlV":e.push("direction: rtl");break;case"tb":case"tbV":e.push("writing-mode: vertical-lr");break}return e}function ak(t){let e=[];if(t.colwidth&&t.colwidth.length>0){let n=t.colwidth.reduce((r,o)=>r+o,0);e.push(`width: ${n}px`)}else if(t.width&&t.widthType==="pct")e.push(`width: ${t.width}%`);else if(t.width){let n=Math.round(t.width/20*1.333);e.push(`width: ${n}px`)}return e}var MO={content:"(paragraph | table)+",tableRole:"cell",isolating:!0,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:!1},_originalFormatting:{default:null},_originalResolvedFill:{default:null},cellMarker:{default:null},tcPrChange:{default:null}},parseDOM:[{tag:"td",getAttrs:t=>rk(t)}],toDOM(t){let e=t.attrs,n={class:"docx-table-cell"};if(e.cellMarker){let o=e.cellMarker,i=o.kind==="ins"?"ep-revision-ins":o.kind==="del"?"ep-revision-del":"ep-revision-merge";n.class=`${n.class} ep-revision-cell ${i}`,n["data-revision-id"]=String(o.info.revisionId),n["data-revision-author"]=o.info.author,o.info.date&&(n["data-revision-date"]=o.info.date),o.kind==="merge"&&(n["data-vmerge"]=o.vMerge)}else if(Array.isArray(e.tcPrChange)&&e.tcPrChange.length>0){let o=e.tcPrChange[0];n.class=`${n.class} ep-revision-prop-change`,n["data-revision-id"]=String(o.info.id),n["data-revision-author"]=o.info.author,o.info.date&&(n["data-revision-date"]=o.info.date)}e.colspan>1&&(n.colspan=String(e.colspan)),e.rowspan>1&&(n.rowspan=String(e.rowspan));let r=[];return r.push(...ik(e)),e.noWrap?r.push("white-space: nowrap"):r.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),r.push(...ak(e)),r.push(...ok(e)),r.push(...lk(e.textDirection)),e.verticalAlign&&(n["data-valign"]=e.verticalAlign,r.push(`vertical-align: ${e.verticalAlign}`)),e.backgroundColor&&(n["data-bgcolor"]=e.backgroundColor,r.push(`background-color: #${e.backgroundColor}`)),n.style=r.join("; "),["td",n,0]}},RO={content:"(paragraph | table)+",tableRole:"header_cell",isolating:!0,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:!1},_originalFormatting:{default:null},_originalResolvedFill:{default:null},cellMarker:{default:null},tcPrChange:{default:null}},parseDOM:[{tag:"th",getAttrs:t=>rk(t)}],toDOM(t){let e=t.attrs,n={class:"docx-table-header"};if(e.colspan>1&&(n.colspan=String(e.colspan)),e.rowspan>1&&(n.rowspan=String(e.rowspan)),e.cellMarker){let o=e.cellMarker,i=o.kind==="ins"?"ep-revision-ins":o.kind==="del"?"ep-revision-del":"ep-revision-merge";n.class=`${n.class} ep-revision-cell ${i}`,n["data-revision-id"]=String(o.info.revisionId),n["data-revision-author"]=o.info.author,o.info.date&&(n["data-revision-date"]=o.info.date),o.kind==="merge"&&(n["data-vmerge"]=o.vMerge)}else if(Array.isArray(e.tcPrChange)&&e.tcPrChange.length>0){let o=e.tcPrChange[0];n.class=`${n.class} ep-revision-prop-change`,n["data-revision-id"]=String(o.info.id),n["data-revision-author"]=o.info.author,o.info.date&&(n["data-revision-date"]=o.info.date)}let r=["font-weight: bold"];return r.push(...ik(e)),e.noWrap?r.push("white-space: nowrap"):r.push("word-wrap: break-word","overflow-wrap: break-word","overflow: hidden"),r.push(...ak(e)),r.push(...ok(e)),r.push(...lk(e.textDirection)),e.verticalAlign&&(n["data-valign"]=e.verticalAlign,r.push(`vertical-align: ${e.verticalAlign}`)),e.backgroundColor&&(n["data-bgcolor"]=e.backgroundColor,r.push(`background-color: #${e.backgroundColor}`)),n.style=r.join("; "),["th",n,0]}};function Ge(t){let{selection:e}=t,{$from:n}=e,r=e instanceof Ve&&e.$anchorCell.pos!==e.$headCell.pos,o,i,l,a,s;for(let p=n.depth;p>0;p--){let m=n.node(p);if(m.type.name==="tableCell"||m.type.name==="tableHeader"){s=m;let y=n.node(p-1);if(y&&y.type.name==="tableRow"){let w=0,C=!1;y.forEach((g,v,k)=>{C||(k===n.index(p-1)?(a=w,C=!0):w+=g.attrs.colspan||1)})}}else if(m.type.name==="tableRow"){let y=n.node(p-1);y&&y.type.name==="table"&&(l=n.index(p-1))}else if(m.type.name==="table"){o=m,i=n.before(p);break}}if(!o)return{isInTable:!1};let c=0,d=0;o.forEach(p=>{if(p.type.name==="tableRow"){c++;let m=0;p.forEach(y=>{m+=y.attrs.colspan||1}),d=Math.max(d,m)}});let u=!!s&&!r,f,h;if(s){let p=s.attrs;p.backgroundColor&&typeof p.backgroundColor=="string"&&(h=p.backgroundColor);let m=p.borders;if(m)for(let y of["top","right","bottom","left"]){let w=m[y];if(w?.color&&w.style&&w.style!=="none"&&w.style!=="nil"){f=w.color;break}}}return{isInTable:!0,table:o,tablePos:i,rowIndex:l,columnIndex:a,rowCount:c,columnCount:d,hasMultiCellSelection:r,canSplitCell:!!u,cellBorderColor:f,cellBackgroundColor:h}}function sk(t){let{$from:e}=t.selection;for(let n=e.depth;n>0;n--){let r=e.node(n);if(r.type.name==="tableCell"||r.type.name==="tableHeader")return!0}return!1}function ck(t){let{$from:e}=t.selection,n=-1,r=-1,o=-1;for(let i=e.depth;i>0;i--){let l=e.node(i);if(l.type.name==="tableCell"||l.type.name==="tableHeader")n=i;else if(l.type.name==="tableRow")r=i;else if(l.type.name==="table"){o=i;break}}return n===-1||r===-1||o===-1?null:{cellDepth:n,cellPos:e.before(n),rowDepth:r,tableDepth:o}}function PO(){return(t,e)=>{if(!sk(t))return!1;let n=ck(t);if(!n)return!1;let{$from:r}=t.selection,o=r.node(n.tableDepth),i=r.node(n.rowDepth),l=r.index(n.rowDepth),a=r.index(n.tableDepth);if(l<i.childCount-1){let s=n.cellPos+r.node(n.cellDepth).nodeSize;if(e){let c=s+1+1,d=t.tr.setSelection(Le.near(t.doc.resolve(c)));e(d.scrollIntoView())}return!0}if(a<o.childCount-1){let s=r.before(n.rowDepth)+i.nodeSize;if(e){let c=s+1+1+1,d=t.tr.setSelection(Le.near(t.doc.resolve(c)));e(d.scrollIntoView())}return!0}return!1}}function EO(){return(t,e)=>{if(!sk(t))return!1;let n=ck(t);if(!n)return!1;let{$from:r}=t.selection,o=r.node(n.tableDepth),i=r.index(n.rowDepth),l=r.index(n.tableDepth);if(i>0){let a=r.node(n.rowDepth).child(i-1),s=n.cellPos-a.nodeSize;if(e){let c=s+a.nodeSize-2,d=t.tr.setSelection(Le.near(t.doc.resolve(c),-1));e(d.scrollIntoView())}return!0}if(l>0){let a=o.child(l-1),s=r.before(n.rowDepth)-a.nodeSize;if(e){let c=s+a.nodeSize-1-1,d=t.tr.setSelection(Le.near(t.doc.resolve(c),-1));e(d.scrollIntoView())}return!0}return!1}}function Zo(t,e={}){let n=t?.attrs??{};return{colspan:n.colspan||1,rowspan:1,colwidth:n.colwidth,width:n.width,widthType:n.widthType,verticalAlign:n.verticalAlign,backgroundColor:n.backgroundColor,borders:n.borders,margins:n.margins,textDirection:n.textDirection,noWrap:n.noWrap,...e}}function Us(t,e){let{$from:n}=t.selection;for(let r=n.depth;r>0;r--){let o=n.node(r);if(o.type.name===e)return{pos:n.before(r),node:o}}return null}function Mr(t){let e=t.selection;if(e instanceof Ve){let r=[];return e.forEachCell((o,i)=>{r.push({pos:i,node:o})}),r}let n=Us(t,"tableCell")??Us(t,"tableHeader");return n?[n]:[]}function zc(t,e){let n=new Map,r=new Map,o=t.childCount,i=0;return t.forEach((l,a,s)=>{if(l.type.name!=="tableRow")return;let c=0;l.forEach((d,u)=>{let f=e+a+u+2,h=d.attrs.colspan||1;n.set(f,{rowIdx:s,colIdx:c,colspan:h,pos:f,node:d}),r.set(`${s},${c}`,f),c+=h}),i=Math.max(i,c)}),{cellByPos:n,cellByRC:r,totalRows:o,totalCols:i}}var dk=null;function FO(t){dk=t}function AO(){return dk}function uk(t,e,n){let r=[];return e.forEach(o=>{let i=t.nodes.paragraph.create(),l={...Zo(o),cellMarker:{kind:"ins",info:n}};r.push(t.nodes.tableCell.create(l,i))}),t.nodes.tableRow.create({height:e.attrs.height??360,heightRule:e.attrs.heightRule??"atLeast",isHeader:e.attrs.isHeader??!1,trIns:n},r)}function DO(t){return function(e,n,r="000000",o=9360,i){let l=[],a=Math.floor(o/n),s=360,c="atLeast",d={style:"single",size:4,color:{rgb:r}},u={top:d,bottom:d,left:d,right:d};for(let h=0;h<e;h++){let p=[];for(let y=0;y<n;y++){let w=t.nodes.paragraph.create(),C={colspan:1,rowspan:1,borders:u,width:a,widthType:"dxa"};i&&(C.cellMarker={kind:"ins",info:i}),p.push(t.nodes.tableCell.create(C,w))}let m={height:s,heightRule:c};i&&(m.trIns=i),l.push(t.nodes.tableRow.create(m,p))}let f=Array(n).fill(a);return t.nodes.table.create({columnWidths:f,width:o,widthType:"dxa",tableLayout:"fixed"},l)}}function F0(t,e){return{type:e,info:{id:t.revisionId,author:t.author,date:t.date??void 0}}}function NO(t,e,n,r,o,i,l){let a=AO();if(!a)return null;let s=Math.floor(r/e),c=Array(e).fill(s),d=[];for(let f=0;f<t;f++){let h=[];for(let m=0;m<e;m++){let y={type:"tableCell",formatting:{width:{value:s,type:"dxa"}},content:[{type:"paragraph",content:[]}]};l&&(y.structuralChange=F0(l,"tableCellInsertion")),h.push(y)}let p={type:"tableRow",formatting:{height:{value:360,type:"dxa"},heightRule:"atLeast"},cells:h};l&&(p.structuralChange=F0(l,"tableRowInsertion")),d.push(p)}let u={type:"table",formatting:{width:{value:r,type:"dxa"},layout:"fixed",styleId:n,look:{...u1}},columnWidths:c,rows:d};return a(u,o,i)}function LO(t){let e=DO(t);return function(n,r){return(o,i)=>{let{$from:l}=o.selection,a="000000",s=o.storedMarks||l.marks();for(let d of s)if(d.type.name==="textColor"&&d.attrs.rgb){a=d.attrs.rgb;break}let c=l.pos;for(let d=l.depth;d>0;d--){let u=l.node(d);if(u.type.name==="paragraph"||u.type.name==="table"){c=l.after(d);break}}if(i){let d=9360;for(let k=l.depth;k>0;k--){let x=l.node(k);if(x.type.name==="tableCell"||x.type.name==="tableHeader"){let T=x.attrs.width;T&&T>0&&(d=Math.max(T-216,360));break}}let u=Oi(o),f=Ap(o),h=f1(m4(o),f),p=(h&&f?NO(n,r,h,d,f,h4(o),u):null)??e(n,r,a,d,u),m=t.nodes.paragraph.create(),y=o.doc.resolve(c).nodeBefore?.type.name==="table",w=y?[m,p,m]:[p,m],C=o.tr.insert(c,w),g=c+1;y&&(g+=m.nodeSize);let v=g+1+1;C.setSelection(ye.near(C.doc.resolve(v),1)),i(C.scrollIntoView())}return!0}}}function BO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.rowIndex===void 0||!r.table||r.tablePos===void 0)return!1;if(n){let o=e.tr,i=r.table.child(r.rowIndex),l=Oi(e),a;if(l)a=uk(t,i,l);else{let c=[];i.forEach(d=>{let u=t.nodes.paragraph.create(),f=Zo(d);c.push(t.nodes.tableCell.create(f,u))}),a=t.nodes.tableRow.create({height:i.attrs.height??360,heightRule:i.attrs.heightRule??"atLeast"},c)}let s=r.tablePos+1;for(let c=0;c<r.rowIndex;c++)s+=r.table.child(c).nodeSize;o.insert(s,a),n(o.scrollIntoView())}return!0}}function OO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.rowIndex===void 0||!r.table||r.tablePos===void 0)return!1;if(n){let o=e.tr,i=r.table.child(r.rowIndex),l=Oi(e),a;if(l)a=uk(t,i,l);else{let c=[];i.forEach(d=>{let u=t.nodes.paragraph.create(),f=Zo(d);c.push(t.nodes.tableCell.create(f,u))}),a=t.nodes.tableRow.create({height:i.attrs.height??360,heightRule:i.attrs.heightRule??"atLeast"},c)}let s=r.tablePos+1;for(let c=0;c<=r.rowIndex;c++)s+=r.table.child(c).nodeSize;o.insert(s,a),n(o.scrollIntoView())}return!0}}function jO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.columnIndex===void 0||!r.table||r.tablePos===void 0)return!1;if(n){let o=e.tr,i=(r.columnCount||1)+1,l=Math.floor(5e3/i),a=[],s=r.tablePos+1;r.table.forEach(d=>{a.push(s),s+=d.nodeSize}),r.table.forEach((d,u,f)=>{if(d.type.name==="tableRow"){let h=o.mapping.map(a[f])+1,p=0,m=!1;if(d.forEach(y=>{if(!m&&p===r.columnIndex){let w=t.nodes.paragraph.create(),C=Zo(y,{colspan:1,rowspan:1});C.width=l,C.widthType="pct";let g=t.nodes.tableCell.create(C,w);o=o.insert(h,g),m=!0}h+=y.nodeSize,p+=y.attrs.colspan||1}),!m&&p<=r.columnIndex){let y=t.nodes.paragraph.create(),w=Zo(d.child(d.childCount-1)??null,{colspan:1,rowspan:1});w.width=l,w.widthType="pct";let C=t.nodes.tableCell.create(w,y);o=o.insert(h,C)}}});let c=o.doc.nodeAt(r.tablePos);if(c&&c.type.name==="table"){let d=c.child(0);if(d&&d.type.name==="tableRow"){let p=r.tablePos+2;d.forEach(m=>{(m.type.name==="tableCell"||m.type.name==="tableHeader")&&(o=o.setNodeMarkup(p,void 0,{...m.attrs,width:l,widthType:"pct"})),p+=m.nodeSize})}let u=d?.childCount??i,f=c.attrs.width||9360,h=Math.floor(f/Math.max(1,u));o=o.setNodeMarkup(r.tablePos,void 0,{...c.attrs,columnWidths:Array(u).fill(h)})}n(o.scrollIntoView())}return!0}}function zO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.columnIndex===void 0||!r.table||r.tablePos===void 0)return!1;if(n){let o=e.tr,i=(r.columnCount||1)+1,l=Math.floor(5e3/i),a=[],s=r.tablePos+1;r.table.forEach(d=>{a.push(s),s+=d.nodeSize}),r.table.forEach((d,u,f)=>{if(d.type.name==="tableRow"){let h=o.mapping.map(a[f])+1,p=0,m=!1;if(d.forEach(y=>{if(h+=y.nodeSize,p+=y.attrs.colspan||1,!m&&p>r.columnIndex){let w=t.nodes.paragraph.create(),C=Zo(y,{colspan:1,rowspan:1});C.width=l,C.widthType="pct";let g=t.nodes.tableCell.create(C,w);o=o.insert(h,g),m=!0}}),!m){let y=t.nodes.paragraph.create(),w=Zo(d.child(d.childCount-1)??null,{colspan:1,rowspan:1});w.width=l,w.widthType="pct";let C=t.nodes.tableCell.create(w,y);o=o.insert(h,C)}}});let c=o.doc.nodeAt(r.tablePos);if(c&&c.type.name==="table"){let d=c.child(0);if(d&&d.type.name==="tableRow"){let p=r.tablePos+2;d.forEach(m=>{(m.type.name==="tableCell"||m.type.name==="tableHeader")&&(o=o.setNodeMarkup(p,void 0,{...m.attrs,width:l,widthType:"pct"})),p+=m.nodeSize})}let u=d?.childCount??i,f=c.attrs.width||9360,h=Math.floor(f/Math.max(1,u));o=o.setNodeMarkup(r.tablePos,void 0,{...c.attrs,columnWidths:Array(u).fill(h)})}n(o.scrollIntoView())}return!0}}var HO=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.rowIndex===void 0||!n.table||n.tablePos===void 0||(n.rowCount||0)<=1)return!1;let r=n.rowCount??0,o=ua(t),i=Math.max(0,Math.min(o.top,r-1)),l=Math.min(Math.max(o.bottom-1,i),r-1);if(e){let a=t.tr,s=n.table,c=Oi(t);if(!c&&i===0&&l>=r-1)return a.delete(n.tablePos,n.tablePos+s.nodeSize),e(a.scrollIntoView()),!0;let d=[],u=n.tablePos+1;if(s.forEach(f=>{d.push(u),u+=f.nodeSize}),c)for(let f=i;f<=l;f++){let h=s.child(f),p=d[f];a.setNodeMarkup(p,void 0,{...h.attrs,trDel:c});let m=p+1;h.forEach(y=>{(y.type.name==="tableCell"||y.type.name==="tableHeader")&&a.setNodeMarkup(m,void 0,{...y.attrs,cellMarker:{kind:"del",info:c}}),m+=y.nodeSize})}else for(let f=l;f>=i;f--){let h=s.child(f),p=d[f];a.delete(p,p+h.nodeSize)}e(a.scrollIntoView())}return!0},_O=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.columnIndex===void 0||!n.table||n.tablePos===void 0||(n.columnCount||0)<=1)return!1;if(e){let r=t.tr,o=(n.columnCount||2)-1,i=Math.floor(5e3/o),l=[],a=n.tablePos+1;n.table.forEach(c=>{if(c.type.name==="tableRow"){let d=a+1,u=0;c.forEach(f=>{let h=d,p=d+f.nodeSize,m=f.attrs.colspan||1;u<=n.columnIndex&&n.columnIndex<u+m&&l.push({start:h,end:p}),d=p,u+=m})}a+=c.nodeSize}),l.reverse().forEach(({start:c,end:d})=>{r=r.delete(c,d)});let s=r.doc.nodeAt(n.tablePos);if(s&&s.type.name==="table"){let c=s.child(0);if(c&&c.type.name==="tableRow"){let h=n.tablePos+2;c.forEach(p=>{(p.type.name==="tableCell"||p.type.name==="tableHeader")&&(r=r.setNodeMarkup(h,void 0,{...p.attrs,width:i,widthType:"pct"})),h+=p.nodeSize})}let d=c?.childCount??o,u=s.attrs.width||9360,f=Math.floor(u/Math.max(1,d));r=r.setNodeMarkup(n.tablePos,void 0,{...s.attrs,columnWidths:Array(d).fill(f)})}e(r.scrollIntoView())}return!0},WO=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table)return!1;if(e){let r=t.tr;r.delete(n.tablePos,n.tablePos+n.table.nodeSize),e(r.scrollIntoView())}return!0},A0=(t,e)=>{let n=t.selection;if(!("$anchorCell"in n&&typeof n.forEachCell=="function"))return!1;let r=Ge(t);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;let o=0;r.table.descendants(l=>{(l.type.name==="tableCell"||l.type.name==="tableHeader")&&(o+=1)});let i=0;if(n.forEachCell(()=>{i+=1}),!(o>0&&i>=o))return!1;if(e){let l=t.tr.delete(r.tablePos,r.tablePos+r.table.nodeSize);e(l.scrollIntoView())}return!0},D0=t=>{let{$from:e,empty:n}=t.selection;if(!n)return!1;let r=e.parent;if(r.type.name!=="paragraph"||r.textContent.length>0)return!1;let o=e.depth;if(o<1)return!1;let i=e.node(o-1),l=e.index(o-1),a=l>0?i.child(l-1):null,s=l+1<i.childCount?i.child(l+1):null,c=a?.type.name==="table",d=s?.type.name==="table";return!!(c||d)},VO=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table)return!1;if(e){let r=xt.get(n.table),o=n.tablePos+1,i=o+r.map[0],l=o+r.map[r.map.length-1],a=Ve.create(t.doc,i,l);e(t.tr.setSelection(a))}return!0},qO=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table||n.rowIndex===void 0)return!1;if(e){let r=n.tablePos+1;for(let s=0;s<n.rowIndex;s++){let c=n.table.child(s);r+=c.nodeSize}let o=n.table.child(n.rowIndex),i=r+1,l=r+o.nodeSize-2,a=Ve.create(t.doc,i,l);e(t.tr.setSelection(a))}return!0},ZO=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table||n.columnIndex===void 0)return!1;if(e){let r=n.tablePos+1,o=n.table.child(0),i=n.table.child(n.table.childCount-1),l=r+1;for(let d=0;d<n.columnIndex&&d<o.childCount;d++)l+=o.child(d).nodeSize;let a=r;for(let d=0;d<n.table.childCount-1;d++)a+=n.table.child(d).nodeSize;let s=a+1;for(let d=0;d<n.columnIndex&&d<i.childCount;d++)s+=i.child(d).nodeSize;let c=Ve.create(t.doc,l,s);e(t.tr.setSelection(c))}return!0},Hc={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}};function Qi(t,e){return(n,r)=>{let o=Ge(n);if(!o.isInTable||o.tablePos===void 0||!o.table)return!1;if(r){let i=n.tr,l=o.table,a=o.tablePos,s=e??{style:"single",size:4,color:{rgb:"000000"}},c={style:"none"},{cellByPos:d,cellByRC:u}=zc(l,a),f=Mr(n),h=1/0,p=-1,m=1/0,y=-1;for(let{pos:v}of f){let k=d.get(v);k&&(h=Math.min(h,k.rowIdx),p=Math.max(p,k.rowIdx),m=Math.min(m,k.colIdx),y=Math.max(y,k.colIdx+k.colspan-1))}let w=new Map,C=(v,k)=>w.get(v)??{...k.attrs},g=(v,k)=>{w.set(v,k)};for(let{pos:v}of f){let k=d.get(v);if(!k)continue;let x=k.rowIdx===h,T=k.rowIdx===p,$=k.colIdx===m,M=k.colIdx+k.colspan-1===y,I;switch(t){case"all":I={top:s,bottom:s,left:s,right:s};break;case"outside":I={top:x?s:c,bottom:T?s:c,left:$?s:c,right:M?s:c};break;case"inside":I={top:x?c:s,bottom:T?c:s,left:$?c:s,right:M?c:s};break;case"none":I={top:c,bottom:c,left:c,right:c};break}let F=C(v,k.node),E=F.borders||{};g(v,{...F,borders:{...E,...I}});for(let R of["top","bottom","left","right"]){let N=I[R];if(!N)continue;let B=Hc[R],j=R==="right"?k.colIdx+k.colspan:k.colIdx+B.dCol,O=u.get(`${k.rowIdx+B.dRow},${j}`);if(O===void 0)continue;let z=d.get(O),W=C(O,z.node),q=W.borders||{};g(O,{...W,borders:{...q,[B.adjSide]:N}})}}for(let[v,k]of w)i.setNodeMarkup(i.mapping.map(v),void 0,k);r(i.scrollIntoView())}return!0}}function KO(t,e,n){return(r,o)=>{let i=Ge(r);if(!i.isInTable||i.tablePos===void 0||!i.table)return!1;if(o){let l=r.tr,a=Mr(r),s=e||{style:"none"},c={style:"none"},d=["top","bottom","left","right"],{cellByPos:u,cellByRC:f}=zc(i.table,i.tablePos),h=new Map,p=(y,w)=>h.get(y)??{...w.attrs},m=(y,w)=>h.set(y,w);for(let{pos:y,node:w}of a){let C=u.get(y),g=p(y,w),v=g.borders||{},k=t==="all"?d:[t],x=n?{top:c,bottom:c,left:c,right:c}:{...v};for(let T of k)x[T]=s;if(C){let T=n?d:k;for(let $ of T){let M=x[$],I=Hc[$],F=$==="right"?C.colIdx+C.colspan:C.colIdx+I.dCol,E=f.get(`${C.rowIdx+I.dRow},${F}`);if(E!==void 0){let R=u.get(E),N=p(E,R.node),B=N.borders||{};m(E,{...N,borders:{...B,[I.adjSide]:M}})}}}m(y,{...g,borders:x})}for(let[y,w]of h)l.setNodeMarkup(l.mapping.map(y),void 0,w);o(l.scrollIntoView())}return!0}}function UO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e),l=t.replace(/^#/,""),a={style:"single",size:4},{cellByPos:s,cellByRC:c}=zc(r.table,r.tablePos),d=new Map,u=(h,p)=>d.get(h)??{...p.attrs},f=(h,p)=>d.set(h,p);for(let{pos:h,node:p}of i){let m=s.get(h),y=u(h,p),w=y.borders||{},C={};for(let g of["top","bottom","left","right"]){let v={...a,...w[g],color:{rgb:l}};if(C[g]=v,m){let k=Hc[g],x=g==="right"?m.colIdx+m.colspan:m.colIdx+k.dCol,T=c.get(`${m.rowIdx+k.dRow},${x}`);if(T!==void 0){let $=s.get(T),M=u(T,$.node),I=M.borders||{};f(T,{...M,borders:{...I,[k.adjSide]:v}})}}}f(h,{...y,borders:{...w,...C}})}for(let[h,p]of d)o.setNodeMarkup(o.mapping.map(h),void 0,p);n(o.scrollIntoView())}return!0}}function XO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e),l={style:"single",color:{rgb:"000000"}},{cellByPos:a,cellByRC:s}=zc(r.table,r.tablePos),c=new Map,d=(f,h)=>c.get(f)??{...h.attrs},u=(f,h)=>c.set(f,h);for(let{pos:f,node:h}of i){let p=a.get(f),m=d(f,h),y=m.borders||{},w={};for(let C of["top","bottom","left","right"]){let g={...l,...y[C],size:t};if(w[C]=g,p){let v=Hc[C],k=C==="right"?p.colIdx+p.colspan:p.colIdx+v.dCol,x=s.get(`${p.rowIdx+v.dRow},${k}`);if(x!==void 0){let T=a.get(x),$=d(x,T.node),M=$.borders||{};u(x,{...$,borders:{...M,[v.adjSide]:g}})}}}u(f,{...m,borders:{...y,...w}})}for(let[f,h]of c)o.setNodeMarkup(o.mapping.map(f),void 0,h);n(o.scrollIntoView())}return!0}}function GO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e),l=t?t.replace(/^#/,""):null;for(let{pos:a,node:s}of i)o.setNodeMarkup(o.mapping.map(a),void 0,{...s.attrs,backgroundColor:l});n(o.scrollIntoView())}return!0}}function YO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e);for(let{pos:l,node:a}of i)o.setNodeMarkup(o.mapping.map(l),void 0,{...a.attrs,verticalAlign:t});n(o.scrollIntoView())}return!0}}function JO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e);for(let{pos:l,node:a}of i){let s={...a.attrs.margins||{},...t};o.setNodeMarkup(o.mapping.map(l),void 0,{...a.attrs,margins:s})}n(o.scrollIntoView())}return!0}}function QO(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=Mr(e);for(let{pos:l,node:a}of i)o.setNodeMarkup(o.mapping.map(l),void 0,{...a.attrs,textDirection:t});n(o.scrollIntoView())}return!0}}var e3=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table)return!1;if(e){let r=t.tr,o=Mr(t);for(let{pos:i,node:l}of o)r.setNodeMarkup(r.mapping.map(i),void 0,{...l.attrs,noWrap:!l.attrs.noWrap});e(r.scrollIntoView())}return!0};function t3(t,e){return(n,r)=>{let o=Ge(n);if(!o.isInTable||o.tablePos===void 0||!o.table)return!1;if(r){let i=Us(n,"tableRow");if(!i)return!0;let l=n.tr.setNodeMarkup(i.pos,void 0,{...i.node.attrs,height:t,heightRule:t?e||"atLeast":null});r(l.scrollIntoView())}return!0}}var n3=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table||!n.columnCount)return!1;if(e){let r=t.tr,o=n.table,i=n.columnCount,l=o.attrs.columnWidths,a=l?l.reduce((u,f)=>u+f,0):9360,s=Math.floor(a/i),c=n.tablePos+1;o.forEach(u=>{if(u.type.name==="tableRow"){let f=c+1;u.forEach(h=>{(h.type.name==="tableCell"||h.type.name==="tableHeader")&&(r=r.setNodeMarkup(f,void 0,{...h.attrs,width:s,widthType:"dxa",colwidth:null})),f+=h.nodeSize})}c+=u.nodeSize});let d=Array(i).fill(s);r=r.setNodeMarkup(n.tablePos,void 0,{...o.attrs,columnWidths:d}),e(r.scrollIntoView())}return!0},r3=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table)return!1;if(e){let r=t.tr,o=n.table,i=n.tablePos+1;o.forEach(l=>{if(l.type.name==="tableRow"){let a=i+1;l.forEach(s=>{(s.type.name==="tableCell"||s.type.name==="tableHeader")&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,width:null,widthType:null,colwidth:null})),a+=s.nodeSize})}i+=l.nodeSize}),r=r.setNodeMarkup(n.tablePos,void 0,{...o.attrs,columnWidths:null,width:null,widthType:"auto"}),e(r.scrollIntoView())}return!0};function o3(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i=r.table,l=r.tablePos,a=i.childCount,s=t.look??{firstRow:!0,lastRow:!1,noHBand:!1},c=t.conditionals??{},d=t.tableBorders;o=o.setNodeMarkup(l,void 0,{...i.attrs,styleId:t.styleId});let u=0,f=l+1;for(let h=0;h<a;h++){let p=i.child(h),m=h===0&&!!s.firstRow,y=h===a-1&&!!s.lastRow,w=s.noHBand!==!0,C=p.childCount,g;m?g="firstRow":y?g="lastRow":(w&&(g=u%2===0?"band1Horz":"band2Horz"),u++);let v=f+1;for(let k=0;k<C;k++){let x=p.child(k),T=o.mapping.map(v),$=g,M=k===0&&!!s.firstCol,I=k===C-1&&!!s.lastCol;m&&M&&c.nwCell?$="nwCell":m&&I&&c.neCell?$="neCell":y&&M&&c.swCell?$="swCell":y&&I&&c.seCell?$="seCell":M?$="firstCol":I&&($="lastCol");let F=$?c[$]:void 0,E={...x.attrs};F?.backgroundColor?E.backgroundColor=F.backgroundColor:E.backgroundColor=null;let R={},N=["top","bottom","left","right"];for(let B of N)F?.borders&&F.borders[B]!==void 0?R[B]=F.borders[B]:d&&(B==="top"&&h>0||B==="bottom"&&h<a-1?R[B]=d.insideH??d[B]:B==="left"&&k>0||B==="right"&&k<C-1?R[B]=d.insideV??d[B]:R[B]=d[B]);Object.keys(R).length>0?E.borders=R:E.borders=null,o=o.setNodeMarkup(T,void 0,E),v+=x.nodeSize}f+=p.nodeSize}n(o.scrollIntoView())}return!0}}function i3(t){return(e,n)=>{let r=Ge(e);if(!r.isInTable||r.tablePos===void 0||!r.table)return!1;if(n){let o=e.tr,i={...r.table.attrs};"width"in t&&(i.width=t.width),"widthType"in t&&(i.widthType=t.widthType),"justification"in t&&(i.justification=t.justification),o.setNodeMarkup(r.tablePos,void 0,i),n(o.scrollIntoView())}return!0}}var l3=(t,e)=>{let n=Ge(t);if(!n.isInTable||n.tablePos===void 0||!n.table)return!1;if(e){let r=Us(t,"tableRow");if(!r)return!0;let o=t.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,isHeader:!r.node.attrs.isHeader});e(o.scrollIntoView())}return!0};function a3(){let t=new fn("activeCell");return new zt({key:t,props:{decorations(e){let{selection:n}=e;if(n instanceof Ve)return ft.empty;let{$from:r}=n;for(let o=r.depth;o>0;o--){let i=r.node(o);if(i.type.name==="tableCell"||i.type.name==="tableHeader"){let l=r.before(o);return ft.create(e.doc,[Jt.node(l,l+i.nodeSize,{class:"activeCell"})])}}return ft.empty}}})}function s3(t){let{schema:e}=t,n=LO(e),r=BO(e),o=OO(e),i=jO(e),l=zO(e);return{plugins:[sO({handleWidth:5,cellMinWidth:25,lastColumnResizable:!0}),bO(),a3()],keyboardShortcuts:{Backspace:Vl(A0,D0),Delete:Vl(A0,D0)},commands:{insertTable:n,addRowAbove:()=>r,addRowBelow:()=>o,deleteRow:()=>HO,addColumnLeft:()=>i,addColumnRight:()=>l,deleteColumn:()=>_O,deleteTable:()=>WO,selectTable:()=>VO,selectRow:()=>qO,selectColumn:()=>ZO,mergeCells:()=>XB,splitCell:()=>GB,setCellBorder:KO,setTableBorders:Qi,setCellVerticalAlign:YO,setCellMargins:JO,setCellTextDirection:QO,toggleNoWrap:()=>e3,setRowHeight:t3,toggleHeaderRow:()=>l3,distributeColumns:()=>n3,autoFitContents:()=>r3,setTableProperties:i3,applyTableStyle:o3,setCellFillColor:GO,setTableBorderColor:UO,setTableBorderWidth:XO,removeTableBorders:()=>Qi("none"),setAllTableBorders:a=>Qi("all",a),setOutsideTableBorders:a=>Qi("outside",a),setInsideTableBorders:a=>Qi("inside",a)}}}var c3=Nt({name:"table",schemaNodeName:"table",nodeSpec:TO}),d3=Nt({name:"tableRow",schemaNodeName:"tableRow",nodeSpec:$O}),u3=Nt({name:"tableCell",schemaNodeName:"tableCell",nodeSpec:MO}),f3=Nt({name:"tableHeader",schemaNodeName:"tableHeader",nodeSpec:RO}),p3=Cn({name:"tablePlugin",onSchemaReady:s3});function h3(){return[c3(),d3(),u3(),f3(),p3()]}var Xs=200,Dt=function(){};Dt.prototype.append=function(e){return e.length?(e=Dt.from(e),!this.length&&e||e.length<Xs&&this.leafAppend(e)||this.length<Xs&&e.leafPrepend(this)||this.appendInner(e)):this};Dt.prototype.prepend=function(e){return e.length?Dt.from(e).append(this):this};Dt.prototype.appendInner=function(e){return new m3(this,e)};Dt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Dt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Dt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Dt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Dt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,l){return o.push(e(i,l))},n,r),o};Dt.from=function(e){return e instanceof Dt?e:e&&e.length?new fk(e):Dt.empty};var fk=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,l,a){for(var s=i;s<l;s++)if(o(this.values[s],a+s)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,l,a){for(var s=i-1;s>=l;s--)if(o(this.values[s],a+s)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Xs)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Xs)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Dt);Dt.empty=new fk([]);var m3=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,i,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),l)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,l+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,l)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Dt);const g3=500;class jn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let l=e.tr,a,s,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,d.push(u);return}if(o){d.push(new Gn(u.map));let h=u.step.map(o.slice(i)),p;h&&l.maybeStep(h).doc&&(p=l.mapping.maps[l.mapping.maps.length-1],c.push(new Gn(p,void 0,void 0,c.length+d.length))),i--,p&&o.appendMap(p,i)}else l.maybeStep(u.step);if(u.selection)return a=o?u.selection.map(o.slice(i)):u.selection,s=new jn(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:l,selection:a}}addTransform(e,n,r,o){let i=[],l=this.eventCount,a=this.items,s=!o&&a.length?a.get(a.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new Gn(e.mapping.maps[d],u,n),h;(h=s&&s.merge(f))&&(f=h,d?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(l++,n=void 0),o||(s=f)}let c=l-r.depth;return c>b3&&(a=y3(a,c),l-=c),new jn(a.append(i),l)}remapping(e,n){let r=new Hl;return this.items.forEach((o,i)=>{let l=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new jn(this.items.append(e.map(n=>new Gn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let s=n;this.items.forEach(f=>{let h=i.getMirror(--s);if(h==null)return;l=Math.min(l,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(i.slice(s+1,h));y&&a++,r.push(new Gn(p,m,y))}else r.push(new Gn(p))},o);let c=[];for(let f=n;f<l;f++)c.push(new Gn(i.maps[f]));let d=this.items.slice(0,o).append(c).append(r),u=new jn(d,a);return u.emptyItemCount()>g3&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&i++;else if(l.step){let s=l.step.map(n.slice(r)),c=s&&s.getMap();if(r--,c&&n.appendMap(c,r),s){let d=l.selection&&l.selection.map(n.slice(r));d&&i++;let u=new Gn(c.invert(),s,d),f,h=o.length-1;(f=o.length&&o[h].merge(u))?o[h]=f:o.push(u)}}else l.map&&r--},this.items.length,0),new jn(Dt.from(o.reverse()),i)}}jn.empty=new jn(Dt.empty,0);function y3(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Gn{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Gn(n.getMap().invert(),n,this.selection)}}}class Br{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const b3=20;function w3(t,e,n,r){let o=n.getMeta(tr),i;if(o)return o.historyState;n.getMeta(k3)&&(t=new Br(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(tr))return l.getMeta(tr).redo?new Br(t.done.addTransform(n,void 0,r,ks(e)),t.undone,N0(n.mapping.maps),t.prevTime,t.prevComposition):new Br(t.done,t.undone.addTransform(n,void 0,r,ks(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),s=t.prevTime==0||!l&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!x3(n,t.prevRanges)),c=l?iu(t.prevRanges,n.mapping):N0(n.mapping.maps);return new Br(t.done.addTransform(n,s?e.selection.getBookmark():void 0,r,ks(e)),jn.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Br(t.done.rebased(n,i),t.undone.rebased(n,i),iu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Br(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),iu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function x3(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function N0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,l)=>e.push(i,l));return e}function iu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function v3(t,e,n){let r=ks(e),o=tr.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let l=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),s=new Br(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(l).setMeta(tr,{redo:n,historyState:s})}let lu=!1,L0=null;function ks(t){let e=t.plugins;if(L0!=e){lu=!1,L0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){lu=!0;break}}return lu}const tr=new fn("history"),k3=new fn("closeHistory");function C3(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new zt({key:tr,state:{init(){return new Br(jn.empty,jn.empty,null,0,-1)},apply(e,n,r){return w3(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Ai:r=="historyRedo"?Fo:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function pk(t,e){return(n,r)=>{let o=tr.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=v3(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const Ai=pk(!1,!0),Fo=pk(!0,!0);function S3(t){let e=tr.getState(t);return e?e.done.eventCount:0}function T3(t){let e=tr.getState(t);return e?e.undone.eventCount:0}function $3(t){return t.getMeta(tr)!=null}function I3(t={}){return new zt({view(e){return new M3(e,t)}})}class M3{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=l=>{this[o](l)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),l=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=u?p.bottom:p.top;u&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*l;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!s||s==document.body&&getComputedStyle(s).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=s.getBoundingClientRect(),f=u.width/s.offsetWidth,h=u.height/s.offsetHeight;c=u.left-s.scrollLeft*f,d=u.top-s.scrollTop*h}this.element.style.left=(r.left-c)/l+"px",this.element.style.top=(r.top-d)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(!n||i)return null;let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=xx(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}return l}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}function R3(t){let e=t.indentLeft;t.numPr?.numId&&e==null&&(e=((t.numPr.ilvl??0)+1)*720);let n={alignment:t.alignment,spaceBefore:t.spaceBefore,spaceAfter:t.spaceAfter,beforeAutospacing:t._originalFormatting?.beforeAutospacing,afterAutospacing:t._originalFormatting?.afterAutospacing,lineSpacing:t.lineSpacing,lineSpacingRule:t.lineSpacingRule,indentLeft:e,indentRight:t.indentRight,indentFirstLine:t.indentFirstLine,hangingIndent:t.hangingIndent,borders:t.borders,shading:t.shading},r=SI(n);return r.marginTop&&(r["--docx-space-before"]=r.marginTop),r.marginBottom&&(r["--docx-space-after"]=r.marginBottom),Object.entries(r).map(([o,i])=>`${o.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${i}`).join("; ")}function P3(t){switch(t){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 E3(t,e,n){if(!t?.numId)return"";let r=t.ilvl??0;return e?`docx-list-bullet docx-list-level-${r}`:`docx-list-numbered ${P3(n)} docx-list-level-${r}`}function hi(t){if(!t)return;let e=t.trim(),n=parseFloat(e);if(!(isNaN(n)||n===0)){if(e.endsWith("pt"))return Math.round(n*20);if(e.endsWith("px"))return Math.round(n*15);if(e.endsWith("in"))return Math.round(n*1440);if(e.endsWith("mm"))return Math.round(n*(1440/25.4));if(e.endsWith("cm"))return Math.round(n*(1440/2.54));if(/^[\d.]+$/.test(e))return Math.round(n*15)}}function F3(t){switch(t.trim().toLowerCase()){case"left":case"start":return"left";case"center":return"center";case"right":case"end":return"right";case"justify":return"both";default:return}}function A3(t){if(!t||t==="normal")return;let e=t.trim();if(e.endsWith("%")){let r=parseFloat(e);return isNaN(r)||r===0?void 0:{lineSpacing:Math.round(240*(r/100)),lineSpacingRule:"auto"}}if(/[a-z]/i.test(e)){let r=hi(e);return r==null?void 0:{lineSpacing:r,lineSpacingRule:"exact"}}let n=parseFloat(e);if(!(isNaN(n)||n===0))return{lineSpacing:Math.round(240*n),lineSpacingRule:"auto"}}function B0(t){let e=t.style,n={};if(e.textAlign){let i=F3(e.textAlign);i&&(n.alignment=i)}let r=e.marginLeft||e.paddingLeft;if(r){let i=hi(r);i!=null&&(n.indentLeft=i)}let o=e.marginRight||e.paddingRight;if(o){let i=hi(o);i!=null&&(n.indentRight=i)}if(e.textIndent){let i=hi(e.textIndent);i!=null&&(i<0?(n.indentFirstLine=Math.abs(i),n.hangingIndent=!0):n.indentFirstLine=i)}if(e.lineHeight){let i=A3(e.lineHeight);i&&(n.lineSpacing=i.lineSpacing,n.lineSpacingRule=i.lineSpacingRule)}if(e.marginTop){let i=hi(e.marginTop);i!=null&&(n.spaceBefore=i)}if(e.marginBottom){let i=hi(e.marginBottom);i!=null&&(n.spaceAfter=i)}return n}var D3={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},spacingExplicit:{default:null},indentLeft:{default:null},indentRight:{default:null},indentFirstLine:{default:null},hangingIndent:{default:!1},numPr:{default:null},numPrFromStyle:{default:null},listNumFmt:{default:null},listIsBullet:{default:null},listMarker:{default:null},listMarkerHidden:{default:null},listMarkerFontFamily:{default:null},listMarkerFontSize:{default:null},listMarkerSuffix:{default:null},listLevelNumFmts:{default:null},listAbstractNumId:{default:null},listStartOverride:{default:null},styleId:{default:null},borders:{default:null},shading:{default:null},tabs:{default:null},pageBreakBefore:{default:null},renderedPageBreakBefore:{default:null},keepNext:{default:null},keepLines:{default:null},contextualSpacing:{default:null},defaultTextFormatting:{default:null},sectionBreakType:{default:null},bidi:{default:null},outlineLevel:{default:null},bookmarks:{default:null},_originalFormatting:{default:null},_originalRunBoundaries:{default:null},_sectionProperties:{default:null},pPrIns:{default:null},pPrDel:{default:null},pPrChange:{default:null}},parseDOM:[{tag:"p",getAttrs(t){let e=t,n={paraId:e.dataset.paraId||void 0,alignment:e.dataset.alignment,styleId:e.dataset.styleId||void 0,sectionBreakType:e.dataset.sectionBreak||void 0},r=B0(e);return{...r,...n,alignment:n.alignment||r.alignment||void 0}}},...["h1","h2","h3","h4","h5","h6"].map(t=>({tag:t,getAttrs(e){let n=parseInt(t.charAt(1));return{...B0(e),styleId:`Heading${n}`,outlineLevel:n-1}}}))],toDOM(t){let e=t.attrs,n=R3(e),r=E3(e.numPr,e.listIsBullet,e.listNumFmt),o={};if(n&&(o.style=n),r&&(o.class=r),e.paraId&&(o["data-para-id"]=e.paraId),e.alignment&&(o["data-alignment"]=e.alignment),e.styleId&&(o["data-style-id"]=e.styleId),e.listMarker&&(o["data-list-marker"]=e.listMarker),e.bidi&&(o.dir="rtl"),e.sectionBreakType&&(o["data-section-break"]=e.sectionBreakType,o.class=(o.class?o.class+" ":"")+"docx-section-break"),e.pPrIns||e.pPrDel){let i=e.pPrIns??e.pPrDel,l=e.pPrIns?"ep-revision-ins":"ep-revision-del";o.class=(o.class?o.class+" ":"")+"ep-revision-pmark "+l,o["data-revision-id"]=String(i.revisionId),o["data-revision-author"]=i.author,i.date&&(o["data-revision-date"]=i.date)}else if(Array.isArray(e.pPrChange)&&e.pPrChange.length>0){let i=e.pPrChange[0];o.class=(o.class?o.class+" ":"")+"ep-revision-prop-change",o["data-revision-id"]=String(i.info.id),o["data-revision-author"]=i.info.author,i.info.date&&(o["data-revision-date"]=i.info.date)}return["p",o,0]}};function rn(t,e){return(n,r)=>{let{$from:o,$to:i}=n.selection;if(!r)return!0;let l=n.tr,a=new Set;return n.doc.nodesBetween(o.pos,i.pos,(s,c)=>{s.type.name==="paragraph"&&!a.has(c)&&(a.add(c),l=l.setNodeMarkup(c,void 0,{...s.attrs,[t]:e}))}),r(l.scrollIntoView()),!0}}function hk(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(!n)return!0;let i=e.tr,l=new Set;return e.doc.nodesBetween(r.pos,o.pos,(a,s)=>{a.type.name==="paragraph"&&!l.has(s)&&(l.add(s),i=i.setNodeMarkup(s,void 0,{...a.attrs,...t}))}),n(i.scrollIntoView()),!0}}function el(t){return(e,n)=>rn("alignment",t)(e,n)}function Za(t,e="auto"){return(n,r)=>hk({lineSpacing:t,lineSpacingRule:e})(n,r)}function N3(t=720){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(!n)return!0;let i=e.tr,l=new Set;return e.doc.nodesBetween(r.pos,o.pos,(a,s)=>{if(a.type.name==="paragraph"&&!l.has(s)){l.add(s);let c=a.attrs.indentLeft||0;i=i.setNodeMarkup(s,void 0,{...a.attrs,indentLeft:c+t})}}),n(i.scrollIntoView()),!0}}function L3(t=720){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(!n)return!0;let i=e.tr,l=new Set;return e.doc.nodesBetween(r.pos,o.pos,(a,s)=>{if(a.type.name==="paragraph"&&!l.has(s)){l.add(s);let c=a.attrs.indentLeft||0,d=Math.max(0,c-t);i=i.setNodeMarkup(s,void 0,{...a.attrs,indentLeft:d>0?d:null})}}),n(i.scrollIntoView()),!0}}function B3(t){return(e,n)=>(r,o)=>{let{$from:i,$to:l}=r.selection;if(!o)return!0;let a=r.tr,s=new Set,c=[];if(n?.runFormatting){let u=n.runFormatting;u.bold&&c.push(t.marks.bold.create()),u.italic&&c.push(t.marks.italic.create()),(u.fontSize||u.fontSizeCs)&&c.push(t.marks.fontSize.create({size:u.fontSize??null,sizeCs:u.fontSizeCs??u.fontSize??null})),u.fontFamily&&c.push(t.marks.fontFamily.create({ascii:u.fontFamily.ascii,hAnsi:u.fontFamily.hAnsi,asciiTheme:u.fontFamily.asciiTheme})),u.color&&!u.color.auto&&c.push(t.marks.textColor.create({rgb:u.color.rgb,themeColor:u.color.themeColor,themeTint:u.color.themeTint,themeShade:u.color.themeShade})),u.underline&&u.underline.style!=="none"&&c.push(t.marks.underline.create({style:u.underline.style,color:u.underline.color})),(u.strike||u.doubleStrike)&&c.push(t.marks.strike.create({double:u.doubleStrike||!1}))}let d=[t.marks.bold,t.marks.italic,t.marks.fontSize,t.marks.fontFamily,t.marks.textColor,t.marks.underline,t.marks.strike].filter(Boolean);return r.doc.nodesBetween(i.pos,l.pos,(u,f)=>{if(u.type.name==="paragraph"&&!s.has(f)){s.add(f);let h={...u.attrs,styleId:e};if(n){Object.assign(h,c1(n));let p=D4(n,n.numbering);p&&Object.assign(h,p)}if(a=a.setNodeMarkup(f,void 0,h),n){let p=f+1,m=f+u.nodeSize-1;if(m>p){for(let y of d)a=a.removeMark(p,m,y);for(let y of c)a=a.addMark(p,m,y)}}}}),c.length>0&&(a=a.setStoredMarks(c)),o(a.scrollIntoView()),!0}}var O3=Nt({name:"paragraph",schemaNodeName:"paragraph",nodeSpec:D3,onSchemaReady(t){let e=B3(t.schema);return{commands:{setAlignment:n=>el(n),alignLeft:()=>el("left"),alignCenter:()=>el("center"),alignRight:()=>el("right"),alignJustify:()=>el("both"),setLineSpacing:(n,r)=>Za(n,r),singleSpacing:()=>Za(240),oneAndHalfSpacing:()=>Za(360),doubleSpacing:()=>Za(480),setSpaceBefore:n=>rn("spaceBefore",n),setSpaceAfter:n=>rn("spaceAfter",n),increaseIndent:n=>N3(n),decreaseIndent:n=>L3(n),setIndentLeft:n=>rn("indentLeft",n>0?n:null),setIndentRight:n=>rn("indentRight",n>0?n:null),setIndentFirstLine:(n,r)=>hk({indentFirstLine:n>0?n:null,hangingIndent:r??!1}),applyStyle:(n,r)=>e(n,r),clearStyle:()=>rn("styleId",null),insertSectionBreak:n=>rn("sectionBreakType",n),removeSectionBreak:()=>rn("sectionBreakType",null),generateTOC:()=>(n,r)=>{let o=Rs(n.doc);if(o.length===0)return!1;if(!r)return!0;let{schema:i}=n,l=n.tr,a=[];for(let d of o){let u=`_Toc${Math.floor(1e8+Math.random()*9e8)}`;a.push({name:u,level:d.level,text:d.text});let f=l.mapping.map(d.pmPos),h=l.doc.resolve(f).nodeAfter;if(h&&h.type.name==="paragraph"){let p=[...(h.attrs.bookmarks||[]).filter(m=>!m.name.startsWith("_Toc")),{id:Math.floor(Math.random()*2147483647),name:u}];l.setNodeMarkup(f,void 0,{...h.attrs,bookmarks:p})}}let s=[];s.push(i.node("paragraph",{styleId:"TOCHeading",alignment:"center"},[i.text("Table of Contents",[i.marks.bold.create()])]));for(let d of a){let u=d.level*720,f=`TOC${d.level+1}`,h=i.marks.hyperlink.create({href:`#${d.name}`});s.push(i.node("paragraph",{styleId:f,indentLeft:u>0?u:null},[i.text(d.text,[h])]))}let c=l.mapping.map(n.selection.from);return l.insert(c,oe.from(s)),r(l.scrollIntoView()),!0},toggleBidi:()=>(n,r)=>{let{$from:o}=n.selection,i=o.parent;if(i.type.name!=="paragraph")return!1;let l=i.attrs.bidi||!1;return rn("bidi",l?null:!0)(n,r)},setRtl:()=>rn("bidi",!0),setLtr:()=>rn("bidi",null),setTabs:n=>rn("tabs",n.length>0?n:null),addTabStop:(n,r="left",o="none")=>(i,l)=>{let{$from:a}=i.selection,s=a.parent;if(s.type.name!=="paragraph")return!1;let c=[...(s.attrs.tabs||[]).filter(d=>d.position!==n),{position:n,alignment:r,leader:o}].sort((d,u)=>d.position-u.position);return rn("tabs",c)(i,l)},removeTabStop:n=>(r,o)=>{let{$from:i}=r.selection,l=i.parent;if(l.type.name!=="paragraph")return!1;let a=(l.attrs.tabs||[]).filter(s=>s.position!==n);return rn("tabs",a.length>0?a:null)(r,o)}}}}});function mk(t){let e=t.schema.marks.hyperlink;if(!e)return null;let{empty:n,$from:r,from:o,to:i}=t.selection;if(n){let a=t.storedMarks||r.marks();for(let s of a)if(s.type===e)return{href:s.attrs.href,tooltip:s.attrs.tooltip};return null}let l=null;return t.doc.nodesBetween(o,i,a=>{if(a.isText&&l===null){let s=e.isInSet(a.marks);if(s)return l={href:s.attrs.href,tooltip:s.attrs.tooltip},!1}return!0}),l}function gk(t){let{from:e,to:n,empty:r}=t.selection;return r?"":t.doc.textBetween(e,n,"")}function O0(t,e){let n=t.schema.marks.hyperlink;if(!n)return null;let{$from:r}=t.selection,o=r.marks().find(c=>c.type===n);if(!o&&r.nodeAfter&&(o=r.nodeAfter.marks.find(c=>c.type===n)),!o&&r.nodeBefore&&(o=r.nodeBefore.marks.find(c=>c.type===n)),!o&&e&&r.parent.forEach(c=>{if(o||!c.isText)return;let d=c.marks.find(u=>u.type===n&&u.attrs.href===e);d&&(o=d)}),!o)return null;let i=r.start(),l=[],a=null;r.parent.forEach((c,d)=>{let u=i+d,f=u+c.nodeSize;c.isText&&c.marks.some(h=>h.type===n&&h.attrs.href===o.attrs.href)?a?a.end=f:a={start:u,end:f}:a&&(l.push(a),a=null)}),a&&l.push(a);let s=l.find(c=>c.start<=r.pos&&r.pos<=c.end);return s?{mark:o,start:s.start,end:s.end}:null}var j3=it({name:"hyperlink",schemaMarkName:"hyperlink",markSpec:{attrs:{href:{},tooltip:{default:null},rId:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>{let e=t,n=yc(e.getAttribute("href"));return n?{href:n,tooltip:e.getAttribute("title")||void 0}:!1}}],toDOM(t){let e=t.attrs,n={href:e.href,target:"_blank",rel:"noopener noreferrer"};return e.tooltip&&(n.title=e.tooltip),["a",n,0]}},onSchemaReady(t){let e=t.schema.marks.hyperlink,n=(o,i)=>(l,a)=>{let{from:s,to:c,empty:d}=l.selection;if(d)return!1;if(a){let u=e.create({href:o,tooltip:i||null}),f=l.tr.addMark(s,c,u),h=l.schema.marks.textColor;h&&(f=f.removeMark(s,c,h)),a(f.scrollIntoView())}return!0},r=(o,i)=>{let{from:l,to:a,empty:s}=o.selection;if(s){let c=o.selection.$from;if(!c.marks().find(f=>f.type===e))return!1;let d=c.pos,u=c.pos;return c.parent.forEach((f,h)=>{if(f.isText){let p=c.start()+h,m=p+f.nodeSize;p<=c.pos&&c.pos<=m&&f.marks.some(y=>y.type===e)&&(d=Math.min(d,p),u=Math.max(u,m))}}),i&&i(o.tr.removeMark(d,u,e).scrollIntoView()),!0}return i&&i(o.tr.removeMark(l,a,e).scrollIntoView()),!0};return{commands:{setHyperlink:n,removeHyperlink:()=>r,insertHyperlink:(o,i,l)=>(a,s)=>{if(s){let c=e.create({href:i,tooltip:l||null}),d=a.schema.text(o,[c]);s(a.tr.replaceSelectionWith(d,!1).scrollIntoView())}return!0}}}}});function au(...t){return(e,n,r)=>{for(let o of t)if(o(e,n,r))return!0;return!1}}function z3(t,e,n){let r=Array.isArray(t.pPrChange)?t.pPrChange:[];return{...t,pPrChange:[...r,{type:"paragraphPropertyChange",info:{id:n.revisionId,author:n.author,date:n.date??void 0},previousFormatting:e}]}}function yk(t){return(e,n)=>{let{$from:r,$to:o}=e.selection,i=r.parent;if(i.type.name!=="paragraph")return!1;let l=i.attrs.numPr?.numId===t;if(!n)return!0;let a=e.tr,s=new Set,c=Oi(e);return e.doc.nodesBetween(r.pos,o.pos,(d,u)=>{if(d.type.name==="paragraph"&&!s.has(u)){s.add(u);let f=d.attrs.numPr,h;if(l)h={...d.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null};else{let p=t===1;h={...d.attrs,numPr:{numId:t,ilvl:d.attrs.numPr?.ilvl||0},listIsBullet:p,listNumFmt:p?null:"decimal",listMarker:null}}c&&(h=z3(h,{numPr:f??null},c)),a=a.setNodeMarkup(u,void 0,h)}}),c&&a.setMeta(En,!0),n(a.scrollIntoView()),!0}}var H3=(t,e)=>yk(1)(t,e),_3=(t,e)=>yk(2)(t,e),W3=(t,e)=>{let{$from:n}=t.selection,r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return!1;let o=r.attrs.numPr.ilvl||0;if(o>=8)return!1;if(!e)return!0;let i=n.before(n.depth);return e(t.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:{...r.attrs.numPr,ilvl:o+1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),!0},V3=(t,e)=>{let{$from:n}=t.selection,r=n.parent;if(r.type.name!=="paragraph"||!r.attrs.numPr)return!1;let o=r.attrs.numPr.ilvl||0;if(!e)return!0;let i=n.before(n.depth);return o<=0?e(t.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()):e(t.tr.setNodeMarkup(i,void 0,{...r.attrs,numPr:{...r.attrs.numPr,ilvl:o-1},indentLeft:null,indentFirstLine:null,hangingIndent:null}).scrollIntoView()),!0},q3=(t,e)=>{let{$from:n,$to:r}=t.selection;if(!e)return!0;let o=t.tr,i=new Set;return t.doc.nodesBetween(n.pos,r.pos,(l,a)=>{l.type.name==="paragraph"&&l.attrs.numPr&&!i.has(a)&&(i.add(a),o=o.setNodeMarkup(a,void 0,{...l.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null}))}),e(o.scrollIntoView()),!0};function Z3(){return(t,e)=>{let{$from:n,empty:r}=t.selection;if(!r)return!1;let o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr||o.textContent.length>0)return!1;if(e){let i=t.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});e(i)}return!0}}function K3(){return(t,e)=>{let{$from:n,empty:r}=t.selection;if(!r)return!1;let o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return!1;if(e){let{tr:i}=t,l=n.pos;i.split(l,1,[{type:t.schema.nodes.paragraph,attrs:{...o.attrs}}]),e(i.scrollIntoView())}return!0}}function U3(){return(t,e)=>{let{$from:n,empty:r}=t.selection;if(!r||n.parentOffset!==0)return!1;let o=n.parent;if(o.type.name!=="paragraph"||!o.attrs.numPr)return!1;if(e){let i=t.tr.setNodeMarkup(n.before(),void 0,{...o.attrs,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null});e(i)}return!0}}function X3(){return(t,e)=>{let{$from:n,$to:r}=t.selection,o=[];if(t.doc.nodesBetween(n.pos,r.pos,(i,l)=>{i.type.name==="paragraph"&&i.attrs.numPr&&(i.attrs.numPr.ilvl??0)<8&&o.push({pos:l,attrs:i.attrs})}),o.length===0)return!1;if(e){let i=t.tr;for(let{pos:l,attrs:a}of o){let s=a.numPr;i=i.setNodeMarkup(l,void 0,{...a,numPr:{...s,ilvl:(s.ilvl??0)+1},indentLeft:null,indentFirstLine:null,hangingIndent:null})}e(i)}return!0}}function G3(){return(t,e)=>{let{$from:n,$to:r}=t.selection,o=[];if(t.doc.nodesBetween(n.pos,r.pos,(i,l)=>{i.type.name==="paragraph"&&i.attrs.numPr&&o.push({pos:l,attrs:i.attrs})}),o.length===0)return!1;if(e){let i=t.tr;for(let{pos:l,attrs:a}of o){let s=a.numPr,c=s.ilvl??0;c<=0?i=i.setNodeMarkup(l,void 0,{...a,numPr:null,listIsBullet:null,listNumFmt:null,listMarker:null,indentLeft:null,indentFirstLine:null,hangingIndent:null}):i=i.setNodeMarkup(l,void 0,{...a,numPr:{...s,ilvl:c-1},indentLeft:null,indentFirstLine:null,hangingIndent:null})}e(i)}return!0}}function Y3(){return(t,e)=>{let{schema:n}=t,r=n.nodes.tab;if(!r)return!1;if(e){let o=t.tr.replaceSelectionWith(r.create());e(o.scrollIntoView())}return!0}}var J3=Cn({name:"list",priority:ei.High,onSchemaReady(){return{commands:{toggleBulletList:()=>H3,toggleNumberedList:()=>_3,increaseListLevel:()=>W3,decreaseListLevel:()=>V3,removeList:()=>q3},keyboardShortcuts:{Tab:au(PO(),X3(),Y3()),"Shift-Tab":au(EO(),G3()),"Shift-Enter":()=>!1,Enter:au(Z3(),K3()),Backspace:U3()}}}}),Gs=new fn("paragraphChangeTracker");function j0(t){let e=0;return t.descendants(n=>{n.type.name==="paragraph"&&e++}),e}function bf(t,e,n){let r=new Set,o=!1;return t.nodesBetween(e,n,i=>{if(i.type.name==="paragraph"){let l=i.attrs.paraId;l?r.add(l):o=!0}}),{ids:r,hasUntracked:o}}function Q3(t,e,n){let r=Math.min(e,n),o=Math.max(e,n),i=o>r?o:r+1,l=bf(t,r,i);if(l.ids.size>0||l.hasUntracked)return l;try{let a=t.resolve(r);for(let s=a.depth;s>=0;s--){let c=a.node(s);if(c.type.name==="paragraph"){let d=c.attrs.paraId;return d?{ids:new Set([d]),hasUntracked:!1}:{ids:new Set,hasUntracked:!0}}}}catch{}return{ids:new Set,hasUntracked:!1}}function ej(){return new zt({key:Gs,state:{init(t,e){return{changedParaIds:new Set,structuralChange:!1,hasUntrackedChanges:!1,paragraphCount:j0(e.doc)}},apply(t,e){if(t.getMeta(Gs)==="clear")return{changedParaIds:new Set,structuralChange:!1,hasUntrackedChanges:!1,paragraphCount:e.paragraphCount};if(t.steps.length===0)return e;let n=j0(t.doc),r={changedParaIds:new Set(e.changedParaIds),structuralChange:e.structuralChange,hasUntrackedChanges:e.hasUntrackedChanges,paragraphCount:n};e.paragraphCount!==n&&(r.structuralChange=!0);for(let o=0;o<t.steps.length;o++){let i=t.steps[o],l=t.mapping.slice(o+1);if(i instanceof hr||i instanceof zn){let a=l.map(i.from,1),s=l.map(i.to,-1);if(s<=a)continue;let{ids:c,hasUntracked:d}=Q3(t.doc,a,s);for(let u of c)r.changedParaIds.add(u);d&&(r.hasUntrackedChanges=!0);continue}if(i instanceof mr||i instanceof oo){let a=l.map(i.pos,1),s=t.doc.nodeAt(a);if(!s)continue;let c=a+s.nodeSize,{ids:d,hasUntracked:u}=bf(t.doc,a,c);for(let f of d)r.changedParaIds.add(f);u&&(r.hasUntrackedChanges=!0);continue}i.getMap().forEach((a,s,c,d)=>{let u=l.map(c,1),f=l.map(d,-1);if(f<u)return;let{ids:h,hasUntracked:p}=bf(t.doc,u,f);for(let m of h)r.changedParaIds.add(m);p&&(r.hasUntrackedChanges=!0)})}return r}}})}function Yp(t){return Gs.getState(t)}function tj(t){return Yp(t)?.changedParaIds??new Set}function nj(t){return Yp(t)?.structuralChange??!1}function rj(t){return Yp(t)?.hasUntrackedChanges??!1}function oj(t){return t.tr.setMeta(Gs,"clear")}var ij=Cn({name:"paragraphChangeTracker",defaultOptions:{},onSchemaReady(){return{plugins:[ej()]}}}),wf=new fn("paraIdAllocator");function bk(t){let e=new Set,n=[];return t.descendants((r,o)=>{if(r.type.name!=="paragraph")return;let i=r.attrs.paraId;if(!i||e.has(i)){let l=zo();for(;e.has(l);)l=zo();e.add(l),n.push({pos:o,attrs:{...r.attrs,paraId:l}})}else e.add(i);return!1}),n}function lj(t){let e=bk(t.doc);if(e.length===0)return t;let n=t.tr;for(let r of e)n.setNodeMarkup(r.pos,void 0,r.attrs);return n.setMeta(wf,"allocated"),n.setMeta("addToHistory",!1),t.apply(n)}function aj(){return new zt({key:wf,appendTransaction(t,e,n){if(!t.some(i=>i.docChanged))return null;let r=bk(n.doc);if(r.length===0)return null;let o=n.tr;for(let i of r)o.setNodeMarkup(i.pos,void 0,i.attrs);return o.setMeta(wf,"allocated"),o.setMeta("addToHistory",!1),o}})}var sj=Cn({name:"paraIdAllocator",onSchemaReady(){return{plugins:[aj()]}}}),cj=Nt({name:"doc",schemaNodeName:"doc",nodeSpec:{content:"(paragraph | horizontalRule | pageBreak | table | textBox | blockSdt)+",attrs:{defaultTabStopTwips:{default:null},watermark:{default:null}}}}),dj=Nt({name:"text",schemaNodeName:"text",nodeSpec:{group:"inline"}}),uj=Cn({name:"history",defaultOptions:{depth:100,newGroupDelay:500},onSchemaReady(t,e){return{plugins:[C3({depth:e.depth,newGroupDelay:e.newGroupDelay})],commands:{undo:()=>Ai,redo:()=>Fo},keyboardShortcuts:{"Mod-z":Ai,"Mod-y":Fo,"Mod-Shift-z":Fo}}}}),fj=it({name:"bold",schemaMarkName:"bold",markSpec:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs(t){let e=t.style?.fontWeight;return e==="normal"||e==="400"?!1:null}},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2})$/.test(t)?null:!1}],toDOM(){return["strong",0]}},onSchemaReady(t){return{commands:{toggleBold:()=>Sr(t.schema.marks.bold)},keyboardShortcuts:{"Mod-b":Sr(t.schema.marks.bold)}}}}),pj=it({name:"italic",schemaMarkName:"italic",markSpec:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:t=>t==="italic"?null:!1}],toDOM(){return["em",0]}},onSchemaReady(t){return{commands:{toggleItalic:()=>Sr(t.schema.marks.italic)},keyboardShortcuts:{"Mod-i":Sr(t.schema.marks.italic)}}}}),hj=it({name:"underline",schemaMarkName:"underline",markSpec:{attrs:{style:{default:"single"},color:{default:null}},parseDOM:[{tag:"u"},{style:"text-decoration",getAttrs:t=>t.includes("underline")?{}:!1}],toDOM(t){let e=t.attrs,n=["text-decoration: underline"];if(e.style&&e.style!=="single"){let r={double:"double",dotted:"dotted",dash:"dashed",wave:"wavy"}[e.style];r&&n.push(`text-decoration-style: ${r}`)}return e.color?.rgb&&n.push(`text-decoration-color: #${e.color.rgb}`),["span",{style:n.join("; ")},0]}},onSchemaReady(t){return{commands:{toggleUnderline:()=>Sr(t.schema.marks.underline),setUnderlineStyle:(e,n)=>la(t.schema.marks.underline,{style:e,color:n})},keyboardShortcuts:{"Mod-u":Sr(t.schema.marks.underline)}}}}),mj=it({name:"strike",schemaMarkName:"strike",markSpec:{attrs:{double:{default:!1}},parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:t=>t.includes("line-through")?{}:!1}],toDOM(){return["s",0]}},onSchemaReady(t){return{commands:{toggleStrike:()=>Sr(t.schema.marks.strike)}}}}),gj=it({name:"textColor",schemaMarkName:"textColor",markSpec:{attrs:{rgb:{default:null},themeColor:{default:null},themeTint:{default:null},themeShade:{default:null}},parseDOM:[{style:"color",getAttrs:t=>{let e=t.match(/#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})/);return e?{rgb:e[1].toUpperCase()}:!1}}],toDOM(t){let e=t.attrs,n=CI({color:e});return["span",{style:n.color?`color: ${n.color}`:""},0]}},onSchemaReady(t){return{commands:{setTextColor:e=>!e.rgb&&!e.themeColor?Ri(t.schema.marks.textColor):la(t.schema.marks.textColor,e),clearTextColor:()=>Ri(t.schema.marks.textColor)}}}}),yj=it({name:"highlight",schemaMarkName:"highlight",markSpec:{attrs:{color:{default:"yellow"}},parseDOM:[{tag:"mark"},{style:"background-color",getAttrs:t=>t&&t!=="transparent"&&t!=="inherit"?{color:t}:!1}],toDOM(t){let e=t.attrs.color;return["mark",{style:`background-color: ${Gf(e)}`},0]}},onSchemaReady(t){return{commands:{setHighlight:e=>!e||e==="none"?Ri(t.schema.marks.highlight):la(t.schema.marks.highlight,{color:e}),clearHighlight:()=>Ri(t.schema.marks.highlight)}}}}),bj=it({name:"fontSize",schemaMarkName:"fontSize",markSpec:{attrs:{size:{default:null},sizeCs:{default:null}},parseDOM:[{style:"font-size",getAttrs:t=>{let e=t,n=e.match(/^([\d.]+)px$/);if(n){let o=parseFloat(n[1])*.75;return{size:Math.round(o*2)}}let r=e.match(/^([\d.]+)pt$/);return r?{size:Math.round(parseFloat(r[1])*2)}:!1}}],toDOM(t){let e=(t.attrs.size??t.attrs.sizeCs??24)/2,n=(e*1.15).toFixed(2);return["span",{style:`font-size: ${e}pt; line-height: ${n}pt`},0]}},onSchemaReady(t){return{commands:{setFontSize:e=>la(t.schema.marks.fontSize,{size:e,sizeCs:e}),clearFontSize:()=>Ri(t.schema.marks.fontSize)}}}}),wj=it({name:"fontFamily",schemaMarkName:"fontFamily",markSpec:{attrs:{ascii:{default:null},hAnsi:{default:null},eastAsia:{default:null},cs:{default:null},asciiTheme:{default:null},hAnsiTheme:{default:null},eastAsiaTheme:{default:null},csTheme:{default:null}},parseDOM:[{style:"font-family",getAttrs:t=>{let e=t.split(",")[0].trim().replace(/['"]/g,"");return e?{ascii:e}:!1}}],toDOM(t){let e=t.attrs,n=e.ascii||e.hAnsi||e.cs;return n?["span",{style:`font-family: ${n.includes(" ")?`"${n}"`:n}, sans-serif`},0]:["span",0]}},onSchemaReady(t){return{commands:{setFontFamily:e=>la(t.schema.marks.fontFamily,{ascii:e,hAnsi:e}),clearFontFamily:()=>Ri(t.schema.marks.fontFamily)}}}}),xj=it({name:"superscript",schemaMarkName:"superscript",markSpec:{excludes:"subscript",parseDOM:[{tag:"sup"}],toDOM(){return["sup",0]}},onSchemaReady(t){return{commands:{toggleSuperscript:()=>Sr(t.schema.marks.superscript)}}}}),vj=it({name:"subscript",schemaMarkName:"subscript",markSpec:{excludes:"superscript",parseDOM:[{tag:"sub"}],toDOM(){return["sub",0]}},onSchemaReady(t){return{commands:{toggleSubscript:()=>Sr(t.schema.marks.subscript)}}}}),kj=it({name:"allCaps",schemaMarkName:"allCaps",markSpec:{parseDOM:[{style:"text-transform",getAttrs:t=>t==="uppercase"?{}:!1}],toDOM(){return["span",{style:"text-transform: uppercase"},0]}}}),Cj=it({name:"smallCaps",schemaMarkName:"smallCaps",markSpec:{parseDOM:[{style:"font-variant",getAttrs:t=>t==="small-caps"?{}:!1}],toDOM(){return["span",{style:"font-variant: small-caps"},0]}}}),Sj=it({name:"footnoteRef",schemaMarkName:"footnoteRef",markSpec:{attrs:{id:{},noteType:{default:"footnote"}},parseDOM:[{tag:"sup.docx-footnote-ref",getAttrs:t=>{let e=t;return{id:e.dataset.id||"",noteType:e.dataset.noteType||"footnote"}}}],toDOM(t){let e=t.attrs;return["sup",{class:`docx-${e.noteType}-ref`,"data-id":e.id,"data-note-type":e.noteType},0]}},onSchemaReady(t){let{schema:e}=t;function n(o){return i=>(l,a)=>{if(!a)return!0;let s=e.marks.footnoteRef.create({id:String(i),noteType:o}),c=e.text(String(i),[s]),d=l.tr.replaceSelectionWith(c,!1);return a(d.scrollIntoView()),!0}}let r=(o,i)=>{let{$from:l,$to:a}=o.selection;if(!i)return!0;let s=o.tr,c=e.marks.footnoteRef;return s=s.removeMark(l.pos,a.pos,c),i(s.scrollIntoView()),!0};return{commands:{insertFootnote:n("footnote"),insertEndnote:n("endnote"),deleteNoteRef:()=>r}}}});function Tj(t){return t/2*(96/72)}var $j=it({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:t=>{let e=t;return{spacing:e.dataset.spacing?Number(e.dataset.spacing):null,position:e.dataset.position?Number(e.dataset.position):null,scale:e.dataset.scale?Number(e.dataset.scale):null,kerning:e.dataset.kerning?Number(e.dataset.kerning):null}}}],toDOM(t){let e=t.attrs,n=[],r={class:"docx-char-spacing"};if(e.spacing!=null&&e.spacing!==0&&(n.push(`letter-spacing: ${rt(ut(e.spacing))}`),r["data-spacing"]=String(e.spacing)),e.position!=null&&e.position!==0){let o=Tj(e.position);n.push(`vertical-align: ${rt(o)}`),r["data-position"]=String(e.position)}return e.scale!=null&&e.scale!==100&&(n.push(`transform: scaleX(${e.scale/100})`),n.push("display: inline-block"),r["data-scale"]=String(e.scale)),e.kerning!=null&&(r["data-kerning"]=String(e.kerning)),n.length>0&&(r.style=n.join("; ")),["span",r,0]}}}),Ij=it({name:"comment",schemaMarkName:"comment",markSpec:{attrs:{commentId:{default:0}},inclusive:!1,parseDOM:[{tag:"span.docx-comment",getAttrs(t){return{commentId:parseInt(t.dataset.commentId||"0",10)}}}],toDOM(t){return["span",{class:"docx-comment","data-comment-id":String(t.attrs.commentId),style:"background-color: rgba(255, 212, 0, 0.25); border-bottom: 2px solid rgba(255, 212, 0, 0.6);"},0]}}}),Mj=it({name:"insertion",schemaMarkName:"insertion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null},isMovePair:{default:!1}},inclusive:!1,parseDOM:[{tag:"span.docx-insertion",getAttrs(t){let e=t;return{revisionId:parseInt(e.dataset.revisionId||"0",10),author:e.dataset.author||"",date:e.dataset.date||null,isMovePair:e.dataset.movePair==="true"}}}],toDOM(t){return["span",{class:"docx-insertion","data-revision-id":String(t.attrs.revisionId),"data-author":t.attrs.author,...t.attrs.date?{"data-date":t.attrs.date}:{},...t.attrs.isMovePair?{"data-move-pair":"true"}:{},style:"color: #2e7d32;"},0]}}}),Rj=it({name:"deletion",schemaMarkName:"deletion",markSpec:{attrs:{revisionId:{default:0},author:{default:""},date:{default:null},isMovePair:{default:!1}},inclusive:!1,parseDOM:[{tag:"span.docx-deletion",getAttrs(t){let e=t;return{revisionId:parseInt(e.dataset.revisionId||"0",10),author:e.dataset.author||"",date:e.dataset.date||null,isMovePair:e.dataset.movePair==="true"}}}],toDOM(t){return["span",{class:"docx-deletion","data-revision-id":String(t.attrs.revisionId),"data-author":t.attrs.author,...t.attrs.date?{"data-date":t.attrs.date}:{},...t.attrs.isMovePair?{"data-move-pair":"true"}:{},style:"color: #c62828;"},0]}}}),Pj=it({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]}}}),Ej=it({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]}}}),Fj=it({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]}}}),Aj=it({name:"emphasisMark",schemaMarkName:"emphasisMark",markSpec:{attrs:{type:{default:"dot"}},parseDOM:[{tag:"span.docx-emphasis-mark",getAttrs:t=>({type:t.dataset.emType||"dot"})}],toDOM(t){let e=t.attrs.type,n="filled dot";switch(e){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 r=e==="underDot"?"under right":"over right";return["span",{class:"docx-emphasis-mark","data-em-type":e,style:`text-emphasis: ${n}; text-emphasis-position: ${r}; -webkit-text-emphasis: ${n}; -webkit-text-emphasis-position: ${r}`},0]}}}),Dj=it({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]}}}),Nj=it({name:"hidden",schemaMarkName:"hidden",markSpec:{parseDOM:[{tag:"span.docx-hidden"}],toDOM(){return["span",{class:"docx-hidden",style:"opacity: 0.4; text-decoration: underline dotted"},0]}}}),Lj=it({name:"rtl",schemaMarkName:"rtl",markSpec:{parseDOM:[{tag:"span[dir=rtl].docx-rtl"}],toDOM(){return["span",{class:"docx-rtl",dir:"rtl"},0]}}}),Bj=it({name:"textEffect",schemaMarkName:"textEffect",markSpec:{attrs:{effect:{default:"blinkBackground"}},parseDOM:[{tag:"span.docx-text-effect",getAttrs:t=>{let e=t.dataset.effect;return e==="blinkBackground"||e==="lights"||e==="antsBlack"||e==="antsRed"||e==="shimmer"||e==="sparkle"?{effect:e}:!1}}],toDOM(t){let e=t.attrs.effect;return["span",{class:`docx-text-effect docx-text-effect-${e}`,"data-effect":e},0]}}}),Oj=it({name:"runStyle",schemaMarkName:"runStyle",markSpec:{attrs:{styleId:{default:null}},parseDOM:[{tag:"span[data-run-style]",getAttrs:t=>{let e=t.dataset.runStyle;return e?{styleId:e}:!1}}],toDOM(t){return["span",{class:"docx-run-style","data-run-style":t.attrs.styleId},0]}}}),jj=Nt({name:"hardBreak",schemaNodeName:"hardBreak",nodeSpec:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}},onSchemaReady(t){let e=t.schema.nodes.hardBreak;return{keyboardShortcuts:{"Shift-Enter":(n,r)=>(r&&r(n.tr.replaceSelectionWith(e.create()).scrollIntoView()),!0)}}}}),zj=Nt({name:"tab",schemaNodeName:"tab",nodeSpec:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"span.docx-tab"}],toDOM(){return["span",{class:"docx-tab",style:"display: inline-block; min-width: 16px; white-space: pre;"}," "]}}});function Hj(t,e,n){let r=()=>e.position?.horizontal&&e.position?.vertical?e.position:n?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:n.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:n.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(t){case"inline":return{wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case"squareLeft":case"squareRight":{let o=t==="squareLeft"?"left":"right",i=t==="squareLeft"?"right":"left";return{wrapType:e.wrapType==="tight"||e.wrapType==="through"?e.wrapType:"square",displayMode:"float",cssFloat:o,wrapText:i,position:r()}}case"square":case"tight":case"through":{let o=e.cssFloat==="left"||e.cssFloat==="right"?e.cssFloat:"left";return{wrapType:t,displayMode:"float",cssFloat:o,wrapText:o==="left"?"right":"left",position:r()}}case"topAndBottom":return{wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case"behind":case"inFront":return{wrapType:t,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}var _j=Nt({name:"image",schemaNodeName:"image",nodeSpec:{inline:!0,group:"inline",marks:"_",draggable:!0,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},hlinkHref:{default:null},cropTop:{default:null},cropRight:{default:null},cropBottom:{default:null},cropLeft:{default:null},opacity:{default:null},effectExtentTop:{default:null},effectExtentBottom:{default:null},effectExtentLeft:{default:null},effectExtentRight:{default:null},layoutInCell:{default:null},allowOverlap:{default:null}},parseDOM:[{tag:"img[src]",getAttrs(t){let e=t;return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||void 0,title:e.getAttribute("title")||void 0,width:e.width||void 0,height:e.height||void 0,rId:e.dataset.rid||void 0,wrapType:e.dataset.wrapType||"inline",displayMode:e.dataset.displayMode||"inline",cssFloat:e.dataset.cssFloat||void 0,transform:e.dataset.transform||void 0,borderWidth:e.dataset.borderWidth?Number(e.dataset.borderWidth):void 0,borderColor:e.dataset.borderColor||void 0,borderStyle:e.dataset.borderStyle||void 0}}}],toDOM(t){let e=t.attrs,n={src:e.src,class:"docx-image"};e.alt&&(n.alt=e.alt),e.title&&(n.title=e.title),e.rId&&(n["data-rid"]=e.rId),e.wrapType&&(n["data-wrap-type"]=e.wrapType),e.displayMode&&(n["data-display-mode"]=e.displayMode),e.cssFloat&&(n["data-css-float"]=e.cssFloat),e.transform&&(n["data-transform"]=e.transform),e.borderWidth&&(n["data-border-width"]=String(e.borderWidth)),e.borderColor&&(n["data-border-color"]=e.borderColor),e.borderStyle&&(n["data-border-style"]=e.borderStyle);let r=[];if(e.width&&(n.width=String(e.width),r.push(`width: ${e.width}px`)),e.height&&(n.height=String(e.height),r.push(`height: ${e.height}px`)),r.push("max-width: 100%"),e.width&&e.height?r.push("object-fit: contain"):r.push("height: auto"),e.displayMode==="float"&&e.cssFloat&&e.cssFloat!=="none"){r.push(`float: ${e.cssFloat}`),n.class+=` docx-image-float docx-image-float-${e.cssFloat}`;let o=e.distTop??0,i=e.distBottom??0,l=e.distLeft??0,a=e.distRight??0;e.cssFloat==="left"?r.push(`margin: ${o}px ${a||12}px ${i}px ${l}px`):r.push(`margin: ${o}px ${a}px ${i}px ${l||12}px`)}else if(e.displayMode==="block"){r.push("display: block"),r.push("margin-left: auto"),r.push("margin-right: auto"),n.class+=" docx-image-block";let o=e.distTop??0,i=e.distBottom??0;o>0&&r.push(`margin-top: ${o}px`),i>0&&r.push(`margin-bottom: ${i}px`)}if(e.transform&&r.push(`transform: ${e.transform}`),e.borderWidth&&e.borderWidth>0){let o=e.borderStyle||"solid",i=e.borderColor||"#000000";r.push(`border: ${e.borderWidth}px ${o} ${i}`)}return n.style=r.join("; "),["img",n]}},onSchemaReady(t){let e=t.schema.nodes.image,n=(r,o,i)=>(l,a)=>{let s=l.doc.nodeAt(r);if(!s||s.type!==e)return!1;let c=s.attrs,d=Hj(o,{wrapType:c.wrapType,cssFloat:c.cssFloat,position:c.position},i);return c.wrapType===d.wrapType&&c.displayMode===d.displayMode&&c.cssFloat===d.cssFloat&&c.wrapText===d.wrapText&&c.position===d.position||a&&a(l.tr.setNodeMarkup(r,void 0,{...c,...d})),!0};return{commands:{setImageWrapType:(r,o,i)=>n(r,o,i)}}}}),Wj=Nt({name:"textBox",schemaNodeName:"textBox",nodeSpec:{group:"block",content:"(paragraph | table)+",isolating:!0,draggable:!0,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"},wrapText:{default:null},anchorTarget:{default:null},position:{default:null},distTop:{default:null},distBottom:{default:null},distLeft:{default:null},distRight:{default:null}},parseDOM:[{tag:"div.docx-textbox",getAttrs(t){let e=t;return{width:e.dataset.width?Number(e.dataset.width):void 0,height:e.dataset.height?Number(e.dataset.height):void 0,textBoxId:e.dataset.textboxId||void 0,fillColor:e.dataset.fillColor||void 0,outlineWidth:e.dataset.outlineWidth?Number(e.dataset.outlineWidth):void 0,outlineColor:e.dataset.outlineColor||void 0,outlineStyle:e.dataset.outlineStyle||void 0,marginTop:e.dataset.marginTop?Number(e.dataset.marginTop):void 0,marginBottom:e.dataset.marginBottom?Number(e.dataset.marginBottom):void 0,marginLeft:e.dataset.marginLeft?Number(e.dataset.marginLeft):void 0,marginRight:e.dataset.marginRight?Number(e.dataset.marginRight):void 0,verticalAlign:e.dataset.verticalAlign||void 0,displayMode:e.dataset.displayMode||void 0,cssFloat:e.dataset.cssFloat||void 0,wrapType:e.dataset.wrapType||void 0,wrapText:e.dataset.wrapText||void 0,anchorTarget:e.dataset.anchorTarget||void 0,position:e.dataset.position?JSON.parse(e.dataset.position):void 0,distTop:e.dataset.distTop?Number(e.dataset.distTop):void 0,distBottom:e.dataset.distBottom?Number(e.dataset.distBottom):void 0,distLeft:e.dataset.distLeft?Number(e.dataset.distLeft):void 0,distRight:e.dataset.distRight?Number(e.dataset.distRight):void 0}}}],toDOM(t){let e=t.attrs,n={class:"docx-textbox"};e.width&&(n["data-width"]=String(e.width)),e.height&&(n["data-height"]=String(e.height)),e.textBoxId&&(n["data-textbox-id"]=e.textBoxId),e.fillColor&&(n["data-fill-color"]=e.fillColor),e.outlineWidth&&(n["data-outline-width"]=String(e.outlineWidth)),e.outlineColor&&(n["data-outline-color"]=e.outlineColor),e.outlineStyle&&(n["data-outline-style"]=e.outlineStyle),e.marginTop!=null&&(n["data-margin-top"]=String(e.marginTop)),e.marginBottom!=null&&(n["data-margin-bottom"]=String(e.marginBottom)),e.marginLeft!=null&&(n["data-margin-left"]=String(e.marginLeft)),e.marginRight!=null&&(n["data-margin-right"]=String(e.marginRight)),e.verticalAlign&&(n["data-vertical-align"]=e.verticalAlign),e.displayMode&&(n["data-display-mode"]=e.displayMode),e.cssFloat&&(n["data-css-float"]=e.cssFloat),e.wrapType&&(n["data-wrap-type"]=e.wrapType),e.wrapText&&(n["data-wrap-text"]=e.wrapText),e.anchorTarget&&(n["data-anchor-target"]=e.anchorTarget),e.position&&(n["data-position"]=JSON.stringify(e.position)),e.distTop!=null&&(n["data-dist-top"]=String(e.distTop)),e.distBottom!=null&&(n["data-dist-bottom"]=String(e.distBottom)),e.distLeft!=null&&(n["data-dist-left"]=String(e.distLeft)),e.distRight!=null&&(n["data-dist-right"]=String(e.distRight));let r=[];if(e.width&&r.push(`width: ${e.width}px`),e.height&&r.push(`min-height: ${e.height}px`),e.fillColor&&r.push(`background-color: ${e.fillColor}`),e.outlineWidth&&e.outlineWidth>0){let s=e.outlineStyle||"solid",c=e.outlineColor||"#000000";r.push(`border: ${e.outlineWidth}px ${s} ${c}`)}else r.push("border: 1px solid var(--doc-border, #d1d5db)");let o=e.marginTop??4,i=e.marginBottom??4,l=e.marginLeft??7,a=e.marginRight??7;return r.push(`padding: ${o}px ${a}px ${i}px ${l}px`),e.verticalAlign==="middle"||e.verticalAlign==="center"?(r.push("display: flex"),r.push("flex-direction: column"),r.push("justify-content: center")):e.verticalAlign==="bottom"&&(r.push("display: flex"),r.push("flex-direction: column"),r.push("justify-content: flex-end")),e.displayMode==="float"&&e.cssFloat&&e.cssFloat!=="none"?(r.push(`float: ${e.cssFloat}`),r.push("margin: 4px 8px")):e.displayMode==="block"&&(r.push("margin-left: auto"),r.push("margin-right: auto")),r.push("box-sizing: border-box"),r.push("overflow: hidden"),r.push("position: relative"),n.style=r.join("; "),["div",n,0]}}}),wk="http://www.w3.org/2000/svg";function On(t,e){let n=document.createElementNS(wk,t);if(e)for(let[r,o]of Object.entries(e))n.setAttribute(r,String(o));return n}function Vj(t,e,n){switch(t){case"ellipse":case"oval":return On("ellipse",{cx:e/2,cy:n/2,rx:e/2,ry:n/2});case"roundRect":return On("rect",{x:0,y:0,width:e,height:n,rx:Math.min(e,n)*.1});case"triangle":case"isosTriangle":return On("polygon",{points:`${e/2},0 ${e},${n} 0,${n}`});case"diamond":return On("polygon",{points:`${e/2},0 ${e},${n/2} ${e/2},${n} 0,${n/2}`});case"line":case"straightConnector1":return On("line",{x1:0,y1:n/2,x2:e,y2:n/2});default:return On("rect",{x:0,y:0,width:e,height:n})}}function qj(t,e){let n;try{n=JSON.parse(e.gradientStops||"[]")}catch{return null}if(!Array.isArray(n))return null;let r=e.gradientType||"linear",o;if(r==="radial"||r==="rectangular"||r==="path")o=On("radialGradient",{id:t,cx:"50%",cy:"50%",r:"50%"});else{let i=((e.gradientAngle||0)-90)*Math.PI/180,l=Math.round(50+50*Math.cos(i+Math.PI)),a=Math.round(50+50*Math.sin(i+Math.PI)),s=Math.round(50+50*Math.cos(i)),c=Math.round(50+50*Math.sin(i));o=On("linearGradient",{id:t,x1:`${l}%`,y1:`${a}%`,x2:`${s}%`,y2:`${c}%`})}for(let i of n)o.appendChild(On("stop",{offset:`${Math.round(i.position/1e3)}%`,"stop-color":i.color}));return o}var Zj=Nt({name:"shape",schemaNodeName:"shape",nodeSpec:{inline:!0,group:"inline",marks:"_",draggable:!0,atom:!0,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(t){let e=t;return{shapeType:e.dataset.shapeType||"rect",shapeId:e.dataset.shapeId||void 0,width:e.dataset.width?Number(e.dataset.width):void 0,height:e.dataset.height?Number(e.dataset.height):void 0,fillColor:e.dataset.fillColor||void 0,fillType:e.dataset.fillType||"solid",gradientType:e.dataset.gradientType||void 0,gradientAngle:e.dataset.gradientAngle?Number(e.dataset.gradientAngle):void 0,gradientStops:e.dataset.gradientStops||void 0,outlineWidth:e.dataset.outlineWidth?Number(e.dataset.outlineWidth):void 0,outlineColor:e.dataset.outlineColor||void 0,outlineStyle:e.dataset.outlineStyle||void 0,transform:e.dataset.transform||void 0,displayMode:e.dataset.displayMode||void 0,cssFloat:e.dataset.cssFloat||void 0,wrapType:e.dataset.wrapType||void 0,shadowColor:e.dataset.shadowColor||void 0,shadowBlur:e.dataset.shadowBlur?Number(e.dataset.shadowBlur):void 0,shadowOffsetX:e.dataset.shadowOffsetX?Number(e.dataset.shadowOffsetX):void 0,shadowOffsetY:e.dataset.shadowOffsetY?Number(e.dataset.shadowOffsetY):void 0,glowColor:e.dataset.glowColor||void 0,glowRadius:e.dataset.glowRadius?Number(e.dataset.glowRadius):void 0}}}],toDOM(t){let e=t.attrs,n=e.width||100,r=e.height||80,o={class:"docx-shape","data-shape-type":e.shapeType||"rect"};e.shapeId&&(o["data-shape-id"]=e.shapeId),o["data-width"]=String(n),o["data-height"]=String(r),e.fillColor&&(o["data-fill-color"]=e.fillColor),e.fillType&&(o["data-fill-type"]=e.fillType),e.gradientType&&(o["data-gradient-type"]=e.gradientType),e.gradientAngle!=null&&(o["data-gradient-angle"]=String(e.gradientAngle)),e.gradientStops&&(o["data-gradient-stops"]=e.gradientStops),e.outlineWidth&&(o["data-outline-width"]=String(e.outlineWidth)),e.outlineColor&&(o["data-outline-color"]=e.outlineColor),e.outlineStyle&&(o["data-outline-style"]=e.outlineStyle),e.transform&&(o["data-transform"]=e.transform),e.displayMode&&(o["data-display-mode"]=e.displayMode),e.cssFloat&&(o["data-css-float"]=e.cssFloat),e.wrapType&&(o["data-wrap-type"]=e.wrapType),e.shadowColor&&(o["data-shadow-color"]=e.shadowColor),e.shadowBlur!=null&&(o["data-shadow-blur"]=String(e.shadowBlur)),e.shadowOffsetX!=null&&(o["data-shadow-offset-x"]=String(e.shadowOffsetX)),e.shadowOffsetY!=null&&(o["data-shadow-offset-y"]=String(e.shadowOffsetY)),e.glowColor&&(o["data-glow-color"]=e.glowColor),e.glowRadius!=null&&(o["data-glow-radius"]=String(e.glowRadius));let i=["display: inline-block",`width: ${n}px`,`height: ${r}px`,"vertical-align: middle","line-height: 0"];if(e.transform&&i.push(`transform: ${e.transform}`),e.displayMode==="float"&&e.cssFloat&&e.cssFloat!=="none"?(i.push(`float: ${e.cssFloat}`),i.push("margin: 4px 8px")):e.displayMode==="block"&&(i.push("display: block"),i.push("margin: 4px auto")),e.shadowColor){let h=e.shadowOffsetX||2,p=e.shadowOffsetY||2,m=e.shadowBlur||4;i.push(`filter: drop-shadow(${h}px ${p}px ${m}px ${e.shadowColor})`)}if(e.glowColor&&e.glowRadius){let h=i.find(m=>m.startsWith("filter:")),p=`drop-shadow(0 0 ${e.glowRadius}px ${e.glowColor})`;if(h){let m=i.indexOf(h);i[m]=h+" "+p}else i.push(`filter: ${p}`)}o.style=i.join("; ");let l=null,a;if(e.fillType==="gradient"&&e.gradientStops){let h=`grad-${e.shapeId||Math.random().toString(36).slice(2,8)}`;a=`url(#${h})`;let p=qj(h,e);p&&(l=On("defs"),l.appendChild(p))}else a=e.fillType==="none"?"none":e.fillColor||"#ffffff";let s=e.outlineWidth||1,c=e.outlineColor||"#000000",d=e.outlineStyle==="dashed"?"8 4":e.outlineStyle==="dotted"?"2 2":null,u=On("svg",{xmlns:wk,width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:`fill:${a};stroke:${c};stroke-width:${s}`});d&&u.setAttribute("stroke-dasharray",d),l&&u.appendChild(l),u.appendChild(Vj(e.shapeType||"rect",n,r));let f=document.createElement("span");return Object.entries(o).forEach(([h,p])=>{f.setAttribute(h,p)}),f.appendChild(u),{dom:f}}}}),Kj=Nt({name:"horizontalRule",schemaNodeName:"horizontalRule",nodeSpec:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["hr"]}}}),Uj=Nt({name:"pageBreak",schemaNodeName:"pageBreak",nodeSpec:{group:"block",atom:!0,selectable:!0,parseDOM:[{tag:"div.docx-page-break"}],toDOM(){return["div",{class:"docx-page-break"}]}}}),Xj=Nt({name:"field",schemaNodeName:"field",nodeSpec:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{fieldType:{default:"UNKNOWN"},instruction:{default:""},displayText:{default:""},fieldKind:{default:"simple"},fldLock:{default:!1},dirty:{default:!1}},parseDOM:[{tag:"span.docx-field",getAttrs(t){let e=t;return{fieldType:e.dataset.fieldType||"UNKNOWN",instruction:e.dataset.instruction||"",displayText:e.textContent||"",fieldKind:e.dataset.fieldKind||"simple",fldLock:e.dataset.fldLock==="true",dirty:e.dataset.dirty==="true"}}}],toDOM(t){let{fieldType:e,instruction:n,displayText:r,fieldKind:o,fldLock:i,dirty:l}=t.attrs,a=r||"";if(!a)switch(e){case"PAGE":a="{page}";break;case"NUMPAGES":a="{pages}";break;case"DATE":case"TIME":case"CREATEDATE":case"SAVEDATE":a=new Date().toLocaleDateString();break;case"MERGEFIELD":a=`«${n.replace(/^MERGEFIELD\s+/i,"").replace(/\s*\\.*$/,"")}»`;break;default:a=`{${e}}`}return["span",{class:`docx-field docx-field-${e.toLowerCase()}`,"data-field-type":e,"data-instruction":n,"data-field-kind":o,...i?{"data-fld-lock":"true"}:{},...l?{"data-dirty":"true"}:{},style:"outline: 1px solid rgba(200,200,200,0.4); padding: 0 1px; border-radius: 2px;"},a]}}}),Gj=Nt({name:"sdt",schemaNodeName:"sdt",nodeSpec:{inline:!0,group:"inline",content:"inline*",attrs:{sdtType:{default:"richText"},id:{default:null},alias:{default:null},tag:{default:null},lock:{default:null},placeholder:{default:null},showingPlaceholder:{default:!1},dateFormat:{default:null},listItems:{default:null},checked:{default:null},dataBinding:{default:null},rawPropertiesXml:{default:null},rawEndPropertiesXml:{default:null}},parseDOM:[{tag:"span.docx-sdt",getAttrs(t){let e=t,n=e.dataset.id,r=n!=null&&n!==""?parseInt(n,10):NaN;return{sdtType:e.dataset.sdtType||"richText",id:Number.isNaN(r)?null:r,alias:e.dataset.alias||null,tag:e.dataset.tag||null,lock:e.dataset.lock||null,placeholder:e.dataset.placeholder||null,showingPlaceholder:e.dataset.showingPlaceholder==="true",dateFormat:e.dataset.dateFormat||null,listItems:e.dataset.listItems||null,checked:e.dataset.checked==="true"?!0:e.dataset.checked==="false"?!1:null,dataBinding:e.dataset.dataBinding||null,rawPropertiesXml:e.dataset.rawPropertiesXml||null,rawEndPropertiesXml:e.dataset.rawEndPropertiesXml||null}}}],toDOM(t){let e=t.attrs,n={class:`docx-sdt docx-sdt-${e.sdtType}`,"data-sdt-type":String(e.sdtType)};return e.id!=null&&(n["data-id"]=String(e.id)),e.alias&&(n["data-alias"]=String(e.alias)),e.tag&&(n["data-tag"]=String(e.tag)),e.lock&&(n["data-lock"]=String(e.lock)),e.placeholder&&(n["data-placeholder"]=String(e.placeholder)),e.showingPlaceholder&&(n["data-showing-placeholder"]="true"),e.dateFormat&&(n["data-date-format"]=String(e.dateFormat)),e.listItems&&(n["data-list-items"]=String(e.listItems)),e.checked!=null&&(n["data-checked"]=String(e.checked)),e.dataBinding&&(n["data-data-binding"]=String(e.dataBinding)),e.rawPropertiesXml&&(n["data-raw-properties-xml"]=String(e.rawPropertiesXml)),e.rawEndPropertiesXml&&(n["data-raw-end-properties-xml"]=String(e.rawEndPropertiesXml)),e.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]}}}),Yj=Nt({name:"blockSdt",schemaNodeName:"blockSdt",nodeSpec:{group:"block",content:"(paragraph | horizontalRule | pageBreak | table | textBox | blockSdt)+",isolating:!0,defining:!0,attrs:{sdtType:{default:"richText"},id:{default:null},alias:{default:null},tag:{default:null},lock:{default:null},placeholder:{default:null},showingPlaceholder:{default:!1},dateFormat:{default:null},listItems:{default:null},checked:{default:null},dataBinding:{default:null},rawPropertiesXml:{default:null},rawEndPropertiesXml:{default:null}},parseDOM:[{tag:"div.docx-block-sdt",getAttrs(t){let e=t,n=e.dataset.id,r=n!=null&&n!==""?parseInt(n,10):NaN;return{sdtType:e.dataset.sdtType||"richText",id:Number.isNaN(r)?null:r,alias:e.dataset.alias||null,tag:e.dataset.tag||null,lock:e.dataset.lock||null,placeholder:e.dataset.placeholder||null,showingPlaceholder:e.dataset.showingPlaceholder==="true",dateFormat:e.dataset.dateFormat||null,listItems:e.dataset.listItems||null,checked:e.dataset.checked==="true"?!0:e.dataset.checked==="false"?!1:null,rawPropertiesXml:e.dataset.rawPropertiesXml||null,rawEndPropertiesXml:e.dataset.rawEndPropertiesXml||null}}}],toDOM(t){let e=t.attrs,n={class:`docx-block-sdt docx-block-sdt-${e.sdtType}`,"data-sdt-type":String(e.sdtType)};return e.id!=null&&(n["data-id"]=String(e.id)),e.alias&&(n["data-alias"]=String(e.alias)),e.tag&&(n["data-tag"]=String(e.tag)),e.lock&&(n["data-lock"]=String(e.lock)),e.placeholder&&(n["data-placeholder"]=String(e.placeholder)),e.showingPlaceholder&&(n["data-showing-placeholder"]="true"),e.dateFormat&&(n["data-date-format"]=String(e.dateFormat)),e.listItems&&(n["data-list-items"]=String(e.listItems)),e.checked!=null&&(n["data-checked"]=String(e.checked)),e.rawPropertiesXml&&(n["data-raw-properties-xml"]=String(e.rawPropertiesXml)),e.rawEndPropertiesXml&&(n["data-raw-end-properties-xml"]=String(e.rawEndPropertiesXml)),["div",n,0]}}}),Jj=Nt({name:"math",schemaNodeName:"math",nodeSpec:{inline:!0,group:"inline",atom:!0,selectable:!0,attrs:{display:{default:"inline"},ommlXml:{default:""},plainText:{default:""}},parseDOM:[{tag:"span.docx-math",getAttrs(t){let e=t;return{display:e.dataset.display||"inline",ommlXml:e.dataset.ommlXml||"",plainText:e.textContent||""}}}],toDOM(t){let{display:e,ommlXml:n,plainText:r}=t.attrs,o=r||"[equation]";return["span",{class:`docx-math docx-math-${e}`,"data-display":e,"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;'},o]}}}),Qj=new fn("emptyParagraphFormat");function ez(t){return!!(t.bold||t.italic||t.underline||t.strike||t.doubleStrike||t.color||t.highlight||t.vertAlign)}function tz(t){return new zt({key:Qj,appendTransaction(e,n,r){if(!e.some(c=>c.selectionSet||c.docChanged))return null;let{selection:o}=r;if(!o.empty||r.storedMarks!==null)return null;let i=o.$from.parent;if(i.type.name!=="paragraph"||i.content.size!==0)return null;let l=i.attrs.defaultTextFormatting;if(!l||!ez(l))return null;let a=Lp(l,t);if(a.length===0)return null;let s=r.tr.setStoredMarks(a);return s.setMeta("addToHistory",!1),s}})}var nz=Cn({name:"emptyParagraphFormat",onSchemaReady(t){return{plugins:[tz(t.schema)]}}}),rz=Cn({name:"selectionTracker",defaultOptions:{},onSchemaReady(t,e){return{plugins:[H4(e.onSelectionChange)],commands:{extractSelectionContext:()=>(n,r)=>(ef(n),!0)}}}}),oz=new fn("imageDrag"),iz=Cn({name:"imageDrag",onSchemaReady(t){return{plugins:[new zt({key:oz,props:{handleDOMEvents:{dragstart(e,n){let{selection:r}=e.state;if(r instanceof Ie&&r.node.type.name==="image"){e.dom.classList.add("pm-image-dragging");let o=n;if(o.dataTransfer){o.dataTransfer.effectAllowed="move";let i=document.createElement("div");i.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);",i.style.width=`${r.node.attrs.width||100}px`,i.style.height=`${r.node.attrs.height||100}px`,document.body.appendChild(i),o.dataTransfer.setDragImage(i,0,0),requestAnimationFrame(()=>{document.body.removeChild(i)})}}return!1},dragend(e){return e.dom.classList.remove("pm-image-dragging"),e.dom.querySelectorAll(".pm-drop-indicator").forEach(n=>n.remove()),!1},dragover(e,n){let{selection:r}=e.state;if(r instanceof Ie&&r.node.type.name==="image"){let o=n;o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="move")}return!1},drop(e){return e.dom.classList.remove("pm-image-dragging"),e.dom.querySelectorAll(".pm-drop-indicator").forEach(n=>n.remove()),!1}}}})]}}}),su=612;async function lz(t){return await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>n(r.error??new Error("Failed to read image file")),r.readAsDataURL(t)})}async function az(t){return await new Promise((e,n)=>{let r=new Image;r.onload=()=>e({width:r.naturalWidth||1,height:r.naturalHeight||1}),r.onerror=()=>n(new Error("Failed to load pasted image")),r.src=t})}async function sz(t,e){let n=t.state.schema.nodes.image;if(!n)return;let r=t.state.selection.from;for(let o of e){let i;try{i=await lz(o)}catch{continue}let l=1,a=1;try{({width:l,height:a}=await az(i))}catch{l=1,a=1}let s=l,c=a;if(s>su){let f=su/s;s=su,c=Math.max(1,Math.round(c*f))}let d=n.create({src:i,alt:o.name,width:s,height:c,rId:`rId_img_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,wrapType:"inline",displayMode:"inline"}),u=t.state.tr.insert(r,d);r+=d.nodeSize,u.setSelection(ye.create(u.doc,r)),t.dispatch(u.scrollIntoView())}t.focus()}var cz=Cn({name:"imagePaste",onSchemaReady(t){return{plugins:[new zt({props:{handleDOMEvents:{paste(e,n){let r=n,o=MI(r.clipboardData);return o.length===0||!e.state.schema.nodes.image?!1:(r.preventDefault(),sz(e,o).catch(()=>{}),!0)}}}})]}}}),dz=Cn({name:"dropCursor",onSchemaReady(){return{plugins:[I3({color:"var(--doc-primary, #4285f4)",width:2})]}}}),uz=Cn({name:"bidiShortcut",priority:ei.High,onSchemaReady(t){let{manager:e}=t;return{plugins:[new zt({props:{handleKeyDown(n,r){if(r.key!=="Shift"||!(r.metaKey||r.ctrlKey))return!1;let o=e.getCommands();return r.code==="ShiftLeft"?(r.preventDefault(),o.setLtr()(n.state,n.dispatch),!0):r.code==="ShiftRight"?(r.preventDefault(),o.setRtl()(n.state,n.dispatch),!0):!1}}})]}}});function xk(t){let e={},n=t.split(";");for(let r of n){let o=r.trim();if(!o)continue;let i=o.indexOf(":");if(i<0)continue;let l=o.slice(0,i).trim(),a=o.slice(i+1).trim();l&&a&&(e[l]=a)}return e}function fz(t,e){let n=t.getAttribute("style")||"",r=xk(n);for(let[o,i]of Object.entries(e))o in r||t.style.setProperty(o,i)}function pz(t){let e=t.querySelectorAll("style");if(e.length===0)return;let n=[];for(let r of e){let o=r.textContent||"";if(o.trim())try{let i=t.createElement("style");i.textContent=o,t.head.appendChild(i);let l=i.sheet;if(l)for(let a=0;a<l.cssRules.length;a++){let s=l.cssRules[a];if(s instanceof CSSStyleRule){let c={},d=s.style;for(let u=0;u<d.length;u++){let f=d[u];c[f]=d.getPropertyValue(f)}Object.keys(c).length>0&&n.push({selector:s.selectorText,declarations:c})}}t.head.removeChild(i)}catch{let i=/([^{]+)\{([^}]+)\}/g,l;for(;(l=i.exec(o))!==null;){let a=l[1].trim(),s=xk(l[2]);Object.keys(s).length>0&&n.push({selector:a,declarations:s})}}}if(n.length!==0)for(let{selector:r,declarations:o}of n)try{let i=t.body.querySelectorAll(r);for(let l of i)fz(l,o)}catch{}}function hz(t){let e=t.body.querySelectorAll('b[id^="docs-internal-guid-"]');for(let n of e){let r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);r.removeChild(n)}}}function mz(t){let e=t.includes("<style"),n=t.includes("docs-internal-guid-");if(!e&&!n)return t;try{let r=new DOMParser().parseFromString(t,"text/html");if(e){pz(r);let o=r.querySelectorAll("style");for(let i of o)i.remove()}return n&&hz(r),r.body.innerHTML}catch{return t}}var gz=Cn({name:"pasteStyleInliner",priority:ei.High,onSchemaReady(){return{plugins:[new zt({props:{transformPastedHTML(t){return mz(t)}}})]}}});function Jp(t={}){let e=new Set(t.disable||[]),n=[];function r(o,i){e.has(o)||n.push(i)}return r("doc",cj()),r("text",dj()),r("paragraph",O3()),r("history",uj({depth:t.historyDepth,newGroupDelay:t.historyNewGroupDelay})),r("bold",fj()),r("italic",pj()),r("underline",hj()),r("strike",mj()),r("textColor",gj()),r("highlight",yj()),r("fontSize",bj()),r("fontFamily",wj()),r("superscript",xj()),r("subscript",vj()),r("hyperlink",j3()),r("allCaps",kj()),r("smallCaps",Cj()),r("footnoteRef",Sj()),r("characterSpacing",$j()),r("emboss",Pj()),r("imprint",Ej()),r("textShadow",Fj()),r("emphasisMark",Aj()),r("textOutline",Dj()),r("hidden",Nj()),r("rtl",Lj()),r("runStyle",Oj()),r("textEffect",Bj()),r("comment",Ij()),r("insertion",Mj()),r("deletion",Rj()),r("hardBreak",jj()),r("tab",zj()),r("image",_j()),r("textBox",Wj()),r("shape",Zj()),r("imageDrag",iz()),r("imagePaste",cz()),r("dropCursor",dz()),r("horizontalRule",Kj()),r("pageBreak",Uj()),r("field",Xj()),r("sdt",Gj()),r("blockSdt",Yj()),r("math",Jj()),e.has("table")||n.push(...h3()),r("pasteStyleInliner",gz()),r("list",J3()),r("baseKeymap",j4()),r("emptyParagraphFormat",nz()),r("selectionTracker",rz({onSelectionChange:t.onSelectionChange})),r("paragraphChangeTracker",ij()),r("paraIdAllocator",sj()),r("bidiShortcut",uz()),n}var Qp=class{constructor(e){Ze(this,"extensions"),Ze(this,"schema",null),Ze(this,"plugins",[]),Ze(this,"commands",{}),this.extensions=[...e].sort((n,r)=>n.config.priority-r.config.priority)}buildSchema(){let e={},n={};for(let r of this.extensions)r.type==="node"?e[r.config.schemaNodeName]=r.config.nodeSpec:r.type==="mark"&&(n[r.config.schemaMarkName]=r.config.markSpec);this.schema=new Q6({nodes:e,marks:n})}initializeRuntime(){if(!this.schema)throw new Error("ExtensionManager: buildSchema() must be called before initializeRuntime()");let e={schema:this.schema,manager:this},n=[],r=[],o={};for(let i of this.extensions){let l=i.onSchemaReady(e);l.commands&&Object.assign(o,l.commands),l.keyboardShortcuts&&n.push(l.keyboardShortcuts),l.plugins&&r.push(...l.plugins)}this.plugins=[...r,...n.map(i=>FB(i))],this.commands=o}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(e){return this.commands[e]}destroy(){this.plugins=[],this.commands={}}},_c=new Qp(Jp());_c.buildSchema();_c.initializeRuntime();var Wc=_c,Ce=_c.getSchema();function yz(t){if(!t||t.pattern&&t.pattern!=="clear")return;let e=t.fill?.rgb;if(!(!e||t.fill?.auto))return Vb(e)}function eh(t){if(!t)return[];let e=[];t.bold&&e.push(Ce.mark("bold")),t.italic&&e.push(Ce.mark("italic")),t.underline&&t.underline.style!=="none"&&e.push(Ce.mark("underline",{style:t.underline.style,color:t.underline.color})),(t.strike||t.doubleStrike)&&e.push(Ce.mark("strike",{double:t.doubleStrike||!1})),t.color&&!t.color.auto&&e.push(Ce.mark("textColor",{rgb:t.color.rgb,themeColor:t.color.themeColor,themeTint:t.color.themeTint,themeShade:t.color.themeShade}));let n=t.highlight&&t.highlight!=="none"?t.highlight:yz(t.shading);return n&&e.push(Ce.mark("highlight",{color:n})),(t.fontSize!=null||t.fontSizeCs!=null)&&e.push(Ce.mark("fontSize",{size:t.fontSize??null,sizeCs:t.fontSizeCs??null})),t.fontFamily&&e.push(Ce.mark("fontFamily",{ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi,eastAsia:t.fontFamily.eastAsia,cs:t.fontFamily.cs,asciiTheme:t.fontFamily.asciiTheme,hAnsiTheme:t.fontFamily.hAnsiTheme,eastAsiaTheme:t.fontFamily.eastAsiaTheme,csTheme:t.fontFamily.csTheme})),t.vertAlign==="superscript"?e.push(Ce.mark("superscript")):t.vertAlign==="subscript"&&e.push(Ce.mark("subscript")),t.allCaps&&e.push(Ce.mark("allCaps")),t.smallCaps&&e.push(Ce.mark("smallCaps")),(t.spacing!=null||t.position!=null||t.scale!=null||t.kerning!=null)&&e.push(Ce.mark("characterSpacing",{spacing:t.spacing??null,position:t.position??null,scale:t.scale??null,kerning:t.kerning??null})),t.emboss&&e.push(Ce.mark("emboss")),t.imprint&&e.push(Ce.mark("imprint")),t.shadow&&e.push(Ce.mark("textShadow")),t.emphasisMark&&t.emphasisMark!=="none"&&e.push(Ce.mark("emphasisMark",{type:t.emphasisMark})),t.outline&&e.push(Ce.mark("textOutline")),t.hidden&&e.push(Ce.mark("hidden")),t.rtl&&e.push(Ce.mark("rtl")),t.effect&&t.effect!=="none"&&e.push(Ce.mark("textEffect",{effect:t.effect})),t.styleId&&e.push(Ce.mark("runStyle",{styleId:t.styleId})),e}function Ys(t,e){if(!t)return;if(!e)return t;let n=e.resolveRunStyle(t.styleId);return n?dn(n,t):t}function vk(t,e){let n="",r,o=t.type==="simpleField"?t.content:t.fieldResult;if(o){for(let s of o)if(s.type==="run"){for(let c of s.content)c.type==="text"&&(n+=c.text);!r&&s.formatting&&(r=s.formatting)}}let i=r??(t.type==="complexField"?t.formatting:void 0),l=dn(e,i),a=eh(l);return Ce.node("field",{fieldType:t.fieldType,instruction:t.instruction,displayText:n,fieldKind:t.type==="simpleField"?"simple":"complex",fldLock:t.fldLock??!1,dirty:t.dirty??!1},void 0,a)}function kk(t){return Ce.node("math",{display:t.display,ommlXml:t.ommlXml,plainText:t.plainText||""})}function th(t,e,n){let r=[],o=t.formatting?.styleId?n?.getRunStyleOwnProperties(t.formatting.styleId):void 0,i=dn(dn(e,o),t.formatting),l=eh(i);for(let a of t.content){let s=Ck(a,l);r.push(...s)}return r}function Ck(t,e){switch(t.type){case"text":return t.text?[Ce.text(t.text,e)]:[];case"break":return t.breakType==="textWrapping"||!t.breakType?[Ce.node("hardBreak",null,void 0,e)]:[];case"tab":return[Ce.node("tab",null,void 0,e)];case"drawing":return t.image?[bz(t.image)]:[];case"shape":{let o=t.shape;return o.textBody&&o.textBody.content.length>0?[]:[wz(o)]}case"footnoteRef":let n=Ce.mark("footnoteRef",{id:t.id.toString(),noteType:"footnote"});return[Ce.text(t.id.toString(),[...e,n])];case"endnoteRef":let r=Ce.mark("footnoteRef",{id:t.id.toString(),noteType:"endnote"});return[Ce.text(t.id.toString(),[...e,r])];default:return[]}}function bz(t){let e=t.size?.width?_e(t.size.width):void 0,n=t.size?.height?_e(t.size.height):void 0,r=t.wrap.type,o=t.wrap.wrapText,i=t.position?.horizontal?.alignment,l;r==="inline"||r==="topAndBottom"?l="none":r==="square"||r==="tight"||r==="through"?o==="left"?l="right":o==="right"||i==="left"?l="left":i==="right"?l="right":l="none":l="none";let a="inline";r==="inline"?a="inline":r==="topAndBottom"?a="block":ra(r)||l&&l!=="none"?a="float":a="block";let s;if(t.transform){let k=[];t.transform.rotation&&k.push(`rotate(${t.transform.rotation}deg)`),t.transform.flipH&&k.push("scaleX(-1)"),t.transform.flipV&&k.push("scaleY(-1)"),k.length>0&&(s=k.join(" "))}let c=t.wrap.distT!=null?_e(t.wrap.distT):void 0,d=t.wrap.distB!=null?_e(t.wrap.distB):void 0,u=t.wrap.distL!=null?_e(t.wrap.distL):void 0,f=t.wrap.distR!=null?_e(t.wrap.distR):void 0,h;t.position&&(h={horizontal:t.position.horizontal?{relativeTo:t.position.horizontal.relativeTo,posOffset:t.position.horizontal.posOffset,align:t.position.horizontal.alignment}:void 0,vertical:t.position.vertical?{relativeTo:t.position.vertical.relativeTo,posOffset:t.position.vertical.posOffset,align:t.position.vertical.alignment}:void 0});let p,m,y;if(t.outline&&t.outline.width){p=Math.round(t.outline.width/914400*96*100)/100,t.outline.color?.rgb&&(m=`#${t.outline.color.rgb}`);let k={solid:"solid",dot:"dotted",dash:"dashed",lgDash:"dashed",dashDot:"dashed",lgDashDot:"dashed",lgDashDotDot:"dashed",sysDot:"dotted",sysDash:"dashed",sysDashDot:"dashed",sysDashDotDot:"dashed"};y=t.outline.style&&k[t.outline.style]||"solid"}let w=t.padding?.top?_e(t.padding.top):void 0,C=t.padding?.bottom?_e(t.padding.bottom):void 0,g=t.padding?.left?_e(t.padding.left):void 0,v=t.padding?.right?_e(t.padding.right):void 0;return Ce.node("image",{src:t.src||"",alt:t.alt,title:t.title,width:e,height:n,rId:t.rId,wrapType:r,displayMode:a,cssFloat:l,transform:s,distTop:c,distBottom:d,distLeft:u,distRight:f,position:h,borderWidth:p,borderColor:m,borderStyle:y,wrapText:o,hlinkHref:t.hlinkHref,cropTop:t.crop?.top,cropRight:t.crop?.right,cropBottom:t.crop?.bottom,cropLeft:t.crop?.left,opacity:t.opacity,effectExtentTop:w,effectExtentBottom:C,effectExtentLeft:g,effectExtentRight:v,layoutInCell:t.layoutInCell,allowOverlap:t.allowOverlap})}function nh(t,e,n){let r=[],o=t.href||(t.anchor?`#${t.anchor}`:""),i=Ce.mark("hyperlink",{href:o,tooltip:t.tooltip,rId:t.rId});for(let l of t.children)if(l.type==="run"){let a=l.formatting?.styleId?n?.getRunStyleOwnProperties(l.formatting.styleId):void 0,s=dn(dn(e,a),l.formatting),c=[...eh(s),i];for(let d of l.content)r.push(...Ck(d,c))}return r}function wz(t){let e=t.size?.width?_e(t.size.width):100,n=t.size?.height?_e(t.size.height):80,r,o="solid",i,l,a;if(t.fill&&(o=t.fill.type,t.fill.color?.rgb&&(r=`#${t.fill.color.rgb}`),t.fill.type==="gradient"&&t.fill.gradient)){let f=t.fill.gradient;i=f.type,l=f.angle,a=JSON.stringify(f.stops.map(h=>({position:h.position,color:h.color.rgb?`#${h.color.rgb}`:"#000000"})))}let s,c,d;t.outline&&(t.outline.width&&(s=Math.round(t.outline.width/914400*96*100)/100),t.outline.color?.rgb&&(c=`#${t.outline.color.rgb}`),d=t.outline.style||"solid");let u;if(t.transform){let f=[];t.transform.rotation&&f.push(`rotate(${t.transform.rotation}deg)`),t.transform.flipH&&f.push("scaleX(-1)"),t.transform.flipV&&f.push("scaleY(-1)"),f.length>0&&(u=f.join(" "))}return Ce.node("shape",{shapeType:t.shapeType||"rect",shapeId:t.id,width:e,height:n,fillColor:r,fillType:o,gradientType:i,gradientAngle:l,gradientStops:a,outlineWidth:s,outlineColor:c,outlineStyle:d,transform:u})}function rh(t,e,n,r){let o=vz(t,e),i=[],l,a=[],s=new Set,c;e&&(c=e.resolveParagraphStyle(t.formatting?.styleId).runFormatting);let d=dn(c,r);for(let u of t.content){if(u.type==="commentRangeStart")s.add(u.id);else if(u.type==="commentRangeEnd")s.delete(u.id);else if(u.type==="run"){let f=th(u,d,e),h=xz(u,f);h&&a?a.push(h):a=void 0,s.size>0&&(f=tl(f,s)),i.push(...f)}else if(u.type==="hyperlink"){let f=nh(u,d,e);i.push(...f),a=void 0}else if(u.type==="simpleField"||u.type==="complexField"){let f=vk(u,d);f&&i.push(f),a=void 0}else if(u.type==="inlineSdt"){let f=Sk(u,d,e);f&&i.push(f),a=void 0}else if(u.type==="insertion"){let f=Ka(u,"insertion",d,e);s.size>0&&(f=tl(f,s)),i.push(...f),a=void 0}else if(u.type==="deletion"){let f=Ka(u,"deletion",d,e);s.size>0&&(f=tl(f,s)),i.push(...f),a=void 0}else if(u.type==="moveFrom"){let f=Ka(u,"deletion",d,e,!0);s.size>0&&(f=tl(f,s)),i.push(...f),a=void 0}else if(u.type==="moveTo"){let f=Ka(u,"insertion",d,e,!0);s.size>0&&(f=tl(f,s)),i.push(...f),a=void 0}else if(u.type==="mathEquation"){let f=kk(u);f&&i.push(f),a=void 0}else u.type!=="bookmarkStart"&&u.type!=="bookmarkEnd"&&(a=void 0);u.type==="bookmarkStart"&&(l||(l=[]),l.push({id:u.id,name:u.name}))}return l&&(o.bookmarks=l),a&&a.length>0&&(o._originalRunBoundaries=a),Ce.node("paragraph",o,i)}function xz(t,e){let n="",r;for(let o of e){if(!o.isText)return null;n+=o.text??"";let i=Fp(o.marks,Wv);if(r!=null&&r!==i)return null;r=i}return{text:n,...r!=null?{marksKey:r}:{},...t.formatting?{formatting:t.formatting}:{},...t.propertyChanges?{propertyChanges:t.propertyChanges}:{}}}function tl(t,e){if(e.size===0)return t;let n=[...e][0],r=Ce.marks.comment.create({commentId:n});return t.map(o=>o.isText?o.mark(r.addToSet(o.marks)):o)}function Ka(t,e,n,r,o=!1){let i=[];for(let a of t.content)a.type==="run"?i.push(...th(a,n,r)):a.type==="hyperlink"&&i.push(...nh(a,n,r));let l=Ce.marks[e].create({revisionId:t.info.id,author:t.info.author,date:t.info.date??null,isMovePair:o});return i.map(a=>a.isText||a.type.allowsMarkType(l.type)?a.mark(l.addToSet(a.marks)):a)}function vz(t,e){let n=t.formatting,r=n?.styleId,o={paraId:t.paraId??void 0,textId:t.textId??void 0,styleId:r,numPr:n?.numPr,numPrFromStyle:n?.numPrFromStyle,listNumFmt:t.listRendering?.numFmt,listIsBullet:t.listRendering?.isBullet,listMarker:t.listRendering?.marker,listMarkerHidden:t.listRendering?.markerHidden||void 0,listMarkerFontFamily:t.listRendering?.markerFontFamily||void 0,listMarkerFontSize:t.listRendering?.markerFontSize||void 0,listMarkerSuffix:t.listRendering?.markerSuffix||void 0,listLevelNumFmts:t.listRendering?.levelNumFmts||void 0,listAbstractNumId:t.listRendering?.abstractNumId,listStartOverride:t.listRendering?.startOverride,_originalFormatting:n||void 0};if(e){let i=e.resolveParagraphStyle(r),l=i.paragraphFormatting,a=i.runFormatting;o.alignment=n?.alignment??l?.alignment,o.spaceBefore=n?.spaceBefore??l?.spaceBefore,o.spaceAfter=n?.spaceAfter??l?.spaceAfter,o.lineSpacing=n?.lineSpacing??l?.lineSpacing,o.lineSpacingRule=n?.lineSpacingRule??l?.lineSpacingRule,n?.spacingExplicit&&(o.spacingExplicit=n.spacingExplicit),o.indentLeft=n?.indentLeft??l?.indentLeft,o.indentRight=n?.indentRight??l?.indentRight;let s=n?.numPr?.numId===0&&l?.numPr&&l.numPr.numId!==0?void 0:l;o.indentFirstLine=n?.indentFirstLine??s?.indentFirstLine,o.hangingIndent=n?.hangingIndent??s?.hangingIndent,o.borders=n?.borders??l?.borders,o.shading=n?.shading??l?.shading,o.tabs=n?.tabs??l?.tabs,o.pageBreakBefore=n?.pageBreakBefore??l?.pageBreakBefore,o.keepNext=n?.keepNext??l?.keepNext,o.keepLines=n?.keepLines??l?.keepLines,o.contextualSpacing=n?.contextualSpacing??l?.contextualSpacing,o.outlineLevel=n?.outlineLevel??l?.outlineLevel,o.bidi=n?.bidi??l?.bidi;let c=e.getDefaultCharacterStyle()?.rPr,d=c?dn(a,c):a,u=Ys(n?.runProperties,e);o.defaultTextFormatting=dn(d,u),!n?.numPr&&l?.numPr&&l.numPr.numId!==0&&(o.numPr=l.numPr,o.numPrFromStyle=l.numPr)}else o.alignment=n?.alignment,o.spaceBefore=n?.spaceBefore,o.spaceAfter=n?.spaceAfter,o.lineSpacing=n?.lineSpacing,o.lineSpacingRule=n?.lineSpacingRule,n?.spacingExplicit&&(o.spacingExplicit=n.spacingExplicit),o.indentLeft=n?.indentLeft,o.indentRight=n?.indentRight,o.indentFirstLine=n?.indentFirstLine,o.hangingIndent=n?.hangingIndent,o.borders=n?.borders,o.shading=n?.shading,o.tabs=n?.tabs,o.pageBreakBefore=n?.pageBreakBefore,o.keepNext=n?.keepNext,o.keepLines=n?.keepLines,o.outlineLevel=n?.outlineLevel,o.bidi=n?.bidi,o.defaultTextFormatting=Ys(n?.runProperties,e);if(t.sectionProperties){o._sectionProperties=t.sectionProperties;let i=t.sectionProperties.sectionStart;(i==="nextPage"||i==="continuous"||i==="oddPage"||i==="evenPage")&&(o.sectionBreakType=i)}return t.renderedPageBreakBefore&&(o.renderedPageBreakBefore=!0),Cz(t)&&(o.pageBreakBefore=!0),t.pPrIns&&(o.pPrIns={revisionId:t.pPrIns.id,author:t.pPrIns.author,date:t.pPrIns.date??null}),t.pPrDel&&(o.pPrDel={revisionId:t.pPrDel.id,author:t.pPrDel.author,date:t.pPrDel.date??null}),t.propertyChanges&&t.propertyChanges.length>0&&(o.pPrChange=t.propertyChanges),o}function Sk(t,e,n){let r=t.properties,o=[];for(let i of t.content)if(i.type==="run"){let l=th(i,e,n);o.push(...l)}else if(i.type==="hyperlink"){let l=nh(i,e,n);o.push(...l)}else if(i.type==="simpleField"||i.type==="complexField"){let l=vk(i,e);l&&o.push(l)}else if(i.type==="inlineSdt"){let l=Sk(i,e,n);l&&o.push(l)}else if(i.type==="mathEquation"){let l=kk(i);l&&o.push(l)}return Ce.node("sdt",Pp(r),o.length>0?o:void 0)}function kz(t){return t.type==="text"?t.text.length>0:!0}function Tk(t,e){for(let n of t)n.type==="break"&&n.breakType==="page"?e.push("pageBreak"):kz(n)&&e.push("visible")}function gl(t,e){for(let n of t)n.type==="run"?Tk(n.content,e):gl(n.children.filter(r=>r.type==="run"),e)}function $k(t,e){for(let n of t)switch(n.type){case"run":Tk(n.content,e);break;case"hyperlink":gl(n.children.filter(r=>r.type==="run"),e);break;case"simpleField":gl(n.content,e);break;case"complexField":gl([...n.fieldCode,...n.fieldResult],e);break;case"inlineSdt":$k(n.content,e);break;case"insertion":case"deletion":case"moveFrom":case"moveTo":gl(n.content,e);break;case"mathEquation":e.push("visible");break}}function Ik(t){let e=[];return $k(t.content,e),e}function Cz(t){return Ik(t)[0]==="pageBreak"}function Sz(t){let e=!1,n=!1;for(let r of Ik(t))if(r==="pageBreak"){if(n||e)return!0;e=!0}else n=!0;return!1}function hn(t,e,n){if(!t||!e)return;let r=t.getStyle(e);if(!r?.tblStylePr)return;let o=r.tblStylePr.find(s=>s.type===n);if(!o)return;let i=Ys(o.pPr?.runProperties,t),l=Ys(o.rPr,t),a=dn(i,l);return{tcPr:o.tcPr,rPr:a}}function Dn(t,e){if(!t&&!e)return;if(!t)return e;if(!e)return t;let n={},r=t.tcPr,o=e.tcPr;if(r||o){let i={...r??{},...o??{}};(r?.borders||o?.borders)&&(i.borders={...r?.borders??{},...o?.borders??{}}),(r?.shading||o?.shading)&&(i.shading={...r?.shading??{},...o?.shading??{}}),(r?.margins||o?.margins)&&(i.margins={...r?.margins??{},...o?.margins??{}}),n.tcPr=i}return n.rPr=dn(t.rPr,e.rPr),n}function Tz(t){let e=new Map,n=t.rows.length,r=new Map;for(let o=0;o<n;o++){let i=t.rows[o],l=0,a=i.cells.map(s=>{let c=s.formatting?.gridSpan??1,d=l;return l+=c,{colIndex:d,vMerge:s.formatting?.vMerge,key:`${o}-${d}`}});if(a.length>0&&a.every(({colIndex:s,vMerge:c})=>c==="continue"&&r.has(s))){for(let{colIndex:s,key:c}of a)r.delete(s),e.set(c,{rowSpan:1,skip:!1});continue}for(let{colIndex:s,vMerge:c,key:d}of a){let u=s;if(c==="restart")r.set(u,o),e.set(d,{rowSpan:1,skip:!1});else if(c==="continue"){let f=r.get(u);if(f!==void 0){let h=`${f}-${u}`,p=e.get(h);p&&p.rowSpan++,e.set(d,{rowSpan:1,skip:!0})}else e.set(d,{rowSpan:1,skip:!1})}else r.delete(u),e.set(d,{rowSpan:1,skip:!1})}}return e}function oh(t,e,n){let r=Tz(t),o=t.columnWidths,i=o?.reduce((k,x)=>k+x,0)??0,l=t.formatting?.styleId,a=t.formatting?.look,s=l?e?.getStyle(l):void 0,c=e?.getDefaultTableStyle(),d=t.formatting?.borders??s?.tblPr?.borders??c?.tblPr?.borders,u=t.formatting?.cellMargins??s?.tblPr?.cellMargins??c?.tblPr?.cellMargins??void 0,f=u?{top:u.top?.value,bottom:u.bottom?.value,left:u.left?.value,right:u.right?.value}:void 0,h={styleId:t.formatting?.styleId,width:t.formatting?.width?.value,widthType:t.formatting?.width?.type,justification:t.formatting?.justification,columnWidths:o,tableLayout:t.formatting?.layout??null,floating:t.formatting?.floating,cellMargins:f,look:t.formatting?.look,bidi:t.formatting?.bidi||void 0,_originalFormatting:t.formatting||void 0};t.propertyChanges&&t.propertyChanges.length>0&&(h.tblPrChange=t.propertyChanges);let p={wholeTable:hn(e,l,"wholeTable"),firstRow:hn(e,l,"firstRow"),lastRow:hn(e,l,"lastRow"),firstCol:hn(e,l,"firstCol"),lastCol:hn(e,l,"lastCol"),band1Horz:hn(e,l,"band1Horz"),band2Horz:hn(e,l,"band2Horz"),band1Vert:hn(e,l,"band1Vert"),band2Vert:hn(e,l,"band2Vert"),nwCell:hn(e,l,"nwCell"),neCell:hn(e,l,"neCell"),swCell:hn(e,l,"swCell"),seCell:hn(e,l,"seCell")},m=a?.noHBand!==!0,y=a?.noVBand!==!0,w=0,C=t.rows.length,g=o?.length??Math.max(0,...t.rows.map(k=>k.cells.reduce((x,T)=>x+(T.formatting?.gridSpan??1),0))),v=t.rows.map((k,x)=>{let T=x===0&&!!a?.firstRow,$=x===C-1&&!!a?.lastRow,M=m&&!T&&!$?w%2===0?p.band1Horz:p.band2Horz:void 0;return m&&!T&&!$&&w++,$z(k,e,T,o,i,p,M,y,a,d,x,C,g,r,f,n)});return Ce.node("table",h,v)}function $z(t,e,n,r,o,i,l,a,s,c,d,u,f,h,p,m){let y={height:t.formatting?.height?.value,heightRule:t.formatting?.heightRule,isHeader:!!t.formatting?.header,_originalFormatting:t.formatting||void 0};if(t.structuralChange){let I=t.structuralChange,F={revisionId:I.info.id,author:I.info.author,date:I.info.date??null};I.type==="tableRowInsertion"?y.trIns=F:I.type==="tableRowDeletion"&&(y.trDel=F)}t.propertyChanges&&t.propertyChanges.length>0&&(y.trPrChange=t.propertyChanges);let w=t.cells.length,C=d===0,g=d===(u??1)-1,v=t.formatting?.conditionalFormat,k=v?.firstRow??C,x=v?.lastRow??g,T=f??w,$=0,M=[];for(let I=0;I<t.cells.length;I++){let F=t.cells[I],E=F.formatting?.gridSpan??1,R=`${d??0}-${$}`,N=h?.get(R),B=N?.skip??!1,j=N?.rowSpan??1,O;if(r&&o&&o>0){let Z=0;for(let K=0;K<E&&$+K<r.length;K++)Z+=r[$+K];O=Math.round(Z/o*100)}if($+=E,B)continue;let z=$-E===0,W=$===T,q=F.formatting?.conditionalFormat,Q=q?.firstRow??k,X=q?.lastRow??x,se=q?.firstColumn??z,ie=q?.lastColumn??W,ce;if(a){let Z=s?.firstColumn?1:0,K=$-E-Z;K>=0&&!(s?.lastColumn&&ie)&&!(s?.firstColumn&&se)&&(ce=K%2===0?i?.band1Vert:i?.band2Vert)}q?.oddVBand?ce=i?.band1Vert:q?.evenVBand&&(ce=i?.band2Vert);let Y=l;v?.oddHBand?Y=i?.band1Horz:v?.evenHBand&&(Y=i?.band2Horz),q?.oddHBand?Y=i?.band1Horz:q?.evenHBand&&(Y=i?.band2Horz);let V=i?.wholeTable;V=Dn(V,Y),V=Dn(V,ce),Q&&(s?.firstRow||v?.firstRow||q?.firstRow)&&(V=Dn(V,i?.firstRow)),X&&(s?.lastRow||v?.lastRow||q?.lastRow)&&(V=Dn(V,i?.lastRow)),se&&(s?.firstColumn||v?.firstColumn||q?.firstColumn)&&(V=Dn(V,i?.firstCol)),ie&&(s?.lastColumn||v?.lastColumn||q?.lastColumn)&&(V=Dn(V,i?.lastCol)),Q&&se&&(s?.firstRow||v?.firstRow||q?.firstRow)&&(s?.firstColumn||v?.firstColumn||q?.firstColumn)&&(V=Dn(V,i?.nwCell)),Q&&ie&&(s?.firstRow||v?.firstRow||q?.firstRow)&&(s?.lastColumn||v?.lastColumn||q?.lastColumn)&&(V=Dn(V,i?.neCell)),X&&se&&(s?.lastRow||v?.lastRow||q?.lastRow)&&(s?.firstColumn||v?.firstColumn||q?.firstColumn)&&(V=Dn(V,i?.swCell)),X&&ie&&(s?.lastRow||v?.lastRow||q?.lastRow)&&(s?.lastColumn||v?.lastColumn||q?.lastColumn)&&(V=Dn(V,i?.seCell)),M.push(z0(F,e,n,O,V,c,C,g,z,W,j,p,m))}if(M.length===0){let I=Math.max(T,1),F={formatting:I>1?{gridSpan:I}:void 0,content:[{type:"paragraph",content:[]}]},E=Dn(i?.wholeTable,l);M.push(z0(F,e,n,o&&o>0?100:void 0,E,c,C,g,!0,!0,1,p,m))}return Ce.node("tableRow",y,M)}var Iz=["top","bottom","left","right","insideH","insideV"];function Mz(t,e){if(!t)return t;let n;for(let r of Iz){let o=t[r];if(!o?.color?.themeColor||o.color.auto)continue;let i=No(o.color,e);i&&(n??(n={...t}),n[r]={...o,color:{rgb:i}})}return n??t}function z0(t,e,n,r,o,i,l,a,s,c,d,u,f){let h=t.formatting,p=d??1,m=h?.width?.value,y=h?.width?.type;m===void 0&&r!==void 0&&(m=r,y="pct");let w=No(h?.shading?.fill??o?.tcPr?.shading?.fill,f),C=i?{top:l?i.top:i.insideH,bottom:a?i.bottom:i.insideH,left:s?i.left:i.insideV,right:c?i.right:i.insideV}:void 0,g=o?.tcPr?.borders,v=h?.borders,k=Mz(C||g||v?{...C??{},...g??{},...v??{}}:void 0,f),x={colspan:h?.gridSpan??1,rowspan:p,width:m,widthType:y,verticalAlign:h?.verticalAlign,backgroundColor:w,textDirection:h?.textDirection,noWrap:h?.noWrap,borders:k,margins:h?.margins?{top:h.margins.top?.value,bottom:h.margins.bottom?.value,left:h.margins.left?.value,right:h.margins.right?.value}:o?.tcPr?.margins?{top:o.tcPr.margins.top?.value,bottom:o.tcPr.margins.bottom?.value,left:o.tcPr.margins.left?.value,right:o.tcPr.margins.right?.value}:u,_originalFormatting:h||void 0,_originalResolvedFill:w};if(t.structuralChange){let M=t.structuralChange,I={revisionId:M.info.id,author:M.info.author,date:M.info.date??null};M.type==="tableCellInsertion"?x.cellMarker={kind:"ins",info:I}:M.type==="tableCellDeletion"?x.cellMarker={kind:"del",info:I}:M.type==="tableCellMerge"&&(x.cellMarker={kind:"merge",info:I,vMerge:M.vMerge??"cont",...M.vMergeOrig?{vMergeOrig:M.vMergeOrig}:{}})}t.propertyChanges&&t.propertyChanges.length>0&&(x.tcPrChange=t.propertyChanges);let T=[];for(let M of t.content)M.type==="paragraph"?T.push(rh(M,e,void 0,o?.rPr)):M.type==="table"&&T.push(oh(M,e));T.length===0&&T.push(Ce.node("paragraph",{},[]));let $=n?"tableHeader":"tableCell";return Ce.node($,x,T)}FO(oh);function Rz(t,e){let n=Ez(t),r=rh(t,e),o=[],i=n.length>0&&r.content.size===0,{anchored:l,inFlow:a}=Pz(n);for(let s of l)o.push(H0(s,e));i||o.push(r);for(let s of a)o.push(H0(s,e));return o}function Pz(t){let e=[],n=[];for(let r of t)Hv(r)?e.push(r):n.push(r);return{anchored:e,inFlow:n}}function Ez(t){let e=[];for(let n of t.content)if(n.type==="run"){for(let r of n.content)if(r.type==="shape"&&"shape"in r){let o=r.shape;o.textBody&&o.textBody.content.length>0&&e.push({type:"textBox",id:o.id,size:o.size,position:o.position,wrap:o.wrap,fill:o.fill,outline:o.outline,content:o.textBody.content,margins:o.textBody.margins})}}return e}function H0(t,e){let n=t.size?.width?_e(t.size.width):200,r=t.size?.height?_e(t.size.height):void 0,o;t.fill?.color?.rgb&&(o=`#${t.fill.color.rgb}`);let i,l,a;t.outline&&t.outline.width&&(i=Math.round(t.outline.width/914400*96*100)/100,t.outline.color?.rgb&&(l=`#${t.outline.color.rgb}`),a=t.outline.style||"solid");let s=t.margins?.top!=null?_e(t.margins.top):4,c=t.margins?.bottom!=null?_e(t.margins.bottom):4,d=t.margins?.left!=null?_e(t.margins.left):7,u=t.margins?.right!=null?_e(t.margins.right):7,f=[];for(let h of t.content)f.push(rh(h,e));return f.length===0&&f.push(Ce.node("paragraph",{},[])),Ce.node("textBox",{width:n,height:r,textBoxId:t.id,fillColor:o,outlineWidth:i,outlineColor:l,outlineStyle:a,marginTop:s,marginBottom:c,marginLeft:d,marginRight:u,...QN(t)},f)}function ih(t,e,n,r){let o=[];for(let i of t)if(i.type==="paragraph")o.push(...Rz(i,e)),r&&Sz(i)&&o.push(Ce.node("pageBreak"));else if(i.type==="table")o.push(oh(i,e,n));else if(i.type==="blockSdt"){let l=ih(i.content,e,n,r),a=l.length>0?l:[Ce.node("paragraph",{},[])];o.push(Ce.node("blockSdt",Pp(i.properties),a))}return o}function Fz(t,e){let n=t.package.theme??null,r=e?.styles?ia(e.styles):null,o=ih(t.package.document.content,r,n,!0);return o.length===0&&o.push(Ce.node("paragraph",{},[])),o[o.length-1]?.type.spec.isolating&&o.push(Ce.node("paragraph",{},[])),Ce.node("doc",{defaultTabStopTwips:t.package.settings?.defaultTabStop??null,watermark:Vv(t)??null},o)}function lh(t,e){let n=e?.styles?ia(e.styles):null,r=e?.theme??null,o=ih(t,n,r,!1);return o.length===0&&o.push(Ce.node("paragraph",{},[])),Ce.node("doc",{defaultTabStopTwips:e?.defaultTabStopTwips??null},o)}function Az(t,e){return lh(t,e)}function Dz(){return Ce.node("doc",null,[Ce.node("paragraph",{},[])])}function Nz(t,e){let n=t.floating;if(!n)return!1;let r=gN(t,e),o=0;n.tblpX!==void 0?o=n.tblpX:n.tblpXSpec?n.tblpXSpec==="left"||n.tblpXSpec==="inside"?o=0:n.tblpXSpec==="right"||n.tblpXSpec==="outside"?o=e-r:n.tblpXSpec==="center"&&(o=(e-r)/2):t.justification==="center"?o=(e-r)/2:t.justification==="right"&&(o=e-r);let i=n.leftFromText??0,l=n.rightFromText??0,a=o-i,s=e-(o+r)-l;return a<_o&&s<_o}function Lz(t,e,n){for(let r=0;r<t.length;r++){let o=t[r];o.kind==="table"&&o.floating&&Nz(o,e[r]??n)&&(t[r]={...o,floating:void 0})}}function ah(t,e){let n=t.pageGap??0,r=0;for(let o=0;o<e&&o<t.pages.length;o++){let i=t.pages[o].size?.h??t.pageSize.h;r+=i+n}return r}function Mk(t,e){return t.findIndex(n=>n.id===e)}function Bz(t,e){let n=0;for(let r=t.fromLine;r<t.toLine&&r<e.lines.length;r++)n+=e.lines[r].lineHeight;return n}function Oz(t,e,n,r){let o=[...t.page.fragments].sort((i,l)=>{let a=i.y-l.y;return Math.abs(a)>.5?a:i.x-l.x});for(let i of o){let l=Mk(e,i.blockId);if(l===-1)continue;let a=e[l],s=n[l];if(!a||!s)continue;let c;if(i.kind==="paragraph"){if(a.kind!=="paragraph"||s.kind!=="paragraph")continue;c=Bz(i,s)}else if(i.kind==="table")c=i.height;else if(i.kind==="image")c=i.height;else continue;let d=r.x>=i.x&&r.x<=i.x+i.width,u=r.y>=i.y&&r.y<=i.y+c;if(d&&u)return{fragment:i,block:a,measure:s,pageIndex:t.pageIndex,localX:r.x-i.x,localY:r.y-i.y}}return null}function jz(t,e,n,r){for(let o of t.page.fragments){if(o.kind!=="table")continue;let i=o,l=r.x>=i.x&&r.x<=i.x+i.width,a=r.y>=i.y&&r.y<=i.y+i.height;if(!l||!a)continue;let s=Mk(e,i.blockId);if(s===-1)continue;let c=e[s],d=n[s];if(!c||c.kind!=="table"||!d||d.kind!=="table")continue;let u=c,f=d,h=r.x-i.x,p=r.y-i.y,m=i.headerRowCount??0,y=m>0&&i.continuesFromPrev?Rp(f,m):0,w=0,C=-1;if(f.rows.length===0||u.rows.length===0)continue;if(y>0&&p<y){let B=0;for(let j=0;j<m&&j<f.rows.length;j++){let O=f.rows[j];if(p>=B&&p<B+O.height){C=j;break}B+=O.height}C===-1&&(C=0)}else{let B=p-y;for(let j=i.fromRow;j<i.toRow&&j<f.rows.length;j++){let O=f.rows[j];if(B>=w&&B<w+O.height){C=j;break}w+=O.height}}if(C===-1&&(C=Math.min(i.toRow-1,f.rows.length-1),C<i.fromRow))continue;let g=f.rows[C],v=u.rows[C];if(!g||!v)continue;let k=0,x=-1;if(g.cells.length===0||v.cells.length===0)continue;for(let B=0;B<g.cells.length;B++){let j=g.cells[B];if(h>=k&&h<k+j.width){x=B;break}k+=j.width}if(x===-1&&(x=g.cells.length-1,x<0))continue;let T=g.cells[x],$=v.cells[x];if(!T||!$)continue;let M=0;if(y>0&&C<m)for(let B=0;B<C;B++)M+=f.rows[B]?.height??0;else{M=y;for(let B=i.fromRow;B<C;B++)M+=f.rows[B]?.height??0}let I=0;for(let B=0;B<x;B++)I+=g.cells[B]?.width??0;let F,E;if($.blocks&&$.blocks.length>0){let B=$.blocks[0],j=T.blocks[0];B.kind==="paragraph"&&j?.kind==="paragraph"&&(F=B,E=j)}let R=h-I,N=p-M;return{fragment:i,block:u,measure:f,pageIndex:t.pageIndex,rowIndex:C,colIndex:x,cellBlock:F,cellMeasure:E,cellLocalX:Math.max(0,R),cellLocalY:Math.max(0,N)}}return null}function zz(t){return{fontFamily:t.fontFamily??"Arial",fontSize:t.fontSize??12,bold:t.bold,italic:t.italic,letterSpacing:t.letterSpacing}}function Hz(t,e){let n=[];for(let r=e.fromRun;r<=e.toRun&&r<t.runs.length;r++){let o=t.runs[r];if(o){if(o.kind==="tab"||o.kind==="image"||o.kind==="lineBreak"){n.push(o);continue}if(o.kind==="text"){let i=o.text??"",l=r===e.fromRun,a=r===e.toRun;if(l||a){let s=l?e.fromChar:0,c=a?e.toChar:i.length,d=i.slice(s,c);d.length>0&&n.push({...o,text:d})}else n.push(o)}}}return n}function _z(t,e){let n,r,o=t.pmStart??0,i=0;for(let l=0;l<t.runs.length&&l<=e.toRun;l++){let a=t.runs[l];a&&(l<e.fromRun?a.kind==="text"?i+=(a.text??"").length:(a.kind==="tab"||a.kind==="lineBreak"||a.kind==="image")&&(i+=1):l===e.fromRun&&(i+=e.fromChar,n=o+i,a.kind==="text"&&(i=e.fromChar)))}if(n!==void 0){let l=0;for(let a=e.fromRun;a<=e.toRun&&a<t.runs.length;a++){let s=t.runs[a];if(s)if(s.kind==="text"){let c=s.text??"",d=a===e.fromRun?e.fromChar:0,u=a===e.toRun?e.toChar:c.length;l+=u-d}else(s.kind==="tab"||s.kind==="lineBreak"||s.kind==="image")&&(l+=1)}r=n+l}return{pmStart:n,pmEnd:r}}function Wz(t,e,n,r){let o=0;for(let i=n;i<r&&i<t.lines.length;i++){let l=t.lines[i].lineHeight;if(e>=o&&e<o+l)return i;o+=l}return r>n?Math.min(r-1,t.lines.length-1):null}function Vz(t,e,n,r){let{pmStart:o,pmEnd:i}=_z(t,e);if(o===void 0||i===void 0)return{charOffset:0,pmPosition:t.pmStart??0};let l=t.attrs?.alignment??"left",a=0;l==="center"?a=Math.max(0,(r-e.width)/2):l==="right"&&(a=Math.max(0,r-e.width));let s=Math.max(0,n-a);if(s<=0)return{charOffset:0,pmPosition:o};let c=Hz(t,e);if(c.length===0)return{charOffset:0,pmPosition:o};let d=0,u=0;for(let f of c){if(f.kind==="tab"){let h=f.width??48,p=d+h;if(s<=p){let m=d+h/2;return s<m?{charOffset:u,pmPosition:o+u}:{charOffset:u+1,pmPosition:o+u+1}}d=p,u+=1;continue}if(f.kind==="image"){let h=f.width,p=d+h;if(s<=p){let m=d+h/2;return s<m?{charOffset:u,pmPosition:o+u}:{charOffset:u+1,pmPosition:o+u+1}}d=p,u+=1;continue}if(f.kind==="lineBreak"){if(s>=d)return{charOffset:u,pmPosition:o+u};u+=1;continue}if(f.kind==="text"){let h=f.text??"";if(h.length===0)continue;let p=zz(f),m=Ku(h,p),y=d+m.width;if(s<=y){let w=s-d,C=TN(w,m.charWidths),g=u+C;return{charOffset:g,pmPosition:o+g}}d=y,u+=h.length}}return{charOffset:i-o,pmPosition:i}}function Rk(t){let{fragment:e,block:n,measure:r,localX:o,localY:i}=t;if(e.kind!=="paragraph"||n.kind!=="paragraph"||r.kind!=="paragraph")return null;let l=e,a=n,s=r,c=Wz(s,i,l.fromLine,l.toLine);if(c===null)return null;let d=s.lines[c];if(!d)return null;let u=0;for(let g=l.fromLine;g<c;g++)u+=s.lines[g]?.lineHeight??0;let f=a.attrs?.indent,h=f?.left??0,p=f?.right??0,m=Math.max(0,e.width-h-p),y=o-h,{charOffset:w,pmPosition:C}=Vz(a,d,y,m);return{pmPosition:C,charOffset:w,lineIndex:c}}function qz(t){let{cellBlock:e,cellMeasure:n,cellLocalX:r,cellLocalY:o}=t;if(!e||!n)return null;let i={fragment:{kind:"paragraph",blockId:e.id,x:0,y:0,width:n.lines.reduce((l,a)=>Math.max(l,a.width),100),fromLine:0,toLine:n.lines.length,height:n.totalHeight},block:e,measure:n,pageIndex:t.pageIndex,localX:r,localY:o};return Rk(i)?.pmPosition??null}function _0(t,e){if(e)return qz(e);if(!t)return null;let{fragment:n}=t;return n.kind==="paragraph"?Rk(t)?.pmPosition??null:n.kind==="image"?n.pmStart??null:null}function Pk(t,e,n={}){let r=n.scope??"body",o=r==="body"?"layout-page-content":`layout-page-${r}`,i=`.${o} .layout-table-cell`,l=t.querySelectorAll(`.${o} .layout-table-cell-selected`);for(let d of Array.from(l))d.classList.remove("layout-table-cell-selected");let a=e.selection;if(!("$anchorCell"in a&&typeof a.forEachCell=="function")||!a.forEachCell)return;let s=[];a.forEachCell((d,u)=>{s.push([u,u+d.nodeSize])});let c=t.querySelectorAll(i);for(let d of Array.from(c)){let u=d,f=u.dataset.pmStart;if(f===void 0)continue;let h=Number(f);for(let[p,m]of s)if(h>=p&&h<m){u.classList.add("layout-table-cell-selected");break}}}function W0(t){return{fontFamily:t.fontFamily??"Arial",fontSize:t.fontSize??12,bold:t.bold,italic:t.italic,letterSpacing:t.letterSpacing}}function xf(t,e){return t.findIndex(n=>n.id===e)}function Ul(t,e){let n=(t.pmStart??0)+1,r=0,o;for(let a=0;a<t.runs.length&&a<=e.toRun;a++){let s=t.runs[a];if(s){if(a<e.fromRun)s.kind==="text"?r+=(s.text??"").length:r+=1;else if(a===e.fromRun){r+=e.fromChar,o=n+r;break}}}o===void 0&&(o=n);let i=0;for(let a=e.fromRun;a<=e.toRun&&a<t.runs.length;a++){let s=t.runs[a];if(s)if(s.kind==="text"){let c=s.text??"",d=a===e.fromRun?e.fromChar:0,u=a===e.toRun?e.toChar:c.length;i+=u-d}else i+=1}let l=o+i;return{pmStart:o,pmEnd:l}}function V0(t,e,n,r){let o=[];for(let i=0;i<e.lines.length;i++){let l=e.lines[i],a=Ul(t,l);a.pmStart===void 0||a.pmEnd===void 0||a.pmEnd>n&&a.pmStart<r&&o.push({line:l,index:i})}return o}function yl(t,e,n){let r=Ul(t,e);return r.pmStart===void 0?0:Math.max(0,n-r.pmStart)}function bl(t,e,n,r){let o=0,i=0;for(let l=e.fromRun;l<=e.toRun&&l<t.runs.length;l++){let a=t.runs[l];if(a){if(a.kind==="tab"){let s=a.width??48;if(i+1>=n)return n<=i?o:o+s;o+=s,i+=1;continue}if(a.kind==="image"){let s=a.width;if(i+1>=n)return n<=i?o:o+s;o+=s,i+=1;continue}if(a.kind==="lineBreak"){if(n<=i)return o;i+=1;continue}if(a.kind==="text"){let s=a.text??"",c=l===e.fromRun,d=l===e.toRun,u=c?e.fromChar:0,f=d?e.toChar:s.length,h=s.slice(u,f);if(i+h.length>=n){let y=n-i,w=W0(a),C=Ku(h.slice(0,y),w);return o+C.width}let p=W0(a),m=Ku(h,p);o+=m.width,i+=h.length}}}return o}function Js(t,e){let n=0;for(let r=0;r<e&&r<t.lines.length;r++)n+=t.lines[r].lineHeight;return n}function Zz(t,e,n,r,o){if(r===o)return[];let i=Math.min(r,o),l=Math.max(r,o),a=[];for(let s=0;s<t.pages.length;s++){let c=t.pages[s],d=ah(t,s);for(let u of c.fragments){if(u.kind==="paragraph"){let f=xf(e,u.blockId);if(f===-1)continue;let h=e[f],p=n[f];if(!h||h.kind!=="paragraph"||!p||p.kind!=="paragraph")continue;let m=h,y=p,w=u,C=V0(m,y,i,l);for(let{line:g,index:v}of C){if(v<w.fromLine||v>=w.toLine)continue;let k=Ul(m,g);if(k.pmStart===void 0||k.pmEnd===void 0)continue;let x=Math.max(k.pmStart,i),T=Math.min(k.pmEnd,l);if(x>=T)continue;let $=yl(m,g,x),M=yl(m,g,T),I=m.attrs?.indent,F=I?.left??0,E=I?.right??0,R=Math.max(0,u.width-F-E),N=bl(m,g,$),B=bl(m,g,M),j=m.attrs?.alignment??"left",O=0;j==="center"?O=Math.max(0,(R-g.width)/2):j==="right"&&(O=Math.max(0,R-g.width));let z=Js(y,v)-Js(y,w.fromLine),W=u.x+F+O+Math.min(N,B),q=Math.max(1,Math.abs(B-N)),Q=u.y+z;a.push({x:W,y:Q+d,width:q,height:g.lineHeight,pageIndex:s})}}if(u.kind==="table"){let f=xf(e,u.blockId);if(f===-1)continue;let h=e[f],p=n[f];if(!h||h.kind!=="table"||!p||p.kind!=="table")continue;let m=h,y=p,w=u,C=[],g=0;for(let M=0;M<y.rows.length;M++)C.push(Math.round(g)),g+=y.rows[M]?.height??0;C.push(Math.round(g));let v=w.headerRowCount??0,k=v>0&&w.continuesFromPrev?Rp(y,v):0,x=(C[w.fromRow]??0)+(w.topClip??0),T=w.bottomClip!==void 0?Math.round(w.height):k+((C[w.toRow]??0)-x),$=M=>k+(M-x);for(let M=w.fromRow;M<w.toRow&&M<m.rows.length;M++){let I=m.rows[M],F=y.rows[M];if(!I||!F)continue;let E=C[M]??0,R=0;for(let N=0;N<I.cells.length;N++){let B=I.cells[N],j=F.cells[N];if(!B||!j)continue;let O=B.padding?.top??0,z=Sv(B.blocks,j.blocks,O);for(let W=0;W<B.blocks.length;W++){let q=B.blocks[W],Q=j.blocks[W];if(!q||q.kind!=="paragraph"||!Q||Q.kind!=="paragraph")continue;let X=q,se=Q,ie=z.lineTops[W]??[],ce=V0(X,se,i,l);for(let{line:Y,index:V}of ce){let Z=Ul(X,Y);if(Z.pmStart===void 0||Z.pmEnd===void 0)continue;let K=Math.max(Z.pmStart,i),ee=Math.min(Z.pmEnd,l);if(K>=ee)continue;let G=$(E+(ie[V]??0));if(G+Y.lineHeight<=k||G>=T)continue;let te=yl(X,Y,K),A=yl(X,Y,ee),P=bl(X,Y,te,j.width),_=bl(X,Y,A,j.width);a.push({x:w.x+R+Math.min(P,_),y:w.y+G+d,width:Math.max(1,Math.abs(_-P)),height:Y.lineHeight,pageIndex:s})}}R+=j.width}}}if(u.kind==="image"){let f=u.pmStart??0;(u.pmEnd??f+1)>i&&f<l&&a.push({x:u.x,y:u.y+d,width:u.width,height:u.height,pageIndex:s})}}}return a}function Qs(t,e,n,r,o=0){for(let i=Math.max(0,o);i<t.pages.length;i++){let l=t.pages[i],a=ah(t,i);for(let s of l.fragments){if(s.kind==="paragraph"){let c=xf(e,s.blockId);if(c===-1)continue;let d=e[c],u=n[c];if(!d||d.kind!=="paragraph"||!u||u.kind!=="paragraph")continue;let f=d,h=u,p=s,m=f.pmStart??0,y=f.pmEnd??m;if(r<m||r>y)continue;for(let w=p.fromLine;w<p.toLine;w++){let C=h.lines[w];if(!C)continue;let g=Ul(f,C);if(!(g.pmStart===void 0||g.pmEnd===void 0)&&r>=g.pmStart&&r<=g.pmEnd){let v=yl(f,C,r),k=f.attrs?.indent,x=k?.left??0,T=k?.right??0,$=Math.max(0,s.width-x-T),M=bl(f,C,v),I=f.attrs?.alignment??"left",F=0;I==="center"?F=Math.max(0,($-C.width)/2):I==="right"&&(F=Math.max(0,$-C.width));let E=Js(h,w)-Js(h,p.fromLine);return{x:s.x+x+F+M,y:s.y+E+a,height:C.lineHeight,pageIndex:i}}}}if(s.kind==="image"){let c=s.pmStart??0,d=s.pmEnd??c+1;if(r>=c&&r<=d){let u=r===c?0:s.width;return{x:s.x+u,y:s.y+a,height:s.height,pageIndex:i}}}}}return null}function Kz(t){if(t.kind!=="paragraph")return!1;let e=t.attrs;return e?!!(e.borders?.top||e.borders?.bottom||e.spacingExplicit?.before||e.spacingExplicit?.after):!1}function Uz(t){return Ek(t)}function Ek(t){let e=new Set;for(let n=1;n<t.length;n++){let r=t[n-1],o=t[n];r.kind==="table"&&o.kind==="paragraph"&&(o.runs.length>0||Kz(o)||e.add(n))}return t.map((n,r)=>{if(n.kind==="table")return Xz(n);if(n.kind!=="paragraph")return n;let o=e.has(r),i=n.attrs?.spacingExplicit,l=n.attrs?.spacing?.before!=null,a=n.attrs?.spacing?.after!=null,s=l&&!i?.before,c=a&&!i?.after,d=s||c;if(!d&&!o)return n;let u=n.attrs;return d&&u?.spacing&&(u={...u,spacing:{...u.spacing,before:i?.before?u.spacing.before:void 0,after:i?.after?u.spacing.after:void 0}}),o&&(u={...u??{},suppressEmptyParagraphHeight:!0}),{...n,attrs:u}})}function Xz(t){let e=!1,n=t.rows.map(r=>{let o=!1,i=r.cells.map(l=>{let a=Ek(l.blocks);return a.some((s,c)=>s!==l.blocks[c])?(o=!0,{...l,blocks:a}):l});return o?(e=!0,{...r,cells:i}):r});return e?{...t,rows:n}:t}function Gz(t){return t?.align??t?.alignment}function Yz(t,e,n,r){let o=r.section==="header"?r.margins.header??48:r.pageSize.h-(r.margins.footer??48)-n,i=t.position?.vertical;if(!i)return e;let l=Gz(i),a=i.posOffset!==void 0?_e(i.posOffset):void 0;if(i.relativeTo==="page"){if(a!==void 0)return a-o;if(l==="top")return-o;if(l==="bottom")return r.pageSize.h-t.height-o;if(l==="center")return(r.pageSize.h-t.height)/2-o}if(i.relativeTo==="margin"){let s=r.margins.top,c=r.pageSize.h-r.margins.top-r.margins.bottom;if(a!==void 0)return s+a-o;if(l==="top")return s-o;if(l==="bottom")return s+c-t.height-o;if(l==="center")return s+(c-t.height)/2-o}return a!==void 0?e+a:e}function Jz(t){switch(t.kind){case"paragraph":case"table":return!0;case"image":return!t.anchor?.isAnchored;case"textBox":return t.displayMode===void 0||t.displayMode==="inline";default:return!1}}function Qz(t){return t?t.kind==="paragraph"||t.kind==="table"?t.totalHeight:t.kind==="image"||t.kind==="textBox"?t.height:0:0}function eH(t,e,n,r){let o=0,i=0,l=0;for(let a=0;a<t.length;a++){let s=t[a],c=e[a];if(!(!s||!c)){if(s.kind==="paragraph"&&c.kind==="paragraph"){let d=l,u=d+c.totalHeight;o=Math.min(o,d),i=Math.max(i,u);for(let f of s.runs){if(f.kind!=="image"||!f.position)continue;let h=Yz(f,d,n,r);o=Math.min(o,h),i=Math.max(i,h+f.height)}l=u}else if(s.kind==="table"&&c.kind==="table"){let d=l+c.totalHeight;o=Math.min(o,l),i=Math.max(i,d),l=d}else if(s.kind==="image"&&c.kind==="image"){let d=l+c.height;o=Math.min(o,l),i=Math.max(i,d),l=d}else if(s.kind==="textBox"&&c.kind==="textBox"){let d=l+c.height;o=Math.min(o,l),i=Math.max(i,d),s.displayMode!=="float"&&(l=d)}}}return{visualTop:o,visualBottom:i}}function tH(t,e,n,r){if(!t||!t.content||t.content.length===0)return;let o=lh(t.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null});return Fk(o,e,n,r)}function Fk(t,e,n,r){let o=kp(t,{theme:r.theme??void 0});if(o.length===0)return;let i=Uz(o),l=r.measureBlocks(i,e),a=0,s=0;for(let u=0;u<i.length;u++){let f=Qz(l[u]);a+=f,Jz(i[u])&&(s+=f)}let{visualTop:c,visualBottom:d}=eH(i,l,a,n);return{blocks:i,measures:l,height:a,flowHeight:s,visualTop:c,visualBottom:d}}var ec={header:null,footer:null};function Ua(){ec.header=null,ec.footer=null}function Ak(t,e){let n=e.querySelectorAll(`.layout-page-${t}`);if(n.length===0)return null;let r=e.defaultView,o=r?r.innerHeight/2:0,i=n[0],l=1/0;for(let u of Array.from(n)){let f=u.getBoundingClientRect(),h=Math.abs((f.top+f.bottom)/2-o);h<l&&(l=h,i=u)}let a=ec[t];if(a&&a.host===i&&a.host.isConnected)return a;let s=Array.from(i.querySelectorAll("span[data-pm-start][data-pm-end]")),c=Array.from(i.querySelectorAll("[data-pm-start][data-pm-end]")),d={host:i,spans:s,ranged:c};return ec[t]=d,d}function nH(t,e,n=globalThis.document){let r=t.state.selection;if(!r.empty)return null;let o=r.head,i=Ak(e,n);if(!i)return null;let{host:l,spans:a}=i;for(let m of a){let y=Number(m.dataset.pmStart),w=Number(m.dataset.pmEnd);if(!(!Number.isFinite(y)||!Number.isFinite(w))&&o>=y&&o<=w){let C=l.ownerDocument.createRange(),g=l.ownerDocument.createTreeWalker(m,NodeFilter.SHOW_TEXT),v=o-y,k=g.nextNode();for(;k;){let $=k.data.length;if(v<=$){try{C.setStart(k,v),C.setEnd(k,v);let M=C.getClientRects()[0]??C.getBoundingClientRect();if(M&&M.height>0)return{top:M.top,left:M.left,height:M.height}}catch{}break}v-=$,k=g.nextNode()}let x=m.getBoundingClientRect(),T=(o-y)/Math.max(1,w-y);return{top:x.top,left:x.left+x.width*T,height:x.height}}}let s=l.querySelector(`[data-pm-start="${o}"]`);if(s){let m=s.getBoundingClientRect();return{top:m.top,left:m.left+1,height:m.height||16}}let c=i.ranged,d=null,u=1/0;for(let m of c){let y=Number(m.dataset.pmStart),w=Number(m.dataset.pmEnd);if(!Number.isFinite(y)||!Number.isFinite(w)||o<y||o>w)continue;let C=w-y;C<u&&(u=C,d=m)}if(d){let m=d.getBoundingClientRect(),y=Number(d.dataset.pmEnd),w=o>=y;return{top:m.top,left:w?m.right:m.left+1,height:m.height||16}}let f=null,h=-1/0;for(let m of c){let y=Number(m.dataset.pmStart);Number.isFinite(y)&&(y>o||y>h&&(h=y,f=m))}if(f){let m=f.getBoundingClientRect();return{top:m.top,left:m.right,height:m.height||16}}let p=l.getBoundingClientRect();return{top:p.top+2,left:p.left+2,height:16}}function rH(t,e,n=globalThis.document){let r=t.state.selection;if(r.empty)return[];let o=r.from,i=r.to,l=[],a=Ak(e,n);if(!a)return l;let{host:s,spans:c}=a;for(let d of c){let u=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(!Number.isFinite(u)||!Number.isFinite(f)||f<=o||u>=i)continue;if(d.classList.contains("layout-run-tab")){let w=d.getBoundingClientRect();l.push({top:w.top,left:w.left,width:w.width,height:w.height});continue}let h=null;if(d.firstChild?.nodeType===Node.TEXT_NODE?h=d.firstChild:d.firstChild?.nodeType===Node.ELEMENT_NODE&&d.firstChild.tagName==="A"&&d.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(h=d.firstChild.firstChild),!h)continue;let p=Math.max(0,o-u),m=Math.min(h.length,i-u);if(p>=m)continue;let y=s.ownerDocument.createRange();y.setStart(h,p),y.setEnd(h,m);for(let w of Array.from(y.getClientRects()))l.push({top:w.top,left:w.left,width:w.width,height:w.height})}return l}function q0(t){return t?t.flowHeight??t.height:0}function oH(t){let{pageSize:e,margins:n,finalMargins:r,bodyBlocks:o,headers:i,footers:l,warn:a}=t,s=n.header??48,c=n.footer??48,d=n.top-s,u=n.bottom-c,f=Math.max(0,...(i??[]).map(q0)),h=Math.max(0,...(l??[]).map(q0)),p=f>d,m=h>u;if(!p&&!m)return{margins:n,finalMargins:r};let y=Math.max(0,e.h-24),w=!1,C=k=>{let x={...k};return p&&(x.top=Math.max(k.top,s+f)),m&&(x.bottom=Math.max(k.bottom,c+h)),x.top+x.bottom>y&&(w=!0,x.bottom=Math.max(0,Math.min(x.bottom,y-x.top)),x.top+x.bottom>y&&(x.top=Math.max(0,y-x.bottom))),x},g=C(n),v=C(r);if(o)for(let k of o){if(k.kind!=="sectionBreak")continue;let x=k;x.margins&&(x.margins=C(x.margins))}return w&&a&&a(`[layout] header/footer content exceeds page height; clamping margins to preserve a content area. pageHeight=${Math.round(e.h)} headerBand=${Math.round(f)} footerBand=${Math.round(h)} top=${Math.round(g.top)} bottom=${Math.round(g.bottom)}`),{margins:g,finalMargins:v}}var iH=816,Dk=1056,Xa=96,Z0=48;function Ko(t){return Math.round(t/1440*96)}function ai(t,e){return t!=null?Ko(t):e}function K0(t){return{w:t?.pageWidth?Ko(t.pageWidth):iH,h:t?.pageHeight?Ko(t.pageHeight):Dk}}function U0(t){return{top:ai(t?.marginTop,Xa),right:ai(t?.marginRight,Xa),bottom:ai(t?.marginBottom,Xa),left:ai(t?.marginLeft,Xa),header:ai(t?.headerDistance,Z0),footer:ai(t?.footerDistance,Z0)}}function lH(t,e){let n={header:null,footer:null,firstHeader:null,firstFooter:null};if(!t?.package)return n;let r=t.package.headers,o=t.package.footers,i=null,l=null,a=null,s=null;if(r&&e?.headerReferences){let c=e.headerReferences.find(u=>u.type==="default");c?.rId&&(i=r.get(c.rId)??null);let d=e.headerReferences.find(u=>u.type==="first");d?.rId&&(a=r.get(d.rId)??null)}if(o&&e?.footerReferences){let c=e.footerReferences.find(u=>u.type==="default");c?.rId&&(l=o.get(c.rId)??null);let d=e.footerReferences.find(u=>u.type==="first");d?.rId&&(s=o.get(d.rId)??null)}return e?.titlePg||(!i&&a&&(i=a),!l&&s&&(l=s)),{header:i,footer:l,firstHeader:a,firstFooter:s}}function X0(t){let e=t?.columnCount??1;if(e<=1)return;let n=Ko(t?.columnSpace??720);return{count:e,gap:n,equalWidth:t?.equalWidth??!0,separator:t?.separator}}function aH(t){let e=t.pageSize.w-t.margins.left-t.margins.right,n=t.columns;return!n||n.count<=1?e:Math.floor((e-(n.count-1)*n.gap)/n.count)}function sH(t,e,n){let{configs:r,breakIndices:o}=jv(t,e,n),i=0,l=[];for(let a=0;a<t.length;a++)l.push(aH(r[i]??e)),i<o.length&&a===o[i]&&i++;return l}function Nk(t){return!ra(t.wrapType)&&t.wrapType!=="topAndBottom"}function tc(t){return t.wrapType==="behind"}function Di(t){return Cp(t.wrapType)?!0:t.displayMode==="float"}function cH(t){return ra(t.wrapType)||t.wrapType==="topAndBottom"?!1:kv(t.wrapType)?!0:t.displayMode==="float"&&t.cssFloat!=="none"}function Lk(t){return t==="left"?"right":t==="right"?"left":"bothSides"}function Bk(t){return{pageWidth:t.size.w,pageHeight:t.size.h,marginLeft:t.margins.left,marginTop:t.margins.top,contentWidth:t.size.w-t.margins.left-t.margins.right,contentHeight:t.size.h-t.margins.top-t.margins.bottom}}function Ok(t,e,n,r){let{x:o,side:i}=uH(t,n,r),l=jk(t,e,r);return{x:o,y:l,side:i}}function dH(t,e,n){return jk(t,e,n)}function uH(t,e,n){let r=t.position?.horizontal;if(!r)return t.cssFloat==="right"?{x:e-t.width,side:"right"}:{x:0,side:"left"};let o=fH(r.relativeTo,e,n);if(r.align==="right")return{x:o.size?o.base+o.size-t.width:0,side:"right"};if(r.align==="left")return{x:o.base,side:"left"};if(r.align==="center")return{x:o.size?o.base+(o.size-t.width)/2:0,side:"left"};if(r.posOffset!==void 0){let i=o.base+_e(r.posOffset);return{x:i,side:i>e/2?"right":"left"}}return{x:o.base,side:"left"}}function fH(t,e,n){let r=n?.pageWidth??0,o=n?.marginLeft??0;switch(t){case"page":return{base:-o,size:r};case"leftMargin":return{base:-o,size:o};case"rightMargin":return{base:e,size:o};case"character":return{base:0,size:0};default:return{base:0,size:e}}}function jk(t,e,n){let r=t.position?.vertical;if(!r)return e;let o=pH(r.relativeTo,e,n);return r.align==="top"?o.base:r.align==="center"?o.size?o.base+(o.size-t.height)/2:e:r.align==="bottom"?o.size?o.base+o.size-t.height:e:r.posOffset!==void 0?o.base+_e(r.posOffset):r.relativeTo==="paragraph"||r.relativeTo==="line"?e:o.base}function pH(t,e,n){let r=n?.pageHeight??0,o=n?.marginTop??0,i=n?.contentHeight??0;switch(t){case"paragraph":case"line":return{base:e,size:0};case"page":return{base:-o,size:r};case"topMargin":return{base:-o,size:o};case"bottomMargin":return{base:i,size:o};default:return{base:0,size:i}}}var G0=7,Y0=0;function hH(t,e){if(t.kind!=="paragraph"||e.kind!=="paragraph")return"totalHeight"in e?e.totalHeight:"height"in e?e.height:0;let n=t.runs.filter(l=>l.kind!=="text"||l.text.length>0);if(!(e.lines.length===1&&n.length>0&&n.every(l=>l.kind==="image")))return e.totalHeight;let r=n.reduce((l,a)=>a.kind==="image"?Math.max(l,a.height):l,0),o=t.attrs?.spacing?.before??0,i=t.attrs?.spacing?.after??0;return o+r+i}function J0(t){let e=t?.borders?.top?.width??0,n=t?.borders?.bottom?.width??0;return e+n}function zk(t,e,n){let r=zs(t.width,t.widthType,e),o=r??e,i=Cv(t,e),l=new Map;for(let f of Sp(t))l.set(`${f.rowIndex}-${f.cellIndex}`,f.columnIndex);let a=t.rows.map((f,h)=>({cells:f.cells.map((p,m)=>{let y=p.colSpan??1,w=l.get(`${h}-${m}`)??0,C=0;for(let x=0;x<y&&w+x<i.length;x++)C+=i[w+x]??0;C===0&&(C=(p.width&&p.width>0?p.width:zs(p.widthValue,p.widthType,o))??100);let g=p.padding?.left??G0,v=p.padding?.right??G0,k=Math.max(1,C-g-v);return{blocks:p.blocks.map(x=>n(x,k)),width:C,height:0,colSpan:p.colSpan,rowSpan:p.rowSpan}}),height:0})),s=[];for(let f=0;f<a.length;f++){let h=a[f],p=t.rows[f]?.cells,m=0,y=0;for(let v=0;v<h.cells.length;v++){let k=h.cells[v],x=p?.[v],T=0,$=0;for(let F=0;F<k.blocks.length;F++){let E=x?.blocks[F],R=k.blocks[F];if(!E||!R)continue;let N=hH(E,R),B=E.kind==="paragraph"?E.attrs?.spacing:void 0,j=B?.before??0,O=B?.after??0;T+=Math.max($,j)+(N-j-O),$=O}T+=$,k.height=T;let M=x?.padding?.top??Y0,I=x?.padding?.bottom??Y0;k.height+=M+I,(k.rowSpan??1)<=1&&(m=Math.max(m,k.height)),y=Math.max(y,J0(x))}let w=t.rows[f],C=w?.height,g=w?.heightRule;s[f]=g==="exact"&&!!C,C&&g==="exact"?h.height=C:C?h.height=Math.max(m+y,C):h.height=m+y}let c=a.map(f=>f.height);for(let f=0;f<a.length;f++){let h=t.rows[f]?.cells,p=a[f]?.cells;if(!(!h||!p))for(let m=0;m<h.length;m++){let y=h[m]?.rowSpan??1;if(y<=1)continue;let w=Math.min(f+y-1,a.length-1),C=(p[m]?.height??0)+J0(h[m]),g=0;for(let x=f;x<=w;x++)g+=c[x]??0;let v=C-g;if(v<=0)continue;let k=w;for(;k>f&&s[k];)k--;s[k]||(a[k].height+=v)}}let d=a.reduce((f,h)=>f+h.height,0),u=i.reduce((f,h)=>f+h,0)||r||e;return{kind:"table",rows:a,columnWidths:i,totalWidth:u,totalHeight:d}}var mH=4;function gH(t,e,n,r){let o=Array.isArray(e)?e[0]??0:e,i=yH(t,o,n,r),l=i.filter(m=>m.isMarginRelative),a=i.filter(m=>!m.isMarginRelative),s=new Map;for(let m of l){let y=s.get(m.topY)??[];y.push(m),s.set(m.topY,y)}let c=vH(a,mH),d=[];Q0(c,d),Q0(Array.from(s.values()),d);let u=new Map;for(let m of d){let y=m.fullWidthBlock&&m.isMarginRelative?0:m.anchorBlockIndex,w=u.get(y)??[],{anchorBlockIndex:C,isMarginRelative:g,...v}=m;w.push(v),u.set(y,w)}let f=new Set(u.keys()),h=0,p=[];return t.map((m,y)=>{f.has(y)&&(h=0,p=u.get(y)??[]);let w=p.length>0?p:void 0,C=Array.isArray(e)?e[y]??o:e,g=n(m,C,w,h);return"totalHeight"in g&&(m.kind==="table"&&m.floating||(h+=g.totalHeight)),g})}function yH(t,e,n,r){let o=[];for(let i=0;i<t.length;i++){let l=t[i];switch(l.kind){case"paragraph":bH(l,i,e,o);break;case"table":wH(l,i,e,n,o);break;case"textBox":xH(l,i,e,o,r);break}}return o}function Hk(t,e,n,r,o,i){let l=0,a=0,s=t?.horizontal;if(s?.align==="left")l=n+o;else if(s?.align==="right")a=n+r;else if(s?.posOffset!==void 0){let c=_e(s.posOffset);c<i/2?l=c+n+o:a=i-c+r}else e==="left"?l=n+o:e==="right"&&(a=n+r);return Mp(l,a,i)}function vf(t){let e=t?.vertical?.relativeTo;return e==="margin"||e==="page"}function bH(t,e,n,r){for(let o of t.runs){if(o.kind!=="image")continue;let i=o;if(!cH(i))continue;let l=i.distTop??0,a=i.distBottom??0,s=i.distLeft??12,c=i.distRight??12,d=0,u=i.position?.vertical;u?.align==="top"&&u.relativeTo==="margin"?d=0:u?.posOffset!==void 0&&(d=_e(u.posOffset));let f=d+i.height,{leftMargin:h,rightMargin:p}=Hk(i.position,i.cssFloat,i.width,s,c,n);(h>0||p>0)&&r.push({leftMargin:h,rightMargin:p,topY:d-l,bottomY:f+a,anchorBlockIndex:e,isMarginRelative:vf(i.position)})}}function wH(t,e,n,r,o){let i=t.floating;if(!i)return;let l=zk(t,n,r),a=l.totalWidth,s=l.totalHeight,c=i.leftFromText??12,d=i.rightFromText??12,u=i.topFromText??0,f=i.bottomFromText??0,h=0;i.tblpX!==void 0?h=i.tblpX:i.tblpXSpec?i.tblpXSpec==="left"||i.tblpXSpec==="inside"?h=0:i.tblpXSpec==="right"||i.tblpXSpec==="outside"?h=n-a:i.tblpXSpec==="center"&&(h=(n-a)/2):t.justification==="center"?h=(n-a)/2:t.justification==="right"&&(h=n-a);let p=0,m=0;h<n/2?p=h+a+d:m=n-h+c,{leftMargin:p,rightMargin:m}=Mp(p,m,n);let y=i.tblpY??0,w=y+s;o.push({leftMargin:p,rightMargin:m,topY:y-u,bottomY:w+f,anchorBlockIndex:e})}function xH(t,e,n,r,o){if(!oa(t)||ra(t.wrapType))return;let i=t.width??0,l=t.height??0;if(i<=0||l<=0)return;let a=t.distTop??0,s=t.distBottom??0,c=t.distLeft??12,d=t.distRight??12;if(t.wrapType==="topAndBottom"){let m=dH({height:l,position:t.position},0,o),y=m+l+s;if(y<=0)return;r.push({leftMargin:0,rightMargin:0,topY:Math.max(0,m-a),bottomY:y,anchorBlockIndex:e,isMarginRelative:vf(t.position),fullWidthBlock:!0});return}let u=0;t.position?.vertical?.posOffset!==void 0&&(u=_e(t.position.vertical.posOffset));let f=u+l,{leftMargin:h,rightMargin:p}=Hk(t.position,t.cssFloat,i,c,d,n);h<=0&&p<=0||r.push({leftMargin:h,rightMargin:p,topY:u-a,bottomY:f+s,anchorBlockIndex:e,isMarginRelative:vf(t.position)})}function vH(t,e){let n=[];for(let r of t){let o=n.find(i=>i.some(l=>Math.abs(l.anchorBlockIndex-r.anchorBlockIndex)<=e&&r.topY<l.bottomY&&r.bottomY>l.topY));o?o.push(r):n.push([r])}return n}function Q0(t,e){for(let n of t){let r=Math.min(...n.map(o=>o.anchorBlockIndex));for(let o of n)e.push({...o,anchorBlockIndex:r})}}var kH=new Map;function CH(){kH.clear()}var SH=new Map;function TH(){SH.clear()}var $H=5e3,IH=$H,Yr=new Map;function _k(t){let e=[];for(let r of t.runs)r.kind==="text"?e.push(`t:${r.text}|${r.fontFamily}|${r.fontSize}|${r.bold}|${r.italic}`):r.kind==="tab"?e.push(`tab:${r.width}`):r.kind==="image"?e.push(`img:${r.width}x${r.height}`):r.kind==="lineBreak"&&e.push("br");let n=t.attrs;if(n){n.alignment&&e.push(`align:${n.alignment}`),n.indent&&e.push(`indent:${n.indent.left}|${n.indent.right}|${n.indent.firstLine}|${n.indent.hanging}`),n.spacing&&e.push(`spacing:${n.spacing.before}|${n.spacing.after}|${n.spacing.line}|${n.spacing.lineRule}`),n.defaultFontSize!=null&&e.push(`dfs:${n.defaultFontSize}`),n.defaultFontFamily!=null&&e.push(`dff:${n.defaultFontFamily}`);let r=n.borders;if(r){let o=i=>i?`${i.width??""},${i.style??""},${i.color??""}`:"";e.push(`bdr:${o(r.top)}|${o(r.bottom)}|${o(r.left)}|${o(r.right)}`)}n.suppressEmptyParagraphHeight&&e.push("sup"),n.pPrIns&&e.push(`pins:${n.pPrIns.revisionId}`),n.pPrDel&&e.push(`pdel:${n.pPrDel.revisionId}`)}return e.join("||")}function MH(){for(;Yr.size>IH;){let t=Yr.keys().next().value;if(t===void 0)break;Yr.delete(t)}}function RH(t,e){let n=_k(t),r=Yr.get(n);if(r!==void 0&&r.maxWidth===e)return Yr.delete(n),Yr.set(n,r),r.measure}function PH(t,e,n){let r=_k(t);Yr.set(r,{measure:n,maxWidth:e}),MH()}function EH(){Yr.clear()}function FH(){CH(),TH(),EH()}function AH(t,e,n,r,o){let i=new Map,l=[];for(let c of t.fragments){let d=r(c);if(d.length===0||!("height"in c))continue;let u=c.y-t.margins.top,f=u+c.height;d.forEach((h,p)=>{let m=`${p}:${h.id}`,y=i.get(m);y?(y.top=Math.min(y.top,u),y.bottom=Math.max(y.bottom,f)):(i.set(m,{group:h,depth:p,top:u,bottom:f}),l.push(m))})}let a=2,s=[];for(let c of l){let{group:d,depth:u,top:f,bottom:h}=i.get(c),p=u*(a+1),m=o.createElement("div");m.className="layout-block-sdt-box",m.dataset.sdtGroupId=d.id,m.dataset.sdtType=d.sdtType,m.dataset.sdtDepth=String(u+1),d.tag!=null&&(m.dataset.sdtTag=d.tag),d.alias!=null&&(m.dataset.sdtAlias=d.alias),d.lock!=null&&(m.dataset.sdtLock=d.lock),m.style.position="absolute",m.style.left=`${p}px`,m.style.top=`${f-a}px`,m.style.width=`${n-p*2}px`,m.style.height=`${h-f+a*2}px`;let y=d.alias||d.tag||d.sdtType;if(y){let C=o.createElement("span");C.className="layout-block-sdt-label",C.textContent=y,m.appendChild(C)}let w=DH(d.sdtType);if(w&&d.tag!=null&&!d.bound&&d.lock!=="contentLocked"&&d.lock!=="sdtContentLocked"){let C=o.createElement("button");C.type="button",C.className="layout-sdt-widget",C.dataset.sdtWidget=w,C.dataset.sdtTag=d.tag,C.dataset.sdtGroupId=d.id,C.setAttribute("aria-label",`${w} control ${d.alias||d.tag}`),w==="dropdown"?C.setAttribute("aria-haspopup","listbox"):w==="date"&&C.setAttribute("aria-haspopup","dialog"),C.textContent=w==="dropdown"?"▾":w==="date"?"📅":d.checked?"☒":"☐",m.appendChild(C)}if(d.repeatingItem&&!d.bound){let C=o.createElement("div");C.className="layout-sdt-repeat-controls";for(let g of["add","remove"]){let v=o.createElement("button");v.type="button",v.className="layout-sdt-repeat-btn",v.dataset.sdtRepeat=g,v.dataset.sdtGroupId=d.id,v.setAttribute("aria-label",g==="add"?"Add item":"Remove item"),v.textContent=g==="add"?"+":"✕",C.appendChild(v)}m.appendChild(C)}e.appendChild(m),s.push(m)}NH(e,s)}function DH(t){return t==="checkbox"?"checkbox":t==="dropDownList"||t==="comboBox"?"dropdown":t==="date"?"date":null}function NH(t,e){if(e.length===0||typeof t.addEventListener!="function")return;let n=(a,s)=>{for(let c of e){let d=c.getBoundingClientRect(),u=a>=d.left&&a<=d.right&&s>=d.top&&s<=d.bottom;u!==c.classList.contains("is-active")&&c.classList.toggle("is-active",u)}},r=typeof requestAnimationFrame=="function"?requestAnimationFrame:a=>a(),o=!1,i=0,l=0;t.addEventListener("mousemove",a=>{i=a.clientX,l=a.clientY,!o&&(o=!0,r(()=>{o=!1,n(i,l)}))}),t.addEventListener("mouseleave",()=>{for(let a of e)a.classList.remove("is-active")})}function LH(t,e,n){let r=new Set,o=t.content.size,i=l=>{let a=t.resolve(Math.max(0,Math.min(l,o)));for(let s=1;s<=a.depth;s++)a.node(s).type.name==="blockSdt"&&r.add(`sdt@${a.before(s)}`)};return i(e),n!==e&&i(n),r}function BH(t,e){let n=t.querySelectorAll(".layout-block-sdt-box");for(let r of n){let o=r.dataset.sdtGroupId,i=o!=null&&e.has(o);i!==r.classList.contains("is-focused")&&r.classList.toggle("is-focused",i)}}var Uo={fragment:"layout-fragment",paragraph:"layout-fragment-paragraph",table:"layout-fragment-table",image:"layout-fragment-image"};function OH(t){return t.kind==="paragraph"}function jH(t){return t.kind==="table"}function zH(t){return t.kind==="image"}function Vc(t){t.style.position="absolute",t.style.overflow="hidden"}function HH(t,e,n){let r=n.createElement("div");return r.className=`${Uo.fragment} ${Uo.paragraph}`,Vc(r),r.dataset.blockId=String(t.blockId),r.dataset.fromLine=String(t.fromLine),r.dataset.toLine=String(t.toLine),t.pmStart!==void 0&&(r.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(r.dataset.pmEnd=String(t.pmEnd)),t.continuesFromPrev&&(r.dataset.continuesFromPrev="true"),t.continuesOnNext&&(r.dataset.continuesOnNext="true"),r}function _H(t,e,n){let r=n.createElement("div");return r.className=`${Uo.fragment} ${Uo.table}`,Vc(r),r.dataset.blockId=String(t.blockId),r.dataset.fromRow=String(t.fromRow),r.dataset.toRow=String(t.toRow),t.pmStart!==void 0&&(r.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(r.dataset.pmEnd=String(t.pmEnd)),r}function WH(t,e,n){let r=n.createElement("div");return r.className=`${Uo.fragment} ${Uo.image}`,Vc(r),r.dataset.blockId=String(t.blockId),t.pmStart!==void 0&&(r.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(r.dataset.pmEnd=String(t.pmEnd)),t.isAnchored&&(r.dataset.anchored="true"),t.zIndex!==void 0&&(r.style.zIndex=String(t.zIndex)),r}function kf(t,e,n={}){let r=n.document??document;if(OH(t))return HH(t,e,r);if(jH(t))return _H(t,e,r);if(zH(t))return WH(t,e,r);let o=r.createElement("div");o.className=Uo.fragment,Vc(o);let i=t;return i.blockId!==void 0&&(o.dataset.blockId=String(i.blockId)),i.kind&&(o.dataset.kind=i.kind),o}var cn={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 Jr(t){return t.kind==="text"}function To(t){return t.kind==="tab"}function xi(t){return t.kind==="image"}function $o(t){return t.kind==="lineBreak"}function Xl(t){return t.kind==="field"}var ey={image:"layout-image",imageAnchored:"layout-image-anchored"};function sh(t){return!!(t.cropTop||t.cropRight||t.cropBottom||t.cropLeft||t.opacity!=null&&t.opacity<1)}function ch(t,e){e.opacity!=null&&e.opacity<1&&(t.style.opacity=String(Math.max(0,e.opacity))),VH(t,e)}function VH(t,e){let n=e.cropTop??0,r=e.cropRight??0,o=e.cropBottom??0,i=e.cropLeft??0;if(!(n||r||o||i))return;let l=i+r>0?i/(i+r)*100:50,a=n+o>0?n/(n+o)*100:50;t.style.objectFit="cover",t.style.objectPosition=`${l}% ${a}%`}function qc(t,e,n,r,o={}){let i=o.document??document,l=i.createElement("div");l.className=ey.image,t.isAnchored&&l.classList.add(ey.imageAnchored),l.style.position="absolute",l.style.width=`${t.width}px`,l.style.height=`${t.height}px`,l.style.overflow="hidden",t.zIndex!==void 0&&(l.style.zIndex=String(t.zIndex)),e.anchor?.behindDoc&&(l.style.zIndex="-1"),l.dataset.blockId=String(t.blockId),t.pmStart!==void 0&&(l.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(l.dataset.pmEnd=String(t.pmEnd));let a=i.createElement("img");if(a.src=e.src,a.alt=e.alt??"",a.style.width="100%",a.style.height="100%",a.style.objectFit="contain",a.style.display="block",e.transform&&(a.style.transform=e.transform),a.draggable=!1,e.hlinkHref){let s=i.createElement("a");s.href=e.hlinkHref,s.target="_blank",s.rel="noopener noreferrer",s.style.display="block",s.style.width="100%",s.style.height="100%",s.appendChild(a),l.appendChild(s)}else l.appendChild(a);return l}function qH(t,e,n){if(e.fontFamily&&(t.style.fontFamily=$r(e.fontFamily).cssFallback),e.fontSize){let o=e.fontSize*96/72;t.style.fontSize=`${o}px`}if(e.bold&&(t.style.fontWeight="bold"),e.italic&&(t.style.fontStyle="italic"),e.color&&(t.style.color=e.color),e.letterSpacing&&(t.style.letterSpacing=`${e.letterSpacing}px`),e.allCaps&&(t.style.textTransform="uppercase"),e.smallCaps&&(t.style.fontVariant="small-caps"),e.positionPx&&(t.style.verticalAlign=`${e.positionPx}px`),e.horizontalScale&&e.horizontalScale!==100&&(t.style.display="inline-block",t.style.transform=`scaleX(${e.horizontalScale/100})`,t.style.transformOrigin="left center"),e.kerningMinPt&&e.kerningMinPt>0&&(e.fontSize??11)>=e.kerningMinPt&&(t.style.fontKerning="normal"),e.emboss&&(t.style.textShadow="1px 1px 1px rgba(255,255,255,0.5), -1px -1px 1px rgba(0,0,0,0.3)"),e.imprint&&(t.style.textShadow="-1px -1px 1px rgba(255,255,255,0.5), 1px 1px 1px rgba(0,0,0,0.3)"),e.textShadow&&!e.emboss&&!e.imprint&&(t.style.textShadow="1px 1px 2px rgba(0,0,0,0.3)"),e.textOutline&&(t.style.webkitTextStroke="1px currentColor",t.style.webkitTextFillColor="transparent"),e.emphasisMark){let o=e.emphasisMark==="comma"?"filled sesame":e.emphasisMark==="circle"?"filled circle":"filled dot",i=e.emphasisMark==="underDot"?"under right":"over right";t.style.textEmphasis=`${o}`,t.style.textEmphasisPosition=i,t.style.webkitTextEmphasis=o,t.style.webkitTextEmphasisPosition=i}e.highlight&&(t.style.backgroundColor=e.highlight);let r=[];if(e.underline&&(r.push("underline"),typeof e.underline=="object"&&(e.underline.style&&(t.style.textDecorationStyle=e.underline.style),e.underline.color&&(t.style.textDecorationColor=e.underline.color))),e.strike&&r.push("line-through"),e.commentIds&&e.commentIds.length>0){let o=e.commentIds.find(i=>!n||!n.has(i));o!=null&&(t.style.backgroundColor="rgba(255, 212, 0, 0.15)",t.style.borderBottom="1px solid rgba(255, 212, 0, 0.4)",t.style.cursor="pointer",t.style.transition="background-color 0.15s ease",t.dataset.commentId=String(o))}e.isInsertion&&(t.style.backgroundColor="rgba(52, 168, 83, 0.08)",t.style.borderBottom="2px dashed #2e7d32",t.style.paddingBottom="1px",t.classList.add("docx-insertion"),e.changeAuthor&&(t.dataset.changeAuthor=e.changeAuthor),e.changeDate&&(t.dataset.changeDate=e.changeDate),e.changeRevisionId!=null&&(t.dataset.revisionId=String(e.changeRevisionId))),e.isDeletion&&(t.style.backgroundColor="rgba(211, 47, 47, 0.08)",t.style.color="#c62828",r.includes("line-through")||r.push("line-through"),t.style.textDecorationColor="#c62828",t.classList.add("docx-deletion"),e.changeAuthor&&(t.dataset.changeAuthor=e.changeAuthor),e.changeDate&&(t.dataset.changeDate=e.changeDate),e.changeRevisionId!=null&&(t.dataset.revisionId=String(e.changeRevisionId))),r.length>0&&(t.style.textDecorationLine=r.join(" ")),e.superscript&&(t.style.fontSize="0.75em",t.style.position="relative",t.style.top="-0.4em"),e.subscript&&(t.style.fontSize="0.75em",t.style.position="relative",t.style.top="0.2em"),e.hidden&&(t.classList.add("docx-hidden"),t.style.opacity="0.4",t.style.textDecoration="underline dotted"),e.rtl&&t.setAttribute("dir","rtl"),e.textEffect&&(t.classList.add("docx-text-effect",`docx-text-effect-${e.textEffect}`),t.dataset.effect=e.textEffect)}function lo(t,e,n){e!==void 0&&(t.dataset.pmStart=String(e)),n!==void 0&&(t.dataset.pmEnd=String(n))}function ZH(t,e){let n=e.inlineSdtWidget;n&&(t.classList.add("layout-inline-sdt-widget"),t.dataset.sdtWidget=n.kind,t.dataset.sdtGroupId=n.groupId,t.dataset.sdtPos=String(n.pos),n.tag&&(t.dataset.sdtTag=n.tag),n.alias&&(t.dataset.sdtAlias=n.alias),typeof n.checked=="boolean"&&(t.dataset.sdtChecked=String(n.checked),t.setAttribute("aria-checked",String(n.checked))),t.setAttribute("role","checkbox"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",n.alias||n.tag||"Checkbox content control"))}function nc(t,e,n){let r=e.createElement("span");if(r.className=`${cn.run} ${cn.text}`,qH(r,t,n),lo(r,t.pmStart,t.pmEnd),ZH(r,t),t.hyperlink){let o=e.createElement("a");o.href=t.hyperlink.href,t.hyperlink.href.startsWith("#")||(o.target="_blank",o.rel="noopener noreferrer"),t.hyperlink.tooltip&&(o.title=t.hyperlink.tooltip),o.textContent=t.text,o.style.color="inherit",o.style.textDecoration="inherit",t.hyperlink.noDefaultStyle||(t.color||(o.style.color="#0563c1",r.style.color="#0563c1"),t.underline||(o.style.textDecoration="underline")),r.appendChild(o)}else r.textContent=t.text;return r}var KH=1e3;function Cf(t,e,n,r){let o=e.createElement("span");o.className=`${cn.run} ${cn.tab}`,o.style.display="inline-block",o.style.width=`${n}px`,lo(o,t.pmStart,t.pmEnd);let i=r&&r!=="none"?UH(r):null;if(i){o.style.position="relative",o.textContent="​";let l=e.createElement("span");l.style.position="absolute",l.style.left="0",l.style.right="0",l.style.top="0",l.style.bottom="0",l.style.overflow="hidden",l.style.whiteSpace="nowrap",l.textContent=i.repeat(KH),o.appendChild(l)}else o.textContent=" ";return o}function UH(t){switch(t){case"dot":return".";case"hyphen":return"-";case"underscore":return"_";case"middleDot":return"·";case"heavy":return"_";default:return null}}function Wk(t){if(!t)return 0;let e=t.match(/rotate\(([-\d.]+)deg\)/);return e?(parseFloat(e[1])%360+360)%360:0}function Vk(t,e,n){if(n===0||n===180)return{w:t,h:e};if(n===90||n===270)return{w:e,h:t};let r=n*Math.PI/180,o=Math.abs(Math.sin(r)),i=Math.abs(Math.cos(r));return{w:t*i+e*o,h:t*o+e*i}}function ty(t,e){e.distTop&&(t.style.marginTop=`${e.distTop}px`),e.distBottom&&(t.style.marginBottom=`${e.distBottom}px`)}function XH(t,e){let n=e.createElement("img");n.className=`${cn.run} ${cn.image}`,n.src=t.src,n.width=t.width,n.height=t.height,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,t.alt&&(n.alt=t.alt),t.transform&&(n.style.transform=t.transform,n.style.transformOrigin="center center"),sh(t)&&ch(n,t);let r=Wk(t.transform);if(r!==0){let o=Vk(t.width,t.height,r),i=e.createElement("span");return i.style.display="inline-block",i.style.position="relative",i.style.width=`${o.w}px`,i.style.height=`${o.h}px`,i.style.verticalAlign="middle",n.style.position="absolute",n.style.left=`${(o.w-t.width)/2}px`,n.style.top=`${(o.h-t.height)/2}px`,ty(i,t),lo(i,t.pmStart,t.pmEnd),i.appendChild(n),i}return n.style.display="inline-block",n.style.verticalAlign="middle",t.width>0&&t.height>0&&(n.style.height="auto",n.style.aspectRatio=`${t.width} / ${t.height}`,n.style.maxWidth="100%"),ty(n,t),lo(n,t.pmStart,t.pmEnd),n}function GH(t,e){let n=e.createElement("div");n.className="layout-block-image",n.style.display="block",n.style.textAlign="center",n.style.marginTop=`${t.distTop??6}px`,n.style.marginBottom=`${t.distBottom??6}px`;let r=e.createElement("img");r.src=t.src,r.width=t.width,r.height=t.height,r.style.marginLeft="auto",r.style.marginRight="auto",t.alt&&(r.alt=t.alt),t.transform&&(r.style.transform=t.transform,r.style.transformOrigin="center center"),sh(t)&&ch(r,t);let o=Wk(t.transform);if(o!==0){let i=Vk(t.width,t.height,o);n.style.height=`${i.h}px`,n.style.position="relative",r.style.position="absolute",r.style.left="50%",r.style.top="50%",r.style.marginLeft=`${-t.width/2}px`,r.style.marginRight="0",r.style.marginTop=`${-t.height/2}px`}return lo(n,t.pmStart,t.pmEnd),n.appendChild(r),n}function Sf(t,e){let n;return Di(t)||t.displayMode==="block"||t.wrapType==="topAndBottom"?n=GH(t,e):n=XH(t,e),YH(n,t),n}function YH(t,e){if(e.isInsertion)t.style.outline="2px solid #2e7d32",t.style.outlineOffset="1px",t.classList.add("docx-insertion");else if(e.isDeletion)t.style.outline="2px solid #c62828",t.style.outlineOffset="1px",t.style.opacity="0.6",t.classList.add("docx-deletion");else return;e.changeAuthor&&(t.dataset.changeAuthor=e.changeAuthor),e.changeDate&&(t.dataset.changeDate=e.changeDate),e.changeRevisionId!=null&&(t.dataset.revisionId=String(e.changeRevisionId))}function qk(t,e){let n=e.createElement("br");return n.className=`${cn.run} ${cn.lineBreak}`,lo(n,t.pmStart,t.pmEnd),n}function Tf(t,e,n){let r=t.fallback??"";switch(t.fieldType){case"PAGE":r=String(n.pageNumber);break;case"NUMPAGES":r=String(n.totalPages);break;case"DATE":r=new Date().toLocaleDateString();break;case"TIME":r=new Date().toLocaleTimeString();break}let o={...t,text:r};return nc(o,e,n?.resolvedCommentIds)}function ny(t,e,n){if(Jr(t))return nc(t,e,n?.resolvedCommentIds);if(To(t))return Cf(t,e,48,void 0);if(xi(t))return Sf(t,e);if($o(t))return qk(t,e);if(Xl(t)&&n)return Tf(t,e,n);let r=e.createElement("span");return r.className=cn.run,r}function JH(t,e){let n=[],r=t.runs;for(let o=e.fromRun;o<=e.toRun;o++){let i=r[o];if(i)if(Jr(i)){let l=o===e.fromRun?e.fromChar:0,a=o===e.toRun?e.toChar:i.text.length;if(l>0||a<i.text.length){let s=i.text.slice(l,a);n.push({...i,text:s,pmStart:i.pmStart!==void 0?i.pmStart+l:void 0,pmEnd:i.pmStart!==void 0?i.pmStart+a:void 0})}else n.push(i)}else n.push(i)}return n}function ry(t){return t==="center"?"center":t==="right"?"flex-end":"flex-start"}function QH(t,e){let n=t.position?.horizontal;return n?n.align??"left":e}function oy(t){return[t.pmStart??"no-start",t.pmEnd??"no-end",t.src,t.width,t.height,t.displayMode??"inline",t.wrapType??"none"].join("|")}function e_(t){return{val:t.val,pos:t.pos,leader:t.leader}}function t_(t,e,n){let r="";for(let o=e+1;o<t.length;o++){let i=t[o];if(Jr(i))r+=i.text;else if(Xl(i))i.fieldType==="PAGE"&&n?r+=String(n.pageNumber):i.fieldType==="NUMPAGES"&&n?r+=String(n.totalPages):r+=i.fallback??"";else if(To(i)||$o(i))break}return r}var n_=.5;function r_(t,e,n,r){let o=0;for(let i=e+1;i<t.length;i++){let l=t[i];if(To(l)||$o(l))break;if(Jr(l))o+=n(l.text||"",l.fontSize,l.fontFamily,l.bold,l.italic);else if(Xl(l)){let a;l.fieldType==="PAGE"&&r?a=String(r.pageNumber):l.fieldType==="NUMPAGES"&&r?a=String(r.totalPages):a=l.fallback??"",o+=n(a,l.fontSize,l.fontFamily,l.bold,l.italic)}else xi(l)&&!Di(l)&&(o+=l.width||0)}return o}function o_(t){let e=t.createElement("canvas").getContext("2d");return(n,r=11,o="Calibri",i=!1,l=!1)=>{if(!e)return n.length*7;let a=$r(o).cssFallback,s=r*96/72,c=[];return l&&c.push("italic"),i&&c.push("bold"),c.push(`${s}px`,a),e.font=c.join(" "),e.measureText(n).width}}function iy(t,e,n,r,o){let i=r.createElement("div");i.className=cn.line,i.style.height=`${e.lineHeight}px`,i.style.lineHeight=`${e.lineHeight}px`;let l=JH(t,e);if(l.length===1&&xi(l[0])){let m=l[0],y=QH(m,n);i.style.display="flex",i.style.alignItems="center",i.style.justifyContent=ry(y),i.dataset.flexLine="true"}else l.some(xi)&&(i.style.display="flex",i.style.alignItems="baseline",i.style.justifyContent=ry(n),i.style.lineHeight="normal",i.dataset.flexLine="true");if(l.length===0){let m=r.createElement("span");return m.className=`${cn.run} layout-empty-run`,m.innerHTML="&nbsp;",i.appendChild(m),i}let a=n==="justify",s=!1;a&&o&&(s=!o.isLastLine||o.paragraphEndsWithLineBreak,s&&(i.style.textAlign="justify",i.style.textAlignLast="justify",i.style.width=`${o.availableWidth}px`)),i.style.whiteSpace="pre";let c=l.some(m=>Jr(m)&&m.highlight);i.style.overflow=c?"hidden":"visible";let d=l.some(To),u,f=o_(r);if(d){let m=o?.tabStops?.map(e_),y=o?.leftIndentPx?Math.round(o.leftIndentPx*15):0;u={explicitStops:m,leftIndent:y}}let h=0,p=o?.leftIndentPx??0;if(o?.isFirstLine){let m=o?.firstLineIndentPx??0;h=p+m}else h=p;for(let m=0;m<l.length;m++){let y=l[m];if(To(y)&&u){let w=r_(l,m,f,o?.context),C=t_(l,m,o?.context),g=C.indexOf("."),v=g>=0?f(C.slice(0,g)):0,k=Rv(h,u,{followingWidth:w,decimalPrefixWidth:v}),x=o?.lineRightEdgePx,T=w,$=!1;for(let F=m+1;F<l.length&&!$o(l[F]);F++)if(To(l[F])){$=!0;break}if(x!==void 0&&k.alignment==="end"&&!$&&h+k.width+T>=x-n_){i.style.display="flex",i.style.alignItems="baseline",i.style.whiteSpace="nowrap",i.style.textIndent="0",i.dataset.flexLine="true",o?.isFirstLine&&o.firstLineIndentPx&&o.firstLineIndentPx<0&&i.firstElementChild instanceof HTMLElement&&(i.firstElementChild.style.marginLeft=`${o.firstLineIndentPx}px`);let F=Cf(y,r,0,k.leader);F.style.flex="1 1 0",F.style.minWidth="0",F.style.width="auto",i.appendChild(F);for(let E=m+1;E<l.length;E++){let R=l[E];if(To(R)||$o(R))break;if(Jr(R))i.appendChild(nc(R,r,o?.context?.resolvedCommentIds));else if(Xl(R)&&o?.context)i.appendChild(Tf(R,r,o.context));else if(xi(R)){if(Di(R))continue;let N=oy(R);o?.renderedInlineImageKeys?.has(N)||(o?.renderedInlineImageKeys?.add(N),i.appendChild(Sf(R,r)))}else i.appendChild(ny(R,r,o?.context))}break}let M=k.width;x!==void 0&&h+M+T>x&&(M=Math.max(1,x-h-T));let I=Cf(y,r,M,k.leader);i.appendChild(I),h+=M}else if(Jr(y)){let w=nc(y,r,o?.context?.resolvedCommentIds);if(y.highlight){let v=(y.fontSize?y.fontSize*96/72:14.67)*1.2,k=Math.max(0,e.lineHeight-v);if(k>0){let x=k/2;w.style.paddingTop=`${x}px`,w.style.paddingBottom=`${x}px`}}i.appendChild(w);let C=y.fontSize||11,g=y.fontFamily||"Calibri";h+=f(y.text,C,g,y.bold,y.italic)}else if(xi(y)){if(Di(y))continue;let w=oy(y);if(o?.renderedInlineImageKeys?.has(w))continue;o?.renderedInlineImageKeys?.add(w);let C=Sf(y,r);i.appendChild(C),y.displayMode!=="block"&&y.wrapType!=="topAndBottom"&&(h+=y.width)}else if($o(y)){let w=qk(y,r);i.appendChild(w)}else if(Xl(y)&&o?.context){let w=Tf(y,r,o.context);i.appendChild(w);let C=y.fallback??"";y.fieldType==="PAGE"?C=String(o.context.pageNumber):y.fieldType==="NUMPAGES"&&(C=String(o.context.totalPages));let g=y.fontSize||11,v=y.fontFamily||"Calibri";h+=f(C,g,v,y.bold,y.italic)}else{let w=ny(y,r,o?.context);i.appendChild(w)}}if(!i.querySelector("span[data-pm-start][data-pm-end]")){let m=l.find($o);if(m?.pmStart!==void 0){let y=r.createElement("span");y.className=cn.run,lo(y,m.pmStart,m.pmStart),y.textContent="​",i.insertBefore(y,i.firstChild)}}return i}function nl(t,e){return!t&&!e?!0:!t||!e?!1:t.style===e.style&&t.width===e.width&&t.color===e.color}function ly(t,e){return!t&&!e||!t||!e?!1:nl(t.top,e.top)&&nl(t.bottom,e.bottom)&&nl(t.left,e.left)&&nl(t.right,e.right)&&nl(t.between,e.between)}var i_=/[\u0590-\u085F\u08A0-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,l_=/[\u0041-\u005A\u0061-\u007A\u00C0-\u02B8\u0370-\u0589\u10A0-\u10FF\u1E00-\u1FFF]/;function a_(t){let e=(t.runs??[]).filter(Jr);if(!e.some(n=>n.rtl))return!1;for(let n of e)for(let r of n.text){if(i_.test(r))return!0;if(l_.test(r))return!1}return!0}function ji(t,e,n,r,o={}){let i=o.document??document,l=i.createElement("div");l.className=cn.fragment,l.style.position=r.positioning==="absolute"?"absolute":"relative",l.dataset.blockId=String(t.blockId),e.paraId&&(l.dataset.paraId=e.paraId),l.dataset.fromLine=String(t.fromLine),l.dataset.toLine=String(t.toLine),lo(l,t.pmStart,t.pmEnd),t.continuesFromPrev&&(l.dataset.continuesFromPrev="true"),t.continuesOnNext&&(l.dataset.continuesOnNext="true");let a=e.attrs?.pPrIns,s=e.attrs?.pPrDel;if(a||s){let k=a??s;l.classList.add("layout-revision-pmark"),l.classList.add(a?"layout-revision-ins":"layout-revision-del"),l.dataset.revisionId=String(k.revisionId),l.dataset.revisionAuthor=k.author,k.date&&(l.dataset.revisionDate=k.date)}let c=n.lines.slice(t.fromLine,t.toLine),d=e.attrs?.alignment;e.attrs?.styleId&&(l.dataset.styleId=e.attrs.styleId);let u=!!e.attrs?.bidi||a_(e);u&&(l.dir="rtl"),d?d==="center"?l.style.textAlign="center":d==="right"?l.style.textAlign="right":d==="left"?l.style.textAlign="left":l.style.textAlign=u?"right":"left":u&&(l.style.textAlign="right");let f=e.attrs?.indent,h=0,p=0;f&&(u?(f.left&&f.left>0&&(p=f.left),f.right&&f.right>0&&(h=f.right)):(f.left&&f.left>0&&(h=f.left),f.right&&f.right>0&&(p=f.right)));let m=e.attrs?.borders;if(m){let k=E=>{switch(E){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"}};l.style.boxSizing="border-box";let x=E=>`${E.width}px ${k(E.style)} ${E.color}`,T=ly(o.prevBorders,m),$=ly(m,o.nextBorders),M=T?m.between:m.top,I=$?void 0:m.bottom,F=i.createElement("div");if(F.className="layout-paragraph-border",F.style.position="absolute",F.style.pointerEvents="none",F.style.boxSizing="border-box",F.style.left=`${h-(m.left?.space??0)}px`,F.style.right=`${p-(m.right?.space??0)}px`,F.style.top=`${-(M?.space??0)}px`,F.style.bottom=`${-(I?.space??0)}px`,M&&(F.style.borderTop=x(M)),I&&(F.style.borderBottom=x(I)),m.left&&(F.style.borderLeft=x(m.left)),m.right&&(F.style.borderRight=x(m.right)),(M||I||m.left||m.right)&&l.appendChild(F),m.bar){let E=i.createElement("div");E.style.position="absolute",E.style.left="-8px",E.style.top="0",E.style.bottom="0",E.style.borderLeft=x(m.bar),l.style.position="relative",l.appendChild(E)}}e.attrs?.shading&&(l.style.backgroundColor=e.attrs.shading);let y=t.width-h-p,w=e.runs[e.runs.length-1]?.kind==="lineBreak",C=n.lines.length,g=0;f?.hanging&&f.hanging>0?g=-f.hanging:f?.firstLine&&f.firstLine>0&&(g=f.firstLine);let v=o.renderedInlineImageKeys??new Set;for(let k=0;k<c.length;k++){let x=c[k],T=t.fromLine+k,$=T===C-1,M=T===0&&!t.continuesFromPrev,I=x.leftOffset??0,F=x.rightOffset??0,E=y;if(s_(x,e)){let O=i.createElement("div");O.className=`${cn.line} layout-line-split`,O.style.position="relative",O.style.height=`${x.lineHeight}px`,O.style.lineHeight=`${x.lineHeight}px`;for(let z of x.segments){let W={fromRun:z.fromRun,fromChar:z.fromChar,toRun:z.toRun,toChar:z.toChar,width:z.width,ascent:x.ascent,descent:x.descent,lineHeight:x.lineHeight},q=iy(e,W,d,i,{availableWidth:z.availableWidth,isLastLine:$,isFirstLine:M,paragraphEndsWithLineBreak:w,tabStops:e.attrs?.tabs,leftIndentPx:h,firstLineIndentPx:M?g:0,context:r,renderedInlineImageKeys:v});q.className+=" layout-line-segment",q.style.position="absolute",q.style.left=`${z.leftOffset}px`,q.style.top="0",q.style.width=`${z.availableWidth}px`,O.appendChild(q)}l.appendChild(O);continue}let R=iy(e,x,d,i,{availableWidth:E-I-F,isLastLine:$,isFirstLine:M,paragraphEndsWithLineBreak:w,tabStops:e.attrs?.tabs,leftIndentPx:h,firstLineIndentPx:M?g:0,context:r,renderedInlineImageKeys:v,lineRightEdgePx:t.width-p-F});if(I>0||F>0){I>0&&(R.style.marginLeft=`${I}px`),F>0&&(R.style.marginRight=`${F}px`);let O=E-I-F;O>0&&(R.style.width=`${O}px`)}x.floatSkipBefore&&x.floatSkipBefore>0&&(R.style.marginTop=`${x.floatSkipBefore}px`);let N=f?.hanging&&f.hanging>0,B=f?.firstLine&&f.firstLine>0,j=R.dataset.flexLine==="true";if(M?h>0&&N?(R.style.paddingLeft=`${h}px`,j||(R.style.textIndent=`-${f.hanging}px`)):h>0&&B?(R.style.paddingLeft=`${h}px`,R.style.textIndent=`${f.firstLine}px`):h>0?R.style.paddingLeft=`${h}px`:B&&(R.style.textIndent=`${f.firstLine}px`):h>0?R.style.paddingLeft=`${h}px`:N&&(R.style.paddingLeft=`${f.hanging}px`),p>0&&(R.style.paddingRight=`${p}px`),M&&e.attrs?.listMarker&&!e.attrs?.listMarkerHidden){let O=f?.hanging??0,z=f?.firstLine??0,W=O>0?h-O:h+z;R.style.paddingLeft=`${Math.max(0,W)}px`,R.style.textIndent="0";let{fontFamily:q,fontSize:Q}=Pv(e),X=c_(e.attrs.listMarker,Ev(e),i,q,Q,e.attrs.listMarkerRevision);W<0&&h>0&&(X.style.marginLeft=`${W}px`),R.insertBefore(X,R.firstChild)}l.appendChild(R)}if((a||s)&&!t.continuesOnNext){let k=l.lastElementChild;if(k){let x=i.createElement("span");x.className="layout-revision-pmark-glyph",a?x.classList.add("layout-revision-ins"):x.classList.add("layout-revision-del"),x.textContent="¶",x.setAttribute("aria-hidden","true"),k.appendChild(x)}}return l}function s_(t,e){return(t.segments?.length??0)>1&&!e.attrs?.listMarker}function c_(t,e,n,r,o,i){let l=n.createElement("span");return l.className="layout-list-marker",l.style.fontFamily=$r(r).cssFallback,l.style.fontSize=`${o*96/72}px`,l.style.textAlign="left",l.style.boxSizing="border-box",l.style.display="inline-block",l.style.minWidth=`${e}px`,l.textContent=t,i==="ins"?l.style.color="#2e7d32":i==="del"&&(l.style.color="#c62828",l.style.textDecoration="line-through"),l}function rc(t,e,n){let r=e.createElement("div");r.className=n.layerClass,r.style.position="absolute",r.style.top="0",r.style.left="0",n.sizing==="inset0"?(r.style.right="0",r.style.bottom="0"):(r.style.width="100%",r.style.height="100%",r.style.overflow="hidden"),r.style.pointerEvents="none",n.layerMode==="front"&&(r.style.zIndex="10");for(let o of t){let i=e.createElement("div");i.className=n.itemClass,i.style.position="absolute",i.style.pointerEvents="auto",i.style.top=`${o.y}px`,i.style.left=`${o.x}px`,o.pmStart!==void 0&&(i.dataset.pmStart=String(o.pmStart)),o.pmEnd!==void 0&&(i.dataset.pmEnd=String(o.pmEnd));let l=e.createElement("img");l.src=o.src,l.style.width=`${o.width}px`,l.style.height=`${o.height}px`,l.style.display="block",l.style.maxWidth="none",l.style.maxHeight="none",o.alt&&(l.alt=o.alt),o.transform&&(l.style.transform=o.transform,l.style.transformOrigin="center center"),sh(o)&&ch(l,o),i.appendChild(l),r.appendChild(i)}return r}function d_(t,e,n){let r=[],o=0;for(let i=0;i<t.blocks.length;i++){let l=t.blocks[i];if(l?.kind!=="paragraph"){let c=e.blocks[i];c&&c.kind==="table"&&(o+=c.totalHeight??0);continue}let a=l;for(let c of a.runs){if(c.kind!=="image")continue;let d=c;if(!Di(d))continue;let u=d.position,f=d.distTop??0,h=d.distBottom??0,p=d.distLeft??12,m=d.distRight??12,y="left",w=0;if(u?.horizontal){let g=u.horizontal;g.align==="right"?(y="right",w=n-d.width):g.align==="left"?w=0:g.align==="center"?w=(n-d.width)/2:g.posOffset!==void 0&&(w=_e(g.posOffset),y=w>n/2?"right":"left")}else d.cssFloat==="right"&&(y="right",w=n-d.width);let C=o;if(u?.vertical){let g=u.vertical;g.posOffset!==void 0?C=o+_e(g.posOffset):g.align==="top"&&(C=0)}w=Math.max(0,Math.min(w,n-d.width)),r.push({src:d.src,width:d.width,height:d.height,alt:d.alt,transform:d.transform,x:w,y:C,side:y,distTop:f,distBottom:h,distLeft:p,distRight:m,wrapText:Lk(d.cssFloat),wrapType:d.wrapType,pmStart:d.pmStart,pmEnd:d.pmEnd})}let s=e.blocks[i];s&&s.kind==="paragraph"&&(o+=s.totalHeight)}return r}function Zk(t){return!!t&&t.style!=="none"&&t.style!=="nil"&&t.width!==0}function wl(t,e,n){let r=`border${e.charAt(0).toUpperCase()+e.slice(1)}`;if(!Zk(n))t.style[r]="none";else{let o=n.width??1,i=n.color??"#000000",l=n.style??"solid";t.style[r]=`${o}px ${l} ${i}`}}function Kk(t){let e=[],n=0;for(let r of t)e.push(Math.round(n)),n+=r?.height??0;return e.push(Math.round(n)),e}function u_(t,e,n,r,o){if(e<=0)return{bodyParent:t,bodyOriginY:0};let i=o.createElement("div");return i.style.position="absolute",i.style.left="0",i.style.top=`${e}px`,i.style.width=`${r}px`,i.style.height=`${Math.max(0,n-e)}px`,i.style.overflowX="visible",i.style.overflowY="hidden",t.appendChild(i),{bodyParent:i,bodyOriginY:e}}function f_(t,e){let n=t.createElement("div");n.className="layout-table-cut-border",n.style.position="absolute",n.style.left=`${e.x}px`,n.style.width=`${e.width}px`;let r=e.border.width??1;return n.style.top=`${e.edge==="bottom"?e.topY-r:e.topY}px`,wl(n,"top",e.border),n}function $f(t,e,n,r){t.classList.add(`ep-revision-${e}`,`ep-revision-${n}`),t.dataset.revisionId=String(r.revisionId),t.dataset.revisionAuthor=r.author,r.date&&(t.dataset.revisionDate=r.date)}var Rn={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 p_(t,e,n,r){let o=r.createElement("div");o.className=Rn.cellContent,o.style.position="relative";let i=t.padding?.left??7,l=t.padding?.right??7,a=Math.max(0,e.width-i-l);o.style.width=`${a}px`;let s=d_(t,e,a),c;if(s.length>0){c=s.filter(Nk).map(p=>{let m=p.x+p.width+p.distRight,y=p.y-p.distTop,w=p.y+p.height+p.distBottom,C=0,g=0,v=p.wrapText??"bothSides";return v==="right"?C=m:v==="left"?g=a-(p.x-p.distLeft):p.side==="left"?C=m:g=a-(p.x-p.distLeft),{leftMargin:C,rightMargin:g,topY:y,bottomY:w}});let h=s.filter(tc);h.length>0&&o.appendChild(rc(h,r,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"behind"}))}let d=0,u=0;for(let h=0;h<t.blocks.length;h++){let p=t.blocks[h],m=e.blocks[h];if(p?.kind==="paragraph"&&m?.kind==="paragraph"){let y=p,w=m,C=y.attrs?.spacing,g=Math.max(u,C?.before??0);d+=g,c&&c.length>0&&(w=_s(y,a,{floatingZones:c,paragraphYOffset:d}));let v={blockId:y.id,width:a,height:w.totalHeight,fromLine:0,toLine:w.lines.length,pmStart:y.pmStart,pmEnd:y.pmEnd},k={...n,insideTableCell:!0},x=ji(v,y,w,k,{document:r});x.style.position="relative",g>0&&(x.style.marginTop=`${g}px`),o.appendChild(x),d+=w.totalHeight,u=C?.after??0}else if(p?.kind==="table"&&m?.kind==="table"){let y=p,w=m,C=u,g=h_(y,w,n,r);g.style.position="relative",C>0&&(g.style.marginTop=`${C}px`),o.appendChild(g),d+=C+(m.totalHeight??0),u=0}}u>0&&(o.style.paddingBottom=`${u}px`);let f=s.filter(h=>!tc(h));return f.length>0&&o.appendChild(rc(f,r,{layerClass:"layout-cell-floating-images-layer",itemClass:"layout-cell-floating-image",sizing:"fullSize",layerMode:"front"})),o}function h_(t,e,n,r){let o=r.createElement("div");o.className=`${Rn.table} layout-nested-table`,o.style.position="relative",o.style.width=`${e.totalWidth}px`,o.style.display="block",t.justification==="center"?(o.style.marginLeft="auto",o.style.marginRight="auto"):t.justification==="right"?o.style.marginLeft="auto":t.indent&&(o.style.marginLeft=`${t.indent}px`),o.dataset.blockId=String(t.id),t.pmStart!==void 0&&(o.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(o.dataset.pmEnd=String(t.pmEnd));let i=t.rows[0],l=i?.trackedIns,a=i?.trackedDel,s=(p,m)=>!!p&&!!m&&(p.author??"")===(m.author??"")&&(p.date??null)===(m.date??null),c=t.rows.length>0&&t.rows.every(p=>l?s(p.trackedIns,l):a?s(p.trackedDel,a):!1);if(c){let p=l??a,m=l?"ins":"del";o.classList.add("ep-revision-table",`ep-revision-${m}`),o.dataset.revisionId=String(p.revisionId),o.dataset.revisionAuthor=p.author,p.date&&(o.dataset.revisionDate=p.date)}let d=Kk(e.rows),u=t.bidi===!0,f=e.columnWidths.reduce((p,m)=>p+(m??0),0),h=new Map;for(let p=0;p<t.rows.length;p++){let m=t.rows[p],y=e.rows[p];if(!m||!y)continue;let w=If(m,y,p,d[p]??0,e.columnWidths,t.rows.length,n,r,h,d,void 0,c,u,f);o.appendChild(w)}return o.style.height=`${d[t.rows.length]??0}px`,o}function Uk(t,e,n,r,o,i,l,a){let s=l.createElement("div");s.className=Rn.cell,t.trackedMarker&&t.trackedMarker.info.revisionId!==a&&$f(s,"cell",t.trackedMarker.kind,t.trackedMarker.info),s.style.position="absolute",s.style.left=`${n}px`,s.style.top="0",s.style.width=`${e.width}px`,s.style.height=`${r}px`,s.style.overflow="hidden",s.style.boxSizing="border-box";let c=t.padding?.top??1,d=t.padding?.right??7,u=t.padding?.bottom??1,f=t.padding?.left??7;s.style.padding=`${c}px ${d}px ${u}px ${f}px`,t.borders&&(o.isFirstRow&&wl(s,"top",t.borders.top),wl(s,"right",t.borders.right),wl(s,"bottom",t.borders.bottom),o.isFirstCol&&wl(s,"left",t.borders.left)),t.background&&(s.style.backgroundColor=t.background),t.noWrap&&(s.style.whiteSpace="nowrap");let h=(e.height??0)>=r-.5;if(t.verticalAlign&&!h)switch(s.style.display="flex",s.style.flexDirection="column",t.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=p_(t,e,i,l);if(s.appendChild(p),t.blocks.length>0){let m=t.blocks[0],y=t.blocks[t.blocks.length-1];m&&"pmStart"in m&&m.pmStart!==void 0&&(s.dataset.pmStart=String(m.pmStart)),y&&"pmEnd"in y&&y.pmEnd!==void 0&&(s.dataset.pmEnd=String(y.pmEnd))}return s}function m_(t,e){let n=t.bidi===!0,r=n?e.reduce((o,i)=>o+(i??0),0):0;return Sp(t).map(o=>{let i=0;for(let l=0;l<o.columnIndex;l++)i+=e[l]??0;if(n){let l=0;for(let a=0;a<o.colSpan;a++)l+=e[o.columnIndex+a]??0;i=r-i-l}return{rowIndex:o.rowIndex,cellIndex:o.cellIndex,columnIndex:o.columnIndex,x:i,colSpan:o.colSpan,rowSpan:o.rowSpan,cell:t.rows[o.rowIndex].cells[o.cellIndex]}})}function If(t,e,n,r,o,i,l,a,s,c,d,u,f=!1,h=0){let p=a.createElement("div");p.className=Rn.row,u||(t.trackedDel?$f(p,"row","del",t.trackedDel):t.trackedIns&&$f(p,"row","ins",t.trackedIns));let m=c&&c.length>n+1?(c[n+1]??0)-(c[n]??0):e.height;p.style.position="absolute",p.style.left="0",p.style.top=`${r}px`,p.style.width="100%",p.style.height=`${m}px`,p.dataset.rowIndex=String(n);let y=new Set;if(s){for(let[,g]of s)if(g.startRow<n&&g.startRow+g.rowSpan>n)for(let v=0;v<g.colSpan;v++)y.add(g.columnIndex+v)}let w=0,C=0;for(;y.has(C);)w+=o[C]??0,C++;for(let g=0;g<t.cells.length;g++){let v=t.cells[g],k=e.cells[g];if(!v||!k)continue;let x=v.colSpan??1,T=v.rowSpan??1,$=m;if(T>1&&c){$=0;for(let R=n;R<n+T&&R<c.length-1;R++)$+=(c[R+1]??0)-(c[R]??0);$===0&&($=e.height*T)}let M=0;for(let R=0;R<x&&C+R<o.length;R++)M+=o[C+R]??0;let I=n===0||d===!0,F=f?C+x>=o.length:C===0;f||C+x>=o.length;let E=Uk(v,k,f?h-w-M:w,$,{isFirstRow:I,isFirstCol:F},l,a,t.trackedIns?.revisionId??t.trackedDel?.revisionId);if(E.dataset.cellIndex=String(g),E.dataset.columnIndex=String(C),T>1&&(E.dataset.rowSpan=String(T)),p.appendChild(E),T>1&&s){let R=`${n}-${C}`;s.set(R,{cell:v,cellMeasure:k,columnIndex:C,startRow:n,rowSpan:T,colSpan:x,x:w,totalHeight:$})}for(w+=M,C+=x;y.has(C);)w+=o[C]??0,C++}return p}function Zc(t,e,n,r,o={}){let i=o.document??document,l=i.createElement("div");l.className=Rn.table,l.style.position=r.positioning==="flow"?"relative":"absolute",l.style.width=`${t.width}px`,l.style.overflow="hidden",l.dataset.blockId=String(t.blockId),l.dataset.fromRow=String(t.fromRow),l.dataset.toRow=String(t.toRow),t.pmStart!==void 0&&(l.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(l.dataset.pmEnd=String(t.pmEnd));let a=e.rows[0],s=a?.trackedIns,c=a?.trackedDel,d=(R,N)=>!!R&&!!N&&(R.author??"")===(N.author??"")&&(R.date??null)===(N.date??null),u=e.rows.length>0&&e.rows.every(R=>s?d(R.trackedIns,s):c?d(R.trackedDel,c):!1);if(u){let R=s??c,N=s?"ins":"del";l.classList.add("ep-revision-table",`ep-revision-${N}`),l.dataset.revisionId=String(R.revisionId),l.dataset.revisionAuthor=R.author,R.date&&(l.dataset.revisionDate=R.date),l.style.overflowX="visible",l.style.overflowY="hidden"}let f=e.bidi===!0,h=n.columnWidths.reduce((R,N)=>R+(N??0),0),p=0;for(let R=0;R<n.columnWidths.length-1;R++){p+=n.columnWidths[R]??0;let N=i.createElement("div");N.className=Rn.resizeHandle,N.style.position="absolute",N.style.left=`${(f?h-p:p)-3}px`,N.style.top="0",N.style.width="6px",N.style.height="100%",N.style.cursor="col-resize",N.style.zIndex="10",N.dataset.columnIndex=String(R),N.dataset.tableBlockId=String(t.blockId),t.pmStart!==void 0&&(N.dataset.tablePmStart=String(t.pmStart)),l.appendChild(N)}let m=Kk(n.rows),y=m_(e,n.columnWidths),w=t.headerRowCount??0,C=0;if(w>0&&t.continuesFromPrev){let R=new Map;for(let N=0;N<w;N++){let B=e.rows[N],j=n.rows[N];if(!B||!j)continue;let O=If(B,j,N,C,n.columnWidths,e.rows.length,r,i,R,m,N===0,u,f,h);O.dataset.repeatedHeader="true",l.appendChild(O),C+=j.height}}let g=(m[t.fromRow]??0)+(t.topClip??0),v=R=>C+(R-g),k=t.bottomClip!==void 0?Math.round(t.height):v(m[t.toRow]??0);l.style.height=`${k}px`;let{bodyParent:x,bodyOriginY:T}=u_(l,C,k,t.width,i),$=R=>v(R)-T,M=new Map,I=w>0&&t.continuesFromPrev;for(let R of y){if(R.rowSpan<=1||R.rowIndex>=t.fromRow||R.rowIndex+R.rowSpan<=t.fromRow||I&&R.rowIndex<w)continue;let N=n.rows[R.rowIndex]?.cells?.[R.cellIndex];if(!N)continue;let B=0;for(let z=R.rowIndex;z<R.rowIndex+R.rowSpan&&z<m.length-1;z++)B+=(m[z+1]??0)-(m[z]??0);M.set(`${R.rowIndex}-${R.columnIndex}`,{cell:R.cell,cellMeasure:N,columnIndex:R.columnIndex,startRow:R.rowIndex,rowSpan:R.rowSpan,colSpan:R.colSpan,x:R.x,totalHeight:B}),R.rowIndex+R.rowSpan>=e.rows.length;let j=f?R.columnIndex+R.colSpan>=n.columnWidths.length:R.columnIndex===0;f?R.columnIndex:R.columnIndex+R.colSpan>=n.columnWidths.length;let O=Uk(R.cell,N,R.x,B,{isFirstRow:!1,isFirstCol:j},r,i);O.style.top=`${$(m[R.rowIndex]??0)}px`,O.dataset.columnIndex=String(R.columnIndex),O.dataset.vmergeContinuation="true",delete O.dataset.pmStart,delete O.dataset.pmEnd,x.appendChild(O)}for(let R=t.fromRow;R<t.toRow;R++){let N=e.rows[R],B=n.rows[R];if(!N||!B)continue;let j=w>0&&t.continuesFromPrev?!1:t.continuesFromPrev&&R===t.fromRow&&!t.topClip,O=If(N,B,R,$(m[R]??0),n.columnWidths,e.rows.length,r,i,M,m,j,u,f,h);x.appendChild(O)}let F=(R,N,B,j)=>{for(let O of y){if(O.rowIndex>R||O.rowIndex+O.rowSpan-1<R||j&&!(N==="bottom"?O.rowIndex+O.rowSpan-1>R:O.rowIndex<R))continue;let z=O.cell.borders?.[N];if(!Zk(z))continue;let W=0;for(let q=0;q<O.colSpan;q++)W+=n.columnWidths[O.columnIndex+q]??0;l.appendChild(f_(i,{x:O.x,topY:B,width:W,edge:N,border:z}))}};t.topClip?F(t.fromRow,"top",C,!1):t.continuesFromPrev&&F(t.fromRow,"top",C,!0),t.bottomClip!==void 0?F(t.toRow-1,"bottom",k,!1):t.continuesOnNext&&F(t.toRow-1,"bottom",k,!0);for(let R=t.fromRow;R<t.toRow-1;R++){let N=v(m[R+1]??0);if(N<=C||N>=t.height)continue;let B=i.createElement("div");B.className=Rn.rowResizeHandle,B.style.position="absolute",B.style.left="0",B.style.top=`${N-3}px`,B.style.width="100%",B.style.height="6px",B.style.cursor="row-resize",B.style.zIndex="10",B.dataset.rowIndex=String(R),B.dataset.tableBlockId=String(t.blockId),t.pmStart!==void 0&&(B.dataset.tablePmStart=String(t.pmStart)),l.appendChild(B)}let E=t.toRow===e.rows.length&&t.bottomClip===void 0;if(E){let R=i.createElement("div");R.className=Rn.tableEdgeHandleBottom,R.style.position="absolute",R.style.left="0",R.style.top=`${v(m[t.toRow]??0)-3}px`,R.style.width="100%",R.style.height="6px",R.style.cursor="row-resize",R.style.zIndex="10",R.dataset.rowIndex=String(e.rows.length-1),R.dataset.tableBlockId=String(t.blockId),R.dataset.isEdge="bottom",t.pmStart!==void 0&&(R.dataset.tablePmStart=String(t.pmStart)),l.appendChild(R)}if(E){let R=i.createElement("div");R.className=Rn.tableEdgeHandleRight,R.style.position="absolute",R.style.left=`${h-3}px`,R.style.top="0",R.style.width="6px",R.style.height="100%",R.style.cursor="col-resize",R.style.zIndex="10",R.dataset.columnIndex=String(n.columnWidths.length-1),R.dataset.tableBlockId=String(t.blockId),R.dataset.isEdge="right",t.pmStart!==void 0&&(R.dataset.tablePmStart=String(t.pmStart)),l.appendChild(R)}return l}var g_={textBox:"layout-textbox"};function Kc(t,e,n,r,o={}){let i=o.document??document,l=i.createElement("div");if(l.className=g_.textBox,l.style.position="absolute",l.style.width=`${t.width}px`,l.style.height=`${t.height}px`,l.style.overflow="hidden",l.style.boxSizing="border-box",y_(l,t),e.fillColor&&(l.style.backgroundColor=e.fillColor),e.outlineWidth&&e.outlineWidth>0){let d=e.outlineStyle||"solid",u=e.outlineColor||"#000000";l.style.border=`${e.outlineWidth}px ${d} ${u}`}let a=e.margins??wi;l.style.padding=`${a.top}px ${a.right}px ${a.bottom}px ${a.left}px`,l.dataset.blockId=String(t.blockId),t.pmStart!==void 0&&(l.dataset.pmStart=String(t.pmStart)),t.pmEnd!==void 0&&(l.dataset.pmEnd=String(t.pmEnd));let s=t.width-a.left-a.right,c=0;for(let d=0;d<e.content.length;d++){let u=e.content[d],f=n.innerMeasures[d];if(!f)continue;let h={blockId:u.id,width:s,height:f.totalHeight,pmStart:u.pmStart,pmEnd:u.pmEnd,fromLine:0,toLine:f.lines.length},p=ji(h,u,f,{...r,positioning:"flow"},{document:i});l.appendChild(p),c+=f.totalHeight}return l}function y_(t,e){!e.isFloating&&e.zIndex===void 0||(t.style.zIndex=String(e.zIndex??10))}var b_="layout-watermark-layer";function w_(t,e){let n=Math.max(t.trim().length,1),r=e/(n*.62);return Math.max(24,Math.min(r,180))}function x_(t,e,n){let r=n.createElement("div");r.style.position="absolute",r.style.top="50%",r.style.left="50%",r.style.whiteSpace="nowrap",r.style.fontWeight="bold",r.style.color=t.color,r.style.fontFamily=$r(t.font).cssFallback,r.style.userSelect="none";let o=e.size.w-e.margins.left-e.margins.right,i=t.layout==="diagonal"?o*1.3:o,l=t.fontSize!==void 0?t.fontSize*96/72:w_(t.text,i);r.style.fontSize=`${l}px`,r.style.lineHeight="1",r.style.opacity=t.semitransparent?"0.5":"0.85";let a=t.layout==="diagonal"?-45:0;return r.style.transform=`translate(-50%, -50%) rotate(${a}deg)`,r.style.transformOrigin="center center",r.textContent=t.text,r}function v_(t,e,n){if(!t.dataUrl)return null;let r=n.createElement("img");r.src=t.dataUrl,r.alt="",r.style.position="absolute",r.style.top="50%",r.style.left="50%",r.style.transform="translate(-50%, -50%)";let o=e.size.w-e.margins.left-e.margins.right,i=t.widthEmu!==void 0?t.widthEmu/(914400/96):o*.75;return r.style.width=`${i*(t.scale||1)}px`,r.style.height="auto",t.washout&&(r.style.opacity="0.5",r.style.filter="brightness(1.4) contrast(0.4)"),r}function k_(t,e,n=document){let r=t.kind==="text"?x_(t,e,n):v_(t,e,n);if(!r)return null;let o=n.createElement("div");return o.className=b_,o.setAttribute("aria-hidden","true"),o.style.position="absolute",o.style.inset="0",o.style.overflow="hidden",o.style.pointerEvents="none",o.style.zIndex="0",o.appendChild(r),o}function Xk(t){return t?.align??t?.alignment}function C_(t,e){let n=t.position.vertical;if(!n)return t.paragraphY;let r=Xk(n),o=n.posOffset!==void 0?_e(n.posOffset):void 0;if(n.relativeTo==="page"){if(o!==void 0)return o-e.flowTop;if(r==="top")return-e.flowTop;if(r==="bottom")return e.pageHeight-t.height-e.flowTop;if(r==="center")return(e.pageHeight-t.height)/2-e.flowTop}if(n.relativeTo==="margin"){let i=e.margins.top,l=e.pageHeight-e.margins.top-e.margins.bottom;if(o!==void 0)return i+o-e.flowTop;if(r==="top")return i-e.flowTop;if(r==="bottom")return i+l-t.height-e.flowTop;if(r==="center")return i+(l-t.height)/2-e.flowTop}return o!==void 0?t.paragraphY+o:t.paragraphY}function Gk(t,e,n){if(!e)return"0";let r=Xk(e);if(e.relativeTo==="page"){if(e.posOffset!==void 0)return`${_e(e.posOffset)-n.flowLeft}px`;if(r==="right")return`${n.pageWidth-t-n.flowLeft}px`;if(r==="center")return`${(n.pageWidth-t)/2-n.flowLeft}px`;if(r==="left")return`${-n.flowLeft}px`}return e.posOffset!==void 0?`${_e(e.posOffset)}px`:r==="right"?`${n.contentWidth-t}px`:r==="center"?`${(n.contentWidth-t)/2}px`:"0"}function S_(t,e,n){t.style.left=Gk(e.width,e.position.horizontal,n)}function T_(t,e){let n=t.tblpY??0;t.vertAnchor==="page"?n-=e.flowTop:t.vertAnchor==="margin"&&(n+=e.margins.top-e.flowTop);let r=t.tblpX??0;return t.horzAnchor==="page"?r-=e.flowLeft:t.horzAnchor==="margin"&&(r+=e.margins.left-e.flowLeft),{left:r,top:n}}function ay(t,e,n,r){let o=n.document??document,i=o.createElement("div");i.style.position="relative";let l=e.contentWidth??600,a=[],s=0;for(let c=0;c<t.blocks.length;c++){let d=t.blocks[c],u=t.measures[c];if(!(!d||!u))if(d.kind==="paragraph"){if(u.kind!=="paragraph")continue;let f=d,h=u,p=f.attrs?.spacing?.before??0,m=s,y=[];for(let v of f.runs)if(v.kind==="image"&&"position"in v&&v.position){let k=v;a.push({src:k.src,width:k.width,height:k.height,alt:k.alt,paragraphY:m,position:k.position})}else y.push(v);let w={...f,runs:y},C={blockId:f.id,width:l,height:h.totalHeight,fromLine:0,toLine:h.lines.length,pmStart:f.pmStart,pmEnd:f.pmEnd},g=ji(C,w,h,{...e,positioning:"absolute"},{document:o});g.style.top=`${s+p}px`,g.style.left="0",g.style.width=`${l}px`,i.appendChild(g),s+=h.totalHeight}else if(d.kind==="table"){if(u.kind!=="table")continue;let f={blockId:d.id,width:u.totalWidth,height:u.totalHeight,fromRow:0,toRow:u.rows.length,pmStart:d.pmStart,pmEnd:d.pmEnd},h=Zc(f,d,u,{...e,positioning:"absolute"},{document:o});if(d.floating){let{left:p,top:m}=T_(d.floating,r);h.style.top=`${m}px`,h.style.left=`${p}px`,i.appendChild(h)}else h.style.top=`${s}px`,h.style.left="0",i.appendChild(h),s+=u.totalHeight}else if(d.kind==="image"){if(u.kind!=="image")continue;let f={blockId:d.id,width:u.width,height:u.height,pmStart:d.pmStart,pmEnd:d.pmEnd},h=qc(f,d,u,{...e},{document:o});h.style.top=`${s}px`,h.style.left="0",i.appendChild(h),s+=u.height}else if(d.kind==="textBox"){if(u.kind!=="textBox")continue;let f={blockId:d.id,width:u.width,height:u.height,pmStart:d.pmStart,pmEnd:d.pmEnd},h=Kc(f,d,u,{...e,positioning:"absolute"},{document:o});h.style.top=`${s}px`,h.style.left=Gk(u.width,d.position?.horizontal,r),i.appendChild(h),d.displayMode!=="float"&&(s+=u.height)}else d.kind==="sectionBreak"||d.kind==="pageBreak"||d.kind==="columnBreak"||gp(d,"renderHeaderFooterContent")}for(let c of a){let d=o.createElement("img");d.src=c.src,d.width=c.width,d.height=c.height,c.alt&&(d.alt=c.alt),d.style.position="absolute",d.style.display="block",d.style.width=`${c.width}px`,d.style.height=`${c.height}px`,d.style.maxWidth="none",d.style.maxHeight="none",S_(d,c,r),d.style.top=`${C_(c,r)}px`,i.appendChild(d)}return i}var oc=12,Mf=24,cu=6;function $_(t,e){if(t.size!==e.size)return!1;for(let[n,r]of t)if(e.get(n)!==r)return!1;return!0}function I_(t,e){for(let[n,r]of e)if((t.get(n)??0)<r)return!1;return!0}function M_(t,e){let n=new Map(t);for(let[r,o]of e)n.set(r,Math.max(n.get(r)??0,o));return n}var du=8;function R_(t){let e=[],n=(r,o)=>{for(let i of r)if(i.kind==="paragraph")for(let l of i.runs)l.kind==="text"&&l.footnoteRefId!=null&&e.push({footnoteId:l.footnoteRefId,pmPos:l.pmStart??0,...o??{}});else i.kind==="table"?i.rows.forEach((l,a)=>{for(let s of l.cells)n(s.blocks,o??{tableBlockId:i.id,rowIndex:a})}):i.kind==="textBox"&&n(i.content,o)};return n(t),e}function Ga(t,e){let n=new Map;if(e.length===0)return n;let r=(o,i)=>{let l=n.get(o)??[];l.includes(i)||l.push(i),n.set(o,l)};for(let o of e){let i=!1;for(let l of t){for(let a of l.fragments){let s=!1;if(o.tableBlockId!=null&&o.rowIndex!=null)s=a.kind==="table"&&a.blockId===o.tableBlockId&&o.rowIndex>=a.fromRow&&o.rowIndex<a.toRow;else{let c=a.pmStart??-1,d=a.pmEnd??-1;s=c>=0&&d>=0&&o.pmPos>=c&&o.pmPos<d}if(s){r(l.number,o.footnoteId),i=!0;break}}if(i)break}}return n}function P_(t,e){if(t.length===0)return[{kind:"paragraph",id:`fn-empty-${e}`,runs:[{kind:"text",text:`${e} `,fontSize:du,superscript:!0}]}];let n=t.map(o=>{if(o.kind!=="paragraph")return o;let i=o;return{...i,runs:i.runs.map(l=>(l.kind==="text"||l.kind==="tab")&&l.fontSize==null?{...l,fontSize:du}:l)}}),r=n[0];if(r.kind==="paragraph"){let o=r,i=o.runs.find(a=>a.kind==="text"),l={kind:"text",text:`${e} `,fontSize:du,superscript:!0,...i?.fontFamily?{fontFamily:i.fontFamily}:{}};n[0]={...o,runs:[l,...o.runs]}}return n}function E_(t,e,n,r){let o=Az(t.content,{styles:r.styles??void 0,theme:r.theme??null,defaultTabStopTwips:r.defaultTabStopTwips??null}),i=kp(o,{theme:r.theme??void 0}),l=P_(i,e),a=r.measureBlocks(l,n),s=a.reduce((c,d)=>d.kind==="paragraph"||d.kind==="table"?c+d.totalHeight:d.kind==="image"||d.kind==="textBox"?c+d.height:c,0);return{id:t.id,displayNumber:e,blocks:l,measures:a,height:s}}function F_(t,e,n,r){let o=new Map,i=new Map;for(let s of t)(s.noteType==="normal"||s.noteType==null)&&i.set(s.id,s);let l=1,a=new Set;for(let s of e){if(a.has(s.footnoteId))continue;a.add(s.footnoteId);let c=i.get(s.footnoteId);c&&(o.set(s.footnoteId,E_(c,l,n,r)),l++)}return o}function dh(t,e){let n=Math.max(1,Math.floor(e));if(n<=1||t.length<=1)return[t];let r=t.reduce((l,a)=>l+a.height,0)/n,o=[[]],i=0;for(let l of t)o.length<n&&i>0&&i+l.height/2>r&&(o.push([]),i=0),o[o.length-1].push(l),i+=l.height;return o}function uu(t,e,n=1){let r=new Map;for(let[o,i]of t){let l=i.map(s=>e.get(s)?.height??0).filter(s=>s>0).map(s=>({height:s}));if(l.length===0)continue;let a=dh(l,n).reduce((s,c)=>Math.max(s,c.reduce((d,u)=>d+u.height,0)),0);a>0&&r.set(o,a+oc)}return r}function A_(t){let{blocks:e,measures:n,layoutOpts:r,footnoteRefs:o,footnoteContentMap:i,initialLayout:l}=t,a=Math.max(1,t.footnoteColumns??1),s=Ga(l.pages,o),c=uu(s,i,a);if(c.size===0)return{layout:l,pageFootnoteMap:s,converged:!0};let d=l,u=!1;for(let f=0;f<cu;f++){d=Tl(e,n,{...r,footnoteReservedHeights:c});let h=Ga(d.pages,o),p=uu(h,i,a);if(s=h,$_(c,p)){c=p,u=!0;break}c=p}if(!u){let f=c,h=!1;for(let p=0;p<cu;p++){d=Tl(e,n,{...r,footnoteReservedHeights:f}),s=Ga(d.pages,o);let m=uu(s,i,a);if(I_(f,m)){h=!0;break}f=M_(f,m)}h||(d=Tl(e,n,{...r,footnoteReservedHeights:f}),s=Ga(d.pages,o)),console.warn(`[docx-editor] footnote layout did not stabilize within ${cu} passes; settling with conservative page reservations. If footnotes appear misplaced, please file a bug with the document.`)}for(let[f,h]of s){let p=d.pages.find(m=>m.number===f);p&&(p.footnoteIds=h,a>1&&(p.footnoteColumns=a))}return{layout:d,pageFootnoteMap:s,converged:u}}function D_(t,e,n){let r=new Map;if(!n?.package?.footnotes)return r;let o=new Map;for(let i of n.package.footnotes)i.noteType&&i.noteType!=="normal"||o.set(i.id,i);for(let[i,l]of t){let a=[];for(let s of l){let c=o.get(s);if(!c)continue;let d=e.get(s),u=d?.displayNumber??0;a.push({displayNumber:String(u),text:OD(c),content:d})}a.length>0&&r.set(i,a)}return r}function N_(t,e,n,r){let o=r.createElement("div");o.className="layout-footnote-content",o.style.position="relative",o.style.width=`${e}px`,o.style.height=`${t.height}px`;let i=0;for(let l=0;l<t.blocks.length;l++){let a=t.blocks[l],s=t.measures[l];if(!(!a||!s)){if(a.kind==="paragraph"&&s.kind==="paragraph"){let c=a.attrs?.spacing?.before??0,d={blockId:a.id,width:e,height:s.totalHeight,pmStart:a.pmStart,pmEnd:a.pmEnd,fromLine:0,toLine:s.lines.length},u=ji(d,a,s,{...n,section:"body",contentWidth:e,positioning:"absolute"},{document:r});u.style.top=`${i+c}px`,u.style.left="0",u.style.width=`${e}px`,u.style.height=`${s.totalHeight}px`,o.appendChild(u),i+=s.totalHeight}else if(a.kind==="table"&&s.kind==="table"){let c={blockId:a.id,width:s.totalWidth,height:s.totalHeight,pmStart:a.pmStart,pmEnd:a.pmEnd,fromRow:0,toRow:s.rows.length},d=Zc(c,a,s,{...n,section:"body",contentWidth:e,positioning:"absolute"},{document:r});d.style.top=`${i}px`,d.style.left="0",o.appendChild(d),i+=s.totalHeight}else if(a.kind==="image"&&s.kind==="image"){let c={blockId:a.id,width:s.width,height:s.height,pmStart:a.pmStart,pmEnd:a.pmEnd},d=qc(c,a,s,{...n},{document:r});d.style.top=`${i}px`,d.style.left="0",o.appendChild(d),i+=s.height}else if(a.kind==="textBox"&&s.kind==="textBox"){let c={blockId:a.id,width:s.width,height:s.height,pmStart:a.pmStart,pmEnd:a.pmEnd},d=Kc(c,a,s,{...n,section:"body",contentWidth:e,positioning:"absolute"},{document:r});d.style.top=`${i}px`,d.style.left="0",o.appendChild(d),i+=s.height}}}return o}function L_(t,e){let n=e.createElement("div");n.style.fontSize="10px",n.style.lineHeight="1.3",n.style.marginBottom="4px",n.style.color="#000";let r=e.createElement("sup");r.textContent=t.displayNumber,r.style.fontSize="7px",r.style.marginRight="2px",n.appendChild(r);let o=e.createTextNode(" "+t.text);return n.appendChild(o),n}function B_(t,e=1){let n=t.filter(o=>o.content).map(o=>({height:o.content.height}));if(n.length===0)return oc;let r=dh(n,e).reduce((o,i)=>Math.max(o,i.reduce((l,a)=>l+a.height,0)),0);return oc+r}function O_(t,e,n,r,o=1){let i=r.createElement("div");i.className="layout-footnote-area",i.style.width=`${e}px`;let l=r.createElement("div"),a=.5,s=(oc-a)/2;l.style.width="33%",l.style.height=`${a}px`,l.style.backgroundColor="#000",l.style.marginBottom=`${s}px`,l.style.marginTop=`${s}px`,i.appendChild(l);let c=(p,m)=>p.content?N_(p.content,m,n,r):L_(p,r),d=Math.max(1,Math.floor(o));if(d<=1){for(let p of t)i.appendChild(c(p,e));return i}let u=Math.max(1,(e-(d-1)*Mf)/d),f=dh(t.map(p=>({fn:p,height:p.content?.height??0})),d),h=r.createElement("div");h.className="layout-footnote-columns",h.style.display="flex",h.style.alignItems="flex-start",h.style.gap=`${Mf}px`;for(let p of f){let m=r.createElement("div");m.className="layout-footnote-column",m.style.flex=`0 0 ${u}px`,m.style.width=`${u}px`;for(let{fn:y}of p)m.appendChild(c(y,u));h.appendChild(m)}return i.appendChild(h),i}function uh(t,e,n){let r={pageNumber:t.number,totalPages:e,section:"body",resolvedCommentIds:n.resolvedCommentIds},o={...n};if(n.titlePg&&t.number===1&&(o.headerContent=n.firstPageHeaderContent,o.footerContent=n.firstPageFooterContent),n.footnotesByPage){let i=n.footnotesByPage.get(t.number);i&&i.length>0&&(o.footnoteArea=i)}return{context:r,pageOptions:o}}function sy(t){let e=[];e.push(`s:${t.size.w},${t.size.h}`),e.push(`m:${t.margins.top},${t.margins.right},${t.margins.bottom},${t.margins.left}`),e.push(`n:${t.number}`),t.footnoteReservedHeight&&e.push(`fn:${t.footnoteReservedHeight}`);for(let n of t.fragments){let r=`${n.kind}:${n.blockId},${n.x},${n.y},${n.width},${n.height}`;n.pmStart!==void 0&&(r+=`,ps:${n.pmStart}`),n.pmEnd!==void 0&&(r+=`,pe:${n.pmEnd}`),n.kind==="paragraph"?r+=`,fl:${n.fromLine},tl:${n.toLine}`:n.kind==="table"&&(r+=`,fr:${n.fromRow},tr:${n.toRow}`),e.push(r)}return e.join("|")}function j_(t){let e=[];return t.headerContent&&e.push(`hdr:${t.headerContent.blocks.length},${t.headerContent.height},${t.headerContent.visualTop??0},${t.headerContent.visualBottom??t.headerContent.height}`),t.footerContent&&e.push(`ftr:${t.footerContent.blocks.length},${t.footerContent.height},${t.footerContent.visualTop??0},${t.footerContent.visualBottom??t.footerContent.height}`),t.firstPageHeaderContent&&e.push(`fp-hdr:${t.firstPageHeaderContent.blocks.length},${t.firstPageHeaderContent.height}`),t.firstPageFooterContent&&e.push(`fp-ftr:${t.firstPageFooterContent.blocks.length},${t.firstPageFooterContent.height}`),t.titlePg&&e.push("titlePg"),t.theme&&e.push(`thm:${t.theme.name??"default"}`),t.pageBorders&&e.push(`pb:${JSON.stringify(t.pageBorders)}`),t.headerDistance!==void 0&&e.push(`hd:${t.headerDistance}`),t.footerDistance!==void 0&&e.push(`fd:${t.footerDistance}`),e.join("|")}function z_(t,e){t.style.display="flex",t.style.flexDirection="column",t.style.alignItems="center",t.style.gap=`${e}px`,t.style.padding=`${e}px`,t.style.backgroundColor="var(--doc-bg, #f8f9fa)"}var Ya=2,H_=8;function __(t,e,n={}){let r=t.length,o=n.pageGap??24,i=e,l=i.__pageRenderState,a=j_(n),s=r>=H_;if(l&&l.optionsHash===a&&s){let m=l.pageStates,y=l.pageDataMap,w=i.__pageObserver,C=[];for(let k of t)C.push(sy(k));let g=l.totalPages!==r,v=Math.min(m.length,t.length);for(let k=0;k<v;k++){let x=m[k],T=C[k];if(x.fingerprint===T&&!g){let I=y.get(x.element);I&&(I.page=t[k]);continue}let $=x.element,M=y.get($);M&&(M.page=t[k],M.rendered&&W_($,y,r,n)),x.fingerprint=T,Cs($,t[k].size.w,t[k].size.h,n),$.dataset.pageNumber=String(t[k].number)}if(t.length>m.length){let k=n.document??document;for(let x=m.length;x<t.length;x++){let T=t[x],$=k.createElement("div");$.className=n.pageClassName??er.page,$.dataset.pageNumber=String(T.number),$.dataset.pageIndex=String(x),Cs($,T.size.w,T.size.h,n),e.appendChild($),m.push({element:$,fingerprint:C[x]}),y.set($,{page:T,index:x,rendered:!1}),w&&w.observe($)}}if(t.length<m.length){for(let k=m.length-1;k>=t.length;k--){let x=m[k].element;w&&w.unobserve(x),y.delete(x),e.removeChild(x)}m.length=t.length}for(let k=0;k<m.length;k++){let x=y.get(m[k].element);x&&(x.index=k)}return l.totalPages=r,l.currentOptions=n,"incremental"}let c=i.__pageObserver;c&&(c.disconnect(),i.__pageObserver=void 0),e.innerHTML="",i.__pageRenderState=void 0,z_(e,o);let d=[],u=[];for(let m=0;m<t.length;m++){let y=t[m];if(u.push(sy(y)),s){let w=(n.document??document).createElement("div");w.className=n.pageClassName??er.page,w.dataset.pageNumber=String(y.number),w.dataset.pageIndex=String(m),Cs(w,y.size.w,y.size.h,n),e.appendChild(w),d.push(w)}else{let{context:w,pageOptions:C}=uh(y,r,n),g=fh(y,w,C);e.appendChild(g),d.push(g)}}if(!s)return"full";let f=new Map;for(let m=0;m<t.length;m++)f.set(d[m],{page:t[m],index:m,rendered:!1});let h=new IntersectionObserver(m=>{let y=i.__pageRenderState;if(!y)return;let{currentOptions:w,totalPages:C,pageDataMap:g}=y;for(let T of m){let $=T.target,M=g.get($);if(M&&T.isIntersecting){Ml($,g,C,w);for(let I=-Ya;I<=Ya;I++){let F=M.index+I;F>=0&&F<y.pageStates.length&&F!==M.index&&Ml(y.pageStates[F].element,g,C,w)}}}let v=window.innerHeight,k=v*3,x=new Set;for(let[T,$]of g){if(!$.rendered)continue;let M=T.getBoundingClientRect();M.bottom>-k&&M.top<v+k&&x.add($.index)}for(let[T,$]of g){if(!$.rendered)continue;let M=!1;for(let I of x)if(Math.abs($.index-I)<=Ya+1){M=!0;break}!M&&x.size>0&&V_(T,g)}},{root:null,rootMargin:"1500px 0px 1500px 0px"});for(let m of d)h.observe(m);i.__pageObserver=h,i.__pageRenderState={pageStates:d.map((m,y)=>({element:m,fingerprint:u[y]})),totalPages:r,optionsHash:a,pageDataMap:f,currentOptions:n};let p=Math.min(t.length,Ya+3);for(let m=0;m<p;m++)Ml(d[m],f,r,n);return"full"}function Ml(t,e,n,r){let o=e.get(t);if(!o||o.rendered)return;let{context:i,pageOptions:l}=uh(o.page,n,r),a=fh(o.page,i,l);for(;a.firstChild;)t.appendChild(a.firstChild);o.rendered=!0}function W_(t,e,n,r){let o=e.get(t);if(!o)return;let{context:i,pageOptions:l}=uh(o.page,n,r),a=fh(o.page,i,l).querySelector(`.${er.content}`),s=t.querySelector(`.${er.content}`);a&&s?t.replaceChild(a,s):(t.innerHTML="",o.rendered=!1,Ml(t,e,n,r))}function V_(t,e){let n=e.get(t);!n||!n.rendered||(t.innerHTML="",n.rendered=!1)}function q_(t){let e=t.__pageRenderState;if(!e)return 0;let{pageStates:n,totalPages:r,currentOptions:o,pageDataMap:i}=e,l=0;for(let{element:a}of n){let s=i.get(a);!s||s.rendered||(Ml(a,i,r,o),l++)}return l}var er={page:"layout-page",content:"layout-page-content",header:"layout-page-header",footer:"layout-page-footer"};function Cs(t,e,n,r){t.style.position="relative",t.style.width=`${e}px`,t.style.height=`${n}px`,t.style.backgroundColor=r.backgroundColor??"var(--doc-page-bg, #ffffff)",t.style.overflow="hidden",t.style.fontFamily=$r("Calibri").cssFallback,t.style.fontSize=`${1056/72}px`,t.style.color="var(--doc-page-text, #000000)",r.showBorders&&(t.style.border="1px solid #ccc"),r.showShadow&&(t.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)")}function Z_(t,e){switch(e??"allPages"){case"firstPage":return t===1;case"notFirstPage":return t!==1;default:return!0}}function Ja(t){return t?.space!==void 0?Zb(t.space):0}function Qa(t,e,n,r){if(!e||e.style==="none"||e.style==="nil")return;let o=al(e,n,r);for(let[a,s]of Object.entries(o))t.style[a]=String(s);let i=`border${n}Style`,l=`border${n}Width`;if(t.style[i]==="double"){let a=parseFloat(t.style[l]);(!Number.isFinite(a)||a<3)&&(t.style[l]="3px")}}function K_(t,e,n){let r=e.pageBorders;if(!r||!Z_(t.number,r.display)||![r.top,r.bottom,r.left,r.right].some(d=>d&&d.style!=="none"&&d.style!=="nil"))return null;let o=r.offsetFrom??"text",i=Ja(r.top),l=Ja(r.right),a=Ja(r.bottom),s=Ja(r.left),c=n.createElement("div");return c.className="layout-page-border",c.style.position="absolute",c.style.pointerEvents="none",c.style.boxSizing="border-box",c.style.zIndex=r.zOrder==="back"?"0":"20",o==="page"?(c.style.top=`${i}px`,c.style.right=`${l}px`,c.style.bottom=`${a}px`,c.style.left=`${s}px`):(c.style.top=`${Math.max(0,t.margins.top-i)}px`,c.style.right=`${Math.max(0,t.margins.right-l)}px`,c.style.bottom=`${Math.max(0,t.margins.bottom-a)}px`,c.style.left=`${Math.max(0,t.margins.left-s)}px`),Qa(c,r.top,"Top",e.theme),Qa(c,r.bottom,"Bottom",e.theme),Qa(c,r.left,"Left",e.theme),Qa(c,r.right,"Right",e.theme),c}function U_(t,e){let n=e.margins;t.style.position="absolute",t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,t.style.right=`${n.right}px`,t.style.bottom=`${n.bottom}px`,t.style.overflow="visible"}function X_(t,e,n){t.style.position="absolute",t.style.left=`${e.x-n.left}px`;let r=e.y-n.top;t.style.top=`${e.kind==="table"?Math.round(r):r}px`,t.style.width=`${e.width}px`,"height"in e&&e.kind!=="table"&&(t.style.height=`${e.height}px`)}function G_(t,e,n,r){let o=[];for(let i of t.runs){if(i.kind!=="image")continue;let l=i;if(!Di(l))continue;let a=l.distTop??0,s=l.distBottom??0,c=l.distLeft??12,d=l.distRight??12,{x:u,y:f,side:h}=Ok(l,e,n,r);o.push({src:l.src,width:l.width,height:l.height,alt:l.alt,transform:l.transform,side:h,x:u,y:f,distTop:a,distBottom:s,distLeft:c,distRight:d,pmStart:l.pmStart,pmEnd:l.pmEnd,wrapText:Lk(l.cssFloat),wrapType:l.wrapType,cropTop:l.cropTop,cropRight:l.cropRight,cropBottom:l.cropBottom,cropLeft:l.cropLeft,opacity:l.opacity})}return o}function fh(t,e,n={}){let r=n.document??document,o=r.createElement("div");if(o.className=n.pageClassName??er.page,o.dataset.pageNumber=String(t.number),Cs(o,t.size.w,t.size.h,n),n.watermark){let g=k_(n.watermark,t,r);g&&o.appendChild(g)}let i=K_(t,n,r);i&&n.pageBorders?.zOrder==="back"&&o.appendChild(i);let l=r.createElement("div");l.className=er.content,U_(l,t);let a=Bk(t),s=a.contentWidth,c=[],d=[];for(let g of t.fragments)if(g.kind==="paragraph"&&n.blockLookup){let v=n.blockLookup.get(String(g.blockId));if(v?.block.kind==="paragraph"){let k=v.block,x=g.y-t.margins.top,T=G_(k,x,s,a);c.push(...T)}}for(let g of c)Nk(g)&&d.push({side:g.side,x:g.x,y:g.y,width:g.width,height:g.height,distTop:g.distTop,distBottom:g.distBottom,distLeft:g.distLeft,distRight:g.distRight,wrapText:g.wrapText,wrapType:g.wrapType});if(n.blockLookup)for(let g of t.fragments){if(g.kind!=="table")continue;let v=n.blockLookup.get(String(g.blockId));if(v?.block.kind!=="table")continue;let k=v.block.floating;if(!k)continue;let x=g.x-t.margins.left,T=g.y-t.margins.top,$=k.topFromText??0,M=k.bottomFromText??0,I=k.leftFromText??12,F=k.rightFromText??12,E=x<s/2?"left":"right";d.push({side:E,x,y:T,width:g.width,height:g.height,distTop:$,distBottom:M,distLeft:I,distRight:F})}if(n.blockLookup)for(let g of t.fragments){if(g.kind!=="textBox")continue;let v=n.blockLookup.get(String(g.blockId));if(v?.block.kind!=="textBox")continue;let k=v.block;if(!oa(k))continue;let x=g.y-t.margins.top,T=Ok({width:g.width,height:g.height,position:k.position,cssFloat:k.cssFloat},x,s,a);g.x=t.margins.left+T.x,g.y=t.margins.top+T.y,!(!fN(k)&&!pN(k))&&d.push({side:T.side,x:T.x,y:T.y,width:g.width,height:g.height,distTop:k.distTop??0,distBottom:k.distBottom??0,distLeft:k.distLeft??12,distRight:k.distRight??12,wrapText:k.wrapText,wrapType:k.wrapType})}let u=d.length>0?AN(d,s):[],f=c.filter(tc),h=c.filter(g=>!tc(g));if(f.length>0){let g=rc(f,r,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"behind"});l.appendChild(g)}let p=g=>{if(g.kind!=="paragraph"||!n.blockLookup||!g.blockId)return;let v=n.blockLookup.get(String(g.blockId));if(v?.block.kind==="paragraph")return v.block.attrs?.borders},m,y=new Map,w=g=>!n.blockLookup||!g.blockId?[]:n.blockLookup.get(String(g.blockId))?.block.sdtGroups??[],C=(g,v)=>{if(v.length===0)return;let k=v[v.length-1];g.classList.add("layout-block-sdt"),g.dataset.sdtGroupId=k.id,g.dataset.sdtType=k.sdtType,g.dataset.sdtDepth=String(v.length),k.tag!=null&&(g.dataset.sdtTag=k.tag),k.alias!=null&&(g.dataset.sdtAlias=k.alias),k.lock!=null&&(g.dataset.sdtLock=k.lock)};for(let g=0;g<t.fragments.length;g++){let v=t.fragments[g],k,x={...e,section:"body",contentWidth:s},T=v.y-t.margins.top;if(n.blockLookup&&v.blockId){let $=n.blockLookup.get(String(v.blockId));if(v.kind==="paragraph"&&$?.block.kind==="paragraph"&&$?.measure.kind==="paragraph"){let M=$.block,I=g+1<t.fragments.length?p(t.fragments[g+1]):void 0,F=String(v.blockId),E=y.get(F);E||(E=new Set,y.set(F,E));let R=$.measure;u.length>0&&(R=_s(M,s,{floatingZones:u,paragraphYOffset:T})),k=ji(v,M,R,x,{document:r,prevBorders:m,nextBorders:I,renderedInlineImageKeys:E}),m=M.attrs?.borders}else v.kind==="table"&&$?.block.kind==="table"&&$?.measure.kind==="table"?(k=Zc(v,$.block,$.measure,x,{document:r}),m=void 0):v.kind==="image"&&$?.block.kind==="image"&&$?.measure.kind==="image"?(k=qc(v,$.block,$.measure,x,{document:r}),m=void 0):v.kind==="textBox"&&$?.block.kind==="textBox"&&$?.measure.kind==="textBox"?(k=Kc(v,$.block,$.measure,x,{document:r}),m=void 0):(k=kf(v,x,{document:r}),m=void 0)}else k=kf(v,x,{document:r}),m=void 0;X_(k,v,{left:t.margins.left,top:t.margins.top}),C(k,w(v)),l.appendChild(k)}if(AH(t,l,s,w,r),h.length>0){let g=rc(h,r,{layerClass:"layout-floating-images-layer",itemClass:"layout-page-floating-image",sizing:"inset0",layerMode:"front"});l.appendChild(g)}if(t.columns&&t.columns.separator&&t.columns.count>1){let g=t.columns.count,v=t.columns.gap,k=(s-(g-1)*v)/g,x=t.size.h-t.margins.top-t.margins.bottom;for(let T=0;T<g-1;T++){let $=(T+1)*k+T*v+v/2,M=r.createElement("div");M.style.position="absolute",M.style.left=`${$}px`,M.style.top="0",M.style.height=`${x}px`,M.style.width="0.5px",M.style.backgroundColor="#000",M.style.pointerEvents="none",l.appendChild(M)}}if(n.footnoteArea&&n.footnoteArea.length>0){let g=t.footnoteColumns??1,v=O_(n.footnoteArea,s,e,r,g);v.style.position="absolute";let k=Math.max(t.footnoteReservedHeight??0,B_(n.footnoteArea,g)),x=t.size.h-t.margins.bottom-t.margins.top;v.style.top=`${Math.max(-t.margins.top,x-k)}px`,v.style.left="0",v.style.right="0",l.appendChild(v)}o.appendChild(l);{let g=n.headerDistance??t.margins.header??48,v=t.size.w-t.margins.left-t.margins.right,k=Math.max(t.margins.top-g,48),x=n.headerContent?.visualTop??0,T=n.headerContent?.visualBottom??n.headerContent?.height??0,$=n.headerContent?.flowHeight??n.headerContent?.height??0,M=Math.max($-Math.min(0,x),24),I=T>k,F=r.createElement("div");F.className=er.header,F.style.position="absolute",F.style.top=`${g+x}px`,F.style.left=`${t.margins.left}px`,F.style.right=`${t.margins.right}px`,F.style.width=`${v}px`,F.style.height=`${M}px`,F.style.minHeight=`${M}px`;let E=!I;if(n.headerContent&&n.headerContent.blocks.length>0){let R={flowTop:g,flowLeft:t.margins.left,contentWidth:v,pageWidth:t.size.w,pageHeight:t.size.h,margins:t.margins},N=ay(n.headerContent,{...e,section:"header",contentWidth:v},n,R);N.style.top=`${-x}px`,N.querySelector("img")&&(E=!1),F.appendChild(N)}E&&(F.style.maxHeight=`${k}px`,F.style.overflow="hidden"),o.appendChild(F)}{let g=n.footerDistance??t.margins.footer??48,v=t.size.w-t.margins.left-t.margins.right,k=Math.max(t.margins.bottom-g,48),x=n.footerContent?.visualTop??0,T=n.footerContent?.visualBottom??n.footerContent?.height??0,$=Math.max(T-x,24),M=$>k,I=n.footerContent?.flowHeight??n.footerContent?.height??0,F=Math.max(I-Math.min(0,x),24),E=r.createElement("div");E.className=er.footer,E.style.position="absolute",E.style.top=`${t.size.h-g-F}px`,E.style.left=`${t.margins.left}px`,E.style.right=`${t.margins.right}px`,E.style.width=`${v}px`,E.style.height=`${F}px`,E.style.minHeight=`${F}px`;let R=!M;if(n.footerContent&&n.footerContent.blocks.length>0){let N={flowTop:t.size.h-g-(n.footerContent?.height??0),flowLeft:t.margins.left,contentWidth:v,pageWidth:t.size.w,pageHeight:t.size.h,margins:t.margins},B=ay(n.footerContent,{...e,section:"footer",contentWidth:v},n,N);B.style.top=`${-x-($-F)}px`,B.querySelector("img")&&(R=!1),E.appendChild(B)}R&&(E.style.maxHeight=`${k}px`,E.style.overflow="hidden"),o.appendChild(E)}return i&&n.pageBorders?.zOrder!=="back"&&o.appendChild(i),o}var Y_=30,J_=200,Q_=24,e7=10,t7=10,n7=24;function r7(t){let{mouseX:e,mouseY:n,pagesContainer:r,target:o,hfEditMode:i,edgeProximity:l=Y_}=t,a=`.${Rn.table}`,s=`.${Rn.row}`,c=`.${Rn.cell}`,d=`.${er.header}`,u=`.${er.footer}`,f=g=>{let v=!!g.closest(d),k=!!g.closest(u);return!v&&!k?!i:v?i==="header":i==="footer"},h=o.closest(a);if(h&&!f(h)&&(h=null),!h){let g=r.querySelectorAll(a);for(let v of Array.from(g)){if(!f(v))continue;let k=v.getBoundingClientRect(),x=e>=k.left-l&&e<k.left,T=n>=k.top-l&&n<k.top,$=e>=k.left-l&&e<=k.right,M=n>=k.top-l&&n<=k.bottom;if(x&&M||T&&$){h=v;break}}}if(!h)return null;let p=h.getBoundingClientRect(),m=e<p.left+l&&e>=p.left-l,y=n<p.top+l&&n>=p.top-l;if(!m&&!y)return null;let w=h.querySelectorAll(`:scope > ${s}`);if(w.length===0)return null;let C=g=>g&&Number(g.dataset.pmStart)||0;if(m)for(let g=0;g<w.length;g++){let v=w[g].getBoundingClientRect();if(n>=v.top&&n<=v.bottom){let k=w[g].querySelector(c),x=C(k);if(!x)break;return{type:"row",clientX:p.left-Q_,clientY:v.top+v.height/2-e7,cellPmPos:x}}}if(y){let g=w[0].querySelectorAll(`:scope > ${c}`);for(let v=0;v<g.length;v++){let k=g[v].getBoundingClientRect();if(e>=k.left&&e<=k.right){let x=C(g[v]);if(!x)break;return{type:"column",clientX:k.left+k.width/2-t7,clientY:p.top-n7,cellPmPos:x}}}}return null}var Uc=".layout-page-content";function Xc(t){return Array.from(t.querySelectorAll(`${Uc} span[data-pm-start][data-pm-end]`))}function o7(t){return Array.from(t.querySelectorAll(`${Uc} .layout-empty-run`))}function Yk(t){return Array.from(t.querySelectorAll(`${Uc} [data-pm-start]`))}function Gc(t,e){return Number.isFinite(e)?t.querySelector(`${Uc} [data-pm-start="${e}"]`):null}function i7(t,e,n,r=1){let o=document.elementsFromPoint(e,n),i=o.find(d=>d.classList.contains("layout-page"));if(!i)return null;let l=o.find(d=>d.tagName==="SPAN"&&d.dataset.pmStart!==void 0&&d.dataset.pmEnd!==void 0);if(l)return ph(l,e);let a=o.find(d=>d.classList.contains("layout-empty-run"));if(a){let d=a.closest(".layout-paragraph");if(d&&d.dataset.pmStart)return Number(d.dataset.pmStart)}let s=o.find(d=>d.classList.contains("layout-paragraph")&&d.dataset.pmStart!==void 0);if(s&&s.dataset.pmStart){let d=cy(s,e,n);return d!==null?d:Number(s.dataset.pmStart)}let c=o.find(d=>d.classList.contains("layout-table-cell"));return c?cy(c,e,n):l7(t,i,e,n)}function ph(t,e,n){let r=Number(t.dataset.pmStart),o=Number(t.dataset.pmEnd);if(t.classList.contains("layout-run-tab")){let u=t.getBoundingClientRect(),f=(u.left+u.right)/2;return e<f?r:o}let i=t.firstChild;if(!i||i.nodeType!==Node.TEXT_NODE)return r;let l=i,a=l.length;if(a===0)return r;let s=t.ownerDocument;if(!s)return r;let c=0,d=a;for(;c<d;){let u=Math.floor((c+d)/2),f=s.createRange();f.setStart(l,u),f.setEnd(l,u);let h=f.getBoundingClientRect().left;e<h?d=u:c=u+1}if(c>0&&c<=a){let u=s.createRange();u.setStart(l,c-1),u.setEnd(l,c-1);let f=u.getBoundingClientRect();u.setStart(l,Math.min(c,a)),u.setEnd(l,Math.min(c,a));let h=u.getBoundingClientRect(),p=Math.abs(e-f.left),m=Math.abs(e-h.left);if(p<m)return r+(c-1)}return r+Math.min(c,o-r)}function cy(t,e,n){let r=t.querySelector(".layout-empty-run");if(r){let u=r.closest(".layout-paragraph");if(u&&u.dataset.pmStart)return Number(u.dataset.pmStart)}let o=t.querySelectorAll(".layout-line"),i=null,l=1/0;for(let u of Array.from(o)){let f=u,h=f.getBoundingClientRect(),p=(h.top+h.bottom)/2,m=Math.abs(n-p);m<l&&(l=m,i=f)}if(!i){let u=t.querySelector(".layout-paragraph[data-pm-start]");return u?.dataset.pmStart?Number(u.dataset.pmStart):t.dataset.pmStart?Number(t.dataset.pmStart):null}let a=i.querySelectorAll("span[data-pm-start][data-pm-end]");if(a.length===0){let u=i.closest(".layout-paragraph");return u?.dataset.pmStart?Number(u.dataset.pmStart):null}let s=null,c=1/0;for(let u of Array.from(a)){let f=u,h=f.getBoundingClientRect();if(e>=h.left&&e<=h.right)return ph(f,e);let p=e<h.left?h.left-e:e-h.right;p<c&&(c=p,s=f)}if(!s)return null;let d=s.getBoundingClientRect();return e<d.left?Number(s.dataset.pmStart):Number(s.dataset.pmEnd)}function l7(t,e,n,r,o){if(e.querySelectorAll("span[data-pm-start][data-pm-end]").length===0){let f=e.querySelectorAll(".layout-paragraph");if(f.length>0){let h=f[0];return Number(h.dataset.pmStart)||0}return null}let i=e.querySelectorAll(".layout-line"),l=null,a=1/0;for(let f of Array.from(i)){let h=f,p=h.getBoundingClientRect(),m=(p.top+p.bottom)/2,y=Math.abs(r-m);y<a&&(a=y,l=h)}if(!l)return null;let s=l.querySelectorAll("span[data-pm-start][data-pm-end]");if(s.length===0){let f=l.closest(".layout-paragraph");return f?.dataset.pmStart?Number(f.dataset.pmStart):null}let c=null,d=1/0;for(let f of Array.from(s)){let h=f,p=h.getBoundingClientRect();if(n>=p.left&&n<=p.right)return ph(h,n);let m=n<p.left?p.left-n:n-p.right;m<d&&(d=m,c=h)}if(!c)return null;let u=c.getBoundingClientRect();return n<u.left?Number(c.dataset.pmStart):Number(c.dataset.pmEnd)}var a7=.5;function Jk(t,e){let n=t.closest(".layout-table:not(.layout-nested-table)");if(!n)return{left:e.left,top:e.top,right:e.right,bottom:e.bottom};let r=n.getBoundingClientRect(),o=Math.max(e.top,r.top),i=Math.min(e.bottom,r.bottom);return i-o<=a7?null:{left:e.left,top:o,right:e.right,bottom:i}}var s7=4;function dy(t,e){let n=(t.closest(".layout-line")??t).getBoundingClientRect(),r=t.getBoundingClientRect().left,o=Jk(t,{left:r,top:n.top,right:r+s7,bottom:n.bottom});if(!o)return null;let i=t.closest(".layout-page");return{x:o.left-e.left,y:o.top-e.top,width:o.right-o.left,height:o.bottom-o.top,pageIndex:i?Number(i.dataset.pageNumber||1)-1:0}}function c7(t){let e=t.closest(".layout-paragraph");if(!e)return null;let n=Number(e.dataset.pmStart),r=Number(e.dataset.pmEnd);return!Number.isFinite(n)||!Number.isFinite(r)?null:{pmStart:n,pmEnd:r}}function d7(t,e,n,r){let o=[],i=Xc(t);for(let l of Array.from(i)){let a=l,s=Number(a.dataset.pmStart),c=Number(a.dataset.pmEnd);if(c<=e||s>=n)continue;let d=a.closest(".layout-page"),u=d?Number(d.dataset.pageNumber||1)-1:0,f=C=>{let g=Jk(a,C);g&&o.push({x:g.left-r.left,y:g.top-r.top,width:g.right-g.left,height:g.bottom-g.top,pageIndex:u})};if(s===c){let C=dy(a,r);C&&o.push(C);continue}if(a.classList.contains("layout-run-tab")){f(a.getBoundingClientRect());continue}let h=null;if(a.firstChild?.nodeType===Node.TEXT_NODE?h=a.firstChild:a.firstChild?.nodeType===Node.ELEMENT_NODE&&a.firstChild.tagName==="A"&&a.firstChild.firstChild?.nodeType===Node.TEXT_NODE&&(h=a.firstChild.firstChild),!h)continue;let p=a.ownerDocument;if(!p)continue;let m=Math.max(0,e-s),y=Math.min(h.length,n-s);if(m>=y)continue;let w=p.createRange();w.setStart(h,m),w.setEnd(h,y);for(let C of Array.from(w.getClientRects()))f(C)}for(let l of o7(t)){let a=c7(l);if(!a||a.pmEnd<=e||a.pmStart>=n)continue;let s=dy(l,r);s&&o.push(s)}return o}function uy(t,e){let n=t.closest(".layout-table:not(.layout-nested-table)");if(!n)return!1;let r=n.getBoundingClientRect(),o=(e.top+e.bottom)/2;return o<r.top-.5||o>r.bottom+.5}function fy(t,e,n,r,o){let i=t.closest(".layout-page"),l=i?Number(i.dataset.pageNumber||1)-1:0,a=t.closest(".layout-line"),s=a?a.offsetHeight:16,c=t.firstChild;if(t.classList.contains("layout-run-tab")||!c||c.nodeType!==Node.TEXT_NODE){let p=t.getBoundingClientRect();return{x:p.left-r.left,y:p.top-r.top,height:s,pageIndex:l}}let d=c,u=Math.min(e-n,d.length),f=t.ownerDocument.createRange();f.setStart(d,u),f.setEnd(d,u);let h=f.getBoundingClientRect();return{x:h.left-r.left,y:h.top-r.top,height:h.height?h.height/o:s,pageIndex:l}}function u7(t,e,n,r=1){let o=Xc(t),i=null,l=0;for(let c of Array.from(o)){let d=c,u=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(!(d.classList.contains("layout-run-tab")?e>=u&&e<f:e>=u&&e<=f))continue;let h=d.getBoundingClientRect();if(uy(d,h)){i||(i=d,l=u);continue}return fy(d,e,u,n,r)}if(i)return fy(i,e,l,n,r);let a=t.querySelectorAll(".layout-paragraph"),s=null;for(let c of Array.from(a)){let d=c,u=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(e>=u&&e<=f){let h=d.querySelector(".layout-empty-run")||d,p=h.getBoundingClientRect();if(uy(d,p)){s||(s={el:d,targetEl:h});continue}return py(d,h,n)}}return s?py(s.el,s.targetEl,n):null}function py(t,e,n){let r=e.getBoundingClientRect(),o=t.closest(".layout-page"),i=o?Number(o.dataset.pageNumber||1)-1:0,l=(e.closest(".layout-line")||e).offsetHeight||16;return{x:r.left-n.left,y:r.top-n.top,height:l,pageIndex:i}}function hh(t){let e=t.parentElement;for(;e&&e!==document.documentElement;){let{overflowY:n}=getComputedStyle(e);if((n==="auto"||n==="scroll")&&e.scrollHeight>e.clientHeight+1)return e;e=e.parentElement}return null}function Ss(t){return hh(t)??document.documentElement}var hy=40;function f7(t,e){if(e<t.top+40){let n=Math.max(0,t.top+40-e);return-Math.min(12,n/40*12)}if(e>t.bottom-40){let n=Math.max(0,e-(t.bottom-40));return Math.min(12,n/40*12)}return 0}var my={entries:[],commentToRevision:new Map};function xl(t){if(!t)return my;let{doc:e,schema:n}=t,r=n.marks.insertion,o=n.marks.deletion,i=n.marks.comment;if(!r&&!o)return my;let l=[],a=new Map,s=new Map;e.descendants((x,T)=>{if(x.type.name==="paragraph"){let I=x.attrs.pPrIns,F=x.attrs.pPrDel;I&&l.push({type:"paragraphMarkInsertion",text:x.textContent||"",author:I.author||"",date:I.date??void 0,from:T,to:T+x.nodeSize,revisionId:I.revisionId}),F&&l.push({type:"paragraphMarkDeletion",text:x.textContent||"",author:F.author||"",date:F.date??void 0,from:T,to:T+x.nodeSize,revisionId:F.revisionId});let E=x.attrs.pPrChange;if(Array.isArray(E))for(let R of E)l.push({type:"paragraphPropertiesChanged",text:x.textContent||"",author:R.info.author||"",date:R.info.date??void 0,from:T,to:T+x.nodeSize,revisionId:R.info.id})}if(x.type.name==="tableRow"){let I=x.attrs.trIns,F=x.attrs.trDel;I&&l.push({type:"rowInserted",text:x.textContent||"",author:I.author||"",date:I.date??void 0,from:T,to:T+x.nodeSize,revisionId:I.revisionId}),F&&l.push({type:"rowDeleted",text:x.textContent||"",author:F.author||"",date:F.date??void 0,from:T,to:T+x.nodeSize,revisionId:F.revisionId});let E=x.attrs.trPrChange;if(Array.isArray(E))for(let R of E)!R?.info||typeof R.info.id!="number"||l.push({type:"rowPropertiesChanged",text:x.textContent||"",author:R.info.author||"",date:R.info.date??void 0,from:T,to:T+x.nodeSize,revisionId:R.info.id})}if(x.type.name==="tableCell"||x.type.name==="tableHeader"){let I=x.attrs.cellMarker;if(I?.info&&typeof I.info.revisionId=="number"){let E={ins:"cellInserted",del:"cellDeleted",merge:"cellMerged"}[I.kind];E&&l.push({type:E,text:x.textContent||"",author:I.info.author||"",date:I.info.date??void 0,from:T,to:T+x.nodeSize,revisionId:I.info.revisionId})}let F=x.attrs.tcPrChange;if(Array.isArray(F))for(let E of F)!E?.info||typeof E.info.id!="number"||l.push({type:"cellPropertiesChanged",text:x.textContent||"",author:E.info.author||"",date:E.info.date??void 0,from:T,to:T+x.nodeSize,revisionId:E.info.id})}if(x.type.name==="table"){let I=x.attrs.tblPrChange;if(Array.isArray(I))for(let B of I)!B?.info||typeof B.info.id!="number"||l.push({type:"tablePropertiesChanged",text:"",author:B.info.author||"",date:B.info.date??void 0,from:T,to:T+x.nodeSize,revisionId:B.info.id});let F=x.firstChild,E=F?.attrs.trIns,R=F?.attrs.trDel,N=E?"trIns":R?"trDel":null;if(N){let B=E??R,j=!0,O=[];if(x.forEach(z=>{if(z.type.name!=="tableRow"){j=!1;return}let W=z.attrs[N];if(!W||(W.author??"")!==(B.author??"")||(W.date??null)!==(B.date??null)){j=!1;return}O.push(W.revisionId)}),j){let z="";o?x.descendants(Q=>{Q.isText&&!Q.marks.some(X=>X.type===o)&&(z+=Q.text||"")}):z=x.textContent||"";let W=B.revisionId,q=O.filter((Q,X)=>Q!==W&&O.indexOf(Q)===X);l.push({type:N==="trIns"?"tableInserted":"tableDeleted",text:z,author:B.author||"",date:B.date??void 0,from:T,to:T+x.nodeSize,revisionId:W,...q.length>0?{coalescedRevisionIds:q}:{}})}}}if(!x.isInline)return;let $=x.isText?x.text||"":x.type.name==="image"?x.attrs.alt||"image":x.type.name,M=null;for(let I of x.marks)(I.type===r||I.type===o)&&(l.push({type:I.type===r?"insertion":"deletion",text:$,author:I.attrs.author||"",date:I.attrs.date,from:T,to:T+x.nodeSize,revisionId:I.attrs.revisionId}),M=I);if(i){let I=x.marks.find(F=>F.type===i);if(I){let F=I.attrs.commentId,E=s.get(F);E||(E={revisions:new Set,hasCleanText:!1},s.set(F,E)),M?E.revisions.add(M.attrs.revisionId):E.hasCleanText=!0}}});for(let[x,T]of s.entries())if(!T.hasCleanText&&T.revisions.size===1){let $=T.revisions.values().next().value;a.set(x,$)}let c={tableInserted:6,tableDeleted:6,tablePropertiesChanged:5,rowInserted:4,rowDeleted:4,rowPropertiesChanged:4,cellInserted:3,cellDeleted:3,cellMerged:3,cellPropertiesChanged:3,paragraphMarkInsertion:2,paragraphMarkDeletion:2,paragraphPropertiesChanged:2},d=x=>x in c,u=new Map,f=[],h=(x,T)=>{let $=new Set(x.coalescedRevisionIds??[]);for(let M of T.coalescedRevisionIds??[])$.add(M);return $.add(T.revisionId),$.delete(x.revisionId),[...$]};for(let x of l){if(!d(x.type)){f.push(x);continue}let T=`${x.author}|${x.date??""}`,$=u.get(T);if($===void 0){u.set(T,f.push(x)-1);continue}let M=f[$],I=c[x.type]??0,F=c[M.type]??0;I>F?f[$]={...x,coalescedRevisionIds:h(x,M)}:f[$]={...M,coalescedRevisionIds:h(M,x)}}let p=new Map,m=[];for(let x of f){if(!(x.type==="insertion"||x.type==="deletion")){m.push({...x});continue}let T=`${x.type}|${x.author}|${x.date??""}`,$=p.get(T);if($){let M=$.to===x.from?"":" ";if($.text+=M+x.text,$.to=x.to,x.revisionId!==$.revisionId){let I=new Set($.coalescedRevisionIds??[]);for(let F of x.coalescedRevisionIds??[])I.add(F);I.add(x.revisionId),I.delete($.revisionId),$.coalescedRevisionIds=I.size>0?[...I]:void 0}}else{let M={...x};p.set(T,M),m.push(M)}}let y=[];for(let x=0;x<m.length;x++){let T=m[x],$=m[x+1];T.type==="deletion"&&$&&$.type==="insertion"&&T.author===$.author&&T.date===$.date&&T.to===$.from?(y.push({type:"replacement",text:$.text,deletedText:T.text,author:T.author,date:T.date,from:T.from,to:$.to,revisionId:T.revisionId,insertionRevisionId:$.revisionId}),x++):y.push(T)}let w=new Map;for(let x of y)if(x.type==="insertion"||x.type==="deletion"||x.type==="replacement"){let T=`${x.author}|${x.date??""}`;w.has(T)||w.set(T,x)}for(let x of y){if(x.type!=="paragraphMarkInsertion"&&x.type!=="paragraphMarkDeletion")continue;let T=w.get(`${x.author}|${x.date??""}`);if(!T)continue;let $=new Set(T.coalescedRevisionIds??[]);for(let M of x.coalescedRevisionIds??[])$.add(M);$.add(x.revisionId),$.delete(T.revisionId),T.type==="replacement"&&T.insertionRevisionId!=null&&$.delete(T.insertionRevisionId),T.coalescedRevisionIds=$.size>0?[...$]:void 0}let C=new Set,g=new Map;for(let x of y){if(x.type!=="tableInserted"&&x.type!=="tableDeleted")continue;let T=`${x.author}|${x.date??""}`;x.text.trim().length>0||(C.add(x),g.has(T)||g.set(T,x))}for(let x of y){if(x.type!=="paragraphMarkInsertion"&&x.type!=="paragraphMarkDeletion")continue;let T=g.get(`${x.author}|${x.date??""}`);if(!T)continue;let $=new Set(T.coalescedRevisionIds??[]);for(let M of x.coalescedRevisionIds??[])$.add(M);$.add(x.revisionId),$.delete(T.revisionId),T.coalescedRevisionIds=$.size>0?[...$]:void 0}let v=y.filter(x=>x.type==="insertion"||x.type==="replacement"),k=new Set;for(let x of y){if(x.type!=="paragraphPropertiesChanged")continue;let T=v.find(M=>M.author===x.author&&M.from<x.to&&x.from<M.to);if(!T)continue;let $=new Set(h(T,x));T.type==="replacement"&&T.insertionRevisionId!=null&&$.delete(T.insertionRevisionId),T.coalescedRevisionIds=$.size>0?[...$]:void 0,k.add(x)}return{entries:y.filter(x=>{let T=`${x.author}|${x.date??""}`;return x.type==="tableInserted"||x.type==="tableDeleted"?C.has(x):x.type==="paragraphMarkInsertion"||x.type==="paragraphMarkDeletion"?!w.has(T)&&!g.has(T):x.type==="paragraphPropertiesChanged"?!k.has(x):x.type==="insertion"||x.type==="deletion"||x.type==="replacement"?!g.has(T):!0}),commentToRevision:a}}var Qk=class{constructor(e){Ze(this,"listeners",new Set),Ze(this,"snapshot"),Ze(this,"subscribe",n=>(this.listeners.add(n),()=>{this.listeners.delete(n)})),Ze(this,"getSnapshot",()=>this.snapshot),this.snapshot=e}setSnapshot(e){this.snapshot=e,this.notify()}notify(){for(let e of this.listeners)e()}};function p7(t,e){if(!t.package?.document?.content)return null;let n=0;for(let r of t.package.document.content)if(r.type==="table"){if(n===e)return r;n++}return null}function gy(t,e,n){if(!t.package?.document?.content)return t;let r=0,o=t.package.document.content.map(i=>{if(i.type==="table"){if(r===e)return r++,n;r++}return i});return{...t,package:{...t.package,document:{...t.package.document,content:o}}}}function h7(t,e){if(!t.package?.document?.content)return t;let n=0,r=t.package.document.content.filter(o=>{if(o.type==="table"){let i=n===e;return n++,!i}return!0});return{...t,package:{...t.package,document:{...t.package.document,content:r}}}}var m7=class extends Qk{constructor(){super({selectedCell:null})}selectCell(e){this.setSnapshot({selectedCell:e})}clearSelection(){this.setSnapshot({selectedCell:null})}isCellSelected(e,n,r){let{selectedCell:o}=this.getSnapshot();return o?o.tableIndex===e&&o.rowIndex===n&&o.columnIndex===r:!1}getSelectedCell(){return this.getSnapshot().selectedCell}};function mh(t,e){if(e<=0)return[];let n=Math.floor(t/e),r=t-n*e;return Array.from({length:e},()=>{let o=n+(r>0?1:0);return r=Math.max(0,r-1),Math.max(1,o)})}function ge(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function re(t){return t==null||!Number.isFinite(t)?"0":String(Math.round(t))}var zi='xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"',Hi='mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"';function gh(t,e){if(!t)return"";if(t.style==="none"||t.style==="nil")return`<w:${e} w:val="${t.style}"/>`;let n=[`w:val="${ge(t.style)}"`];return t.size!==void 0&&n.push(`w:sz="${re(t.size)}"`),t.space!==void 0&&n.push(`w:space="${re(t.space)}"`),t.color&&(t.color.auto?n.push('w:color="auto"'):t.color.rgb&&n.push(`w:color="${ge(t.color.rgb)}"`),t.color.themeColor&&n.push(`w:themeColor="${ge(t.color.themeColor)}"`),t.color.themeTint&&n.push(`w:themeTint="${ge(t.color.themeTint)}"`),t.color.themeShade&&n.push(`w:themeShade="${ge(t.color.themeShade)}"`)),t.shadow&&n.push('w:shadow="true"'),t.frame&&n.push('w:frame="true"'),`<w:${e} ${n.join(" ")}/>`}function g7(t){return`<w:headerReference ${[`w:type="${t.type}"`,`r:id="${t.rId}"`].join(" ")}/>`}function y7(t){return`<w:footerReference ${[`w:type="${t.type}"`,`r:id="${t.rId}"`].join(" ")}/>`}function b7(t){if(!t)return"";let e=[];return t.position&&e.push(`<w:pos w:val="${t.position}"/>`),t.numFmt&&e.push(`<w:numFmt w:val="${t.numFmt}"/>`),t.numStart!==void 0&&e.push(`<w:numStart w:val="${t.numStart}"/>`),t.numRestart&&e.push(`<w:numRestart w:val="${t.numRestart}"/>`),e.length===0?"":`<w:footnotePr>${e.join("")}</w:footnotePr>`}function w7(t){if(!t)return"";let e=[];return t.position&&e.push(`<w:pos w:val="${t.position}"/>`),t.numFmt&&e.push(`<w:numFmt w:val="${t.numFmt}"/>`),t.numStart!==void 0&&e.push(`<w:numStart w:val="${t.numStart}"/>`),t.numRestart&&e.push(`<w:numRestart w:val="${t.numRestart}"/>`),e.length===0?"":`<w:endnotePr>${e.join("")}</w:endnotePr>`}function x7(t){let e=[];return t.pageWidth!==void 0&&e.push(`w:w="${re(t.pageWidth)}"`),t.pageHeight!==void 0&&e.push(`w:h="${re(t.pageHeight)}"`),t.orientation==="landscape"&&e.push('w:orient="landscape"'),e.length===0?"":`<w:pgSz ${e.join(" ")}/>`}function v7(t){let e=[];return t.marginTop!==void 0&&e.push(`w:top="${re(t.marginTop)}"`),t.marginRight!==void 0&&e.push(`w:right="${re(t.marginRight)}"`),t.marginBottom!==void 0&&e.push(`w:bottom="${re(t.marginBottom)}"`),t.marginLeft!==void 0&&e.push(`w:left="${re(t.marginLeft)}"`),t.headerDistance!==void 0&&e.push(`w:header="${re(t.headerDistance)}"`),t.footerDistance!==void 0&&e.push(`w:footer="${re(t.footerDistance)}"`),t.gutter!==void 0&&e.push(`w:gutter="${re(t.gutter)}"`),e.length===0?"":`<w:pgMar ${e.join(" ")}/>`}function k7(t){if(!t.columnCount&&!t.columns?.length)return"";let e=[];t.columnCount!==void 0&&t.columnCount>1&&e.push(`w:num="${re(t.columnCount)}"`),t.columnSpace!==void 0&&e.push(`w:space="${re(t.columnSpace)}"`),t.equalWidth!==void 0&&e.push(`w:equalWidth="${t.equalWidth?"1":"0"}"`),t.separator&&e.push('w:sep="1"');let n="";return t.columns&&t.columns.length>0&&(n=t.columns.map(r=>{let o=[];return r.width!==void 0&&o.push(`w:w="${re(r.width)}"`),r.space!==void 0&&o.push(`w:space="${re(r.space)}"`),`<w:col ${o.join(" ")}/>`}).join("")),e.length===0&&!n?"":`<w:cols${e.length>0?" "+e.join(" "):""}>${n}</w:cols>`}function C7(t){if(!t.lineNumbers)return"";let e=t.lineNumbers,n=[];return e.countBy!==void 0&&n.push(`w:countBy="${re(e.countBy)}"`),e.start!==void 0&&n.push(`w:start="${re(e.start)}"`),e.distance!==void 0&&n.push(`w:distance="${re(e.distance)}"`),e.restart&&n.push(`w:restart="${e.restart}"`),n.length===0?"":`<w:lnNumType ${n.join(" ")}/>`}function S7(t){if(!t.pageBorders)return"";let e=t.pageBorders,n=[],r=[];e.display&&n.push(`w:display="${ge(e.display)}"`),e.offsetFrom&&n.push(`w:offsetFrom="${ge(e.offsetFrom)}"`),e.zOrder&&n.push(`w:zOrder="${ge(e.zOrder)}"`);for(let o of["top","left","bottom","right"]){let i=gh(e[o],o);i&&r.push(i)}return r.length===0?"":`<w:pgBorders${n.length>0?" "+n.join(" "):""}>${r.join("")}</w:pgBorders>`}function T7(t){if(!t.docGrid)return"";let e=t.docGrid,n=[];return e.type&&n.push(`w:type="${e.type}"`),e.linePitch!==void 0&&n.push(`w:linePitch="${e.linePitch}"`),e.charSpace!==void 0&&n.push(`w:charSpace="${e.charSpace}"`),n.length===0?"":`<w:docGrid ${n.join(" ")}/>`}function eC(t){if(!t)return"";let e=[];if(t.headerReferences)for(let d of t.headerReferences)e.push(g7(d));if(t.footerReferences)for(let d of t.footerReferences)e.push(y7(d));let n=b7(t.footnotePr);n&&e.push(n);let r=w7(t.endnotePr);r&&e.push(r),t.sectionStart&&e.push(`<w:type w:val="${t.sectionStart}"/>`);let o=x7(t);o&&e.push(o);let i=v7(t);if(i&&e.push(i),t.paperSrcFirst!==void 0||t.paperSrcOther!==void 0){let d=[];t.paperSrcFirst!==void 0&&d.push(`w:first="${t.paperSrcFirst}"`),t.paperSrcOther!==void 0&&d.push(`w:other="${t.paperSrcOther}"`),e.push(`<w:paperSrc ${d.join(" ")}/>`)}let l=S7(t);l&&e.push(l);let a=C7(t);a&&e.push(a);let s=k7(t);s&&e.push(s),t.footnoteColumns!==void 0&&t.footnoteColumns>1&&e.push(`<w15:footnoteColumns w:val="${re(t.footnoteColumns)}"/>`),t.verticalAlign&&e.push(`<w:vAlign w:val="${t.verticalAlign}"/>`),t.titlePg&&e.push("<w:titlePg/>"),t.bidi&&e.push("<w:bidi/>");let c=T7(t);return c&&e.push(c),t.evenAndOddHeaders&&e.push("<w:evenAndOddHeaders/>"),e.length===0?"":`<w:sectPr>${e.join("")}</w:sectPr>`}var $7=["top","left","bottom","right","between","bar"];function I7(t){if(!t)return"";let e=[];for(let n of $7){let r=gh(t[n],n);r&&e.push(r)}return e.length===0?"":`<w:pBdr>${e.join("")}</w:pBdr>`}function M7(t){if(!t)return"";let e=[];return t.pattern?e.push(`w:val="${t.pattern}"`):e.push('w:val="clear"'),t.color?.rgb?e.push(`w:color="${t.color.rgb}"`):t.color?.auto&&e.push('w:color="auto"'),t.fill?.rgb?e.push(`w:fill="${t.fill.rgb}"`):t.fill?.auto&&e.push('w:fill="auto"'),t.fill?.themeColor&&e.push(`w:themeFill="${t.fill.themeColor}"`),t.fill?.themeTint&&e.push(`w:themeFillTint="${t.fill.themeTint}"`),t.fill?.themeShade&&e.push(`w:themeFillShade="${t.fill.themeShade}"`),e.length===0?"":`<w:shd ${e.join(" ")}/>`}function R7(t){return!t||t.length===0?"":`<w:tabs>${t.map(e=>{let n=[`w:val="${e.alignment}"`,`w:pos="${re(e.position)}"`];return e.leader&&e.leader!=="none"&&n.push(`w:leader="${e.leader}"`),`<w:tab ${n.join(" ")}/>`}).join("")}</w:tabs>`}function P7(t){let e=[];return t.spaceBefore!==void 0&&e.push(`w:before="${re(t.spaceBefore)}"`),t.spaceAfter!==void 0&&e.push(`w:after="${re(t.spaceAfter)}"`),t.lineSpacing!==void 0&&e.push(`w:line="${re(t.lineSpacing)}"`),t.lineSpacingRule&&e.push(`w:lineRule="${t.lineSpacingRule}"`),t.beforeAutospacing&&e.push('w:beforeAutospacing="1"'),t.afterAutospacing&&e.push('w:afterAutospacing="1"'),e.length===0?"":`<w:spacing ${e.join(" ")}/>`}function tC(t){let e=[];return t.indentLeft!==void 0&&e.push(`w:left="${re(t.indentLeft)}"`),t.indentRight!==void 0&&e.push(`w:right="${re(t.indentRight)}"`),t.indentFirstLine!==void 0&&(t.hangingIndent?e.push(`w:hanging="${re(Math.abs(t.indentFirstLine))}"`):t.indentFirstLine!==0&&e.push(`w:firstLine="${re(t.indentFirstLine)}"`)),e.length===0?"":`<w:ind ${e.join(" ")}/>`}function E7(t){if(!t)return"";let e=[];return t.ilvl!==void 0&&e.push(`<w:ilvl w:val="${re(t.ilvl)}"/>`),t.numId!==void 0&&e.push(`<w:numId w:val="${re(t.numId)}"/>`),e.length===0?"":`<w:numPr>${e.join("")}</w:numPr>`}function F7(t){if(!t)return"";let e=[];return t.width!==void 0&&e.push(`w:w="${re(t.width)}"`),t.height!==void 0&&e.push(`w:h="${re(t.height)}"`),t.hAnchor&&e.push(`w:hAnchor="${t.hAnchor}"`),t.vAnchor&&e.push(`w:vAnchor="${t.vAnchor}"`),t.x!==void 0&&e.push(`w:x="${re(t.x)}"`),t.y!==void 0&&e.push(`w:y="${re(t.y)}"`),t.xAlign&&e.push(`w:xAlign="${t.xAlign}"`),t.yAlign&&e.push(`w:yAlign="${t.yAlign}"`),t.wrap&&e.push(`w:wrap="${t.wrap}"`),e.length===0?"":`<w:framePr ${e.join(" ")}/>`}function nC(t){let e=[`w:id="${t.id}"`,`w:name="${ge(t.name)}"`];return t.colFirst!==void 0&&e.push(`w:colFirst="${t.colFirst}"`),t.colLast!==void 0&&e.push(`w:colLast="${t.colLast}"`),`<w:bookmarkStart ${e.join(" ")}/>`}function rC(t){return`<w:bookmarkEnd w:id="${t.id}"/>`}function yh(t){let e=[];t.rId&&e.push(`r:id="${t.rId}"`),t.anchor&&e.push(`w:anchor="${ge(t.anchor)}"`),t.tooltip&&e.push(`w:tooltip="${ge(t.tooltip)}"`),t.target&&e.push(`w:tgtFrame="${ge(t.target)}"`),t.history===!1&&e.push('w:history="0"'),t.docLocation&&e.push(`w:docLocation="${ge(t.docLocation)}"`);let n=t.children.map(r=>r.type==="run"?Xo(r):r.type==="bookmarkStart"?nC(r):r.type==="bookmarkEnd"?rC(r):"").join("");return e.length===0&&!t.href?n:`<w:hyperlink${e.length>0?" "+e.join(" "):""}>${n}</w:hyperlink>`}function oC(t){let e=[],n=t.content.find(l=>l.type==="run"),r=n?.formatting?fa(n.formatting):"",o=['w:fldCharType="begin"'];t.fldLock&&o.push('w:fldLock="true"'),e.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`);let i=t.instruction.startsWith(" ")||t.instruction.endsWith(" ")||t.instruction.includes(" ")?' xml:space="preserve"':"";e.push(`<w:r>${r}<w:instrText${i}>${ge(t.instruction)}</w:instrText></w:r>`),e.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`);for(let l of t.content)l.type==="run"&&e.push(Xo(l));return e.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),e.join("")}function iC(t){let e=[],n=t.fieldResult?.[0]?.formatting??t.formatting,r=n?fa(n):"",o=['w:fldCharType="begin"'];if(t.fldLock&&o.push('w:fldLock="true"'),e.push(`<w:r>${r}<w:fldChar ${o.join(" ")}/></w:r>`),t.fieldCode.length>0)e.push(...t.fieldCode.map(i=>Xo(i)));else{let i=t.instruction.startsWith(" ")||t.instruction.endsWith(" ")||t.instruction.includes(" ")?' xml:space="preserve"':"";e.push(`<w:r>${r}<w:instrText${i}>${ge(t.instruction)}</w:instrText></w:r>`)}return e.push(`<w:r>${r}<w:fldChar w:fldCharType="separate"/></w:r>`),e.push(...t.fieldResult.map(i=>Xo(i))),e.push(`<w:r>${r}<w:fldChar w:fldCharType="end"/></w:r>`),e.join("")}function A7(t){let e=[];switch(t.alias&&e.push(`<w:alias w:val="${ge(t.alias)}"/>`),t.tag&&e.push(`<w:tag w:val="${ge(t.tag)}"/>`),t.id!=null&&e.push(`<w:id w:val="${t.id}"/>`),t.lock&&t.lock!=="unlocked"&&e.push(`<w:lock w:val="${t.lock}"/>`),t.placeholder&&e.push(`<w:placeholder><w:docPart w:val="${ge(t.placeholder)}"/></w:placeholder>`),t.showingPlaceholder&&e.push("<w:showingPlcHdr/>"),t.sdtType){case"plainText":e.push("<w:text/>");break;case"date":t.dateFormat?e.push(`<w:date><w:dateFormat w:val="${ge(t.dateFormat)}"/></w:date>`):e.push("<w:date/>");break;case"dropDownList":{let n=(t.listItems??[]).map(r=>`<w:listItem w:displayText="${ge(r.displayText)}" w:value="${ge(r.value)}"/>`).join("");e.push(`<w:dropDownList w:lastValue="">${n}</w:dropDownList>`);break}case"comboBox":{let n=(t.listItems??[]).map(r=>`<w:listItem w:displayText="${ge(r.displayText)}" w:value="${ge(r.value)}"/>`).join("");e.push(`<w:comboBox w:lastValue="">${n}</w:comboBox>`);break}case"checkbox":e.push(`<w14:checkbox><w14:checked w14:val="${t.checked?"1":"0"}"/><w14:checkedState w14:val="2612" w14:font="MS Gothic"/><w14:uncheckedState w14:val="2610" w14:font="MS Gothic"/></w14:checkbox>`);break;case"picture":e.push("<w:picture/>");break}return`<w:sdtPr>${e.join("")}</w:sdtPr>`}function lC(t){let e=t.properties,n=t.content.map(i=>{switch(i.type){case"run":return Xo(i);case"hyperlink":return yh(i);case"simpleField":return oC(i);case"complexField":return iC(i);case"inlineSdt":return lC(i);case"mathEquation":return i.ommlXml||"";default:return i}}).join(""),r=e.rawPropertiesXml??A7(e),o=e.rawEndPropertiesXml??"";return`<w:sdt>${r}${o}<w:sdtContent>${n}</w:sdtContent></w:sdt>`}function yy(t,e){let n=[`w:id="${e.id}"`,`w:name="${ge(e.name)}"`];return`<w:${t} ${n.join(" ")}/>`}function es(t,e){let n=e.info,r=Number.isInteger(n.id)&&n.id>=0?n.id:0,o=typeof n.author=="string"?n.author.trim():"",i=o.length>0?o:"Unknown",l=typeof n.date=="string"?n.date.trim():void 0,a=[`w:id="${r}"`,`w:author="${ge(i)}"`];l&&a.push(`w:date="${ge(l)}"`);let s=e.content.map(c=>{if(c.type==="run"){let d=Xo(c),u=c.content.some(f=>f.type==="drawing");return(t==="del"||t==="moveFrom")&&!u?d.replace(/<w:t\b/g,"<w:delText").replace(/<\/w:t>/g,"</w:delText>").replace(/<w:instrText\b/g,"<w:delInstrText").replace(/<\/w:instrText>/g,"</w:delInstrText>"):d}return c.type==="hyperlink"?yh(c):""}).join("");return`<w:${t} ${a.join(" ")}>${s}</w:${t}>`}function D7(t){switch(t.type){case"run":return Xo(t);case"hyperlink":return yh(t);case"bookmarkStart":return nC(t);case"bookmarkEnd":return rC(t);case"simpleField":return oC(t);case"complexField":return iC(t);case"inlineSdt":return lC(t);case"commentRangeStart":return`<w:commentRangeStart w:id="${t.id}"/>`;case"commentRangeEnd":return`<w:commentRangeEnd w:id="${t.id}"/><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:commentReference w:id="${t.id}"/></w:r>`;case"insertion":return es("ins",t);case"deletion":return es("del",t);case"moveFrom":return es("moveFrom",t);case"moveTo":return es("moveTo",t);case"moveFromRangeStart":return yy("moveFromRangeStart",t);case"moveFromRangeEnd":return`<w:moveFromRangeEnd w:id="${t.id}"/>`;case"moveToRangeStart":return yy("moveToRangeStart",t);case"moveToRangeEnd":return`<w:moveToRangeEnd w:id="${t.id}"/>`;case"mathEquation":return t.ommlXml||"";default:return""}}function by(t){let e=Number.isInteger(t.id)&&t.id>=0?t.id:0,n=typeof t.author=="string"&&t.author.length>0?t.author:"Unknown",r=[`w:id="${e}"`,`w:author="${ge(n)}"`],o=typeof t.date=="string"&&t.date.length>0?t.date:void 0;return o&&r.push(`w:date="${ge(o)}"`),r.join(" ")}function N7(t,e,n){let r=[];if(e&&r.push(`<w:ins ${by(e)}/>`),n&&r.push(`<w:del ${by(n)}/>`),t?.runProperties){let o=fa(t.runProperties);if(o)if(o.startsWith("<w:rPr>")&&o.endsWith("</w:rPr>")){let i=o.slice(7,-8);i.length>0&&r.push(i)}else o.startsWith("<w:rPr/>")||r.push(o)}return r.length===0?"":`<w:rPr>${r.join("")}</w:rPr>`}function aC(t,e,n,r,o){let i=[];if(t){t.styleId&&i.push(`<w:pStyle w:val="${ge(t.styleId)}"/>`),t.keepNext===!0?i.push("<w:keepNext/>"):t.keepNext===!1&&i.push('<w:keepNext w:val="0"/>'),t.keepLines===!0?i.push("<w:keepLines/>"):t.keepLines===!1&&i.push('<w:keepLines w:val="0"/>'),t.contextualSpacing===!0?i.push("<w:contextualSpacing/>"):t.contextualSpacing===!1&&i.push('<w:contextualSpacing w:val="0"/>'),t.pageBreakBefore===!0?i.push("<w:pageBreakBefore/>"):t.pageBreakBefore===!1&&i.push('<w:pageBreakBefore w:val="0"/>');let l=F7(t.frame);l&&i.push(l),t.widowControl===!1?i.push('<w:widowControl w:val="0"/>'):t.widowControl===!0&&i.push("<w:widowControl/>");let a=t.numPrFromStyle!=null&&JSON.stringify(t.numPr)===JSON.stringify(t.numPrFromStyle)?"":E7(t.numPr);a&&i.push(a);let s=I7(t.borders);s&&i.push(s);let c=M7(t.shading);c&&i.push(c);let d=R7(t.tabs);d&&i.push(d),t.suppressLineNumbers===!0?i.push("<w:suppressLineNumbers/>"):t.suppressLineNumbers===!1&&i.push('<w:suppressLineNumbers w:val="0"/>'),t.suppressAutoHyphens===!0?i.push("<w:suppressAutoHyphens/>"):t.suppressAutoHyphens===!1&&i.push('<w:suppressAutoHyphens w:val="0"/>');let u=P7(t);u&&i.push(u);let f=tC(t);f&&i.push(f),t.bidi===!0?i.push("<w:bidi/>"):t.bidi===!1&&i.push('<w:bidi w:val="0"/>'),t.alignment&&i.push(`<w:jc w:val="${t.alignment}"/>`),t.outlineLevel!==void 0&&i.push(`<w:outlineLvl w:val="${t.outlineLevel}"/>`)}if(!o?.baseOnly){let l=N7(t,n??void 0,r??void 0);if(l&&i.push(l),o?.sectionProperties){let a=eC(o.sectionProperties);a&&i.push(a)}e&&e.length>0&&i.push(B7(e[0]))}return i.length===0?"":`<w:pPr>${i.join("")}</w:pPr>`}function L7(t){return!t.startsWith("<w:pPr>")||!t.endsWith("</w:pPr>")?"":t.slice(7,-8)}function B7(t){let e=Number.isInteger(t.info.id)&&t.info.id>=0?t.info.id:0,n=typeof t.info.author=="string"?t.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof t.info.date=="string"?t.info.date.trim():void 0,i=[`w:id="${e}"`,`w:author="${ge(r)}"`];o&&i.push(`w:date="${ge(o)}"`);let l=aC(t.previousFormatting,void 0,void 0,void 0,{baseOnly:!0})||"<w:pPr/>",a=L7(l),s=a.length>0?`<w:pPr>${a}</w:pPr>`:"<w:pPr/>";return`<w:pPrChange ${i.join(" ")}>${s}</w:pPrChange>`}function Yc(t){let e=[],n=[];t.paraId&&n.push(`w14:paraId="${t.paraId}"`),t.textId&&n.push(`w14:textId="${t.textId}"`);let r=n.length>0?" "+n.join(" "):"",o=aC(t.formatting,t.propertyChanges,t.pPrIns,t.pPrDel,t.sectionProperties?{sectionProperties:t.sectionProperties}:void 0);o&&e.push(o);let i=!!t.renderedPageBreakBefore;for(let l of t.content){let a=D7(l);if(a){if(i){let s=O7(a);s&&(a=s,i=!1)}e.push(a)}}return`<w:p${r}>${e.join("")}</w:p>`}function O7(t){let e=/<w:r(?=[\s>/])[^>]*>/;return e.test(t)?t.replace(e,n=>`${n}<w:lastRenderedPageBreak/>`):null}var sC=1e5;function j7(){sC=1e5}function cC(t){return t!=null&&t!==""&&t!==0?String(t):String(sC++)}function Rf(t){if(!t)return"";if(t.rgb)return`<a:srgbClr val="${t.rgb.replace("#","")}"/>`;if(t.themeColor){let e=`<a:schemeClr val="${t.themeColor}"`;return t.themeTint?e+=`><a:tint val="${t.themeTint}"/></a:schemeClr>`:t.themeShade?e+=`><a:shade val="${t.themeShade}"/></a:schemeClr>`:e+="/>",e}return""}function z7(t){if(!t||t.type==="none")return"<a:noFill/>";if(t.type==="solid"&&t.color)return`<a:solidFill>${Rf(t.color)}</a:solidFill>`;if(t.type==="gradient"&&t.gradient){let e=t.gradient,n=e.stops.map(o=>`<a:gs pos="${o.position}">${Rf(o.color)}</a:gs>`).join(""),r=e.type==="linear"?`<a:lin ang="${(e.angle||0)*6e4}" scaled="1"/>`:"";return`<a:gradFill><a:gsLst>${n}</a:gsLst>${r}</a:gradFill>`}return""}function dC(t){if(!t)return"";let e=[];t.width!=null&&e.push(`w="${t.width}"`),t.cap&&e.push(`cap="${t.cap}"`);let n=[];return t.color&&n.push(`<a:solidFill>${Rf(t.color)}</a:solidFill>`),t.style&&t.style!=="solid"&&n.push(`<a:prstDash val="${t.style}"/>`),t.headEnd&&n.push(`<a:headEnd type="${t.headEnd.type}"${t.headEnd.width?` w="${t.headEnd.width}"`:""}${t.headEnd.length?` len="${t.headEnd.length}"`:""}/>`),t.tailEnd&&n.push(`<a:tailEnd type="${t.tailEnd.type}"${t.tailEnd.width?` w="${t.tailEnd.width}"`:""}${t.tailEnd.length?` len="${t.tailEnd.length}"`:""}/>`),n.length===0&&e.length===0?"":`<a:ln${e.length?" "+e.join(" "):""}>${n.join("")}</a:ln>`}function uC(t){let e=[],n=t.horizontal;e.push(`<wp:positionH relativeFrom="${n.relativeTo}">`),n.alignment?e.push(`<wp:align>${n.alignment}</wp:align>`):e.push(`<wp:posOffset>${re(n.posOffset)}</wp:posOffset>`),e.push("</wp:positionH>");let r=t.vertical;return e.push(`<wp:positionV relativeFrom="${r.relativeTo}">`),r.alignment?e.push(`<wp:align>${r.alignment}</wp:align>`):e.push(`<wp:posOffset>${re(r.posOffset)}</wp:posOffset>`),e.push("</wp:positionV>"),e.join("")}function fC(t){let e=t.wrapText?` wrapText="${t.wrapText}"`:' wrapText="bothSides"';switch(t.type){case"square":return`<wp:wrapSquare${e}/>`;case"tight":return`<wp:wrapTight${e}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapTight>`;case"through":return`<wp:wrapThrough${e}><wp:wrapPolygon edited="0"><wp:start x="0" y="0"/><wp:lineTo x="0" y="21600"/><wp:lineTo x="21600" y="21600"/><wp:lineTo x="21600" y="0"/><wp:lineTo x="0" y="0"/></wp:wrapPolygon></wp:wrapThrough>`;case"topAndBottom":return"<wp:wrapTopAndBottom/>";case"behind":case"inFront":return"<wp:wrapNone/>";default:return"<wp:wrapNone/>"}}function H7(t,e){let n=t.size.width,r=t.size.height,o=t.rId||"rId1",i=e,l=t.filename||`image${i}`,a="";t.transform?.rotation&&(a+=` rot="${Math.round(t.transform.rotation*6e4)}"`),t.transform?.flipH&&(a+=' flipH="1"'),t.transform?.flipV&&(a+=' flipV="1"');let s=t.opacity!==void 0&&t.opacity<1?`<a:alphaModFix amt="${Math.round(Math.max(0,Math.min(1,t.opacity))*1e5)}"/>`:"",c=s?`<a:blip r:embed="${o}">${s}</a:blip>`:`<a:blip r:embed="${o}"/>`,d=[];t.crop?.left&&d.push(`l="${Math.round(t.crop.left*1e5)}"`),t.crop?.top&&d.push(`t="${Math.round(t.crop.top*1e5)}"`),t.crop?.right&&d.push(`r="${Math.round(t.crop.right*1e5)}"`),t.crop?.bottom&&d.push(`b="${Math.round(t.crop.bottom*1e5)}"`);let u=d.length>0?`<a:srcRect ${d.join(" ")}/>`:"";return['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">','<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">',"<pic:nvPicPr>",`<pic:cNvPr id="${i}" name="${ge(l)}"${t.alt?` descr="${ge(t.alt)}"`:""}/>`,"<pic:cNvPicPr/>","</pic:nvPicPr>","<pic:blipFill>",c,u,"<a:stretch><a:fillRect/></a:stretch>","</pic:blipFill>","<pic:spPr>",`<a:xfrm${a}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${re(n)}" cy="${re(r)}"/>`,"</a:xfrm>",'<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>',t.outline?dC(t.outline):"","</pic:spPr>","</pic:pic>","</a:graphicData>","</a:graphic>"].join("")}function _7(t){let e=t.image,n=e.wrap.type!=="inline",r=e.size.width,o=e.size.height,i=e.wrap.distT??0,l=e.wrap.distB??0,a=e.wrap.distL??0,s=e.wrap.distR??0,c=e.padding?.left??0,d=e.padding?.top??0,u=e.padding?.right??0,f=e.padding?.bottom??0,h=`<wp:effectExtent l="${re(c)}" t="${re(d)}" r="${re(u)}" b="${re(f)}"/>`,p=cC(e.id),m=e.title||e.filename||`Picture ${p}`,y=H7(e,p);if(!n)return["<w:drawing>",`<wp:inline distT="${re(i)}" distB="${re(l)}" distL="${re(a)}" distR="${re(s)}">`,`<wp:extent cx="${re(r)}" cy="${re(o)}"/>`,h,`<wp:docPr id="${p}" name="${ge(m)}"${e.alt?` descr="${ge(e.alt)}"`:""}${e.decorative?' hidden="1"':""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',y,"</wp:inline>","</w:drawing>"].join("");let w=e.wrap.type==="behind"?"1":"0",C=e.position?uC(e.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',g=fC(e.wrap);return["<w:drawing>",`<wp:anchor distT="${re(i)}" distB="${re(l)}" distL="${re(a)}" distR="${re(s)}" simplePos="0" relativeHeight="251658240" behindDoc="${w}" locked="0" layoutInCell="${e.layoutInCell===!1?"0":"1"}" allowOverlap="${e.allowOverlap===!1?"0":"1"}">`,'<wp:simplePos x="0" y="0"/>',C,`<wp:extent cx="${re(r)}" cy="${re(o)}"/>`,h,g,`<wp:docPr id="${p}" name="${ge(m)}"${e.alt?` descr="${ge(e.alt)}"`:""}/>`,'<wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr>',y,"</wp:anchor>","</w:drawing>"].join("")}function W7(t){return t.map(e=>Yc(e)).join("")}function V7(t){let e=t.shape,n=e.size.width,r=e.size.height,o=e.shapeType==="textBox",i=e.wrap&&e.wrap.type!=="inline",l=e.wrap?.distT??0,a=e.wrap?.distB??0,s=e.wrap?.distL??0,c=e.wrap?.distR??0,d=cC(e.id),u=e.name||(o?`TextBox ${d}`:`Shape ${d}`),f="";e.transform?.rotation&&(f+=` rot="${Math.round(e.transform.rotation*6e4)}"`),e.transform?.flipH&&(f+=' flipH="1"'),e.transform?.flipV&&(f+=' flipV="1"');let h=["<wps:spPr>",`<a:xfrm${f}>`,'<a:off x="0" y="0"/>',`<a:ext cx="${re(n)}" cy="${re(r)}"/>`,"</a:xfrm>",`<a:prstGeom prst="${e.shapeType==="textBox"?"rect":e.shapeType}"><a:avLst/></a:prstGeom>`,z7(e.fill),dC(e.outline),"</wps:spPr>"].join(""),p="";if(e.textBody){let g=e.textBody,v=['rot="0"','vert="horz"'];g.anchor&&v.push(`anchor="${g.anchor==="middle"?"ctr":g.anchor}"`),g.anchorCenter&&v.push('anchorCtr="1"'),g.margins&&(g.margins.left!=null&&v.push(`lIns="${re(g.margins.left)}"`),g.margins.top!=null&&v.push(`tIns="${re(g.margins.top)}"`),g.margins.right!=null&&v.push(`rIns="${re(g.margins.right)}"`),g.margins.bottom!=null&&v.push(`bIns="${re(g.margins.bottom)}"`)),o?p=["<wps:txbx><w:txbxContent>",W7(g.content),"</w:txbxContent></wps:txbx>",`<wps:bodyPr ${v.join(" ")}/>`].join(""):p=[`<wps:bodyPr ${v.join(" ")}/>`].join("")}let m=['<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">','<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">',["<wps:wsp>",`<wps:cNvSpPr${o?' txBox="1"':""}/>`,h,p,"</wps:wsp>"].join(""),"</a:graphicData>","</a:graphic>"].join("");if(!i)return["<w:drawing>",`<wp:inline distT="${re(l)}" distB="${re(a)}" distL="${re(s)}" distR="${re(c)}">`,`<wp:extent cx="${re(n)}" cy="${re(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',`<wp:docPr id="${d}" name="${ge(u)}"/>`,"<wp:cNvGraphicFramePr/>",m,"</wp:inline>","</w:drawing>"].join("");let y=e.wrap?.type==="behind"?"1":"0",w=e.position?uC(e.position):'<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH><wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>',C=fC(e.wrap);return["<w:drawing>",`<wp:anchor distT="${re(l)}" distB="${re(a)}" distL="${re(s)}" distR="${re(c)}" simplePos="0" relativeHeight="251658240" behindDoc="${y}" locked="0" layoutInCell="1" allowOverlap="1">`,'<wp:simplePos x="0" y="0"/>',w,`<wp:extent cx="${re(n)}" cy="${re(r)}"/>`,'<wp:effectExtent l="0" t="0" r="0" b="0"/>',C,`<wp:docPr id="${d}" name="${ge(u)}"/>`,"<wp:cNvGraphicFramePr/>",m,"</wp:anchor>","</w:drawing>"].join("")}var q7=new Set(["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow"]);function Z7(t){if(!t)return"";let e=[];return t.auto?e.push('w:val="auto"'):t.rgb&&e.push(`w:val="${t.rgb}"`),t.themeColor&&e.push(`w:themeColor="${t.themeColor}"`),t.themeTint&&e.push(`w:themeTint="${t.themeTint}"`),t.themeShade&&e.push(`w:themeShade="${t.themeShade}"`),e.length===0?"":`<w:color ${e.join(" ")}/>`}function K7(t){if(!t)return"";let e=[];return t.pattern?e.push(`w:val="${t.pattern}"`):e.push('w:val="clear"'),t.color?.rgb?e.push(`w:color="${t.color.rgb}"`):t.color?.auto&&e.push('w:color="auto"'),t.fill?.rgb?e.push(`w:fill="${t.fill.rgb}"`):t.fill?.auto&&e.push('w:fill="auto"'),t.fill?.themeColor&&e.push(`w:themeFill="${t.fill.themeColor}"`),t.fill?.themeTint&&e.push(`w:themeFillTint="${t.fill.themeTint}"`),t.fill?.themeShade&&e.push(`w:themeFillShade="${t.fill.themeShade}"`),e.length===0?"":`<w:shd ${e.join(" ")}/>`}function fa(t){if(!t)return"";let e=[];if(t.styleId&&e.push(`<w:rStyle w:val="${ge(t.styleId)}"/>`),t.fontFamily){let o=[];t.fontFamily.ascii&&o.push(`w:ascii="${ge(t.fontFamily.ascii)}"`),t.fontFamily.hAnsi&&o.push(`w:hAnsi="${ge(t.fontFamily.hAnsi)}"`),t.fontFamily.eastAsia&&o.push(`w:eastAsia="${ge(t.fontFamily.eastAsia)}"`),t.fontFamily.cs&&o.push(`w:cs="${ge(t.fontFamily.cs)}"`),t.fontFamily.asciiTheme&&o.push(`w:asciiTheme="${t.fontFamily.asciiTheme}"`),t.fontFamily.hAnsiTheme&&o.push(`w:hAnsiTheme="${t.fontFamily.hAnsiTheme}"`),t.fontFamily.eastAsiaTheme&&o.push(`w:eastAsiaTheme="${t.fontFamily.eastAsiaTheme}"`),t.fontFamily.csTheme&&o.push(`w:csTheme="${t.fontFamily.csTheme}"`),o.length>0&&e.push(`<w:rFonts ${o.join(" ")}/>`)}t.bold===!0?e.push("<w:b/>"):t.bold===!1&&e.push('<w:b w:val="0"/>'),t.boldCs===!0?e.push("<w:bCs/>"):t.boldCs===!1&&e.push('<w:bCs w:val="0"/>'),t.italic===!0?e.push("<w:i/>"):t.italic===!1&&e.push('<w:i w:val="0"/>'),t.italicCs===!0?e.push("<w:iCs/>"):t.italicCs===!1&&e.push('<w:iCs w:val="0"/>'),t.allCaps===!0?e.push("<w:caps/>"):t.allCaps===!1&&e.push('<w:caps w:val="0"/>'),t.smallCaps===!0?e.push("<w:smallCaps/>"):t.smallCaps===!1&&e.push('<w:smallCaps w:val="0"/>'),t.strike===!0?e.push("<w:strike/>"):t.strike===!1&&e.push('<w:strike w:val="0"/>'),t.doubleStrike===!0?e.push("<w:dstrike/>"):t.doubleStrike===!1&&e.push('<w:dstrike w:val="0"/>'),t.outline===!0?e.push("<w:outline/>"):t.outline===!1&&e.push('<w:outline w:val="0"/>'),t.shadow===!0?e.push("<w:shadow/>"):t.shadow===!1&&e.push('<w:shadow w:val="0"/>'),t.emboss===!0?e.push("<w:emboss/>"):t.emboss===!1&&e.push('<w:emboss w:val="0"/>'),t.imprint===!0?e.push("<w:imprint/>"):t.imprint===!1&&e.push('<w:imprint w:val="0"/>'),t.hidden===!0?e.push("<w:vanish/>"):t.hidden===!1&&e.push('<w:vanish w:val="0"/>');let n=Z7(t.color);if(n&&e.push(n),t.spacing!==void 0&&e.push(`<w:spacing w:val="${re(t.spacing)}"/>`),t.scale!==void 0&&e.push(`<w:w w:val="${re(t.scale)}"/>`),t.kerning!==void 0&&e.push(`<w:kern w:val="${re(t.kerning)}"/>`),t.position!==void 0&&e.push(`<w:position w:val="${re(t.position)}"/>`),t.fontSize!==void 0&&e.push(`<w:sz w:val="${re(t.fontSize)}"/>`),t.fontSizeCs!==void 0&&e.push(`<w:szCs w:val="${re(t.fontSizeCs)}"/>`),t.highlight&&t.highlight!=="none"){if(q7.has(t.highlight))e.push(`<w:highlight w:val="${t.highlight}"/>`);else if(!t.shading){let o=t.highlight.replace(/^#/,"");/^[0-9a-fA-F]{6}$/.test(o)&&e.push(`<w:shd w:val="clear" w:color="auto" w:fill="${o}"/>`)}}if(t.underline){let o=[`w:val="${t.underline.style}"`];t.underline.color&&(t.underline.color.rgb&&o.push(`w:color="${t.underline.color.rgb}"`),t.underline.color.themeColor&&o.push(`w:themeColor="${t.underline.color.themeColor}"`),t.underline.color.themeTint&&o.push(`w:themeTint="${t.underline.color.themeTint}"`),t.underline.color.themeShade&&o.push(`w:themeShade="${t.underline.color.themeShade}"`)),e.push(`<w:u ${o.join(" ")}/>`)}t.effect&&t.effect!=="none"&&e.push(`<w:effect w:val="${t.effect}"/>`),t.emphasisMark&&t.emphasisMark!=="none"&&e.push(`<w:em w:val="${t.emphasisMark}"/>`);let r=K7(t.shading);return r&&e.push(r),t.vertAlign&&t.vertAlign!=="baseline"&&e.push(`<w:vertAlign w:val="${t.vertAlign}"/>`),t.rtl===!0?e.push("<w:rtl/>"):t.rtl===!1&&e.push('<w:rtl w:val="0"/>'),t.cs===!0?e.push("<w:cs/>"):t.cs===!1&&e.push('<w:cs w:val="0"/>'),e.length===0?"":`<w:rPr>${e.join("")}</w:rPr>`}function U7(t){return!t.startsWith("<w:rPr>")||!t.endsWith("</w:rPr>")?"":t.slice(7,-8)}function X7(t){let e=Number.isInteger(t.info.id)&&t.info.id>=0?t.info.id:0,n=typeof t.info.author=="string"?t.info.author.trim():"",r=n.length>0?n:"Unknown",o=typeof t.info.date=="string"?t.info.date.trim():void 0,i=[`w:id="${e}"`,`w:author="${ge(r)}"`];o&&i.push(`w:date="${ge(o)}"`);let l=fa(t.previousFormatting)||"<w:rPr/>";return`<w:rPrChange ${i.join(" ")}>${l}</w:rPrChange>`}function G7(t,e){let n=fa(t),r=n?U7(n):"",o=(e??[]).map(X7).join(""),i=`${r}${o}`;return i?`<w:rPr>${i}</w:rPr>`:""}function Y7(t){return`<w:t${t.preserveSpace||t.text.startsWith(" ")||t.text.endsWith(" ")||t.text.includes(" ")?' xml:space="preserve"':""}>${ge(t.text)}</w:t>`}function J7(t){return"<w:tab/>"}function Q7(t){let e=[];return t.breakType==="page"?e.push('w:type="page"'):t.breakType==="column"?e.push('w:type="column"'):t.breakType==="textWrapping"&&(e.push('w:type="textWrapping"'),t.clear&&t.clear!=="none"&&e.push(`w:clear="${t.clear}"`)),e.length===0?"<w:br/>":`<w:br ${e.join(" ")}/>`}function eW(t){return`<w:sym w:font="${ge(t.font)}" w:char="${ge(t.char)}"/>`}function tW(t){return t.type==="footnoteRef"?`<w:footnoteReference w:id="${t.id}"/>`:`<w:endnoteReference w:id="${t.id}"/>`}function nW(t){let e=[`w:fldCharType="${t.charType}"`];return t.fldLock&&e.push('w:fldLock="true"'),t.dirty&&e.push('w:dirty="true"'),`<w:fldChar ${e.join(" ")}/>`}function rW(t){return`<w:instrText${t.text.startsWith(" ")||t.text.endsWith(" ")||t.text.includes(" ")?' xml:space="preserve"':""}>${ge(t.text)}</w:instrText>`}function oW(t){return"<w:softHyphen/>"}function iW(t){return"<w:noBreakHyphen/>"}function lW(t){switch(t.type){case"text":return Y7(t);case"tab":return J7();case"break":return Q7(t);case"symbol":return eW(t);case"footnoteRef":case"endnoteRef":return tW(t);case"footnoteRefMark":return"<w:footnoteRef/>";case"endnoteRefMark":return"<w:endnoteRef/>";case"separator":return"<w:separator/>";case"continuationSeparator":return"<w:continuationSeparator/>";case"fieldChar":return nW(t);case"instrText":return rW(t);case"softHyphen":return oW();case"noBreakHyphen":return iW();case"drawing":return _7(t);case"shape":return V7(t);default:return""}}function Xo(t){let e=[],n=G7(t.formatting,t.propertyChanges);n&&e.push(n);for(let r of t.content){let o=lW(r);o&&e.push(o)}return`<w:r>${e.join("")}</w:r>`}function pC(t){if(!t)return"";let e=[t.firstRow?"1":"0",t.lastRow?"1":"0",t.firstColumn?"1":"0",t.lastColumn?"1":"0",t.oddVBand?"1":"0",t.evenVBand?"1":"0",t.oddHBand?"1":"0",t.evenHBand?"1":"0",t.nwCell?"1":"0",t.neCell?"1":"0",t.swCell?"1":"0",t.seCell?"1":"0"].join("");return e==="000000000000"?"":`<w:cnfStyle w:val="${e}"/>`}function Pf(t){if(!(t==null||!Number.isFinite(t)||t<=0))return Math.max(1,Math.round(t))}function aW(t){return t.columnWidths&&t.columnWidths.length>0?t.columnWidths.length:t.rows.reduce((e,n)=>{let r=n.cells.reduce((o,i)=>o+Math.max(1,Math.round(i.formatting?.gridSpan??1)),0);return Math.max(e,r)},0)}function sW(t){let e=[];for(let n of t.cells){let r=Pf(n.formatting?.width?.value);if(r==null)return;let o=Math.max(1,Math.round(n.formatting?.gridSpan??1));e.push(...mh(r,o))}return e}function cW(t){let e=t.columnWidths?.map(l=>Pf(l)).filter(l=>l!=null);if(e&&e.length>0)return e;let n=aW(t);if(n<=0)return[];let r,o=-1;for(let l of t.rows){let a=sW(l);a&&a.length===n&&l.cells.length>o&&(r=a,o=l.cells.length)}if(r)return r;let i=t.formatting?.width?.type==="dxa"?Pf(t.formatting.width.value):void 0;return mh(i??9360,n)}function dW(t){let e=cW(t);return e.length===0?"":`<w:tblGrid>${e.map(n=>`<w:gridCol w:w="${re(n)}"/>`).join("")}</w:tblGrid>`}function uW(t){let e=Number.isInteger(t.id)&&t.id>=0?t.id:0,n=typeof t.author=="string"?t.author.trim():"",r=n.length>0?n:"Unknown",o=typeof t.date=="string"?t.date.trim():void 0;return{id:e,author:r,date:o}}function Qr(t){let e=uW(t),n=[`w:id="${e.id}"`,`w:author="${ge(e.author)}"`];return e.date&&n.push(`w:date="${ge(e.date)}"`),n.join(" ")}function Wr(t,e){if(!t)return"";let n=[`w:w="${re(t.value)}"`,`w:type="${t.type}"`];return`<w:${e} ${n.join(" ")}/>`}var fW=["top","left","bottom","right","insideH","insideV"];function hC(t,e){if(!t)return"";let n=[];for(let r of fW){let o=gh(t[r],r);o&&n.push(o)}return n.length===0?"":`<w:${e}>${n.join("")}</w:${e}>`}function mC(t,e){if(!t)return"";let n=[];return t.top&&n.push(Wr(t.top,"top")),t.left&&n.push(Wr(t.left,"left")),t.bottom&&n.push(Wr(t.bottom,"bottom")),t.right&&n.push(Wr(t.right,"right")),n.length===0?"":`<w:${e}>${n.join("")}</w:${e}>`}function gC(t){if(!t)return"";let e=[];return t.pattern?e.push(`w:val="${t.pattern}"`):e.push('w:val="clear"'),t.color?.rgb?e.push(`w:color="${t.color.rgb}"`):t.color?.auto&&e.push('w:color="auto"'),t.fill?.rgb?e.push(`w:fill="${t.fill.rgb}"`):t.fill?.auto&&e.push('w:fill="auto"'),t.fill?.themeColor&&e.push(`w:themeFill="${t.fill.themeColor}"`),t.fill?.themeTint&&e.push(`w:themeFillTint="${t.fill.themeTint}"`),t.fill?.themeShade&&e.push(`w:themeFillShade="${t.fill.themeShade}"`),e.length===0?"":`<w:shd ${e.join(" ")}/>`}function pW(t){if(!t)return"";let e=[];return t.firstRow&&e.push('w:firstRow="1"'),t.lastRow&&e.push('w:lastRow="1"'),t.firstColumn&&e.push('w:firstColumn="1"'),t.lastColumn&&e.push('w:lastColumn="1"'),t.noHBand&&e.push('w:noHBand="1"'),t.noVBand&&e.push('w:noVBand="1"'),e.length===0?"":`<w:tblLook ${e.join(" ")}/>`}function hW(t){if(!t)return"";let e=[];return t.horzAnchor&&e.push(`w:horzAnchor="${t.horzAnchor}"`),t.vertAnchor&&e.push(`w:vertAnchor="${t.vertAnchor}"`),t.tblpX!==void 0&&e.push(`w:tblpX="${re(t.tblpX)}"`),t.tblpXSpec&&e.push(`w:tblpXSpec="${t.tblpXSpec}"`),t.tblpY!==void 0&&e.push(`w:tblpY="${re(t.tblpY)}"`),t.tblpYSpec&&e.push(`w:tblpYSpec="${t.tblpYSpec}"`),t.topFromText!==void 0&&e.push(`w:topFromText="${re(t.topFromText)}"`),t.bottomFromText!==void 0&&e.push(`w:bottomFromText="${re(t.bottomFromText)}"`),t.leftFromText!==void 0&&e.push(`w:leftFromText="${re(t.leftFromText)}"`),t.rightFromText!==void 0&&e.push(`w:rightFromText="${re(t.rightFromText)}"`),e.length===0?"":`<w:tblpPr ${e.join(" ")}/>`}function yC(t,e){let n=[];if(t){t.styleId&&n.push(`<w:tblStyle w:val="${ge(t.styleId)}"/>`);let r=hW(t.floating);r&&n.push(r),t.overlap&&n.push(`<w:tblOverlap w:val="${t.overlap}"/>`),t.bidi&&n.push("<w:bidiVisual/>");let o=Wr(t.width,"tblW");o&&n.push(o),t.justification&&n.push(`<w:jc w:val="${t.justification}"/>`);let i=Wr(t.cellSpacing,"tblCellSpacing");i&&n.push(i);let l=Wr(t.indent,"tblInd");l&&n.push(l);let a=hC(t.borders,"tblBorders");a&&n.push(a);let s=gC(t.shading);s&&n.push(s),t.layout&&n.push(`<w:tblLayout w:type="${t.layout}"/>`);let c=mC(t.cellMargins,"tblCellMar");c&&n.push(c);let d=pW(t.look);d&&n.push(d)}return e&&e.length>0&&n.push(gW(e[0])),n.length===0?"":`<w:tblPr>${n.join("")}</w:tblPr>`}function mW(t){return!t.startsWith("<w:tblPr>")||!t.endsWith("</w:tblPr>")?"":t.slice(9,-10)}function gW(t){let e=Qr(t.info),n=yC(t.previousFormatting)||"<w:tblPr/>",r=mW(n),o=r.length>0?`<w:tblPr>${r}</w:tblPr>`:"<w:tblPr/>";return`<w:tblPrChange ${e}>${o}</w:tblPrChange>`}function bC(t,e,n){let r=[];if(t){let o=pC(t.conditionalFormat);if(o&&r.push(o),t.cantSplit&&r.push("<w:cantSplit/>"),t.header&&r.push("<w:tblHeader/>"),t.height){let i=[`w:val="${re(t.height.value)}"`];t.heightRule&&i.push(`w:hRule="${t.heightRule}"`),r.push(`<w:trHeight ${i.join(" ")}/>`)}t.justification&&r.push(`<w:jc w:val="${t.justification}"/>`),t.hidden&&r.push("<w:hidden/>")}return n&&(n.type==="tableRowInsertion"?r.push(`<w:ins ${Qr(n.info)}/>`):n.type==="tableRowDeletion"&&r.push(`<w:del ${Qr(n.info)}/>`)),e&&e.length>0&&r.push(bW(e[0])),r.length===0?"":`<w:trPr>${r.join("")}</w:trPr>`}function yW(t){return!t.startsWith("<w:trPr>")||!t.endsWith("</w:trPr>")?"":t.slice(8,-9)}function bW(t){let e=Qr(t.info),n=bC(t.previousFormatting)||"<w:trPr/>",r=yW(n),o=r.length>0?`<w:trPr>${r}</w:trPr>`:"<w:trPr/>";return`<w:trPrChange ${e}>${o}</w:trPrChange>`}function wC(t,e,n){let r=[];if(t){let o=pC(t.conditionalFormat);o&&r.push(o);let i=Wr(t.width,"tcW");i&&r.push(i),t.gridSpan&&t.gridSpan>1&&r.push(`<w:gridSpan w:val="${re(t.gridSpan)}"/>`),t.vMerge&&(t.vMerge==="restart"?r.push('<w:vMerge w:val="restart"/>'):r.push("<w:vMerge/>"));let l=hC(t.borders,"tcBorders");l&&r.push(l);let a=gC(t.shading);a&&r.push(a),t.noWrap&&r.push("<w:noWrap/>");let s=mC(t.margins,"tcMar");s&&r.push(s),t.textDirection&&r.push(`<w:textDirection w:val="${t.textDirection}"/>`),t.fitText&&r.push("<w:tcFitText/>"),t.verticalAlign&&r.push(`<w:vAlign w:val="${t.verticalAlign}"/>`),t.hideMark&&r.push("<w:hideMark/>")}if(n){if(n.type==="tableCellInsertion")r.push(`<w:cellIns ${Qr(n.info)}/>`);else if(n.type==="tableCellDeletion")r.push(`<w:cellDel ${Qr(n.info)}/>`);else if(n.type==="tableCellMerge"){let o=n.vMerge?` w:vMerge="${n.vMerge}"`:"",i=n.vMergeOrig?` w:vMergeOrig="${n.vMergeOrig}"`:"";r.push(`<w:cellMerge ${Qr(n.info)}${o}${i}/>`)}}return e&&e.length>0&&r.push(xW(e[0])),r.length===0?"":`<w:tcPr>${r.join("")}</w:tcPr>`}function wW(t){return!t.startsWith("<w:tcPr>")||!t.endsWith("</w:tcPr>")?"":t.slice(8,-9)}function xW(t){let e=Qr(t.info),n=wC(t.previousFormatting)||"<w:tcPr/>",r=wW(n),o=r.length>0?`<w:tcPr>${r}</w:tcPr>`:"<w:tcPr/>";return`<w:tcPrChange ${e}>${o}</w:tcPrChange>`}function vW(t){let e=[];for(let n of t)n.type==="paragraph"?e.push(Yc(n)):n.type==="table"&&e.push(bh(n));return e.length===0&&e.push("<w:p/>"),e.join("")}function kW(t){let e=[],n=wC(t.formatting,t.propertyChanges,t.structuralChange);return n&&e.push(n),e.push(vW(t.content)),`<w:tc>${e.join("")}</w:tc>`}function CW(t){let e=[],n=bC(t.formatting,t.propertyChanges,t.structuralChange);n&&e.push(n);for(let r of t.cells)e.push(kW(r));return`<w:tr>${e.join("")}</w:tr>`}function bh(t){let e=[],n=yC(t.formatting,t.propertyChanges),r=dW(t);n?e.push(n):r&&e.push("<w:tblPr/>"),r&&e.push(r);for(let o of t.rows)e.push(CW(o));return`<w:tbl>${e.join("")}</w:tbl>`}function xC(t,e){let n=t.content.map(e).join(""),r=t.properties.rawPropertiesXml??"",o=t.properties.rawEndPropertiesXml??"";return`<w:sdt>${r}${o}<w:sdtContent>${n}</w:sdtContent></w:sdt>`}var kt={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function SW(){let t={wpc:kt.wpc,mc:kt.mc,o:kt.o,r:kt.r,m:kt.m,v:kt.v,wp14:kt.wp14,wp:kt.wp,w10:kt.w10,w:kt.w,w14:kt.w14,w15:kt.w15,w16se:kt.w16se,w16cid:kt.w16cid,w16:kt.w16,w16cex:kt.w16cex,w16sdtdh:kt.w16sdtdh,wne:kt.wne,wpg:kt.wpg,wps:kt.wps};return Object.entries(t).map(([e,n])=>`xmlns:${e}="${n}"`).join(" ")}function wh(t){return t.type==="paragraph"?Yc(t):t.type==="table"?bh(t):t.type==="blockSdt"?xC(t,wh):""}function TW(t){return t.map(e=>wh(e)).join("")}function $W(t){let e=[];return e.push(TW(t.content)),t.finalSectionProperties&&e.push(eC(t.finalSectionProperties)),e.join("")}function vC(t){j7();let e=[];e.push('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');let n=SW();return e.push(`<w:document ${n} mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14">`),e.push("<w:body>"),e.push($W(t.package.document)),e.push("</w:body>"),e.push("</w:document>"),e.join("")}var IW='<v:shapetype id="_x0000_t136" coordsize="21600,21600" o:spt="136" adj="10800" path="m@7,l@8,m@5,21600l@6,21600e"><v:formulas><v:f eqn="sum #0 0 10800"/><v:f eqn="prod #0 2 1"/><v:f eqn="sum 21600 0 @1"/><v:f eqn="sum 0 0 @2"/><v:f eqn="sum 21600 0 @3"/><v:f eqn="if @0 @3 0"/><v:f eqn="if @0 21600 @1"/><v:f eqn="if @0 0 @2"/><v:f eqn="if @0 @4 21600"/><v:f eqn="mid @5 @6"/><v:f eqn="mid @8 @5"/><v:f eqn="mid @7 @8"/><v:f eqn="mid @6 @7"/><v:f eqn="sum @6 0 @5"/></v:formulas><v:path textpathok="t" o:connecttype="custom" o:connectlocs="@9,0;@10,10800;@9,21600;@11,10800" o:connectangles="270,180,90,0"/><v:textpath on="t" fitshape="t"/><v:handles><v:h position="#0,bottomRight" xrange="6629,14971"/></v:handles><o:lock v:ext="edit" text="t" shapetype="t"/></v:shapetype>',MW='<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"/><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"/><v:f eqn="sum @0 1 0"/><v:f eqn="sum 0 0 @1"/><v:f eqn="prod @2 1 2"/><v:f eqn="prod @3 21600 pixelWidth"/><v:f eqn="prod @3 21600 pixelHeight"/><v:f eqn="sum @0 0 1"/><v:f eqn="prod @6 1 2"/><v:f eqn="prod @7 21600 pixelWidth"/><v:f eqn="sum @8 21600 0"/><v:f eqn="prod @7 21600 pixelHeight"/><v:f eqn="sum @10 21600 0"/></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/><o:lock v:ext="edit" aspectratio="t"/></v:shapetype>';function RW(t){let e=Math.max(t.text.trim().length,1),n=Math.min(Math.max(e*26,120),468);return{width:n,height:n/2}}var wy=12700;function PW(t){let e=t.widthEmu!==void 0?t.widthEmu/wy:311.4,n=t.heightEmu!==void 0?t.heightEmu/wy:e;return{width:e*(t.scale||1),height:n*(t.scale||1)}}function EW(t){let{width:e,height:n}=RW(t),r=t.layout==="diagonal"?";rotation:315":"",o=`position:absolute;margin-left:0;margin-top:0;width:${e}pt;height:${n}pt${r};z-index:-251658240;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin`,i=t.semitransparent?'<v:fill opacity=".5"/>':"",l=t.fontSize!==void 0?t.fontSize:1,a=`font-family:&quot;${ge(t.font)}&quot;;font-size:${l}pt`;return"<w:p><w:r><w:rPr><w:noProof/></w:rPr><w:pict>"+IW+`<v:shape id="PowerPlusWaterMarkObject1" o:spid="_x0000_s2049" type="#_x0000_t136" style="${o}" o:allowincell="f" fillcolor="${ge(t.color)}" stroked="f">`+i+`<v:textpath style="${a}" string="${ge(t.text)}"/></v:shape></w:pict></w:r></w:p>`}function FW(t){if(!t.relId)return"";let{width:e,height:n}=PW(t),r=`position:absolute;margin-left:0;margin-top:0;width:${e}pt;height:${n}pt;z-index:-251657216;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin`,o=t.washout?' gain="19661f" blacklevel="22938f"':"";return"<w:p><w:r><w:rPr><w:noProof/></w:rPr><w:pict>"+MW+`<v:shape id="WordPictureWatermark1" o:spid="_x0000_s2050" type="#_x0000_t75" style="${r}" o:allowincell="f"><v:imagedata r:id="${ge(t.relId)}" o:title="watermark"${o}/></v:shape></w:pict></w:r></w:p>`}function AW(t){return t.kind==="text"?EW(t):FW(t)}var DW={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"};function NW(){return Object.entries(DW).map(([t,e])=>`xmlns:${t}="${e}"`).join(" ")}function kC(t){return t.type==="paragraph"?Yc(t):t.type==="table"?bh(t):t.type==="blockSdt"?xC(t,kC):""}function LW(t){let e=t.type==="header"?"w:hdr":"w:ftr",n=NW(),r=t.content.map(o=>kC(o)).join("");return t.watermark&&(r=AW(t.watermark)+r),r||(r="<w:p><w:pPr/></w:p>"),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42
+ <${e} ${n}>${r}</${e}>`}function CC(t){let e="<w:r>",n=[];t.formatting?.bold&&n.push("<w:b/>"),t.formatting?.italic&&n.push("<w:i/>"),n.length>0&&(e+=`<w:rPr>${n.join("")}</w:rPr>`);for(let r of t.content)if(r.type==="text"){let o=r.text!==r.text.trim()||r.text.includes(" ");e+=o?`<w:t xml:space="preserve">${ge(r.text)}</w:t>`:`<w:t>${ge(r.text)}</w:t>`}else r.type==="break"&&(e+="<w:br/>");return e+="</w:r>",e}function xy(t,e){let n=e?`<w:p w14:paraId="${e}">`:"<w:p>";for(let r of t.content)r.type==="run"&&(n+=CC(r));return n+="</w:p>",n}function vy(t,e){let n=e?`<w:p w14:paraId="${e}">`:"<w:p>";n+='<w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r>';for(let r of t.content)r.type==="run"&&(n+=CC(r));return n+="</w:p>",n}function ky(t,e){let n=zo(),r=[`w:id="${t.id}"`];if(t.author&&r.push(`w:author="${ge(t.author)}"`),t.initials?r.push(`w:initials="${ge(t.initials)}"`):r.push('w:initials=""'),t.date){let i=t.date.replace(/\.\d{3}Z$/,"Z");r.push(`w:date="${ge(i)}"`)}let o=`<w:comment ${r.join(" ")}>`;if(t.content&&t.content.length>0)if(t.content.length===1)o+=vy(t.content[0],n);else{o+=vy(t.content[0]);for(let i=1;i<t.content.length-1;i++)o+=xy(t.content[i]);o+=xy(t.content[t.content.length-1],n)}else o+=`<w:p w14:paraId="${n}"><w:r><w:rPr><w:rStyle w:val="CommentReference"/></w:rPr><w:annotationRef/></w:r></w:p>`;return o+="</w:comment>",e.push({commentId:t.id,lastParaId:n,durableId:zo(),parentId:t.parentId,done:t.done}),o}function SC(t){if(!t||t.length===0)return{xml:"",paraInfos:[]};let e=[],n=[];for(let i of t)(i.parentId==null?e:n).push(i);let r=[],o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments ${zi} ${Hi}>`;for(let i of e)o+=ky(i,r);for(let i of n)o+=ky(i,r);return o+="</w:comments>",{xml:o,paraInfos:r}}function TC(t){if(t.length===0)return"";let e=new Map;for(let r of t)e.set(r.commentId,r.lastParaId);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w15:commentsEx ${zi} ${Hi}>`;for(let r of t){let o=`w15:paraId="${r.lastParaId}" w15:done="${r.done?"1":"0"}"`;if(r.parentId!=null){let i=e.get(r.parentId);i&&(o+=` w15:paraIdParent="${i}"`)}n+=`<w15:commentEx ${o} />`}return n+="</w15:commentsEx>",n}function $C(t){if(t.length===0)return"";let e=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cid:commentsIds ${zi} ${Hi}>`;for(let n of t)e+=`<w16cid:commentId w16cid:paraId="${n.lastParaId}" w16cid:durableId="${n.durableId}" />`;return e+="</w16cid:commentsIds>",e}function IC(t,e){if(t.length===0)return"";let n=new Map;for(let o of e)n.set(o.id,o);let r=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w16cex:commentsExtensible ${zi} ${Hi}>`;for(let o of t){let i=n.get(o.commentId);if(!i?.date)continue;let l=o.durableId,a=(i.date.endsWith("Z")?i.date:i.date+"Z").replace(/\.\d{3}Z$/,"Z");r+=`<w16cex:commentExtensible w16cex:durableId="${l}" w16cex:dateUtc="${a}"/>`}return r+="</w16cex:commentsExtensible>",r}var MC='<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';function RC(t,e){if(e.verbatimXml)return e.verbatimXml;let n=[];e.noteType&&e.noteType!=="normal"&&n.push(`w:type="${e.noteType}"`),n.push(`w:id="${e.id}"`);let r=e.content.map(o=>wh(o)).join("");return`<w:${t} ${n.join(" ")}>${r}</w:${t}>`}function BW(t){let e=t.map(n=>RC("footnote",n)).join("");return`${MC}<w:footnotes ${zi} ${Hi}>${e}</w:footnotes>`}function OW(t){let e=t.map(n=>RC("endnote",n)).join("");return`${MC}<w:endnotes ${zi} ${Hi}>${e}</w:endnotes>`}var jW=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
43
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`;function Jc(t){return t.startsWith("/")?t.slice(1):`word/${t}`}function zW(t){let e=[{relsPath:"word/_rels/document.xml.rels",blocks:t.package.document.content}],n=a=>(a??[]).flatMap(s=>s.content),r=[...n(t.package.footnoteSeparators),...n(t.package.footnotes)];r.length>0&&e.push({relsPath:"word/_rels/footnotes.xml.rels",blocks:r});let o=[...n(t.package.endnoteSeparators),...n(t.package.endnotes)];o.length>0&&e.push({relsPath:"word/_rels/endnotes.xml.rels",blocks:o});let i=t.package.relationships;if(!i)return e;let l=(a,s)=>{if(a)for(let[c,d]of a.entries()){let u=i.get(c);if(!u||u.type!==s||!u.target)continue;let f=Jc(u.target).replace(/^word\//,"");e.push({relsPath:`word/_rels/${f}.rels`,blocks:d.content})}};return l(t.package.headers,pt.header),l(t.package.footers,pt.footer),e}async function pa(t,e){let n=t.file(e);return(n?await n.async("text"):jW).replace(/<Relationships([^>]*)\/>/,"<Relationships$1></Relationships>")}function _i(t){let e=0;for(let n of t.matchAll(/Id="rId(\d+)"/g)){let r=parseInt(n[1],10);r>e&&(e=r)}return e}function HW(t,e){return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",tif:"image/tiff",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp",wmf:"image/x-wmf",emf:"image/x-emf"}[t]||"application/octet-stream"}function PC(t){let e=[],n=r=>{for(let o of r.content)o.type==="drawing"&&o.image?.src?.startsWith("data:")&&e.push(o.image)};for(let r of t)if(r.type==="paragraph"){for(let o of r.content)if(o.type==="run")n(o);else if(o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo")for(let i of o.content)i.type==="run"&&n(i)}else if(r.type==="table")for(let o of r.rows)for(let i of o.cells)e.push(...PC(i.content));return e}var _W={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif","image/bmp":"bmp","image/tiff":"tiff","image/webp":"webp","image/svg+xml":"svg"};function EC(t){let e=t.match(/^data:([^;]+);base64,(.+)$/);if(!e)throw new Error("Invalid data URL");let n=atob(e[2]),r=new Uint8Array(n.length);for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return{data:r.buffer,extension:_W[e[1]]||"png"}}async function FC(t,e,n){if(e.size===0)return;let r=t.file("[Content_Types].xml");if(!r)return;let o=await r.async("text"),i=!1;for(let l of e)if(!o.includes(`Extension="${l}"`)){let a=HW(l);o=o.replace("</Types>",`<Default Extension="${l}" ContentType="${a}"/></Types>`),i=!0}i&&t.file("[Content_Types].xml",o,{compression:"DEFLATE",compressionOptions:{level:n}})}function AC(t){let e=0;return t.forEach(n=>{let r=n.match(/^word\/media\/image(\d+)\./);if(r){let o=parseInt(r[1],10);o>e&&(e=o)}}),e}async function WW(t,e,n){let r=AC(e),o=new Set;for(let{relsPath:i,blocks:l}of t){let a=PC(l);if(a.length===0)continue;let s=await pa(e,i),c=_i(s),d=[];for(let f of a){let{data:h,extension:p}=EC(f.src);r++,c++;let m=`image${r}.${p}`,y=`rId${c}`;e.file(`word/media/${m}`,h,{compression:"DEFLATE",compressionOptions:{level:n}}),d.push(`<Relationship Id="${y}" Type="${pt.image}" Target="media/${m}"/>`),o.add(p),f.rId=y}let u=s.replace("</Relationships>",d.join("")+"</Relationships>");e.file(i,u,{compression:"DEFLATE",compressionOptions:{level:n}})}await FC(e,o,n)}function Cy(t){return t.replace(/^\.?\/?(?:word\/)?/,"")}function VW(t,e){let n=Cy(e),r=/<Relationship\b[^>]*?>/g,o;for(;(o=r.exec(t))!==null;){let i=o[0],l=/Target="([^"]*)"/.exec(i)?.[1];if(l&&Cy(l)===n)return/Id="([^"]*)"/.exec(i)?.[1]??null}return null}async function qW(t,e,n){let r=t.package.headers,o=t.package.relationships;if(!r||!o)return;let i=new Set,l=new Map,a=AC(e);function s(c){if(c.mediaPath){let d=c.mediaPath.split("/").pop();if(d)return d}if(c.dataUrl&&c.dataUrl.startsWith("data:")){let d=l.get(c.dataUrl);if(d)return d;let{data:u,extension:f}=EC(c.dataUrl);a++;let h=`image${a}.${f}`;return e.file(`word/media/${h}`,u,{compression:"DEFLATE",compressionOptions:{level:n}}),i.add(f),l.set(c.dataUrl,h),h}return null}for(let[c,d]of r.entries()){let u=d.watermark;if(!u||u.kind!=="picture")continue;let f=o.get(c);if(!f?.target)continue;let h=`word/_rels/${Jc(f.target).replace(/^word\//,"")}.rels`,p=await pa(e,h);if(u.relId&&new RegExp(`Id="${u.relId}"`).test(p))continue;let m=s(u);if(!m)continue;let y=`media/${m}`,w=VW(p,y);if(w){u.relId=w;continue}let C=`rId${_i(p)+1}`,g=p.replace("</Relationships>",`<Relationship Id="${C}" Type="${pt.image}" Target="${y}"/></Relationships>`);e.file(h,g,{compression:"DEFLATE",compressionOptions:{level:n}}),u.relId=C}await FC(e,i,n)}function Ef(t){let e=[];for(let n of t)if(n.type==="paragraph")for(let r of n.content)r.type==="hyperlink"&&(r.href||r.rId)&&!r.anchor&&e.push(r);else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)e.push(...Ef(o.content));else n.type==="blockSdt"&&e.push(...Ef(n.content));return e}function ZW(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function KW(t,e){return t.match(new RegExp(`<Relationship\\b(?=[^>]*\\bId="${ZW(e)}")[^>]*/?>`))?.[0]}function DC(t){return!!t&&t.includes(`Type="${pt.hyperlink}"`)&&t.includes('TargetMode="External"')}function UW(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(e,n)=>String.fromCodePoint(Number(n))).replace(/&#x([0-9A-Fa-f]+);/g,(e,n)=>String.fromCodePoint(parseInt(n,16))).replace(/&amp;/g,"&")}function NC(t,e){let n=t?.match(/\bTarget="([^"]*)"/)?.[1];return n!=null&&UW(n)===e}function LC(t,e){return DC(t)&&NC(t,e)}function XW(t,e){for(let n of t.matchAll(/<Relationship\b[^>]*\/?>/g))if(LC(n[0],e))return n[0].match(/\bId="([^"]+)"/)?.[1]}async function GW(t,e,n){for(let{relsPath:r,blocks:o}of t){let i=Ef(o);if(i.length===0)continue;let l=await pa(e,r),a=_i(l),s=[];for(let d of i){let u=d.href,f=d.rId?KW(l,d.rId):void 0;if(!u){f||(d.rId=void 0);continue}if(LC(f,u)||f&&!DC(f)&&NC(f,u))continue;let h=XW(l,u);if(h){d.rId=h;continue}a++;let p=`rId${a}`;s.push(`<Relationship Id="${p}" Type="${pt.hyperlink}" Target="${ge(u)}" TargetMode="External"/>`),d.rId=p}if(s.length===0)continue;let c=l.replace("</Relationships>",s.join("")+"</Relationships>");e.file(r,c,{compression:"DEFLATE",compressionOptions:{level:n}})}}var YW="http://schemas.openxmlformats.org/wordprocessingml/2006/main";function BC(t){let e=[];t.start!==void 0&&e.push(`<w:start w:val="${re(t.start)}"/>`),e.push(`<w:numFmt w:val="${ge(t.numFmt)}"/>`),t.suffix&&e.push(`<w:suff w:val="${t.suffix}"/>`),e.push(`<w:lvlText w:val="${ge(t.lvlText)}"/>`),t.lvlJc&&e.push(`<w:lvlJc w:val="${t.lvlJc}"/>`);let n=t.pPr?tC(t.pPr):"";return n&&e.push(`<w:pPr>${n}</w:pPr>`),`<w:lvl w:ilvl="${re(t.ilvl)}">${e.join("")}</w:lvl>`}function JW(t){let e=[];t.multiLevelType&&e.push(`<w:multiLevelType w:val="${t.multiLevelType}"/>`);let n=[...t.levels].sort((r,o)=>r.ilvl-o.ilvl);for(let r of n)e.push(BC(r));return`<w:abstractNum w:abstractNumId="${re(t.abstractNumId)}">${e.join("")}</w:abstractNum>`}function QW(t){let e=[`<w:abstractNumId w:val="${re(t.abstractNumId)}"/>`];for(let n of t.levelOverrides??[]){let r=[];n.startOverride!==void 0&&r.push(`<w:startOverride w:val="${re(n.startOverride)}"/>`),n.lvl&&r.push(BC(n.lvl)),e.push(`<w:lvlOverride w:ilvl="${re(n.ilvl)}">${r.join("")}</w:lvlOverride>`)}return`<w:num w:numId="${re(t.numId)}">${e.join("")}</w:num>`}function eV(t){let e=t.abstractNums.map(JW).join(""),n=t.nums.map(QW).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
44
+ <w:numbering xmlns:w="${YW}">${e}${n}</w:numbering>`}var tV="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",nV="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",OC="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",jC="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",zC="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",HC="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml",rV="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";async function oV(t,e,n){let r=t.package.relationships;if(!r)return;let o=[];for(let[c,d]of r){if(!d.target)continue;let u=d.type===pt.header?tV:d.type===pt.footer?nV:null;u&&o.push({rId:c,target:d.target.replace(/^(\/?word\/)/,""),contentType:u,relType:d.type})}if(o.length===0)return;let i=e.file("[Content_Types].xml");if(i){let c=await i.async("text"),d=!1;for(let{target:u,contentType:f}of o){let h=`/word/${u}`;c.includes(`PartName="${h}"`)||(c=c.replace("</Types>",`<Override PartName="${h}" ContentType="${f}"/></Types>`),d=!0)}d&&e.file("[Content_Types].xml",c,{compression:"DEFLATE",compressionOptions:{level:n}})}let l="word/_rels/document.xml.rels",a=await pa(e,l),s=!1;for(let{rId:c,relType:d,target:u}of o)a.includes(`Id="${c}"`)||(a=a.replace("</Relationships>",`<Relationship Id="${c}" Type="${d}" Target="${u}"/></Relationships>`),s=!0);s&&e.file(l,a,{compression:"DEFLATE",compressionOptions:{level:n}})}async function iV(t,e,n){let r=t.package.numbering;if(!r||r.abstractNums.length===0&&r.nums.length===0||e.file("word/numbering.xml"))return;e.file("word/numbering.xml",eV(r),{compression:"DEFLATE",compressionOptions:{level:n}});let o=e.file("[Content_Types].xml");if(o){let a=await o.async("text");a.includes('PartName="/word/numbering.xml"')||(a=a.replace("</Types>",`<Override PartName="/word/numbering.xml" ContentType="${rV}"/></Types>`),e.file("[Content_Types].xml",a,{compression:"DEFLATE",compressionOptions:{level:n}}))}let i="word/_rels/document.xml.rels",l=await pa(e,i);if(!l.includes('Target="numbering.xml"')){let a=`rId${_i(l)+1}`;l=l.replace("</Relationships>",`<Relationship Id="${a}" Type="${pt.numbering}" Target="numbering.xml"/></Relationships>`),e.file(i,l,{compression:"DEFLATE",compressionOptions:{level:n}})}}async function lV(t,e){let n=[{partName:"/word/comments.xml",contentType:OC,target:"comments.xml",relType:pt.comments},{partName:"/word/commentsExtended.xml",contentType:jC,target:"commentsExtended.xml",relType:pt.commentsExtended},{partName:"/word/commentsIds.xml",contentType:zC,target:"commentsIds.xml",relType:pt.commentsIds},{partName:"/word/commentsExtensible.xml",contentType:HC,target:"commentsExtensible.xml",relType:pt.commentsExtensible}],r=t.file("[Content_Types].xml");if(r){let l=await r.async("text"),a=!1;for(let{partName:s,contentType:c}of n)l.includes(s)||(l=l.replace("</Types>",`<Override PartName="${s}" ContentType="${c}"/></Types>`),a=!0);a&&t.file("[Content_Types].xml",l,{compression:"DEFLATE",compressionOptions:{level:e}})}let o="word/_rels/document.xml.rels",i=t.file(o);if(i){let l=await i.async("text"),a=!1;for(let{target:s,relType:c}of n)if(!l.includes(s)){let d=`rId${_i(l)+1}`;l=l.replace("</Relationships>",`<Relationship Id="${d}" Type="${c}" Target="${s}"/></Relationships>`),a=!0}a&&t.file(o,l,{compression:"DEFLATE",compressionOptions:{level:e}})}}async function aV(t,e,n){let r=t.package.document.comments;if(!r||r.length===0)return;let{xml:o,paraInfos:i}=SC(r);e.file("word/comments.xml",o,{compression:"DEFLATE",compressionOptions:{level:n}});let l=TC(i);l&&e.file("word/commentsExtended.xml",l,{compression:"DEFLATE",compressionOptions:{level:n}});let a=$C(i);a&&e.file("word/commentsIds.xml",a,{compression:"DEFLATE",compressionOptions:{level:n}});let s=IC(i,r);s&&e.file("word/commentsExtensible.xml",s,{compression:"DEFLATE",compressionOptions:{level:n}}),await lV(e,n)}function sV(t,e,n){let r=t.package.footnotes??[],o=t.package.footnoteSeparators??[];if(r.length===0&&o.length===0)return;let i=BW([...o,...r]);e.file("word/footnotes.xml",i,{compression:"DEFLATE",compressionOptions:{level:n}})}function cV(t,e,n){let r=t.package.endnotes??[],o=t.package.endnoteSeparators??[];if(r.length===0&&o.length===0)return;let i=OW([...o,...r]);e.file("word/endnotes.xml",i,{compression:"DEFLATE",compressionOptions:{level:n}})}function _C(t){let e=new Map,n=t.package.relationships;if(!n)return e;let r=[{map:t.package.headers,type:pt.header},{map:t.package.footers,type:pt.footer}];for(let{map:o,type:i}of r)if(o)for(let[l,a]of o.entries()){let s=n.get(l);s&&s.type===i&&s.target&&e.set(Jc(s.target),LW(a))}return e}function dV(t,e,n){let r={level:n};for(let[o,i]of _C(t))e.file(o,i,{compression:"DEFLATE",compressionOptions:r})}async function uV(){let t=new Ts;t.file("[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
45
+ <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
46
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
47
+ <Default Extension="xml" ContentType="application/xml"/>
48
+ <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
49
+ <Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
50
+ <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
51
+ <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
52
+ </Types>`),t.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
53
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
54
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
55
+ <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
56
+ <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
57
+ </Relationships>`),t.file("word/_rels/document.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
58
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
59
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
60
+ </Relationships>`),t.file("word/document.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
61
+ <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
62
+ <w:body>
63
+ <w:p>
64
+ <w:r>
65
+ <w:t></w:t>
66
+ </w:r>
67
+ </w:p>
68
+ <w:sectPr>
69
+ <w:pgSz w:w="12240" w:h="15840"/>
70
+ <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/>
71
+ </w:sectPr>
72
+ </w:body>
73
+ </w:document>`),t.file("word/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
74
+ <w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
75
+ <w:docDefaults>
76
+ <w:rPrDefault>
77
+ <w:rPr>
78
+ <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
79
+ <w:sz w:val="22"/>
80
+ </w:rPr>
81
+ </w:rPrDefault>
82
+ <w:pPrDefault>
83
+ <w:pPr>
84
+ <w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
85
+ </w:pPr>
86
+ </w:pPrDefault>
87
+ </w:docDefaults>
88
+ <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
89
+ <w:name w:val="Normal"/>
90
+ </w:style>
91
+ </w:styles>`);let e=new Date().toISOString();return t.file("docProps/core.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
92
+ <cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
93
+ <dc:creator>EigenPal DOCX Editor</dc:creator>
94
+ <dcterms:created xsi:type="dcterms:W3CDTF">${e}</dcterms:created>
95
+ <dcterms:modified xsi:type="dcterms:W3CDTF">${e}</dcterms:modified>
96
+ </cp:coreProperties>`),t.file("docProps/app.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
97
+ <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
98
+ <Application>EigenPal DOCX Editor</Application>
99
+ <AppVersion>1.0.0</AppVersion>
100
+ </Properties>`),t.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:6}})}async function WC(t,e={}){if(!t.originalBuffer)throw new Error("Cannot repack document: no original buffer for round-trip. Use createDocx() for new documents.");let{compressionLevel:n=6,updateModifiedDate:r=!0,modifiedBy:o}=e,i=t,l=await Ts.loadAsync(t.originalBuffer),a=new Ts;for(let[d,u]of Object.entries(l.files)){if(u.dir){a.folder(d.replace(/\/$/,""));continue}let f=await u.async("arraybuffer");a.file(d,f,{compression:"DEFLATE",compressionOptions:{level:n}})}let s=zW(i);await WW(s,a,n),await qW(i,a,n),await GW(s,a,n);let c=vC(i);if(a.file("word/document.xml",c,{compression:"DEFLATE",compressionOptions:{level:n}}),dV(i,a,n),await oV(i,a,n),await iV(i,a,n),await aV(i,a,n),sV(i,a,n),cV(i,a,n),r){let d="docProps/core.xml",u=l.file(d);if(u){let f=await u.async("text"),h=VC(f,{updateModifiedDate:r,modifiedBy:o});a.file(d,h,{compression:"DEFLATE",compressionOptions:{level:n}})}}return await a.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:n}})}async function fV(t,e,n={}){let{compressionLevel:r=6}=n;for(let[o,i]of e)t.file(o,i,{compression:"DEFLATE",compressionOptions:{level:r}});return t.generateAsync({type:"arraybuffer",compression:"DEFLATE",compressionOptions:{level:r}})}function VC(t,e){let n=t;if(e.updateModifiedDate){let r=new Date().toISOString();n.includes("<dcterms:modified")?n=n.replace(/<dcterms:modified[^<>]*>[^<]*<\/dcterms:modified>/,`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified>`):n=n.replace("</cp:coreProperties>",`<dcterms:modified xsi:type="dcterms:W3CDTF">${r}</dcterms:modified></cp:coreProperties>`)}return e.modifiedBy&&(n.includes("<cp:lastModifiedBy")?n=n.replace(/<cp:lastModifiedBy>[^<]*<\/cp:lastModifiedBy>/,`<cp:lastModifiedBy>${ge(e.modifiedBy)}</cp:lastModifiedBy>`):n=n.replace("</cp:coreProperties>",`<cp:lastModifiedBy>${ge(e.modifiedBy)}</cp:lastModifiedBy></cp:coreProperties>`)),n}async function pV(t){let e=await uV(),n={...t,originalBuffer:e};return WC(n)}function qC(t,e){let n=yV(e),r=new RegExp(`<w:p[\\s][^>]*w14:paraId="${n}"`,"g"),o=[],i;for(;(i=r.exec(t))!==null;)o.push(i.index);if(o.length===0||o.length>1)return null;let l=o[0],a=l,s=0;for(;a<t.length;){let c=t.indexOf("<",a);if(c===-1)break;if(t.startsWith("<w:p",c)){let d=t[c+4];if(d===">"||d===" "||d==="/"){let u=t.indexOf(">",c);if(u===-1)break;if(t[u-1]==="/"){if(s===0)return{start:l,end:u+1};a=u+1}else s++,a=u+1}else a=c+1}else if(t.startsWith("</w:p>",c)){if(s--,s===0)return{start:l,end:c+6};a=c+6}else a=c+1}return null}function hV(t,e){let n=qC(t,e);return n?t.substring(n.start,n.end):null}function Sy(t){let e=0,n=/<w:p[\s>]/g,r;for(;(r=n.exec(t))!==null;){let o=r.index,i=t[o+4];(i===">"||i===" ")&&e++}return e}function Ty(t){let e=new Map,n=/w14:paraId="([^"]+)"/g,r;for(;(r=n.exec(t))!==null;){let o=r[1];e.set(o,(e.get(o)||0)+1)}return e}function mV(t,e,n){if(n.size===0)return{safe:!0};let r=Ty(t),o=Ty(e);for(let a of n){let s=r.get(a)||0;if(s===0)return{safe:!1,reason:`paraId-not-found-in-original: ${a}`};if(s>1)return{safe:!1,reason:`duplicate-paraId-in-original: ${a}`}}for(let a of n){let s=o.get(a)||0;if(s===0)return{safe:!1,reason:`paraId-not-found-in-serialized: ${a}`};if(s>1)return{safe:!1,reason:`duplicate-paraId-in-serialized: ${a}`}}let i=Sy(t),l=Sy(e);return i!==l?{safe:!1,reason:`paragraph-count-mismatch: original=${i}, serialized=${l}`}:{safe:!0}}function gV(t,e,n){if(n.size===0)return t;if(!mV(t,e,n).safe)return null;let r=[];for(let i of n){let l=qC(t,i);if(!l)return null;let a=hV(e,i);if(!a)return null;r.push({start:l.start,end:l.end,newXml:a})}r.sort((i,l)=>l.start-i.start);let o=t;for(let{start:i,end:l,newXml:a}of r)o=o.substring(0,i)+a+o.substring(l);return o}function yV(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZC(t){let e=n=>n.content.some(r=>r.type==="drawing"&&r.image?.src?.startsWith("data:")&&!r.image?.rId);for(let n of t)if(n.type==="paragraph")for(let r of n.content)if(r.type==="run"){if(e(r))return!0}else{if(r.type==="hyperlink"&&r.href&&!r.rId&&!r.anchor)return!0;if(r.type==="insertion"||r.type==="deletion"||r.type==="moveFrom"||r.type==="moveTo"){for(let o of r.content)if(o.type==="run"&&e(o))return!0}}else if(n.type==="table"){for(let r of n.rows)for(let o of r.cells)if(ZC(o.content))return!0}return!1}async function bV(t,e,n){let{changedParaIds:r,structuralChange:o,hasUntrackedChanges:i}=n;if(o||i||!e)return null;let l=t.package.document.content;if(ZC(l))return null;let a=t.package.document.comments,s=a&&a.length>0,c=_C(t);try{let d=await(await Vn(async()=>{const{default:p}=await import("./index-Bk2iXKnJ.js").then(m=>m.j);return{default:p}},__vite__mapDeps([0,1,2,3,4]))).default.loadAsync(e),u=new Map,f=t.package.relationships;if(f)for(let p of f.values()){if(!p.target||p.type!==pt.header&&p.type!==pt.footer)continue;let m=Jc(p.target).replace(/^\//,"");if(!d.file(m))return null}if(r.size>0){let p=d.file("word/document.xml");if(!p)return null;let m=await p.async("text"),y=vC(t),w=gV(m,y,r);if(!w)return null;u.set("word/document.xml",w)}if(s){let{xml:p,paraInfos:m}=SC(a);u.set("word/comments.xml",p);let y=TC(m);y&&u.set("word/commentsExtended.xml",y);let w=$C(m);w&&u.set("word/commentsIds.xml",w);let C=IC(m,a);C&&u.set("word/commentsExtensible.xml",C);let g=d.file("[Content_Types].xml");if(g){let x=u.get("[Content_Types].xml")??await g.async("text"),T=!1,$=[["/word/comments.xml",OC],["/word/commentsExtended.xml",jC],["/word/commentsIds.xml",zC],["/word/commentsExtensible.xml",HC]];for(let[M,I]of $)x.includes(M)||(x=x.replace("</Types>",`<Override PartName="${M}" ContentType="${I}"/></Types>`),T=!0);T&&u.set("[Content_Types].xml",x)}let v="word/_rels/document.xml.rels",k=d.file(v);if(k){let x=u.get(v)??await k.async("text"),T=!1,$=[["comments.xml",pt.comments],["commentsExtended.xml",pt.commentsExtended],["commentsIds.xml",pt.commentsIds],["commentsExtensible.xml",pt.commentsExtensible]];for(let[M,I]of $)if(!x.includes(M)){let F=_i(x);x=x.replace("</Relationships>",`<Relationship Id="rId${F+1}" Type="${I}" Target="${M}"/></Relationships>`),T=!0}T&&u.set(v,x)}}for(let[p,m]of c)u.set(p,m);let h=d.file("docProps/core.xml");if(h){let p=await h.async("text");u.set("docProps/core.xml",VC(p,{updateModifiedDate:!0}))}return await fV(d,u)}catch{return null}}function wV(t){return xV(t).variables}function xV(t){let e=[],n={body:[],headers:[],footers:[],footnotes:[],endnotes:[],textBoxes:[]};if(t.package?.document){let o=vV(t.package.document);o.forEach(i=>{e.push({name:i,location:"body"})}),n.body=Array.from(new Set(o)).sort()}if(t.package?.document?.sections&&t.package.document.sections.forEach((o,i)=>{o.properties.headerReferences&&o.properties.headerReferences.forEach(l=>{})}),t.package?.footnotes){let o=Iy(t.package.footnotes);o.forEach(i=>{e.push({name:i,location:"footnote"})}),n.footnotes=Array.from(new Set(o)).sort()}if(t.package?.endnotes){let o=Iy(t.package.endnotes);o.forEach(i=>{e.push({name:i,location:"endnote"})}),n.endnotes=Array.from(new Set(o)).sort()}t.templateVariables&&t.templateVariables.forEach(o=>{e.some(i=>i.name===o)||e.push({name:o,location:"body"})});let r=new Set;return e.forEach(o=>r.add(o.name)),{variables:Array.from(r).sort(),totalOccurrences:e.length,byLocation:n,occurrences:e}}function vV(t){let e=[];if(t.content&&e.push(...$y(t.content)),t.sections)for(let n of t.sections)n.content&&e.push(...$y(n.content));return e}function $y(t){let e=[];for(let n of t)n.type==="paragraph"?e.push(...xh(n)):n.type==="table"&&e.push(...KC(n));return e}function xh(t){let e=[];if(!t.content)return e;for(let n of t.content)n.type==="run"?e.push(...Gl(n)):n.type==="hyperlink"?e.push(...kV(n)):n.type==="simpleField"?e.push(...CV(n)):n.type==="complexField"&&e.push(...SV(n));return e}function Gl(t){let e=[];if(!t.content)return e;for(let n of t.content)n.type==="text"&&n.text&&e.push(...UC(n.text));return e}function kV(t){let e=[];if(!t.children)return e;for(let n of t.children)n.type==="run"&&e.push(...Gl(n));return e}function CV(t){let e=[];if(t.instruction&&e.push(...UC(t.instruction)),t.content)for(let n of t.content)n.type==="run"&&e.push(...Gl(n));return e}function SV(t){let e=[];if(t.fieldCode)for(let n of t.fieldCode)n.type==="run"&&e.push(...Gl(n));if(t.fieldResult)for(let n of t.fieldResult)n.type==="run"&&e.push(...Gl(n));return e}function KC(t){let e=[];if(!t.rows)return e;for(let n of t.rows)if(n.cells)for(let r of n.cells)e.push(...TV(r));return e}function TV(t){let e=[];if(!t.content)return e;for(let n of t.content)n.type==="paragraph"?e.push(...xh(n)):n.type==="table"&&e.push(...KC(n));return e}function Iy(t){let e=[];for(let n of t)if(n.content)for(let r of n.content)r.type==="paragraph"&&e.push(...xh(r));return e}var $V=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function UC(t){if(!t)return[];let e=[],n=new RegExp($V),r;for(;(r=n.exec(t))!==null;)e.push(r[1]);return e}var IV=class{constructor(){Ze(this,"plugins",new Map),Ze(this,"commandHandlers",new Map),Ze(this,"eventListeners",new Set),Ze(this,"initialized",new Set)}register(e,n){let r=[];if(!e.id)return{success:!1,error:"Plugin must have an id"};if(this.plugins.has(e.id))return{success:!1,error:`Plugin '${e.id}' is already registered`};if(e.dependencies){for(let o of e.dependencies)if(!this.plugins.has(o))return{success:!1,error:`Plugin '${e.id}' requires '${o}' which is not registered`}}if(e.commandHandlers)for(let[o,i]of Object.entries(e.commandHandlers)){if(this.commandHandlers.has(o)){let l=this.commandHandlers.get(o);r.push(`Command '${o}' from '${e.id}' overrides handler from '${l.pluginId}'`)}this.commandHandlers.set(o,{pluginId:e.id,handler:i})}if(this.plugins.set(e.id,e),e.initialize&&!this.initialized.has(e.id))try{let o=e.initialize();o instanceof Promise?o.then(()=>{this.initialized.add(e.id)}).catch(i=>{this.emit({type:"error",pluginId:e.id,error:i})}):this.initialized.add(e.id)}catch(o){this.emit({type:"error",pluginId:e.id,error:o})}return n?.debug&&console.log(`[PluginRegistry] Registered plugin: ${e.id}`),this.emit({type:"registered",plugin:e}),{success:!0,plugin:e,warnings:r.length>0?r:void 0}}unregister(e){let n=this.plugins.get(e);if(!n)return!1;for(let[r,o]of this.plugins)if(o.dependencies?.includes(e))return console.warn(`Cannot unregister '${e}': '${r}' depends on it`),!1;for(let[r,{pluginId:o}]of this.commandHandlers)o===e&&this.commandHandlers.delete(r);if(n.destroy)try{let r=n.destroy();r instanceof Promise&&r.catch(o=>{this.emit({type:"error",pluginId:e,error:o})})}catch(r){this.emit({type:"error",pluginId:e,error:r})}return this.plugins.delete(e),this.initialized.delete(e),this.emit({type:"unregistered",pluginId:e}),!0}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}get size(){return this.plugins.size}getCommandHandler(e){return this.commandHandlers.get(e)?.handler}getCommandTypes(){return Array.from(this.commandHandlers.keys())}hasCommandHandler(e){return this.commandHandlers.has(e)}getMcpTools(){let e=[];for(let n of this.plugins.values())n.mcpTools&&e.push(...n.mcpTools);return e}getMcpToolsForPlugin(e){return this.plugins.get(e)?.mcpTools||[]}getMcpTool(e){for(let n of this.plugins.values())if(n.mcpTools){let r=n.mcpTools.find(o=>o.name===e);if(r)return r}}addEventListener(e){this.eventListeners.add(e)}removeEventListener(e){this.eventListeners.delete(e)}emit(e){for(let n of this.eventListeners)try{n(e)}catch(r){console.error("[PluginRegistry] Event listener error:",r)}}clear(){for(let e of this.plugins.values())if(e.destroy)try{e.destroy()}catch{}this.plugins.clear(),this.commandHandlers.clear(),this.initialized.clear()}getDebugInfo(){return{plugins:Array.from(this.plugins.keys()),commandTypes:Array.from(this.commandHandlers.keys()),mcpTools:this.getMcpTools().map(e=>e.name),initialized:Array.from(this.initialized)}}},MV=new IV;function pn(t){return JSON.parse(JSON.stringify(t))}function Rt(t,e){let n=0;for(let r=0;r<t.content.length;r++)if(t.content[r].type==="paragraph"){if(n===e)return r;n++}return-1}function ha(t){let e="";for(let n of t.content)if(n.type==="run")for(let r of n.content)r.type==="text"&&(e+=r.text);else if(n.type==="hyperlink"){for(let r of n.children)if(r.type==="run")for(let o of r.content)o.type==="text"&&(e+=o.text)}return e}function ic(t,e){return{type:"run",formatting:e,content:[{type:"text",text:t}]}}function lc(t,e,n,r){let o=[],i=0,l=!1;for(let a of t.content)if(a.type==="run"){let s=a.content.filter(u=>u.type==="text").map(u=>u.text).join(""),c=i,d=i+s.length;if(!l&&e>=c&&e<=d){let u=e-c;u>0&&o.push({...a,content:[{type:"text",text:s.slice(0,u)}]}),o.push(ic(n,r||a.formatting)),u<s.length&&o.push({...a,content:[{type:"text",text:s.slice(u)}]}),l=!0}else o.push(a);i=d}else o.push(a);return l||o.push(ic(n,r)),o}function eo(t,e,n){let r=[],o=0;for(let i of t.content)if(i.type==="run"){let l=i.content.filter(c=>c.type==="text").map(c=>c.text).join(""),a=o,s=o+l.length;if(s<=e||a>=n)r.push(i);else{let c="";a<e&&(c+=l.slice(0,e-a)),s>n&&(c+=l.slice(n-a)),c.length>0&&r.push({...i,content:[{type:"text",text:c}]})}o=s}else r.push(i);return r}function My(t,e,n,r){let o=[],i=0;for(let l of t.content)if(l.type==="run"){let a=l.content.filter(d=>d.type==="text").map(d=>d.text).join(""),s=i,c=i+a.length;if(c<=e||s>=n)o.push(l);else if(s>=e&&c<=n)o.push({...l,formatting:{...l.formatting,...r}});else{let d=Math.max(e,s),u=Math.min(n,c);s<d&&o.push({...l,content:[{type:"text",text:a.slice(0,d-s)}]}),o.push({...l,formatting:{...l.formatting,...r},content:[{type:"text",text:a.slice(d-s,u-s)}]}),c>u&&o.push({...l,content:[{type:"text",text:a.slice(u-s)}]})}i=c}else o.push(l);return o}function RV(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.position.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let i=r.content[o];return i.content=lc(i,e.position.offset,e.text,e.formatting),n}function PV(t,e){let n=pn(t),r=n.package.document,{start:o,end:i}=e.range;if(o.paragraphIndex===i.paragraphIndex){let l=Rt(r,o.paragraphIndex);if(l===-1)throw new Error(`Paragraph index ${o.paragraphIndex} not found`);let a=r.content[l];a.content=eo(a,o.offset,i.offset),a.content=lc(a,o.offset,e.text,e.formatting)}else{let l=Rt(r,o.paragraphIndex),a=r.content[l],s=ha(a);a.content=eo(a,o.offset,s.length),a.content=lc(a,o.offset,e.text,e.formatting);let c=[];for(let d=o.paragraphIndex+1;d<=i.paragraphIndex;d++)c.push(Rt(r,d));for(let d=c.length-1;d>=0;d--)c[d]!==-1&&r.content.splice(c[d],1)}return n}function EV(t,e){let n=pn(t),r=n.package.document,{start:o,end:i}=e.range;if(o.paragraphIndex===i.paragraphIndex){let l=Rt(r,o.paragraphIndex);if(l===-1)throw new Error(`Paragraph index ${o.paragraphIndex} not found`);let a=r.content[l];a.content=eo(a,o.offset,i.offset)}else{let l=Rt(r,o.paragraphIndex),a=r.content[l],s=ha(a);a.content=eo(a,o.offset,s.length);let c=Rt(r,i.paragraphIndex),d=r.content[c];d.content=eo(d,0,i.offset),a.content.push(...d.content);let u=[];for(let f=o.paragraphIndex+1;f<=i.paragraphIndex;f++)u.push(Rt(r,f));for(let f=u.length-1;f>=0;f--)u[f]!==-1&&r.content.splice(u[f],1)}return n}function FV(t,e){let n=pn(t),r=n.package.document,{start:o,end:i}=e.range;if(o.paragraphIndex===i.paragraphIndex){let l=Rt(r,o.paragraphIndex);if(l===-1)throw new Error(`Paragraph index ${o.paragraphIndex} not found`);let a=r.content[l];a.content=My(a,o.offset,i.offset,e.formatting)}else for(let l=o.paragraphIndex;l<=i.paragraphIndex;l++){let a=Rt(r,l);if(a===-1)continue;let s=r.content[a],c=ha(s),d=0,u=c.length;l===o.paragraphIndex&&(d=o.offset),l===i.paragraphIndex&&(u=i.offset),s.content=My(s,d,u,e.formatting)}return n}function AV(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let i=r.content[o];if(i.formatting={...i.formatting,...e.formatting},"numPr"in e.formatting){let l=e.formatting.numPr;if(l&&l.numId!==void 0&&l.numId!==0){let a=l.ilvl??0,s=l.numId===1,c=s?"•":"1.";if(n.package.numbering){let d=n.package.numbering.nums.find(u=>u.numId===l.numId);if(d){let u=n.package.numbering.abstractNums.find(f=>f.abstractNumId===d.abstractNumId);if(u){let f=u.levels.find(h=>h.ilvl===a);f&&(c=f.lvlText||c)}}}i.listRendering={level:a,numId:l.numId,marker:c,isBullet:s}}else delete i.listRendering}return n}function DV(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let i=r.content[o];return i.formatting={...i.formatting,styleId:e.styleId},n}function NV(t,e){let n=pn(t),r=n.package.document,o=mh(9360,e.columns),i=[];for(let d=0;d<e.rows;d++){let u=[];for(let f=0;f<e.columns;f++){let h=e.data?.[d]?.[f]||"";u.push({type:"tableCell",formatting:o[f]?{width:{value:o[f],type:"dxa"}}:void 0,content:[{type:"paragraph",content:h?[ic(h)]:[]}]})}i.push({type:"tableRow",formatting:d===0&&e.hasHeader?{header:!0}:void 0,cells:u})}let l=ia(n.package.styles),a=f1(n.package.settings?.defaultTableStyle,l),s={type:"table",formatting:{width:{value:9360,type:"dxa"},layout:"fixed",...a?{styleId:a,look:{...u1}}:{}},columnWidths:o,rows:i},c=Rt(r,e.position.paragraphIndex);return c===-1?r.content.push(s):r.content.splice(c+1,0,s),n}function LV(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.position.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let i=r.content[o],l={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:e.src,alt:e.alt,size:{width:He(e.width||100),height:He(e.height||100)},wrap:{type:"inline"}}}]},a=lc(i,e.position.offset,"",void 0),s=!1,c=0;for(let d=0;d<a.length;d++){let u=a[d];if(u.type==="run"){let f=u.content.filter(h=>h.type==="text").map(h=>h.text).join("");if(c+=f.length,!s&&c>=e.position.offset){a.splice(d+1,0,l),s=!0;break}}}return s||a.push(l),i.content=a,n}function BV(t,e){let n=pn(t),r=n.package.document,{start:o,end:i}=e.range;if(o.paragraphIndex!==i.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let l=Rt(r,o.paragraphIndex);if(l===-1)throw new Error(`Paragraph index ${o.paragraphIndex} not found`);let a=r.content[l],s=ha(a),c=e.displayText||s.slice(o.offset,i.offset);a.content=eo(a,o.offset,i.offset);let d={type:"hyperlink",href:e.url,tooltip:e.tooltip,children:[ic(c)]},u=!1,f=0,h=[];for(let p of a.content)if(p.type==="run"){let m=p.content.filter(w=>w.type==="text").map(w=>w.text).join(""),y=f+m.length;if(!u&&f<=o.offset&&o.offset<=y){let w=o.offset-f;w>0&&h.push({...p,content:[{type:"text",text:m.slice(0,w)}]}),h.push(d),w<m.length&&h.push({...p,content:[{type:"text",text:m.slice(w)}]}),u=!0}else h.push(p);f=y}else h.push(p);return u||h.push(d),a.content=h,n}function OV(t,e){let n=pn(t),r=n.package.document,{start:o}=e.range,i=Rt(r,o.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${o.paragraphIndex} not found`);let l=r.content[i],a=[];for(let s of l.content)if(s.type==="hyperlink")for(let c of s.children)c.type==="run"&&a.push(c);else a.push(s);return l.content=a,n}function XC(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.position.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let i=r.content[o],l=ha(i),a=eo({...i,content:[...i.content]},e.position.offset,l.length),s=eo({...i,content:[...i.content]},0,e.position.offset);i.content=a;let c={type:"paragraph",formatting:i.formatting,content:s};return r.content.splice(o+1,0,c),n}function jV(t,e){let n=pn(t),r=n.package.document,o=Rt(r,e.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let i=r.content[o],l=[];for(let a=1;a<=e.count;a++){let s=Rt(r,e.paragraphIndex+a);if(s!==-1){let c=r.content[s];i.content.push(...c.content),l.push(s)}}for(let a=l.length-1;a>=0;a--)r.content.splice(l[a],1);return n}function zV(t,e){return XC(t,{position:e.position})}function HV(t,e){let n=pn(t);return n.templateVariables||(n.templateVariables=[]),n.templateVariables.includes(e.name)||n.templateVariables.push(e.name),n}function _V(t,e){let n=pn(t),r=n.package.document;function o(a){for(let s of a.content)if(s.type==="text")for(let[c,d]of Object.entries(e.values)){let u=new RegExp(`\\{${c}\\}`,"g");s.text=s.text.replace(u,d)}}function i(a){for(let s of a.content)if(s.type==="run")o(s);else if(s.type==="hyperlink")for(let c of s.children)c.type==="run"&&o(c)}function l(a){if(a.type==="paragraph")i(a);else if(a.type==="table")for(let s of a.rows)for(let c of s.cells)for(let d of c.content)l(d)}for(let a of r.content)l(a);return n}function GC(t,e){let n=MV.getCommandHandler(e.type);if(n)return n(t,e);switch(e.type){case"insertText":return RV(t,e);case"replaceText":return PV(t,e);case"deleteText":return EV(t,e);case"formatText":return FV(t,e);case"formatParagraph":return AV(t,e);case"applyStyle":return DV(t,e);case"insertTable":return NV(t,e);case"insertImage":return LV(t,e);case"insertHyperlink":return BV(t,e);case"removeHyperlink":return OV(t,e);case"insertParagraphBreak":return XC(t,e);case"mergeParagraphs":return jV(t,e);case"splitParagraph":return zV(t,e);case"setVariable":return HV(t,e);case"applyVariables":return _V(t,e);default:{let r=e;throw new Error(`Unknown command type: ${r.type}`)}}}function WV(t,e){return e.reduce((n,r)=>GC(n,r),t)}async function VV(t){let e=await Ts.loadAsync(t),n={documentXml:null,stylesXml:null,themeXml:null,numberingXml:null,fontTableXml:null,settingsXml:null,webSettingsXml:null,headers:new Map,footers:new Map,footnotesXml:null,endnotesXml:null,commentsXml:null,commentsExtensibleXml:null,commentsExtendedXml:null,documentRels:null,packageRels:null,contentTypesXml:null,corePropsXml:null,appPropsXml:null,customPropsXml:null,media:new Map,fonts:new Map,allXml:new Map,originalZip:e,originalBuffer:t};for(let[r,o]of Object.entries(e.files)){if(o.dir)continue;let i=r.toLowerCase();if(i.endsWith(".xml")||i.endsWith(".rels")){let l=await o.async("text");if(n.allXml.set(r,l),i==="word/document.xml")n.documentXml=l;else if(i==="word/styles.xml")n.stylesXml=l;else if(i==="word/theme/theme1.xml")n.themeXml=l;else if(i==="word/numbering.xml")n.numberingXml=l;else if(i==="word/fonttable.xml")n.fontTableXml=l;else if(i==="word/settings.xml")n.settingsXml=l;else if(i==="word/websettings.xml")n.webSettingsXml=l;else if(i==="word/footnotes.xml")n.footnotesXml=l;else if(i==="word/endnotes.xml")n.endnotesXml=l;else if(i==="word/comments.xml")n.commentsXml=l;else if(i==="word/commentsextensible.xml")n.commentsExtensibleXml=l;else if(i==="word/commentsextended.xml")n.commentsExtendedXml=l;else if(i==="word/_rels/document.xml.rels")n.documentRels=l;else if(i==="_rels/.rels")n.packageRels=l;else if(i==="[content_types].xml")n.contentTypesXml=l;else if(i==="docprops/core.xml")n.corePropsXml=l;else if(i==="docprops/app.xml")n.appPropsXml=l;else if(i==="docprops/custom.xml")n.customPropsXml=l;else if(i.match(/^word\/header\d+\.xml$/)){let a=r.split("/").pop()||r;n.headers.set(a,l)}else if(i.match(/^word\/footer\d+\.xml$/)){let a=r.split("/").pop()||r;n.footers.set(a,l)}}else if(i.startsWith("word/media/")){let l=await o.async("arraybuffer");n.media.set(r,l)}else if(i.startsWith("word/fonts/")){let l=await o.async("arraybuffer");n.fonts.set(r,l)}}return n}function qV(t){switch(t.toLowerCase().split(".").pop()){case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tif":case"tiff":return"image/tiff";case"wmf":return"image/x-wmf";case"emf":return"image/x-emf";case"svg":return"image/svg+xml";case"webp":return"image/webp";default:return"application/octet-stream"}}function ZV(t){if(!t)return;let e=ht(t,"w","tab");if(e.length===0)return;let n=[];for(let r of e){let o=J(r,"w","pos"),i=D(r,"w","val");if(o!==void 0&&i){let l={position:o,alignment:i},a=D(r,"w","leader");a&&(l.leader=a),n.push(l)}}return n.length>0?n:void 0}function Ff(t,e){if(!t)return;let n={},r=L(t,"w","jc");if(r){let k=D(r,"w","val");k&&(n.alignment=k)}let o=L(t,"w","bidi");o&&(n.bidi=fe(o));let i=L(t,"w","spacing");if(i){let k=J(i,"w","before");k!==void 0&&(n.spaceBefore=k);let x=J(i,"w","after");x!==void 0&&(n.spaceAfter=x);let T=J(i,"w","line");T!==void 0&&(n.lineSpacing=T);let $=D(i,"w","lineRule");$&&(n.lineSpacingRule=$);let M=D(i,"w","beforeAutospacing");M&&(n.beforeAutospacing=M==="1"||M==="true");let I=D(i,"w","afterAutospacing");I&&(n.afterAutospacing=I==="1"||I==="true")}let l=L(t,"w","ind");if(l){let k=J(l,"w","left");k!==void 0&&(n.indentLeft=k);let x=J(l,"w","right");x!==void 0&&(n.indentRight=x);let T=J(l,"w","firstLine");T!==void 0&&(n.indentFirstLine=T);let $=J(l,"w","hanging");$!==void 0&&(n.indentFirstLine=-$,n.hangingIndent=!0)}let a=Gx(L(t,"w","pBdr"));a&&(n.borders=a);let s=L(t,"w","shd");s&&(n.shading=Dc(s));let c=L(t,"w","tabs");c&&(n.tabs=ZV(c));let d=L(t,"w","keepNext");d&&(n.keepNext=fe(d));let u=L(t,"w","keepLines");u&&(n.keepLines=fe(u));let f=L(t,"w","widowControl");f&&(n.widowControl=fe(f));let h=L(t,"w","pageBreakBefore");h&&(n.pageBreakBefore=fe(h));let p=L(t,"w","contextualSpacing");p&&(n.contextualSpacing=fe(p));let m=L(t,"w","numPr");if(m){let k=L(m,"w","numId"),x=L(m,"w","ilvl");if(k||x){if(n.numPr={},k){let T=J(k,"w","val");T!==void 0&&(n.numPr.numId=T)}if(x){let T=J(x,"w","val");T!==void 0&&(n.numPr.ilvl=T)}}}let y=L(t,"w","outlineLvl");if(y){let k=J(y,"w","val");k!==void 0&&(n.outlineLevel=k)}let w=L(t,"w","pStyle");if(w){let k=D(w,"w","val");k&&(n.styleId=k)}let C=L(t,"w","suppressLineNumbers");C&&(n.suppressLineNumbers=fe(C));let g=L(t,"w","suppressAutoHyphens");g&&(n.suppressAutoHyphens=fe(g));let v=L(t,"w","rPr");return v&&(n.runProperties=js(v,e)),Object.keys(n).length>0?n:void 0}function br(t){if(!t)return;let e=J(t,"w","w"),n=D(t,"w","type");if(e!==void 0&&n)return{value:e,type:n}}function YC(t){if(!t)return;let e={},n=br(L(t,"w","top"));n&&(e.top=n);let r=br(L(t,"w","bottom"));r&&(e.bottom=r);let o=br(L(t,"w","left"));o&&(e.left=o);let i=br(L(t,"w","right"));return i&&(e.right=i),Object.keys(e).length>0?e:void 0}function KV(t){if(!t)return;let e={},n=D(t,"w","val");if(n){let c=parseInt(n,16);isNaN(c)||(e.firstRow=(c&32)!==0,e.lastRow=(c&64)!==0,e.firstColumn=(c&128)!==0,e.lastColumn=(c&256)!==0,e.noHBand=(c&512)!==0,e.noVBand=(c&1024)!==0)}let r=D(t,"w","firstColumn");r&&(e.firstColumn=r==="1");let o=D(t,"w","firstRow");o&&(e.firstRow=o==="1");let i=D(t,"w","lastColumn");i&&(e.lastColumn=i==="1");let l=D(t,"w","lastRow");l&&(e.lastRow=l==="1");let a=D(t,"w","noHBand");a&&(e.noHBand=a==="1");let s=D(t,"w","noVBand");return s&&(e.noVBand=s==="1"),Object.keys(e).length>0?e:void 0}function Ry(t,e){if(!t)return;let n={},r=L(t,"w","tblW");r&&(n.width=br(r));let o=L(t,"w","jc");if(o){let p=D(o,"w","val");(p==="left"||p==="center"||p==="right")&&(n.justification=p)}let i=L(t,"w","tblCellSpacing");i&&(n.cellSpacing=br(i));let l=L(t,"w","tblInd");l&&(n.indent=br(l));let a=L(t,"w","tblBorders");a&&(n.borders=Nc(a));let s=L(t,"w","tblCellMar");s&&(n.cellMargins=YC(s));let c=L(t,"w","tblLayout");if(c){let p=D(c,"w","type");(p==="fixed"||p==="autofit")&&(n.layout=p)}let d=L(t,"w","tblStyle");if(d){let p=D(d,"w","val");p&&(n.styleId=p)}let u=L(t,"w","tblLook");u&&(n.look=KV(u));let f=L(t,"w","shd");f&&(n.shading=Dc(f));let h=L(t,"w","bidiVisual");return h&&(n.bidi=fe(h)),Object.keys(n).length>0?n:void 0}function Py(t){if(!t)return;let e={},n=L(t,"w","trHeight");if(n){e.height=br(n);let a=D(n,"w","hRule");a&&(e.heightRule=a)}let r=L(t,"w","tblHeader");r&&(e.header=fe(r));let o=L(t,"w","cantSplit");o&&(e.cantSplit=fe(o));let i=L(t,"w","jc");if(i){let a=D(i,"w","val");(a==="left"||a==="center"||a==="right")&&(e.justification=a)}let l=L(t,"w","hidden");return l&&(e.hidden=fe(l)),Object.keys(e).length>0?e:void 0}function Ey(t,e){if(!t)return;let n={},r=L(t,"w","tcW");r&&(n.width=br(r));let o=L(t,"w","tcBorders");o&&(n.borders=Nc(o));let i=L(t,"w","tcMar");i&&(n.margins=YC(i));let l=L(t,"w","shd");l&&(n.shading=Dc(l));let a=L(t,"w","vAlign");if(a){let p=D(a,"w","val");(p==="top"||p==="center"||p==="bottom")&&(n.verticalAlign=p)}let s=L(t,"w","textDirection");if(s){let p=D(s,"w","val");p&&(n.textDirection=p)}let c=L(t,"w","gridSpan");if(c){let p=J(c,"w","val");p!==void 0&&(n.gridSpan=p)}let d=L(t,"w","vMerge");if(d){let p=D(d,"w","val");n.vMerge=p==="restart"?"restart":"continue"}let u=L(t,"w","tcFitText");u&&(n.fitText=fe(u));let f=L(t,"w","noWrap");f&&(n.noWrap=fe(f));let h=L(t,"w","hideMark");return h&&(n.hideMark=fe(h)),Object.keys(n).length>0?n:void 0}function UV(t,e){let n={styleId:D(t,"w","styleId")??"",type:D(t,"w","type")??"paragraph"},r=D(t,"w","default");r&&(n.default=r==="1"||r==="true");let o=L(t,"w","name");o&&(n.name=D(o,"w","val")??void 0);let i=L(t,"w","basedOn");i&&(n.basedOn=D(i,"w","val")??void 0);let l=L(t,"w","next");l&&(n.next=D(l,"w","val")??void 0);let a=L(t,"w","link");a&&(n.link=D(a,"w","val")??void 0);let s=L(t,"w","uiPriority");if(s){let v=J(s,"w","val");v!==void 0&&(n.uiPriority=v)}let c=L(t,"w","hidden");c&&(n.hidden=fe(c));let d=L(t,"w","semiHidden");d&&(n.semiHidden=fe(d));let u=L(t,"w","unhideWhenUsed");u&&(n.unhideWhenUsed=fe(u));let f=L(t,"w","qFormat");f&&(n.qFormat=fe(f));let h=L(t,"w","personal");h&&(n.personal=fe(h));let p=L(t,"w","pPr");p&&(n.pPr=Ff(p,e));let m=L(t,"w","rPr");m&&(n.rPr=js(m,e));let y=L(t,"w","tblPr");y&&(n.tblPr=Ry(y));let w=L(t,"w","trPr");w&&(n.trPr=Py(w));let C=L(t,"w","tcPr");C&&(n.tcPr=Ey(C));let g=ht(t,"w","tblStylePr");if(g.length>0){n.tblStylePr=[];for(let v of g){let k=D(v,"w","type");if(k){let x={type:k},T=L(v,"w","pPr");T&&(x.pPr=Ff(T,e));let $=L(v,"w","rPr");$&&(x.rPr=js($,e));let M=L(v,"w","tblPr");M&&(x.tblPr=Ry(M));let I=L(v,"w","trPr");I&&(x.trPr=Py(I));let F=L(v,"w","tcPr");F&&(x.tcPr=Ey(F)),n.tblStylePr.push(x)}}}return n}function XV(t,e){if(!t)return;let n={},r=L(t,"w","rPrDefault");if(r){let i=L(r,"w","rPr");i&&(n.rPr=js(i,e))}let o=L(t,"w","pPrDefault");if(o){let i=L(o,"w","pPr");i&&(n.pPr=Ff(i,e))}return n.rPr||n.pPr?n:void 0}function GV(t,e){if(!e)return t;if(!t)return e?{...e}:void 0;let n={...t};for(let r of Object.keys(e)){let o=e[r];if(o!==void 0)if(r==="runProperties")n.runProperties=dn(n.runProperties,e.runProperties);else if(r==="borders"||r==="numPr"||r==="frame"){let i=n[r],l=o;n[r]={...i||{},...l||{}}}else r==="tabs"&&Array.isArray(o)?n.tabs=[...o]:n[r]=o}return n}function JC(t,e,n,r=new Set){if(r.has(t.styleId)||(r.add(t.styleId),!t.basedOn))return t;let o=e.get(t.basedOn);if(!o)return t;let i=JC(o,e,n,r),l={...t,pPr:GV(i.pPr,t.pPr),rPr:dn(i.rPr,t.rPr)};return t.type==="table"&&((i.tblPr||t.tblPr)&&(l.tblPr={...i.tblPr||{},...t.tblPr||{}}),(i.trPr||t.trPr)&&(l.trPr={...i.trPr||{},...t.trPr||{}}),(i.tcPr||t.tcPr)&&(l.tcPr={...i.tcPr||{},...t.tcPr||{}})),l}function QC(t,e){let n=new Map;try{let r=Go(t);if(!r)return n;let o=ht(r,"w","style");for(let i of o){let l=UV(i,e);l.styleId&&n.set(l.styleId,l)}for(let[i,l]of n){let a=JC(l,n,e);n.set(i,a)}}catch(r){console.warn("Failed to parse styles:",r)}return n}function YV(t,e){let n={styles:[]};try{let r=Go(t);if(!r)return n;let o=L(r,"w","docDefaults");n.docDefaults=XV(o,e);let i=L(r,"w","latentStyles");i&&(n.latentStyles={defLockedState:D(i,"w","defLockedState")==="1",defUIPriority:J(i,"w","defUIPriority"),defSemiHidden:D(i,"w","defSemiHidden")==="1",defUnhideWhenUsed:D(i,"w","defUnhideWhenUsed")==="1",defQFormat:D(i,"w","defQFormat")==="1",count:J(i,"w","count")});let l=QC(t,e);n.styles=Array.from(l.values())}catch(r){console.warn("Failed to parse style definitions:",r)}return n}var Fy=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g;function eS(t){let e=[],n;for(Fy.lastIndex=0;(n=Fy.exec(t))!==null;){let r=n[1].trim();r&&!e.includes(r)&&e.push(r)}return e}function JV(t){let e=[];for(let n of t)if(n.type==="paragraph"){let r=fv(n),o=eS(r);for(let i of o)e.includes(i)||e.push(i)}else if(n.type==="table"){let r=tS(n);for(let o of r)e.includes(o)||e.push(o)}return e}function tS(t){let e=[];for(let n of t.rows)for(let r of n.cells)for(let o of r.content)if(o.type==="paragraph"){let i=fv(o),l=eS(i);for(let a of l)e.includes(a)||e.push(a)}else if(o.type==="table"){let i=tS(o);for(let l of i)e.includes(l)||e.push(l)}return e}function QV(t,e){let n=[],r=[];for(let o of t)r.push(o),o.type==="paragraph"&&o.sectionProperties&&(n.push({properties:o.sectionProperties,content:r}),r=[]);return(r.length>0||n.length===0)&&n.push({properties:e??qD(),content:r}),n}function eq(t,e=null,n=null,r=null,o=null,i=null){let l={content:[]};if(!t)return l;let a=Tr(t);if(!a)return l;let s=(a.elements??[]).find(f=>f.type==="element"&&(f.name==="w:document"||f.name?.endsWith(":document")));if(!s)return l;let c=L(s,"w","body");if(!c)return l;l.content=na(c,e,n,r,o,i);let d=L(c,"w","sectPr");d&&(l.finalSectionProperties=av(d));let u=QV(l.content,l.finalSectionProperties);return l.sections=ZD(u),l.finalSectionProperties&&l.sections.length>0&&(l.finalSectionProperties=l.sections[l.sections.length-1].properties),l}function tq(t){let e=new Map,n=Tr(t);if(!n)return e;let r=L(n,"w16cex","commentsExtensible")??n;for(let o of je(r)){if((o.name?.replace(/^.*:/,"")??"")!=="comment")continue;let i=D(o,"w16cex","paraId")??D(o,"w15","paraId")??o.attributes?.["w16cex:paraId"]??o.attributes?.["w15:paraId"],l=D(o,"w16cex","dateUtc")??D(o,"w15","dateUtc")??o.attributes?.["w16cex:dateUtc"]??o.attributes?.["w15:dateUtc"];i&&l&&e.set(String(i).toUpperCase(),String(l))}return e}function nq(t){let e=new Map,n=new Map,r=Tr(t);if(!r)return{parentByParaId:e,doneByParaId:n};let o=L(r,"w15","commentsEx")??r;for(let i of je(o)){if((i.name?.replace(/^.*:/,"")??"")!=="commentEx")continue;let l=D(i,"w15","paraId")??i.attributes?.["w15:paraId"],a=D(i,"w15","paraIdParent")??i.attributes?.["w15:paraIdParent"],s=D(i,"w15","done")??i.attributes?.["w15:done"];if(l){let c=String(l).toUpperCase();a&&e.set(c,String(a).toUpperCase()),s==="1"&&n.set(c,!0)}}return{parentByParaId:e,doneByParaId:n}}function rq(t,e,n,r,o,i,l){if(!t)return[];let a=Tr(t);if(!a)return[];let s=i?tq(i):new Map,c=l?nq(l):null,d=L(a,"w","comments")??a,u=je(d),f=[],h=[];for(let p of u){if((p.name?.replace(/^.*:/,"")??"")!=="comment")continue;let m=parseInt(D(p,"w","id")??"0",10),y=D(p,"w","author")??"Unknown",w=D(p,"w","initials"),C=w!=null?String(w):void 0,g=D(p,"w","date"),v=g!=null?String(g):void 0,k=D(p,"w14","paraId")??p.attributes?.["w14:paraId"]??D(p,"w","paraId"),x=(k?s.get(String(k).toUpperCase()):void 0)??v,T=D(p,"w","done")??p.attributes?.["w:done"],$=T==="1"||T==="true"?!0:void 0,M=D(p,"w16cid","parentId")??D(p,"w","parentId")??p.attributes?.["w16cid:parentId"]??p.attributes?.["w:parentId"],I=M!=null?parseInt(String(M),10):void 0,F=[],E="";for(let R of je(p))if((R.name?.replace(/^.*:/,"")??"")==="p"){let N=Lc(R,e,n,null,r,o);F.push(N);let B=D(R,"w14","paraId")??R.attributes?.["w14:paraId"];B&&(E=String(B).toUpperCase())}$==null&&c&&E&&c.doneByParaId.get(E)&&($=!0),h.push(E),f.push({id:m,author:y,initials:C,date:x,content:F,...$!=null?{done:$}:{},...I!=null&&!isNaN(I)?{parentId:I}:{}})}if(c&&c.parentByParaId.size>0){let p=new Map;for(let m=0;m<f.length;m++){let y=h[m];y&&p.set(y,f[m].id)}for(let m=0;m<f.length;m++){if(f[m].parentId!=null)continue;let y=h[m];if(!y)continue;let w=c.parentByParaId.get(y);if(!w)continue;let C=p.get(w);C!=null&&(f[m]={...f[m],parentId:C})}}return f}function ur(t,e){if(t)for(let n of t)if(n.type==="paragraph")n.content=n.content.filter(r=>r.type!=="commentRangeStart"&&r.type!=="commentRangeEnd"||e.has(r.id));else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)ur(o.content,e);else n.type==="blockSdt"&&ur(n.content,e)}function oq(t){let e=t.package,n=new Set((e.document.comments??[]).map(r=>r.id));ur(e.document.content,n);for(let r of e.headers?.values()??[])ur(r.content,n);for(let r of e.footers?.values()??[])ur(r.content,n);for(let r of e.footnotes??[])ur(r.content,n);for(let r of e.endnotes??[])ur(r.content,n);for(let r of e.footnoteSeparators??[])ur(r.content,n);for(let r of e.endnoteSeparators??[])ur(r.content,n)}function iq(t){let e=zo();for(;t.has(e)||!qx(e);)e=zo();return e}function lq(t,e){t.paraId!=null&&(e.has(t.paraId)&&(t.paraId=iq(e)),e.add(t.paraId))}function fr(t,e){if(t)for(let n of t)if(n.type==="paragraph")lq(n,e);else if(n.type==="table")for(let r of n.rows)for(let o of r.cells)fr(o.content,e);else n.type==="blockSdt"&&fr(n.content,e)}function aq(t){let e=t.package,n=new Set;fr(e.document.content,n);for(let r of e.headers?.values()??[])fr(r.content,n);for(let r of e.footers?.values()??[])fr(r.content,n);for(let r of e.footnotes??[])fr(r.content,n);for(let r of e.endnotes??[])fr(r.content,n);for(let r of e.footnoteSeparators??[])fr(r.content,n);for(let r of e.endnoteSeparators??[])fr(r.content,n)}var sq=new Set(["decorative","modern","roman","script","swiss","auto"]),cq=new Set(["default","fixed","variable"]);function ts(t,e){let n=L(t,"w",e);if(!n)return;let r=D(n,"r","id");if(!r)return;let o={relId:r},i=D(n,"w","fontKey");i&&(o.fontKey=i);let l=D(n,"w","subsetted");return(l==="true"||l==="1")&&(o.subsetted=!0),o}function dq(t){let e=D(t,"w","name");if(!e)return null;let n={name:e},r=L(t,"w","altName");if(r){let f=D(r,"w","val");f&&(n.altName=f)}let o=L(t,"w","family");if(o){let f=D(o,"w","val");f&&sq.has(f)&&(n.family=f)}let i=L(t,"w","pitch");if(i){let f=D(i,"w","val");f&&cq.has(f)&&(n.pitch=f)}let l=L(t,"w","charset");if(l){let f=D(l,"w","val");f&&(n.charset=f)}let a=L(t,"w","panose1");if(a){let f=D(a,"w","val");f&&(n.panose1=f)}let s=ts(t,"embedRegular");s&&(n.embedRegular=s);let c=ts(t,"embedBold");c&&(n.embedBold=c);let d=ts(t,"embedItalic");d&&(n.embedItalic=d);let u=ts(t,"embedBoldItalic");return u&&(n.embedBoldItalic=u),n}function uq(t){if(!t||t.trim().length===0)return{fonts:[]};let e=Go(t);if(!e)return console.warn("Failed to parse fontTable.xml"),{fonts:[]};let n=[];for(let r of ht(e,"w","font")){let o=dq(r);o&&n.push(o)}return{fonts:n}}async function Af(t,e={}){let n=t instanceof ArrayBuffer?t:await pI(t),{onProgress:r=()=>{},preloadFonts:o=!0,parseHeadersFooters:i=!0,parseNotes:l=!0,detectVariables:a=!0}=e,s=[];try{let d=function(z,W){let q=performance.now(),Q=W(),X=performance.now()-q;return f.push({stage:z,ms:X}),X>1e3&&console.warn(`[parseDocx] ${z} took ${Math.round(X)}ms`),Q};var c=d;let u=performance.now(),f=[];async function h(z,W){let q=performance.now(),Q=await W(),X=performance.now()-q;return f.push({stage:z,ms:X}),X>1e3&&console.warn(`[parseDocx] ${z} took ${Math.round(X)}ms`),Q}r("Extracting DOCX...",0);let p=await h("unzip",()=>VV(n));r("Extracted DOCX",10),r("Parsing relationships...",10);let m=d("relationships",()=>p.documentRels?$s(p.documentRels):new Map);r("Parsed relationships",15),r("Parsing theme...",15);let y=d("theme",()=>cD(p.themeXml)),w=d("settings",()=>oN(p.settingsXml));fD(y,w.themeFontLang),r("Parsed theme",20),r("Parsing styles...",20);let C=null,g;d("styles",()=>{p.stylesXml&&(C=QC(p.stylesXml,y),g=YV(p.stylesXml,y))}),r("Parsed styles",30);let v=d("fontTable",()=>uq(p.fontTableXml));r("Parsing numbering...",30);let k=d("numbering",()=>G5(p.numberingXml));r("Parsed numbering",35),r("Processing media files...",35);let x=d("media",()=>pq(p,m));r("Processed media",40),r("Parsing document body...",40);let T={content:[]};d("documentBody",()=>{p.documentXml?T=eq(p.documentXml,C,y,k,m,x):s.push("No document.xml found in DOCX")}),r("Parsed document body",55);let $,M;if(i){r("Parsing headers/footers...",55);let z=d("headersFooters",()=>hq(p,C,y,k,m,x));$=z.headers,M=z.footers,r("Parsed headers/footers",65)}else r("Skipping headers/footers",65);let I,F,E,R;if(l){r("Parsing footnotes/endnotes...",65);let z=d("footnotesEndnotes",()=>mq(p,C,y,k,m,x));I=z.footnotes,F=z.endnotes,E=z.footnoteSeparators,R=z.endnoteSeparators,r("Parsed footnotes/endnotes",75)}else r("Skipping footnotes/endnotes",75);r("Parsing comments...",75);let N=d("comments",()=>rq(p.commentsXml,C,y,m,x,p.commentsExtensibleXml,p.commentsExtendedXml));N.length>0&&(T.comments=N);let B;a?(r("Detecting template variables...",75),B=d("variables",()=>JV(T.content)),r("Detected variables",80)):r("Skipping variable detection",80),o?(r("Loading fonts...",80),await h("fonts",()=>gq(y,g,T)),await h("embeddedFonts",()=>fI(v,p.fonts,fq(p))),r("Loaded fonts",95)):r("Skipping font loading",95),r("Assembling document...",95);let j={package:{document:T,styles:g,theme:y,numbering:k.definitions,settings:w,fontTable:v,headers:$,footers:M,footnotes:I,endnotes:F,footnoteSeparators:E,endnoteSeparators:R,relationships:m,media:x},originalBuffer:n,templateVariables:B,warnings:s.length>0?s:void 0};oq(j),aq(j);let O=performance.now()-u;if(O>2e3){let z=f.filter(W=>W.ms>100).map(W=>`${W.stage}: ${Math.round(W.ms)}ms`).join(", ");console.warn(`[parseDocx] Total: ${Math.round(O)}ms`+(z?` (${z})`:""))}return r("Complete",100),j}catch(d){let u=d instanceof Error?d.message:String(d);throw console.error("[parseDocx] Failed to parse DOCX:",u,d),new Error(`Failed to parse DOCX: ${u}`)}}function fq(t){for(let[e,n]of t.allXml)if(e.toLowerCase()==="word/_rels/fonttable.xml.rels")return n;return null}function pq(t,e){let n=new Map;for(let[r,o]of t.media.entries()){let i=r.split("/").pop()||r,l=qV(r),a=new Uint8Array(o),s="";for(let h=0;h<a.length;h++)s+=String.fromCharCode(a[h]);let c=btoa(s),d=`data:${l};base64,${c}`,u={path:r,filename:i,mimeType:l,data:o,dataUrl:d};n.set(r,u);let f=r.replace(/^word\//,"");f!==r&&n.set(f,u)}return n}function ns(t,e){let n=e.toLowerCase();for(let[r,o]of t.entries())if(r.toLowerCase()===n)return o}function hq(t,e,n,r,o,i){let l=new Map,a=new Map;for(let[s,c]of o.entries())if(c.type===pt.header&&c.target){let d=c.target.split("/").pop()||c.target,u=ns(t.headers,d);if(u){let f=`word/_rels/${d}.rels`,h=ns(t.allXml,f),p=h?$s(h):o,m=MD(u,"default",e,n,r,p,i);l.set(s,m)}}else if(c.type===pt.footer&&c.target){let d=c.target.split("/").pop()||c.target,u=ns(t.footers,d);if(u){let f=`word/_rels/${d}.rels`,h=ns(t.allXml,f),p=h?$s(h):o,m=RD(u,"default",e,n,r,p,i);a.set(s,m)}}return{headers:l,footers:a}}function mq(t,e,n,r,o,i){let l=ED(t.footnotesXml,e,n,r,o,i),a=AD(t.endnotesXml,e,n,r,o,i);return{footnotes:l.getNormalFootnotes(),endnotes:a.getNormalEndnotes(),footnoteSeparators:l.footnotes.filter(jD),endnoteSeparators:a.endnotes.filter(zD)}}async function gq(t,e,n){let r=new Set;if(t?.fontScheme){let{majorFont:o,minorFont:i}=t.fontScheme;o?.latin&&r.add(o.latin),i?.latin&&r.add(i.latin)}if(e?.docDefaults?.rPr?.fontFamily?.ascii&&r.add(e.docDefaults.rPr.fontFamily.ascii),e?.styles)for(let o of e.styles)o.rPr?.fontFamily?.ascii&&r.add(o.rPr.fontFamily.ascii),o.rPr?.fontFamily?.hAnsi&&r.add(o.rPr.fontFamily.hAnsi);if(n.content){for(let o of n.content)if(o.type==="paragraph")for(let i of o.content)i.type==="run"&&i.formatting?.fontFamily&&(i.formatting.fontFamily.ascii&&r.add(i.formatting.fontFamily.ascii),i.formatting.fontFamily.hAnsi&&r.add(i.formatting.fontFamily.hAnsi))}if(r.size>0)try{await Ab(Array.from(r))}catch(o){console.warn("Failed to load some fonts:",o)}}var yq=class mi{constructor(e){Ze(this,"_document"),Ze(this,"_pendingVariables"),e instanceof ArrayBuffer||ArrayBuffer.isView(e)?this._document={package:{document:{content:[]}},originalBuffer:e instanceof ArrayBuffer?e:e.buffer}:this._document=e,this._pendingVariables={}}static async fromBuffer(e){let n=await Af(e);return new mi(n)}static fromDocument(e){return new mi(e)}getDocument(){return this._document}getText(){let e=this._document.package.document;return this._getBodyText(e)}getFormattedText(){let e=[],n=this._document.package.document;for(let r of n.content)r.type==="paragraph"&&this._extractParagraphSegments(r,e);return e}getVariables(){return wV(this._document)}getStyles(){let e=this._document.package.styles;if(!e?.styles)return[];let n=[];for(let[r,o]of Object.entries(e.styles))if(typeof o=="object"&&o!==null){let i=o;n.push({id:r,name:i.name||r,type:i.type==="numbering"?"paragraph":i.type||"paragraph",builtIn:i.default})}return n}getPageCount(){let e=this.getWordCount();return Math.max(1,Math.ceil(e/500))}getWordCount(){return this.getText().split(/\s+/).filter(e=>e.length>0).length}getCharacterCount(e=!0){let n=this.getText();return e?n.length:n.replace(/\s/g,"").length}getParagraphCount(){return this._document.package.document.content.filter(e=>e.type==="paragraph").length}getTableCount(){return this._document.package.document.content.filter(e=>e.type==="table").length}getAgentContext(e=100){let n=this._document.package.document,r=n.content.filter(l=>l.type==="paragraph"),o=r.map((l,a)=>{let s=this._getParagraphText(l),c=l.formatting?.styleId;return{index:a,preview:s.slice(0,e),style:c,isHeading:c?.toLowerCase().includes("heading")||!1,headingLevel:this._parseHeadingLevel(c),isListItem:!!l.listRendering,isEmpty:s.trim().length===0}}),i=(n.sections||[]).map((l,a)=>({index:a,paragraphCount:l.content?.length||0,pageSize:l.properties?.pageWidth&&l.properties?.pageHeight?{width:l.properties.pageWidth,height:l.properties.pageHeight}:void 0,isLandscape:l.properties?.orientation==="landscape",hasHeader:!!l.properties?.headerReferences?.length,hasFooter:!!l.properties?.footerReferences?.length}));return{paragraphCount:r.length,wordCount:this.getWordCount(),characterCount:this.getCharacterCount(),variables:this.getVariables(),variableCount:this.getVariables().length,availableStyles:this.getStyles(),outline:o,sections:i,hasTables:this.getTableCount()>0,hasImages:this._hasImages(),hasHyperlinks:this._hasHyperlinks()}}insertText(e,n,r={}){let o={type:"insertText",position:e,text:n,formatting:r.formatting};return this._executeCommand(o)}replaceRange(e,n,r={}){let o={type:"replaceText",range:e,text:n,formatting:r.formatting};return this._executeCommand(o)}deleteRange(e){let n={type:"deleteText",range:e};return this._executeCommand(n)}applyFormatting(e,n){let r={type:"formatText",range:e,formatting:n};return this._executeCommand(r)}applyStyle(e,n){let r={type:"applyStyle",paragraphIndex:e,styleId:n};return this._executeCommand(r)}applyParagraphFormatting(e,n){let r={type:"formatParagraph",paragraphIndex:e,formatting:n};return this._executeCommand(r)}insertTable(e,n,r,o={}){let i={type:"insertTable",position:e,rows:n,columns:r,data:o.data,hasHeader:o.hasHeader};return this._executeCommand(i)}insertImage(e,n,r={}){let o={type:"insertImage",position:e,src:n,width:r.width,height:r.height,alt:r.alt};return this._executeCommand(o)}insertHyperlink(e,n,r={}){let o={type:"insertHyperlink",range:e,url:n,displayText:r.displayText,tooltip:r.tooltip};return this._executeCommand(o)}removeHyperlink(e){let n={type:"removeHyperlink",range:e};return this._executeCommand(n)}insertParagraphBreak(e){let n={type:"insertParagraphBreak",position:e};return this._executeCommand(n)}mergeParagraphs(e,n){let r={type:"mergeParagraphs",paragraphIndex:e,count:n};return this._executeCommand(r)}setVariable(e,n){return this._pendingVariables[e]=n,this}setVariables(e){for(let[n,r]of Object.entries(e))this._pendingVariables[n]=r;return this}getPendingVariables(){return{...this._pendingVariables}}clearPendingVariables(){return this._pendingVariables={},this}async applyVariables(e){let n={...this._pendingVariables,...e};if(Object.keys(n).length===0)return this;let r=this._document.originalBuffer;if(!r)throw new Error("Cannot apply variables: no original buffer for processing");let{processTemplate:o}=await Vn(()=>import("./processTemplate-GPFDLQMX-B1sVV2O0.js"),__vite__mapDeps([5,2])),i=o(r,n),l=await Af(i),a=new mi(l);return a._pendingVariables={},a}async toBuffer(e){if(this._document.originalBuffer){if(e?.selective){let r=await bV(this._document,this._document.originalBuffer,e.selective);if(r)return this._document.originalBuffer=r,r}let n=await WC(this._document);return this._document.originalBuffer=n,n}return pV(this._document)}async toBlob(e="application/vnd.openxmlformats-officedocument.wordprocessingml.document"){let n=await this.toBuffer();return new Blob([n],{type:e})}executeCommands(e){return new mi(WV(this._document,e))}_executeCommand(e){let n=new mi(GC(this._document,e));return n._pendingVariables={...this._pendingVariables},n}_getBodyText(e){let n=[];for(let r of e.content)r.type==="paragraph"?n.push(this._getParagraphText(r)):r.type==="table"&&n.push(this._getTableText(r));return n.join(`
101
+ `)}_getParagraphText(e){let n=[];for(let r of e.content)r.type==="run"?n.push(this._getRunText(r)):r.type==="hyperlink"&&n.push(this._getHyperlinkText(r));return n.join("")}_getRunText(e){return e.content.filter(n=>n.type==="text").map(n=>n.text).join("")}_getHyperlinkText(e){let n=[];for(let r of e.children)r.type==="run"&&n.push(this._getRunText(r));return n.join("")}_getTableText(e){let n=[];for(let r of e.rows)for(let o of r.cells)for(let i of o.content)i.type==="paragraph"&&n.push(this._getParagraphText(i));return n.join(" ")}_extractParagraphSegments(e,n){for(let r of e.content)if(r.type==="run"){let o=this._getRunText(r);o&&n.push({text:o,formatting:r.formatting})}else if(r.type==="hyperlink"){let o=r.href||"";for(let i of r.children)if(i.type==="run"){let l=this._getRunText(i);l&&n.push({text:l,formatting:i.formatting,isHyperlink:!0,hyperlinkUrl:o})}}}_parseHeadingLevel(e){if(!e)return;let n=e.match(/heading\s*(\d)/i);if(n)return parseInt(n[1],10)}_hasImages(){let e=this._document.package.document;for(let n of e.content)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="run"){for(let o of r.content)if(o.type==="drawing")return!0}}return!1}_hasHyperlinks(){let e=this._document.package.document;for(let n of e.content)if(n.type==="paragraph"){for(let r of n.content)if(r.type==="hyperlink")return!0}return!1}};function bq(t,e){if(!e||!e.trim())return null;let n=null;return t.descendants((r,o)=>n!==null?!1:r.attrs?.paraId===e&&r.isTextblock?(n=o,!1):!0),n}var wq=class extends Qk{constructor(){super({notifications:[]}),Ze(this,"notifications",[]),Ze(this,"idCounter",0),Ze(this,"timers",new Set)}showError(e,n){return this.addNotification(e,"error",n)}showWarning(e,n){return this.addNotification(e,"warning",n)}showInfo(e,n){return this.addNotification(e,"info",n)}dismiss(e){this.notifications=this.notifications.map(r=>r.id===e?{...r,dismissed:!0}:r),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(r=>r.id!==e),this.emitSnapshot()},300);this.timers.add(n)}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot()}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[]}addNotification(e,n,r){let o=`error-${++this.idCounter}-${Date.now()}`,i={id:o,message:e,severity:n,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),n!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(o)},5e3);this.timers.add(l)}return o}emitSnapshot(){this.setSnapshot({notifications:this.notifications})}},Ay=".layout-page-content .layout-line";function xq(t){let e=hh(t);if(!e)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=40;n.bottom>r.bottom-o?e.scrollTop+=n.bottom-r.bottom+o:n.top<r.top+o&&(e.scrollTop-=r.top-n.top+o)}function vq({pagesContainerRef:t}){let e=S.useRef(null),n=S.useRef(-1),r=S.useCallback(a=>{if(!t.current)return null;let s=Xc(t.current);for(let d of s){let u=Number(d.dataset.pmStart),f=Number(d.dataset.pmEnd);if(d.classList.contains("layout-run-tab")){if(a>=u&&a<f)return d.getBoundingClientRect().left;continue}if(a>=u&&a<=f&&d.firstChild?.nodeType===Node.TEXT_NODE){let h=d.firstChild,p=Math.min(a-u,h.length),m=d.ownerDocument;if(!m)continue;let y=m.createRange();return y.setStart(h,p),y.setEnd(h,p),y.getBoundingClientRect().left}}let c=t.current.querySelectorAll(".layout-empty-run");for(let d of Array.from(c)){let u=d.closest(".layout-paragraph");if(!u)continue;let f=Number(u.dataset.pmStart),h=Number(u.dataset.pmEnd);if(a>=f&&a<=h)return d.getBoundingClientRect().left}return null},[t]),o=S.useCallback(a=>{if(!t.current)return null;let s=t.current.querySelectorAll(Ay);for(let c of Array.from(s)){let d=c,u=d.querySelectorAll("span[data-pm-start][data-pm-end]");for(let f of Array.from(u)){let h=f,p=Number(h.dataset.pmStart),m=Number(h.dataset.pmEnd);if(a>=p&&a<=m)return d}}for(let c of Array.from(s)){let d=c,u=d.closest(".layout-paragraph");if(!u)continue;let f=Number(u.dataset.pmStart),h=Number(u.dataset.pmEnd);if(a>=f&&a<=h&&u.querySelector(".layout-line")===d)return d}return null},[t]),i=S.useCallback((a,s)=>{let c=a.querySelectorAll("span[data-pm-start][data-pm-end]");if(c.length===0){let h=a.closest(".layout-paragraph");return h?.dataset.pmStart?Number(h.dataset.pmStart)+1:null}for(let h of Array.from(c)){let p=h,m=p.getBoundingClientRect(),y=Number(p.dataset.pmStart),w=Number(p.dataset.pmEnd);if(p.classList.contains("layout-run-tab")){if(s>=m.left&&s<=m.right){let C=(m.left+m.right)/2;return s<C?y:w}continue}if(s>=m.left&&s<=m.right){let C=p.firstChild;if(!C||C.nodeType!==Node.TEXT_NODE)return y;let g=C,v=p.ownerDocument;if(!v)return y;let k=0,x=g.length;for(;k<x;){let T=Math.floor((k+x)/2),$=v.createRange();$.setStart(g,T),$.setEnd(g,T),s<$.getBoundingClientRect().left?x=T:k=T+1}if(k>0&&k<=g.length){let T=v.createRange();T.setStart(g,k-1),T.setEnd(g,k-1);let $=T.getBoundingClientRect().left;T.setStart(g,Math.min(k,g.length)),T.setEnd(g,Math.min(k,g.length));let M=T.getBoundingClientRect().left;if(Math.abs(s-$)<Math.abs(s-M))return y+(k-1)}return y+Math.min(k,w-y)}}let d=null,u=1/0;for(let h of Array.from(c)){let p=h,m=p.getBoundingClientRect(),y=s<m.left?m.left-s:s-m.right;y<u&&(u=y,d=p)}if(!d)return null;let f=d.getBoundingClientRect();return s<f.left?Number(d.dataset.pmStart):Number(d.dataset.pmEnd)},[]),l=S.useCallback((a,s)=>{if(s.key!=="ArrowUp"&&s.key!=="ArrowDown")return(["ArrowLeft","ArrowRight","Home","End"].includes(s.key)||s.key.length===1&&!s.ctrlKey&&!s.metaKey)&&(e.current=null,n.current=-1),!1;if(s.ctrlKey||s.metaKey)return e.current=null,n.current=-1,!1;if(!t.current)return!1;let c=Array.from(t.current.querySelectorAll(Ay));if(c.length===0)return!1;let{from:d,anchor:u}=a.state.selection;if(e.current===null){let g=r(d);if(g===null)return!1;e.current=g}let f;if(n.current>=0&&n.current<c.length)f=n.current;else{let g=o(d);if(!g||(f=c.indexOf(g),f===-1))return!1}let h=s.key==="ArrowUp"?f-1:f+1;if(h<0||h>=c.length)return n.current=-1,!1;let p=c[h],m=i(p,e.current);if(m===null)return!1;n.current=h;let{state:y,dispatch:w}=a,C=Math.max(0,Math.min(m,y.doc.content.size));try{let g=s.shiftKey?ye.create(y.doc,u,C):ye.create(y.doc,C);w(y.tr.setSelection(g))}catch{let g=y.doc.resolve(C),v=s.shiftKey?ye.between(y.doc.resolve(u),g):ye.near(g);w(y.tr.setSelection(v))}return xq(p),!0},[t,r,o,i]);return{stickyXRef:e,lastVisualLineIndexRef:n,getCaretClientX:r,findLineElementAtPosition:o,findPositionOnLineAtClientX:i,handlePMKeyDown:l}}function kq({pagesContainerRef:t,onScrollExtendSelection:e}){let n=S.useRef(null),r=S.useRef({x:0,y:0}),o=S.useRef(!1),i=S.useRef(null),l=S.useCallback(()=>{if(i.current)return i.current;let d=t.current;return d?(i.current=hh(d),i.current):null},[t]),a=S.useCallback(()=>{o.current=!1,n.current!==null&&(cancelAnimationFrame(n.current),n.current=null)},[]),s=S.useCallback(()=>{if(!o.current)return;let d=l();if(!d)return;let u=d.getBoundingClientRect(),{x:f,y:h}=r.current,p=f7(u,h);p!==0&&(d.scrollTop+=p,e(f,h)),n.current=requestAnimationFrame(s)},[l,e]),c=S.useCallback(()=>{o.current||(o.current=!0,n.current=requestAnimationFrame(s))},[s]);return{updateMousePosition:S.useCallback((d,u)=>{if(r.current={x:d,y:u},!o.current){let f=l();if(!f)return;let h=f.getBoundingClientRect();(u<h.top+hy||u>h.bottom-hy)&&c()}},[l,c]),stopAutoScroll:a}}function Cq({document:t,onChange:e,onSelectionChange:n}){let r=S.useMemo(()=>new m7,[]),[o,i]=S.useState({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null}),l=S.useCallback((f,h,p)=>{if(!t)return;let m=p7(t,f);if(!m){r.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null});return}r.selectCell({tableIndex:f,rowIndex:h,columnIndex:p});let y=aM(m,{tableIndex:f,rowIndex:h,columnIndex:p});i({context:y,table:m,tableIndex:f,rowIndex:h,columnIndex:p})},[t,r,n]),a=S.useCallback(()=>{r.clearSelection(),i({context:null,table:null,tableIndex:null,rowIndex:null,columnIndex:null})},[r,n]),s=S.useCallback(()=>!o.table||o.rowIndex===null||o.columnIndex===null?null:pM(o.table,o.rowIndex,o.columnIndex),[o.columnIndex,o.rowIndex,o.table]),c=S.useCallback((f,h)=>{if(!t||!o.table||o.tableIndex===null||o.rowIndex===null||o.columnIndex===null)return;let p=hM(o.table,o.rowIndex,o.columnIndex,f,h);if(p===o.table)return;let m=gy(t,o.tableIndex,p);e?.(m),m&&l(o.tableIndex,o.rowIndex,o.columnIndex)},[t,l,e,o.columnIndex,o.rowIndex,o.table,o.tableIndex]),d=S.useCallback(f=>{if(!t||!o.context||o.tableIndex===null||o.rowIndex===null||o.columnIndex===null)return;let h=o.table;if(!h)return;let p=null,m=null,y=o.rowIndex,w=o.columnIndex;switch(f){case"addRowAbove":p=Im(h,o.rowIndex,"before"),y=o.rowIndex+1;break;case"addRowBelow":p=Im(h,o.rowIndex,"after");break;case"addColumnLeft":p=Mm(h,o.columnIndex,"before"),w=o.columnIndex+1;break;case"addColumnRight":p=Mm(h,o.columnIndex,"after");break;case"deleteRow":h.rows.length>1&&(p=mM(h,o.rowIndex),y>=p.rows.length&&(y=p.rows.length-1));break;case"deleteColumn":{if(Nl(h)>1){p=gM(h,o.columnIndex);let C=Nl(p);w>=C&&(w=C-1)}break}case"mergeCells":o.context.selection.selectedCells&&(p=yM(h,o.context.selection));break;case"splitCell":break;case"deleteTable":m=h7(t,o.tableIndex),a(),e?.(m);return}p&&(m=gy(t,o.tableIndex,p),e?.(m),m&&l(o.tableIndex,y,w))},[t,o,e,a,l]),u=S.useCallback((f,h,p)=>r.isCellSelected(f,h,p),[r,o]);return{state:o,handleCellClick:l,handleAction:d,getSplitCellConfig:s,applySplitCell:c,clearSelection:a,isCellSelected:u,tableContext:o.context}}function Sq(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Tq(t,e={}){let{maxEntries:n=100,groupingInterval:r=500,enableKeyboardShortcuts:o=!0,isEqual:i=Sq,onUndo:l,onRedo:a,containerRef:s}=e,[c,d]=S.useState(t),[u,f]=S.useState([]),[h,p]=S.useState([]),m=S.useRef(0),y=S.useRef(!1),w=S.useCallback((M,I)=>{if(i(c,M))return;if(y.current){d(M);return}let F=Date.now();F-m.current<r&&u.length>0?f(E=>{let R=[...E];return R[R.length-1]={state:c,timestamp:F,description:I||R[R.length-1].description},R}):f(E=>{let R={state:c,timestamp:F,description:I},N=[...E,R];return N.length>n?N.slice(N.length-n):N}),p([]),d(M),m.current=F},[c,i,r,n,u.length]),C=S.useCallback(()=>{if(u.length===0)return;y.current=!0;let M=u[u.length-1];return f(I=>I.slice(0,-1)),p(I=>[...I,{state:c,timestamp:Date.now()}]),d(M.state),setTimeout(()=>{y.current=!1},0),l?.(M.state),M.state},[u,c,l]),g=S.useCallback(()=>{if(h.length===0)return;y.current=!0;let M=h[h.length-1];return p(I=>I.slice(0,-1)),f(I=>[...I,{state:c,timestamp:Date.now()}]),d(M.state),setTimeout(()=>{y.current=!1},0),a?.(M.state),M.state},[h,c,a]),v=S.useCallback(()=>{f([]),p([])},[]),k=S.useCallback(M=>{d(M??t),f([]),p([]),m.current=0},[t]),x=S.useCallback(()=>[...u],[u]),T=S.useCallback(()=>[...h],[h]),$=S.useCallback(M=>{d(I=>M(I)),f(I=>I.map(F=>({...F,state:M(F.state)}))),p(I=>I.map(F=>({...F,state:M(F.state)})))},[]);return S.useEffect(()=>{if(!o)return;let M=F=>{if((F.ctrlKey||F.metaKey)&&F.key==="z"&&!F.shiftKey){F.preventDefault(),C();return}if((F.ctrlKey||F.metaKey)&&F.key==="y"||(F.ctrlKey||F.metaKey)&&F.key==="z"&&F.shiftKey){F.preventDefault(),g();return}},I=s?.current||document;return I.addEventListener("keydown",M),()=>{I.removeEventListener("keydown",M)}},[o,C,g,s]),{state:c,canUndo:u.length>0,canRedo:h.length>0,undoCount:u.length,redoCount:h.length,push:w,undo:C,redo:g,clear:v,reset:k,getUndoStack:x,getRedoStack:T,transformAll:$}}function $q(t,e={}){let n=S.useCallback((r,o)=>!(r?.package?.document!==o?.package?.document&&JSON.stringify(r?.package?.document)!==JSON.stringify(o?.package?.document)||r?.package?.headers!==o?.package?.headers||r?.package?.footers!==o?.package?.footers),[]);return Tq(t,{...e,isEqual:n})}var Iq=class{constructor(e,n=1){Ze(this,"pagesContainer"),Ze(this,"zoom"),this.pagesContainer=e,this.zoom=n}getCoordinatesForPosition(e){let n=this.pagesContainer.getBoundingClientRect(),r=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(r)){let l=i,a=Number(l.dataset.pmStart),s=Number(l.dataset.pmEnd);if(l.classList.contains("layout-run-tab")){if(e>=a&&e<s){let c=l.getBoundingClientRect(),d=l.closest(".layout-line"),u=d?d.offsetHeight:16;return{x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:u/this.zoom}}continue}if(e>=a&&e<=s&&i.firstChild?.nodeType===Node.TEXT_NODE){let c=i.firstChild,d=Math.min(e-a,c.length),u=l.ownerDocument;if(!u)continue;let f=u.createRange();f.setStart(c,d),f.setEnd(c,d);let h=f.getBoundingClientRect(),p=l.closest(".layout-line"),m=p?p.offsetHeight:16;return{x:(h.left-n.left)/this.zoom,y:(h.top-n.top)/this.zoom,height:m/this.zoom}}}let o=this.pagesContainer.querySelectorAll(".layout-empty-run");for(let i of Array.from(o)){let l=i.closest(".layout-paragraph");if(!l)continue;let a=Number(l.dataset.pmStart),s=Number(l.dataset.pmEnd);if(e>=a&&e<=s){let c=i.getBoundingClientRect(),d=i.closest(".layout-line"),u=d?d.offsetHeight:16;return{x:(c.left-n.left)/this.zoom,y:(c.top-n.top)/this.zoom,height:u/this.zoom}}}return null}findElementsForRange(e,n){let r=[],o=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let i of Array.from(o)){let l=i,a=Number(l.dataset.pmStart);Number(l.dataset.pmEnd)>e&&a<n&&r.push(l)}return r}getRectsForRange(e,n){let r=this.pagesContainer.getBoundingClientRect(),o=[],i=this.pagesContainer.querySelectorAll("span[data-pm-start][data-pm-end]");for(let l of Array.from(i)){let a=l,s=Number(a.dataset.pmStart);if(Number(a.dataset.pmEnd)>e&&s<n){if(a.classList.contains("layout-run-tab")){let h=a.getBoundingClientRect();o.push({x:(h.left-r.left)/this.zoom,y:(h.top-r.top)/this.zoom,width:h.width/this.zoom,height:h.height/this.zoom});continue}if(l.firstChild?.nodeType!==Node.TEXT_NODE)continue;let c=l.firstChild,d=a.ownerDocument;if(!d)continue;let u=Math.max(0,e-s),f=Math.min(c.length,n-s);if(u<f){let h=d.createRange();h.setStart(c,u),h.setEnd(c,f);let p=h.getClientRects();for(let m of Array.from(p))o.push({x:(m.left-r.left)/this.zoom,y:(m.top-r.top)/this.zoom,width:m.width/this.zoom,height:m.height/this.zoom})}}}return o}getContainerOffset(){let e=this.pagesContainer.parentElement;if(!e)return{x:0,y:0};let n=this.pagesContainer.getBoundingClientRect(),r=e.getBoundingClientRect();return{x:(n.left-r.left)/this.zoom,y:(n.top-r.top)/this.zoom}}};function nS(t,e=1){return new Iq(t,e)}function Mq(){return{matchCase:!1,matchWholeWord:!1,useRegex:!1}}function rS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function oS(t,e){if(!t)return null;try{let n;e.useRegex?n=t:n=rS(t),e.matchWholeWord&&(n=`\\b${n}\\b`);let r=e.matchCase?"g":"gi";return new RegExp(n,r)}catch{return null}}function vh(t,e,n){if(!t||!e)return[];let r=[],o=e;n.matchCase||(o=e.toLowerCase());let i=d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l;n.matchWholeWord?l=`\\b${i(o)}\\b`:l=i(o);let a=n.matchCase?"g":"gi",s=new RegExp(l,a),c;for(;(c=s.exec(t))!==null;)r.push({start:c.index,end:c.index+c[0].length}),c[0].length===0&&s.lastIndex++;return r}function Rq(t,e,n,r){let o=oS(e,r);return o?t.replace(o,n):t}function Pq(t,e,n,r,o=0){let i=vh(t,e,r),l=i.find(a=>a.start>=o)||i[0];return l?{content:t.substring(0,l.start)+n+t.substring(l.end),replaced:!0,matchStart:l.start,matchEnd:l.start+n.length}:{content:t,replaced:!1,matchStart:-1,matchEnd:-1}}function Eq(t){return t?t.totalCount===0?"No results":t.totalCount===1?"1 match":`${t.currentIndex+1} of ${t.totalCount} matches`:""}function Fq(t){return!t||t.trim()===""}function Aq(){return{currentMatchColor:"#FFFF00",otherMatchColor:"#FFFFAA"}}function ac(t){if(!t||!t.content)return"";let e="";for(let n of t.content)n.type==="text"?e+=n.text||"":n.type==="tab"?e+=" ":n.type==="break"&&n.breakType==="textWrapping"&&(e+=`
102
+ `);return e}function Dq(t){if(!t||!t.content)return"";let e="";for(let n of t.content)if(n.type==="run")e+=ac(n);else if(n.type==="hyperlink")for(let r of n.children||[])r.type==="run"&&(e+=ac(r));return e}function Nq(t,e,n){if(!t||!e)return[];let r=[],o=t.package?.document||t.package?.document;if(!o||!o.content)return r;let i=0;for(let l of o.content)if(l.type==="paragraph"){let a=iS(l,e,n,i);r.push(...a),i++}else if(l.type==="table")for(let a of l.rows||[])for(let s of a.cells||[])for(let c of s.content||[])c.type;return r}function iS(t,e,n,r){let o=[],i=Dq(t);if(!i)return o;let l=vh(i,e,n);for(let a of l){let s=Lq(t,a.start);o.push({paragraphIndex:r,contentIndex:s.contentIndex,startOffset:s.offsetInContent,endOffset:s.offsetInContent+(a.end-a.start),text:i.substring(a.start,a.end)})}return o}function Lq(t,e){if(!t||!t.content)return{contentIndex:0,runIndex:0,offsetInContent:e};let n=0,r=0;for(let o of t.content){let i="";if(o.type==="run")i=ac(o);else if(o.type==="hyperlink")for(let a of o.children||[])a.type==="run"&&(i+=ac(a));let l=i.length;if(n+l>e)return{contentIndex:r,runIndex:r,offsetInContent:e-n};n+=l,r++}return{contentIndex:Math.max(0,t.content.length-1),runIndex:Math.max(0,t.content.length-1),offsetInContent:0}}function Bq(t,e){if(!t||!e)return;let n=t.querySelector(`[data-paragraph-index="${e.paragraphIndex}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"center"})}const Oq=Object.freeze(Object.defineProperty({__proto__:null,createDefaultFindOptions:Mq,createSearchPattern:oS,escapeRegexString:rS,findAllMatches:vh,findInDocument:Nq,findInParagraph:iS,getDefaultHighlightOptions:Aq,getMatchCountText:Eq,isEmptySearch:Fq,replaceAllInContent:Rq,replaceFirstInContent:Pq,scrollToMatch:Bq},Symbol.toStringTag,{value:"Module"}));var kh={};D6(kh,Oq);function jq(t){let[e,n]=S.useState({isOpen:!1,searchText:"",replaceText:"",options:(0,kh.createDefaultFindOptions)(),matches:[],currentIndex:0,replaceMode:t?.initialReplaceMode??!1}),r=S.useCallback(y=>{n(w=>({...w,isOpen:!0,replaceMode:!1,searchText:y||w.searchText,matches:[],currentIndex:0}))},[]),o=S.useCallback(y=>{n(w=>({...w,isOpen:!0,replaceMode:!0,searchText:y||w.searchText,matches:[],currentIndex:0}))},[]),i=S.useCallback(()=>{n(y=>({...y,isOpen:!1}))},[]),l=S.useCallback(()=>{n(y=>({...y,isOpen:!y.isOpen}))},[]),a=S.useCallback(y=>{n(w=>({...w,searchText:y}))},[]),s=S.useCallback(y=>{n(w=>({...w,replaceText:y}))},[]),c=S.useCallback(y=>{n(w=>({...w,options:{...w.options,...y}}))},[]),d=S.useCallback((y,w=0)=>{let C=Math.max(0,Math.min(w,y.length-1));n(g=>({...g,matches:y,currentIndex:y.length>0?C:0})),t?.onMatchesChange?.(y),y.length>0?t?.onCurrentMatchChange?.(y[C],C):t?.onCurrentMatchChange?.(null,-1)},[t]),u=S.useCallback(()=>{let y=0;return n(w=>w.matches.length===0?w:(y=(w.currentIndex+1)%w.matches.length,{...w,currentIndex:y})),y},[]),f=S.useCallback(()=>{let y=0;return n(w=>w.matches.length===0?w:(y=w.currentIndex===0?w.matches.length-1:w.currentIndex-1,{...w,currentIndex:y})),y},[]),h=S.useCallback(y=>{n(w=>w.matches.length===0||y<0||y>=w.matches.length?w:{...w,currentIndex:y})},[]),p=S.useCallback(()=>e.matches.length===0?null:e.matches[e.currentIndex]||null,[e.matches,e.currentIndex]),m=S.useCallback(()=>e.matches.length>0,[e.matches.length]);return{state:e,openFind:r,openReplace:o,close:i,toggle:l,setSearchText:a,setReplaceText:s,setOptions:c,setMatches:d,goToNextMatch:u,goToPreviousMatch:f,goToMatch:h,getCurrentMatch:p,hasMatches:m}}var zq={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Hq={backgroundColor:"var(--doc-surface)",borderRadius:"8px",boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:"400px",maxWidth:"500px",width:"100%",margin:"20px"},_q={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Wq={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Vq={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},qq={padding:"20px"},rs={marginBottom:"16px"},is={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Rl={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box",outline:"none"},Zq={...Rl,borderColor:"var(--doc-error)"},Kq={...Rl,cursor:"pointer"},Uq={color:"var(--doc-error)",fontSize:"12px",marginTop:"4px"},Dy={color:"var(--doc-text-muted)",fontSize:"12px",marginTop:"4px"},Xq={display:"flex",borderBottom:"1px solid var(--doc-border)",marginBottom:"16px"},Df={padding:"10px 16px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"var(--doc-text-muted)",borderBottom:"2px solid transparent",marginBottom:"-1px"},Ny={...Df,color:"var(--doc-link)",borderBottomColor:"var(--doc-link)",fontWeight:500},Gq={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Qc={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},Yq={...Qc,backgroundColor:"var(--doc-link)",color:"var(--doc-on-primary)"},Jq={...Qc,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Qq={...Qc,backgroundColor:"var(--doc-error)",color:"var(--doc-on-primary)"},e9={...Qc,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Nf(t){if(!t||t.trim()==="")return!1;let e=t.trim();if(e.startsWith("mailto:")||e.startsWith("tel:"))return e.length>7;if(e.startsWith("ftp://"))return e.length>6;try{let n=e.match(/^https?:\/\//)?e:`https://${e}`,r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function Ch(t){if(!t)return"";let e=t.trim();return e.startsWith("mailto:")||e.startsWith("tel:")||e.startsWith("ftp://")||e.match(/^https?:\/\//)?e:`https://${e}`}function t9(t){if(!t)return"unknown";let e=t.trim().toLowerCase();return e.startsWith("mailto:")?"email":e.startsWith("tel:")?"phone":e.startsWith("ftp://")?"ftp":e.startsWith("http://")||e.startsWith("https://")?"web":e.includes("@")&&!e.includes(" ")?"email":"web"}function lS({isOpen:t,onClose:e,onSubmit:n,onRemove:r,initialData:o,selectedText:i="",isEditing:l=!1,bookmarks:a=[],className:s,style:c}){let{t:d}=Re(),[u,f]=S.useState("url"),[h,p]=S.useState(""),[m,y]=S.useState(""),[w,C]=S.useState(""),[g,v]=S.useState(""),[k,x]=S.useState(""),[T,$]=S.useState(!1),M=S.useRef(null),I=S.useRef(null);S.useEffect(()=>{t&&(o?(o.bookmark?(f("bookmark"),C(o.bookmark)):(f("url"),p(o.url||"")),y(o.displayText||""),v(o.tooltip||"")):(f("url"),p(""),y(i),C(""),v("")),x(""),$(!1))},[t,o,i]),S.useEffect(()=>{t&&setTimeout(()=>{u==="url"?M.current?.focus():I.current?.focus()},100)},[t,u]);let F=S.useCallback(()=>{u==="url"&&h.trim()?Nf(h)?x(""):x(d("dialogs.hyperlink.invalidUrl")):x("")},[u,h,d]),E=S.useCallback(O=>{if(O?.preventDefault(),u==="url"){if(!h.trim()){x(d("dialogs.hyperlink.urlRequired")),$(!0);return}if(!Nf(h)){x(d("dialogs.hyperlink.invalidUrl")),$(!0);return}}else if(u==="bookmark"&&!w)return;let z={displayText:m.trim()||void 0,tooltip:g.trim()||void 0};u==="url"?z.url=Ch(h):z.bookmark=w,n(z)},[u,h,w,m,g,n]),R=S.useCallback(O=>{O.key==="Escape"?e():O.key==="Enter"&&!O.shiftKey&&O.target.tagName!=="TEXTAREA"&&(O.preventDefault(),E())},[e,E]),N=S.useCallback(O=>{O.target===O.currentTarget&&e()},[e]);if(!t)return null;let B=a.length>0,j=u==="url"&&h.trim()&&!k||u==="bookmark"&&w;return b.jsx("div",{className:`docx-hyperlink-dialog-overlay ${s||""}`,style:{...zq,...c},onClick:N,onKeyDown:R,role:"dialog","aria-modal":"true","aria-labelledby":"hyperlink-dialog-title",children:b.jsxs("div",{className:"docx-hyperlink-dialog",style:Hq,children:[b.jsxs("div",{className:"docx-hyperlink-dialog-header",style:_q,children:[b.jsx("h2",{id:"hyperlink-dialog-title",style:Wq,children:d(l?"dialogs.hyperlink.titleEdit":"dialogs.hyperlink.titleInsert")}),b.jsx("button",{type:"button",className:"docx-hyperlink-dialog-close",style:Vq,onClick:e,"aria-label":d("common.closeDialog"),children:"×"})]}),b.jsxs("form",{className:"docx-hyperlink-dialog-body",style:qq,onSubmit:E,children:[B&&b.jsxs("div",{className:"docx-hyperlink-dialog-tabs",style:Xq,children:[b.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${u==="url"?"active":""}`,style:u==="url"?Ny:Df,onClick:()=>f("url"),"aria-selected":u==="url",children:d("dialogs.hyperlink.tabWebAddress")}),b.jsx("button",{type:"button",className:`docx-hyperlink-dialog-tab ${u==="bookmark"?"active":""}`,style:u==="bookmark"?Ny:Df,onClick:()=>f("bookmark"),"aria-selected":u==="bookmark",children:d("dialogs.hyperlink.tabBookmark")})]}),u==="url"&&b.jsxs("div",{className:"docx-hyperlink-dialog-field",style:rs,children:[b.jsx("label",{htmlFor:"hyperlink-url",style:is,children:d("dialogs.hyperlink.urlLabel")}),b.jsx("input",{ref:M,id:"hyperlink-url",type:"text",className:"docx-hyperlink-dialog-input",style:k&&T?Zq:Rl,value:h,onChange:O=>{p(O.target.value),T&&x("")},onBlur:()=>{$(!0),F()},placeholder:d("dialogs.hyperlink.urlPlaceholder"),"aria-invalid":!!k,"aria-describedby":k?"url-error":"url-hint"}),k&&T&&b.jsx("div",{id:"url-error",style:Uq,children:k}),!k&&b.jsx("div",{id:"url-hint",style:Dy,children:d("dialogs.hyperlink.urlHint")})]}),u==="bookmark"&&b.jsxs("div",{className:"docx-hyperlink-dialog-field",style:rs,children:[b.jsx("label",{htmlFor:"hyperlink-bookmark",style:is,children:d("dialogs.hyperlink.bookmarkLabel")}),b.jsxs("select",{ref:I,id:"hyperlink-bookmark",className:"docx-hyperlink-dialog-select",style:Kq,value:w,onChange:O=>C(O.target.value),children:[b.jsx("option",{value:"",children:d("dialogs.hyperlink.bookmarkPlaceholder")}),a.map(O=>b.jsx("option",{value:O.name,children:O.label||O.name},O.name))]})]}),b.jsxs("div",{className:"docx-hyperlink-dialog-field",style:rs,children:[b.jsx("label",{htmlFor:"hyperlink-display-text",style:is,children:d("dialogs.hyperlink.displayTextLabel")}),b.jsx("input",{id:"hyperlink-display-text",type:"text",className:"docx-hyperlink-dialog-input",style:Rl,value:m,onChange:O=>y(O.target.value),placeholder:d("dialogs.hyperlink.displayTextPlaceholder")}),b.jsx("div",{style:Dy,children:d("dialogs.hyperlink.displayTextHint")})]}),b.jsxs("div",{className:"docx-hyperlink-dialog-field",style:rs,children:[b.jsx("label",{htmlFor:"hyperlink-tooltip",style:is,children:d("dialogs.hyperlink.tooltipLabel")}),b.jsx("input",{id:"hyperlink-tooltip",type:"text",className:"docx-hyperlink-dialog-input",style:Rl,value:g,onChange:O=>v(O.target.value),placeholder:d("dialogs.hyperlink.tooltipPlaceholder")})]})]}),b.jsxs("div",{className:"docx-hyperlink-dialog-footer",style:Gq,children:[l&&r&&b.jsx("button",{type:"button",className:"docx-hyperlink-dialog-remove",style:Qq,onClick:r,children:d("dialogs.hyperlink.removeLink")}),b.jsx("div",{style:{flex:1}}),b.jsx("button",{type:"button",className:"docx-hyperlink-dialog-cancel",style:Jq,onClick:e,children:d("common.cancel")}),b.jsx("button",{type:"submit",className:"docx-hyperlink-dialog-submit",style:j?Yq:e9,onClick:E,disabled:!j,children:d(l?"common.update":"common.insert")})]})]})})}function n9(t,e){return{url:Ch(t),displayText:e}}function r9(t,e){return{bookmark:t,displayText:e}}function o9(t){return!!t.url&&!t.bookmark}function i9(t){return!!t.bookmark}function l9(t){return t.displayText?t.displayText:t.url?t.url.replace(/^https?:\/\//,""):t.bookmark?t.bookmark:""}function a9(t){return t.startsWith("mailto:")?t:`mailto:${t}`}function s9(t){return t.startsWith("tel:")?t:`tel:${t.replace(/[\s\-\(\)\.]/g,"")}`}function c9(t){return t.filter(e=>!e.name.startsWith("_")).map(e=>({name:e.name,label:e.name})).sort((e,n)=>e.name.localeCompare(n.name))}function aS(){let[t,e]=S.useState({isOpen:!1,isEditing:!1}),n=S.useCallback(l=>{e({isOpen:!0,selectedText:l,initialData:void 0,isEditing:!1})},[]),r=S.useCallback(l=>{e({isOpen:!0,initialData:l,selectedText:l.displayText,isEditing:!0})},[]),o=S.useCallback(()=>{e(l=>({...l,isOpen:!1}))},[]),i=S.useCallback(()=>{e(l=>({...l,isOpen:!l.isOpen}))},[]);return{state:t,openInsert:n,openEdit:r,close:o,toggle:i}}var d9=lS,Nr,wo,xo,Vr,Pl,vl,sS,Lf,u9=class{constructor(){ri(this,vl),ri(this,Nr,0),ri(this,wo,0),ri(this,xo,!1),ri(this,Vr,null),ri(this,Pl,new Set)}setStateSeq(e){Nn(this,Nr,e)}incrementStateSeq(){return++AI(this,Nr)._}getStateSeq(){return Yt(this,Nr)}getRenderSeq(){return Yt(this,wo)}onLayoutStart(){Nn(this,xo,!0)}onLayoutComplete(e){Nn(this,wo,e),Nn(this,xo,!1),Md(this,vl,sS).call(this)}isSafeToRender(){return!Yt(this,xo)&&Yt(this,wo)>=Yt(this,Nr)}requestRender(){this.isSafeToRender()?Md(this,vl,Lf).call(this):Nn(this,Vr,()=>Md(this,vl,Lf).call(this))}onRender(e){return Yt(this,Pl).add(e),()=>{Yt(this,Pl).delete(e)}}reset(){Nn(this,Nr,0),Nn(this,wo,0),Nn(this,xo,!1),Nn(this,Vr,null)}getDebugInfo(){return{stateSeq:Yt(this,Nr),renderSeq:Yt(this,wo),layoutUpdating:Yt(this,xo),hasPendingRender:Yt(this,Vr)!==null,isSafe:this.isSafeToRender()}}};Nr=new WeakMap,wo=new WeakMap,xo=new WeakMap,Vr=new WeakMap,Pl=new WeakMap,vl=new WeakSet,sS=function(){if(Yt(this,Vr)&&this.isSafeToRender()){let t=Yt(this,Vr);Nn(this,Vr,null),t()}},Lf=function(){for(let t of Yt(this,Pl))try{t()}catch(e){console.error("LayoutSelectionGate: render callback error",e)}};var Ao=class extends Error{constructor(e){super(`No content control matched ${JSON.stringify(e)}`),this.name="ContentControlNotFoundError"}},sc=class extends Error{constructor(e,n){super(`Content control is ${e}; cannot ${n} it without { force: true }`),this.name="ContentControlLockedError"}},f9=class extends Error{constructor(e){super(`Content control is a '${e}' control; replacing its content with free text would desync it. Use a type-specific value setter or pass { force: true }.`),this.name="ContentControlTypeError"}},cS=class extends Error{constructor(){super("Content control is data-bound (w:dataBinding); its content is driven by the Custom XML store and a direct write will not persist. Update the store, or pass { force: true }."),this.name="ContentControlBoundError"}},p9=new Set(["richText","plainText","unknown"]);function h9(t){return p9.has(t)}function dS(t){return t==="contentLocked"||t==="sdtContentLocked"}function m9(t){return t==="sdtLocked"||t==="sdtContentLocked"}function g9(t){return t.dataBinding!=null}function uS(t){return t&&t.replace(/<w:showingPlcHdr\b[^>]*\/>/g,"").replace(/<w:showingPlcHdr\b[^>]*>[\s\S]*?<\/w:showingPlcHdr>/g,"")}var si=class extends Error{constructor(e){super(e),this.name="ContentControlValueError"}};function ls(t,e,n){let r=new RegExp(`<${e}\\b[^>]*>`).exec(t);if(!r)return;let o=new RegExp(`\\b${n}="([^"]*)"`).exec(r[0]);return o?o[1]:void 0}function fu(t,e,n,r){let o=new RegExp(`<${e}\\b[^>]*?(/?)>`).exec(t);if(!o)return t;let i=o[0],l=o[1]==="/",a=i.slice(1,l?-2:-1),s=new RegExp(`\\b${n}="[^"]*"`).test(a)?a.replace(new RegExp(`\\b${n}="[^"]*"`),()=>`${n}="${r}"`):`${a} ${n}="${r}"`;return t.replace(i,()=>`<${s}${l?"/>":">"}`)}function y9(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function b9(t,e){if(!t)return e;let n=parseInt(t,16);return Number.isNaN(n)?e:String.fromCodePoint(n)}var Ly=["January","February","March","April","May","June","July","August","September","October","November","December"];function w9(t,e){let[n,r,o]=t.slice(0,10).split("-").map(s=>parseInt(s,10));if(!n||!r||!o)return t;let i=e&&e.trim()?e:"M/d/yyyy",l=s=>String(s).padStart(2,"0"),a={yyyy:String(n),yy:String(n).slice(-2),MMMM:Ly[r-1],MMM:Ly[r-1].slice(0,3),MM:l(r),M:String(r),dd:l(o),d:String(o)};return i.replace(/yyyy|yy|MMMM|MMM|MM|M|dd|d/g,s=>a[s])}function pu(t,e){return t?{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t}],...e?{formatting:{fontFamily:{ascii:e,hAnsi:e,eastAsia:e,cs:e}}}:{}}]}:{type:"paragraph",content:[]}}function hu(t,e){let n=uS(e);return{...t,showingPlaceholder:!1,rawPropertiesXml:(n??e)||void 0}}function x9(t,e){let n=t.rawPropertiesXml??"";switch(e.kind){case"dropdown":{if(t.sdtType!=="dropDownList"&&t.sdtType!=="comboBox")throw new si(`Control is '${t.sdtType}', not a dropdown/combo box.`);let r=t.listItems?.find(l=>l.value===e.value||l.displayText===e.value);if(!r)throw new si(`'${e.value}' is not one of the control's list items.`);let o=t.sdtType==="comboBox"?"w:comboBox":"w:dropDownList",i=fu(n,o,"w:lastValue",y9(r.value));return{properties:hu(t,i),content:[pu(r.displayText)]}}case"checkbox":{if(t.sdtType!=="checkbox")throw new si(`Control is '${t.sdtType}', not a checkbox.`);if(ls(n,"w14:checked","w14:val")==null)throw new si("Checkbox control has no <w14:checked> state to update (not a Word checkbox).");let r=e.checked?"w14:checkedState":"w14:uncheckedState",o=b9(ls(n,r,"w14:val"),e.checked?"☒":"☐"),i=ls(n,r,"w14:font"),l=fu(n,"w14:checked","w14:val",e.checked?"1":"0");return{properties:{...hu(t,l),checked:e.checked},content:[pu(o,i)]}}case"date":{if(t.sdtType!=="date")throw new si(`Control is '${t.sdtType}', not a date control.`);let r=e.date.slice(0,10);if(!/^\d{4}-\d{2}-\d{2}$/.test(r))throw new si(`Date must be ISO yyyy-mm-dd, got '${e.date}'.`);let o=`${r}T00:00:00`,i=fu(n,"w:date","w:fullDate",o),l=ls(n,"w:dateFormat","w:val");return{properties:hu(t,i),content:[pu(w9(r,l))]}}}}function Bf(t){return/<w15:repeatingSectionItem[\s/>]/.test(t??"")}var Of=class extends Error{constructor(e){super(e),this.name="RepeatingSectionError"}};function v9(t,e){return k9(t,e)}function k9(t,e){return t&&(/<w:id\b/.test(t)?t.replace(/(<w:id\b[^>]*\bw:val=")[^"]*(")/,`$1${e}$2`):t.replace(/(<w:sdtPr\b[^>]*[^/]>)/,`$1<w:id w:val="${e}"/>`))}function C9(t){return t.attrs.href||""}function S9(t){return Fp(t,_v)}function Sh(t){let e={};for(let n of t)switch(n.type.name){case"bold":e.bold=!0,e.boldCs=!0;break;case"italic":e.italic=!0,e.italicCs=!0;break;case"underline":{let o=n.attrs;e.underline={style:o.style||"single",color:o.color};break}case"strike":n.attrs.double?e.doubleStrike=!0:e.strike=!0;break;case"textColor":{let o=n.attrs;e.color={rgb:o.rgb,themeColor:o.themeColor,themeTint:o.themeTint,themeShade:o.themeShade};break}case"highlight":e.highlight=n.attrs.color;break;case"fontSize":n.attrs.size!=null&&(e.fontSize=n.attrs.size);let r=n.attrs.sizeCs??n.attrs.size;r!=null&&(e.fontSizeCs=r);break;case"fontFamily":{let o=n.attrs;e.fontFamily={ascii:o.ascii,hAnsi:o.hAnsi,eastAsia:o.eastAsia||void 0,cs:o.cs||o.ascii||void 0,asciiTheme:o.asciiTheme,hAnsiTheme:o.hAnsiTheme||void 0,eastAsiaTheme:o.eastAsiaTheme||void 0,csTheme:o.csTheme||void 0};break}case"superscript":e.vertAlign="superscript";break;case"subscript":e.vertAlign="subscript";break;case"allCaps":e.allCaps=!0;break;case"smallCaps":e.smallCaps=!0;break;case"characterSpacing":{n.attrs.spacing!=null&&(e.spacing=n.attrs.spacing),n.attrs.position!=null&&(e.position=n.attrs.position),n.attrs.scale!=null&&(e.scale=n.attrs.scale),n.attrs.kerning!=null&&(e.kerning=n.attrs.kerning);break}case"emboss":e.emboss=!0;break;case"imprint":e.imprint=!0;break;case"textShadow":e.shadow=!0;break;case"emphasisMark":e.emphasisMark=n.attrs.type||"dot";break;case"textOutline":e.outline=!0;break;case"hidden":e.hidden=!0;break;case"rtl":e.rtl=!0;break;case"textEffect":e.effect=n.attrs.effect||"blinkBackground";break;case"runStyle":n.attrs.styleId&&(e.styleId=n.attrs.styleId);break}return e}function T9(t){let e=t.attrs.href;return e?.startsWith("#")?{type:"hyperlink",anchor:e.substring(1),tooltip:t.attrs.tooltip||void 0,children:[]}:{type:"hyperlink",href:e,tooltip:t.attrs.tooltip||void 0,rId:t.attrs.rId||void 0,children:[]}}function By(t,e){let n=e.marks.filter(r=>r.type.name!=="hyperlink");e.isText&&e.text?t.children.push(fS(e.text,n)):e.type.name==="tab"?t.children.push(hS()):e.type.name==="hardBreak"&&t.children.push(pS())}function fS(t,e){let n=Sh(e),r={type:"text",text:t};return{type:"run",formatting:Object.keys(n).length>0?n:void 0,content:[r]}}function $9(t,e){let n=t.content[t.content.length-1];n&&n.type==="text"?n.text+=e:t.content.push({type:"text",text:e})}function pS(){return{type:"run",content:[{type:"break",breakType:"textWrapping"}]}}function hS(){return{type:"run",content:[{type:"tab"}]}}function I9(t,e){let n=t.attrs,r=e&&e.length>0?Sh(e):void 0,o=n.displayText||"";if(!o)switch(n.fieldType){case"PAGE":o="1";break;case"NUMPAGES":o="1";break;default:o=" ";break}let i={type:"run",content:[{type:"text",text:o}],...r&&Object.keys(r).length>0?{formatting:r}:{}};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 M9(t){let e=t.attrs;return{type:"mathEquation",display:e.display||"inline",ommlXml:e.ommlXml,plainText:e.plainText||void 0}}function Oy(t){let e=t.attrs,n={type:e.wrapType||"inline"};e.distTop!==void 0&&(n.distT=He(e.distTop)),e.distBottom!==void 0&&(n.distB=He(e.distBottom)),e.distLeft!==void 0&&(n.distL=He(e.distLeft)),e.distRight!==void 0&&(n.distR=He(e.distRight)),e.wrapText&&(n.wrapText=e.wrapText);let r={type:"image",rId:e.rId||"",src:e.src,alt:e.alt||void 0,title:e.title||void 0,size:{width:He(e.width||0),height:He(e.height||0)},wrap:n};if(e.transform){let o=e.transform,i={},l=o.match(/rotate\(([-\d.]+)deg\)/);l&&(i.rotation=parseFloat(l[1])),o.includes("scaleX(-1)")&&(i.flipH=!0),o.includes("scaleY(-1)")&&(i.flipV=!0),(i.rotation||i.flipH||i.flipV)&&(r.transform=i)}if(e.position?.horizontal&&e.position?.vertical){let o=e.position;r.position={horizontal:{relativeTo:o.horizontal.relativeTo||"column",alignment:o.horizontal.align,posOffset:o.horizontal.posOffset},vertical:{relativeTo:o.vertical.relativeTo||"paragraph",alignment:o.vertical.align,posOffset:o.vertical.posOffset}}}if(e.borderWidth&&e.borderWidth>0){let o={solid:"solid",dotted:"dot",dashed:"dash",double:"solid",groove:"solid",ridge:"solid",inset:"solid",outset:"solid"};r.outline={width:He(e.borderWidth),color:e.borderColor?{rgb:e.borderColor.replace("#","")}:void 0,style:e.borderStyle&&o[e.borderStyle]||"solid"}}if(e.hlinkHref&&(r.hlinkHref=e.hlinkHref),e.cropTop!==void 0||e.cropRight!==void 0||e.cropBottom!==void 0||e.cropLeft!==void 0){let o={};e.cropTop!==void 0&&e.cropTop!==null&&(o.top=e.cropTop),e.cropRight!==void 0&&e.cropRight!==null&&(o.right=e.cropRight),e.cropBottom!==void 0&&e.cropBottom!==null&&(o.bottom=e.cropBottom),e.cropLeft!==void 0&&e.cropLeft!==null&&(o.left=e.cropLeft),Object.keys(o).length>0&&(r.crop=o)}if(e.opacity!==void 0&&e.opacity!==null&&e.opacity<1&&(r.opacity=e.opacity),e.layoutInCell!==void 0&&e.layoutInCell!==null&&(r.layoutInCell=e.layoutInCell),e.allowOverlap!==void 0&&e.allowOverlap!==null&&(r.allowOverlap=e.allowOverlap),e.effectExtentTop||e.effectExtentBottom||e.effectExtentLeft||e.effectExtentRight){let o={};e.effectExtentTop&&(o.top=He(e.effectExtentTop)),e.effectExtentBottom&&(o.bottom=He(e.effectExtentBottom)),e.effectExtentLeft&&(o.left=He(e.effectExtentLeft)),e.effectExtentRight&&(o.right=He(e.effectExtentRight)),Object.keys(o).length>0&&(r.padding=o)}return{type:"run",content:[{type:"drawing",image:r}]}}function jy(t){let e=t.attrs,n={type:"shape",shapeType:e.shapeType||"rect",id:e.shapeId||void 0,size:{width:e.width?He(e.width):0,height:e.height?He(e.height):0}};if(e.fillType==="gradient"&&e.gradientStops)try{let r=JSON.parse(e.gradientStops);n.fill={type:"gradient",gradient:{type:e.gradientType||"linear",angle:e.gradientAngle||void 0,stops:r.map(o=>({position:o.position,color:{rgb:o.color.replace("#","")}}))}}}catch{n.fill={type:"solid",color:{rgb:(e.fillColor||"000000").replace("#","")}}}else e.fillColor?n.fill={type:e.fillType||"solid",color:{rgb:e.fillColor.replace("#","")}}:e.fillType==="none"&&(n.fill={type:"none"});if(e.outlineWidth&&e.outlineWidth>0){let r={solid:"solid",dotted:"dot",dashed:"dash"};n.outline={width:He(e.outlineWidth),color:e.outlineColor?{rgb:e.outlineColor.replace("#","")}:void 0,style:e.outlineStyle&&r[e.outlineStyle]||"solid"}}return{type:"run",content:[{type:"shape",shape:n}]}}function Th(t){let e=t.attrs,n=R9(gS(t),t);n=N9(n,t);let r=e.bookmarks;if(r&&r.length>0){let i=r.map(a=>({type:"bookmarkStart",id:a.id,name:a.name})),l=r.map(a=>({type:"bookmarkEnd",id:a.id}));n=[...i,...n,...l]}let o={type:"paragraph",paraId:e.paraId||void 0,textId:e.textId||void 0,formatting:j9(e),content:n};return e.renderedPageBreakBefore&&(o.renderedPageBreakBefore=!0),e.pPrIns&&(o.pPrIns={id:e.pPrIns.revisionId,author:e.pPrIns.author,...e.pPrIns.date?{date:e.pPrIns.date}:{}}),e.pPrDel&&(o.pPrDel={id:e.pPrDel.revisionId,author:e.pPrDel.author,...e.pPrDel.date?{date:e.pPrDel.date}:{}}),e.pPrChange&&e.pPrChange.length>0&&(o.propertyChanges=e.pPrChange),e._sectionProperties?o.sectionProperties=e._sectionProperties:e.sectionBreakType&&(o.sectionProperties={sectionStart:e.sectionBreakType}),o}function R9(t,e){let n=e.attrs._originalRunBoundaries;if(!n||n.length===0||!t.every(l=>l.type==="run"))return t;let r=t;if(!r.every(P9))return t;let o=r.map($h).join(""),i=n.map(l=>l.text).join("");return o!==i||!E9(e,n)?t:F9(r,n)??t}function P9(t){return t.content.every(e=>e.type==="text")}function $h(t){return t.content.map(e=>e.type==="text"?e.text:"").join("")}function E9(t,e){let n=0,r=0,o=!0;if(t.forEach(i=>{if(!o)return;if(!i.isText){o=!1;return}let l=Fp(i.marks,Wv),a=i.text??"",s=0;for(;s<a.length;){for(;n<e.length&&e[n].text.length===0;)n++;let c=e[n];if(!c||l!==(c.marksKey??"")){o=!1;return}let d=c.text.length-r,u=a.length-s,f=Math.min(d,u),h=a.slice(s,s+f),p=c.text.slice(r,r+f);if(h!==p){o=!1;return}s+=f,r+=f,r===c.text.length&&(n++,r=0)}}),!o)return!1;for(;n<e.length&&e[n].text.length===0;)n++;return n===e.length&&r===0}function F9(t,e){let n=[],r={runIndex:0,runOffset:0};for(let o of e){if(o.text.length===0){n.push(A9(o));continue}let i=D9(t,r,o.text.length);if(!i)return null;o.propertyChanges&&o.propertyChanges.length>0&&(i.propertyChanges=o.propertyChanges),n.push(i)}for(;r.runIndex<t.length;){if($h(t[r.runIndex]).length-r.runOffset>0)return null;r.runIndex++,r.runOffset=0}return n}function A9(t){let e={type:"run",content:[]};return t.formatting&&Object.keys(t.formatting).length>0&&(e.formatting=t.formatting),t.propertyChanges&&t.propertyChanges.length>0&&(e.propertyChanges=t.propertyChanges),e}function D9(t,e,n){let r=n,o="",i,l;for(;r>0;){let s=t[e.runIndex];if(!s)return null;let c=$h(s),d=c.length-e.runOffset;if(d<=0){e.runIndex++,e.runOffset=0;continue}let u=JSON.stringify(s.formatting??null);if(l==null)i=s.formatting,l=u;else if(l!==u)return null;let f=Math.min(r,d);o+=c.slice(e.runOffset,e.runOffset+f),e.runOffset+=f,r-=f,e.runOffset===c.length&&(e.runIndex++,e.runOffset=0)}let a={type:"run",content:[{type:"text",text:o}]};return i&&Object.keys(i).length>0&&(a.formatting=i),a}function N9(t,e){let n=new Map,r=new Map,o=0;if(e.forEach(h=>{for(let p of h.marks)if(p.type.name==="comment"){let m=p.attrs.commentId;n.has(m)||n.set(m,o),r.set(m,o)}o++}),n.size===0)return t;let i=[...n.keys()],l=[...i].sort((h,p)=>{let m=n.get(h),y=n.get(p);if(m!==y)return m-y;let w=r.get(h),C=r.get(p);return w!==C?C-w:h-p}),a=[...i].sort((h,p)=>{let m=r.get(h),y=r.get(p);if(m!==y)return m-y;let w=n.get(h),C=n.get(p);return w!==C?C-w:p-h}),s=new Map;for(let h of l){let p=n.get(h);(s.get(p)??(s.set(p,[]),s.get(p))).push(h)}let c=new Map;for(let h of a){let p=r.get(h);(c.get(p)??(c.set(p,[]),c.get(p))).push(h)}let d=[],u={index:0},f=0;for(e.forEach(h=>{for(let p of s.get(f)??[])d.push({type:"commentRangeStart",id:p});L9(d,t,u,h);for(let p of c.get(f)??[])d.push({type:"commentRangeEnd",id:p});f++});u.index<t.length;)d.push(t[u.index]),u.index++;return d}function L9(t,e,n,r){if(!r.isText){B9(t,e,n);return}let o=(r.text??"").length;for(;o>0&&n.index<e.length;){let i=e[n.index];t.push(i),n.index++,o-=mS(i)}}function B9(t,e,n){n.index>=e.length||(t.push(e[n.index]),n.index++)}function mS(t){switch(t.type){case"run":return O9(t);case"hyperlink":return rl(t.children);case"simpleField":return rl(t.content);case"complexField":return rl(t.fieldResult);case"inlineSdt":return rl(t.content);case"insertion":case"deletion":case"moveFrom":case"moveTo":return rl(t.content);case"mathEquation":return t.plainText?.length??0;default:return 0}}function rl(t){return t.reduce((e,n)=>e+mS(n),0)}function O9(t){return t.content.reduce((e,n)=>{switch(n.type){case"text":case"instrText":return e+n.text.length;case"symbol":return e+n.char.length;case"tab":case"softHyphen":case"noBreakHyphen":return e+1;default:return e}},0)}function zy(t){return t.numPrFromStyle!=null&&t.numPr!=null&&JSON.stringify(t.numPr)===JSON.stringify(t.numPrFromStyle)}function j9(t){if(t._originalFormatting){let e=t._originalFormatting,n={...e};return t.alignment!==(e.alignment||void 0)&&(n.alignment=t.alignment||void 0),zy(t)?(delete n.numPr,delete n.numPrFromStyle):t.numPr!==e.numPr&&JSON.stringify(t.numPr)!==JSON.stringify(e.numPr)&&(n.numPr=t.numPr||void 0,delete n.numPrFromStyle),t.styleId!==(e.styleId||void 0)&&(n.styleId=t.styleId||void 0),t.pageBreakBefore!==(e.pageBreakBefore||void 0)&&(n.pageBreakBefore=t.pageBreakBefore||void 0),t.bidi!==(e.bidi||void 0)&&(n.bidi=t.bidi||void 0),n}if(t.alignment||t.spaceBefore||t.spaceAfter||t.lineSpacing||t.indentLeft||t.indentRight||t.indentFirstLine||t.numPr||t.styleId||t.borders||t.shading||t.tabs||t.outlineLevel!=null||t.contextualSpacing||t.pageBreakBefore||t.bidi)return{alignment:t.alignment||void 0,spaceBefore:t.spaceBefore||void 0,spaceAfter:t.spaceAfter||void 0,lineSpacing:t.lineSpacing||void 0,lineSpacingRule:t.lineSpacingRule||void 0,indentLeft:t.indentLeft||void 0,indentRight:t.indentRight||void 0,indentFirstLine:t.indentFirstLine||void 0,hangingIndent:t.hangingIndent||void 0,numPr:zy(t)?void 0:t.numPr||void 0,styleId:t.styleId||void 0,borders:t.borders||void 0,shading:t.shading||void 0,tabs:t.tabs||void 0,outlineLevel:t.outlineLevel??void 0,contextualSpacing:t.contextualSpacing||void 0,pageBreakBefore:t.pageBreakBefore||void 0,bidi:t.bidi||void 0}}function gS(t){let e=[],n=null,r=null,o=null;return t.forEach(i=>{let l=i.marks.find(d=>d.type.name==="footnoteRef");if(l){n&&(e.push(n),n=null,r=null),o&&(e.push(o),o=null);let d={type:l.attrs.noteType==="endnote"?"endnoteRef":"footnoteRef",id:parseInt(l.attrs.id,10)||0};e.push({type:"run",content:[d]});return}let a=i.marks.find(d=>d.type.name==="insertion"),s=i.marks.find(d=>d.type.name==="deletion");if(a||s){n&&(e.push(n),n=null,r=null),o&&(e.push(o),o=null);let d=a||s,u;if(i.type.name==="image")u=Oy(i);else if(i.type.name==="shape")u=jy(i);else{let p=i.marks.filter(y=>y.type.name!=="insertion"&&y.type.name!=="deletion"),m=Sh(p);u={type:"run",content:i.isText&&i.text?[{type:"text",text:i.text}]:[],...Object.keys(m).length>0?{formatting:m}:{}}}let f={id:d.attrs.revisionId,author:d.attrs.author||"Unknown",date:d.attrs.date||void 0},h=d.attrs.isMovePair===!0;a?h?e.push({type:"moveTo",info:f,content:[u]}):e.push({type:"insertion",info:f,content:[u]}):h?e.push({type:"moveFrom",info:f,content:[u]}):e.push({type:"deletion",info:f,content:[u]});return}let c=i.marks.find(d=>d.type.name==="hyperlink");if(c){let d=C9(c),u=o?.href||(o?.anchor?`#${o.anchor}`:"");o&&u===d||(n&&(e.push(n),n=null,r=null),o&&e.push(o),o=T9(c)),By(o,i);return}if(o&&(e.push(o),o=null),i.isText){let d=S9(i.marks);n&&r===d?$9(n,i.text||""):(n&&e.push(n),n=fS(i.text||"",i.marks),r=d)}else i.type.name==="hardBreak"?(n&&(e.push(n),n=null,r=null),e.push(pS())):i.type.name==="image"?(n&&(e.push(n),n=null,r=null),e.push(Oy(i))):i.type.name==="shape"?(n&&(e.push(n),n=null,r=null),e.push(jy(i))):i.type.name==="tab"?(n&&(e.push(n),n=null,r=null),e.push(hS())):i.type.name==="field"?(n&&(e.push(n),n=null,r=null),e.push(I9(i,i.marks))):i.type.name==="sdt"?(n&&(e.push(n),n=null,r=null),e.push(z9(i))):i.type.name==="math"&&(n&&(e.push(n),n=null,r=null),e.push(M9(i)))}),n&&e.push(n),o&&e.push(o),e}function z9(t){let e=Ep(t.attrs),n=gS(t).filter(r=>r.type==="run"||r.type==="hyperlink"||r.type==="simpleField"||r.type==="complexField"||r.type==="inlineSdt"||r.type==="mathEquation");return{type:"inlineSdt",properties:e,content:n}}function H9(t){for(let e of t)for(let n of e.cells){let r=n.formatting?.borders;if(r){let o=r.top||r.left||r.right||r.bottom||r.insideH||r.insideV;return o?{top:r.top??o,bottom:r.bottom??o,left:r.left??o,right:r.right??o,insideH:r.insideH??r.bottom??o,insideV:r.insideV??r.right??o}:void 0}}}function _9(t){let e=[],n=[],r=0;for(let o=0;o<t.childCount;o++){let i=t.child(o),l=0;i.forEach(a=>{if(a.type.name!=="tableCell"&&a.type.name!=="tableHeader")return;for(;e[o]?.[l];)l++;let s=a.attrs.rowspan||1,c=a.attrs.colspan||1;n.push({row:o,col:l,rowspan:s,colspan:c,cell:Z9(a)});for(let d=o;d<o+s;d++){let u=e[d]??[];e[d]=u;for(let f=l;f<l+c;f++)u[f]=!0}l+=c,r=Math.max(r,l)})}return{anchors:n,totalCols:r}}function W9(t){let e=new Map;t.forEach((r,o)=>{let i=0;for(let l of r.cells){let a=i;if(i+=l.formatting?.gridSpan??1,l.formatting?.vMerge){let s=e.get(a)??[];s.push({rowIndex:o,cell:l}),e.set(a,s)}}});let n=r=>{r.formatting&&(delete r.formatting.vMerge,Object.keys(r.formatting).length===0&&(r.formatting=void 0))};for(let r of e.values()){let o=null,i=0,l=-1,a=()=>{o&&i<2&&n(o),o=null,i=0};for(let{rowIndex:s,cell:c}of r){let d=c.formatting?.vMerge;d==="restart"?(a(),o=c,i=1,l=s):d==="continue"&&(o&&s===l+1?(i++,l=s):(a(),n(c)))}a()}}function yS(t){let e=t.attrs,{anchors:n,totalCols:r}=_9(t),o=new Map,i=new Map;for(let c of n){o.set(`${c.row}-${c.col}`,c);for(let d=c.row;d<c.row+c.rowspan;d++)for(let u=c.col;u<c.col+c.colspan;u++)i.set(`${d}-${u}`,c)}let l=[];for(let c=0;c<t.childCount;c++){let d=t.child(c),u=[];for(let p=0;p<r;){let m=o.get(`${c}-${p}`);if(m){let C={...m.cell.formatting??{}};m.colspan>1?C.gridSpan=m.colspan:delete C.gridSpan,m.rowspan>1?C.vMerge="restart":C.vMerge!=="restart"&&C.vMerge!=="continue"&&delete C.vMerge,u.push({...m.cell,formatting:Object.keys(C).length?C:void 0}),p+=m.colspan;continue}let y=i.get(`${c}-${p}`);if(!y){p++;continue}let w={...y.cell.formatting??{}};y.colspan>1?w.gridSpan=y.colspan:delete w.gridSpan,w.vMerge="continue",u.push({...y.cell,content:[],formatting:w}),p+=y.colspan}let f=d.attrs,h={type:"tableRow",formatting:q9(f),cells:u};f.trIns?h.structuralChange={type:"tableRowInsertion",info:{id:f.trIns.revisionId,author:f.trIns.author,...f.trIns.date?{date:f.trIns.date}:{}}}:f.trDel&&(h.structuralChange={type:"tableRowDeletion",info:{id:f.trDel.revisionId,author:f.trDel.author,...f.trDel.date?{date:f.trDel.date}:{}}}),f.trPrChange&&f.trPrChange.length>0&&(h.propertyChanges=f.trPrChange),l.push(h)}W9(l);let a=V9(e)||void 0;if(!a?.borders){let c=H9(l);if(c)if(a)a.borders=c;else return{type:"table",columnWidths:e.columnWidths||void 0,formatting:{borders:c},rows:l}}let s={type:"table",columnWidths:e.columnWidths||void 0,formatting:a,rows:l};return e.tblPrChange&&e.tblPrChange.length>0&&(s.propertyChanges=e.tblPrChange),s}function V9(t){if(t._originalFormatting){let r=t._originalFormatting,o={...r};t.styleId!==(r.styleId||void 0)&&(o.styleId=t.styleId||void 0),t.justification!==(r.justification||void 0)&&(o.justification=t.justification||void 0),t.floating!==(r.floating||void 0)&&(o.floating=t.floating||void 0),t.tableLayout!==(r.layout||void 0)&&(o.layout=t.tableLayout||void 0),t.look!==(r.look||void 0)&&(o.look=t.look||void 0),t.bidi!==(r.bidi||void 0)&&(o.bidi=t.bidi||void 0);let i=r.width?.value,l=r.width?.type;return(t.width!==i||t.widthType!==l)&&(t.width!=null||t.widthType?o.width={value:t.width??0,type:t.widthType||"dxa"}:o.width=void 0),t.cellMargins&&(o.cellMargins={top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}),o}if(!(t.styleId||t.width!=null||t.widthType||t.justification||t.tableLayout||t.floating||t.cellMargins||t.look||t.bidi))return;let e=t.cellMargins?{top:t.cellMargins.top!=null?{value:t.cellMargins.top,type:"dxa"}:void 0,bottom:t.cellMargins.bottom!=null?{value:t.cellMargins.bottom,type:"dxa"}:void 0,left:t.cellMargins.left!=null?{value:t.cellMargins.left,type:"dxa"}:void 0,right:t.cellMargins.right!=null?{value:t.cellMargins.right,type:"dxa"}:void 0}:void 0,n;return(t.width!=null||t.widthType)&&(n={value:t.width??0,type:t.widthType||"dxa"}),{styleId:t.styleId||void 0,width:n,justification:t.justification||void 0,layout:t.tableLayout||void 0,floating:t.floating||void 0,cellMargins:e,look:t.look||void 0,bidi:t.bidi||void 0}}function q9(t){if(t._originalFormatting){let e=t._originalFormatting,n={...e};return t.height!==(e.height?.value||void 0)&&(n.height=t.height?{value:t.height,type:"dxa"}:void 0),t.heightRule!==(e.heightRule||void 0)&&(n.heightRule=t.heightRule||void 0),t.isHeader!==(e.header||void 0)&&(n.header=t.isHeader||void 0),n}if(t.height||t.isHeader)return{height:t.height?{value:t.height,type:"dxa"}:void 0,heightRule:t.heightRule||void 0,header:t.isHeader||void 0}}function Z9(t){let e=t.attrs,n=[];t.forEach(o=>{o.type.name==="paragraph"?n.push(Th(o)):o.type.name==="table"&&n.push(yS(o))});let r={type:"tableCell",formatting:K9(e),content:n};if(e.cellMarker){let o=e.cellMarker,i={id:o.info.revisionId,author:o.info.author,...o.info.date?{date:o.info.date}:{}};o.kind==="ins"?r.structuralChange={type:"tableCellInsertion",info:i}:o.kind==="del"?r.structuralChange={type:"tableCellDeletion",info:i}:r.structuralChange={type:"tableCellMerge",info:i,...o.vMerge?{vMerge:o.vMerge}:{},...o.vMergeOrig?{vMergeOrig:o.vMergeOrig}:{}}}return e.tcPrChange&&e.tcPrChange.length>0&&(r.propertyChanges=e.tcPrChange),r}function K9(t){if(t._originalFormatting){let n=t._originalFormatting,r={...n};if(t.colspan>1&&(r.gridSpan=t.colspan),t.width!=null&&(r.width={value:t.width,type:t.widthType||"dxa"}),t.verticalAlign!==(n.verticalAlign||void 0)&&(r.verticalAlign=t.verticalAlign||void 0),t.backgroundColor?t._originalResolvedFill===t.backgroundColor&&n.shading?r.shading=n.shading:r.shading={fill:{rgb:t.backgroundColor}}:n.shading&&(r.shading=void 0),t.borders&&(r.borders=t.borders),t.margins){let o=t.margins,i={};o.top!=null&&(i.top={value:o.top,type:"dxa"}),o.bottom!=null&&(i.bottom={value:o.bottom,type:"dxa"}),o.left!=null&&(i.left={value:o.left,type:"dxa"}),o.right!=null&&(i.right={value:o.right,type:"dxa"}),r.margins=i}return t.textDirection!==(n.textDirection||void 0)&&(r.textDirection=t.textDirection||void 0),r}if(!(t.colspan>1||t.rowspan>1||t.width!=null||t.verticalAlign||t.backgroundColor||t.borders||t.margins||t.textDirection))return;let e;if(t.margins){let n=t.margins;e={},n.top!=null&&(e.top={value:n.top,type:"dxa"}),n.bottom!=null&&(e.bottom={value:n.bottom,type:"dxa"}),n.left!=null&&(e.left={value:n.left,type:"dxa"}),n.right!=null&&(e.right={value:n.right,type:"dxa"})}return{gridSpan:t.colspan>1?t.colspan:void 0,width:t.width!=null?{value:t.width,type:t.widthType||"dxa"}:void 0,verticalAlign:t.verticalAlign||void 0,textDirection:t.textDirection||void 0,shading:t.backgroundColor?{fill:{rgb:t.backgroundColor}}:void 0,borders:t.borders,margins:e}}function bS(t){let e=t.attrs,n=[];t.forEach(l=>{l.type.name==="paragraph"&&n.push(Th(l))});let r={type:"shape",shapeType:"rect",id:e.textBoxId||void 0,size:{width:e.width?He(e.width):0,height:e.height?He(e.height):0},textBody:{content:n.length>0?n:[{type:"paragraph",content:[]}],margins:{top:e.marginTop!=null?He(e.marginTop):void 0,bottom:e.marginBottom!=null?He(e.marginBottom):void 0,left:e.marginLeft!=null?He(e.marginLeft):void 0,right:e.marginRight!=null?He(e.marginRight):void 0}}},o=t4(e);o&&(r.position=o);let i=n4(e);if(i&&(r.wrap=i),e.fillColor&&(r.fill={type:"solid",color:{rgb:e.fillColor.replace("#","")}}),e.outlineWidth&&e.outlineWidth>0){let l={solid:"solid",dotted:"dot",dashed:"dash"};r.outline={width:He(e.outlineWidth),color:e.outlineColor?{rgb:e.outlineColor.replace("#","")}:void 0,style:e.outlineStyle&&l[e.outlineStyle]||"solid"}}return{type:"run",content:[{type:"shape",shape:r}]}}function U9(t){return{type:"paragraph",content:[bS(t)]}}function X9(t,e,n){let r=e==="bullet"?n?.trim()||"•":`%${t+1}.`;return{ilvl:t,start:1,numFmt:e,lvlText:r,lvlJc:"left",pPr:{indentLeft:720*(t+1),indentFirstLine:360,hangingIndent:!0}}}function G9(t){let e=new Set;t.descendants(c=>{if(c.type.name!=="paragraph")return!0;let d=c.attrs.listAbstractNumId;return typeof d=="number"&&e.add(d),!0});let n=0,r=()=>{for(;e.has(n);)n++;return e.add(n),n++},o=new Map,i=new Map,l=new Map;if(t.descendants(c=>{if(c.type.name!=="paragraph")return!0;let d=c.attrs,u=d.numPr?.numId;if(typeof u!="number"||u<=0)return!0;let f=d.numPr?.ilvl??0,h=o.get(u);if(h===void 0&&(h=typeof d.listAbstractNumId=="number"?d.listAbstractNumId:r(),o.set(u,h)),d.listStartOverride!==void 0){let y=i.get(u);y||(y=new Map,i.set(u,y)),y.has(f)||y.set(f,d.listStartOverride)}let p=l.get(h);p||(p=new Map,l.set(h,p));let m=d.listIsBullet??d.listNumFmt==="bullet";for(let y=0;y<=f;y++){if(p.has(y))continue;let w=d.listLevelNumFmts?.[y]??(m?"bullet":d.listNumFmt??"decimal"),C=y===f?d.listMarker:void 0;p.set(y,X9(y,w,C))}return!0}),o.size===0)return;let a=[...l.entries()].map(([c,d])=>({abstractNumId:c,multiLevelType:"hybridMultilevel",levels:[...d.values()].sort((u,f)=>u.ilvl-f.ilvl)})).sort((c,d)=>c.abstractNumId-d.abstractNumId),s=[...o.entries()].map(([c,d])=>{let u={numId:c,abstractNumId:d},f=i.get(c);return f&&f.size>0&&(u.levelOverrides=[...f.entries()].sort((h,p)=>h[0]-p[0]).map(([h,p])=>({ilvl:h,startOverride:p}))),u}).sort((c,d)=>c.numId-d.numId);return{abstractNums:a,nums:s}}function Y9(t,e){let n={content:Ih(t),finalSectionProperties:e?.package.document.finalSectionProperties,sections:e?.package.document.sections,comments:e?.package.document.comments},r=e?{...e,package:{...e.package,document:n}}:{package:{document:n,numbering:G9(t)}},o=t.attrs.watermark??null,i=Vv(r)??null;return o!==i?u4(r,o):r}function Ih(t){let e=[],n=[],r=()=>{for(let o of n)e.push({type:"paragraph",content:[o]});n=[]};return t.forEach(o=>{if(o.type.name==="paragraph"){let i=Th(o);n.length>0&&(i.content=[...n,...i.content],n=[]),e.push(i)}else if(o.type.name==="table")r(),e.push(yS(o));else if(o.type.name==="blockSdt")r(),e.push(J9(o));else if(o.type.name==="textBox"){let i=o.attrs;e4(i)?n.push(bS(o)):(r(),e.push(U9(o)))}else o.type.name==="pageBreak"&&(r(),e.push(Q9()))}),r(),e}function J9(t){return{type:"blockSdt",properties:Ep(t.attrs),content:Ih(t)}}function Q9(){return{type:"paragraph",content:[{type:"run",content:[{type:"break",breakType:"page"}]}]}}function Mh(t){return Ih(t)}function wS(t){let{$from:e}=t.selection,n=null,r=null,o=null,i=-1,l=-1;for(let a=e.depth;a>0;a--){let s=e.node(a);if(s.type.name==="tableCell"||s.type.name==="tableHeader"){o=s;let c=e.node(a-1);if(c?.type.name==="tableRow"){let d=0;c.forEach((u,f,h)=>{if(l===-1){if(h===e.index(a-1)){l=d;return}d+=u.attrs.colspan||1}})}}else if(s.type.name==="tableRow")e.node(a-1)?.type.name==="table"&&(i=e.index(a-1));else if(s.type.name==="table"){n=s,r=e.before(a);break}}return!n||r==null||!o||i<0||l<0?null:{table:n,tablePos:r,cell:o,row:i,col:l,rowspan:o.attrs.rowspan||1,colspan:o.attrs.colspan||1}}function Hy(t){let e=[],n=[],r=0;for(let o=0;o<t.childCount;o++){let i=t.child(o),l=0;i.forEach(a=>{for(;e[o]?.[l];)l++;let s=a.attrs.rowspan||1,c=a.attrs.colspan||1;n.push({data:a,row:o,col:l,rowspan:s,colspan:c});for(let d=o;d<o+s;d++){let u=e[d]??[];e[d]=u;for(let f=l;f<l+c;f++)u[f]=!0}l+=c,r=Math.max(r,l)})}return{anchors:n,totalCols:r}}function _y(t,e,n,r,o){let i={...t.attrs},l=o.reduce((c,d)=>c+d,0),a=Nb(o,e,n),s=n!==(t.attrs.colspan||1)||r!==(t.attrs.rowspan||1);return i.colspan=n,i.rowspan=r,i.colwidth=null,l>0&&(i.width=Math.round(a/l*5e3),i.widthType="pct"),s&&(i._originalFormatting=null),i}function eZ(t,e,n,r){let o=e+1;for(let i=0;i<t.childCount;i++){let l=t.child(i),a=o+1,s=0;for(let c=0;c<l.childCount;c++){let d=l.child(c);if(i===n&&s===r)return a;s+=d.attrs.colspan||1,a+=d.nodeSize}o+=l.nodeSize}return null}function tZ(t,e){let n=t.attrs.width??9360;return Array.isArray(t.attrs.columnWidths)&&t.attrs.columnWidths.length>0?[...t.attrs.columnWidths]:Array.from({length:e},()=>Math.floor(n/Math.max(e,1)))}function nZ(t){let e=wS(t);return e?{...Ob(e.rowspan,e.colspan),capturedCellRow:e.row,capturedCellCol:e.col}:null}function rZ(t,e,n,r,o,i){if(n<1||r<1)return!1;let l=wS(t);if(!l||!e)return!1;let a=l;if(o!=null&&i!=null&&(o!==l.row||i!==l.col)){let{anchors:k}=Hy(l.table),x=k.find(T=>T.row===o&&T.col===i);if(!x)return!1;a={...l,cell:x.data,row:x.row,col:x.col,rowspan:x.rowspan,colspan:x.colspan}}if(n<a.rowspan||r<a.colspan||n===1&&r===1)return!1;let{anchors:s,totalCols:c}=Hy(a.table),d=tZ(a.table,c),u=Lb(d,a.col,a.colspan,r),f=s.find(k=>k.row===a.row&&k.col===a.col);if(!f)return!1;let h=Bb(s,f,n,r,a.table.childCount,k=>{if(k)return f.data;let x=f.data.type.schema.nodes.paragraph.create(),T=_y(f.data,0,1,1,u);return f.data.type.create(T,x)}),p=a.row+a.rowspan,m=Array.from({length:h.newRowCount},(k,x)=>x<p?{...a.table.child(x)?.attrs??{}}:x<a.row+n?{...a.table.child(p-1)?.attrs??{}}:{...a.table.child(x-h.deltaRows)?.attrs??{}}),y=Array.from({length:h.newRowCount},()=>[]);h.anchors.sort((k,x)=>k.row===x.row?k.col-x.col:k.row-x.row).forEach(k=>{let x=_y(k.data,k.col,k.colspan,k.rowspan,u);y[k.row].push(k.data.type.create(x,k.data.content))});let w=y.map((k,x)=>a.table.type.schema.nodes.tableRow.create(m[x],k)),C=a.table.type.create({...a.table.attrs,columnWidths:u},w),g=t.tr.replaceWith(a.tablePos,a.tablePos+a.table.nodeSize,C),v=g.doc.nodeAt(a.tablePos);if(v){let k=eZ(v,a.tablePos,a.row,a.col);k!=null&&(g=g.setSelection(ye.near(g.doc.resolve(k+1))))}return e(g.scrollIntoView()),!0}var Ye=Wc.getCommands();function oZ(t,e){return Ye.insertTable(t,e)}function xS(t,e){return Ye.addRowAbove()(t,e)}function Rh(t,e){return Ye.addRowBelow()(t,e)}function vS(t,e){return Ye.deleteRow()(t,e)}function kS(t,e){return Ye.addColumnLeft()(t,e)}function Ph(t,e){return Ye.addColumnRight()(t,e)}function CS(t,e){return Ye.deleteColumn()(t,e)}function Eh(t,e){return Ye.deleteTable()(t,e)}function SS(t,e){return Ye.selectTable()(t,e)}function iZ(t,e){return Ye.selectRow()(t,e)}function lZ(t,e){return Ye.selectColumn()(t,e)}function TS(t,e){return Ye.mergeCells()(t,e)}function ol(t,e,n){return Ye.setCellBorder(t,e,n)}function aZ(t,e){return Ye.removeTableBorders()(t,e)}function sZ(t,e,n){return Ye.setAllTableBorders(n)(t,e)}function cZ(t,e,n){return Ye.setOutsideTableBorders(n)(t,e)}function dZ(t,e,n){return Ye.setInsideTableBorders(n)(t,e)}function uZ(t){return Ye.setCellVerticalAlign(t)}function fZ(t){return Ye.setCellMargins(t)}function pZ(t){return Ye.setCellTextDirection(t)}function hZ(){return Ye.toggleNoWrap()}function mZ(t,e){return Ye.setRowHeight(t,e)}function gZ(){return Ye.toggleHeaderRow()}function yZ(){return Ye.distributeColumns()}function bZ(){return Ye.autoFitContents()}function wZ(t){return Ye.setTableProperties(t)}function xZ(t){return Ye.applyTableStyle(t)}function vZ(t){return Ye.setCellFillColor(t)}function kZ(t){return Ye.setTableBorderColor(t)}function CZ(t){return Ye.setTableBorderWidth(t)}var SZ=Wc.getCommands();function TZ(t,e,n,r){if(!e)return!0;let o=t.tr.insert(r,n),i=Oi(t),l=t.schema.marks.insertion;return i&&l&&o.addMark(r,r+n.nodeSize,l.create({revisionId:i.revisionId,author:i.author,date:i.date})),e(o.scrollIntoView()),!0}var $Z=612;function IZ(t,e,n){let r=n?.maxWidth??$Z,o=new FileReader;o.onload=()=>{let i=o.result,l=new Image;l.onload=()=>{let a=l.naturalWidth,s=l.naturalHeight;a>r&&(s=Math.round(s*(r/a)),a=r);let c=t.state.schema.nodes.image.create({src:i,alt:e.name,width:a,height:s,rId:`rId_img_${Date.now()}_${Math.round(Math.random()*1e9)}`,wrapType:"inline",displayMode:"inline"});TZ(t.state,t.dispatch,c,t.state.selection.from),t.focus(),n?.onInserted?.()},l.onerror=()=>n?.onError?.(new Error("Failed to decode image")),l.src=i},o.onerror=()=>n?.onError?.(o.error),o.readAsDataURL(e)}function $S(t,e,n){return SZ.setImageWrapType(t,e,n)}function IS(t,e,n){return(r,o)=>{let i=r.schema.marks.insertion,l=r.schema.marks.deletion;if(!i&&!l)return!1;let a=n==="accept"?i:l,s=n==="accept"?l:i;if(o){let c=r.tr,d=[];r.doc.nodesBetween(t,e,(u,f)=>{if(!u.isInline)return;let h=f+u.nodeSize,p=Math.max(t,f),m=Math.min(e,h);s&&u.marks.some(y=>y.type===s)&&d.push({from:p,to:m}),a&&u.marks.some(y=>y.type===a)&&c.removeMark(p,m,a)});for(let u of d.reverse())c.delete(u.from,u.to);c.steps.length>0&&o(c)}return!0}}function MZ(t,e){return IS(t,e,"accept")}function RZ(t,e){return IS(t,e,"reject")}function PZ(t,e){let n=[];return t.doc.descendants((r,o)=>{if(r.type.name!=="paragraph")return;let i=r.attrs.pPrIns,l=r.attrs.pPrDel;i&&i.revisionId===e&&n.push({pos:o,node:r,kind:"pPrIns"}),l&&l.revisionId===e&&n.push({pos:o,node:r,kind:"pPrDel"})}),n}function EZ(t,e){let n=[];return t.doc.descendants((r,o)=>{if(r.type.name!=="paragraph")return;let i=r.attrs.pPrChange;Array.isArray(i)&&i.forEach((l,a)=>{!l?.info||typeof l.info.id!="number"||l.info.id===e&&n.push({pos:o,node:r,entryIndex:a,prior:l.previousFormatting,current:l.currentFormatting})})}),n}function FZ(t,e){let n=[],r=t.schema.marks.insertion,o=t.schema.marks.deletion;return t.doc.descendants((i,l)=>{if(i.isInline){for(let a of i.marks)if((r&&a.type===r||o&&a.type===o)&&a.attrs.revisionId===e){let s=a.type===r?"insertion":"deletion",c=n[n.length-1];c&&c.markName===s&&c.to===l?c.to=l+i.nodeSize:n.push({from:l,to:l+i.nodeSize,markName:s})}}}),n}function AZ(t,e,n){let r=t.doc.nodeAt(e);if(!r)return;let o=e+r.nodeSize,i=t.doc.nodeAt(o);!i||i.type.name!=="paragraph"||(t.setNodeMarkup(e,void 0,{...i.attrs,pPrIns:null,pPrDel:null}),t.join(o))}function mu(t,e,n){let r=t.doc.nodeAt(e);if(!r)return;let o={...r.attrs};o[n]=null,t.setNodeMarkup(e,void 0,o)}function DZ(t,e,n){let r=t.doc.nodeAt(e);if(!r)return;let o=r.attrs.pPrChange;if(!Array.isArray(o)||n<0||n>=o.length)return;let i=o.slice();i.splice(n,1),t.setNodeMarkup(e,void 0,{...r.attrs,pPrChange:i.length>0?i:null})}function NZ(t,e,n){let r={...t},o=["alignment","spaceBefore","spaceAfter","lineSpacing","lineSpacingRule","beforeAutospacing","afterAutospacing","spacingExplicit","indentLeft","indentRight","indentFirstLine","hangingIndent","styleId","borders","shading","tabs","pageBreakBefore","keepNext","keepLines","contextualSpacing","bidi","outlineLevel","numPr"];for(let i of o)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]??null);return n?.numPr&&!Object.prototype.hasOwnProperty.call(e,"numPr")&&(r.numPr=null),r.numPr==null&&(r.listIsBullet=null,r.listNumFmt=null,r.listMarker=null),r}function LZ(t,e){let n=[];return t.doc.descendants((r,o)=>{if(r.type.name!=="tableRow")return;let i=r.attrs.trIns,l=r.attrs.trDel;i&&i.revisionId===e&&n.push({pos:o,node:r,kind:"trIns"}),l&&l.revisionId===e&&n.push({pos:o,node:r,kind:"trDel"})}),n}function BZ(t,e){let n=[];return t.doc.descendants((r,o)=>{if(r.type.name!=="tableCell"&&r.type.name!=="tableHeader")return;let i=r.attrs.cellMarker;i?.info?.revisionId===e&&n.push({pos:o,node:r,cellKind:i.kind})}),n}function MS(t,e){return(n,r)=>{let o=PZ(n,t),i=FZ(n,t),l=EZ(n,t),a=LZ(n,t),s=BZ(n,t);if(o.length===0&&i.length===0&&l.length===0&&a.length===0&&s.length===0)return!1;if(!r)return!0;let c=n.tr;c.setMeta(Kv,!0);let d=n.schema.marks.insertion,u=n.schema.marks.deletion,f=[...i].sort((w,C)=>C.from-w.from);for(let w of f){let C=w.markName==="insertion";if(e==="accept"&&!C||e==="reject"&&C)c.delete(w.from,w.to);else{let g=C?d:u;g&&c.removeMark(w.from,w.to,g)}}let h=[...o].sort((w,C)=>C.pos-w.pos);for(let w of h){let C=c.mapping.map(w.pos),g=c.doc.nodeAt(C);if(!g||g.type.name!=="paragraph")continue;let v=w.kind==="pPrIns"&&g.attrs.pPrIns?.revisionId===t,k=w.kind==="pPrDel"&&g.attrs.pPrDel?.revisionId===t;if(!(!v&&!k))if(e==="reject"&&w.kind==="pPrIns"||e==="accept"&&w.kind==="pPrDel"){let x=C+g.nodeSize,T=c.doc.nodeAt(x);!T||T.type.name!=="paragraph"?mu(c,C,w.kind):(mu(c,C,w.kind),AZ(c,C))}else mu(c,C,w.kind)}let p=[...l].sort((w,C)=>C.pos-w.pos);for(let w of p){let C=c.mapping.map(w.pos),g=c.doc.nodeAt(C);if(!g||g.type.name!=="paragraph")continue;let v=g.attrs.pPrChange;if(!Array.isArray(v))continue;let k=v.findIndex(x=>x.info.id===t);if(!(k<0))if(e==="reject"&&w.prior){let x=NZ(g.attrs,w.prior,w.current),T=v.slice();T.splice(k,1),c.setNodeMarkup(C,void 0,{...x,pPrChange:T.length>0?T:null})}else DZ(c,C,k)}let m=[...s].sort((w,C)=>C.pos-w.pos);for(let w of m){let C=c.mapping.map(w.pos),g=c.doc.nodeAt(C);if(!g||g.type.name!=="tableCell"&&g.type.name!=="tableHeader")continue;let v=g.attrs.cellMarker;!v||v.info.revisionId!==t||c.setNodeMarkup(C,void 0,{...g.attrs,cellMarker:null})}let y=[...a].sort((w,C)=>C.pos-w.pos);for(let w of y){let C=c.mapping.map(w.pos),g=c.doc.nodeAt(C);if(!g||g.type.name!=="tableRow")continue;let v=g.attrs.trIns,k=g.attrs.trDel,x=v?.revisionId===t,T=k?.revisionId===t;if(!(!x&&!T))if(e==="reject"&&x||e==="accept"&&T){let $=c.doc.resolve(C+1),M=$.node($.depth-1),I=$.before($.depth-1);if(M?.type.name==="table"&&M.childCount>1)c.delete(C,C+g.nodeSize);else if(M?.type.name==="table")if(c.doc.resolve(I).parent.childCount===1){let F=c.doc.type.schema.nodes.paragraph;c.replaceWith(I,I+M.nodeSize,F.create())}else c.delete(I,I+M.nodeSize);else{let F={...g.attrs};x&&(F.trIns=null),T&&(F.trDel=null),c.setNodeMarkup(C,void 0,F)}}else{let $={...g.attrs};x&&($.trIns=null),T&&($.trDel=null),c.setNodeMarkup(C,void 0,$)}}return c.steps.length===0?!1:(r(c),!0)}}function OZ(t){return MS(t,"accept")}function jZ(t){return MS(t,"reject")}function zZ(t){return t.doc.attrs.watermark??null}function HZ(t){return(e,n)=>(n&&n(e.tr.setDocAttribute("watermark",t)),!0)}var _Z=(t,e)=>{let{schema:n}=t,r=n.nodes.pageBreak,o=n.nodes.paragraph;if(!r||!o)return!1;if(e){let{$from:i}=t.selection,l=t.tr,a=r.create(),s=a.nodeSize,c;if(i.parent.isTextblock)if(i.parentOffset>0&&i.parentOffset<i.parent.content.size){l.split(i.pos);let d=l.mapping.map(i.pos);l.insert(d,oe.from([a,o.create()])),c=d+s+1}else if(i.parentOffset===i.parent.content.size){let d=i.after();l.insert(d,oe.from([a,o.create()])),c=d+s+1}else{let d=i.before();l.insert(d,a),c=d+s+1}else{let d=i.pos;l.insert(d,oe.from([a,o.create()])),c=d+s+1}l.setSelection(ye.create(l.doc,c)),e(l.scrollIntoView())}return!0};function RS(t){return(e,n)=>{let{schema:r}=e,o=r.nodes.paragraph;if(!o)return!1;let{$from:i}=e.selection;if(!(i.parent.isTextblock?e.doc.resolve(i.before()).depth===0:i.depth===0))return!1;if(n){let l=e.tr,a;if(i.parent.isTextblock){let s=i.before();l.split(i.pos);let c=l.doc.nodeAt(s);c&&l.setNodeMarkup(s,void 0,{...c.attrs,sectionBreakType:t}),a=l.mapping.map(i.pos)}else{let s=i.pos;l.insert(s,o.create({sectionBreakType:t})),a=l.mapping.map(i.pos)}l.setSelection(ye.create(l.doc,a)),n(l.scrollIntoView())}return!0}}var WZ=RS("nextPage"),VZ=RS("continuous"),st=Wc.getCommands();function qZ(t){return st.setAlignment(t)}st.alignLeft();st.alignCenter();st.alignRight();st.alignJustify();function ZZ(t,e="auto"){return st.setLineSpacing(t,e)}st.singleSpacing();st.oneAndHalfSpacing();st.doubleSpacing();function KZ(t=720){return st.increaseIndent(t)}function UZ(t=720){return st.decreaseIndent(t)}function XZ(t){return st.setIndentLeft(t)}function GZ(t){return st.setIndentRight(t)}function Wy(t,e){return st.setIndentFirstLine(t,e)}var YZ=st.toggleBulletList(),JZ=st.toggleNumberedList(),QZ=st.increaseListLevel(),eK=st.decreaseListLevel();st.removeList();function cc(t,e){return st.applyStyle(t,e)}st.clearStyle();st.removeSectionBreak();function tK(t){return st.removeTabStop(t)}var nK=st.setRtl(),rK=st.setLtr(),oK=st.generateTOC(),Ht=Wc.getCommands(),iK=Ht.toggleBold(),lK=Ht.toggleItalic(),aK=Ht.toggleUnderline(),sK=Ht.toggleStrike(),cK=Ht.toggleSuperscript(),dK=Ht.toggleSubscript();function Vy(t){return Ht.setTextColor(t)}var uK=Ht.clearTextColor();function fK(t){return Ht.setHighlight(t)}Ht.clearHighlight();function pK(t){return Ht.setFontSize(t)}Ht.clearFontSize();function hK(t){return Ht.setFontFamily(t)}Ht.clearFontFamily();function mK(t,e){return Ht.setHyperlink(t,e)}var gK=Ht.removeHyperlink();function qy(t,e,n){return Ht.insertHyperlink(t,e,n)}function PS(t,e,n,r){if(n){let o={active:t};r!==void 0&&(o.author=r);let i=e.tr.setMeta(Vt,o);n(i)}return!0}function Rr(t,e){return{revisionId:Uv(),author:t.author,date:e??new Date().toISOString()}}function jf(t){return{revisionId:t.revisionId,author:t.author,date:t.date}}function dc(t,e,n){let r=null;return t.descendants(o=>{if(r)return!1;if(!o.isText)return!0;let i=o.marks.find(l=>l.type.name===e&&l.attrs.author===n);return i?(r=jf(i.attrs),!1):!0}),r}function uc(t,e,n,r){let o=i=>{if(!i?.isText)return null;let l=i.marks.find(a=>a.type.name===n&&a.attrs.author===r);return l?jf(l.attrs):null};try{let i=t.resolve(e);for(let l of[i.nodeBefore,i.nodeAfter]){let a=o(l);if(a)return a}if(i.parentOffset===0&&i.depth>0){let l=i.before(i.depth);if(l>0){let a=t.resolve(l).nodeBefore;if(a){let s=dc(a,n,r);if(s)return s}}}if(i.parentOffset===i.parent.content.size&&i.depth>0){let l=i.after(i.depth),a=t.resolve(l).nodeAfter;if(a){let s=dc(a,n,r);if(s)return s}}if(n==="insertion"||n==="deletion"){let l=n==="insertion"?"ins":"del";for(let a=i.depth;a>0;a--){let s=i.node(a);if(!(s.type.name==="tableCell"||s.type.name==="tableHeader"))continue;let c=s.attrs.cellMarker;if(c&&c.kind===l&&c.info&&c.info.author===r)return jf(c.info);break}}}catch{}return null}function ed(t,e,n,r,o){return uc(t,e,r,o)??uc(t,n,r,o)}function Fh(t,e,n,r){let o=n==="pPrIns"?"insertion":"deletion";try{let i=t.resolve(e);for(let s of[i.nodeBefore,i.nodeAfter]){if(s?.type.name!=="paragraph")continue;let c=s.attrs[n];if(c&&c.author===r)return c}let l=i.nodeBefore;if(l?.type.name==="paragraph"){let s=dc(l,o,r);if(s)return s}let a=i.nodeAfter;if(a?.type.name==="paragraph"){let s=dc(a,o,r);if(s)return s}}catch{}return null}function td(t,e,n,r,o,i,l,a){let s=[];if(e.nodesBetween(n,r,(d,u)=>{if(!d.isText&&!(d.isInline&&d.type.allowsMarkType(i)))return;let f=Math.max(u,n),h=Math.min(u+d.nodeSize,r);if(f>=h)return;let p=d.marks.some(m=>m.type===o&&m.attrs.author===l.author);s.push({from:f,to:h,isOwnInsert:p})}),s.length===0)return;let c=ed(e,n,r,"deletion",l.author)??Rr(l,a);for(let d=s.length-1;d>=0;d--){let u=s[d];u.isOwnInsert?t.delete(u.from,u.to):t.addMark(u.from,u.to,i.create(c))}}function Zy(t,e,n){let r=Vt.getState(t);if(!r?.active)return!1;let{$from:o,$to:i,empty:l}=t.selection,a=t.schema.marks.insertion,s=t.schema.marks.deletion;if(!a||!s)return!1;if(!e)return!0;let c=t.tr;if(c.setMeta(En,!0),!l){td(c,t.doc,o.pos,i.pos,a,s,r);let m=c.mapping.map(i.pos);return c.setSelection(ye.near(c.doc.resolve(m))),e(c.scrollIntoView()),!0}let d=n==="backward",u=d?o.pos-1:o.pos,f=d?o.pos:o.pos+1;if(u<0||f>t.doc.content.size)return!0;let h=t.doc.resolve(u).nodeAfter;if(!h||!(h.isText||h.isInline&&h.type.allowsMarkType(s)))return!1;let p=h.marks.some(m=>m.type===a&&m.attrs.author===r.author);if(h.marks.some(m=>m.type===s)){let m=d?u:f;c.setSelection(ye.near(c.doc.resolve(m)))}else if(p)c.delete(u,f);else{let m=ed(t.doc,u,f,"deletion",r.author)||Rr(r);c.addMark(u,f,s.create(m));let y=d?u:f;c.setSelection(ye.near(c.doc.resolve(y)))}return e(c.scrollIntoView()),!0}function Ah(t,e,n,r,o,i,l){e.nodesBetween(n,r,(a,s)=>{if(!a.isText&&!(a.isInline&&a.type.allowsMarkType(o))||a.marks.some(u=>u.type===o||i&&u.type===i))return;let c=Math.max(s,n),d=Math.min(s+a.nodeSize,r);c>=d||t.addMark(c,d,o.create(l))})}function Ky(t,e,n,r,o){let i=t.state.schema.marks.insertion;if(!i)return!1;let l=t.state.tr;l.setMeta(En,!0);let a=uc(t.state.doc,e,"insertion",o.author)||Rr(o);if(e!==n){let d=t.state.schema.marks.deletion;d&&td(l,t.state.doc,e,n,i,d,o,a.date)}let s=l.mapping.map(n);l.insertText(r,s,s);let c=t.state.schema.marks.deletion;return c&&l.removeMark(s,s+r.length,c),l.addMark(s,s+r.length,i.create(a)),t.dispatch(l.scrollIntoView()),!0}function yK(t,e,n){let r=t.state.schema.marks.insertion,o=t.state.schema.marks.deletion;if(!r||!o)return!1;let{selection:i}=t.state;if(!(i instanceof ye)||i.empty)return!1;let{from:l,to:a}=i,s=t.state.tr;s.setMeta(En,!0);let c=uc(t.state.doc,l,"insertion",n.author)||Rr(n);td(s,t.state.doc,l,a,r,o,n,c.date);let d=s.mapping.map(a);s.setSelection(ye.near(s.doc.resolve(d))),s.replaceSelection(e);let u=s.selection.from;return u>d&&Ah(s,s.doc,d,u,r,o,c),t.dispatch(s.scrollIntoView()),!0}function bK(t,e){let n=Vt.getState(t);if(!n?.active)return!1;let{$from:r,$to:o}=t.selection;if(r.parent.type.name!=="paragraph"||o.parent.type.name!=="paragraph")return!1;if(!e)return!0;let i=t.schema.marks.insertion,l=t.schema.marks.deletion;if(!i||!l)return!1;let a=r.parent,s=(t.storedMarks??r.marks()).filter(h=>Bp.has(h.type.name)),c=t.tr;if(c.setMeta(En,!0),!t.selection.empty){td(c,t.doc,r.pos,o.pos,i,l,n);let h=c.mapping.map(r.pos);c.setSelection(ye.near(c.doc.resolve(h)))}let d=c.selection.$from,u=d.before(d.depth);c.split(c.selection.from,1);let f=c.doc.nodeAt(u);if(f&&f.type.name==="paragraph"){let h=Fh(c.doc,u,"pPrIns",n.author)??Rr(n);c.setNodeMarkup(u,void 0,{...f.attrs,pPrIns:h})}return d1(c,a,s,t.schema,Ap(t)),e(c.scrollIntoView()),!0}function wK(t,e){let n=Vt.getState(t);if(!n?.active)return!1;let{$from:r,empty:o}=t.selection;if(!o||r.parentOffset!==0||r.parent.type.name!=="paragraph")return!1;let i=r.before(r.depth);if(i<=0)return!1;let l=t.doc.resolve(i).nodeBefore;if(!l||l.type.name!=="paragraph")return!1;let a=l.attrs.pPrIns;if(a&&a.author===n.author){if(!e)return!0;let f=i-l.nodeSize,h=r.parent,p=t.tr.setNodeMarkup(f,void 0,h.attrs);return p.join(i),p.setMeta(En,!0),e(p.scrollIntoView()),!0}if(l.attrs.pPrDel){if(e){let f=i-1,h=t.tr.setSelection(ye.near(t.doc.resolve(f)));e(h)}return!0}if(!e)return!0;let s=i-l.nodeSize,c=Fh(t.doc,s,"pPrDel",n.author)??Rr(n),d=t.tr.setNodeMarkup(s,void 0,{...l.attrs,pPrDel:c});d.setMeta(En,!0);let u=i-1;return d.setSelection(ye.near(d.doc.resolve(u))),e(d.scrollIntoView()),!0}function xK(t,e){let n=Vt.getState(t);if(!n?.active)return!1;let{$from:r,empty:o}=t.selection;if(!o||r.parent.type.name!=="paragraph"||r.parentOffset!==r.parent.content.size)return!1;let i=r.parent,l=r.before(r.depth),a=l+i.nodeSize;if(a>=t.doc.content.size)return!1;let s=t.doc.resolve(a).nodeAfter;if(!s||s.type.name!=="paragraph")return!1;let c=i.attrs.pPrIns;if(c&&c.author===n.author){if(!e)return!0;let f=t.tr.setNodeMarkup(l,void 0,s.attrs);return f.join(a),f.setMeta(En,!0),e(f.scrollIntoView()),!0}if(i.attrs.pPrDel||!e)return!0;let d=Fh(t.doc,l,"pPrDel",n.author)??Rr(n),u=t.tr.setNodeMarkup(l,void 0,{...i.attrs,pPrDel:d});return u.setMeta(En,!0),e(u.scrollIntoView()),!0}function vK(t,e,n){let r=t.state.schema.marks.insertion;if(!r)return;let o=t.state.selection.to;if(o<=e)return;let i=t.state.tr;i.setMeta(En,!0);let l=t.state.schema.marks.deletion,a=ed(t.state.doc,e,o,"insertion",n.author)??Rr(n);if(Ah(i,t.state.doc,e,o,r,l,a),i.steps.length===0)return;let s=i.mapping.map(o);i.setSelection(ye.create(i.doc,s)),t.dispatch(i)}function ES(t=!1,e="User"){let n=!1,r=null;return new zt({key:Vt,state:{init(){return{active:t,author:e}},apply(o,i){let l=o.getMeta(Vt);return l?{...i,...l}:i}},props:{handleDOMEvents:{compositionstart(o){return Vt.getState(o.state)?.active&&(n=!0,r=o.state.selection.from),!1},compositionend(o){let i=Vt.getState(o.state),l=r;return r=null,!i?.active||l==null?(n=!1,!1):(Promise.resolve().then(()=>{try{let a=Vt.getState(o.state);a?.active&&vK(o,l,a)}finally{n=!1}}),!1)},beforeinput(o,i){let l=Vt.getState(o.state);if(!l?.active||n||i.isComposing)return!1;if(i.inputType==="insertText"&&i.data){i.preventDefault();let{from:a,to:s}=o.state.selection;return Ky(o,a,s,i.data,l)}return!1}},handlePaste(o,i,l){let a=Vt.getState(o.state);return a?.active?yK(o,l,a):!1},handleKeyDown(o,i){return Vt.getState(o.state)?.active?i.key==="Enter"&&!i.shiftKey?bK(o.state,o.dispatch):i.key==="Backspace"?wK(o.state,o.dispatch)?!0:Zy(o.state,o.dispatch,"backward"):i.key==="Delete"?xK(o.state,o.dispatch)?!0:Zy(o.state,o.dispatch,"forward"):!1:!1},handleTextInput(o,i,l,a){let s=Vt.getState(o.state);return!s?.active||n||o.composing?!1:Ky(o,i,l,a,s)}},appendTransaction(o,i,l){let a=Vt.getState(l);if(!a?.active||n)return null;let s=o.find(f=>f.docChanged&&!f.getMeta(En)&&!f.getMeta(Kv)&&!$3(f));if(!s)return null;let c=l.schema.marks.insertion;if(!c)return null;let d=l.tr;d.setMeta(En,!0);let u=l.schema.marks.deletion;return s.steps.forEach(f=>{f.getMap().forEach((h,p,m,y)=>{if(y>m){let w=ed(l.doc,m,y,"insertion",a.author)??Rr(a);Ah(d,l.doc,m,y,c,u,w)}})}),d.steps.length>0?d:null}})}function FS(t){let{selection:e,doc:n}=t,{from:r,to:o,empty:i}=e,l=n.resolve(r),a=0,s=0;n.forEach((y,w,C)=>{w<=r&&(a=C),w<=o&&(s=C)});let c={},d=l.parent,u=d.type.name==="paragraph"&&d.textContent.length===0,f=d.attrs?.defaultTextFormatting,h=t.storedMarks||e.$from.marks();u&&h.length===0&&f&&(c={...f});for(let y of h)switch(y.type.name){case"bold":c.bold=!0;break;case"italic":c.italic=!0;break;case"underline":c.underline={style:y.attrs.style||"single",color:y.attrs.color};break;case"strike":y.attrs.double?c.doubleStrike=!0:c.strike=!0;break;case"textColor":c.color={rgb:y.attrs.rgb,themeColor:y.attrs.themeColor};break;case"highlight":c.highlight=y.attrs.color;break;case"fontSize":c.fontSize=y.attrs.size??y.attrs.sizeCs,y.attrs.sizeCs!=null&&(c.fontSizeCs=y.attrs.sizeCs);break;case"fontFamily":c.fontFamily={ascii:y.attrs.ascii,hAnsi:y.attrs.hAnsi};break;case"superscript":c.vertAlign="superscript";break;case"subscript":c.vertAlign="subscript";break}let p={},m=null;return d.type.name==="paragraph"&&(d.attrs.alignment&&(p.alignment=d.attrs.alignment),d.attrs.lineSpacing&&(p.lineSpacing=d.attrs.lineSpacing,p.lineSpacingRule=d.attrs.lineSpacingRule),d.attrs.numPr&&(p.numPr=d.attrs.numPr),d.attrs.indentLeft&&(p.indentLeft=d.attrs.indentLeft),d.attrs.indentRight&&(p.indentRight=d.attrs.indentRight),d.attrs.indentFirstLine&&(p.indentFirstLine=d.attrs.indentFirstLine),d.attrs.hangingIndent&&(p.hangingIndent=d.attrs.hangingIndent),d.attrs.tabs&&(p.tabs=d.attrs.tabs),d.attrs.bidi&&(p.bidi=!0),d.attrs.styleId&&(m=d.attrs.styleId)),{hasSelection:!i,isMultiParagraph:a!==s,textFormatting:c,paragraphFormatting:p,styleId:m,startParagraphIndex:a,endParagraphIndex:s}}function Uy(t){if(!(typeof t!="string"||!t))try{return JSON.parse(t)}catch{return}}function AS(t,e){return!(e.tag!==void 0&&t.tag!==e.tag||e.alias!==void 0&&t.alias!==e.alias||e.id!==void 0&&t.id!==e.id||e.type!==void 0&&(t.sdtType??"richText")!==e.type)}function Dh(t){return t.type.name==="blockSdt"||t.type.name==="sdt"}function kK(t,e,n){let r=t.attrs;return{tag:r.tag!=null?String(r.tag):void 0,alias:r.alias!=null?String(r.alias):void 0,id:typeof r.id=="number"?r.id:void 0,sdtType:r.sdtType??"richText",lock:r.lock??void 0,showingPlaceholder:r.showingPlaceholder===!0?!0:void 0,checked:typeof r.checked=="boolean"?r.checked:void 0,dateFormat:r.dateFormat!=null?String(r.dateFormat):void 0,listItems:Uy(r.listItems),dataBinding:Uy(r.dataBinding),dateValue:/<w:date\b[^>]*\bw:fullDate="(\d{4}-\d{2}-\d{2})/.exec(String(r.rawPropertiesXml??""))?.[1],text:t.textBetween(0,t.content.size,`
103
+ `),pos:e,depth:n}}function nd(t,e={}){let n=[],r=(o,i,l)=>{o.forEach((a,s)=>{let c=i+s,d=Dh(a);d&&AS(a.attrs,e)&&n.push(kK(a,c,l)),r(a,c+1,d?l+1:l)})};return r(t,0,0),n}function CK(t,e){return nd(t,e)[0]?.pos??null}function Nh(t,e){let n=null;return t.descendants((r,o)=>n?!1:Dh(r)&&AS(r.attrs,e)?(n={node:r,pos:o},!1):!0),n}function SK(t,e){let n=t.nodeAt(e);return n&&Dh(n)?{node:n,pos:e}:null}function TK(t){let e;return t.descendants(n=>e?!1:n.isText?(e=n.marks,!1):!0),e}function $K(t,e,n,r){if(!e)return[];if(n==="plainText"||!e.includes(`
104
+ `))return[t.text(e,r)];let o=t.nodes.hardBreak,i=[];return e.split(`
105
+ `).forEach((l,a)=>{a>0&&o&&i.push(o.create()),l&&i.push(t.text(l,r))}),i}function IK(t,e,n,r={}){let o=Nh(t.doc,e);if(!o)throw new Ao(e);let i=o.node.attrs;if(!r.force&&dS(i.lock))throw new sc(i.lock,"edit");let l=i.sdtType??"richText";if(!r.force&&!h9(l))throw new f9(l);if(!r.force&&i.dataBinding!=null)throw new cS;let{schema:a}=t,s=o.node.type.name==="sdt"?$K(a,n,l,TK(o.node)):(l==="plainText"?[n]:n.split(`
106
+ `)).map(f=>a.nodes.paragraph.create(null,f?a.text(f):null)),c=o.pos+1,d=o.pos+1+o.node.content.size,u=t.tr.replaceWith(c,d,s);return(i.showingPlaceholder||/showingPlcHdr/.test(String(i.rawPropertiesXml??"")))&&u.setNodeMarkup(o.pos,void 0,{...i,showingPlaceholder:!1,rawPropertiesXml:uS(i.rawPropertiesXml==null?void 0:String(i.rawPropertiesXml))}),u}function MK(t,e,n={}){let r=Nh(t.doc,e);if(!r)throw new Ao(e);let o=r.node.attrs.lock;if(!n.force&&m9(o))throw new sc(o,"remove");if(n.keepContent&&!n.force&&/<w15:repeatingSection(Item)?[\s/>]/.test(String(r.node.attrs.rawPropertiesXml??"")))throw new sc(o,"remove");let i=r.pos,l=r.pos+r.node.nodeSize;return n.keepContent?t.tr.replaceWith(i,l,r.node.content):t.tr.delete(i,l)}function DS(t,e,n,r={}){let o=Nh(t.doc,e);if(!o)throw new Ao(e);return LS(t,o,n,r)}function RK(t,e,n,r={}){let o=SK(t.doc,e);if(!o)throw new Ao({});return LS(t,o,n,r)}function PK(t){if(t)return typeof t=="string"?{ascii:t,hAnsi:t}:t}function NS(t,e,n){if(!e)return null;let r=t.marks.fontFamily,o=PK(n),i=o&&r?[r.create(o)]:void 0;return t.text(e,i)}function EK(t,e){return e.map(n=>{if(n.type!=="paragraph")return t.nodes.paragraph.create(null,null);let r=n.content.find(l=>l.type==="run"),o=r?.type==="run"?r.content.map(l=>"text"in l?l.text:"").join(""):"",i=r?.type==="run"?r.formatting?.fontFamily:void 0;return t.nodes.paragraph.create(null,NS(t,o,i))})}function FK(t,e){let n=e.find(o=>o.type==="paragraph");if(!n||n.type!=="paragraph")return[];let r=[];for(let o of n.content){if(o.type!=="run")continue;let i=o.content.map(a=>"text"in a?a.text:"").join(""),l=NS(t,i,o.formatting?.fontFamily);l&&r.push(l)}return r}function LS(t,e,n,r){let o=Ep(e.node.attrs);if(!r.force&&dS(o.lock))throw new sc(o.lock,"edit");if(!r.force&&g9(o))throw new cS;let{properties:i,content:l}=x9(o,n),{schema:a}=t,s=e.pos+1,c=e.pos+1+e.node.content.size,d=e.node.type.name==="sdt"?FK(a,l):EK(a,l),u=t.tr.replaceWith(s,c,d);return u.setNodeMarkup(e.pos,void 0,{...e.node.attrs,...Pp(i)}),u}function AK(t){let e=0;return t.descendants(n=>(n.type.name==="blockSdt"&&typeof n.attrs.id=="number"&&(e=Math.max(e,n.attrs.id)),!0)),e}function DK(t,e,n){let r=n,o=e.toJSON(),i=l=>{if(l.type==="blockSdt"&&l.attrs){let a=++r;l.attrs={...l.attrs,id:a,rawPropertiesXml:v9(l.attrs.rawPropertiesXml==null?void 0:String(l.attrs.rawPropertiesXml),a)}}l.content?.forEach(i)};return i(o),t.nodeFromJSON(o)}function NK(t,e){let n=t.doc.nodeAt(e);if(!n||n.type.name!=="blockSdt"||!Bf(String(n.attrs.rawPropertiesXml??"")))throw new Of("Position is not a repeating-section item.");let r=DK(t.schema,n,AK(t.doc));return t.tr.insert(e+n.nodeSize,r)}function LK(t,e){let n=t.doc.nodeAt(e);if(!n||n.type.name!=="blockSdt"||!Bf(String(n.attrs.rawPropertiesXml??"")))throw new Of("Position is not a repeating-section item.");let r=t.doc.resolve(e).parent,o=0;if(r.forEach(i=>{i.type.name==="blockSdt"&&Bf(String(i.attrs.rawPropertiesXml??""))&&(o+=1)}),o<=1)throw new Of("Cannot remove the last item of a repeating section.");return t.tr.delete(e,e+n.nodeSize)}function BK(t,e){let n=e.filter(i=>i.parentId!=null);if(n.length===0)return;let r=new Map;for(let i of n){let l=r.get(i.parentId);l?l.push(i.id):r.set(i.parentId,[i.id])}function o(i){for(let l of i)if(l.type==="paragraph"){if(!l.content.some(s=>s.type==="commentRangeStart"||s.type==="commentRangeEnd"))continue;let a=[];for(let s of l.content)if(s.type==="commentRangeStart"){a.push(s);let c=r.get(s.id);if(c)for(let d of c)a.push({type:"commentRangeStart",id:d})}else if(s.type==="commentRangeEnd"){a.push(s);let c=r.get(s.id);if(c)for(let d of c)a.push({type:"commentRangeEnd",id:d})}else a.push(s);l.content=a}else if(l.type==="table")for(let a of l.rows)for(let s of a.cells)o(s.content)}o(t)}function OK(t,e){let n=new Set(e.map(l=>l.id)),r=e.filter(l=>l.parentId!=null&&!n.has(l.parentId));if(r.length===0)return;let o=new Map;for(let l of r){let a=o.get(l.parentId);a?a.push(l.id):o.set(l.parentId,[l.id])}function i(l){for(let a of l)if(a.type==="paragraph"){if(!a.content.some(d=>(d.type==="insertion"||d.type==="deletion")&&o.has(d.info.id)))continue;let s=[],c=a.content;for(let d=0;d<c.length;d++){let u=c[d];if((u.type==="insertion"||u.type==="deletion")&&o.has(u.info.id)){let f=o.get(u.info.id);for(let p of f)s.push({type:"commentRangeStart",id:p});s.push(u);let h=c[d+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==u.type&&h.info.author===u.info.author&&h.info.date===u.info.date&&(s.push(h),d++);for(let p of f)s.push({type:"commentRangeEnd",id:p})}else s.push(u)}a.content=s}else if(a.type==="table")for(let s of a.rows)for(let c of s.cells)i(c.content)}i(t)}var qr={runImage:"layout-run-image",blockImage:"layout-block-image",pageFloatingImage:"layout-page-floating-image",cellFloatingImage:"layout-cell-floating-image",pageContent:"layout-page-content",paragraph:"layout-paragraph"},BS=[`.${qr.pageFloatingImage}`,`.${qr.cellFloatingImage}`,`.${qr.blockImage}`,`.${qr.runImage}`].join(", ");function jK(t){if(!(t instanceof Element))return null;let e=t.closest(BS);if(!e)return null;let n=e.dataset.pmStart;if(n===void 0)return null;let r=Number(n);return Number.isNaN(r)?null:{pos:r,imageEl:e}}function zK(t){if(!(t instanceof HTMLElement))return null;if(t.tagName==="IMG"&&t.classList.contains(qr.runImage))return t;let e=t.closest(BS);return e&&e.dataset.pmStart?e:null}function zf(t,e=1){if(!t.classList.contains(qr.runImage))return;let n=t.closest(`.${qr.pageContent}`),r=t.closest(`.${qr.paragraph}`);if(!n||!r)return;let o=t.getBoundingClientRect(),i=n.getBoundingClientRect(),l=r.getBoundingClientRect(),a=e>0?e:1;return{horizontalEmu:Math.round(He((o.left-i.left)/a)),verticalEmu:Math.round(He((o.top-l.top)/a))}}function HK(t,e){return t==="inline"?"inline":t==="behind"?"behind":t==="inFront"?"inFront":t==="square"||t==="tight"||t==="through"?e==="right"?"squareRight":"squareLeft":null}var gu=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function _K(t,e){return!0}function WK(t){switch(t){case"inline":return"inline";case"square":case"tight":case"through":return"squareLeft";case"topAndBottom":return"topAndBottom";case"behind":return"behind";case"inFront":return"inFront";case"wrapRight":return"squareLeft";case"wrapLeft":return"squareRight";default:return}}function VK(t,e){let n=new Map;for(let r=0;r<t.length;r++){let o=t[r],i=e[r];o&&i&&n.set(String(o.id),{block:o,measure:i})}return n}var qK=class{constructor(e={}){Ze(this,"container",null),Ze(this,"blockLookup",new Map),Ze(this,"pageStates",[]),Ze(this,"totalPages",0),Ze(this,"options"),Ze(this,"doc"),Ze(this,"resolvedCommentIds",new Set),this.options=e,this.doc=e.document??document}setBlockLookup(e){this.blockLookup=e}mount(e){this.container=e,this.applyContainerStyles()}unmount(){this.container&&(this.container.innerHTML=""),this.container=null,this.pageStates=[]}applyContainerStyles(){if(!this.container)return;let e=this.options.pageGap??24;this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.alignItems="center",this.container.style.gap=`${e}px`,this.container.style.padding=`${e}px`,this.container.style.backgroundColor=this.options.containerBackground??"var(--doc-bg, #f8f9fa)",this.container.style.minHeight="100%"}paint(e){if(!this.container)throw new Error("LayoutPainter: not mounted");let{pages:n}=e;this.totalPages=n.length,this.container.innerHTML="",this.pageStates=[];for(let r=0;r<n.length;r++){let o=n[r],i={pageNumber:o.number,totalPages:this.totalPages,section:"body",resolvedCommentIds:this.resolvedCommentIds},l=this.renderPageWithLookup(o,i);this.container.appendChild(l),this.pageStates.push({element:l,pageNumber:o.number,fragmentCount:o.fragments.length})}}renderPageWithLookup(e,n){let r=this.doc.createElement("div");r.className="layout-page",r.dataset.pageNumber=String(e.number),r.style.position="relative",r.style.width=`${e.size.w}px`,r.style.height=`${e.size.h}px`,r.style.backgroundColor=this.options.pageBackground??"var(--doc-page-bg, #ffffff)",r.style.color="var(--doc-page-text, #000000)",r.style.overflow="hidden",this.options.showShadow&&(r.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.15)");let o=this.doc.createElement("div");o.className="layout-page-content",o.style.position="absolute",o.style.top=`${e.margins.top}px`,o.style.left=`${e.margins.left}px`,o.style.right=`${e.margins.right}px`,o.style.bottom=`${e.margins.bottom}px`,o.style.overflow="visible";for(let i of e.fragments){let l=this.renderFragmentWithLookup(i,n);this.applyFragmentPosition(l,i),o.appendChild(l)}return r.appendChild(o),r}renderFragmentWithLookup(e,n){let r=this.blockLookup.get(String(e.blockId));if(e.kind==="paragraph"&&r){let o=r.block,i=r.measure;return ji(e,o,i,n,{document:this.doc})}if(e.kind==="table"&&r){let o=r.block,i=r.measure;return Zc(e,o,i,n,{document:this.doc})}if(e.kind==="image"&&r){let o=r.block,i=r.measure;return qc(e,o,i,n,{document:this.doc})}if(e.kind==="textBox"&&r){let o=r.block,i=r.measure;return Kc(e,o,i,n,{document:this.doc})}return kf(e,n,{document:this.doc})}applyFragmentPosition(e,n){e.style.position="absolute",e.style.left=`${n.x}px`,e.style.top=`${n.y}px`,e.style.width=`${n.width}px`,"height"in n&&(e.style.height=`${n.height}px`)}getPageCount(){return this.totalPages}getPageElement(e){return this.pageStates[e]?.element??null}scrollToPage(e){let n=this.pageStates.find(r=>r.pageNumber===e);n?.element&&n.element.scrollIntoView({behavior:"smooth",block:"start"})}};function ZK(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const KK=t=>{switch(t){case"success":return GK;case"info":return JK;case"warning":return YK;case"error":return QK;default:return null}},UK=Array(12).fill(0),XK=({visible:t,className:e})=>ae.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ae.createElement("div",{className:"sonner-spinner"},UK.map((n,r)=>ae.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),GK=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},ae.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),YK=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},ae.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),JK=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),QK=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),eU=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},ae.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ae.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),tU=()=>{const[t,e]=ae.useState(document.hidden);return ae.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),t};let nU=1;const rU=100,Xy=t=>{var e;return typeof t?.id=="number"||(t==null||(e=t.id)==null?void 0:e.length)>0?t.id:nU++};class oU{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(n=>e(n)),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-rU;e<=0||(this.toasts=this.toasts.filter(n=>e>0&&this.dismissedToasts.has(n.id)?(this.dismissedToasts.delete(n.id),e--,!1):!0))},this.create=e=>{const{message:n,...r}=e,o=Xy(e),i=this.pendingDismissals.get(o);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o));const l=this.dismissedToasts.has(o),a=e.dismissible===void 0?!0:e.dismissible;return l&&(this.dismissedToasts.delete(o),this.toasts=this.toasts.filter(c=>c.id!==o)),(l?void 0:this.toasts.find(c=>c.id===o))?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...e,id:o,title:n}),{...c,...e,id:o,dismissible:a,title:n}):c):this.addToast({title:n,...r,dismissible:a,id:o}),o},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);const n=this.pendingDismissals.get(e);return n!==void 0&&cancelAnimationFrame(n),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(r=>r({id:e,dismiss:!0}))})),e},this.message=(e,n)=>this.create({...n,message:e,type:void 0}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(e instanceof Function?e():e);let i=r!==void 0,l;const a=o.then(async c=>{if(l=["resolve",c],ae.isValidElement(c))i=!1,this.create({id:r,type:"default",message:c});else if(lU(c)&&!c.ok){i=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,f=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,p=typeof u=="object"&&!ae.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...p})}else if(c instanceof Error){i=!1;const u=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,p=typeof u=="object"&&!ae.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:f,...p})}else if(n.success!==void 0){i=!1;const u=typeof n.success=="function"?await n.success(c):n.success,f=typeof n.description=="function"?await n.description(c):n.description,p=typeof u=="object"&&!ae.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:f,...p})}}).catch(async c=>{if(l=["reject",c],n.error!==void 0){i=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,h=typeof d=="object"&&!ae.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...h})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),s=()=>new Promise((c,d)=>a.then(()=>l[0]==="reject"?d(l[1]):c(l[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:s}:Object.assign(r,{unwrap:s})},this.custom=(e,n)=>{const r=Xy(n);return this.create({...n,jsx:e(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const on=new oU,iU=(t,e)=>on.message(t,e),lU=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",aU=iU,sU=()=>on.toasts,cU=()=>on.getActiveToasts(),OS=Object.assign(aU,{success:on.success,info:on.info,warning:on.warning,error:on.error,custom:on.custom,message:on.message,promise:on.promise,dismiss:on.dismiss,loading:on.loading},{getHistory:sU,getToasts:cU});ZK("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function as(t){return t.label!==void 0}const dU=3,uU="24px",fU="16px",Gy=4e3,pU=356,hU=14,mU=45,gU=200;function Un(...t){return t.filter(Boolean).join(" ")}function yU(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const bU=t=>{var e,n,r,o,i,l,a,s,c;const{invert:d,toast:u,unstyled:f,interacting:h,setHeights:p,visibleToasts:m,heights:y,index:w,toasts:C,expanded:g,removeToast:v,defaultRichColors:k,closeButton:x,style:T,cancelButtonStyle:$,actionButtonStyle:M,className:I="",descriptionClassName:F="",duration:E,position:R,gap:N,expandByDefault:B,classNames:j,icons:O,closeButtonAriaLabel:z="Close toast"}=t,[W,q]=ae.useState(null),[Q,X]=ae.useState(null),[se,ie]=ae.useState(!1),[ce,Y]=ae.useState(!1),[V,Z]=ae.useState(!1),[K,ee]=ae.useState(!1),[G,te]=ae.useState(!1),[A,P]=ae.useState(0),[_,H]=ae.useState(0),le=ae.useRef(u.duration||E||Gy),ue=ae.useRef(null),ve=ae.useRef(null),Pe=w===0,be=w+1<=m,pe=u.type,Fe=pe??"default",Ae=u.dismissible!==!1,yt=u.className||"",Me=u.descriptionClassName||"",Ue=ae.useMemo(()=>y.findIndex(me=>me.toastId===u.id)||0,[y,u.id]),Lt=ae.useMemo(()=>{var me;return(me=u.closeButton)!=null?me:x},[u.closeButton,x]),Sn=ae.useMemo(()=>u.duration||E||Gy,[u.duration,E]),vt=ae.useRef(0),Tt=ae.useRef(0),Ee=ae.useRef(0),Se=ae.useRef(null),[De,et]=R.split("-"),qe=ae.useMemo(()=>y.reduce((me,ze,bt)=>bt>=Ue?me:me+ze.height,0),[y,Ue]),ct=tU(),tt=ae.useMemo(()=>{var me;return(me=t.swipeDirections)!=null?me:yU(R)},[t.swipeDirections,R]),ot=u.invert||d,Ne=pe==="loading";Tt.current=ae.useMemo(()=>Ue*N+qe,[Ue,qe]),ae.useEffect(()=>{le.current=Sn},[Sn]),ae.useEffect(()=>{ie(!0)},[]),ae.useEffect(()=>{const me=ve.current;if(me){const ze=me.getBoundingClientRect().height;return H(ze),p(bt=>[{toastId:u.id,height:ze,position:u.position},...bt]),()=>p(bt=>bt.filter(gt=>gt.toastId!==u.id))}},[p,u.id]),ae.useLayoutEffect(()=>{if(!se)return;const me=ve.current,ze=me.style.height;me.style.height="auto";const bt=me.getBoundingClientRect().height;me.style.height=ze,H(bt),p(gt=>gt.find(dt=>dt.toastId===u.id)?gt.map(dt=>dt.toastId===u.id?{...dt,height:bt}:dt):[{toastId:u.id,height:bt,position:u.position},...gt])},[se,u.title,u.description,p,u.id,u.jsx,u.action,u.cancel]);const mt=ae.useCallback(()=>{Y(!0),P(Tt.current),p(me=>me.filter(ze=>ze.toastId!==u.id)),setTimeout(()=>{v(u)},gU)},[u,v,p,Tt]);ae.useEffect(()=>{if(u.promise&&pe==="loading"||u.duration===1/0||u.type==="loading")return;let me;return g||h||ct?(()=>{if(Ee.current<vt.current){const gt=new Date().getTime()-vt.current;le.current=le.current-gt}Ee.current=new Date().getTime()})():le.current!==1/0&&(vt.current=new Date().getTime(),me=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),mt()},le.current)),()=>clearTimeout(me)},[g,h,u,pe,ct,mt]),ae.useEffect(()=>{u.delete&&(mt(),u.onDismiss==null||u.onDismiss.call(u,u))},[mt,u.delete]);function $t(){var me;if(O?.loading){var ze;return ae.createElement("div",{className:Un(j?.loader,u==null||(ze=u.classNames)==null?void 0:ze.loader,"sonner-loader"),"data-visible":pe==="loading"},O.loading)}return ae.createElement(XK,{className:Un(j?.loader,u==null||(me=u.classNames)==null?void 0:me.loader),visible:pe==="loading"})}const lr=u.icon||O?.[pe]||KK(pe);var lt,Pt;return ae.createElement("li",{tabIndex:0,ref:ve,className:Un(I,yt,j?.toast,u==null||(e=u.classNames)==null?void 0:e.toast,j?.[Fe],u==null||(n=u.classNames)==null?void 0:n[Fe]),"data-sonner-toast":"","data-rich-colors":(lt=u.richColors)!=null?lt:k,"data-styled":!(u.jsx||u.unstyled||f),"data-mounted":se,"data-promise":!!u.promise,"data-swiped":G,"data-removed":ce,"data-visible":be,"data-y-position":De,"data-x-position":et,"data-index":w,"data-front":Pe,"data-swiping":V,"data-dismissible":Ae,"data-type":pe,"data-invert":ot,"data-swipe-out":K,"data-swipe-direction":Q,"data-expanded":!!(g||B&&se),"data-testid":u.testId,style:{"--index":w,"--toasts-before":w,"--z-index":C.length-w,"--offset":`${ce?A:Tt.current}px`,"--initial-height":B?"auto":`${_}px`,...T,...u.style},onDragEnd:()=>{Z(!1),q(null),Se.current=null},onPointerDown:me=>{me.button!==2&&(Ne||!Ae||(ue.current=new Date,P(Tt.current),me.target.setPointerCapture(me.pointerId),me.target.tagName!=="BUTTON"&&(Z(!0),Se.current={x:me.clientX,y:me.clientY})))},onPointerUp:()=>{var me,ze,bt;if(K||!Ae)return;Se.current=null;const gt=Number(((me=ve.current)==null?void 0:me.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Tn=Number(((ze=ve.current)==null?void 0:ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),dt=new Date().getTime()-((bt=ue.current)==null?void 0:bt.getTime()),It=W==="x"?gt:Tn,Xt=Math.abs(It)/dt;if((W==="x"?tt.includes(gt>0?"right":"left"):tt.includes(Tn>0?"bottom":"top"))&&(Math.abs(It)>=mU||Xt>.11)){P(Tt.current),u.onDismiss==null||u.onDismiss.call(u,u),X(W==="x"?gt>0?"right":"left":Tn>0?"down":"up"),mt(),ee(!0);return}else{var _t,uo;(_t=ve.current)==null||_t.style.setProperty("--swipe-amount-x","0px"),(uo=ve.current)==null||uo.style.setProperty("--swipe-amount-y","0px")}te(!1),Z(!1),q(null)},onPointerMove:me=>{var ze,bt,gt;if(!Se.current||!Ae||((ze=window.getSelection())==null?void 0:ze.toString().length)>0)return;const dt=me.clientY-Se.current.y,It=me.clientX-Se.current.x;!W&&(Math.abs(It)>1||Math.abs(dt)>1)&&q(Math.abs(It)>Math.abs(dt)?"x":"y");let Xt={x:0,y:0};const qn=_t=>1/(1.5+Math.abs(_t)/20);if(W==="y"){if(tt.includes("top")||tt.includes("bottom"))if(tt.includes("top")&&dt<0||tt.includes("bottom")&&dt>0)Xt.y=dt;else{const _t=dt*qn(dt);Xt.y=Math.abs(_t)<Math.abs(dt)?_t:dt}}else if(W==="x"&&(tt.includes("left")||tt.includes("right")))if(tt.includes("left")&&It<0||tt.includes("right")&&It>0)Xt.x=It;else{const _t=It*qn(It);Xt.x=Math.abs(_t)<Math.abs(It)?_t:It}(Math.abs(Xt.x)>0||Math.abs(Xt.y)>0)&&te(!0),(bt=ve.current)==null||bt.style.setProperty("--swipe-amount-x",`${Xt.x}px`),(gt=ve.current)==null||gt.style.setProperty("--swipe-amount-y",`${Xt.y}px`)}},Lt&&!u.jsx&&pe!=="loading"?ae.createElement("button",{"aria-label":z,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!Ae?()=>{}:()=>{mt(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Un(j?.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(Pt=O?.close)!=null?Pt:eU):null,(pe||u.icon||u.promise)&&u.icon!==null&&(O?.[pe]!==null||u.icon)?ae.createElement("div",{"data-icon":"",className:Un(j?.icon,u==null||(o=u.classNames)==null?void 0:o.icon)},pe==="loading"?u.icon||$t():u.promise?$t():null,pe!=="loading"?lr:null):null,ae.createElement("div",{"data-content":"",className:Un(j?.content,u==null||(i=u.classNames)==null?void 0:i.content)},ae.createElement("div",{"data-title":"",className:Un(j?.title,u==null||(l=u.classNames)==null?void 0:l.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?ae.createElement("div",{"data-description":"",className:Un(F,Me,j?.description,u==null||(a=u.classNames)==null?void 0:a.description)},typeof u.description=="function"?u.description():u.description):null),ae.isValidElement(u.cancel)?u.cancel:u.cancel&&as(u.cancel)?ae.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||$,onClick:me=>{as(u.cancel)&&Ae&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,me),mt())},className:Un(j?.cancelButton,u==null||(s=u.classNames)==null?void 0:s.cancelButton)},u.cancel.label):null,ae.isValidElement(u.action)?u.action:u.action&&as(u.action)?ae.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||M,onClick:me=>{as(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,me),!me.defaultPrevented&&mt())},className:Un(j?.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function Yy(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function wU(t,e){const n={};return[t,e].forEach((r,o)=>{const i=o===1,l=i?"--mobile-offset":"--offset",a=i?fU:uU;function s(c){["top","right","bottom","left"].forEach(d=>{n[`${l}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?s(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${l}-${c}`]=a:n[`${l}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):s(a)}),n}const xU=ae.forwardRef(function(e,n){const{id:r,invert:o,position:i="bottom-right",hotkey:l=["altKey","KeyT"],expand:a,closeButton:s,className:c,offset:d,mobileOffset:u,theme:f="light",richColors:h,duration:p,style:m,visibleToasts:y=dU,toastOptions:w,dir:C=Yy(),gap:g=hU,icons:v,customAriaLabel:k,containerAriaLabel:x="Notifications"}=e,[T,$]=ae.useState([]),M=ae.useMemo(()=>r?T.filter(ie=>ie.toasterId===r):T.filter(ie=>!ie.toasterId),[T,r]),I=ae.useMemo(()=>Array.from(new Set([i].concat(M.filter(ie=>ie.position).map(ie=>ie.position)))),[M,i]),[F,E]=ae.useState([]),[R,N]=ae.useState(!1),[B,j]=ae.useState(!1),[O,z]=ae.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=ae.useRef(null),q=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),Q=ae.useRef(null),X=ae.useRef(!1),se=ae.useCallback(ie=>{$(ce=>{var Y;return(Y=ce.find(V=>V.id===ie.id))!=null&&Y.delete||on.dismiss(ie.id),ce.filter(({id:V})=>V!==ie.id)})},[]);return ae.useEffect(()=>on.subscribe(ie=>{if(ie.dismiss){requestAnimationFrame(()=>{$(ce=>ce.map(Y=>Y.id===ie.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{i$.flushSync(()=>{$(ce=>{const Y=ce.findIndex(V=>V.id===ie.id);return Y!==-1?[...ce.slice(0,Y),{...ce[Y],...ie},...ce.slice(Y+1)]:[ie,...ce]})})})}),[]),ae.useEffect(()=>{if(f!=="system"){z(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const ie=window.matchMedia("(prefers-color-scheme: dark)");try{ie.addEventListener("change",({matches:ce})=>{z(ce?"dark":"light")})}catch{ie.addListener(({matches:Y})=>{try{z(Y?"dark":"light")}catch(V){console.error(V)}})}},[f]),ae.useEffect(()=>{T.length<=1&&N(!1)},[T]),ae.useEffect(()=>{const ie=ce=>{var Y;if(l.length>0&&l.every(K=>ce[K]||ce.code===K)){var Z;N(!0),(Z=W.current)==null||Z.focus()}ce.code==="Escape"&&(document.activeElement===W.current||(Y=W.current)!=null&&Y.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",ie),()=>document.removeEventListener("keydown",ie)},[l]),ae.useEffect(()=>{if(W.current)return()=>{Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null,X.current=!1)}},[W.current]),ae.createElement("section",{ref:n,"aria-label":k??`${x} ${q}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},I.map((ie,ce)=>{var Y;const[V,Z]=ie.split("-");return M.length?ae.createElement("ol",{key:ie,dir:C==="auto"?Yy():C,tabIndex:-1,ref:W,className:c,"data-sonner-toaster":!0,"data-sonner-theme":O,"data-y-position":V,"data-x-position":Z,style:{"--front-toast-height":`${((Y=F[0])==null?void 0:Y.height)||0}px`,"--width":`${pU}px`,"--gap":`${g}px`,...m,...wU(d,u)},onBlur:K=>{X.current&&!K.currentTarget.contains(K.relatedTarget)&&(X.current=!1,Q.current&&(Q.current.focus({preventScroll:!0}),Q.current=null))},onFocus:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||X.current||(X.current=!0,Q.current=K.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{B||N(!1)},onDragEnd:()=>N(!1),onPointerDown:K=>{K.target instanceof HTMLElement&&K.target.dataset.dismissible==="false"||j(!0)},onPointerUp:()=>j(!1)},M.filter(K=>!K.position&&ce===0||K.position===ie).map((K,ee)=>{var G,te;return ae.createElement(bU,{key:K.id,icons:v,index:ee,toast:K,defaultRichColors:h,duration:(G=w?.duration)!=null?G:p,className:w?.className,descriptionClassName:w?.descriptionClassName,invert:o,visibleToasts:y,closeButton:(te=w?.closeButton)!=null?te:s,interacting:B,position:ie,style:w?.style,unstyled:w?.unstyled,classNames:w?.classNames,cancelButtonStyle:w?.cancelButtonStyle,actionButtonStyle:w?.actionButtonStyle,closeButtonAriaLabel:w?.closeButtonAriaLabel,removeToast:se,toasts:M.filter(A=>A.position==K.position),heights:F.filter(A=>A.position==K.position),setHeights:E,expandByDefault:a,gap:g,expanded:R,swipeDirections:e.swipeDirections})})):null}))});function ma(t,e){if(!e||!e.trim())return null;let n=null;return t.descendants((r,o)=>n!==null?!1:r.isTextblock&&r.attrs?.paraId===e?(n={from:o,to:o+r.nodeSize},!1):!0),n}function jS(t){let e=[];return t.descendants(n=>!n.isText||!n.text?!0:n.marks.some(r=>r.type.name==="insertion")?!1:(e.push(n.text),!0)),e.join("")}function yu(t,e,n){if(e>=n)return"";let r=[];return t.nodesBetween(e,n,(o,i)=>{if(!o.isText||!o.text||o.marks.some(s=>s.type.name==="insertion"))return;let l=Math.max(e,i),a=Math.min(n,i+o.text.length);l<a&&r.push(o.text.slice(l-i,a-i))}),r.join("")}function Lh(t,e,n,r){if(!r)return null;let o="",i=[];t.nodesBetween(e,n,(d,u)=>{!d.isText||!d.text||d.marks.some(f=>f.type.name==="insertion")||(i.push({pos:u,len:d.text.length}),o+=d.text)});let l=o.indexOf(r);if(l===-1||o.indexOf(r,l+1)!==-1)return null;let a=0,s=e,c=e;for(let d of i){let u=a+d.len;if(a<=l&&l<u&&(s=d.pos+(l-a)),a<=l+r.length&&l+r.length<=u){c=d.pos+(l+r.length-a);break}a=u}return{from:s,to:c}}function vU(t,e,n){if(!Number.isInteger(e)||!Number.isInteger(n)||e<0||n<e)return null;let r=t.content.size;return e>r?null:{from:e,to:Math.min(n,r)}}function kU(t,e){if(!t)return null;let n=t.state.schema.marks.comment;if(!n)return null;let r=1/0,o=-1/0;return t.state.doc.descendants((i,l)=>{if(i.isInline)for(let a of i.marks)a.type===n&&a.attrs.commentId===e&&(r=Math.min(r,l),o=Math.max(o,l+i.nodeSize))}),o<0?null:{from:r,to:o}}function Jy(t,e){if(!t)return null;let{entries:n}=xl(t.state),r=n.find(o=>o.revisionId===e||o.insertionRevisionId===e||o.coalescedRevisionIds?.includes(e));return r?{from:r.from,to:r.to}:null}function CU(t,e,n){if(!t||!e)return[];let r=n?.caseSensitive??!1,o=n?.limit??20,i=r?e:e.toLowerCase(),l=[];return t.state.doc.descendants(a=>{if(l.length>=o)return!1;if(!a.isTextblock)return!0;let s=a.attrs?.paraId;if(!s)return!1;let c=jS(a),d=r?c:c.toLowerCase(),u=d.indexOf(i);if(u===-1||d.indexOf(i,u+1)!==-1)return!1;let f=40;return l.push({paraId:s,match:c.slice(u,u+e.length),before:c.slice(Math.max(0,u-f),u),after:c.slice(u+e.length,u+e.length+f)}),!1}),l}function SU(t){if(!t)return null;let{selection:e,doc:n}=t.state,r=e.$from,o=r.depth;for(;o>0&&!r.node(o).isTextblock;)o--;let i=o>0?r.node(o):null;if(!i)return null;let l=i.attrs?.paraId??null,a=r.start(o),s=a+i.content.size,c=yu(n,a,e.from),d=yu(n,e.from,e.to),u=yu(n,e.to,s);return{paraId:l,selectedText:d,paragraphText:c+d+u,before:c,after:u}}function TU(t,e,n){if(!e||!t)return null;let r=e.pages[n-1];if(!r)return null;let o=new Set,i=[];for(let a of r.fragments){if(a.kind!=="paragraph")continue;let s=a.pmStart;if(s==null)continue;let c=t.state.doc.nodeAt(s);if(!c||!c.isTextblock)continue;let d=c.attrs?.paraId;!d||o.has(d)||(o.add(d),i.push({paraId:d,text:jS(c),styleId:c.attrs?.styleId??void 0}))}let l=i.map(a=>`[${a.paraId}] ${a.text}`).join(`
107
+ `);return{pageNumber:n,text:l,paragraphs:i}}function $U(t,e){let n=ma(t.state.doc,e.paraId);if(!n)return!1;let r=n.from+1,o=n.to-1;if(e.search){let s=Lh(t.state.doc,n.from,n.to,e.search);if(!s)return!1;r=s.from,o=s.to}if(r>=o)return!0;let{schema:i}=t.state,l=e.marks,a=t.state.tr;if(l.bold!==void 0&&i.marks.bold&&(a=l.bold?a.addMark(r,o,i.marks.bold.create()):a.removeMark(r,o,i.marks.bold)),l.italic!==void 0&&i.marks.italic&&(a=l.italic?a.addMark(r,o,i.marks.italic.create()):a.removeMark(r,o,i.marks.italic)),l.underline!==void 0&&i.marks.underline)if(l.underline){let s=typeof l.underline=="object"?l.underline.style:void 0;a=a.addMark(r,o,i.marks.underline.create({style:s??"single"}))}else a=a.removeMark(r,o,i.marks.underline);if(l.strike!==void 0&&i.marks.strike&&(a=l.strike?a.addMark(r,o,i.marks.strike.create()):a.removeMark(r,o,i.marks.strike)),l.color!==void 0&&i.marks.textColor&&(l.color&&(l.color.rgb||l.color.themeColor)?a=a.addMark(r,o,i.marks.textColor.create({rgb:l.color.rgb??null,themeColor:l.color.themeColor??null})):a=a.removeMark(r,o,i.marks.textColor)),l.highlight!==void 0&&i.marks.highlight)if(l.highlight){let s=Ew(l.highlight);a=a.addMark(r,o,i.marks.highlight.create({color:s||l.highlight}))}else a=a.removeMark(r,o,i.marks.highlight);if(l.fontSize!==void 0&&i.marks.fontSize)if(l.fontSize>0){let s=Ub(l.fontSize);a=a.addMark(r,o,i.marks.fontSize.create({size:s,sizeCs:s}))}else a=a.removeMark(r,o,i.marks.fontSize);return l.fontFamily!==void 0&&i.marks.fontFamily&&(l.fontFamily&&(l.fontFamily.ascii||l.fontFamily.hAnsi)?a=a.addMark(r,o,i.marks.fontFamily.create({ascii:l.fontFamily.ascii??null,hAnsi:l.fontFamily.hAnsi??l.fontFamily.ascii??null})):a=a.removeMark(r,o,i.marks.fontFamily)),t.dispatch(a),!0}function IU(t,e,n){let r=ma(t.state.doc,e.paraId);if(!r)return!1;let{styleResolver:o,numbering:i}=n;if(o&&!o.hasParagraphStyle(e.styleId))return!1;let l=t.state.doc.resolve(r.from+1),a=t.state.doc.resolve(r.to-1),s=ye.between(l,a),c=t.state.apply(t.state.tr.setSelection(s)),d=o?(()=>{let f=o.resolveParagraphStyle(e.styleId);return cc(e.styleId,{paragraphFormatting:f.paragraphFormatting,runFormatting:f.runFormatting,numbering:i})})():cc(e.styleId),u=!1;return d(c,f=>{u=!0,f.setSelection(t.state.selection.map(f.doc,f.mapping)),t.dispatch(f)}),u}function MU(t,e){let n=ma(t.state.doc,e.paraId);if(!n)return!1;let{state:r}=t,o=r.doc.nodeAt(n.from);if(!o||r.doc.resolve(n.from).depth!==0)return!1;let i=r.tr;if(e.type==="page"){let l=r.schema.nodes.pageBreak;if(!l)return!1;i.insert(n.to,l.create())}else if(e.type==="sectionNextPage"||e.type==="sectionContinuous"){let l=e.type==="sectionNextPage"?"nextPage":"continuous";i.setNodeMarkup(n.from,void 0,{...o.attrs,sectionBreakType:l})}else return!1;return i.setSelection(r.selection.map(i.doc,i.mapping)),t.dispatch(i),!0}function El(t,e,n,r){return{id:t.next(),author:n,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:e}]}]}],...r!==void 0&&{parentId:r}}}function RU(t,e,n){let{schema:r}=t.state;if(!r.marks.comment)return null;let o=ma(t.state.doc,e.paraId);if(!o)return null;let i=o.from+1,l=o.to-1;if(e.search){let s=Lh(t.state.doc,o.from,o.to,e.search);if(!s)return null;i=s.from,l=s.to}if(i>=l)return null;let a=El(n,e.text,e.author);return t.dispatch(t.state.tr.addMark(i,l,r.marks.comment.create({commentId:a.id}))),a}function PU(t,e,n){let{schema:r}=t.state;if(!r.marks.deletion||!r.marks.insertion)return!1;let o=ma(t.state.doc,e.paraId);if(!o)return!1;let i=e.search==="",l=e.replaceWith==="";if(i&&l)return!1;let a,s;if(i)a=o.to-1,s=o.to-1;else{let p=Lh(t.state.doc,o.from,o.to,e.search);if(!p)return!1;a=p.from,s=p.to}if(a<s){let p=!1;if(t.state.doc.nodesBetween(a,s,m=>{for(let y of m.marks)if(y.type===r.marks.insertion||y.type===r.marks.deletion)return p=!0,!1;return!0}),p)return!1}let c=n.next(),d=new Date().toISOString(),u=r.marks.deletion.create({revisionId:c,author:e.author,date:d}),f=r.marks.insertion.create({revisionId:c,author:e.author,date:d}),h=t.state.tr;return i||(h=h.addMark(a,s,u)),l||(h=h.insert(s,r.text(e.replaceWith,[f]))),t.dispatch(h),!0}var Yl=-1;function EU(){let t=1;return{next:()=>t++,seedAbove(e){e>=t&&(t=e+1)}}}function FU(t,e,n){let r=0;for(let o of e??[])r=Math.max(r,o.id);n&&n.state.doc.descendants(o=>{for(let i of o.marks)i.attrs.revisionId!=null&&(r=Math.max(r,i.attrs.revisionId))}),t.seedAbove(r)}function AU(t,e){let n=t?.package?.document,r=(n?[...(n.sections??[]).map(l=>l.properties),n.finalSectionProperties]:[]).find(l=>(l?.footnoteColumns??1)>1);if(!r?.footnoteColumns)return{columns:1,columnWidth:e};let o=r.footnoteColumns,i=((r.pageWidth!=null?Ko(r.pageWidth-(r.marginLeft??1440)-(r.marginRight??1440)):e)-(o-1)*Mf)/o;return{columns:o,columnWidth:Math.max(1,i)}}function DU(t){let{state:e,document:n,pageSize:r,margins:o,columns:i,finalPageSize:l,finalMargins:a,finalColumns:s,pageGap:c,contentWidth:d,theme:u,styles:f,sectionProperties:h,finalSectionProperties:p,headerContent:m,footerContent:y,firstPageHeaderContent:w,firstPageFooterContent:C,measureBlocks:g,getHfPmDoc:v}=t,k=r.h-o.top-o.bottom,x=kp(e.doc,{theme:u,pageContentHeight:k}),T=sH(x,{pageSize:r,margins:o,columns:i},{pageSize:l,margins:a,columns:s});Lz(x,T,d);let $=g(x,T,Bk({size:r,margins:o})),M=R_(x),I=M.length>0&&!!n?.package?.footnotes,F={section:"header",pageSize:r,margins:o},E={section:"footer",pageSize:r,margins:o},R=e.doc.attrs?.defaultTabStopTwips,N={styles:f,theme:u,measureBlocks:g,defaultTabStopTwips:R},B=(ee,G)=>{if(!ee)return;let te=v(ee);return te?Fk(te,d,G,N):tH(ee,d,G,N)},j=B(m,F),O=B(y,E),z=h?.titlePg===!0,W=z?B(w,F):void 0,q=z?B(C,E):void 0,Q=e.doc.attrs?.watermark??void 0,{margins:X,finalMargins:se}=oH({pageSize:r,margins:o,finalMargins:a,bodyBlocks:x,headers:[j,W],footers:[O,q],warn:ee=>console.warn(`[computeLayout] ${ee}`)}),ie=p?.sectionStart,ce={pageSize:r,margins:X,finalPageSize:l,finalMargins:se,columns:s,bodyBreakType:ie,pageGap:c},Y,V=new Map,Z=new Map;if(I){let ee=Tl(x,$,ce),{columns:G,columnWidth:te}=AU(n,d);Z=F_(n.package.footnotes,M,te,{styles:f??void 0,theme:u??null,measureBlocks:g,defaultTabStopTwips:R});let A=A_({blocks:x,measures:$,layoutOpts:ce,footnoteRefs:M,footnoteContentMap:Z,initialLayout:ee,footnoteColumns:G});Y=A.layout,V=A.pageFootnoteMap}else Y=Tl(x,$,ce);let K=I?D_(V,Z,n):void 0;return{blocks:x,measures:$,layout:Y,headerContentForRender:j,footerContentForRender:O,firstPageHeaderForRender:W,firstPageFooterForRender:q,hasTitlePg:z,watermark:Q,headerDistancePx:h?.headerDistance!=null?Ko(h.headerDistance):void 0,footerDistancePx:h?.footerDistance!=null?Ko(h.footerDistance):void 0,pageBorders:h?.pageBorders,footnotesByPage:K?.size?K:void 0}}function NU(t,e=r=>requestAnimationFrame(r),n=r=>cancelAnimationFrame(r)){let r=null;return{schedule(o){if(r){r.state=o;return}r={handle:0,state:o};let i=e(()=>{let l=r;r=null,l&&t(l.state)});r&&(r.handle=i)},cancel(){r&&(n(r.handle),r=null)}}}var Qy=!1;function LU(t){if(!Qy){Qy=!0;try{let e=t.scrollIntoView();(typeof e.updated!="number"||(e.updated&4)===0)&&console.warn("[docx-editor] prosemirror-state UPDATED_SCROLL bit shape changed; paginated scroll suppression may be stale. Update PM_UPDATED_SCROLL.")}catch{}}}function BU(t,e){LU(e);let n=t;typeof n.updated=="number"&&(n.updated&=-5)}function OU(t,e,n,r,o,i){let l=t.includes("w")||t.includes("e"),a=t.includes("n")||t.includes("s"),s=l&&a,c=t.includes("w")?-1:1,d=t.includes("n")?-1:1,u=l?r+e*c:r,f=a?o+n*d:o;if(s&&i){let p=Math.max(u/r,f/o);u=r*p,f=o*p}let h=p=>Math.max(20,Math.min(2e3,p));return{width:l?h(u):r,height:a?h(f):o}}function jU(t){let e=t.attrs.wrapType;return t.attrs.displayMode==="float"||(e?["square","tight","through"].includes(e):!1)}function Bh(t,e){let n=t.state.doc.nodeAt(e);return!n||n.type.name!=="image"?null:n}function zU(t,e,n,r){try{let o=Bh(t,e);return o?(t.dispatch(t.state.tr.setNodeMarkup(e,void 0,{...o.attrs,width:n,height:r})),e):null}catch{return null}}function HU(t,e,n,r){try{let o=Bh(t,e);if(!o)return null;let i={horizontal:{posOffset:n,relativeTo:"margin"},vertical:{posOffset:r,relativeTo:"margin"}};return t.dispatch(t.state.tr.setNodeMarkup(e,void 0,{...o.attrs,position:i})),e}catch{return null}}function _U(t,e,n){try{let r=Bh(t,e);if(!r||n===e||n===e+1)return null;let o=t.state.tr;if(n<=e)return o=o.delete(e,e+r.nodeSize),o=o.insert(n,r),t.dispatch(o),n;o=o.delete(e,e+r.nodeSize);let i=Math.min(n-r.nodeSize,o.doc.content.size);return o=o.insert(i,r),t.dispatch(o),Math.min(i,t.state.doc.content.size-1)}catch{return null}}var ss=15,bu=300,WU=200;function Wi(t,e){try{let n=t.state.doc.resolve(e+1);for(let r=n.depth;r>=0;r--){let o=n.node(r);if(o.type.name==="table")return{node:o,tablePos:n.before(r)}}}catch{}return null}function VU(t,e,n){let r=Wi(t,e);if(!r)return null;let o=r.node.attrs.columnWidths;return!o||o[n]===void 0||o[n+1]===void 0?null:{left:o[n],right:o[n+1]}}function qU(t,e,n){let r=Wi(t,e);if(!r)return null;let o=null,i=0;return r.node.forEach(l=>{if(i===n){let a=l.attrs.height;a&&(o=a)}i++}),o}function ZU(t,e,n){let r=Wi(t,e);if(!r)return null;let o=r.node.attrs.columnWidths;return!o||o[n]===void 0?null:o[n]}function KU(t,e){let{pmStart:n,colIdx:r,newLeft:o,newRight:i}=e,l=Wi(t,n);if(!l)return;let{node:a,tablePos:s}=l,c=t.state.tr,d=[...a.attrs.columnWidths??[]];d[r]=o,d[r+1]=i,c.setNodeMarkup(s,void 0,{...a.attrs,columnWidths:d,tableLayout:"fixed"});let u=s+1;a.forEach(f=>{let h=u+1,p=0;f.forEach(m=>{let y=m.attrs.colspan||1;if(p===r||p===r+1){let w=p===r?o:i;c.setNodeMarkup(c.mapping.map(h),void 0,{...m.attrs,width:w,widthType:"dxa",colwidth:null})}h+=m.nodeSize,p+=y}),u+=f.nodeSize}),t.dispatch(c)}function UU(t,e){let{pmStart:n,rowIdx:r,newHeight:o}=e,i=Wi(t,n);if(!i)return;let{node:l,tablePos:a}=i,s=t.state.tr,c=a+1,d=0;l.forEach(u=>{d===r&&s.setNodeMarkup(s.mapping.map(c),void 0,{...u.attrs,height:o,heightRule:"atLeast"}),c+=u.nodeSize,d++}),t.dispatch(s)}function XU(t,e){let{pmStart:n,colIdx:r,newWidth:o}=e,i=Wi(t,n);if(!i)return;let{node:l,tablePos:a}=i,s=t.state.tr,c=[...l.attrs.columnWidths??[]];c[r]=o,s.setNodeMarkup(a,void 0,{...l.attrs,columnWidths:c,tableLayout:"fixed"});let d=a+1;l.forEach(u=>{let f=d+1,h=0;u.forEach(p=>{let m=p.attrs.colspan||1;h===r&&s.setNodeMarkup(s.mapping.map(f),void 0,{...p.attrs,width:o,widthType:"dxa",colwidth:null}),f+=p.nodeSize,h+=m}),d+=u.nodeSize}),t.dispatch(s)}function Hf(t,e){try{let n=t.state.doc.resolve(e);for(let r=n.depth;r>0;r--){let o=n.node(r);if(o.type.name==="tableCell"||o.type.name==="tableHeader")return n.before(r)}}catch{}return null}function eb(t,e,n){try{let r=t.state.doc.resolve(e),o=t.state.doc.resolve(n);return t.dispatch(t.state.tr.setSelection(new Ve(r,o))),!0}catch{return!1}}function GU(){let t=null,e=!1;return{begin(n){t=n,e=!1},update(n,r,o){if(t===null)return!1;if(e){let l=Hf(n,r);if(l!==null)return eb(n,t,l),!0}let i=Hf(n,r);return i!==null&&i!==t?(e=!0,eb(n,t,i),!0):!1},end(){e=!1},get isCellDragging(){return e}}}function YU(t,e,n,r,o,i){if(t.length===0)return[];let l=n?.getContainerOffset(),a=[];for(let d of t){let u;if(d.fixedY!=null&&(u=d.fixedY*r),u==null&&d.anchorKey){let f=e.get(d.anchorKey);f!=null&&(u=f*r)}if(u==null&&n){let f=n.getRectsForRange(d.anchorPos,d.anchorPos+1);f.length>0&&l&&(u=(f[0].y+l.y)*r)}if(u==null){let f=i.get(d.id);f!=null&&(u=f)}u!=null&&(a.push({item:d,targetY:u}),i.set(d.id,u))}a.sort((d,u)=>{let f=d.targetY-u.targetY;return f!==0?f:(d.item.priority??0)-(u.item.priority??0)});let s=[],c=0;for(let d of a){let u=o.get(d.item.id)??d.item.estimatedHeight??80,f=Math.max(d.targetY,c+8);s.push({item:d.item,y:f}),c=f+u}return s}var tb=["single","words","double","thick","dotted","dottedHeavy","dash","dashedHeavy","dashLong","dashLongHeavy","dotDash","dashDotHeavy","dotDotDash","dashDotDotHeavy","wave","wavyHeavy","wavyDouble","none"],cs=["black","blue","cyan","darkBlue","darkCyan","darkGray","darkGreen","darkMagenta","darkRed","darkYellow","green","lightGray","magenta","red","white","yellow","none"],JU={name:"apply_formatting",displayName:"Applying formatting",description:'Apply character formatting (bold, italic, underline, strike, color, highlight, font size, font family) to a paragraph or to a unique phrase within it. Pass `search` to scope the change to part of the paragraph; omit it to format the whole paragraph. Direct edit — does not create a tracked change. Pass `false` to clear a mark; omit a key to leave it untouched. Color uses `{rgb: "FF0000"}` (no hash) or `{themeColor: "accent1"}`. Font size is in points. Font family takes `{ascii, hAnsi}`.',inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Optional: format only this exact phrase within the paragraph (must be unique)."},marks:{type:"object",description:"Marks to set or clear. Omit a key to leave it untouched.",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{description:'true → single underline; false → clear; or { style: "single"|"double"|"thick"|"dotted"|"dottedHeavy"|"dash"|"dashedHeavy"|"dashLong"|"dashLongHeavy"|"dotDash"|"dashDotHeavy"|"dotDotDash"|"dashDotDotHeavy"|"wave"|"wavyHeavy"|"wavyDouble"|"words"|"none" }. Other values are rejected.'},strike:{type:"boolean"},color:{type:"object",description:'Either {rgb: "RRGGBB"} (no hash) or {themeColor: "accent1"|"text1"|...}.',properties:{rgb:{type:"string"},themeColor:{type:"string"}}},highlight:{type:"string",enum:[...cs],description:"Highlight color — must be one of the Word-supported names: "+cs.join(", ")+'. Pass "none" to clear. Hex values are rejected (Word does not accept hex for <w:highlight>).'},fontSize:{type:"number",description:"Size in points (e.g. 12, 14, 24)."},fontFamily:{type:"object",properties:{ascii:{type:"string"},hAnsi:{type:"string"}}}}}},required:["paraId","marks"]},handler:(t,e)=>{if(!t.marks||Object.keys(t.marks).length===0)return{success:!1,error:"No marks provided. Specify at least one of bold/italic/etc."};let n=typeof t.marks.underline=="object"&&t.marks.underline!==null?t.marks.underline.style:void 0;if(n&&!tb.includes(n))return{success:!1,error:`Invalid underline.style "${n}". Must be one of: ${tb.join(", ")}.`};let r=typeof t.marks.highlight=="string"?t.marks.highlight:void 0;if(r&&!cs.includes(r))return{success:!1,error:`Invalid highlight "${r}". Must be one of: ${cs.join(", ")}. Hex values are not supported by Word's highlight attribute.`};let o=r==="none"?{...t.marks,highlight:""}:t.marks;return e.applyFormatting({paraId:t.paraId,search:t.search,marks:o})?{success:!0,data:`Formatting applied to ${t.search?`"${t.search}" in ${t.paraId}`:t.paraId}.`}:{success:!1,error:"Could not apply formatting. The paraId may not exist, or `search` is missing / ambiguous."}}},QU={name:"set_paragraph_style",displayName:"Setting paragraph style",description:`Apply a paragraph style by id (e.g. "Heading1", "Heading2", "Title", "Quote", "Normal"). The styleId must exist in the document's style definitions — unknown ids are no-ops. Direct edit, not a tracked change.`,inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},styleId:{type:"string",description:'Style id (e.g. "Heading1", "Title", "Quote", "Normal").'}},required:["paraId","styleId"]},handler:(t,e)=>e.setParagraphStyle({paraId:t.paraId,styleId:t.styleId})?{success:!0,data:`Style "${t.styleId}" applied to ${t.paraId}.`}:{success:!1,error:`Could not set style. paraId "${t.paraId}" not found, or styleId "${t.styleId}" is not defined.`}},wu=["page","sectionNextPage","sectionContinuous"],eX={page:"Page break",sectionNextPage:"Section break (next page)",sectionContinuous:"Section break (continuous)"},tX={name:"insert_break",displayName:"Inserting break",description:'Insert a break after a paragraph (located by paraId). `type: "page"` adds a page break so following content starts on a new page. `type: "sectionNextPage"` starts a new document section on a new page. `type: "sectionContinuous"` starts a new section on the same page (use this to change column layout or margins from that point onward). The target paragraph becomes the end of its page/section and the next paragraph begins the new one. Direct edit — not a tracked change.',inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text. The break is inserted after this paragraph."},type:{type:"string",enum:[...wu],description:'Break kind: "page" (page break), "sectionNextPage" (new section, new page), or "sectionContinuous" (new section, same page).'}},required:["paraId","type"]},handler:(t,e)=>wu.includes(t.type)?e.insertBreak({paraId:t.paraId,type:t.type})?{success:!0,data:`${eX[t.type]} inserted after ${t.paraId}.`}:{success:!1,error:`Could not insert break. paraId "${t.paraId}" not found.`}:{success:!1,error:`Invalid break type "${t.type}". Must be one of: ${wu.join(", ")}.`}},nX={name:"read_page",displayName:"Reading page",description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:"object",properties:{pageNumber:{type:"number",description:"1-indexed page number."}},required:["pageNumber"]},handler:(t,e)=>{let n=e.getPage(t.pageNumber);if(!n){let r=e.getTotalPages();return r===0?{success:!1,error:"No pages rendered (headless mode or empty document)."}:{success:!1,error:`Page ${t.pageNumber} does not exist (document has ${r} page${r===1?"":"s"}).`}}return{success:!0,data:n.text||"(empty page)"}}},rX={name:"read_pages",displayName:"Reading pages",description:"Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly — single round-trip.",inputSchema:{type:"object",properties:{from:{type:"number",description:"1-indexed start page (inclusive)."},to:{type:"number",description:"1-indexed end page (inclusive)."}},required:["from","to"]},handler:(t,e)=>{let n=e.getPages({from:t.from,to:t.to});if(n.length===0){let r=e.getTotalPages();return r===0?{success:!1,error:"No pages rendered (headless mode or empty document)."}:{success:!1,error:`No pages in range ${t.from}–${t.to} (document has ${r} page${r===1?"":"s"}).`}}return{success:!0,data:n.map(r=>`--- Page ${r.pageNumber} ---
108
+ ${r.text||"(empty page)"}`).join(`
109
+
110
+ `)}}},oX={name:"read_document",displayName:"Reading document",description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes — it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:"object",properties:{fromIndex:{type:"number",description:"Start ordinal index (inclusive). Optional."},toIndex:{type:"number",description:"End ordinal index (inclusive). Optional."}}},handler:(t,e)=>({success:!0,data:e.getContentAsText({fromIndex:t.fromIndex,toIndex:t.toIndex,includeTrackedChanges:!1,includeCommentAnchors:!1})})},iX={name:"read_selection",displayName:"Reading selection",description:'Read the user\'s current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph\'s `paraId`. Use this when the user asks "fix this" or "review what I have selected".',inputSchema:{type:"object",properties:{}},handler:(t,e)=>{let n=e.getSelection();return n?{success:!0,data:n}:{success:!1,error:"No selection (editor not focused)."}}},lX={name:"find_text",displayName:"Finding text",description:"Locate paragraphs containing `query`. Returns up to `limit` handles, each with `paraId`, the matched substring, and surrounding context. Pass any returned `paraId` (and the `match` as `search`) to add_comment / suggest_change.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text to find (substring match)."},caseSensitive:{type:"boolean",description:"Default: false."},limit:{type:"number",description:"Max paragraphs to return. Default: 20."}},required:["query"]},handler:(t,e)=>{let n=e.findText(t.query,{caseSensitive:t.caseSensitive,limit:t.limit});return n.length===0?{success:!0,data:"No matches."}:{success:!0,data:n}}},aX={name:"read_comments",displayName:"Reading comments",description:"List all comments in the document with their paragraph anchors.",inputSchema:{type:"object",properties:{}},handler:(t,e)=>{let n=e.getComments();return n.length===0?{success:!0,data:"No comments."}:{success:!0,data:n.map(r=>`[Comment #${r.id}] ${r.author}: "${r.text}"`+(r.anchoredText?` (anchored to: "${r.anchoredText}")`:"")+(r.replies.length>0?`
111
+ `+r.replies.map(o=>` Reply by ${o.author}: "${o.text}"`).join(`
112
+ `):"")).join(`
113
+ `)}}},sX={name:"read_changes",displayName:"Reading changes",description:"List tracked changes (insertions / deletions) currently in the document.",inputSchema:{type:"object",properties:{}},handler:(t,e)=>{let n=e.getChanges();return n.length===0?{success:!0,data:"No tracked changes."}:{success:!0,data:n.map(r=>`[Change #${r.id}] ${r.type} by ${r.author}: "${r.text}"`).join(`
114
+ `)}}},cX={name:"add_comment",displayName:"Adding comment",description:"Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},text:{type:"string",description:"Comment body."},search:{type:"string",description:"Optional: anchor to this exact phrase within the paragraph. Must be unique."}},required:["paraId","text"]},handler:(t,e)=>{let n=e.addComment({paraId:t.paraId,text:t.text,search:t.search});return n===null?{success:!1,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:!0,data:`Comment ${n} added on ${t.paraId}.`}}},dX={name:"suggest_change",displayName:"Suggesting change",description:"Suggest a tracked change. Three modes: (1) replacement — `search` non-empty, `replaceWith` non-empty; (2) deletion — `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end — `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."},search:{type:"string",description:"Phrase to find (must be unique). Empty string = insert at paragraph end."},replaceWith:{type:"string",description:"Replacement text. Empty string = delete the matched phrase."}},required:["paraId","search","replaceWith"]},handler:(t,e)=>e.proposeChange({paraId:t.paraId,search:t.search,replaceWith:t.replaceWith})?t.search?t.replaceWith?{success:!0,data:`Replacement proposed: "${t.search}" → "${t.replaceWith}" on ${t.paraId}.`}:{success:!0,data:`Deletion proposed: "${t.search}" on ${t.paraId}.`}:{success:!0,data:`Insertion proposed on ${t.paraId}.`}:{success:!1,error:"Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change."}},uX={name:"reply_comment",displayName:"Replying to comment",description:"Reply to an existing comment by id. Threaded under the original.",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."},text:{type:"string",description:"Reply body."}},required:["commentId","text"]},handler:(t,e)=>{let n=e.replyTo(t.commentId,{text:t.text});return n===null?{success:!1,error:`Comment #${t.commentId} not found.`}:{success:!0,data:`Reply ${n} added to comment ${t.commentId}.`}}},fX={name:"resolve_comment",displayName:"Resolving comment",description:"Mark a comment as resolved (done).",inputSchema:{type:"object",properties:{commentId:{type:"number",description:"Comment id from read_comments."}},required:["commentId"]},handler:(t,e)=>(e.resolveComment(t.commentId),{success:!0,data:`Comment ${t.commentId} resolved.`})},pX={name:"scroll",displayName:"Scrolling",description:"Scroll the editor to a paragraph by paraId. Does not move the user's cursor.",inputSchema:{type:"object",properties:{paraId:{type:"string",description:"Paragraph id from read_document / find_text."}},required:["paraId"]},handler:(t,e)=>e.scrollTo(t.paraId)?{success:!0,data:`Scrolled to ${t.paraId}.`}:{success:!1,error:`paraId ${t.paraId} not found.`}},hX=[oX,iX,nX,rX,lX,aX,sX,cX,dX,JU,QU,tX,uX,fX,pX];function mX(){return hX.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.inputSchema}}))}mX();var xu={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel"}},nb="eigenpal:docx-editor:agentPanelWidth";function gX({size:t=22}){return b.jsx("svg",{viewBox:"0 -960 960 960",width:t,height:t,fill:"currentColor","aria-hidden":"true",children:b.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function yX({size:t=18}){return b.jsx("svg",{viewBox:"0 -960 960 960",width:t,height:t,fill:"currentColor","aria-hidden":"true",children:b.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var bX=360,wX=280,xX=600;function vX({title:t=xu.agentPanel.defaultTitle,icon:e,closeLabel:n=xu.agentPanel.close,resizeHandleLabel:r=xu.agentPanel.resizeHandle,width:o,defaultWidth:i=bX,minWidth:l=wX,maxWidth:a=xX,onWidthChange:s,onClose:c,children:d,className:u,closed:f=!1}){let h=o!==void 0,[p,m]=S.useState(!1),y=S.useRef(f);S.useEffect(()=>{if(y.current!==f){y.current=f,m(!0);let $=window.setTimeout(()=>m(!1),260);return()=>window.clearTimeout($)}},[f]);let[w,C]=S.useState(()=>{if(h)return o;if(typeof window>"u")return i;try{let $=window.localStorage.getItem(nb);if($){let M=Number($);if(Number.isFinite(M)&&M>=l&&M<=a)return M}}catch{}return i}),g=h?o:w,v=S.useRef(null),k=S.useRef({minWidth:l,maxWidth:a,isControlled:h,onWidthChange:s});k.current={minWidth:l,maxWidth:a,isControlled:h,onWidthChange:s};let x=S.useRef(null);if(!x.current){let $=I=>{let F=v.current;if(!F)return;let E=k.current,R=F.startX-I.clientX,N=Math.min(E.maxWidth,Math.max(E.minWidth,F.startWidth+R));F.lastWidth=N,E.isControlled||C(N),E.onWidthChange?.(N)},M=()=>{let I=v.current;if(I&&(v.current=null,document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",M),!k.current.isControlled))try{window.localStorage.setItem(nb,String(I.lastWidth))}catch{}};x.current={move:$,up:M}}let T=S.useCallback($=>{$.preventDefault();let M=h?o:w;v.current={startX:$.clientX,startWidth:M,lastWidth:M},document.addEventListener("pointermove",x.current.move),document.addEventListener("pointerup",x.current.up)},[]);return S.useEffect(()=>()=>{let $=x.current;$&&(document.removeEventListener("pointermove",$.move),document.removeEventListener("pointerup",$.up))},[]),b.jsxs("div",{className:`ep-agent-panel${u?` ${u}`:""}`,style:{width:f?0:g,flex:f?"0 0 0px":`0 0 ${g}px`,height:"calc(100% - 16px)",margin:f?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:f?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:f?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:f?0:1,pointerEvents:f?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:f?0:l,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:p?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":f,"data-testid":"agent-panel","data-state":f?"closed":"open",role:"complementary","aria-label":t,children:[b.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":r,onPointerDown:T,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[b.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:e??b.jsx(gX,{size:22})}),b.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),c&&b.jsx("button",{type:"button",onClick:c,"aria-label":n,title:n,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:$=>{$.currentTarget.style.background="#f1f3f4"},onMouseLeave:$=>{$.currentTarget.style.background="transparent"},children:b.jsx(yX,{size:18})})]}),b.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:d})]})}function zS(t){return t?.length?t.flatMap(e=>e.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 Oh(t){return t?new Date(t).toLocaleString(void 0,{hour:"numeric",minute:"2-digit",month:"short",day:"numeric"}):""}function jh(t){return t.split(/\s+/).map(e=>e[0]).join("").toUpperCase().slice(0,2)}var rb=["#6DCCB1","#79AAD9","#EE789D","#A987D1","#E6A85F","#F2CC8F","#68B3A2","#B07AA1","#59A14F","#FF9DA7","#E15759","#76B7B2"];function kX(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return rb[Math.abs(e)%rb.length]}function ci(t,e=50){return t.length>e?t.slice(0,e)+"...":t}var CX={padding:"8px 10px",borderRadius:8,backgroundColor:"var(--doc-card)",cursor:"pointer",boxShadow:"var(--doc-card-shadow)"},SX={padding:"10px 12px",borderRadius:8,backgroundColor:"var(--doc-surface)",cursor:"pointer",boxShadow:"var(--doc-card-shadow-strong)"};function TX({showOutlineProp:t,pagedEditorRef:e,scrollContainerRef:n,isLoading:r}){let[o,i]=S.useState(t),l=S.useRef(!1);l.current=o;let[a,s]=S.useState([]);S.useEffect(()=>{if(i(t),t){let y=e.current?.getView();y&&s(Rs(y.state.doc))}},[t,e]);let c=S.useRef(null),d=S.useRef(null),[u,f]=S.useState(0),h=S.useCallback(y=>{if(d.current=y,c.current&&(c.current.disconnect(),c.current=null),!y){f(0);return}f(y.offsetHeight);let w=new ResizeObserver(()=>{f(y.offsetHeight)});w.observe(y),c.current=w},[]);S.useEffect(()=>()=>{c.current?.disconnect()},[]);let[p,m]=S.useState(0);return S.useEffect(()=>{let y=n.current;if(!y)return;let w=0,C=()=>{w=0,m(y.scrollLeft)},g=()=>{w===0&&(w=requestAnimationFrame(C))};return C(),y.addEventListener("scroll",g,{passive:!0}),()=>{y.removeEventListener("scroll",g),w!==0&&cancelAnimationFrame(w)}},[r,n]),{showOutline:o,setShowOutline:i,showOutlineRef:l,outlineHeadings:a,setHeadingInfos:s,toolbarHeight:u,toolbarRefCallback:h,editorScrollLeft:p}}function $X({pagedEditorRef:t,disableFindReplaceShortcuts:e,showFileOpen:n,onOpenDocument:r,findReplace:o,hyperlinkDialog:i,tableSelection:l}){S.useEffect(()=>{let a=s=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0?s.metaKey:s.ctrlKey;if(!c&&!s.shiftKey&&!s.altKey&&(s.key==="Delete"||s.key==="Backspace")){let d=t.current?.getView();if(d){let u=d.state.selection;if("$anchorCell"in u&&typeof u.forEachCell=="function"){let f=Ge(d.state);if(f.isInTable&&f.table){let h=0;f.table.descendants(m=>{(m.type.name==="tableCell"||m.type.name==="tableHeader")&&(h+=1)});let p=0;if(u.forEachCell(()=>{p+=1}),h>0&&p>=h){s.preventDefault(),Eh(d.state,d.dispatch);return}}}}if(l.state.tableIndex!==null){s.preventDefault(),l.handleAction("deleteTable");return}}if(c&&!s.shiftKey&&!s.altKey){if(s.key.toLowerCase()==="f"){if(e)return;s.preventDefault();let d=window.getSelection(),u=d&&!d.isCollapsed?d.toString():"";o.openFind(u)}else if(s.key.toLowerCase()==="o"){if(!n||!r)return;s.preventDefault(),r()}else if(s.key.toLowerCase()==="h"){if(e)return;s.preventDefault();let d=window.getSelection(),u=d&&!d.isCollapsed?d.toString():"";o.openReplace(u)}else if(s.key.toLowerCase()==="k"){s.preventDefault();let d=t.current?.getView();if(d){let u=gk(d.state),f=mk(d.state);f?i.openEdit({url:f.href,displayText:u,tooltip:f.tooltip}):i.openInsert(u)}}}};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[t,e,n,r,o,i,l])}function vu(t,e){return t instanceof Error?t:new Error(e)}function IX({agentRef:t,pagedEditorRef:e,containerRef:n,comments:r,documentName:o,onSave:i,onOpen:l,onError:a,onPrint:s,onDocumentNameChange:c,loadBuffer:d,getActiveEditorView:u,focusActiveEditor:f}){let h=S.useRef(null),p=S.useRef(null),m=S.useCallback(async x=>{if(!t.current)return null;try{let T=t.current.getDocument(),$=e.current?.getDocument();$?.package?.document&&(T.package.document.content=$.package.document.content),T.package.document.comments=r,BK(T.package.document.content,r),OK(T.package.document.content,r);let M=x?.selective!==!1,I=e.current?.getView(),F;if(M&&I){let R=I.state,N=r.some(B=>B.parentId!=null);F={selective:{changedParaIds:tj(R),structuralChange:nj(R)||N,hasUntrackedChanges:rj(R)}}}let E=await t.current.toBuffer(F);return I&&I.dispatch(oj(I.state)),i?.(E),E}catch(T){return a?.(vu(T,"Failed to save document")),null}},[t,e,r,i,a]),y=S.useCallback(()=>{let x=n.current?.querySelector(".paged-editor__pages");if(!x){window.print(),s?.();return}q_(x);let T=window.open("","_blank");if(!T){window.print(),s?.();return}let $=[];for(let F of Array.from(document.styleSheets))try{for(let E of Array.from(F.cssRules))E instanceof CSSFontFaceRule&&$.push(E.cssText)}catch{}let M=x.cloneNode(!0);M.style.cssText="display: block; margin: 0; padding: 0;";for(let F of Array.from(M.querySelectorAll(".layout-page"))){let E=F;E.style.boxShadow="none",E.style.margin="0"}T.document.write(`<!DOCTYPE html>
115
+ <html><head><title>Print</title>
116
+ <style>
117
+ * { margin: 0; padding: 0; }
118
+ body { background: white; }
119
+ .layout-page { break-after: page; }
120
+ .layout-page:last-child { break-after: auto; }
121
+ @page { margin: 0; size: auto; }
122
+ </style>
123
+ </head><body></body></html>`);let I=T.document.createElement("style");I.textContent=$.join(`
124
+ `),T.document.head.appendChild(I),T.document.body.appendChild(T.document.importNode(M,!0)),T.document.close(),T.onload=()=>{T.print(),T.close()},setTimeout(()=>{T.closed||(T.print(),T.close())},1e3),s?.()},[n,s]),w=S.useCallback(async()=>{let x=await m();if(!x)return;let T=new Blob([x],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),$=URL.createObjectURL(T),M=window.document.createElement("a");M.href=$,M.download=`${(o?.trim()||"document").replace(/\.docx$/i,"")}.docx`,M.click(),setTimeout(()=>URL.revokeObjectURL($),0)},[m,o]),C=S.useCallback(()=>{p.current?.click()},[]),g=S.useCallback(async x=>{if(l){let T=x.currentTarget,$=T.files?.[0];if(T.value="",!$)return;try{await l($)}catch(M){a?.(vu(M,"Failed to open document"))}return}try{let T=await rM(x.nativeEvent);if(!T)return;await d(T.buffer),c?.(T.name)}catch(T){a?.(vu(T,"Failed to open document"))}},[d,c,a,l]),v=S.useCallback(()=>{h.current?.click()},[]),k=S.useCallback(x=>{let T=x.target.files?.[0],$=u();T&&$&&IZ($,T,{onInserted:f}),x.target.value=""},[u,f]);return{imageInputRef:h,docxInputRef:p,handleSave:m,handleDirectPrint:y,handleDownloadDocument:w,handleOpenDocument:C,handleDocxFileChange:g,handleInsertImageClick:v,handleImageFileChange:k}}function MX({document:t,readOnly:e,handleDocumentChange:n,getActiveEditorView:r}){let[o,i]=S.useState(!1),l=S.useCallback(()=>i(!0),[]),a=S.useCallback(w=>C=>{if(!t||e)return;let g={...t,package:{...t.package,document:{...t.package.document,finalSectionProperties:{...t.package.document.finalSectionProperties,[w]:C}}}};n(g)},[t,e,n]),s=S.useMemo(()=>a("marginLeft"),[a]),c=S.useMemo(()=>a("marginRight"),[a]),d=S.useMemo(()=>a("marginTop"),[a]),u=S.useMemo(()=>a("marginBottom"),[a]),f=S.useCallback(w=>{if(!t||e)return;let C={...t,package:{...t.package,document:{...t.package.document,finalSectionProperties:{...t.package.document.finalSectionProperties,...w}}}};n(C)},[t,e,n]),h=S.useCallback(w=>{let C=r();C&&XZ(w)(C.state,C.dispatch)},[r]),p=S.useCallback(w=>{let C=r();C&&GZ(w)(C.state,C.dispatch)},[r]),m=S.useCallback(w=>{let C=r();C&&(w<0?Wy(-w,!0)(C.state,C.dispatch):Wy(w,!1)(C.state,C.dispatch))},[r]),y=S.useCallback(w=>{let C=r();C&&tK(w)(C.state,C.dispatch)},[r]);return{showPageSetup:o,setShowPageSetup:i,handleOpenPageSetup:l,handleLeftMarginChange:s,handleRightMarginChange:c,handleTopMarginChange:d,handleBottomMarginChange:u,handlePageSetupApply:f,handleIndentLeftChange:h,handleIndentRightChange:p,handleFirstLineIndentChange:m,handleTabStopRemove:y}}function RX({readOnly:t,getBodyEditorView:e}){let[n,r]=S.useState(!1),o=S.useCallback(()=>r(!0),[]),i=e(),l=i?zZ(i.state)??void 0:void 0,a=S.useCallback(s=>{if(t)return;let c=e();c&&HZ(s)(c.state,c.dispatch)},[t,e]);return{showWatermark:n,setShowWatermark:r,handleOpenWatermark:o,currentWatermark:l,handleWatermarkApply:a}}function PX({hyperlinkDialog:t,getActiveEditorView:e,focusActiveEditor:n}){let[r,o]=S.useState(null),i=S.useCallback(p=>{let m=e();if(!m)return;let y=p.url||"",w=p.tooltip,{empty:C}=m.state.selection;C&&p.displayText?qy(p.displayText,y,w)(m.state,m.dispatch):C?p.displayText&&qy(p.displayText,y,w)(m.state,m.dispatch):mK(y,w)(m.state,m.dispatch),t.close(),n()},[t,e,n]),l=S.useCallback(()=>{let p=e();p&&(gK(p.state,p.dispatch),n())},[e,n]),a=S.useCallback(()=>{l(),t.close()},[t,l]),s=S.useCallback(p=>o(p),[]),c=S.useCallback(p=>{window.open(p,"_blank","noopener,noreferrer")},[]),d=S.useCallback(p=>{navigator.clipboard.writeText(p).catch(()=>{let m=document.createElement("textarea");m.value=p,m.style.position="fixed",m.style.opacity="0",document.body.appendChild(m),m.select(),document.execCommand("copy"),document.body.removeChild(m)})},[]),u=S.useCallback((p,m)=>{let y=e();if(!y)return;let w=O0(y.state);if(w){let C=y.state.schema.marks.hyperlink,{$from:g}=y.state.selection,v=C.create({href:m,tooltip:w.mark.attrs.tooltip}),k=y.state.schema.text(p,[...g.marks().filter(T=>T.type!==C),v]),x=y.state.tr.replaceWith(w.start,w.end,k);y.dispatch(x.scrollIntoView())}o(null),n()},[e,n]),f=S.useCallback(()=>{let p=e();if(!p)return;let m=O0(p.state,r?.href);if(!m)return;let y=p.state.schema.marks.hyperlink;p.dispatch(p.state.tr.removeMark(m.start,m.end,y).scrollIntoView()),o(null),n(),OS("Link removed")},[e,n,r]),h=S.useCallback(()=>{o(null)},[]);return{hyperlinkPopupData:r,setHyperlinkPopupData:o,handleHyperlinkSubmit:i,handleHyperlinkRemove:a,handleHyperlinkClick:s,handleHyperlinkPopupNavigate:c,handleHyperlinkPopupCopy:d,handleHyperlinkPopupEdit:u,handleHyperlinkPopupRemove:f,handleHyperlinkPopupClose:h}}function ob(t,e,n){let r=0;for(let o of t){let i=r+o.text.length;if(n==="start"&&e>=r&&e<i||n==="end"&&e>r&&e<=i)return o.pmStart+e-r;r=i}return null}function ib(t,e,n){let r=[],o=0;return t.state.doc.descendants((i,l)=>{if(!i.isTextblock)return!0;let a=[],s="";if(i.descendants((d,u)=>(!d.isText||!d.text||(a.push({text:d.text,pmStart:l+1+u}),s+=d.text),!0)),!s)return o+=1,!1;let c=(0,kh.findAllMatches)(s,e,n);for(let d of c){let u=ob(a,d.start,"start"),f=ob(a,d.end,"end");u==null||f==null||u>=f||r.push({paragraphIndex:o,contentIndex:0,startOffset:d.start,endOffset:d.end,text:s.slice(d.start,d.end),pmFrom:u,pmTo:f})}return o+=1,!1}),r}function EX({pagedEditorRef:t,findReplace:e}){let n=S.useRef(null),r=S.useCallback(()=>t.current?.getView()??null,[t]),o=S.useCallback((d,u)=>{let f=r();if(!f||!d)return null;try{let p=ye.create(f.state.doc,d.pmFrom,d.pmTo);f.dispatch(f.state.tr.setSelection(p)),t.current?.scrollToPosition(d.pmFrom)}catch(p){return console.error("Find navigation failed:",p),null}let h=n.current;return h&&(h.currentIndex=u),e.goToMatch(u),d},[e,r,t]),i=S.useCallback((d,u)=>{let f=r();if(!f||!d.trim())return n.current=null,e.setMatches([],0),null;let h=ib(f,d,u),p={matches:h,totalCount:h.length,currentIndex:0};return n.current=p,e.setMatches(h,0),h.length>0&&o(h[0],0),p},[e,r,o]),l=S.useCallback(()=>{let d=n.current;if(!d||d.matches.length===0)return null;let u=(d.currentIndex+1)%d.matches.length;return o(d.matches[u],u)},[o]),a=S.useCallback(()=>{let d=n.current;if(!d||d.matches.length===0)return null;let u=d.currentIndex===0?d.matches.length-1:d.currentIndex-1;return o(d.matches[u],u)},[o]),s=S.useCallback(d=>{let u=r(),f=n.current;if(!u||!f||f.matches.length===0)return!1;let h=f.matches[f.currentIndex];if(!h)return!1;try{let p=d?u.state.tr.replaceWith(h.pmFrom,h.pmTo,u.state.schema.text(d)):u.state.tr.delete(h.pmFrom,h.pmTo);return u.dispatch(p),!0}catch(p){return console.error("Replace failed:",p),!1}},[r]),c=S.useCallback((d,u,f)=>{let h=r();if(!h||!d.trim())return 0;let p=ib(h,d,f);if(p.length===0)return 0;let m=[...p].sort((w,C)=>C.pmFrom-w.pmFrom),y=h.state.tr;for(let w of m)try{y=u?y.replaceWith(w.pmFrom,w.pmTo,h.state.schema.text(u)):y.delete(w.pmFrom,w.pmTo)}catch(C){console.error("Replace failed for match:",w,C)}return h.dispatch(y),n.current=null,e.setMatches([],0),p.length},[e,r]);return{findResultRef:n,handleFind:i,handleFindNext:l,handleFindPrevious:a,handleReplace:s,handleReplaceAll:c}}function FX({getActiveEditorView:t,focusActiveEditor:e,pagedEditorRef:n,lastSelectionRef:r,hyperlinkDialog:o,historyStateRef:i,getCachedStyleResolver:l}){let a=S.useCallback(h=>{let p=t();if(!p)return;p.focus();let m=p===n.current?.getView(),{from:y,to:w}=p.state.selection,C=r.current;if(m&&C&&(y!==C.from||w!==C.to))try{let g=p.state.tr.setSelection(ye.create(p.state.doc,C.from,C.to));p.dispatch(g)}catch(g){console.warn("Could not restore selection:",g)}if(h==="bold")return void iK(p.state,p.dispatch);if(h==="italic")return void lK(p.state,p.dispatch);if(h==="underline")return void aK(p.state,p.dispatch);if(h==="strikethrough")return void sK(p.state,p.dispatch);if(h==="superscript")return void cK(p.state,p.dispatch);if(h==="subscript")return void dK(p.state,p.dispatch);if(h==="bulletList")return void YZ(p.state,p.dispatch);if(h==="numberedList")return void JZ(p.state,p.dispatch);if(h==="indent"){QZ(p.state,p.dispatch)||KZ()(p.state,p.dispatch);return}if(h==="outdent"){eK(p.state,p.dispatch)||UZ()(p.state,p.dispatch);return}if(h==="clearFormatting")return void A4(p.state,p.dispatch);if(h==="setRtl")return void nK(p.state,p.dispatch);if(h==="setLtr")return void rK(p.state,p.dispatch);if(h==="insertLink"){let g=gk(p.state),v=mk(p.state);v?o.openEdit({url:v.href,displayText:g,tooltip:v.tooltip}):o.openInsert(g);return}if(typeof h=="object")switch(h.type){case"alignment":qZ(h.value)(p.state,p.dispatch);break;case"textColor":{let g=h.value;typeof g=="string"?Vy({rgb:g.replace("#","")})(p.state,p.dispatch):g.auto?uK(p.state,p.dispatch):Vy(g)(p.state,p.dispatch);break}case"highlightColor":{let g=h.value?Ew(h.value):"";fK(g||h.value)(p.state,p.dispatch);break}case"fontSize":pK(Ub(h.value))(p.state,p.dispatch);break;case"fontFamily":hK(h.value)(p.state,p.dispatch);break;case"lineSpacing":ZZ(h.value)(p.state,p.dispatch);break;case"applyStyle":{let g=i.current,v=g?.package.styles?l(g.package.styles):null;if(v){let k=v.resolveParagraphStyle(h.value);cc(h.value,{paragraphFormatting:k.paragraphFormatting,runFormatting:k.runFormatting,numbering:g?.package.numbering?Kx(g.package.numbering):null})(p.state,p.dispatch)}else cc(h.value)(p.state,p.dispatch);break}}},[t,n,r,o,i,l]),s=S.useCallback((h,p)=>{let m=t();m&&(oZ(h,p)(m.state,m.dispatch),e())},[t,e]),c=S.useCallback(()=>{let h=t();h&&(_Z(h.state,h.dispatch),e())},[t,e]),d=S.useCallback(()=>{let h=t();h&&(WZ(h.state,h.dispatch),e())},[t,e]),u=S.useCallback(()=>{let h=t();h&&(VZ(h.state,h.dispatch),e())},[t,e]),f=S.useCallback(()=>{let h=t();h&&(oK(h.state,h.dispatch),e())},[t,e]);return{handleFormat:a,handleInsertTable:s,handleInsertPageBreak:c,handleInsertSectionBreakNextPage:d,handleInsertSectionBreakContinuous:u,handleInsertTOC:f}}function AX({document:t,pmImageContext:e,zoom:n,getActiveEditorView:r,focusActiveEditor:o,pushDocument:i}){let[l,a]=S.useState(!1),[s,c]=S.useState(!1),[d,u]=S.useState(!1),f=S.useCallback(C=>{let g=r();if(!g||!e)return;let v=e.pos,k=g.state.doc.nodeAt(v);if(!k||k.type.name!=="image")return;let x=WK(C);if(!x)return;let T;if(k.attrs.wrapType==="inline"&&x!=="inline"){let $=window.document.querySelector(`.layout-run-image[data-pm-start="${v}"]`),M=$?zf($,n):void 0;M&&(T={initialPositionEmu:M})}$S(v,x,T)(g.state,g.dispatch),o()},[r,o,e,n]),h=S.useCallback(C=>{let g=r();if(!g||!e)return;let v=e.pos,k=g.state.doc.nodeAt(v);if(!k||k.type.name!=="image")return;let x=k.attrs.transform||"",T=x.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/),$=T?parseFloat(T[1]):0,M=/scaleX\(-1\)/.test(x),I=/scaleY\(-1\)/.test(x);switch(C){case"rotateCW":$=($+90)%360;break;case"rotateCCW":$=($-90+360)%360;break;case"flipH":M=!M;break;case"flipV":I=!I;break}let F=[];$!==0&&F.push(`rotate(${$}deg)`),M&&F.push("scaleX(-1)"),I&&F.push("scaleY(-1)");let E=F.length>0?F.join(" "):null,R=g.state.tr.setNodeMarkup(v,void 0,{...k.attrs,transform:E});g.dispatch(R.scrollIntoView()),o()},[r,o,e]),p=S.useCallback(C=>{let g=r();if(!g||!e)return;let v=e.pos,k=g.state.doc.nodeAt(v);if(!k||k.type.name!=="image")return;let x=g.state.tr.setNodeMarkup(v,void 0,{...k.attrs,position:{horizontal:C.horizontal,vertical:C.vertical},distTop:C.distTop??k.attrs.distTop,distBottom:C.distBottom??k.attrs.distBottom,distLeft:C.distLeft??k.attrs.distLeft,distRight:C.distRight??k.attrs.distRight});g.dispatch(x.scrollIntoView()),o()},[r,o,e]),m=S.useCallback(()=>{c(!0)},[]),y=S.useCallback(C=>{let g=r();if(!g||!e)return;let v=e.pos,k=g.state.doc.nodeAt(v);if(!k||k.type.name!=="image")return;let x=g.state.tr.setNodeMarkup(v,void 0,{...k.attrs,alt:C.alt??null,borderWidth:C.borderWidth??null,borderColor:C.borderColor??null,borderStyle:C.borderStyle??null,width:C.width??null,height:C.height??null});g.dispatch(x.scrollIntoView()),o()},[r,o,e]),w=S.useCallback((C,g)=>{if(!t?.package)return;let v={...t.package.document,finalSectionProperties:{...t.package.document.finalSectionProperties,footnotePr:C,endnotePr:g}};i({...t,package:{...t.package,document:v}})},[t,i]);return{imagePositionOpen:l,setImagePositionOpen:a,imagePropsOpen:s,setImagePropsOpen:c,footnotePropsOpen:d,setFootnotePropsOpen:u,handleImageWrapType:f,handleImageTransform:h,handleApplyImagePosition:p,handleOpenImageProperties:m,handleApplyImageProperties:y,handleApplyFootnoteProperties:w}}var HS=new Map;function DX({ref:t,agentRef:e,document:n,historyStateRef:r,pagedEditorRef:o,handleSave:i,handleDirectPrint:l,zoom:a,setZoom:s,scrollPageInfo:c,loadParsedDocument:d,loadBuffer:u,comments:f,setComments:h,setShowCommentsSidebar:p,contentChangeSubscribersRef:m,selectionChangeSubscribersRef:y,getCachedStyleResolver:w,commentIdAllocator:C}){S.useImperativeHandle(t,()=>({getAgent:()=>e.current,getDocument:()=>n,getEditorRef:()=>o.current,save:i,setZoom:s,getZoom:()=>a,focus:()=>{o.current?.focus()},getCurrentPage:()=>c.currentPage,getTotalPages:()=>c.totalPages,scrollToPage:g=>{o.current?.scrollToPage(g)},scrollToPosition:g=>{o.current?.scrollToPosition(g)},openPrintPreview:l,print:l,loadDocument:d,loadDocumentBuffer:u,addComment:g=>{let v=o.current?.getView();if(!v)return null;let k=RU(v,g,C);return k?(h(x=>[...x,k]),p(!0),k.id):null},replyToComment:(g,v,k)=>{if(!f.some(T=>T.id===g))return null;let x=El(C,v,k,g);return h(T=>[...T,x]),x.id},resolveComment:g=>{h(v=>v.map(k=>k.id===g?{...k,done:!0}:k))},proposeChange:g=>{let v=o.current?.getView();if(!v)return!1;let k=PU(v,g,C);return k&&p(!0),k},applyFormatting:g=>{let v=o.current?.getView();return v?$U(v,g):!1},setParagraphStyle:g=>{let v=o.current?.getView();if(!v)return!1;let k=r.current,x=k?.package?.styles?w(k.package.styles):null,T=k?.package?.numbering?Kx(k.package.numbering):null;return IU(v,g,{styleResolver:x,numbering:T})},insertBreak:g=>{let v=o.current?.getView();return v?MU(v,g):!1},getPageContent:g=>TU(o.current?.getView()??null,o.current?.getLayout()??null,g),scrollToParaId:(g,v)=>o.current?.scrollToParaId(g,v)??!1,scrollToCommentId:g=>o.current?.scrollToCommentId(g)??!1,scrollToChangeId:g=>o.current?.scrollToChangeId(g)??!1,highlightRange:(g,v)=>{o.current?.highlightRange(g,v)},findInDocument:(g,v)=>CU(o.current?.getView()??null,g,v),getSelectionInfo:()=>SU(o.current?.getView()??null),getComments:()=>f,getContentControls:g=>{let v=o.current?.getView();return v?nd(v.state.doc,g??{}):[]},scrollToContentControl:g=>{let v=o.current?.getView();if(!v)return!1;let k=CK(v.state.doc,g);return k==null?!1:(o.current?.scrollToPosition(k),!0)},setContentControlContent:(g,v,k)=>{let x=o.current?.getView();if(!x)return!1;try{return x.dispatch(IK(x.state,g,v,k)),!0}catch(T){if(T instanceof Ao)return!1;throw T}},removeContentControl:(g,v)=>{let k=o.current?.getView();if(!k)return!1;try{return k.dispatch(MK(k.state,g,v)),!0}catch(x){if(x instanceof Ao)return!1;throw x}},setContentControlValue:(g,v,k)=>{let x=o.current?.getView();if(!x)return!1;try{return x.dispatch(DS(x.state,g,v,k)),!0}catch(T){if(T instanceof Ao)return!1;throw T}},onContentChange:g=>(m.current.add(g),()=>{m.current.delete(g)}),onSelectionChange:g=>(y.current.add(g),()=>{y.current.delete(g)})}),[n,a,c,i,l,d,u,f])}function NX(t,e,n=!1){let r=t!==void 0,[o,i]=S.useState(n),l=r?t:o,a=S.useRef(l);a.current=l;let s=S.useRef(r);s.current=r;let c=S.useRef(e);c.current=e;let d=S.useCallback(u=>{let f=a.current,h=typeof u=="function"?u(f):u;h!==f&&(s.current||(a.current=h,i(h)),c.current?.(h))},[]);return[l,d]}var $e=t=>({style:"single",size:4,color:{rgb:t}}),LX=[{id:"TableNormal",name:"Normal Table",look:{firstRow:!1,lastRow:!1,noHBand:!0,noVBand:!0}},{id:"TableGrid",name:"Table Grid",tableBorders:{top:$e("000000"),bottom:$e("000000"),left:$e("000000"),right:$e("000000"),insideH:$e("000000"),insideV:$e("000000")},look:{firstRow:!1,lastRow:!1,noHBand:!0,noVBand:!0}},{id:"TableGridLight",name:"Grid Table Light",tableBorders:{top:$e("BFBFBF"),bottom:$e("BFBFBF"),left:$e("BFBFBF"),right:$e("BFBFBF"),insideH:$e("BFBFBF"),insideV:$e("BFBFBF")},look:{firstRow:!0,lastRow:!1,noHBand:!0,noVBand:!0},conditionals:{firstRow:{bold:!0,borders:{bottom:$e("000000")}}}},{id:"PlainTable1",name:"Plain Table 1",tableBorders:{top:$e("BFBFBF"),bottom:$e("BFBFBF"),insideH:$e("BFBFBF")},look:{firstRow:!0,lastRow:!1,noHBand:!0,noVBand:!0},conditionals:{firstRow:{bold:!0}}},{id:"PlainTable2",name:"Plain Table 2",look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,borders:{bottom:$e("7F7F7F")}},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"PlainTable3",name:"Plain Table 3",look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#E7E7E7"}}},{id:"PlainTable4",name:"Plain Table 4",look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#000000"},band1Horz:{backgroundColor:"#F2F2F2"}}},{id:"GridTable1Light-Accent1",name:"Grid Table 1 Light",tableBorders:{top:$e("B4C6E7"),bottom:$e("B4C6E7"),left:$e("B4C6E7"),right:$e("B4C6E7"),insideH:$e("B4C6E7"),insideV:$e("B4C6E7")},look:{firstRow:!0,lastRow:!1,noHBand:!0,noVBand:!0},conditionals:{firstRow:{bold:!0,borders:{bottom:$e("4472C4")}}}},{id:"GridTable4-Accent1",name:"Grid Table 4 Accent 1",tableBorders:{top:$e("4472C4"),bottom:$e("4472C4"),left:$e("4472C4"),right:$e("4472C4"),insideH:$e("4472C4"),insideV:$e("4472C4")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"}}},{id:"GridTable5Dark-Accent1",name:"Grid Table 5 Dark",tableBorders:{top:$e("FFFFFF"),bottom:$e("FFFFFF"),left:$e("FFFFFF"),right:$e("FFFFFF"),insideH:$e("FFFFFF"),insideV:$e("FFFFFF")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#4472C4"},band1Horz:{backgroundColor:"#D6E4F0"},band2Horz:{backgroundColor:"#B4C6E7"}}},{id:"ListTable3-Accent2",name:"List Table 3 Accent 2",tableBorders:{top:$e("ED7D31"),bottom:$e("ED7D31")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#ED7D31"},band1Horz:{backgroundColor:"#FBE4D5"}}},{id:"ListTable4-Accent3",name:"List Table 4 Accent 3",tableBorders:{top:$e("A5A5A5"),bottom:$e("A5A5A5"),insideH:$e("A5A5A5")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#A5A5A5"},band1Horz:{backgroundColor:"#EDEDED"}}},{id:"GridTable4-Accent5",name:"Grid Table 4 Accent 5",tableBorders:{top:$e("5B9BD5"),bottom:$e("5B9BD5"),left:$e("5B9BD5"),right:$e("5B9BD5"),insideH:$e("5B9BD5"),insideV:$e("5B9BD5")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#5B9BD5"},band1Horz:{backgroundColor:"#DEEAF6"}}},{id:"GridTable4-Accent6",name:"Grid Table 4 Accent 6",tableBorders:{top:$e("70AD47"),bottom:$e("70AD47"),left:$e("70AD47"),right:$e("70AD47"),insideH:$e("70AD47"),insideV:$e("70AD47")},look:{firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0},conditionals:{firstRow:{bold:!0,color:"#FFFFFF",backgroundColor:"#70AD47"},band1Horz:{backgroundColor:"#E2EFDA"}}}];function BX(t){return LX.find(e=>e.id===t)}function OX({getActiveEditorView:t,focusActiveEditor:e,tableSelection:n,borderSpecRef:r,historyStateRef:o,getCachedStyleResolver:i}){let[l,a]=S.useState(!1),[s,c]=S.useState({isOpen:!1,initialRows:1,initialCols:2,minRows:1,minCols:1,source:null,capturedCellRow:null,capturedCellCol:null}),d=S.useCallback(()=>{let p=t(),m=p?nZ(p.state):null,y=m?null:n.getSplitCellConfig(),w=m??y;w&&c({isOpen:!0,...w,source:m?"pm":"legacy",capturedCellRow:m?.capturedCellRow??null,capturedCellCol:m?.capturedCellCol??null})},[t,n]),u=S.useCallback(p=>{let m=t();if(!m){p==="splitCell"?d():typeof p!="object"&&n.handleAction(p);return}switch(p){case"addRowAbove":xS(m.state,m.dispatch);break;case"addRowBelow":Rh(m.state,m.dispatch);break;case"addColumnLeft":kS(m.state,m.dispatch);break;case"addColumnRight":Ph(m.state,m.dispatch);break;case"deleteRow":vS(m.state,m.dispatch);break;case"deleteColumn":CS(m.state,m.dispatch);break;case"deleteTable":Eh(m.state,m.dispatch);break;case"selectTable":SS(m.state,m.dispatch);break;case"selectRow":iZ(m.state,m.dispatch);break;case"selectColumn":lZ(m.state,m.dispatch);break;case"mergeCells":TS(m.state,m.dispatch);break;case"splitCell":d();break;case"borderAll":sZ(m.state,m.dispatch,r.current);break;case"borderOutside":cZ(m.state,m.dispatch,r.current);break;case"borderInside":dZ(m.state,m.dispatch,r.current);break;case"borderNone":aZ(m.state,m.dispatch);break;case"borderTop":ol("top",r.current,!0)(m.state,m.dispatch);break;case"borderBottom":ol("bottom",r.current,!0)(m.state,m.dispatch);break;case"borderLeft":ol("left",r.current,!0)(m.state,m.dispatch);break;case"borderRight":ol("right",r.current,!0)(m.state,m.dispatch);break;default:if(typeof p=="object"){if(p.type==="cellFillColor")vZ(p.color)(m.state,m.dispatch);else if(p.type==="borderColor"){let y=p.color.replace(/^#/,"");r.current={...r.current,color:{rgb:y}},kZ(p.color)(m.state,m.dispatch)}else if(p.type==="borderWidth")r.current={...r.current,size:p.size},CZ(p.size)(m.state,m.dispatch);else if(p.type==="cellBorder")ol(p.side,{style:p.style,size:p.size,color:{rgb:p.color.replace(/^#/,"")}})(m.state,m.dispatch);else if(p.type==="cellVerticalAlign")uZ(p.align)(m.state,m.dispatch);else if(p.type==="cellMargins")fZ(p.margins)(m.state,m.dispatch);else if(p.type==="cellTextDirection")pZ(p.direction)(m.state,m.dispatch);else if(p.type==="toggleNoWrap")hZ()(m.state,m.dispatch);else if(p.type==="rowHeight")mZ(p.height,p.rule)(m.state,m.dispatch);else if(p.type==="toggleHeaderRow")gZ()(m.state,m.dispatch);else if(p.type==="distributeColumns")yZ()(m.state,m.dispatch);else if(p.type==="autoFitContents")bZ()(m.state,m.dispatch);else if(p.type==="openTableProperties")a(!0);else if(p.type==="applyTableStyle"){let y=BX(p.styleId),w=o.current;if(!y&&w?.package.styles){let C=i(w.package.styles).getStyle(p.styleId);if(C){if(y={id:C.styleId,name:C.name??C.styleId},C.tblPr?.borders){let g=C.tblPr.borders;y.tableBorders={};for(let v of["top","bottom","left","right","insideH","insideV"]){let k=g[v];k&&(y.tableBorders[v]={style:k.style,size:k.size,color:k.color?.rgb?{rgb:k.color.rgb}:void 0})}}if(C.tblStylePr){y.conditionals={};for(let g of C.tblStylePr){let v={};if(g.tcPr?.shading?.fill&&(v.backgroundColor=`#${g.tcPr.shading.fill}`),g.tcPr?.borders){let k={};for(let x of["top","bottom","left","right"]){let T=g.tcPr.borders[x];T&&(k[x]={style:T.style,size:T.size,color:T.color?.rgb?{rgb:T.color.rgb}:void 0})}v.borders=k}g.rPr?.bold&&(v.bold=!0),g.rPr?.color?.rgb&&(v.color=`#${g.rPr.color.rgb}`),y.conditionals[g.type]=v}}y.look={firstRow:!0,lastRow:!1,noHBand:!1,noVBand:!0}}}y&&xZ({styleId:y.id,tableBorders:y.tableBorders,conditionals:y.conditionals,look:y.look})(m.state,m.dispatch)}}else n.handleAction(p)}e()},[n,t,e,d,r,o,i]),f=S.useCallback(()=>{c(p=>({...p,isOpen:!1,source:null,capturedCellRow:null,capturedCellCol:null}))},[]),h=S.useCallback((p,m)=>{if(s.source==="legacy"){n.applySplitCell(p,m),e();return}let y=t();y&&(rZ(y.state,y.dispatch,p,m,s.capturedCellRow??void 0,s.capturedCellCol??void 0),e())},[e,t,s.source,s.capturedCellRow,s.capturedCellCol,n]);return{tablePropsOpen:l,setTablePropsOpen:a,splitCellDialogState:s,openSplitCellDialog:d,handleTableAction:u,handleSplitCellDialogClose:f,handleSplitCellDialogApply:h}}function jX({document:t,pushDocument:e,hfEditorRef:n,containerRef:r,initialSectionProperties:o,finalSectionProperties:i,hfEditPosition:l,setHfEditPosition:a,hfEditIsFirstPage:s,setHfEditIsFirstPage:c}){let{headerContent:d,footerContent:u,firstPageHeaderContent:f,firstPageFooterContent:h}=S.useMemo(()=>{let{header:g,footer:v,firstHeader:k,firstFooter:x}=lH(t??null,i??o);return{headerContent:g,footerContent:v,firstPageHeaderContent:k,firstPageFooterContent:x}},[t,o,i]),p=S.useCallback((g,v)=>{let k=t?.package?.document?.finalSectionProperties?.titlePg===!0&&(v??1)===1,x=k?g==="header"?f:h:g==="header"?d:u;if(c(k),x){a(g);return}if(!t?.package)return;let T=t.package,$=T.document?.finalSectionProperties;if(!$)return;let M=k?"first":"default",I=`rId_new_${g}_${M}`,F={type:g==="header"?"header":"footer",hdrFtrType:M,content:[{type:"paragraph",content:[]}]},E=g==="header"?"headers":"footers",R=new Map(T[E]??[]);R.set(I,F);let N=g==="header"?"headerReferences":"footerReferences",B=$[N]??[],j={type:M,rId:I},O=T.relationships,z=new Set;for(let se of O?.values()??[])se.target&&z.add(se.target);let W=1;for(;z.has(`${g}${W}.xml`);)W++;let q=g==="header"?"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header":"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",Q=new Map(O);Q.set(I,{id:I,type:q,target:`${g}${W}.xml`});let X={...t,package:{...T,[E]:R,relationships:Q,document:T.document?{...T.document,finalSectionProperties:{...$,[N]:[...B,j]}}:T.document}};e(X),a(g)},[d,u,f,h,t,e,a,c]),m=S.useCallback(g=>{if(!l||!t?.package){a(null);return}let v=t.package,k=v.document?.finalSectionProperties,x=l==="header"?k?.headerReferences:k?.footerReferences,T=s?"first":"default",$=x?.find(F=>F.type===T)??x?.find(F=>F.type==="default")??x?.find(F=>F.type==="first")??x?.[0],M=l==="header"?"headers":"footers",I=v[M];if($?.rId&&I){let F=I.get($.rId),E={type:l,hdrFtrType:$.type,...F,content:g},R=new Map(I);R.set($.rId,E);let N={...t,package:{...v,[M]:R}};e(N)}a(null)},[l,s,t,e,a]),y=S.useCallback(()=>{if(!l)return;let g=n.current?.getView();if(g){let v=Mh(g.state.doc);m(v)}else a(null)},[l,m,n,a]),w=S.useCallback(()=>{if(!l||!t?.package){a(null);return}let g=t.package,v=g.document?.finalSectionProperties,k=l==="header"?"headerReferences":"footerReferences",x=l==="header"?"headers":"footers",T=v?.[k],$=s?"first":"default",M=T?.find(I=>I.type===$)??T?.find(I=>I.type==="default")??T?.find(I=>I.type==="first")??T?.[0];if(M?.rId){let I=new Map(g[x]??[]);I.delete(M.rId);let F=(T??[]).filter(R=>R.rId!==M.rId),E={...t,package:{...g,[x]:I,document:g.document?{...g.document,finalSectionProperties:{...v,[k]:F}}:g.document}};e(E)}a(null)},[l,s,t,e,a]),C=S.useCallback(g=>{let v=r.current?.querySelector(".paged-editor__pages");if(!v)return null;let k=g==="header"?".layout-page-header":".layout-page-footer";return v.querySelector(k)},[r]);return{headerContent:d,footerContent:u,firstPageHeaderContent:f,firstPageFooterContent:h,handleHeaderFooterDoubleClick:p,handleHeaderFooterSave:m,handleBodyClick:y,handleRemoveHeaderFooter:w,getHfTargetElement:C}}function zX({documentBuffer:t,initialDocument:e,externalContent:n,history:r,agentRef:o,pagedEditorRef:i,setLoadingState:l,setComments:a,setShowCommentsSidebar:s,onError:c,resetForNewDocument:d,commentsLoadedRef:u,commentIdAllocator:f,setDocumentFonts:h}){let p=S.useRef(0),m=S.useCallback(w=>{d(),r.reset(w),l({isLoading:!1,parseError:null}),oI(w).catch(C=>{console.warn("Failed to load document fonts:",C)}),h(UI(w,{embeddedFamilies:aI(w.package?.fontTable)}))},[d,r,l,h]),y=S.useCallback(async w=>{let C=++p.current;d(),l({isLoading:!0,parseError:null});try{let g=await Af(w);if(p.current!==C)return;m(g)}catch(g){if(p.current!==C)return;let v=g instanceof Error?g.message:"Failed to parse document";l({isLoading:!1,parseError:v}),c?.(g instanceof Error?g:new Error(v))}},[d,m,c,l]);return S.useEffect(()=>{if(!n){if(!t){e&&m(e);return}y(t)}},[t,e,n]),S.useEffect(()=>{r.state?o.current=new yq(r.state):o.current=null},[r.state,o]),S.useEffect(()=>{if(u.current)return;let w=r.state;if(!w)return;u.current=!0;let C=w.package?.document?.comments;C&&C.length>0&&(a(C),s(!0)),FU(f,C,i.current?.getView()??null)},[r.state,i,a,s,u,f]),{loadParsedDocument:m,loadBuffer:y}}var HX={inline:"wrap_text",squareLeft:"format_image_left",squareRight:"format_image_right",behind:"flip_to_back",inFront:"flip_to_front"},il=18,_X=({isOpen:t,position:e,currentWrapType:n,currentCssFloat:r,onApplyLayout:o,textActions:i,onTextAction:l,onOpenProperties:a,onClose:s})=>{let{t:c}=Re(),d=S.useRef(null),[u,f]=S.useState(0),h=S.useMemo(()=>HK(n,r),[n,r]),p=S.useMemo(()=>gu.filter(g=>_K()),[n]),m=S.useMemo(()=>(i??[]).filter(g=>!g.disabled),[i]),y=a?1:0,w=y+p.length+m.length;S.useEffect(()=>{if(!t)return;let g=k=>{d.current&&!d.current.contains(k.target)&&s()},v=setTimeout(()=>{document.addEventListener("mousedown",g)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",g)}},[t,s]),S.useEffect(()=>{if(!t)return;let g=v=>{if(v.key==="Escape"){v.preventDefault(),s();return}let k=Math.max(1,w);if(v.key==="ArrowDown")v.preventDefault(),f(x=>(x+1)%k);else if(v.key==="ArrowUp")v.preventDefault(),f(x=>(x-1+k)%k);else if(v.key==="Enter"){if(v.preventDefault(),y&&u===0)a?.(),s();else if(u<y+p.length)o(p[u-y].choice),s();else if(l){let x=m[u-y-p.length];x&&(l(x.action),s())}}};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t,u,p,m,w,y,o,a,l,s]),S.useEffect(()=>{if(!t)return;let g=h?p.findIndex(v=>v.choice===h):-1;f(g>=0?y+g:0)},[t,h,p,y]);let C=S.useCallback(()=>{let g=gu.length,v=i?.length??0,k=g*36+v*32+(v>0?9:0)+16,x=e.x,T=e.y;return typeof window<"u"&&(x+260>window.innerWidth&&(x=window.innerWidth-260-10),T+k>window.innerHeight&&(T=window.innerHeight-k-10),x<10&&(x=10),T<10&&(T=10)),{position:"fixed",top:T,left:x,minWidth:260,background:"var(--doc-surface)",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px var(--doc-shadow)",zIndex:ro.contextMenu,padding:"4px 0",overflow:"hidden"}},[e,i]);return t?b.jsxs("div",{ref:d,className:"docx-image-context-menu",style:C(),role:"menu","aria-label":c("imageWrap.menu.ariaLabel"),"data-testid":"image-context-menu",children:[a&&b.jsxs(b.Fragment,{children:[b.jsxs("button",{type:"button",role:"menuitem","data-action":"open-properties",onClick:()=>{a(),s()},onMouseEnter:()=>f(0),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:u===0?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[b.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)",width:il},children:b.jsx(we,{name:"settings",size:il})}),b.jsx("span",{style:{flex:1},children:c("imageWrap.menu.imageProperties")})]}),b.jsx("div",{style:{height:1,background:"var(--doc-border-light)",margin:"4px 0"},role:"separator"})]}),gu.map(g=>{let v=g.choice===h,k=y+p.findIndex($=>$.choice===g.choice),x=k>=0&&k===u,T=c(`imageWrap.menuDesc.${g.i18nDescKey}`);return b.jsxs("button",{type:"button",role:"menuitem","data-wrap-type":g.choice,"data-current":v?"true":"false","data-disabled":"false",disabled:!1,onClick:()=>{o(g.choice),s()},onMouseEnter:()=>{k>=0&&f(k)},title:T,style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 12px",border:"none",background:x?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left",opacity:1},children:[b.jsx("span",{style:{display:"flex",color:v?"var(--doc-primary)":"var(--doc-text-muted)",width:il},children:b.jsx(we,{name:HX[g.iconHint],size:il})}),b.jsx("span",{style:{flex:1},children:c(`imageWrap.menu.${g.i18nLabelKey}`)}),v&&b.jsx("span",{style:{fontSize:"11px",color:"var(--doc-primary)"},"aria-label":c("toolbar.imageWrap.current"),children:"●"})]},g.choice)}),i&&i.length>0&&b.jsxs(b.Fragment,{children:[b.jsx("div",{style:{height:1,background:"var(--doc-border-light)",margin:"4px 0"},role:"separator"}),i.map((g,v)=>{let k=g.disabled?-1:y+p.length+m.findIndex(T=>T.action===g.action),x=k===u&&!g.disabled;return b.jsxs(ae.Fragment,{children:[b.jsxs("button",{type:"button",role:"menuitem","data-action":g.action,"data-disabled":g.disabled?"true":"false",disabled:g.disabled,onClick:()=>{g.disabled||!l||(l(g.action),s())},onMouseEnter:()=>{k>=0&&f(k)},style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"7px 12px",border:"none",background:x?"var(--doc-primary-light)":"transparent",cursor:g.disabled?"not-allowed":"pointer",fontSize:"13px",color:g.disabled?"var(--doc-text-placeholder)":"var(--doc-text)",textAlign:"left",opacity:g.disabled?.55:1},children:[b.jsx("span",{style:{width:il},"aria-hidden":"true"}),b.jsx("span",{style:{flex:1},children:g.label}),g.shortcut&&b.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-muted)",fontFamily:"monospace"},children:g.shortcut})]}),g.dividerAfter&&b.jsx("div",{style:{height:1,background:"var(--doc-border-light)",margin:"4px 0"},role:"separator"})]},`${g.action}-${v}`)})]})]}):null};function WX(){let[t,e]=S.useState(!1),[n,r]=S.useState({x:0,y:0}),[o,i]=S.useState("inline"),[l,a]=S.useState(null),[s,c]=S.useState(null),[d,u]=S.useState(null),f=S.useCallback(p=>{r({x:p.x,y:p.y}),i(p.wrapType),a(p.cssFloat??null),c(p.pos),u(p.inlinePositionEmu??null),e(!0)},[]),h=S.useCallback(()=>{e(!1),c(null),u(null)},[]);return{isOpen:t,position:n,currentWrapType:o,currentCssFloat:l,imagePos:s,inlinePositionEmu:d,openForImage:f,closeMenu:h}}function _S(t,e,n){if(!t||!e)return null;let r=t.querySelector(".paged-editor__pages");if(!r)return null;for(let o of Yk(r)){let i=Number(o.dataset.pmStart),l=Number(o.dataset.pmEnd);if(n>=i&&n<=l)return o.getBoundingClientRect().top-e.getBoundingClientRect().top}return null}function VX(t){let e=t?.package?.document;return e?.sections?.[0]?.properties??e?.finalSectionProperties}function qX({getActiveEditorView:t,focusActiveEditor:e,openSplitCellDialog:n,scrollContainerRef:r,editorContentRef:o,i18n:i,onAddComment:l}){let{t:a}=Re(),[s,c]=S.useState({isOpen:!1,position:{x:0,y:0},hasSelection:!1,cursorInTable:!1,tableContext:null}),d=WX(),u=S.useCallback(C=>{let g=C.target;if(g?.closest(".paged-editor__pages")&&!g.closest(".hf-inline-editor"))return;C.preventDefault(),C.stopPropagation();let v=t(),k=v?Ge(v.state):{isInTable:!1},{from:x,to:T}=v?.state.selection??{from:0,to:0},$=x!==T;c({isOpen:!0,position:{x:C.clientX,y:C.clientY},hasSelection:$,cursorInTable:k.isInTable,tableContext:k.isInTable?k:null})},[t]),f=S.useCallback(C=>{if(C.image){d.openForImage({x:C.x,y:C.y,wrapType:C.image.wrapType,cssFloat:C.image.cssFloat,pos:C.image.pos,inlinePositionEmu:C.image.inlinePositionEmu});return}let g=t(),v=g?Ge(g.state):{isInTable:!1};c({isOpen:!0,position:C,hasSelection:C.hasSelection,cursorInTable:v.isInTable,tableContext:v.isInTable?v:null})},[t,d]),h=S.useCallback(C=>{let g=t();if(!g||d.imagePos===null)return;let v=d.inlinePositionEmu?{initialPositionEmu:d.inlinePositionEmu}:void 0;$S(d.imagePos,C,v)(g.state,g.dispatch)},[t,d.imagePos,d.inlinePositionEmu]),p=S.useMemo(()=>[{action:"cut",label:a("contextMenu.cut"),shortcut:Kn(a("contextMenu.cutShortcut"))},{action:"copy",label:a("contextMenu.copy"),shortcut:Kn(a("contextMenu.copyShortcut"))},{action:"paste",label:a("contextMenu.paste"),shortcut:Kn(a("contextMenu.pasteShortcut")),dividerAfter:!0},{action:"delete",label:a("contextMenu.delete"),shortcut:Kn(a("contextMenu.deleteShortcut"))}],[a]),m=S.useCallback(()=>{c({isOpen:!1,position:{x:0,y:0},hasSelection:!1,cursorInTable:!1,tableContext:null})},[]),y=S.useMemo(()=>{let C=[{action:"cut",label:a("contextMenu.cut"),shortcut:Kn(a("contextMenu.cutShortcut"))},{action:"copy",label:a("contextMenu.copy"),shortcut:Kn(a("contextMenu.copyShortcut"))},{action:"paste",label:a("contextMenu.paste"),shortcut:Kn(a("contextMenu.pasteShortcut"))},{action:"pasteAsPlainText",label:a("contextMenu.pastePlainText"),shortcut:Kn(a("contextMenu.pastePlainTextShortcut")),dividerAfter:!0},{action:"delete",label:a("contextMenu.delete"),shortcut:Kn(a("contextMenu.deleteShortcut")),dividerAfter:!s.hasSelection&&!s.cursorInTable}];return s.hasSelection&&C.push({action:"addComment",label:"Comment",dividerAfter:!s.cursorInTable}),s.cursorInTable&&C.push({action:"addRowAbove",label:"Insert row above"},{action:"addRowBelow",label:"Insert row below"},{action:"deleteRow",label:"Delete row",dividerAfter:!0},{action:"addColumnLeft",label:"Insert column left"},{action:"addColumnRight",label:"Insert column right"},{action:"deleteColumn",label:"Delete column"},{action:"mergeCells",label:i?.table?.mergeCells??gi.table.mergeCells,disabled:!s.tableContext?.hasMultiCellSelection},{action:"splitCell",label:i?.table?.splitCell??gi.table.splitCell,disabled:!s.tableContext?.canSplitCell,dividerAfter:!0},{action:"selectTable",label:i?.table?.selectTable??gi.table.selectTable},{action:"deleteTable",label:i?.table?.deleteTable??gi.table.deleteTable,dividerAfter:!0}),C.push({action:"selectAll",label:a("contextMenu.selectAll"),shortcut:Kn(a("contextMenu.selectAllShortcut"))}),C},[s.hasSelection,s.cursorInTable,s.tableContext,i,a]),w=S.useCallback(async C=>{let g=t();if(g)switch(e(),C){case"cut":document.execCommand("cut");break;case"copy":document.execCommand("copy");break;case"paste":{try{let v=await navigator.clipboard.read(),k="",x="";for(let M of v)M.types.includes("text/html")&&(k=await(await M.getType("text/html")).text()),M.types.includes("text/plain")&&(x=await(await M.getType("text/plain")).text());let T=new DataTransfer;k&&T.items.add(k,"text/html"),x&&T.items.add(x,"text/plain");let $=new ClipboardEvent("paste",{clipboardData:T,bubbles:!0,cancelable:!0});g.dom.dispatchEvent($)}catch{try{let v=await navigator.clipboard.readText();v&&g.dispatch(g.state.tr.insertText(v))}catch{}}break}case"pasteAsPlainText":try{let v=await navigator.clipboard.readText();v&&g.dispatch(g.state.tr.insertText(v))}catch{}break;case"delete":{let{from:v,to:k}=g.state.selection;v!==k&&g.dispatch(g.state.tr.deleteRange(v,k));break}case"selectAll":g.dispatch(g.state.tr.setSelection(ye.create(g.state.doc,0,g.state.doc.content.size)));break;case"addRowAbove":xS(g.state,g.dispatch);break;case"addRowBelow":Rh(g.state,g.dispatch);break;case"deleteRow":vS(g.state,g.dispatch);break;case"addColumnLeft":kS(g.state,g.dispatch);break;case"addColumnRight":Ph(g.state,g.dispatch);break;case"deleteColumn":CS(g.state,g.dispatch);break;case"mergeCells":TS(g.state,g.dispatch);break;case"splitCell":n();break;case"selectTable":SS(g.state,g.dispatch);break;case"deleteTable":Eh(g.state,g.dispatch);break;case"addComment":{let{from:v,to:k}=g.state.selection;if(v===k)break;let x=_S(r.current,o.current,v),T=g.state.schema.marks.comment.create({commentId:Yl}),$=g.state.tr.addMark(v,k,T);$.setSelection(ye.create($.doc,k)),g.dispatch($),l({from:v,to:k,yPos:x});break}}},[t,e,n,r,o,l]);return{contextMenu:s,imageContextMenu:d,handleEditorContextMenu:u,handleContextMenu:f,handleContextMenuClose:m,handleImageWrapApply:h,imageContextMenuTextActions:p,contextMenuItems:y,handleContextMenuAction:w}}function ZX({commentsProp:t,onCommentDelete:e,onCommentsChange:n,pagedEditorRef:r}){let[o,i]=S.useState([]),l=t!==void 0,a=l?t:o,[s,c]=S.useState(!1),[d,u]=S.useState(null),[f,h]=S.useState(null),[p,m]=S.useState(null),y=S.useRef(null),w=S.useRef(a);w.current=a;let C=S.useRef(s);C.current=s;let g=S.useRef(e);g.current=e;let v=S.useRef(n);v.current=n;let k=S.useCallback(T=>{let $=typeof T=="function"?T(w.current):T;$!==w.current&&(l||(w.current=$,i($)),v.current?.($))},[l]),x=S.useCallback(()=>{if(C.current)return;let T=r.current?.getView();if(!T)return;let{doc:$,schema:M}=T.state,I=M.marks.comment;if(!I)return;let F=new Set;$.descendants(N=>{for(let B of N.marks)if(B.type===I){let j=B.attrs.commentId;j!==Yl&&F.add(j)}});let E=w.current,R=new Set;for(let N of E)N.parentId==null&&!F.has(N.id)&&R.add(N.id);if(R.size!==0){for(let N of E)R.has(N.id)&&g.current?.(N);k(N=>N.filter(B=>!R.has(B.id)&&!R.has(B.parentId)))}},[r,k]);return S.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),{comments:a,setComments:k,isAddingComment:s,setIsAddingComment:c,isAddingCommentRef:C,commentSelectionRange:d,setCommentSelectionRange:u,addCommentYPosition:f,setAddCommentYPosition:h,floatingCommentBtn:p,setFloatingCommentBtn:m,cleanOrphanedCommentsTimerRef:y,cleanOrphanedComments:x}}function KX({commentToRevision:t,setComments:e,pmState:n,isLoading:r,trackedChangesCount:o,setShowCommentsSidebar:i,trackedChangesLoadedRef:l}){S.useEffect(()=>{t.size!==0&&e(a=>{let s=!1,c=a.map(d=>{if(d.parentId!=null)return d;let u=t.get(d.id);return u!=null?(s=!0,{...d,parentId:u}):d});return s?c:a})},[t,e]),S.useEffect(()=>{l.current||r||!n||(l.current=!0,o>0&&i(!0))},[n,r,o,i,l])}function UX({getActiveEditorView:t,lastSelectionRef:e,borderSpecRef:n,theme:r,historyStateRef:o,getCachedStyleResolver:i,setFloatingCommentBtn:l,applySelectionDelta:a,recomputeFloatingCommentBtn:s,onSelectionChange:c,selectionChangeSubscribersRef:d}){return{handleSelectionChange:S.useCallback(u=>{let f=t();if(f){let{from:$,to:M}=f.state.selection;e.current={from:$,to:M}}let h=null;if(f&&(h=Ge(f.state),h.isInTable||(h=null)),h?.cellBorderColor){let $=No(h.cellBorderColor,r??void 0);$&&(n.current={...n.current,color:{rgb:$}})}let p=null;if(f){let $=f.state.selection,M=$.node;M?.type.name==="image"&&(p={pos:$.from,wrapType:M.attrs.wrapType??"inline",displayMode:M.attrs.displayMode??"inline",cssFloat:M.attrs.cssFloat??null,transform:M.attrs.transform??null,alt:M.attrs.alt??null,borderWidth:M.attrs.borderWidth??null,borderColor:M.attrs.borderColor??null,borderStyle:M.attrs.borderStyle??null,width:M.attrs.width??null,height:M.attrs.height??null})}if(!u){l(null),a({selectionFormatting:{},pmTableContext:h,pmImageContext:p});return}let{textFormatting:m,paragraphFormatting:y}=u,w=m.fontFamily?.ascii||m.fontFamily?.hAnsi,C=m.fontSize;if(!w||!C){let $=o.current,M=u.styleId;if($?.package.styles&&M){let I=i($.package.styles).resolveParagraphStyle(M);!w&&I.runFormatting?.fontFamily&&(w=I.runFormatting.fontFamily.ascii||I.runFormatting.fontFamily.hAnsi),!C&&I.runFormatting?.fontSize&&(C=I.runFormatting.fontSize)}}let g=No(m.color,r??void 0),v=g?`#${g}`:void 0,k=y.numPr,x=k?{type:k.numId===1?"bullet":"numbered",level:k.ilvl??0,isInList:!0,numId:k.numId}:void 0,T={bold:m.bold,italic:m.italic,underline:!!m.underline,strike:m.strike,superscript:m.vertAlign==="superscript",subscript:m.vertAlign==="subscript",fontFamily:w,fontSize:C,color:v,highlight:m.highlight,alignment:y.alignment,lineSpacing:y.lineSpacing,listState:x,styleId:u.styleId??void 0,indentLeft:y.indentLeft,bidi:!!y.bidi};a({selectionFormatting:T,paragraphIndentLeft:y.indentLeft??0,paragraphIndentRight:y.indentRight??0,paragraphFirstLineIndent:y.indentFirstLine??0,paragraphHangingIndent:y.hangingIndent??!1,paragraphTabs:y.tabs??null,pmTableContext:h,pmImageContext:p}),s(),c?.(u);for(let $ of d.current)try{$(u)}catch(M){console.error("selectionChange subscriber threw:",M)}},[t,e,n,r,o,i,l,a,s,c,d])}}function XX({pagedEditorRef:t,scrollContainerRef:e,editorContentRef:n,isAddingCommentRef:r,setFloatingCommentBtn:o,readOnly:i,isLoading:l,zoom:a}){let s=S.useRef(!1);s.current=i;let c=S.useCallback(()=>{let d=t.current?.getView();if(!d)return;if(r.current||s.current){o(null);return}let{from:u,to:f}=d.state.selection;if(u===f){o(null);return}let h=e.current,p=n.current;if(!h||!p)return;let m=_S(h,p,u);if(m==null)return;let y=h.querySelector(".paged-editor__pages")?.querySelector(".layout-page"),w=y?y.getBoundingClientRect().right-p.getBoundingClientRect().left:p.getBoundingClientRect().width/2+408;o({top:m,left:w})},[t,e,n,r,o]);return S.useEffect(()=>{let d=e.current;if(!d)return;let u=new ResizeObserver(()=>c());u.observe(d);let f=()=>c();return window.addEventListener("resize",f),()=>{u.disconnect(),window.removeEventListener("resize",f)}},[l,c,e]),S.useEffect(()=>{c()},[a,c]),{recomputeFloatingCommentBtn:c}}function GX({hfEditPosition:t,hfEditorRef:e,pagedEditorRef:n}){let r=S.useCallback(()=>t&&e.current?e.current.getView():n.current?.getView(),[t,e,n]),o=S.useCallback(()=>{t&&e.current?e.current.focus():n.current?.focus()},[t,e,n]),i=S.useCallback(()=>{t&&e.current?e.current.undo():n.current?.undo()},[t,e,n]),l=S.useCallback(()=>{t&&e.current?e.current.redo():n.current?.redo()},[t,e,n]);return{getActiveEditorView:r,focusActiveEditor:o,undoActiveEditor:i,redoActiveEditor:l}}function YX({scrollContainerRef:t,pagedEditorRef:e}){let[n,r]=S.useState({currentPage:1,totalPages:1,visible:!1}),o=S.useRef(null),i=t.current;return S.useEffect(()=>{if(!i)return;let l=()=>{let a=e.current?.getLayout();if(!a||a.pages.length===0)return;let s=i.scrollTop,c=a.pages.length,d=24,u=24,f=s+i.clientHeight/2,h=u,p=1;for(let m=0;m<a.pages.length;m++){let y=a.pages[m].size.h,w=h+y;if(f<w){p=m+1;break}h=w+d,p=m+2}p=Math.min(p,c),r({currentPage:p,totalPages:c,visible:!0}),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{r(m=>({...m,visible:!1}))},600)};return i.addEventListener("scroll",l,{passive:!0}),()=>{i.removeEventListener("scroll",l),o.current&&clearTimeout(o.current)}},[i,e]),{scrollPageInfo:n,setScrollPageInfo:r}}function JX({contextMenu:t,contextMenuItems:e,onContextMenuAction:n,onContextMenuClose:r,imageContextMenu:o,onImageWrapApply:i,imageContextMenuTextActions:l,onOpenImageProperties:a,readOnly:s}){return b.jsxs(b.Fragment,{children:[b.jsx(dA,{isOpen:t.isOpen,position:t.position,hasSelection:t.hasSelection,isEditable:!s,items:e,onAction:n,onClose:r}),b.jsx(_X,{isOpen:o.isOpen,position:o.position,currentWrapType:o.currentWrapType,currentCssFloat:o.currentCssFloat,onApplyLayout:i,textActions:l,onTextAction:n,onOpenProperties:a,onClose:o.closeMenu}),b.jsx(xU,{position:"bottom-right"})]})}var QX=S.lazy(()=>Vn(()=>import("./FindReplaceDialog-KU5TEIBJ-CQ76sPaJ.js"),__vite__mapDeps([6,2,1,0,3,4]))),eG=S.lazy(()=>Vn(()=>Promise.resolve().then(()=>FJ),void 0)),tG=S.lazy(()=>Vn(()=>import("./TablePropertiesDialog-TMLKGOOW-12vmjb6B.js"),__vite__mapDeps([7,2,1,0,3,4])).then(t=>({default:t.TablePropertiesDialog}))),nG=S.lazy(()=>Vn(()=>import("./SplitCellDialog-IFBKYCD6-Cb9uQOB8.js"),__vite__mapDeps([8,2,1,0,3,4]))),rG=S.lazy(()=>Vn(()=>import("./ImagePositionDialog-HEWYR6Q3-CFzOnzAt.js"),__vite__mapDeps([9,2,1,0,3,4])).then(t=>({default:t.ImagePositionDialog}))),oG=S.lazy(()=>Vn(()=>import("./ImagePropertiesDialog-RAB47C6M-D-ThGU-b.js"),__vite__mapDeps([10,2,1,0,3,4])).then(t=>({default:t.ImagePropertiesDialog}))),iG=S.lazy(()=>Vn(()=>import("./FootnotePropertiesDialog-W3YHM4BV-BpgYQvvd.js"),__vite__mapDeps([11,2,1,0,3,4])).then(t=>({default:t.FootnotePropertiesDialog}))),lG=S.lazy(()=>Vn(()=>import("./PageSetupDialog-AIGIXO3E-_PYIO8eb.js"),__vite__mapDeps([12,2,1,0,3,4])).then(t=>({default:t.PageSetupDialog}))),aG=S.lazy(()=>Vn(()=>import("./WatermarkDialog-KRL7WMIS-C-d8rzt2.js"),__vite__mapDeps([13,2,1,0,3,4])).then(t=>({default:t.WatermarkDialog})));function sG({findReplace:t,findResultRef:e,onFind:n,onFindNext:r,onFindPrevious:o,onReplace:i,onReplaceAll:l,hyperlinkDialog:a,onHyperlinkSubmit:s,onHyperlinkRemove:c,tablePropsOpen:d,onTablePropsClose:u,pmTableContext:f,getActiveEditorView:h,splitCellDialogState:p,onSplitCellDialogClose:m,onSplitCellDialogApply:y,imagePositionOpen:w,onImagePositionClose:C,onApplyImagePosition:g,imagePropsOpen:v,onImagePropsClose:k,onApplyImageProperties:x,pmImageContext:T,showPageSetup:$,onPageSetupClose:M,onPageSetupApply:I,showWatermark:F,onWatermarkClose:E,onWatermarkApply:R,currentWatermark:N,watermarkPresets:B,document:j,footnotePropsOpen:O,onFootnotePropsClose:z,onApplyFootnoteProperties:W}){return b.jsxs(S.Suspense,{fallback:null,children:[t.state.isOpen&&b.jsx(QX,{isOpen:t.state.isOpen,onClose:t.close,onFind:n,onFindNext:r,onFindPrevious:o,onReplace:i,onReplaceAll:l,initialSearchText:t.state.searchText,replaceMode:t.state.replaceMode,currentResult:e.current}),a.state.isOpen&&b.jsx(eG,{isOpen:a.state.isOpen,onClose:a.close,onSubmit:s,onRemove:a.state.isEditing?c:void 0,initialData:a.state.initialData,selectedText:a.state.selectedText,isEditing:a.state.isEditing}),d&&b.jsx(tG,{isOpen:d,onClose:u,onApply:q=>{let Q=h();Q&&wZ(q)(Q.state,Q.dispatch)},currentProps:f?.table?.attrs}),p.isOpen&&b.jsx(nG,{isOpen:p.isOpen,onClose:m,onApply:y,initialRows:p.initialRows,initialCols:p.initialCols,minRows:p.minRows,minCols:p.minCols}),w&&b.jsx(rG,{isOpen:w,onClose:C,onApply:g}),v&&b.jsx(oG,{isOpen:v,onClose:k,onApply:x,currentData:T?{alt:T.alt??void 0,borderWidth:T.borderWidth??void 0,borderColor:T.borderColor??void 0,borderStyle:T.borderStyle??void 0,width:T.width??void 0,height:T.height??void 0}:void 0}),$&&b.jsx(lG,{isOpen:$,onClose:M,onApply:I,currentProps:j?.package.document?.finalSectionProperties}),F&&b.jsx(aG,{isOpen:F,onClose:E,onApply:R,current:N,presets:B}),O&&b.jsx(iG,{isOpen:O,onClose:z,onApply:W,footnotePr:j?.package.document?.finalSectionProperties?.footnotePr,endnotePr:j?.package.document?.finalSectionProperties?.endnotePr})]})}function cG({active:t,onClick:e}){let{t:n}=Re(),r=n("editor.toggleCommentsSidebar");return b.jsx(mn,{onClick:e,active:t,title:r,ariaLabel:r,children:b.jsx(we,{name:"comment",size:20})})}var lb=[{value:"editing",labelKey:"editor.editing",icon:"edit_note",descKey:"editor.editingDescription"},{value:"suggesting",labelKey:"editor.suggesting",icon:"rate_review",descKey:"editor.suggestingDescription"},{value:"viewing",labelKey:"editor.viewing",icon:"visibility",descKey:"editor.viewingDescription"}];function dG({mode:t,onModeChange:e}){let{t:n}=Re(),[r,o]=S.useState(!1),[i,l]=S.useState(!1),a=S.useRef(null),s=S.useRef(null),[c,d]=S.useState({top:0,left:0}),u=lb.find(f=>f.value===t);return S.useEffect(()=>{let f=window.matchMedia("(max-width: 1400px)");l(f.matches);let h=p=>l(p.matches);return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[]),S.useEffect(()=>{if(!r||!a.current)return;let f=a.current.getBoundingClientRect();d({top:f.bottom+2,left:f.right-220})},[r]),S.useEffect(()=>{if(!r)return;let f=p=>{!a.current?.contains(p.target)&&!s.current?.contains(p.target)&&o(!1)},h=p=>{p.key==="Escape"&&o(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",h)}},[r]),b.jsxs("div",{style:{position:"relative"},children:[b.jsxs("button",{ref:a,type:"button",onMouseDown:f=>f.preventDefault(),onClick:()=>o(!r),title:`${n(u.labelKey)} (Ctrl+Shift+E)`,style:{display:"flex",alignItems:"center",gap:i?0:4,padding:i?"2px 4px":"2px 6px 2px 4px",border:"none",background:r?"var(--doc-bg-hover)":"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28},children:[b.jsx(we,{name:u.icon,size:18}),!i&&b.jsx("span",{children:n(u.labelKey)}),b.jsx(we,{name:"arrow_drop_down",size:16})]}),r&&b.jsx("div",{ref:s,onMouseDown:f=>f.preventDefault(),style:{position:"fixed",top:c.top,left:c.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:220},children:lb.map(f=>b.jsxs("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:()=>{e(f.value),o(!1)},onMouseOver:h=>{h.currentTarget.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:h=>{h.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)",width:"100%",textAlign:"left"},children:[b.jsx(we,{name:f.icon,size:20}),b.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[b.jsx("span",{style:{fontWeight:500},children:n(f.labelKey)}),b.jsx("span",{style:{fontSize:11,color:"var(--doc-text-muted)"},children:n(f.descKey)})]}),f.value===t&&b.jsx(we,{name:"check",size:18,style:{marginLeft:"auto",color:"var(--doc-primary)"}})]},f.value))})]})}function uG({active:t,onClick:e,badge:n}){let{t:r}=Re(),o=r("agentPanel.toggle");return b.jsx(mn,{onClick:e,active:t,title:o,ariaLabel:o,children:b.jsxs("span",{style:{position:"relative",display:"inline-flex"},children:[b.jsx(we,{name:"agent-sparkle",size:20}),n!=null&&b.jsx("span",{"data-testid":"agent-panel-toggle-badge",style:{position:"absolute",top:-4,right:-6,display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:14,height:14,padding:"0 3px",borderRadius:7,fontSize:10,fontWeight:600,background:"var(--doc-error)",color:"var(--doc-on-primary)",lineHeight:1},children:n})]})})}function fG({toolbarRefCallback:t,agentPanelOpen:e,setAgentPanelOpen:n,document:r,theme:o,pmState:i,selectionFormatting:l,tableContext:a,imageContext:s,readOnly:c,editingMode:d,setEditingMode:u,setShowCommentsSidebar:f,setExpandedSidebarItem:h,showCommentsSidebar:p,agentPanel:m,renderLogo:y,documentName:w,onDocumentNameChange:C,documentNameEditable:g,renderTitleBarRight:v,toolbarExtra:k,fontFamilies:x,documentFonts:T,zoom:$,showZoomControl:M,onFormat:I,onUndo:F,onRedo:E,onPrint:R,showFileOpen:N,showHelpMenu:B,onOpen:j,onSave:O,onZoomChange:z,onRefocusEditor:W,onInsertTable:q,onInsertImage:Q,onInsertPageBreak:X,onInsertSectionBreakNextPage:se,onInsertSectionBreakContinuous:ie,onInsertTOC:ce,onImageWrapType:Y,onImageTransform:V,onOpenImageProperties:Z,onPageSetup:K,onWatermark:ee,onTableAction:G}){return b.jsx("div",{ref:t,className:"z-50 flex flex-col gap-0 flex-shrink-0",children:b.jsxs(yn,{className:e?"rounded-br-2xl":void 0,style:{transition:"border-radius 220ms cubic-bezier(0.4, 0, 0.2, 1)"},currentFormatting:l,onFormat:I,onUndo:F,onRedo:E,canUndo:i?S3(i)>0:!1,canRedo:i?T3(i)>0:!1,disabled:c,documentStyles:r?.package.styles?.styles,theme:r?.package.theme||o,fontFamilies:x,documentFonts:T,onPrint:R,onOpen:N?j:void 0,onSave:O,showZoomControl:M,zoom:$,onZoomChange:z,onRefocusEditor:W,onInsertTable:q,showTableInsert:!0,showHelpMenu:B,onInsertImage:Q,onInsertPageBreak:X,onInsertSectionBreakNextPage:se,onInsertSectionBreakContinuous:ie,onInsertTOC:ce,imageContext:s,onImageWrapType:Y,onImageTransform:V,onOpenImageProperties:Z,onPageSetup:K,onWatermark:ee,tableContext:a,onTableAction:G,children:[b.jsxs(yn.TitleBar,{children:[y&&b.jsx(yn.Logo,{children:y()}),w!==void 0&&b.jsx(yn.DocumentName,{value:w,onChange:C,editable:g}),v&&b.jsx(yn.TitleBarRight,{children:v()}),b.jsx(yn.MenuBar,{})]}),b.jsxs(yn.Toolbar,{children:[b.jsx(zd,{}),b.jsx(cG,{active:p,onClick:()=>{f(te=>!te),h(null)}}),b.jsx(zd,{}),b.jsx(dG,{mode:d,onModeChange:te=>{u(te),te==="suggesting"&&f(!0)}}),m&&m.showToolbarButton!==!1&&b.jsxs(b.Fragment,{children:[b.jsx(zd,{}),b.jsx(uG,{active:e,badge:m.toolbarBadge,onClick:()=>n(!e)})]}),k]})]})})}function pG(t,e,n){let r=t.parentElement?.querySelector('[data-testid="selection-overlay"]');if(!r)return null;let o=r.getBoundingClientRect(),i=u7(t,e,o,n);return i?{x:i.x/n,y:i.y/n,height:i.height,pageIndex:i.pageIndex}:null}function hG(t,e,n,r,o){return d7(t,n,r,e).map(i=>({x:i.x/o,y:i.y/o,width:i.width/o,height:i.height/o,pageIndex:i.pageIndex}))}var mG={position:"fixed",left:"-9999px",top:"0",opacity:0,zIndex:-1,pointerEvents:"none",userSelect:"none",overflowAnchor:"none"};function ab(t,e,n,r=[]){let o=n?.getSchema()??Ce,i=e??t?.package?.styles,l=t?Fz(t,{styles:i}):Dz(),a=Gv(i),s=Yv({theme:t?.package?.theme??null,defaultTableStyleId:t?.package?.settings?.defaultTableStyle??null}),c=[...r,...n?.getPlugins()??[],a,s];return lj(ko.create({doc:l,schema:o,plugins:c}))}function gG(t,e){return e?Y9(t.doc,e):null}var yG=S.forwardRef(function(t,e){let{document:n,styles:r,theme:o,widthPx:i=612,readOnly:l=!1,onTransaction:a,onSelectionChange:s,externalPlugins:c=[],extensionManager:d,onEditorViewReady:u,onEditorViewDestroy:f,onKeyDown:h}=t,p=S.useRef(null),m=S.useRef(null),y=S.useRef(n),w=S.useRef(!1),C=S.useRef(null),g=S.useRef(!1),v=S.useRef(a),k=S.useRef(s),x=S.useRef(u),T=S.useRef(f),$=S.useRef(h),M=S.useRef(l);v.current=a,k.current=s,x.current=u,T.current=f,$.current=h,M.current=l,y.current=n;let I=j=>{if(!j)return"empty";let O=j.package?.properties;return`${O?.created||""}-${O?.modified||""}-${O?.title||""}`},F=S.useCallback(()=>{if(!p.current||w.current)return;let j={state:ab(n,r,d,c),editable:()=>!M.current,attributes:{style:"overflow-anchor: none"},dispatchTransaction(z){if(w.current)return;m.current||(m.current=this),BU(z,this.state.tr);let W=this.state.apply(z);this.updateState(W),v.current?.(z,W),(z.selectionSet||z.docChanged)&&k.current?.(W)},handleKeyDown:(z,W)=>$.current?.(z,W)??!1,handleScrollToSelection:()=>!0,handleDOMEvents:{focus:()=>!1,blur:()=>!1}};m.current=new Kp(p.current,j);let O=m.current.dom;O.style.overflowAnchor="none",g.current=!0,C.current=I(n),x.current?.(m.current)},[n,r,c,d,l]),E=S.useCallback(()=>{m.current&&!w.current&&(w.current=!0,T.current?.(),m.current.destroy(),m.current=null,w.current=!1)},[]);S.useEffect(()=>(F(),()=>E()),[]),S.useEffect(()=>{if(!m.current||w.current)return;let j=I(n);if(g.current&&j===C.current)return;g.current=!0,C.current=j;let O=ab(n,r,d,c);m.current.updateState(O),k.current?.(O)},[n,r,d,c]),S.useEffect(()=>{m.current},[l]),S.useImperativeHandle(e,()=>({getState(){return m.current?.state??null},getView(){return m.current??null},getDocument(){return m.current?gG(m.current.state,y.current):null},focus(){m.current?.focus()},blur(){m.current?.hasFocus()&&m.current.dom.blur()},isFocused(){return m.current?.hasFocus()??!1},dispatch(j){m.current&&!w.current&&m.current.dispatch(j)},executeCommand(j){return m.current?j(m.current.state,m.current.dispatch,m.current):!1},undo(){return m.current?Ai(m.current.state,m.current.dispatch):!1},redo(){return m.current?Fo(m.current.state,m.current.dispatch):!1},canUndo(){return m.current?Ai(m.current.state):!1},canRedo(){return m.current?Fo(m.current.state):!1},setSelection(j,O){if(!m.current)return;let{state:z,dispatch:W}=m.current,q=z.doc.resolve(j),Q=O!==void 0?z.doc.resolve(O):q,X=ye.between(q,Q);W(z.tr.setSelection(X))},setNodeSelection(j){if(!m.current)return;let{state:O,dispatch:z}=m.current;try{let W=Ie.create(O.doc,j);z(O.tr.setSelection(W))}catch{this.setSelection(j)}},setCellSelection(j,O){if(!m.current)return;let{state:z,dispatch:W}=m.current;try{let q=Ve.create(z.doc,j,O);W(z.tr.setSelection(q))}catch{this.setSelection(j,O)}},scrollToSelection(){}}),[]);let R=b.jsx("div",{ref:p,className:"paged-editor__hidden-pm",style:{...mG,width:i>0?`${i}px`:void 0}}),N=globalThis.document,B=N&&"body"in N&&N.body!=null?N.body:null;return B?Ql.createPortal(R,B):R}),bG=S.memo(yG);function wG(t,e,n,r,o,i,l,a){let s=lh(t.content,{styles:e??void 0,theme:n??null,defaultTabStopTwips:r??null}),c=Gv(e),d=Yv({theme:n??null,defaultTableStyleId:o??null}),u=ES(l,a);return ko.create({doc:s,schema:Ce,plugins:[u,...i.getPlugins(),c,d]})}function xG(t){if(!t?.package)return[];let e=[],n=t.package.headers;if(n)for(let o of n.keys())e.push({rId:o,kind:"header"});let r=t.package.footers;if(r)for(let o of r.keys())(!n||!n.has(o))&&e.push({rId:o,kind:"footer"});return e}var WS=S.memo(S.forwardRef(function({document:t,styles:e,theme:n,isSuggesting:r=!1,author:o="User",defaultTabStopTwips:i,onTransaction:l},a){let s=S.useRef(l);s.current=l;let c=t?.package?.settings?.defaultTableStyle??null,d=S.useRef(r);d.current=r;let u=S.useRef(o);u.current=o,S.useEffect(()=>{for(let{view:g}of m.current.values())PS(r,g.state,g.dispatch,o)},[r,o]);let f=S.useRef(t);f.current=t;let h=S.useRef(null),p=S.useRef(null),m=S.useRef(new Map),y=S.useRef(new Map);h.current=(g,v,k)=>{let x=f.current?.package;if(!x)return;let T=(v==="header"?x.headers:x.footers)?.get(g);T&&(T.content=Mh(k.doc))};let w=S.useCallback((g,v)=>{let k=t?.package;return k?(v==="header"?k.headers:k.footers)?.get(g)??null:null},[t]),C=S.useMemo(()=>xG(t),[t?.package?.headers,t?.package?.footers]);return S.useEffect(()=>{if(!p.current)return;let g=p.current,v=new Map(C.map(x=>[x.rId,x])),k=m.current;for(let[x,T]of k)v.has(x)||(T.view.destroy(),T.mountNode.remove(),y.current.get(x)?.destroy(),y.current.delete(x),k.delete(x));for(let x of C){if(k.has(x.rId))continue;let T=w(x.rId,x.kind);if(!T)continue;let $=new Qp(Jp());$.buildSchema(),$.initializeRuntime(),y.current.set(x.rId,$);let M=g.ownerDocument.createElement("div");M.dataset.hfRId=x.rId,M.dataset.hfKind=x.kind,g.appendChild(M);let I=wG(T,e,n,i,c,$,d.current,u.current),F=x.rId,E=x.kind,R=new Kp(M,{state:I,dispatchTransaction(N){let B=R.state.apply(N);R.updateState(B),N.docChanged&&h.current?.(F,E,B),s.current?.(F,R,N.docChanged)}});k.set(x.rId,{rId:x.rId,kind:x.kind,view:R,mountNode:M})}},[C,w,e,n,i,c]),S.useEffect(()=>{let g=m.current,v=y.current;return()=>{for(let{view:k,mountNode:x}of g.values())k.destroy(),x.remove();g.clear();for(let k of v.values())k.destroy();v.clear()}},[]),S.useImperativeHandle(a,()=>({getView(g){return m.current.get(g)?.view??null},getViews(){let g=new Map;for(let[v,k]of m.current)g.set(v,k.view);return g}}),[]),b.jsx("div",{ref:p,style:{position:"fixed",left:-9999,top:0,opacity:0,zIndex:-1,pointerEvents:"none"}})}));WS.displayName="HiddenHeaderFooterPMs";var vG="var(--doc-caret, #000)",kG="rgba(66, 133, 244, 0.3)",CG=2,SG=530,TG={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:10,overflow:"hidden"},$G=(t,e,n,r)=>({position:"absolute",left:t.x,top:t.y,width:n,height:t.height,backgroundColor:e,opacity:r?1:0,transition:"opacity 0.05s ease-out",pointerEvents:"none"}),IG=(t,e)=>({position:"absolute",left:t.x,top:t.y,width:t.width,height:t.height,backgroundColor:e,pointerEvents:"none"}),MG=({position:t,color:e,width:n,blinkInterval:r,isFocused:o})=>{let[i,l]=S.useState(o),a=S.useRef(null);return S.useEffect(()=>(a.current&&(window.clearInterval(a.current),a.current=null),o&&r>0?(l(!0),a.current=window.setInterval(()=>{l(s=>!s)},r)):l(!1),()=>{a.current&&window.clearInterval(a.current)}),[o,r]),S.useEffect(()=>{if(o)return l(!0),a.current&&window.clearInterval(a.current),r>0&&(a.current=window.setInterval(()=>{l(s=>!s)},r)),()=>{a.current&&window.clearInterval(a.current)}},[t.x,t.y,o,r]),b.jsx("div",{style:$G(t,e,n,i),"data-testid":"caret"})},RG=({rect:t,color:e,index:n})=>b.jsx("div",{style:IG(t,e),"data-testid":`selection-rect-${n}`,"data-page-index":t.pageIndex}),PG=({selectionRects:t,caretPosition:e,isFocused:n,readOnly:r=!1,caretColor:o=vG,selectionColor:i=kG,caretWidth:l=CG,blinkInterval:a=SG})=>{if(r)return null;let s=t.length>0,c=e!==null&&!s;return b.jsxs("div",{style:TG,"data-testid":"selection-overlay",children:[s&&t.map((d,u)=>b.jsx(RG,{rect:d,color:i,index:u},`sel-${d.pageIndex}-${d.x}-${d.y}-${u}`)),c&&e&&b.jsx(MG,{position:e,color:o,width:l,blinkInterval:a,isFocused:n})]})},_f=10,sb=_f/2,kl=2,VS="#2563eb",cb={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",zIndex:15,overflow:"visible"},EG={position:"absolute",border:`${kl}px solid ${VS}`,pointerEvents:"none",boxSizing:"border-box"},FG={position:"absolute",width:`${_f}px`,height:`${_f}px`,backgroundColor:"#ffffff",border:`1.5px solid ${VS}`,borderRadius:"50%",boxShadow:"0 1px 2.5px rgba(0, 0, 0, 0.35)",boxSizing:"border-box",pointerEvents:"auto",zIndex:16},AG={position:"absolute",backgroundColor:"rgba(0, 0, 0, 0.75)",color:"var(--doc-on-primary)",fontSize:"11px",fontFamily:"system-ui, sans-serif",padding:"2px 8px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:20,transform:"translateX(-50%)"},DG={nw:"nw-resize",ne:"ne-resize",se:"se-resize",sw:"sw-resize",n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize"},NG=[{pos:"nw",x:0,y:0},{pos:"ne",x:1,y:0},{pos:"se",x:1,y:1},{pos:"sw",x:0,y:1},{pos:"n",x:.5,y:0},{pos:"s",x:.5,y:1},{pos:"e",x:1,y:.5},{pos:"w",x:0,y:.5}];function LG({imageInfo:t,zoom:e,isFocused:n,onResize:r,onResizeStart:o,onResizeEnd:i,onDragMove:l,onDragStart:a,onDragEnd:s,onContextMenu:c}){let[d,u]=S.useState(!1),[f,h]=S.useState(!1),[p,m]=S.useState(0),[y,w]=S.useState(0),[C,g]=S.useState(null),v=S.useRef(null),k=S.useRef(null),x=S.useRef(r),T=S.useRef(o),$=S.useRef(i),M=S.useRef(l),I=S.useRef(a),F=S.useRef(s);x.current=r,T.current=o,$.current=i,M.current=l,I.current=a,F.current=s;let E=S.useRef(t),R=S.useRef(e);E.current=t,R.current=e;let N=S.useCallback(()=>{if(!t||!k.current){g(null);return}let Q=k.current.offsetParent;if(!Q){g(null);return}let X=Q.getBoundingClientRect(),se=t.element.getBoundingClientRect();g({left:(se.left-X.left)/e,top:(se.top-X.top)/e,width:se.width/e,height:se.height/e})},[t,e]);S.useEffect(()=>{N()},[N]),S.useEffect(()=>{if(!t)return;let Q=k.current?.closest('[style*="overflow"]')??k.current?.closest(".paged-editor__container");if(!Q)return;let X=()=>{v.current&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(N)};return Q.addEventListener("scroll",X,{passive:!0}),window.addEventListener("resize",X,{passive:!0}),()=>{Q.removeEventListener("scroll",X),window.removeEventListener("resize",X),v.current&&cancelAnimationFrame(v.current)}},[t,N]);let B=S.useCallback((Q,X)=>{if(!t||!C)return;X.preventDefault(),X.stopPropagation();let se=C.width,ie=C.height,ce=X.clientX,Y=X.clientY,V=Math.round(se),Z=Math.round(ie);u(!0),m(V),w(Z),T.current?.();let K=G=>{let te=R.current,A=(G.clientX-ce)/te,P=(G.clientY-Y)/te,_=!G.shiftKey,H=OU(Q,A,P,se,ie,_);V=Math.round(H.width),Z=Math.round(H.height),m(V),w(Z),g(le=>{if(!le)return le;let ue={...le};return Q.includes("w")&&(ue.left=le.left+(le.width-H.width)),Q.includes("n")&&(ue.top=le.top+(le.height-H.height)),ue.width=H.width,ue.height=H.height,ue})},ee=()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",ee),u(!1);let G=E.current;G&&x.current?.(G.pmPos,V,Z),$.current?.()};window.addEventListener("mousemove",K),window.addEventListener("mouseup",ee)},[t,C]),j=S.useCallback(Q=>{if(!t||!C)return;Q.preventDefault(),Q.stopPropagation();let X=4,se=Q.clientX,ie=Q.clientY,ce=!1,Y=null,V=K=>{let ee=K.clientX-se,G=K.clientY-ie;!ce&&Math.sqrt(ee*ee+G*G)<X||(ce||(ce=!0,h(!0),I.current?.(),Y=document.createElement("div"),Y.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);",Y.style.width=`${C.width}px`,Y.style.height=`${C.height}px`,document.body.appendChild(Y)),Y&&(Y.style.left=`${K.clientX-C.width/2}px`,Y.style.top=`${K.clientY-C.height/2}px`))},Z=K=>{if(window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",Z),Y&&(Y.remove(),Y=null),h(!1),ce){let ee=E.current;ee&&M.current?.(ee.pmPos,K.clientX,K.clientY),F.current?.()}};window.addEventListener("mousemove",V),window.addEventListener("mouseup",Z)},[t,C]);if(!(t&&C&&n))return b.jsx("div",{ref:k,style:{...cb,visibility:"hidden"},className:"image-selection-overlay"});let{left:O,top:z,width:W,height:q}=C;return b.jsxs("div",{ref:k,style:cb,className:"image-selection-overlay",children:[b.jsx("div",{style:{...EG,left:O-kl,top:z-kl,width:W+kl*2,height:q+kl*2}}),b.jsx("div",{style:{position:"absolute",left:O,top:z,width:W,height:q,cursor:f?"grabbing":"grab",pointerEvents:"auto",zIndex:15},onMouseDown:j,onContextMenu:c}),NG.map(({pos:Q,x:X,y:se})=>b.jsx(BG,{handle:Q,style:{left:O+W*X-sb,top:z+q*se-sb},onMouseDown:B},Q)),d&&b.jsxs("div",{style:{...AG,left:O+W/2,top:z+q+12},children:[p," × ",y]})]})}function BG({handle:t,style:e,onMouseDown:n}){return b.jsx("div",{style:{...FG,...e,cursor:DG[t]},onMouseDown:r=>n(t,r),"data-handle":t})}var OG={position:"absolute",inset:0,pointerEvents:"none",zIndex:11};function jG({getView:t,getPagesContainer:e,zoom:n,decorationSyncToken:r,syncCoordinator:o}){let i=S.useRef(null),l=S.useRef(null),[a,s]=S.useState(0);return S.useEffect(()=>o.onRender(()=>s(c=>c+1)),[o]),S.useEffect(()=>(l.current!==null&&cancelAnimationFrame(l.current),l.current=requestAnimationFrame(()=>{l.current=null;let c=t(),d=e(),u=i.current;!c||!d||!u||o.isSafeToRender()&&zG(c,d,u,n)}),()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)}),[n,r,a]),b.jsx("div",{ref:i,className:"paged-editor__decoration-overlay",style:OG,"aria-hidden":"true"})}function zG(t,e,n,r){let o=HG(t.state);if(o.length===0){n.firstChild&&n.replaceChildren();return}let i=nS(e,r),l=i.getContainerOffset(),a=document.createDocumentFragment();for(let{decoration:s,from:c,to:d}of o){if(c===d){let h=_G(s,t);if(!h)continue;let p=i.getCoordinatesForPosition(c);if(!p)continue;let m=document.createElement("div");m.style.cssText=`position:absolute;left:${p.x+l.x}px;top:${p.y+l.y}px;height:${p.height}px;`,m.appendChild(h),a.appendChild(m);continue}let u=WG(s);if(!u)continue;let f=i.getRectsForRange(c,d);for(let h of f){let p=document.createElement("div");for(let[y,w]of Object.entries(u))y!=="nodeName"&&p.setAttribute(y,w);let m=`position:absolute;left:${h.x+l.x}px;top:${h.y+l.y}px;width:${h.width}px;height:${h.height}px;`;p.style.cssText=m+(u.style??""),a.appendChild(p)}}n.replaceChildren(a)}function HG(t){let e=[];for(let n of t.plugins){let r=n.props.decorations;if(!r)continue;let o=r.call(n,t);o&&o.forEachSet(i=>{i.find().forEach(l=>{l.spec?.noOverlay||e.push({decoration:l,from:l.from,to:l.to})})})}return e}function _G(t,e){let n=t.type;if(!n)return null;let r=n.toDOM;return typeof r=="function"?r(e,()=>t.from):r instanceof HTMLElement?r.cloneNode(!0):null}function WG(t){return t.type?.attrs??null}var VG=[],qG={position:"relative",width:"100%",minHeight:"100%",overflow:"visible",backgroundColor:"var(--doc-bg)"},ZG={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:24,paddingBottom:24,overflowAnchor:"none"},KG={position:"relative",display:"flex",flexDirection:"column",alignItems:"center",overflowAnchor:"none"},UG={position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none",overflow:"visible",zIndex:8};function ku(t,e,n){let r=e.getBoundingClientRect(),o=t.getBoundingClientRect(),i=o.top+o.height/2,l=r.top+r.height/2,a=i-l,s=Math.max(0,e.scrollHeight-e.clientHeight),c=Math.max(0,Math.min(s,e.scrollTop+a));e.scrollTop=c}function Cu(t,e){if(e.aborted)return;let n=requestAnimationFrame(()=>{if(e.aborted)return;let r=requestAnimationFrame(()=>{if(e.aborted)return;let o=requestAnimationFrame(()=>{e.aborted||t()});e.addEventListener("abort",()=>cancelAnimationFrame(o),{once:!0})});e.addEventListener("abort",()=>cancelAnimationFrame(r),{once:!0})});e.addEventListener("abort",()=>cancelAnimationFrame(n),{once:!0})}function XG(t,e){let n=null,r=Yk(t);for(let o=0;o<r.length;o++){let i=r[o].dataset.pmStart;if(i==null)continue;let l=Number(i);Number.isNaN(l)||l<=e&&(n===null||l>n)&&(n=l)}return n}function qS(t,e){let n=t.pages.length;return t.pages.reduce((r,o)=>r+o.size.h,0)+Math.max(0,n-1)*e+24+24}function GG(t,e,n,r,o){let i=new Map;if(!t?.state)return i;let{doc:l,schema:a}=t.state,s=a.marks.comment,c=a.marks.insertion,d=a.marks.deletion;if(!s&&!c&&!d)return i;let u=new Set,f=24+o,h=0,p=(m,y)=>{if(u.has(m))return;u.add(m);let w=Qs(e,n,r,y,h);if(w){h=w.pageIndex,i.set(m,w.y+f);return}for(let C=h;C<e.pages.length;C++){let g=e.pages[C];for(let v of g.fragments){let k=v.pmStart??0,x=v.pmEnd??k;if(y<k||y>x)continue;let T=v.kind==="table"?YG(n,r,v,y):0;h=C,i.set(m,v.y+T+ah(e,C)+f);return}}};return l.descendants((m,y)=>{let w=m.attrs;if(w){let C=[w.trIns,w.trDel,w.pPrIns,w.pPrDel];for(let k of C){let x=k?.revisionId;typeof x=="number"&&p(`revision-${x}`,y)}let g=w.cellMarker?.info?.revisionId;typeof g=="number"&&p(`revision-${g}`,y);let v=[w.pPrChange,w.trPrChange,w.tcPrChange,w.tblPrChange];for(let k of v)if(Array.isArray(k))for(let x of k){let T=x?.info?.id;typeof T=="number"&&p(`revision-${T}`,y)}}if(m.isInline)for(let C of m.marks){let g=null;s&&C.type===s?g=`comment-${C.attrs.commentId}`:(c&&C.type===c||d&&C.type===d)&&(g=`revision-${C.attrs.revisionId}`),g&&p(g,y)}}),i}function YG(t,e,n,r){let o=t.findIndex(s=>s.id===n.blockId);if(o===-1)return 0;let i=t[o],l=e[o];if(i.kind!=="table"||l.kind!=="table")return 0;let a=0;for(let s=n.fromRow;s<n.toRow;s++){let c=i.rows[s];if(!c||c.cells.some(d=>d.blocks.some(u=>{let f=u.pmStart??0,h=u.pmEnd??f;return r>=f&&r<=h})))break;a+=l.rows[s]?.height??0}return a}function ZS(t,e,n,r){switch(t.kind){case"paragraph":{let o=t;if(!n||n.length===0){let l=RH(o,e);if(l)return l}let i=_s(o,e,{floatingZones:n,paragraphYOffset:r??0});return(!n||n.length===0)&&PH(o,e,i),i}case"table":return zk(t,e,ZS);case"image":{let o=t;return{kind:"image",width:o.width??100,height:o.height??100}}case"textBox":{let o=t,i=o.margins??wi,l=(o.width??Vu)-i.left-i.right,a=o.content.map(d=>_s(d,l)),s=a.reduce((d,u)=>d+u.totalHeight,0),c=o.height??s+i.top+i.bottom;return{kind:"textBox",width:o.width??Vu,height:c,innerMeasures:a}}case"pageBreak":return{kind:"pageBreak"};case"columnBreak":return{kind:"columnBreak"};case"sectionBreak":return{kind:"sectionBreak"};default:gp(t,"react PagedEditor measureBlock")}}function JG(t,e,n){return gH(t,e,ZS,n)}function QG(t,e,n){e.style.overflowAnchor||e.style.setProperty("overflow-anchor","none");let r=Math.max(1,e.scrollHeight-e.clientHeight),o=e.scrollTop/r,i=XG(t,n),l=0;if(i!=null){let a=Gc(t,i);if(a){let s=a.getBoundingClientRect(),c=e.getBoundingClientRect();l=s.top-c.top}else i=null}return{scrollRestoreRatioPre:o,domAnchorPmStart:i,domAnchorOffsetInScroller:l}}function eY(t,e,n){let r=n.scrollRestoreRatioPre;if(t==="incremental"){let i=Math.max(1,e.scrollHeight-e.clientHeight);r=e.scrollTop/i}let o=t==="incremental"?e.scrollTop:null;return{renderKind:t,ratio:r,scrollTopSnapshot:o,domAnchorPmStart:n.domAnchorPmStart,domAnchorOffsetInScroller:n.domAnchorOffsetInScroller}}function db(t,e,n){let{renderKind:r,ratio:o,scrollTopSnapshot:i,domAnchorPmStart:l,domAnchorOffsetInScroller:a}=t;if(r==="incremental"&&i!=null){let c=Math.max(1,n.scrollHeight-n.clientHeight);n.scrollTop=Math.min(Math.max(0,i),c);return}if(r!=="incremental"&&l!=null){let c=Gc(e,l);if(c){let d=n.getBoundingClientRect(),u=c.getBoundingClientRect().top-d.top;n.scrollTop+=a-u;return}}let s=Math.max(1,n.scrollHeight-n.clientHeight);n.scrollTop=o*s}function tY(t,e,n,r){if(t?.renderKind!=="incremental"||t.scrollTopSnapshot==null||r&&n>32||!e?.isConnected)return;let o=Math.max(1,e.scrollHeight-e.clientHeight),i=Math.min(Math.max(0,t.scrollTopSnapshot),o);Math.abs(e.scrollTop-i)>.5&&(e.scrollTop=i)}function nY(t){let{document:e,styles:n,theme:r,sectionProperties:o,finalSectionProperties:i,headerContent:l,footerContent:a,firstPageHeaderContent:s,firstPageFooterContent:c,getHfPmDoc:d,pageGap:u,zoom:f,resolvedCommentIds:h,pagesContainerRef:p,viewportLayoutRef:m,hiddenPMRef:y,syncCoordinator:w,getScrollContainer:C,onTotalPagesChange:g,onAnchorPositionsChange:v,onRenderedDomContextReady:k}=t,[x,T]=S.useState(null),[$,M]=S.useState([]),[I,F]=S.useState([]),[E,R]=S.useState(0),N=S.useCallback(()=>R(_=>_+1),[]),B=S.useRef(g),j=S.useRef(v),O=S.useRef(k),z=S.useRef(d);B.current=g,j.current=v,O.current=k,z.current=d;let W=S.useRef(0);S.useEffect(()=>{let _=x?.pages.length??0;_!==W.current&&(W.current=_,B.current?.(_))},[x]);let q=S.useMemo(()=>K0(o),[o]),Q=S.useMemo(()=>U0(o),[o]),X=S.useMemo(()=>X0(o),[o]),{finalPageSize:se,finalMargins:ie,finalColumns:ce}=S.useMemo(()=>{let _=i??o;return{finalPageSize:K0(_),finalMargins:U0(_),finalColumns:X0(_)}},[i,o]),Y=q.w-Q.left-Q.right,V=S.useMemo(()=>new qK({pageGap:u,showShadow:!0,pageBackground:"var(--doc-page-bg, #ffffff)"}),[u]),Z=S.useRef(null);Z.current=V;let K=S.useRef(null),ee=S.useRef(0),G=S.useCallback(_=>{let H=performance.now(),le=w.getStateSeq();w.onLayoutStart();let ue=ve=>{let Pe=p.current,be=Pe?C()??Ss(Pe):null,pe=performance.now()-ee.current;tY(K.current,be,pe,ve)};ue(!0);try{let{blocks:ve,measures:Pe,layout:be,headerContentForRender:pe,footerContentForRender:Fe,firstPageHeaderForRender:Ae,firstPageFooterForRender:yt,hasTitlePg:Me,watermark:Ue,headerDistancePx:Lt,footerDistancePx:Sn,pageBorders:vt,footnotesByPage:Tt}=DU({state:_,document:e,pageSize:q,margins:Q,columns:X,finalPageSize:se,finalMargins:ie,finalColumns:ce,pageGap:u,contentWidth:Y,theme:r,styles:n,sectionProperties:o,finalSectionProperties:i,headerContent:l,footerContent:a,firstPageHeaderContent:s,firstPageFooterContent:c,measureBlocks:JG,getHfPmDoc:Se=>z.current?.(Se)??null});if(M(ve),F(Pe),T(be),p.current&&Z.current){K.current=null,ee.current=0;let Se=p.current,De=C()??Ss(Se),et=De?.isConnected?QG(Se,De,_.selection.head):null,qe=VK(ve,Pe);Z.current.setBlockLookup(qe);let ct=__(be.pages,p.current,{pageGap:u,showShadow:!0,pageBackground:"var(--doc-page-bg, #ffffff)",blockLookup:qe,headerContent:pe,footerContent:Fe,firstPageHeaderContent:Ae,firstPageFooterContent:yt,titlePg:Me,headerDistance:Lt,footerDistance:Sn,pageBorders:vt,theme:r,watermark:Ue,footnotesByPage:Tt,resolvedCommentIds:h}),tt=m.current;if(tt){let ot=qS(be,u);tt.style.minHeight=`${ot}px`,f!==1?tt.style.marginBottom=`${ot*(f-1)}px`:tt.style.marginBottom=""}if(De?.isConnected&&et){let ot=eY(ct,De,et);K.current=ot,ot.renderKind==="incremental"&&ot.scrollTopSnapshot!=null&&(ee.current=performance.now())}if(p.current?.dispatchEvent(new CustomEvent("painter:painted",{bubbles:!0})),O.current){let ot=nS(p.current,f);O.current(ot)}}else K.current=null,ee.current=0;if(j.current){let Se=GG(y.current?.getView()??null,be,ve,Pe,u),De=p.current;if(De){let et=De.querySelectorAll(".layout-page-header, .layout-page-footer");if(et.length>0){let qe=De.getBoundingClientRect(),ct=f||1;for(let tt=0;tt<et.length;tt++){let ot=et[tt],Ne=ot.querySelectorAll(".docx-insertion[data-revision-id]");for(let lt=0;lt<Ne.length;lt++){let Pt=Ne[lt],me=Pt.getAttribute("data-revision-id");if(me&&!Se.has(`revision-${me}`)){let ze=(Pt.getBoundingClientRect().top-qe.top+De.scrollTop)/ct;Se.set(`revision-${me}`,ze)}}let mt=ot.querySelectorAll(".docx-deletion[data-revision-id]");for(let lt=0;lt<mt.length;lt++){let Pt=mt[lt],me=Pt.getAttribute("data-revision-id");if(me&&!Se.has(`revision-${me}`)){let ze=(Pt.getBoundingClientRect().top-qe.top+De.scrollTop)/ct;Se.set(`revision-${me}`,ze)}}let $t=ot.querySelectorAll("[data-comment-id]");for(let lt=0;lt<$t.length;lt++){let Pt=$t[lt],me=Pt.getAttribute("data-comment-id");if(me&&!Se.has(`comment-${me}`)){let ze=(Pt.getBoundingClientRect().top-qe.top+De.scrollTop)/ct;Se.set(`comment-${me}`,ze)}}let lr=ot.querySelectorAll(".ep-revision-table[data-revision-id], .ep-revision-row[data-revision-id], .ep-revision-cell[data-revision-id], .layout-revision-pmark[data-revision-id]");for(let lt=0;lt<lr.length;lt++){let Pt=lr[lt],me=Pt.getAttribute("data-revision-id");if(me&&!Se.has(`revision-${me}`)){let ze=(Pt.getBoundingClientRect().top-qe.top+De.scrollTop)/ct;Se.set(`revision-${me}`,ze)}}}}}j.current(Se)}ue(!1);let Ee=performance.now()-H;Ee>2e3&&console.warn(`[PagedEditor] Layout pipeline took ${Math.round(Ee)}ms total (${ve.length} blocks, ${Pe.length} measures)`)}catch(ve){console.error("[PagedEditor] Layout pipeline error:",ve)}w.onLayoutComplete(le),ue(!1)},[Y,X,q,Q,se,ie,ce,u,f,w,l,a,s,c,o,i,e,h,C,y,p,n,r,m]);S.useLayoutEffect(()=>{let _=K.current;if(!_)return;K.current=null,ee.current=0;let H=p.current,le=C()??(H?Ss(H):null);if(!H||!le?.isConnected)return;db(_,H,le);let ue=requestAnimationFrame(()=>{le.isConnected&&db(_,H,le)});return()=>cancelAnimationFrame(ue)},[x,C,p]);let te=S.useRef(G);te.current=G;let A=S.useRef(null);A.current||(A.current=NU(_=>te.current(_)));let P=S.useCallback(_=>{A.current.schedule(_)},[]);return S.useEffect(()=>{let _=A.current;return()=>_?.cancel()},[]),{layout:x,blocks:$,measures:I,decorationSyncToken:E,notifyDecorationLayer:N,contentWidth:Y,runLayoutPipeline:G,scheduleLayout:P}}function rY(t){let{layout:e,blocks:n,measures:r,zoom:o,containerRef:i,pagesContainerRef:l,hiddenPMRef:a,syncCoordinator:s,isImageInteractingRef:c,onSelectionChangeRef:d}=t,[u,f]=S.useState([]),[h,p]=S.useState(null),[m,y]=S.useState(null),w=S.useRef(null),C=S.useCallback((k,x)=>{let T=k.tagName==="IMG"?k:k.querySelector("img"),$=(T??k).getBoundingClientRect();return{element:T??k,pmPos:x,width:Math.round($.width/o),height:Math.round($.height/o)}},[o]),g=S.useCallback(k=>{let{from:x,to:T}=k.selection;w.current!==k&&(w.current=k,d.current?.(x,T));let $=l.current;if($&&(Pk($,k),BH($,LH(k.doc,x,T))),!(!e||n.length===0))if(x===T){let M=$?pG($,x,o):null;if(M)p(M);else{let I=l.current?.parentElement?.querySelector('[data-testid="selection-overlay"]'),F=l.current?.querySelector(".layout-page");if(I&&F){let E=I.getBoundingClientRect(),R=F.getBoundingClientRect(),N=Qs(e,n,r,x);p(N?{...N,x:N.x+(R.left-E.left)/o,y:N.y+(R.top-E.top)/o}:null)}else p(null)}f([])}else{let M=l.current?.parentElement?.querySelector('[data-testid="selection-overlay"]');if(M&&l.current){let I=M.getBoundingClientRect(),F=hG(l.current,I,x,T,o);if(F.length>0)f(F);else{let E=l.current.querySelector(".layout-page");if(E){let R=E.getBoundingClientRect(),N=(R.left-I.left)/o,B=(R.top-I.top)/o,j=Zz(e,n,r,x,T).map(O=>({...O,x:O.x+N,y:O.y+B}));f(j)}else f([])}}else f([]);p(null)}},[e,n,r,o,d,l]),v=S.useCallback(k=>{let{selection:x}=k;x instanceof Ie&&x.node.type.name==="image"?(f([]),p(null)):s.isSafeToRender()&&g(k),requestAnimationFrame(()=>{let T=a.current?.getView();if(!T){y(null);return}let{selection:$}=T.state;if($ instanceof Ie&&$.node.type.name==="image"){let M=$.from,I=l.current?Gc(l.current,M):null;if(I){y(C(I,M));return}}c.current||y(null)})},[g,C,s,a,c,l]);return S.useEffect(()=>{let k=i.current;if(!k)return;let x=new ResizeObserver(()=>{let T=a.current?.getState();T&&g(T)});return x.observe(k),()=>x.disconnect()},[g,i,a]),S.useEffect(()=>{let k=a.current?.getState();e&&k&&g(k)},[e,g,a]),{selectionRects:u,caretPosition:h,selectedImageInfo:m,setSelectionRects:f,setCaretPosition:p,setSelectedImageInfo:y,buildImageSelectionInfo:C,updateSelectionOverlay:g,handleSelectionChange:v}}function oY(t){let{pagesContainerRef:e,hiddenPMRef:n,zoom:r,isImageInteractingRef:o,getPositionFromMouse:i}=t,l=S.useCallback((f,h,p)=>{let m=n.current?.getView();if(!m)return;let y=zU(m,f,h,p);y!==null&&n.current?.setNodeSelection(y)},[n]),a=S.useCallback(()=>{o.current=!0},[o]),s=S.useCallback(()=>{o.current=!1},[o]),c=S.useCallback((f,h,p)=>{let m=n.current?.getView();if(!m)return;let y=m.state.doc.nodeAt(f);if(!(!y||y.type.name!=="image"))if(jU(y)){let w=e.current?.querySelectorAll(".layout-page");if(!w||w.length===0)return;let C=null;for(let T of w){let $=T.getBoundingClientRect();if(p>=$.top&&p<=$.bottom){C=T.querySelector(".layout-page-content");break}}if(C||(C=w[w.length-1].querySelector(".layout-page-content")),!C)return;let g=C.getBoundingClientRect(),v=He((h-g.left)/r),k=He((p-g.top)/r),x=HU(m,f,v,k);x!==null&&n.current?.setNodeSelection(x)}else{let w=i(h,p);if(w===null)return;let C=_U(m,f,w);C!==null&&n.current?.setNodeSelection(C)}},[i,r,n,e]),d=S.useCallback(()=>{o.current=!0},[o]),u=S.useCallback(()=>{o.current=!1},[o]);return{handleImageResize:l,handleImageResizeStart:a,handleImageResizeEnd:s,handleImageDragMove:c,handleImageDragStart:d,handleImageDragEnd:u}}function iY(t){let{layout:e,blocks:n,measures:r,pagesContainerRef:o,hiddenPMRef:i,getScrollContainer:l}=t,a=S.useRef(null);S.useEffect(()=>()=>{a.current?.abort(),a.current=null},[]);let s=S.useCallback((u,f=!1)=>{if(!Number.isInteger(u)||u<0)return;let h=o.current;if(!h)return;a.current?.abort();let p=new AbortController;a.current=p;let{signal:m}=p,y=()=>{let M=Gc(h,u);if(M)return M;for(let I of Xc(h)){let F=Number(I.dataset.pmStart),E=Number(I.dataset.pmEnd);if(Number.isFinite(F)&&Number.isFinite(E)&&u>=F&&u<=E)return I}return null};if(!f){let M={block:"center",inline:"nearest",behavior:"smooth"},I=y();if(I){I.scrollIntoView(M);return}let F=e,E=n,R=r;if(!F||E.length===0||R.length!==E.length)return;let N=null,B=Qs(F,E,R,u);if(B?N=B.pageIndex:N=Wg(F,u),N==null)return;let j=h.querySelectorAll(".layout-page")[N];if(!j)return;j.scrollIntoView(M),Cu(()=>{if(!h.isConnected)return;let O=y();O&&O.scrollIntoView(M)},m);return}let w=l()??Ss(h),C=()=>{let M=y();return M?(ku(M,w),!0):!1};if(C())return;let g=e,v=n,k=r;if(!g||v.length===0||k.length!==v.length)return;let x=null,T=Qs(g,v,k,u);if(T?x=T.pageIndex:x=Wg(g,u),x==null)return;let $=h.querySelectorAll(".layout-page")[x];$&&(ku($,w),Cu(()=>{if(!h.isConnected)return;let M=y();M?ku(M,w):C()},m))},[e,n,r,l,o]),c=S.useCallback(u=>{if(!Number.isInteger(u)||u<1||!e||u>e.pages.length)return;let f=e.pages[u-1];for(let h of f.fragments)if(typeof h.pmStart=="number"){s(h.pmStart,!0);return}o.current?.querySelectorAll(".layout-page")[u-1]?.scrollIntoView({block:"center",inline:"nearest"})},[e,s,o]),d=S.useCallback((u,f)=>{let h=i.current?.getState();if(!h)return!1;let p=bq(h.doc,u);if(p==null||p<0)return!1;s(p,!0);let m=()=>{if(!f?.highlight)return;let g=o.current;g&&nM(g,u,f.highlight)};m();let y=a.current?.signal;if(!y)return!0;let w=h.doc.nodeAt(p),C=w?.isTextblock===!0?Math.min(p+1+w.content.size,h.doc.content.size):Math.min(p+1,h.doc.content.size);return Cu(()=>{m(),i.current&&(i.current.setSelection(C),i.current.focus())},y),!0},[s,i,o]);return{scrollToPositionImpl:s,scrollToPageImpl:c,scrollToParaIdImpl:d}}function lY(t){let{hiddenPMRef:e,getActiveHfView:n}=t,r=S.useRef(null);function o(E){return E.closest(".layout-page-header")||E.closest(".layout-page-footer")?n?.()??e.current?.getView()??null:e.current?.getView()??null}let i=S.useRef(!1),l=S.useRef(0),a=S.useRef(0),s=S.useRef(0),c=S.useRef({left:0,right:0}),d=S.useRef(null),u=S.useRef(!1),f=S.useRef(0),h=S.useRef(0),p=S.useRef(0),m=S.useRef(0),y=S.useRef(null),w=S.useRef(!1),C=S.useRef(!1),g=S.useRef(0),v=S.useRef(0),k=S.useRef(0),x=S.useRef(0),T=S.useRef(null),$=S.useCallback((E,R)=>{let N=o(E);if(!N)return!1;if(E.classList.contains("layout-table-resize-handle")){R.preventDefault(),R.stopPropagation(),i.current=!0,l.current=R.clientX,d.current=E,r.current=N,E.classList.add("dragging");let B=parseInt(E.dataset.columnIndex??"0",10);a.current=B,s.current=parseInt(E.dataset.tablePmStart??"0",10);let j=VU(N,s.current,B);return j&&(c.current=j),!0}if(E.classList.contains("layout-table-row-resize-handle")||E.classList.contains("layout-table-edge-handle-bottom")){R.preventDefault(),R.stopPropagation(),u.current=!0,f.current=R.clientY,y.current=E,w.current=E.dataset.isEdge==="bottom",r.current=N,E.classList.add("dragging");let B=parseInt(E.dataset.rowIndex??"0",10);h.current=B,p.current=parseInt(E.dataset.tablePmStart??"0",10);let j=qU(N,p.current,B);if(j!=null)m.current=j;else{let O=E.closest(".layout-table")?.querySelector(`[data-row-index="${B}"]`),z=O?O.getBoundingClientRect().height:30;m.current=Math.round(z*ss)}return!0}if(E.classList.contains("layout-table-edge-handle-right")){R.preventDefault(),R.stopPropagation(),C.current=!0,g.current=R.clientX,T.current=E,r.current=N,E.classList.add("dragging");let B=parseInt(E.dataset.columnIndex??"0",10);v.current=B,k.current=parseInt(E.dataset.tablePmStart??"0",10);let j=ZU(N,k.current,B);return j!=null&&(x.current=j),!0}return!1},[e,n]),M=S.useCallback(E=>{if(i.current){E.preventDefault();let R=E.clientX-l.current;if(d.current){let N=parseFloat(d.current.style.left);d.current.style.left=`${N+R}px`,l.current=E.clientX;let B=Math.round(R*ss),j=c.current.left+B,O=c.current.right-B;j>=bu&&O>=bu&&(c.current={left:j,right:O})}return!0}if(u.current){E.preventDefault();let R=E.clientY-f.current;if(y.current){let N=parseFloat(y.current.style.top);y.current.style.top=`${N+R}px`,f.current=E.clientY;let B=Math.round(R*ss),j=m.current+B;j>=WU&&(m.current=j)}return!0}if(C.current){E.preventDefault();let R=E.clientX-g.current;if(T.current){let N=parseFloat(T.current.style.left);T.current.style.left=`${N+R}px`,g.current=E.clientX;let B=Math.round(R*ss),j=x.current+B;j>=bu&&(x.current=j)}return!0}return!1},[]),I=S.useCallback(()=>{let E=r.current;if(i.current){if(i.current=!1,d.current&&(d.current.classList.remove("dragging"),d.current=null),E){let{left:R,right:N}=c.current;KU(E,{pmStart:s.current,colIdx:a.current,newLeft:R,newRight:N})}return r.current=null,!0}return u.current?(u.current=!1,y.current&&(y.current.classList.remove("dragging"),y.current=null),E&&UU(E,{pmStart:p.current,rowIdx:h.current,newHeight:m.current}),r.current=null,!0):C.current?(C.current=!1,T.current&&(T.current.classList.remove("dragging"),T.current=null),E&&XU(E,{pmStart:k.current,colIdx:v.current,newWidth:x.current}),r.current=null,!0):!1},[]),F=S.useCallback(()=>i.current||u.current||C.current,[]);return{tryStartFromMouseDown:$,handleMouseMoveUpdate:M,tryCommit:I,isAnyResizeActive:F}}function aY(t){return{getView:()=>t,setSelection(e,n){let r=n??e;try{let o=t.state.doc.resolve(e),i=t.state.doc.resolve(r);t.dispatch(t.state.tr.setSelection(ye.between(o,i)))}catch{t.dispatch(t.state.tr.setSelection(ye.create(t.state.doc,0)))}},setNodeSelection(e){try{t.dispatch(t.state.tr.setSelection(Ie.create(t.state.doc,e)))}catch{}},setCellSelection(e,n){try{let r=t.state.doc.resolve(e),o=t.state.doc.resolve(n);t.dispatch(t.state.tr.setSelection(new Ve(r,o)))}catch{}},focus(){t.focus()}}}function sY(t){let{pagesContainerRef:e,hiddenPMRef:n,getHfView:r,layout:o,blocks:i,measures:l,zoom:a,readOnly:s,hfEditMode:c,onBodyClick:d,onContextMenu:u,onHyperlinkClick:f,onHeaderFooterDoubleClick:h,setSelectedImageInfo:p,setSelectionRects:m,setCaretPosition:y,buildImageSelectionInfo:w,setIsFocused:C,scrollToPositionImpl:g}=t,v=S.useRef(!1),k=S.useRef(null),x=lY({hiddenPMRef:n,getActiveHfView:r}),T=S.useRef(GU()),[$,M]=S.useState(null),I=S.useRef(null),F=S.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]);S.useEffect(()=>()=>{I.current&&clearTimeout(I.current)},[]);let E=S.useRef(()=>{}),R=S.useCallback((V,Z)=>{E.current(V,Z)},[]),{updateMousePosition:N,stopAutoScroll:B}=kq({pagesContainerRef:e,onScrollExtendSelection:R}),j=S.useCallback((V,Z)=>{if(!e.current||!o)return null;let K=i7(e.current,V,Z,a);if(K!==null)return K;if(c){let ue=window.document.elementsFromPoint(V,Z).find(pe=>pe.closest(".layout-page-header")||pe.closest(".layout-page-footer"));if(!ue)return null;let ve=ue.closest(".layout-page-header")??ue.closest(".layout-page-footer");if(!ve)return null;let Pe=Array.from(ve.querySelectorAll("span[data-pm-start][data-pm-end]")),be=null;for(let pe of Pe){let Fe=pe.getBoundingClientRect();if(Z<Fe.top-4||Z>Fe.bottom+4)continue;let Ae=Number(pe.dataset.pmStart),yt=Number(pe.dataset.pmEnd);if(!Number.isFinite(Ae)||!Number.isFinite(yt))continue;let Me,Ue;if(V<Fe.left)Me=Ae,Ue=Fe.left-V;else if(V>Fe.right)Me=yt,Ue=V-Fe.right;else{let Lt=(V-Fe.left)/Math.max(1,Fe.width);Me=Ae+Math.round(Lt*(yt-Ae)),Ue=0}(!be||Ue<be.dist)&&(be={pos:Me,dist:Ue})}return be?.pos??null}let ee=e.current.querySelectorAll(".layout-page"),G=-1,te=null;for(let ue=0;ue<ee.length;ue++){let ve=ee[ue].getBoundingClientRect();if(V>=ve.left&&V<=ve.right&&Z>=ve.top&&Z<=ve.bottom){G=ue,te=ve;break}}if(G<0||!te)return null;let A=(V-te.left)/a,P=(Z-te.top)/a,_=o.pages[G];if(!_)return null;let H={pageIndex:G,page:_},le=Oz(H,i,l,{x:A,y:P});if(!le)return null;if(le.fragment.kind==="table"){let ue=jz(H,i,l,{x:A,y:P});return _0(le,ue)}return _0(le)},[o,i,l,a,c,e]),O=S.useCallback(()=>{if(c&&r){let V=r();if(V)return aY(V)}return n.current},[c,r,n]),z=S.useCallback(V=>{let Z=O()?.getView();return Z?Hf(Z,V):null},[O]),W=S.useCallback(V=>{let Z=O();if(!Z)return;if(V.button===2){V.preventDefault();return}if(V.button!==0||(M(null),F(),V.target.closest("a[href]")&&V.preventDefault(),s))return;let K=V.target;if(c){if(!(K.closest(".layout-page-header")||K.closest(".layout-page-footer")||K.closest(".hf-inline-editor"))&&d){V.preventDefault(),V.stopPropagation(),d();return}}else if((K.closest(".layout-page-header")||K.closest(".layout-page-footer"))&&V.detail!==2){V.preventDefault();return}if(x.tryStartFromMouseDown(K,V))return;let ee=zK(K);if(ee){V.preventDefault(),V.stopPropagation();let te=ee.dataset.pmStart;if(te!==void 0){let A=parseInt(te,10);Z.setNodeSelection(A),p(w(ee,A)),m([]),y(null)}Z.focus(),c||C(!0);return}p(null),V.preventDefault();let G=j(V.clientX,V.clientY);if(G!==null)T.current.begin(z(G)),v.current=!0,k.current=G,Z.setSelection(G);else{T.current.begin(null);let te=Z.getView();if(te){let A=Math.max(0,te.state.doc.content.size-1);Z.setSelection(A),k.current=A,v.current=!0}}Z.focus(),c||C(!0)},[O,s,c,d,j,z,x,F,p,m,y,w,C]);E.current=(V,Z)=>{if(!v.current||k.current===null)return;let K=O();if(!K)return;let ee=j(V,Z);ee!==null&&K.setSelection(k.current,ee)};let q=S.useCallback(V=>{if(x.handleMouseMoveUpdate(V)||!v.current||k.current===null)return;let Z=O();if(!Z||!e.current)return;N(V.clientX,V.clientY);let K=j(V.clientX,V.clientY);if(K===null)return;let ee=Z.getView();if(ee&&T.current.update(ee,K,V.clientX))return;let G=k.current;Z.setSelection(G,K)},[O,j,z,N,x,e]),Q=S.useCallback(()=>{x.tryCommit()||(v.current=!1,T.current.end(),B())},[B,x]);S.useEffect(()=>(window.addEventListener("mousemove",q),window.addEventListener("mouseup",Q),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",Q)}),[q,Q]);let X=S.useCallback(V=>{if(s||v.current||T.current.isCellDragging||x.isAnyResizeActive())return;let Z=e.current;if(!Z)return;let K=r7({mouseX:V.clientX,mouseY:V.clientY,pagesContainer:Z,target:V.target,hfEditMode:c??null});if(!K){I.current||(I.current=setTimeout(()=>{M(null),I.current=null},J_));return}let ee=Z.parentElement;if(!ee)return;let G=ee.getBoundingClientRect();M({type:K.type,x:(K.clientX-G.left)/a,y:(K.clientY-G.top)/a,cellPmPos:K.cellPmPos}),F()},[s,F,c,e,a]),se=S.useCallback(V=>{if(V.preventDefault(),V.stopPropagation(),!$)return;let Z=O(),K=Z?.getView();if(!Z||!K)return;let{type:ee,cellPmPos:G}=$,te=K.state.tr.setSelection(ye.create(K.state.doc,G+1));K.dispatch(te),ee==="row"?Rh(K.state,K.dispatch):Ph(K.state,K.dispatch),M(null),Z.focus()},[$,O]),ie=S.useCallback(V=>{let Z=O(),K=V.target.closest("a[href]");if(K&&Z){V.preventDefault();let G=K.getAttribute("href")||"",te=Z.getView();if(G.startsWith("#")){let A=G.substring(1);if(A&&te){let P=null;te.state.doc.descendants((_,H)=>{if(P!==null)return!1;if(_.type.name==="paragraph"&&_.attrs.bookmarks?.some(le=>le.name===A))return P=H,!1}),P!==null&&(g(P),Z.setSelection(P+1))}}else if(f&&!(te&&te.state.selection.from!==te.state.selection.to)){let A=K.textContent||"",P=K.getAttribute("title")||void 0,_=K.closest(".ep-root.paged-editor");if(_){let H=_.getBoundingClientRect(),le=K.getBoundingClientRect(),ue={top:le.bottom-H.top+4,left:le.left-H.left};f({href:G,displayText:A,tooltip:P,position:ue})}}return}if(V.detail===2&&!c&&h){let G=V.target,te=G.closest(".layout-page-header"),A=G.closest(".layout-page-footer");if(te||A){let P=G.closest("[data-page-number]"),_=P?Number(P.dataset.pageNumber):1;V.preventDefault(),V.stopPropagation(),h(te?"header":"footer",_);return}}if(!Z)return;let ee=Z.getView();if(ee){if(V.detail===2){let G=j(V.clientX,V.clientY);if(G!==null){let te=z(G);if(te!==null){V.preventDefault(),V.stopPropagation(),Z.setCellSelection(te,te);return}let{doc:A}=ee.state,P=A.resolve(G),_=P.parent;if(_.isTextblock){let H=_.textContent,le=P.parentOffset,[ue,ve]=T$(H,le),Pe=P.start()+ue,be=P.start()+ve;Pe<be&&Z.setSelection(Pe,be)}}}if(V.detail===3){let G=j(V.clientX,V.clientY);if(G!==null){let te=ee.state.doc.resolve(G);Z.setSelection(te.start(te.depth),te.end(te.depth))}}}},[O,c,j,h,f,z,g]),ce=S.useCallback(V=>{if(!u)return;V.preventDefault();let Z=O(),K=Z?.getView();if(!Z||!K)return;let ee=le=>{let ue=K.state.doc.nodeAt(le);if(!ue||ue.type.name!=="image")return null;let ve=ue.attrs.wrapType??"inline",Pe=ue.attrs.cssFloat;return{pos:le,wrapType:ve,cssFloat:Pe}},G=null,te=jK(V.target);if(te&&(G=ee(te.pos),G&&(G.inlinePositionEmu=zf(te.imageEl,a))),!G){let le=K.state.selection;if(le instanceof Ie&&le.node.type.name==="image"&&(G=ee(le.from),G)){let ue=e.current?.querySelector(`.layout-run-image[data-pm-start="${le.from}"]`);ue&&(G.inlinePositionEmu=zf(ue,a))}}let{from:A,to:P}=K.state.selection,_=j(V.clientX,V.clientY);_!==null&&(A===P||_<A||_>P)&&(Z.setSelection(_),Z.focus(),c||C(!0));let H=K.state.selection.from!==K.state.selection.to;u({x:V.clientX,y:V.clientY,hasSelection:H,image:G})},[O,c,u,j,a,e,C]),Y=S.useCallback(()=>M(null),[]);return{handlePagesMouseDown:W,handlePagesMouseMove:X,handlePagesClick:ie,handlePagesContextMenu:ce,handleTableInsertClick:se,tableInsertButton:$,clearTableInsertTimer:F,hideTableInsertButton:Y,getPositionFromMouse:j}}function cY(t,e){let n=t?.package;if(!n)return null;let r=o=>{if(!o)return null;for(let[i,l]of o)if(l===e)return i;return null};return r(n.headers)??r(n.footers)}function ub(t){let{hiddenPMRef:e,hiddenHfPMsRef:n,documentRef:r,layout:o,runLayoutPipeline:i,scrollToPositionImpl:l,scrollToParaIdImpl:a,scrollToPageImpl:s,setIsFocused:c}=t;return{getDocument:()=>e.current?.getDocument()??null,getState:()=>e.current?.getState()??null,getView:()=>e.current?.getView()??null,focus:()=>{e.current?.focus(),c(!0)},blur:()=>{e.current?.blur(),c(!1)},isFocused:()=>e.current?.isFocused()??!1,dispatch:d=>e.current?.dispatch(d),undo:()=>e.current?.undo()??!1,redo:()=>e.current?.redo()??!1,setSelection:(d,u)=>e.current?.setSelection(d,u),getLayout:()=>o,relayout:()=>{let d=e.current?.getState();d&&i(d)},scrollToPosition:l,scrollToParaId:a,scrollToPage:s,highlightRange:(d,u)=>{let f=e.current?.getView()??null;if(!f)return;let h=vU(f.state.doc,d,u);h&&(e.current?.setSelection(h.from,h.to),l(h.from,!0))},scrollToCommentId:d=>{let u=e.current?.getView()??null,f=kU(u,d);return f?(e.current?.setSelection(f.from,f.to),l(f.from,!0),!0):!1},scrollToChangeId:d=>{let u=e.current?.getView()??null,f=Jy(u,d);if(f)return e.current?.setSelection(f.from,f.to),l(f.from,!0),!0;let h=n.current?.getViews();if(h){for(let p of h.values())if(f=Jy(p,d),f){let m=p.state.tr.setSelection(ye.create(p.state.doc,f.from,f.to));return p.dispatch(m),p.focus(),!0}}return!1},getHfPmView:d=>{let u=cY(r.current,d);return u?n.current?.getView(u)??null:null},getHfPmViews:()=>n.current?.getViews()??new Map}}function dY(t){let{ref:e,hiddenPMRef:n,hiddenHfPMsRef:r,documentRef:o,layout:i,runLayoutPipeline:l,scrollToPositionImpl:a,scrollToParaIdImpl:s,scrollToPageImpl:c,setIsFocused:d,onReadyRef:u}=t;S.useImperativeHandle(e,()=>ub({hiddenPMRef:n,hiddenHfPMsRef:r,documentRef:o,layout:i,runLayoutPipeline:l,scrollToPositionImpl:a,scrollToParaIdImpl:s,scrollToPageImpl:c,setIsFocused:d}),[i,l,a,s,c]),S.useEffect(()=>{u.current&&n.current&&u.current(ub({hiddenPMRef:n,hiddenHfPMsRef:r,documentRef:o,layout:i,runLayoutPipeline:l,scrollToPositionImpl:a,scrollToParaIdImpl:s,scrollToPageImpl:c,setIsFocused:d}))},[i,l,s,c])}function uY(t){let{hiddenPMRef:e,runLayoutPipeline:n,updateSelectionOverlay:r,headerContent:o,footerContent:i,firstPageHeaderContent:l,firstPageFooterContent:a}=t;S.useEffect(()=>{let c=()=>{let d=e.current?.getView();d&&(CN(),FH(),n(d.state),r(d.state))};return window.document.fonts.addEventListener("loadingdone",c),()=>{window.document.fonts.removeEventListener("loadingdone",c)}},[]);let s=S.useRef(0);S.useEffect(()=>{if(s.current===0){s.current=1;return}let c=e.current?.getView();c&&n(c.state)},[o,i,l,a,n,e])}function fY({type:t,x:e,y:n,onMouseDown:r,onMouseEnter:o,onMouseLeave:i}){let l=t==="row"?"Insert row below":"Insert column to the right";return b.jsx("button",{type:"button",onMouseDown:r,onMouseEnter:o,onMouseLeave:i,style:{position:"absolute",left:e,top:n,width:20,height:20,borderRadius:"4px",border:"1px solid var(--doc-border-light)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text-muted)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:200,padding:0,boxShadow:"none"},title:l,"aria-label":l,children:b.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:b.jsx("path",{d:"M6 1v10M1 6h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})}var KS={position:"absolute",zIndex:1e4,background:"var(--doc-surface)",borderRadius:"8px",boxShadow:"0 1px 3px var(--doc-shadow), 0 4px 12px var(--doc-shadow-subtle)",border:"1px solid var(--doc-border-light)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"14px"},pY={...KS,padding:"8px 12px",display:"flex",alignItems:"center",gap:"8px",maxWidth:"400px"},hY={...KS,padding:"12px",width:"320px"},Su={width:"20px",height:"20px",flexShrink:0,color:"var(--doc-text-muted)",display:"flex",alignItems:"center",justifyContent:"center"},mY={color:"var(--doc-link)",textDecoration:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"220px",fontSize:"14px",lineHeight:"20px",cursor:"pointer"},gY={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"none",borderRadius:"4px",cursor:"pointer",color:"var(--doc-text-muted)",padding:0,flexShrink:0},yY={width:"1px",height:"20px",background:"var(--doc-border-light)",flexShrink:0},fb={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},pb={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"14px",outline:"none",lineHeight:"20px"},bY={color:"var(--doc-primary)",fontWeight:600,fontSize:"14px",border:"none",background:"none",cursor:"pointer",padding:"6px 12px",borderRadius:"4px",flexShrink:0},Vi={width:18,height:18,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};function wY(){return b.jsxs("svg",{...Vi,children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("path",{d:"M2 12h20"}),b.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}function xY(){return b.jsxs("svg",{...Vi,children:[b.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),b.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function vY(){return b.jsx("svg",{...Vi,children:b.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}function kY(){return b.jsxs("svg",{...Vi,children:[b.jsx("path",{d:"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"}),b.jsx("path",{d:"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"}),b.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),b.jsx("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),b.jsx("line",{x1:"16",y1:"19",x2:"16",y2:"22"}),b.jsx("line",{x1:"19",y1:"16",x2:"22",y2:"16"})]})}function CY(){return b.jsxs("svg",{...Vi,children:[b.jsx("line",{x1:"4",y1:"9",x2:"20",y2:"9"}),b.jsx("line",{x1:"4",y1:"15",x2:"20",y2:"15"}),b.jsx("line",{x1:"10",y1:"3",x2:"8",y2:"21"}),b.jsx("line",{x1:"16",y1:"3",x2:"14",y2:"21"})]})}function SY(){return b.jsxs("svg",{...Vi,children:[b.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),b.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function Tu({title:t,onClick:e,children:n}){return b.jsx("button",{type:"button",className:"ep-hyperlink-popup__icon-btn",style:gY,title:t,onClick:e,children:n})}function TY({data:t,onNavigate:e,onCopy:n,onEdit:r,onRemove:o,onClose:i,readOnly:l}){let{t:a}=Re(),[s,c]=S.useState("view"),[d,u]=S.useState(""),[f,h]=S.useState(""),p=S.useRef(null),m=S.useRef(null);S.useEffect(()=>{t&&(c("view"),u(t.displayText),h(t.href))},[t]),S.useEffect(()=>{s==="edit"&&requestAnimationFrame(()=>{m.current?.focus(),m.current?.select()})},[s]),S.useEffect(()=>{if(!t)return;let x=!1,T=M=>{p.current&&!p.current.contains(M.target)&&i()},$=setTimeout(()=>{x||document.addEventListener("mousedown",T)},0);return()=>{x=!0,clearTimeout($),document.removeEventListener("mousedown",T)}},[t,i]),S.useEffect(()=>{if(!t)return;let x=T=>{T.key==="Escape"&&(s==="edit"?c("view"):i())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[t,s,i]);let y=S.useCallback(()=>{t&&(n(t.href),OS("Link copied to clipboard"))},[t,n]),w=S.useCallback(()=>{t&&(u(t.displayText),h(t.href),c("edit"))},[t]),C=S.useCallback(()=>{let x=f.trim();x&&r(d.trim()||x,x)},[d,f,r]),g=S.useCallback(x=>{x.key==="Enter"&&(x.preventDefault(),C())},[C]);if(!t)return null;let v=t.position.top,k=t.position.left;return s==="edit"?b.jsxs("div",{ref:p,className:"ep-hyperlink-popup ep-hyperlink-popup--edit",style:{...hY,top:v,left:k},onMouseDown:x=>x.stopPropagation(),children:[b.jsxs("div",{style:fb,children:[b.jsx("span",{style:Su,children:b.jsx(CY,{})}),b.jsx("input",{ref:m,type:"text",style:pb,value:d,onChange:x=>u(x.target.value),onKeyDown:g,placeholder:a("hyperlinkPopup.displayTextPlaceholder"),onFocus:x=>x.target.style.borderColor="var(--doc-primary)",onBlur:x=>x.target.style.borderColor="var(--doc-border-light)"})]}),b.jsxs("div",{style:{...fb,marginBottom:0},children:[b.jsx("span",{style:Su,children:b.jsx(SY,{})}),b.jsx("input",{type:"text",style:pb,value:f,onChange:x=>h(x.target.value),onKeyDown:g,placeholder:a("hyperlinkPopup.urlPlaceholder"),onFocus:x=>x.target.style.borderColor="var(--doc-primary)",onBlur:x=>x.target.style.borderColor="var(--doc-border-light)"}),b.jsx("button",{type:"button",style:{...bY,opacity:f.trim()?1:.5,cursor:f.trim()?"pointer":"default"},onClick:C,disabled:!f.trim(),children:a("common.apply")})]})]}):b.jsxs("div",{ref:p,className:"ep-hyperlink-popup",style:{...pY,top:v,left:k},onMouseDown:x=>x.stopPropagation(),children:[b.jsx("span",{style:Su,children:b.jsx(wY,{})}),b.jsx("a",{href:t.href,style:mY,title:t.href,target:"_blank",rel:"noopener noreferrer",onClick:x=>{x.preventDefault(),e(t.href)},children:t.href}),b.jsx("span",{style:yY}),b.jsx(Tu,{title:a("hyperlinkPopup.copyLink"),onClick:y,children:b.jsx(xY,{})}),!l&&b.jsxs(b.Fragment,{children:[b.jsx(Tu,{title:a("hyperlinkPopup.editLink"),onClick:w,children:b.jsx(vY,{})}),b.jsx(Tu,{title:a("hyperlinkPopup.removeLink"),onClick:o,children:b.jsx(kY,{})})]})]})}var $Y=S.forwardRef(function(t,e){let{document:n,styles:r,theme:o,sectionProperties:i,finalSectionProperties:l,headerContent:a,footerContent:s,firstPageHeaderContent:c,firstPageFooterContent:d,readOnly:u=!1,pageGap:f=24,zoom:h=1,onDocumentChange:p,onSelectionChange:m,externalPlugins:y=VG,extensionManager:w,onReady:C,onRenderedDomContextReady:g,pluginOverlays:v,onHeaderFooterDoubleClick:k,hfEditMode:x,onBodyClick:T,onHfTransaction:$,className:M,style:I,commentsSidebarOpen:F=!1,sidebarOverlay:E,scrollContainerRef:R,onHyperlinkClick:N,onContextMenu:B,onAnchorPositionsChange:j,onTotalPagesChange:O,resolvedCommentIds:z,hyperlinkPopupData:W,onHyperlinkPopupNavigate:q,onHyperlinkPopupCopy:Q,onHyperlinkPopupEdit:X,onHyperlinkPopupRemove:se,onHyperlinkPopupClose:ie,isSuggesting:ce=!1,author:Y="User"}=t,V=S.useCallback(()=>R&&typeof R=="object"?R.current:Z.current,[R]),Z=S.useRef(null),K=S.useRef(null),ee=S.useRef(null),G=S.useRef(null),te=S.useRef(null),A=S.useRef(n);A.current=n;let{handlePMKeyDown:P}=vq({pagesContainerRef:K}),_=S.useRef(m),H=S.useRef(p),le=S.useRef(C),ue=S.useRef(g);_.current=m,H.current=p,le.current=C,ue.current=g;let[ve,Pe]=S.useState(!1);S.useEffect(()=>{if(x){let ke=G.current?.getView();if(ke){try{let at=ke.state.tr.setSelection(ye.create(ke.state.doc,0));ke.dispatch(at)}catch{}ke.dom.blur?.()}Pe(!1)}},[x]);let be=S.useRef(!1),pe=S.useMemo(()=>new u9,[]),Fe=S.useCallback(ke=>{let at=te.current;if(!at)return null;let nt=n?.package;if(!nt)return null;let nn=po=>{if(!po)return null;for(let[ya,ba]of po)if(ba===ke)return ya;return null},Fn=nn(nt.headers)??nn(nt.footers);return Fn?at.getView(Fn)?.state.doc??null:null},[n]),{layout:Ae,blocks:yt,measures:Me,decorationSyncToken:Ue,notifyDecorationLayer:Lt,contentWidth:Sn,runLayoutPipeline:vt,scheduleLayout:Tt}=nY({document:n,styles:r,theme:o,sectionProperties:i,finalSectionProperties:l,headerContent:a,footerContent:s,firstPageHeaderContent:c,firstPageFooterContent:d,getHfPmDoc:Fe,pageGap:f,zoom:h,resolvedCommentIds:z,pagesContainerRef:K,viewportLayoutRef:ee,hiddenPMRef:G,syncCoordinator:pe,getScrollContainer:V,onTotalPagesChange:O,onAnchorPositionsChange:j,onRenderedDomContextReady:g}),{selectionRects:Ee,caretPosition:Se,selectedImageInfo:De,setSelectionRects:et,setCaretPosition:qe,setSelectedImageInfo:ct,buildImageSelectionInfo:tt,updateSelectionOverlay:ot,handleSelectionChange:Ne}=rY({layout:Ae,blocks:yt,measures:Me,zoom:h,containerRef:Z,pagesContainerRef:K,hiddenPMRef:G,syncCoordinator:pe,isImageInteractingRef:be,onSelectionChangeRef:_}),mt=S.useCallback((ke,at)=>{if(Lt(),ke.docChanged){pe.incrementStateSeq(),Tt(at);let nt=G.current?.getDocument();nt&&H.current?.(nt)}pe.requestRender(),ke.docChanged||ot(at)},[Tt,ot,pe,Lt]),{scrollToPositionImpl:$t,scrollToPageImpl:lr,scrollToParaIdImpl:lt}=iY({layout:Ae,blocks:yt,measures:Me,pagesContainerRef:K,hiddenPMRef:G,getScrollContainer:V}),{handlePagesMouseDown:Pt,handlePagesMouseMove:me,handlePagesClick:ze,handlePagesContextMenu:bt,handleTableInsertClick:gt,tableInsertButton:Tn,clearTableInsertTimer:dt,hideTableInsertButton:It,getPositionFromMouse:Xt}=sY({pagesContainerRef:K,hiddenPMRef:G,getHfView:S.useCallback(()=>{let ke=te.current;if(!ke)return null;let at=n?.package?.document?.finalSectionProperties,nt=x==="header"?at?.headerReferences:at?.footerReferences,nn=nt?.find(Fn=>Fn.type==="default")??nt?.find(Fn=>Fn.type==="first")??null;return nn?.rId?ke.getView(nn.rId):null},[x,n]),layout:Ae,blocks:yt,measures:Me,zoom:h,readOnly:u,hfEditMode:x,onBodyClick:T,onContextMenu:B,onHyperlinkClick:N,onHeaderFooterDoubleClick:k,setSelectedImageInfo:ct,setSelectionRects:et,setCaretPosition:qe,buildImageSelectionInfo:tt,setIsFocused:Pe,scrollToPositionImpl:$t}),qn=S.useCallback(ke=>{if(u)return;let at=ke.target;at.closest(".docx-comments-sidebar")||at.closest(".docx-unified-sidebar")||at.closest(".ep-hyperlink-popup")||at.closest("[data-hf-r-id]")||(G.current?.focus(),Pe(!0))},[u]),_t=S.useCallback(ke=>{let at=ke.relatedTarget;at&&Z.current?.contains(at)||at?.closest('[role="toolbar"], [data-radix-popper-content-wrapper], [data-radix-select-content], .docx-table-options-dropdown')||Pe(!1)},[]),{handleImageResize:uo,handleImageResizeStart:qi,handleImageResizeEnd:fo,handleImageDragMove:rd,handleImageDragStart:od,handleImageDragEnd:ga}=oY({pagesContainerRef:K,hiddenPMRef:G,zoom:h,isImageInteractingRef:be,getPositionFromMouse:Xt}),id=S.useCallback(ke=>{if(u)return;let at=ke.target;if(!at?.closest("[data-hf-r-id]")&&!at?.closest(".ep-hyperlink-popup")){if(G.current?.isFocused()||(G.current?.focus(),Pe(!0)),ke.key===" "&&!ke.ctrlKey&&!ke.metaKey&&!ke.nativeEvent.isComposing){ke.preventDefault();let nt=G.current?.getView();if(nt){let{from:nn,to:Fn}=nt.state.selection;nt.someProp("handleTextInput",po=>po(nt,nn,Fn," "))||nt.dispatch(nt.state.tr.insertText(" "))}return}if(["PageUp","PageDown"].includes(ke.key)&&!ke.metaKey&&ke.ctrlKey,ke.key==="Home"&&(ke.metaKey||ke.ctrlKey)){let nt=V();nt&&(nt.scrollTop=0)}if(ke.key==="End"&&(ke.metaKey||ke.ctrlKey)){let nt=V();nt&&(nt.scrollTop=nt.scrollHeight)}}},[u,V]),ld=S.useCallback(ke=>{u||ke.target.closest(".docx-comments-sidebar")||ke.target.closest(".docx-unified-sidebar")||G.current?.isFocused()||(G.current?.focus(),Pe(!0))},[u]),Pr=S.useCallback(ke=>{vt(ke.state),ot(ke.state),u||requestAnimationFrame(()=>{ke.focus(),Pe(!0)})},[vt,ot,u]);uY({hiddenPMRef:G,runLayoutPipeline:vt,updateSelectionOverlay:ot,headerContent:a,footerContent:s,firstPageHeaderContent:c,firstPageFooterContent:d}),dY({ref:e,hiddenPMRef:G,hiddenHfPMsRef:te,documentRef:A,layout:Ae,runLayoutPipeline:vt,scrollToPositionImpl:$t,scrollToParaIdImpl:lt,scrollToPageImpl:lr,setIsFocused:Pe,onReadyRef:le});let Zi=S.useMemo(()=>Ae?qS(Ae,f):Dk+24+24,[Ae,f]);return b.jsxs("div",{ref:Z,className:`ep-root paged-editor ${M??""}`,style:{...qG,...I},tabIndex:0,onFocus:qn,onBlur:_t,onKeyDown:id,onMouseDown:ld,children:[b.jsx(bG,{ref:G,document:n,styles:r,widthPx:Sn,readOnly:u||!!x,onTransaction:mt,onSelectionChange:Ne,externalPlugins:y,extensionManager:w,onEditorViewReady:Pr,onKeyDown:P}),b.jsx(WS,{ref:te,document:n,styles:r,theme:o,isSuggesting:ce,author:Y,defaultTabStopTwips:n?.package?.settings?.defaultTabStop??null,onTransaction:(ke,at,nt)=>{if(nt){let nn=G.current?.getState();nn&&vt(nn)}$?.(ke,at,nt)}}),b.jsxs("div",{ref:ee,style:{...ZG,minHeight:Zi,marginBottom:h!==1?Zi*(h-1):void 0,transform:(()=>{let ke=[];return F&&ke.push(`translateX(-${mc}px)`),h!==1&&ke.push(`scale(${h})`),ke.length>0?ke.join(" "):void 0})(),transformOrigin:"top center",transition:"transform 0.2s ease"},children:[b.jsx("div",{ref:K,className:`paged-editor__pages${u?" paged-editor--readonly":""}${x?` paged-editor--hf-editing paged-editor--editing-${x}`:""}`,style:KG,onMouseDown:Pt,onMouseMove:me,onClick:ze,onContextMenu:bt,"aria-hidden":"true"}),b.jsx(PG,{selectionRects:x?[]:Ee,caretPosition:x?null:Se,isFocused:ve&&!x,pageGap:f,readOnly:u}),b.jsx(LG,{imageInfo:De,zoom:h,isFocused:ve,onResize:uo,onResizeStart:qi,onResizeEnd:fo,onDragMove:rd,onDragStart:od,onDragEnd:ga,onContextMenu:bt}),Tn&&b.jsx(fY,{type:Tn.type,x:Tn.x,y:Tn.y,onMouseDown:gt,onMouseEnter:dt,onMouseLeave:It}),v&&b.jsx("div",{className:"paged-editor__plugin-overlays",style:UG,children:v}),b.jsx(jG,{getView:()=>G.current?.getView()??null,getPagesContainer:()=>K.current,zoom:h,decorationSyncToken:Ue,syncCoordinator:pe})]}),E&&b.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Zi*h,pointerEvents:"none",overflow:"visible"},children:b.jsx("div",{style:{pointerEvents:"auto"},children:E})}),W&&q&&Q&&X&&se&&ie&&b.jsx(TY,{data:W,onNavigate:q,onCopy:Q,onEdit:X,onRemove:se,onClose:ie,readOnly:u})]})}),IY=S.memo($Y),hb={position:"absolute",left:0,right:0,bottom:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"2px 0",fontSize:11,color:"var(--doc-primary)",userSelect:"none",pointerEvents:"auto"},mb={fontWeight:500,letterSpacing:.3},MY={background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:11,padding:"2px 6px",borderRadius:3},RY={position:"absolute",right:0,top:"100%",background:"var(--doc-surface)",border:"1px solid var(--doc-border-light)",borderRadius:4,boxShadow:"0 2px 6px var(--doc-shadow)",zIndex:ro.dropdown,minWidth:160,padding:"4px 0"},ds={display:"block",width:"100%",padding:"6px 12px",border:"none",background:"none",textAlign:"left",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},PY=S.forwardRef(function({headerFooter:t,position:e,view:n,targetElement:r,parentElement:o,onSave:i,onClose:l,onRemove:a},s){let c=S.useRef(n);c.current=n;let[d,u]=S.useState(!1),f=S.useRef(null),[h,p]=S.useState(null);S.useLayoutEffect(()=>{let x=()=>{let $=o.getBoundingClientRect(),M=r.getBoundingClientRect();p({top:M.top-$.top+o.scrollTop,left:M.left-$.left+o.scrollLeft,width:M.width,height:M.height})};x();let T=o.closest('[style*="overflow"]')||o;return T.addEventListener("scroll",x),window.addEventListener("resize",x),()=>{T.removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[r,o]);let m=S.useRef(!1);S.useEffect(()=>{!n||m.current||(m.current=!0,requestAnimationFrame(()=>n.focus()))},[n]);let y=S.useCallback(()=>{if(!c.current)return;let x=Mh(c.current.state.doc);i(x)},[i]),w=S.useCallback(()=>{y(),l()},[y,l]);S.useEffect(()=>{function x(T){T.key==="Escape"&&(T.preventDefault(),T.stopPropagation(),w())}return document.addEventListener("keydown",x,!0),()=>document.removeEventListener("keydown",x,!0)},[w]),S.useEffect(()=>{if(!d)return;function x(T){f.current&&!f.current.contains(T.target)&&u(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[d]),S.useImperativeHandle(s,()=>({getView:()=>c.current,focus:()=>c.current?.focus(),undo:()=>{let x=c.current;return x?Ai(x.state,x.dispatch):!1},redo:()=>{let x=c.current;return x?Fo(x.state,x.dispatch):!1}}));let{t:C}=Re(),g=C(e==="header"?"headerFooter.header":"headerFooter.footer");if(!h)return null;let v={position:"absolute",top:h.top,left:h.left,width:h.width,height:h.height,zIndex:ro.hfInlineEditor,pointerEvents:"none"},k={...hb,bottom:"auto",top:"100%"};return b.jsxs("div",{className:"hf-inline-editor",style:v,children:[e==="footer"&&b.jsxs("div",{className:"hf-separator-bar",style:k,children:[b.jsx("span",{style:mb,children:g}),b.jsx(gb,{label:g,showOptions:d,setShowOptions:u,optionsRef:f,onRemove:a,onClose:w,viewRef:c})]}),e==="header"&&b.jsxs("div",{className:"hf-separator-bar",style:hb,children:[b.jsx("span",{style:mb,children:g}),b.jsx(gb,{label:g,showOptions:d,setShowOptions:u,optionsRef:f,onRemove:a,onClose:w,viewRef:c})]})]})});function gb({label:t,showOptions:e,setShowOptions:n,optionsRef:r,onRemove:o,onClose:i,viewRef:l}){let{t:a}=Re(),s=c=>{let d=l.current;if(!d)return;let{$from:u,from:f}=d.state.selection,h=d.state.storedMarks||u.marks(),p=Ce.nodes.field.create({fieldType:c,instruction:` ${c} \\* MERGEFORMAT `,fieldKind:"simple",dirty:!0}),m=d.state.tr.insert(f,p.mark(h));d.dispatch(m),d.focus()};return b.jsxs("div",{style:{position:"relative"},ref:r,children:[b.jsxs("button",{type:"button",style:MY,onClick:c=>{c.stopPropagation(),n(d=>!d)},onMouseDown:c=>c.stopPropagation(),children:[a("headerFooter.options")," ▾"]}),e&&b.jsxs("div",{style:RY,onMouseDown:c=>c.stopPropagation(),children:[b.jsx("button",{type:"button",style:ds,onClick:()=>{n(!1),s("PAGE")},onMouseOver:c=>{c.target.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:c=>{c.target.style.backgroundColor="transparent"},children:a("headerFooter.insertPageNumber")}),b.jsx("button",{type:"button",style:ds,onClick:()=>{n(!1),s("NUMPAGES")},onMouseOver:c=>{c.target.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:c=>{c.target.style.backgroundColor="transparent"},children:a("headerFooter.insertTotalPages")}),b.jsx("div",{style:{borderTop:"1px solid var(--doc-border-light)",margin:"4px 0"}}),o&&b.jsx("button",{type:"button",style:ds,onClick:()=>{n(!1),o()},onMouseOver:c=>{c.target.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:c=>{c.target.style.backgroundColor="transparent"},children:a("headerFooter.remove",{label:t.toLowerCase()})}),b.jsx("button",{type:"button",style:ds,onClick:()=>{n(!1),i()},onMouseOver:c=>{c.target.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:c=>{c.target.style.backgroundColor="transparent"},children:a("headerFooter.closeEditing",{label:t.toLowerCase()})})]})]})}var EY=YU;function FY({items:t,anchorPositions:e,renderedDomContext:n,pageWidth:r,zoom:o,editorContainerRef:i,onExpandedItemChange:l,activeItemId:a}){let{t:s}=Re(),c=a??null,d=S.useRef(c);d.current=c;let[u,f]=S.useState(!1),h=S.useRef(new Map),p=S.useRef(new Map),m=S.useRef(new Set),y=S.useRef(null),w=S.useRef(new Map),C=S.useRef(new Map),[g,v]=S.useState(0),k=S.useMemo(()=>EY(t,e,n,o,h.current,p.current),[t,e,n,o,g]),x=k.length>0,T=S.useMemo(()=>{let F=new Map;for(let E of k)F.set(E.item.id,E.y);return F},[k]);S.useEffect(()=>{for(let F of k)m.current.add(F.item.id)},[k]);let $=S.useCallback(()=>{let F=!1;for(let[E,R]of w.current){let N=R.offsetHeight;h.current.get(E)!==N&&(h.current.set(E,N),F=!0)}F&&v(E=>E+1)},[]);S.useEffect(()=>{let F=requestAnimationFrame($),E=setTimeout(()=>{$(),f(!0)},400);return()=>{cancelAnimationFrame(F),clearTimeout(E)}},[t.length,$]),S.useEffect(()=>{let F=i?.current;if(!F)return;let E=new ResizeObserver(()=>{requestAnimationFrame(()=>v(R=>R+1))});return E.observe(F),()=>E.disconnect()},[i]),S.useEffect(()=>{let F=requestAnimationFrame($);return()=>cancelAnimationFrame(F)},[c,$]),S.useEffect(()=>{if(!c)return;let F=w.current.get(c);if(!F){let N=requestAnimationFrame(()=>v(B=>B+1));return()=>cancelAnimationFrame(N)}let E,R=new ResizeObserver(()=>{cancelAnimationFrame(E),E=requestAnimationFrame(()=>{h.current.set(c,F.offsetHeight),v(N=>N+1)})});return R.observe(F),()=>{cancelAnimationFrame(E),R.disconnect()}},[c]);let M=S.useCallback(F=>{let E=C.current.get(F);return E||(E=R=>{R?(w.current.set(F,R),h.current.set(F,R.offsetHeight)):(w.current.delete(F),h.current.delete(F))},C.current.set(F,E)),E},[]),I=S.useCallback(F=>{l?.(d.current===F?null:F)},[l]);return t.length===0?null:b.jsx("aside",{ref:y,className:"docx-unified-sidebar",role:"complementary","aria-label":s("sidebar.ariaLabel"),style:{position:"absolute",top:0,left:`calc(50% - ${mc}px + ${r*o/2+k$}px)`,width:v$,fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,backgroundColor:"transparent",overflowY:"visible",overflowX:"visible",opacity:x?1:0,transition:"opacity 0.15s ease"},onMouseDown:F=>F.stopPropagation(),children:b.jsx("div",{style:{position:"relative"},children:t.map(F=>{let E=T.get(F.id),R=c===F.id,N=!m.current.has(F.id)&&E!==void 0,B=x&&!T.has(F.id),j=x?E!==void 0?{position:"absolute",top:E,left:0,right:0,opacity:1}:{position:"absolute",top:0,left:0,right:0,opacity:0,visibility:"hidden"}:{marginBottom:6},O=B?"none":N||F.isTemporary?"opacity 0.2s ease":u?"opacity 0.2s ease, top 0.15s ease":"none";return b.jsx("div",{style:{...j,transition:O},children:F.render({isExpanded:R,onToggleExpand:()=>I(F.id),measureRef:M(F.id)})},F.id)})})})}function AY({comments:t,anchorPositions:e,zoom:n,pageWidth:r,sidebarOpen:o,resolvedCommentIds:i,onMarkerClick:l}){let{t:a}=Re(),s=t.filter(c=>c.parentId==null).map(c=>{let d=i.has(c.id);if(!d&&o||d&&o)return null;let u=e.get(`comment-${c.id}`);return u==null?null:{comment:c,isResolved:d,y:u}}).filter(Boolean);return s.length===0?null:b.jsx("div",{className:"docx-comment-margin-markers",style:{position:"absolute",top:0,left:`calc(50% + ${r*n/2+6}px)`,zIndex:30,pointerEvents:"none"},onMouseDown:c=>c.stopPropagation(),children:s.map(({comment:c,isResolved:d,y:u})=>b.jsx("button",{onClick:()=>l(c.id),title:a(d?"commentMarkers.resolvedComment":"commentMarkers.comment"),style:{position:"absolute",top:u*n,left:0,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:4,background:"transparent",cursor:"pointer",pointerEvents:"auto",color:"var(--doc-text-muted)",padding:0,fontFamily:"inherit"},onMouseOver:f=>{f.currentTarget.style.opacity="0.7"},onMouseOut:f=>{f.currentTarget.style.opacity="1"},children:b.jsx(we,{name:d?"chat_bubble_check":"chat_bubble_outline",size:18})},c.id))})}function DY({pagedEditorRef:t,hfEditorRef:e,scrollContainerRef:n,editorContentRef:r,document:o,theme:i,initialSectionProperties:l,finalSectionProperties:a,headerContent:s,footerContent:c,firstPageHeaderContent:d,firstPageFooterContent:u,hfEditPosition:f,setHfEditPosition:h,hfEditIsFirstPage:p,onHeaderFooterDoubleClick:m,onHeaderFooterSave:y,onRemoveHeaderFooter:w,onBodyClick:C,getHfTargetElement:g,zoom:v,readOnly:k,extensionManager:x,externalPlugins:T,onDocumentChange:$,onSelectionChange:M,onPagedSelectionChange:I,onReady:F,onEditorViewReady:E,onRenderedDomContextReady:R,pluginOverlays:N,onHyperlinkClick:B,hyperlinkPopupData:j,onHyperlinkPopupNavigate:O,onHyperlinkPopupCopy:z,onHyperlinkPopupEdit:W,onHyperlinkPopupRemove:q,onHyperlinkPopupClose:Q,onContextMenu:X,sidebarOpen:se,sidebarItems:ie,anchorPositions:ce,onAnchorPositionsChange:Y,pluginRenderedDomContext:V,pageWidthPx:Z,expandedSidebarItem:K,setExpandedSidebarItem:ee,comments:G,resolvedCommentIds:te,resolvedIdsForRender:A,setShowCommentsSidebar:P,onTotalPagesChange:_,floatingCommentBtn:H,isAddingComment:le,setCommentSelectionRange:ue,setAddCommentYPosition:ve,setIsAddingComment:Pe,setFloatingCommentBtn:be,isSuggesting:pe=!1,author:Fe="User",onHfTransaction:Ae}){let yt=f?p?f==="header"?d:u:f==="header"?s:c:null,[Me,Ue]=S.useState(null),[Lt,Sn]=S.useState([]),vt=S.useCallback(Ee=>{let Se=window.document.querySelector(".paged-editor__pages")?.parentElement;if(!Se)return Ee;let De=Se.getBoundingClientRect();return{...Ee,top:Ee.top-De.top+Se.scrollTop,left:Ee.left-De.left+Se.scrollLeft}},[]),Tt=S.useCallback(Ee=>{if(!f){Ue(null),Sn([]);return}let Se=nH(Ee,f);Ue(Se?vt(Se):null),Sn(rH(Ee,f).map(vt));let De=window.document.querySelector(".paged-editor__pages");De&&Pk(De,Ee.state,{scope:f})},[f,vt]);return S.useEffect(()=>{if(!f){Ue(null),Sn([]),Ua();return}let Ee=()=>{let ct=e.current?.getView();ct&&Tt(ct)},Se=window.document.querySelector(".paged-editor__pages"),De=()=>{Ua(),Ee()};Se?.addEventListener("painter:painted",De);let et=requestAnimationFrame(Ee),qe=()=>Ee();return window.addEventListener("resize",qe),()=>{cancelAnimationFrame(et),Se?.removeEventListener("painter:painted",De),window.removeEventListener("resize",qe),Ua()}},[f,e,Tt]),b.jsxs(b.Fragment,{children:[b.jsx(IY,{ref:t,document:o,styles:o?.package.styles,theme:o?.package.theme||i,sectionProperties:l,finalSectionProperties:a,headerContent:s,footerContent:c,firstPageHeaderContent:d,firstPageFooterContent:u,onHeaderFooterDoubleClick:m,hfEditMode:f,onBodyClick:C,isSuggesting:pe,author:Fe,onHfTransaction:(Ee,Se,De)=>{let et=window.document.querySelector(".paged-editor__pages"),qe=!1,ct=()=>{qe||(qe=!0,Ua(),Tt(Se))};et?.addEventListener("painter:painted",ct,{once:!0}),requestAnimationFrame(()=>{qe||(et?.removeEventListener("painter:painted",ct),ct())}),M(FS(Se.state)),Ae?.(Ee,Se,De)},zoom:v,readOnly:k,extensionManager:x,onDocumentChange:$,onSelectionChange:I,externalPlugins:T,onReady:Ee=>{F(Ee);let Se=Ee.getView();Se&&E?.(Se)},onRenderedDomContextReady:R,pluginOverlays:N,onHyperlinkClick:B,hyperlinkPopupData:j,onHyperlinkPopupNavigate:O,onHyperlinkPopupCopy:z,onHyperlinkPopupEdit:W,onHyperlinkPopupRemove:q,onHyperlinkPopupClose:Q,onContextMenu:X,commentsSidebarOpen:se,onAnchorPositionsChange:Y,onTotalPagesChange:_,resolvedCommentIds:A,scrollContainerRef:n,sidebarOverlay:b.jsxs(b.Fragment,{children:[ie.length>0&&b.jsx(FY,{items:ie,anchorPositions:ce,renderedDomContext:V??null,pageWidth:Z,zoom:v,editorContainerRef:n,onExpandedItemChange:ee,activeItemId:K}),b.jsx(AY,{comments:G,anchorPositions:ce,zoom:v,pageWidth:Z,sidebarOpen:se,resolvedCommentIds:te,onMarkerClick:()=>P(!0)})]})}),H!=null&&!le&&!k&&b.jsx(Qo,{content:"Add comment",side:"bottom",delayMs:300,children:b.jsx("button",{type:"button",onMouseDown:Ee=>{Ee.preventDefault(),Ee.stopPropagation();let Se=t.current?.getView();if(Se){let{from:De,to:et}=Se.state.selection;if(De!==et){ue({from:De,to:et});let qe=Se.state.schema.marks.comment.create({commentId:Yl}),ct=Se.state.tr.addMark(De,et,qe);ct.setSelection(ye.create(ct.doc,et)),Se.dispatch(ct)}}ve(H.top),P(!0),Pe(!0),be(null)},style:{position:"absolute",top:H.top,left:H.left,transform:"translate(-50%, -50%)",zIndex:50,width:28,height:28,borderRadius:6,border:"1px solid var(--doc-focus-ring)",backgroundColor:"var(--doc-surface)",color:"var(--doc-primary)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px var(--doc-shadow)",transition:"background-color 0.15s ease, box-shadow 0.15s ease"},onMouseOver:Ee=>{Ee.currentTarget.style.backgroundColor="var(--doc-primary-light)",Ee.currentTarget.style.boxShadow="0 1px 4px var(--doc-focus-ring)"},onMouseOut:Ee=>{Ee.currentTarget.style.backgroundColor="var(--doc-surface)",Ee.currentTarget.style.boxShadow="0 1px 3px var(--doc-shadow)"},children:b.jsx(we,{name:"add_comment",size:16})})}),f&&(Me||Lt.length>0)&&(()=>{let Ee=window.document.querySelector(".paged-editor__pages"),Se=Ee?.parentElement;return!Ee||!Se?null:Ql.createPortal(b.jsxs(b.Fragment,{children:[Me&&Lt.length===0&&b.jsx(b.Fragment,{children:b.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:Me.top,left:Me.left,width:2,height:Me.height,background:"#4285f4",pointerEvents:"none",zIndex:11,animation:"hf-caret-blink 1.06s steps(1) infinite"}})}),Lt.map((De,et)=>b.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:De.top,left:De.left,width:De.width,height:De.height,background:"rgba(66, 133, 244, 0.25)",pointerEvents:"none",zIndex:10}},`hf-sel-${et}-${De.top}-${De.left}`))]}),Se)})(),f&&yt&&(()=>{let Ee=g(f),Se=r.current;if(!Ee||!Se)return null;let De=t.current?.getHfPmView(yt)??null;return b.jsx(PY,{ref:e,headerFooter:yt,position:f,view:De,targetElement:Ee,parentElement:Se,onSave:y,onClose:()=>{h(null),Ue(null)},onRemove:w})})()]})}var $u=".layout-sdt-widget, .layout-inline-sdt-widget";function US(t){let e=/^sdt@(\d+)$/.exec(t??"");return e?Number(e[1]):null}function NY(t){if(t==null||t==="")return null;let e=Number(t);return Number.isFinite(e)?e:null}function LY(t){let e=US(t.dataset.sdtGroupId)??NY(t.dataset.sdtPos),n=t.dataset.sdtTag;return e!=null?n?{pos:e,tag:n}:{pos:e}:n?{tag:n}:null}function BY(t,e){return nd(t.state.doc,{tag:e})[0]}function OY(t,e){return e.pos!=null?nd(t.state.doc).find(n=>n.pos===e.pos):e.tag?BY(t,e.tag):void 0}function jY({containerRef:t,getView:e}){let[n,r]=S.useState(null),o=S.useRef(null),i=S.useCallback((s,c)=>{let d=e();if(d){try{let u=s.pos!=null?RK(d.state,s.pos,c):s.tag?DS(d.state,{tag:s.tag},c):null;if(!u)return;d.dispatch(u),d.focus()}catch{}r(null)}},[e]);S.useEffect(()=>{let s=t.current;if(!s)return;let c=p=>{let m=e(),y=p.dataset.sdtWidget,w=LY(p);if(!m||!y||!w)return;let C=OY(m,w),g=p.getBoundingClientRect();y==="checkbox"?i(w,{kind:"checkbox",checked:!C?.checked}):y==="dropdown"?r({kind:"dropdown",target:w,items:C?.listItems??[],current:C?.text??"",rect:g}):y==="date"&&r({kind:"date",target:w,current:C?.dateValue??"",rect:g})},d=p=>{let m=e(),y=US(p.dataset.sdtGroupId);if(!(!m||y==null))try{let w=p.dataset.sdtRepeat==="add"?NK(m.state,y):LK(m.state,y);m.dispatch(w),m.focus()}catch{}},u=p=>{let m=p.target;(m?.closest?.($u)||m?.closest?.(".layout-sdt-repeat-btn"))&&p.preventDefault()},f=p=>{let m=p.target?.closest?.(".layout-sdt-repeat-btn");if(m){p.preventDefault(),p.stopPropagation(),d(m);return}let y=p.target?.closest?.($u);y&&(p.preventDefault(),p.stopPropagation(),c(y))},h=p=>{if(p.key!=="Enter"&&p.key!==" ")return;let m=p.target?.closest?.($u);m&&(p.preventDefault(),c(m))};return s.addEventListener("mousedown",u),s.addEventListener("click",f),s.addEventListener("keydown",h),()=>{s.removeEventListener("mousedown",u),s.removeEventListener("click",f),s.removeEventListener("keydown",h)}},[t,e,i]),S.useEffect(()=>{if(!n)return;let s=d=>{o.current?.contains(d.target)||r(null)},c=d=>{d.key==="Escape"&&r(null)};return document.addEventListener("mousedown",s),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",c)}},[n]),S.useEffect(()=>{if(n?.kind!=="dropdown")return;let s=o.current?.querySelectorAll(".layout-sdt-widget-option");s?.length&&([...s].find(c=>c.getAttribute("aria-selected")==="true")??s[0]).focus()},[n]);let l=s=>{if(s.key!=="ArrowDown"&&s.key!=="ArrowUp")return;let c=[...o.current?.querySelectorAll(".layout-sdt-widget-option")??[]];if(!c.length)return;s.preventDefault();let d=c.indexOf(document.activeElement),u=s.key==="ArrowDown"?(d+1)%c.length:(d-1+c.length)%c.length;c[u].focus()};if(!n)return null;let a={position:"fixed",top:n.rect.bottom+2,left:n.rect.left,zIndex:1e3};return b.jsx("div",{ref:o,className:"layout-sdt-widget-popup",style:a,role:n.kind==="dropdown"?"listbox":void 0,onKeyDown:l,onMouseDown:s=>s.preventDefault(),children:n.kind==="dropdown"?n.items.length===0?b.jsx("div",{className:"layout-sdt-widget-empty",children:"No options"}):n.items.map(s=>{let c=s.displayText===n.current;return b.jsx("button",{type:"button",role:"option","aria-selected":c,className:`layout-sdt-widget-option${c?" is-selected":""}`,onClick:()=>i(n.target,{kind:"dropdown",value:s.value}),children:s.displayText},s.value)}):b.jsx("input",{type:"date",className:"layout-sdt-widget-date",autoFocus:!0,defaultValue:n.current,onChange:s=>{s.target.value&&i(n.target,{kind:"date",date:s.target.value})}})})}function zY({commentsLoadedRef:t,trackedChangesLoadedRef:e,setComments:n,setHeadingInfos:r,setShowCommentsSidebar:o,setIsAddingComment:i,setCommentSelectionRange:l,setAddCommentYPosition:a,setFloatingCommentBtn:s,setHfEditPosition:c,setHfEditIsFirstPage:d,setAnchorPositions:u,clearFindReplaceMatches:f,cleanOrphanedCommentsTimerRef:h}){return{resetForNewDocument:S.useCallback(()=>{t.current=!1,e.current=!1,n([]),r([]),o(!1),i(!1),l(null),a(null),s(null),c(null),d(!1),u(HS),f(),h.current&&(clearTimeout(h.current),h.current=null)},[t,e,n,r,o,i,l,a,s,c,d,u,f,h])}}var HY=S.createContext(null);function _Y({children:t}){let e=S.useMemo(()=>new wq,[]),n=S.useSyncExternalStore(e.subscribe,e.getSnapshot),r=S.useCallback((c,d)=>{e.showError(c,d)},[e]),o=S.useCallback((c,d)=>{e.showWarning(c,d)},[e]),i=S.useCallback((c,d)=>{e.showInfo(c,d)},[e]),l=S.useCallback(c=>{e.dismiss(c)},[e]),a=S.useCallback(()=>{e.clearAll()},[e]),s=S.useMemo(()=>({notifications:n.notifications,showError:r,showWarning:o,showInfo:i,dismissNotification:l,clearNotifications:a}),[n.notifications,r,o,i,l,a]);return b.jsxs(HY.Provider,{value:s,children:[t,b.jsx(WY,{notifications:n.notifications,onDismiss:l})]})}function WY({notifications:t,onDismiss:e}){let n=t.filter(r=>!r.dismissed);return n.length===0?null:b.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=>b.jsx(VY,{notification:r,onDismiss:()=>e(r.id)},r.id))})}function VY({notification:t,onDismiss:e}){let{t:n}=Re(),[r,o]=S.useState(!1),i=(p=>{switch(p){case"error":return{bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case"warning":return{bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case"info":return{bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(t.severity),l={background:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},a={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:i.icon,flexShrink:0},c={flex:1,minWidth:0},d={color:i.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},u={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:i.text,maxHeight:"200px",overflow:"auto"},f={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},h=p=>{switch(p){case"error":return b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[b.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case"warning":return b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[b.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),b.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case"info":return b.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[b.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),b.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return b.jsxs("div",{className:`docx-notification-toast docx-notification-${t.severity}`,style:l,children:[b.jsx("style",{children:`
125
+ @keyframes slideIn {
126
+ from {
127
+ opacity: 0;
128
+ transform: translateX(100%);
129
+ }
130
+ to {
131
+ opacity: 1;
132
+ transform: translateX(0);
133
+ }
134
+ }
135
+ `}),b.jsxs("div",{style:a,children:[b.jsx("span",{style:s,children:h(t.severity)}),b.jsxs("div",{style:c,children:[b.jsx("div",{style:d,children:t.message}),t.details&&b.jsxs(b.Fragment,{children:[b.jsx("button",{type:"button",onClick:()=>o(!r),style:{...f,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(r?"errors.hideDetails":"errors.showDetails")}),r&&b.jsx("div",{style:u,children:t.details})]})]}),b.jsx("button",{type:"button",onClick:e,style:f,title:n("common.dismiss"),children:b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:b.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var qY=class extends S.Component{constructor(t){super(t),N6(this,"resetError",()=>{this.setState({hasError:!1,error:null,errorInfo:null})}),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,e){this.setState({errorInfo:e}),console.error("ErrorBoundary caught an error:",t,e),this.props.onError&&this.props.onError(t,e)}render(){if(this.state.hasError){let{fallback:t,showDetails:e=!0}=this.props,{error:n,errorInfo:r}=this.state;return t?typeof t=="function"?t(n,this.resetError):t:b.jsx(ZY,{error:n,errorInfo:r,showDetails:e,onReset:this.resetError})}return this.props.children}};function ZY({error:t,errorInfo:e,showDetails:n,onReset:r}){let{t:o}=Re(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},l={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"},c={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"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return b.jsxs("div",{className:"docx-error-fallback",style:i,children:[b.jsx("div",{style:l,children:b.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[b.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),b.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),b.jsx("h2",{style:a,children:o("errors.somethingWentWrong")}),b.jsx("p",{style:s,children:o("errors.errorDescription")}),n&&b.jsxs("div",{style:c,children:[b.jsx("strong",{children:o("errors.errorLabel")})," ",t.message,e&&b.jsxs(b.Fragment,{children:[`
136
+
137
+ `,b.jsx("strong",{children:o("errors.componentStack")}),e.componentStack]})]}),b.jsx("button",{type:"button",onClick:r,style:d,children:o("errors.tryAgain")})]})}var KY=15840,yb=1440,UY=1440,XY=567,Jl=20,GY="var(--doc-text-muted)",YY="var(--doc-text-subtle)",JY="var(--doc-primary)",QY="var(--doc-primary)",eJ="var(--doc-primary-hover)";function tJ({sectionProps:t,zoom:e=1,editable:n=!1,onTopMarginChange:r,onBottomMarginChange:o,unit:i="inch",className:l="",style:a}){let{t:s}=Re(),[c,d]=S.useState(null),[u,f]=S.useState(null),h=S.useRef(null),p=t?.pageHeight??KY,m=t?.marginTop??yb,y=t?.marginBottom??yb,w=ut(p)*e,C=ut(m)*e,g=ut(y)*e,v=S.useCallback((M,I)=>{n&&(M.preventDefault(),d(I))},[n]),k=S.useCallback(M=>{if(!c||!h.current)return;let I=h.current.getBoundingClientRect(),F=M.clientY-I.top,E=qb(F/e);if(c==="topMargin"){let R=p-y-720,N=Math.max(0,Math.min(E,R));r?.(Math.round(N))}else if(c==="bottomMargin"){let R=p-E,N=p-m-720,B=Math.max(0,Math.min(R,N));o?.(Math.round(B))}},[c,e,p,m,y,r,o]),x=S.useCallback(()=>{d(null)},[]);S.useEffect(()=>{if(c)return document.addEventListener("mousemove",k),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",x)}},[c,k,x]);let T=rJ(p,e,i),$={position:"relative",width:Jl,height:rt(w),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:c?"ns-resize":"default",...a};return b.jsxs("div",{ref:h,className:`docx-vertical-ruler ${l}`,style:$,role:"slider","aria-label":s("ruler.vertical"),"aria-orientation":"vertical",children:[b.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:T.map((M,I)=>b.jsx(nJ,{tick:M},I))}),b.jsx(bb,{type:"topMargin",position:C,editable:n,isDragging:c==="topMargin",isHovered:u==="topMargin",onMouseEnter:()=>f("topMargin"),onMouseLeave:()=>f(null),onMouseDown:M=>v(M,"topMargin")}),b.jsx(bb,{type:"bottomMargin",position:w-g,editable:n,isDragging:c==="bottomMargin",isHovered:u==="bottomMargin",onMouseEnter:()=>f("bottomMargin"),onMouseLeave:()=>f(null),onMouseDown:M=>v(M,"bottomMargin")})]})}function nJ({tick:t}){let e={position:"absolute",top:rt(t.position),right:0,height:1,width:t.width,backgroundColor:YY},n={position:"absolute",top:rt(t.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:GY,fontFamily:"sans-serif",whiteSpace:"nowrap"};return b.jsxs(b.Fragment,{children:[b.jsx("div",{style:e}),t.label&&b.jsx("div",{style:n,children:t.label})]})}function bb({type:t,position:e,editable:n,isDragging:r,isHovered:o,onMouseEnter:i,onMouseLeave:l,onMouseDown:a}){let{t:s}=Re(),c=r?eJ:o?QY:JY,d={position:"absolute",top:rt(e-5),right:0,width:Jl,height:10,cursor:n?"ns-resize":"default",zIndex:r?10:1},u={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${c}`,transition:"border-right-color 0.1s"};return b.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${t}`,style:d,onMouseEnter:i,onMouseLeave:l,onMouseDown:a,role:"slider","aria-label":s(t==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:b.jsx("div",{style:u})})}function rJ(t,e,n){let r=[];if(n==="inch"){let o=UY/8,i=Math.ceil(t/o);for(let l=0;l<=i;l++){let a=l*o;if(a>t)break;let s=ut(a)*e;if(l%8===0){let c=l/8;r.push({position:s,width:10,label:c>0?String(c):void 0})}else l%4===0?r.push({position:s,width:6}):l%2===0?r.push({position:s,width:4}):r.push({position:s,width:2})}}else{let o=XY/10,i=Math.ceil(t/o);for(let l=0;l<=i;l++){let a=l*o;if(a>t)break;let s=ut(a)*e;if(l%10===0){let c=l/10;r.push({position:s,width:10,label:c>0?String(c):void 0})}else l%5===0?r.push({position:s,width:6}):r.push({position:s,width:3})}}return r}var zh=12,Wf=240,XS=16,oJ=24,iJ=zh+Wf+XS,Hh=12,lJ=36,aJ=Hh+lJ+XS,sJ=ae.memo(function({headings:t,onHeadingClick:e,onClose:n,topOffset:r=0,scrollLeft:o=0,leftOffset:i=zh}){let{t:l}=Re(),[a,s]=S.useState(!1),c=t.length?Math.min(...t.map(d=>d.level)):0;return S.useEffect(()=>{requestAnimationFrame(()=>s(!0))},[]),b.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:i-o,bottom:0,width:Wf,paddingTop:oJ,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:a?"translateX(0)":`translateX(-${i+Wf}px)`,transition:"transform 0.15s ease-out"},onMouseDown:d=>d.stopPropagation(),children:[b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[b.jsx("button",{onClick:n,"aria-label":l("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:l("documentOutline.closeTitle"),children:b.jsx(we,{name:"arrow_back",size:20})}),b.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:l("documentOutline.title")})]}),b.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?b.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:l("documentOutline.noHeadings")}):t.map((d,u)=>b.jsx("div",{style:{marginLeft:(d.level-c)*16},children:b.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>e(d.pmPos),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:d.text,children:d.text})},`${d.pmPos}-${u}`))})]})});function cJ({onClick:t,topPx:e,scrollLeft:n=0,leftOffset:r=Hh}){let{t:o}=Re();return b.jsx("button",{className:"docx-outline-toggle",onClick:t,onMouseDown:i=>i.stopPropagation(),title:o("editor.showDocumentOutline"),"aria-label":o("editor.showDocumentOutline"),style:{position:"absolute",left:r-n,top:e,zIndex:ro.outline},children:b.jsx(we,{name:"format_list_bulleted",size:20})})}function dJ({currentPage:t,totalPages:e,visible:n}){let{t:r}=Re();return b.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:r("viewer.pageIndicator",{current:t,total:e})})}function uJ({agentPanel:t,closed:e,onClose:n}){let{t:r}=Re();return b.jsx(vX,{title:t.title??r("agentPanel.defaultTitle"),icon:t.icon,closeLabel:r("agentPanel.close"),resizeHandleLabel:r("agentPanel.resizeHandle"),defaultWidth:t.defaultWidth,minWidth:t.minWidth,maxWidth:t.maxWidth,onClose:n,closed:e,children:t.render({close:n})})}function fJ({i18n:t,isDark:e,onEditorError:n,containerRef:r,scrollContainerRef:o,editorContentRef:i,className:l,containerStyle:a,mainContentStyle:s,editorContainerStyle:c,showRuler:d,readOnlyProp:u,showOutline:f,showOutlineButton:h,sidebarOpen:p,minLayoutWidth:m,toolbarHeight:y,editorScrollLeft:w,expandedSidebarItem:C,trackedChanges:g,onScrollContainerMouseDown:v,onEditorBgMouseDown:k,onEditorContextMenu:x,horizontalRulerProps:T,verticalRulerProps:$,outlineProps:M,onToggleOutline:I,scrollPageInfo:F,agentPanel:E,agentPanelOpen:R,onAgentPanelClose:N,toolbar:B,pagedArea:j,overlays:O,dialogs:z,fileInputs:W}){return b.jsx(x$,{i18n:t,children:b.jsx(_Y,{children:b.jsx(qY,{onError:n,children:b.jsxs("div",{ref:r,className:We("ep-root docx-editor",e&&"dark",l),style:a,"data-testid":"docx-editor",children:[b.jsxs("div",{style:s,children:[b.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[B,b.jsxs("div",{ref:o,className:"docx-editor__scroll-container",style:c,onMouseDown:v,children:[d&&b.jsx("div",{className:"flex justify-center py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:ro.ruler,paddingLeft:20,paddingRight:20+(p?mc*2:0),minWidth:m,transition:"padding 0.2s ease"},children:b.jsx(k6,{...T})}),b.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:m},children:b.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:k,onContextMenu:x,children:[d&&!u&&b.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:ro.ruler,paddingTop:48},children:b.jsx(tJ,{...$})}),C&&C.startsWith("comment-")&&b.jsx("style",{children:`.paged-editor__pages [data-comment-id="${C.replace("comment-","")}"] { background-color: rgba(255, 212, 0, 0.35) !important; border-bottom: 2px solid rgba(255, 212, 0, 0.7) !important; }`}),C?.startsWith("tc-")&&(()=>{let q=C.split("-")[1],Q=g.find(X=>String(X.revisionId)===q)?.insertionRevisionId;return b.jsx("style",{children:`
138
+ .paged-editor__pages .docx-insertion[data-revision-id="${Q??q}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
139
+ .paged-editor__pages .docx-deletion[data-revision-id="${q}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
140
+ `})})(),j]})})]}),F.totalPages>1&&b.jsx(dJ,{currentPage:F.currentPage,totalPages:F.totalPages,visible:F.visible}),f&&b.jsx(sJ,{...M,leftOffset:zh+(d?Jl:0)}),h&&!f&&b.jsx(cJ,{onClick:I,topPx:y+(d?30:0)+48,scrollLeft:w,leftOffset:Hh+(d?Jl:0)})]}),E&&b.jsx(uJ,{agentPanel:E,closed:!R,onClose:N})]}),O,z,W]})})})})}var fc={background:"none",border:"none",cursor:"pointer",padding:4,color:"var(--doc-text-muted)",display:"flex",borderRadius:"50%"},GS={padding:"6px 16px",fontSize:14,border:"none",background:"none",color:"var(--doc-primary)",cursor:"pointer",fontWeight:500,fontFamily:"inherit"};function _h(t,e=32){return{width:e,height:e,borderRadius:"50%",backgroundColor:kX(t),color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:e===32?13:11,fontWeight:500,flexShrink:0}}function YS(t){return{padding:"6px 16px",fontSize:14,border:"none",borderRadius:20,background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"#fff":"var(--doc-text-subtle)",cursor:t?"pointer":"default",fontWeight:500,fontFamily:"inherit"}}function JS({replies:t,isExpanded:e}){let{t:n}=Re();if(t.length===0)return null;let r=e?t:t.slice(-1),o=e?0:t.length-1;return b.jsxs("div",{style:{marginTop:8},children:[o>0&&b.jsx("div",{style:{fontSize:12,fontWeight:500,color:"var(--doc-primary)",paddingTop:6,paddingBottom:6,borderTop:"1px solid var(--doc-border-light)"},children:n("comments.replyCount",{count:o})}),r.map(i=>b.jsxs("div",{style:{marginBottom:e?8:0,paddingTop:8,borderTop:"1px solid var(--doc-border-light)"},children:[b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[b.jsx("div",{style:_h(i.author||"U",28),children:jh(i.author||"U")}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--doc-text)"},children:i.author||n("comments.unknown")}),b.jsx("div",{style:{fontSize:11,color:"var(--doc-text-muted)"},children:Oh(i.date)})]})]}),b.jsx("div",{style:{fontSize:13,color:"var(--doc-text)",lineHeight:"20px",marginTop:4,...e?{}:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"}},children:zS(i.content)})]},i.id))]})}var pJ={width:"100%",border:"1px solid var(--doc-primary)",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",boxSizing:"border-box",color:"var(--doc-text)"},hJ={width:"100%",border:"1px solid var(--doc-border-light)",borderRadius:20,outline:"none",fontSize:14,padding:"8px 16px",fontFamily:"inherit",color:"var(--doc-text-subtle)",cursor:"text",backgroundColor:"var(--doc-surface)",boxSizing:"border-box"};function QS({onSubmit:t}){let[e,n]=S.useState(!1),[r,o]=S.useState(""),{t:i}=Re();if(!e)return b.jsx("div",{onClick:a=>a.stopPropagation(),style:{marginTop:12},children:b.jsx("input",{readOnly:!0,onMouseDown:a=>a.stopPropagation(),onClick:a=>{a.stopPropagation(),n(!0)},placeholder:i("comments.replyPlaceholder"),style:hJ})});let l=r.trim();return b.jsxs("div",{onClick:a=>a.stopPropagation(),style:{marginTop:12},children:[b.jsx("input",{ref:a=>a?.focus({preventScroll:!0}),type:"text",value:r,onChange:a=>o(a.target.value),onMouseDown:a=>a.stopPropagation(),onKeyDown:a=>{a.stopPropagation(),a.key==="Enter"&&(a.preventDefault(),l&&t(l),o(""),n(!1)),a.key==="Escape"&&(n(!1),o(""))},placeholder:i("comments.replyPlaceholder"),style:pJ}),b.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[b.jsx("button",{onClick:a=>{a.stopPropagation(),n(!1),o("")},style:GS,children:i("common.cancel")}),b.jsx("button",{onClick:a=>{a.stopPropagation(),l&&t(l),o(""),n(!1)},disabled:!l,style:YS(!!l),children:i("common.reply")})]})]})}var eT=CX,tT=SX;function mJ({comment:t,replies:e,isExpanded:n,onToggleExpand:r,measureRef:o,onReply:i,onResolve:l,onUnresolve:a,onDelete:s}){let[c,d]=S.useState(!1),{t:u}=Re();return b.jsxs("div",{ref:o,"data-comment-id":t.id,className:"docx-comment-card",onClick:r,onMouseDown:f=>f.stopPropagation(),style:{...n?tT:eT},children:[t.done&&b.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",marginBottom:8,fontSize:11,fontWeight:500,color:"var(--doc-success)",backgroundColor:"var(--doc-success-bg)",borderRadius:10},children:[b.jsx(we,{name:"check",size:12}),u("comments.resolved")]}),b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[b.jsx("div",{style:_h(t.author||"U"),children:jh(t.author||"U")}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--doc-text)"},children:t.author||u("comments.unknown")}),b.jsx("div",{style:{fontSize:11,color:"var(--doc-text-muted)"},children:Oh(t.date)})]}),n&&b.jsxs("div",{style:{display:"flex",gap:4,marginTop:2,position:"relative"},children:[b.jsx("button",{onClick:f=>{f.stopPropagation(),t.done?a?.(t.id):l?.(t.id)},title:t.done?u("comments.reopen"):u("comments.resolve"),style:fc,children:b.jsx(we,{name:t.done?"undo":"check",size:20})}),b.jsx("button",{onClick:f=>{f.stopPropagation(),d(!c)},title:u("comments.moreOptions"),style:fc,children:b.jsx(we,{name:"more_vert",size:20})}),c&&b.jsx("div",{onClick:f=>f.stopPropagation(),onMouseDown:f=>f.stopPropagation(),style:{position:"absolute",top:32,right:0,background:"var(--doc-surface)",borderRadius:8,boxShadow:"0 2px 6px var(--doc-shadow-strong), 0 1px 2px var(--doc-shadow)",zIndex:100,minWidth:120,padding:"4px 0"},children:b.jsx("button",{onClick:()=>{d(!1),s?.(t.id)},style:{display:"block",width:"100%",padding:"8px 16px",border:"none",background:"none",textAlign:"left",fontSize:14,color:"var(--doc-text)",cursor:"pointer",fontFamily:"inherit"},onMouseOver:f=>{f.target.style.backgroundColor="var(--doc-bg-hover)"},onMouseOut:f=>{f.target.style.backgroundColor="transparent"},children:u("common.delete")})})]})]}),b.jsx("div",{style:{fontSize:13,color:"var(--doc-text)",lineHeight:"20px",marginTop:6},children:zS(t.content)}),b.jsx(JS,{replies:e,isExpanded:n}),n&&!t.done&&b.jsx(QS,{onSubmit:f=>i?.(t.id,f)})]})}function gJ({change:t,replies:e,isExpanded:n,onToggleExpand:r,measureRef:o,onAccept:i,onReject:l,onAcceptById:a,onRejectById:s,onReply:c}){let{t:d}=Re(),u=t.author||d("trackedChanges.unknown"),f=()=>{let m=new Set([t.revisionId]);t.type==="replacement"&&t.insertionRevisionId!=null&&m.add(t.insertionRevisionId);for(let y of t.coalescedRevisionIds??[])m.add(y);return[...m]},h=m=>{if(m.stopPropagation(),a)for(let y of f())a(y);else i?.(t.from,t.to)},p=m=>{if(m.stopPropagation(),s)for(let y of f())s(y);else l?.(t.from,t.to)};return b.jsxs("div",{ref:o,className:"docx-tracked-change-card",onClick:()=>r(),onMouseDown:m=>m.stopPropagation(),style:n?tT:eT,children:[b.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10},children:[b.jsx("div",{style:_h(u),children:jh(u)}),b.jsxs("div",{style:{flex:1,minWidth:0},children:[b.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--doc-text)"},children:u}),t.date&&b.jsx("div",{style:{fontSize:11,color:"var(--doc-text-muted)"},children:Oh(t.date)})]}),n&&b.jsxs("div",{style:{display:"flex",gap:4,marginTop:2},children:[b.jsx("button",{onClick:h,title:d("common.accept"),style:fc,children:b.jsx(we,{name:"check",size:20})}),b.jsx("button",{onClick:p,title:d("common.reject"),style:fc,children:b.jsx(we,{name:"close",size:20})})]})]}),b.jsx("div",{style:{fontSize:13,lineHeight:"20px",color:"var(--doc-text)",marginTop:6},children:t.type==="replacement"?b.jsxs(b.Fragment,{children:[d("trackedChanges.replaced")," ",b.jsxs("span",{style:{color:"var(--doc-error)",fontWeight:500},children:['"',ci(t.deletedText||""),'"']})," ",d("trackedChanges.with")," ",b.jsxs("span",{style:{color:"var(--doc-success)",fontWeight:500},children:['"',ci(t.text),'"']})]}):t.type==="paragraphMarkInsertion"?b.jsxs(b.Fragment,{children:[d("revisions.paragraphMarkInserted"),t.text?b.jsxs(b.Fragment,{children:[": ",b.jsxs("span",{style:{color:"var(--doc-success)",fontWeight:500},children:['"',ci(t.text),'"']})]}):null]}):t.type==="paragraphMarkDeletion"?b.jsxs(b.Fragment,{children:[d("revisions.paragraphMarkDeleted"),t.text?b.jsxs(b.Fragment,{children:[": ",b.jsxs("span",{style:{color:"var(--doc-error)",fontWeight:500},children:['"',ci(t.text),'"']})]}):null]}):t.type==="paragraphPropertiesChanged"?b.jsxs(b.Fragment,{children:[d("revisions.paragraphPropertiesChanged"),t.text?b.jsxs(b.Fragment,{children:[": ",b.jsxs("span",{style:{color:"var(--doc-text-muted)",fontWeight:500},children:['"',ci(t.text),'"']})]}):null]}):t.type==="rowInserted"?b.jsx("span",{style:{color:"var(--doc-success)",fontWeight:500},children:d("revisions.rowInserted")}):t.type==="rowDeleted"?b.jsx("span",{style:{color:"var(--doc-error)",fontWeight:500},children:d("revisions.rowDeleted")}):t.type==="cellInserted"?b.jsx("span",{style:{color:"var(--doc-success)",fontWeight:500},children:d("revisions.cellInserted")}):t.type==="cellDeleted"?b.jsx("span",{style:{color:"var(--doc-error)",fontWeight:500},children:d("revisions.cellDeleted")}):t.type==="cellMerged"?b.jsx("span",{style:{color:"var(--doc-text-muted)",fontWeight:500},children:d("revisions.cellMerged")}):t.type==="rowPropertiesChanged"?b.jsx("span",{style:{color:"var(--doc-text-muted)"},children:d("revisions.rowPropertiesChanged")}):t.type==="cellPropertiesChanged"?b.jsx("span",{style:{color:"var(--doc-text-muted)"},children:d("revisions.cellPropertiesChanged")}):t.type==="tablePropertiesChanged"?b.jsx("span",{style:{color:"var(--doc-text-muted)"},children:d("revisions.tablePropertiesChanged")}):t.type==="tableInserted"?b.jsx("span",{style:{color:"var(--doc-success)",fontWeight:500},children:d("revisions.tableInserted")}):t.type==="tableDeleted"?b.jsx("span",{style:{color:"var(--doc-error)",fontWeight:500},children:d("revisions.tableDeleted")}):b.jsxs(b.Fragment,{children:[t.type==="insertion"?d("trackedChanges.added"):d("trackedChanges.deleted")," ",b.jsxs("span",{style:{color:t.type==="insertion"?"var(--doc-success)":"var(--doc-error)",fontWeight:500},children:['"',ci(t.text),'"']})]})}),b.jsx(JS,{replies:e,isExpanded:n}),n&&b.jsx(QS,{onSubmit:m=>c?.(t.revisionId,m)})]})}function yJ({measureRef:t,onSubmit:e,onCancel:n}){let[r,o]=S.useState(""),{t:i}=Re(),l=()=>{r.trim()&&(e?.(r.trim()),o(""))};return b.jsxs("div",{ref:t,onMouseDown:a=>a.stopPropagation(),style:{padding:12,borderRadius:8,backgroundColor:"var(--doc-surface)",boxShadow:"0 1px 3px var(--doc-shadow-strong), 0 4px 8px 3px var(--doc-shadow)",zIndex:50},children:[b.jsx("textarea",{ref:a=>a?.focus({preventScroll:!0}),value:r,onChange:a=>o(a.target.value),onMouseDown:a=>a.stopPropagation(),onKeyDown:a=>{a.stopPropagation(),a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),l()),a.key==="Escape"&&(n?.(),o(""))},placeholder:i("comments.addComment"),style:{width:"100%",border:"1px solid var(--doc-primary)",borderRadius:20,outline:"none",resize:"none",fontSize:14,lineHeight:"20px",padding:"8px 16px",fontFamily:"inherit",minHeight:40,boxSizing:"border-box",color:"var(--doc-text)"}}),b.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:8},children:[b.jsx("button",{onClick:()=>{n?.(),o("")},style:GS,children:i("common.cancel")}),b.jsx("button",{onClick:l,disabled:!r.trim(),style:YS(!!r.trim()),children:i("common.comment")})]})]})}function bJ({comment:t,measureRef:e,onToggleExpand:n}){return b.jsx("div",{ref:e,"data-comment-id":t.id,"data-comment-resolved":"true",onClick:n,onMouseDown:r=>r.stopPropagation(),style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"var(--doc-text-muted)",padding:2},onMouseOver:r=>{r.currentTarget.style.opacity="0.7"},onMouseOut:r=>{r.currentTarget.style.opacity="1"},children:b.jsx(we,{name:"chat_bubble_check",size:20})})}function wJ({comments:t,trackedChanges:e,callbacks:n,showResolved:r=!1,isAddingComment:o=!1,addCommentYPosition:i=null}){let l=S.useMemo(()=>t.filter(s=>!(s.parentId!=null||s.done&&!r)),[t,r]),a=S.useMemo(()=>{let s=new Map;for(let c of t)if(c.parentId!=null){let d=s.get(c.parentId);d?d.push(c):s.set(c.parentId,[c])}return s},[t]);return S.useMemo(()=>{let s=[];o&&i!=null&&s.push({id:"new-comment-input",anchorPos:0,fixedY:i,priority:-1e3,isTemporary:!0,estimatedHeight:120,render:c=>b.jsx(yJ,{...c,onSubmit:n.onAddComment,onCancel:n.onCancelAddComment})});for(let c of l){let d=a.get(c.id)??[];s.push({id:`comment-${c.id}`,anchorPos:0,anchorKey:`comment-${c.id}`,priority:0,estimatedHeight:c.done?28:80,render:u=>c.done&&!u.isExpanded?b.jsx(bJ,{...u,comment:c}):b.jsx(mJ,{...u,comment:c,replies:d,onReply:n.onCommentReply,onResolve:n.onCommentResolve,onUnresolve:n.onCommentUnresolve,onDelete:n.onCommentDelete})})}return e.forEach((c,d)=>{let u=a.get(c.revisionId)??[];s.push({id:`tc-${c.revisionId}-${d}`,anchorPos:c.from,anchorKey:`revision-${c.revisionId}`,priority:1,estimatedHeight:80,render:f=>b.jsx(gJ,{...f,change:c,replies:u,onAccept:n.onAcceptChange,onReject:n.onRejectChange,onAcceptById:n.onAcceptChangeById,onRejectById:n.onRejectChangeById,onReply:n.onTrackedChangeReply})})}),s},[l,e,a,n,o,i])}function xJ(){let{t}=Re();return b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:"20px",color:"var(--doc-text-muted)"},children:[b.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"}}),b.jsx("style",{children:`
141
+ @keyframes docx-spin {
142
+ to { transform: rotate(360deg); }
143
+ }
144
+ `}),b.jsx("div",{style:{fontSize:"14px"},children:t("errors.loadingDocument")})]})}function vJ(){let{t}=Re();return b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--doc-text-placeholder)"},children:[b.jsxs("svg",{width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[b.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),b.jsx("polyline",{points:"14 2 14 8 20 8"})]}),b.jsx("div",{style:{marginTop:"16px"},children:t("errors.noDocumentLoaded")})]})}function kJ({message:t}){let{t:e}=Re();return b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"20px",textAlign:"center"},children:[b.jsx("div",{style:{color:"var(--doc-error)",marginBottom:"16px"},children:b.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[b.jsx("circle",{cx:"12",cy:"12",r:"10"}),b.jsx("path",{d:"M12 8v4M12 16v.01"})]})}),b.jsx("h3",{style:{color:"var(--doc-error)",marginBottom:"8px"},children:e("errors.failedToLoad")}),b.jsx("p",{style:{color:"var(--doc-text-muted)",maxWidth:"400px"},children:t})]})}function CJ(t,e,n){S.useEffect(()=>{Q$(t)},[t]),S.useEffect(()=>q$(()=>e?.()),[e]);let r=S.useRef(n);S.useEffect(()=>{r.current=n},[n]),S.useEffect(()=>Z$(o=>r.current?.(o)),[])}var SJ=S.forwardRef(function({documentBuffer:t,document:e,onSave:n,onOpen:r,author:o="User",onChange:i,onSelectionChange:l,onError:a,onFontsLoaded:s,colorMode:c="light",theme:d,showToolbar:u=!0,showFileOpen:f=!0,showHelpMenu:h=!0,showZoomControl:p=!0,showMarginGuides:m=!1,marginGuideColor:y,showRuler:w=!1,rulerUnit:C="inch",initialZoom:g=1,readOnly:v=!1,disableFindReplaceShortcuts:k=!1,toolbarExtra:x,className:T="",style:$,placeholder:M,loadingIndicator:I,showOutline:F=!1,showOutlineButton:E=!0,fontFamilies:R,fonts:N,watermarkPresets:B,printOptions:j,onPrint:O,onCopy:z,onCut:W,onPaste:q,mode:Q,onModeChange:X,onCommentAdd:se,onCommentResolve:ie,onCommentDelete:ce,onCommentReply:Y,comments:V,onCommentsChange:Z,commentsSidebarOpen:K,onCommentsSidebarOpenChange:ee,externalPlugins:G,externalContent:te=!1,onEditorViewReady:A,onRenderedDomContextReady:P,pluginOverlays:_,pluginSidebarItems:H,pluginRenderedDomContext:le,renderLogo:ue,documentName:ve,onDocumentNameChange:Pe,documentNameEditable:be=!0,renderTitleBarRight:pe,i18n:Fe,agentPanel:Ae},yt){let[Me,Ue]=S.useState({isLoading:!!t&&!te,parseError:null,zoom:g,selectionFormatting:{},paragraphIndentLeft:0,paragraphIndentRight:0,paragraphFirstLineIndent:0,paragraphHangingIndent:!1,paragraphTabs:null,pmTableContext:null,pmImageContext:null}),[Lt,Sn]=S.useState(oM);S.useEffect(()=>{if(c==="system")return lM(Sn)},[c]);let vt=iM(c,Lt),[Tt,Ee]=S.useState(null),[Se,De]=S.useState(!1),[et,qe]=NX(K,ee),ct=S.useRef(!1),[tt,ot]=S.useState(null),Ne=S.useRef(null),{comments:mt,setComments:$t,isAddingComment:lr,setIsAddingComment:lt,isAddingCommentRef:Pt,commentSelectionRange:me,setCommentSelectionRange:ze,addCommentYPosition:bt,setAddCommentYPosition:gt,floatingCommentBtn:Tn,setFloatingCommentBtn:dt,cleanOrphanedCommentsTimerRef:It,cleanOrphanedComments:Xt}=ZX({commentsProp:V,onCommentDelete:ce,onCommentsChange:Z,pagedEditorRef:Ne}),[qn,_t]=S.useState(null),[uo,qi]=S.useState(0),{entries:fo,commentToRevision:rd}=S.useMemo(()=>{let U=xl(qn),de=[...U.entries],xe=new Map(U.commentToRevision),Oe=Ne.current?.getHfPmViews?.();if(Oe)for(let[Je,Gt]of Oe.entries()){let Et=xl(Gt.state);for(let Fr of Et.entries)Fr.hfRid=Je,de.push(Fr);for(let[Fr,ni]of Et.commentToRevision.entries())xe.set(Fr,ni)}return{entries:de,commentToRevision:xe}},[qn,uo]),[od,ga]=S.useState(HS),[id,ld]=S.useState(Q??"editing"),Pr=Q??id,Zi=U=>{Q||ld(U),X?.(U)},ke=v||Pr==="viewing",[at,nt]=S.useState(!1),nn=Ae?.open!==void 0,Fn=Ae?nn?!!Ae.open:at:!1,po=S.useCallback(U=>{Ae?.onOpenChange?.(U),nn||nt(U)},[Ae,nn]),ya=S.useRef(new Set),ba=S.useRef(new Set),wt=$q(e||null,{maxEntries:100,groupingInterval:500,enableKeyboardShortcuts:!0}),nT=S.useMemo(()=>{let U=new Qp(Jp());return U.buildSchema(),U.initializeRuntime(),U},[]),Wh=S.useMemo(()=>ES(Pr==="suggesting",o),[]),rT=S.useMemo(()=>[Wh,...G??[]],[Wh,G]),ad=S.useRef(null),sd=S.useRef(null),wa=S.useRef(null),Vh=S.useRef(null),xa=S.useRef(null),ti=S.useRef(null),[oT,iT]=S.useState([]),{showOutline:cd,setShowOutline:qh,showOutlineRef:lT,outlineHeadings:aT,setHeadingInfos:dd,toolbarHeight:Zh,toolbarRefCallback:sT,editorScrollLeft:Kh}=TX({showOutlineProp:F,pagedEditorRef:Ne,scrollContainerRef:ti,isLoading:Me.isLoading}),Ki=S.useRef(wt.state);Ki.current=wt.state;let Uh=S.useRef({style:"single",size:4,color:{rgb:"000000"}}),Xh=S.useRef(null),va=S.useCallback(U=>{let de=Xh.current;if(de&&de.styles===U)return de.resolver;let xe=ia(U);return Xh.current={styles:U,resolver:xe},xe},[]),{getActiveEditorView:ar,focusActiveEditor:ho,undoActiveEditor:cT,redoActiveEditor:dT}=GX({hfEditPosition:Tt,hfEditorRef:ad,pagedEditorRef:Ne}),Ui=jq(),ka=aS(),Gh=S.useRef(!1),Yh=S.useRef(!1),Xi=S.useRef(EU()),{resetForNewDocument:uT}=zY({commentsLoadedRef:Gh,trackedChangesLoadedRef:Yh,setComments:$t,setHeadingInfos:dd,setShowCommentsSidebar:qe,setIsAddingComment:lt,setCommentSelectionRange:ze,setAddCommentYPosition:gt,setFloatingCommentBtn:dt,setHfEditPosition:Ee,setHfEditIsFirstPage:De,setAnchorPositions:ga,clearFindReplaceMatches:S.useCallback(()=>Ui.setMatches([],0),[Ui]),cleanOrphanedCommentsTimerRef:It}),{loadParsedDocument:fT,loadBuffer:Jh}=zX({documentBuffer:t,initialDocument:e,externalContent:te,history:wt,agentRef:sd,pagedEditorRef:Ne,setLoadingState:S.useCallback(U=>{Ue(de=>({...de,isLoading:U.isLoading,parseError:U.parseError}))},[]),setComments:$t,setShowCommentsSidebar:qe,onError:a,resetForNewDocument:uT,commentsLoadedRef:Gh,commentIdAllocator:Xi.current,setDocumentFonts:iT}),{imageInputRef:pT,docxInputRef:hT,handleSave:mT,handleDirectPrint:Qh,handleDownloadDocument:gT,handleOpenDocument:em,handleDocxFileChange:yT,handleInsertImageClick:bT,handleImageFileChange:wT}=IX({agentRef:sd,pagedEditorRef:Ne,containerRef:wa,comments:mt,documentName:ve,onSave:n,onOpen:r,onError:a,onPrint:O,onDocumentNameChange:Pe,loadBuffer:Jh,getActiveEditorView:ar,focusActiveEditor:ho});S.useEffect(()=>{if(Me.isLoading||!wt.state)return;let U=Ne.current?.getView();U&&_t(U.state)},[Me.isLoading,wt.state]),KX({commentToRevision:rd,setComments:$t,pmState:qn,isLoading:Me.isLoading,trackedChangesCount:fo.length,setShowCommentsSidebar:qe,trackedChangesLoadedRef:Yh}),CJ(N,s,a),S.useEffect(()=>{let U=Ne.current?.getView();U&&PS(Pr==="suggesting",U.state,U.dispatch,o)},[Pr,o]);let Ca=S.useCallback(U=>(wt.push(U),U),[wt]),ud=S.useCallback(U=>{Ca(U),i?.(U);for(let xe of ya.current)try{xe(U)}catch(Oe){console.error("contentChange subscriber threw:",Oe)}if(lT.current){let xe=Ne.current?.getView();xe&&dd(Rs(xe.state.doc))}let de=Ne.current?.getView();de&&_t(de.state),It.current&&clearTimeout(It.current),It.current=setTimeout(Xt,300)},[i,Ca,Xt]),{recomputeFloatingCommentBtn:xT}=XX({pagedEditorRef:Ne,scrollContainerRef:ti,editorContentRef:xa,isAddingCommentRef:Pt,setFloatingCommentBtn:dt,readOnly:ke,isLoading:Me.isLoading,zoom:Me.zoom}),{handleSelectionChange:Sa}=UX({getActiveEditorView:ar,lastSelectionRef:Vh,borderSpecRef:Uh,theme:d,historyStateRef:Ki,getCachedStyleResolver:va,setFloatingCommentBtn:dt,applySelectionDelta:S.useCallback(U=>Ue(de=>({...de,...U})),[]),recomputeFloatingCommentBtn:xT,onSelectionChange:l,selectionChangeSubscribersRef:ba}),tm=Cq({document:wt.state,onChange:ud,onSelectionChange:U=>{}});$X({pagedEditorRef:Ne,disableFindReplaceShortcuts:k,showFileOpen:f,onOpenDocument:em,findReplace:Ui,hyperlinkDialog:ka,tableSelection:tm});let vT=S.useCallback(()=>{qh(U=>{if(!U){let de=Ne.current?.getView();de&&dd(Rs(de.state.doc))}return!U})},[]),kT=S.useCallback(U=>{Ne.current?.scrollToPosition(U),Ne.current?.setSelection(U+1),Ne.current?.focus()},[]),{imagePositionOpen:CT,setImagePositionOpen:ST,imagePropsOpen:TT,setImagePropsOpen:$T,footnotePropsOpen:IT,setFootnotePropsOpen:MT,handleImageWrapType:RT,handleImageTransform:PT,handleApplyImagePosition:ET,handleOpenImageProperties:nm,handleApplyImageProperties:FT,handleApplyFootnoteProperties:AT}=AX({document:wt.state,pmImageContext:Me.pmImageContext,zoom:Me.zoom,getActiveEditorView:ar,focusActiveEditor:ho,pushDocument:Ca}),{tablePropsOpen:DT,setTablePropsOpen:NT,splitCellDialogState:LT,openSplitCellDialog:BT,handleTableAction:OT,handleSplitCellDialogClose:jT,handleSplitCellDialogApply:zT}=OX({getActiveEditorView:ar,focusActiveEditor:ho,tableSelection:tm,borderSpecRef:Uh,historyStateRef:Ki,getCachedStyleResolver:va}),{handleFormat:HT,handleInsertTable:_T,handleInsertPageBreak:WT,handleInsertSectionBreakNextPage:VT,handleInsertSectionBreakContinuous:qT,handleInsertTOC:ZT}=FX({getActiveEditorView:ar,focusActiveEditor:ho,pagedEditorRef:Ne,lastSelectionRef:Vh,hyperlinkDialog:ka,historyStateRef:Ki,getCachedStyleResolver:va}),KT=S.useCallback(U=>{Ue(de=>({...de,zoom:U}))},[]),{hyperlinkPopupData:UT,handleHyperlinkSubmit:XT,handleHyperlinkRemove:GT,handleHyperlinkClick:YT,handleHyperlinkPopupNavigate:JT,handleHyperlinkPopupCopy:QT,handleHyperlinkPopupEdit:e2,handleHyperlinkPopupRemove:t2,handleHyperlinkPopupClose:n2}=PX({hyperlinkDialog:ka,getActiveEditorView:ar,focusActiveEditor:ho}),{contextMenu:r2,imageContextMenu:o2,handleEditorContextMenu:i2,handleContextMenu:l2,handleContextMenuClose:a2,handleImageWrapApply:s2,imageContextMenuTextActions:c2,contextMenuItems:d2,handleContextMenuAction:u2}=qX({getActiveEditorView:ar,focusActiveEditor:ho,openSplitCellDialog:BT,scrollContainerRef:ti,editorContentRef:xa,i18n:Fe,onAddComment:S.useCallback(({from:U,to:de,yPos:xe})=>{ze({from:U,to:de}),gt(xe),qe(!0),lt(!0),dt(null)},[])}),{showPageSetup:f2,setShowPageSetup:p2,handleOpenPageSetup:h2,handleLeftMarginChange:m2,handleRightMarginChange:g2,handleTopMarginChange:y2,handleBottomMarginChange:b2,handlePageSetupApply:w2,handleIndentLeftChange:x2,handleIndentRightChange:v2,handleFirstLineIndentChange:k2,handleTabStopRemove:C2}=MX({document:wt.state,readOnly:ke,handleDocumentChange:ud,getActiveEditorView:ar}),{showWatermark:S2,setShowWatermark:T2,handleOpenWatermark:$2,currentWatermark:I2,handleWatermarkApply:M2}=RX({readOnly:ke,getBodyEditorView:()=>Ne.current?.getView()}),{scrollPageInfo:rm,setScrollPageInfo:R2}=YX({scrollContainerRef:ti,pagedEditorRef:Ne}),P2=S.useCallback(U=>{a?.(U)},[a]),{findResultRef:E2,handleFind:F2,handleFindNext:A2,handleFindPrevious:D2,handleReplace:N2,handleReplaceAll:L2}=EX({pagedEditorRef:Ne,findReplace:Ui});DX({ref:yt,agentRef:sd,document:wt.state,historyStateRef:Ki,pagedEditorRef:Ne,handleSave:mT,handleDirectPrint:Qh,zoom:Me.zoom,setZoom:U=>Ue(de=>({...de,zoom:U})),scrollPageInfo:rm,loadParsedDocument:fT,loadBuffer:Jh,comments:mt,setComments:$t,setShowCommentsSidebar:qe,contentChangeSubscribersRef:ya,selectionChangeSubscribersRef:ba,getCachedStyleResolver:va,commentIdAllocator:Xi.current});let fd=S.useMemo(()=>VX(wt.state),[wt.state]),om=wt.state?.package.document?.finalSectionProperties,{headerContent:B2,footerContent:O2,firstPageHeaderContent:j2,firstPageFooterContent:z2,handleHeaderFooterDoubleClick:H2,handleHeaderFooterSave:_2,handleBodyClick:W2,handleRemoveHeaderFooter:V2,getHfTargetElement:q2}=jX({document:wt.state,pushDocument:Ca,hfEditorRef:ad,containerRef:wa,initialSectionProperties:fd,finalSectionProperties:om,hfEditPosition:Tt,setHfEditPosition:Ee,hfEditIsFirstPage:Se,setHfEditIsFirstPage:De}),Ta={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)",...$},Z2={display:"flex",flex:1,minHeight:0,minWidth:0,flexDirection:"row"},$n=S.useRef({});$n.current={onCommentReply:(U,de)=>{let xe=El(Xi.current,de,o,U),Oe=mt.find(Je=>Je.id===U);$t(Je=>[...Je,xe]),Oe&&Y?.(xe,Oe)},onCommentResolve:U=>{let de=mt.find(xe=>xe.id===U);$t(xe=>xe.map(Oe=>Oe.id===U?{...Oe,done:!0}:Oe)),tt===`comment-${U}`&&ot(null),de&&ie?.({...de,done:!0})},onCommentUnresolve:U=>{$t(de=>de.map(xe=>xe.id===U?{...xe,done:void 0}:xe))},onCommentDelete:U=>{let de=mt.find(Oe=>Oe.id===U);$t(Oe=>Oe.filter(Je=>Je.id!==U&&Je.parentId!==U));let xe=Ne.current?.getView();if(xe){let Oe=xe.state.schema.marks.comment?.create({commentId:U});if(Oe){let Je=xe.state.tr.removeMark(0,xe.state.doc.content.size,Oe);Je.docChanged&&xe.dispatch(Je)}}de&&ce?.(de)},onAddComment:U=>{let de=El(Xi.current,U,o),xe=Ne.current?.getView();if(xe&&me){let{from:Oe,to:Je}=me,Gt=xe.state.schema.marks.comment.create({commentId:Yl}),Et=xe.state.schema.marks.comment.create({commentId:de.id}),Fr=xe.state.tr.removeMark(Oe,Je,Gt).addMark(Oe,Je,Et);xe.dispatch(Fr)}$t(Oe=>[...Oe,de]),lt(!1),ze(null),gt(null),se?.(de)},onCancelAddComment:()=>{let U=Ne.current?.getView();if(U&&me){let{from:de,to:xe}=me,Oe=U.state.schema.marks.comment.create({commentId:Yl});U.dispatch(U.state.tr.removeMark(de,xe,Oe))}lt(!1),ze(null),gt(null)},onAcceptChange:(U,de)=>{let xe=Ne.current?.getView();xe&&MZ(U,de)(xe.state,xe.dispatch)},onRejectChange:(U,de)=>{let xe=Ne.current?.getView();xe&&RZ(U,de)(xe.state,xe.dispatch)},onAcceptChangeById:U=>{let de=Ne.current?.getHfPmViews?.(),xe=null;if(de)for(let Je of de.values()){let{entries:Gt}=xl(Je.state);if(Gt.some(Et=>Et.revisionId===U||Et.insertionRevisionId===U||Et.coalescedRevisionIds?.includes(U))){xe=Je;break}}let Oe=xe||Ne.current?.getView();Oe&&(OZ(U)(Oe.state,Oe.dispatch),xe&&qi(Je=>Je+1))},onRejectChangeById:U=>{let de=Ne.current?.getHfPmViews?.(),xe=null;if(de)for(let Je of de.values()){let{entries:Gt}=xl(Je.state);if(Gt.some(Et=>Et.revisionId===U||Et.insertionRevisionId===U||Et.coalescedRevisionIds?.includes(U))){xe=Je;break}}let Oe=xe||Ne.current?.getView();Oe&&(jZ(U)(Oe.state,Oe.dispatch),xe&&qi(Je=>Je+1))},onTrackedChangeReply:(U,de)=>{$t(xe=>[...xe,El(Xi.current,de,o,U)])}};let K2=S.useMemo(()=>({onCommentReply:(...U)=>$n.current.onCommentReply?.(...U),onCommentResolve:(...U)=>$n.current.onCommentResolve?.(...U),onCommentUnresolve:(...U)=>$n.current.onCommentUnresolve?.(...U),onCommentDelete:(...U)=>$n.current.onCommentDelete?.(...U),onAddComment:(...U)=>$n.current.onAddComment?.(...U),onCancelAddComment:(...U)=>$n.current.onCancelAddComment?.(...U),onAcceptChange:(...U)=>$n.current.onAcceptChange?.(...U),onRejectChange:(...U)=>$n.current.onRejectChange?.(...U),onAcceptChangeById:(...U)=>$n.current.onAcceptChangeById?.(...U),onRejectChangeById:(...U)=>$n.current.onRejectChangeById?.(...U),onTrackedChangeReply:(...U)=>$n.current.onTrackedChangeReply?.(...U)}),[]),mo=wJ({comments:mt,trackedChanges:fo,callbacks:K2,showResolved:et,isAddingComment:et?lr:!1,addCommentYPosition:bt}),im=S.useMemo(()=>{let U=[];return et&&U.push(...mo),H&&U.push(...H),U},[et,mo,H]),pd=S.useMemo(()=>{let U=new Map;return fo.forEach((de,xe)=>{de.type==="replacement"&&de.insertionRevisionId!=null&&U.set(String(de.insertionRevisionId),`tc-${de.revisionId}-${xe}`)}),U},[fo]),hd=im.length>0,U2=(cd?iJ:E?aJ:20)+(w&&(cd||E)?Jl:0),md=wt.state?.package?.document,lm=[md?.finalSectionProperties?.pageWidth,...md?.sections?.map(U=>U.properties?.pageWidth)??[]].filter(U=>typeof U=="number"&&U>0),X2=lm.length?Math.round(Math.max(...lm)/15):816,G2=2*U2+X2+(hd?mc*2:0),am=md?.finalSectionProperties?.pageWidth,Y2=am?Math.round(am/15):816,Er=S.useMemo(()=>{let U=new Set;for(let de of mt)de.done&&de.parentId==null&&U.add(de.id);return U},[mt]),J2=S.useCallback(()=>{let U=Ne.current?.getView();if(!U){Sa(null);return}let de=FS(U.state);Sa(de);let xe=U.state.selection.$from,Oe=[...U.state.storedMarks??[],...xe.nodeAfter?.marks??[],...xe.nodeBefore?.marks??[],...xe.marks()],Je=null;for(let Gt of Oe){if(Gt.type.name==="comment"&&Gt.attrs.commentId!=null){let Et=Gt.attrs.commentId;if(Er.has(Et))continue;Je=`comment-${Et}`;break}if((Gt.type.name==="insertion"||Gt.type.name==="deletion")&&Gt.attrs.revisionId!=null){let Et=String(Gt.attrs.revisionId),Fr=`tc-${Et}-`,ni=mo.find($a=>$a.id.startsWith(Fr));if(!ni&&pd){let $a=pd.get(Et);$a&&(ni=mo.find(t$=>t$.id===$a))}if(ni){Je=ni.id;break}}}Je&&qe(!0),ot(Je)},[Sa,Er,mo,pd]);S.useEffect(()=>{ct.current||mo.length!==0&&(ct.current=!0,qe(!0))},[mo]);let Q2=S.useMemo(()=>{if(!tt?.startsWith("comment-"))return Er;let U=parseInt(tt.slice(8),10);if(isNaN(U)||!Er.has(U))return Er;let de=new Set(Er);return de.delete(U),de},[Er,tt]),e$={flex:1,minHeight:0,minWidth:0,overflow:"auto",position:"relative",overflowAnchor:"none"};return Me.isLoading?b.jsx("div",{className:We("ep-root docx-editor docx-editor-loading",vt&&"dark",T),style:Ta,"data-testid":"docx-editor",children:I||b.jsx(xJ,{})}):Me.parseError?b.jsx("div",{className:We("ep-root docx-editor docx-editor-error",vt&&"dark",T),style:Ta,"data-testid":"docx-editor",children:b.jsx(kJ,{message:Me.parseError})}):wt.state?b.jsx(fJ,{i18n:Fe,isDark:vt,onEditorError:P2,containerRef:wa,scrollContainerRef:ti,editorContentRef:xa,className:T,containerStyle:Ta,mainContentStyle:Z2,editorContainerStyle:e$,showRuler:w,readOnlyProp:v,showOutline:cd,showOutlineButton:E,sidebarOpen:hd,minLayoutWidth:G2,toolbarHeight:Zh,editorScrollLeft:Kh,expandedSidebarItem:tt,trackedChanges:fo,onScrollContainerMouseDown:U=>{let de=U.target;de.closest(".paged-editor__pages")||de.closest(".docx-unified-sidebar")||de.closest(".docx-comment-margin-markers")||ot(null)},onEditorBgMouseDown:U=>{U.target===U.currentTarget&&(U.preventDefault(),Ne.current?.focus())},onEditorContextMenu:i2,horizontalRulerProps:{sectionProps:wt.state?.package.document?.finalSectionProperties,zoom:Me.zoom,unit:C,editable:!ke,onLeftMarginChange:m2,onRightMarginChange:g2,indentLeft:Me.paragraphIndentLeft,indentRight:Me.paragraphIndentRight,onIndentLeftChange:x2,onIndentRightChange:v2,firstLineIndent:Me.paragraphFirstLineIndent,hangingIndent:Me.paragraphHangingIndent,onFirstLineIndentChange:k2,tabStops:Me.paragraphTabs,onTabStopRemove:C2},verticalRulerProps:{sectionProps:fd,zoom:Me.zoom,unit:C,editable:!ke,onTopMarginChange:y2,onBottomMarginChange:b2},outlineProps:{headings:aT,onHeadingClick:kT,onClose:()=>qh(!1),topOffset:Zh,scrollLeft:Kh},onToggleOutline:vT,scrollPageInfo:rm,agentPanel:Ae,agentPanelOpen:Fn,onAgentPanelClose:()=>po(!1),toolbar:u&&!v?b.jsx(fG,{toolbarRefCallback:sT,agentPanelOpen:Fn,setAgentPanelOpen:po,document:wt.state,theme:d,pmState:qn,selectionFormatting:Me.selectionFormatting,tableContext:Me.pmTableContext,imageContext:Me.pmImageContext,readOnly:ke,editingMode:Pr,setEditingMode:Zi,setShowCommentsSidebar:qe,setExpandedSidebarItem:ot,showCommentsSidebar:et,agentPanel:Ae,renderLogo:ue,documentName:ve,onDocumentNameChange:Pe,documentNameEditable:be,renderTitleBarRight:pe,toolbarExtra:x,fontFamilies:R,documentFonts:oT,zoom:Me.zoom,showZoomControl:p,onFormat:HT,onUndo:cT,onRedo:dT,onPrint:Qh,showFileOpen:f,showHelpMenu:h,onOpen:em,onSave:gT,onZoomChange:KT,onRefocusEditor:ho,onInsertTable:_T,onInsertImage:bT,onInsertPageBreak:WT,onInsertSectionBreakNextPage:VT,onInsertSectionBreakContinuous:qT,onInsertTOC:ZT,onImageWrapType:RT,onImageTransform:PT,onOpenImageProperties:nm,onPageSetup:h2,onWatermark:$2,onTableAction:OT}):null,pagedArea:b.jsxs(b.Fragment,{children:[b.jsx(DY,{pagedEditorRef:Ne,hfEditorRef:ad,scrollContainerRef:ti,editorContentRef:xa,document:wt.state,theme:d,initialSectionProperties:fd,finalSectionProperties:om,headerContent:B2,footerContent:O2,firstPageHeaderContent:j2,firstPageFooterContent:z2,hfEditPosition:Tt,setHfEditPosition:Ee,hfEditIsFirstPage:Se,onHeaderFooterDoubleClick:H2,onHeaderFooterSave:_2,onRemoveHeaderFooter:V2,onBodyClick:W2,getHfTargetElement:q2,zoom:Me.zoom,readOnly:ke,isSuggesting:Pr==="suggesting",author:o,onHfTransaction:(U,de,xe)=>{xe&&qi(Oe=>Oe+1)},extensionManager:nT,externalPlugins:rT,onDocumentChange:ud,onSelectionChange:Sa,onPagedSelectionChange:J2,onReady:U=>{let de=U.getView();de&&_t(de.state)},onEditorViewReady:A,onRenderedDomContextReady:P,pluginOverlays:_,onHyperlinkClick:YT,hyperlinkPopupData:UT,onHyperlinkPopupNavigate:JT,onHyperlinkPopupCopy:QT,onHyperlinkPopupEdit:e2,onHyperlinkPopupRemove:t2,onHyperlinkPopupClose:n2,onContextMenu:l2,sidebarOpen:hd,sidebarItems:im,anchorPositions:od,onAnchorPositionsChange:ga,pluginRenderedDomContext:le,pageWidthPx:Y2,expandedSidebarItem:tt,setExpandedSidebarItem:ot,comments:mt,resolvedCommentIds:Er,resolvedIdsForRender:Q2,setShowCommentsSidebar:qe,onTotalPagesChange:U=>{R2(de=>de.totalPages===U?de:{...de,totalPages:U})},floatingCommentBtn:Tn,isAddingComment:lr,setCommentSelectionRange:ze,setAddCommentYPosition:gt,setIsAddingComment:lt,setFloatingCommentBtn:dt}),!ke&&b.jsx(jY,{containerRef:wa,getView:()=>Ne.current?.getView()??null})]}),overlays:b.jsx(JX,{contextMenu:r2,contextMenuItems:d2,onContextMenuAction:u2,onContextMenuClose:a2,imageContextMenu:o2,onImageWrapApply:s2,imageContextMenuTextActions:c2,onOpenImageProperties:nm,readOnly:ke}),dialogs:b.jsx(sG,{findReplace:Ui,findResultRef:E2,onFind:F2,onFindNext:A2,onFindPrevious:D2,onReplace:N2,onReplaceAll:L2,hyperlinkDialog:ka,onHyperlinkSubmit:XT,onHyperlinkRemove:GT,tablePropsOpen:DT,onTablePropsClose:()=>NT(!1),pmTableContext:Me.pmTableContext,getActiveEditorView:ar,splitCellDialogState:LT,onSplitCellDialogClose:jT,onSplitCellDialogApply:zT,imagePositionOpen:CT,onImagePositionClose:()=>ST(!1),onApplyImagePosition:ET,imagePropsOpen:TT,onImagePropsClose:()=>$T(!1),onApplyImageProperties:FT,pmImageContext:Me.pmImageContext,showPageSetup:f2,onPageSetupClose:()=>p2(!1),onPageSetupApply:w2,showWatermark:S2,onWatermarkClose:()=>T2(!1),onWatermarkApply:M2,currentWatermark:I2,watermarkPresets:B,document:wt.state,footnotePropsOpen:IT,onFootnotePropsClose:()=>MT(!1),onApplyFootnoteProperties:AT}),fileInputs:b.jsxs(b.Fragment,{children:[b.jsx("input",{ref:pT,type:"file",accept:"image/*",style:{display:"none"},onChange:wT}),b.jsx("input",{ref:hT,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:yT})]})}):b.jsx("div",{className:We("ep-root docx-editor docx-editor-empty",vt&&"dark",T),style:Ta,"data-testid":"docx-editor",children:M||b.jsx(vJ,{})})}),TJ={_lang:"fr",common:{cancel:"Annuler",insert:"Insérer",apply:"Appliquer",close:"Fermer",delete:"Supprimer",update:"Mettre à jour",save:"Enregistrer",retry:"Réessayer",send:"Envoyer",edit:"Modifier",comment:"Commenter",reply:"Répondre",accept:"Accepter",reject:"Refuser",dismiss:"Ignorer",change:"Modifier",clear:"Effacer",px:"px",closeDialog:"Fermer la boîte de dialogue"},toolbar:{ariaLabel:"Outils de mise en forme",file:"Fichier",format:"Format",insert:"Insérer",open:"Ouvrir",openShortcut:"Ctrl+O",save:"Enregistrer",saveShortcut:"Ctrl+S",print:"Imprimer",printShortcut:"Ctrl+P",pageSetup:"Mise en page",leftToRight:"Texte de gauche à droite",rightToLeft:"Texte de droite à gauche",image:"Image",table:"Tableau",pageBreak:"Saut de page",tableOfContents:"Table des matières",symbol:"Symbole",help:"Aide",reportIssue:"Signaler un bug",watermark:"Filigrane",break:null,sectionBreakContinuous:null,sectionBreakNextPage:null},formattingBar:{groups:{history:"Historique",zoom:"Zoom",styles:"Styles",font:"Police",textFormatting:"Mise en forme du texte",script:"Attributs",alignment:"Alignement",listFormatting:"Format de liste",image:"Image",table:"Tableau"},undo:"Annuler",undoShortcut:"Annuler (Ctrl+Z)",redo:"Rétablir",redoShortcut:"Rétablir (Ctrl+Y)",bold:"Gras",boldShortcut:"Gras (Ctrl+B)",italic:"Italique",italicShortcut:"Italique (Ctrl+I)",underline:"Souligné",underlineShortcut:"Souligné (Ctrl+U)",strikethrough:"Barré",fontColor:"Couleur du texte",highlightColor:"Couleur de surbrillance",insertLink:"Insérer un lien",insertLinkShortcut:"Insérer un lien (Ctrl+K)",superscript:"Exposant",superscriptShortcut:"Exposant (Ctrl+Maj+=)",subscript:"Indice",subscriptShortcut:"Indice (Ctrl+=)",imageProperties:"Propriétés de l'image",imagePropertiesShortcut:"Propriétés de l'image... (description, bordure)",clearFormatting:"Effacer la mise en forme",commentsAndChanges:null,moreItems:null},alignment:{alignLeft:"Aligner à gauche",alignLeftShortcut:"Ctrl+L",center:"Centrer",centerShortcut:"Ctrl+E",alignRight:"Aligner à droite",alignRightShortcut:"Ctrl+R",justify:"Justifier",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"Format de liste",typeAriaLabel:"Type de liste",indentationAriaLabel:"Retrait de la liste",bulletList:"Liste à puces",numberedList:"Liste numérotée",decreaseIndent:"Décaler à gauche",increaseIndent:"Décaler à droite"},lineSpacing:{single:"Simple",double:"Double",lineSpacingTitle:"Interligne : {label}",paragraphSpacing:"Espacement des paragraphes",label:null},styles:{selectAriaLabel:"Sélectionner le type de paragraphe",normalText:"Texte normal",title:"Titre",subtitle:"Sous-titre",heading1:"Titre 1",heading2:"Titre 2",heading3:"Titre 3"},font:{selectAriaLabel:"Sélectionner une police",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace",other:null,documentFonts:null},fontSize:{decrease:"Diminuer la taille de la police",increase:"Augmenter la taille de la police",label:"Police",listLabel:"Tailles de police"},zoom:{ariaLabel:"Zoom : {label}",zoomIn:null,zoomLevel:null,zoomOut:null},colorPicker:{ariaLabel:"Choisir la couleur {type}",highlightColors:"Couleurs de surbrillance",customColor:"Couleur personnalisée",noColor:"Aucune couleur",automatic:"Automatique",themeColors:"Couleurs du thème",standardColors:"Couleurs standards",colors:{black:"Noir",darkRed:"Rouge foncé",red:"Rouge",orange:"Orange",yellow:"Jaune",darkYellow:"Jaune foncé",green:"Vert",darkGreen:"Vert foncé",teal:"Bleu canard",darkTeal:"Bleu canard foncé",blue:"Bleu",darkBlue:"Bleu foncé",purple:"Violet",darkPurple:"Violet foncé",brown:"Marron",grey50:"Gris 50%",grey25:"Gris 25%",grey10:"Gris 10%",white:"Blanc",lightRed:"Rouge clair",lightOrange:"Orange clair",lightYellow:"Jaune clair",lightGreen:"Vert clair",lightBlue:"Bleu clair",lightPurple:"Violet clair",pink:"Rose",rose:"Rose vif",gold:"Doré",aqua:"Aigue-marine",lavender:"Lavande",silver:"Argent",darkOrange:"Orange foncé",darkGray:"Gris foncé",gray:"Gris",cyan:"Cyan",magenta:"Magenta",paleGreen:"Vert pâle",lightCyan:"Cyan clair",skyBlue:"Bleu ciel",lightBlue2:"Bleu clair 2",lightMagenta:"Magenta clair",brightGreen:"Vert vif",violet:"Violet"}},dialogs:{findReplace:{titleFind:"Rechercher",titleFindReplace:"Rechercher et remplacer",findLabel:"Rechercher :",findPlaceholder:"Texte à rechercher...",findAriaLabel:"Rechercher du texte",findPrevious:"Précédent",findPreviousTitle:"Précédent (Maj+Entrée)",findNext:"Suivant",findNextTitle:"Suivant (Entrée)",matchCount:"{current} sur {total}",noResults:"Aucun résultat trouvé",replaceLabel:"Remplacer :",replacePlaceholder:"Texte de remplacement...",replaceAriaLabel:"Remplacer le texte",replaceButton:"Remplacer",replaceCurrentTitle:"Remplacer cette occurrence",replaceAllButton:"Tout remplacer",replaceAllTitle:"Remplacer toutes les occurrences",matchCase:"Respecter la casse",wholeWords:"Mot entier",matchesFound:"{total} occurrences",toggleReplace:"+ Remplacer"},hyperlink:{titleEdit:"Modifier le lien",titleInsert:"Insérer un lien",tabWebAddress:"Adresse web",tabBookmark:"Signet",urlLabel:"URL",urlPlaceholder:"https://exemple.com",urlHint:"Adresse web, e-mail (mailto:) ou téléphone (tel:)",bookmarkLabel:"Signet",bookmarkPlaceholder:"Sélectionner un signet...",displayTextLabel:"Texte à afficher",displayTextPlaceholder:"Texte facultatif",displayTextHint:"Laisser vide pour utiliser le texte sélectionné",tooltipLabel:"Info-bulle (facultatif)",tooltipPlaceholder:"Texte au survol",removeLink:"Supprimer le lien",invalidUrl:"Veuillez entrer une URL valide",urlRequired:"L'URL est requise"},insertTable:{title:"Insérer un tableau",hoverToSelect:"Survoler pour choisir la taille",tableSize:"Tableau {cols} x {rows}",orSpecifySize:"ou spécifier la taille",rowsLabel:"Lignes :",columnsLabel:"Colonnes :",insertButton:"Insérer le tableau",sizeSelector:"Sélectionner la taille",columnWidthLabel:"Largeur des colonnes",fixedWidth:"Fixe",autofit:"Ajuster au contenu",tableStyleLabel:"Style de tableau",validationHint:"Lignes : {minRows}-{maxRows}, Colonnes : {minCols}-{maxCols}"},splitCell:{title:"Fractionner la cellule",description:"Définissez le nombre de lignes et de colonnes pour fractionner la cellule.",rowsLabel:"Lignes :",columnsLabel:"Colonnes :",currentMinimum:"Minimum requis : {rows} ligne(s) x {cols} colonne(s)",minValue:"Utilisez au moins {rows} ligne(s) et {cols} colonne(s).",notOneByOne:"Choisissez au moins deux cellules de destination."},insertImage:{title:"Insérer une image",uploadAriaLabel:"Cliquez ou glissez pour importer",uploadText:"Cliquez ou glissez-déposez une image ici",uploadSubtext:"PNG, JPG, GIF jusqu'à 10 Mo",dimensions:"Dimensions",widthLabel:"Largeur :",heightLabel:"Hauteur :",aspectRatioLocked:"Proportions verrouillées",aspectRatioUnlocked:"Proportions déverrouillées",altTextLabel:"Texte alternatif (facultatif)",altTextPlaceholder:"Description pour l'accessibilité",insertButton:"Insérer l'image",invalidFile:"Veuillez sélectionner un fichier valide",fileTooLarge:"Image trop volumineuse (max 10 Mo)",readFailed:"Échec de lecture du fichier",loadFailed:"Échec de chargement de l'image",preview:"Aperçu"},insertSymbol:{title:"Insérer un symbole",searchPlaceholder:"Rechercher (nom ou unicode)...",noResultsEmpty:"Aucun symbole trouvé",noResults:'Aucun symbole pour "{query}"',decimal:"Décimal : {value}",recent:"Récents :",categories:{common:"Courants",arrows:"Flèches",math:"Maths",greek:"Grec",shapes:"Formes",punctuation:"Ponctuation",currency:"Devises",music:"Musique",emoji:"Émojis"}},imageProperties:{title:"Propriétés de l'image",altText:"Texte alternatif",altTextPlaceholder:"Décrivez l'image pour l'accessibilité...",border:"Bordure",width:"Largeur",style:"Style",color:"Couleur",preview:"Aperçu",textWrapping:"Retour à la ligne automatique",dimensions:"Dimensions",widthLabel:"Largeur :",heightLabel:"Hauteur :",lockAspectRatio:"Verrouiller les proportions",wrapOptions:{inline:"En ligne avec le texte",wrapRight:"Aligner l'image à gauche",wrapLeft:"Aligner l'image à droite",topAndBottom:"Haut et bas",behind:"Derrière le texte",inFront:"Devant le texte"},borderStyles:{solid:"Plein",dashed:"Tirés",dotted:"Pointillés",double:"Double",groove:"Rainure",ridge:"Relief",inset:"Incrusté",outset:"Excrusté"}},imagePosition:{title:"Position de l'image",horizontal:"Horizontale",vertical:"Verticale",position:"Position",alignment:"Alignement",offset:"Décalage",offsetPx:"Décalage (px)",align:"Aligner",relativeTo:"Par rapport à",alignOptions:{left:"Gauche",center:"Centrer",right:"Droite",top:"Haut",bottom:"Bas"},relativeOptions:{page:"Page",column:"Colonne",margin:"Marge",character:"Caractère",paragraph:"Paragraphe",line:"Ligne"}},pageSetup:{title:"Disposition de la page",pageSize:"Taille de la page",sizeLabel:"Taille",custom:"Personnalisée",orientation:"Orientation",portrait:"Portrait",landscape:"Paysage",margins:"MARGES",top:"Haut",bottom:"Bas",left:"Gauche",right:"Droite",pageSizes:{letter:"Lettre US (21,6 × 27,9 cm)",a4:"A4 (21 × 29,7 cm)",legal:"Standard juridique US (21,6 × 35,6 cm)",a3:"A3 (29,7 × 42 cm)",a5:"A5 (14,8 × 21 cm)",b5:"B5 (17,6 × 25 cm)",executive:"Executive (18,4 × 26,7 cm)"}},tableProperties:{title:"Propriétés du tableau",widthType:"Type de largeur",widthLabel:"Largeur",alignmentLabel:"Alignement",widthTypes:{auto:"Automatique",fixed:"Fixe (twips)",percentage:"Pourcentage"},units:{fiftiethsPercent:"(50e de %)",twips:"tw"},alignOptions:{left:"Gauche",center:"Centrer",right:"Droite"}},pasteSpecial:{title:"Collage spécial",keepFormatting:"Conserver la mise en forme source",keepFormattingDescription:"Coller avec la mise en forme d'origine",keepFormattingShortcut:"Ctrl+V",plainText:"Coller comme texte brut",plainTextDescription:"Coller sans aucune mise en forme",plainTextShortcut:"Ctrl+Maj+V",readingClipboard:"Lecture du presse-papiers...",preview:"Aperçu",noContent:"Aucun contenu disponible à coller",clipboardError:"Impossible de lire le presse-papiers. Veuillez utiliser Ctrl+V pour coller."},footnoteProperties:{title:"Propriétés des notes de bas de page et de fin",footnotes:"Notes de bas de page",endnotes:"Notes de fin",position:"Position",numberFormat:"Format de numérotation",startAt:"À partir de",numbering:"Numérotation",footnotePositions:{bottomOfPage:"Bas de page",belowText:"Sous le texte"},endnotePositions:{endOfDocument:"Fin du document",endOfSection:"Fin de la section"},numberingOptions:{continuous:"Continue",restartSection:"Recommencer à chaque section",restartPage:"Recommencer à chaque page"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, †, ‡, ..."}},keyboardShortcuts:{ariaLabel:"Raccourcis clavier",searchPlaceholder:"Rechercher des raccourcis...",categories:{editing:"Modification",formatting:"Mise en forme",navigation:"Navigation",clipboard:"Presse-papiers",selection:"Sélection",view:"Affichage",file:"Fichier",other:"Autre"},shortcuts:{save:"Enregistrer",saveDescription:"Enregistrer le document",print:"Imprimer",printDescription:"Imprimer le document",undo:"Annuler",undoDescription:"Annuler la dernière action",redo:"Rétablir",redoDescription:"Rétablir la dernière action",delete:"Supprimer",deleteDescription:"Supprimer le texte sélectionné",find:"Rechercher",findDescription:"Rechercher du texte dans le document",findReplace:"Rechercher et remplacer",findReplaceDescription:"Rechercher et remplacer du texte",cut:"Couper",cutDescription:"Couper le texte sélectionné",copy:"Copier",copyDescription:"Copier le texte sélectionné",paste:"Coller",pasteDescription:"Coller depuis le presse-papiers",pastePlainText:"Coller comme texte brut",pastePlainTextDescription:"Coller sans mise en forme",bold:"Gras",boldDescription:"Activer/désactiver le gras",italic:"Italique",italicDescription:"Activer/désactiver l'italique",underline:"Souligné",underlineDescription:"Activer/désactiver le texte souligné",strikethrough:"Barré",strikethroughDescription:"Activer/désactiver le texte barré",subscript:"Indice",subscriptDescription:"Activer/désactiver l'indice",superscript:"Exposant",superscriptDescription:"Activer/désactiver l'exposant",alignLeft:"Aligner à gauche",alignLeftDescription:"Aligner le paragraphe à gauche",alignCenter:"Centrer",alignCenterDescription:"Centrer le paragraphe",alignRight:"Aligner à droite",alignRightDescription:"Aligner le paragraphe à droite",justify:"Justifier",justifyDescription:"Justifier le paragraphe",increaseIndent:"Augmenter le décalage",increaseIndentDescription:"Augmenter l'indentation du paragraphe",decreaseIndent:"Diminuer le décalage",decreaseIndentDescription:"Réduire l'indentation du paragraphe",selectAll:"Tout sélectionner",selectAllDescription:"Sélectionner tout le contenu",selectWord:"Sélectionner le mot",selectWordDescription:"Sélectionner le mot actuel",selectParagraph:"Sélectionner le paragraphe",selectParagraphDescription:"Sélectionner le paragraphe actuel",extendSelectionByWord:"Étendre la sélection par mot",extendSelectionByWordDescription:"Étendre la sélection au mot suivant/précédent",extendSelectionToLineEdge:"Étendre la sélection au bord de la ligne",extendSelectionToLineEdgeDescription:"Étendre la sélection au début/à la fin de la ligne",moveByWord:"Déplacement par mot",moveByWordDescription:"Déplacer le curseur au mot suivant/précédent",moveToLineStart:"Aller au début de la ligne",moveToLineStartDescription:"Déplacer le curseur au début de la ligne",moveToLineEnd:"Aller à la fin de la ligne",moveToLineEndDescription:"Déplacer le curseur à la fin de la ligne",moveToDocumentStart:"Aller au début du document",moveToDocumentStartDescription:"Déplacer le curseur au début du document",moveToDocumentEnd:"Aller à la fin du document",moveToDocumentEndDescription:"Déplacer le curseur à la fin du document",pageUp:"Page précédente",pageUpDescription:"Défiler d'une page vers le haut",pageDown:"Page suivante",pageDownDescription:"Défiler d'une page vers le bas",zoomIn:"Zoom avant",zoomInDescription:"Augmenter le niveau de zoom",zoomOut:"Zoom arrière",zoomOutDescription:"Diminuer le niveau de zoom",resetZoom:"Réinitialiser le zoom",resetZoomDescription:"Réinitialiser le zoom à 100 %",keyboardShortcuts:"Raccourcis clavier",keyboardShortcutsDescription:"Afficher cette boîte d'aide",insertLink:"Insérer un lien",insertLinkDescription:"Insérer ou modifier un lien"},noResults:"Aucun raccourci trouvé pour « {query} »",pressEscToClose:"Appuyez sur {key} pour fermer",or:"ou"},watermark:{applyButton:"Appliquer",cancelButton:"Annuler",colorLabel:"Couleur",diagonal:"Diagonale",fontLabel:"Police",horizontal:"Horizontale",layoutLabel:"Disposition",noWatermark:"Aucun filigrane",picture:"Filigrane image",presetLabel:"Prédéfini",scale:"Échelle",selectPicture:"Sélectionner une image…",semitransparent:"Semi-transparent",sizeAuto:"Auto",sizeLabel:"Taille",text:"Filigrane texte",textLabel:"Texte",title:"Filigrane",washout:"Estompé"}},comments:{resolved:"Résolu",resolve:"Résoudre",reopen:"Rouvrir",moreOptions:"Plus d'options",unknown:"Inconnu",addComment:"Ajouter un commentaire...",replyPlaceholder:"Répondre ou mentionner d'autres personnes avec @",replyCount:"{count, plural, one {# réponse} other {# réponses}}"},trackedChanges:{unknown:"Inconnu",replaced:"Remplacé",with:"par",added:"Ajouté",deleted:"Supprimé"},contextMenu:{ariaLabel:"Menu des actions IA",textMenuAriaLabel:"Menu d'édition de texte",customPromptPlaceholder:"Saisir une consigne personnalisée...",cut:"Couper",cutShortcut:"Ctrl+X",copy:"Copier",copyShortcut:"Ctrl+C",paste:"Coller",pasteShortcut:"Ctrl+V",pastePlainText:"Coller comme texte brut",pastePlainTextShortcut:"Ctrl+Maj+V",delete:"Supprimer",deleteShortcut:"Suppr",selectAll:"Tout sélectionner",selectAllShortcut:"Ctrl+A",selected:"Sélectionné :",aiActions:{askAi:"Demander à l'IA",rewrite:"Réécrire",expand:"Développer",summarize:"Résumer",translate:"Traduire",explain:"Expliquer",fixGrammar:"Corriger la grammaire",makeFormal:"Rendre formel",makeCasual:"Rendre informel",custom:"Personnalisé"}},documentOutline:{ariaLabel:"Plan du document",closeAriaLabel:"Fermer le plan",closeTitle:"Fermer le plan",title:"Plan",noHeadings:"Aucun titre trouvé. Ajoutez des titres à votre document pour les voir apparaître ici."},sidebar:{ariaLabel:"Barre latérale des annotations"},viewer:{pageIndicator:"{current} sur {total}"},titleBar:{untitled:"Sans titre",documentNameAriaLabel:"Nom du document",menuBarAriaLabel:"Barre de menus"},errors:{loadingDocument:"Chargement du document...",noDocumentLoaded:"Aucun document chargé",failedToLoad:"Échec du chargement du document",unableToParse:"Impossible d'analyser le document",somethingWentWrong:"Une erreur est survenue",errorDescription:"Une erreur s'est produite lors du rendu de ce composant. Veuillez réessayer ou contacter le support si le problème persiste.",errorLabel:"Erreur :",componentStack:"Pile de composants :",tryAgain:"Réessayer",showDetails:"Afficher les détails",hideDetails:"Masquer les détails",unsavedChanges:"Vous avez des modifications non enregistrées. Voulez-vous vraiment quitter ?"},table:{insertRowAbove:"Insérer une ligne au-dessus",insertRowBelow:"Insérer une ligne en dessous",insertColumnLeft:"Insérer une colonne à gauche",insertColumnRight:"Insérer une colonne à droite",deleteRow:"Supprimer la ligne",deleteColumn:"Supprimer la colonne",deleteTable:"Supprimer le tableau",mergeCells:"Fusionner les cellules",splitCell:"Fractionner la cellule",editingTools:"Outils d'édition de tableau",label:"Tableau :",cellFillColor:"Couleur de remplissage des cellules",borderColor:"Couleur de la bordure",borderWidth:"Épaisseur de la bordure",unknownAction:"Action inconnue",borders:{all:"Toutes les bordures",outside:"Bordures extérieures",inside:"Bordures intérieures",none:"Aucune bordure",remove:"Supprimer les bordures",top:"Bordure supérieure",bottom:"Bordure inférieure",left:"Bordure gauche",right:"Bordure droite",styleAriaLabel:"Style de bordure",tooltip:"Bordures"},moreOptions:"Plus d'options de tableau",styles:{title:"Styles de tableau",label:"Styles",normalTable:"Tableau normal",tableGrid:"Grille de tableau",gridTableLight:"Tableau à grille clair",plainTable1:"Tableau simple 1",plainTable2:"Tableau simple 2",plainTable3:"Tableau simple 3",plainTable4:"Tableau simple 4",gridTable1Light:"Grille de tableau 1 clair",gridTable4Accent1:"Grille de tableau 4 - Accent 1",gridTable5Dark:"Grille de tableau 5 sombre",listTable3Accent2:"Grille de tableau 3 Accent 2",listTable4Accent3:"Grille de tableau 4 Accent 3",gridTable4Accent5:"Grille de tableau 4 Accent 5",gridTable4Accent6:"Grille de tableau 4 Accent 6"},selectTable:null},tableAdvanced:{verticalAlignment:"Alignement vertical",top:"Haut",middle:"Milieu",bottom:"Bas",cellMargins:"Marges de cellule",textDirection:"Orientation du texte",textDirections:{horizontal:"Horizontal (GàD)",verticalRL:"Vertical (haut-bas, DàG)",verticalLR:"Vertical (bas-haut, GàD)"},toggleNoWrap:"Activer/Désactiver le retour à la ligne",rowHeight:"Hauteur de ligne",heightRules:{auto:"Auto",atLeast:"Au moins",exact:"Exacte"},rule:"Règle",height:"Hauteur",toggleHeaderRow:"Activer/Désactiver la ligne d'en-tête",distributeColumns:"Uniformiser la largeur des colonnes",autoFit:"Ajuster automatiquement au contenu",tableProperties:"Propriétés du tableau...",tableAlignment:"Alignement du tableau",alignTableLeft:"Aligner le tableau à gauche",alignTableCenter:"Centrer le tableau",alignTableRight:"Aligner le tableau à droite",tableOptionsMenu:"Menu des options de tableau",tableOptions:"Options de tableau"},imageTransform:{tooltip:"Transformer",rotateClockwise:"Pivoter vers la droite",rotateCounterClockwise:"Pivoter vers la gauche",flipHorizontal:"Retourner horizontalement",flipVertical:"Retourner verticalement"},imageWrap:{inline:"En ligne avec le texte",floatLeft:"Carré à gauche",floatRight:"Carré à droite",topAndBottom:"Haut et bas",behindText:"Derrière le texte",inFrontOfText:"Devant le texte",tooltipPrefix:"Habillage : {label}",menu:{inLineWithText:"En ligne avec le texte",squareLeft:"Carré à gauche",squareRight:"Carré à droite",behindText:"Derrière le texte",inFrontOfText:"Devant le texte",ariaLabel:"Options de disposition de l'image",imageProperties:"Propriétés de l'image…"},menuDesc:{inLineWithText:"L'image s'intègre dans la ligne comme un caractère",squareLeft:"L'image est alignée à gauche, le texte l'entoure à droite",squareRight:"L'image est alignée à droite, le texte l'entoure à gauche",behindText:"L'image s'affiche en arrière-plan derrière le texte",inFrontOfText:"L'image s'affiche au premier plan par-dessus le texte"}},responsePreview:{loading:"{action}...",result:"{action} résultat",closeEsc:"Fermer (Échap)",editPrompt:"Modifier le résultat avant d'accepter :",changes:"Modifications :",original:"Original :",new:"Nouveau :",cancelEdit:"Annuler la modification"},commentMarkers:{resolvedComment:"Commentaire résolu",comment:"Commentaire"},editor:{toggleCommentsSidebar:"Afficher/masquer les commentaires",showDocumentOutline:"Afficher le plan",editing:"Éditer",editingDescription:"Modifier directement le document",suggesting:"Suggestions",suggestingDescription:"Les modifications deviennent des suggestions",viewing:"Affichage",viewingDescription:"Lecture seule, aucune modification",failedToParse:"Impossible d'analyser le document",linkRemoved:"Lien supprimé",linkCopied:"Lien copié dans le presse-papiers",failedToSave:"Échec de l'enregistrement du document"},hyperlinkPopup:{displayTextPlaceholder:"Texte à afficher",urlPlaceholder:"https://exemple.com",copyLink:"Copier le lien",editLink:"Modifier le lien",removeLink:"Supprimer le lien"},headerFooter:{header:"En-tête",footer:"Pied de page",options:"Options",insertPageNumber:"Insérer le numéro de page",insertTotalPages:"Insérer le nombre total de pages",remove:"Supprimer {label}",closeEditing:"Fermer l'édition de {label}"},image:{placeholder:"Insérer une image",placeholderText:"[Image]",editableAriaLabel:"Éditer l'image"},imageOverlay:{rotate:"Faire pivoter",imageProperties:"Propriétés de l'image",deleteImage:"Supprimer l'image",replaceImage:null},ruler:{horizontal:"Règle horizontale",vertical:"Règle verticale",firstLineIndent:"Indentation de première ligne",leftIndent:"Décalage à gauche",rightIndent:"Décalage à droite",topMargin:"Marge supérieure",bottomMargin:"Marge inférieure"},print:{label:"Imprimer",allPages:"Tout ({totalPages} pages)",singlePage:"Page {start}",pageRange:"Pages {start}-{end}"},unsaved:{unsaved:"Non enregistré",saved:"Enregistré",unsavedTitle:"Le document a des modifications non enregistrées",savedTitle:"Toutes les modifications ont été enregistrées",unsavedAriaLabel:"Modifications non enregistrées",savedAriaLabel:"Toutes les modifications ont été enregistrées"},loading:{label:"Chargement"},agentPanel:{defaultTitle:"Assistant",toggle:"Ouvrir l'assistant",close:"Fermer",resizeHandle:"Redimensionner",thinking:"L'assistant réfléchit...",composerPlaceholder:"Demander à l'assistant…",send:"Envoyer",timeline:{working:"Traitement… {count, plural, one {# étape} other {# étapes}}",summary:"{count, plural, one {# étape} other {# étapes}}",earlier:"+ {count, plural, one {# étape précédente} other {# étapes précédentes}}"}},revisions:{cellDeleted:null,cellInserted:null,cellMerged:null,cellPropertiesChanged:null,paragraphMarkDeleted:null,paragraphMarkInserted:null,paragraphPropertiesChanged:null,rowDeleted:null,rowInserted:null,rowPropertiesChanged:null,tableDeleted:null,tableInserted:null,tablePropertiesChanged:null}},$J=TJ,IJ=$J;const MJ="application/vnd.openxmlformats-officedocument.wordprocessingml.document",RJ=1e3,PJ=800;function EJ({file:t,projectId:e,isSidebar:n,onClose:r}){const{isDarkMode:o}=p$(),i=S.useRef(null),l=S.useRef(null),a=S.useRef(!1),s=S.useRef(null),c=S.useRef(!1),[d,u]=S.useState(null),[f,h]=S.useState(null),p=e?`projectId=${encodeURIComponent(e)}&path=${encodeURIComponent(t.path)}`:"",m=S.useCallback(async()=>{const v=await fm(`/api/piecemaker/docx-document/version?${p}`);if(!v.ok)throw new Error(`HTTP ${v.status}`);return(await v.json()).version},[p]),y=S.useCallback(async()=>{if(!e)return;const v=await m(),k=await h$.readFileBlob(e,t.path);if(!k.ok)throw new Error(`HTTP ${k.status}`);const x=await k.arrayBuffer();s.current!==null&&window.clearTimeout(s.current),s.current=null,a.current=!1,l.current=v,h(null),u({buffer:x,version:v})},[m,t.path,e]);S.useEffect(()=>{y().catch(k=>h(String(k)));const v=window.setInterval(()=>{c.current||m().then(k=>{if(!c.current&&k!==l.current)return y()}).catch(()=>{})},RJ);return()=>{window.clearInterval(v),s.current!==null&&window.clearTimeout(s.current)}},[m,y]);const w=S.useCallback(async()=>{s.current=null;const v=await i.current?.save();if(v){c.current=!0;try{const k=await fm(`/api/piecemaker/docx-document?${p}`,{method:"PUT",headers:{"Content-Type":MJ},body:v});if(!k.ok)throw new Error(`HTTP ${k.status}`);l.current=(await k.json()).version}catch(k){h(String(k))}finally{c.current=!1}}},[p]),C=S.useCallback(()=>{a.current&&(s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{w()},PJ))},[w]),g=()=>{a.current=!0};return b.jsxs("div",{className:`flex flex-col bg-background ${n?"h-full w-full":"fixed inset-0 z-[9999]"}`,onKeyDownCapture:g,onPointerDownCapture:g,children:[f&&b.jsx("p",{className:"border-b border-border px-3 py-1.5 text-xs text-destructive",children:f}),d?b.jsx(SJ,{ref:i,documentBuffer:d.buffer,documentName:t.name,documentNameEditable:!1,showFileOpen:!1,mode:"editing",colorMode:o?"dark":"light",i18n:IJ,onChange:C,renderTitleBarRight:()=>b.jsx("button",{type:"button",onClick:r,className:"rounded-md px-2 py-1 text-sm text-muted-foreground hover:bg-muted","aria-label":"Fermer",children:"✕"}),style:{flex:1,minHeight:0}},d.version):b.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:f?t.path:"Chargement…"})]})}const tQ=Object.freeze(Object.defineProperty({__proto__:null,default:EJ},Symbol.toStringTag,{value:"Module"})),FJ=Object.freeze(Object.defineProperty({__proto__:null,HyperlinkDialog:lS,createBookmarkLinkData:r9,createHyperlinkData:n9,default:d9,emailToMailto:a9,extractBookmarksForDialog:c9,getDisplayText:l9,getUrlType:t9,isBookmarkHyperlinkData:i9,isExternalHyperlinkData:o9,isValidUrl:Nf,normalizeUrl:Ch,phoneToTel:s9,useHyperlinkDialog:aS},Symbol.toStringTag,{value:"Module"}));export{tQ as D,Re as L,jq as P,kh as r,BJ as u};