superdoc 2.2.1 β†’ 2.4.0-next.1

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 (689) hide show
  1. package/AGENTS.md +337 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +8 -0
  4. package/README.md +106 -0
  5. package/dist/chunks/FindReplaceSurface-BEW-1NhM.es.js +344 -0
  6. package/dist/chunks/FindReplaceSurface-Dx0llWqP.cjs +346 -0
  7. package/dist/chunks/PasswordPromptSurface-BA6HHqEa.es.js +111 -0
  8. package/dist/chunks/PasswordPromptSurface-BUUVC2ee.cjs +113 -0
  9. package/dist/chunks/PdfViewer-CNOtyS-I.es.js +531 -0
  10. package/dist/chunks/PdfViewer-qpvzwYMz.cjs +535 -0
  11. package/dist/chunks/_plugin-vue_export-helper-BTwbGDKw.cjs +11 -0
  12. package/dist/chunks/_plugin-vue_export-helper-CInC0bKI.es.js +6 -0
  13. package/dist/chunks/blank-docx-DP8RUPW-.cjs +7 -0
  14. package/dist/chunks/blank-docx-XRX6Ker2.es.js +2 -0
  15. package/dist/chunks/constants-CY3R3_kF.es.js +3 -0
  16. package/dist/chunks/constants-sbCZ2O_A.cjs +14 -0
  17. package/dist/chunks/create-super-doc-ui-D4kk9AjM.es.js +9417 -0
  18. package/dist/chunks/create-super-doc-ui-DXdWuTzm.cjs +9680 -0
  19. package/dist/chunks/eventemitter3-Bt2s0X0a.es.js +131 -0
  20. package/dist/chunks/eventemitter3-DqY4aSMf.cjs +137 -0
  21. package/dist/chunks/jszip-C8srOKAO.es.js +4650 -0
  22. package/dist/chunks/jszip-Cs9JBLlJ.cjs +4691 -0
  23. package/dist/chunks/rolldown-runtime-1Y-nnZJ3.cjs +40 -0
  24. package/dist/chunks/rolldown-runtime-D7PMmH3s.es.js +27 -0
  25. package/dist/chunks/uuid-B2Sqk-3p.es.js +32 -0
  26. package/dist/chunks/uuid-CFp0WGVU.cjs +38 -0
  27. package/dist/collaboration-upgrade-engine.cjs +37 -0
  28. package/dist/collaboration-upgrade-engine.es.js +30 -0
  29. package/dist/document-api/src/authorities/authorities.d.ts +29 -0
  30. package/dist/document-api/src/authorities/authorities.types.d.ts +113 -0
  31. package/dist/document-api/src/blocks/blocks.d.ts +29 -0
  32. package/dist/document-api/src/bookmarks/bookmarks.d.ts +15 -0
  33. package/dist/document-api/src/bookmarks/bookmarks.types.d.ts +82 -0
  34. package/dist/document-api/src/capabilities/capabilities.d.ts +82 -0
  35. package/dist/document-api/src/captions/captions.d.ts +17 -0
  36. package/dist/document-api/src/captions/captions.types.d.ts +61 -0
  37. package/dist/document-api/src/citations/citations.d.ts +39 -0
  38. package/dist/document-api/src/citations/citations.types.d.ts +151 -0
  39. package/dist/document-api/src/clear-content/clear-content.d.ts +25 -0
  40. package/dist/document-api/src/clipboard/clipboard.d.ts +11 -0
  41. package/dist/document-api/src/comments/comment-create-attribution.d.ts +2 -0
  42. package/dist/document-api/src/comments/comments.d.ts +231 -0
  43. package/dist/document-api/src/comments/comments.types.d.ts +266 -0
  44. package/dist/document-api/src/content-controls/content-controls.d.ts +136 -0
  45. package/dist/document-api/src/content-controls/content-controls.types.d.ts +455 -0
  46. package/dist/document-api/src/contract/command-catalog.d.ts +17 -0
  47. package/dist/document-api/src/contract/index.d.ts +9 -0
  48. package/dist/document-api/src/contract/metadata-types.d.ts +48 -0
  49. package/dist/document-api/src/contract/operation-definitions.d.ts +3645 -0
  50. package/dist/document-api/src/contract/operation-map.d.ts +5 -0
  51. package/dist/document-api/src/contract/operation-registry.d.ts +2002 -0
  52. package/dist/document-api/src/contract/reference-aliases.d.ts +19 -0
  53. package/dist/document-api/src/contract/reference-doc-map.d.ts +12 -0
  54. package/dist/document-api/src/contract/schemas.d.ts +35 -0
  55. package/dist/document-api/src/contract/step-op-catalog.d.ts +26 -0
  56. package/dist/document-api/src/contract/types.d.ts +31 -0
  57. package/dist/document-api/src/create/create.d.ts +27 -0
  58. package/dist/document-api/src/cross-refs/cross-refs.d.ts +15 -0
  59. package/dist/document-api/src/cross-refs/cross-refs.types.d.ts +68 -0
  60. package/dist/document-api/src/customXml/customXml.d.ts +19 -0
  61. package/dist/document-api/src/customXml/customXml.types.d.ts +148 -0
  62. package/dist/document-api/src/delete/delete.d.ts +20 -0
  63. package/dist/document-api/src/diff/diff.d.ts +14 -0
  64. package/dist/document-api/src/diff/diff.types.d.ts +83 -0
  65. package/dist/document-api/src/diff/index.d.ts +3 -0
  66. package/dist/document-api/src/errors.d.ts +11 -0
  67. package/dist/document-api/src/export/export.d.ts +10 -0
  68. package/dist/document-api/src/export/export.types.d.ts +40 -0
  69. package/dist/document-api/src/extract/extract.d.ts +15 -0
  70. package/dist/document-api/src/fields/fields.d.ts +15 -0
  71. package/dist/document-api/src/fields/fields.types.d.ts +90 -0
  72. package/dist/document-api/src/find/find.d.ts +52 -0
  73. package/dist/document-api/src/footnotes/footnotes.d.ts +17 -0
  74. package/dist/document-api/src/footnotes/footnotes.types.d.ts +104 -0
  75. package/dist/document-api/src/format/format.d.ts +92 -0
  76. package/dist/document-api/src/format/inline-run-patch.d.ts +138 -0
  77. package/dist/document-api/src/get/get.d.ts +19 -0
  78. package/dist/document-api/src/get-html/get-html.d.ts +27 -0
  79. package/dist/document-api/src/get-markdown/get-markdown.d.ts +22 -0
  80. package/dist/document-api/src/get-node/get-node.d.ts +46 -0
  81. package/dist/document-api/src/get-text/get-text.d.ts +22 -0
  82. package/dist/document-api/src/header-footers/header-footers.d.ts +37 -0
  83. package/dist/document-api/src/header-footers/header-footers.types.d.ts +116 -0
  84. package/dist/document-api/src/history/history.d.ts +38 -0
  85. package/dist/document-api/src/history/history.types.d.ts +100 -0
  86. package/dist/document-api/src/hyperlinks/hyperlinks.d.ts +17 -0
  87. package/dist/document-api/src/hyperlinks/hyperlinks.types.d.ts +112 -0
  88. package/dist/document-api/src/images/images.d.ts +63 -0
  89. package/dist/document-api/src/images/images.types.d.ts +209 -0
  90. package/dist/document-api/src/images/z-order.d.ts +10 -0
  91. package/dist/document-api/src/index/index.d.ts +29 -0
  92. package/dist/document-api/src/index/index.types.d.ts +125 -0
  93. package/dist/document-api/src/index.d.ts +560 -0
  94. package/dist/document-api/src/info/info.d.ts +19 -0
  95. package/dist/document-api/src/inline-semantics/directives.d.ts +95 -0
  96. package/dist/document-api/src/inline-semantics/error-types.d.ts +68 -0
  97. package/dist/document-api/src/inline-semantics/index.d.ts +20 -0
  98. package/dist/document-api/src/inline-semantics/property-ids.d.ts +24 -0
  99. package/dist/document-api/src/inline-semantics/token-parsers.d.ts +59 -0
  100. package/dist/document-api/src/inline-semantics/token-sets.d.ts +34 -0
  101. package/dist/document-api/src/insert/insert.d.ts +65 -0
  102. package/dist/document-api/src/invoke/invoke.d.ts +17 -0
  103. package/dist/document-api/src/lists/lists.d.ts +100 -0
  104. package/dist/document-api/src/lists/lists.types.d.ts +499 -0
  105. package/dist/document-api/src/markdown-to-fragment/markdown-to-fragment.d.ts +15 -0
  106. package/dist/document-api/src/metadata/anchored-metadata.d.ts +33 -0
  107. package/dist/document-api/src/metadata/anchored-metadata.types.d.ts +175 -0
  108. package/dist/document-api/src/paragraphs/paragraphs.d.ts +84 -0
  109. package/dist/document-api/src/paragraphs/paragraphs.types.d.ts +214 -0
  110. package/dist/document-api/src/permission-ranges/permission-ranges.d.ts +15 -0
  111. package/dist/document-api/src/permission-ranges/permission-ranges.types.d.ts +49 -0
  112. package/dist/document-api/src/plan/plan.d.ts +73 -0
  113. package/dist/document-api/src/protection/protection.d.ts +11 -0
  114. package/dist/document-api/src/protection/protection.types.d.ts +47 -0
  115. package/dist/document-api/src/ranges/index.d.ts +2 -0
  116. package/dist/document-api/src/ranges/ranges.types.d.ts +121 -0
  117. package/dist/document-api/src/ranges/resolve.d.ts +2 -0
  118. package/dist/document-api/src/receipt-bridge.d.ts +30 -0
  119. package/dist/document-api/src/replace/replace.d.ts +24 -0
  120. package/dist/document-api/src/sections/sections.d.ts +42 -0
  121. package/dist/document-api/src/sections/sections.types.d.ts +236 -0
  122. package/dist/document-api/src/selection/selection.d.ts +23 -0
  123. package/dist/document-api/src/selection/selection.types.d.ts +85 -0
  124. package/dist/document-api/src/selection-mutation.d.ts +46 -0
  125. package/dist/document-api/src/styles/apply.d.ts +142 -0
  126. package/dist/document-api/src/styles/catalog.d.ts +154 -0
  127. package/dist/document-api/src/styles/index.d.ts +14 -0
  128. package/dist/document-api/src/styles/registry.d.ts +43 -0
  129. package/dist/document-api/src/styles/schema.d.ts +9 -0
  130. package/dist/document-api/src/styles/validation.d.ts +38 -0
  131. package/dist/document-api/src/tables/color-formats.d.ts +12 -0
  132. package/dist/document-api/src/tables/tables.d.ts +83 -0
  133. package/dist/document-api/src/templates/apply.d.ts +160 -0
  134. package/dist/document-api/src/templates/index.d.ts +7 -0
  135. package/dist/document-api/src/toc/toc.d.ts +25 -0
  136. package/dist/document-api/src/toc/toc.types.d.ts +247 -0
  137. package/dist/document-api/src/track-changes/track-changes.d.ts +177 -0
  138. package/dist/document-api/src/types/adapter-result.d.ts +10 -0
  139. package/dist/document-api/src/types/address.d.ts +169 -0
  140. package/dist/document-api/src/types/base.d.ts +89 -0
  141. package/dist/document-api/src/types/blocks.types.d.ts +190 -0
  142. package/dist/document-api/src/types/clipboard.d.ts +216 -0
  143. package/dist/document-api/src/types/comments.types.d.ts +17 -0
  144. package/dist/document-api/src/types/create.types.d.ts +56 -0
  145. package/dist/document-api/src/types/discovery.d.ts +99 -0
  146. package/dist/document-api/src/types/extract.types.d.ts +163 -0
  147. package/dist/document-api/src/types/fragment.d.ts +29 -0
  148. package/dist/document-api/src/types/index.d.ts +30 -0
  149. package/dist/document-api/src/types/info.types.d.ts +109 -0
  150. package/dist/document-api/src/types/inline.types.d.ts +28 -0
  151. package/dist/document-api/src/types/media.types.d.ts +72 -0
  152. package/dist/document-api/src/types/mutation-plan.types.d.ts +264 -0
  153. package/dist/document-api/src/types/node.d.ts +9 -0
  154. package/dist/document-api/src/types/paragraph.types.d.ts +61 -0
  155. package/dist/document-api/src/types/placement.d.ts +24 -0
  156. package/dist/document-api/src/types/query-match.types.d.ts +212 -0
  157. package/dist/document-api/src/types/query.d.ts +133 -0
  158. package/dist/document-api/src/types/receipt.d.ts +191 -0
  159. package/dist/document-api/src/types/references.types.d.ts +9 -0
  160. package/dist/document-api/src/types/sd-contract.d.ts +54 -0
  161. package/dist/document-api/src/types/sd-envelope.d.ts +59 -0
  162. package/dist/document-api/src/types/sd-nodes.d.ts +375 -0
  163. package/dist/document-api/src/types/sd-objects.d.ts +144 -0
  164. package/dist/document-api/src/types/sd-props.d.ts +240 -0
  165. package/dist/document-api/src/types/sd-sections.d.ts +126 -0
  166. package/dist/document-api/src/types/sd-styles.d.ts +36 -0
  167. package/dist/document-api/src/types/step-manifest.types.d.ts +30 -0
  168. package/dist/document-api/src/types/story.types.d.ts +123 -0
  169. package/dist/document-api/src/types/structural-input.d.ts +40 -0
  170. package/dist/document-api/src/types/structured.types.d.ts +21 -0
  171. package/dist/document-api/src/types/style-policy.types.d.ts +49 -0
  172. package/dist/document-api/src/types/table-operations.types.d.ts +618 -0
  173. package/dist/document-api/src/types/tables.types.d.ts +43 -0
  174. package/dist/document-api/src/types/toc.types.d.ts +1 -0
  175. package/dist/document-api/src/types/track-changes.types.d.ts +703 -0
  176. package/dist/document-api/src/validation/create-location-validator.d.ts +2 -0
  177. package/dist/document-api/src/validation/fragment-validator.d.ts +13 -0
  178. package/dist/document-api/src/validation/selection-target-validator.d.ts +7 -0
  179. package/dist/document-api/src/validation/story-validator.d.ts +12 -0
  180. package/dist/document-api/src/validation-primitives.d.ts +29 -0
  181. package/dist/document-api/src/write/locator.d.ts +24 -0
  182. package/dist/document-api/src/write/write.d.ts +73 -0
  183. package/dist/images/altText_add.svg +3 -0
  184. package/dist/images/altText_disclaimer.svg +3 -0
  185. package/dist/images/altText_done.svg +3 -0
  186. package/dist/images/altText_spinner.svg +30 -0
  187. package/dist/images/altText_warning.svg +3 -0
  188. package/dist/images/annotation-check.svg +11 -0
  189. package/dist/images/annotation-comment.svg +16 -0
  190. package/dist/images/annotation-help.svg +26 -0
  191. package/dist/images/annotation-insert.svg +10 -0
  192. package/dist/images/annotation-key.svg +11 -0
  193. package/dist/images/annotation-newparagraph.svg +11 -0
  194. package/dist/images/annotation-noicon.svg +7 -0
  195. package/dist/images/annotation-note.svg +42 -0
  196. package/dist/images/annotation-paperclip.svg +6 -0
  197. package/dist/images/annotation-paragraph.svg +16 -0
  198. package/dist/images/annotation-pushpin.svg +7 -0
  199. package/dist/images/checkmark.svg +5 -0
  200. package/dist/images/comment-actionsButton.svg +3 -0
  201. package/dist/images/comment-closeButton.svg +3 -0
  202. package/dist/images/comment-editButton.svg +8 -0
  203. package/dist/images/comment-popup-editButton.svg +5 -0
  204. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  205. package/dist/images/cursor-editorFreeText.svg +3 -0
  206. package/dist/images/cursor-editorInk.svg +4 -0
  207. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  208. package/dist/images/editor-toolbar-delete.svg +5 -0
  209. package/dist/images/editor-toolbar-edit.svg +3 -0
  210. package/dist/images/findbarButton-next.svg +3 -0
  211. package/dist/images/findbarButton-previous.svg +3 -0
  212. package/dist/images/gv-toolbarButton-download.svg +3 -0
  213. package/dist/images/loading-icon.gif +0 -0
  214. package/dist/images/loading.svg +1 -0
  215. package/dist/images/messageBar_closingButton.svg +3 -0
  216. package/dist/images/messageBar_info.svg +3 -0
  217. package/dist/images/messageBar_warning.svg +3 -0
  218. package/dist/images/pages_closeButton.svg +3 -0
  219. package/dist/images/pages_selected.svg +7 -0
  220. package/dist/images/pages_viewArrow.svg +3 -0
  221. package/dist/images/pages_viewButton.svg +3 -0
  222. package/dist/images/secondaryToolbarButton-documentProperties.svg +3 -0
  223. package/dist/images/secondaryToolbarButton-firstPage.svg +3 -0
  224. package/dist/images/secondaryToolbarButton-handTool.svg +3 -0
  225. package/dist/images/secondaryToolbarButton-lastPage.svg +3 -0
  226. package/dist/images/secondaryToolbarButton-rotateCcw.svg +3 -0
  227. package/dist/images/secondaryToolbarButton-rotateCw.svg +3 -0
  228. package/dist/images/secondaryToolbarButton-scrollHorizontal.svg +3 -0
  229. package/dist/images/secondaryToolbarButton-scrollPage.svg +3 -0
  230. package/dist/images/secondaryToolbarButton-scrollVertical.svg +3 -0
  231. package/dist/images/secondaryToolbarButton-scrollWrapped.svg +3 -0
  232. package/dist/images/secondaryToolbarButton-selectTool.svg +3 -0
  233. package/dist/images/secondaryToolbarButton-spreadEven.svg +3 -0
  234. package/dist/images/secondaryToolbarButton-spreadNone.svg +3 -0
  235. package/dist/images/secondaryToolbarButton-spreadOdd.svg +3 -0
  236. package/dist/images/toolbarButton-bookmark.svg +3 -0
  237. package/dist/images/toolbarButton-currentOutlineItem.svg +3 -0
  238. package/dist/images/toolbarButton-download.svg +4 -0
  239. package/dist/images/toolbarButton-editorFreeText.svg +5 -0
  240. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  241. package/dist/images/toolbarButton-editorInk.svg +4 -0
  242. package/dist/images/toolbarButton-editorSignature.svg +6 -0
  243. package/dist/images/toolbarButton-editorStamp.svg +8 -0
  244. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  245. package/dist/images/toolbarButton-openFile.svg +3 -0
  246. package/dist/images/toolbarButton-pageDown.svg +3 -0
  247. package/dist/images/toolbarButton-pageUp.svg +3 -0
  248. package/dist/images/toolbarButton-presentationMode.svg +3 -0
  249. package/dist/images/toolbarButton-print.svg +3 -0
  250. package/dist/images/toolbarButton-search.svg +3 -0
  251. package/dist/images/toolbarButton-secondaryToolbarToggle.svg +3 -0
  252. package/dist/images/toolbarButton-viewAttachments.svg +3 -0
  253. package/dist/images/toolbarButton-viewLayers.svg +3 -0
  254. package/dist/images/toolbarButton-viewOutline.svg +3 -0
  255. package/dist/images/toolbarButton-viewThumbnail.svg +3 -0
  256. package/dist/images/toolbarButton-viewsManagerToggle.svg +3 -0
  257. package/dist/images/toolbarButton-zoomIn.svg +3 -0
  258. package/dist/images/toolbarButton-zoomOut.svg +3 -0
  259. package/dist/images/treeitem-collapsed.svg +1 -0
  260. package/dist/images/treeitem-expanded.svg +1 -0
  261. package/dist/layout-engine/contracts/src/author-colors.d.ts +56 -0
  262. package/dist/layout-engine/contracts/src/cell-spacing.d.ts +12 -0
  263. package/dist/layout-engine/contracts/src/clip-path-inset.d.ts +27 -0
  264. package/dist/layout-engine/contracts/src/column-layout.d.ts +79 -0
  265. package/dist/layout-engine/contracts/src/direction-context.d.ts +219 -0
  266. package/dist/layout-engine/contracts/src/drawing-taxonomy.d.ts +126 -0
  267. package/dist/layout-engine/contracts/src/engines/image-wrap.d.ts +54 -0
  268. package/dist/layout-engine/contracts/src/engines/index.d.ts +17 -0
  269. package/dist/layout-engine/contracts/src/engines/lists.d.ts +57 -0
  270. package/dist/layout-engine/contracts/src/engines/paragraph.d.ts +59 -0
  271. package/dist/layout-engine/contracts/src/engines/tables.d.ts +89 -0
  272. package/dist/layout-engine/contracts/src/engines/tabs.d.ts +117 -0
  273. package/dist/layout-engine/contracts/src/graphic-placement.d.ts +76 -0
  274. package/dist/layout-engine/contracts/src/header-footer-inheritance.d.ts +22 -0
  275. package/dist/layout-engine/contracts/src/header-footer-resolution.d.ts +28 -0
  276. package/dist/layout-engine/contracts/src/incremental-dependency.d.ts +10 -0
  277. package/dist/layout-engine/contracts/src/index.d.ts +2459 -0
  278. package/dist/layout-engine/contracts/src/justify-utils.d.ts +98 -0
  279. package/dist/layout-engine/contracts/src/layout-identity.d.ts +136 -0
  280. package/dist/layout-engine/contracts/src/ooxml-z-index.d.ts +46 -0
  281. package/dist/layout-engine/contracts/src/page-number-formatting.d.ts +26 -0
  282. package/dist/layout-engine/contracts/src/page-ref-anchor.d.ts +2 -0
  283. package/dist/layout-engine/contracts/src/pm-range.d.ts +45 -0
  284. package/dist/layout-engine/contracts/src/resolved-layout.d.ts +541 -0
  285. package/dist/layout-engine/contracts/src/run-helpers.d.ts +23 -0
  286. package/dist/layout-engine/contracts/src/sdt-container.d.ts +13 -0
  287. package/dist/layout-engine/contracts/src/segment-geometry.d.ts +192 -0
  288. package/dist/layout-engine/contracts/src/semantic-colors.d.ts +150 -0
  289. package/dist/layout-engine/contracts/src/table-cell-spacing.d.ts +12 -0
  290. package/dist/layout-engine/contracts/src/table-column-rescale.d.ts +13 -0
  291. package/dist/layout-engine/contracts/src/vertical-text.d.ts +43 -0
  292. package/dist/layout-engine/dom-contract/src/class-names.d.ts +62 -0
  293. package/dist/layout-engine/dom-contract/src/data-attrs.d.ts +103 -0
  294. package/dist/layout-engine/dom-contract/src/index.d.ts +18 -0
  295. package/dist/layout-engine/dom-contract/src/selectors.d.ts +47 -0
  296. package/dist/layout-engine/layout-bridge/src/cache-warmer.d.ts +73 -0
  297. package/dist/layout-engine/layout-bridge/src/cache.d.ts +143 -0
  298. package/dist/layout-engine/layout-bridge/src/cacheInvalidation.d.ts +117 -0
  299. package/dist/layout-engine/layout-bridge/src/cursor-renderer.d.ts +201 -0
  300. package/dist/layout-engine/layout-bridge/src/debounced-passes.d.ts +130 -0
  301. package/dist/layout-engine/layout-bridge/src/diff.d.ts +36 -0
  302. package/dist/layout-engine/layout-bridge/src/dirty-tracker.d.ts +128 -0
  303. package/dist/layout-engine/layout-bridge/src/dom-mapping.d.ts +80 -0
  304. package/dist/layout-engine/layout-bridge/src/featureFlags.d.ts +95 -0
  305. package/dist/layout-engine/layout-bridge/src/field-annotation-key.d.ts +2 -0
  306. package/dist/layout-engine/layout-bridge/src/focus-watchdog.d.ts +170 -0
  307. package/dist/layout-engine/layout-bridge/src/font-metrics-cache.d.ts +164 -0
  308. package/dist/layout-engine/layout-bridge/src/footnote-scorer.d.ts +63 -0
  309. package/dist/layout-engine/layout-bridge/src/headerFooterUtils.d.ts +218 -0
  310. package/dist/layout-engine/layout-bridge/src/ime-handler.d.ts +81 -0
  311. package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +390 -0
  312. package/dist/layout-engine/layout-bridge/src/index.d.ts +211 -0
  313. package/dist/layout-engine/layout-bridge/src/instrumentation.d.ts +245 -0
  314. package/dist/layout-engine/layout-bridge/src/layoutHeaderFooter.d.ts +123 -0
  315. package/dist/layout-engine/layout-bridge/src/list-indent-utils.d.ts +205 -0
  316. package/dist/layout-engine/layout-bridge/src/local-paragraph-layout.d.ts +93 -0
  317. package/dist/layout-engine/layout-bridge/src/neutral-hit.d.ts +142 -0
  318. package/dist/layout-engine/layout-bridge/src/neutral-segment-geometry.d.ts +32 -0
  319. package/dist/layout-engine/layout-bridge/src/page-geometry-helper.d.ts +197 -0
  320. package/dist/layout-engine/layout-bridge/src/paragraph-hash-utils.d.ts +126 -0
  321. package/dist/layout-engine/layout-bridge/src/paragraph-line-cache.d.ts +152 -0
  322. package/dist/layout-engine/layout-bridge/src/performance-metrics.d.ts +249 -0
  323. package/dist/layout-engine/layout-bridge/src/pm-dom-fallback.d.ts +188 -0
  324. package/dist/layout-engine/layout-bridge/src/pm-position-validator.d.ts +100 -0
  325. package/dist/layout-engine/layout-bridge/src/position-hit.d.ts +167 -0
  326. package/dist/layout-engine/layout-bridge/src/remeasure.d.ts +75 -0
  327. package/dist/layout-engine/layout-bridge/src/resolveHeaderFooterTokens.d.ts +76 -0
  328. package/dist/layout-engine/layout-bridge/src/rtl-text-geometry.d.ts +34 -0
  329. package/dist/layout-engine/layout-bridge/src/run-visual-marks.d.ts +12 -0
  330. package/dist/layout-engine/layout-bridge/src/safety-net.d.ts +234 -0
  331. package/dist/layout-engine/layout-bridge/src/sectionAwareHeaderFooter.d.ts +15 -0
  332. package/dist/layout-engine/layout-bridge/src/table-handler.d.ts +86 -0
  333. package/dist/layout-engine/layout-bridge/src/text-boundaries.d.ts +17 -0
  334. package/dist/layout-engine/layout-bridge/src/text-measurement.d.ts +69 -0
  335. package/dist/layout-engine/layout-bridge/src/track-changes-handler.d.ts +90 -0
  336. package/dist/layout-engine/layout-bridge/src/tracked-changes-utils.d.ts +41 -0
  337. package/dist/layout-engine/layout-engine/src/anchors.d.ts +52 -0
  338. package/dist/layout-engine/layout-engine/src/column-balancing.d.ts +255 -0
  339. package/dist/layout-engine/layout-engine/src/column-utils.d.ts +1 -0
  340. package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +60 -0
  341. package/dist/layout-engine/layout-engine/src/floating-table-anchor.d.ts +21 -0
  342. package/dist/layout-engine/layout-engine/src/index.d.ts +349 -0
  343. package/dist/layout-engine/layout-engine/src/layout-drawing.d.ts +60 -0
  344. package/dist/layout-engine/layout-engine/src/layout-image.d.ts +16 -0
  345. package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +101 -0
  346. package/dist/layout-engine/layout-engine/src/layout-table.d.ts +71 -0
  347. package/dist/layout-engine/layout-engine/src/layout-textbox.d.ts +4 -0
  348. package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +104 -0
  349. package/dist/layout-engine/layout-engine/src/normalize-header-footer-fragments.d.ts +45 -0
  350. package/dist/layout-engine/layout-engine/src/pageNumbering.d.ts +73 -0
  351. package/dist/layout-engine/layout-engine/src/paginator.d.ts +131 -0
  352. package/dist/layout-engine/layout-engine/src/paragraph-layout-eligibility.d.ts +1 -0
  353. package/dist/layout-engine/layout-engine/src/resolvePageRefs.d.ts +31 -0
  354. package/dist/layout-engine/layout-engine/src/resolvePageTokens.d.ts +82 -0
  355. package/dist/layout-engine/layout-engine/src/section-breaks.d.ts +98 -0
  356. package/dist/layout-engine/layout-engine/src/section-props.d.ts +65 -0
  357. package/dist/layout-engine/layout-engine/src/table-cell-slice.d.ts +98 -0
  358. package/dist/layout-engine/painters/dom/src/_test-utils.d.ts +22 -0
  359. package/dist/layout-engine/painters/dom/src/chart-renderer.d.ts +13 -0
  360. package/dist/layout-engine/painters/dom/src/constants.d.ts +10 -0
  361. package/dist/layout-engine/painters/dom/src/css-token.d.ts +10 -0
  362. package/dist/layout-engine/painters/dom/src/features/feature-registry.d.ts +41 -0
  363. package/dist/layout-engine/painters/dom/src/features/inline-direction/index.d.ts +22 -0
  364. package/dist/layout-engine/painters/dom/src/features/inline-direction/rtl-styles.d.ts +27 -0
  365. package/dist/layout-engine/painters/dom/src/features/inline-direction/run-direction.d.ts +75 -0
  366. package/dist/layout-engine/painters/dom/src/features/math/converters/accent.d.ts +25 -0
  367. package/dist/layout-engine/painters/dom/src/features/math/converters/bar.d.ts +16 -0
  368. package/dist/layout-engine/painters/dom/src/features/math/converters/box.d.ts +38 -0
  369. package/dist/layout-engine/painters/dom/src/features/math/converters/delimiter.d.ts +13 -0
  370. package/dist/layout-engine/painters/dom/src/features/math/converters/equation-array.d.ts +19 -0
  371. package/dist/layout-engine/painters/dom/src/features/math/converters/fraction.d.ts +13 -0
  372. package/dist/layout-engine/painters/dom/src/features/math/converters/function.d.ts +16 -0
  373. package/dist/layout-engine/painters/dom/src/features/math/converters/group-character.d.ts +26 -0
  374. package/dist/layout-engine/painters/dom/src/features/math/converters/index.d.ts +27 -0
  375. package/dist/layout-engine/painters/dom/src/features/math/converters/lower-limit.d.ts +13 -0
  376. package/dist/layout-engine/painters/dom/src/features/math/converters/math-run.d.ts +47 -0
  377. package/dist/layout-engine/painters/dom/src/features/math/converters/matrix.d.ts +23 -0
  378. package/dist/layout-engine/painters/dom/src/features/math/converters/nary.d.ts +23 -0
  379. package/dist/layout-engine/painters/dom/src/features/math/converters/phantom.d.ts +17 -0
  380. package/dist/layout-engine/painters/dom/src/features/math/converters/pre-sub-superscript.d.ts +25 -0
  381. package/dist/layout-engine/painters/dom/src/features/math/converters/radical.d.ts +14 -0
  382. package/dist/layout-engine/painters/dom/src/features/math/converters/sub-superscript.d.ts +13 -0
  383. package/dist/layout-engine/painters/dom/src/features/math/converters/subscript.d.ts +13 -0
  384. package/dist/layout-engine/painters/dom/src/features/math/converters/superscript.d.ts +13 -0
  385. package/dist/layout-engine/painters/dom/src/features/math/converters/upper-limit.d.ts +13 -0
  386. package/dist/layout-engine/painters/dom/src/features/math/index.d.ts +14 -0
  387. package/dist/layout-engine/painters/dom/src/features/math/omml-to-mathml.d.ts +18 -0
  388. package/dist/layout-engine/painters/dom/src/features/math/types.d.ts +41 -0
  389. package/dist/layout-engine/painters/dom/src/images/drawing-image.d.ts +5 -0
  390. package/dist/layout-engine/painters/dom/src/images/hyperlink.d.ts +2 -0
  391. package/dist/layout-engine/painters/dom/src/images/image-block.d.ts +15 -0
  392. package/dist/layout-engine/painters/dom/src/images/image-clip-path.d.ts +17 -0
  393. package/dist/layout-engine/painters/dom/src/images/image-fragment.d.ts +34 -0
  394. package/dist/layout-engine/painters/dom/src/images/image-selectors.d.ts +9 -0
  395. package/dist/layout-engine/painters/dom/src/images/types.d.ts +2 -0
  396. package/dist/layout-engine/painters/dom/src/index.d.ts +130 -0
  397. package/dist/layout-engine/painters/dom/src/page-content.d.ts +277 -0
  398. package/dist/layout-engine/painters/dom/src/paragraph/block-version.d.ts +8 -0
  399. package/dist/layout-engine/painters/dom/src/paragraph/borders/border-layer.d.ts +59 -0
  400. package/dist/layout-engine/painters/dom/src/paragraph/borders/group-analysis.d.ts +38 -0
  401. package/dist/layout-engine/painters/dom/src/paragraph/borders/index.d.ts +18 -0
  402. package/dist/layout-engine/painters/dom/src/paragraph/frame.d.ts +3 -0
  403. package/dist/layout-engine/painters/dom/src/paragraph/indentation.d.ts +25 -0
  404. package/dist/layout-engine/painters/dom/src/paragraph/list-marker.d.ts +51 -0
  405. package/dist/layout-engine/painters/dom/src/paragraph/marker-tracked-change.d.ts +34 -0
  406. package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphContent.d.ts +87 -0
  407. package/dist/layout-engine/painters/dom/src/paragraph/renderParagraphFragment.d.ts +33 -0
  408. package/dist/layout-engine/painters/dom/src/paragraph/styles.d.ts +3 -0
  409. package/dist/layout-engine/painters/dom/src/paragraph-hash-utils.d.ts +13 -0
  410. package/dist/layout-engine/painters/dom/src/persistent-page-surface.d.ts +144 -0
  411. package/dist/layout-engine/painters/dom/src/pm-position-validation.d.ts +149 -0
  412. package/dist/layout-engine/painters/dom/src/renderer.d.ts +625 -0
  413. package/dist/layout-engine/painters/dom/src/ruler/index.d.ts +41 -0
  414. package/dist/layout-engine/painters/dom/src/ruler/ruler-core.d.ts +195 -0
  415. package/dist/layout-engine/painters/dom/src/ruler/ruler-renderer.d.ts +97 -0
  416. package/dist/layout-engine/painters/dom/src/ruler/ruler-styles.d.ts +31 -0
  417. package/dist/layout-engine/painters/dom/src/runs/field-annotation-run.d.ts +14 -0
  418. package/dist/layout-engine/painters/dom/src/runs/font-synthesis.d.ts +1 -0
  419. package/dist/layout-engine/painters/dom/src/runs/formatting-marks.d.ts +3 -0
  420. package/dist/layout-engine/painters/dom/src/runs/hash.d.ts +82 -0
  421. package/dist/layout-engine/painters/dom/src/runs/image-run.d.ts +37 -0
  422. package/dist/layout-engine/painters/dom/src/runs/index.d.ts +13 -0
  423. package/dist/layout-engine/painters/dom/src/runs/links.d.ts +58 -0
  424. package/dist/layout-engine/painters/dom/src/runs/math-run.d.ts +7 -0
  425. package/dist/layout-engine/painters/dom/src/runs/render-line.d.ts +2 -0
  426. package/dist/layout-engine/painters/dom/src/runs/render-run.d.ts +12 -0
  427. package/dist/layout-engine/painters/dom/src/runs/tab-run.d.ts +66 -0
  428. package/dist/layout-engine/painters/dom/src/runs/text-run.d.ts +35 -0
  429. package/dist/layout-engine/painters/dom/src/runs/tracked-changes.d.ts +90 -0
  430. package/dist/layout-engine/painters/dom/src/runs/types.d.ts +67 -0
  431. package/dist/layout-engine/painters/dom/src/sdt/boundaries.d.ts +16 -0
  432. package/dist/layout-engine/painters/dom/src/sdt/container.d.ts +32 -0
  433. package/dist/layout-engine/painters/dom/src/sdt/dataset.d.ts +7 -0
  434. package/dist/layout-engine/painters/dom/src/sdt/inline.d.ts +9 -0
  435. package/dist/layout-engine/painters/dom/src/sdt/snapshot.d.ts +29 -0
  436. package/dist/layout-engine/painters/dom/src/styles.d.ts +71 -0
  437. package/dist/layout-engine/painters/dom/src/svg-utils.d.ts +101 -0
  438. package/dist/layout-engine/painters/dom/src/table/border-utils.d.ts +185 -0
  439. package/dist/layout-engine/painters/dom/src/table/grid-geometry.d.ts +69 -0
  440. package/dist/layout-engine/painters/dom/src/table/renderTableCell.d.ts +170 -0
  441. package/dist/layout-engine/painters/dom/src/table/renderTableFragment.d.ts +132 -0
  442. package/dist/layout-engine/painters/dom/src/table/renderTableRow.d.ts +146 -0
  443. package/dist/layout-engine/painters/dom/src/test-utils/normalize-line.d.ts +39 -0
  444. package/dist/layout-engine/painters/dom/src/utils/anchor-helpers.d.ts +3 -0
  445. package/dist/layout-engine/painters/dom/src/utils/apply-styles.d.ts +1 -0
  446. package/dist/layout-engine/painters/dom/src/utils/layout-identity.d.ts +9 -0
  447. package/dist/layout-engine/painters/dom/src/utils/source-anchor.d.ts +2 -0
  448. package/dist/layout-engine/style-engine/src/bench/resolveSdtMetadata.bench.d.ts +1 -0
  449. package/dist/layout-engine/style-engine/src/cascade.d.ts +43 -0
  450. package/dist/layout-engine/style-engine/src/index.d.ts +121 -0
  451. package/dist/layout-engine/style-engine/src/normalize/colors.d.ts +13 -0
  452. package/dist/layout-engine/style-engine/src/normalize/index.d.ts +13 -0
  453. package/dist/layout-engine/style-engine/src/normalize/paragraph-attrs.d.ts +3 -0
  454. package/dist/layout-engine/style-engine/src/normalize/run-attrs.d.ts +17 -0
  455. package/dist/layout-engine/style-engine/src/normalize/types.d.ts +36 -0
  456. package/dist/layout-engine/style-engine/src/normalize/units.d.ts +13 -0
  457. package/dist/layout-engine/style-engine/src/ooxml/index.d.ts +64 -0
  458. package/dist/layout-engine/style-engine/src/ooxml/numbering-types.d.ts +126 -0
  459. package/dist/layout-engine/style-engine/src/ooxml/styles-types.d.ts +363 -0
  460. package/dist/layout-engine/style-engine/src/ooxml/table-style-selection.d.ts +86 -0
  461. package/dist/layout-engine/style-engine/src/ooxml/types.d.ts +459 -0
  462. package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-theme.d.ts +33 -0
  463. package/dist/layout-engine/style-engine/src/ooxml/word-style-model/parse-xml.d.ts +29 -0
  464. package/dist/public/ui-react.cjs +175 -0
  465. package/dist/public/ui-react.es.js +159 -0
  466. package/dist/public/ui.cjs +5 -0
  467. package/dist/public/ui.es.js +2 -0
  468. package/dist/shared/common/comments-types.d.ts +102 -0
  469. package/dist/shared/common/layout-constants.d.ts +7 -0
  470. package/dist/shared/common/list-marker-utils.d.ts +186 -0
  471. package/dist/shared/common/list-numbering/index.d.ts +16 -0
  472. package/dist/shared/font-system/src/activation.d.ts +64 -0
  473. package/dist/shared/font-system/src/bundled-manifest.d.ts +32 -0
  474. package/dist/shared/font-system/src/bundled.d.ts +41 -0
  475. package/dist/shared/font-system/src/document-font-options.d.ts +53 -0
  476. package/dist/shared/font-system/src/epoch.d.ts +6 -0
  477. package/dist/shared/font-system/src/font-offerings.d.ts +120 -0
  478. package/dist/shared/font-system/src/index.d.ts +35 -0
  479. package/dist/shared/font-system/src/os2.d.ts +30 -0
  480. package/dist/shared/font-system/src/registry.d.ts +188 -0
  481. package/dist/shared/font-system/src/report.d.ts +98 -0
  482. package/dist/shared/font-system/src/resolver.d.ts +215 -0
  483. package/dist/shared/font-system/src/substitution-evidence.d.ts +103 -0
  484. package/dist/shared/font-system/src/types.d.ts +128 -0
  485. package/dist/style.css +3323 -0
  486. package/dist/style.layered.css +3323 -0
  487. package/dist/superdoc/src/SuperDoc.vue.d.ts +88 -0
  488. package/dist/superdoc/src/cdn-entry.d.ts +2 -0
  489. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +62 -0
  490. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +26 -0
  491. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +19 -0
  492. package/dist/superdoc/src/components/CommentsLayer/CommentsDropdown.vue.d.ts +30 -0
  493. package/dist/superdoc/src/components/CommentsLayer/InternalDropdown.vue.d.ts +10 -0
  494. package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +1 -0
  495. package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +6 -0
  496. package/dist/superdoc/src/components/CommentsLayer/comment-schemas.d.ts +18 -0
  497. package/dist/superdoc/src/components/CommentsLayer/commentsList/commentsList.vue.d.ts +9 -0
  498. package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +21 -0
  499. package/dist/superdoc/src/components/CommentsLayer/floating-comment-positioning.d.ts +28 -0
  500. package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +7 -0
  501. package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +2 -0
  502. package/dist/superdoc/src/components/CommentsLayer/types.d.ts +3 -0
  503. package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts +8 -0
  504. package/dist/superdoc/src/components/CommentsLayer/use-conversation.d.ts +22 -0
  505. package/dist/superdoc/src/components/CommentsLayer/use-floating-comment.d.ts +11 -0
  506. package/dist/superdoc/src/components/HtmlViewer/HtmlViewer.vue.d.ts +10 -0
  507. package/dist/superdoc/src/components/PdfViewer/PdfViewer.vue.d.ts +61 -0
  508. package/dist/superdoc/src/components/PdfViewer/PdfViewerDocument.vue.d.ts +21 -0
  509. package/dist/superdoc/src/components/PdfViewer/PdfViewerPage.vue.d.ts +24 -0
  510. package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +19 -0
  511. package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +17 -0
  512. package/dist/superdoc/src/components/Whiteboard/use-whiteboard.d.ts +18 -0
  513. package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +19 -0
  514. package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +17 -0
  515. package/dist/superdoc/src/components/surfaces/SurfaceDialog.vue.d.ts +12 -0
  516. package/dist/superdoc/src/components/surfaces/SurfaceExternalMount.vue.d.ts +19 -0
  517. package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +10 -0
  518. package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +31 -0
  519. package/dist/superdoc/src/components/surfaces/focusable-selector.d.ts +5 -0
  520. package/dist/superdoc/src/composables/find-shortcut-owner.d.ts +32 -0
  521. package/dist/superdoc/src/composables/replace-continuation.d.ts +37 -0
  522. package/dist/superdoc/src/composables/use-ai.d.ts +10 -0
  523. package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +10 -0
  524. package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +21 -0
  525. package/dist/superdoc/src/composables/use-document.d.ts +34 -0
  526. package/dist/superdoc/src/composables/use-field.d.ts +33 -0
  527. package/dist/superdoc/src/composables/use-find-replace.d.ts +83 -0
  528. package/dist/superdoc/src/composables/use-high-contrast-mode.d.ts +4 -0
  529. package/dist/superdoc/src/composables/use-link-popover.d.ts +221 -0
  530. package/dist/superdoc/src/composables/use-password-prompt.d.ts +33 -0
  531. package/dist/superdoc/src/composables/use-selected-text.d.ts +16 -0
  532. package/dist/superdoc/src/composables/use-viewport-fit.d.ts +50 -0
  533. package/dist/superdoc/src/composables/useUiFontFamily.d.ts +24 -0
  534. package/dist/superdoc/src/core/EventEmitter.d.ts +55 -0
  535. package/dist/superdoc/src/core/SuperDoc.d.ts +775 -0
  536. package/dist/superdoc/src/core/collaboration/collaboration-comments.d.ts +4 -0
  537. package/dist/superdoc/src/core/collaboration/collaboration.d.ts +28 -0
  538. package/dist/superdoc/src/core/collaboration/helpers.d.ts +8 -0
  539. package/dist/superdoc/src/core/collaboration/permissions.d.ts +19 -0
  540. package/dist/superdoc/src/core/collaboration/resolve-v2-collaboration-target.d.ts +99 -0
  541. package/dist/superdoc/src/core/collaboration/room-overwrite.d.ts +22 -0
  542. package/dist/superdoc/src/core/collaboration/v2-awareness-bridge.d.ts +57 -0
  543. package/dist/superdoc/src/core/config/merge-defined.d.ts +35 -0
  544. package/dist/superdoc/src/core/config/normalize-interaction-config.d.ts +15 -0
  545. package/dist/superdoc/src/core/config/normalize-surfaces-config.d.ts +23 -0
  546. package/dist/superdoc/src/core/config/normalize-ui-config.d.ts +62 -0
  547. package/dist/superdoc/src/core/create-app.d.ts +32 -0
  548. package/dist/superdoc/src/core/editor-runtime/conformance/fake-v2-runtime.d.ts +9 -0
  549. package/dist/superdoc/src/core/editor-runtime/editor-runtime-registry.d.ts +117 -0
  550. package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -0
  551. package/dist/superdoc/src/core/editor-runtime/root-marker.d.ts +33 -0
  552. package/dist/superdoc/src/core/editor-runtime/types.d.ts +405 -0
  553. package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +185 -0
  554. package/dist/superdoc/src/core/editor-runtime/v2/v2-session-shortcut-routes.d.ts +47 -0
  555. package/dist/superdoc/src/core/extensions/define.d.ts +56 -0
  556. package/dist/superdoc/src/core/extensions/index.d.ts +2 -0
  557. package/dist/superdoc/src/core/extensions/types.d.ts +519 -0
  558. package/dist/superdoc/src/core/helpers/export.d.ts +2 -0
  559. package/dist/superdoc/src/core/helpers/file.d.ts +43 -0
  560. package/dist/superdoc/src/core/helpers/normalize-track-changes-config.d.ts +60 -0
  561. package/dist/superdoc/src/core/helpers/normalize-user.d.ts +13 -0
  562. package/dist/superdoc/src/core/index.d.ts +1 -0
  563. package/dist/superdoc/src/core/pdf/helpers/constants.d.ts +2 -0
  564. package/dist/superdoc/src/core/pdf/helpers/floor.d.ts +1 -0
  565. package/dist/superdoc/src/core/pdf/helpers/range.d.ts +1 -0
  566. package/dist/superdoc/src/core/pdf/helpers/read-file.d.ts +1 -0
  567. package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +66 -0
  568. package/dist/superdoc/src/core/surface-manager.d.ts +90 -0
  569. package/dist/superdoc/src/core/theme/create-theme.d.ts +82 -0
  570. package/dist/superdoc/src/core/types/index.d.ts +3253 -0
  571. package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +3 -0
  572. package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +16 -0
  573. package/dist/superdoc/src/core/v2-integration/v2-integration.d.ts +97 -0
  574. package/dist/superdoc/src/core/whiteboard/Whiteboard.d.ts +247 -0
  575. package/dist/superdoc/src/core/whiteboard/WhiteboardPage.d.ts +251 -0
  576. package/dist/superdoc/src/core/whiteboard/WhiteboardRenderer.d.ts +2 -0
  577. package/dist/superdoc/src/core/whiteboard/helpers/createTextarea.d.ts +1 -0
  578. package/dist/superdoc/src/core/whiteboard/helpers/flattenPoints.d.ts +1 -0
  579. package/dist/superdoc/src/core/whiteboard/helpers/getRandomId.d.ts +1 -0
  580. package/dist/superdoc/src/helpers/collect-touched-tracked-change-ids.d.ts +11 -0
  581. package/dist/superdoc/src/helpers/comment-focus.d.ts +4 -0
  582. package/dist/superdoc/src/helpers/comment-small-screen.d.ts +14 -0
  583. package/dist/superdoc/src/helpers/deprecation.d.ts +26 -0
  584. package/dist/superdoc/src/helpers/floor.d.ts +1 -0
  585. package/dist/superdoc/src/helpers/group-changes.d.ts +1 -0
  586. package/dist/superdoc/src/helpers/interaction-trace.d.ts +26 -0
  587. package/dist/superdoc/src/helpers/selection-source.d.ts +1 -0
  588. package/dist/superdoc/src/helpers/transaction-touches-structural-change.d.ts +19 -0
  589. package/dist/superdoc/src/helpers/use-selection.d.ts +17 -0
  590. package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +22 -0
  591. package/dist/superdoc/src/helpers/v2-remote-review-hydration.d.ts +12 -0
  592. package/dist/superdoc/src/helpers/v2-review-mutation-impact.d.ts +19 -0
  593. package/dist/superdoc/src/helpers/v2-review-mutation-reconciler.d.ts +19 -0
  594. package/dist/superdoc/src/helpers/v2-review-target.d.ts +7 -0
  595. package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +12 -0
  596. package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +5 -0
  597. package/dist/superdoc/src/icons.d.ts +11 -0
  598. package/dist/superdoc/src/index.d.cts +13 -0
  599. package/dist/superdoc/src/index.d.ts +11 -0
  600. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +21 -0
  601. package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +6 -0
  602. package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +10 -0
  603. package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +10 -0
  604. package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +10 -0
  605. package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +10 -0
  606. package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +14 -0
  607. package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +13 -0
  608. package/dist/superdoc/src/internal/toolbar/built-in/LinkInput.vue.d.ts +37 -0
  609. package/dist/superdoc/src/internal/toolbar/built-in/LinkedStyle.vue.d.ts +12 -0
  610. package/dist/superdoc/src/internal/toolbar/built-in/OverflowMenu.vue.d.ts +10 -0
  611. package/dist/superdoc/src/internal/toolbar/built-in/SdTooltip.vue.d.ts +34 -0
  612. package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +14 -0
  613. package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +8 -0
  614. package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +6 -0
  615. package/dist/superdoc/src/internal/toolbar/built-in/Toolbar.vue.d.ts +4 -0
  616. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButton.vue.d.ts +24 -0
  617. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarButtonIcon.vue.d.ts +11 -0
  618. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +18 -0
  619. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +38 -0
  620. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +8 -0
  621. package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +24 -0
  622. package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +101 -0
  623. package/dist/superdoc/src/internal/toolbar/built-in/default-items.d.ts +17 -0
  624. package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +1 -0
  625. package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +11 -0
  626. package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +5 -0
  627. package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +1 -0
  628. package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +5 -0
  629. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +10 -0
  630. package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +4 -0
  631. package/dist/superdoc/src/internal/toolbar/built-in/toolbar-focus-helpers.d.ts +1 -0
  632. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +76 -0
  633. package/dist/superdoc/src/internal/toolbar/built-in/toolbarTexts.d.ts +58 -0
  634. package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +8 -0
  635. package/dist/superdoc/src/internal/toolbar/built-in/use-toolbar-item.d.ts +48 -0
  636. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +237 -0
  637. package/dist/superdoc/src/internal/toolbar/compatibility-catalog.d.ts +59 -0
  638. package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +63 -0
  639. package/dist/superdoc/src/internal/toolbar/index.d.ts +10 -0
  640. package/dist/superdoc/src/main.d.ts +1 -0
  641. package/dist/superdoc/src/public/browser-document-api.d.ts +53 -0
  642. package/dist/superdoc/src/public/collaboration-upgrade-engine.d.cts +26 -0
  643. package/dist/superdoc/src/public/collaboration-upgrade-engine.d.ts +130 -0
  644. package/dist/superdoc/src/public/index.d.cts +365 -0
  645. package/dist/superdoc/src/public/index.d.ts +182 -0
  646. package/dist/superdoc/src/public/ui/commands.d.ts +249 -0
  647. package/dist/superdoc/src/public/ui/create-super-doc-ui.d.ts +18 -0
  648. package/dist/superdoc/src/public/ui/entity-at.d.ts +29 -0
  649. package/dist/superdoc/src/public/ui/equality.d.ts +10 -0
  650. package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +36 -0
  651. package/dist/superdoc/src/public/ui/react.d.ts +81 -0
  652. package/dist/superdoc/src/public/ui/reasons.d.ts +99 -0
  653. package/dist/superdoc/src/public/ui/types.d.ts +1425 -0
  654. package/dist/superdoc/src/public/ui-react.d.cts +20 -0
  655. package/dist/superdoc/src/public/ui-react.d.ts +20 -0
  656. package/dist/superdoc/src/public/ui.d.cts +194 -0
  657. package/dist/superdoc/src/public/ui.d.ts +29 -0
  658. package/dist/superdoc/src/stores/comments-store.d.ts +700 -0
  659. package/dist/superdoc/src/stores/helpers/floating-comment-instances.d.ts +14 -0
  660. package/dist/superdoc/src/stores/helpers/tracked-change-thread-index.d.ts +14 -0
  661. package/dist/superdoc/src/stores/hrbr-fields-store.d.ts +43 -0
  662. package/dist/superdoc/src/stores/superdoc-store.d.ts +2254 -0
  663. package/dist/superdoc.cjs +40494 -0
  664. package/dist/superdoc.es.js +40418 -0
  665. package/dist/word-layout/src/index.d.ts +64 -0
  666. package/dist/word-layout/src/list-marker.d.ts +68 -0
  667. package/dist/word-layout/src/marker-utils.d.ts +20 -0
  668. package/dist/word-layout/src/numbering-manager.d.ts +85 -0
  669. package/dist/word-layout/src/tab-layout.d.ts +193 -0
  670. package/dist/word-layout/src/types.d.ts +106 -0
  671. package/dist/word-layout/src/unit-conversions.d.ts +120 -0
  672. package/dist-cdn/style.layered.css +2 -0
  673. package/dist-cdn/superdoc.min.css +2 -0
  674. package/dist-cdn/superdoc.min.js +108 -0
  675. package/package.json +138 -24
  676. package/.npmignore +0 -4
  677. package/data.json +0 -17
  678. package/index.js +0 -2
  679. package/lib/Augmenter.js +0 -27
  680. package/lib/Runner.js +0 -80
  681. package/lib/Stopper.js +0 -71
  682. package/test/superdoc.js +0 -126
  683. package/utils/app.js +0 -18
  684. package/utils/server.js +0 -2
  685. package/web/index.js +0 -54
  686. package/web/public/style.css +0 -76
  687. package/web/views/index.ejs +0 -53
  688. package/web/views/layout.ejs +0 -13
  689. package/web/views/method.ejs +0 -59
@@ -0,0 +1,108 @@
1
+ var SuperDoc=(function(){var sI=Object.create,sh=Object.defineProperty,aI=Object.getOwnPropertyDescriptor,lI=Object.getOwnPropertyNames,cI=Object.getPrototypeOf,uI=Object.prototype.hasOwnProperty,Ir=(e,t)=>()=>(e&&(t=e(e=0)),t),Nb=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nd=(e,t)=>{let n={};for(var r in e)sh(n,r,{get:e[r],enumerable:!0});return t&&sh(n,Symbol.toStringTag,{value:"Module"}),n},dI=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=lI(t),i=0,s=o.length,a;i<s;i++)a=o[i],!uI.call(e,a)&&a!==n&&sh(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=aI(t,a))||r.enumerable});return e},Bb=(e,t,n)=>(n=e!=null?sI(cI(e)):{},dI(t||!e||!e.__esModule?sh(n,"default",{value:e,enumerable:!0}):n,e)),fI=Nb(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function s(u,c,d,h,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new i(d,h||u,m),v=r?r+c:c;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],p]:u._events[v].push(p):(u._events[v]=p,u._eventsCount++),u}function a(u,c){--u._eventsCount===0?u._events=new o:delete u._events[c]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var c=[],d,h;if(this._eventsCount===0)return c;for(h in d=this._events)n.call(d,h)&&c.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},l.prototype.listeners=function(c){var d=r?r+c:c,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,p=h.length,v=new Array(p);m<p;m++)v[m]=h[m].fn;return v},l.prototype.listenerCount=function(c){var d=r?r+c:c,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(c,d,h,m,p,v){var _=r?r+c:c;if(!this._events[_])return!1;var C=this._events[_],k=arguments.length,y,b;if(C.fn){switch(C.once&&this.removeListener(c,C.fn,void 0,!0),k){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,m),!0;case 5:return C.fn.call(C.context,d,h,m,p),!0;case 6:return C.fn.call(C.context,d,h,m,p,v),!0}for(b=1,y=new Array(k-1);b<k;b++)y[b-1]=arguments[b];C.fn.apply(C.context,y)}else{var T=C.length,R;for(b=0;b<T;b++)switch(C[b].once&&this.removeListener(c,C[b].fn,void 0,!0),k){case 1:C[b].fn.call(C[b].context);break;case 2:C[b].fn.call(C[b].context,d);break;case 3:C[b].fn.call(C[b].context,d,h);break;case 4:C[b].fn.call(C[b].context,d,h,m);break;default:if(!y)for(R=1,y=new Array(k-1);R<k;R++)y[R-1]=arguments[R];C[b].fn.apply(C[b].context,y)}}return!0},l.prototype.on=function(c,d,h){return s(this,c,d,h,!1)},l.prototype.once=function(c,d,h){return s(this,c,d,h,!0)},l.prototype.removeListener=function(c,d,h,m){var p=r?r+c:c;if(!this._events[p])return this;if(!d)return a(this,p),this;var v=this._events[p];if(v.fn)v.fn===d&&(!m||v.once)&&(!h||v.context===h)&&a(this,p);else{for(var _=0,C=[],k=v.length;_<k;_++)(v[_].fn!==d||m&&!v[_].once||h&&v[_].context!==h)&&C.push(v[_]);C.length?this._events[p]=C.length===1?C[0]:C:a(this,p)}return this},l.prototype.removeAllListeners=function(c){var d;return c?(d=r?r+c:c,this._events[d]&&a(this,d)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),Ym=Bb(fI(),1),fo=[];for(let e=0;e<256;++e)fo.push((e+256).toString(16).slice(1));function hI(e,t=0){return(fo[e[t+0]]+fo[e[t+1]]+fo[e[t+2]]+fo[e[t+3]]+"-"+fo[e[t+4]]+fo[e[t+5]]+"-"+fo[e[t+6]]+fo[e[t+7]]+"-"+fo[e[t+8]]+fo[e[t+9]]+"-"+fo[e[t+10]]+fo[e[t+11]]+fo[e[t+12]]+fo[e[t+13]]+fo[e[t+14]]+fo[e[t+15]]).toLowerCase()}var Xm,pI=new Uint8Array(16);function mI(){if(!Xm){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xm=crypto.getRandomValues.bind(crypto)}return Xm(pI)}var gI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zb={randomUUID:gI};function vI(e,t,n){if(zb.randomUUID&&!t&&!e)return zb.randomUUID();e=e||{};const r=e.random??e.rng?.()??mI();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return hI(r)}var as=vI;function rd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function yn(e){if(Mt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Xn(r)?yI(r):yn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Xn(e)||Ln(e))return e}function yI(e){const t={};return e.replace(Zb,"").split(Yb).forEach(n=>{if(n){const r=n.split(Xb);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function rn(e){let t="";if(Xn(e))t=e;else if(Mt(e))for(let n=0;n<e.length;n++){const r=rn(e[n]);r&&(t+=r+" ")}else if(Ln(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Zm(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Xn(t)&&(e.class=rn(t)),n&&(e.style=yn(n)),e}function Vb(e){return!!e||e===""}function bI(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Fs(e[r],t[r]);return n}function Fs(e,t){if(e===t)return!0;let n=Jm(e),r=Jm(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Go(e),r=Go(t),n||r)return e===t;if(n=Mt(e),r=Mt(t),n||r)return n&&r?bI(e,t):!1;if(n=Ln(e),r=Ln(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!Fs(e[o],t[o]))return!1}}return String(e)===String(t)}function ah(e,t){return e.findIndex(n=>Fs(n,t))}function wI(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var In,Fl,ci,Qm,Rc,od,Un,lh,Hb,Fn,Mt,Nl,Oa,Jm,jb,Zt,Xn,Go,Ln,ch,$m,Bl,Ub,id,sd,Fa,ad,Gb,Pr,Wb,Do,Mc,Lc,Qr,zl,eg,ld,cd,Kb,ud,qb,Yb,Xb,Zb,tg,Qb,CI,ng,Bt,rg,uh,og=Ir((()=>{In={},Fl=[],ci=()=>{},Qm=()=>!1,Rc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),od=e=>e.startsWith("onUpdate:"),Un=Object.assign,lh=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Hb=Object.prototype.hasOwnProperty,Fn=(e,t)=>Hb.call(e,t),Mt=Array.isArray,Nl=e=>Bl(e)==="[object Map]",Oa=e=>Bl(e)==="[object Set]",Jm=e=>Bl(e)==="[object Date]",jb=e=>Bl(e)==="[object RegExp]",Zt=e=>typeof e=="function",Xn=e=>typeof e=="string",Go=e=>typeof e=="symbol",Ln=e=>e!==null&&typeof e=="object",ch=e=>(Ln(e)||Zt(e))&&Zt(e.then)&&Zt(e.catch),$m=Object.prototype.toString,Bl=e=>$m.call(e),Ub=e=>Bl(e).slice(8,-1),id=e=>Bl(e)==="[object Object]",sd=e=>Xn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Fa=rd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ad=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Gb=/-\w/g,Pr=ad(e=>e.replace(Gb,t=>t.slice(1).toUpperCase())),Wb=/\B([A-Z])/g,Do=ad(e=>e.replace(Wb,"-$1").toLowerCase()),Mc=ad(e=>e.charAt(0).toUpperCase()+e.slice(1)),Lc=ad(e=>e?`on${Mc(e)}`:""),Qr=(e,t)=>!Object.is(e,t),zl=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},eg=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ld=e=>{const t=parseFloat(e);return isNaN(t)?e:t},cd=e=>{const t=Xn(e)?Number(e):NaN;return isNaN(t)?e:t},ud=()=>Kb||(Kb=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),qb=rd("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"),Yb=/;(?![^(]*\))/g,Xb=/:([^]+)/,Zb=/\/\*[^]*?\*\//g,tg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Qb=rd(tg),CI=rd(tg+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),ng=e=>!!(e&&e.__v_isRef===!0),Bt=e=>Xn(e)?e:e==null?"":Mt(e)||Ln(e)&&(e.toString===$m||!Zt(e.toString))?ng(e)?Bt(e.value):JSON.stringify(e,rg,2):String(e),rg=(e,t)=>ng(t)?rg(e,t.value):Nl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[uh(r,i)+" =>"]=o,n),{})}:Oa(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>uh(n))}:Go(t)?uh(t):Ln(t)&&!Mt(t)&&!id(t)?String(t):t,uh=(e,t="")=>{var n;return Go(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function ig(e){return new gh(e)}function sg(){return Io}function Jb(e,t=!1){Io&&Io.cleanups.push(e)}function $b(e,t=!1){if(e.flags|=8,t){e.next=pd,pd=e;return}e.next=hd,hd=e}function ag(){mg++}function lg(){if(--mg>0)return;if(pd){let t=pd;for(pd=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;hd;){let t=hd;for(hd=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function e2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function t2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),ug(r),_I(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function cg(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(n2(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function n2(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Oc)||(e.globalVersion=Oc,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!cg(e))))return;e.flags|=2;const t=e.dep,n=$n,r=_i;$n=e,_i=!0;try{e2(e);const o=e.fn(e._value);(t.version===0||Qr(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{$n=n,_i=r,t2(e),e.flags&=-3}}function ug(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)ug(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function _I(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function SI(e,t){e.effect instanceof Dc&&(e=e.effect.fn);const n=new Dc(e);t&&Un(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function kI(e){e.effect.stop()}function Ns(){gg.push(_i),_i=!1}function Bs(){const e=gg.pop();_i=e===void 0?!0:e}function r2(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=$n;$n=void 0;try{t()}finally{$n=n}}}function o2(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)o2(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Ao(e,t,n){if(_i&&$n){let r=gd.get(e);r||gd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new md),o.map=r,o.key=n),o.track()}}function zs(e,t,n,r,o,i){const s=gd.get(e);if(!s){Oc++;return}const a=l=>{l&&l.trigger()};if(ag(),t==="clear")s.forEach(a);else{const l=Mt(e),u=l&&sd(n);if(l&&n==="length"){const c=Number(r);s.forEach((d,h)=>{(h==="length"||h===Fc||!Go(h)&&h>=c)&&a(d)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(Fc)),t){case"add":l?u&&a(s.get("length")):(a(s.get(Na)),Nl(e)&&a(s.get(yh)));break;case"delete":l||(a(s.get(Na)),Nl(e)&&a(s.get(yh)));break;case"set":Nl(e)&&a(s.get(Na));break}}lg()}function AI(e,t){const n=gd.get(e);return n&&n.get(t)}function Pc(e){const t=mn(e);return t===e?t:(Ao(t,"iterate",Fc),Wo(e)?t:t.map(Si))}function dh(e){return Ao(e=mn(e),"iterate",Fc),e}function ls(e,t){return cs(e)?Vl(Ci(e)?Si(t):t):Si(t)}function dg(e,t,n){const r=dh(e),o=r[t]();return r!==e&&!Wo(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function Vs(e,t,n,r,o,i){const s=dh(e),a=s!==e&&!Wo(e),l=s[t];if(l!==p2[t]){const d=l.apply(e,i);return a?Si(d):d}let u=n;s!==e&&(a?u=function(d,h){return n.call(this,ls(e,d),h,e)}:n.length>2&&(u=function(d,h){return n.call(this,d,h,e)}));const c=l.call(s,u,r);return a&&o?o(c):c}function i2(e,t,n,r){const o=dh(e),i=o!==e&&!Wo(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,c,d){return a&&(a=!1,u=ls(e,u)),n.call(this,u,ls(e,c),d,e)}):n.length>3&&(s=function(u,c,d){return n.call(this,u,c,d,e)}));const l=o[t](s,...r);return a?ls(e,l):l}function fg(e,t,n){const r=mn(e);Ao(r,"iterate",Fc);const o=r[t](...n);return(o===-1||o===!1)&&fd(n[0])?(n[0]=mn(n[0]),r[t](...n)):o}function dd(e,t,n=[]){Ns(),ag();const r=mn(e)[t].apply(e,n);return lg(),Bs(),r}function II(e){Go(e)||(e=String(e));const t=mn(this);return Ao(t,"has",e),t.hasOwnProperty(e)}function EI(e,t,n){return function(...r){const o=this.__v_raw,i=mn(o),s=Nl(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),c=n?bh:t?Vl:Si;return!t&&Ao(i,"iterate",l?yh:Na),Un(Object.create(u),{next(){const{value:d,done:h}=u.next();return h?{value:d,done:h}:{value:a?[c(d[0]),c(d[1])]:c(d),done:h}}})}}function fh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function xI(e,t){const n={get(r){const o=this.__v_raw,i=mn(o),s=mn(r);e||(Qr(r,s)&&Ao(i,"get",r),Ao(i,"get",s));const{has:a}=vd(i),l=t?bh:e?Vl:Si;if(a.call(i,r))return l(o.get(r));if(a.call(i,s))return l(o.get(s));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!e&&Ao(mn(r),"iterate",Na),r.size},has(r){const o=this.__v_raw,i=mn(o),s=mn(r);return e||(Qr(r,s)&&Ao(i,"has",r),Ao(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=mn(s),l=t?bh:e?Vl:Si;return!e&&Ao(a,"iterate",Na),s.forEach((u,c)=>r.call(o,l(u),l(c),i))}};return Un(n,e?{add:fh("add"),set:fh("set"),delete:fh("delete"),clear:fh("clear")}:{add(r){const o=mn(this),i=vd(o),s=mn(r),a=!t&&!Wo(r)&&!cs(r)?s:r;return i.has.call(o,a)||Qr(r,a)&&i.has.call(o,r)||Qr(s,a)&&i.has.call(o,s)||(o.add(a),zs(o,"add",a,a)),this},set(r,o){!t&&!Wo(o)&&!cs(o)&&(o=mn(o));const i=mn(this),{has:s,get:a}=vd(i);let l=s.call(i,r);l||(r=mn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?Qr(o,u)&&zs(i,"set",r,o,u):zs(i,"add",r,o),this},delete(r){const o=mn(this),{has:i,get:s}=vd(o);let a=i.call(o,r);a||(r=mn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&zs(o,"delete",r,void 0,l),u},clear(){const r=mn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&zs(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=EI(r,e,t)}),n}function hh(e,t){const n=xI(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Fn(n,o)&&o in r?n:r,o,i)}function TI(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function RI(e){return e.__v_skip||!Object.isExtensible(e)?0:TI(Ub(e))}function Gr(e){return cs(e)?e:mh(e,!1,g2,w2,Cg)}function s2(e){return mh(e,!1,y2,C2,_g)}function ph(e){return mh(e,!0,v2,_2,Sg)}function MI(e){return mh(e,!0,b2,S2,kg)}function mh(e,t,n,r,o){if(!Ln(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=RI(e);if(i===0)return e;const s=o.get(e);if(s)return s;const a=new Proxy(e,i===2?r:n);return o.set(e,a),a}function Ci(e){return cs(e)?Ci(e.__v_raw):!!(e&&e.__v_isReactive)}function cs(e){return!!(e&&e.__v_isReadonly)}function Wo(e){return!!(e&&e.__v_isShallow)}function fd(e){return e?!!e.__v_raw:!1}function mn(e){const t=e&&e.__v_raw;return t?mn(t):e}function Wr(e){return!Fn(e,"__v_skip")&&Object.isExtensible(e)&&eg(e,"__v_skip",!0),e}function nr(e){return e?e.__v_isRef===!0:!1}function ne(e){return a2(e,!1)}function Kr(e){return a2(e,!0)}function a2(e,t){return nr(e)?e:new k2(e,t)}function LI(e){e.dep&&e.dep.trigger()}function et(e){return nr(e)?e.value:e}function PI(e){return Zt(e)?e():et(e)}function hg(e){return Ci(e)?e:new Proxy(e,A2)}function l2(e){return new I2(e)}function c2(e){const t=Mt(e)?new Array(e.length):{};for(const n in e)t[n]=u2(e,n);return t}function pg(e,t,n){return nr(e)?e:Zt(e)?new x2(e):Ln(e)&&arguments.length>1?u2(e,t,n):ne(e)}function u2(e,t,n){return new E2(e,t,n)}function DI(e,t,n=!1){let r,o;return Zt(e)?r=e:(r=e.get,o=e.set),new T2(r,o,n)}function OI(){return js}function d2(e,t=!1,n=js){if(n){let r=bd.get(n);r||bd.set(n,r=[]),r.push(e)}}function FI(e,t,n=In){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=b=>o?b:Wo(b)||o===!1||o===0?Hs(b,1):Hs(b);let c,d,h,m,p=!1,v=!1;if(nr(e)?(d=()=>e.value,p=Wo(e)):Ci(e)?(d=()=>u(e),p=!0):Mt(e)?(v=!0,p=e.some(b=>Ci(b)||Wo(b)),d=()=>e.map(b=>{if(nr(b))return b.value;if(Ci(b))return u(b);if(Zt(b))return l?l(b,2):b()})):Zt(e)?t?d=l?()=>l(e,2):e:d=()=>{if(h){Ns();try{h()}finally{Bs()}}const b=js;js=c;try{return l?l(e,3,[m]):e(m)}finally{js=b}}:d=ci,t&&o){const b=d,T=o===!0?1/0:o;d=()=>Hs(b(),T)}const _=sg(),C=()=>{c.stop(),_&&_.active&&lh(_.effects,c)};if(i&&t){const b=t;t=(...T)=>{b(...T),C()}}let k=v?new Array(e.length).fill(yd):yd;const y=b=>{if(!(!(c.flags&1)||!c.dirty&&!b))if(t){const T=c.run();if(o||p||(v?T.some((R,P)=>Qr(R,k[P])):Qr(T,k))){h&&h();const R=js;js=c;try{const P=[T,k===yd?void 0:v&&k[0]===yd?[]:k,m];k=T,l?l(t,3,P):t(...P)}finally{js=R}}}else c.run()};return a&&a(y),c=new Dc(d),c.scheduler=s?()=>s(y,!1):y,m=b=>d2(b,!1,c),h=c.onStop=()=>{const b=bd.get(c);if(b){if(l)l(b,4);else for(const T of b)T();bd.delete(c)}},t?r?y(!0):k=c.run():s?s(y.bind(null,!0),!0):c.run(),C.pause=c.pause.bind(c),C.resume=c.resume.bind(c),C.stop=C,C}function Hs(e,t=1/0,n){if(t<=0||!Ln(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,nr(e))Hs(e.value,t,n);else if(Mt(e))for(let r=0;r<e.length;r++)Hs(e[r],t,n);else if(Oa(e)||Nl(e))e.forEach(r=>{Hs(r,t,n)});else if(id(e)){for(const r in e)Hs(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Hs(e[r],t,n)}return e}var Io,gh,$n,vh,Dc,mg,hd,pd,_i,gg,Oc,f2,md,gd,Na,yh,Fc,h2,p2,m2,vg,yg,bg,wg,g2,v2,y2,b2,bh,vd,w2,C2,_2,S2,Cg,_g,Sg,kg,Si,Vl,k2,A2,I2,E2,x2,T2,R2,M2,yd,bd,js,NI=Ir((()=>{og(),gh=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Io,!e&&Io&&(this.index=(Io.scopes||(Io.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Io;try{return Io=this,e()}finally{Io=t}}}on(){++this._on===1&&(this.prevScope=Io,Io=this)}off(){this._on>0&&--this._on===0&&(Io=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}},vh=new WeakSet,Dc=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Io&&Io.active&&Io.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,vh.has(this)&&(vh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||$b(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,r2(this),e2(this);const e=$n,t=_i;$n=this,_i=!0;try{return this.fn()}finally{t2(this),$n=e,_i=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ug(e);this.deps=this.depsTail=void 0,r2(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?vh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){cg(this)&&this.run()}get dirty(){return cg(this)}},mg=0,_i=!0,gg=[],Oc=0,f2=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},md=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!$n||!_i||$n===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==$n)t=this.activeLink=new f2($n,this),$n.deps?(t.prevDep=$n.depsTail,$n.depsTail.nextDep=t,$n.depsTail=t):$n.deps=$n.depsTail=t,o2(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=$n.depsTail,t.nextDep=void 0,$n.depsTail.nextDep=t,$n.depsTail=t,$n.deps===t&&($n.deps=n)}return t}trigger(e){this.version++,Oc++,this.notify(e)}notify(e){ag();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{lg()}}},gd=new WeakMap,Na=Symbol(""),yh=Symbol(""),Fc=Symbol(""),h2={__proto__:null,[Symbol.iterator](){return dg(this,Symbol.iterator,e=>ls(this,e))},concat(...e){return Pc(this).concat(...e.map(t=>Mt(t)?Pc(t):t))},entries(){return dg(this,"entries",e=>(e[1]=ls(this,e[1]),e))},every(e,t){return Vs(this,"every",e,t,void 0,arguments)},filter(e,t){return Vs(this,"filter",e,t,n=>n.map(r=>ls(this,r)),arguments)},find(e,t){return Vs(this,"find",e,t,n=>ls(this,n),arguments)},findIndex(e,t){return Vs(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Vs(this,"findLast",e,t,n=>ls(this,n),arguments)},findLastIndex(e,t){return Vs(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Vs(this,"forEach",e,t,void 0,arguments)},includes(...e){return fg(this,"includes",e)},indexOf(...e){return fg(this,"indexOf",e)},join(e){return Pc(this).join(e)},lastIndexOf(...e){return fg(this,"lastIndexOf",e)},map(e,t){return Vs(this,"map",e,t,void 0,arguments)},pop(){return dd(this,"pop")},push(...e){return dd(this,"push",e)},reduce(e,...t){return i2(this,"reduce",e,t)},reduceRight(e,...t){return i2(this,"reduceRight",e,t)},shift(){return dd(this,"shift")},some(e,t){return Vs(this,"some",e,t,void 0,arguments)},splice(...e){return dd(this,"splice",e)},toReversed(){return Pc(this).toReversed()},toSorted(e){return Pc(this).toSorted(e)},toSpliced(...e){return Pc(this).toSpliced(...e)},unshift(...e){return dd(this,"unshift",e)},values(){return dg(this,"values",e=>ls(this,e))}},p2=Array.prototype,m2=rd("__proto__,__v_isRef,__isVue"),vg=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Go)),yg=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return o;if(t==="__v_raw")return n===(r?o?kg:Sg:o?_g:Cg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Mt(e);if(!r){let a;if(i&&(a=h2[t]))return a;if(t==="hasOwnProperty")return II}const s=Reflect.get(e,t,nr(e)?e:n);if((Go(t)?vg.has(t):m2(t))||(r||Ao(e,"get",t),o))return s;if(nr(s)){const a=i&&sd(t)?s:s.value;return r&&Ln(a)?ph(a):a}return Ln(s)?r?ph(s):Gr(s):s}},bg=class extends yg{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Mt(e)&&sd(t);if(!this._isShallow){const l=cs(o);if(!Wo(n)&&!cs(n)&&(o=mn(o),n=mn(n)),!i&&nr(o)&&!nr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Fn(e,t),a=Reflect.set(e,t,n,nr(e)?e:r);return e===mn(r)&&(s?Qr(n,o)&&zs(e,"set",t,n,o):zs(e,"add",t,n)),a}deleteProperty(e,t){const n=Fn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&zs(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!Go(t)||!vg.has(t))&&Ao(e,"has",t),n}ownKeys(e){return Ao(e,"iterate",Mt(e)?"length":Na),Reflect.ownKeys(e)}},wg=class extends yg{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},g2=new bg,v2=new wg,y2=new bg(!0),b2=new wg(!0),bh=e=>e,vd=e=>Reflect.getPrototypeOf(e),w2={get:hh(!1,!1)},C2={get:hh(!1,!0)},_2={get:hh(!0,!1)},S2={get:hh(!0,!0)},Cg=new WeakMap,_g=new WeakMap,Sg=new WeakMap,kg=new WeakMap,Si=e=>Ln(e)?Gr(e):e,Vl=e=>Ln(e)?ph(e):e,k2=class{constructor(e,t){this.dep=new md,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:mn(e),this._value=t?e:Si(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Wo(e)||cs(e);e=n?e:mn(e),Qr(e,t)&&(this._rawValue=e,this._value=n?e:Si(e),this.dep.trigger())}},A2={get:(e,t,n)=>t==="__v_raw"?e:et(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return nr(o)&&!nr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},I2=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new md,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}},E2=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Go(t)?t:String(t),this._raw=mn(e);let r=!0,o=e;if(!Mt(e)||Go(this._key)||!sd(this._key))do r=!fd(o)||Wo(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=et(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&nr(this._raw[this._key])){const t=this._object[this._key];if(nr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return AI(this._raw,this._key)}},x2=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}},T2=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new md(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Oc-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&$n!==this)return $b(this,!0),!0}get value(){const e=this.dep.track();return n2(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},R2={GET:"get",HAS:"has",ITERATE:"iterate"},M2={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},yd={},bd=new WeakMap,js=void 0}));function BI(e){Gg.push(e)}function zI(){Gg.pop()}function VI(e,t){}function Nc(e,t,n,r){try{return r?e(...r):e()}catch(o){Hl(o,t,n)}}function ki(e,t,n,r){if(Zt(e)){const o=Nc(e,t,n,r);return o&&ch(o)&&o.catch(i=>{Hl(i,t,n)}),o}if(Mt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(ki(e[i],t,n,r));return o}}function Hl(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||In;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let d=0;d<c.length;d++)if(c[d](e,l,u)===!1)return}a=a.parent}if(i){Ns(),Nc(i,null,10,[e,l,u]),Bs();return}}HI(e,n,o,r,s)}function HI(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function _t(e){const t=Md||Wg;return e?t.then(this?e.bind(this):e):t}function jI(e){let t=Bi+1,n=xo.length;for(;t<n;){const r=t+n>>>1,o=xo[r],i=Hc(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function Ag(e){if(!(e.flags&1)){const t=Hc(e),n=xo[xo.length-1];!n||!(e.flags&2)&&t>=Hc(n)?xo.push(e):xo.splice(jI(t),0,e),e.flags|=1,L2()}}function L2(){Md||(Md=Wg.then(D2))}function wd(e){Mt(e)?Gl.push(...e):qs&&e.id===-1?qs.splice(Wl+1,0,e):e.flags&1||(Gl.push(e),e.flags|=1),L2()}function P2(e,t,n=Bi+1){for(;n<xo.length;n++){const r=xo[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;xo.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function wh(e){if(Gl.length){const t=[...new Set(Gl)].sort((n,r)=>Hc(n)-Hc(r));if(Gl.length=0,qs){qs.push(...t);return}for(qs=t,Wl=0;Wl<qs.length;Wl++){const n=qs[Wl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}qs=null,Wl=0}}function D2(e){try{for(Bi=0;Bi<xo.length;Bi++){const t=xo[Bi];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Nc(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Bi<xo.length;Bi++){const t=xo[Bi];t&&(t.flags&=-2)}Bi=-1,xo.length=0,wh(e),Md=null,(xo.length||Gl.length)&&D2(e)}}function O2(e,t){var n,r;jc=e,jc?(jc.enabled=!0,Ld.forEach(({event:o,args:i})=>jc.emit(o,...i)),Ld=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{O2(o,t)}),setTimeout(()=>{jc||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Ld=[])},3e3)):Ld=[]}function Cd(e){const t=Jr;return Jr=e,Pd=e&&e.type.__scopeId||null,t}function UI(e){Pd=e}function GI(){Pd=null}function Eo(e,t=Jr,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Td(-1);const i=Cd(t);let s;try{s=e(...o)}finally{Cd(i),r._d&&Td(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function Us(e,t){if(Jr===null)return e;const n=Rd(Jr),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=In]=t[o];i&&(Zt(i)&&(i={mounted:i,updated:i}),i.deep&&Hs(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function us(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(Ns(),ki(l,n,8,[e.el,a,e,t]),Bs())}}function F2(e,t){if($r){let n=$r.provides;const r=$r.parent&&$r.parent.provides;r===n&&(n=$r.provides=Object.create(r)),n[e]=t}}function Ba(e,t,n=!1){const r=ir();if(r||ja){let o=ja?ja._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Zt(t)?t.call(r&&r.proxy):t}}function N2(){return!!(ir()||ja)}function WI(e,t){return _d(e,null,t)}function KI(e,t){return _d(e,null,{flush:"post"})}function B2(e,t){return _d(e,null,{flush:"sync"})}function Lt(e,t,n){return _d(e,t,n)}function _d(e,t,n=In){const{immediate:r,deep:o,flush:i,once:s}=n,a=Un({},n),l=t&&r||!t&&i!=="post";let u;if(Wa){if(i==="sync"){const m=qg();u=m.__watcherHandles||(m.__watcherHandles=[])}else if(!l){const m=()=>{};return m.stop=ci,m.resume=ci,m.pause=ci,m}}const c=$r;a.call=(m,p,v)=>ki(m,c,p,v);let d=!1;i==="post"?a.scheduler=m=>{Dr(m,c&&c.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(m,p)=>{p?m():Ag(m)}),a.augmentJob=m=>{t&&(m.flags|=4),d&&(m.flags|=2,c&&(m.id=c.uid,m.i=c))};const h=FI(e,t,a);return Wa&&(u?u.push(h):l&&h()),h}function qI(e,t,n){const r=this.proxy,o=Xn(e)?e.includes(".")?z2(r,e):()=>r[e]:e.bind(r,r);let i;Zt(t)?i=t:(i=t.handler,n=t);const s=Yl(this),a=_d(o,i.bind(r),n);return s(),a}function z2(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}function Ch(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:c}=e,d=i===2;if(d&&r(s,t,n),(!d||Va(c))&&l&16)for(let h=0;h<u.length;h++)o(u[h],t,n,2);d&&r(a,t,n)}function YI(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:c}},d){function h(_,C){let k=C;for(;k;){if(k&&k.nodeType===8){if(k.data==="teleport start anchor")t.targetStart=k;else if(k.data==="teleport anchor"){t.targetAnchor=k,_._lpa=t.targetAnchor&&s(t.targetAnchor);break}}k=s(k)}}function m(_,C){C.anchor=d(s(_),C,a(_),n,r,o,i)}const p=t.target=Lh(t.props,l),v=Va(t.props);if(p){const _=p._lpa||p.firstChild;t.shapeFlag&16&&(v?(m(e,t),h(p,_),t.targetAnchor||Ig(p,t,c,u,a(e)===p?e:null)):(t.anchor=s(e),h(p,_),t.targetAnchor||Ig(p,t,c,u),d(_&&s(_),t,p,n,r,o,i))),Sd(t,v)}else v&&t.shapeFlag&16&&(m(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function Sd(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ig(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Yg]=s,e&&(r(i,e,o),r(s,e,o)),s}function Eg(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Nn(()=>{e.isMounted=!0}),or(()=>{e.isUnmounting=!0}),e}function V2(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Er){t=n;break}}return t}function H2(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Bc(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:d,onBeforeLeave:h,onLeave:m,onAfterLeave:p,onLeaveCancelled:v,onBeforeAppear:_,onAppear:C,onAfterAppear:k,onAppearCancelled:y}=t,b=String(e.key),T=H2(n,e),R=(O,V)=>{O&&ki(O,r,9,V)},P=(O,V)=>{const Q=V[1];R(O,V),Mt(O)?O.every(F=>F.length<=1)&&Q():O.length<=1&&Q()},j={mode:s,persisted:a,beforeEnter(O){let V=l;if(!n.isMounted)if(i)V=_||l;else return;O[zi]&&O[zi](!0);const Q=T[b];Q&&Fi(e,Q)&&Q.el[zi]&&Q.el[zi](),R(V,[O])},enter(O){if(T[b]===e)return;let V=u,Q=c,F=d;if(!n.isMounted)if(i)V=C||u,Q=k||c,F=y||d;else return;let N=!1;O[Uc]=z=>{N||(N=!0,z?R(F,[O]):R(Q,[O]),j.delayedLeave&&j.delayedLeave(),O[Uc]=void 0)};const x=O[Uc].bind(null,!1);V?P(V,[O,x]):x()},leave(O,V){const Q=String(e.key);if(O[Uc]&&O[Uc](!0),n.isUnmounting)return V();R(h,[O]);let F=!1;O[zi]=x=>{F||(F=!0,V(),x?R(v,[O]):R(p,[O]),O[zi]=void 0,T[Q]===e&&delete T[Q])};const N=O[zi].bind(null,!1);T[Q]=e,m?P(m,[O,N]):N()},clone(O){const V=Bc(O,t,n,r,o);return o&&o(V),V}};return j}function xg(e){if(Gc(e))return e=ds(e),e.children=null,e}function j2(e){if(!Gc(e))return Xg(e.type)&&e.children?V2(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Zt(n.default))return n.default()}}function Gs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Gs(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function _h(e,t=!1,n){let r=[],o=0;for(let i=0;i<e.length;i++){let s=e[i];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:i);s.type===Wt?(s.patchFlag&128&&o++,r=r.concat(_h(s.children,t,a))):(t||s.type!==Er)&&r.push(a!=null?ds(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function jl(e,t){return Zt(e)?Un({name:e.name},t,{setup:e}):e}function XI(){const e=ir();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Tg(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function ZI(e){const t=ir(),n=Kr(null);if(t){const r=t.refs===In?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function U2(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function zc(e,t,n,r,o=!1){if(Mt(e)){e.forEach((v,_)=>zc(v,t&&(Mt(t)?t[_]:t),n,r,o));return}if(hs(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&zc(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?Rd(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,c=a.refs===In?a.refs={}:a.refs,d=a.setupState,h=mn(d),m=d===In?Qm:v=>U2(c,v)?!1:Fn(h,v),p=(v,_)=>!(_&&U2(c,_));if(u!=null&&u!==l){if(G2(t),Xn(u))c[u]=null,m(u)&&(d[u]=null);else if(nr(u)){const v=t;p(u,v.k)&&(u.value=null),v.k&&(c[v.k]=null)}}if(Zt(l))Nc(l,a,12,[s,c]);else{const v=Xn(l),_=nr(l);if(v||_){const C=()=>{if(e.f){const k=v?m(l)?d[l]:c[l]:p(l)||!e.k?l.value:c[e.k];if(o)Mt(k)&&lh(k,i);else if(Mt(k))k.includes(i)||k.push(i);else if(v)c[l]=[i],m(l)&&(d[l]=c[l]);else{const y=[i];p(l,e.k)&&(l.value=y),e.k&&(c[e.k]=y)}}else v?(c[l]=s,m(l)&&(d[l]=s)):_&&(p(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const k=()=>{C(),Dd.delete(e)};k.id=-1,Dd.set(e,k),Dr(k,n)}else G2(e),C()}}}function G2(e){const t=Dd.get(e);t&&(t.flags|=8,Dd.delete(e))}function QI(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,c=(y,b)=>{if(!b.hasChildNodes()){n(null,y,b),wh(),b._vnode=y;return}d(b.firstChild,y,null,null,null),wh(),b._vnode=y},d=(y,b,T,R,P,j=!1)=>{j=j||!!b.dynamicChildren;const O=ql(y)&&y.data==="[",V=()=>v(y,b,T,R,P,O),{type:Q,ref:F,shapeFlag:N,patchFlag:x}=b;let z=y.nodeType;b.el=y,x===-2&&(j=!1,b.dynamicChildren=null);let J=null;switch(Q){case Ys:z!==3?b.children===""?(l(b.el=o(""),s(y),y),J=y):J=V():(y.data!==b.children&&(Kl(),y.data=b.children),J=i(y));break;case Er:k(y)?(J=i(y),C(b.el=y.content.firstChild,y,T)):z!==8||O?J=V():J=i(y);break;case Ua:if(O&&(y=i(y),z=y.nodeType),z===1||z===3){J=y;const X=!b.children.length;for(let ae=0;ae<b.staticCount;ae++)X&&(b.children+=J.nodeType===1?J.outerHTML:J.data),ae===b.staticCount-1&&(b.anchor=J),J=i(J);return O?i(J):J}else V();break;case Wt:O?J=p(y,b,T,R,P,j):J=V();break;default:if(N&1)(z!==1||b.type.toLowerCase()!==y.tagName.toLowerCase())&&!k(y)?J=V():J=h(y,b,T,R,P,j);else if(N&6){b.slotScopeIds=P;const X=s(y);if(O?J=_(y):ql(y)&&y.data==="teleport start"?J=_(y,y.data,"teleport end"):J=i(y),t(b,X,null,T,R,Od(X),j),hs(b)&&!b.type.__asyncResolved){let ae;O?(ae=jt(Wt),ae.anchor=J?J.previousSibling:X.lastChild):ae=y.nodeType===3?Ni(""):jt("div"),ae.el=y,b.component.subTree=ae}}else N&64?z!==8?J=V():J=b.type.hydrate(y,b,T,R,P,j,e,m):N&128&&(J=b.type.hydrate(y,b,T,R,Od(s(y)),P,j,e,d))}return F!=null&&zc(F,null,R,b),J},h=(y,b,T,R,P,j)=>{j=j||!!b.dynamicChildren;const{type:O,props:V,patchFlag:Q,shapeFlag:F,dirs:N,transition:x}=b,z=O==="input"||O==="option";if(z||Q!==-1){N&&us(b,null,T,"created");let J=!1;if(k(y)){J=f1(null,x)&&T&&T.vnode.props&&T.vnode.props.appear;const ae=y.content.firstChild;if(J){const pe=ae.getAttribute("class");pe&&(ae.$cls=pe),x.beforeEnter(ae)}C(ae,y,T),b.el=y=ae}if(F&16&&!(V&&(V.innerHTML||V.textContent))){let ae=m(y.firstChild,b,y,T,R,P,j);for(;ae;){Sh(y,1)||Kl();const pe=ae;ae=ae.nextSibling,a(pe)}}else if(F&8){let ae=b.children;ae[0]===`
2
+ `&&(y.tagName==="PRE"||y.tagName==="TEXTAREA")&&(ae=ae.slice(1));const{textContent:pe}=y;pe!==ae&&pe!==ae.replace(/\r\n|\r/g,`
3
+ `)&&(Sh(y,0)||Kl(),y.textContent=b.children)}if(V){if(z||!j||Q&48){const ae=y.tagName.includes("-");for(const pe in V)(z&&(pe.endsWith("value")||pe==="indeterminate")||Rc(pe)&&!Fa(pe)||pe[0]==="."||ae&&!Fa(pe))&&r(y,pe,null,V[pe],void 0,T)}else if(V.onClick)r(y,"onClick",null,V.onClick,void 0,T);else if(Q&4&&Ci(V.style))for(const ae in V.style)V.style[ae]}let X;(X=V&&V.onVnodeBeforeMount)&&qo(X,T,b),N&&us(b,null,T,"beforeMount"),((X=V&&V.onVnodeMounted)||N||J)&&v1(()=>{X&&qo(X,T,b),J&&x.enter(y),N&&us(b,null,T,"mounted")},R)}return y.nextSibling},m=(y,b,T,R,P,j,O)=>{O=O||!!b.dynamicChildren;const V=b.children,Q=V.length;for(let F=0;F<Q;F++){const N=O?V[F]:V[F]=Ko(V[F]),x=N.type===Ys;y?(x&&!O&&F+1<Q&&Ko(V[F+1]).type===Ys&&(l(o(y.data.slice(N.children.length)),T,i(y)),y.data=N.children),y=d(y,N,R,P,j,O)):x&&!N.children?l(N.el=o(""),T):(Sh(T,1)||Kl(),n(null,N,T,null,R,P,Od(T),j))}return y},p=(y,b,T,R,P,j)=>{const{slotScopeIds:O}=b;O&&(P=P?P.concat(O):O);const V=s(y),Q=m(i(y),b,V,T,R,P,j);return Q&&ql(Q)&&Q.data==="]"?i(b.anchor=Q):(Kl(),l(b.anchor=u("]"),V,Q),Q)},v=(y,b,T,R,P,j)=>{if(Sh(y.parentElement,1)||Kl(),b.el=null,j){const Q=_(y);for(;;){const F=i(y);if(F&&F!==Q)a(F);else break}}const O=i(y),V=s(y);return a(y),n(null,b,V,O,T,R,Od(V),P),T&&(T.vnode.el=b.el,Rh(T,b.el)),O},_=(y,b="[",T="]")=>{let R=0;for(;y;)if(y=i(y),y&&ql(y)&&(y.data===b&&R++,y.data===T)){if(R===0)return i(y);R--}return y},C=(y,b,T)=>{const R=b.parentNode;R&&R.replaceChild(y,b);let P=T;for(;P;)P.vnode.el===b&&(P.vnode.el=P.subTree.el=y),P=P.parent},k=y=>y.nodeType===1&&y.tagName==="TEMPLATE";return[c,d]}function Sh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(tv);)e=e.parentElement;const n=e&&e.getAttribute(tv);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(O1[t])}}function JI(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:s}=window;return(t>0&&t<i||r>0&&r<i)&&(n>0&&n<s||o>0&&o<s)}function $I(e,t){if(ql(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(ql(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function W2(e){Zt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,c,d=0;const h=()=>(d++,u=null,m()),m=()=>{let p;return u||(p=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((_,C)=>{l(v,()=>_(h()),()=>C(v),d+1)});throw v}).then(v=>p!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),c=v,v)))};return jl({name:"AsyncComponentWrapper",__asyncLoader:m,__asyncHydrate(p,v,_){let C=!1;(v.bu||(v.bu=[])).push(()=>C=!0);const k=()=>{C||_()},y=i?()=>{const b=i(k,T=>$I(p,T));b&&(v.bum||(v.bum=[])).push(b)}:k;c?y():m().then(()=>!v.isUnmounted&&y())},get __asyncResolved(){return c},setup(){const p=$r;if(Tg(p),c)return()=>kh(c,p);const v=y=>{u=null,Hl(y,p,13,!r)};if(a&&p.suspense||Wa)return m().then(y=>()=>kh(y,p)).catch(y=>(v(y),()=>r?jt(r,{error:y}):null));const _=ne(!1),C=ne(),k=ne(!!o);return o&&setTimeout(()=>{k.value=!1},o),s!=null&&setTimeout(()=>{if(!_.value&&!C.value){const y=new Error(`Async component timed out after ${s}ms.`);v(y),C.value=y}},s),m().then(()=>{_.value=!0,p.parent&&Gc(p.parent.vnode)&&p.parent.update()}).catch(y=>{v(y),C.value=y}),()=>{if(_.value&&c)return kh(c,p);if(C.value&&r)return jt(r,{error:C.value});if(n&&!k.value)return kh(n,p)}}})}function kh(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=jt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function kd(e,t){return Mt(e)?e.some(n=>kd(n,t)):Xn(e)?e.split(",").includes(t):jb(e)?(e.lastIndex=0,e.test(t)):!1}function Rg(e,t){K2(e,"a",t)}function Mg(e,t){K2(e,"da",t)}function K2(e,t,n=$r){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Ih(t,r,n),n){let o=n.parent;for(;o&&o.parent;)Gc(o.parent.vnode)&&e5(r,t,n,o),o=o.parent}}function e5(e,t,n,r){const o=Ih(t,e,r,!0);Nd(()=>{lh(r[t],o)},n)}function Lg(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Ah(e){return e.shapeFlag&128?e.ssContent:e}function Ih(e,t,n=$r,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{Ns();const a=Yl(n),l=ki(t,n,e,s);return a(),Bs(),l});return r?o.unshift(i):o.push(i),i}}function q2(e,t=$r){Ih("ec",e,t)}function t5(e,t){return Dg(Oh,e,!0,t)||e}function Pg(e){return Xn(e)?Dg(Oh,e,!1)||e:e||sv}function Y2(e){return Dg(U1,e)}function Dg(e,t,n=!0,r=!1){const o=Jr||$r;if(o){const i=o.type;if(e===Oh){const a=Ug(i,!1);if(a&&(a===t||a===Pr(t)||a===Mc(Pr(t))))return i}const s=X2(o[e]||i[e],t)||X2(o.appContext[e],t);return!s&&r?i:s}}function X2(e,t){return e&&(e[t]||e[Pr(t)]||e[Mc(Pr(t))])}function rr(e,t,n,r){let o;const i=n&&n[r],s=Mt(e);if(s||Xn(e)){const a=s&&Ci(e);let l=!1,u=!1;a&&(l=!Wo(e),u=cs(e),e=dh(e)),o=new Array(e.length);for(let c=0,d=e.length;c<d;c++)o[c]=t(l?u?Vl(Si(e[c])):Si(e[c]):e[c],c,void 0,i&&i[c])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(Ln(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];o[l]=t(e[c],c,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function n5(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(Mt(r))for(let o=0;o<r.length;o++)e[r[o].name]=r[o].fn;else r&&(e[r.name]=r.key?(...o)=>{const i=r.fn(...o);return i&&(i.key=r.key),i}:r.fn)}return e}function Ad(e,t,n={},r,o){if(Jr.ce||Jr.parent&&hs(Jr.parent)&&Jr.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ge(),dn(Wt,null,[jt("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ge();const s=i&&Og(i(n)),a=n.key||s&&s.key,l=dn(Wt,{key:(a&&!Go(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function Og(e){return e.some(t=>Ws(t)?!(t.type===Er||t.type===Wt&&!Og(t.children)):!0)?e:null}function r5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:Lc(r)]=e[r];return n}function o5(){return null}function i5(){return null}function s5(e){}function a5(e){}function l5(){return null}function c5(){}function u5(e,t){return null}function d5(){return Q2("useSlots").slots}function Z2(){return Q2("useAttrs").attrs}function Q2(e){const t=ir();return t.setupContext||(t.setupContext=A1(t))}function Id(e){return Mt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function f5(e,t){const n=Id(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Mt(o)||Zt(o)?o=n[r]={type:o,default:t[r]}:o.default=t[r]:o===null&&(o=n[r]={default:t[r]}),o&&t[`__skip_${r}`]&&(o.skipFactory=!0)}return n}function h5(e,t){return!e||!t?e||t:Mt(e)&&Mt(t)?e.concat(t):Un({},Id(e),Id(t))}function p5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function m5(e){const t=ir(),n=Wa;let r=e();Yc(),n&&qc(!1);const o=()=>{Yl(t),n&&qc(!0)},i=()=>{ir()!==t&&t.scope.off(),Yc(),n&&qc(!1)};return ch(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function g5(e){const t=Fg(e),n=e.proxy,r=e.ctx;zh=!1,t.beforeCreate&&J2(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:c,beforeMount:d,mounted:h,beforeUpdate:m,updated:p,activated:v,deactivated:_,beforeDestroy:C,beforeUnmount:k,destroyed:y,unmounted:b,render:T,renderTracked:R,renderTriggered:P,errorCaptured:j,serverPrefetch:O,expose:V,inheritAttrs:Q,components:F,directives:N,filters:x}=t;if(u&&v5(u,r,null),s)for(const X in s){const ae=s[X];Zt(ae)&&(r[X]=ae.bind(n))}if(o){const X=o.call(n,n);Ln(X)&&(e.data=Gr(X))}if(zh=!0,i)for(const X in i){const ae=i[X],pe=ke({get:Zt(ae)?ae.bind(n,n):Zt(ae.get)?ae.get.bind(n,n):ci,set:!Zt(ae)&&Zt(ae.set)?ae.set.bind(n):ci});Object.defineProperty(r,X,{enumerable:!0,configurable:!0,get:()=>pe.value,set:Fe=>pe.value=Fe})}if(a)for(const X in a)$2(a[X],r,n,X);if(l){const X=Zt(l)?l.call(n):l;Reflect.ownKeys(X).forEach(ae=>{F2(ae,X[ae])})}c&&J2(c,e,"c");function J(X,ae){Mt(ae)?ae.forEach(pe=>X(pe.bind(n))):ae&&X(ae.bind(n))}if(J(nv,d),J(Nn,h),J(Dh,m),J(Fd,p),J(Rg,v),J(Mg,_),J(q2,j),J(iv,R),J(ov,P),J(or,k),J(Nd,b),J(rv,O),Mt(V))if(V.length){const X=e.exposed||(e.exposed={});V.forEach(ae=>{Object.defineProperty(X,ae,{get:()=>n[ae],set:pe=>n[ae]=pe,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===ci&&(e.render=T),Q!=null&&(e.inheritAttrs=Q),F&&(e.components=F),N&&(e.directives=N),O&&Tg(e)}function v5(e,t,n=ci){Mt(e)&&(e=Ng(e));for(const r in e){const o=e[r];let i;Ln(o)?"default"in o?i=Ba(o.from||r,o.default,!0):i=Ba(o.from||r):i=Ba(o),nr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function J2(e,t,n){ki(Mt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function $2(e,t,n,r){let o=r.includes(".")?z2(n,r):()=>n[r];if(Xn(e)){const i=t[e];Zt(i)&&Lt(o,i)}else if(Zt(e))Lt(o,e.bind(n));else if(Ln(e))if(Mt(e))e.forEach(i=>$2(i,t,n,r));else{const i=Zt(e.handler)?e.handler.bind(n):t[e.handler];Zt(i)&&Lt(o,i,e)}}function Fg(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>Eh(l,u,s,!0)),Eh(l,t,s)),Ln(t)&&i.set(t,l),l}function Eh(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Eh(e,i,n,!0),o&&o.forEach(s=>Eh(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=W1[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function e1(e,t){return t?e?function(){return Un(Zt(e)?e.call(this,this):e,Zt(t)?t.call(this,this):t)}:t:e}function y5(e,t){return Ed(Ng(e),Ng(t))}function Ng(e){if(Mt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Oo(e,t){return e?[...new Set([].concat(e,t))]:t}function Ed(e,t){return e?Un(Object.create(null),e,t):t}function t1(e,t){return e?Mt(e)&&Mt(t)?[...new Set([...e,...t])]:Un(Object.create(null),Id(e),Id(t??{})):t}function b5(e,t){if(!e)return t;if(!t)return e;const n=Un(Object.create(null),e);for(const r in t)n[r]=Oo(e[r],t[r]);return n}function n1(){return{app:null,config:{isNativeTag:Qm,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}function w5(e,t){return function(r,o=null){Zt(r)||(r=Un({},r)),o!=null&&!Ln(o)&&(o=null);const i=n1(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:K1++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:gv,get config(){return i.config},set config(c){},use(c,...d){return s.has(c)||(c&&Zt(c.install)?(s.add(c),c.install(u,...d)):Zt(c)&&(s.add(c),c(u,...d))),u},mixin(c){return i.mixins.includes(c)||i.mixins.push(c),u},component(c,d){return d?(i.components[c]=d,u):i.components[c]},directive(c,d){return d?(i.directives[c]=d,u):i.directives[c]},mount(c,d,h){if(!l){const m=u._ceVNode||jt(r,o);return m.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),d&&t?t(m,c):e(m,c,h),l=!0,u._container=c,c.__vue_app__=u,Rd(m.component)}},onUnmount(c){a.push(c)},unmount(){l&&(ki(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,d){return i.provides[c]=d,u},runWithContext(c){const d=ja;ja=u;try{return c()}finally{ja=d}}};return u}}function C5(e,t,n=In){const r=ir(),o=Pr(t),i=Do(t),s=av(e,o),a=l2((l,u)=>{let c,d=In,h;return B2(()=>{const m=e[o];Qr(c,m)&&(c=m,u())}),{get(){return l(),n.get?n.get(c):c},set(m){const p=n.set?n.set(m):m;if(!Qr(p,c)&&!(d!==In&&Qr(m,d)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(c=m,u()),r.emit(`update:${t}`,p),Qr(m,p)&&Qr(m,d)&&!Qr(p,h)&&u(),d=m,h=p}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||In:a,done:!1}:{done:!0}}}},a}function _5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||In;let o=n;const i=t.startsWith("update:"),s=i&&av(r,t.slice(7));s&&(s.trim&&(o=n.map(c=>Xn(c)?c.trim():c)),s.number&&(o=n.map(ld)));let a,l=r[a=Lc(t)]||r[a=Lc(Pr(t))];!l&&i&&(l=r[a=Lc(Do(t))]),l&&ki(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,ki(u,e,6,o)}}function r1(e,t,n=!1){const r=n?q1:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Zt(e)){const l=u=>{const c=r1(u,t,!0);c&&(a=!0,Un(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Ln(e)&&r.set(e,null),null):(Mt(i)?i.forEach(l=>s[l]=null):Un(s,i),Ln(e)&&r.set(e,s),s)}function xh(e,t){return!e||!Rc(t)?!1:(t=t.slice(2).replace(/Once$/,""),Fn(e,t[0].toLowerCase()+t.slice(1))||Fn(e,Do(t))||Fn(e,t))}function Th(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:c,props:d,data:h,setupState:m,ctx:p,inheritAttrs:v}=e,_=Cd(e);let C,k;try{if(n.shapeFlag&4){const b=o||r,T=b;C=Ko(u.call(T,b,c,d,m,h,p)),k=a}else{const b=t;C=Ko(b.length>1?b(d,{attrs:a,slots:s,emit:l}):b(d,null)),k=t.props?a:Y1(a)}}catch(b){Kc.length=0,Hl(b,e,1),C=jt(Er)}let y=C;if(k&&v!==!1){const b=Object.keys(k),{shapeFlag:T}=y;b.length&&T&7&&(i&&b.some(od)&&(k=X1(k,i)),y=ds(y,k,!1,!0))}return n.dirs&&(y=ds(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&Gs(y,n.transition),C=y,Cd(_),C}function S5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(Ws(o)){if(o.type!==Er||o.children==="v-if"){if(n)return;n=o}}else return}return n}function k5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?o1(r,s,u):!!s;if(l&8){const c=t.dynamicProps;for(let d=0;d<c.length;d++){const h=c[d];if(i1(s,r,h)&&!xh(u,h))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?o1(r,s,u):!0:!!s;return!1}function o1(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(i1(t,e,i)&&!xh(n,i))return!0}return!1}function i1(e,t,n){const r=e[n],o=t[n];return n==="style"&&Ln(r)&&Ln(o)?!Fs(r,o):r!==o}function Rh({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}function A5(e,t,n,r=!1){const o={},i=cv();e.propsDefaults=Object.create(null),s1(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:s2(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function I5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=mn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let d=0;d<c.length;d++){let h=c[d];if(xh(e.emitsOptions,h))continue;const m=t[h];if(l)if(Fn(i,h))m!==i[h]&&(i[h]=m,u=!0);else{const p=Pr(h);o[p]=Bg(l,a,p,m,e,!1)}else m!==i[h]&&(i[h]=m,u=!0)}}}else{s1(e,t,o,i)&&(u=!0);let c;for(const d in a)(!t||!Fn(t,d)&&((c=Do(d))===d||!Fn(t,c)))&&(l?n&&(n[d]!==void 0||n[c]!==void 0)&&(o[d]=Bg(l,a,d,void 0,e,!0)):delete o[d]);if(i!==a)for(const d in i)(!t||!Fn(t,d))&&(delete i[d],u=!0)}u&&zs(e.attrs,"set","")}function s1(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(Fa(l))continue;const u=t[l];let c;o&&Fn(o,c=Pr(l))?!i||!i.includes(c)?n[c]=u:(a||(a={}))[c]=u:xh(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=mn(n),u=a||In;for(let c=0;c<i.length;c++){const d=i[c];n[d]=Bg(o,l,d,u[d],e,!Fn(u,d))}}return s}function Bg(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Fn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Zt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const c=Yl(o);r=u[n]=l.call(null,t),c()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===Do(n))&&(r=!0))}return r}function a1(e,t,n=!1){const r=n?Z1:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Zt(e)){const c=d=>{l=!0;const[h,m]=a1(d,t,!0);Un(s,h),m&&a.push(...m)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!i&&!l)return Ln(e)&&r.set(e,Fl),Fl;if(Mt(i))for(let c=0;c<i.length;c++){const d=Pr(i[c]);l1(d)&&(s[d]=In)}else if(i)for(const c in i){const d=Pr(c);if(l1(d)){const h=i[c],m=s[d]=Mt(h)||Zt(h)?{type:h}:Un({},h),p=m.type;let v=!1,_=!0;if(Mt(p))for(let C=0;C<p.length;++C){const k=p[C],y=Zt(k)&&k.name;if(y==="Boolean"){v=!0;break}else y==="String"&&(_=!1)}else v=Zt(p)&&p.name==="Boolean";m[0]=v,m[1]=_,(v||Fn(m,"default"))&&a.push(d)}}const u=[s,a];return Ln(e)&&r.set(e,u),u}function l1(e){return e[0]!=="$"&&!Fa(e)}function tj(){}function c1(e){return d1(e)}function u1(e){return d1(e,QI)}function d1(e,t){const n=ud();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:c,parentNode:d,nextSibling:h,setScopeId:m=ci,insertStaticContent:p}=e,v=(Z,S,ee,D=null,U=null,H=null,G=void 0,te=null,Y=!!S.dynamicChildren)=>{if(Z===S)return;Z&&!Fi(Z,S)&&(D=$e(Z),ye(Z,U,H,!0),Z=null),S.patchFlag===-2&&(Y=!1,S.dynamicChildren=null);const{type:K,ref:be,shapeFlag:me}=S;switch(K){case Ys:_(Z,S,ee,D);break;case Er:C(Z,S,ee,D);break;case Ua:Z==null&&k(S,ee,D,G);break;case Wt:F(Z,S,ee,D,U,H,G,te,Y);break;default:me&1?T(Z,S,ee,D,U,H,G,te,Y):me&6?N(Z,S,ee,D,U,H,G,te,Y):(me&64||me&128)&&K.process(Z,S,ee,D,U,H,G,te,Y,Ee)}be!=null&&U?zc(be,Z&&Z.ref,H,S||Z,!S):be==null&&Z&&Z.ref!=null&&zc(Z.ref,null,H,Z,!0)},_=(Z,S,ee,D)=>{if(Z==null)r(S.el=a(S.children),ee,D);else{const U=S.el=Z.el;S.children!==Z.children&&u(U,S.children)}},C=(Z,S,ee,D)=>{Z==null?r(S.el=l(S.children||""),ee,D):S.el=Z.el},k=(Z,S,ee,D)=>{[Z.el,Z.anchor]=p(Z.children,S,ee,D,Z.el,Z.anchor)},y=({el:Z,anchor:S},ee,D)=>{let U;for(;Z&&Z!==S;)U=h(Z),r(Z,ee,D),Z=U;r(S,ee,D)},b=({el:Z,anchor:S})=>{let ee;for(;Z&&Z!==S;)ee=h(Z),o(Z),Z=ee;o(S)},T=(Z,S,ee,D,U,H,G,te,Y)=>{if(S.type==="svg"?G="svg":S.type==="math"&&(G="mathml"),Z==null)R(S,ee,D,U,H,G,te,Y);else{const K=Z.el&&Z.el._isVueCE?Z.el:null;try{K&&K._beginPatch(),O(Z,S,U,H,G,te,Y)}finally{K&&K._endPatch()}}},R=(Z,S,ee,D,U,H,G,te)=>{let Y,K;const{props:be,shapeFlag:me,transition:Ce,dirs:Pe}=Z;if(Y=Z.el=s(Z.type,H,be&&be.is,be),me&8?c(Y,Z.children):me&16&&j(Z.children,Y,null,D,U,zg(Z,H),G,te),Pe&&us(Z,null,D,"created"),P(Y,Z,Z.scopeId,G,D),be){for(const He in be)He!=="value"&&!Fa(He)&&i(Y,He,null,be[He],H,D);"value"in be&&i(Y,"value",null,be.value,H),(K=be.onVnodeBeforeMount)&&qo(K,D,Z)}Pe&&us(Z,null,D,"beforeMount");const it=f1(U,Ce);it&&Ce.beforeEnter(Y),r(Y,S,ee),((K=be&&be.onVnodeMounted)||it||Pe)&&Dr(()=>{K&&qo(K,D,Z),it&&Ce.enter(Y),Pe&&us(Z,null,D,"mounted")},U)},P=(Z,S,ee,D,U)=>{if(ee&&m(Z,ee),D)for(let H=0;H<D.length;H++)m(Z,D[H]);if(U){let H=U.subTree;if(S===H||Bd(H.type)&&(H.ssContent===S||H.ssFallback===S)){const G=U.vnode;P(Z,G,G.scopeId,G.slotScopeIds,U.parent)}}},j=(Z,S,ee,D,U,H,G,te,Y=0)=>{for(let K=Y;K<Z.length;K++)v(null,Z[K]=te?Ks(Z[K]):Ko(Z[K]),S,ee,D,U,H,G,te)},O=(Z,S,ee,D,U,H,G)=>{const te=S.el=Z.el;let{patchFlag:Y,dynamicChildren:K,dirs:be}=S;Y|=Z.patchFlag&16;const me=Z.props||In,Ce=S.props||In;let Pe;if(ee&&Ul(ee,!1),(Pe=Ce.onVnodeBeforeUpdate)&&qo(Pe,ee,S,Z),be&&us(S,Z,ee,"beforeUpdate"),ee&&Ul(ee,!0),(me.innerHTML&&Ce.innerHTML==null||me.textContent&&Ce.textContent==null)&&c(te,""),K?V(Z.dynamicChildren,K,te,ee,D,zg(S,U),H):G||ae(Z,S,te,null,ee,D,zg(S,U),H,!1),Y>0){if(Y&16)Q(te,me,Ce,ee,U);else if(Y&2&&me.class!==Ce.class&&i(te,"class",null,Ce.class,U),Y&4&&i(te,"style",me.style,Ce.style,U),Y&8){const it=S.dynamicProps;for(let He=0;He<it.length;He++){const Ct=it[He],Yt=me[Ct],St=Ce[Ct];(St!==Yt||Ct==="value")&&i(te,Ct,Yt,St,U,ee)}}Y&1&&Z.children!==S.children&&c(te,S.children)}else!G&&K==null&&Q(te,me,Ce,ee,U);((Pe=Ce.onVnodeUpdated)||be)&&Dr(()=>{Pe&&qo(Pe,ee,S,Z),be&&us(S,Z,ee,"updated")},D)},V=(Z,S,ee,D,U,H,G)=>{for(let te=0;te<S.length;te++){const Y=Z[te],K=S[te];v(Y,K,Y.el&&(Y.type===Wt||!Fi(Y,K)||Y.shapeFlag&198)?d(Y.el):ee,null,D,U,H,G,!0)}},Q=(Z,S,ee,D,U)=>{if(S!==ee){if(S!==In)for(const H in S)!Fa(H)&&!(H in ee)&&i(Z,H,S[H],null,U,D);for(const H in ee){if(Fa(H))continue;const G=ee[H],te=S[H];G!==te&&H!=="value"&&i(Z,H,te,G,U,D)}"value"in ee&&i(Z,"value",S.value,ee.value,U)}},F=(Z,S,ee,D,U,H,G,te,Y)=>{const K=S.el=Z?Z.el:a(""),be=S.anchor=Z?Z.anchor:a("");let{patchFlag:me,dynamicChildren:Ce,slotScopeIds:Pe}=S;Pe&&(te=te?te.concat(Pe):Pe),Z==null?(r(K,ee,D),r(be,ee,D),j(S.children||[],ee,be,U,H,G,te,Y)):me>0&&me&64&&Ce&&Z.dynamicChildren&&Z.dynamicChildren.length===Ce.length?(V(Z.dynamicChildren,Ce,ee,U,H,G,te),(S.key!=null||U&&S===U.subTree)&&Vg(Z,S,!0)):ae(Z,S,ee,be,U,H,G,te,Y)},N=(Z,S,ee,D,U,H,G,te,Y)=>{S.slotScopeIds=te,Z==null?S.shapeFlag&512?U.ctx.activate(S,ee,D,G,Y):x(S,ee,D,U,H,G,Y):z(Z,S,Y)},x=(Z,S,ee,D,U,H,G)=>{const te=Z.component=C1(Z,D,U);if(Gc(Z)&&(te.ctx.renderer=Ee),S1(te,!1,G),te.asyncDep){if(U&&U.registerDep(te,J,G),!Z.el){const Y=te.subTree=jt(Er);C(null,Y,S,ee),Z.placeholder=Y.el}}else J(te,Z,S,ee,U,H,G)},z=(Z,S,ee)=>{const D=S.component=Z.component;if(k5(Z,S,ee))if(D.asyncDep&&!D.asyncResolved){X(D,S,ee);return}else D.next=S,D.update();else S.el=Z.el,D.vnode=S},J=(Z,S,ee,D,U,H,G)=>{const te=()=>{if(Z.isMounted){let{next:me,bu:Ce,u:Pe,parent:it,vnode:He}=Z;{const Nt=h1(Z);if(Nt){me&&(me.el=He.el,X(Z,me,G)),Nt.asyncDep.then(()=>{Dr(()=>{Z.isUnmounted||K()},U)});return}}let Ct=me,Yt;Ul(Z,!1),me?(me.el=He.el,X(Z,me,G)):me=He,Ce&&zl(Ce),(Yt=me.props&&me.props.onVnodeBeforeUpdate)&&qo(Yt,it,me,He),Ul(Z,!0);const St=Th(Z),Ft=Z.subTree;Z.subTree=St,v(Ft,St,d(Ft.el),$e(Ft),Z,U,H),me.el=St.el,Ct===null&&Rh(Z,St.el),Pe&&Dr(Pe,U),(Yt=me.props&&me.props.onVnodeUpdated)&&Dr(()=>qo(Yt,it,me,He),U)}else{let me;const{el:Ce,props:Pe}=S,{bm:it,m:He,parent:Ct,root:Yt,type:St}=Z,Ft=hs(S);if(Ul(Z,!1),it&&zl(it),!Ft&&(me=Pe&&Pe.onVnodeBeforeMount)&&qo(me,Ct,S),Ul(Z,!0),Ce&&qe){const Nt=()=>{Z.subTree=Th(Z),qe(Ce,Z.subTree,Z,U,null)};Ft&&St.__asyncHydrate?St.__asyncHydrate(Ce,Z,Nt):Nt()}else{Yt.ce&&Yt.ce._hasShadowRoot()&&Yt.ce._injectChildStyle(St,Z.parent?Z.parent.type:void 0);const Nt=Z.subTree=Th(Z);v(null,Nt,ee,D,Z,U,H),S.el=Nt.el}if(He&&Dr(He,U),!Ft&&(me=Pe&&Pe.onVnodeMounted)){const Nt=S;Dr(()=>qo(me,Ct,Nt),U)}(S.shapeFlag&256||Ct&&hs(Ct.vnode)&&Ct.vnode.shapeFlag&256)&&Z.a&&Dr(Z.a,U),Z.isMounted=!0,S=ee=D=null}};Z.scope.on();const Y=Z.effect=new Dc(te);Z.scope.off();const K=Z.update=Y.run.bind(Y),be=Z.job=Y.runIfDirty.bind(Y);be.i=Z,be.id=Z.uid,Y.scheduler=()=>Ag(be),Ul(Z,!0),K()},X=(Z,S,ee)=>{S.component=Z;const D=Z.vnode.props;Z.vnode=S,Z.next=null,I5(Z,S.props,D,ee),$1(Z,S.children,ee),Ns(),P2(Z),Bs()},ae=(Z,S,ee,D,U,H,G,te,Y=!1)=>{const K=Z&&Z.children,be=Z?Z.shapeFlag:0,me=S.children,{patchFlag:Ce,shapeFlag:Pe}=S;if(Ce>0){if(Ce&128){Fe(K,me,ee,D,U,H,G,te,Y);return}else if(Ce&256){pe(K,me,ee,D,U,H,G,te,Y);return}}Pe&8?(be&16&&xe(K,U,H),me!==K&&c(ee,me)):be&16?Pe&16?Fe(K,me,ee,D,U,H,G,te,Y):xe(K,U,H,!0):(be&8&&c(ee,""),Pe&16&&j(me,ee,D,U,H,G,te,Y))},pe=(Z,S,ee,D,U,H,G,te,Y)=>{Z=Z||Fl,S=S||Fl;const K=Z.length,be=S.length,me=Math.min(K,be);let Ce;for(Ce=0;Ce<me;Ce++){const Pe=S[Ce]=Y?Ks(S[Ce]):Ko(S[Ce]);v(Z[Ce],Pe,ee,null,U,H,G,te,Y)}K>be?xe(Z,U,H,!0,!1,me):j(S,ee,D,U,H,G,te,Y,me)},Fe=(Z,S,ee,D,U,H,G,te,Y)=>{let K=0;const be=S.length;let me=Z.length-1,Ce=be-1;for(;K<=me&&K<=Ce;){const Pe=Z[K],it=S[K]=Y?Ks(S[K]):Ko(S[K]);if(Fi(Pe,it))v(Pe,it,ee,null,U,H,G,te,Y);else break;K++}for(;K<=me&&K<=Ce;){const Pe=Z[me],it=S[Ce]=Y?Ks(S[Ce]):Ko(S[Ce]);if(Fi(Pe,it))v(Pe,it,ee,null,U,H,G,te,Y);else break;me--,Ce--}if(K>me){if(K<=Ce){const Pe=Ce+1,it=Pe<be?S[Pe].el:D;for(;K<=Ce;)v(null,S[K]=Y?Ks(S[K]):Ko(S[K]),ee,it,U,H,G,te,Y),K++}}else if(K>Ce)for(;K<=me;)ye(Z[K],U,H,!0),K++;else{const Pe=K,it=K,He=new Map;for(K=it;K<=Ce;K++){const Qt=S[K]=Y?Ks(S[K]):Ko(S[K]);Qt.key!=null&&He.set(Qt.key,K)}let Ct,Yt=0;const St=Ce-it+1;let Ft=!1,Nt=0;const sn=new Array(St);for(K=0;K<St;K++)sn[K]=0;for(K=Pe;K<=me;K++){const Qt=Z[K];if(Yt>=St){ye(Qt,U,H,!0);continue}let Ye;if(Qt.key!=null)Ye=He.get(Qt.key);else for(Ct=it;Ct<=Ce;Ct++)if(sn[Ct-it]===0&&Fi(Qt,S[Ct])){Ye=Ct;break}Ye===void 0?ye(Qt,U,H,!0):(sn[Ye-it]=K+1,Ye>=Nt?Nt=Ye:Ft=!0,v(Qt,S[Ye],ee,null,U,H,G,te,Y),Yt++)}const _n=Ft?E5(sn):Fl;for(Ct=_n.length-1,K=St-1;K>=0;K--){const Qt=it+K,Ye=S[Qt],Et=S[Qt+1],Ot=Qt+1<be?Et.el||p1(Et):D;sn[K]===0?v(null,Ye,ee,Ot,U,H,G,te,Y):Ft&&(Ct<0||K!==_n[Ct]?fe(Ye,ee,Ot,2):Ct--)}}},fe=(Z,S,ee,D,U=null)=>{const{el:H,type:G,transition:te,children:Y,shapeFlag:K}=Z;if(K&6){fe(Z.component.subTree,S,ee,D);return}if(K&128){Z.suspense.move(S,ee,D);return}if(K&64){G.move(Z,S,ee,Ee);return}if(G===Wt){r(H,S,ee);for(let be=0;be<Y.length;be++)fe(Y[be],S,ee,D);r(Z.anchor,S,ee);return}if(G===Ua){y(Z,S,ee);return}if(D!==2&&K&1&&te)if(D===0)te.beforeEnter(H),r(H,S,ee),Dr(()=>te.enter(H),U);else{const{leave:be,delayLeave:me,afterLeave:Ce}=te,Pe=()=>{Z.ctx.isUnmounted?o(H):r(H,S,ee)},it=()=>{H._isLeaving&&H[zi](!0),be(H,()=>{Pe(),Ce&&Ce()})};me?me(H,Pe,it):it()}else r(H,S,ee)},ye=(Z,S,ee,D=!1,U=!1)=>{const{type:H,props:G,ref:te,children:Y,dynamicChildren:K,shapeFlag:be,patchFlag:me,dirs:Ce,cacheIndex:Pe,memo:it}=Z;if(me===-2&&(U=!1),te!=null&&(Ns(),zc(te,null,ee,Z,!0),Bs()),Pe!=null&&(S.renderCache[Pe]=void 0),be&256){S.ctx.deactivate(Z);return}const He=be&1&&Ce,Ct=!hs(Z);let Yt;if(Ct&&(Yt=G&&G.onVnodeBeforeUnmount)&&qo(Yt,S,Z),be&6)re(Z.component,ee,D);else{if(be&128){Z.suspense.unmount(ee,D);return}He&&us(Z,null,S,"beforeUnmount"),be&64?Z.type.remove(Z,S,ee,Ee,D):K&&!K.hasOnce&&(H!==Wt||me>0&&me&64)?xe(K,S,ee,!1,!0):(H===Wt&&me&384||!U&&be&16)&&xe(Y,S,ee),D&&le(Z)}const St=it!=null&&Pe==null;(Ct&&(Yt=G&&G.onVnodeUnmounted)||He||St)&&Dr(()=>{Yt&&qo(Yt,S,Z),He&&us(Z,null,S,"unmounted"),St&&(Z.el=null)},ee)},le=Z=>{const{type:S,el:ee,anchor:D,transition:U}=Z;if(S===Wt){Se(ee,D);return}if(S===Ua){b(Z);return}const H=()=>{o(ee),U&&!U.persisted&&U.afterLeave&&U.afterLeave()};if(Z.shapeFlag&1&&U&&!U.persisted){const{leave:G,delayLeave:te}=U,Y=()=>G(ee,H);te?te(Z.el,H,Y):Y()}else H()},Se=(Z,S)=>{let ee;for(;Z!==S;)ee=h(Z),o(Z),Z=ee;o(S)},re=(Z,S,ee)=>{const{bum:D,scope:U,job:H,subTree:G,um:te,m:Y,a:K}=Z;Mh(Y),Mh(K),D&&zl(D),U.stop(),H&&(H.flags|=8,ye(G,Z,S,ee)),te&&Dr(te,S),Dr(()=>{Z.isUnmounted=!0},S)},xe=(Z,S,ee,D=!1,U=!1,H=0)=>{for(let G=H;G<Z.length;G++)ye(Z[G],S,ee,D,U)},$e=Z=>{if(Z.shapeFlag&6)return $e(Z.component.subTree);if(Z.shapeFlag&128)return Z.suspense.next();const S=h(Z.anchor||Z.el),ee=S&&S[Yg];return ee?h(ee):S};let st=!1;const At=(Z,S,ee)=>{let D;Z==null?S._vnode&&(ye(S._vnode,null,null,!0),D=S._vnode.component):v(S._vnode||null,Z,S,null,null,null,ee),S._vnode=Z,st||(st=!0,P2(D),wh(),st=!1)},Ee={p:v,um:ye,m:fe,r:le,mt:x,mc:j,pc:ae,pbc:V,n:$e,o:e};let Ge,qe;return t&&([Ge,qe]=t(Ee)),{render:At,hydrate:Ge,createApp:w5(At,Ge)}}function zg({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Ul({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function f1(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Vg(e,t,n=!1){const r=e.children,o=t.children;if(Mt(r)&&Mt(o))for(let i=0;i<r.length;i++){const s=r[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=Ks(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Vg(s,a)),a.type===Ys&&(a.patchFlag===-1&&(a=o[i]=Ks(a)),a.el=s.el),a.type===Er&&!a.el&&(a.el=s.el)}}function E5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function h1(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:h1(t)}function Mh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function p1(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?p1(t.subTree):null}function xd(e,t){const n=e.props&&e.props[t];Zt(n)&&n()}function x5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:c}}=l,d=c("div"),h=e.suspense=m1(e,o,r,t,d,n,i,s,a,l);u(null,h.pendingBranch=e.ssContent,d,null,r,h,i,s),h.deps>0?(xd(e,"onPending"),xd(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),Vc(h,e.ssFallback)):h.resolve(!1,!0)}function T5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:c}}){const d=t.suspense=e.suspense;d.vnode=t,t.el=e.el;const h=t.ssContent,m=t.ssFallback,{activeBranch:p,pendingBranch:v,isInFallback:_,isHydrating:C}=d;if(v)d.pendingBranch=h,Fi(v,h)?(l(v,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0?d.resolve():_&&(C||(l(p,m,n,r,o,null,i,s,a),Vc(d,m)))):(d.pendingId=jh++,C?(d.isHydrating=!1,d.activeBranch=v):u(v,o,d),d.deps=0,d.effects.length=0,d.hiddenContainer=c("div"),_?(l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0?d.resolve():(l(p,m,n,r,o,null,i,s,a),Vc(d,m))):p&&Fi(p,h)?(l(p,h,n,r,o,d,i,s,a),d.resolve(!0)):(l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0&&d.resolve()));else if(p&&Fi(p,h))l(p,h,n,r,o,d,i,s,a),Vc(d,h);else if(xd(t,"onPending"),d.pendingBranch=h,h.shapeFlag&512?d.pendingId=h.component.suspenseId:d.pendingId=jh++,l(null,h,d.hiddenContainer,null,o,d,i,s,a),d.deps<=0)d.resolve();else{const{timeout:k,pendingId:y}=d;k>0?setTimeout(()=>{d.pendingId===y&&d.fallback(m)},k):k===0&&d.fallback(m)}}function m1(e,t,n,r,o,i,s,a,l,u,c=!1){const{p:d,m:h,um:m,n:p,o:{parentNode:v,remove:_}}=u;let C;const k=L5(e);k&&t&&t.pendingBranch&&(C=t.pendingId,t.deps++);const y=e.props?cd(e.props.timeout):void 0,b=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:jh++,timeout:typeof y=="number"?y:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!c,isHydrating:c,isUnmounted:!1,effects:[],resolve(R=!1,P=!1){const{vnode:j,activeBranch:O,pendingBranch:V,pendingId:Q,effects:F,parentComponent:N,container:x,isInFallback:z}=T;let J=!1;T.isHydrating?T.isHydrating=!1:R||(J=O&&V.transition&&V.transition.mode==="out-in",J&&(O.transition.afterLeave=()=>{Q===T.pendingId&&(h(V,x,i===b?p(O):i,0),wd(F),z&&j.ssFallback&&(j.ssFallback.el=null))}),O&&!T.isFallbackMountPending&&(v(O.el)===x&&(i=p(O)),m(O,N,T,!0),!J&&z&&j.ssFallback&&Dr(()=>j.ssFallback.el=null,T)),J||h(V,x,i,0)),T.isFallbackMountPending=!1,Vc(T,V),T.pendingBranch=null,T.isInFallback=!1;let X=T.parent,ae=!1;for(;X;){if(X.pendingBranch){X.effects.push(...F),ae=!0;break}X=X.parent}!ae&&!J&&wd(F),T.effects=[],k&&t&&t.pendingBranch&&C===t.pendingId&&(t.deps--,t.deps===0&&!P&&t.resolve()),xd(j,"onResolve")},fallback(R){if(!T.pendingBranch)return;const{vnode:P,activeBranch:j,parentComponent:O,container:V,namespace:Q}=T;xd(P,"onFallback");const F=p(j),N=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(d(null,R,V,F,O,null,Q,a,l),Vc(T,R))},x=R.transition&&R.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,j.transition.afterLeave=N),T.isInFallback=!0,m(j,O,null,!0),x||N()},move(R,P,j){T.activeBranch&&h(T.activeBranch,R,P,j),T.container=R},next(){return T.activeBranch&&p(T.activeBranch)},registerDep(R,P,j){const O=!!T.pendingBranch;O&&T.deps++;const V=R.vnode.el;R.asyncDep.catch(Q=>{Hl(Q,R,0)}).then(Q=>{if(R.isUnmounted||T.isUnmounted||T.pendingId!==R.suspenseId)return;Yc(),R.asyncResolved=!0;const{vnode:F}=R;jg(R,Q,!1),V&&(F.el=V);const N=!V&&R.subTree.el;P(R,F,v(V||R.subTree.el),V?null:p(R.subTree),T,s,j),N&&(F.placeholder=null,_(N)),Rh(R,F.el),O&&--T.deps===0&&T.resolve()})},unmount(R,P){T.isUnmounted=!0,T.activeBranch&&m(T.activeBranch,n,R,P),T.pendingBranch&&m(T.pendingBranch,n,R,P)}};return T}function R5(e,t,n,r,o,i,s,a,l){const u=t.suspense=m1(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),c=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),c}function M5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=g1(r?n.default:n),e.ssFallback=r?g1(n.fallback):jt(Er)}function g1(e){let t;if(Zt(e)){const n=Ga&&e._c;n&&(e._d=!1,ge()),e=e(),n&&(e._d=!0,t=ho,y1())}return Mt(e)&&(e=S5(e)),e=Ko(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function v1(e,t){t&&t.pendingBranch?Mt(e)?t.effects.push(...e):t.effects.push(e):wd(e)}function Vc(e,t){e.activeBranch=t;const{vnode:n,parentComponent:r}=e;let o=t.el;for(;!o&&t.component;)t=t.component.subTree,o=t.el;n.el=o,r&&r.subTree===n&&(r.vnode.el=o,Rh(r,o))}function L5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ge(e=!1){Kc.push(ho=e?null:[])}function y1(){Kc.pop(),ho=Kc[Kc.length-1]||null}function Td(e,t=!1){Ga+=e,e<0&&ho&&t&&(ho.hasOnce=!0)}function b1(e){return e.dynamicChildren=Ga>0?ho||Fl:null,y1(),Ga>0&&ho&&ho.push(e),e}function Ae(e,t,n,r,o,i){return b1(Me(e,t,n,r,o,i,!0))}function dn(e,t,n,r,o){return b1(jt(e,t,n,r,o,!0))}function Ws(e){return e?e.__v_isVNode===!0:!1}function Fi(e,t){return e.type===t.type&&e.key===t.key}function P5(e){}function Me(e,t=null,n=null,r=0,o=null,i=e===Wt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&pv(t),ref:t&&zd(t),scopeId:Pd,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Jr};return a?(Hg(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Xn(n)?8:16),Ga>0&&!s&&ho&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ho.push(l),l}function D5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===sv)&&(e=Er),Ws(e)){const a=ds(e,t,!0);return n&&Hg(a,n),Ga>0&&!i&&ho&&(a.shapeFlag&6?ho[ho.indexOf(e)]=a:ho.push(a)),a.patchFlag=-2,a}if(B5(e)&&(e=e.__vccOpts),t){t=w1(t);let{class:a,style:l}=t;a&&!Xn(a)&&(t.class=rn(a)),Ln(l)&&(fd(l)&&!Mt(l)&&(l=Un({},l)),t.style=yn(l))}const s=Xn(e)?1:Bd(e)?128:Xg(e)?64:Ln(e)?4:Zt(e)?2:0;return Me(e,t,n,r,o,s,i,!0)}function w1(e){return e?fd(e)||uv(e)?Un({},e):e:null}function ds(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?fs(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&pv(u),ref:t&&t.ref?n&&i?Mt(i)?i.concat(zd(t)):[i,zd(t)]:zd(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Wt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ds(e.ssContent),ssFallback:e.ssFallback&&ds(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Gs(c,l.clone(c)),c}function Ni(e=" ",t=0){return jt(Ys,null,e,t)}function O5(e,t){const n=jt(Ua,null,e);return n.staticCount=t,n}function ht(e="",t=!1){return t?(ge(),dn(Er,null,e)):jt(Er,null,e)}function Ko(e){return e==null||typeof e=="boolean"?jt(Er):Mt(e)?jt(Wt,null,e.slice()):Ws(e)?Ks(e):jt(Ys,null,String(e))}function Ks(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ds(e)}function Hg(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Mt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Hg(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!uv(t)?t._ctx=Jr:o===3&&Jr&&(Jr.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Zt(t)?(t={default:t,_ctx:Jr},n=32):(t=String(t),r&64?(n=16,t=[Ni(t)]):n=8);e.children=t,e.shapeFlag|=n}function fs(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=rn([t.class,r.class]));else if(o==="style")t.style=yn([t.style,r.style]);else if(Rc(o)){const i=t[o],s=r[o];s&&i!==s&&!(Mt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!od(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function qo(e,t,n,r=null){ki(e,t,7,[n,r])}function C1(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||tw,i={uid:nw++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new gh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:a1(r,o),emitsOptions:r1(r,o),emit:null,emitted:null,propsDefaults:In,inheritAttrs:r.inheritAttrs,ctx:In,data:In,props:In,attrs:In,slots:In,refs:In,setupState:In,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=_5.bind(null,i),e.ce&&e.ce(i),i}function _1(e){return e.vnode.shapeFlag&4}function S1(e,t=!1,n=!1){t&&qc(t);const{props:r,children:o}=e.vnode,i=_1(e);A5(e,r,i,t),J1(e,o,n||t);const s=i?F5(e,t):void 0;return t&&qc(!1),s}function F5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Bh);const{setup:r}=n;if(r){Ns();const o=e.setupContext=r.length>1?A1(e):null,i=Yl(e),s=Nc(r,e,0,[e.props,o]),a=ch(s);if(Bs(),i(),(a||e.sp)&&!hs(e)&&Tg(e),a){if(s.then(Yc,Yc),t)return s.then(l=>{jg(e,l,t)}).catch(l=>{Hl(l,e,0)});e.asyncDep=s}else jg(e,s,t)}else k1(e,t)}function jg(e,t,n){Zt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ln(t)&&(e.setupState=hg(t)),k1(e,n)}function N5(e){Gh=e,mv=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,G1))}}function k1(e,t,n){const r=e.type;if(!e.render){if(!t&&Gh&&!r.render){const o=r.template||Fg(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=Un(Un({isCustomElement:i,delimiters:a},s),l);r.render=Gh(o,u)}}e.render=r.render||ci,mv&&mv(e)}{const o=Yl(e);Ns();try{g5(e)}finally{Bs(),o()}}}function A1(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,ow),slots:e.slots,emit:e.emit,expose:t}}function Rd(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(hg(Wr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Wc)return Wc[n](e)},has(t,n){return n in t||n in Wc}})):e.proxy}function Ug(e,t=!0){return Zt(e)?e.displayName||e.name:e.name||t&&e.__name}function B5(e){return Zt(e)&&"__vccOpts"in e}function Vr(e,t,n){try{Td(-1);const r=arguments.length;return r===2?Ln(t)&&!Mt(t)?Ws(t)?jt(e,null,[t]):jt(e,t):jt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ws(n)&&(n=[n]),jt(e,t,n))}finally{Td(1)}}function z5(){return;function e(t,n,r){const o=t[r];if(Mt(o)&&o.includes(n)||Ln(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function V5(e,t,n,r){const o=n[r];if(o&&I1(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function I1(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Qr(n[r],t[r]))return!1;return Ga>0&&ho&&ho.push(e),!0}var Gg,E1,x1,xo,Bi,Gl,qs,Wl,Wg,Md,Hc,jc,Ld,Jr,Pd,T1,Kg,qg,za,Yg,Xg,Va,R1,Zg,Qg,Lh,M1,Ha,zi,Uc,ui,Ph,Jg,L1,$g,Dd,ev,Kl,P1,D1,Od,ql,tv,O1,F1,N1,B1,z1,V1,H1,hs,Gc,j1,ps,nv,Nn,Dh,Fd,or,Nd,rv,ov,iv,Oh,U1,sv,Fh,Wc,Nh,Bh,G1,zh,W1,K1,ja,av,q1,Y1,X1,lv,cv,uv,Z1,Vh,Hh,Q1,dv,fv,hv,J1,$1,Dr,Bd,jh,ew,Wt,Ys,Er,Ua,Kc,ho,Ga,pv,zd,jt,tw,nw,$r,ir,Uh,qc,Yl,Yc,Wa,Gh,mv,rw,ow,ke,gv,iw,sw,aw,lw,cw,H5,j5,U5,uw=Ir((()=>{NI(),og(),Gg=[],E1={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},x1={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},xo=[],Bi=-1,Gl=[],qs=null,Wl=0,Wg=Promise.resolve(),Md=null,Hc=e=>e.id==null?e.flags&2?-1:1/0:e.id,Ld=[],Jr=null,Pd=null,T1=e=>Eo,Kg=Symbol.for("v-scx"),qg=()=>{{const e=Ba(Kg);return e}},za=new WeakMap,Yg=Symbol("_vte"),Xg=e=>e.__isTeleport,Va=e=>e&&(e.disabled||e.disabled===""),R1=e=>e&&(e.defer||e.defer===""),Zg=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qg=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Lh=(e,t)=>{const n=e&&e.to;return Xn(n)?t?t(n):null:n},M1={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:c,pc:d,pbc:h,o:{insert:m,querySelector:p,createText:v,createComment:_}}=u,C=Va(t.props);let{dynamicChildren:k}=t;const y=(R,P,j)=>{R.shapeFlag&16&&c(R.children,P,j,o,i,s,a,l)},b=(R=t)=>{const P=Va(R.props),j=R.target=Lh(R.props,p),O=Ig(j,R,v,m);j&&(s!=="svg"&&Zg(j)?s="svg":s!=="mathml"&&Qg(j)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(j),P||(y(R,j,O),Sd(R,!1)))},T=R=>{const P=()=>{za.get(R)===P&&(za.delete(R),Va(R.props)&&(y(R,n,R.anchor),Sd(R,!0)),b(R))};za.set(R,P),Dr(P,i)};if(e==null){const R=t.el=v(""),P=t.anchor=v("");if(m(R,n,r),m(P,n,r),R1(t.props)||i&&i.pendingBranch){T(t);return}C&&(y(t,n,P),Sd(t,!0)),b()}else{t.el=e.el;const R=t.anchor=e.anchor,P=za.get(e);if(P){P.flags|=8,za.delete(e),T(t);return}t.targetStart=e.targetStart;const j=t.target=e.target,O=t.targetAnchor=e.targetAnchor,V=Va(e.props),Q=V?n:j,F=V?R:O;if(s==="svg"||Zg(j)?s="svg":(s==="mathml"||Qg(j))&&(s="mathml"),k?(h(e.dynamicChildren,k,Q,o,i,s,a),Vg(e,t,!0)):l||d(e,t,Q,F,o,i,s,a,!1),C)V?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Ch(t,n,R,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const N=t.target=Lh(t.props,p);N&&Ch(t,N,null,u,0)}else V&&Ch(t,j,O,u,1);Sd(t,C)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:c,target:d,props:h}=e;let m=i||!Va(h);const p=za.get(e);if(p&&(p.flags|=8,za.delete(e),m=!1),d&&(o(u),o(c)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const _=a[v];r(_,t,n,m,!!_.dynamicChildren)}},move:Ch,hydrate:YI},Ha=M1,zi=Symbol("_leaveCb"),Uc=Symbol("_enterCb"),ui=[Function,Array],Ph={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ui,onEnter:ui,onAfterEnter:ui,onEnterCancelled:ui,onBeforeLeave:ui,onLeave:ui,onAfterLeave:ui,onLeaveCancelled:ui,onBeforeAppear:ui,onAppear:ui,onAfterAppear:ui,onAppearCancelled:ui},Jg=e=>{const t=e.subTree;return t.component?Jg(t.component):t},L1={name:"BaseTransition",props:Ph,setup(e,{slots:t}){const n=ir(),r=Eg();return()=>{const o=t.default&&_h(t.default(),!0);if(!o||!o.length)return;const i=V2(o),s=mn(e),{mode:a}=s;if(r.isLeaving)return xg(i);const l=j2(i);if(!l)return xg(i);let u=Bc(l,s,r,n,d=>u=d);l.type!==Er&&Gs(l,u);let c=n.subTree&&j2(n.subTree);if(c&&c.type!==Er&&!Fi(c,l)&&Jg(n).type!==Er){let d=Bc(c,s,r,n);if(Gs(c,d),a==="out-in"&&l.type!==Er)return r.isLeaving=!0,d.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,c=void 0},xg(i);a==="in-out"&&l.type!==Er?d.delayLeave=(h,m,p)=>{const v=H2(r,c);v[String(c.key)]=c,h[zi]=()=>{m(),h[zi]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{p(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return i}}},$g=L1,Dd=new WeakMap,ev=!1,Kl=()=>{ev||(console.error("Hydration completed but contains mismatches."),ev=!0)},P1=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",D1=e=>e.namespaceURI.includes("MathML"),Od=e=>{if(e.nodeType===1){if(P1(e))return"svg";if(D1(e))return"mathml"}},ql=e=>e.nodeType===8,tv="data-allow-mismatch",O1={0:"text",1:"children",2:"class",3:"style",4:"attribute"},F1=ud().requestIdleCallback||(e=>setTimeout(e,1)),N1=ud().cancelIdleCallback||(e=>clearTimeout(e)),B1=(e=1e4)=>t=>{const n=F1(t,{timeout:e});return()=>N1(n)},z1=e=>(t,n)=>{const r=new IntersectionObserver(o=>{for(const i of o)if(i.isIntersecting){r.disconnect(),t();break}},e);return n(o=>{if(o instanceof Element){if(JI(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},V1=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},H1=(e=[])=>(t,n)=>{Xn(e)&&(e=[e]);let r=!1;const o=s=>{r||(r=!0,i(),t(),s.target.dispatchEvent(new s.constructor(s.type,s)))},i=()=>{n(s=>{for(const a of e)s.removeEventListener(a,o)})};return n(s=>{for(const a of e)s.addEventListener(a,o,{once:!0})}),i},hs=e=>!!e.type.__asyncLoader,Gc=e=>e.type.__isKeepAlive,j1={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=ir(),r=n.ctx;if(!r.renderer)return()=>{const k=t.default&&t.default();return k&&k.length===1?k[0]:k};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:c,o:{createElement:d}}}=r,h=d("div");r.activate=(k,y,b,T,R)=>{const P=k.component;u(k,y,b,0,a),l(P.vnode,k,y,b,P,a,T,k.slotScopeIds,R),Dr(()=>{P.isDeactivated=!1,P.a&&zl(P.a);const j=k.props&&k.props.onVnodeMounted;j&&qo(j,P.parent,k)},a)},r.deactivate=k=>{const y=k.component;Mh(y.m),Mh(y.a),u(k,h,null,1,a),Dr(()=>{y.da&&zl(y.da);const b=k.props&&k.props.onVnodeUnmounted;b&&qo(b,y.parent,k),y.isDeactivated=!0},a)};function m(k){Lg(k),c(k,n,a,!0)}function p(k){o.forEach((y,b)=>{const T=Ug(hs(y)?y.type.__asyncResolved||{}:y.type);T&&!k(T)&&v(b)})}function v(k){const y=o.get(k);y&&(!s||!Fi(y,s))?m(y):s&&Lg(s),o.delete(k),i.delete(k)}Lt(()=>[e.include,e.exclude],([k,y])=>{k&&p(b=>kd(k,b)),y&&p(b=>!kd(y,b))},{flush:"post",deep:!0});let _=null;const C=()=>{_!=null&&(Bd(n.subTree.type)?Dr(()=>{o.set(_,Ah(n.subTree))},n.subTree.suspense):o.set(_,Ah(n.subTree)))};return Nn(C),Fd(C),or(()=>{o.forEach(k=>{const{subTree:y,suspense:b}=n,T=Ah(y);if(k.type===T.type&&k.key===T.key){Lg(T);const R=T.component.da;R&&Dr(R,b);return}m(k)})}),()=>{if(_=null,!t.default)return s=null;const k=t.default(),y=k[0];if(k.length>1)return s=null,k;if(!Ws(y)||!(y.shapeFlag&4)&&!(y.shapeFlag&128))return s=null,y;let b=Ah(y);if(b.type===Er)return s=null,b;const T=b.type,R=Ug(hs(b)?b.type.__asyncResolved||{}:T),{include:P,exclude:j,max:O}=e;if(P&&(!R||!kd(P,R))||j&&R&&kd(j,R))return b.shapeFlag&=-257,s=b,y;const V=b.key==null?T:b.key,Q=o.get(V);return b.el&&(b=ds(b),y.shapeFlag&128&&(y.ssContent=b)),_=V,Q?(b.el=Q.el,b.component=Q.component,b.transition&&Gs(b,b.transition),b.shapeFlag|=512,i.delete(V),i.add(V)):(i.add(V),O&&i.size>parseInt(O,10)&&v(i.values().next().value)),b.shapeFlag|=256,s=b,Bd(y.type)?y:b}}},ps=e=>(t,n=$r)=>{(!Wa||e==="sp")&&Ih(e,(...r)=>t(...r),n)},nv=ps("bm"),Nn=ps("m"),Dh=ps("bu"),Fd=ps("u"),or=ps("bum"),Nd=ps("um"),rv=ps("sp"),ov=ps("rtg"),iv=ps("rtc"),Oh="components",U1="directives",sv=Symbol.for("v-ndc"),Fh=e=>e?_1(e)?Rd(e):Fh(e.parent):null,Wc=Un(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Fh(e.parent),$root:e=>Fh(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Fg(e),$forceUpdate:e=>e.f||(e.f=()=>{Ag(e.update)}),$nextTick:e=>e.n||(e.n=_t.bind(e.proxy)),$watch:e=>qI.bind(e)}),Nh=(e,t)=>e!==In&&!e.__isScriptSetup&&Fn(e,t),Bh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const h=s[t];if(h!==void 0)switch(h){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(Nh(r,t))return s[t]=1,r[t];if(o!==In&&Fn(o,t))return s[t]=2,o[t];if(Fn(i,t))return s[t]=3,i[t];if(n!==In&&Fn(n,t))return s[t]=4,n[t];zh&&(s[t]=0)}}const u=Wc[t];let c,d;if(u)return t==="$attrs"&&Ao(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==In&&Fn(n,t))return s[t]=4,n[t];if(d=l.config.globalProperties,Fn(d,t))return d[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Nh(o,t)?(o[t]=n,!0):r!==In&&Fn(r,t)?(r[t]=n,!0):Fn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||e!==In&&a[0]!=="$"&&Fn(e,a)||Nh(t,a)||Fn(i,a)||Fn(r,a)||Fn(Wc,a)||Fn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Fn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},G1=Un({},Bh,{get(e,t){if(t!==Symbol.unscopables)return Bh.get(e,t,e)},has(e,t){return t[0]!=="_"&&!qb(t)}}),zh=!0,W1={data:e1,props:t1,emits:t1,methods:Ed,computed:Ed,beforeCreate:Oo,created:Oo,beforeMount:Oo,mounted:Oo,beforeUpdate:Oo,updated:Oo,beforeDestroy:Oo,beforeUnmount:Oo,destroyed:Oo,unmounted:Oo,activated:Oo,deactivated:Oo,errorCaptured:Oo,serverPrefetch:Oo,components:Ed,directives:Ed,watch:b5,provide:e1,inject:y5},K1=0,ja=null,av=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Pr(t)}Modifiers`]||e[`${Do(t)}Modifiers`],q1=new WeakMap,Y1=e=>{let t;for(const n in e)(n==="class"||n==="style"||Rc(n))&&((t||(t={}))[n]=e[n]);return t},X1=(e,t)=>{const n={};for(const r in e)(!od(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},lv={},cv=()=>Object.create(lv),uv=e=>Object.getPrototypeOf(e)===lv,Z1=new WeakMap,Vh=e=>e==="_"||e==="_ctx"||e==="$stable",Hh=e=>Mt(e)?e.map(Ko):[Ko(e)],Q1=(e,t,n)=>{if(t._n)return t;const r=Eo((...o)=>Hh(t(...o)),n);return r._c=!1,r},dv=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Vh(o))continue;const i=e[o];if(Zt(i))t[o]=Q1(o,i,r);else if(i!=null){const s=Hh(i);t[o]=()=>s}}},fv=(e,t)=>{const n=Hh(t);e.slots.default=()=>n},hv=(e,t,n)=>{for(const r in t)(n||!Vh(r))&&(e[r]=t[r])},J1=(e,t,n)=>{const r=e.slots=cv();if(e.vnode.shapeFlag&32){const o=t._;o?(hv(r,t,n),n&&eg(r,"_",o,!0)):dv(t,r)}else t&&fv(e,t)},$1=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=In;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:hv(o,t,n):(i=!t.$stable,dv(t,o)),s=t}else t&&(fv(e,t),s={default:1});if(i)for(const a in o)!Vh(a)&&s[a]==null&&delete o[a]},Dr=v1,Bd=e=>e.__isSuspense,jh=0,ew={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)x5(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}T5(e,t,n,r,o,s,a,l,u)}},hydrate:R5,normalize:M5},Wt=Symbol.for("v-fgt"),Ys=Symbol.for("v-txt"),Er=Symbol.for("v-cmt"),Ua=Symbol.for("v-stc"),Kc=[],ho=null,Ga=1,pv=({key:e})=>e??null,zd=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Xn(e)||nr(e)||Zt(e)?{i:Jr,r:e,k:t,f:!!n}:e:null),jt=D5,tw=n1(),nw=0,$r=null,ir=()=>$r||Jr;{const e=ud(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};Uh=t("__VUE_INSTANCE_SETTERS__",n=>$r=n),qc=t("__VUE_SSR_SETTERS__",n=>Wa=n)}Yl=e=>{const t=$r;return Uh(e),e.scope.on(),()=>{e.scope.off(),Uh(t)}},Yc=()=>{$r&&$r.scope.off(),Uh(null)},Wa=!1,rw=()=>!Gh,ow={get(e,t){return Ao(e,"get",""),e[t]}},ke=(e,t)=>DI(e,t,Wa),gv="3.5.32",iw=ci,sw=x1,aw=jc,lw=O2,cw={createComponentInstance:C1,setupComponent:S1,renderComponentRoot:Th,setCurrentRenderingInstance:Cd,isVNode:Ws,normalizeVNode:Ko,getComponentPublicInstance:Rd,ensureValidVNode:Og,pushWarningContext:BI,popWarningContext:zI},H5=null,j5=null,U5=null}));function dw(e){const t={};for(const F in e)F in kv||(t[F]=e[F]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:c=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,p=G5(o),v=p&&p[0],_=p&&p[1],{onBeforeEnter:C,onEnter:k,onEnterCancelled:y,onLeave:b,onLeaveCancelled:T,onBeforeAppear:R=C,onAppear:P=k,onAppearCancelled:j=y}=t,O=(F,N,x,z)=>{F._enterCancelled=z,Ka(F,N?c:a),Ka(F,N?u:s),x&&x()},V=(F,N)=>{F._isLeaving=!1,Ka(F,d),Ka(F,m),Ka(F,h),N&&N()},Q=F=>(N,x)=>{const z=F?P:k,J=()=>O(N,F,x);qa(z,[N,J]),fw(()=>{Ka(N,F?l:i),ms(N,F?c:a),Iv(z)||hw(N,r,v,J)})};return Un(t,{onBeforeEnter(F){qa(C,[F]),ms(F,i),ms(F,s)},onBeforeAppear(F){qa(R,[F]),ms(F,l),ms(F,u)},onEnter:Q(!1),onAppear:Q(!0),onLeave(F,N){F._isLeaving=!0;const x=()=>V(F,N);ms(F,d),F._enterCancelled?(ms(F,h),yv(F)):(yv(F),ms(F,h)),fw(()=>{F._isLeaving&&(Ka(F,d),ms(F,m),Iv(b)||hw(F,r,_,x))}),qa(b,[F,x])},onEnterCancelled(F){O(F,!1,void 0,!0),qa(y,[F])},onAppearCancelled(F){O(F,!0,void 0,!0),qa(j,[F])},onLeaveCancelled(F){V(F),qa(T,[F])}})}function G5(e){if(e==null)return null;if(Ln(e))return[vv(e.enter),vv(e.leave)];{const t=vv(e);return[t,t]}}function vv(e){return cd(e)}function ms(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Xl]||(e[Xl]=new Set)).add(t)}function Ka(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Xl];n&&(n.delete(t),n.size||(e[Xl]=void 0))}function fw(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function hw(e,t,n,r){const o=e._endId=++Ow,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=pw(e,t);if(!s)return r();const u=s+"end";let c=0;const d=()=>{e.removeEventListener(u,h),i()},h=m=>{m.target===e&&++c>=l&&d()};setTimeout(()=>{c<l&&d()},a+1),e.addEventListener(u,h)}function pw(e,t){const n=window.getComputedStyle(e),r=p=>(n[p]||"").split(", "),o=r(`${Zs}Delay`),i=r(`${Zs}Duration`),s=mw(o,i),a=r(`${Zc}Delay`),l=r(`${Zc}Duration`),u=mw(a,l);let c=null,d=0,h=0;t===Zs?s>0&&(c=Zs,d=s,h=i.length):t===Zc?u>0&&(c=Zc,d=u,h=l.length):(d=Math.max(s,u),c=d>0?s>u?Zs:Zc:null,h=c?c===Zs?i.length:l.length:0);const m=c===Zs&&/\b(?:transform|all)(?:,|$)/.test(r(`${Zs}Property`).toString());return{type:c,timeout:d,propCount:h,hasTransform:m}}function mw(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>gw(n)+gw(e[r])))}function gw(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function yv(e){return(e?e.ownerDocument:document).body.offsetHeight}function W5(e,t,n){const r=e[Xl];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Vd(e,t){e.style.display=t?e[Hd]:"none",e[Ev]=!t}function K5(){xv.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function q5(e){const t=ir();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Wh(i,o))},r=()=>{const o=e(t.proxy);t.ce?Wh(t.ce,o):bv(t.subTree,o),n(o)};Dh(()=>{wd(r)}),Nn(()=>{Lt(r,ci,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),Nd(()=>o.disconnect())})}function bv(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{bv(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Wh(e.el,t);else if(e.type===Wt)e.children.forEach(n=>bv(n,t));else if(e.type===Ua){let{el:n,anchor:r}=e;for(;n&&(Wh(n,t),n!==r);)n=n.nextSibling}}function Wh(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=wI(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Tv]=r}}function Y5(e,t,n){const r=e.style,o=Xn(n);let i=!1;if(n&&!o){if(t)if(Xn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Kh(r,a,"")}else for(const s in t)n[s]==null&&Kh(r,s,"");for(const s in n)s==="display"&&(i=!0),Kh(r,s,n[s])}else if(o){if(t!==n){const s=r[Tv];s&&(n+=";"+s),r.cssText=n,i=Fw.test(n)}}else t&&e.removeAttribute("style");Hd in e&&(e[Hd]=i?r.display:"",e[Ev]&&(r.display="none"))}function Kh(e,t,n){if(Mt(n))n.forEach(r=>Kh(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=X5(e,t);Rv.test(n)?e.setProperty(Do(r),n.replace(Rv,""),"important"):e[r]=n}}function X5(e,t){const n=Zh[t];if(n)return n;let r=Pr(t);if(r!=="filter"&&r in e)return Zh[t]=r;r=Mc(r);for(let o=0;o<Mv.length;o++){const i=Mv[o]+r;if(i in e)return Zh[t]=i}return t}function vw(e,t,n,r,o,i=Qb(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Lv,t.slice(6,t.length)):e.setAttributeNS(Lv,t,n):n==null||i&&!Vb(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Go(n)?String(n):n)}function yw(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Cv(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Vb(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Xs(e,t,n,r){e.addEventListener(t,n,r)}function Z5(e,t,n,r){e.removeEventListener(t,n,r)}function Q5(e,t,n,r,o=null){const i=e[Pv]||(e[Pv]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=J5(t);r?Xs(e,a,i[t]=$5(r,o),l):s&&(Z5(e,a,s,l),i[t]=void 0)}}function J5(e){let t;if(Dv.test(e)){t={};let n;for(;n=e.match(Dv);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Do(e.slice(2)),t]}function $5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ki(e6(r,n.value),t,5,[r])};return n.value=e,n.attached=Bw(),n}function e6(e,t){if(Mt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}function t6(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ov(t)&&Zt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Ov(t)&&Xn(n)?!1:t in e}function n6(e,t){const n=e._def.props;if(!n)return!1;const r=Pr(t);return Array.isArray(n)?n.some(o=>Pr(o)===r):Object.keys(n).some(o=>Pr(o)===r)}function bw(e,t,n){let r=jl(e,t);id(r)&&(r=Un({},r,t));class o extends Bv{constructor(s){super(r,s,n)}}return o.def=r,o}function ww(e){const t=ir(),n=t&&t.ce;return n||null}function r6(){const e=ww();return e&&e.shadowRoot}function o6(e="$style"){{const t=ir();if(!t)return In;const n=t.type.__cssModules;if(!n)return In;const r=n[e];return r||In}}function i6(e){const t=e.el;t[jd]&&t[jd](),t[Hv]&&t[Hv]()}function s6(e){Vv.set(e,Cw(e.el))}function a6(e){const t=zv.get(e),n=Vv.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function Cw(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function l6(e,t,n){const r=e.cloneNode(),o=e[Xl];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(r);const{hasTransform:s}=pw(r);return i.removeChild(r),s}function c6(e){e.target.composing=!0}function _w(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function Sw(e,t,n){return t&&(e=e.trim()),n&&(e=ld(e)),e}function kw(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Mt(t))o=ah(t,r.props.value)>-1;else if(Oa(t))o=t.has(r.props.value);else{if(t===n)return;o=Fs(t,Iw(e,!0))}e.checked!==o&&(e.checked=o)}function Aw(e,t){const n=e.multiple,r=Mt(t);if(!(n&&!r&&!Oa(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Xc(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=ah(t,a)>-1}else s.selected=t.has(a);else if(Fs(Xc(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Xc(e){return"_value"in e?e._value:e.value}function Iw(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function Ew(e,t){switch(e){case"SELECT":return jv;case"TEXTAREA":return Ai;default:switch(t){case"checkbox":return Jh;case"radio":return $h;default:return Ai}}}function qh(e,t,n,r,o){const i=Ew(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function u6(){Ai.getSSRProps=({value:e})=>({value:e}),$h.getSSRProps=({value:e},t)=>{if(t.props&&Fs(t.props.value,e))return{checked:!0}},Jh.getSSRProps=({value:e},t)=>{if(Mt(e)){if(t.props&&ah(e,t.props.value)>-1)return{checked:!0}}else if(Oa(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Uv.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=Ew(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function xw(){return Ud||(Ud=c1(Gv))}function Tw(){return Ud=Wv?Ud:u1(Gv),Wv=!0,Ud}function Rw(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Mw(e){return Xn(e)?document.querySelector(e):e}var Yh,wv,Cv,Lw,Pw,gs,_v,Sv,Zs,Zc,Xl,kv,Av,Dw,Xh,qa,Iv,Ow,Hd,Ev,xv,Tv,Fw,Rv,Mv,Zh,Lv,Pv,Dv,Qh,Nw,Bw,Ov,Fv,Nv,zw,Vw,Bv,zv,Vv,jd,Hv,Hw,jw,Qs,di,Ai,Jh,$h,jv,Uv,Uw,Gw,tn,Ww,Yo,Gv,Ud,Wv,Kv,Kw,Zl,qv,Yv,qw,d6=Ir((()=>{if(uw(),uw(),og(),Yh=void 0,wv=typeof window<"u"&&window.trustedTypes,wv)try{Yh=wv.createPolicy("vue",{createHTML:e=>e})}catch{}Cv=Yh?e=>Yh.createHTML(e):e=>e,Lw="http://www.w3.org/2000/svg",Pw="http://www.w3.org/1998/Math/MathML",gs=typeof document<"u"?document:null,_v=gs&&gs.createElement("template"),Sv={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?gs.createElementNS(Lw,e):t==="mathml"?gs.createElementNS(Pw,e):n?gs.createElement(e,{is:n}):gs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>gs.createTextNode(e),createComment:e=>gs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>gs.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{_v.innerHTML=Cv(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=_v.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Zs="transition",Zc="animation",Xl=Symbol("_vtc"),kv={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Av=Un({},Ph,kv),Dw=e=>(e.displayName="Transition",e.props=Av,e),Xh=Dw((e,{slots:t})=>Vr($g,dw(e),t)),qa=(e,t=[])=>{Mt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Iv=e=>e?Mt(e)?e.some(t=>t.length>1):e.length>1:!1,Ow=0,Hd=Symbol("_vod"),Ev=Symbol("_vsh"),xv={name:"show",beforeMount(e,{value:t},{transition:n}){e[Hd]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Vd(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Vd(e,!0),r.enter(e)):r.leave(e,()=>{Vd(e,!1)}):Vd(e,t))},beforeUnmount(e,{value:t}){Vd(e,t)}},Tv=Symbol(""),Fw=/(?:^|;)\s*display\s*:/,Rv=/\s*!important$/,Mv=["Webkit","Moz","ms"],Zh={},Lv="http://www.w3.org/1999/xlink",Pv=Symbol("_vei"),Dv=/(?:Once|Passive|Capture)$/,Qh=0,Nw=Promise.resolve(),Bw=()=>Qh||(Nw.then(()=>Qh=0),Qh=Date.now()),Ov=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Fv=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?W5(e,r,s):t==="style"?Y5(e,n,r):Rc(t)?od(t)||Q5(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):t6(e,t,r,s))?(yw(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&vw(e,t,r,s,i,t!=="value")):e._isVueCE&&(n6(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Xn(r)))?yw(e,Pr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),vw(e,t,r,s))},Nv={},zw=((e,t)=>bw(e,t,qv)),Vw=typeof HTMLElement<"u"?HTMLElement:class{},Bv=class XA extends Vw{constructor(t,n={},r=Zl){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==Zl?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Un({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof XA){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,_t(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!Mt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=cd(this._props[l])),(a||(a=Object.create(null)))[Pr(l)]=!0)}this._numberProps=a,this._resolveProps(r),this.shadowRoot&&this._applyStyles(s),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)Fn(this,r)||Object.defineProperty(this,r,{get:()=>et(n[r])})}_resolveProps(t){const{props:n}=t,r=Mt(n)?n:Object.keys(n||{});for(const o of Object.keys(this))o[0]!=="_"&&r.includes(o)&&this._setProp(o,this[o]);for(const o of r.map(Pr))Object.defineProperty(this,o,{get(){return this._getProp(o)},set(i){this._setProp(o,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):Nv;const o=Pr(t);n&&this._numberProps&&this._numberProps[o]&&(r=cd(r)),this._setProp(o,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,o=!1){if(n!==this._props[t]&&(this._dirty=!0,n===Nv?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),o&&this._instance&&this._update(),r)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Do(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Do(t),n+""):n||this.removeAttribute(Do(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),Kv(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=jt(this._def,Un(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,id(s[0])?Un({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Do(i)!==i&&o(Do(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",c=document.createTreeWalker(l,1);l.setAttribute(u,"");let d;for(;d=c.nextNode();)d.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},zv=new WeakMap,Vv=new WeakMap,jd=Symbol("_moveCb"),Hv=Symbol("_enterCb"),Hw=e=>(delete e.props.mode,e),jw=Hw({name:"TransitionGroup",props:Un({},Av,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=ir(),r=Eg();let o,i;return Fd(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!l6(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(i6),o.forEach(s6);const a=o.filter(a6);yv(n.vnode.el),a.forEach(l=>{const u=l.el,c=u.style;ms(u,s),c.transform=c.webkitTransform=c.transitionDuration="";const d=u[jd]=h=>{h&&h.target!==u||(!h||h.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",d),u[jd]=null,Ka(u,s))};u.addEventListener("transitionend",d)}),o=[]}),()=>{const s=mn(e),a=dw(s);let l=s.tag||Wt;if(o=[],i)for(let u=0;u<i.length;u++){const c=i[u];c.el&&c.el instanceof Element&&(o.push(c),Gs(c,Bc(c,a,r,n)),zv.set(c,Cw(c.el)))}i=t.default?_h(t.default()):[];for(let u=0;u<i.length;u++){const c=i[u];c.key!=null&&Gs(c,Bc(c,a,r,n))}return jt(l,null,i)}}}),Qs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Mt(t)?n=>zl(t,n):t},di=Symbol("_assign"),Ai={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[di]=Qs(o);const i=r||o.props&&o.props.type==="number";Xs(e,t?"change":"input",s=>{s.target.composing||e[di](Sw(e.value,n,i))}),(n||i)&&Xs(e,"change",()=>{e.value=Sw(e.value,n,i)}),t||(Xs(e,"compositionstart",c6),Xs(e,"compositionend",_w),Xs(e,"change",_w))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[di]=Qs(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?ld(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Jh={deep:!0,created(e,t,n){e[di]=Qs(n),Xs(e,"change",()=>{const r=e._modelValue,o=Xc(e),i=e.checked,s=e[di];if(Mt(r)){const a=ah(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(Oa(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(Iw(e,i))})},mounted:kw,beforeUpdate(e,t,n){e[di]=Qs(n),kw(e,t,n)}},$h={created(e,{value:t},n){e.checked=Fs(t,n.props.value),e[di]=Qs(n),Xs(e,"change",()=>{e[di](Xc(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[di]=Qs(r),t!==n&&(e.checked=Fs(t,r.props.value))}},jv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=Oa(t);Xs(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?ld(Xc(s)):Xc(s));e[di](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,_t(()=>{e._assigning=!1})}),e[di]=Qs(r)},mounted(e,{value:t}){Aw(e,t)},beforeUpdate(e,t,n){e[di]=Qs(n)},updated(e,{value:t}){e._assigning||Aw(e,t)}},Uv={created(e,t,n){qh(e,t,n,null,"created")},mounted(e,t,n){qh(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){qh(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){qh(e,t,n,r,"updated")}},Uw=["ctrl","shift","alt","meta"],Gw={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Uw.some(n=>e[`${n}Key`]&&!t.includes(n))},tn=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...i)=>{for(let s=0;s<t.length;s++){const a=Gw[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},Ww={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Yo=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Do(o.key);if(t.some(s=>s===i||Ww[s]===i))return e(o)}))},Gv=Un({patchProp:Fv},Sv),Wv=!1,Kv=((...e)=>{xw().render(...e)}),Kw=((...e)=>{Tw().hydrate(...e)}),Zl=((...e)=>{const t=xw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Mw(r);if(!o)return;const i=t._component;!Zt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,Rw(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),qv=((...e)=>{const t=Tw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Mw(r);if(o)return n(o,!0,Rw(o))},t}),Yv=!1,qw=()=>{Yv||(Yv=!0,u6(),K5())}})),f6=nd({BaseTransition:()=>$g,BaseTransitionPropsValidators:()=>Ph,Comment:()=>Er,DeprecationTypes:()=>null,EffectScope:()=>gh,ErrorCodes:()=>E1,ErrorTypeStrings:()=>sw,Fragment:()=>Wt,KeepAlive:()=>j1,ReactiveEffect:()=>Dc,Static:()=>Ua,Suspense:()=>ew,Teleport:()=>Ha,Text:()=>Ys,TrackOpTypes:()=>R2,Transition:()=>Xh,TransitionGroup:()=>jw,TriggerOpTypes:()=>M2,VueElement:()=>Bv,assertNumber:()=>VI,callWithAsyncErrorHandling:()=>ki,callWithErrorHandling:()=>Nc,camelize:()=>Pr,capitalize:()=>Mc,cloneVNode:()=>ds,compatUtils:()=>null,compile:()=>Yw,computed:()=>ke,createApp:()=>Zl,createBlock:()=>dn,createCommentVNode:()=>ht,createElementBlock:()=>Ae,createElementVNode:()=>Me,createHydrationRenderer:()=>u1,createPropsRestProxy:()=>p5,createRenderer:()=>c1,createSSRApp:()=>qv,createSlots:()=>n5,createStaticVNode:()=>O5,createTextVNode:()=>Ni,createVNode:()=>jt,customRef:()=>l2,defineAsyncComponent:()=>W2,defineComponent:()=>jl,defineCustomElement:()=>bw,defineEmits:()=>i5,defineExpose:()=>s5,defineModel:()=>c5,defineOptions:()=>a5,defineProps:()=>o5,defineSSRCustomElement:()=>zw,defineSlots:()=>l5,devtools:()=>aw,effect:()=>SI,effectScope:()=>ig,getCurrentInstance:()=>ir,getCurrentScope:()=>sg,getCurrentWatcher:()=>OI,getTransitionRawChildren:()=>_h,guardReactiveProps:()=>w1,h:()=>Vr,handleError:()=>Hl,hasInjectionContext:()=>N2,hydrate:()=>Kw,hydrateOnIdle:()=>B1,hydrateOnInteraction:()=>H1,hydrateOnMediaQuery:()=>V1,hydrateOnVisible:()=>z1,initCustomFormatter:()=>z5,initDirectivesForSSR:()=>qw,inject:()=>Ba,isMemoSame:()=>I1,isProxy:()=>fd,isReactive:()=>Ci,isReadonly:()=>cs,isRef:()=>nr,isRuntimeOnly:()=>rw,isShallow:()=>Wo,isVNode:()=>Ws,markRaw:()=>Wr,mergeDefaults:()=>f5,mergeModels:()=>h5,mergeProps:()=>fs,nextTick:()=>_t,nodeOps:()=>Sv,normalizeClass:()=>rn,normalizeProps:()=>Zm,normalizeStyle:()=>yn,onActivated:()=>Rg,onBeforeMount:()=>nv,onBeforeUnmount:()=>or,onBeforeUpdate:()=>Dh,onDeactivated:()=>Mg,onErrorCaptured:()=>q2,onMounted:()=>Nn,onRenderTracked:()=>iv,onRenderTriggered:()=>ov,onScopeDispose:()=>Jb,onServerPrefetch:()=>rv,onUnmounted:()=>Nd,onUpdated:()=>Fd,onWatcherCleanup:()=>d2,openBlock:()=>ge,patchProp:()=>Fv,popScopeId:()=>GI,provide:()=>F2,proxyRefs:()=>hg,pushScopeId:()=>UI,queuePostFlushCb:()=>wd,reactive:()=>Gr,readonly:()=>ph,ref:()=>ne,registerRuntimeCompiler:()=>N5,render:()=>Kv,renderList:()=>rr,renderSlot:()=>Ad,resolveComponent:()=>t5,resolveDirective:()=>Y2,resolveDynamicComponent:()=>Pg,resolveFilter:()=>null,resolveTransitionHooks:()=>Bc,setBlockTracking:()=>Td,setDevtoolsHook:()=>lw,setTransitionHooks:()=>Gs,shallowReactive:()=>s2,shallowReadonly:()=>MI,shallowRef:()=>Kr,ssrContextKey:()=>Kg,ssrUtils:()=>cw,stop:()=>kI,toDisplayString:()=>Bt,toHandlerKey:()=>Lc,toHandlers:()=>r5,toRaw:()=>mn,toRef:()=>pg,toRefs:()=>c2,toValue:()=>PI,transformVNodeArgs:()=>P5,triggerRef:()=>LI,unref:()=>et,useAttrs:()=>Z2,useCssModule:()=>o6,useCssVars:()=>q5,useHost:()=>ww,useId:()=>XI,useModel:()=>C5,useSSRContext:()=>qg,useShadowRoot:()=>r6,useSlots:()=>d5,useTemplateRef:()=>ZI,useTransitionState:()=>Eg,vModelCheckbox:()=>Jh,vModelDynamic:()=>Uv,vModelRadio:()=>$h,vModelSelect:()=>jv,vModelText:()=>Ai,vShow:()=>xv,version:()=>gv,warn:()=>iw,watch:()=>Lt,watchEffect:()=>WI,watchPostEffect:()=>KI,watchSyncEffect:()=>B2,withAsyncContext:()=>m5,withCtx:()=>Eo,withDefaults:()=>u5,withDirectives:()=>Us,withKeys:()=>Yo,withMemo:()=>V5,withModifiers:()=>tn,withScopeId:()=>T1},1),Yw,xt=Ir((()=>{d6(),Yw=()=>{}})),h6=Nb(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,c){if(!o[u]){if(!r[u]){var d=typeof require=="function"&&require;if(!c&&d)return d(u,!0);if(a)return a(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var m=o[u]={exports:{}};r[u][0].call(m.exports,function(p){var v=r[u][1][p];return s(v||p)},m,m.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,c,d,h,m,p,v,_=[],C=0,k=l.length,y=k,b=i.getTypeOf(l)!=="string";C<l.length;)y=k-C,d=b?(u=l[C++],c=C<k?l[C++]:0,C<k?l[C++]:0):(u=l.charCodeAt(C++),c=C<k?l.charCodeAt(C++):0,C<k?l.charCodeAt(C++):0),h=u>>2,m=(3&u)<<4|c>>4,p=1<y?(15&c)<<2|d>>6:64,v=2<y?63&d:64,_.push(a.charAt(h)+a.charAt(m)+a.charAt(p)+a.charAt(v));return _.join("")},o.decode=function(l){var u,c,d,h,m,p,v=0,_=0,C="data:";if(l.substr(0,C.length)===C)throw new Error("Invalid base64 input, it looks like a data url.");var k,y=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&y--,l.charAt(l.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(k=s.uint8array?new Uint8Array(0|y):new Array(0|y);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(h=a.indexOf(l.charAt(v++)))>>4,c=(15&h)<<4|(m=a.indexOf(l.charAt(v++)))>>2,d=(3&m)<<6|(p=a.indexOf(l.charAt(v++))),k[_++]=u,m!==64&&(k[_++]=c),p!==64&&(k[_++]=d);return k}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(c,d,h,m,p){this.compressedSize=c,this.uncompressedSize=d,this.crc32=h,this.compression=m,this.compressedContent=p}u.prototype={getContentWorker:function(){var c=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return c.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,d,h){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,c,d,h){var m=s,p=h+d;u^=-1;for(var v=h;v<p;v++)u=u>>>8^m[255&(u^c[v])];return-1^u})(0|l,a,a.length,0):(function(u,c,d,h){var m=s,p=h+d;u^=-1;for(var v=h;v<p;v++)u=u>>>8^m[255&(u^c.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function c(d,h){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=h,this.meta={}}o.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,d.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(h){d.push({data:h,meta:d.meta})}},o.compressWorker=function(d){return new c("Deflate",d)},o.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(m,p){var v,_="";for(v=0;v<p;v++)_+=String.fromCharCode(255&m),m>>>=8;return _}function s(m,p,v,_,C,k){var y,b,T=m.file,R=m.compression,P=k!==u.utf8encode,j=a.transformTo("string",k(T.name)),O=a.transformTo("string",u.utf8encode(T.name)),V=T.comment,Q=a.transformTo("string",k(V)),F=a.transformTo("string",u.utf8encode(V)),N=O.length!==T.name.length,x=F.length!==V.length,z="",J="",X="",ae=T.dir,pe=T.date,Fe={crc32:0,compressedSize:0,uncompressedSize:0};p&&!v||(Fe.crc32=m.crc32,Fe.compressedSize=m.compressedSize,Fe.uncompressedSize=m.uncompressedSize);var fe=0;p&&(fe|=8),P||!N&&!x||(fe|=2048);var ye=0,le=0;ae&&(ye|=16),C==="UNIX"?(le=798,ye|=(function(re,xe){var $e=re;return re||($e=xe?16893:33204),(65535&$e)<<16})(T.unixPermissions,ae)):(le=20,ye|=(function(re){return 63&(re||0)})(T.dosPermissions)),y=pe.getUTCHours(),y<<=6,y|=pe.getUTCMinutes(),y<<=5,y|=pe.getUTCSeconds()/2,b=pe.getUTCFullYear()-1980,b<<=4,b|=pe.getUTCMonth()+1,b<<=5,b|=pe.getUTCDate(),N&&(J=i(1,1)+i(c(j),4)+O,z+="up"+i(J.length,2)+J),x&&(X=i(1,1)+i(c(Q),4)+F,z+="uc"+i(X.length,2)+X);var Se="";return Se+=`
4
+ \0`,Se+=i(fe,2),Se+=R.magic,Se+=i(y,2),Se+=i(b,2),Se+=i(Fe.crc32,4),Se+=i(Fe.compressedSize,4),Se+=i(Fe.uncompressedSize,4),Se+=i(j.length,2),Se+=i(z.length,2),{fileRecord:d.LOCAL_FILE_HEADER+Se+j+z,dirRecord:d.CENTRAL_FILE_HEADER+i(le,2)+Se+i(Q.length,2)+"\0\0\0\0"+i(ye,4)+i(_,4)+j+z+Q}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),c=n("../crc32"),d=n("../signature");function h(m,p,v,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=v,this.encodeFileName=_,this.streamFiles=m,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(m){var p=m.meta.percent||0,v=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,l.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:v?(p+100*(v-_-1))/v:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var p=this.streamFiles&&!m.file.dir;if(p){var v=s(m,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var p=this.streamFiles&&!m.file.dir,v=s(m,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),p)this.push({data:(function(_){return d.DATA_DESCRIPTOR+i(_.crc32,4)+i(_.compressedSize,4)+i(_.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var v=this.bytesWritten-m,_=(function(C,k,y,b,T){var R=a.transformTo("string",T(b));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(C,2)+i(C,2)+i(k,4)+i(y,4)+i(R.length,2)+R})(this.dirRecords.length,v,m,this.zipComment,this.encodeFileName);this.push({data:_,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(m){this._sources.push(m);var p=this;return m.on("data",function(v){p.processChunk(v)}),m.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),m.on("error",function(v){p.error(v)}),this},h.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(m){var p=this._sources;if(!l.prototype.error.call(this,m))return!1;for(var v=0;v<p.length;v++)try{p[v].error(m)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var m=this._sources,p=0;p<m.length;p++)m[p].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var c=new s(l.streamFiles,u,l.platform,l.encodeFileName),d=0;try{a.forEach(function(h,m){d++;var p=(function(k,y){var b=k||y,T=i[b];if(!T)throw new Error(b+" is not a valid compression method !");return T})(m.options.compression,l.compression),v=m.options.compressionOptions||l.compressionOptions||{},_=m.dir,C=m.date;m._compressWorker(p,v).withStreamInfo("file",{name:h,dir:_,date:C,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(c)}),c.entriesCount=d}catch(h){c.error(h)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),c=n("./nodejsUtils");function d(h){return new s.Promise(function(m,p){var v=h.decompressed.getContentWorker().pipe(new u);v.on("error",function(_){p(_)}).on("end",function(){v.streamInfo.crc32!==h.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}r.exports=function(h,m){var p=this;return m=i.extend(m||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(h)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",h,!0,m.optimizedBinaryString,m.base64).then(function(v){var _=new l(m);return _.load(v),_}).then(function(v){var _=[s.Promise.resolve(v)],C=v.files;if(m.checkCRC32)for(var k=0;k<C.length;k++)_.push(d(C[k]));return s.Promise.all(_)}).then(function(v){for(var _=v.shift(),C=_.files,k=0;k<C.length;k++){var y=C[k],b=y.fileNameStr,T=i.resolve(y.fileNameStr);p.file(T,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:m.createFolders}),y.dir||(p.file(T).unsafeOriginalName=b)}return _.zipComment.length&&(p.comment=_.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(c){u.push({data:c,meta:{percent:0}})}).on("error",function(c){u.isPaused?this.generatedError=c:u.error(c)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var c=this;a.on("data",function(d,h){c.push(d)||c._helper.pause(),u&&u(h)}).on("error",function(d){c.emit("error",d)}).on("end",function(){c.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(b,T,R){var P,j=a.getTypeOf(T),O=a.extend(R||{},c);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(b=C(b)),O.createFolders&&(P=_(b))&&k.call(this,P,!0);var V=j==="string"&&O.binary===!1&&O.base64===!1;R&&R.binary!==void 0||(O.binary=!V),(T instanceof d&&T.uncompressedSize===0||O.dir||!T||T.length===0)&&(O.base64=!1,O.binary=!0,T="",O.compression="STORE",j="string");var Q=null;Q=T instanceof d||T instanceof l?T:p.isNode&&p.isStream(T)?new v(b,T):a.prepareContent(b,T,O.binary,O.optimizedBinaryString,O.base64);var F=new h(b,Q,O);this.files[b]=F}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),c=n("./defaults"),d=n("./compressedObject"),h=n("./zipObject"),m=n("./generate"),p=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),_=function(b){b.slice(-1)==="/"&&(b=b.substring(0,b.length-1));var T=b.lastIndexOf("/");return 0<T?b.substring(0,T):""},C=function(b){return b.slice(-1)!=="/"&&(b+="/"),b},k=function(b,T){return T=T!==void 0?T:c.createFolders,b=C(b),this.files[b]||i.call(this,b,null,{dir:!0,createFolders:T}),this.files[b]};function y(b){return Object.prototype.toString.call(b)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(b){var T,R,P;for(T in this.files)P=this.files[T],(R=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&b(R,P)},filter:function(b){var T=[];return this.forEach(function(R,P){b(R,P)&&T.push(P)}),T},file:function(b,T,R){if(arguments.length!==1)return b=this.root+b,i.call(this,b,T,R),this;if(y(b)){var P=b;return this.filter(function(O,V){return!V.dir&&P.test(O)})}var j=this.files[this.root+b];return j&&!j.dir?j:null},folder:function(b){if(!b)return this;if(y(b))return this.filter(function(j,O){return O.dir&&b.test(j)});var T=this.root+b,R=k.call(this,T),P=this.clone();return P.root=R.name,P},remove:function(b){b=this.root+b;var T=this.files[b];if(T||(b.slice(-1)!=="/"&&(b+="/"),T=this.files[b]),T&&!T.dir)delete this.files[b];else for(var R=this.filter(function(j,O){return O.name.slice(0,b.length)===b}),P=0;P<R.length;P++)delete this.files[R[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(b){var T,R={};try{if((R=a.extend(b||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");a.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var P=R.comment||this.comment||"";T=m.generateWorker(this,R,P)}catch(j){(T=new l("error")).error(j)}return new u(T,R.type||"string",R.mimeType)},generateAsync:function(b,T){return this.generateInternalStream(b).accumulate(T)},generateNodeStream:function(b,T){return(b=b||{}).type||(b.type="nodebuffer"),this.generateInternalStream(b).toNodejsStream(T)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===u&&this.data[h+2]===c&&this.data[h+3]===d)return h-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),c=a.charCodeAt(2),d=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&u===h[1]&&c===h[2]&&d===h[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),c=n("./Uint8ArrayReader");r.exports=function(d){var h=i.getTypeOf(d);return i.checkSupport(h),h!=="string"||s.uint8array?h==="nodebuffer"?new u(d):s.uint8array?new c(i.transformTo("uint8array",d)):new a(i.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=i.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),c=n("../external"),d=null;if(u.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(p,v){return new c.Promise(function(_,C){var k=[],y=p._internalType,b=p._outputType,T=p._mimeType;p.on("data",function(R,P){k.push(R),v&&v(P)}).on("error",function(R){k=[],C(R)}).on("end",function(){try{_((function(R,P,j){switch(R){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),j);case"base64":return l.encode(P);default:return i.transformTo(R,P)}})(b,(function(R,P){var j,O=0,V=null,Q=0;for(j=0;j<P.length;j++)Q+=P[j].length;switch(R){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(V=new Uint8Array(Q),j=0;j<P.length;j++)V.set(P[j],O),O+=P[j].length;return V;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+R+"'")}})(y,k),T))}catch(R){C(R)}k=[]}).resume()})}function m(p,v,_){var C=v;switch(v){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=v,this._mimeType=_,i.checkSupport(C),this._worker=p.pipe(new s(C)),p.lock()}catch(k){this._worker=new a("error"),this._worker.error(k)}}m.prototype={accumulate:function(p){return h(this,p)},on:function(p,v){var _=this;return p==="data"?this._worker.on(p,function(C){v.call(_,C.data,C.meta)}):this._worker.on(p,function(){i.delay(v,arguments,_)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},p)}},r.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}o.utf8encode=function(m){return s.nodebuffer?a.newBufferFrom(m,"utf-8"):(function(p){var v,_,C,k,y,b=p.length,T=0;for(k=0;k<b;k++)(64512&(_=p.charCodeAt(k)))==55296&&k+1<b&&(64512&(C=p.charCodeAt(k+1)))==56320&&(_=65536+(_-55296<<10)+(C-56320),k++),T+=_<128?1:_<2048?2:_<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),k=y=0;y<T;k++)(64512&(_=p.charCodeAt(k)))==55296&&k+1<b&&(64512&(C=p.charCodeAt(k+1)))==56320&&(_=65536+(_-55296<<10)+(C-56320),k++),_<128?v[y++]=_:(_<2048?v[y++]=192|_>>>6:(_<65536?v[y++]=224|_>>>12:(v[y++]=240|_>>>18,v[y++]=128|_>>>12&63),v[y++]=128|_>>>6&63),v[y++]=128|63&_);return v})(m)},o.utf8decode=function(m){return s.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(p){var v,_,C,k,y=p.length,b=new Array(2*y);for(v=_=0;v<y;)if((C=p[v++])<128)b[_++]=C;else if(4<(k=u[C]))b[_++]=65533,v+=k-1;else{for(C&=k===2?31:k===3?15:7;1<k&&v<y;)C=C<<6|63&p[v++],k--;1<k?b[_++]=65533:C<65536?b[_++]=C:(C-=65536,b[_++]=55296|C>>10&1023,b[_++]=56320|1023&C)}return b.length!==_&&(b.subarray?b=b.subarray(0,_):b.length=_),i.applyFromCharCode(b)})(m=i.transformTo(s.uint8array?"uint8array":"array",m))},i.inherits(d,l),d.prototype.processChunk=function(m){var p=i.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=p;(p=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),p.set(v,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var _=(function(k,y){var b;for((y=y||k.length)>k.length&&(y=k.length),b=y-1;0<=b&&(192&k[b])==128;)b--;return b<0||b===0?y:b+u[k[b]]>y?b:y})(p),C=p;_!==p.length&&(s.uint8array?(C=p.subarray(0,_),this.leftOver=p.subarray(_,p.length)):(C=p.slice(0,_),this.leftOver=p.slice(_,p.length))),this.push({data:o.utf8decode(C),meta:m.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,i.inherits(h,l),h.prototype.processChunk=function(m){this.push({data:o.utf8encode(m.data),meta:m.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function c(v,_){for(var C=0;C<v.length;++C)_[C]=255&v.charCodeAt(C);return _}n("setimmediate"),o.newBlob=function(v,_){o.checkSupport("blob");try{return new Blob([v],{type:_})}catch{try{var C=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return C.append(v),C.getBlob(_)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(v,_,C){var k=[],y=0,b=v.length;if(b<=C)return String.fromCharCode.apply(null,v);for(;y<b;)_==="array"||_==="nodebuffer"?k.push(String.fromCharCode.apply(null,v.slice(y,Math.min(y+C,b)))):k.push(String.fromCharCode.apply(null,v.subarray(y,Math.min(y+C,b)))),y+=C;return k.join("")},stringifyByChar:function(v){for(var _="",C=0;C<v.length;C++)_+=String.fromCharCode(v[C]);return _},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function h(v){var _=65536,C=o.getTypeOf(v),k=!0;if(C==="uint8array"?k=d.applyCanBeUsed.uint8array:C==="nodebuffer"&&(k=d.applyCanBeUsed.nodebuffer),k)for(;1<_;)try{return d.stringifyByChunk(v,C,_)}catch{_=Math.floor(_/2)}return d.stringifyByChar(v)}function m(v,_){for(var C=0;C<v.length;C++)_[C]=v[C];return _}o.applyFromCharCode=h;var p={};p.string={string:u,array:function(v){return c(v,new Array(v.length))},arraybuffer:function(v){return p.string.uint8array(v).buffer},uint8array:function(v){return c(v,new Uint8Array(v.length))},nodebuffer:function(v){return c(v,a.allocBuffer(v.length))}},p.array={string:h,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},p.arraybuffer={string:function(v){return h(new Uint8Array(v))},array:function(v){return m(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},p.uint8array={string:h,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},p.nodebuffer={string:h,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return p.nodebuffer.uint8array(v).buffer},uint8array:function(v){return m(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,_){return _=_||"",v?(o.checkSupport(v),p[o.getTypeOf(_)][v](_)):_},o.resolve=function(v){for(var _=v.split("/"),C=[],k=0;k<_.length;k++){var y=_[k];y==="."||y===""&&k!==0&&k!==_.length-1||(y===".."?C.pop():C.push(y))}return C.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var _,C,k="";for(C=0;C<(v||"").length;C++)k+="\\x"+((_=v.charCodeAt(C))<16?"0":"")+_.toString(16).toUpperCase();return k},o.delay=function(v,_,C){setImmediate(function(){v.apply(C||null,_||[])})},o.inherits=function(v,_){function C(){}C.prototype=_.prototype,v.prototype=new C},o.extend=function(){var v,_,C={};for(v=0;v<arguments.length;v++)for(_ in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],_)&&C[_]===void 0&&(C[_]=arguments[v][_]);return C},o.prepareContent=function(v,_,C,k,y){return l.Promise.resolve(_).then(function(b){return i.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,R){var P=new FileReader;P.onload=function(j){T(j.target.result)},P.onerror=function(j){R(j.target.error)},P.readAsArrayBuffer(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(y?b=s.decode(b):C&&k!==!0&&(b=(function(R){return c(R,i.uint8array?new Uint8Array(R.length):new Array(R.length))})(b))),b):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function c(d){this.files=[],this.loadOptions=d}c.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(h)+", expected "+s.pretty(d)+")")}},isSignature:function(d,h){var m=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===h;return this.reader.setIndex(m),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",m=s.transformTo(h,d);this.zipComment=this.loadOptions.decodeFileName(m)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,h,m,p=this.zip64EndOfCentralSize-44;0<p;)d=this.reader.readInt(2),h=this.reader.readInt(4),m=this.reader.readData(h),this.zip64ExtensibleData[d]={id:d,length:h,value:m}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,h;for(d=0;d<this.files.length;d++)h=this.files[d],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var h=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var p=h-m;if(0<p)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=i(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),c=n("./compressions"),d=n("./support");function h(m,p){this.options=m,this.loadOptions=p}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var p,v;if(m.skip(22),this.fileNameLength=m.readInt(2),v=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=(function(_){for(var C in c)if(Object.prototype.hasOwnProperty.call(c,C)&&c[C].magic===_)return c[C];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var p=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(p),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var p,v,_,C=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<C;)p=m.readInt(2),v=m.readInt(2),_=m.readData(v),this.extraFields[p]={id:p,length:v,value:_};m.setIndex(C)},handleUTF8:function(){var m=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var v=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var C=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(C)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var p=i(m.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:u.utf8decode(p.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var p=i(m.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:u.utf8decode(p.readData(m.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(p,v,_){this.name=p,this.dir=_.dir,this.date=_.date,this.comment=_.comment,this.unixPermissions=_.unixPermissions,this.dosPermissions=_.dosPermissions,this._data=v,this._dataBinary=_.binary,this.options={compression:_.compression,compressionOptions:_.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),c=n("./stream/GenericWorker");i.prototype={internalStream:function(p){var v=null,_="string";try{if(!p)throw new Error("No output type specified.");var C=(_=p.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),v=this._decompressWorker();var k=!this._dataBinary;k&&!C&&(v=v.pipe(new l.Utf8EncodeWorker)),!k&&C&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(y){(v=new c("error")).error(y)}return new s(v,_,"")},async:function(p,v){return this.internalStream(p).accumulate(v)},nodeStream:function(p,v){return this.internalStream(p||"nodebuffer").toNodejsStream(v)},_compressWorker:function(p,v){if(this._data instanceof u&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(_,p,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},m=0;m<d.length;m++)i.prototype[d[m]]=h;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,c=new l(p),d=i.document.createTextNode("");c.observe(d,{characterData:!0}),s=function(){d.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){p(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(p,0)};else{var h=new i.MessageChannel;h.port1.onmessage=p,s=function(){h.port2.postMessage(0)}}var m=[];function p(){var v,_;a=!0;for(var C=m.length;C;){for(_=m,m=[],v=-1;++v<C;)_[v]();C=m.length}a=!1}r.exports=function(v){m.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],c=["PENDING"];function d(C){if(typeof C!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,C!==s&&v(this,C)}function h(C,k,y){this.promise=C,typeof k=="function"&&(this.onFulfilled=k,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function m(C,k,y){i(function(){var b;try{b=k(y)}catch(T){return a.reject(C,T)}b===C?a.reject(C,new TypeError("Cannot resolve promise with itself")):a.resolve(C,b)})}function p(C){var k=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof k=="function")return function(){k.apply(C,arguments)}}function v(C,k){var y=!1;function b(P){y||(y=!0,a.reject(C,P))}function T(P){y||(y=!0,a.resolve(C,P))}var R=_(function(){k(T,b)});R.status==="error"&&b(R.value)}function _(C,k){var y={};try{y.value=C(k),y.status="success"}catch(b){y.status="error",y.value=b}return y}(r.exports=d).prototype.finally=function(C){if(typeof C!="function")return this;var k=this.constructor;return this.then(function(y){return k.resolve(C()).then(function(){return y})},function(y){return k.resolve(C()).then(function(){throw y})})},d.prototype.catch=function(C){return this.then(null,C)},d.prototype.then=function(C,k){if(typeof C!="function"&&this.state===u||typeof k!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==c?m(y,this.state===u?C:k,this.outcome):this.queue.push(new h(y,C,k)),y},h.prototype.callFulfilled=function(C){a.resolve(this.promise,C)},h.prototype.otherCallFulfilled=function(C){m(this.promise,this.onFulfilled,C)},h.prototype.callRejected=function(C){a.reject(this.promise,C)},h.prototype.otherCallRejected=function(C){m(this.promise,this.onRejected,C)},a.resolve=function(C,k){var y=_(p,k);if(y.status==="error")return a.reject(C,y.value);var b=y.value;if(b)v(C,b);else{C.state=u,C.outcome=k;for(var T=-1,R=C.queue.length;++T<R;)C.queue[T].callFulfilled(k)}return C},a.reject=function(C,k){C.state=l,C.outcome=k;for(var y=-1,b=C.queue.length;++y<b;)C.queue[y].callRejected(k);return C},d.resolve=function(C){return C instanceof this?C:a.resolve(new this(s),C)},d.reject=function(C){var k=new this(s);return a.reject(k,C)},d.all=function(C){var k=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=C.length,b=!1;if(!y)return this.resolve([]);for(var T=new Array(y),R=0,P=-1,j=new this(s);++P<y;)O(C[P],P);return j;function O(V,Q){k.resolve(V).then(function(F){T[Q]=F,++R!==y||b||(b=!0,a.resolve(j,T))},function(F){b||(b=!0,a.reject(j,F))})}},d.race=function(C){var k=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=C.length,b=!1;if(!y)return this.resolve([]);for(var T=-1,R=new this(s);++T<y;)P=C[T],k.resolve(P).then(function(j){b||(b=!0,a.resolve(R,j))},function(j){b||(b=!0,a.reject(R,j))});var P;return R}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),c=Object.prototype.toString,d=0,h=-1,m=0,p=8;function v(C){if(!(this instanceof v))return new v(C);this.options=s.assign({level:h,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},C||{});var k=this.options;k.raw&&0<k.windowBits?k.windowBits=-k.windowBits:k.gzip&&0<k.windowBits&&k.windowBits<16&&(k.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,k.level,k.method,k.windowBits,k.memLevel,k.strategy);if(y!==d)throw new Error(l[y]);if(k.header&&i.deflateSetHeader(this.strm,k.header),k.dictionary){var b;if(b=typeof k.dictionary=="string"?a.string2buf(k.dictionary):c.call(k.dictionary)==="[object ArrayBuffer]"?new Uint8Array(k.dictionary):k.dictionary,(y=i.deflateSetDictionary(this.strm,b))!==d)throw new Error(l[y]);this._dict_set=!0}}function _(C,k){var y=new v(k);if(y.push(C,!0),y.err)throw y.msg||l[y.err];return y.result}v.prototype.push=function(C,k){var y,b,T=this.strm,R=this.options.chunkSize;if(this.ended)return!1;b=k===~~k?k:k===!0?4:0,typeof C=="string"?T.input=a.string2buf(C):c.call(C)==="[object ArrayBuffer]"?T.input=new Uint8Array(C):T.input=C,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(R),T.next_out=0,T.avail_out=R),(y=i.deflate(T,b))!==1&&y!==d)return this.onEnd(y),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||b!==4&&b!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&y!==1);return b===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===d):b!==2||(this.onEnd(d),!(T.avail_out=0))},v.prototype.onData=function(C){this.chunks.push(C)},v.prototype.onEnd=function(C){C===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg},o.Deflate=v,o.deflate=_,o.deflateRaw=function(C,k){return(k=k||{}).raw=!0,_(C,k)},o.gzip=function(C,k){return(k=k||{}).gzip=!0,_(C,k)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),c=n("./zlib/zstream"),d=n("./zlib/gzheader"),h=Object.prototype.toString;function m(v){if(!(this instanceof m))return new m(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var _=this.options;_.raw&&0<=_.windowBits&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),!(0<=_.windowBits&&_.windowBits<16)||v&&v.windowBits||(_.windowBits+=32),15<_.windowBits&&_.windowBits<48&&(15&_.windowBits)==0&&(_.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var C=i.inflateInit2(this.strm,_.windowBits);if(C!==l.Z_OK)throw new Error(u[C]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function p(v,_){var C=new m(_);if(C.push(v,!0),C.err)throw C.msg||u[C.err];return C.result}m.prototype.push=function(v,_){var C,k,y,b,T,R,P=this.strm,j=this.options.chunkSize,O=this.options.dictionary,V=!1;if(this.ended)return!1;k=_===~~_?_:_===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?P.input=a.binstring2buf(v):h.call(v)==="[object ArrayBuffer]"?P.input=new Uint8Array(v):P.input=v,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new s.Buf8(j),P.next_out=0,P.avail_out=j),(C=i.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&O&&(R=typeof O=="string"?a.string2buf(O):h.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,C=i.inflateSetDictionary(this.strm,R)),C===l.Z_BUF_ERROR&&V===!0&&(C=l.Z_OK,V=!1),C!==l.Z_STREAM_END&&C!==l.Z_OK)return this.onEnd(C),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&C!==l.Z_STREAM_END&&(P.avail_in!==0||k!==l.Z_FINISH&&k!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(P.output,P.next_out),b=P.next_out-y,T=a.buf2string(P.output,y),P.next_out=b,P.avail_out=j-b,b&&s.arraySet(P.output,P.output,y,b,0),this.onData(T)):this.onData(s.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(V=!0)}while((0<P.avail_in||P.avail_out===0)&&C!==l.Z_STREAM_END);return C===l.Z_STREAM_END&&(k=l.Z_FINISH),k===l.Z_FINISH?(C=i.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===l.Z_OK):k!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},m.prototype.onData=function(v){this.chunks.push(v)},m.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=m,o.inflate=p,o.inflateRaw=function(v,_){return(_=_||{}).raw=!0,p(v,_)},o.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var c=u.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(l[d]=c[d])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,c,d,h){if(u.subarray&&l.subarray)l.set(u.subarray(c,c+d),h);else for(var m=0;m<d;m++)l[h+m]=u[c+m]},flattenChunks:function(l){var u,c,d,h,m,p;for(u=d=0,c=l.length;u<c;u++)d+=l[u].length;for(p=new Uint8Array(d),u=h=0,c=l.length;u<c;u++)m=l[u],p.set(m,h),h+=m.length;return p}},a={arraySet:function(l,u,c,d,h){for(var m=0;m<d;m++)l[h+m]=u[c+m]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function c(d,h){if(h<65537&&(d.subarray&&a||!d.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(d,h));for(var m="",p=0;p<h;p++)m+=String.fromCharCode(d[p]);return m}l[254]=l[254]=1,o.string2buf=function(d){var h,m,p,v,_,C=d.length,k=0;for(v=0;v<C;v++)(64512&(m=d.charCodeAt(v)))==55296&&v+1<C&&(64512&(p=d.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),k+=m<128?1:m<2048?2:m<65536?3:4;for(h=new i.Buf8(k),v=_=0;_<k;v++)(64512&(m=d.charCodeAt(v)))==55296&&v+1<C&&(64512&(p=d.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(p-56320),v++),m<128?h[_++]=m:(m<2048?h[_++]=192|m>>>6:(m<65536?h[_++]=224|m>>>12:(h[_++]=240|m>>>18,h[_++]=128|m>>>12&63),h[_++]=128|m>>>6&63),h[_++]=128|63&m);return h},o.buf2binstring=function(d){return c(d,d.length)},o.binstring2buf=function(d){for(var h=new i.Buf8(d.length),m=0,p=h.length;m<p;m++)h[m]=d.charCodeAt(m);return h},o.buf2string=function(d,h){var m,p,v,_,C=h||d.length,k=new Array(2*C);for(m=p=0;m<C;)if((v=d[m++])<128)k[p++]=v;else if(4<(_=l[v]))k[p++]=65533,m+=_-1;else{for(v&=_===2?31:_===3?15:7;1<_&&m<C;)v=v<<6|63&d[m++],_--;1<_?k[p++]=65533:v<65536?k[p++]=v:(v-=65536,k[p++]=55296|v>>10&1023,k[p++]=56320|1023&v)}return c(k,p)},o.utf8border=function(d,h){var m;for((h=h||d.length)>d.length&&(h=d.length),m=h-1;0<=m&&(192&d[m])==128;)m--;return m<0||m===0?h:m+l[d[m]]>h?m:h}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,c=i>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;c=c+(u=u+s[l++]|0)|0,--d;);u%=65521,c%=65521}return u|c<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var c=i,d=u+l;s^=-1;for(var h=u;h<d;h++)s=s>>>8^c[255&(s^a[h])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),c=n("./messages"),d=0,h=4,m=0,p=-2,v=-1,_=4,C=2,k=8,y=9,b=286,T=30,R=19,P=2*b+1,j=15,O=3,V=258,Q=V+O+1,F=42,N=113,x=1,z=2,J=3,X=4;function ae(S,ee){return S.msg=c[ee],ee}function pe(S){return(S<<1)-(4<S?9:0)}function Fe(S){for(var ee=S.length;0<=--ee;)S[ee]=0}function fe(S){var ee=S.state,D=ee.pending;D>S.avail_out&&(D=S.avail_out),D!==0&&(s.arraySet(S.output,ee.pending_buf,ee.pending_out,D,S.next_out),S.next_out+=D,ee.pending_out+=D,S.total_out+=D,S.avail_out-=D,ee.pending-=D,ee.pending===0&&(ee.pending_out=0))}function ye(S,ee){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,ee),S.block_start=S.strstart,fe(S.strm)}function le(S,ee){S.pending_buf[S.pending++]=ee}function Se(S,ee){S.pending_buf[S.pending++]=ee>>>8&255,S.pending_buf[S.pending++]=255&ee}function re(S,ee){var D,U,H=S.max_chain_length,G=S.strstart,te=S.prev_length,Y=S.nice_match,K=S.strstart>S.w_size-Q?S.strstart-(S.w_size-Q):0,be=S.window,me=S.w_mask,Ce=S.prev,Pe=S.strstart+V,it=be[G+te-1],He=be[G+te];S.prev_length>=S.good_match&&(H>>=2),Y>S.lookahead&&(Y=S.lookahead);do if(be[(D=ee)+te]===He&&be[D+te-1]===it&&be[D]===be[G]&&be[++D]===be[G+1]){G+=2,D++;do;while(be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&be[++G]===be[++D]&&G<Pe);if(U=V-(Pe-G),G=Pe-V,te<U){if(S.match_start=ee,Y<=(te=U))break;it=be[G+te-1],He=be[G+te]}}while((ee=Ce[ee&me])>K&&--H!=0);return te<=S.lookahead?te:S.lookahead}function xe(S){var ee,D,U,H,G,te,Y,K,be,me,Ce=S.w_size;do{if(H=S.window_size-S.lookahead-S.strstart,S.strstart>=Ce+(Ce-Q)){for(s.arraySet(S.window,S.window,Ce,Ce,0),S.match_start-=Ce,S.strstart-=Ce,S.block_start-=Ce,ee=D=S.hash_size;U=S.head[--ee],S.head[ee]=Ce<=U?U-Ce:0,--D;);for(ee=D=Ce;U=S.prev[--ee],S.prev[ee]=Ce<=U?U-Ce:0,--D;);H+=Ce}if(S.strm.avail_in===0)break;if(te=S.strm,Y=S.window,K=S.strstart+S.lookahead,be=H,me=void 0,me=te.avail_in,be<me&&(me=be),D=me===0?0:(te.avail_in-=me,s.arraySet(Y,te.input,te.next_in,me,K),te.state.wrap===1?te.adler=l(te.adler,Y,me,K):te.state.wrap===2&&(te.adler=u(te.adler,Y,me,K)),te.next_in+=me,te.total_in+=me,me),S.lookahead+=D,S.lookahead+S.insert>=O)for(G=S.strstart-S.insert,S.ins_h=S.window[G],S.ins_h=(S.ins_h<<S.hash_shift^S.window[G+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[G+O-1])&S.hash_mask,S.prev[G&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=G,G++,S.insert--,!(S.lookahead+S.insert<O)););}while(S.lookahead<Q&&S.strm.avail_in!==0)}function $e(S,ee){for(var D,U;;){if(S.lookahead<Q){if(xe(S),S.lookahead<Q&&ee===d)return x;if(S.lookahead===0)break}if(D=0,S.lookahead>=O&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+O-1])&S.hash_mask,D=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),D!==0&&S.strstart-D<=S.w_size-Q&&(S.match_length=re(S,D)),S.match_length>=O)if(U=a._tr_tally(S,S.strstart-S.match_start,S.match_length-O),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=O){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+O-1])&S.hash_mask,D=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else U=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(U&&(ye(S,!1),S.strm.avail_out===0))return x}return S.insert=S.strstart<O-1?S.strstart:O-1,ee===h?(ye(S,!0),S.strm.avail_out===0?J:X):S.last_lit&&(ye(S,!1),S.strm.avail_out===0)?x:z}function st(S,ee){for(var D,U,H;;){if(S.lookahead<Q){if(xe(S),S.lookahead<Q&&ee===d)return x;if(S.lookahead===0)break}if(D=0,S.lookahead>=O&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+O-1])&S.hash_mask,D=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=O-1,D!==0&&S.prev_length<S.max_lazy_match&&S.strstart-D<=S.w_size-Q&&(S.match_length=re(S,D),S.match_length<=5&&(S.strategy===1||S.match_length===O&&4096<S.strstart-S.match_start)&&(S.match_length=O-1)),S.prev_length>=O&&S.match_length<=S.prev_length){for(H=S.strstart+S.lookahead-O,U=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-O),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=H&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+O-1])&S.hash_mask,D=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=O-1,S.strstart++,U&&(ye(S,!1),S.strm.avail_out===0))return x}else if(S.match_available){if((U=a._tr_tally(S,0,S.window[S.strstart-1]))&&ye(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return x}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(U=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<O-1?S.strstart:O-1,ee===h?(ye(S,!0),S.strm.avail_out===0?J:X):S.last_lit&&(ye(S,!1),S.strm.avail_out===0)?x:z}function At(S,ee,D,U,H){this.good_length=S,this.max_lazy=ee,this.nice_length=D,this.max_chain=U,this.func=H}function Ee(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=k,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*P),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*R+1)),Fe(this.dyn_ltree),Fe(this.dyn_dtree),Fe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(j+1),this.heap=new s.Buf16(2*b+1),Fe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),Fe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ge(S){var ee;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=C,(ee=S.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?F:N,S.adler=ee.wrap===2?0:1,ee.last_flush=d,a._tr_init(ee),m):ae(S,p)}function qe(S){var ee=Ge(S);return ee===m&&(function(D){D.window_size=2*D.w_size,Fe(D.head),D.max_lazy_match=i[D.level].max_lazy,D.good_match=i[D.level].good_length,D.nice_match=i[D.level].nice_length,D.max_chain_length=i[D.level].max_chain,D.strstart=0,D.block_start=0,D.lookahead=0,D.insert=0,D.match_length=D.prev_length=O-1,D.match_available=0,D.ins_h=0})(S.state),ee}function Z(S,ee,D,U,H,G){if(!S)return p;var te=1;if(ee===v&&(ee=6),U<0?(te=0,U=-U):15<U&&(te=2,U-=16),H<1||y<H||D!==k||U<8||15<U||ee<0||9<ee||G<0||_<G)return ae(S,p);U===8&&(U=9);var Y=new Ee;return(S.state=Y).strm=S,Y.wrap=te,Y.gzhead=null,Y.w_bits=U,Y.w_size=1<<Y.w_bits,Y.w_mask=Y.w_size-1,Y.hash_bits=H+7,Y.hash_size=1<<Y.hash_bits,Y.hash_mask=Y.hash_size-1,Y.hash_shift=~~((Y.hash_bits+O-1)/O),Y.window=new s.Buf8(2*Y.w_size),Y.head=new s.Buf16(Y.hash_size),Y.prev=new s.Buf16(Y.w_size),Y.lit_bufsize=1<<H+6,Y.pending_buf_size=4*Y.lit_bufsize,Y.pending_buf=new s.Buf8(Y.pending_buf_size),Y.d_buf=1*Y.lit_bufsize,Y.l_buf=3*Y.lit_bufsize,Y.level=ee,Y.strategy=G,Y.method=D,qe(S)}i=[new At(0,0,0,0,function(S,ee){var D=65535;for(D>S.pending_buf_size-5&&(D=S.pending_buf_size-5);;){if(S.lookahead<=1){if(xe(S),S.lookahead===0&&ee===d)return x;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var U=S.block_start+D;if((S.strstart===0||S.strstart>=U)&&(S.lookahead=S.strstart-U,S.strstart=U,ye(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-Q&&(ye(S,!1),S.strm.avail_out===0))return x}return S.insert=0,ee===h?(ye(S,!0),S.strm.avail_out===0?J:X):(S.strstart>S.block_start&&(ye(S,!1),S.strm.avail_out),x)}),new At(4,4,8,4,$e),new At(4,5,16,8,$e),new At(4,6,32,32,$e),new At(4,4,16,16,st),new At(8,16,32,32,st),new At(8,16,128,128,st),new At(8,32,128,256,st),new At(32,128,258,1024,st),new At(32,258,258,4096,st)],o.deflateInit=function(S,ee){return Z(S,ee,k,15,8,0)},o.deflateInit2=Z,o.deflateReset=qe,o.deflateResetKeep=Ge,o.deflateSetHeader=function(S,ee){return S&&S.state?S.state.wrap!==2?p:(S.state.gzhead=ee,m):p},o.deflate=function(S,ee){var D,U,H,G;if(!S||!S.state||5<ee||ee<0)return S?ae(S,p):p;if(U=S.state,!S.output||!S.input&&S.avail_in!==0||U.status===666&&ee!==h)return ae(S,S.avail_out===0?-5:p);if(U.strm=S,D=U.last_flush,U.last_flush=ee,U.status===F)if(U.wrap===2)S.adler=0,le(U,31),le(U,139),le(U,8),U.gzhead?(le(U,(U.gzhead.text?1:0)+(U.gzhead.hcrc?2:0)+(U.gzhead.extra?4:0)+(U.gzhead.name?8:0)+(U.gzhead.comment?16:0)),le(U,255&U.gzhead.time),le(U,U.gzhead.time>>8&255),le(U,U.gzhead.time>>16&255),le(U,U.gzhead.time>>24&255),le(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),le(U,255&U.gzhead.os),U.gzhead.extra&&U.gzhead.extra.length&&(le(U,255&U.gzhead.extra.length),le(U,U.gzhead.extra.length>>8&255)),U.gzhead.hcrc&&(S.adler=u(S.adler,U.pending_buf,U.pending,0)),U.gzindex=0,U.status=69):(le(U,0),le(U,0),le(U,0),le(U,0),le(U,0),le(U,U.level===9?2:2<=U.strategy||U.level<2?4:0),le(U,3),U.status=N);else{var te=k+(U.w_bits-8<<4)<<8;te|=(2<=U.strategy||U.level<2?0:U.level<6?1:U.level===6?2:3)<<6,U.strstart!==0&&(te|=32),te+=31-te%31,U.status=N,Se(U,te),U.strstart!==0&&(Se(U,S.adler>>>16),Se(U,65535&S.adler)),S.adler=1}if(U.status===69)if(U.gzhead.extra){for(H=U.pending;U.gzindex<(65535&U.gzhead.extra.length)&&(U.pending!==U.pending_buf_size||(U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),fe(S),H=U.pending,U.pending!==U.pending_buf_size));)le(U,255&U.gzhead.extra[U.gzindex]),U.gzindex++;U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),U.gzindex===U.gzhead.extra.length&&(U.gzindex=0,U.status=73)}else U.status=73;if(U.status===73)if(U.gzhead.name){H=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),fe(S),H=U.pending,U.pending===U.pending_buf_size)){G=1;break}G=U.gzindex<U.gzhead.name.length?255&U.gzhead.name.charCodeAt(U.gzindex++):0,le(U,G)}while(G!==0);U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),G===0&&(U.gzindex=0,U.status=91)}else U.status=91;if(U.status===91)if(U.gzhead.comment){H=U.pending;do{if(U.pending===U.pending_buf_size&&(U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),fe(S),H=U.pending,U.pending===U.pending_buf_size)){G=1;break}G=U.gzindex<U.gzhead.comment.length?255&U.gzhead.comment.charCodeAt(U.gzindex++):0,le(U,G)}while(G!==0);U.gzhead.hcrc&&U.pending>H&&(S.adler=u(S.adler,U.pending_buf,U.pending-H,H)),G===0&&(U.status=103)}else U.status=103;if(U.status===103&&(U.gzhead.hcrc?(U.pending+2>U.pending_buf_size&&fe(S),U.pending+2<=U.pending_buf_size&&(le(U,255&S.adler),le(U,S.adler>>8&255),S.adler=0,U.status=N)):U.status=N),U.pending!==0){if(fe(S),S.avail_out===0)return U.last_flush=-1,m}else if(S.avail_in===0&&pe(ee)<=pe(D)&&ee!==h)return ae(S,-5);if(U.status===666&&S.avail_in!==0)return ae(S,-5);if(S.avail_in!==0||U.lookahead!==0||ee!==d&&U.status!==666){var Y=U.strategy===2?(function(K,be){for(var me;;){if(K.lookahead===0&&(xe(K),K.lookahead===0)){if(be===d)return x;break}if(K.match_length=0,me=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,me&&(ye(K,!1),K.strm.avail_out===0))return x}return K.insert=0,be===h?(ye(K,!0),K.strm.avail_out===0?J:X):K.last_lit&&(ye(K,!1),K.strm.avail_out===0)?x:z})(U,ee):U.strategy===3?(function(K,be){for(var me,Ce,Pe,it,He=K.window;;){if(K.lookahead<=V){if(xe(K),K.lookahead<=V&&be===d)return x;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=O&&0<K.strstart&&(Ce=He[Pe=K.strstart-1])===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]){it=K.strstart+V;do;while(Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Ce===He[++Pe]&&Pe<it);K.match_length=V-(it-Pe),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=O?(me=a._tr_tally(K,1,K.match_length-O),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(me=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),me&&(ye(K,!1),K.strm.avail_out===0))return x}return K.insert=0,be===h?(ye(K,!0),K.strm.avail_out===0?J:X):K.last_lit&&(ye(K,!1),K.strm.avail_out===0)?x:z})(U,ee):i[U.level].func(U,ee);if(Y!==J&&Y!==X||(U.status=666),Y===x||Y===J)return S.avail_out===0&&(U.last_flush=-1),m;if(Y===z&&(ee===1?a._tr_align(U):ee!==5&&(a._tr_stored_block(U,0,0,!1),ee===3&&(Fe(U.head),U.lookahead===0&&(U.strstart=0,U.block_start=0,U.insert=0))),fe(S),S.avail_out===0))return U.last_flush=-1,m}return ee!==h?m:U.wrap<=0?1:(U.wrap===2?(le(U,255&S.adler),le(U,S.adler>>8&255),le(U,S.adler>>16&255),le(U,S.adler>>24&255),le(U,255&S.total_in),le(U,S.total_in>>8&255),le(U,S.total_in>>16&255),le(U,S.total_in>>24&255)):(Se(U,S.adler>>>16),Se(U,65535&S.adler)),fe(S),0<U.wrap&&(U.wrap=-U.wrap),U.pending!==0?m:1)},o.deflateEnd=function(S){var ee;return S&&S.state?(ee=S.state.status)!==F&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==N&&ee!==666?ae(S,p):(S.state=null,ee===N?ae(S,-3):m):p},o.deflateSetDictionary=function(S,ee){var D,U,H,G,te,Y,K,be,me=ee.length;if(!S||!S.state||(G=(D=S.state).wrap)===2||G===1&&D.status!==F||D.lookahead)return p;for(G===1&&(S.adler=l(S.adler,ee,me,0)),D.wrap=0,me>=D.w_size&&(G===0&&(Fe(D.head),D.strstart=0,D.block_start=0,D.insert=0),be=new s.Buf8(D.w_size),s.arraySet(be,ee,me-D.w_size,D.w_size,0),ee=be,me=D.w_size),te=S.avail_in,Y=S.next_in,K=S.input,S.avail_in=me,S.next_in=0,S.input=ee,xe(D);D.lookahead>=O;){for(U=D.strstart,H=D.lookahead-(O-1);D.ins_h=(D.ins_h<<D.hash_shift^D.window[U+O-1])&D.hash_mask,D.prev[U&D.w_mask]=D.head[D.ins_h],D.head[D.ins_h]=U,U++,--H;);D.strstart=U,D.lookahead=O-1,xe(D)}return D.strstart+=D.lookahead,D.block_start=D.strstart,D.insert=D.lookahead,D.lookahead=0,D.match_length=D.prev_length=O-1,D.match_available=0,S.next_in=Y,S.input=K,S.avail_in=te,D.wrap=G,m},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,c,d,h,m,p,v,_,C,k,y,b,T,R,P,j,O,V,Q,F,N,x=i.input,z;u=l+(i.avail_in-5),c=i.next_out,z=i.output,d=c-(s-i.avail_out),h=c+(i.avail_out-257),m=a.dmax,p=a.wsize,v=a.whave,_=a.wnext,C=a.window,k=a.hold,y=a.bits,b=a.lencode,T=a.distcode,R=(1<<a.lenbits)-1,P=(1<<a.distbits)-1;e:do{y<15&&(k+=x[l++]<<y,y+=8,k+=x[l++]<<y,y+=8),j=b[k&R];t:for(;;){if(k>>>=O=j>>>24,y-=O,(O=j>>>16&255)===0)z[c++]=65535&j;else{if(!(16&O)){if((64&O)==0){j=b[(65535&j)+(k&(1<<O)-1)];continue t}if(32&O){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&j,(O&=15)&&(y<O&&(k+=x[l++]<<y,y+=8),V+=k&(1<<O)-1,k>>>=O,y-=O),y<15&&(k+=x[l++]<<y,y+=8,k+=x[l++]<<y,y+=8),j=T[k&P];n:for(;;){if(k>>>=O=j>>>24,y-=O,!(16&(O=j>>>16&255))){if((64&O)==0){j=T[(65535&j)+(k&(1<<O)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Q=65535&j,y<(O&=15)&&(k+=x[l++]<<y,(y+=8)<O&&(k+=x[l++]<<y,y+=8)),m<(Q+=k&(1<<O)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(k>>>=O,y-=O,(O=c-d)<Q){if(v<(O=Q-O)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(N=C,(F=0)===_){if(F+=p-O,O<V){for(V-=O;z[c++]=C[F++],--O;);F=c-Q,N=z}}else if(_<O){if(F+=p+_-O,(O-=_)<V){for(V-=O;z[c++]=C[F++],--O;);if(F=0,_<V){for(V-=O=_;z[c++]=C[F++],--O;);F=c-Q,N=z}}}else if(F+=_-O,O<V){for(V-=O;z[c++]=C[F++],--O;);F=c-Q,N=z}for(;2<V;)z[c++]=N[F++],z[c++]=N[F++],z[c++]=N[F++],V-=3;V&&(z[c++]=N[F++],1<V&&(z[c++]=N[F++]))}else{for(F=c-Q;z[c++]=z[F++],z[c++]=z[F++],z[c++]=z[F++],2<(V-=3););V&&(z[c++]=z[F++],1<V&&(z[c++]=z[F++]))}break}}break}}while(l<u&&c<h);l-=V=y>>3,k&=(1<<(y-=V<<3))-1,i.next_in=l,i.next_out=c,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=c<h?h-c+257:257-(c-h),a.hold=k,a.bits=y}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),c=1,d=2,h=0,m=-2,p=1,v=852,_=592;function C(F){return(F>>>24&255)+(F>>>8&65280)+((65280&F)<<8)+((255&F)<<24)}function k(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(F){var N;return F&&F.state?(N=F.state,F.total_in=F.total_out=N.total=0,F.msg="",N.wrap&&(F.adler=1&N.wrap),N.mode=p,N.last=0,N.havedict=0,N.dmax=32768,N.head=null,N.hold=0,N.bits=0,N.lencode=N.lendyn=new i.Buf32(v),N.distcode=N.distdyn=new i.Buf32(_),N.sane=1,N.back=-1,h):m}function b(F){var N;return F&&F.state?((N=F.state).wsize=0,N.whave=0,N.wnext=0,y(F)):m}function T(F,N){var x,z;return F&&F.state?(z=F.state,N<0?(x=0,N=-N):(x=1+(N>>4),N<48&&(N&=15)),N&&(N<8||15<N)?m:(z.window!==null&&z.wbits!==N&&(z.window=null),z.wrap=x,z.wbits=N,b(F))):m}function R(F,N){var x,z;return F?(z=new k,(F.state=z).window=null,(x=T(F,N))!==h&&(F.state=null),x):m}var P,j,O=!0;function V(F){if(O){var N;for(P=new i.Buf32(512),j=new i.Buf32(32),N=0;N<144;)F.lens[N++]=8;for(;N<256;)F.lens[N++]=9;for(;N<280;)F.lens[N++]=7;for(;N<288;)F.lens[N++]=8;for(u(c,F.lens,0,288,P,0,F.work,{bits:9}),N=0;N<32;)F.lens[N++]=5;u(d,F.lens,0,32,j,0,F.work,{bits:5}),O=!1}F.lencode=P,F.lenbits=9,F.distcode=j,F.distbits=5}function Q(F,N,x,z){var J,X=F.state;return X.window===null&&(X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new i.Buf8(X.wsize)),z>=X.wsize?(i.arraySet(X.window,N,x-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize):(z<(J=X.wsize-X.wnext)&&(J=z),i.arraySet(X.window,N,x-z,J,X.wnext),(z-=J)?(i.arraySet(X.window,N,x-z,z,0),X.wnext=z,X.whave=X.wsize):(X.wnext+=J,X.wnext===X.wsize&&(X.wnext=0),X.whave<X.wsize&&(X.whave+=J))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=y,o.inflateInit=function(F){return R(F,15)},o.inflateInit2=R,o.inflate=function(F,N){var x,z,J,X,ae,pe,Fe,fe,ye,le,Se,re,xe,$e,st,At,Ee,Ge,qe,Z,S,ee,D,U,H=0,G=new i.Buf8(4),te=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!F||!F.state||!F.output||!F.input&&F.avail_in!==0)return m;(x=F.state).mode===12&&(x.mode=13),ae=F.next_out,J=F.output,Fe=F.avail_out,X=F.next_in,z=F.input,pe=F.avail_in,fe=x.hold,ye=x.bits,le=pe,Se=Fe,ee=h;e:for(;;)switch(x.mode){case p:if(x.wrap===0){x.mode=13;break}for(;ye<16;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(2&x.wrap&&fe===35615){G[x.check=0]=255&fe,G[1]=fe>>>8&255,x.check=a(x.check,G,2,0),ye=fe=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&fe)<<8)+(fe>>8))%31){F.msg="incorrect header check",x.mode=30;break}if((15&fe)!=8){F.msg="unknown compression method",x.mode=30;break}if(ye-=4,S=8+(15&(fe>>>=4)),x.wbits===0)x.wbits=S;else if(S>x.wbits){F.msg="invalid window size",x.mode=30;break}x.dmax=1<<S,F.adler=x.check=1,x.mode=512&fe?10:12,ye=fe=0;break;case 2:for(;ye<16;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(x.flags=fe,(255&x.flags)!=8){F.msg="unknown compression method",x.mode=30;break}if(57344&x.flags){F.msg="unknown header flags set",x.mode=30;break}x.head&&(x.head.text=fe>>8&1),512&x.flags&&(G[0]=255&fe,G[1]=fe>>>8&255,x.check=a(x.check,G,2,0)),ye=fe=0,x.mode=3;case 3:for(;ye<32;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.head&&(x.head.time=fe),512&x.flags&&(G[0]=255&fe,G[1]=fe>>>8&255,G[2]=fe>>>16&255,G[3]=fe>>>24&255,x.check=a(x.check,G,4,0)),ye=fe=0,x.mode=4;case 4:for(;ye<16;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.head&&(x.head.xflags=255&fe,x.head.os=fe>>8),512&x.flags&&(G[0]=255&fe,G[1]=fe>>>8&255,x.check=a(x.check,G,2,0)),ye=fe=0,x.mode=5;case 5:if(1024&x.flags){for(;ye<16;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.length=fe,x.head&&(x.head.extra_len=fe),512&x.flags&&(G[0]=255&fe,G[1]=fe>>>8&255,x.check=a(x.check,G,2,0)),ye=fe=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(pe<(re=x.length)&&(re=pe),re&&(x.head&&(S=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,z,X,re,S)),512&x.flags&&(x.check=a(x.check,z,re,X)),pe-=re,X+=re,x.length-=re),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(pe===0)break e;for(re=0;S=z[X+re++],x.head&&S&&x.length<65536&&(x.head.name+=String.fromCharCode(S)),S&&re<pe;);if(512&x.flags&&(x.check=a(x.check,z,re,X)),pe-=re,X+=re,S)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(pe===0)break e;for(re=0;S=z[X+re++],x.head&&S&&x.length<65536&&(x.head.comment+=String.fromCharCode(S)),S&&re<pe;);if(512&x.flags&&(x.check=a(x.check,z,re,X)),pe-=re,X+=re,S)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ye<16;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(fe!==(65535&x.check)){F.msg="header crc mismatch",x.mode=30;break}ye=fe=0}x.head&&(x.head.hcrc=x.flags>>9&1,x.head.done=!0),F.adler=x.check=0,x.mode=12;break;case 10:for(;ye<32;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}F.adler=x.check=C(fe),ye=fe=0,x.mode=11;case 11:if(x.havedict===0)return F.next_out=ae,F.avail_out=Fe,F.next_in=X,F.avail_in=pe,x.hold=fe,x.bits=ye,2;F.adler=x.check=1,x.mode=12;case 12:if(N===5||N===6)break e;case 13:if(x.last){fe>>>=7&ye,ye-=7&ye,x.mode=27;break}for(;ye<3;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}switch(x.last=1&fe,ye-=1,3&(fe>>>=1)){case 0:x.mode=14;break;case 1:if(V(x),x.mode=20,N!==6)break;fe>>>=2,ye-=2;break e;case 2:x.mode=17;break;case 3:F.msg="invalid block type",x.mode=30}fe>>>=2,ye-=2;break;case 14:for(fe>>>=7&ye,ye-=7&ye;ye<32;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if((65535&fe)!=(fe>>>16^65535)){F.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&fe,ye=fe=0,x.mode=15,N===6)break e;case 15:x.mode=16;case 16:if(re=x.length){if(pe<re&&(re=pe),Fe<re&&(re=Fe),re===0)break e;i.arraySet(J,z,X,re,ae),pe-=re,X+=re,Fe-=re,ae+=re,x.length-=re;break}x.mode=12;break;case 17:for(;ye<14;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(x.nlen=257+(31&fe),fe>>>=5,ye-=5,x.ndist=1+(31&fe),fe>>>=5,ye-=5,x.ncode=4+(15&fe),fe>>>=4,ye-=4,286<x.nlen||30<x.ndist){F.msg="too many length or distance symbols",x.mode=30;break}x.have=0,x.mode=18;case 18:for(;x.have<x.ncode;){for(;ye<3;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.lens[te[x.have++]]=7&fe,fe>>>=3,ye-=3}for(;x.have<19;)x.lens[te[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,D={bits:x.lenbits},ee=u(0,x.lens,0,19,x.lencode,0,x.work,D),x.lenbits=D.bits,ee){F.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have<x.nlen+x.ndist;){for(;At=(H=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,Ee=65535&H,!((st=H>>>24)<=ye);){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(Ee<16)fe>>>=st,ye-=st,x.lens[x.have++]=Ee;else{if(Ee===16){for(U=st+2;ye<U;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(fe>>>=st,ye-=st,x.have===0){F.msg="invalid bit length repeat",x.mode=30;break}S=x.lens[x.have-1],re=3+(3&fe),fe>>>=2,ye-=2}else if(Ee===17){for(U=st+3;ye<U;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}ye-=st,S=0,re=3+(7&(fe>>>=st)),fe>>>=3,ye-=3}else{for(U=st+7;ye<U;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}ye-=st,S=0,re=11+(127&(fe>>>=st)),fe>>>=7,ye-=7}if(x.have+re>x.nlen+x.ndist){F.msg="invalid bit length repeat",x.mode=30;break}for(;re--;)x.lens[x.have++]=S}}if(x.mode===30)break;if(x.lens[256]===0){F.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,D={bits:x.lenbits},ee=u(c,x.lens,0,x.nlen,x.lencode,0,x.work,D),x.lenbits=D.bits,ee){F.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,D={bits:x.distbits},ee=u(d,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,D),x.distbits=D.bits,ee){F.msg="invalid distances set",x.mode=30;break}if(x.mode=20,N===6)break e;case 20:x.mode=21;case 21:if(6<=pe&&258<=Fe){F.next_out=ae,F.avail_out=Fe,F.next_in=X,F.avail_in=pe,x.hold=fe,x.bits=ye,l(F,Se),ae=F.next_out,J=F.output,Fe=F.avail_out,X=F.next_in,z=F.input,pe=F.avail_in,fe=x.hold,ye=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;At=(H=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,Ee=65535&H,!((st=H>>>24)<=ye);){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(At&&(240&At)==0){for(Ge=st,qe=At,Z=Ee;At=(H=x.lencode[Z+((fe&(1<<Ge+qe)-1)>>Ge)])>>>16&255,Ee=65535&H,!(Ge+(st=H>>>24)<=ye);){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}fe>>>=Ge,ye-=Ge,x.back+=Ge}if(fe>>>=st,ye-=st,x.back+=st,x.length=Ee,At===0){x.mode=26;break}if(32&At){x.back=-1,x.mode=12;break}if(64&At){F.msg="invalid literal/length code",x.mode=30;break}x.extra=15&At,x.mode=22;case 22:if(x.extra){for(U=x.extra;ye<U;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.length+=fe&(1<<x.extra)-1,fe>>>=x.extra,ye-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;At=(H=x.distcode[fe&(1<<x.distbits)-1])>>>16&255,Ee=65535&H,!((st=H>>>24)<=ye);){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if((240&At)==0){for(Ge=st,qe=At,Z=Ee;At=(H=x.distcode[Z+((fe&(1<<Ge+qe)-1)>>Ge)])>>>16&255,Ee=65535&H,!(Ge+(st=H>>>24)<=ye);){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}fe>>>=Ge,ye-=Ge,x.back+=Ge}if(fe>>>=st,ye-=st,x.back+=st,64&At){F.msg="invalid distance code",x.mode=30;break}x.offset=Ee,x.extra=15&At,x.mode=24;case 24:if(x.extra){for(U=x.extra;ye<U;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}x.offset+=fe&(1<<x.extra)-1,fe>>>=x.extra,ye-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){F.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(Fe===0)break e;if(re=Se-Fe,x.offset>re){if((re=x.offset-re)>x.whave&&x.sane){F.msg="invalid distance too far back",x.mode=30;break}xe=re>x.wnext?(re-=x.wnext,x.wsize-re):x.wnext-re,re>x.length&&(re=x.length),$e=x.window}else $e=J,xe=ae-x.offset,re=x.length;for(Fe<re&&(re=Fe),Fe-=re,x.length-=re;J[ae++]=$e[xe++],--re;);x.length===0&&(x.mode=21);break;case 26:if(Fe===0)break e;J[ae++]=x.length,Fe--,x.mode=21;break;case 27:if(x.wrap){for(;ye<32;){if(pe===0)break e;pe--,fe|=z[X++]<<ye,ye+=8}if(Se-=Fe,F.total_out+=Se,x.total+=Se,Se&&(F.adler=x.check=x.flags?a(x.check,J,Se,ae-Se):s(x.check,J,Se,ae-Se)),Se=Fe,(x.flags?fe:C(fe))!==x.check){F.msg="incorrect data check",x.mode=30;break}ye=fe=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ye<32;){if(pe===0)break e;pe--,fe+=z[X++]<<ye,ye+=8}if(fe!==(4294967295&x.total)){F.msg="incorrect length check",x.mode=30;break}ye=fe=0}x.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return m}return F.next_out=ae,F.avail_out=Fe,F.next_in=X,F.avail_in=pe,x.hold=fe,x.bits=ye,(x.wsize||Se!==F.avail_out&&x.mode<30&&(x.mode<27||N!==4))&&Q(F,F.output,F.next_out,Se-F.avail_out)?(x.mode=31,-4):(le-=F.avail_in,Se-=F.avail_out,F.total_in+=le,F.total_out+=Se,x.total+=Se,x.wrap&&Se&&(F.adler=x.check=x.flags?a(x.check,J,Se,F.next_out-Se):s(x.check,J,Se,F.next_out-Se)),F.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(le==0&&Se===0||N===4)&&ee===h&&(ee=-5),ee)},o.inflateEnd=function(F){if(!F||!F.state)return m;var N=F.state;return N.window&&(N.window=null),F.state=null,h},o.inflateGetHeader=function(F,N){var x;return F&&F.state?(2&(x=F.state).wrap)==0?m:((x.head=N).done=!1,h):m},o.inflateSetDictionary=function(F,N){var x,z=N.length;return F&&F.state?(x=F.state).wrap!==0&&x.mode!==11?m:x.mode===11&&s(1,N,z,0)!==x.check?-3:Q(F,N,z,z)?(x.mode=31,-4):(x.havedict=1,h):m},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(c,d,h,m,p,v,_,C){var k,y,b,T,R,P,j,O,V,Q=C.bits,F=0,N=0,x=0,z=0,J=0,X=0,ae=0,pe=0,Fe=0,fe=0,ye=null,le=0,Se=new i.Buf16(16),re=new i.Buf16(16),xe=null,$e=0;for(F=0;F<=15;F++)Se[F]=0;for(N=0;N<m;N++)Se[d[h+N]]++;for(J=Q,z=15;1<=z&&Se[z]===0;z--);if(z<J&&(J=z),z===0)return p[v++]=20971520,p[v++]=20971520,C.bits=1,0;for(x=1;x<z&&Se[x]===0;x++);for(J<x&&(J=x),F=pe=1;F<=15;F++)if(pe<<=1,(pe-=Se[F])<0)return-1;if(0<pe&&(c===0||z!==1))return-1;for(re[1]=0,F=1;F<15;F++)re[F+1]=re[F]+Se[F];for(N=0;N<m;N++)d[h+N]!==0&&(_[re[d[h+N]]++]=N);if(P=c===0?(ye=xe=_,19):c===1?(ye=s,le-=257,xe=a,$e-=257,256):(ye=l,xe=u,-1),F=x,R=v,ae=N=fe=0,b=-1,T=(Fe=1<<(X=J))-1,c===1&&852<Fe||c===2&&592<Fe)return 1;for(;;){for(j=F-ae,V=_[N]<P?(O=0,_[N]):_[N]>P?(O=xe[$e+_[N]],ye[le+_[N]]):(O=96,0),k=1<<F-ae,x=y=1<<X;p[R+(fe>>ae)+(y-=k)]=j<<24|O<<16|V|0,y!==0;);for(k=1<<F-1;fe&k;)k>>=1;if(k!==0?(fe&=k-1,fe+=k):fe=0,N++,--Se[F]==0){if(F===z)break;F=d[h+_[N]]}if(J<F&&(fe&T)!==b){for(ae===0&&(ae=J),R+=x,pe=1<<(X=F-ae);X+ae<z&&!((pe-=Se[X+ae])<=0);)X++,pe<<=1;if(Fe+=1<<X,c===1&&852<Fe||c===2&&592<Fe)return 1;p[b=fe&T]=J<<24|X<<16|R-v|0}}return fe!==0&&(p[R+fe]=F-ae<<24|4194304),C.bits=J,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(H){for(var G=H.length;0<=--G;)H[G]=0}var u=0,c=29,d=256,h=d+1+c,m=30,p=19,v=2*h+1,_=15,C=16,k=7,y=256,b=16,T=17,R=18,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Q=new Array(2*(h+2));l(Q);var F=new Array(2*m);l(F);var N=new Array(512);l(N);var x=new Array(256);l(x);var z=new Array(c);l(z);var J,X,ae,pe=new Array(m);function Fe(H,G,te,Y,K){this.static_tree=H,this.extra_bits=G,this.extra_base=te,this.elems=Y,this.max_length=K,this.has_stree=H&&H.length}function fe(H,G){this.dyn_tree=H,this.max_code=0,this.stat_desc=G}function ye(H){return H<256?N[H]:N[256+(H>>>7)]}function le(H,G){H.pending_buf[H.pending++]=255&G,H.pending_buf[H.pending++]=G>>>8&255}function Se(H,G,te){H.bi_valid>C-te?(H.bi_buf|=G<<H.bi_valid&65535,le(H,H.bi_buf),H.bi_buf=G>>C-H.bi_valid,H.bi_valid+=te-C):(H.bi_buf|=G<<H.bi_valid&65535,H.bi_valid+=te)}function re(H,G,te){Se(H,te[2*G],te[2*G+1])}function xe(H,G){for(var te=0;te|=1&H,H>>>=1,te<<=1,0<--G;);return te>>>1}function $e(H,G,te){var Y,K,be=new Array(_+1),me=0;for(Y=1;Y<=_;Y++)be[Y]=me=me+te[Y-1]<<1;for(K=0;K<=G;K++){var Ce=H[2*K+1];Ce!==0&&(H[2*K]=xe(be[Ce]++,Ce))}}function st(H){var G;for(G=0;G<h;G++)H.dyn_ltree[2*G]=0;for(G=0;G<m;G++)H.dyn_dtree[2*G]=0;for(G=0;G<p;G++)H.bl_tree[2*G]=0;H.dyn_ltree[2*y]=1,H.opt_len=H.static_len=0,H.last_lit=H.matches=0}function At(H){8<H.bi_valid?le(H,H.bi_buf):0<H.bi_valid&&(H.pending_buf[H.pending++]=H.bi_buf),H.bi_buf=0,H.bi_valid=0}function Ee(H,G,te,Y){var K=2*G,be=2*te;return H[K]<H[be]||H[K]===H[be]&&Y[G]<=Y[te]}function Ge(H,G,te){for(var Y=H.heap[te],K=te<<1;K<=H.heap_len&&(K<H.heap_len&&Ee(G,H.heap[K+1],H.heap[K],H.depth)&&K++,!Ee(G,Y,H.heap[K],H.depth));)H.heap[te]=H.heap[K],te=K,K<<=1;H.heap[te]=Y}function qe(H,G,te){var Y,K,be,me,Ce=0;if(H.last_lit!==0)for(;Y=H.pending_buf[H.d_buf+2*Ce]<<8|H.pending_buf[H.d_buf+2*Ce+1],K=H.pending_buf[H.l_buf+Ce],Ce++,Y===0?re(H,K,G):(re(H,(be=x[K])+d+1,G),(me=P[be])!==0&&Se(H,K-=z[be],me),re(H,be=ye(--Y),te),(me=j[be])!==0&&Se(H,Y-=pe[be],me)),Ce<H.last_lit;);re(H,y,G)}function Z(H,G){var te,Y,K,be=G.dyn_tree,me=G.stat_desc.static_tree,Ce=G.stat_desc.has_stree,Pe=G.stat_desc.elems,it=-1;for(H.heap_len=0,H.heap_max=v,te=0;te<Pe;te++)be[2*te]!==0?(H.heap[++H.heap_len]=it=te,H.depth[te]=0):be[2*te+1]=0;for(;H.heap_len<2;)be[2*(K=H.heap[++H.heap_len]=it<2?++it:0)]=1,H.depth[K]=0,H.opt_len--,Ce&&(H.static_len-=me[2*K+1]);for(G.max_code=it,te=H.heap_len>>1;1<=te;te--)Ge(H,be,te);for(K=Pe;te=H.heap[1],H.heap[1]=H.heap[H.heap_len--],Ge(H,be,1),Y=H.heap[1],H.heap[--H.heap_max]=te,H.heap[--H.heap_max]=Y,be[2*K]=be[2*te]+be[2*Y],H.depth[K]=(H.depth[te]>=H.depth[Y]?H.depth[te]:H.depth[Y])+1,be[2*te+1]=be[2*Y+1]=K,H.heap[1]=K++,Ge(H,be,1),2<=H.heap_len;);H.heap[--H.heap_max]=H.heap[1],(function(He,Ct){var Yt,St,Ft,Nt,sn,_n,Qt=Ct.dyn_tree,Ye=Ct.max_code,Et=Ct.stat_desc.static_tree,Ot=Ct.stat_desc.has_stree,wn=Ct.stat_desc.extra_bits,Kt=Ct.stat_desc.extra_base,Sn=Ct.stat_desc.max_length,Pt=0;for(Nt=0;Nt<=_;Nt++)He.bl_count[Nt]=0;for(Qt[2*He.heap[He.heap_max]+1]=0,Yt=He.heap_max+1;Yt<v;Yt++)Sn<(Nt=Qt[2*Qt[2*(St=He.heap[Yt])+1]+1]+1)&&(Nt=Sn,Pt++),Qt[2*St+1]=Nt,Ye<St||(He.bl_count[Nt]++,sn=0,Kt<=St&&(sn=wn[St-Kt]),_n=Qt[2*St],He.opt_len+=_n*(Nt+sn),Ot&&(He.static_len+=_n*(Et[2*St+1]+sn)));if(Pt!==0){do{for(Nt=Sn-1;He.bl_count[Nt]===0;)Nt--;He.bl_count[Nt]--,He.bl_count[Nt+1]+=2,He.bl_count[Sn]--,Pt-=2}while(0<Pt);for(Nt=Sn;Nt!==0;Nt--)for(St=He.bl_count[Nt];St!==0;)Ye<(Ft=He.heap[--Yt])||(Qt[2*Ft+1]!==Nt&&(He.opt_len+=(Nt-Qt[2*Ft+1])*Qt[2*Ft],Qt[2*Ft+1]=Nt),St--)}})(H,G),$e(be,it,H.bl_count)}function S(H,G,te){var Y,K,be=-1,me=G[1],Ce=0,Pe=7,it=4;for(me===0&&(Pe=138,it=3),G[2*(te+1)+1]=65535,Y=0;Y<=te;Y++)K=me,me=G[2*(Y+1)+1],++Ce<Pe&&K===me||(Ce<it?H.bl_tree[2*K]+=Ce:K!==0?(K!==be&&H.bl_tree[2*K]++,H.bl_tree[2*b]++):Ce<=10?H.bl_tree[2*T]++:H.bl_tree[2*R]++,be=K,it=(Ce=0)===me?(Pe=138,3):K===me?(Pe=6,3):(Pe=7,4))}function ee(H,G,te){var Y,K,be=-1,me=G[1],Ce=0,Pe=7,it=4;for(me===0&&(Pe=138,it=3),Y=0;Y<=te;Y++)if(K=me,me=G[2*(Y+1)+1],!(++Ce<Pe&&K===me)){if(Ce<it)for(;re(H,K,H.bl_tree),--Ce!=0;);else K!==0?(K!==be&&(re(H,K,H.bl_tree),Ce--),re(H,b,H.bl_tree),Se(H,Ce-3,2)):Ce<=10?(re(H,T,H.bl_tree),Se(H,Ce-3,3)):(re(H,R,H.bl_tree),Se(H,Ce-11,7));be=K,it=(Ce=0)===me?(Pe=138,3):K===me?(Pe=6,3):(Pe=7,4)}}l(pe);var D=!1;function U(H,G,te,Y){Se(H,(u<<1)+(Y?1:0),3),(function(K,be,me,Ce){At(K),Ce&&(le(K,me),le(K,~me)),i.arraySet(K.pending_buf,K.window,be,me,K.pending),K.pending+=me})(H,G,te,!0)}o._tr_init=function(H){D||((function(){var G,te,Y,K,be,me=new Array(_+1);for(K=Y=0;K<c-1;K++)for(z[K]=Y,G=0;G<1<<P[K];G++)x[Y++]=K;for(x[Y-1]=K,K=be=0;K<16;K++)for(pe[K]=be,G=0;G<1<<j[K];G++)N[be++]=K;for(be>>=7;K<m;K++)for(pe[K]=be<<7,G=0;G<1<<j[K]-7;G++)N[256+be++]=K;for(te=0;te<=_;te++)me[te]=0;for(G=0;G<=143;)Q[2*G+1]=8,G++,me[8]++;for(;G<=255;)Q[2*G+1]=9,G++,me[9]++;for(;G<=279;)Q[2*G+1]=7,G++,me[7]++;for(;G<=287;)Q[2*G+1]=8,G++,me[8]++;for($e(Q,h+1,me),G=0;G<m;G++)F[2*G+1]=5,F[2*G]=xe(G,5);J=new Fe(Q,P,d+1,h,_),X=new Fe(F,j,0,m,_),ae=new Fe(new Array(0),O,0,p,k)})(),D=!0),H.l_desc=new fe(H.dyn_ltree,J),H.d_desc=new fe(H.dyn_dtree,X),H.bl_desc=new fe(H.bl_tree,ae),H.bi_buf=0,H.bi_valid=0,st(H)},o._tr_stored_block=U,o._tr_flush_block=function(H,G,te,Y){var K,be,me=0;0<H.level?(H.strm.data_type===2&&(H.strm.data_type=(function(Ce){var Pe,it=4093624447;for(Pe=0;Pe<=31;Pe++,it>>>=1)if(1&it&&Ce.dyn_ltree[2*Pe]!==0)return s;if(Ce.dyn_ltree[18]!==0||Ce.dyn_ltree[20]!==0||Ce.dyn_ltree[26]!==0)return a;for(Pe=32;Pe<d;Pe++)if(Ce.dyn_ltree[2*Pe]!==0)return a;return s})(H)),Z(H,H.l_desc),Z(H,H.d_desc),me=(function(Ce){var Pe;for(S(Ce,Ce.dyn_ltree,Ce.l_desc.max_code),S(Ce,Ce.dyn_dtree,Ce.d_desc.max_code),Z(Ce,Ce.bl_desc),Pe=p-1;3<=Pe&&Ce.bl_tree[2*V[Pe]+1]===0;Pe--);return Ce.opt_len+=3*(Pe+1)+5+5+4,Pe})(H),K=H.opt_len+3+7>>>3,(be=H.static_len+3+7>>>3)<=K&&(K=be)):K=be=te+5,te+4<=K&&G!==-1?U(H,G,te,Y):H.strategy===4||be===K?(Se(H,2+(Y?1:0),3),qe(H,Q,F)):(Se(H,4+(Y?1:0),3),(function(Ce,Pe,it,He){var Ct;for(Se(Ce,Pe-257,5),Se(Ce,it-1,5),Se(Ce,He-4,4),Ct=0;Ct<He;Ct++)Se(Ce,Ce.bl_tree[2*V[Ct]+1],3);ee(Ce,Ce.dyn_ltree,Pe-1),ee(Ce,Ce.dyn_dtree,it-1)})(H,H.l_desc.max_code+1,H.d_desc.max_code+1,me+1),qe(H,H.dyn_ltree,H.dyn_dtree)),st(H),Y&&At(H)},o._tr_tally=function(H,G,te){return H.pending_buf[H.d_buf+2*H.last_lit]=G>>>8&255,H.pending_buf[H.d_buf+2*H.last_lit+1]=255&G,H.pending_buf[H.l_buf+H.last_lit]=255&te,H.last_lit++,G===0?H.dyn_ltree[2*te]++:(H.matches++,G--,H.dyn_ltree[2*(x[te]+d+1)]++,H.dyn_dtree[2*ye(G)]++),H.last_lit===H.lit_bufsize-1},o._tr_align=function(H){Se(H,2,3),re(H,y,Q),(function(G){G.bi_valid===16?(le(G,G.bi_buf),G.bi_buf=0,G.bi_valid=0):8<=G.bi_valid&&(G.pending_buf[G.pending++]=255&G.bi_buf,G.bi_buf>>=8,G.bi_valid-=8)})(H)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,c,d,h=1,m={},p=!1,v=s.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(s);_=_&&_.setTimeout?_:s,l={}.toString.call(s.process)==="[object process]"?function(b){process.nextTick(function(){k(b)})}:(function(){if(s.postMessage&&!s.importScripts){var b=!0,T=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=T,b}})()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(b){s.postMessage(d+b,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(b){k(b.data)},function(b){c.port2.postMessage(b)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(b){var T=v.createElement("script");T.onreadystatechange=function(){k(b),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(b){setTimeout(k,0,b)},_.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var T=new Array(arguments.length-1),R=0;R<T.length;R++)T[R]=arguments[R+1];return m[h]={callback:b,args:T},l(h),h++},_.clearImmediate=C}function C(b){delete m[b]}function k(b){if(p)setTimeout(k,0,b);else{var T=m[b];if(T){p=!0;try{(function(R){var P=R.callback,j=R.args;switch(j.length){case 0:P();break;case 1:P(j[0]);break;case 2:P(j[0],j[1]);break;case 3:P(j[0],j[1],j[2]);break;default:P.apply(a,j)}})(T)}finally{C(b),p=!1}}}}function y(b){b.source===s&&typeof b.data=="string"&&b.data.indexOf(d)===0&&k(+b.data.slice(d.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}));const Or="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ql="application/pdf",ep="text/html",p6={docx:Or,pdf:Ql,html:ep},tp={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};var m6=Bb(h6(),1);xt();const g6=e=>typeof e!="string"?"":e.trim(),Xv=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Xw=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Gd=e=>{const t=e??{},n=g6(t.id),r=Xv(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Zw=({current:e,other:t})=>{const n=Gd(e),r=Gd(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Qc=({actor:e,fallbackKey:t=""})=>{const n=Gd(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function v6(e){return typeof e.captureStackTrace=="function"}var np=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",v6(Error)&&Error.captureStackTrace(this,this.constructor)}},y6=class extends np{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},b6=class extends np{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}};const Zv=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new y6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new b6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof np?r:new np("Failed to create file object",r)}};function w6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var rp=new WeakMap;function Qw(e){return e.ownerDocument??document}function Jw(e,t){const n=rp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),rp.delete(t))}function $w(e,t){const n=Qw(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&Jw(e,e.__clickOutsideDocument);let r=rp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},rp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Qv={mounted(e,t){$w(e,t)},updated(e,t){$w(e,t)},unmounted(e){Jw(e,e.__clickOutsideDocument??Qw(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function C6(e){return e[1].user!==void 0}const _6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(C6).filter(([r,o])=>{const i=Qc({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Qc({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},S6=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e};var k6=typeof window<"u",eC,Wd=e=>eC=e,tC=Symbol();function Jv(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Kd;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Kd||(Kd={}));var nC=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function A6(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function $v(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){I6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function rC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function op(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(n)}}var ip=typeof navigator=="object"?navigator:{userAgent:""},oC=/Macintosh/.test(ip.userAgent)&&/AppleWebKit/.test(ip.userAgent)&&!/Safari/.test(ip.userAgent),I6=k6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!oC?E6:"msSaveOrOpenBlob"in ip?x6:T6:()=>{};function E6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?rC(r.href)?$v(e,t,n):(r.target="_blank",op(r)):op(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){op(r)},0))}function x6(e,t="download",n){if(typeof e=="string")if(rC(e))$v(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){op(r)})}else navigator.msSaveOrOpenBlob(A6(e,n),t)}function T6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return $v(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(nC.HTMLElement))||"safari"in nC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||oC)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:nj}=Object;function R6(){const e=ig(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Wr({install(i){Wd(o),o._a=i,i.provide(tC,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var iC=()=>{};function sC(e,t,n,r=iC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&sg()&&Jb(o),o}function Jc(e,...t){e.forEach(n=>{n(...t)})}var M6=e=>e(),aC=Symbol(),ey=Symbol();function ty(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];Jv(o)&&Jv(r)&&e.hasOwnProperty(n)&&!nr(r)&&!Ci(r)?e[n]=ty(o,r):e[n]=r}return e}var L6=Symbol();function P6(e){return!Jv(e)||!Object.prototype.hasOwnProperty.call(e,L6)}var{assign:Ya}=Object;function D6(e){return!!(nr(e)&&e.effect)}function O6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){return a||(n.state.value[e]=o?o():{}),Ya(c2(n.state.value[e]),i,Object.keys(s||{}).reduce((c,d)=>(c[d]=Wr(ke(()=>{Wd(n);const h=n._s.get(e);return s[d].call(h,h)})),c),{}))}return l=lC(e,u,t,n,r,!0),l}function lC(e,t,n={},r,o,i){let s;const a=Ya({actions:{}},n),l={deep:!0};let u,c,d=new Set,h=new Set,m;const p=r.state.value[e];!i&&!p&&(r.state.value[e]={});let v;function _(R){let P;u=c=!1,typeof R=="function"?(R(r.state.value[e]),P={type:Kd.patchFunction,storeId:e,events:m}):(ty(r.state.value[e],R),P={type:Kd.patchObject,payload:R,storeId:e,events:m});const j=v=Symbol();_t().then(()=>{v===j&&(u=!0)}),c=!0,Jc(d,P,r.state.value[e])}const C=i?function(){const{state:P}=n,j=P?P():{};this.$patch(O=>{Ya(O,j)})}:iC;function k(){s.stop(),d.clear(),h.clear(),r._s.delete(e)}const y=(R,P="")=>{if(aC in R)return R[ey]=P,R;const j=function(){Wd(r);const O=Array.from(arguments),V=new Set,Q=new Set;function F(z){V.add(z)}function N(z){Q.add(z)}Jc(h,{args:O,name:j[ey],store:b,after:F,onError:N});let x;try{x=R.apply(this&&this.$id===e?this:b,O)}catch(z){throw Jc(Q,z),z}return x instanceof Promise?x.then(z=>(Jc(V,z),z)).catch(z=>(Jc(Q,z),Promise.reject(z))):(Jc(V,x),x)};return j[aC]=!0,j[ey]=P,j},b=Gr({_p:r,$id:e,$onAction:sC.bind(null,h),$patch:_,$reset:C,$subscribe(R,P={}){const j=sC(d,R,P.detached,()=>O()),O=s.run(()=>Lt(()=>r.state.value[e],V=>{(P.flush==="sync"?c:u)&&R({storeId:e,type:Kd.direct,events:m},V)},Ya({},l,P)));return j},$dispose:k});r._s.set(e,b);const T=(r._a&&r._a.runWithContext||M6)(()=>r._e.run(()=>(s=ig()).run(()=>t({action:y}))));for(const R in T){const P=T[R];nr(P)&&!D6(P)||Ci(P)?i||(p&&P6(P)&&(nr(P)?P.value=p[R]:ty(P,p[R])),r.state.value[e][R]=P):typeof P=="function"&&(T[R]=y(P,R),a.actions[R]=P)}return Ya(b,T),Ya(mn(b),T),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:R=>{_(P=>{Ya(P,R)})}}),r._p.forEach(R=>{Ya(b,s.run(()=>R({store:b,app:r._a,pinia:r,options:a})))}),p&&i&&n.hydrate&&n.hydrate(b.$state,p),u=!0,c=!0,b}function cC(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=N2();return s=s||(l?Ba(tC,null):null),s&&Wd(s),s=eC,s._s.has(e)||(o?lC(e,t,r,s):O6(e,r,s)),s._s.get(e)}return i.$id=e,i}function Js(e){const t=mn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(nr(o)||Ci(o))&&(n[r]=pg(e,r))}return n}const qd=e=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const t=e.name||"document";return new File([e],t,{type:e.type})}return e}return e.originFileObj?qd(e.originFileObj):e.file?qd(e.file):e.raw?qd(e.raw):null};var uC=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Or:t.endsWith(".pdf")?Ql:t.endsWith(".html")||t.endsWith(".htm")?ep:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""};const Yd=e=>{const t=qd(e);if(t){const n=t.name||e&&e.name||"document";return{type:t.type||uC(n)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:t,name:n}}if(e&&typeof e=="object"&&"data"in e){const n=qd(e.data);if(n){const r=e.type||n.type||uC(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";return{...e,type:r,data:n,name:e.name||n.name||"document"}}}return e};xt();function F6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?Gr({...t}):ne(t),i=ne(null);return Lt(o,(a,l)=>{i.value={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r}}),{value:o}}function N6(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=F6(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),c=e,d=Gr({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),h=ne(e.logicrules),m=ne(!1),p=Gr({}),v={SELECT:z6,IMAGEINPUT:B6,CHECKBOXINPUT:V6};return l.value in v&&Object.assign(p,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:h,hidden:m,originalJSON:c,fieldStyle:d,valueGetter:e.valueGetter,...p}}function B6(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function z6(e){return{options:ne(e.itemoptions)}}function V6(e){const t=ne(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}const vs=()=>new Map,ny=e=>{const t=vs();return e.forEach((n,r)=>{t.set(r,n)}),t},$c=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},H6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},j6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},eu=()=>new Set,ry=e=>e[e.length-1],tu=Array.from,oy=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},dC=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},U6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Xd=Array.isArray;var G6=class{constructor(){this._observers=vs()}on(e,t){return $c(this._observers,e,eu).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return tu((this._observers.get(e)||vs()).values()).forEach(n=>n(...t))}destroy(){this._observers=vs()}};const $s=Math.floor,sp=Math.abs,fC=(e,t)=>e<t?e:t,nu=(e,t)=>e>t?e:t,rj=Number.isNaN,W6=e=>e!==0?e<0:1/e<0,oj=1,ij=2,sj=4,aj=8,lj=32,cj=64,uj=128,K6=1<<17,q6=1<<18,Y6=1<<19,X6=1<<20,Z6=1<<21,Q6=1<<22,J6=1<<23,$6=1<<24,eE=1<<25,tE=1<<26,nE=1<<27,rE=1<<28,oE=1<<29,iE=1<<30,dj=1<<31,fj=31,hj=63,pj=127,mj=K6-1,gj=q6-1,vj=Y6-1,yj=X6-1,bj=Z6-1,wj=Q6-1,Cj=J6-1,_j=$6-1,Sj=eE-1,kj=tE-1,Aj=nE-1,Ij=rE-1,Ej=oE-1,xj=iE-1,sE=2147483647,aE=4294967295,hC=Number.MAX_SAFE_INTEGER,pC=Number.MIN_SAFE_INTEGER,Tj=1<<31,Rj=sE,Mj=aE,lE=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&$s(e)===e),Lj=Number.isNaN,Pj=Number.parseInt,mC=String.fromCharCode,Dj=String.fromCodePoint,Oj=mC(65535);var cE=e=>e.toLowerCase(),uE=/^\s*/g;const dE=e=>e.replace(uE,"");var fE=/([A-Z])/g;const gC=(e,t)=>dE(e.replace(fE,n=>`${t}${cE(n)}`)),hE=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Zd=typeof TextEncoder<"u"?new TextEncoder:null,pE=Zd?e=>Zd.encode(e):hE;let iy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});iy&&iy.decode(new Uint8Array).length===1&&(iy=null);const mE=(e,t)=>U6(t,()=>e).join("");var Qd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const sy=()=>new Qd,gE=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ea=e=>{const t=new Uint8Array(gE(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},vE=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(nu(n,t)*2),e.cpos=0)},eo=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},ay=eo,Zn=(e,t)=>{for(;t>127;)eo(e,128|127&t),t=$s(t/128);eo(e,127&t)},ly=(e,t)=>{const n=W6(t);for(n&&(t=-t),eo(e,(t>63?128:0)|(n?64:0)|63&t),t=$s(t/64);t>0;)eo(e,(t>127?128:0)|127&t),t=$s(t/128)};var cy=new Uint8Array(3e4),yE=cy.length/3;const bE=(e,t)=>{if(t.length<yE){const n=Zd.encodeInto(t,cy).written||0;Zn(e,n);for(let r=0;r<n;r++)eo(e,cy[r])}else fi(e,pE(t))},wE=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Zn(e,r);for(let o=0;o<r;o++)eo(e,n.codePointAt(o))},ru=Zd&&Zd.encodeInto?bE:wE,uy=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=fC(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(nu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},fi=(e,t)=>{Zn(e,t.byteLength),uy(e,t)},dy=(e,t)=>{vE(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},CE=(e,t)=>dy(e,4).setFloat32(0,t,!1),_E=(e,t)=>dy(e,8).setFloat64(0,t,!1),SE=(e,t)=>dy(e,8).setBigInt64(0,t,!1);var vC=new DataView(new ArrayBuffer(4)),kE=e=>(vC.setFloat32(0,e),vC.getFloat32(0)===e);const Jd=(e,t)=>{switch(typeof t){case"string":eo(e,119),ru(e,t);break;case"number":lE(t)&&sp(t)<=2147483647?(eo(e,125),ly(e,t)):kE(t)?(eo(e,124),CE(e,t)):(eo(e,123),_E(e,t));break;case"bigint":eo(e,122),SE(e,t);break;case"object":if(t===null)eo(e,126);else if(Xd(t)){eo(e,117),Zn(e,t.length);for(let n=0;n<t.length;n++)Jd(e,t[n])}else if(t instanceof Uint8Array)eo(e,116),fi(e,t);else{eo(e,118);const n=Object.keys(t);Zn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];ru(e,o),Jd(e,t[o])}}break;case"boolean":eo(e,t?120:121);break;default:eo(e,127)}};var yC=class extends Qd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Zn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},bC=e=>{e.count>0&&(ly(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Zn(e.encoder,e.count-2))},ap=class{constructor(){this.encoder=new Qd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(bC(this),this.count=1,this.s=e)}toUint8Array(){return bC(this),ea(this.encoder)}},wC=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);ly(e.encoder,t),e.count>1&&Zn(e.encoder,e.count-2)}},fy=class{constructor(){this.encoder=new Qd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(wC(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return wC(this),ea(this.encoder)}},AE=class{constructor(){this.sarr=[],this.s="",this.lensE=new ap}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Qd;return this.sarr.push(this.s),this.s="",ru(e,this.sarr.join("")),uy(e,this.lensE.toUint8Array()),ea(e)}};const Xa=e=>new Error(e),Vi=()=>{throw Xa("Method unimplemented")},ta=()=>{throw Xa("Unexpected case")},Nj=crypto.subtle,IE=crypto.getRandomValues.bind(crypto),CC=()=>IE(new Uint32Array(1))[0];var EE="10000000-1000-4000-8000-100000000000";const xE=()=>EE.replace(/[018]/g,e=>(e^CC()&15>>e/4).toString(16)),TE=Date.now,_C=e=>new Promise(e),Bj=Promise.all.bind(Promise),SC=e=>e===void 0?null:e;var RE=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},kC=new RE,ME=!0;try{typeof localStorage<"u"&&localStorage&&(kC=localStorage,ME=!1)}catch{}const LE=kC,$d=Symbol("Equality"),AC=(e,t)=>e===t||!!e?.[$d]?.(t)||!1,PE=e=>typeof e=="object",DE=Object.assign,OE=Object.keys,FE=(e,t)=>{for(const n in e)t(e[n],n)},lp=e=>OE(e).length,NE=e=>{for(const t in e)return!1;return!0},ef=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},hy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),BE=(e,t)=>e===t||lp(e)===lp(t)&&ef(e,(n,r)=>(n!==void 0||hy(t,r))&&AC(t[r],n)),zE=Object.freeze,IC=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&IC(e[t])}return zE(e)},py=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&py(e,t,n+1)}},cp=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[$d]!=null)return e[$d](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!cp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(lp(e)!==lp(t))return!1;for(const n in e)if(!hy(e,n)||!cp(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!cp(e[n],t[n]))return!1;break;default:return!1}return!0},VE=(e,t)=>t.includes(e),zj=Xd,tf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Vj=typeof navigator<"u"?/Mac/.test(navigator.platform):!1;var ys,HE=[],jE=()=>{if(ys===void 0)if(tf){ys=vs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&ys.set(t,""),t=r):t!==null?(ys.set(t,r),t=null):HE.push(r)}t!==null&&ys.set(t,"")}else typeof location=="object"?(ys=vs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");ys.set(`--${gC(t,"-")}`,n),ys.set(`-${gC(t,"-")}`,n)}})):ys=vs();return ys};const my=e=>jE().has(e),up=e=>SC(tf?process.env[e.toUpperCase().replaceAll("-","_")]:LE.getItem(e)),EC=e=>my("--"+e)||up(e)!==null,UE=EC("production");var GE=tf&&VE(process.env.FORCE_COLOR,["true","1","2"]);const WE=GE||!my("--no-colors")&&!EC("no-color")&&(!tf||process.stdout.isTTY)&&(!tf||my("--color")||up("COLORTERM")!==null||(up("TERM")||"").includes("color"));var KE=class{constructor(e,t){this.left=e,this.right=t}};const na=(e,t)=>new KE(e,t),xC=e=>e.next()>=.5,gy=(e,t,n)=>$s(e.next()*(n+1-t)+t),TC=(e,t,n)=>$s(e.next()*(n+1-t)+t),vy=(e,t,n)=>TC(e,t,n),qE=e=>mC(vy(e,97,122)),YE=(e,t=0,n=20)=>{const r=vy(e,t,n);let o="";for(let i=0;i<r;i++)o+=qE(e);return o},yy=(e,t)=>t[vy(e,0,t.length-1)];var XE=Symbol("0schema"),ZE=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(mE(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
5
+ `)}},by=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[$d]?AC(e,t):Xd(e)?oy(e,n=>dC(t,r=>by(n,r))):PE(e)?ef(e,(n,r)=>by(n,t[r])):!1,Fo=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),by(t,n)}equals(e){return this.constructor===e.constructor&&cp(this.shape,e.shape)}[XE](){return!0}[$d](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Vi()}get nullable(){return ou(this,gp)}get optional(){return new LC(this)}cast(e){return KC(e,this),e}expect(e){return KC(e,this),e}},wy=class extends Fo{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}};const Hr=(e,t=null)=>new wy(e,t),Hj=Hr(wy);var Cy=class extends Fo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}};const to=e=>new Cy(e),jj=Hr(Cy);var dp=class extends Fo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape.some(r=>r===e);return!n&&t?.extend(null,this.shape.join(" | "),e.toString()),n}};const fp=(...e)=>new dp(e),RC=Hr(dp);var QE=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),MC=e=>{if(su.check(e))return[QE(e)];if(RC.check(e))return e.shape.map(t=>t+"");if(UC.check(e))return["[+-]?\\d+.?\\d*"];if(GC.check(e))return[".*"];if(hp.check(e))return e.shape.map(MC).flat(1);ta()},JE=class extends Fo{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(MC).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),n}};const Uj=Hr(JE);var $E=Symbol("optional"),LC=class extends Fo{constructor(e){super(),this.shape=e}check(e,t){const n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,"undefined (optional)","()"),n}get[$E](){return!0}};const ex=Hr(LC);var PC=class extends Fo{check(e,t){return t?.extend(null,"never",typeof e),!1}};const Gj=new PC,Wj=Hr(PC);var DC=class ZA extends Fo{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new ZA(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):ef(this.shape,(r,o)=>{const i=this._isPartial&&!hy(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}};const tx=e=>new DC(e),nx=Hr(DC),rx=to(e=>e!=null&&(e.constructor===Object||e.constructor==null));var OC=class extends Fo{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&ef(e,(n,r)=>{const o=this.shape.keys.check(r,t);return!o&&t?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(n,t)})}};const FC=(e,t)=>new OC(e,t),ox=Hr(OC);var NC=class extends Fo{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&ef(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}};const ix=(...e)=>new NC(e),Kj=Hr(NC);var BC=class extends Fo{constructor(e){super(),this.shape=e.length===1?e[0]:new _y(e)}check(e,t){const n=Xd(e)&&oy(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}};const zC=(...e)=>new BC(e),sx=Hr(BC),ax=to(e=>Xd(e));var VC=class extends Fo{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}};const lx=(e,t=null)=>new VC(e,t),qj=Hr(VC),cx=lx(Fo);var ux=class extends Fo{constructor(e){super(),this.len=e.length-1,this.args=ix(...e.slice(-1)),this.res=e[this.len]}check(e,t){const n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,"function",typeof e),n}};const dx=Hr(ux),fx=to(e=>typeof e=="function");var hx=class extends Fo{constructor(e){super(),this.shape=e}check(e,t){const n=oy(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}};const Yj=Hr(hx,e=>e.shape.length>0);var _y=class extends Fo{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=dC(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}};const ou=(...e)=>e.findIndex(t=>hp.check(t))>=0?ou(...e.map(t=>nf(t)).map(t=>hp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new _y(e),hp=Hr(_y);var HC=()=>!0;const pp=to(HC),px=Hr(Cy,e=>e.shape===HC),Sy=to(e=>typeof e=="bigint"),mx=to(e=>e===Sy),jC=to(e=>typeof e=="symbol"),Xj=to(e=>e===jC),iu=to(e=>typeof e=="number"),UC=to(e=>e===iu),su=to(e=>typeof e=="string"),GC=to(e=>e===su),mp=to(e=>typeof e=="boolean"),gx=to(e=>e===mp),WC=fp(void 0),Zj=Hr(dp,e=>e.shape.length===1&&e.shape[0]===void 0),Qj=fp(void 0),gp=fp(null),vx=Hr(dp,e=>e.shape.length===1&&e.shape[0]===null),Jj=Hr(Uint8Array),$j=Hr(wy,e=>e.shape===Uint8Array),yx=ou(iu,su,gp,WC,Sy,mp,jC),eU=(()=>{const e=zC(pp),t=FC(su,pp),n=ou(iu,su,gp,mp,e,t);return e.shape=n,t.shape.values=n,n})(),nf=e=>{if(cx.check(e))return e;if(rx.check(e)){const t={};for(const n in e)t[n]=nf(e[n]);return tx(t)}else{if(ax.check(e))return ou(...e.map(nf));if(yx.check(e))return fp(e);if(fx.check(e))return Hr(e)}ta()},KC=UE?()=>{}:(e,t)=>{const n=new ZE;if(!t.check(e,n))throw Xa(`Expected value to be of type ${t.constructor.name}.
6
+ ${n.toString()}`)};var bx=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:nf(e),h:t}),this}else(e){return this.if(pp,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw Xa("Unhandled pattern")}}},qC=(e=>new bx(e))(pp).if(UC,(e,t)=>gy(t,pC,hC)).if(GC,(e,t)=>YE(t)).if(gx,(e,t)=>xC(t)).if(mx,(e,t)=>BigInt(gy(t,pC,hC))).if(hp,(e,t)=>au(t,yy(t,e.shape))).if(nx,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(ex.check(o)){if(xC(t))continue;o=o.shape}n[r]=qC(o,t)}return n}).if(sx,(e,t)=>{const n=[],r=TC(t,0,42);for(let o=0;o<r;o++)n.push(au(t,e.shape));return n}).if(RC,(e,t)=>yy(t,e.shape)).if(vx,(e,t)=>null).if(dx,(e,t)=>{const n=au(t,e.res);return()=>n}).if(px,(e,t)=>au(t,yy(t,[iu,su,gp,WC,Sy,mp,zC(iu),FC(ou("a","b","c"),iu)]))).if(ox,(e,t)=>{const n={},r=gy(t,0,3);for(let o=0;o<r;o++){const i=au(t,e.shape.keys);n[i]=au(t,e.shape.values)}return n}).done();const au=(e,t)=>qC(nf(t),e),Jl=typeof document<"u"?document:{},nU=to(e=>e.nodeType===kx),rU=typeof DOMParser<"u"?new DOMParser:null,oU=to(e=>e.nodeType===Cx),iU=to(e=>e.nodeType===_x),wx=e=>H6(e,(t,n)=>`${n}:${t};`).join(""),Cx=Jl.ELEMENT_NODE,_x=Jl.TEXT_NODE,sU=Jl.CDATA_SECTION_NODE,aU=Jl.COMMENT_NODE,Sx=Jl.DOCUMENT_NODE,lU=Jl.DOCUMENT_TYPE_NODE,kx=Jl.DOCUMENT_FRAGMENT_NODE,cU=to(e=>e.nodeType===Sx),ra=Symbol,YC=ra(),XC=ra(),Ax=ra(),Ix=ra(),Ex=ra(),ZC=ra(),xx=ra(),ky=ra(),Tx=ra(),Rx=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n};var uU=TE(),Mx={[YC]:na("font-weight","bold"),[XC]:na("font-weight","normal"),[Ax]:na("color","blue"),[Ex]:na("color","green"),[Ix]:na("color","grey"),[ZC]:na("color","red"),[xx]:na("color","purple"),[ky]:na("color","orange"),[Tx]:na("color","black")},Lx=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=vs();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=Mx[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=wx(r);i>0||l.length>0?(t.push("%c"+s),n.push(l)):t.push(s)}else break}}for(i>0&&(o=n,o.unshift(t.join("")));i<e.length;i++){const s=e[i];s instanceof Symbol||o.push(s)}return o},QC=WE?Lx:Rx;const Px=(...e)=>{console.log(...QC(e)),JC.forEach(t=>t.print(e))},Dx=(...e)=>{console.warn(...QC(e)),e.unshift(ky),JC.forEach(t=>t.print(e))},JC=eu(),$C=e=>({[Symbol.iterator](){return this},next:e}),Ox=(e,t)=>$C(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Ay=(e,t)=>$C(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}});var e3=class{constructor(e,t){this.clock=e,this.len=t}},t3=class{constructor(){this.clients=new Map}},n3=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])h3(e,i,u.clock,u.len,n)}}),Fx=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=$s((n+r)/2),i=e[o],s=i.clock;if(s<=t){if(t<s+i.len)return o;n=o+1}else r=o-1}return null},r3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&Fx(n,t.clock)!==null},o3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new e3(o.clock,nu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},i3=(e,t,n,r)=>{$c(e.clients,t,()=>[]).push(new e3(n,r))},Nx=()=>new t3,Bx=(e,t)=>{Zn(e.restEncoder,t.clients.size),tu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Zn(e.restEncoder,n);const o=r.length;Zn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},s3=CC,Iy=class QA extends G6{constructor({guid:t=xE(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=s3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Zx,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=_C(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>_C(u=>{const c=d=>{(d===void 0||d===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&sr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(tu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return sr(this,t,n)}get(t,n=po){const r=$c(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==po&&o!==n)if(o===po){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,uT)}getText(t=""){return this.get(t,gT)}getMap(t=""){return this.get(t,Dy)}getXmlElement(t=""){return this.get(t,F3)}getXmlFragment(t=""){return this.get(t,By)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,tu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new QA({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,sr(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},zx=class{constructor(){this.restEncoder=sy()}toUint8Array(){return ea(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Zn(this.restEncoder,e)}writeDsLen(e){Zn(this.restEncoder,e)}},Vx=class extends zx{writeLeftID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeRightID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeClient(e){Zn(this.restEncoder,e)}writeInfo(e){ay(this.restEncoder,e)}writeString(e){ru(this.restEncoder,e)}writeParentInfo(e){Zn(this.restEncoder,e?1:0)}writeTypeRef(e){Zn(this.restEncoder,e)}writeLen(e){Zn(this.restEncoder,e)}writeAny(e){Jd(this.restEncoder,e)}writeBuf(e){fi(this.restEncoder,e)}writeJSON(e){ru(this.restEncoder,JSON.stringify(e))}writeKey(e){ru(this.restEncoder,e)}},Hx=class{constructor(){this.restEncoder=sy(),this.dsCurrVal=0}toUint8Array(){return ea(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Zn(this.restEncoder,t)}writeDsLen(e){e===0&&ta(),Zn(this.restEncoder,e-1),this.dsCurrVal+=e}},jx=class extends Hx{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new fy,this.clientEncoder=new ap,this.leftClockEncoder=new fy,this.rightClockEncoder=new fy,this.infoEncoder=new yC(ay),this.stringEncoder=new AE,this.parentInfoEncoder=new yC(ay),this.typeRefEncoder=new ap,this.lenEncoder=new ap}toUint8Array(){const e=sy();return Zn(e,0),fi(e,this.keyClockEncoder.toUint8Array()),fi(e,this.clientEncoder.toUint8Array()),fi(e,this.leftClockEncoder.toUint8Array()),fi(e,this.rightClockEncoder.toUint8Array()),fi(e,ea(this.infoEncoder)),fi(e,this.stringEncoder.toUint8Array()),fi(e,ea(this.parentInfoEncoder)),fi(e,this.typeRefEncoder.toUint8Array()),fi(e,this.lenEncoder.toUint8Array()),uy(e,ea(this.restEncoder)),ea(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Jd(this.restEncoder,e)}writeBuf(e){fi(this.restEncoder,e)}writeJSON(e){Jd(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},Ux=(e,t,n,r)=>{r=nu(r,t[0].id.clock);const o=oa(t,r);Zn(e.restEncoder,t.length-o),e.writeClient(n),Zn(e.restEncoder,r);const i=t[o];i.write(e,r-i.id.clock);for(let s=o+1;s<t.length;s++)t[s].write(e,0)},Gx=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{Xo(t,i)>o&&r.set(i,o)}),xy(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Zn(e.restEncoder,r.size),tu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{Ux(e,t.clients.get(o),o,i)})},Wx=(e,t)=>Gx(e,t.doc.store,t.beforeState),Kx=class{constructor(){this.l=[]}},a3=()=>new Kx,l3=(e,t)=>e.l.push(t),c3=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(o=>t!==o),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},u3=(e,t,n)=>py(e.l,[t,n]),vp=class{constructor(e,t){this.client=e,this.clock=t}},yp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,xr=(e,t)=>new vp(e,t),qx=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw ta()},Yx=class{constructor(e,t){this.ds=e,this.sv=t}},Xx=(e,t)=>new Yx(e,t),dU=Xx(Nx(),new Map),lu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!r3(t.ds,e.id),Ey=(e,t)=>{const n=$c(e.meta,Ey,eu),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<Xo(r,i)&&Za(e,xr(i,o))}),n3(e,t.ds,o=>{}),n.add(t))},Zx=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},xy=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},Xo=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},d3=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw ta()}n.push(t)},oa=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=$s(t/(i+o.length-1)*r);for(;n<=r;){if(o=e[s],i=o.id.clock,i<=t){if(t<i+o.length)return s;n=s+1}else r=s-1;s=$s((n+r)/2)}throw ta()},Qx=(e,t)=>{const n=e.clients.get(t.client);return n[oa(n,t.clock)]},Ty=Qx,Ry=(e,t,n)=>{const r=oa(t,n),o=t[r];return o.id.clock<n&&o instanceof hi?(t.splice(r+1,0,V3(e,o,n-o.id.clock)),r+1):r},Za=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[Ry(e,n,t.clock)]},f3=(e,t,n)=>{const r=t.clients.get(n.client),o=oa(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Ja&&r.splice(o+1,0,V3(e,i,n.clock-i.id.clock+1)),i},Jx=(e,t,n)=>{const r=e.clients.get(t.id.client);r[oa(r,t.id.clock)]=n},h3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=Ry(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&Ry(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},$x=class{constructor(e,t,n){this.doc=e,this.deleteSet=new t3,this.beforeState=xy(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},p3=(e,t)=>t.deleteSet.clients.size===0&&!j6(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(o3(t.deleteSet),Wx(e,t),Bx(e,t.deleteSet),!0),m3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&$c(e.changed,t,eu).add(n)},bp=(e,t)=>{let n=e[t],r=e[t-1],o=t;for(;o>0;n=r,r=e[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof hi&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-o;return i&&e.splice(t+1-i,i),i},eT=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=oa(i,a.clock),c=i[u];u<i.length&&c.id.clock<l;c=i[++u]){const d=i[u];if(a.clock+a.len<=d.id.clock)break;d instanceof hi&&d.deleted&&!d.keep&&n(d)&&d.gc(t,!1)}}}},tT=(e,t)=>{e.clients.forEach((n,r)=>{const o=t.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=fC(o.length-1,1+oa(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+bp(o,l)}})},g3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{o3(i),n.afterState=xy(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,d)=>c.path.length-d.path.length),a.push(()=>{u3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&pT(n)})}),py(a,[])}finally{r.gc&&eT(i,o,r.gcFilter),tT(i,o),n.afterState.forEach((c,d)=>{const h=n.beforeState.get(d)||0;if(h!==c){const m=o.clients.get(d),p=nu(oa(m,h),1);for(let v=m.length-1;v>=p;)v-=1+bp(m,v)}});for(let c=s.length-1;c>=0;c--){const{client:d,clock:h}=s[c].id,m=o.clients.get(d),p=oa(m,h);p+1<m.length&&bp(m,p+1)>1||p>0&&bp(m,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(Px(ky,YC,"[yjs] ",XC,ZC,"Changed the client-id because another client seems to be using it."),r.clientID=s3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new Vx;p3(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new jx;p3(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):g3(e,t+1)}}},sr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new $x(e,n,r),o.push(e._transaction),o.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(i){const a=e._transaction===o[0];e._transaction=null,a&&g3(o,0)}}return s},v3="You must not compute changes after the event-handler fired.",wp=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=nT(this.currentTarget,this.target))}deletes(e){return r3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Xa(v3);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){const r=t._map.get(n);let o,i;if(this.adds(r)){let s=r.left;for(;s!==null&&this.adds(s);)s=s.left;if(this.deletes(r))if(s!==null&&this.deletes(s))o="delete",i=ry(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=ry(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=ry(r.content.getContent());else return;e.set(n,{action:o,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Xa(v3);const t=this.target,n=eu(),r=eu(),o=[];if(e={added:n,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null;const s=()=>{i&&o.push(i)};for(let a=t._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((i===null||i.delete===void 0)&&(s(),i={delete:0}),i.delete+=a.length,r.add(a)):this.adds(a)?((i===null||i.insert===void 0)&&(s(),i={insert:[]}),i.insert=i.insert.concat(a.content.getContent()),n.add(a)):((i===null||i.retain===void 0)&&(s(),i={retain:0}),i.retain+=a.length);i!==null&&i.retain===void 0&&s()}this._changes=e}return e}},nT=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},To=()=>{Dx("Invalid access: Add Yjs type to a document before reading data.")},y3=80,My=0,rT=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=My++}},oT=e=>{e.timestamp=My++},b3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=My++},iT=(e,t,n)=>{if(e.length>=y3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return b3(r,t,n),r}else{const r=new rT(t,n);return e.push(r),r}},Cp=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,s)=>sp(t-i.index)<sp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,oT(n));r.right!==null&&o<t;){if(!r.deleted&&r.countable){if(t<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>t;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&sp(n.index-o)<r.parent.length/y3?(b3(n,r,o),n):iT(e._searchMarker,r,o)},rf=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const o=e[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}o.p=i,i.marker=!0}(t<o.index||n>0&&t===o.index)&&(o.index=nu(t,o.index+n))}},_p=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;$c(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;u3(r._eH,n,t)},po=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=a3(),this._dEH=a3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Vi()}clone(){throw Vi()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){l3(this._eH,e)}observeDeep(e){l3(this._dEH,e)}unobserve(e){c3(this._eH,e)}unobserveDeep(e){c3(this._dEH,e)}toJSON(){}},w3=(e,t,n)=>{e.doc??To(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},C3=e=>{e.doc??To();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},of=(e,t)=>{let n=0,r=e._start;for(e.doc??To();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},_3=(e,t)=>{const n=[];return of(e,(r,o)=>{n.push(t(r,o,e))}),n},sT=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},S3=(e,t)=>{e.doc??To();const n=Cp(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Sp=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const c=()=>{u.length>0&&(o=new hi(xr(s,Xo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new zy(u)),o.integrate(e,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(c(),d.constructor){case Uint8Array:case ArrayBuffer:o=new hi(xr(s,Xo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new B3(new Uint8Array(d))),o.integrate(e,0);break;case Iy:o=new hi(xr(s,Xo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new z3(d)),o.integrate(e,0);break;default:if(d instanceof po)o=new hi(xr(s,Xo(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new du(d)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},k3=()=>Xa("Length exceeded!"),A3=(e,t,n,r)=>{if(n>t._length)throw k3();if(n===0)return t._searchMarker&&rf(t._searchMarker,n,r.length),Sp(e,t,null,r);const o=n,i=Cp(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Za(e,xr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&rf(t._searchMarker,o,r.length),Sp(e,t,s,r)},aT=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((o,i)=>i.index>o.index?i:o,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Sp(e,t,r,n)},I3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=Cp(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Za(e,xr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Za(e,xr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw k3();t._searchMarker&&rf(t._searchMarker,o,-i+r)},kp=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Ly=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new zy([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new zy([r]);break;case Uint8Array:a=new B3(r);break;case Iy:a=new z3(r);break;default:if(r instanceof po)a=new du(r);else throw new Error("Unexpected content type")}new hi(xr(s,Xo(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},Py=(e,t)=>{e.doc??To();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},E3=e=>{const t={};return e.doc??To(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},x3=(e,t)=>{e.doc??To();const n=e._map.get(t);return n!==void 0&&!n.deleted},lT=(e,t)=>{const n={};return e._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&lu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},Ap=e=>(e.doc??To(),Ox(e._map.entries(),t=>!t[1].deleted)),cT=class extends wp{},uT=class qm extends po{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new qm;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new qm}clone(){const t=new qm;return t.insert(0,this.toArray().map(n=>n instanceof po?n.clone():n)),t}get length(){return this.doc??To(),this._length}_callObserver(t,n){super._callObserver(t,n),_p(this,t,new cT(this,t))}insert(t,n){this.doc!==null?sr(this.doc,r=>{A3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?sr(this.doc,n=>{aT(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?sr(this.doc,r=>{I3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return S3(this,t)}toArray(){return C3(this)}slice(t=0,n=this.length){return w3(this,t,n)}toJSON(){return this.map(t=>t instanceof po?t.toJSON():t)}map(t){return _3(this,t)}forEach(t){of(this,t)}[Symbol.iterator](){return sT(this)}_write(t){t.writeTypeRef(_T)}},dT=class extends wp{constructor(e,t,n){super(e,t),this.keysChanged=n}},Dy=class Tb extends po{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new Tb}clone(){const t=new Tb;return this.forEach((n,r)=>{t.set(r,n instanceof po?n.clone():n)}),t}_callObserver(t,n){_p(this,t,new dT(this,t,n))}toJSON(){this.doc??To();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof po?o.toJSON():o}}),t}get size(){return[...Ap(this)].length}keys(){return Ay(Ap(this),t=>t[0])}values(){return Ay(Ap(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Ay(Ap(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??To(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?sr(this.doc,n=>{kp(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?sr(this.doc,r=>{Ly(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return Py(this,t)}has(t){return x3(this,t)}clear(){this.doc!==null?sr(this.doc,t=>{this.forEach(function(n,r,o){kp(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(ST)}},Qa=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&BE(e,t),Oy=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&ta(),this.right.content.constructor===Ro?this.right.deleted||cu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},T3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Ro?t.right.deleted||cu(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Za(e,xr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},Ip=(e,t,n,r)=>{const o=new Map,i=r?Cp(t,n):null;return i?T3(e,new Oy(i.p.left,i.p,i.index,o),n-i.index):T3(e,new Oy(null,t._start,0,o),n)},R3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ro&&Qa(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,c=new hi(xr(i,Xo(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new Ro(a,s));c.integrate(e,0),n.right=c,n.forward()})},cu=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},M3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Ro&&Qa(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},L3=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!Qa(u,l)){s.set(a,u);const{left:c,right:d}=n;n.right=new hi(xr(i,Xo(o.store,i)),c,c&&c.lastId,d,d&&d.id,t,null,new Ro(a,l)),n.right.integrate(e,0),n.forward()}}return s},Fy=(e,t,n,r,o)=>{n.currentAttributes.forEach((h,m)=>{o[m]===void 0&&(o[m]=null)});const i=e.doc,s=i.clientID;M3(n,o);const a=L3(e,t,n,o),l=r.constructor===String?new uu(r):r instanceof po?new du(r):new Ep(r);let{left:u,right:c,index:d}=n;t._searchMarker&&rf(t._searchMarker,n.index,l.getLength()),c=new hi(xr(s,Xo(i.store,s)),u,u&&u.lastId,c,c&&c.id,t,null,l),c.integrate(e,0),n.right=c,n.index=d,n.forward(),R3(e,t,n,a)},P3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;M3(n,o);const a=L3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ro));){if(!n.right.deleted)switch(n.right.content.constructor){case Ro:{const{key:l,value:u}=n.right.content,c=o[l];if(c!==void 0){if(Qa(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Za(e,xr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
7
+ `;n.right=new hi(xr(s,Xo(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new uu(l)),n.right.integrate(e,0),n.forward()}R3(e,t,n,a)},D3=(e,t,n,r,o)=>{let i=t;const s=vs();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Ro){const u=i.content;s.set(u.key,u)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const u=t.content;if(u.constructor===Ro){const{key:c,value:d}=u,h=r.get(c)??null;(s.get(c)!==u||h===d)&&(t.delete(e),a++,!l&&(o.get(c)??null)===d&&h!==d&&(h===null?o.delete(c):o.set(c,h))),!l&&!t.deleted&&cu(o,u)}}t=t.right}return a},fT=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Ro){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},hT=e=>{let t=0;return sr(e.doc,n=>{let r=e._start,o=e._start,i=vs();const s=ny(i);for(;o;)o.deleted===!1&&(o.content.constructor===Ro?cu(s,o.content):(t+=D3(n,r,o,i,s),i=ny(s),r=o)),o=o.right}),t},pT=e=>{const t=new Set,n=e.doc;for(const[r,o]of e.afterState.entries()){const i=e.beforeState.get(r)||0;o!==i&&h3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===Ro&&s.constructor!==Ja&&t.add(s.parent)})}sr(n,r=>{n3(e,e.deleteSet,o=>{if(o instanceof Ja||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===Ro?t.add(i):fT(r,o)});for(const o of t)hT(o)})},O3=(e,t,n)=>{const r=n,o=ny(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case du:case Ep:case uu:n<t.right.length&&Za(e,xr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&D3(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&rf(s._searchMarker,t.index,-r+n),t},mT=class extends wp{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];sr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,c=0;const d=()=>{if(s!==null){let h=null;switch(s){case"delete":c>0&&(h={delete:c}),c=0;break;case"insert":(typeof l=="object"||l.length>0)&&(h={insert:l},r.size>0&&(h.attributes={},r.forEach((m,p)=>{m!==null&&(h.attributes[p]=m)}))),l="";break;case"retain":u>0&&(h={retain:u},NE(a)||(h.attributes=DE({},a))),u=0;break}h&&t.push(h),s=null}};for(;i!==null;){switch(i.content.constructor){case du:case Ep:this.adds(i)?this.deletes(i)||(d(),s="insert",l=i.content.getContent()[0],d()):this.deletes(i)?(s!=="delete"&&(d(),s="delete"),c+=1):i.deleted||(s!=="retain"&&(d(),s="retain"),u+=1);break;case uu:this.adds(i)?this.deletes(i)||(s!=="insert"&&(d(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(d(),s="delete"),c+=i.length):i.deleted||(s!=="retain"&&(d(),s="retain"),u+=i.length);break;case Ro:{const{key:h,value:m}=i.content;if(this.adds(i))this.deletes(i)||(Qa(r.get(h)??null,m)?m!==null&&i.delete(n):(s==="retain"&&d(),Qa(m,o.get(h)??null)?delete a[h]:a[h]=m));else if(this.deletes(i)){o.set(h,m);const p=r.get(h)??null;Qa(p,m)||(s==="retain"&&d(),a[h]=p)}else if(!i.deleted){o.set(h,m);const p=a[h];p!==void 0&&(Qa(p,m)?p!==null&&i.delete(n):(s==="retain"&&d(),m===null?delete a[h]:a[h]=m))}i.deleted||(s==="insert"&&d(),cu(r,i.content));break}}i=i.right}for(d();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},gT=class Rb extends po{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??To(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new Rb}clone(){const t=new Rb;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new mT(this,t,n);_p(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??To();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===uu&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?sr(this.doc,r=>{const o=new Oy(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const s=t[i];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&i===t.length-1&&o.right===null&&s.insert.slice(-1)===`
8
+ `?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&Fy(r,this,o,a,s.attributes||{})}else s.retain!==void 0?P3(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&O3(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??To();const o=[],i=new Map,s=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let h=!1;i.forEach((p,v)=>{h=!0,d[v]=p});const m={insert:a};h&&(m.attributes=d),o.push(m),a=""}}const c=()=>{for(;l!==null;){if(lu(l,t)||n!==void 0&&lu(l,n))switch(l.content.constructor){case uu:{const d=i.get("ychange");t!==void 0&&!lu(l,t)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!lu(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),i.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),i.delete("ychange")),a+=l.content.str;break}case du:case Ep:{u();const d={insert:l.content.getContent()[0]};if(i.size>0){const h={};d.attributes=h,i.forEach((m,p)=>{h[p]=m})}o.push(d);break}case Ro:lu(l,t)&&(u(),cu(i,l.content));break}l=l.right}u()};return t||n?sr(s,d=>{t&&Ey(d,t),n&&Ey(d,n),c()},"cleanup"):c(),o}insert(t,n,r){if(n.length<=0)return;const o=this.doc;o!==null?sr(o,i=>{const s=Ip(i,this,t,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),Fy(i,this,s,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const o=this.doc;o!==null?sr(o,i=>{const s=Ip(i,this,t,!r);Fy(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?sr(r,o=>{O3(o,Ip(o,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const o=this.doc;o!==null?sr(o,i=>{const s=Ip(i,this,t,!1);s.right!==null&&P3(i,this,s,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?sr(this.doc,n=>{kp(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?sr(this.doc,r=>{Ly(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return Py(this,t)}getAttributes(){return E3(this)}_write(t){t.writeTypeRef(kT)}},Ny=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??To()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===F3||t.constructor===By)&&t._start!==null)e=t._start;else for(;e!==null;){const n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},By=class Mb extends po{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Mb}clone(){const t=new Mb;return t.insert(0,this.toArray().map(n=>n instanceof po?n.clone():n)),t}get length(){return this.doc??To(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new Ny(this,t)}querySelector(t){t=t.toUpperCase();const n=new Ny(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return n.done?null:n.value}querySelectorAll(t){return t=t.toUpperCase(),tu(new Ny(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){_p(this,t,new vT(this,n,t))}toString(){return _3(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const o=t.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),of(this,i=>{o.insertBefore(i.toDOM(t,n,r),null)}),o}insert(t,n){this.doc!==null?sr(this.doc,r=>{A3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)sr(this.doc,r=>{const o=t&&t instanceof po?t._item:t;Sp(r,this,o,n)});else{const r=this._prelimContent,o=t===null?0:r.findIndex(i=>i===t)+1;if(o===0&&t!==null)throw Xa("Reference item not found");r.splice(o,0,...n)}}delete(t,n=1){this.doc!==null?sr(this.doc,r=>{I3(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return C3(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return S3(this,t)}slice(t=0,n=this.length){return w3(this,t,n)}forEach(t){of(this,t)}_write(t){t.writeTypeRef(IT)}},F3=class Lb extends By{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new Lb(this.nodeName)}clone(){const t=new Lb(this.nodeName),n=this.getAttributes();return FE(n,(r,o)=>{t.setAttribute(o,r)}),t.insert(0,this.toArray().map(r=>r instanceof po?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const s in t)r.push(s);r.sort();const o=r.length;for(let s=0;s<o;s++){const a=r[s];n.push(a+'="'+t[a]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${n.length>0?" "+n.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?sr(this.doc,n=>{kp(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?sr(this.doc,r=>{Ly(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return Py(this,t)}hasAttribute(t){return x3(this,t)}getAttributes(t){return t?lT(this,t):E3(this)}toDOM(t=document,n={},r){const o=t.createElement(this.nodeName),i=this.getAttributes();for(const s in i){const a=i[s];typeof a=="string"&&o.setAttribute(s,a)}return of(this,s=>{o.appendChild(s.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(t){t.writeTypeRef(AT),t.writeKey(this.nodeName)}},vT=class extends wp{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}},N3=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Vi()}mergeWith(e){return!1}write(e,t,n){throw Vi()}integrate(e,t){throw Vi()}},yT=0,Ja=class extends N3{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),d3(e.doc.store,this)}write(e,t){e.writeInfo(yT),e.writeLen(this.length-t)}getMissing(e,t){return null}},B3=class JA{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new JA(this.content)}splice(t){throw Vi()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}},bT=class Pb{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Pb(this.len)}splice(t){const n=new Pb(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){i3(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}},wT=(e,t)=>new Iy({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),z3=class $A{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new $A(wT(this.doc.guid,this.opts))}splice(t){throw Vi()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},Ep=class eI{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new eI(this.embed)}splice(t){throw Vi()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}},Ro=class tI{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new tI(this.key,this.value)}splice(t){throw Vi()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},CT=up("node_env")==="development",zy=class Db{constructor(t){this.arr=t,CT&&IC(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Db(this.arr)}splice(t){const n=new Db(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let o=n;o<r;o++){const i=this.arr[o];t.writeAny(i)}}getRef(){return 8}},uu=class Ob{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new Ob(this.str)}splice(t){const n=new Ob(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"οΏ½",n.str="οΏ½"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}},_T=0,ST=1,kT=2,AT=3,IT=4,du=class nI{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new nI(this.type._copy())}splice(t){throw Vi()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}},V3=(e,t,n)=>{const{client:r,clock:o}=t.id,i=new hi(xr(r,o+n),t,xr(r,o+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=xr(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},hi=class Fb extends N3{constructor(t,n,r,o,i,s,a,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Xo(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Xo(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===vp&&this.id.client!==this.parent.client&&this.parent.clock>=Xo(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=f3(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Za(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Ja||this.right&&this.right.constructor===Ja)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Fb?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Fb&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===vp){const r=Ty(n,this.parent);r.constructor===Ja?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=f3(t,t.doc.store,xr(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),yp(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(yp(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(Ty(t.doc.store,o.origin)))i.has(Ty(t.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),d3(t.doc.store,this),this.content.integrate(t,this),m3(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new Ja(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:xr(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&yp(t.origin,this.lastId)&&this.right===t&&yp(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),i3(t.deleteSet,this.id.client,this.id.clock,this.length),m3(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw ta();this.content.gc(t),n?Jx(t,this,new Ja(this.id,this.length)):this.content=new bT(this.length)}write(t,n){const r=n>0?xr(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(t.writeInfo(s),r!==null&&t.writeLeftID(r),o!==null&&t.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=qx(a);t.writeParentInfo(!0),t.writeString(u)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===vp?(t.writeParentInfo(!1),t.writeLeftID(a)):ta();i!==null&&t.writeString(i)}this.content.write(t,n)}},H3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},j3="__ $YJS$ __";H3[j3]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),H3[j3]=!0;var ET=Math.floor,xT=(e,t)=>e<t?e:t,TT=(e,t)=>e>t?e:t,RT=128,Vy=127,fU=Number.MAX_SAFE_INTEGER,MT=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},sf=typeof TextEncoder<"u"?new TextEncoder:null,LT=e=>sf.encode(e),PT=sf?LT:MT,Hy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Hy&&Hy.decode(new Uint8Array).length===1&&(Hy=null);var xp=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},jy=(e,t)=>{for(;t>Vy;)xp(e,RT|Vy&t),t=ET(t/128);xp(e,Vy&t)},Uy=new Uint8Array(3e4),DT=Uy.length/3,OT=(e,t)=>{if(t.length<DT){const n=sf.encodeInto(t,Uy).written||0;jy(e,n);for(let r=0;r<n;r++)xp(e,Uy[r])}else BT(e,PT(t))},FT=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;jy(e,r);for(let o=0;o<r;o++)xp(e,n.codePointAt(o))},hU=sf&&sf.encodeInto?OT:FT,NT=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=xT(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(TT(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},BT=(e,t)=>{jy(e,t.byteLength),NT(e,t)},U3=e=>new Error(e),pU=U3("Unexpected end of array"),mU=U3("Integer out of Range"),G3;(function(e){e[e.Token=0]="Token",e[e.PermissionDenied=1]="PermissionDenied",e[e.Authenticated=2]="Authenticated"})(G3||(G3={}));var W3;(function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"})(W3||(W3={}));var Gy=()=>new Map,gU=Array.from,vU=String.fromCharCode,zT=e=>e.toLowerCase(),VT=/^\s*/g,HT=e=>e.replace(VT,""),jT=/([A-Z])/g,K3=(e,t)=>HT(e.replace(jT,n=>`${t}${zT(n)}`)),UT=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},af=typeof TextEncoder<"u"?new TextEncoder:null,GT=e=>af.encode(e),WT=af?GT:UT,Wy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Wy&&Wy.decode(new Uint8Array).length===1&&(Wy=null);var q3=e=>e===void 0?null:e,KT=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},Y3=new KT,qT=!0;try{typeof localStorage<"u"&&localStorage&&(Y3=localStorage,qT=!1)}catch{}var YT=Y3,XT=(e,t)=>t.includes(e),lf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";typeof navigator<"u"&&/Mac/.test(navigator.platform);var bs,ZT=()=>{if(bs===void 0)if(lf){bs=Gy();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&bs.set(t,""),t=r):t!==null&&(bs.set(t,r),t=null)}t!==null&&bs.set(t,"")}else typeof location=="object"?(bs=Gy(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");bs.set(`--${K3(t,"-")}`,n),bs.set(`-${K3(t,"-")}`,n)}})):bs=Gy();return bs},Ky=e=>ZT().has(e),qy=e=>q3(lf?process.env[e.toUpperCase()]:YT.getItem(e)),QT=e=>Ky("--"+e)||qy(e)!==null;QT("production");var X3=lf&&XT(process.env.FORCE_COLOR,["true","1","2"]);!Ky("no-colors")&&(!lf||process.stdout.isTTY||X3)&&(!lf||Ky("color")||X3||qy("COLORTERM")!==null||(qy("TERM")||"").includes("color"));var JT=Math.floor,$T=(e,t)=>e<t?e:t,e8=(e,t)=>e>t?e:t,t8=128,Yy=127,yU=Number.MAX_SAFE_INTEGER,Tp=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Xy=(e,t)=>{for(;t>Yy;)Tp(e,t8|Yy&t),t=JT(t/128);Tp(e,Yy&t)},Zy=new Uint8Array(3e4),n8=Zy.length/3,r8=(e,t)=>{if(t.length<n8){const n=af.encodeInto(t,Zy).written||0;Xy(e,n);for(let r=0;r<n;r++)Tp(e,Zy[r])}else s8(e,WT(t))},o8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Xy(e,r);for(let o=0;o<r;o++)Tp(e,n.codePointAt(o))},bU=af&&af.encodeInto?r8:o8,i8=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=$T(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(e8(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},s8=(e,t)=>{Xy(e,t.byteLength),i8(e,t)},Z3=e=>new Error(e),wU=Z3("Unexpected end of array"),CU=Z3("Integer out of Range"),_U=Date.now,Q3;(function(e){e[e.Sync=0]="Sync",e[e.Awareness=1]="Awareness",e[e.Auth=2]="Auth",e[e.QueryAwareness=3]="QueryAwareness",e[e.Stateless=5]="Stateless",e[e.CLOSE=7]="CLOSE",e[e.SyncStatus=8]="SyncStatus"})(Q3||(Q3={}));var J3;(function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected"})(J3||(J3={}));var SU=crypto.getRandomValues.bind(crypto);function a8(e,{changes:t={},states:n}){const{added:r=[],removed:o=[]}=t,i={states:_6(e,n),added:r,removed:o,superdoc:e};e.emit("awareness-update",i)}function l8(e,t,n){const r=e.awareness;if(!r)return console.warn("[superdoc] External provider missing awareness property"),()=>{};n&&r.setLocalStateField&&r.setLocalStateField("user",n);const o=(i={})=>{a8(t,{changes:i,states:r.getStates()})};return r.on("change",o),()=>{typeof r.off=="function"&&r.off("change",o)}}const c8=(e,t,n,r)=>{const{comment:o}=n,i=new Dy(Object.entries(o));t.transact(()=>{e.push([i])},{user:r})},$3=(e,t,n,r)=>{const{comment:o}=n,i=new Dy(Object.entries(o)),s=e_(e,o);s!==-1&&t.transact(()=>{e.delete(s,1),e.insert(s,[i])},{user:r})},u8=(e,t,n,r)=>{const{comment:o}=n,i=e_(e,o);i!==-1&&t.transact(()=>{e.delete(i,1)},{user:r})},e_=(e,t)=>e.toJSON().findIndex(n=>n.commentId===t.commentId);var d8=e=>e?.activeEditor?.editorVersion===2||e?.editorVersion===2,t_=e=>{const t=e?.commentId??e?.importedId;return t==null?null:String(t)},f8=(e,t)=>{if(!d8(e))return[];const n=e?.commentsStore?.commentsList;if(!Array.isArray(n)||!n.length)return[];const r=new Set(t.map(t_).filter(Boolean));return n.filter(o=>{if(o?.trackedChange!==!0)return!1;const i=t_(o);return!i||!r.has(i)})};const n_=e=>{if(!e?.ydoc||!e?.commentsStore)return!1;const t=e.ydoc.getArray("comments").toJSON(),n=new Map,r=[];return t.forEach(o=>{const i=o?.importedId??o?.commentId;if(i){if(n.has(i)){const s=n.get(i),a=o?.commentId;s&&a&&s!==a&&console.warn(`[SuperDoc] Duplicate collaboration comment key "${i}" detected with conflicting commentId values. Keeping first entry and dropping duplicate.`,{key:i,keptCommentId:s,droppedCommentId:a});return}if(n.set(i,o?.commentId),!o?.commentId){r.push({...o,commentId:i});return}r.push(o)}}),e.commentsStore.commentsList=[...r.map(o=>ia(o)),...f8(e,r)],e.provider?.synced&&(e.commentsStore.hasSyncedCollaborationComments=!0),!0},h8=e=>{if(!e.config.modules.comments||!e.provider)return;if(e._commentsCollabInitialized){n_(e);return}e._commentsCollabInitialized=!0;const t=e.ydoc.getArray("comments"),n=()=>n_(e),r=()=>{if(n()||setTimeout(n,0),e.commentsStore){const o=e.commentsStore.commentsParentElement,i=e.commentsStore.editorCommentIds;e.commentsStore.handleEditorLocationsUpdate(o,i),e.commentsStore.hasSyncedCollaborationComments=!0}e.provider.off("synced",r)};e.provider.on("synced",r),n()||setTimeout(n,0),t.observe(o=>{if(!e.commentsStore)return;const i=e.config.user,{user:s={}}=o?.transaction?.origin||{};Zw({current:i,other:s})||n()})},$l=(e,t)=>{if(!e.isCollaborative||!e.config.modules.comments)return;const n=e.ydoc.getArray("comments"),r=e.config.user;switch(t.type){case"add":c8(n,e.ydoc,t,r);break;case"update":$3(n,e.ydoc,t,r);break;case"resolved":$3(n,e.ydoc,t,r);break;case"deleted":u8(n,e.ydoc,t,r);break}};xt();function cf(e){const t=ne(e.documentId),n=ne(e.page),r=Gr(e.selectionBounds||{}),o=ne(e.source),i=()=>`${t.value}-page-${n.value}`;return{documentId:t,page:n,selectionBounds:r,source:o,getValues:()=>({documentId:t.value,page:n.value,selectionBounds:mn(r),source:o.value}),getContainerId:i,getContainerLocation:l=>{if(!l)return{top:0,left:0};const u=l.getBoundingClientRect(),c=document.getElementById(i());let d={top:0,left:0};return c&&(d=c.getBoundingClientRect()),{top:Number((d.top-u.top).toFixed(3)),left:Number((d.left-u.left).toFixed(3))}}}}const fu="document-editor";xt();const r_=Symbol("comment-reconciliation");var o_=e=>[e?.commentId,e?.importedId].filter(t=>t!=null).map(t=>String(t)),Qy=()=>({ok:!1,reason:"read-only-document"}),Jy=e=>e?.commentsStore?.getConfig?.readOnly===!0||e?.config?.modules?.comments?.readOnly===!0;function p8(e,t){const n=e?.commentsStore;if(!n)return[];const r=n.commentsList,o=Array.isArray(r)?r:r?.value??[],i=new Set(o_(t)),s=[];let a=!0;for(;a;){a=!1;for(const l of o){if(!l)continue;const u=o_(l);u.some(c=>i.has(c))||[l.parentCommentId,l.threadingParentCommentId].filter(c=>c!=null).map(c=>String(c)).some(c=>i.has(c))&&(s.push(l),u.forEach(c=>i.add(c)),a=!0)}}return s}function ia(e){const t=ne(e.uid);let n=e.commentId||as(),r=e.importedId,o=e.parentCommentId,i=e.trackedChangeParentId;const s=ne(e.trackedChangeThreadParentId),a=e.fileId,l=e.fileType,u=e.createdAtVersionNumber,c=ne(e.isInternal!==void 0?e.isInternal:!0),d=ne([]),h=ne(null),m=ne(e.isFocused||!1),p=ne(e.creatorId??null),v=ne(e.creatorEmail??null),_=ne(e.creatorName??null),C=ne(e.creatorImage??null),k=ne(e.createdTime||Date.now()),y=ne(e.importedAuthor||null),b=ne(e.docxCommentJSON||null),T=e.origin,R=e.threadingMethod,P=e.threadingStyleOverride;let j=e.threadingParentCommentId;const O=e.originalXmlStructure,V=ne(e.commentText||""),Q=e.selection?cf(e.selection):cf({documentId:a,page:1,selectionBounds:{}}),F=e.selection?.selectionBounds?{...e.selection.selectionBounds}:{top:0,left:0,right:0,bottom:0},N=ne(e.trackedChange),x=ne(e.trackedChangeType||null),z=ne(e.trackedChangeText||null),J=ne(e.trackedChangeDisplayType||null),X=ne(e.semanticColorKey||null),ae=ne(e.semanticColor||null),pe=ne(e.trackedChangeStory||null),Fe=ne(e.trackedChangeStoryKind||null),fe=ne(e.trackedChangeStoryLabel||""),ye=ne(e.trackedChangeAnchorKey||null),le=ne(e.trackedChangeCanonicalId||null),Se=ne(e.trackedChangePositionAliases||[]),re=ne(e.deletedText||null),xe=ne(e.trackedChangeLabel||null),$e=ne(e.trackedChangeDetailLines||null),st=ne(e.trackedChangeImagePreview||null),At=ne(e.resolvedTime||null),Ee=ne(e.resolvedById||null),Ge=ne(e.resolvedByEmail||null),qe=ne(e.resolvedByName||null),Z=ne(e.trackedChangeDecision||null),S=({id:me,email:Ce,name:Pe,superdoc:it,decision:He,reconciliationToken:Ct})=>{const Yt=Ct===r_;if(Jy(it)&&!Yt)return Qy();if(At.value)return;At.value=Date.now(),Ee.value=me??null,Ge.value=Ce,qe.value=Pe,(He==="accept"||He==="reject")&&(Z.value=He),Y(it,{type:tp.RESOLVED,comment:be()});const St=it.activeEditor?.commands;if(N.value){St?.resolveComment({commentId:n,importedId:r});return}const Ft=p8(it,{commentId:n,importedId:r});Ft.length&&typeof St?.resolveCommentThread=="function"?St.resolveCommentThread({comments:[{commentId:n,importedId:r,preserveAnchor:!0},...Ft.map(Nt=>({commentId:Nt.commentId,importedId:Nt.importedId,preserveAnchor:!1}))]}):St?.resolveComment({commentId:n,importedId:r})},ee=({isInternal:me,superdoc:Ce})=>{if(Jy(Ce))return Qy();const Pe=c.value;if(Pe===me)return;c.value=me,Y(Ce,{type:tp.UPDATE,changes:[{key:"isInternal",value:me,previousValue:Pe}],comment:be()});const it=Ce.activeEditor;it&&it.commands.setCommentInternal({commentId:n,importedId:r,isInternal:me})},D=me=>{const{activeEditor:Ce}=me;Ce?.commands.setActiveComment({commentId:n,importedId:r})},U=({text:me,superdoc:Ce,suppressUpdate:Pe})=>{if(!Pe&&Jy(Ce))return Qy();V.value=me,d.value=H(me),!Pe&&Y(Ce,{type:tp.UPDATE,changes:[{key:"text",value:me}],comment:be()})},H=me=>{const Ce=[...new DOMParser().parseFromString(me,"text/html").querySelectorAll('span[data-type="mention"]')],Pe=[];return Ce.forEach(it=>{Pe.some(He=>{const Ct=He.email===it.getAttribute("email"),Yt=He.name===it.getAttribute("name");return Ct&&Yt})||Pe.push({name:it.getAttribute("name"),email:it.getAttribute("email")})}),Pe},G=(me,Ce)=>{Q.source=fu;const Pe=Ce?.getBoundingClientRect()?.top;Q.selectionBounds={top:me.top-Pe,left:me.left,right:me.right,bottom:me.bottom-Pe}},te=()=>y.value?{name:y.value.name||"(Imported)",email:y.value.email}:{id:p.value,name:_.value,email:v.value,image:C.value},Y=(me,Ce)=>{me.emit("comments-update",Ce),$l(me,Ce)},K=(me={})=>{Object.prototype.hasOwnProperty.call(me,"commentId")&&(n=me.commentId),Object.prototype.hasOwnProperty.call(me,"importedId")&&(r=me.importedId),Object.prototype.hasOwnProperty.call(me,"parentCommentId")&&(o=me.parentCommentId),Object.prototype.hasOwnProperty.call(me,"trackedChangeParentId")&&(i=me.trackedChangeParentId),Object.prototype.hasOwnProperty.call(me,"trackedChangeThreadParentId")&&(s.value=me.trackedChangeThreadParentId),Object.prototype.hasOwnProperty.call(me,"threadingParentCommentId")&&(j=me.threadingParentCommentId)},be=()=>({uid:t.value,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s.value,fileId:a,fileType:l,mentions:d.value.map(me=>({...me,name:me.name?me.name:me.email})),createdAtVersionNumber:u,creatorId:p.value,creatorEmail:v.value,creatorName:_.value,creatorImage:C.value,createdTime:k.value,importedAuthor:y.value,docxCommentJSON:b.value,isInternal:c.value,commentText:V.value,selection:Q?Q.getValues():null,trackedChange:N.value,trackedChangeText:z.value,trackedChangeType:x.value,trackedChangeDisplayType:J.value,semanticColorKey:X.value,semanticColor:ae.value,trackedChangeStory:pe.value,trackedChangeStoryKind:Fe.value,trackedChangeStoryLabel:fe.value,trackedChangeAnchorKey:ye.value,trackedChangeCanonicalId:le.value,trackedChangePositionAliases:Se.value,trackedChangeDecision:Z.value,trackedChangeLabel:xe.value,trackedChangeDetailLines:$e.value,trackedChangeImagePreview:st.value,deletedText:re.value,resolvedTime:At.value,resolvedById:Ee.value,resolvedByEmail:Ge.value,resolvedByName:qe.value,origin:T,threadingMethod:R,threadingStyleOverride:P,threadingParentCommentId:j,originalXmlStructure:O});return Gr({uid:t,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s,fileId:a,fileType:l,mentions:d,commentElement:h,isFocused:m,creatorId:p,creatorEmail:v,creatorName:_,creatorImage:C,createdTime:k,isInternal:c,commentText:V,selection:Q,floatingPosition:F,trackedChange:N,deletedText:re,trackedChangeType:x,trackedChangeText:z,trackedChangeDisplayType:J,semanticColorKey:X,semanticColor:ae,trackedChangeStory:pe,trackedChangeStoryKind:Fe,trackedChangeStoryLabel:fe,trackedChangeAnchorKey:ye,trackedChangeCanonicalId:le,trackedChangePositionAliases:Se,trackedChangeDecision:Z,trackedChangeLabel:xe,trackedChangeDetailLines:$e,trackedChangeImagePreview:st,resolvedTime:At,resolvedById:Ee,resolvedByEmail:Ge,resolvedByName:qe,importedAuthor:y,docxCommentJSON:b,origin:T,threadingMethod:R,threadingStyleOverride:P,threadingParentCommentId:j,originalXmlStructure:O,setText:U,getValues:be,resolveComment:S,setIsInternal:ee,setActive:D,updatePosition:G,getCommentUser:te,updateIdentityValues:K})}xt();function m8(e,t){const n=e.id,r=Q(e),o=e.data,i=t,s=e.state,a=e.role,l=e.html,u=e.markdown,c=e.password,d=ne(0),h=ne(null),m=ne([]),p=ne(!1),v=ne(t.rulers),_=Kr(e.ydoc),C=Kr(e.provider),k=Kr(e.socket),y=ne(e.isNewFile),b=Kr(e.v2Collaboration||null),T=Kr(null),R=le=>T.value=le,P=()=>T.value,j=Kr(null),O=le=>j.value=le,V=()=>j.value;function Q({type:le,data:Se}){if(Se?.type)return Se.type;if(le)return p6[le]||le;throw new Error("Document type not specified")}const F=()=>{ae.value=X.value,X.value=[]},N=()=>{X.value=ae.value,console.debug("[superdoc] Restored comments:",X.value)},x=ne(e.fields||[]),z=ne(e.fields?.map(le=>N6(le))||[]),J=ne(e.annotations||[]),X=ne(Fe()),ae=ne(X.value),pe=ne(e.commentThreadingProfile||null);function Fe(){return i.modules.comments?e.conversations?.map(le=>ia(le))||[]:[]}return{id:n,data:o,html:l,markdown:u,password:c,type:r,config:i,state:s,role:a,core:ne(null),editorMountNonce:d,ydoc:_,provider:C,socket:k,isNewFile:y,v2Collaboration:b,container:h,pageContainers:m,isReady:p,rulers:v,rawFields:x,fields:z,annotations:J,conversations:X,commentThreadingProfile:pe,setEditor:R,getEditor:P,setDocumentRuntime:O,getDocumentRuntime:V,removeComments:F,restoreComments:N,removeConversation:le=>{const Se=X.value.findIndex(re=>re.conversationId===le);Se>-1&&X.value.splice(Se,1)}}}var i_="data:application/octet-stream;base64,UEsDBBQAAAAIAAAAIQAykW9XXwEAAKUFAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbLWUTWsCMRBA74X+hyVXcaM9lFJcPfTj2BZqf0BMZndDk5mQjLr++7Jql1KsC1Uve0nmvRdYZjJrvMtWEJMlLMQ4H4kMUJOxWBXiY/48vBNZYoVGOUIoxAaSmE2vrybzTYCUNd5hKkTNHO6lTLoGr1JOAbDxrqToFaecYiWD0p+qAnkzGt1KTciAPOSWIaaTRyjV0nH21DDgriSCSyJ72F1sXYVQITirFVtCuULzyzLcG/IIbnsn1TakQeOdkAcN7cnfgv3c6wpitAayNxX5RXkohFxTNNKQXnpAzo9jDnRSWVoN3XxLC5E0pGSx8i7vTryyOOjrwKVfQLRYnT+kQ/dGJN44SOcv2HH79cBssbpEwJ7cm7CGxfvFKn7Ae0NKQp6rhYPzZ3To3giuwcPuOz65Y4s5pjSk3yKFJDXFfzz7e2+008MQKUBke/yv64wqhJPfB+1KMmAOuOV2yU6/AFBLAwQUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAGRvY1Byb3BzLwMAUEsDBBQAAAAIAAAAIQCGoakSbgEAAM0CAAAQAAAAZG9jUHJvcHMvYXBwLnhtbJ2STWvcMBCG74X+B+N7LG8PoYRZhbIm9NCPBTvJeZDGtoikEZI2rP99sd3dddtbb/M+mnnnA8Hj2dninWIy7PflrqrLgrxibfywL5+7p7vPZZEyeo2WPe3LiVL5KD9+gGPkQDEbSsXZWZ/25ZhzeBAiqZEcpooD+bOzPUeHOVUcB8F9bxQ1rE6OfBaf6vpe0DmT16TvwtWwXB0f3vP/mmpW83zppZsCpVJCRy5YzCR/zJW20pwdiCuFjjPazjiSNYibgCMOlOQOxBrAK0ed5pw1gMOIEVWmuMCNgi8hWKMwG/byu1GRE/e5+LkMW8zVILYp0LBqSZ2iydNstZXwzXhaGqwBHDHiEDGMC9woaBVaOkQOskebCMQNwIFdQD/J9hQoNqxAXMjc4C09h46b+Rq/S/+Em1VfTR7bgIr+WnrDoR0xkm5YXQe5Avg6BYp2dj+M6AfSl5x/H+Yzvqy/U+7uq7qu6+VuFwbi9g/lL1BLAwQUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAGRvY1Byb3BzL2NvcmUueG1snZJNT+MwEIbvSPsfIt8TO2EXIStNJRZxWqSVKFrEzYyHYhp/yOOS9N+vkrQpFT1x88w888741dTL3rbZB0Yy3i1YWQiWoQOvjVsv2OPqLr9mGSXltGq9wwXbIbFl8+OihiDBR/wbfcCYDFLW29aRhLBgbykFyTnBG1pFhQ/oetu++mhVosLHNQ8KNmqNvBLiiltMSquk+CCYh1mR7SU1zJJhG9tRQAPHFi26RLwsSn5kE0ZLZxvGyifSmrQLeBY9FGe6JzODXdcV3eWIVkKU/On+z8P41dy4wStA1tQaZDKpxabmx6cGSduXd4Q0pedAg4SIKvnYPGwDxlsP2QopZY+EcUQP5cH4De46HzU1NT+JNEiNBNGEZLybRpwkIMhWUbr32rwa1De7s9O+UkNjxA8zXElTjcQc1nvLpw1RZz0ZORl7qPy7/H27umNNJaqfeVnl5dWqqqT4JYV4HpY86T8K2v0C31Y8CEw+nZ5r8x9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAYAAABfcmVscy8DAFBLAwQUAAAACAAAACEAHpEat+kAAABOAgAACwAAAF9yZWxzLy5yZWxzrZLBSgMxEIbvgu8Q5t6dbQURabYXEXoTWR9gSGZ3Q5NMSKJu314ERRdq6cHr8PPNN8O/3c3BqzfOxUnUsG5aUByNWBdHDS/94+oOVKkULXmJrOHIBXbd9dX2mT1VJ7FMLhU1Bx+LhqnWdI9YzMSBSiOJ4xz8IDlQLY3kEROZA42Mm7a9xfybAd2CqfZWQ97bG1D9MfElbBkGZ/hBzGvgWE+sQJ4rR8t2lbIkztVxAdVTHrlqsGKesqSClFIzBw942mhzudHf12LgSpYqoZHM530+E+eE1v/5omXix+ZdskX7Nf62wUULug9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAB3b3JkLwMAUEsDBBQAAAAIAAAAIQDscNBiEwIAALQHAAASAAAAd29yZC9mb250VGFibGUueG1svZPNbqMwEIDvlfoOlu8Nw0/SFIVUbbeR9rKHVfcBHGOCtf5BthPI268wECmkuy3tqnCwGWY+jz/D6r6RAh2YsVyrDIczwIgpqnOudhn+9bK5WWJkHVE5EVqxDB+Zxffr66tVnRZaOYsaKZRNJc1w6VyVBoGlJZPEznTFVCNFoY0kzs602QWSmN/76oZqWRHHt1xwdwwigAW+vkII9SzzHpQuCk7ZN033kinnIYFhgjiulS15Zc+Q9XuQtTZ5ZTRl1nK1k6KDSsLVOStMLmiSU6OtLtyMatn35nlBBCH4mRQjynwaJXqdsqCsmQZa9qCAsuYCxvNpsMUJxvMx7GNtjSn5fhInioeO2qEtHwNt7vJyGnM4waCtJY6UxJYXWDZtv/MT8yhZg5Gk6fed0oZsBctwHSaoDufIg1F3Mu2AuhNHwz6QN4TXXTP9T4nqVBHJMvzCJbPoB6vRTy2JGtL61IoobVmI6vRARIah3egCYphDAnOIIIYEB+cltCTGMncqgXFCQSQXx+G98auOUiruaDlkHIjh7Y7HSZbvUJ3u7RYy/AwA0fNmg7tImOEnALhdzh/7SNR24q+7PhKfItBGqOf4x7DjUM855Qyrr4LO4F98Pum94cy0Rt90eQsx3Hmnrcvk0y6lzpn5t8yCNyz/iMkk/mqTD4YT8abDR1hA4h1292cd2ppb+3++x4evtjhM7foPUEsDBBQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAd29yZC9kb2N1bWVudC54bWyllt1u2yAUx+8n7R0s7huM7TiJVbfSmq3qxaRq3R6AALFRDVhA4mRPP2HHH5unKnaugONzfvw5B458/3gShXdk2nAlU4AWPvCYJIpymaXg189vd2vgGYslxYWSLAVnZsDjw+dP91VCFTkIJq13EoU0SVWSFOTWlgmEhuRMYLMQnGhl1N4uiBJQ7fecMFgpTWHgI7+elVoRZgyX2ROWR2zABUdO19GoxhWXmQNGkORYW3bqGWgyZAk3cD0GBTNAyIcBGqPCyagYOlUjUDQLhPwxaTmP9J/DxfNIwZi0mkcKx6T1PNLoOonxBVclkydR7JUW2JqF0hkUWL8fyjuiRIkt3/GC2zMMfD9uMZjL9xmKuHzvCCKkkwkrKBRlRUhbikrBQcvkEn/XxTvpSRN/GboIVly3beCjDWQnWxjbxuprcteEby+Npc4a1KzAlitpcl523UHMpQls8xZy/CgBR1GArrOh6LbWtm3K0AOvkX+pnSga5R8TkX9FNR2ii7hGwt97tkoE5rLfeFZqBslFy2mAYASICTtNY6wvDEj61+04nE7jxB2H0wFnnpgBgB4mIYKw1eEGFz5gGWppPg3X1gi6WGxxjk0+JLJpB1x2uLMY5LvMbntUz1odyp7Gb6O99O21ktMO6Mf/VrA0t4l5y3HJgCdI8pJJpfGuYCmoUORVaOnVFfCa6+oGr3kBXltrr75Anuta4OG+SnaKnt1YehWKkhJr/EJTEKFNHMUrBGqrZSfrrH603KxXmyXwqkQbTn+kwPeDMNyuvnSmV+2MIfKjp6+dccv2+FDYsfvrwBk6GYYR+6qv5dfCs7ffXuU6FgqCyHeOeQrQch35DbLMvmNHtKpMAYoaF82z3PbLnbJWiX5dsP3ga84wZToFq6Be7pWyg2V2sPXysh1RhfGqxJSYsManNlNFnrUrSVJwyV65JXkKwrj+Cttz19OmIrD/hX74A1BLAwQUAAAACAAAACEAyudliigEAAC+DAAAEQAAAHdvcmQvc2V0dGluZ3MueG1stVfbbttGEH0v0H8g+FxZXF4kmTAd6No4sJoictDnFTmUFt4LMbs0rRT994KXldSaCKQEfuLynJkzs5eZJe8+vAruvABqpmTikhvPdUCmKmNyl7hfn1aDietoQ2VGuZKQuAfQ7of7X3+5q2INxjC5086r4FLHIk3cvTFFPBzqdA+C6htVgHwVPFcoqNE3CndDQfG5LAapEgU1bMs4M4eh73kjt5NRiVuijDuJgWApKq1yU7vEKs9ZCt3DeuAlcVuXhUpLAdI0EYcInBqmpN6zQls18aNqgpq9FXn53iReBLd2FfEumG6lMDt6XJJe7VCgSkFrJneC2wSZPAUO3wgdY9+kSnRTbKSGvke8ZnSeeXSdgP9GYJTC63Uak05jmMLruQ7LrtMZHXVYdqbzY8mcCWTlVRJ+YPOoH7X7mZbOTLa/Ts7u0bD2pYbuqd6fK8J1E4yOcgdxWm/NLzmBLfXItkjxcH78RBo/7KRCuuWQuBUJnYpETpOd025l/XDa0+HYdXCaxXXv76r4m1LCqeICMAVpEpf4njusiQKVyjeGGnCqWBfAedPDUg5Uuk4V75AKQdEijU8GOS25eaLbjVGFU8UvlCfu2Eqme4o0NYCbgqZM7uZKGlTc2mXqD2XmShQIWnceTV87jTZtj3SqWFIBifufvrdWGdSZlcgu3xnXRifRecj/B1IvgMgyeKoXemMOHFZKmg37BlOZfSq1YTlLm+73Exl8LwGQdeTPBcinQwEroKZE0O8UrNmJFWfFmiEqfJAZSPNuwVieA4I0jBpYl9wwVFWzzh+BZoDvFbfU8JfCzPdI8IQ0fZ4pY5T4eCj2IH9yJ5vzPjw/vqhZpu3gi1LmaOr5QbAYz9pMa/YSJiBeOF/2MiNvRfp9pmHgBb3MnCxI2M9Ek9m8jwlvwxGZ9jGjyF+GUR8znfmTYNLHzGZkHPUy83kwD1a9zNJb9M9nOffH497cVre+d7vsdqfbExHXnxp/oh3Vhe2I1mNOxRYZddb1x8iwttji84xJy28hVwjnzKbcWnIwaAktKOcrpKklvBbPmC4WkDdjvqa4O+l2FtiLZpB/OmrVXRvwd1Rl0bIV0qItWGtCwrDzZNI8MmFxXW431ktSPJxRpcw+v2CzTqflqWKzB9E0vkfaFFJjC3LwddMVGsdNXSSwpkXR1tp2RxKXs93ekLo8DEncjOJz87Ld+R3nN5zfcs0LTeuZkcTtBifMt9iZXWCx4ISFFgtPWGSx6ISNLDaqsf2hAORMPifucVjjueJcVZB9PPFvIHsJpkxQvjmI7eluu2k5zrTZQEGRGoWW+63hSBhnKn2o7+uwxYPpNFpMvXFLR831aZpWxeTuC+QzqiHrOOsata5/j0beiJD5ZBBOlreD5TgMBxMyux2Mx96YBCviBxPvn64O7I/H/b9QSwMEFAAAAAgAAAAhANuFbMNjBAAAlx0AABIAAAB3b3JkL251bWJlcmluZy54bWzNmctu4zYUhvcF+g6CgC5jkbrbiDJIMkmRwXRQdFJ0TUu0RYQXgaR82c7L9BH6WPMKBWVLdiJPKslO45USkufT4c9zpD/K5YcVo9YCS0UET2w4AraFeSoywueJ/efj/UVsW0ojniEqOE7sNVb2h6uff7pcTnjJplgSPrdWjHI1WRZpYudaFxPHUWmOGVIjRlIplJjpUSqYI2YzkmJnKWTmuACC6qdCihQrRfj8FvEFUvYWl6660TKJloTPDdB30hxJjVc7BuwNCZyxE7dB7gAQBI4L2yivNyp0TFYtkD8IBEGbFAwjHdhcOIzktknRMJLXJsXDSK1yYu0CFwXmK0ZnQjKk1UjIucOQfCqLi1SwAmkyJZToteMCENYYRPjTgIwIf2oIzMt6EyKHiQxTL6spIrFLySfb+Ism3qQ+2cRvL00Ept1u6wI4dvBKU6XrWNlFu034R5GWDHNdqeZITJEmgqucFM3TgQ2lMaTzGrJ4TYAFo3bzZIP+cY+2j5tj2AG7pL89O0Y3mb9OhKDDaRpEE9Elhef3rDNhiPDdjQdJsycuDPoB3BYgTPGqHyPeMpx0192GQ7J+nLDhkGyPMyyZPUBW9kK4Xp2HuZjwPZbKdJb3w9Vn5JhYpFGOVL5PxP02GDS4NdvTu5gf11S/SlEWOxo5jvawe7wueb8NgvDlCRbquGS+5qjAtsXSycOcC4mmFCf2EvrWEgZWdQLWplzNxdp0gFWftVUVkGWeWvbV5XKCpkpLlOovJbOe/faQJTawDXMisdJImsGNp7ueaSxvJEZPZomhcGXuNlkgmtgwhG54AyLbMTOspJp8xgtMH9cFrtfk66kk2W9mjpq5zVrNClqvCODdrX8H4s0MXZgJQhd0k9REFzRNbOCDMQAAVjlUOTZJbOJ4ye5ZMzgtKcW6IT7iVTP1/ds/zfintB6leLZdXvwuzYVws00znNiRW2WSIz6vDLEXArPWaRbL7eVecK2MuColJLG/rtlU0Cr0mqvnA4TrxM7wDJVUb2EVxakSe6kEbCnhVSOYa6TJApsVRysj+uoCfX+YMLeilARL6wte7qnzYjRV7YX9VHNbqgWnV+37t7/76ubCcJhufxE+N3+TqT3Vno/1E8g70GBvIFDvhnPj+L07zj/LjvNCcNYdF5xpx/meex4dF55pxwXAf++Oi86y44IoPOuOi8+040I/fq+Oc5652/+0vnCI9Q3iCEDv5vo463t3F/owuvW7WN/7jseY4ZQwRA+e4y9wdGLv29GuwvHAoqRiieVnrDWWh3fkjk7tWjt6SXhzzJb+EAzxwzvyDu1Iknnew1DCuMOWvAM1NmxLr9acPzq1/evo2N6u6ILRqY1bRzv1ZkUX9i+6lqfqVHTh/1N00ejUDqijaXm7ootHp/YuHR3FmxXduH/RtWzFD4qu7QF49e7ne+988+FskpXVZ7VqEADoR+PQffm57KF57df34geY7iGmHwcBjHwIf8yE+0xn7x+qV/8CUEsDBBQAAAAIAAAAIQC+fnZiWAEAANADAAAUAAAAd29yZC93ZWJTZXR0aW5ncy54bWyd019LwzAQAPB3we8Q8r6lnduQsm4gMvFFBPUDZOmtDeZyJclM56eXdn+s7GX16ULgftwfbrFq0LAvcF6TzXk6TjgDq6jQtsz5x/t6dM+ZD9IW0pCFnO/B89Xy9mYRswibNwhB29KzBo31GaqcVyHUmRBeVYDSj6kG26DZkkMZ/JhcKVC6z109UoS1DHqjjQ57MUmSOT8y7hqFtlut4JHUDsGGLl84MDJosr7StT9p8RotkitqRwq817ZEc/BQantm0ukFhFo58rQNY0V4rKijxCRJk+6F5heYDQMmF8BcQTPMuD8aQkHTd3QxzJmfHV30nP8V0wOK3SBicneqow1tes/yRSiqYdxpR6LNlUFW0ld9EYY1ODtze2znjSp7Li05uTGQ85hOWUxnrIPZYQttYIfFslMLrJsLXy5iRnXQqL9hTe7BUfTgRPstjaH4+vIklgvx5w6XP1BLAwQUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAHdvcmQvc3R5bGVzLnhtbO1dXXPiOBZ936r9Dy6eZh66AUk2kBp6Kkl3b7o2/TFDeudZ2AI0sSXWFk0yv35L/gCDLbDRhUl3baUqCcb3SNa551q6sqVffn2KQucbixMuxbjTf93rOEz4MuBiPu58fXj/athxEkVFQEMp2LjzzJLOr2/++Y9f1leJeg5Z4jxFoUiuIn/cWSi1vOp2E3/BIpq8lksmnqJwJuOIquS1jOfdiMaPq+UrX0ZLqviUh1w9d1Gv53VymLgJipzNuM/eSn8VMaFS+27MQqq4FMmCL5MCbd0EbS3jYBlLnyUJF/MozPAiysUGpk8qQBH3Y5nImXrtyyivUQrVRb1+L/0vCrcAbjsAVAHwfPbUDmOYY3R99lTG4UE7HG+Dw4MSzmmVKQEEq1YQCBf10H+0eQkrCVSwaAdXcNTVtlTRBU0WZUTW7gLdDdxzpNs78q8+zIWM6TRk4866T5x133VSYCdjQf9xMmKd4hKctF06b35ZXwXSf8tmdBWqRH+Mv8T5x/xT+ue9FCpx1lc08Tkfd65jTsOOs75iNFHXCacPCxaxcSfiQsZ31yLh+suF/qd0sp+MOw88Yonzia2d32VEhfPTjQyendvJz52uLuiRxcJZX32j4biDskPJX5sDpDhym+wfC6mYF8eYePV1Uq5d6dCUB3zcofGryXVq2CdXIZ9TtYpZ4uhPKUIWiOLgVgrFntSKhvrkbt4e3f1WWm4+ZWftNWlIFRNqkkWx9VXAZvfSf2TBRFHFxp1eJzv49cOXmMuYq+dxZzTKD05YxO94EDBROlEseMD+WDDxNWHB9vhv79Nokx/w5UqocQcPvJTmMAnePflsqWOXs74SVPP1SRuk3Kz4tvDU/L8FWD9v4Dr7BaM6gDv9fYhRawikLZLS1dZjrvauvd+6IHypgsilCnIvVZB3qYIGlypoeKmCRucuiIuAPWVCrBZTQT2Gg4BwMBAOAcJxgXA8IJwBEM4QCGdkjaOkb/LCkrPj0Sm46Ey4+Ey45Ey47plwvTPhDs6EOzwT7ugMuFlXy/kgAiaUtcpmUiohFXN099QajQohVTqqhcHTNz0Wg1wkAEwW2fIbsTWaT9PPxz3EtbufKz2gc+TMmfG5HpxYV5yJbyyUS+bQIIhZAggYM7WKBZxPx2zGYiZ8BunYcKAhF8wRq2gK4JtLOgfDYiIAbr4CESQobByartRCi4QDOHVE/VgC9FkoWHy454kCAXFuVmHIgLA+wbhYioVgYDAMDIGBcSE5g2qiHA2DohFQNBfSP6HaLUfDoGgEFM2+3R64Ctl+r6PfPHd3G8oEIuBN+Fyk+VNrpDxn6nyhMZ3HdLlwdNr5aE+rdTlpyvkB4p62QYLq16cuorPOXKwYLBqUuDZ4GBiPAOPZS+wjSxLdQbuDGc9MVlNVK9rmo4IJDVdZh9ZebVQxQAG853ECJoN6WAAP/qS7s3dAXb1tLREgFgaPSqDVyyEBahlK/xEmDN89L1kccvFojfRehqFcswAOcaJimflaWfIINZb8u2i5oAlPKhDNb/XFEwzOR7q0vqAvIeUChrd3ryLKQweuB3H38PHeeZBLPczUDQMDeCOVkhEYZp4J/OkPNv0ZpoLXfizFM9DVXgOlh1KwW66AWL2VARDSWzbjgoPcQ1O8f7PnqaRxAIP2JWbZQ0OKASFOaLQMobT1vGTrmEOkZVO8/9CY67wQlKgeQMBKacNkNf2T+Qqgfg5IZujzSqX5x7Sr24eFQ7Bw9l2ElE1nwrX/AlzsDhyChYO62NuQJgn3wa62wEPAeNDXS6DwZCjj2SqEa8ACEEEDYjjAVSQSyCtO8RAwHvT1EmA8FwjvXzEPwMhIwRAkGIYEI5BgoAR4kGADSLAhEBhQF6AEhiDBMCQYgQRzIcE8SLABJBiUn+G3DpvNmK/gbjElSAQPCXejEYpFSxnT+BkI8l3I5hQgQZqhfYnlTL9NIkX2EDdEd3Y1VZCd7QwOiuQ/2BSsahoLsl4AGVEahlIC5da2N5yaZ9eOmaWvc0BkCn22kGHAYsM1HRwvT5bU59XUafPJkns+Xyhnsthk+8swXu+oZTFg3zE7XmBdm3vo4DRTwFdRUdHqyxQebm6MKsbkuPG2J7Fj6Ta0rJbpHbfc9pJ3LAcNLatlDhta4orl6OAsWfxY6wiDQ/6zGeMZnG/Qb2JcWyxqYlnnggPcVCrOte/r2YL+iZox2zcTj9m+jYrMKG3kZEZprCszxCGB/c6+8aQ2R31k/nvz9EQl7pPGkfO3lVSVaWrU/KWuD0IxkTCnFgc3n7jaiTLmdmwcbswQjeOOGaJxADJDNIpERvNWIcmM0jg2mSEaBykzROtohSyjFbKMVggkWiGQaIXsoxU6vTtghmgtVGQvVGQvVGQnVAQiVGQvVGQvVGQvVGwpVGwpVAwiVAwiVGwvVGwvVGwvVGwvVGwvVGwnVAwiVGwvVGwvVGwvVGIpVGIpVAIiVAIiVGIvVGIvVGIvVGIvVGIvVGInVAIiVGIvVGIvVGIvVNdSqK6lUF0QobogQnXtheraC9W1F6prL1TXXqiunVBdEKG69kJ17YXq2gvVsxSqZylUD0SoHohQPXuhevZC9eyF6tkL1bMXqmcnVA9EqJ69UD17oXqthJpPUZoes++3z3oan9hv8Z5PVqnfy69y7+RQ+61rZcZq/i7CjZSPTu2Lhxg3B+HTkMs0Rf18fBmFQeuJz8+3h9/wabCMR9NLyd+FSOdMK+CkqWUlp0JQQ8vKII/ghpaVXichDS0rt0FyKOimuiweSpkvKvNZpNfMuG8w95qZV5t40Myw2sLDZobVBh41M3QdHZz3rd2G7eRtni+tIPSbIQzMCKgVV8bcfmPSzAhN2TMjNKXRjNCKTyNMe2LNUK0ZNkOdRjWyphpZU42sqUYwVCM4qhEc1QiIamxNNbamGltTjWGoxnBUYziqMRDVxJpqYk01saaawFBN4KgmcFQTIKpda6pda6pda6pdGKpdOKpdOKpdIKo9a6o9a6o9a6o9GKo9OKo9OKq9VlSnWZTTR0sl83adsJJhuxtyybBdcC4ZnjBaKlmfOFoqIZw4WqpyddpoqUzaaaOlMnunjZbKNJ42WqrwedpoqZbY00ZLtQyfNloyU42sqUbWVCNrqhEM1QiOagRHNQKiGltTja2pxtZUYxiqMRzVGI5qDEQ1saaaWFNNrKkmMFQTOKoJHNUEiGrXmmrXmmrXmmoXhmoXjmoXjmoXiGrPmmrPmmrPmmoPhmoPjmoPjup2o6WPTIAsATWJaKwcuPXi7miyUNR+ccKvImaJDL+xwIG91PtWV9nd3f7qTbGdn7O+Us/LdAX00utKQbYCbA6Ynvgh2GxTpY11TYp9vvLDaYXz6dqsxNTwSFEb8HyuuF+B325ulZYwpQkLPou6woVeGLHmuHaI4nhRzO2Cxtm3W1ctzhntX8v6Kk70Bm7Z170ewvjt4CY7a5ltzfbI2PITe1Ld4sM9FyzJ9knLXqDVu57pNcXYuIO99N0rOlMsHneGuWpltmrT/bdwU1JOXV5G7S5wxZZv9M/Slm/7+8HpL9/lxzZbwtVa+okqHb7hAc8q52uVb+r1ngy81DfSk9MIMO7QVP/bw/qhFP2cwfv9DeSKyebyBnKkt7e12ynOg4zOgyCdBzVwnq0ss/N2RHlm9+o3dK/+j+leGFXdKztm6V7Y6F4Y0r3wD+Je6LB7HXOiS7gKGtZsZTkEcBVidBUC6SrkhbvKsOwpxOgp+DyewrPftwmI31h6hGv0CBfSI9wfwyPIy4wdlj7gGX3Ag/QB74X7gJl29+KBwB3pn30n0DstbV3ggesdfK89AA8YGD1gAOkBg+/WA7wLCP/CnA+NnA8hOR++KM6rzA4urm000D9NeH4L0ecbGXkeQfI8euE8Dy+gYHhm/QWNqZ8vqG7If+UbI21W9km3Rdrn3LB7koGvfjO+zPVWxUrrhjqnWdqDibt8sXaTQzX2KDUNM6rVNPwgtEOt8z3ss5oGT7RTnHjLwvAjzc6WS/OpIZup7Nt+b1jz/TTbEsJoH6dzB0aA7m5lupuLMLd3tklk/lKLMU+aLhlWbe5sKTHLlm7ow/4qUTJK07379dvJge7X8q5ItzrbOLMXuGp1YMy0HglV5uDz/3Rna0rRQUoREKWo3d3nx2fYJuPYkmF8kGEMxDA+F8Pfe9KvJVvkIFsEiC3y0ti6dOKtJSvuQVZcIFbcH01D4Dx4B3nwgHjwviN1wGcmWlIyOEjJAIiSwYuWxt9OwvAgCUMgEobfkS7OPN4/TsnoICUjIEpGL1oXl0qnZQtb7Ld1dhQij5YiHUqi9XsnPAC0TXLvTYz7evuKJ7WiYb6S/ot56GJb5fSyXhXX/chiUe0sb8KjV+0+u8CBcEtRrRvYyq3kS2b2X+aw9fKc1Yt0s4n2PkGbLyCkWoAdVGv/BLWKVZT9w8Pq81CbLyua7nu9Fzg/VfGKvvt3jHl3yDK5ha10d93L7A0vvM94ZsrqNZttA7DPTHYUQq0p0iGpopHVjbX+AbR+sXjfn36BowexLK5V6oFOJunpnyYcQo+Htw1XS46tZkoMmzk5KpiLtly9A+vpk+2+GvtttbftxjGPrjYFJie4J0+nuvRElV4jr0Gfr6G7bC46Xzhus5rd/mVXlrtr5yg1HtHqhnrcOy74nFXeFvWBbnc3FIiAVy7uUNzDpwwoljdBaYI0PS/hYp7vq/2XfkbOyaIjSzutTt7sJ+bHN1OpZy6pu72yYy9G4CKylzU29NLapDO72SeQ4P+35kMrfnTQdW1vBzsiOeKxL073B2Pkdm1NUwNuz7CNksWcX6soOc1KzVsriWgY3tJlAjXFtduldOtbtPgvefM/UEsDBBQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAd29yZC90aGVtZS8DAFBLAwQUAAAACAAAACEAZ4D8tJEGAADNIAAAFQAAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbO1Zz4/bNha+L9D/gdDd0Q9LsjSIpvDPpslMEmQmWfT4RqIlxhQpkPTMGEWAIj3tZYEFukUvBXrroVhsgS3Qopf+MQEa7Hb/iIVkjy3adJO0k90AO/bBJvV9j5/eeyQfyNvvX5YUnWMhCWeJ5d5yLIRZyjPC8sR6fDrpRBaSClgGlDOcWAssrfcP3/vDbThQBS4xuiwpkweQWIVS1YFty7TAJchbvMLssqRTLkpQ8hYXuZ0JuCAsL6ntOU5ol0CYhRiUOLEeTKckxei0NmkdXhkfU1xipmTdkVJxkjYjthkNNpu59Y9cyCEV6BxoYl0QlvGLU3ypLERBqiEVieU0H8s+vG2vSVTt4bZ4k+az4q0I2cxreCI/WxOdsRf57tq+t7S/ixtH9XdtrwFAmmK20tLGukHoRN4K2wIt/xpsxz23q+Nb9ru79uNw4PkavrvB+7vvOInHo0DD+xt8sIPvO94g7mr4YIMPd/D+uN/zxhq+ARWUsNkuOuxFUbhCryFTTu8Y4XEYOr3RCr5B2a3sWvKZ2pdrJTzlYsKZaoILijCkFhWeQooTq18pLtGIyIrCwkIVMC5xYjme6zqO4zve+tt4HA4wtNjLrlTudNV6kEwFqVRi3a2AWS3Izz/88OL5dy+ef//i009fPP87OiJ5oQy8O8DyNu+Xr//y7y8/Qf/6x1e/fPZXM1628S//9qeXP/70a+aVJuvzb19+9+3PX/z5n998ZoD3BZy14aekxBLdxxfoES+BmQbAZ+LNGKcFkDajz3IJDGqOAT1WhYa+vwAKBtwA6358IgjLTMAP5k81wSeFmCtiAN4rSg14zDkdcGF8p3v1WG0vzFluHlzM27hHAOemsYdbUR7PqwKXxGRyWGBN5kMKTEGOGVaofsZnGBtoHxGi+fWYpIJLPlXoI4IGQIwuOSVnyky6Q0qgsABzvDXfHD9BA05N5kf4XEcCy4GaTGKqufEDmCsojYqhpG3kEajCJPJkIVLN4VIJYDmmHI0zLKWJ80AsNLn3gBJz2I/potSRQpGZCXkEnLeRIz4bFlBWRs2EFW3sh3LGOQX0kCujCK7PkLrNKQG2N9xPCFZvNrcfk7wwJ0j9ZC5MUwJzfT4u6BQwMy5OpbbE9gUxZsdgnmupfYQxhQvIMEaPPzThecXNou8WmOV3sMk3d0HP1brNsMSoKW4MgSVSS9kTnPM9eo4XWwvPAlgJYp/l+zM9ZcZngpTGfKXpTFtKiagnrVnEA1nCa1l9WICWVnVbVnvmGHvTOXayEE9/Awe/MYcLeG3fnALF5oQ5BYKOsJkyN1Pq6dTQ5kbeVJ+0mzDYW0VPSdgrKqD/TeXz1mqe66929i0o2zXOPtx2ZTPkIiPvfmEzgjl7iFlxU9fc1DX/l3XNvvl8U83cVDM31cx/rZrZFDB2+7CnsVLuPfmZEkpP1ILiI9mUPpJTkk0IpU2jIa0PmqpiSMVqOA2XC2j+I8HVH4kqTgqocGK5zQi5XJnOJaq4TCzH2mu7Kb7m5THPVud47tXZJhxIUJt+J1j3K8LUsjfsbQ5C1+abVi7bAoLG6OuLaA2mi+gaRPS6ryfCda5LRWxQEbm/psJuRYUShqA+Fg/8pSIkU6A4q+O05F9F99ojvc+Z+mt7hteL/WuLtCailW66iFYaFpDh7e5rjnUcm0PtGWX0orcRa3t3baBMb6GLxAq7gWOhFKrEmlJQFkrLKkssWa9UQHOWWKlaOfq3rCyVkGoEsljCmkfL9y+JwgJRUiZW1A4DZRttrtdz3l1xsfPuec7eDjKeTnGq9vRsmkdSLY0Yn/5OcN3gc4XFSZFdoDM6F48gS6yg59YOzIhUa29mRLSSe+PFreVqNRW1G6DNFAVaFbDaUdqL+RLe/F/Lab1Ho3T7rWyTC8/yyXXsuq8mbS2aezaQ3t5V7O1t8i1VXbOqwLjWxdErdonfvyG0pEVmaV2ztH17xzUWBK3hwu4r9ojr3g22s9Zu1ZVNa+dym589xaka4SnMqZLLA7JLJWB4dS25XAma3qvV5VKhuSCJ9bET9P2hFww7ThSMO37XdzpR0O92+kHQdceB64wG3jPr8LYqSjdYjj2BktDF6u6+6d+5vy+vSu1bKS9t3tTBdkNu7u9db//9PSJZYn0cepO4Gw/CTtztTzr+aBB14mE46IzCYW80GQ2DKJ48s9B5A/b73aEfjqNO6A6HHT90avlR3On5ntf3e/1o7PefrXyNL9XV75V7G12H/wFQSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAB3b3JkL19yZWxzLwMAUEsDBBQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAd29yZC9fcmVscy9kb2N1bWVudC54bWwucmVsc63TsU7DMBAG4B2Jd7BuJ04KVAg16YKQukJ4ACe5OBb2ObKvkLw9UlHbVFQRQ8b7h///BnuzHZwVXxii8ZRDlqQgkGrfGNI5fJSvd08gIitqlPWEOYwYYVvc3mze0Co2nmJn+igGZynm0DH3z1LGukOnYuJ7pMHZ1genOCY+aNmr+lNplKs0Xcsw7YDiolPsmhzCrrkHUY49/qfbt62p8cXXe4fEVyZkRGZDOoIoVdDIORyTZHAW5HXCalECjxangMM9N58tOU97V2EwpM+CUzSHWC+J4A4dngGH8zfM5gyPSxpaT1yqyk4cp2gO8bAk4hur9z9PchIeIfLitxU/UEsBAhQAFAAAAAgAAAAhADKRb1dfAQAApQUAABMAAAAAAAAAAAAAAAAAAAAAAFtDb250ZW50X1R5cGVzXS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAAAAAAAAAAAAAACQAQAAZG9jUHJvcHMvUEsBAhQAFAAAAAgAAAAhAIahqRJuAQAAzQIAABAAAAAAAAAAAAAAAAAAuQEAAGRvY1Byb3BzL2FwcC54bWxQSwECFAAUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAAAAAAAAAAAAAABVAwAAZG9jUHJvcHMvY29yZS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAABgAAAAAAAAAAAAAAAAD0BAAAX3JlbHMvUEsBAhQAFAAAAAgAAAAhAB6RGrfpAAAATgIAAAsAAAAAAAAAAAAAAAAAGgUAAF9yZWxzLy5yZWxzUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAAAAAAAAAAAAAAALAYAAHdvcmQvUEsBAhQAFAAAAAgAAAAhAOxw0GITAgAAtAcAABIAAAAAAAAAAAAAAAAAUQYAAHdvcmQvZm9udFRhYmxlLnhtbFBLAQIUABQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAAAAAAAAAAAAAAJQIAAB3b3JkL2RvY3VtZW50LnhtbFBLAQIUABQAAAAIAAAAIQDK52WKKAQAAL4MAAARAAAAAAAAAAAAAAAAAJULAAB3b3JkL3NldHRpbmdzLnhtbFBLAQIUABQAAAAIAAAAIQDbhWzDYwQAAJcdAAASAAAAAAAAAAAAAAAAAOwPAAB3b3JkL251bWJlcmluZy54bWxQSwECFAAUAAAACAAAACEAvn52YlgBAADQAwAAFAAAAAAAAAAAAAAAAAB/FAAAd29yZC93ZWJTZXR0aW5ncy54bWxQSwECFAAUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAAAAAAAAAAAAAAAJFgAAd29yZC9zdHlsZXMueG1sUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAAAAAAAAAAAAAAAbyQAAHdvcmQvdGhlbWUvUEsBAhQAFAAAAAgAAAAhAGeA/LSRBgAAzSAAABUAAAAAAAAAAAAAAAAAmiQAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQIUABQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAAAAAAAAAAAAAAF4rAAB3b3JkL19yZWxzL1BLAQIUABQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAAAAAAAAAAAAAAIkrAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzUEsFBgAAAAARABEAEQQAAMEsAAAAAA==";xt();var s_="in";const hu=cC("superdoc",()=>{const e=ne(null);let t=null;const n=aa(),r=ne([]),o=ne([]),i=Gr({}),s=ne([]),a=ne(100),l=ne("manual"),u=ne(s_),c=ne(null),d=ne(!1),h=ne(!1),m=ne([]),p=Gr({name:null,email:null}),v=Gr({}),_=ne(null),C=ne({left:0,top:0,width:0,height:0,source:null}),k=()=>{r.value=[],o.value=[],Object.assign(i,{}),s.value=[],d.value=!1,p.name=null,p.email=null,Object.assign(v,{}),_.value=null,u.value=s_},y=Gr({scrollTop:0,scrollLeft:0}),b=z=>{t=typeof z=="function"?z:null},T=z=>{const J=t||e.value?.onException;typeof J=="function"&&J(z)},R=async z=>{if(k(),e.value=z,z.zoom?.initial!==void 0){const Fe=z.zoom.initial;typeof Fe=="number"&&Number.isFinite(Fe)&&Fe>0?a.value=Fe:console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage")}if(z.zoom?.mode!==void 0){const Fe=z.zoom.mode;Fe==="manual"||Fe==="fit-width"?l.value=Fe:console.warn("[SuperDoc] zoom.mode expects 'manual' or 'fit-width'")}if(z.measurementUnit!==void 0){const Fe=z.measurementUnit;Fe==="in"||Fe==="cm"?u.value=Fe:console.warn("[SuperDoc] measurementUnit expects 'in' or 'cm'")}const{documents:J,modules:X,user:ae,users:pe}=z;if(s.value=pe||[],Object.assign(p,ae),Object.assign(v,X),Object.prototype.hasOwnProperty.call(v,"comments")||(v.comments={}),!J?.length&&!z.modules.collaboration){const Fe=await Zv(i_,"blank.docx",Or),fe={id:as(),type:Or,data:Fe,name:"blank.docx",isNewFile:!0};z.html&&(fe.html=z.html),z.markdown&&(fe.markdown=z.markdown),J.push(fe)}await P(J),d.value=!0},P=async(z=[])=>{if(!z)return[];for(let J of z){if(!J){T({error:new Error("Received empty document entry during initialization."),stage:"document-init",document:J}),console.warn("[superdoc] Skipping empty document entry.");continue}try{let X=await O(J);if(!X){T({error:new Error("Document could not be initialized with the provided configuration."),stage:"document-init",document:J}),console.warn("[superdoc] Skipping document due to invalid configuration:",J);continue}const ae=m8(X,e.value);r.value.push(ae)}catch(X){T({error:X,stage:"document-init",document:J}),console.warn("[superdoc] Error initializing document:",J,"with error:",X,"Skipping document.")}}},j=(z,J,X)=>new File([z],J,{type:X}),O=async z=>{if(z=Yd(z),e.value?.html&&(z.html=e.value.html),!z.data&&z.url&&!z.type&&(z.type=Or),e.value?.modules.collaboration&&!z.isNewFile)return{...z,data:null,url:null};if(z.data instanceof File){let J=z.name;const X=z.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":z.type==="application/pdf"?".pdf":".bin";if(J?J.includes(".")||(J=`${J}${X}`):J=`document${X}`,z.data.name!==J){const ae=j(z.data,J,z.data.type||z.type);return{...z,name:J,data:ae}}return z.name?z:{...z,name:J}}else if(z.data instanceof Blob){let J=z.name;J||(J=`document${z.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":z.type==="application/pdf"?".pdf":".bin"}`);const X=j(z.data,J,z.data.type||z.type);return{...z,data:X}}else{if(z.data)return z;if(z.url&&z.type){z.type.toLowerCase()==="docx"?z.type=Or:z.type.toLowerCase()==="pdf"&&(z.type=Ql);try{const J=await Zv(z.url,z.name||"document",z.type);return{...z,data:J}}catch(J){const X=J instanceof Error?J.message:String(J);throw console.debug("[SuperDoc] Failed to fetch document from URL:",X),J}}}return null},V=ke(()=>{for(let z of r.value.filter(J=>J.type==="pdf"))if(!z.isReady)return!1;return!0}),Q=z=>r.value.find(J=>J.id===z);return{commentsStore:n,documents:r,documentBounds:o,pages:i,documentUsers:s,users:m,activeZoom:a,zoomMode:l,measurementUnit:u,viewportMetrics:c,documentScroll:y,isInternal:h,selectionPosition:C,activeSelection:_,isReady:d,user:p,modules:v,areDocumentsReady:V,init:R,setExceptionHandler:b,reset:k,handlePageReady:(z,J,X)=>{i[z]||(i[z]=[]),i[z].push({page:J,containerBounds:X});const ae=Q(z);ae&&ae.pageContainers.push({page:J,containerBounds:X})},getDocument:Q,removeDocument:z=>{const J=z!=null?String(z):null;if(!J)return null;const X=r.value.findIndex(Fe=>String(Fe?.id??"")===J);if(X===-1)return null;n.removeCommentsForDocument?.(J),_.value?.documentId!=null&&String(_.value.documentId)===J&&(_.value=null,C.value={left:0,top:0,width:0,height:0,source:null}),delete i[J];const[ae]=r.value.splice(X,1),pe=e.value?.documents;if(Array.isArray(pe)){const Fe=pe.findIndex(fe=>String(fe?.id??"")===J);Fe!==-1&&pe.splice(Fe,1)}return ae??null},getPageBounds:(z,J)=>{const X=i[z];if(!X)return;const ae=X.find(Fe=>Fe.page==J);if(!ae||!ae.container)return;const{height:pe}=ae.container.getBoundingClientRect();return{top:pe*(J-1)}}}}),g8=e=>{const t={trackInsert:"insertedMark",trackDelete:"deletionMark",trackFormat:"formatMark"},n=new Map;for(const o of e){const i=o.mark.attrs.id;n.has(i)||n.set(i,[]),n.get(i).push(o)}const r=[];for(const[,o]of n){if(o.length===1){const s=o[0],a=t[s.mark.type.name];r.push({from:s.from,to:s.to,[a]:s});continue}const i=new Set;for(let s=0;s<o.length;s++){if(i.has(s))continue;const a=o[s],l=t[a.mark.type.name],u=o[s+1];if(u&&!i.has(s+1)&&a.to===u.from&&a.mark.type.name!==u.mark.type.name){const d=t[u.mark.type.name];r.push({from:a.from,to:u.to,[l]:a,[d]:u}),i.add(s),i.add(s+1);continue}let c=!1;for(let d=s+1;d<o.length;d++){if(i.has(d))continue;const h=o[d];if(a.mark.type.name!==h.mark.type.name){const m=t[h.mark.type.name];r.push({from:Math.min(a.from,h.from),to:Math.max(a.to,h.to),[l]:a,[m]:h}),i.add(s),i.add(d),c=!0;break}}c||(r.push({from:a.from,to:a.to,[l]:a}),i.add(s))}}return r};var v8="headerFooterPart",$y=e=>Number.isFinite(e)?Number(e):null,y8=(e,t)=>`${e}::page:${t}`,b8=(e,t)=>{const n=String(e),r=String(t);return n===r||n.startsWith("tc::")&&n.endsWith(`::${r}`)},w8=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.forEach(i=>{[i?.left,i?.top,i?.right,i?.bottom].every(Number.isFinite)&&(t=Math.min(t,i.left),n=Math.min(n,i.top),r=Math.max(r,i.right),o=Math.max(o,i.bottom))}),[t,n,r,o].every(Number.isFinite)?{left:t,top:n,right:r,bottom:o,width:r-t,height:o-n}:null},a_=e=>{const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{const r=$y(n?.pageIndex);if(r==null)return;const o=t.get(r);if(o){o.push(n);return}t.set(r,[n])}),[...t.entries()].sort((n,r)=>n[0]-r[0]).map(([n,r])=>({pageIndex:n,rects:r}))},C8=(e,t)=>!e?.trackedChange||e?.trackedChangeStory?.storyType!==v8?!1:a_(t?.rects).length>1,_8=e=>{const t=Number(e?.selection?.page);return!Number.isInteger(t)||t<1?null:t-1},S8=({id:e,threadId:t,comment:n,positionKey:r,positionEntry:o})=>{const i=$y(o?.pageIndex),s=n?.trackedChange?null:_8(n);return{id:e,threadId:t,comment:n,positionKey:r,positionEntry:o??null,pageIndex:i??s,isPrimary:!0}},k8=({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:r})=>{const o=a_(n?.rects);if(o.length<2)return[];const i=o.map(({pageIndex:l,rects:u})=>{const c=w8(u);return c?{pageIndex:l,rects:u,bounds:c}:null}).filter(Boolean);if(i.length<2)return[];const s=$y(n?.pageIndex),a=i.some(({pageIndex:l})=>l===s)?s:i[0]?.pageIndex??null;return i.map(({pageIndex:l,rects:u,bounds:c})=>{const d=l===a;return{id:d?r:y8(r,l),threadId:e?.commentId??t,comment:e,positionKey:t,pageIndex:l,isPrimary:d,positionEntry:{...n,pageIndex:l,rects:u,bounds:c}}})};const A8=({comment:e,positionKey:t,positionEntry:n,fallbackId:r})=>{const o=e?.trackedChange&&t&&r&&Array.isArray(e?.trackedChangePositionAliases)&&e.trackedChangePositionAliases.some(a=>b8(t,a)),i=e?.trackedChange&&e?.trackedChangeCanonicalId&&t&&r&&String(t)!==String(r),s=o||i?r:t??r;if(!s)return[];if(C8(e,n)&&t){const a=k8({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:s});if(a.length>0)return a}return[S8({id:s,threadId:e?.commentId??r,comment:e,positionKey:t,positionEntry:n})]};xt();var l_=()=>import("@superdoc/docx-engine"),pu=null,Rp=null;function I8(e){if(typeof e!="function")throw new TypeError("SuperDoc: the DOCX Engine loader must be a function");if(pu)throw new Error("SuperDoc: the DOCX Engine loader cannot change after loading has started");l_=e}async function E8(){if(!pu){const e=Promise.resolve().then(()=>l_()).then(t=>{const n=t&&typeof t=="object"&&"createSuperDocV2Integration"in t?t.createSuperDocV2Integration:null;if(typeof n!="function")throw new TypeError("SuperDoc: the DOCX Engine module does not export createSuperDocV2Integration");Rp=n});pu=e,e.catch(()=>{pu===e&&(pu=null,Rp=null)})}await pu}async function x8(){try{await E8()}catch(e){console.error("[SuperDoc] DOCX Engine failed to load; using the stub.",e)}}const kU=1;var T8="tc-comment:",R8="tc::body::";function e0(e){if(!e||typeof e!="object")return!1;const t=e.id??e.commentId;return typeof t!="string"?!1:t.startsWith(T8)}function uf(e){if(!e||e.trackedChange!==!0)return!1;const t=e.trackedChangeAnchorKey;return typeof t=="string"&&t.startsWith(R8)}function M8(){return{publish(){},recollect(){},reset(){},getLastEpoch(){return null},getLastPayload(){return null}}}function L8(){return{setContext(){},onRenderReadiness(){},hydrateNow(){},invalidate(){},reset(){},getDiagnostics(){return null}}}var P8=jl({name:"SuperDocV2IntegrationMissing",emits:["v2-editor-failed"],setup(e,{emit:t}){return Nn(()=>{t("v2-editor-failed",{reason:"v2-integration-unavailable",detail:"SuperDoc: the DOCX Engine runtime could not be constructed in this environment."})}),()=>Vr("div",{class:"superdoc-v2-integration-missing"})}});function t0(){return{version:1,capabilities:null,EditorComponent:P8,RulerComponent:null,createGeometryPublisher:M8,createReviewHydrationController:L8,isSyntheticTrackedChangeCommentLaneItem:e0,isV2SyntheticTrackedChangeRow:uf}}function D8(){if(!Rp)return t0();try{const e=t0(),t=Rp();return!t||typeof t!="object"||!t.EditorComponent?e:{version:typeof t.version=="number"?t.version:e.version,capabilities:t.capabilities??e.capabilities,EditorComponent:t.EditorComponent,RulerComponent:t.RulerComponent??e.RulerComponent,createGeometryPublisher:t.createGeometryPublisher??e.createGeometryPublisher,createReviewHydrationController:t.createReviewHydrationController??e.createReviewHydrationController,isSyntheticTrackedChangeCommentLaneItem:t.isSyntheticTrackedChangeCommentLaneItem??e.isSyntheticTrackedChangeCommentLaneItem,isV2SyntheticTrackedChangeRow:t.isV2SyntheticTrackedChangeRow??e.isV2SyntheticTrackedChangeRow}}catch(e){return console.error("[SuperDoc] DOCX Engine integration failed to construct; using the stub.",e),t0()}}function O8(){return D8()}function c_(){try{const e=globalThis.__superdocInteractionTrace;return e&&typeof e=="object"?e:null}catch{return null}}function u_(e,t,n=void 0){try{const r=c_();return!r||typeof r.startSpan!="function"?null:r.startSpan(e,t,n)}catch{return null}}function df(e,t=void 0){if(e)try{const n=c_();if(!n||typeof n.endSpan!="function")return;n.endSpan(e,t)}catch{}}function ec(e,t,n,r){const o=u_(e,t,n);if(!o)return r();try{const i=r();return i&&typeof i.then=="function"?i.then(s=>(df(o),s)).catch(s=>{throw df(o,{error:s instanceof Error?s.message:String(s)}),s}):(df(o),i)}catch(i){throw df(o,{error:i instanceof Error?i.message:String(i)}),i}}const F8=e=>!!e?.trackedChangeLink||!!e?.trackedChangeType||!!e?.trackedChangeDisplayType||!!e?.trackedChangeText||!!e?.deletedText||e?.trackedChange===!0,Mp=e=>e?.trackedChangeThreadParentId!=null?e.trackedChangeThreadParentId:e?.trackedChangeParentId!=null&&F8(e)?e.trackedChangeParentId:null,N8=(e,t=new Map)=>{const n=new Map,r=new Map,o=new Map,i=new Map,s=(l,u,c)=>{const d=l.get(u);d?d.push(c):l.set(u,[c])};e.forEach((l,u)=>{i.set(l,u),s(o,l.commentId,l),new Set([l.parentCommentId,l.threadingParentCommentId].filter(d=>d!=null).map(d=>String(d))).forEach(d=>s(n,d,l));const c=uf(l)?null:Mp(l);c!=null&&!l.parentCommentId&&s(r,String(c),l)});const a=new Map;for(const l of e){if(!l?.trackedChange||l.commentId==null)continue;const u=l.commentId,c=new Set([u]),d=[],h=typeof u=="string"?[...n.get(u)??[],...r.get(u)??[]]:[];for(const _ of h){const C=_.commentId;C===u||c.has(C)||(c.add(C),d.push(C))}for(let _=0;_<d.length;_+=1){const C=d[_];for(const k of typeof C=="string"?n.get(C)??[]:[]){const y=k.commentId;c.has(y)||(c.add(y),d.push(y))}}const m=[...c].flatMap(_=>o.get(_)??[]).sort((_,C)=>(i.get(_)??0)-(i.get(C)??0));m.sort((_,C)=>_===l?-1:C===l?1:Number(_.createdTime)-Number(C.createdTime));const p=t.get(u),v=p?.length===m.length&&m.every((_,C)=>p[C]===_)?p:m;a.set(u,v)}return a},B8=(e,t=new Map)=>{const n=new Map;for(const o of e){const i=new Set([o.parentCommentId,o.threadingParentCommentId,o.trackedChangeParentId,o.trackedChangeThreadParentId].filter(s=>s!=null).map(s=>String(s)));for(const s of i){const a=n.get(s);a?a.push(o):n.set(s,[o])}}const r=new Map;for(const[o,i]of n){const s=t.get(o);r.set(o,s?.length===i.length&&i.every((a,l)=>s[l]===a)?s:i)}return r};xt();var d_=class{constructor(){throw new Error("SuperDoc v2 beta: v1 editor-backed comment import paths are not available.")}},sa={getTrackChanges:()=>[],enumerateStructuralRowChanges:()=>[]},z8=Symbol("comments-plugin-disabled"),f_=()=>[],n0=()=>null,mu=()=>null,h_=()=>null,r0=({storyKey:e,rawId:t})=>`tc::${e}::${t}`,V8=/<br(?:\s[^>]*)?\s*\/?>/gi,H8=/<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi,j8=/<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi,U8=/<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g,G8=/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g,W8={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'},p_=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Object.is(e[o],t[o]))},K8=e=>{if(!Array.isArray(e))return null;const t=e.filter(n=>n&&typeof n=="object").map(n=>({excerpt:typeof n.excerpt=="string"?n.excerpt:"",label:typeof n.label=="string"?n.label:""}));return t.length>0?t:null},q8=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>p_(n,t[r])),Y8=e=>{if(!e||typeof e!="object")return null;const t=typeof e.src=="string"?e.src:null;if(!t||!t.startsWith("data:image/"))return null;const n=typeof e.contentType=="string"&&e.contentType.startsWith("image/")?e.contentType:null,r=typeof e.role=="string"?e.role:null,o=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:null,i=typeof e.height=="number"&&Number.isFinite(e.height)&&e.height>0?e.height:null,s=typeof e.alt=="string"&&e.alt.length>0?e.alt:"Tracked image preview";return{src:t,...n?{contentType:n}:{},...r?{role:r}:{},...o?{width:o}:{},...i?{height:i}:{},alt:s}},X8=e=>{const t=String(e).toLowerCase(),n=W8[t];if(n!==void 0)return n;const r=t.startsWith("#x")?16:t.startsWith("#")?10:null;if(!r)return null;const o=t.startsWith("#x")?t.slice(2):t.slice(1),i=Number.parseInt(o,r);if(!Number.isFinite(i))return null;try{return String.fromCodePoint(i)}catch{return null}},Z8=e=>e.replace(G8,(t,n)=>X8(n)??t),o0=e=>{const t=String(e??"");return!t||t==="<p></p>"?"":Z8(t.replace(V8,`
9
+ `).replace(j8,`
10
+ `).replace(H8,"").replace(U8,"")).replace(/\n{3,}/g,`
11
+
12
+ `).replace(/^\n+/,"").replace(/\n+$/,"")};const aa=cC("comments",()=>{const e={kind:"story",storyType:"body"},t=I=>{if(!I?.trackedChange)return!1;const M=I?.trackedChangeStory?.storyType;return M==null||M==="body"?!0:I?.trackedChangeAnchorKey?.startsWith?.("tc::body::")===!0},n=I=>I==null?null:r0({storyKey:"body",rawId:String(I)}),r=I=>{const M=He(I);if(!M?.startsWith("tc::"))return null;const $=M.indexOf("::",4);if($<=4)return null;const ie=M.slice(4,$),se=M.slice($+2);return!ie||!se?null:{storyKey:ie,rawId:se}},o=(I,M)=>M==null?null:r0({storyKey:I||"body",rawId:String(M)}),i=I=>{if(!I)return null;const M=I.sourceId?String(I.sourceId):"";return M?`word:structural:${M}`:I.id?String(I.id):null},s=hu(),a=Gr({name:"comments",readOnly:!1,allowResolve:!0,showResolved:!1}),l=()=>({ok:!1,reason:"read-only-document"}),u=()=>({ok:!1,reason:"resolve-disabled"}),c=()=>a.allowResolve===!1,d=()=>a.readOnly===!0,h=Gr({documentMode:"editing",commentsVisible:!1,trackChangesVisible:!1}),m=!1,p={},v=new WeakMap,_=new Map;let C=0;const k=()=>typeof window>"u"?!1:"__labsSuperDocV2PreviewDebug"in window,y=(I,M=null)=>{if(k()){if(M!==null){console.debug("[SuperDoc][comments-store]",I,M);return}console.debug("[SuperDoc][comments-store]",I)}},b=tp,T=ne(!1),R=ne(!1),P=ne(null),j=ne(!1),O=ne(null),V=ne(null),Q=ne(null),F=ne([]),N=ne([]),x=new Set([]),z=ne(!0),J=ne(""),X=ne([]);let ae=new Map;const pe=ke(()=>{const I=N8(X.value,ae);return ae=I,I}),Fe=I=>{const M=I?.commentId??null;return(M!=null?pe.value.get(M):null)??[I].filter(Boolean)};let fe=new Map;const ye=ke(()=>{const I=B8(X.value,fe);return fe=I,I}),le=ne(!1),Se=ne([]),re=ne({}),xe=ne(!1),$e=ne(0),st=ne([]),At=ne([]),Ee=ne(!1),Ge=ne(!1),qe=ne([]),Z=ne(null),S=ne(null),ee=ne(null),D=ne(null),U=Kr(null),H=ke(()=>h.documentMode==="viewing"),G=ke(()=>H.value?h.commentsVisible||h.trackChangesVisible:!0),te=Kr(null),Y=I=>{te.value=I??null},K=I=>{const M=I?.activeEditor?.v2Comments??null;return M||te.value},be=I=>I?.activeEditor?.editorVersion===2||te.value!==null,me=Kr(null),Ce=I=>{me.value=I??null},Pe=I=>{const M=I?.activeEditor?.v2TrackedChanges??null;return M||me.value},it=(I={})=>{const M={...a,...I};Object.assign(a,M),z.value=a.suppressInternalExternal||!1,I.comments&&I.comments.length&&(X.value=I.comments?.map($=>ia($))||[])},He=I=>I==null?null:String(I),Ct=I=>Array.isArray(I)?[...new Set(I.map(M=>He(M)).filter(Boolean))]:[],Yt=I=>He(I?.id??I?.changeId??I?.address?.entityId),St=I=>Ct([Yt(I),I?.changeId,I?.address?.entityId,I?.trackedChangeAnchorKey,I?.anchorKey,I?.address?.anchorKey,...Array.isArray(I?.trackedChangePositionAliases)?I.trackedChangePositionAliases:[],...Array.isArray(I?.sourceIds?.rsids)?I.sourceIds.rsids:[],I?.sourceIds?.wordIdDelete,I?.sourceIds?.wordIdInsert,...Array.isArray(I?.sourceIds?.wordIdOther)?I.sourceIds.wordIdOther:[]]),Ft=I=>new Set(St(I).flatMap(M=>{const $=r(M);return $?.rawId?[M,$.rawId]:[M]})),Nt=I=>{const M=new Set,$=[];for(const ie of I){const se=Yt(ie);if(se){if(M.has(se))continue;M.add(se)}$.push(ie)}return $},sn=I=>{if(!I?.trackedChange)return null;const M=r(I.trackedChangeAnchorKey);if(M?.storyKey)return M.storyKey;const $=I.trackedChangeStory;switch($?.storyType){case"body":return"body";case"headerFooterPart":return $.refId?`hf:${$.refId}`:null;case"footnote":return $.noteId?`fn:${$.noteId}`:null;case"endnote":return $.noteId?`en:${$.noteId}`:null;case"textbox":return $.textboxId?`textbox:${$.textboxId}`:null;default:return null}},_n=I=>I?.startsWith("hf:part:")?`hf:${I.slice(8)}`:I?.startsWith("headerFooterPart:")?`hf:${I.slice(17)}`:I,Qt=(I,M)=>{const $=_n(I),ie=_n(M);return!$||!ie||$===ie},Ye=(I,M)=>Qt(_n(sn(M)),_n(He(I?.storyKey))),Et=I=>{const M=He(I);return M?M.startsWith("imported:")?M:`imported:${M}`:null},Ot=I=>{const M=He(I);if(!M)return{key:null,entry:null};const $=re.value||{};if($[M]!==void 0)return{key:M,entry:$[M]};for(const[ie,se]of Object.entries($)){const de=He(se?.key),he=He(se?.threadId);if(de===M||he===M)return{key:ie,entry:se}}return{key:null,entry:null}},wn=(I,M)=>{if(!I||!M)return!1;const $=Math.max(Number(I.left),Number(M.left)),ie=Math.min(Number(I.right),Number(M.right)),se=Math.max(Number(I.top),Number(M.top)),de=Math.min(Number(I.bottom),Number(M.bottom));return[$,ie,se,de].every(Number.isFinite)&&ie>$&&de>se},Kt=(I,M)=>{if(!I||!M||I.kind!=="trackedChange"||M.kind!=="trackedChange"||I.storyKey&&M.storyKey&&I.storyKey!==M.storyKey)return!1;const $=Number(I.pageIndex),ie=Number(M.pageIndex);if(Number.isFinite($)&&Number.isFinite(ie)&&$!==ie)return!1;if(wn(I.bounds,M.bounds))return!0;const se=Number(I.start),de=Number(I.end),he=Number(M.start),ue=Number(M.end);return[se,de,he,ue].every(Number.isFinite)&&se===he&&de===ue},Sn=I=>{const{entry:M}=Ot(I);if(!M)return null;const $=X.value.filter(ie=>ie?.trackedChange?kt(ie).some(se=>{const{entry:de}=Ot(se);return Kt(M,de)}):!1);return $.length===1?$[0]:null},Pt=I=>I==null?null:X.value.find(M=>M.commentId==I||M.importedId==I||M.trackedChangeAnchorKey==I||M?.trackedChange&&Et(M.importedId)==I)||Sn(I),De=I=>I?.parentCommentId?Pt(I.parentCommentId):I,je=I=>I?.trackedChangeThreadParentId?I.trackedChangeThreadParentId:uf(I)&&I?.trackedChange===!0?null:Mp(I),Ke=I=>{const M=je(I);return M?!!Pt(M)?.trackedChange:!1},pt=I=>{if(!I)return null;const M=re.value||{};if(typeof I=="string"){if(M[I])return I;const he=Pt(I);if(!he)return I;const ue=he.commentId??null,Te=he.importedId??null,Ne=he.trackedChange?Et(Te):null,Oe=he.trackedChangeAnchorKey??null;return Oe&&M[Oe]?Oe:ue&&M[ue]?ue:Te&&M[Te]?Te:Ne&&M[Ne]?Ne:Oe??ue??Ne??Te??null}const $=I.commentId??null,ie=I.importedId??null,se=I.trackedChange?Et(ie):null,de=I.trackedChangeAnchorKey??null;return de&&M[de]?de:$&&M[$]?$:ie&&M[ie]?ie:se&&M[se]?se:de??$??se??ie??null},kt=I=>{if(I==null)return[];const M=typeof I=="object"?null:I,$=typeof I=="object"?I:Pt(I),ie=$?.trackedChange?Ct($?.trackedChangePositionAliases):[],se=_n(sn($)),de=new Set;return[M,pt($),$?.trackedChangeAnchorKey,$?.commentId,$?.importedId,$?.trackedChange?Et($?.importedId):null,...ie.flatMap(he=>[se&&!he.startsWith("tc::")?r0({storyKey:se,rawId:he}):null,he])].map(he=>He(he)).filter(he=>!he||de.has(he)?!1:(de.add(he),!0))},ft=(I,M)=>{const $=re.value||{},ie=typeof I=="object"?I:Pt(I),se=new Set;for(const de of[M,...kt(I)].map(he=>He(he)).filter(Boolean)){if(se.has(de))continue;se.add(de);const he=$[de];if(he!==void 0&&Ye(he,ie))return{key:de,entry:he}}return{key:null,entry:null}},an=I=>{I&&((I.resolvedTime!=null||I.resolvedById!=null||I.resolvedByEmail!=null||I.resolvedByName!=null)&&v.set(I,{resolvedTime:I.resolvedTime??null,resolvedById:I.resolvedById??null,resolvedByEmail:I.resolvedByEmail??null,resolvedByName:I.resolvedByName??null,trackedChangeDecision:I.trackedChangeDecision??null}),I.resolvedTime=null,I.resolvedById=null,I.resolvedByEmail=null,I.resolvedByName=null,I.trackedChangeDecision=null)},qt=I=>{if(!I)return!1;const M=v.get(I);return M?(I.resolvedTime=M.resolvedTime??Date.now(),I.resolvedById=M.resolvedById??null,I.resolvedByEmail=M.resolvedByEmail??null,I.resolvedByName=M.resolvedByName??null,I.trackedChangeDecision=M.trackedChangeDecision??null,!0):!1},cn=I=>typeof I?.getValues=="function"?I.getValues():{...I},hn=I=>{const M=I?.selection?.source;return M==null?!0:M===fu},oo=I=>!!I?.trackedChange||!!je(I),Jt=({documentId:I,editor:M}={})=>{if(!M?.state||!X.value?.length)return 0;const $=re.value||{};if(!Object.keys($).length)return 0;const ie=nt=>nt.find(ln=>$[ln]!==void 0)??null,se=new Set,de=new Map;if(X.value.forEach(nt=>{if(!nt?.trackedChange)return;if(I){const Vn=nt?.fileId??null;if(Vn&&Vn!==I)return}const ln=kt(nt),nn=ie(ln);nn&&(se.add(nn),de.set(nn,new Set(ln)))}),!se.size)return 0;const he=new Set(sa.getTrackChanges(M.state).map(({mark:nt})=>nt?.attrs?.id).filter(nt=>nt!=null).map(nt=>String(nt))),ue=typeof mu=="function"?mu(M):null;let Te=[];try{Te=ue?.getAll?.()??[]}catch{}const Ne=new Set(Te.map(nt=>nt?.anchorKey).filter(nt=>typeof nt=="string"&&nt.length>0)),Oe=new Set(Array.from(se).filter(nt=>{const ln=de.get(nt)??new Set([nt]);return Array.from(ln).some(nn=>Ne.has(nn))?!1:!Array.from(ln).some(nn=>he.has(nn))}));if(!Oe.size)return 0;const Qe=new Set;Oe.forEach(nt=>{(de.get(nt)??new Set([nt])).forEach(ln=>Qe.add(ln))});const ct=new Set(Oe);X.value.forEach(nt=>{const ln=ie(kt(nt));ln&&[je(nt),nt?.threadingParentCommentId,nt?.parentCommentId].map(nn=>He(nn)).filter(Boolean).some(nn=>Qe.has(nn))&&ct.add(ln)});const yt={...$};if(ct.forEach(nt=>{delete yt[nt]}),re.value=yt,O.value!==void 0&&O.value!==null){const nt=Pt(O.value),ln=new Set(kt(nt??O.value)),nn=[je(nt),nt?.threadingParentCommentId,nt?.parentCommentId].map(Vn=>He(Vn)).filter(Boolean);(Array.from(ln).some(Vn=>Qe.has(Vn))||nn.some(Vn=>Qe.has(Vn)))&&Lo()}return ct.size},Yn=I=>{const M=I?.state?.doc;if(!M||typeof M.descendants!="function")return null;const $=new Set,ie=new Set;return M.descendants(se=>{se.marks?.filter(ue=>ue?.type?.name==="commentMark").forEach(ue=>{[ue.attrs?.commentId,ue.attrs?.importedId].map(Te=>He(Te)).filter(Boolean).forEach(Te=>$.add(Te))});const de=se.type?.name;if(de!=="commentRangeStart"&&de!=="commentRangeEnd")return;const he=He(se.attrs?.["w:id"]);he&&ie.add(he)}),{liveMarkIds:$,resolvedAnchorIds:ie}},Nr=()=>{const I=s.documents;if(!Array.isArray(I))return null;for(const M of I){const $=typeof M?.getEditor=="function"?M.getEditor():null;if($?.state?.doc)return $}return null},io=({editor:I}={})=>{if(te.value)return 0;const M=Yn(I??Nr()),$=re.value||{},ie=new Set(Object.keys($));if(!M&&!ie.size)return 0;let se=0;return X.value.forEach(de=>{if(!hn(de)||oo(de))return;if(M){const ue=kt(de),Te=ue.some(Oe=>M.liveMarkIds.has(Oe)),Ne=ue.some(Oe=>M.resolvedAnchorIds.has(Oe));if(Te&&de.resolvedTime!=null){an(de),se+=1;return}!Te&&Ne&&de.resolvedTime==null&&qt(de)&&(se+=1);return}const{key:he}=ft(de);he&&ie.has(String(he))&&de.resolvedTime!=null&&(an(de),se+=1)}),se};Lt(re,()=>{io()}),Lt(X,()=>{io()},{deep:!1});const vo=I=>{if(!I)return null;const M=I.start??I.pos??I.from,$=I.end??I.to??M;return!Number.isFinite(M)||!Number.isFinite($)?null:{start:M,end:$}},$t=I=>ft(I).entry??null,Bn=(I,M={})=>{const $=typeof I=="object"?I:Pt(I);if(!$)return null;const ie=vo(ft(I).entry??null);if(!ie)return null;const se=s.getDocument($.fileId)?.getEditor?.()?.state?.doc;if(!se?.textBetween)return null;const de=M.separator??" ",he=se.textBetween(ie.start,ie.end,de,de);return M.trim===!1?he:he?.trim()},xi=(I,M={})=>{const $=$t(I);return $?{position:$,anchoredText:Bn(I,M)}:null},Is=I=>{if(!H.value)return!0;const M=De(I);return!M&&I?.parentCommentId?!1:M?.trackedChange||je(I)?h.trackChangesVisible:h.commentsVisible},so=(I,M)=>{const $=I?.activeEditor,ie=K(I);if(M==null){if(Lo(),ie){ie.setActiveComment(null);return}$?.commands?.setActiveComment({commentId:null});return}const se=Pt(M);if(se){if(O.value=se.commentId,Wu(se.commentId),ie){ie.setActiveComment(se.commentId);return}$?.commands?.setActiveComment({commentId:O.value})}},cr=({superdoc:I,params:M,broadcastChanges:$=!0,documentState:ie=void 0})=>{const se=u_("store.trackedChanges.handleUpdate","store-reconciliation",{event:M?.event??null,changeId:M?.changeId??null,documentId:M?.documentId??null});try{const{event:de,changeId:he,trackedChangeText:ue,trackedChangeType:Te,trackedChangeDisplayType:Ne,semanticColorKey:Oe,semanticColor:Qe,deletedText:ct,trackedChangeLabel:yt,trackedChangeDetailLines:nt,trackedChangeImagePreview:ln,authorId:nn,authorEmail:Vn,authorImage:Ut,date:Cn,author:Sr,importedAuthor:Kn,documentId:dr,coords:yr,trackedChangeStory:Bo,trackedChangeStoryKind:Rn,trackedChangeStoryLabel:at,trackedChangeAnchorKey:pn,trackedChangeCanonicalId:An,trackedChangePositionAliases:Ur,importedId:oi}=M,zo=he!=null?String(he):null,Ps=An!=null?String(An):null,ka=Object.prototype.hasOwnProperty.call(M,"trackedChangePositionAliases"),bi=ka?Ct(Ur):void 0,Vo=Object.prototype.hasOwnProperty.call(M,"importedId"),Po=Vo?oi!=null?String(oi):null:void 0,Aa=dr!=null?String(dr):null;if(!(Ne==="tableInsert"||Ne==="tableDelete")&&zo){const zt=Aa??(I?.activeEditor?.options?.documentId!=null?String(I.activeEditor.options.documentId):null),Hn=zt?s.getDocument(zt)?.getEditor?.():null,Br=ie!==void 0?ie:Hn?.state??I?.activeEditor?.state??null;if(Br){const{ranges:fr,ids:jo}=Uu(Br),os=sa.getTrackChanges(Br,zo),is=fr.length>0&&os.length>0&&El(os,fr),Ta=os.length===0&&jo.has(zo);if(is||Ta){Wf({suppressedIds:new Set([zo]),activeDocumentId:zt,superdoc:I,broadcastChanges:$});return}}}const Tl=Bo!==void 0||Rn!==void 0||at!==void 0||pn!==void 0,Ho=Tl?Bo??null:e,ut=Tl?Rn??null:"body",Di=Tl&&at!==void 0?at:"",Dt=pn!==void 0?pn??null:Tl?null:n(zo),Rl=typeof yt=="string"&&yt.length>0?yt:null,Ia=K8(nt),Ea=Y8(ln),Ac=No({documentId:dr,commentId:he,trackedChange:!0,trackedChangeText:ue,trackedChangeType:Te,trackedChangeDisplayType:Ne,semanticColorKey:Oe,semanticColor:Qe,deletedText:ct,trackedChangeLabel:Rl,trackedChangeDetailLines:Ia,trackedChangeImagePreview:Ea,createdTime:Cn,creatorId:nn??null,creatorName:Sr,creatorEmail:Vn,creatorImage:Ut,isInternal:!1,importedAuthor:Kn,...Vo?{importedId:Po}:{},trackedChangeStory:Ho,trackedChangeStoryKind:ut,trackedChangeStoryLabel:Di,trackedChangeAnchorKey:Dt,trackedChangeCanonicalId:Ps,...ka?{trackedChangePositionAliases:bi}:{},selection:{source:fu,selectionBounds:yr}}),Ml=()=>{const zt=Dt!=null?String(Dt):null;if(!zo)return null;const Hn=sn(Ac),Br=fr=>{if(!fr)return!1;const jo=fr.trackedChangeAnchorKey!=null?String(fr.trackedChangeAnchorKey):null,os=fr.commentId!=null?String(fr.commentId):null,is=fr.importedId!=null?String(fr.importedId):null,Ta=fr.trackedChangeCanonicalId!=null?String(fr.trackedChangeCanonicalId):null,Ku=kt(fr),qu=Qt(sn(fr),Hn);if(qu&&Ku.includes(zo))return!0;const Yu=new Set(bi??[]);if(qu&&Yu.size>0&&[os,is,Ta,jo,...Ku].filter(Boolean).some(Oi=>Yu.has(Oi)))return!0;const Xu=Ps&&Ps!==zo||Ta&&Ta!==os;return os===zo||!Xu&&(is===zo||Po!==void 0&&Po!=null&&is===Po)?!0:Xu?!1:zt&&jo?jo===zt:!1};return Aa?X.value.find(fr=>Br(fr)&&yo(fr,Aa)):X.value.find(Br)},Ll=zt=>{$&&($l(I,zt),Ti(he,zt,I))},Pl=(zt,Hn,Br)=>zt?.[Hn]==null&&Br==null||!zt||p_(zt[Hn],Br)?!1:(zt[Hn]=Br,!0),xa=zt=>{if(!zt)return!1;let Hn=!1;return Ho!=null&&(Hn=Pl(zt,"trackedChangeStory",Ho)||Hn),ut!=null&&(Hn=Pl(zt,"trackedChangeStoryKind",ut)||Hn),Di!==void 0&&Di!==""&&(Hn=Pl(zt,"trackedChangeStoryLabel",Di)||Hn),Dt!=null&&(Hn=Pl(zt,"trackedChangeAnchorKey",Dt)||Hn),Hn},ii=zt=>{const Hn={trackedChangeText:ue??null,trackedChangeType:Te??null,trackedChangeDisplayType:Ne??null,semanticColorKey:Oe??null,semanticColor:Qe??null,deletedText:ct??null,trackedChangeLabel:Rl,trackedChangeImagePreview:Ea,trackedChangeCanonicalId:Ps,creatorId:nn??null,creatorName:Sr??null,creatorEmail:Vn??null,creatorImage:Ut??null,createdTime:Cn??null};if(Vo&&(Hn.importedId=Po),ka){const fr=new Set([zt?.commentId,zt?.importedId,zt?.trackedChangeCanonicalId,zt?.trackedChangeAnchorKey,...kt(zt)].map(jo=>He(jo)).filter(Boolean));Hn.trackedChangePositionAliases=bi.some(jo=>fr.has(jo))?Ct([...Array.isArray(zt?.trackedChangePositionAliases)?zt.trackedChangePositionAliases:[],...bi]):bi}let Br=!1;for(const[fr,jo]of Object.entries(Hn))Br=Pl(zt,fr,jo)||Br;return zt&&!(zt.trackedChangeDetailLines==null&&Ia==null)&&!q8(zt.trackedChangeDetailLines,Ia)&&(zt.trackedChangeDetailLines=Ia,Br=!0),xa(zt)||Br},wo=zt=>{const Hn=!!(zt.resolvedTime||zt.resolvedById||zt.resolvedByEmail||zt.resolvedByName);return Hn&&an(zt),ii(zt)||Hn};if(de==="add"){const zt=Ml();if(zt){if(!wo(zt))return;Ll({type:b.UPDATE,comment:cn(zt)});return}lo({superdoc:I,comment:Ac,broadcastChanges:$})}else if(de==="update"){const zt=Ml();if(!zt||!wo(zt))return;Ll({type:b.UPDATE,comment:cn(zt)})}else if(de==="resolve"){const zt=Ml(),Hn={id:M.resolvedById??I?.user?.id??null,email:M.resolvedByEmail??I?.user?.email??null,name:M.resolvedByName??I?.user?.name??null,decision:M.decision??null,superdoc:I};zt&&!zt.resolvedTime&&zt.resolveComment({...Hn,reconciliationToken:r_})}}finally{df(se)}},Qo=(I=[])=>({insertedMark:I.find(({mark:M})=>M?.type?.name==="trackInsert")?.mark??null,deletionMark:I.find(({mark:M})=>M?.type?.name==="trackDelete")?.mark??null,formatMark:I.find(({mark:M})=>M?.type?.name==="trackFormat")?.mark??null}),Zi=({superdoc:I,editor:M,changeIds:$,broadcastChanges:ie=!0})=>{if(!I||!M?.state||!Array.isArray($)||!$.length)return;const se=M?.options?.documentId!=null?String(M.options.documentId):null;if(se)for(const de of new Set($.map(he=>he!=null?String(he):null).filter(Boolean))){const he=sa.getTrackChanges(M.state,de);if(!he.length)continue;const ue=n0({event:"update",marks:Qo(he),nodes:[],newEditorState:M.state,documentId:se,trackedChangesForId:he});ue&&(ue.trackedChangeStory=e,ue.trackedChangeStoryKind="body",ue.trackedChangeStoryLabel="",ue.trackedChangeAnchorKey=n(ue.changeId??de),cr({superdoc:I,params:ue,broadcastChanges:ie}))}},va=(I=null,M=null,$=null)=>{const ie=Number.isFinite(I);Z.value=ie?I:null,S.value=ie&&M!=null?String(M):null;const se=$??M;ee.value=ie&&se!=null?String(se):null},Qi=()=>{const I=Z.value;return Number.isFinite(I)?I:null},hl=()=>{Z.value=null,S.value=null,ee.value=null},Ti=(I,M,$,ie=1e3)=>{p[I]&&clearTimeout(p[I]),p[I]=setTimeout(()=>{$&&$.emit("comments-update",M),delete p[I]},ie)},ao=(I,M)=>{if(M?.source!=="document-editor")return null;const $=M?.documentId??null,ie=I?.activeEditor?.options?.documentId??null;if(!$||!ie||$!==ie)return null;let se;try{se=I?.activeEditor?.doc?.selection?.current}catch{return null}if(typeof se!="function")return null;try{return se()}catch{return null}},Ri=(I,M=null)=>{const $=K(I),ie=ao(I,s.activeSelection),se={type:b.PENDING,pendingSelection:ie};if(I.emit("comments-update",se),$){const he=$.getCapabilityState?.();return he&&he.canWrite===!1?{ok:!1,reason:he.reason}:Promise.resolve($.captureCurrentSelection?.()).then(ue=>{if(!ue?.ok)return{ok:!1,reason:ue?.reason??"editing-range-required",detail:ue?.detail};U.value=ue.target??null;const Te=$.documentId??I?.activeEditor?.options?.documentId??null;return D.value=No({selection:{source:fu,documentId:Te,page:1,selectionBounds:{}},documentId:Te,parentCommentId:null}),I.config.isInternal||(D.value.isInternal=!1),va(M,"pending"),Ls(null),O.value=D.value.commentId,{ok:!0}}).catch(ue=>({ok:!1,reason:"selection-capture-failed",detail:ue?.message??String(ue)}))}const de={...s.activeSelection};return de.selectionBounds={...de.selectionBounds},s.selectionPosition?.source&&s.selectionPosition.source!=="pdf"&&(s.selectionPosition.source=null),D.value=No({selection:de,documentId:de.documentId,parentCommentId:null}),I.config.isInternal||(D.value.isInternal=!1),I.activeEditor?.commands&&I.activeEditor.commands.insertComment({...D.value.getValues(),commentId:"pending",skipEmit:!0}),D.value.selection.source==="document-editor"&&s.selectionPosition&&(s.selectionPosition.source=fu),va(M,"pending"),Ls(null),O.value=D.value.commentId,{ok:!0}},_e=I=>{const M=ft(I).entry;return M?Number.isFinite(M.start)?M.start:Number.isFinite(M.pos)?M.pos:Number.isFinite(M.from)?M.from:Number.isFinite(M.to)?M.to:Number.isFinite(M.pageIndex)&&Number.isFinite(M?.bounds?.top)?M.pageIndex*1e6+M.bounds.top:null:null},ze=(I,M)=>(I.createdTime??0)-(M.createdTime??0),vt=(I,M)=>{const $=_e(I),ie=_e(M),se=Number.isFinite($),de=Number.isFinite(ie);return se&&de&&$!==ie?$-ie:se&&!de?-1:!se&&de?1:ze(I,M)},ot=I=>{const M=[],$=[],ie=new Map;return X.value.forEach(se=>{if(!Is(se))return;const de=Ke(se)?je(se):null,he=se.trackedChange?null:se.parentCommentId||de;se.resolvedTime?$.push(se):!he&&!se.resolvedTime?M.push({...se}):he&&(ie.has(he)||ie.set(he,[]),ie.get(he).push(se))}),{parentComments:M.sort(I),resolvedComments:$.sort(I)}},xn=ke(()=>ot(ze)),Tn=ke(()=>xn.value?.parentComments.some(I=>I.trackedChange&&!I.resolvedTime)??!1),_r=ke(()=>ot(vt)),jr=I=>x.includes(I),gi=ke(()=>s.documents),Ji=ke(()=>a),Es=(I,M)=>{const $=I.getContainerLocation(M);return{top:$.top+I.selectionBounds.top,left:$.left+I.selectionBounds.left}},No=({selection:I,documentId:M,parentCommentId:$,...ie})=>Yr({selection:I,documentId:M,parentCommentId:$,...ie}),Yr=({selection:I,documentId:M,parentCommentId:$,...ie})=>{let se;return M?se=s.getDocument(M):I&&(se=s.getDocument(I.documentId)),se||(se=s.documents[0]),ia({fileId:se.id,fileType:se.type,parentCommentId:$,creatorId:s.user.id,creatorEmail:s.user.email,creatorName:s.user.name,creatorImage:s.user.image,commentText:J.value,selection:I,...ie})},Jo=I=>{const M=!!D.value;J.value="",D.value=null,U.value=null,s.selectionPosition=null,M&&Lo(),!be(I)&&I?.activeEditor?.commands?.removeComment({commentId:"pending"})},$i=({superdoc:I,comment:M,skipEditorUpdate:$=!1,broadcastChanges:ie=!0,isHydration:se=!1})=>{if(d()&&!se)return l();const de=!$&&!se?K(I):null;if(de&&!M.trackedChange){const Ne=o0(D.value?J.value:M.commentText),Oe=D.value?U.value:null,Qe=M.parentCommentId?String(M.parentCommentId):(D.value,null);return(async()=>{try{return await(Qe?de.reply({parentCommentId:Qe,text:Ne}):de.commitPendingComment({text:Ne,target:Oe}))}catch(ct){return{ok:!1,reason:"adapter-threw",detail:ct?.message??String(ct)}}})().then(ct=>{if(!ei(de))return{ok:!1,reason:"adapter-stale"};if(!ct?.ok)return ie&&I.emit("comments-update",{type:b.PENDING,rejected:!0,reason:ct?.reason??"v2-create-failed",...ct?.committed?{committed:!0}:{}}),ct;const yt=ti({superdoc:I,adapter:de,documentId:de.documentId,items:ct.items});return D.value&&Jo(I),ie&&I.emit("comments-update",{type:b.ADD,comment:yt?.added?.getValues?.()??null}),{ok:!0,comment:yt?.added??null}})}let he=X.value.find(Ne=>Ne.commentId===O.value);he||(he=M);const ue=ia(M.getValues());D.value?ue.setText({text:J.value,suppressUpdate:!0}):ue.setText({text:M.commentText,suppressUpdate:!0}),ue.selection.source=D.value?.selection?.source??ue.selection.source,he&&(ue.isInternal=he.isInternal),I.config.isInternal||(ue.isInternal=!1),X.value.push(ue),Jo(I),!$&&!M.trackedChange&&I.activeEditor?.commands&&!M.parentCommentId&&I.activeEditor.commands.insertComment({...ue.getValues(),skipEmit:!0});const Te={type:b.ADD,comment:ue.getValues()};return ie&&($l(I,Te),I.emit("comments-update",Te)),{ok:!0,comment:ue}},Mi=({superdoc:I,comment:M,skipEditorUpdate:$=!1,broadcastChanges:ie=!0})=>$i({superdoc:I,comment:M,skipEditorUpdate:$,broadcastChanges:ie}),lo=({superdoc:I,comment:M,skipEditorUpdate:$=!1,broadcastChanges:ie=!0})=>$i({superdoc:I,comment:M,skipEditorUpdate:$,broadcastChanges:ie,isHydration:!0}),$o=({commentId:I,superdoc:M})=>{if(d())return Promise.resolve(l());const $=X.value.findIndex(Oe=>Oe.commentId===I),ie=X.value[$];if(!ie)return Promise.resolve({ok:!1,reason:"comment-not-found"});const{commentId:se,importedId:de}=ie,{fileId:he}=ie,ue=K(M);if(ue&&!ie.trackedChange)return(async()=>{try{return await ue.delete({commentId:se})}catch(Oe){return{ok:!1,reason:"adapter-threw",detail:Oe?.message??String(Oe)}}})().then(Oe=>ei(ue)?Oe?.ok?(ti({superdoc:M,adapter:ue,documentId:ue.documentId??he,items:Oe.items}),M.emit("comments-update",{type:b.DELETED,comment:ie.getValues(),changes:[{key:"deleted",commentId:se,fileId:he}]}),{ok:!0}):(M.emit("comments-update",{type:b.DELETED,rejected:!0,comment:ie.getValues(),reason:Oe?.reason??"v2-delete-failed",...Oe?.committed?{committed:!0}:{}}),Oe):{ok:!1,reason:"adapter-stale"});M.activeEditor?.commands?.removeComment({commentId:se,importedId:de}),X.value.splice($,1);const Te=X.value.filter(Oe=>Oe.parentCommentId===se).map(Oe=>Oe.commentId||Oe.importedId);X.value=X.value.filter(Oe=>!Te.includes(Oe.commentId)),(O.value===se||Te.includes(O.value))&&Lo();const Ne={type:b.DELETED,comment:ie.getValues(),changes:[{key:"deleted",commentId:se,fileId:he}]};return M.emit("comments-update",Ne),$l(M,Ne),Promise.resolve({ok:!0})},Xr=async({superdoc:I,adapter:M,fileId:$,operation:ie,eventType:se,rejectionFallbackReason:de,rejectionEventExtras:he={},validateOutcome:ue,successEventBuilder:Te})=>{let Ne;try{Ne=await ie()}catch(yt){Ne={ok:!1,reason:"adapter-threw",detail:yt?.message??String(yt)}}if(!ei(M))return{ok:!1,reason:"adapter-stale"};if(!Ne?.ok){const yt={type:se,rejected:!0,reason:Ne?.reason??de,...Ne?.committed?{committed:!0}:{},...Ne?.code!==void 0?{code:Ne.code}:{},...Ne?.detail!==void 0?{detail:Ne.detail}:{},...he};return I?.emit?.("comments-update",yt),Ne}const Oe=ue?.({outcome:Ne});if(Oe?.ok===!1){const yt={ok:!1,committed:Oe.committed??!0,reason:Oe.reason??de,...Oe.code!==void 0?{code:Oe.code}:{},...Oe.detail!==void 0?{detail:Oe.detail}:{}},nt={type:se,rejected:!0,reason:yt.reason,...yt.committed?{committed:!0}:{},...yt.code!==void 0?{code:yt.code}:{},...yt.detail!==void 0?{detail:yt.detail}:{},...he};return I?.emit?.("comments-update",nt),yt}const Qe=ti({superdoc:I,adapter:M,documentId:M.documentId??$,items:Ne.items??[]}),ct=Te?.({outcome:Ne,reconciled:Qe})??null;return ct&&I?.emit?.("comments-update",ct),{ok:!0,items:Ne.items??[],reconciled:Qe}},ur=({outcome:I,adapter:M,fileId:$})=>(I.items??[]).map(ie=>M.mapV2CommentToUseCommentInput(ie,{fileId:$,fileType:null})).filter(Boolean),Li=I=>{const M=I?.commentId??I?.importedId;return M!=null?String(M):null},pc=I=>I?.parentCommentId!=null?String(I.parentCommentId):null,Lu=({outcome:I,adapter:M,fileId:$,commentId:ie,expectedResolved:se,operation:de})=>{const he=ie!=null?String(ie):null,ue=ur({outcome:I,adapter:M,fileId:$}),Te=ue.find(nt=>Li(nt)===he)??null,Ne=Te?.parentCommentId?ue.find(nt=>Li(nt)===pc(Te))??null:Te,Oe=Li(Ne);if(!Ne||!Oe)return{ok:!1,reason:`v2-${de}-refresh-missing`,detail:`comment ${he} was absent from the refreshed v2 comment list after ${de}`};const Qe=[Ne,...ue.filter(nt=>pc(nt)===Oe)],ct=nt=>!!nt?.resolvedTime;if(Qe.filter(nt=>ct(nt)!==se).length===0)return{ok:!0};const yt=ct(Ne);return Qe.some(nt=>ct(nt)!==yt)?{ok:!1,reason:`v2-${de}-refresh-split-thread`,detail:{rootId:Oe,expected:se?"resolved":"open",observed:Qe.map(nt=>({commentId:Li(nt),parentCommentId:pc(nt),status:ct(nt)?"resolved":"open"}))}}:{ok:!1,reason:se?`v2-${de}-refresh-still-open`:`v2-${de}-refresh-still-resolved`,detail:`comment ${Oe} remained ${yt?"resolved":"open"} after ${de}`}},xs=async({superdoc:I,parentCommentId:M,text:$}={})=>{if(d())return l();const ie=K(I);if(!ie)return{ok:!1,reason:"v2-comments-adapter-missing"};const se=M!=null?String(M):null;if(!se)return{ok:!1,reason:"parent-comment-id-missing"};const de=o0($);if(de.length===0)return{ok:!1,reason:"comment-text-empty"};const he=X.value.find(ue=>String(ue.commentId)===se);return Xr({superdoc:I,adapter:ie,fileId:he?.fileId??ie.documentId??null,operation:()=>ie.reply({parentCommentId:se,text:de}),eventType:b.ADD,rejectionFallbackReason:"v2-reply-failed",rejectionEventExtras:he?{comment:cn(he)}:{},successEventBuilder:({reconciled:ue})=>({type:b.ADD,comment:ue?.added?.getValues?.()??null})})},Mo=async({superdoc:I,commentId:M,text:$}={})=>{if(d())return l();const ie=K(I);if(!ie)return{ok:!1,reason:"v2-comments-adapter-missing"};const se=M!=null?String(M):null;if(!se)return{ok:!1,reason:"comment-id-missing"};const de=o0($);if(de.length===0)return{ok:!1,reason:"comment-text-empty"};const he=X.value.find(ue=>String(ue.commentId)===se);return Xr({superdoc:I,adapter:ie,fileId:he?.fileId??ie.documentId??null,operation:()=>ie.edit({commentId:se,text:de}),eventType:b.UPDATE,rejectionFallbackReason:"v2-edit-failed",rejectionEventExtras:he?{comment:cn(he),changes:[{key:"text",value:de}]}:{},successEventBuilder:()=>{const ue=X.value.find(Te=>String(Te.commentId)===se)??he;return ue?{type:b.UPDATE,comment:cn(ue),changes:[{key:"text",value:ue.commentText??de}]}:null}})},mc=async({superdoc:I,commentId:M}={})=>{if(d())return l();if(c())return u();const $=K(I);if(!$)return{ok:!1,reason:"v2-comments-adapter-missing"};const ie=M!=null?String(M):null;if(!ie)return{ok:!1,reason:"comment-id-missing"};const se=X.value.find(ue=>String(ue.commentId)===ie),de=se?.fileId??$.documentId??null,he=await Xr({superdoc:I,adapter:$,fileId:de,operation:()=>$.resolve({commentId:ie}),eventType:b.RESOLVED,rejectionFallbackReason:"v2-resolve-failed",rejectionEventExtras:se?{comment:cn(se)}:{},validateOutcome:({outcome:ue})=>Lu({outcome:ue,adapter:$,fileId:de,commentId:ie,expectedResolved:!0,operation:"resolve"}),successEventBuilder:()=>{const ue=X.value.find(Te=>String(Te.commentId)===ie)??se;return ue?{type:b.RESOLVED,comment:cn(ue)}:null}});if(he?.ok){const Te=!!X.value.find(Oe=>String(Oe.commentId)===ie)?.resolvedTime,Ne=O.value!=null?String(O.value):null;Te&&Ne===ie&&Lo()}return he},ya=async({superdoc:I,commentId:M}={})=>{if(d())return l();if(c())return u();const $=K(I);if(!$)return{ok:!1,reason:"v2-comments-adapter-missing"};const ie=M!=null?String(M):null;if(!ie)return{ok:!1,reason:"comment-id-missing"};const se=X.value.find(he=>String(he.commentId)===ie),de=se?.fileId??$.documentId??null;return Xr({superdoc:I,adapter:$,fileId:de,operation:()=>$.reopen({commentId:ie}),eventType:b.UPDATE,rejectionFallbackReason:"v2-reopen-failed",rejectionEventExtras:se?{comment:cn(se),changes:[{key:"resolvedTime",value:null}]}:{},validateOutcome:({outcome:he})=>Lu({outcome:he,adapter:$,fileId:de,commentId:ie,expectedResolved:!1,operation:"reopen"}),successEventBuilder:()=>{const he=X.value.find(ue=>String(ue.commentId)===ie);return!he||he.resolvedTime?null:{type:b.UPDATE,comment:cn(he),changes:[{key:"resolvedTime",value:null}]}}})},ei=I=>I?te.value===I:!1,Wn=I=>I?me.value===I:!1,jf=({superdoc:I,commentsAdapter:M,trackedChangesAdapter:$,documentId:ie,commentItems:se,trackedChangeItems:de,trackedList:he,patch:ue}={})=>ec("store.reviewSnapshot.apply","store-reconciliation",{commentItemCount:Array.isArray(se)?se.length:null,trackedItemCount:Array.isArray(de)?de.length:null},()=>{if(!ei(M))return{ok:!1,reason:"comments-adapter-stale"};if(!Wn($))return{ok:!1,reason:"tracked-changes-adapter-stale"};const Te=ie!=null?String(ie):null,Ne=I?.activeEditor?.documentId??I?.activeEditor?.options?.documentId??null;if(!Te)return{ok:!1,reason:"document-mismatch"};for(const yt of[M.documentId,$.documentId,Ne])if(yt==null||String(yt)!==Te)return{ok:!1,reason:"document-mismatch"};if(!Array.isArray(se)||!Array.isArray(de))return{ok:!1,reason:"items-invalid"};if(he?.complete!==!1||!["review-snapshot","visible-window"].includes(he?.visibleWindowSource))return{ok:!1,reason:"tracked-list-not-partial-visible-window"};if(typeof M.mapV2CommentToUseCommentInput!="function"||typeof $.mapV2TrackedChangeToCommentParams!="function")return{ok:!1,reason:"adapter-mapper-missing"};const Oe=(Te?s.getDocument(Te):null)?.type??null;let Qe,ct;try{Qe=se.filter(yt=>!e0(yt)).map(yt=>M.mapV2CommentToUseCommentInput(yt,{fileId:Te,fileType:Oe})).filter(Boolean),ct=de.map(yt=>$.mapV2TrackedChangeToCommentParams(yt)).filter(Boolean)}catch(yt){return{ok:!1,reason:"mapper-failed",detail:yt?.message??String(yt)}}return typeof ue!="function"?{ok:!1,reason:"patch-missing"}:(ue(()=>{_a({superdoc:I,adapter:$,documentId:Te,items:de,preparedParams:ct,pruneStale:!1}),ti({superdoc:I,adapter:M,documentId:Te,items:se,preparedInputs:Qe})}),{ok:!0,commentItems:Qe.length,trackedItems:ct.length})}),Ts=async({superdoc:I,adapter:M,documentId:$}={})=>ec("store.comments.hydrateFromV2","comments-list",{documentId:$??null},async()=>{const ie=M??K(I);if(!ie||typeof ie.refresh!="function")return{ok:!1,reason:"adapter-missing"};let se;try{se=await ie.refresh()}catch(de){return{ok:!1,reason:"adapter-threw",detail:de?.message??String(de)}}return ei(ie)?se?.ok?(ti({superdoc:I,adapter:ie,documentId:$,items:se.items??[]}),{ok:!0,items:se.items??[]}):se:{ok:!1,reason:"adapter-stale"}}),ti=({superdoc:I,adapter:M,documentId:$,items:ie,preparedInputs:se=null}={})=>ec("store.comments.reconcile","store-reconciliation",{documentId:$??null,itemCount:Array.isArray(ie)?ie.length:null},()=>{if(!M||!Array.isArray(ie))return{added:null};if(!ei(M))return{added:null,dropped:"adapter-stale"};const de=$??M.documentId??null,he=de!=null?String(de):null,ue=(de?s.getDocument(de):null)?.type??null,Te=at=>typeof at!="string"?!0:at.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi," ").trim().length===0,Ne=at=>!at||at.trackedChange===!0||!at.trackedChangeThreadParentId||at.parentCommentId?!1:Te(at.commentText),Oe=O.value!=null?String(O.value):null,Qe=Oe?X.value.find(at=>String(at.commentId)===Oe)??null:null,ct=Qe!=null&&D.value!=null&&(Qe===D.value||D.value.commentId!=null&&String(Qe.commentId??"")===String(D.value.commentId)),yt=Qe!=null&&!ct&&Qe.trackedChange!==!0&&!uf(Qe)&&(he==null||Qe.fileId==null||String(Qe.fileId)===he),nt=new Map,ln=new Map,nn=[],Vn=Array.isArray(se)?se:ie.filter(at=>!e0(at)).map(at=>M.mapV2CommentToUseCommentInput(at,{fileId:de,fileType:ue})).filter(Boolean);for(const at of Vn){if(Ne(at)){ln.set(String(at.commentId),String(at.trackedChangeThreadParentId)),y("hydrate:drop-v2-sidecar-comment",{commentId:at.commentId??null,importedId:at.importedId??null,parentCommentId:at.parentCommentId??null,trackedChangeParentId:at.trackedChangeParentId??null,trackedChangeThreadParentId:at.trackedChangeThreadParentId??null,trackedChangeSide:at.trackedChangeSide??null,commentText:at.commentText??null});continue}nn.push(at)}for(const at of nn){const pn=at.parentCommentId!=null?String(at.parentCommentId):null,An=pn?ln.get(pn):null;An&&(at.threadingParentCommentId=An,at.trackedChangeThreadParentId==null&&(at.trackedChangeThreadParentId=An));const Ur=at.commentId!=null?String(at.commentId):null;Ur&&nt.set(Ur,at)}const Ut=at=>{if(he==null)return!0;const pn=at?.fileId!=null?String(at.fileId):null;return pn==null?!0:pn===he},Cn=D.value?.commentId!=null?String(D.value.commentId):null,Sr=at=>!at||!D.value?!1:at===D.value||Cn!=null&&String(at.commentId??"")===Cn,Kn=at=>!at||Sr(at)||at.trackedChange===!0||uf(at)?!1:at.commentId!=null,dr=(at,pn)=>{at.commentText=pn.commentText??at.commentText,at.isInternal=typeof pn.isInternal=="boolean"?pn.isInternal:at.isInternal,typeof pn.resolvedTime=="number"?(at.resolvedTime=pn.resolvedTimeWasSynthesized===!0&&typeof at.resolvedTime=="number"?at.resolvedTime:pn.resolvedTime,at.resolvedByEmail=pn.resolvedByEmail??null,at.resolvedByName=pn.resolvedByName??null):(at.resolvedTime=null,at.resolvedByEmail=null,at.resolvedByName=null),pn.parentCommentId!==void 0?at.parentCommentId=pn.parentCommentId:delete at.parentCommentId,pn.trackedChangeParentId!==void 0?at.trackedChangeParentId=pn.trackedChangeParentId:delete at.trackedChangeParentId,pn.trackedChangeThreadParentId!==void 0?at.trackedChangeThreadParentId=pn.trackedChangeThreadParentId:at.trackedChangeThreadParentId=void 0,pn.trackedChangeSide!==void 0?at.trackedChangeSide=pn.trackedChangeSide:delete at.trackedChangeSide,pn.threadingParentCommentId!==void 0?at.threadingParentCommentId=pn.threadingParentCommentId:delete at.threadingParentCommentId},yr=[],Bo=new Set,Rn=[];for(const at of X.value){if(!Kn(at)||!Ut(at)){yr.push(at);continue}const pn=String(at.commentId),An=nt.get(pn);An&&(dr(at,An),Bo.add(pn),yr.push(at))}for(const[at,pn]of nt.entries()){if(Bo.has(at))continue;const An=ia(pn);yr.push(An),Rn.push(An)}return X.value=yr,yt&&Oe&&!yr.some(at=>String(at.commentId)===Oe)&&Lo(),{added:Rn[Rn.length-1]??null}}),vi=I=>{Jo(I)},pl=I=>typeof I!="string"?null:I.replace(/\s*\(imported\)\s*$/u,"").trim()||null,es=I=>{if(!I)return null;try{if(I.isDestroyed===!0)return null;const M=I.view;if(!M||M.isDestroyed===!0||M.destroyed===!0)return null;const $=M.state;return $?{view:M,state:$}:null}catch{return null}},Pu=I=>I!=null&&String(I).length>0?String(I):null,ml=I=>{const M=Pu(I),$=M?[[M,_.get(M)]]:Array.from(_.entries());let ie=0;for(const[se,de]of $)de&&(_.delete(se),de.timeoutHandle!==null&&de.timeoutHandle!==void 0&&clearTimeout(de.timeoutHandle),ie+=1);return ie},gl=I=>{const M=es(I);if(!M)return null;let $=[];try{$=sa.getTrackChanges(M.state)??[]}catch{return null}const ie=sa?.enumerateStructuralRowChanges;let se=[];if(typeof ie=="function")try{se=ie(M.state)??[]}catch{se=[]}let de=[];if(typeof mu=="function")try{de=mu(I)?.getAll?.()??[]}catch{de=[]}return{...M,trackedChanges:$,structuralChanges:se,storySnapshots:de}},Uf=(I,M,$=null)=>{if(!I||!M)return!1;const ie=$??gl(I);return ie?(Du(I,M,ie.trackedChanges,{editorState:ie.state,editorView:ie.view}),Pi({superdoc:M,editor:I,snapshots:ie.storySnapshots,documentState:ie.state,resolveFromEditor:!1}),Cl({superdoc:M,editor:I,structuralChanges:ie.structuralChanges}),!0):!1},ba=I=>{if(!I||_.get(I.documentId)!==I)return!1;try{const M=I.editor?.options?.documentId;if(M!=null&&String(M)!==I.documentId)return!1;const $=s.getDocument(I.documentId);if(!$||$.getEditor?.()!==I.editor)return!1}catch{return!1}return!0},vl=I=>{if(!ba(I))return _.get(I?.documentId)===I&&_.delete(I.documentId),!1;const M=gl(I.editor);if(!M||!ba(I))return _.get(I.documentId)===I&&_.delete(I.documentId),!1;try{return Uf(I.editor,I.superdoc,M)}finally{_.get(I.documentId)===I&&_.delete(I.documentId)}},ts=({editor:I,superdoc:M,documentId:$,defer:ie=!0})=>{const se=Pu($);if(!se||!I||!M)return!1;ml(se);const de={documentId:se,editor:I,superdoc:M,generation:++C,timeoutHandle:null};return _.set(se,de),ie?(de.timeoutHandle=setTimeout(()=>{de.timeoutHandle=null,vl(de)},0),!0):vl(de)};function yi(I){const M=I!=null?String(I):null;if(!M)return;ml(M);const $=X.value.filter(de=>Ca(de,M,{allowSingleDocumentMismatch:!0}));if(!$.length)return;const ie=new Set;if($.forEach(de=>{kt(de).forEach(he=>ie.add(he))}),X.value=X.value.filter(de=>!$.includes(de)),ie.size){const de={...re.value||{}};ie.forEach(he=>{delete de[he]}),re.value=de}const se=O.value!=null?String(O.value):null;se&&ie.has(se)&&Lo()}function Gf(I){yi(I)}const wa=async({superdoc:I,editor:M,comments:$,documentId:ie,replacedFile:se=!1})=>{const de=s.getDocument(ie);if(de?.commentThreadingProfile&&(de.commentThreadingProfile.value=M?.converter?.commentThreadingProfile||null),se&&Gf(ie),$.forEach(he=>{const ue=Array.isArray(he.elements)?he.elements:[],Te=Qf(ue);if(!Te&&!he.trackedChange)return;const Ne=pl(he.creatorName),Oe=Ne?`${Ne} (imported)`:null;lo({superdoc:I,comment:ia({fileId:ie,fileType:de.type,docxCommentJSON:ue.length?ue:null,commentId:he.commentId,isInternal:!1,parentCommentId:he.parentCommentId,trackedChangeParentId:he.trackedChangeParentId,trackedChangeThreadParentId:he.trackedChangeThreadParentId,creatorId:null,creatorName:Ne,createdTime:he.createdTime,creatorEmail:he.creatorEmail,importedAuthor:{...Oe?{name:Oe}:{},email:he.creatorEmail},commentText:Te,resolvedTime:he.isDone?Date.now():null,resolvedById:null,resolvedByEmail:he.isDone?he.creatorEmail:null,resolvedByName:he.isDone?Oe||"(Imported)":null,trackedChange:he.trackedChange||!1,trackedChangeText:he.trackedChangeText,trackedChangeType:he.trackedChangeType,trackedChangeDisplayType:he.trackedChangeDisplayType,deletedText:he.trackedDeletedText,origin:he.origin||"word",threadingMethod:he.threadingMethod,threadingStyleOverride:he.threadingStyleOverride,threadingParentCommentId:he.threadingParentCommentId,originalXmlStructure:he.originalXmlStructure})})}),se){ts({editor:M,superdoc:I,documentId:ie,defer:!1});return}ts({editor:M,superdoc:I,documentId:ie})},Du=(I,M,$=null,ie={})=>{const{reopenResolved:se=!1,refreshExisting:de=!1,broadcastChanges:he=!0,editorState:ue=null,editorView:Te=null}=ie,Ne=ue?{state:ue,view:Te}:es(I);if(!Ne?.state)return;const Oe=Ne.state,Qe=$??sa.getTrackChanges(Oe),ct=g8(Qe),yt=I?.options?.documentId!=null?String(I.options.documentId):null;if(!yt)return;const nt=new Set,ln=new Map;X.value.forEach(Kn=>{if(!Kn?.trackedChange||!yo(Kn,yt)||!t(Kn))return;const dr=[Kn.commentId,Kn.importedId].map(yr=>yr!=null?String(yr):null).filter(Boolean);if(Kn.resolvedTime){se||dr.forEach(yr=>nt.add(yr));return}dr.forEach(yr=>{ln.set(yr,Kn),de||nt.add(yr)})});const nn=new Map;for(const Kn of Qe){const dr=Kn.mark.attrs.id;nn.has(dr)||nn.set(dr,[]),nn.get(dr).push(Kn)}const Vn=yt,Ut=new Set;ct.forEach(({insertedMark:Kn,deletionMark:dr,formatMark:yr})=>{const Bo=Kn?.mark.attrs.id||dr?.mark.attrs.id||yr?.mark.attrs.id;if(Bo==null)return;const Rn=String(Bo);if(Ut.has(Rn)||(Ut.add(Rn),!de&&nt.has(Rn)))return;const at=ln.get(Rn),pn={...Kn&&{insertedMark:Kn.mark},...dr&&{deletionMark:dr.mark},...yr&&{formatMark:yr.mark}},An=n0({event:at?"update":"add",marks:pn,nodes:[],newEditorState:Oe,documentId:Vn,trackedChangesForId:nn.get(Bo)||[]});if(An){const Ur=n(An.changeId??Bo);An.trackedChangeStory=e,An.trackedChangeStoryKind="body",An.trackedChangeStoryLabel="",An.trackedChangeAnchorKey=Ur,cr({superdoc:M,params:An,broadcastChanges:he,documentState:Oe}),at||(nt.add(Rn),An.changeId!=null&&nt.add(String(An.changeId)),An.importedId!=null&&nt.add(String(An.importedId)))}});const Cn=Ne.view;try{if(!Cn||I.view!==Cn||Cn.isDestroyed===!0||Cn.destroyed===!0)return}catch{return}const{tr:Sr}=Oe;Sr.setMeta(z8,{type:"force"}),Cn.dispatch(Sr)},Wf=({suppressedIds:I,activeDocumentId:M,superdoc:$=null,broadcastChanges:ie=!0})=>{if(!(I instanceof Set)||!I.size||!M)return;const se=[];if(X.value=X.value.filter(ue=>{if(!ue?.trackedChange||!t(ue)||Al(ue)||!yo(ue,M))return!0;const Te=ue.commentId!=null?String(ue.commentId):null,Ne=ue.importedId!=null?String(ue.importedId):null;return Te&&I.has(Te)||Ne&&I.has(Ne)?(se.push(ue),!1):!0}),!se.length)return;const de=new Set;se.forEach(ue=>{ue.commentId!=null&&de.add(String(ue.commentId)),ue.importedId!=null&&de.add(String(ue.importedId));const Te=cn(ue),Ne={type:b.DELETED,comment:Te,changes:[{key:"deleted",commentId:Te.commentId,fileId:Te.fileId}]};ie&&($l($,Ne),$?.emit?.("comments-update",Ne))});const he=O.value!=null?String(O.value):null;he&&de.has(he)&&Lo()},yl=I=>I?I.fileId!=null?String(I.fileId):I.documentId!=null?String(I.documentId):I.selection?.documentId!=null?String(I.selection.documentId):null:null,gc=()=>{const I=Array.isArray(s.documents)?s.documents:s.documents?.value;return Array.isArray(I)?I:[]},Ou=()=>{const I=gc();return I.length!==1?null:I[0]?.id!=null?String(I[0].id):null},Ca=(I,M,$={})=>{const{allowSingleDocumentMismatch:ie=!1}=$;if(!M)return!1;const se=yl(I);if(se){if(se===M)return!0;const de=Ou();return ie&&de===M}return Ou()===M},yo=(I,M)=>Ca(I,M,{allowSingleDocumentMismatch:!0}),bl=I=>{const M=typeof I=="string"?I.toLowerCase():"";return M?M==="insert"||M==="insertion"||M==="trackinsert"||M==="tableinsert"||M==="paragraphsplit"?"insertion":M==="delete"||M==="deletion"||M==="trackdelete"||M==="tabledelete"?"deletion":M:null},Rs=({comment:I,decision:M}={})=>{const $=M==="accept"||M==="reject"?M:null;if(!$)return!1;const ie=bl(I?.trackedChangeDisplayType)??bl(I?.trackedChangeType);return $==="accept"&&ie==="insertion"||$==="reject"&&ie==="deletion"},vc=(I,M,$,ie=null,{broadcastChanges:se=!0}={})=>ec("store.trackedChanges.pruneStaleComments","store-reconciliation",{activeDocumentId:$??null,liveIdCount:I instanceof Set?I.size:null,liveAnchorKeyCount:M instanceof Set?M.size:null},()=>{if(!(I instanceof Set)||!$)return;const de=new Set,he=[],ue=[...X.value];if(X.value=X.value.filter(Qe=>{if(!Qe?.trackedChange||!yo(Qe,$))return!0;const ct=Qe.commentId!=null?String(Qe.commentId):null,yt=Qe.importedId!=null?String(Qe.importedId):null,nt=Qe.trackedChangeAnchorKey!=null?String(Qe.trackedChangeAnchorKey):null,ln=!!(ct&&I.has(ct)),nn=!!(yt&&I.has(yt)),Vn=!!(nt&&M?.has(nt));if(!ct&&!yt&&!nt||ln||nn||Vn||Qe.resolvedTime)return!0;const Ut=v.get(Qe);return Ut?(Qe.resolvedTime=Ut.resolvedTime??Date.now(),Qe.resolvedById=Ut.resolvedById??null,Qe.resolvedByEmail=Ut.resolvedByEmail??null,Qe.resolvedByName=Ut.resolvedByName??null,Qe.trackedChangeDecision=Ut.trackedChangeDecision??null,he.push(Qe),!0):(ct&&de.add(ct),yt&&de.add(yt),!1)}),he.forEach(Qe=>{const ct=cn(Qe),yt={type:b.UPDATE,comment:ct};se&&($l(ie,yt),ie?.emit?.("comments-update",yt))}),!de.size)return;let Te=!0;for(;Te;)Te=!1,X.value=X.value.filter(Qe=>{if(!yo(Qe,$))return!0;const ct=Qe.parentCommentId!=null?String(Qe.parentCommentId):null,yt=je(Qe)!=null?String(je(Qe)):null;if(!(ct&&de.has(ct)||yt&&de.has(yt))||Qe.resolvedTime)return!0;const nt=Qe.commentId!=null?String(Qe.commentId):null,ln=Qe.importedId!=null?String(Qe.importedId):null;return nt&&de.add(nt),ln&&de.add(ln),Te=!0,!1});ue.filter(Qe=>{if(!yo(Qe,$))return!1;const ct=Qe.commentId!=null?String(Qe.commentId):null,yt=Qe.importedId!=null?String(Qe.importedId):null;return ct&&de.has(ct)||yt&&de.has(yt)}).forEach(Qe=>{const ct=cn(Qe),yt={type:b.DELETED,comment:ct,changes:[{key:"deleted",commentId:ct.commentId,fileId:ct.fileId}]};se&&($l(ie,yt),ie?.emit?.("comments-update",yt))});const Ne=O.value!=null?String(O.value):null,Oe=ue.some(Qe=>{const ct=Qe.commentId!=null?String(Qe.commentId):null,yt=Qe.importedId!=null?String(Qe.importedId):null;return yo(Qe,$)&&(ct&&ct===Ne||yt&&yt===Ne)});Ne&&de.has(Ne)&&Oe&&Lo()}),Fu=({superdoc:I,comment:M,decision:$}={})=>{if(!M?.trackedChange||Rs({comment:M,decision:$}))return 0;const ie=bo(M);if(!ie.size)return 0;const se={email:I?.user?.email??null,name:I?.user?.name??null,superdoc:I};let de=0;return ns(M).forEach(he=>{!he||he===M||he.resolvedTime||[je(he),he.threadingParentCommentId,he.parentCommentId].map(ue=>He(ue)).filter(Boolean).some(ue=>ie.has(ue))&&typeof he.resolveComment=="function"&&(he.resolveComment(se),de+=1)}),de},bo=I=>{const M=new Set(kt(I));I?.trackedChangeCanonicalId!=null&&M.add(String(I.trackedChangeCanonicalId));const $=I?.trackedChangeAnchorKey!=null?String(I.trackedChangeAnchorKey):null;if($&&(M.add($),$.startsWith("tc::"))){const ie=$.slice($.lastIndexOf("::")+2);ie&&M.add(ie)}return M},ns=I=>{const M=[],$=new Set;for(const ie of bo(I))for(const se of ye.value.get(String(ie))??[])$.has(se)||($.add(se),M.push(se));return M},Nu=I=>{const M=I&&typeof I=="object"?I:null;if(!M?.success)return new Set;const $=new Set,ie=se=>{const de=se&&typeof se=="object"?se:null;de?.kind!=="entity"||de.entityType!=="trackedChange"||de.entityId!=null&&String(de.entityId).length>0&&$.add(String(de.entityId))};return Array.isArray(M.removed)&&M.removed.forEach(ie),Array.isArray(M.invalidatedRefs)&&M.invalidatedRefs.forEach(ie),$},yc=I=>{const M=new Set;return I?.decidedId!=null&&String(I.decidedId).length>0&&M.add(String(I.decidedId)),Array.isArray(I?.decidedIds)&&I.decidedIds.forEach($=>{$!=null&&String($).length>0&&M.add(String($))}),Nu(I?.receipt).forEach($=>M.add($)),M},Bu=({comment:I,decision:M}={})=>{if(!I?.trackedChange||!Rs({comment:I,decision:M}))return 0;const $=bo(I);if(!$.size)return 0;let ie=0;return ns(I).forEach(se=>{if(!se||se===I)return;const de=He(se.trackedChangeParentId),he=He(se.trackedChangeThreadParentId),ue=He(se.threadingParentCommentId),Te=He(se.parentCommentId);(de&&$.has(de)||he&&$.has(he)||ue&&$.has(ue)||Te&&$.has(Te))&&(delete se.trackedChangeParentId,se.trackedChangeThreadParentId=void 0,delete se.trackedChangeSide,delete se.threadingParentCommentId,Te&&$.has(Te)&&delete se.parentCommentId,ie+=1)}),ie},bc=(I=[],{documentId:M}={})=>{const $=He(M);if(!Array.isArray(I)||I.length===0||!$)return;const ie=re.value||{};let se=!1;const de=(ue,Te,Ne,Oe)=>He(ue?.[Te])!==Ne?!1:(ue[Te]=Oe,!0),he=(ue,Te)=>ue?.trackedChange&&yo(ue,$)&&[ue.commentId,ue.importedId,ue.trackedChangeCanonicalId,...kt(ue)].map(Ne=>He(Ne)).includes(Te);for(const ue of I){const Te=He(ue?.from),Ne=He(ue?.to);if(!Te||!Ne||Te===Ne)continue;const Oe=X.value.find(Ut=>he(Ut,Te));if(!Oe)continue;const Qe={};for(const Ut of["commentId","importedId"])de(Oe,Ut,Te,Ne)&&(Qe[Ut]=Ne);de(Oe,"trackedChangeCanonicalId",Te,Ne)&&(Qe.trackedChangeCanonicalId=Ne);const ct=n(Te),yt=r(Oe.trackedChangeAnchorKey)?.storyKey??_n(sn(Oe)),nt=o(yt,Te),ln=o(yt,Ne);(He(Oe.trackedChangeAnchorKey)===ct||Oe.trackedChangeAnchorKey==null||He(Oe.trackedChangeAnchorKey)===nt)&&(Oe.trackedChangeAnchorKey=ln),Array.isArray(Oe.trackedChangePositionAliases)&&(Oe.trackedChangePositionAliases=Oe.trackedChangePositionAliases.map(Ut=>He(Ut)===Te?Ne:Ut)),X.value.forEach(Ut=>{if(Ut===Oe||!yo(Ut,$))return;const Cn={};for(const Sr of["trackedChangeThreadParentId","trackedChangeParentId","threadingParentCommentId","parentCommentId"])de(Ut,Sr,Te,Ne)&&(Cn[Sr]=Ne);Object.keys(Cn).length&&typeof Ut.updateIdentityValues=="function"&&Ut.updateIdentityValues(Cn)}),Object.keys(Qe).length&&typeof Oe.updateIdentityValues=="function"&&Oe.updateIdentityValues(Qe);const nn=[ie[Te],ie[ct]],Vn=ie[nt]??nn.find(Ut=>Ut&&Ye(Ut,Oe));if(Vn)for(const Ut of[Ne,ln])ie[Ut]===void 0&&(ie[Ut]=Vn,se=!0);He(O.value)===Te&&(O.value=Ne),He(V.value)===Te&&(V.value=Ne)}se&&(re.value={...ie})},Ms=({superdoc:I,comment:M,decidedId:$,decidedIds:ie,documentId:se}={})=>{const de=new Set((Array.isArray(ie)||ie instanceof Set?Array.from(ie):[$]).map(ct=>He(ct)).filter(Boolean)),he=He(se);if(!de.size||!he)return{removed:!1,removedIds:new Set};const ue=new Set;let Te=!1;const Ne=M?X.value.indexOf(M):-1,Oe=M?.trackedChange?bo(M):new Set;if(Ne>=0&&yo(M,he)&&Array.from(de).some(ct=>Oe.has(ct))?(Oe.forEach(ct=>ue.add(ct)),X.value.splice(Ne,1),Te=!0):X.value=X.value.filter(ct=>{if(!ct?.trackedChange||!yo(ct,he))return!0;const yt=bo(ct);return Array.from(de).some(nt=>yt.has(nt))?(Te=!0,yt.forEach(nt=>ue.add(nt)),!1):!0}),!Te)return{removed:!1,removedIds:ue};const Qe=O.value!=null?String(O.value):null;return Qe&&ue.has(Qe)&&Lo(),{removed:!0,removedIds:ue}},ni=(I,M)=>{if(!(!M||typeof I?.clearActiveTrackedChangeTargetIfMatches!="function"))try{I.clearActiveTrackedChangeTargetIfMatches(M)}catch{}},zu=async({superdoc:I,receipt:M}={})=>{const $=I?.activeEditor?.documentMutationReadiness;if(!(M?.success!==!0||typeof M?.txId!="string"||!M.txId||typeof $?.whenPainted!="function"))try{await $.whenPainted(M);const ie=globalThis.requestAnimationFrame;typeof ie=="function"&&await new Promise(se=>{let de=!1;const he=()=>{de||(de=!0,clearTimeout(ue),se())},ue=setTimeout(he,250);ie(()=>ie(()=>setTimeout(he,0)))})}catch{}},wl=({superdoc:I,comment:M,decision:$})=>{if(d())return{ok:!1,reason:"read-only-document"};if(!M?.trackedChange)return{ok:!1};const ie=Pe(I);if(ie){if($!=="accept"&&$!=="reject")return Promise.resolve({ok:!1,reason:"decision-invalid"});const Oe=M?.trackedChangeCanonicalId!=null?String(M.trackedChangeCanonicalId):M?.commentId!=null?String(M.commentId):M?.trackedChangeAnchorKey?.startsWith?.("tc::body::")?M.trackedChangeAnchorKey.slice(10):null,Qe=Oe!=null&&String(O.value??"")===Oe;return ec("store.trackedChanges.sidebarDecision","command",{decision:$,decidedId:Oe},()=>(async()=>{try{return await($==="accept"?ie.accept(M):ie.reject(M))}catch(ct){return{ok:!1,reason:"adapter-threw",detail:ct?.message??String(ct)}}})().then(async ct=>{if(!Wn(ie))return{ok:!1,reason:"adapter-stale"};if(!ct?.ok)return{ok:!1,reason:ct?.reason,detail:ct?.detail};const yt=yc(ct),nt=ct?.documentId??ie.documentId??I?.activeEditor?.documentId??I?.activeEditor?.options?.documentId??null,ln=async()=>{let nn;try{nn=await ie.listTrackedChanges({mode:"all",refreshReason:"post-decision-blocking",blocking:!0})}catch(Cn){return{ok:!1,committed:!0,reason:"relist-after-commit-failed",detail:Cn?.message??String(Cn)}}if(!Wn(ie))return{ok:!1,committed:!0,reason:"adapter-stale"};if(!nn?.ok)return{ok:!1,committed:!0,reason:"relist-after-commit-failed",detail:nn?.reason??nn?.detail??null};Fu({superdoc:I,comment:M,decision:$}),Bu({comment:M,decision:$}),_a({superdoc:I,adapter:ie,documentId:nt,items:nn.items??[],pruneStale:nn.complete===!0&&nn.sourceCoverageComplete===!0});const Vn=new Set((nn.items??[]).map(Cn=>Cn&&Cn.id!=null?String(Cn.id):null).filter(Boolean));Oe!=null&&Vn.has(Oe)||(Qe&&Lo(),ni(ie,Oe));const Ut=K(I);if(Ut&&typeof Ut.refresh=="function"&&ei(Ut)){let Cn;try{Cn=await Ut.refresh()}catch(Sr){return{ok:!1,committed:!0,reason:"comments-relist-after-tracked-decision-failed",detail:Sr?.message??String(Sr)}}if(!ei(Ut))return{ok:!1,committed:!0,reason:"comments-adapter-stale"};if(!Cn?.ok)return{ok:!1,committed:!0,reason:"comments-relist-after-tracked-decision-failed",detail:Cn?.reason??Cn?.detail??null};ti({superdoc:I,adapter:Ut,documentId:Ut.documentId??nt,items:Cn.items??[]})}return{ok:!0,success:!0}};return!yt.size||!nt?ln():(yt.forEach(nn=>ni(ie,nn)),await zu({superdoc:I,receipt:ct.receipt}),Fu({superdoc:I,comment:M,decision:$}),Bu({comment:M,decision:$}),Ms({superdoc:I,comment:M,decidedIds:yt,documentId:nt}),Qe&&Lo(),{ok:!0,success:!0})}))}const se=I?.activeEditor;if(!se)return{ok:!1};const de=M.commentId??M.importedId;if(!de)return{ok:!1};const he=M.trackedChangeStory??void 0,ue=typeof se.doc=="object"?se.doc:null;if(ue?.trackChanges?.decide)try{const Oe=he?{id:de,story:he}:{id:de};return Promise.resolve(ue.trackChanges.decide({decision:$,target:Oe})).then(Qe=>({ok:!0,success:!!Qe?.success}))}catch(Oe){if(he)return{ok:!1,error:Oe}}const Te=$==="accept"?"acceptTrackedChangeById":"rejectTrackedChangeById",Ne=se.commands?.[Te];return typeof Ne!="function"?{ok:!1}:{ok:!0,success:!!Ne(de)}},Vu=async({superdoc:I,adapter:M,documentId:$,trackedChangesListMode:ie="all",refreshReason:se,blocking:de}={})=>ec("store.trackedChanges.hydrateFromV2","tracked-change-list",{documentId:$??null,trackedChangesListMode:ie,refreshReason:se??null,blocking:de??null},async()=>{const he=M??Pe(I);if(!he||typeof he.listTrackedChanges!="function")return{ok:!1,reason:"adapter-missing"};let ue;try{const Oe={mode:ie};se!=null&&(Oe.refreshReason=se),typeof de=="boolean"&&(Oe.blocking=de),ue=await he.listTrackedChanges(Oe)}catch(Oe){return{ok:!1,reason:"adapter-threw",detail:Oe?.message??String(Oe)}}if(!Wn(he))return{ok:!1,reason:"adapter-stale"};if(!ue?.ok)return ue;const Te=!(ie==="startup-page"||ie==="interaction-prime"||ie==="visible-window")&&ue.visibleWindowSource==null&&ue.complete===!0&&ue.sourceCoverageComplete===!0;_a({superdoc:I,adapter:he,documentId:$,items:ue.items??[],pruneStale:Te});const Ne={ok:!0,items:ue.items??[]};return typeof ue.complete=="boolean"&&(Ne.complete=ue.complete),typeof ue.sourceCoverageComplete=="boolean"&&(Ne.sourceCoverageComplete=ue.sourceCoverageComplete),ue.visibleWindowSource!=null&&(Ne.visibleWindowSource=ue.visibleWindowSource),ue.visibleWindowFallbackReason!=null&&(Ne.visibleWindowFallbackReason=ue.visibleWindowFallbackReason),typeof ue.visibleTrackedChangeExpectedRows=="number"&&(Ne.visibleTrackedChangeExpectedRows=ue.visibleTrackedChangeExpectedRows),typeof ue.visibleTrackedChangeObservedRows=="number"&&(Ne.visibleTrackedChangeObservedRows=ue.visibleTrackedChangeObservedRows),typeof ue.refreshReason=="string"&&(Ne.refreshReason=ue.refreshReason),typeof ue.blocking=="boolean"&&(Ne.blocking=ue.blocking),typeof ue.pageCount=="number"&&(Ne.pageCount=ue.pageCount),typeof ue.totalItems=="number"&&(Ne.totalItems=ue.totalItems),typeof ue.coalesced=="boolean"&&(Ne.coalesced=ue.coalesced),Ne}),wc=async({superdoc:I,adapter:M,documentId:$,upsertIds:ie=[],removedIds:se=[]}={})=>{const de=M??Pe(I);if(!de)return{ok:!1,reason:"adapter-missing"};if(!Wn(de))return{ok:!1,reason:"adapter-stale"};const he=$??de.documentId??I?.activeEditor?.documentId??null,ue=new Set(Array.from(se??[]).map(nt=>He(nt)).filter(Boolean)),Te=[...new Set(Array.from(ie??[]).map(nt=>He(nt)).filter(Boolean))];if(ue.size>0&&Te.length===0&&he!=null&&Ms({superdoc:I,decidedIds:ue,documentId:he}),Te.length===0)return{ok:!0,items:[],resolvedIds:[],unresolvedIds:[]};if(typeof de.getTrackedChange!="function")return{ok:!1,reason:"adapter-get-missing"};const Ne=await Promise.all(Te.map(async nt=>{try{return{id:nt,result:await de.getTrackedChange(nt)}}catch(ln){return{id:nt,result:{ok:!1,reason:"adapter-threw",detail:ln?.message??String(ln)}}}}));if(!Wn(de))return{ok:!1,reason:"adapter-stale"};const Oe=[],Qe=[],ct=[];for(const{id:nt,result:ln}of Ne){const nn=(ln?.ok&&Array.isArray(ln.items)?ln.items:[]).filter(Vn=>Ft(Vn).has(nt));nn.length>0?(Oe.push(nt),ct.push(...nn)):Qe.push(nt)}const yt=Nt(ct);return ct.length>0&&_a({superdoc:I,adapter:de,documentId:he,items:yt,pruneStale:!1}),{ok:Qe.length===0,items:yt,resolvedIds:Oe,unresolvedIds:Qe,failures:Ne.map(({result:nt})=>nt).filter(nt=>!nt?.ok)}},_a=({superdoc:I,adapter:M,documentId:$,items:ie,pruneStale:se=!0,preparedParams:de=null}={})=>ec("store.trackedChanges.reconcile","store-reconciliation",{documentId:$??null,itemCount:Array.isArray(ie)?ie.length:null,pruneStale:se},()=>{if(!M||!Array.isArray(ie)||!Wn(M))return;const he=$??M.documentId??I?.activeEditor?.documentId??null,ue=new Set,Te=new Set,Ne=Array.isArray(de)?de:ie.map(Oe=>M.mapV2TrackedChangeToCommentParams(Oe));for(const Oe of Ne)if(Oe){if(Oe.event==="omit"){Oe.changeId!=null&&Te.add(String(Oe.changeId));continue}he&&Oe.documentId==null&&(Oe.documentId=he),Oe.changeId!=null&&Te.add(String(Oe.changeId)),Oe.trackedChangeAnchorKey!=null&&ue.add(String(Oe.trackedChangeAnchorKey)),cr({superdoc:I,params:Oe,broadcastChanges:!1})}!he||!se||vc(Te,ue,String(he),I,{broadcastChanges:!1})}),rs=({superdoc:I,editor:M,broadcastChanges:$=!0})=>{if(!I||!M)return;const ie=M?.options?.documentId!=null?String(M.options.documentId):null;if(!ie)return;const se=gl(M);if(!se)return;const de=se.trackedChanges,he=new Set;de.forEach(Te=>{const Ne=Te?.mark?.attrs?.id;Ne!=null&&he.add(String(Ne))});const ue=se.storySnapshots;vc(he,new Set(ue.map(Te=>Te?.anchorKey).filter(Te=>typeof Te=="string"&&Te.length>0)),ie,I,{broadcastChanges:$}),Du(M,I,de,{reopenResolved:!0,refreshExisting:!0,broadcastChanges:$,editorState:se.state,editorView:se.view}),Pi({superdoc:I,editor:M,broadcastChanges:$,snapshots:ue,documentState:se.state}),Cl({superdoc:I,editor:M,broadcastChanges:$,structuralChanges:se.structuralChanges})},Cl=({superdoc:I,editor:M,broadcastChanges:$=!0,structuralChanges:ie=null})=>{const se=M?.options?.documentId!=null?String(M.options.documentId):null;if(!se)return;const de=sa?.enumerateStructuralRowChanges;if(typeof de!="function")return;let he=ie;if(!Array.isArray(he)){const ue=es(M);if(!ue)return;try{he=de(ue.state)??[]}catch{he=[]}}for(const ue of he){if(!ue?.decidable||!ue?.wholeTable)continue;const Te=i(ue);if(!Te)continue;const Ne=n(Te),Oe=ue.subtype==="table-insert"?"tableInsert":"tableDelete",Qe=ue.side==="insertion"?"trackInsert":"trackDelete",ct=String(Te),yt=Ne!=null?String(Ne):null;cr({superdoc:I,params:{event:X.value.find(nt=>{if(!nt?.trackedChange||!yo(nt,se))return!1;const ln=nt.trackedChangeAnchorKey!=null?String(nt.trackedChangeAnchorKey):null;if(yt&&ln)return ln===yt;const nn=nt.commentId!=null?String(nt.commentId):null,Vn=nt.importedId!=null?String(nt.importedId):null;return nn===ct||Vn===ct})?"update":"add",changeId:Te,trackedChangeText:"",trackedChangeType:Qe,trackedChangeDisplayType:Oe,deletedText:null,authorId:null,authorEmail:ue.authorEmail||null,authorImage:ue.authorImage||null,date:ue.date||null,author:ue.author||null,importedAuthor:ue.importedAuthor?{name:ue.importedAuthor}:null,semanticColorKey:ue.semanticColorKey??null,semanticColor:ue.semanticColor??null,documentId:se,coords:null,trackedChangeStory:e,trackedChangeStoryKind:"body",trackedChangeStoryLabel:"",trackedChangeAnchorKey:Ne},broadcastChanges:$})}},Pi=({superdoc:I,editor:M,broadcastChanges:$=!0,snapshots:ie=null,documentState:se=void 0,resolveFromEditor:de=!0})=>{const he=M?.options?.documentId!=null?String(M.options.documentId):null;if(!he)return;let ue=ie;if(!Array.isArray(ue)){if(typeof mu!="function"||!es(M))return;let Te=null;try{Te=mu(M)}catch{return}if(!Te)return;try{ue=Te.getAll()}catch{return}}for(const Te of ue)Te.storyKind!=="body"&&Hu({superdoc:I,editor:M,snapshot:Te,documentId:he,broadcastChanges:$,documentState:se,resolveFromEditor:de})},Kf=I=>I?.type!=="structural"?I?.type??null:I?.subtype==="table-delete"?"tableDelete":"tableInsert",qf=I=>I?.type!=="structural"?I?.type??null:I?.subtype==="table-delete"?"trackDelete":"trackInsert",Cc=I=>I?I.type==="delete"?!0:I.type==="structural"&&I.subtype==="table-delete":!1,_l=({editor:I,snapshot:M,documentId:$,event:ie,resolveFromEditor:se=!0})=>{const de=qf(M),he=Kf(M),ue={event:ie,changeId:M.runtimeRef.rawId,trackedChangeText:Cc(M)?"":M.excerpt??"",trackedChangeType:de,trackedChangeDisplayType:he,semanticColorKey:M.semanticColorKey??null,semanticColor:M.semanticColor??null,deletedText:Cc(M)?M.excerpt??"":null,authorId:M.authorId,authorEmail:M.authorEmail,authorImage:M.authorImage,date:M.date,author:M.author,documentId:$,coords:null,trackedChangeStory:M.story,trackedChangeStoryKind:M.storyKind,trackedChangeStoryLabel:M.storyLabel,trackedChangeAnchorKey:M.anchorKey};if(!se||typeof h_!="function")return ue;let Te=null;try{Te=h_(I,{kind:"entity",entityType:"trackedChange",entityId:M.runtimeRef.rawId,story:M.story})}catch{Te=null}const Ne=Te?.editor?.state??null;if(!Ne)return ue;let Oe=[];try{Oe=sa.getTrackChanges(Ne,Te.change.rawId)??[]}catch{Oe=[]}const Qe=n0({event:ie,marks:Qo(Oe),nodes:[],newEditorState:Ne,documentId:$,trackedChangesForId:Oe});return Qe?(Qe.semanticColorKey==null&&M.semanticColorKey!=null&&(Qe.semanticColorKey=M.semanticColorKey),Qe.semanticColor==null&&M.semanticColor!=null&&(Qe.semanticColor=M.semanticColor),Qe.trackedChangeStory=M.story,Qe.trackedChangeStoryKind=M.storyKind,Qe.trackedChangeStoryLabel=M.storyLabel,Qe.trackedChangeAnchorKey=M.anchorKey,Qe):ue},Hu=({superdoc:I,editor:M,snapshot:$,documentId:ie,broadcastChanges:se,documentState:de,resolveFromEditor:he})=>{if(!$?.runtimeRef?.rawId)return;const ue=X.value.find(Te=>{if(!Te?.trackedChange)return!1;const Ne=Te.trackedChangeAnchorKey!=null?String(Te.trackedChangeAnchorKey):null;return Ne&&$.anchorKey?Ne===$.anchorKey:Ne||$.anchorKey?!1:Te.commentId===$.runtimeRef.rawId||Te.importedId===$.runtimeRef.rawId});cr({superdoc:I,params:_l({editor:M,snapshot:$,documentId:ie,event:ue?"update":"add",resolveFromEditor:he}),broadcastChanges:se,documentState:de}),ue&&(ue.trackedChangeStory=$.story,ue.trackedChangeStoryKind=$.storyKind,ue.trackedChangeStoryLabel=$.storyLabel,ue.trackedChangeAnchorKey=$.anchorKey)},Sl=I=>I?(Array.isArray(I)?I:[I]).filter(Boolean):[],Sa=()=>{const I=[];return X.value.forEach(M=>{const $=M.getValues(),ie=$.commentText,se=Sl($.docxCommentJSON),de=se.length?se:ju(ie);I.push({...$,commentJSON:de})}),I},ju=I=>{const M=new d_({mode:"text",isHeadless:!0,content:I,extensions:f_()}).getJSON();return Array.isArray(M?.content)?M.content.filter(Boolean):[]},kl=(I,M={})=>{if(I==null)return;const $=M?.retainMissingTrackedChangeGeometry===!0,ie=$&&M?.retainedTrackedChangeIds!=null?new Set(Array.from(M.retainedTrackedChangeIds,Te=>He(Te)).filter(Boolean)):null,se=re.value||{},de={};Object.entries(I).forEach(([Te,Ne])=>{de[Te]=Ne;const Oe=Ne?.kind==="trackedChange"&&Ne?.storyKey==="body"&&Ne?.threadId!=null?String(Ne.threadId):null;Oe&&de[Oe]===void 0&&(de[Oe]=Ne);const Qe=typeof Ne?.key=="string"?Ne.key:null;Qe&&de[Qe]===void 0&&(de[Qe]=Ne)});const he=(Te,Ne)=>{for(const Oe of kt(Te)){const Qe=Ne[Oe];if(Qe!==void 0&&Ye(Qe,Te))return Qe}return null},ue=(Te,Ne,Oe=[])=>{const Qe=[...kt(Ne),...Oe.map(ct=>He(ct)).filter(Boolean)];for(const ct of new Set(Qe))de[ct]===void 0&&(de[ct]=Te)};X.value.forEach(Te=>{if(!Te?.trackedChange||Te.resolvedTime)return;const Ne=he(Te,de);if(Ne){ue(Ne,Te);return}if(!$||ie&&!kt(Te).some(Qe=>ie.has(Qe)))return;const Oe=he(Te,se);Oe&&ue(Oe,Te,[Oe.key,Oe.threadId])}),re.value=de},Yf=()=>{re.value={}},Al=I=>{if(!I?.trackedChange)return!1;const M=I?.trackedChangeDisplayType;return M==="tableInsert"||M==="tableDelete"?!0:[I?.commentId,I?.importedId,I?.trackedChangeAnchorKey].map($=>$!=null?String($):"").filter(Boolean).some($=>$.includes("word:structural:"))},Il=new WeakMap,Uu=I=>{if(!I)return{ranges:[],ids:new Set};const M=Il.get(I);if(M)return M;const $=[],ie=new Set,se=ue=>{ue!=null&&ue!==""&&ie.add(String(ue))},de=sa?.enumerateStructuralRowChanges;if(typeof de=="function"){let ue=[];try{ue=de(I)??[]}catch{ue=[]}for(const Te of ue){if(!Te?.decidable||!Te?.wholeTable)continue;const Ne=Number(Te.tableFrom),Oe=Number(Te.tableTo);Number.isFinite(Ne)&&Number.isFinite(Oe)&&$.push({from:Ne,to:Oe}),se(Te.id),se(Te.revisionId),se(Te.revisionGroupId),se(Te.sourceId);for(const Qe of Te.rows||[]){const ct=Qe?.node?.attrs?.trackChange;se(ct?.id),se(ct?.sourceId)}}}const he={ranges:$,ids:ie};return Il.set(I,he),he},Gu=I=>{const M=s.getDocument(I)?.getEditor?.();return Uu(M?.state).ranges},El=(I,M)=>!M?.length||!I?.length?!1:I.every($=>{const ie=Number($?.from),se=Number($?.to);return!Number.isFinite(ie)||!Number.isFinite(se)?!1:M.some(de=>ie>=de.from&&se<=de.to)}),Xf=I=>{if(!I?.trackedChange||Al(I))return!1;const M=Gu(I?.fileId);if(!M.length)return!1;const $=ft(I).entry,ie=vo($);return ie?M.some(se=>ie.start>=se.from&&ie.end<=se.to):!1},_c=ke(()=>xn.value?.parentComments.filter(I=>!I.resolvedTime).filter(I=>!hn(I)||oo(I)?!0:!!ft(I).entry).filter(I=>!Xf(I))),xl=ke(()=>_c.value.flatMap(I=>{const{key:M,entry:$}=ft(I);return A8({comment:I,positionKey:M,positionEntry:$,fallbackId:He(I?.commentId)??kt(I)[0]??null})})),Zf=I=>I==null?null:String(I),Ls=(I=null)=>{V.value=Zf(I)},Lo=()=>{O.value=null,Ls(null)},ri=(I,M)=>I==null||M==null?!1:xl.value.some($=>String($.id)===String(I)&&String($.comment?.commentId??$.threadId??"")===String(M)),Wu=I=>{ri(V.value,I)||Ls(null)},Sc=({documentMode:I,commentsVisible:M,trackChangesVisible:$}={})=>{typeof I=="string"&&(h.documentMode=I),typeof M=="boolean"&&(h.commentsVisible=M),typeof $=="boolean"&&(h.trackChangesVisible=$)},kc=I=>{if(Array.isArray(I))return I.map(he=>kc(he)).flat().filter(Boolean);if(!I||typeof I!="object")return I;const M=he=>{if(!he)return he;const ue={...he};return delete ue.fontSize,delete ue.fontFamily,delete ue.eastAsiaFontFamily,Object.keys(ue).length?ue:void 0},$=he=>{if(!he)return he;const ue=typeof he.type=="string"?he.type:he.type?.name,Te=he?.attrs?{...he.attrs}:void 0;return ue==="textStyle"&&Te?{...he,attrs:M(Te)}:{...he,attrs:Te}},ie=he=>Array.isArray(he)?he.filter(Boolean).map(ue=>$(ue)):void 0,se=he=>he&&typeof he=="object"?{...he}:void 0;if(!Array.isArray(I.content))return{type:I.type,...I.text!==void 0?{text:I.text}:{},...I.attrs?{attrs:se(I.attrs)}:{},...I.marks?{marks:ie(I.marks)}:{}};const de=I.content.map(he=>kc(he)).flat().filter(Boolean);return I.type==="run"?de:{type:I.type,...I.attrs?{attrs:se(I.attrs)}:{},...I.marks?{marks:ie(I.marks)}:{},content:de}},Qf=I=>{const M=Array.isArray(I)?I:I?[I]:[];if(M.some($=>$?.content?.length))try{const $=kc(M),ie=Array.isArray($)?$:$?[$]:[];return ie.length?new d_({mode:"text",isHeadless:!0,content:{type:"doc",content:ie},loadFromSchema:!0,extensions:f_()}).getHTML():null}catch($){console.warn("Failed to convert comment",$);return}};return{COMMENT_EVENTS:b,isDebugging:m,hasInitializedComments:T,hasSyncedCollaborationComments:R,editingCommentId:Q,activeComment:O,activeFloatingCommentInstanceId:V,commentDialogs:F,overlappingComments:N,overlappedIds:x,suppressInternalExternal:z,pendingComment:D,currentCommentText:J,commentsList:X,isCommentsListVisible:le,generalCommentIds:qe,editorCommentIds:Se,commentsParentElement:P,editorCommentPositions:re,hasInitializedLocations:j,isCommentHighlighted:xe,floatingCommentsOffset:$e,sortedConversations:st,visibleConversations:At,skipSelectionUpdate:Ee,isFloatingCommentsReady:Ge,instantSidebarAlignmentTargetY:Z,instantSidebarAlignmentThreadId:S,instantSidebarAlignmentInstanceId:ee,getConfig:Ji,documentsWithConverations:gi,getGroupedComments:xn,hasOpenTrackedChanges:Tn,getCommentsByPosition:_r,getFloatingComments:_c,getFloatingCommentInstances:xl,getCommentAliasIds:kt,getTrackedChangeThread:Fe,getCommentPositionKey:pt,getCommentPosition:$t,getCommentAnchoredText:Bn,getCommentAnchorData:xi,resolveCommentPositionEntry:ft,getCommentDocumentId:yl,belongsToDocument:Ca,viewingVisibility:h,isViewingMode:H,shouldRenderReviewInViewing:G,init:it,setViewingVisibility:Sc,getComment:Pt,setActiveComment:so,getCommentLocation:Es,hasOverlapId:jr,getPendingComment:No,showAddComment:Ri,addComment:Mi,addHydratedComment:lo,cancelComment:vi,deleteComment:$o,removePendingComment:Jo,cancelImportedTrackedChangeBootstrap:ml,removeCommentsForDocument:yi,processLoadedDocxComments:wa,translateCommentsForExport:Sa,handleEditorLocationsUpdate:kl,clearEditorCommentPositions:Yf,handleTrackedChangeUpdate:cr,refreshTrackedChangeCommentsByIds:Zi,syncResolvedCommentsWithDocument:io,syncTrackedChangePositionsWithDocument:Jt,setActiveFloatingCommentInstance:Ls,requestInstantSidebarAlignment:va,peekInstantSidebarAlignment:Qi,clearInstantSidebarAlignment:hl,syncTrackedChangeComments:rs,decideTrackedChangeFromSidebar:wl,v2CommentsAdapter:te,setV2CommentsAdapter:Y,getV2CommentsAdapter:K,hydrateCommentsFromV2:Ts,applyReviewSnapshotFromV2:jf,reconcileCommentsFromV2:ti,isV2EditorActive:be,replyCommentV2:xs,editCommentV2:Mo,resolveCommentV2:mc,reopenCommentV2:ya,v2TrackedChangesAdapter:me,setV2TrackedChangesAdapter:Ce,getV2TrackedChangesAdapter:Pe,hydrateTrackedChangesFromV2:Vu,reconcileTrackedChangeMutationFromV2:wc,reconcileTrackedChangesFromV2:_a,remapTrackedChangeIdentities:bc}});var m_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M512 240c0 114.9-114.6 208-256 208c-37.1 0-72.3-6.4-104.1-17.9c-11.9 8.7-31.3 20.6-54.3 30.6C73.6 471.1 44.7 480 16 480c-6.5 0-12.3-3.9-14.8-9.9c-2.5-6-1.1-12.8 3.4-17.4c0 0 0 0 0 0s0 0 0 0s0 0 0 0c0 0 0 0 0 0l.3-.3c.3-.3 .7-.7 1.3-1.4c1.1-1.2 2.8-3.1 4.9-5.7c4.1-5 9.6-12.4 15.2-21.6c10-16.6 19.5-38.4 21.4-62.9C17.7 326.8 0 285.1 0 240C0 125.1 114.6 32 256 32s256 93.1 256 208z"/></svg>',g_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"/></svg>',Q8='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M96 128a128 128 0 1 1 256 0A128 128 0 1 1 96 128zM0 482.3C0 383.8 79.8 304 178.3 304l91.4 0C368.2 304 448 383.8 448 482.3c0 16.4-13.3 29.7-29.7 29.7L29.7 512C13.3 512 0 498.7 0 482.3zM625 177L497 305c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L591 143c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>',J8='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M144 0a80 80 0 1 1 0 160A80 80 0 1 1 144 0zM512 0a80 80 0 1 1 0 160A80 80 0 1 1 512 0zM0 298.7C0 239.8 47.8 192 106.7 192l42.7 0c15.9 0 31 3.5 44.6 9.7c-1.3 7.2-1.9 14.7-1.9 22.3c0 38.2 16.8 72.5 43.3 96c-.2 0-.4 0-.7 0L21.3 320C9.6 320 0 310.4 0 298.7zM405.3 320c-.2 0-.4 0-.7 0c26.6-23.5 43.3-57.8 43.3-96c0-7.6-.7-15-1.9-22.3c13.6-6.3 28.7-9.7 44.6-9.7l42.7 0C592.2 192 640 239.8 640 298.7c0 11.8-9.6 21.3-21.3 21.3l-213.3 0zM224 224a96 96 0 1 1 192 0 96 96 0 1 1 -192 0zM128 485.3C128 411.7 187.7 352 261.3 352l117.3 0C452.3 352 512 411.7 512 485.3c0 14.7-11.9 26.7-26.7 26.7l-330.7 0c-14.7 0-26.7-11.9-26.7-26.7z"/></svg>',i0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>',v_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/></svg>',y_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/></svg>',b_='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"/></svg>';const la={comment:m_,caretDown:g_,internal:Q8,external:J8,markDone:i0,acceptChange:i0,rejectChange:v_,overflow:y_,reopen:b_};var $8=.38,e7=".superdoc-comment-highlight",t7=e=>{if(typeof e?.getBoundingClientRect!="function")return!1;const t=e.getBoundingClientRect();return!Number.isFinite(t.top)||!Number.isFinite(t.bottom)?!1:t.bottom>0&&t.top<window.innerHeight},n7=e=>e?e.split(",").map(t=>t.trim()).filter(Boolean):[],r7=e=>{const t=[];return e?(e.split(",").forEach(n=>{const r=n.indexOf("=");r<=0||t.push(n.slice(0,r),n.slice(r+1))}),t.filter(Boolean)):t};const o7=()=>Math.round(window.innerHeight*$8),w_=(e,t)=>{const n=t?.bounds?.top;if(!Number.isFinite(n)||typeof e?.getBoundingClientRect!="function")return null;const r=e.getBoundingClientRect().top+n;return r<0||r>=window.innerHeight?null:r},i7=e=>{if(typeof document>"u")return null;const t=new Set((e??[]).map(o=>String(o)).filter(Boolean));if(t.size===0)return null;let n=null;const r=document.querySelectorAll(e7);for(const o of r){const i=new Set([...n7(o.getAttribute("data-comment-ids")),...r7(o.getAttribute("data-comment-imported-ids"))]);if(![...t].some(a=>i.has(a))||!t7(o))continue;const s=o.getBoundingClientRect().top;Number.isFinite(s)&&(n=n==null?s:Math.min(n,s))}return n},s7=(e,t,n,r)=>{if(!e||!Number.isFinite(r))return null;const o=s=>{if(!s)return null;const a=e.getReachableThreadAnchorClientY(s,r);return Number.isFinite(a)&&e.scrollThreadAnchorToClientY(s,r,{behavior:"auto"})?a:null},i=o(t);return Number.isFinite(i)?i:!n||n===t?null:o(n)};xt();const a7="Arial, Helvetica, sans-serif";function s0(){const e=ir();return{uiFontFamily:ke(()=>{const t=e?.proxy?.$superdoc?.config?.uiDisplayFallbackFont;return typeof t=="string"&&t.trim()?t.trim():a7})}}var fn,gn=Ir((()=>{fn=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n}}));xt(),gn();var l7={class:"comments-dropdown"},c7=["onClick"],u7={key:0,class:"comments-dropdown__option-icon"},d7=["innerHTML"],f7={class:"comments-dropdown__option-label"},h7={__name:"CommentsDropdown",props:{options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,o=ne(!1),i=ne(null),s=ne(null),a=ne({top:"0px",left:"0px"}),l=ke(()=>({...n.contentStyle,position:"fixed",top:a.value.top,left:a.value.left,zIndex:1200})),u=b=>{n.disabled&&b||(o.value=b)},c=()=>{n.disabled||u(!o.value)},d=()=>{o.value&&u(!1)},h=()=>{if(!i.value)return;const b=i.value.getBoundingClientRect(),T=s.value?.offsetWidth??0,R=window.innerWidth||document.documentElement.clientWidth||0,P=8;let j=b.left;const O=Math.max(P,R-T-P);j=Math.min(Math.max(P,j),O),a.value={top:`${b.bottom+4}px`,left:`${j}px`}},m=b=>{b.stopPropagation(),c()},p=b=>{b?.disabled||(r("select",b?.key,b),d())},v=b=>!!b?.iconString||!!b?.icon,_=b=>b?.iconString?b.iconString:typeof b?.icon=="function"?b.icon(b):b?.icon||null,C=jl({name:"CommentsDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(b){return()=>_(b.option)}}),k=b=>{if(!o.value)return;const T=b.target;if(!(T instanceof Element))return;const R=i.value?.contains(T),P=s.value?.contains(T);R||P||d()},y=b=>{b.key==="Escape"&&d()};return Lt(o,async b=>{b&&(await _t(),h())}),Lt(o,b=>{b?(document.addEventListener("pointerdown",k,!0),document.addEventListener("keydown",y,!0),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0)):(document.removeEventListener("pointerdown",k,!0),document.removeEventListener("keydown",y,!0),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0))}),or(()=>{document.removeEventListener("pointerdown",k,!0),document.removeEventListener("keydown",y,!0),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}),(b,T)=>(ge(),Ae("div",l7,[Me("div",{ref_key:"triggerRef",ref:i,class:"comments-dropdown__trigger",onClick:m},[Ad(b.$slots,"default",{},void 0,!0)],512),(ge(),dn(Ha,{to:"body"},[o.value?(ge(),Ae("div",{key:0,ref_key:"menuRef",ref:s,class:"comments-dropdown__menu",style:yn(l.value)},[(ge(!0),Ae(Wt,null,rr(e.options,R=>(ge(),Ae("div",{key:R.key,class:rn(["comments-dropdown__option",{"sd-disabled":R.disabled}]),onClick:P=>p(R)},[v(R)?(ge(),Ae("span",u7,[R.iconString?(ge(),Ae("span",{key:0,innerHTML:R.iconString},null,8,d7)):(ge(),dn(et(C),{key:1,option:R},null,8,["option"]))])):ht("",!0),Me("span",f7,Bt(R.label),1)],10,c7))),128))],4)):ht("",!0)]))]))}},C_=fn(h7,[["__scopeId","data-v-7eced80a"]]);xt(),gn();var p7={class:"sd-comment-option"},m7=["innerHTML"],g7={class:"sd-option-state"},v7=["innerHTML"],y7={__name:"InternalDropdown",props:{state:{type:String,required:!1},isDisabled:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:t}){const n=t,r=e,{uiFontFamily:o}=s0(),i=[{label:"Internal",key:"internal",iconString:la.internal,backgroundColor:"var(--sd-ui-comments-internal-bg, #CDE6E6)"},{label:"External",key:"external",iconString:la.external,backgroundColor:"var(--sd-ui-comments-external-bg, #F5CFDA)"}],s=ke(()=>i.find(d=>d.key===u.value)?.label),a=ke(()=>{if(!r.state)return{};const d=i.find(m=>m.key===u.value);if(!d)return{};const h={backgroundColor:d.backgroundColor};return r.isDisabled&&(h.opacity=.5,h.cursor="default"),h}),l=(d,h=!1)=>{u.value=d,c.value=i.find(m=>m.key===d)?.iconString,!h&&n("select",d)},u=ne(r.state),c=ne(null);return Lt(()=>r.state,d=>{l(d)}),Nn(()=>{l(r.state,!0)}),(d,h)=>(ge(),Ae("div",{class:"sd-internal-dropdown",style:yn(a.value),"data-sd-part":"dropdown-trigger"},[jt(C_,{options:i,onSelect:h[0]||(h[0]=m=>l(m)),disabled:e.isDisabled,"content-style":{fontFamily:et(o)}},{default:Eo(()=>[Me("div",p7,[Me("div",{class:"sd-active-icon",innerHTML:c.value},null,8,m7),Me("div",g7,Bt(s.value),1),Me("div",{class:"sd-dropdown-caret",innerHTML:et(la).caretDown},null,8,v7)])]),_:1},8,["disabled","content-style"])],4))}},__=fn(y7,[["__scopeId","data-v-138d641e"]]);function b7(e){const t=new Date(e),n=t.getHours(),r=t.getMinutes(),o=n>=12?"PM":"AM",i=n%12||12,s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],a=t.getDate();return`${`${i}:${r.toString().padStart(2,"0")}${o}`} ${s} ${a}`}const no=Object.freeze({RESOLVE_OWN:"RESOLVE_OWN",RESOLVE_OTHER:"RESOLVE_OTHER",REJECT_OWN:"REJECT_OWN",REJECT_OTHER:"REJECT_OTHER",COMMENTS_OVERFLOW_OWN:"COMMENTS_OVERFLOW",COMMENTS_OVERFLOW_OTHER:"COMMENTS_OVERFLOW_OTHER",COMMENTS_DELETE_OWN:"COMMENTS_DELETE_OWN",COMMENTS_DELETE_OTHER:"COMMENTS_DELETE_OTHER",UPLOAD_VERSION:"UPLOAD_VERSION",VERSION_HISTORY:"VERSION_HISTORY"});var mr=Object.freeze({EDITOR:"editor",SUGGESTER:"suggester",VIEWER:"viewer"}),w7=Object.freeze({[no.RESOLVE_OWN]:{internal:[mr.EDITOR],external:[mr.EDITOR]},[no.RESOLVE_OTHER]:{internal:[mr.EDITOR],external:[mr.EDITOR]},[no.REJECT_OWN]:{internal:[mr.EDITOR,mr.SUGGESTER],external:[mr.EDITOR,mr.SUGGESTER]},[no.REJECT_OTHER]:{internal:[mr.EDITOR],external:[mr.EDITOR]},[no.COMMENTS_OVERFLOW_OWN]:{internal:[mr.EDITOR,mr.SUGGESTER],external:[mr.EDITOR,mr.SUGGESTER]},[no.COMMENTS_OVERFLOW_OTHER]:{internal:[mr.EDITOR],external:[mr.EDITOR]},[no.COMMENTS_DELETE_OWN]:{internal:[mr.EDITOR,mr.SUGGESTER],external:[mr.EDITOR,mr.SUGGESTER]},[no.COMMENTS_DELETE_OTHER]:{internal:[mr.EDITOR],external:[mr.EDITOR]},[no.UPLOAD_VERSION]:{internal:[mr.EDITOR],external:[]},[no.VERSION_HISTORY]:{internal:[mr.EDITOR],external:[]}}),C7=(e={})=>{if(typeof e.permissionResolver=="function")return e.permissionResolver;if(e.superdoc?.config?.modules?.comments?.permissionResolver){const t=e.superdoc.config.modules.comments.permissionResolver;if(typeof t=="function")return t}return typeof e.superdoc?.config?.permissionResolver=="function"?e.superdoc.config.permissionResolver:null},_7=(e,t,n)=>{const r=n?"internal":"external";return w7[e]?.[r]?.includes(t)??!1};const ca=(e,t,n,r={})=>{const o=_7(e,t,n),i=C7(r);if(typeof i!="function")return o;const s=i({permission:e,role:t,isInternal:n,defaultDecision:o,comment:r.comment??null,currentUser:r.currentUser??r.superdoc?.config?.user??null,superdoc:r.superdoc??null,trackedChange:r.trackedChange??null});return typeof s=="boolean"?s:o};xt(),gn();var S7={class:"user-container"},k7=["src"],A7={key:1,class:"user-bg"},I7={__name:"Avatar",props:{user:{type:Object,required:!0}},setup(e){const t=(n,r)=>{if(!(!n&&!r)){if(n){const o=n.trim().split(/\s+/).filter(i=>/^[a-zA-Z]/.test(i));if(o.length>=2)return(o[0][0]+o[o.length-1][0]).toUpperCase();if(o.length===1)return o[0][0].toUpperCase()}return r?.substring(0,1)?.toUpperCase()||null}};return(n,r)=>(ge(),Ae("div",S7,[e.user.image?(ge(),Ae("img",{key:0,class:"user-bg",src:e.user.image.startsWith("http")?e.user.image:`data:image/png;base64,${e.user.image}`},null,8,k7)):(ge(),Ae("span",A7,Bt(t(e.user.name,e.user.email)),1))]))}},S_=fn(I7,[["__scopeId","data-v-c95b2073"]]);xt(),gn();var E7={class:"card-section comment-header"},x7={class:"comment-header-left"},T7={class:"user-info"},R7={class:"user-name"},M7={key:0,class:"imported-tag"},L7={key:0,class:"user-timestamp"},P7=["data-disabled-reason","aria-disabled","innerHTML"],D7=["data-disabled-reason","aria-disabled","innerHTML"],O7=["data-disabled-reason","aria-disabled","innerHTML"],F7={class:"overflow-menu__icon"},N7=["innerHTML"],B7={__name:"CommentHeader",props:{timestamp:{type:Number,required:!1},config:{type:Object,required:!0},comment:{type:Object,required:!1},isPendingInput:{type:Boolean,required:!1,default:!1},isActive:{type:Boolean,default:!1},resolveDisabledReason:{type:String,default:null},rejectDisabledReason:{type:String,default:null},reopenDisabledReason:{type:String,default:null},reopenSupported:{type:Boolean,default:!1},writeDisabledReason:{type:String,default:null}},emits:["resolve","reject","reopen","overflow-select"],setup(e,{emit:t}){const n=t,r=aa(),o=e,{proxy:i}=ir(),s=i.$superdoc.config.role,a=i.$superdoc.config.isInternal,l=V=>{const Q=i.$superdoc.config.user,F={id:V?.creatorId,email:V?.creatorEmail};if(Zw({current:Q,other:F}))return!0;const N=Gd(Q),x=Gd(F);if(N.hasId||N.hasEmail||x.hasId||x.hasEmail||V?.origin!=null||V?.importedAuthor?.name)return!1;const z=Xw(Q?.name),J=Xw(V?.creatorName);return!!(z&&J&&z===J)},u=ke(()=>l(o.comment)),c=ke(()=>Mp(o.comment)),{uiFontFamily:d}=s0(),h=Object.freeze({edit:{label:"Edit",key:"edit"},delete:{label:"Delete",key:"delete"}}),m=ke(()=>o.config.readOnly!==!0),p=ke(()=>!(!m.value||!o.comment||o.comment.resolvedTime||r.pendingComment||o.isPendingInput)),v=ke(()=>{if(!p.value||!o.comment.trackedChange&&o.config.allowResolve===!1||o.comment.parentCommentId||c.value)return!1;const V={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value||o.comment.trackedChange?ca(no.RESOLVE_OWN,s,a,V):ca(no.RESOLVE_OTHER,s,a,V)}),_=ke(()=>{if(!p.value||!o.comment.trackedChange)return!1;const V={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value||o.comment.trackedChange?ca(no.REJECT_OWN,s,a,V):ca(no.REJECT_OTHER,s,a,V)}),C=ke(()=>{if(!m.value||o.config.allowResolve===!1||!o.reopenSupported||!o.comment||!o.comment.resolvedTime||r.pendingComment||o.isPendingInput||o.comment.parentCommentId||c.value||o.comment.trackedChange)return!1;const V={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return u.value?ca(no.RESOLVE_OWN,s,a,V):ca(no.RESOLVE_OTHER,s,a,V)}),k=ke(()=>!(!p.value||o.comment.trackedChange||o.isPendingInput||y.value.length===0)),y=ke(()=>{if(!m.value)return[];if(!p.value)return[];if(o.writeDisabledReason)return[];const V=[],Q=new Set;l(o.comment)&&Q.add("edit");const F=l(o.comment),N={comment:o.comment,currentUser:i.$superdoc.config.user,superdoc:i.$superdoc};return(F&&ca(no.COMMENTS_DELETE_OWN,s,a,N)||!F&&ca(no.COMMENTS_DELETE_OTHER,s,a,N))&&Q.add("delete"),Q.forEach(x=>V.push(h[x])),V}),b=()=>{m.value&&(!o.comment?.trackedChange&&o.config.allowResolve===!1||o.resolveDisabledReason||n("resolve"))},T=()=>{m.value&&(o.rejectDisabledReason||n("reject"))},R=()=>{!m.value||o.config.allowResolve===!1||o.reopenDisabledReason||n("reopen")},P=V=>{m.value&&n("overflow-select",V)},j=ke(()=>!(!(o.comment.origin!=null||o.comment.importedAuthor?.name)||l(o.comment))),O=ke(()=>{if(o.isPendingInput)return i.$superdoc.config.user;const V=o.comment.getCommentUser();if(V?.name){const Q=V.name.replace(/\s*\(imported\)\s*/gi,"").trim();if(Q)return{...V,name:Q}}return V});return(V,Q)=>(ge(),Ae("div",E7,[Me("div",x7,[jt(S_,{user:O.value,class:"avatar"},null,8,["user"]),Me("div",T7,[Me("div",R7,[Ni(Bt(O.value.name),1),j.value?(ge(),Ae("span",M7,"IMPORTED")):ht("",!0)]),o.comment.createdTime?(ge(),Ae("div",L7,Bt(et(b7)(o.comment.createdTime)),1)):ht("",!0)])]),Me("div",{class:rn(["overflow-menu",{"is-visible":o.isActive}])},[v.value?(ge(),Ae("div",{key:0,class:rn(["overflow-menu__icon",{"sd-is-disabled":!!e.resolveDisabledReason}]),"data-comment-action":"resolve","data-disabled-reason":e.resolveDisabledReason||null,"aria-disabled":!!e.resolveDisabledReason,innerHTML:et(la).markDone,onClick:tn(b,["stop","prevent"])},null,10,P7)):ht("",!0),_.value?(ge(),Ae("div",{key:1,class:rn(["overflow-menu__icon",{"sd-is-disabled":!!e.rejectDisabledReason}]),"data-comment-action":"reject","data-disabled-reason":e.rejectDisabledReason||null,"aria-disabled":!!e.rejectDisabledReason,innerHTML:et(la).rejectChange,onClick:tn(T,["stop","prevent"])},null,10,D7)):ht("",!0),C.value?(ge(),Ae("div",{key:2,class:rn(["overflow-menu__icon overflow-menu__icon--reopen",{"sd-is-disabled":!!e.reopenDisabledReason}]),"data-disabled-reason":e.reopenDisabledReason||null,"data-comment-reopen":!0,"aria-disabled":!!e.reopenDisabledReason,title:"Reopen comment",innerHTML:et(la).reopen,onClick:tn(R,["stop","prevent"])},null,10,O7)):ht("",!0),k.value?(ge(),dn(C_,{key:3,"data-comment-action":"overflow",options:y.value,onSelect:P,"content-style":{fontFamily:et(d)}},{default:Eo(()=>[Me("div",F7,[Me("div",{class:"overflow-icon",innerHTML:et(la).overflow},null,8,N7)])]),_:1},8,["options","content-style"])):ht("",!0)],2)]))}},a0=fn(B7,[["__scopeId","data-v-ca6050aa"]]);xt(),gn();var z7={class:"input-section"},l0=28,k_=132,V7={__name:"CommentInput",props:{users:{type:Array,required:!1,default:()=>[]},config:{type:Object,required:!0},isFocused:{type:Boolean,default:!1},includeHeader:{type:Boolean,default:!0},comment:{type:Object,required:!1}},emits:["focus"],setup(e,{expose:t,emit:n}){const r=n,{currentCommentText:o}=Js(aa()),i=ne(null),s=p=>r("focus",p),a=()=>{i.value?.focus?.()},l=()=>{const p=i.value;if(!p)return;p.style.height=`${l0}px`;const v=p.scrollHeight||l0,_=Math.min(Math.max(v,l0),k_);p.style.height=`${_}px`,p.style.overflowY=v>k_?"auto":"hidden"},u=()=>{_t(l)},c=p=>String(p??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),d=p=>{const v=String(p??"");if(!v||v==="<p></p>")return"";if(typeof document>"u")return v.replace(/<br\s*\/?>/gi,`
13
+ `).replace(/<[^>]+>/g,"");const _=document.createElement("div");return _.innerHTML=v,_.innerText||_.textContent||""},h=p=>{const v=String(p??"").replace(/\r\n/g,`
14
+ `).trim();return v?v.split(/\n{2,}/).map(_=>`<p>${c(_).replace(/\n/g,"<br>")}</p>`).join(""):"<p></p>"},m=ke({get:()=>d(o.value),set:p=>{o.value=h(p)}});return Nn(u),Lt(o,u),t({focus:a}),(p,v)=>(ge(),Ae("div",z7,[e.includeHeader?(ge(),dn(a0,{key:0,config:e.config,comment:e.comment,"is-pending-input":!0},null,8,["config","comment"])):ht("",!0),Me("div",{class:rn(["comment-entry",{"sd-input-active":e.isFocused}])},[Us(Me("textarea",{ref_key:"inputRef",ref:i,class:"superdoc-field",placeholder:"Add a comment","onUpdate:modelValue":v[0]||(v[0]=_=>m.value=_),rows:"1",onInput:l,onFocus:v[1]||(v[1]=_=>s(!0)),onBlur:v[2]||(v[2]=_=>s(!1))},null,544),[[Ai,m.value]])],2)]))}},c0=fn(V7,[["__scopeId","data-v-cc54b489"]]);xt(),gn();var H7=["data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],j7={key:0,class:"existing-internal-input"},U7={class:"new-comment-input-wrapper"},G7={class:"reply-actions"},W7=["disabled"],K7={key:0,class:"resolved-badge"},q7=["innerHTML"],Y7={key:1,class:"existing-internal-input"},X7={key:0,class:"card-section comment-body"},Z7=["data-track-change-semantic-color-key"],Q7={key:0},J7={class:"change-type tracked-change-label"},$7={key:0,class:"tracked-change-detail-lines"},eR={key:0,class:"tracked-change-text"},tR={key:1,class:"change-type"},nR={class:"change-type"},rR={key:1},oR={class:"tracked-change-text is-inserted"},iR={key:2},sR={class:"tracked-change-text is-inserted"},aR={key:3},lR={key:4},cR={key:5},uR={key:6},dR={class:"tracked-change-text"},fR={key:7},hR={class:"tracked-change-text is-deleted"},pR={class:"tracked-change-text is-inserted"},mR={key:8},gR={class:"tracked-change-text is-deleted"},vR={key:9},yR={class:"tracked-change-text is-inserted"},bR=["data-track-change-image-preview-role"],wR=["src","alt"],CR={key:1,class:"card-section comment-body"},_R=["innerHTML"],SR={key:1,class:"comment"},kR={key:2,class:"reply-expanded"},AR={class:"reply-input-wrapper"},IR={class:"reply-actions"},ER=["onClick"],xR=["onClick","disabled","data-disabled-reason"],TR={class:"collapsed-avatars"},RR={key:3,class:"comment-separator"},MR={key:2,class:"tracked-change-decision-alert",role:"alert"},LR={class:"tracked-change-decision-alert__message"},PR=["disabled","data-disabled-reason"],DR={key:1,class:"reply-expanded"},OR={class:"reply-input-wrapper"},FR={class:"reply-actions"},NR=["disabled","data-disabled-reason"],Lp=3,A_=90,BR={__name:"CommentDialog",props:{comment:{type:Object,required:!0},autoFocus:{type:Boolean,default:!1},parent:{type:Object,required:!1},floatingInstanceId:{type:String,default:null},floatingPageIndex:{type:Number,default:null},floatingPositionEntry:{type:Object,default:null},isFloatingInstanceActive:{type:Boolean,default:void 0}},emits:["click-outside","ready","dialog-exit","resize"],setup(e,{emit:t}){const n=t,r=e,{proxy:o}=ir(),i=hu(),s=aa(),{addComment:a,cancelComment:l,deleteComment:u,getCommentAliasIds:c,removePendingComment:d,getCommentDocumentId:h,requestInstantSidebarAlignment:m,resolveCommentPositionEntry:p,clearInstantSidebarAlignment:v,setActiveFloatingCommentInstance:_}=s,{suppressInternalExternal:C,getConfig:k,activeComment:y,activeFloatingCommentInstanceId:b,floatingCommentsOffset:T,pendingComment:R,currentCommentText:P,isDebugging:j,editingCommentId:O,editorCommentPositions:V,isCommentHighlighted:Q}=Js(s),F=ne(!0),N=ne(null),x=ne(new Map),z=ne(null),J=[[0,0],[-Lp,0],[Lp,0],[0,-Lp],[0,Lp]],X=_e=>{const ze=typeof _e?.width=="number"&&Number.isFinite(_e.width)?_e.width:null,vt=typeof _e?.height=="number"&&Number.isFinite(_e.height)?_e.height:null;if(!ze||!vt||ze<=0||vt<=0)return{};const ot=Math.min(A_/ze,A_/vt,1);return{width:`${Math.max(1,Math.round(ze*ot))}px`,height:`${Math.max(1,Math.round(vt*ot))}px`}},ae=[".comments-dropdown__option-label",".comments-dropdown__menu",".comments-dropdown__option",".comments-dropdown__option-icon",".comments-dropdown__trigger",".superdoc-comment-highlight",".sd-editor-comment-highlight",".sd-editor-tracked-change-highlight","[data-track-change-id]",".track-insert",".track-insert-dec",".track-delete",".track-delete-dec",".track-format",".track-format-dec"].join(","),pe=_e=>ze=>{_e&&(ze?(x.value.set(_e,ze),O.value===_e&&_t(()=>{ye(_e)})):x.value.delete(_e))},Fe=(_e,ze,vt)=>{const ot=_e?.getBoundingClientRect?.();return!ot||![ot.left,ot.top,ot.right,ot.bottom].every(Number.isFinite)||ot.width<=0||ot.height<=0?!1:J.some(([xn,Tn])=>{const _r=ze+xn,jr=vt+Tn;return _r>=ot.left&&_r<=ot.right&&jr>=ot.top&&jr<=ot.bottom})},fe=(_e,ze)=>{if(!Number.isFinite(_e)||!Number.isFinite(ze))return null;const vt=document.querySelectorAll(ae);for(const ot of vt)if(ot instanceof HTMLElement&&Fe(ot,_e,ze))return ot;return null},ye=_e=>{x.value.get(_e)?.focus?.()},le=ne(null),Se=_e=>_e.resolvedTime?_e.commentId:_e.importedId||_e.commentId,re=_e=>_e?_e.trackedChange&&_e.importedId!=null?String(_e.importedId):_e.commentId!=null?String(_e.commentId):null:null,xe=(_e,ze)=>{const vt=_e?.bounds?.[ze];return Number.isFinite(vt)?vt:null},$e=(_e,ze)=>{if(!_e||!ze||_e.pageIndex!==ze.pageIndex)return!1;const vt=xe(_e,"top"),ot=xe(ze,"top");return vt!=null&&ot!=null&&Math.abs(vt-ot)<.5},st=(_e,ze)=>{const vt=xe(_e,"left"),ot=xe(ze,"left"),xn=xe(_e,"right"),Tn=xe(ze,"right");return[vt,ot,xn,Tn].some(_r=>_r==null)?!1:ot<xn&&vt<Tn},At=(_e,ze)=>{const vt=_e?.start,ot=_e?.end,xn=ze?.start,Tn=ze?.end;return[vt,ot,xn,Tn].every(Number.isFinite)?xn<=ot&&vt<=Tn:!1},Ee=(_e,ze)=>!_e||!ze||_e.kind&&ze.kind&&_e.kind!==ze.kind||_e.storyKey&&ze.storyKey&&_e.storyKey!==ze.storyKey?!1:ze.start===_e.start&&ze.end===_e.end?!0:$e(_e,ze)&&st(_e,ze)&&At(_e,ze),Ge=_e=>{const ze=new Set(c(_e)),{key:vt,entry:ot}=p(_e);return vt&&ze.add(vt),ot?(Object.entries(V.value??{}).forEach(([xn,Tn])=>{Ee(ot,Tn)&&ze.add(xn)}),[...ze]):[...ze]},qe=(_e,ze,vt=24)=>{if(!Number.isFinite(ze)||typeof _e?.getBoundingClientRect!="function")return!1;const ot=_e.getBoundingClientRect().top;return Number.isFinite(ot)&&Math.abs(ot-ze)<=vt},Z=ke(()=>r.floatingInstanceId??r.comment.commentId??null),S=ke(()=>typeof r.isFloatingInstanceActive=="boolean"?r.isFloatingInstanceActive:y.value!==r.comment.commentId?!1:r.floatingInstanceId==null?!0:b.value===r.floatingInstanceId),ee=ke(()=>r.comment.resolvedTime?r.comment.trackedChange?r.comment.trackedChangeDecision==="reject"?"Rejected":"Accepted":"Resolved":null),D=ke(()=>R.value&&R.value.commentId===r.comment.commentId),U=ke(()=>_e=>{const ze=Ye.value;return H.value&&_e===ze.length-1?!0:ze.length>1&&_e!==ze.length-1}),H=ke(()=>!k.readOnly&&S.value&&!r.comment.resolvedTime&&!Pt.value),G=()=>({ok:!1,reason:"read-only-document"}),te=()=>k.value?.readOnly===!0,Y=ne(!1),K=ne(!1),be=()=>{if(te())return G();if(hn.value)return{ok:!1,reason:cn.value?.reason??"v2-write-unavailable"};Y.value=!0,_t(()=>{N.value?.focus?.(),n("resize")})},me=ke(()=>{const _e=r.comment;return _e.trackedChange?s.getTrackedChangeThread(_e):s.commentsList.filter(ze=>{const vt=ze.parentCommentId===_e.commentId,ot=ze.commentId===_e.commentId;return vt||ot}).sort((ze,vt)=>ze.commentId===_e.commentId?-1:vt.commentId===_e.commentId?1:ze.createdTime-vt.createdTime)}),Ce=ne(!1),Pe=ne(null),it=ne(!1),He=ke(()=>!Ce.value),Ct=ke(()=>({"is-truncated":He.value,"is-scrollable":Ce.value&&it.value})),Yt=()=>{Ce.value=!Ce.value,_t(()=>n("resize"))},St=_e=>{Pe.value=_e??null},Ft=()=>{if(Ce.value)return;const _e=Pe.value;if(!_e){it.value=!1;return}it.value=_e.scrollHeight>_e.clientHeight+1};Lt(Pe,()=>{_t(Ft)});const Nt=()=>O.value?me.value.some(_e=>_e.commentId===O.value):!1;Lt(S,_e=>{_e||((Y.value||Nt())&&(P.value="",O.value=null),Ce.value=!1,sn.value=!1,Y.value=!1,_t(()=>n("resize")))});const sn=ne(!1),_n=ke(()=>me.value.slice(1)),Qt=ke(()=>sn.value?!1:_n.value.length>=2),Ye=ke(()=>Qt.value?[me.value[0],_n.value[_n.value.length-1]].filter(Boolean):me.value);Lt(ke(()=>{const _e=Ye.value[0];return _e?JSON.stringify({commentId:_e.commentId,commentText:_e.commentText,trackedChange:_e.trackedChange,trackedChangeText:_e.trackedChangeText,deletedText:_e.deletedText,trackedChangeLabel:_e.trackedChangeLabel,trackedChangeDisplayType:_e.trackedChangeDisplayType,trackedChangeDetailLines:_e.trackedChangeDetailLines}):""}),()=>{_t(Ft)});const Et=ke(()=>Qt.value?_n.value.length-1:0),Ot=ke(()=>{if(!Qt.value)return[];const _e=_n.value.slice(0,-1),ze=new Set;return _e.map(vt=>typeof vt.getCommentUser=="function"?vt.getCommentUser():{name:vt.creatorName,email:vt.creatorEmail||vt.email}).filter(vt=>{if(!vt)return!1;const ot=vt.email||vt.name;return ze.has(ot)?!1:(ze.add(ot),!0)}).slice(0,3)}),wn=()=>{sn.value=!0,Ke(),_t(()=>n("resize"))},Kt=ke(()=>r.comment.resolvedTime?!0:k.value.readOnly),Sn=ke(()=>_e=>S.value&&O.value===_e.commentId),Pt=ke(()=>!O.value||!S.value?!1:me.value.some(_e=>_e.commentId===O.value)),De=ke(()=>k.value.readOnly||!o.$superdoc.config.isInternal||ft.value?!1:!C.value&&!r.comment.trackedChange),je=ke(()=>P.value&&P.value!=="<p></p>"),Ke=async()=>{const _e=o.$superdoc.activeEditor,ze=_e?.editorVersion===2?_e?.v2Comments??null:null,vt=!!r.comment?.trackedChange,ot=o7(),xn=r.floatingInstanceId!=null,Tn=le.value?.getBoundingClientRect?.().top,_r=!r.comment.resolvedTime&&(y.value!==r.comment.commentId||xn&&Z.value!==b.value);let jr=ot;if(ze){const gi=!vt&&String(r.comment?.trackedChangeParentId??"").trim()?r.comment.trackedChangeParentId:null,Ji=_e?.editorVersion===2&&(vt||gi!=null)?_e?.v2TrackedChanges??null:null,Es=gi!=null?s.getComment(gi):null,No=vt?r.comment:Es?.trackedChange?Es:gi;let Yr=await(Ji?Ji.focusTrackedChange(No):ze.focusComment(r.comment));return!vt&&Yr?.reason==="tracked-change-anchor-not-found"&&(Yr=await ze.focusComment(r.comment)),Yr?.ok?(r.comment.resolvedTime||(y.value=r.comment.commentId,r.floatingInstanceId&&_(r.floatingInstanceId)),_r&&!xn?m(ot,r.comment.commentId,r.floatingInstanceId??null):_r&&Number.isFinite(Tn)?m(Tn,r.comment.commentId,r.floatingInstanceId):v(),Yr):(v(),Yr)}if(_e){const{entry:gi}=p(r.comment),Ji=r.floatingPositionEntry??gi,Es=Number.isFinite(r.floatingPageIndex)&&r.comment?.trackedChangeStory?.storyType==="headerFooterPart",No=w_(r.parent,Ji),Yr=Es?null:i7(Ge(r.comment)),Jo=Number.isFinite(Yr)?Yr:No,$i=qe(le.value,Jo),Mi=Se(r.comment),lo=null;let $o=null;if(vt)if(r.comment.trackedChangeStory&&(r.comment.trackedChangeStory,{...Number.isFinite(r.floatingPageIndex)?{pageIndex:r.floatingPageIndex}:{}}),r.comment.resolvedTime)_e.commands?.setCursorById(Mi);else{const Xr=r.comment.commentId;_e.commands?.setCursorById(Mi,{activeCommentId:Xr})||_e.commands?.setActiveComment({commentId:Xr})}else{if(r.comment.resolvedTime)_e.commands?.setCursorById(Mi);else{const ur=r.comment.commentId;_e.commands?.setCursorById(Mi,{activeCommentId:ur})||_e.commands?.setActiveComment({commentId:ur})}const Xr=r.comment.commentId;$o=$i?null:s7(lo,Mi,Xr,ot)}Number.isFinite(Yr)?jr=Yr:Number.isFinite(No)?jr=No:Number.isFinite($o)&&(jr=$o)}_r&&!xn?r.floatingInstanceId?m(jr,r.comment.commentId,r.floatingInstanceId):m(jr,r.comment.commentId):v(),r.comment.resolvedTime||(y.value=r.comment.commentId,r.floatingInstanceId&&_(r.floatingInstanceId))},pt=_e=>{const ze=_e.target instanceof Element?_e.target:_e.target?.parentElement,vt=document.elementFromPoint(_e.clientX,_e.clientY);if(!(ze?.closest?.(ae)||vt?.closest?.(ae)||fe(_e.clientX,_e.clientY)||Q.value)&&!(_e.target.closest?.(".comments-dialog")&&!le.value?.contains(_e.target))){if(D.value){l(o.$superdoc);return}S.value&&(T.value=0,n("dialog-exit"),y.value=null,s.setActiveComment(o.$superdoc,y.value),Q.value=!1)}},kt=async()=>{if(te())return G();if(hn.value)return{ok:!1,reason:cn.value?.reason??"v2-write-unavailable"};if(ft.value&&an.value&&!D.value){if(K.value)return{ok:!1,reason:"reply-submit-in-flight"};K.value=!0;try{const vt=await s.replyCommentV2({superdoc:o.$superdoc,parentCommentId:re(r.comment),text:P.value});return vt?.ok?(Y.value=!1,P.value="",_t(()=>n("resize")),vt):(_t(()=>n("resize")),vt)}finally{K.value=!1}}const _e={documentId:r.comment.fileId,isInternal:R.value?R.value.isInternal:F.value,parentCommentId:R.value?null:r.comment.commentId};R.value&&(_e.selection=R.value.selection.getValues());const ze=s.getPendingComment(_e);!R.value&&P.value&&ze.setText({text:P.value,suppressUpdate:!0}),Promise.resolve(a({superdoc:o.$superdoc,comment:ze})).finally(()=>{Y.value=!1,_t(()=>n("resize"))})},ft=ke(()=>o.$superdoc?.activeEditor?.editorVersion===2),an=ke(()=>ft.value?o.$superdoc?.activeEditor?.v2Comments??null:null),qt=ke(()=>ft.value?o.$superdoc?.activeEditor?.v2TrackedChanges??null:null),cn=ke(()=>{if(!an.value)return null;const _e=s.viewingVisibility.documentMode,ze=an.value.getCapabilityState?.()??null;return _e==="viewing"?{...ze??{},canWrite:!1,reason:"review-surface-read-only"}:ze}),hn=ke(()=>{if(!ft.value)return!1;const _e=cn.value;return _e?_e.canWrite===!1:!1}),oo=ke(()=>K.value?"reply-submit-in-flight":hn.value?cn.value?.reason??"v2-write-unavailable":null),Jt=ke(()=>{if(!qt.value)return null;const _e=s.viewingVisibility.documentMode,ze=qt.value.getCapabilityState?.()??null;return _e==="viewing"&&ze?.canDecide!==!1?{canDecide:!1,reason:"review-surface-read-only"}:ze}),Yn=_e=>{if(ft.value&&_e?.trackedChange){if(!qt.value)return"v2-tracked-change-adapter-missing";const ze=Jt.value;return ze&&ze.canDecide===!1?ze.reason??"v2-tracked-change-unavailable":null}return hn.value?cn.value?.reason??"v2-write-unavailable":null},Nr=_e=>{if(ft.value&&_e?.trackedChange){if(!qt.value)return"v2-tracked-change-adapter-missing";const ze=Jt.value;return ze&&ze.canDecide===!1?ze.reason??"v2-tracked-change-unavailable":null}return hn.value?cn.value?.reason??"v2-write-unavailable":null},io=()=>ft.value?an.value?k.value?.readOnly?"read-only-document":hn.value?cn.value?.reason??"v2-write-unavailable":null:"v2-comments-adapter-missing":null,vo=ke(()=>!ft.value||!hn.value?null:cn.value?.reason??"v2-write-unavailable"),$t=(_e,ze)=>{z.value={decision:_e,reason:ze?.reason??null},_t(()=>n("resize"))},Bn=()=>{z.value&&(z.value=null,_t(()=>n("resize")))},xi=ke(()=>{const _e=z.value;if(!_e)return null;const ze=_e.decision==="reject"?"reject":"accept";return _e.reason==="stale-catalog"?`Couldn't ${ze} this change because the review list is stale.`:`Couldn't ${ze} this change.`}),Is=()=>{const _e=z.value;if(_e){if(z.value=null,_e.decision==="reject"){so();return}cr()}},so=async()=>{if(te())return G();const _e=o.$superdoc.config.onTrackedChangeBubbleReject;if(r.comment.trackedChange){if(ft.value){const vt=await s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"reject"});if(!vt?.ok||vt.success===!1){$t("reject",vt);return}Bn(),typeof _e=="function"&&_e(r.comment,o.$superdoc.activeEditor),_t(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.({preventScroll:!0})});return}let ze=!0;if(typeof _e=="function")_e(r.comment,o.$superdoc.activeEditor);else{const vt=s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"reject"});ze=!!vt?.ok&&vt.success!==!1}ze&&r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc,decision:"reject"})}else if(ft.value&&an.value){if(!(await s.deleteComment({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok)return}else s.deleteComment({superdoc:o.$superdoc,commentId:r.comment.commentId});_t(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},cr=async()=>{if(te())return G();if(!r.comment.trackedChange&&k.value?.allowResolve===!1)return{ok:!1,reason:"resolve-disabled"};const _e=o.$superdoc.config.onTrackedChangeBubbleAccept;if(r.comment.trackedChange&&ft.value){const vt=await s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"accept"});if(!vt?.ok||vt.success===!1){$t("accept",vt);return}Bn(),typeof _e=="function"&&_e(r.comment,o.$superdoc.activeEditor),_t(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.({preventScroll:!0})});return}let ze=!0;if(r.comment.trackedChange&&typeof _e=="function")_e(r.comment,o.$superdoc.activeEditor);else if(r.comment.trackedChange){const vt=s.decideTrackedChangeFromSidebar({superdoc:o.$superdoc,comment:r.comment,decision:"accept"});ze=!!vt?.ok&&vt.success!==!1}else if(ft.value&&an.value){if(!(await s.resolveCommentV2({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok)return}else r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc});r.comment.trackedChange&&!ft.value&&ze&&r.comment.resolveComment({id:i.user.id,email:i.user.email,name:i.user.name,superdoc:o.$superdoc,decision:"accept"}),_t(()=>{s.lastUpdate=new Date,y.value=null,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},Qo=async()=>{if(te())return G();if(k.value?.allowResolve===!1)return{ok:!1,reason:"resolve-disabled"};!ft.value||!an.value||(await s.reopenCommentV2({superdoc:o.$superdoc,commentId:r.comment.commentId}))?.ok&&_t(()=>{s.lastUpdate=new Date,s.setActiveComment(o.$superdoc,y.value),o.$superdoc.focus?.()})},Zi=(_e,ze)=>{if(te())return G();switch(_e){case"edit":P.value=ze?.commentText?.value??ze?.commentText??"",y.value=r.comment.commentId,r.floatingInstanceId&&_(r.floatingInstanceId),O.value=ze.commentId,s.setActiveComment(o.$superdoc,y.value),_t(()=>{ye(ze.commentId)});break;case"delete":u({superdoc:o.$superdoc,commentId:ze.commentId});break}},va=async _e=>{if(te())return G();if(ft.value&&an.value){const ze=await s.editCommentV2({superdoc:o.$superdoc,commentId:_e.commentId,text:P.value});return ze?.ok&&(O.value=null,d(o.$superdoc)),ze}O.value=null,_e.setText({text:P.value,superdoc:o.$superdoc}),d(o.$superdoc)},Qi=_e=>{if(te())return G();const ze=!!R.value,vt=_e.toLowerCase()==="internal";ze?R.value.isInternal=vt:r.comment.setIsInternal({isInternal:vt,superdoc:o.$superdoc})},hl=ke(()=>{const _e={};return(S.value||D.value||Pt.value)&&(_e.zIndex=50),_e}),Ti=_e=>typeof _e=="string"?new Date(_e).getTime():_e,ao=_e=>{O.value=null,Y.value=!1,l(o.$superdoc)},Ri=ke(()=>{const _e=o.$superdoc.users;return r.comment.isInternal===!0?_e.filter(ze=>ze.access?.role==="internal"):_e});return Nn(()=>{r.autoFocus&&_t(()=>Ke()),D.value&&_t(()=>{N.value?.focus?.()}),_t(()=>{n("ready",{commentId:r.floatingInstanceId??(r.comment.importedId!==void 0?r.comment.importedId:r.comment.commentId),elementRef:le}),Ft()})}),Lt(H,_e=>{_e&&_t(()=>{N.value?.focus?.()})},{immediate:!0}),Lt(O,_e=>{if(!_e||!S.value)return;const ze=me.value.find(vt=>vt.commentId===_e);!ze||ze.trackedChange||_t(()=>{ye(_e)})}),Lt(()=>k.value?.readOnly===!0,_e=>{_e&&(Y.value=!1,me.value.some(ze=>ze.commentId===O.value)&&(O.value=null),D.value&&l(o.$superdoc),_t(()=>n("resize")))},{immediate:!0}),Lt(hn,_e=>{_e&&(Y.value=!1,_t(()=>n("resize")))}),(_e,ze)=>{const vt=Y2("click-outside");return Us((ge(),Ae("div",{class:rn(["comments-dialog",{"is-active":S.value||D.value,"is-resolved":r.comment.resolvedTime}]),onClick:tn(Ke,["stop","prevent"]),style:yn(hl.value),ref_key:"commentDialogElement",ref:le,role:"dialog","data-sd-part":"comment-thread","data-editor-ui-surface":"","data-comment-instance-id":r.floatingInstanceId??"","data-comment-thread-id":r.comment.commentId??"","data-comment-position-key":r.comment.trackedChangeAnchorKey??"","data-comment-page-index":Number.isFinite(r.floatingPageIndex)?r.floatingPageIndex:""},[D.value?(ge(),Ae(Wt,{key:0},[De.value?(ge(),Ae("div",j7,[jt(__,{onClick:ze[0]||(ze[0]=tn(()=>{},["stop","prevent"])),class:"sd-internal-dropdown","is-disabled":!1,state:et(R).isInternal?"internal":"external",onSelect:Qi},null,8,["state"])])):ht("",!0),jt(a0,{config:et(k),comment:r.comment,"is-pending-input":!0},null,8,["config","comment"]),Me("div",U7,[jt(c0,{ref_key:"commentInput",ref:N,users:Ri.value,config:et(k),comment:r.comment,"include-header":!1},null,8,["users","config","comment"])]),Me("div",G7,[Me("button",{class:"sd-button reply-btn-cancel",onClick:tn(ao,["stop","prevent"])},"Cancel"),Me("button",{class:rn(["sd-button primary reply-btn-primary",{"sd-is-disabled":!je.value}]),onClick:tn(kt,["stop","prevent"]),disabled:!je.value}," Comment ",10,W7)])],64)):(ge(),Ae(Wt,{key:1},[ee.value?(ge(),Ae("div",K7,[Me("span",{class:"resolved-badge__icon",innerHTML:et(la).markDone},null,8,q7),Ni(" "+Bt(ee.value),1)])):ht("",!0),De.value?(ge(),Ae("div",Y7,[jt(__,{onClick:ze[1]||(ze[1]=tn(()=>{},["stop","prevent"])),class:"sd-internal-dropdown","is-disabled":Kt.value,state:e.comment.isInternal?"internal":"external",onSelect:Qi},null,8,["is-disabled","state"])])):ht("",!0),(ge(!0),Ae(Wt,null,rr(Ye.value,(ot,xn)=>(ge(),Ae("div",{key:ot.commentId,class:"conversation-item"},[jt(a0,{config:et(k),timestamp:Ti(ot.createdTime),comment:ot,"is-active":S.value,"resolve-disabled-reason":Yn(ot),"reject-disabled-reason":Nr(ot),"reopen-supported":ft.value&&!!an.value,"reopen-disabled-reason":io(),"write-disabled-reason":vo.value,onResolve:cr,onReject:so,onReopen:Qo,onOverflowSelect:Tn=>Zi(Tn,ot)},null,8,["config","timestamp","comment","is-active","resolve-disabled-reason","reject-disabled-reason","reopen-supported","reopen-disabled-reason","write-disabled-reason","onOverflowSelect"]),ot.trackedChange?(ge(),Ae("div",X7,[Me("div",{class:rn(["tracked-change",xn===0?Ct.value:void 0]),"data-track-change-semantic-color-key":ot.semanticColorKey??void 0,ref_for:!0,ref:xn===0?St:void 0},[ot.trackedChangeLabel?(ge(),Ae("div",Q7,[Me("span",J7,Bt(ot.trackedChangeLabel),1),ot.trackedChangeDetailLines&&ot.trackedChangeDetailLines.length?(ge(),Ae("div",$7,[(ge(!0),Ae(Wt,null,rr(ot.trackedChangeDetailLines,(Tn,_r)=>(ge(),Ae("div",{key:_r,class:"tracked-change-detail-line"},[Tn.excerpt?(ge(),Ae("span",eR,'"'+Bt(Tn.excerpt)+'"',1)):ht("",!0),Tn.excerpt?(ge(),Ae("span",tR," β€” ")):ht("",!0),Me("span",nR,Bt(Tn.label),1)]))),128))])):ht("",!0)])):ot.trackedChangeDisplayType==="hyperlinkAdded"?(ge(),Ae("div",rR,[ze[2]||(ze[2]=Me("span",{class:"change-type"},"Added hyperlink ",-1)),Me("span",oR,'"'+Bt(ot.trackedChangeText)+'"',1)])):ot.trackedChangeDisplayType==="hyperlinkModified"?(ge(),Ae("div",iR,[ze[3]||(ze[3]=Me("span",{class:"change-type"},"Changed hyperlink to ",-1)),Me("span",sR,'"'+Bt(ot.trackedChangeText)+'"',1)])):ot.trackedChangeDisplayType==="paragraphSplit"?(ge(),Ae("div",aR,[...ze[4]||(ze[4]=[Me("span",{class:"change-type"},"Added new line",-1)])])):ot.trackedChangeDisplayType==="tableInsert"?(ge(),Ae("div",lR,[...ze[5]||(ze[5]=[Me("span",{class:"change-type"},"Added table",-1)])])):ot.trackedChangeDisplayType==="tableDelete"?(ge(),Ae("div",cR,[...ze[6]||(ze[6]=[Me("span",{class:"change-type"},"Deleted table",-1)])])):ot.trackedChangeType==="trackFormat"?(ge(),Ae("div",uR,[ze[7]||(ze[7]=Me("span",{class:"change-type"},"Format: ",-1)),Me("span",dR,Bt(ot.trackedChangeText),1)])):ot.trackedChangeType==="both"?(ge(),Ae("div",fR,[ze[8]||(ze[8]=Me("span",{class:"change-type"},"Replaced ",-1)),Me("span",hR,'"'+Bt(ot.deletedText)+'"',1),ze[9]||(ze[9]=Me("span",{class:"change-type"}," with ",-1)),Me("span",pR,'"'+Bt(ot.trackedChangeText)+'"',1)])):ot.deletedText?(ge(),Ae("div",mR,[ze[10]||(ze[10]=Me("span",{class:"change-type"},"Deleted ",-1)),Me("span",gR,'"'+Bt(ot.deletedText)+'"',1)])):ot.trackedChangeText?(ge(),Ae("div",vR,[ze[11]||(ze[11]=Me("span",{class:"change-type"},"Added ",-1)),Me("span",yR,'"'+Bt(ot.trackedChangeText)+'"',1)])):ht("",!0),ot.trackedChangeImagePreview?.src?(ge(),Ae("div",{key:10,class:"tracked-change-image-preview","data-track-change-image-preview-role":ot.trackedChangeImagePreview.role??void 0},[Me("img",{class:"tracked-change-image-preview__image",src:ot.trackedChangeImagePreview.src,alt:ot.trackedChangeImagePreview.alt||"Tracked image preview",style:yn(X(ot.trackedChangeImagePreview)),loading:"lazy",decoding:"async"},null,12,wR)],8,bR)):ht("",!0)],10,Z7),He.value&&it.value&&xn===0?(ge(),Ae("div",{key:0,class:"show-more-toggle",onClick:tn(Yt,["stop","prevent"])}," Show more ")):ht("",!0),Ce.value&&it.value&&xn===0?(ge(),Ae("div",{key:1,class:"show-more-toggle",onClick:tn(Yt,["stop","prevent"])}," Show less ")):ht("",!0)])):ht("",!0),ot.trackedChange?ht("",!0):(ge(),Ae("div",CR,[!et(j)&&!Sn.value(ot)?(ge(),Ae("div",{key:0,class:rn(["comment",xn===0?Ct.value:void 0]),ref_for:!0,ref:xn===0?St:void 0,innerHTML:ot.commentText},null,10,_R)):et(j)&&!Sn.value(ot)?(ge(),Ae("div",SR,Bt(et(V)[ot.importedId!==void 0?ot.importedId:ot.commentId]?.bounds),1)):(ge(),Ae("div",kR,[Me("div",AR,[jt(c0,{ref_for:!0,ref:pe(ot.commentId),users:Ri.value,config:et(k),"include-header":!1,comment:ot},null,8,["users","config","comment"])]),Me("div",IR,[Me("button",{class:"sd-button reply-btn-cancel",onClick:tn(Tn=>ao(ot),["stop","prevent"])},"Cancel",8,ER),Me("button",{class:rn(["sd-button primary reply-btn-primary",{"sd-is-disabled":!je.value||hn.value}]),onClick:tn(Tn=>va(ot),["stop","prevent"]),disabled:!je.value||hn.value,"data-disabled-reason":hn.value?cn.value?.reason??null:null}," Update ",10,xR)])])),He.value&&it.value&&xn===0&&!Sn.value(ot)?(ge(),Ae("div",{key:3,class:"show-more-toggle",onClick:tn(Yt,["stop","prevent"])}," Show more ")):ht("",!0),Ce.value&&it.value&&xn===0&&!Sn.value(ot)?(ge(),Ae("div",{key:4,class:"show-more-toggle",onClick:tn(Yt,["stop","prevent"])}," Show less ")):ht("",!0)])),Qt.value&&xn===0?(ge(),Ae(Wt,{key:2},[ze[12]||(ze[12]=Me("div",{class:"comment-separator"},null,-1)),Me("div",{class:"collapsed-replies",onClick:tn(wn,["stop","prevent"])},[Me("div",TR,[(ge(!0),Ae(Wt,null,rr(Ot.value,Tn=>(ge(),dn(S_,{key:Tn.email||Tn.name,user:Tn,class:"mini-avatar"},null,8,["user"]))),128))]),Me("span",null,Bt(Et.value)+" more "+Bt(Et.value===1?"reply":"replies"),1)])],64)):ht("",!0),U.value(xn)?(ge(),Ae("div",RR)):ht("",!0)]))),128)),z.value?(ge(),Ae("div",MR,[Me("span",LR,Bt(xi.value),1),Me("button",{type:"button",class:"sd-button tracked-change-decision-alert__retry",onClick:tn(Is,["stop","prevent"])}," Retry ")])):ht("",!0),H.value&&!et(k).readOnly?(ge(),Ae(Wt,{key:3},[Y.value?(ge(),Ae("div",DR,[Me("div",OR,[jt(c0,{ref_key:"commentInput",ref:N,users:Ri.value,config:et(k),comment:r.comment,"include-header":!1},null,8,["users","config","comment"])]),Me("div",FR,[Me("button",{class:"sd-button reply-btn-cancel",onClick:tn(ao,["stop","prevent"])},"Cancel"),Me("button",{class:rn(["sd-button primary reply-btn-primary",{"sd-is-disabled":!je.value||hn.value||K.value}]),onClick:tn(kt,["stop","prevent"]),disabled:!je.value||hn.value||K.value,"data-disabled-reason":oo.value}," Reply ",10,NR)])])):(ge(),Ae("button",{key:0,type:"button",class:rn(["reply-pill",{"sd-is-disabled":hn.value}]),onClick:tn(be,["stop","prevent"]),disabled:hn.value,"data-disabled-reason":hn.value?cn.value?.reason??null:null}," Reply or add others with @ ",10,PR))],64)):ht("",!0)],64))],14,H7)),[[vt,pt]])}}},Pp=fn(BR,[["__scopeId","data-v-05d69162"]]);xt(),gn();var zR={class:"comments-list"},VR={key:0},HR=["data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],jR={key:1},UR="headerFooterPart",GR={__name:"commentsList",props:{showMainComments:{type:Boolean,default:!0},showResolvedComments:{type:Boolean,default:!0}},setup(e){const t=e,n=aa(),r=pg(n,"isCommentsListVisible"),o=ke(()=>n.getGroupedComments),i=ke(()=>n.getFloatingCommentInstances),{activeComment:s,activeFloatingCommentInstanceId:a}=Js(n),l=m=>{const p=i.value.filter(v=>v?.comment?.commentId===m?.commentId);return p.length<2?[]:m?.trackedChange?m?.trackedChangeStory?.storyType!==UR?[]:p:[]},u=m=>!m?.comment?.commentId||s.value!==m.comment.commentId?!1:a.value==null?m.isPrimary===!0:String(a.value)===String(m.id),c=m=>{const p=l(m);return p.length?p.map(v=>({id:v.id,comment:m,floatingInstanceId:String(v.id),floatingPageIndex:v.pageIndex,floatingPositionEntry:v.positionEntry??null,isFloatingInstanceActive:u(v)})):[{id:m.commentId,comment:m,floatingInstanceId:null,floatingPageIndex:null,floatingPositionEntry:null,isFloatingInstanceActive:void 0}]},d=ke(()=>o.value.parentComments.flatMap(m=>c(m))),h=ke(()=>t.showResolvedComments&&o.value?.resolvedComments?.length>0);return Nn(()=>{r.value=!0}),or(()=>{r.value=!1}),(m,p)=>(ge(),Ae("div",zR,[e.showMainComments?(ge(),Ae("div",VR,[(ge(!0),Ae(Wt,null,rr(d.value,v=>(ge(),Ae("div",{key:v.id,class:"comment-item","data-comment-instance-id":v.floatingInstanceId??"","data-comment-thread-id":v.comment.commentId??"","data-comment-position-key":v.comment.trackedChangeAnchorKey??"","data-comment-page-index":Number.isFinite(v.floatingPageIndex)?v.floatingPageIndex:""},[jt(Pp,{comment:v.comment,"floating-instance-id":v.floatingInstanceId,"floating-page-index":v.floatingPageIndex,"floating-position-entry":v.floatingPositionEntry,"is-floating-instance-active":v.isFloatingInstanceActive},null,8,["comment","floating-instance-id","floating-page-index","floating-position-entry","is-floating-instance-active"])],8,HR))),128))])):ht("",!0),h.value?(ge(),Ae("div",jR,[p[0]||(p[0]=Me("div",{class:"comment-title"},"Resolved",-1)),(ge(!0),Ae(Wt,null,rr(o.value.resolvedComments,v=>(ge(),Ae("div",{key:v.commentId,class:"comment-item"},[jt(Pp,{comment:v},null,8,["comment"])]))),128))])):ht("",!0)]))}},WR=fn(GR,[["__scopeId","data-v-e89dbc33"]]);xt();var KR=class extends Ym.default{element;config={comments:[],element:null,commentsStore:null};constructor(e,t){super(),this.config={...this.config,...e},this.element=this.config.element,this.app=null,this.superdoc=t,this.open()}createVueApp(){this.app=Zl(WR);const e=this.superdoc?.app?._context?.provides;e&&this.app?._context?.provides&&Object.setPrototypeOf(this.app._context.provides,e),this.superdoc?.pinia&&(Wd(this.superdoc.pinia),this.app.use(this.superdoc.pinia),this.app.config.globalProperties.$pinia=this.superdoc.pinia),this.app.directive("click-outside",Qv),this.app.config.globalProperties.$superdoc=this.superdoc,!this.element&&this.config.selector&&(this.element=document.getElementById(this.config.selector)),this.container=this.app.mount(this.element)}close(){this.app&&(this.app.unmount(),this.app=null,this.container=null,this.element=null)}open(){this.app||this.createVueApp()}},qR,$a,u0=Ir((()=>{qR=2,$a=96/72}));xt(),u0();var YR=96,XR=".superdoc__right-sidebar",ZR=".sd-pdf-viewer-page";const d0=Object.freeze({min:10,max:100,padding:0}),I_=e=>{const t=e&&typeof e=="object"?e:{},n=(s,a)=>typeof s=="number"&&Number.isFinite(s)&&s>0?s:a,r=n(t.min,d0.min),o=n(t.max,d0.max),i=typeof t.padding=="number"&&Number.isFinite(t.padding)&&t.padding>=0?t.padding:d0.padding;return{min:Math.min(r,o),max:Math.max(r,o),padding:i}},E_=(e,t)=>!(e>0)||!(t>0)?null:Math.round(e/t*100),QR=(e,t,n)=>{const r=E_(e-n.padding,t);return r===null?null:Math.max(1,Math.round(Math.min(n.max,Math.max(n.min,r))))},JR=(e,t,n)=>e>0?Number.isFinite(t)&&t>0?e/t*$a:n>0?e/n:e:null;function $R({getSuperdoc:e,superdocContainerWidth:t,isReady:n,activeZoom:r,zoomMode:o,viewportMetrics:i,showCommentsSidebar:s,rightSidebarRef:a,superdocRoot:l,documents:u}){const c=b=>{if(!b)return null;let T=0;try{const j=b.getPages?.();if(Array.isArray(j))for(const O of j){const V=O?.size?.w;typeof V=="number"&&Number.isFinite(V)&&V>T&&(T=V)}}catch{T=0}if(T>0)return T;let R=null;try{R=b.getPageStyles?.()??null}catch{R=null}const P=R?.pageSize?.width;return typeof P=="number"&&Number.isFinite(P)&&P>0?P*YR:null},d=()=>{if(!(u?.value??[]).some(R=>R?.type==="application/pdf"))return null;const b=l.value;if(!b?.querySelectorAll)return null;let T=0;for(const R of b.querySelectorAll(ZR)){const P=Number(R.clientWidth)||Number(R.getBoundingClientRect?.().width)||0;let j=NaN;typeof window<"u"&&typeof window.getComputedStyle=="function"&&(j=Number.parseFloat(window.getComputedStyle(R).getPropertyValue("--scale-factor")));const O=(r.value??100)/100,V=JR(P,j,O);V!==null&&V>T&&(T=V)}return T>0?T:null},h=()=>{const b=e();if(!b)return null;const T=[],R=u?.value??[];for(const j of R){if(j?.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")continue;const O=c(j.getEditor?.());O!==null&&T.push(O)}if(T.length===0){const j=c(b.activeEditor);j!==null&&T.push(j)}const P=d();if(P!==null&&T.push(P),T.length>0)return Math.max(...T);if(b.activeEditor){const j=l.value?.querySelector?.(".superdoc__document"),O=Number(j?.clientWidth)||Number(j?.getBoundingClientRect?.().width)||0;if(O>0){const V=(r.value??100)/100;return V>0?O/V:O}}return null},m=()=>{if(!s?.value)return 0;const b=a?.value??l.value?.querySelector?.(XR),T=Number(b?.offsetWidth)||Number(b?.getBoundingClientRect?.().width)||0;return T>0?T:0},p=(b,T)=>{const R=I_(b.config?.zoom?.fitWidth),P=QR(T.availableWidth,T.documentWidth,R);P!==null&&P!==r.value&&(r.value=P,b.emit("zoomChange",{zoom:P,mode:"fit-width"}))},v=()=>{const b=e();if(!b)return;const T=t.value;if(!(T>0)||!n.value)return;const R=h();if(R===null)return;const P=T-m(),j=E_(P,R);if(j===null)return;const O=Object.freeze({availableWidth:P,documentWidth:R,fitZoom:j}),V=i.value;(!V||V.availableWidth!==P||V.documentWidth!==R||V.fitZoom!==j)&&(i.value=O),(!V||V.fitZoom!==j||Math.round(V.documentWidth)!==Math.round(R))&&b.emit("viewport-change",O),o.value==="fit-width"&&p(b,O)};Lt(t,()=>{_t(()=>v())}),Lt(n,b=>{b&&v()}),Lt(o,b=>{b==="fit-width"&&v()}),s&&Lt(s,()=>{_t(()=>v())});const _=()=>{_t(()=>v())},C=()=>{_t(()=>v())},k=()=>{_t(()=>v())},y=e();return y?.on?.("editorCreate",_),y?.on?.("pagination-update",C),y?.on?.("pdf:document-ready",k),or(()=>{y?.off?.("editorCreate",_),y?.off?.("pagination-update",C),y?.off?.("pdf:document-ready",k)}),{evaluateViewport:v}}const e9=e=>!!e?.trackedChange,t9=e=>e,n9=(e,t,n,r=e)=>!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)?!1:(Number.isFinite(r)?r:e)<t||e>n,r9=({comment:e,anchorTop:t,anchorBottom:n,viewportTop:r,viewportBottom:o})=>e9(e)&&n9(t,r,o,n),o9=({comment:e,anchorTop:t,anchorBottom:n,cardHeight:r,viewportTop:o,viewportBottom:i})=>!r9({comment:e,anchorTop:t,anchorBottom:n,viewportTop:o,viewportBottom:i})||!Number.isFinite(r)?null:(Number.isFinite(n)?n:t)<o?Math.min(t,o-r-1):t,i9=({id:e,visibleIds:t,activeCommentInstanceId:n})=>e?!!(e==="pending"||n!=null&&String(e)===String(n)||t?.has?.(e)):!1,x_=({previousIds:e,currentIds:t,removedId:n})=>{if(!Array.isArray(e)||!(t instanceof Set)||!n)return null;const r=e.indexOf(n);if(r<0)return null;for(let o=r+1;o<e.length;o+=1){const i=e[o];if(t.has(i))return i}for(let o=r-1;o>=0;o-=1){const i=e[o];if(t.has(i))return i}return null};xt(),gn();var s9=["data-comment-id","data-comment-instance-id","data-comment-thread-id","data-comment-position-key","data-comment-page-index"],tc={},a9={__name:"FloatingComments",props:{currentDocument:{type:Object,required:!0},parent:{type:Object,required:!0}},setup(e){const r=(De,je,Ke)=>{if(je>=0){De[je].top=De[je].anchorTop;let pt=De[je].top+De[je].height+Ke;for(let ft=je+1;ft<De.length;ft++)De[ft].top=Math.max(De[ft].anchorTop,pt),pt=De[ft].top+De[ft].height+Ke;pt=De[je].top-Ke;for(let ft=je-1;ft>=0;ft--){const an=pt-De[ft].height;De[ft].top=Math.min(De[ft].anchorTop,an),pt=De[ft].top-Ke}const kt=Math.min(...De.map(ft=>ft.top));if(kt<0){const ft=Math.abs(kt);for(const an of De)an.top+=ft}}else for(let pt=1;pt<De.length;pt++){const kt=De[pt-1],ft=kt.top+kt.height+Ke;De[pt].top<ft&&(De[pt].top=ft)}},o=e,i=hu(),s=aa(),{clearInstantSidebarAlignment:a}=s,{activeComment:l,activeFloatingCommentInstanceId:u,editorCommentPositions:c,pendingComment:d,editingCommentId:h,instantSidebarAlignmentTargetY:m,instantSidebarAlignmentThreadId:p,instantSidebarAlignmentInstanceId:v}=Js(s),{activeZoom:_}=Js(i),C=ke(()=>{const De=s.getFloatingCommentInstances;if(!Array.isArray(De))return[];const je=o.currentDocument?.id;return je==null?De:De.filter(Ke=>s.belongsToDocument(Ke.comment,String(je),{allowSingleDocumentMismatch:!0}))}),k=ne(null),y=ne(0),b=ne(0),T=ne(!1),R=ne(null),P=ne(0),j=De=>{const je=d.value?.commentId;return je?typeof De=="object"?De?.commentId===je:De===je||De==="pending":!1},O=De=>De?.commentId??De?.importedId??null,V=ke(()=>{const De=new Map,je=new Map;for(const Ke of C.value){Ke?.id!=null&&De.set(String(Ke.id),Ke);const pt=O(Ke?.comment);if(pt==null)continue;const kt=String(pt),ft=je.get(kt)??[];ft.push(Ke),je.set(kt,ft)}return{byId:De,byThreadId:je}}),Q=(De,je=null)=>{if(De==null)return null;const Ke=String(De),pt=V.value.byThreadId.get(Ke)??[];if(!pt.length)return null;if(je!=null){const kt=pt.find(ft=>String(ft.id)===String(je));if(kt)return kt.id}return pt.find(kt=>kt.isPrimary)?.id??pt[0]?.id??null},F=ke(()=>l.value?Q(l.value,u.value):null),N=De=>{if(typeof De=="number")return Number.isFinite(De)?De:null;if(typeof De!="string"||De.trim()==="")return null;const je=Number(De);return Number.isFinite(je)?je:null},x=ne({...tc}),z=ne(new Set),J=ne({});let X=null;const ae=new Set;let pe=null;const Fe=()=>{pe==null&&(pe=requestAnimationFrame(()=>{pe=null,P.value+=1}))},fe=De=>{if(o.currentDocument.type==="application/pdf"){const je=(_.value??100)/100,Ke=N(De?.comment?.selection?.selectionBounds?.top);return Ke==null?null:Ke*je}return De?.positionEntry?.bounds?.top},ye=(De,je)=>{if(o.currentDocument.type==="application/pdf"){const pt=(_.value??100)/100,kt=N(De?.comment?.selection?.selectionBounds?.bottom);return kt!=null?kt*pt:je}const Ke=De?.positionEntry?.bounds?.bottom;return Number.isFinite(Ke)?Ke:je},le=ke(()=>{const De=[];for(const je of C.value){const Ke=je?.id,pt=O(je?.comment),kt=fe(je);if(Ke==null||pt==null||!Number.isFinite(kt))continue;const ft=t9(kt,je.comment);De.push({id:Ke,threadId:pt,instance:je,top:ft,anchorBottom:ye(je,ft)})}return De}),Se=()=>{const De=c.value.pending;if(typeof De?.bounds?.top=="number"&&!isNaN(De.bounds.top))return De.bounds.top;const je=o.currentDocument.type==="application/pdf"?(_.value??100)/100:1,Ke=N(d.value?.selection?.selectionBounds?.top);return Ke==null?null:Ke*je},re=De=>i9({id:De?.id,visibleIds:z.value,activeCommentInstanceId:F.value,comment:De?.commentRef}),xe=()=>{const De=k.value;if(!De)return null;const je=De.getBoundingClientRect();if(!Number.isFinite(je.top)||!Number.isFinite(window.innerHeight))return null;let Ke=0,pt=window.innerHeight;for(let ft=De.parentElement;ft;ft=ft.parentElement){const an=window.getComputedStyle(ft).overflowY;if(!["auto","scroll","hidden","clip"].includes(an))continue;const qt=ft.getBoundingClientRect();!Number.isFinite(qt.top)||!Number.isFinite(qt.bottom)||(Ke=Math.max(Ke,qt.top),pt=Math.min(pt,qt.bottom))}if(pt<=Ke)return null;const kt=o.parent?.getBoundingClientRect?.();if(kt&&Number.isFinite(kt.top)&&Number.isFinite(kt.bottom)){const ft=Math.max(Ke,kt.top),an=Math.min(pt,kt.bottom);an>ft&&(Ke=ft,pt=an)}return{top:Ke-je.top,bottom:pt-je.top}},$e=ke(()=>p.value?Q(p.value,v.value):null),st=ke(()=>{P.value;const De=le.value,je=d.value&&d.value.fileId===o.currentDocument.id;if(!De.length&&!C.value.length&&!je)return[];const Ke=[],pt=xe()??{top:0,bottom:Math.max(0,o.parent?.clientHeight||window.innerHeight||0)},kt=pt.top-600,ft=pt.bottom+600,an=je?"pending":F.value,qt=new Set,cn=({id:Jt,threadId:Yn,instance:Nr,top:io,anchorBottom:vo,hasAnchorGeometry:$t})=>{const Bn=String(Jt);qt.has(Bn)||(qt.add(Bn),Ke.push({id:Jt,threadId:Yn,pageIndex:Nr?.pageIndex??null,anchorTop:io,anchorBottom:vo,hasAnchorGeometry:$t,top:io,height:x.value[Jt]||110,commentRef:Nr.comment,instanceRef:Nr}))};for(const Jt of De){const{id:Yn,threadId:Nr,instance:io,top:vo,anchorBottom:$t}=Jt,Bn=an!=null&&String(Yn)===String(an),xi=h.value!=null&&String(Nr)===String(h.value);!Bn&&!xi&&($t<kt||vo>ft)||cn({id:Yn,threadId:Nr,instance:io,top:vo,anchorBottom:$t,hasAnchorGeometry:!0})}const hn=[];if(an&&an!=="pending"){const Jt=V.value.byId.get(String(an));Jt&&hn.push(Jt)}if(h.value!=null){const Jt=V.value.byThreadId.get(String(h.value))??[],Yn=Jt.find(Nr=>Nr.isPrimary)??Jt[0];Yn&&hn.push(Yn)}for(const Jt of hn){const Yn=Jt.id,Nr=O(Jt.comment);Yn==null||Nr==null||qt.has(String(Yn))||cn({id:Yn,threadId:Nr,instance:Jt,top:pt.top,anchorBottom:pt.top,hasAnchorGeometry:!1})}if(je){const Jt=Se();typeof Jt=="number"&&!isNaN(Jt)&&Ke.push({id:"pending",anchorTop:Jt,anchorBottom:Jt,hasAnchorGeometry:!0,top:Jt,height:x.value.pending||110,commentRef:d.value})}Ke.sort((Jt,Yn)=>Jt.anchorTop-Yn.anchorTop);const oo=[];for(const Jt of Ke){const Yn=Jt.hasAnchorGeometry?o9({comment:Jt.commentRef,anchorTop:Jt.anchorTop,anchorBottom:Jt.anchorBottom,cardHeight:Jt.height,viewportTop:pt.top,viewportBottom:pt.bottom}):null;Yn==null?oo.push(Jt):Jt.top=Yn}return r(oo,an?oo.findIndex(Jt=>Jt.id===an):-1,15),Ke}),At=ke(()=>(P.value,Math.max(0,o.parent?.clientHeight||0,o.parent?.scrollHeight||0))),Ee=()=>{X&&X.disconnect(),X=new IntersectionObserver(De=>{const je=new Set(z.value);for(const Ke of De){const pt=Ke.target.dataset.commentId;pt&&(Ke.isIntersecting?je.add(pt):je.delete(pt))}z.value=je},{rootMargin:"600px 0px 600px 0px"})},Ge=()=>{if(!X)return;const De=new Set;for(const je of st.value){const Ke=J.value[je.id];Ke&&(De.add(Ke),ae.has(Ke)||(X.observe(Ke),ae.add(Ke)))}for(const je of ae)De.has(je)||(X.unobserve(je),ae.delete(je))},qe=(De,je)=>{je<=0||je===x.value[De]||(tc[De]=je,x.value={...x.value,[De]:je})},Z=De=>{if(!De)return;const{elementRef:je,commentId:Ke}=De;je&&_t(()=>{const pt=je.value?.getBoundingClientRect();!pt||pt.height<=0||Ke&&qe(Ke,pt.height)})},S=De=>{const je=De?.id;je&&_t(()=>{const Ke=J.value[je];if(!Ke)return;const pt=Ke.querySelector(".comments-dialog");if(!pt)return;qe(je,pt.getBoundingClientRect().height);const kt=je===F.value,ft=je==="pending",an=!!h.value&&!!l.value&&De?.threadId!=null&&String(De.threadId)===String(l.value);!kt&&!ft&&!an||(St(st.value.map(qt=>qt.id)),sn(()=>st.value.map(qt=>qt.id)))})},ee=De=>{!De&&R.value!=null||(T.value=De)},D=(De,je,Ke)=>{if(!Number.isFinite(je)){Ke?.(!1);return}const pt=J.value[De];if(!pt){Ke?.(!1);return}const kt=pt.getBoundingClientRect().top;b.value+=je-kt,Ke?.(!0)},U=(De,je)=>{if(je)J.value[De]=je,X&&!ae.has(je)&&(X.observe(je),ae.add(je));else{const Ke=J.value[De];Ke&&X&&(X.unobserve(Ke),ae.delete(Ke)),delete J.value[De]}};let H=[],G=null,te=[],Y=null,K=!1,be=0,me=null,Ce=null,Pe=null,it=null;const He=()=>{Pe=null,it=null,R.value=null,ee(!1)},Ct=De=>{if(!Pe)return;const je=(De?.target instanceof Element?De.target:null)?.closest?.("[data-comment-action]"),Ke=je?.getAttribute?.("data-comment-action");(Ke==="resolve"||Ke==="reject")&&k.value?.contains?.(je)||He()},Yt=()=>{H.forEach(clearTimeout),H=[]},St=De=>{for(const je of De.filter(Boolean)){const Ke=J.value[je];if(!Ke)continue;const pt=Ke.querySelector(".comments-dialog");pt&&qe(je,pt.getBoundingClientRect().height)}},Ft=50,Nt=350,sn=De=>{Yt();const je=typeof De=="function"?De:()=>De;H.push(setTimeout(()=>St(je()),Ft)),H.push(setTimeout(()=>St(je()),Nt))},_n=()=>{a(),requestAnimationFrame(()=>{ee(!1)})},Qt=(De,je)=>{!De||!Number.isFinite(je)||(ee(!0),_t(()=>{St([De]),D(De,je,()=>{_n()})}))},Ye=()=>{Y=null,be+=1,me!=null&&(cancelAnimationFrame(me),me=null),ee(!1)},Et=()=>{if(!Y||K)return;K=!0;const De=be;me!=null&&(cancelAnimationFrame(me),me=null),ee(!0),_t(()=>{if(K=!1,De!==be){Et();return}const{key:je,targetClientY:Ke}=Y;St([je]),D(je,Ke,pt=>{if(De===be){if(!pt){ee(!1);return}me=requestAnimationFrame(()=>{me=null,De===be&&ee(!1)})}})})},Ot=(De,je)=>{const Ke=x_({previousIds:te,currentIds:je,removedId:De}),pt=(Ke?J.value[Ke]:null)?.getBoundingClientRect?.().top;return!Ke||!Number.isFinite(pt)?(Ye(),!1):(Y={key:Ke,targetClientY:pt},be+=1,Et(),!0)},wn=De=>{const je=De?.target?.closest?.("[data-comment-action]"),Ke=je?.getAttribute?.("data-comment-action");if(Ke!=="resolve"&&Ke!=="reject"||(He(),je.getAttribute?.("aria-disabled")==="true"))return;const pt=je.closest?.("[data-comment-id]")?.getAttribute?.("data-comment-id");if(!pt||String(F.value??"")===String(pt))return;const kt=st.value.filter(qt=>qt.commentRef?.trackedChange).map((qt,cn)=>({id:qt.id,index:cn,top:qt.top})).filter(qt=>Number.isFinite(qt.top)).sort((qt,cn)=>qt.top-cn.top||qt.index-cn.index).map(qt=>qt.id),ft=x_({previousIds:kt,currentIds:new Set(kt),removedId:pt}),an=(ft?J.value[ft]:null)?.getBoundingClientRect?.().top;!ft||!Number.isFinite(an)||(Pe={removedKey:pt,targetKey:ft,targetClientY:an,applied:!1},it=pt,R.value=ft,ee(!0))};Lt(F,(De,je)=>{if(Yt(),!(Pe!=null&&it!=null&&[De,je].some(kt=>kt!=null&&String(kt)===String(it)))){if(it=null,De)He(),Ye();else if(je){const kt=new Set(st.value.map(ft=>ft.id));kt.has(je)?Ye():Ot(je,kt)}}const Ke=[De,je],pt=De&&De===$e.value&&Number.isFinite(m.value);_t(()=>{if(pt){St(Ke);return}sn(Ke)})}),Lt([F,$e,m],([De,je,Ke])=>{!De||!je||De!==je||!Number.isFinite(Ke)||Qt(De,Ke)}),Lt(h,()=>{Yt(),_t(()=>{sn(()=>st.value.map(De=>De.id))})}),Lt(l,()=>{if(G&&clearTimeout(G),!l.value){if(a(),Y){Et();return}ee(!1),b.value=0;return}if(!(j(l.value)?d.value:s.getComment(l.value)))return;const De=j(l.value)?"pending":F.value;if(De){if(De===$e.value&&Number.isFinite(m.value)){ee(!0);return}_t(()=>{G=setTimeout(()=>{const Ke=J.value[De];if(!Ke)return;const pt=o.parent?.getBoundingClientRect?.();if(!pt)return;const kt=st.value.find(cn=>cn.id===De),ft=De==="pending"?Se():kt?.anchorTop;if(typeof ft!="number"||isNaN(ft))return;const an=Ke.getBoundingClientRect().top,qt=pt.top+ft;b.value+=qt-an},400)})}}),Lt(_,()=>{if(o.currentDocument.type==="application/pdf"){for(const De in tc)delete tc[De];x.value={},y.value+=1}});let Kt=new Set,Sn=null,Pt=null;return Lt(st,De=>{const je=F.value?De.find($t=>$t.id===F.value):null,Ke=typeof je?.anchorTop=="number"&&Number.isFinite(je.anchorTop)?je.anchorTop:null,pt=Ke!=null&&Sn!=null&&Math.abs(Ke-Sn)>1,kt=typeof je?.top=="number"&&Number.isFinite(je.top)?je.top:null,ft=kt!=null&&Pt!=null&&Math.abs(kt-Pt)>1;pt&&b.value!==0&&!Number.isFinite(m.value)?(b.value=0,ee(!1)):ft&&b.value!==0&&!Number.isFinite(m.value)&&!Y&&(ee(!0),b.value+=Pt-kt,Ce!=null&&cancelAnimationFrame(Ce),Ce=requestAnimationFrame(()=>{Ce=null,!Y&&!Number.isFinite(m.value)&&ee(!1)})),Sn=Ke,Pt=kt;const an=De.map($t=>$t.id),qt=new Set(an);if(Pe&&!Pe.applied&&!qt.has(Pe.removedKey)){const{targetKey:$t,targetClientY:Bn}=Pe;Pe.applied=!0,qt.has($t)&&Number.isFinite(Bn)?(Y={key:$t,targetClientY:Bn},be+=1,Et()):He()}if(Pe?.applied&&!qt.has(Pe.targetKey)&&He(),Y&&!qt.has(Y.key)){const $t=Y.key;Ot($t,qt)||(ee(!1),b.value=0)}const cn=new Set(z.value);let hn=!1,oo=-1/0,Jt=1/0;const Yn=k.value;if(Yn){const $t=Yn.getBoundingClientRect();oo=-$t.top-600,Jt=-$t.top+window.innerHeight+600}const Nr=new Map(De.map($t=>[$t.id,$t]));for(const $t of qt)if(!cn.has($t)){const Bn=Nr.get($t);(!Bn||Bn.top>=oo&&Bn.top<=Jt)&&(cn.add($t),hn=!0)}for(const $t of cn)qt.has($t)||(cn.delete($t),hn=!0);hn&&(z.value=cn);for(const $t of Kt)qt.has($t)||delete tc[$t];const io=Kt.size!==qt.size||[...Kt].some($t=>!qt.has($t)),vo=te.length!==an.length||te.some(($t,Bn)=>$t!==an[Bn]);if(io){const $t={};for(const Bn of qt)tc[Bn]&&($t[Bn]=tc[Bn]);x.value=$t,_t(()=>{for(const Bn of De){const xi=J.value[Bn.id];if(!xi)continue;const Is=xi.querySelector(".comments-dialog");Is&&qe(Bn.id,Is.getBoundingClientRect().height)}})}Y&&(io||vo)&&Et(),Kt=qt,_t(()=>{te=an,Ge()})}),Nn(()=>{Ee(),o.parent?.addEventListener?.("scroll",Fe,{passive:!0}),window.addEventListener("resize",Fe,{passive:!0}),document.addEventListener("pointerdown",Ct,!0),_t(Ge)}),or(()=>{Yt(),G&&clearTimeout(G),He(),Ye(),Ce!=null&&(cancelAnimationFrame(Ce),Ce=null),o.parent?.removeEventListener?.("scroll",Fe),window.removeEventListener("resize",Fe),document.removeEventListener("pointerdown",Ct,!0),pe!=null&&(cancelAnimationFrame(pe),pe=null),X&&(X.disconnect(),X=null,ae.clear())}),(De,je)=>(ge(),Ae("div",{class:"section-wrapper",ref_key:"floatingCommentsContainer",ref:k,onClickCapture:wn,style:yn({minHeight:At.value+"px",transition:T.value?"none":void 0})},[Me("div",{class:"sidebar-container",style:yn({transform:`translateY(${b.value}px)`,transition:T.value?"none":void 0})},[(ge(!0),Ae(Wt,null,rr(st.value,Ke=>(ge(),Ae("div",{key:Ke.id,ref_for:!0,ref:pt=>U(Ke.id,pt),"data-comment-id":Ke.id,"data-comment-instance-id":Ke.id,"data-comment-thread-id":Ke.threadId,"data-comment-position-key":Ke.instanceRef?.positionKey??"","data-comment-page-index":Ke.pageIndex??"",class:rn([{"is-direct-decision-continuity-target":Ke.id===R.value},"comment-placeholder"]),style:yn({top:Ke.top+"px",height:Ke.height+"px",transition:T.value?"none":void 0})},[re(Ke)?(ge(),dn(Pp,{key:Ke.id+y.value,onReady:Z,onResize:pt=>S(Ke),class:"floating-comment",parent:e.parent,comment:Ke.commentRef,"floating-instance-id":Ke.id,"floating-page-index":Ke.pageIndex,"floating-position-entry":Ke.instanceRef?.positionEntry??null,"is-floating-instance-active":Ke.id===F.value},null,8,["onResize","parent","comment","floating-instance-id","floating-page-index","floating-position-entry","is-floating-instance-active"])):ht("",!0)],14,s9))),128))],4)],36))}},l9=fn(a9,[["__scopeId","data-v-a0a841ce"]]);xt(),gn();var c9={class:"superdoc__pdf-comments-layer pdf-comments-layer","aria-hidden":"false"},u9=["data-id","data-comment-id","data-page-number","onClick","onKeydown"],d9="pdf",f9="#078383",h9="#B1124B",p9={__name:"PdfCommentsLayer",emits:["anchor-activate"],setup(e,{emit:t}){const n=t,r=aa(),o=hu(),{activeComment:i}=Js(r),{documents:s,activeZoom:a}=Js(o),{proxy:l}=ir(),u=y=>typeof y=="number"?Number.isFinite(y):typeof y=="string"&&y.trim()!==""?Number.isFinite(Number(y)):!1,c=y=>!!y&&u(y.top)&&u(y.left)&&u(y.right)&&u(y.bottom),d=ke(()=>{const y=Array.isArray(s.value)?s.value:[];return new Set(y.filter(b=>b?.type===Ql).map(b=>String(b.id)))}),h=y=>{const b=y?.fileId??y?.documentId??y?.selection?.documentId;return b!=null?String(b):null},m=y=>{const b=y?.commentId??y?.importedId;return b!=null&&String(b)!==""?String(b):null},p=y=>{const b=d.value;if(!b.size)return!1;const T=h(y);return T?b.has(T):b.size===1},v=y=>{const b=Math.min(Number(y.top),Number(y.bottom)),T=Math.max(Number(y.top),Number(y.bottom));return{top:b,left:Math.min(Number(y.left),Number(y.right)),right:Math.max(Number(y.left),Number(y.right)),bottom:T}},_=ke(()=>{const y=r.getFloatingComments;return Array.isArray(y)?y.filter(b=>b?.selection?.source===d9).filter(b=>!b.resolvedTime).filter(b=>m(b)!==null).filter(b=>c(b.selection?.selectionBounds)).filter(b=>p(b)).map(b=>{const T=m(b),R=v(b.selection.selectionBounds);return{commentId:T,page:b.selection?.page??null,isInternal:b.isInternal!==!1,bounds:R}}):[]}),C=y=>{const b=(a.value??100)/100,{top:T,left:R,right:P,bottom:j}=y.bounds,O=i.value===y.commentId,V=(y.isInternal?f9:h9)+(O?"66":"33");return{position:"absolute",top:T*b+"px",left:R*b+"px",width:(P-R)*b+"px",height:(j-T)*b+"px",backgroundColor:V}},k=y=>{r.setActiveComment(l.$superdoc,y.commentId),n("anchor-activate",y.commentId)};return(y,b)=>(ge(),Ae("div",c9,[(ge(!0),Ae(Wt,null,rr(_.value,T=>(ge(),Ae("div",{key:T.commentId,class:"sd-comment-anchor sd-highlight",role:"button",tabindex:"0","data-id":T.commentId,"data-comment-id":T.commentId,"data-page-number":T.page,style:yn(C(T)),onClick:tn(R=>k(T),["stop","prevent"]),onKeydown:[Yo(tn(R=>k(T),["stop","prevent"]),["enter"]),Yo(tn(R=>k(T),["stop","prevent"]),["space"])]},null,44,u9))),128))]))}},m9=fn(p9,[["__scopeId","data-v-b5ad4c58"]]);xt();const g9=({proxy:e,layers:t,documents:n,modules:r})=>{const o=ke(()=>{const V=r.value?.whiteboard??r.whiteboard;return V===!1||V==null?null:V}),i=e?.$superdoc?.whiteboard,s=Kr([]),a=Gr({}),l=Gr({}),u=ne(!1),c=ne(0),d=ne(0),h=ne(1),m=ne(o.value?.enabled??!1),p=()=>{if(u.value)return;c.value+=1;const V=d.value||s.value.length;V&&c.value>=V&&(u.value=!0,e?.$superdoc?.emit("whiteboard:ready",{whiteboard:i}))},v=V=>{if(!V)return;const Q=n.value?.[0];Q&&Q.type==="application/pdf"&&_(V)},_=V=>{const{pageIndex:Q,width:F,height:N,originalWidth:x,originalHeight:z}=V,J={width:F,height:N,originalWidth:x,originalHeight:z};i?.setPageSize(Q,J),a[Q]=J;const X=i?.getPage(Q);X&&X.setSize(J),i&&(s.value=i.getPages().sort((ae,pe)=>ae.pageIndex-pe.pageIndex).map(ae=>Wr(ae)),d.value=s.value.length),_t(()=>{j(),p()})},C=V=>{e?.$superdoc?.emit("whiteboard:change",V)},k=V=>{V.forEach(Q=>{const F=a[Q.pageIndex];F&&Q.setSize(F)}),s.value=V.map(Q=>Wr(Q)),d.value=s.value.length,_t(()=>j())},y=V=>{m.value=V,e?.$superdoc?.emit("whiteboard:enabled",V)},b=V=>{h.value=V},T=V=>{e?.$superdoc?.emit("whiteboard:tool",V)},R=()=>{const V=n.value?.[0];V&&V.type==="application/pdf"&&P({doc:V})},P=({doc:V})=>{s.value.forEach(Q=>{const F=`${V.id}-page-${Q.pageIndex+1}`,N=document.querySelector(`[data-page-id="${F}"]`);if(!N)return;const x=N.getBoundingClientRect(),z=a[Q.pageIndex]||{},J=z.originalWidth??Q.size?.originalWidth??x.width,X=z.originalHeight??Q.size?.originalHeight??x.height,ae={width:x.width,height:x.height,originalWidth:J,originalHeight:X};a[Q.pageIndex]=ae,Q.setSize(ae)})},j=()=>{const V=t.value?.getBoundingClientRect?.();if(!V)return;const Q=n.value?.[0];Q&&Q.type==="application/pdf"&&O({doc:Q,layerBounds:V})},O=({doc:V,layerBounds:Q})=>{s.value.forEach(F=>{const N=`${V.id}-page-${F.pageIndex+1}`,x=document.querySelector(`[data-page-id="${N}"]`);if(!x)return;const z=x.getBoundingClientRect();l[F.pageIndex]={top:z.top-Q.top,left:z.left-Q.left}})};return i&&(i.on("change",C),i.on("setData",k),i.on("enabled",y),i.on("opacity",b),i.on("tool",T)),or(()=>{i&&(i.off("change",C),i.off("setData",k),i.off("opacity",b),i.off("enabled",y),i.off("tool",T))}),{whiteboard:i,whiteboardModuleConfig:o,whiteboardPages:s,whiteboardPageSizes:a,whiteboardPageOffsets:l,whiteboardEnabled:m,whiteboardOpacity:h,whiteboardReady:u,handleWhiteboardPageReady:v,updateWhiteboardPageSizes:R,updateWhiteboardPageOffsets:j}};xt(),gn();var v9=["data-page-index"],y9={__name:"WhiteboardPage",props:{whiteboard:{type:Object,required:!0},page:{type:Object,required:!0},pageSize:{type:Object,default:null},pageOffset:{type:Object,default:null},enabled:{type:Boolean,default:!0}},setup(e){const t=e,n=ne(null),r=()=>{const u=n.value;!u||!t.page||(t.page.mount(u),t.pageSize&&t.page.resize(t.pageSize.width,t.pageSize.height))},o=u=>{if(!t.page||!u?.dataTransfer||!t.enabled||t.whiteboard.getTool()!=="select")return;u.preventDefault(),u.stopPropagation();const c=n.value;if(!c)return;const d=c.getBoundingClientRect(),h=u.clientX-d.left,m=u.clientY-d.top,p=t.pageSize?.width,v=t.pageSize?.originalWidth??p,_=Number.isFinite(p)&&Number.isFinite(v)&&v?p/v:1;i(u,h,m,_)||s(u,h,m,_)||a(u,h,m)||l(u,h,m)},i=(u,c,d,h)=>{const m=u.dataTransfer.getData("application/sticker");if(!m)return!1;const p=(t.whiteboard.getType("stickers")||[]).find(v=>v.id===m);return p?.src?(t.page.addImage({stickerId:p.id,x:c,y:d,src:p.src,width:Number.isFinite(p.width)?p.width*h:p.width,height:Number.isFinite(p.height)?p.height*h:p.height,type:"sticker"}),!0):!1},s=(u,c,d,h)=>{const m=Array.from(u.dataTransfer.files||[]).find(v=>v.type.startsWith("image/"));if(!m)return!1;const p=new FileReader;return p.onload=()=>{typeof p.result=="string"&&t.page.addImage({x:c,y:d,src:p.result,type:"image"})},p.readAsDataURL(m),!0},a=(u,c,d)=>{const h=u.dataTransfer.getData("application/comment");if(!h)return!1;const m=(t.whiteboard.getType("comments")||[]).find(p=>p.id===h);return m?.text?(t.page.addText({x:c,y:d,content:m.text}),!0):!1},l=(u,c,d)=>{const h=u.dataTransfer.getData("text/plain");return h?(t.page.addText({x:c,y:d,content:h}),!0):!1};return Lt(()=>[t.page,t.pageSize?.width,t.pageSize?.height],()=>{_t(r)}),Nn(()=>{r()}),or(()=>{t.page?.destroy()}),(u,c)=>(ge(),Ae("div",{ref_key:"containerRef",ref:n,class:"whiteboard-page","data-page-index":e.page.pageIndex,onDragover:c[0]||(c[0]=tn(()=>{},["prevent"])),onDrop:tn(o,["prevent"]),style:yn({width:(e.pageSize?.width??e.page.size?.width)+"px",height:(e.pageSize?.height??e.page.size?.height)+"px",transform:`translate(${e.pageOffset?.left??0}px, ${e.pageOffset?.top??0}px)`})},null,44,v9))}},b9=fn(y9,[["__scopeId","data-v-c876c9b5"]]);xt(),gn();var w9={__name:"WhiteboardLayer",props:{whiteboard:{type:Object,required:!0},pages:{type:Array,default:()=>[]},pageSizes:{type:Object,default:()=>({})},pageOffsets:{type:Object,default:()=>({})},enabled:{type:Boolean,default:!0},interactive:{type:Boolean,default:null},opacity:{type:Number,default:1}},setup(e){const t=e,n=ke(()=>t.interactive==null?t.enabled:t.interactive);return(r,o)=>(ge(),Ae("div",{class:"whiteboard-layer","aria-hidden":"true",style:yn({opacity:e.opacity,pointerEvents:n.value?"auto":"none"})},[(ge(!0),Ae(Wt,null,rr(e.pages,i=>(ge(),dn(b9,{key:i.pageIndex,page:i,"page-size":e.pageSizes?.[i.pageIndex],"page-offset":e.pageOffsets?.[i.pageIndex],whiteboard:e.whiteboard,enabled:e.enabled},null,8,["page","page-size","page-offset","whiteboard","enabled"]))),128))],4))}},C9=fn(w9,[["__scopeId","data-v-54546c3d"]]);function _9(e){const t=e?.directionContext?.inlineDirection;if(t!=null)return t;const n=e?.paragraphProperties?.rightToLeft;if(n===!0)return"rtl";if(n===!1)return"ltr"}var T_=["#1f6feb","#d1242f","#8250df","#bf3989","#1a7f37","#9a6700","#bc4c00","#0969da","#cf222e","#6639ba","#116329","#7d4e00"];const S9=e=>e?`${typeof e.name=="string"?e.name:""} ${typeof e.email=="string"?e.email:""}`:"";var k9=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0};const A9=e=>T_[k9(S9(e))%T_.length];var ff=e=>typeof e=="string"&&e.length>0;const I9=e=>{if(!e||e.enabled===!1)return;const t=e.overrides&&typeof e.overrides=="object"?e.overrides:void 0,n=typeof e.resolve=="function"?e.resolve:void 0;return r=>{const o=r??{};if(t){if(ff(o.email)&&ff(t[o.email]))return t[o.email];if(ff(o.name)&&ff(t[o.name]))return t[o.name]}if(n)try{const i=n(o);if(ff(i))return i}catch{}return A9(o)}},E9=["insertion","deletion","move","move-from","move-to","table-cell-insertion","table-cell-deletion","cell-merge","cell-split","image-insertion","image-deletion","image-property-change"];var AU=new Set(E9);const gr={externalImageDeferred:"render.media.external-image-deferred",missingRelationship:"render.drawing.missing-relationship",missingMediaPart:"render.media.missing-part",unsupportedRelationshipType:"render.drawing.unsupported-relationship-type",unsupportedMime:"render.media.unsupported-mime",imageTooLarge:"render.media.image-too-large",unsafeSvg:"render.media.unsafe-svg",unsupportedFormat:"render.media.unsupported-format",embeddedObjectNotSupported:"render.embedded-object-not-supported",unsupportedObject:"render.drawing.unsupported-object",vmlUnsupported:"render.drawing.vml-unsupported",vmlImageUnsupported:"render.drawing.vml-image-unsupported",unsupportedGeometryCommand:"render.drawing.unsupported-geometry-command",anchorUnsupported:"render.drawing.anchor-unsupported",wrapUnsupported:"render.drawing.wrap-unsupported",altContentNoSupportedChoice:"render.drawing.altcontent-no-supported-choice",groupChildUnsupported:"render.drawing.group-child-unsupported"},IU={"render.media.missing-relationship":gr.missingRelationship,"render.media.wrong-relationship-type":gr.unsupportedRelationshipType,"render.media.unsupported-target":gr.unsupportedRelationshipType,"render.media.invalid-image-size":gr.imageTooLarge,"render.media-resolver-unavailable":gr.missingMediaPart,"render.chart-not-supported":gr.unsupportedObject,"render.textbox.vml-unsupported":gr.vmlUnsupported},x9={inlineBitmap:{family:"inlineBitmap",support:"supported",description:"wp:inline pic:pic with internal media and browser-safe MIME (PNG/JPEG; WebP/SVG once the host media resolver lands).",contract:"ImageRun"},anchoredBitmap:{family:"anchoredBitmap",support:"supported",description:"wp:anchor bitmap with anchor/wrap expressible by ImageAnchor/ImageWrap. Never silently inlined.",contract:"ImageBlock"},imageChildInGroup:{family:"imageChildInGroup",support:"supported",description:"Bitmap child of a supported DrawingML group/drawing wrapper. Supported only when the parent is.",contract:"ImageDrawing"},vectorShape:{family:"vectorShape",support:"supported",description:"Block/floating DrawingML preset/custom shape with the supported geometry/style subset.",contract:"DrawingBlock",drawingKind:"vectorShape"},shapeGroup:{family:"shapeGroup",support:"supported",description:"DrawingML group whose rendered children are supported vector/image children.",contract:"DrawingBlock",drawingKind:"shapeGroup"},chart:{family:"chart",support:"supported",description:"DrawingML chart projected into a ChartDrawing with parsed cached chart XML data. Complete Word chart fidelity remains deferred to chartFidelity.",contract:"DrawingBlock",drawingKind:"chart"},alternateContent:{family:"alternateContent",support:"supported",description:"mc:AlternateContent traversal/select policy. Selected Choice/Fallback maps to its family contract; unselected branches preserved for save/reopen.",contract:"selected-choice"},externalImage:{family:"externalImage",support:"fail-closed",description:'External image relationship (r:link / TargetMode="External"). Not fetched.',contract:"none",diagnostic:gr.externalImageDeferred},missingRelationship:{family:"missingRelationship",support:"fail-closed",description:"Drawing references a relationship id absent from the owner part .rels.",contract:"none",diagnostic:gr.missingRelationship},missingMediaPart:{family:"missingMediaPart",support:"fail-closed",description:"Relationship resolves but the target media part bytes are missing or empty.",contract:"none",diagnostic:gr.missingMediaPart},wrongRelationshipType:{family:"wrongRelationshipType",support:"fail-closed",description:"Relationship exists but is not an image relationship type.",contract:"none",diagnostic:gr.unsupportedRelationshipType},unsupportedMime:{family:"unsupportedMime",support:"fail-closed",description:"Media MIME outside the supported allowlist (incl. GIF/BMP/ICO).",contract:"none",diagnostic:gr.unsupportedMime},oversizedMediaPart:{family:"oversizedMediaPart",support:"fail-closed",description:"Media part exceeds the host byte-size policy before bytes are materialized.",contract:"none",diagnostic:gr.imageTooLarge},unsafeSvg:{family:"unsafeSvg",support:"fail-closed",description:"SVG content rejected by the SVG safety policy.",contract:"none",diagnostic:gr.unsafeSvg},metafileOrTiff:{family:"metafileOrTiff",support:"fail-closed",description:"EMF/WMF/TIFF and other non-browser-native formats with no approved conversion path.",contract:"none",diagnostic:gr.unsupportedFormat},embeddedObject:{family:"embeddedObject",support:"fail-closed",description:"OLE / ActiveX / embedded package object.",contract:"none",diagnostic:gr.embeddedObjectNotSupported},smartArtOrDiagram:{family:"smartArtOrDiagram",support:"fail-closed",description:"SmartArt / diagram / unknown external graphic-data object.",contract:"none",diagnostic:gr.unsupportedObject},vml:{family:"vml",support:"fail-closed",description:"VML structure outside any supported image-like subset (default fail-closed policy).",contract:"none",diagnostic:gr.vmlUnsupported},vmlImageLike:{family:"vmlImageLike",support:"fail-closed",description:"Simple VML image references (v:imagedata) / watermark image metadata. Fail-closed unless a later change promotes a named subset with deterministic fixtures and exact oracles.",contract:"none",diagnostic:gr.vmlImageUnsupported},unsupportedGeometryCommand:{family:"unsupportedGeometryCommand",support:"fail-closed",description:"Custom geometry command the extractor does not implement, e.g. arcTo.",contract:"none",diagnostic:gr.unsupportedGeometryCommand},unsupportedAnchorFields:{family:"unsupportedAnchorFields",support:"fail-closed",description:"Anchor fields required for honest placement are unsupported (char-relative, alignment modes, etc.).",contract:"none",diagnostic:gr.anchorUnsupported},unsupportedWrapFields:{family:"unsupportedWrapFields",support:"fail-closed",description:"Wrap fields required for honest placement are unsupported (arbitrary wrap polygons, etc.).",contract:"none",diagnostic:gr.wrapUnsupported},alternateContentNoSupportedChoice:{family:"alternateContentNoSupportedChoice",support:"fail-closed",description:"mc:AlternateContent with no supported choice and no usable fallback.",contract:"none",diagnostic:gr.altContentNoSupportedChoice},groupChildUnsupported:{family:"groupChildUnsupported",support:"fail-closed",description:"Unsupported child inside an otherwise-supported group. Supported siblings are not dropped.",contract:"none",diagnostic:gr.groupChildUnsupported},objectEditing:{family:"objectEditing",support:"deferred",description:"Editing/mutation of anchored/vector objects.",contract:"none"},customWrapPolygon:{family:"customWrapPolygon",support:"deferred",description:"Full Word-compatible text wrapping for arbitrary custom wrap polygons.",contract:"none"},chartFidelity:{family:"chartFidelity",support:"deferred",description:"Complete chart fidelity (a dedicated chart effort owns the parsed subset).",contract:"none"},vmlFidelity:{family:"vmlFidelity",support:"deferred",description:"Complete VML fidelity.",contract:"none"},decorativeAccessibilityUi:{family:"decorativeAccessibilityUi",support:"deferred",description:"Full accessibility UI for decorative image semantics beyond preserving source data.",contract:"none"}},EU=Object.keys(x9),xU=Object.freeze(["multiple-sections","furniture-page-tokens","non-balanceable-multi-column-sections","body-anchored-objects","footnotes","page-references","keep-constraints","tables","furniture-anchored-objects"]);xt(),gn();var T9={class:"superdoc-html-viewer"},R9={class:"superdoc-html-viewer__document"},M9=["innerHTML"],L9={__name:"HtmlViewer",props:{fileSource:{type:[File,Blob],required:!0},documentId:{type:String,required:!0}},emits:["ready","selection-change"],setup(e,{emit:t}){const n=e,r=ne(""),o=t,i=()=>{const l=window.getSelection();console.debug("selection from html viewer",l),o("selection-change",l)},s=l=>new Promise((u,c)=>{const d=new FileReader;d.onload=h=>{const m=h.target.result;u(m)},d.onerror=h=>c(h),d.readAsText(l)}),a=async()=>{try{r.value=await s(n.fileSource),o("ready",n.documentId)}catch(l){o("error",l),console.error("Error loading document",l)}};return Nn(()=>{a()}),(l,u)=>(ge(),Ae("div",T9,[Me("div",R9,[Me("div",{class:"superdoc-html-viewer__content",innerHTML:r.value,onMouseup:i},null,40,M9)])]))}},P9=fn(L9,[["__scopeId","data-v-da3494ba"]]);const D9=(e,t,n=()=>!0)=>{const r=new Set(t.map(String)),o=new Set;e.forEach(s=>{if(!n(s))return;const a=s.commentId!=null?String(s.commentId):null,l=s.importedId!=null?String(s.importedId):null;!(a&&r.has(a))&&!(l&&r.has(l))||(a&&o.add(a),l&&o.add(l))});let i=!0;for(;i;)i=!1,e.forEach(s=>{if(!n(s))return;const a=s.commentId!=null?String(s.commentId):null,l=s.importedId!=null?String(s.importedId):null,u=s.parentCommentId!=null?String(s.parentCommentId):null,c=Mp(s),d=c!=null?String(c):null,h=a&&o.has(a)||l&&o.has(l),m=u&&o.has(u)||d&&o.has(d);if(!h&&!m)return;const p=o.size;a&&o.add(a),l&&o.add(l),o.size>p&&(i=!0)});return o};xt();var R_=ne(!1);function Hi(){return{isHighContrastMode:R_,setHighContrastMode:t=>{R_.value=t}}}const TU="[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor",RU=320,MU=24,LU=816,PU=250,DU="sidebar",M_=new Set(["auto","sidebar","inline"]);function L_(e){if(!e||e===!1||typeof e!="object")return e;const t={...e},n=t.displayMode;M_.has(n)||delete t.displayMode;const r=t.compactBreakpointPx;typeof r=="number"&&Number.isFinite(r)&&r>=0||delete t.compactBreakpointPx;const o=t.compactMeasurementSelector;return typeof o=="string"&&o.trim().length>0?t.compactMeasurementSelector=o.trim():delete t.compactMeasurementSelector,t}xt();var O9=".superdoc__document",F9=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0,N9=e=>e+320+24;function B9({commentsModuleConfig:e,superdocRoot:t,layers:n}){const r=ne(0),o=ne(!1);let i=null,s=null;const a=m=>{if(!(m instanceof HTMLElement)||(typeof window<"u"?window.getComputedStyle(m):null)?.display==="contents")return!1;const p=Number(m.clientWidth??0),v=Number(m.getBoundingClientRect?.().width??0);return Number.isFinite(p)&&p>0||Number.isFinite(v)&&v>0},l=()=>{const m=t.value,p=e.value?.compactMeasurementSelector;if(typeof p=="string"&&p.trim().length>0&&typeof document<"u"){const _=document.querySelector(p.trim());if(a(_))return _}let v=m?.parentElement??null;for(;v;){if(a(v))return v;v=v.parentElement}return a(m)||m instanceof HTMLElement?m:null},u=()=>{const m=typeof window<"u"?window.ResizeObserver:void 0;if(typeof m>"u")return;const p=l();p!==s&&(i&&(i.disconnect(),i=null),s=p,s&&(i=new m(()=>{h()}),i.observe(s)))},c=()=>{u();const m=Number(s?.clientWidth??0);if(Number.isFinite(m)&&m>0)return m;const p=Number(s?.getBoundingClientRect?.().width??0);return Number.isFinite(p)&&p>0?p:0},d=()=>{const m=t.value?.querySelector?.(O9),p=n.value,v=Number(m?.clientWidth??m?.getBoundingClientRect?.().width??0);if(Number.isFinite(v)&&v>0)return v;const _=Number(p?.clientWidth??p?.getBoundingClientRect?.().width??0);return Number.isFinite(_)&&_>0?_:816},h=()=>{const m=c(),p=e.value,v=p?.displayMode??"sidebar";if(v==="sidebar"){r.value=m,o.value=!1;return}if(v==="inline"){r.value=m,o.value=!0;return}if(!(Number.isFinite(m)&&m>0))return;r.value=m;const _=p?.compactBreakpointPx;if(F9(_)){o.value=m<_;return}o.value=m<N9(d())};return or(()=>{i&&(i.disconnect(),i=null),s=null}),{superdocContainerWidth:r,isCompactCommentsMode:o,recalculateCompactCommentsMode:h,ensureCompactMeasurementObserver:u}}xt();var P_=320,el=12,z9=220,V9=16,H9=500,D_=".superdoc-comment-highlight[data-comment-ids]",O_="data-comment-ids",j9=".sd-comment-anchor",f0=(e,t,n)=>Math.min(Math.max(e,t),n),ws=e=>Number(e),ji=e=>Number.isFinite(e),h0=e=>e?.commentId??e?.importedId??null,F_=e=>String(e||"").split(",").map(t=>t.trim()).filter(Boolean),U9=e=>{const t=e?.value;if(!t)return null;const n=ws(t.ts);if(!ji(n)||Date.now()-n>H9)return null;const r=ws(t.x),o=ws(t.anchorRect?.bottom),i=ji(o)?o:ws(t.y);return!ji(r)||!ji(i)?null:{x:r,y:i}},G9=({rootEl:e,comment:t,pendingComment:n})=>{if(n?.value&&t?.commentId===n.value?.commentId){const a=e.querySelectorAll(D_);for(const l of a)if(F_(l.getAttribute(O_)).includes("pending")&&typeof l.getBoundingClientRect=="function")return l.getBoundingClientRect()}const r=h0(t);if(!r)return null;const o=String(r),i=e.querySelectorAll(D_);for(const a of i)if(F_(a.getAttribute(O_)).includes(o)&&typeof a.getBoundingClientRect=="function")return a.getBoundingClientRect();const s=e.querySelector(`[data-track-change-id="${o}"]`);return s&&typeof s.getBoundingClientRect=="function"?s.getBoundingClientRect():null},W9=(e,t)=>{const{entry:n}=e(h0(t)),r=ws(n?.bounds?.bottom);return ji(r)?r:ws(n?.bounds?.top)},K9=({selectionPosition:e,comment:t,pendingComment:n})=>e.value?.source==="pdf"||t?.selection?.source==="pdf"||n.value?.selection?.source==="pdf",q9=({rootEl:e,layersRect:t,comment:n})=>{const r=h0(n);if(r==null)return NaN;const o=e.querySelector(`${j9}[data-id="${String(r)}"]`);return!o||typeof o.getBoundingClientRect!="function"?NaN:ws(o.getBoundingClientRect().bottom)-ws(t.top)},Y9=({comment:e,pendingComment:t,selectionPosition:n,activeZoom:r})=>{if(!t.value||e?.commentId!==t.value?.commentId)return NaN;const o=ws(n.value?.bottom);if(ji(o))return o*(n.value?.source==="pdf"?(r.value??100)/100:1);const i=ws(n.value?.top);return ji(i)?i*(n.value?.source==="pdf"?(r.value??100)/100:1):NaN},X9=({top:e,left:t})=>({top:`${Math.round(e)}px`,left:`${Math.round(t)}px`,right:"auto"}),Z9=({rootRect:e,layersRect:t,anchorBottom:n,anchorClientX:r=NaN})=>{const o=f0(t.top-e.top+n+V9,el,Math.max(el,e.height-z9)),i=Math.max(el,e.width-P_-el);let s;if(ji(r))s=f0(r-e.left+el,el,i);else{const a=e.width-(t.left-e.left+t.width)+el;s=f0(e.width-a-P_,el,i)}return{top:o,left:s}};function Q9({activeComment:e,pendingComment:t,activeCompactComment:n,showCommentsSidebar:r,selectionPosition:o,activeZoom:i,superdocRoot:s,layers:a,documents:l,resolveCommentPositionEntry:u,clearActiveComment:c,clearPendingComment:d}){const h={top:"12px",right:"12px"},m=ne(0),p=ne({x:null,y:null,ts:0,anchorRect:null});let v=null,_=null;const C=()=>{p.value={x:null,y:null,ts:0,anchorRect:null}},k=(R,P,j)=>{if(!l.value?.some(V=>V.type==="application/pdf"))return!1;const O=R.querySelector(".superdoc__compact-comment-popover");return!n.value||!O||O.contains(P)||j?!1:(t.value&&d(),c(),C(),!0)},y=R=>{const P=s.value;if(!P||!a.value?.contains(R.target))return;const j=(typeof document.elementsFromPoint=="function"?document.elementsFromPoint(R.clientX,R.clientY):[]).find(V=>V?.nodeType===1&&P.contains(V)&&V.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor"))?.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor")??(R.target?.nodeType===1?R.target.closest("[data-track-change-id], .superdoc-comment-highlight, .sd-comment-anchor"):null);if(k(P,R.target,j)||R.button!==0||R.pointerType!=="mouse")return;const O=j&&typeof j.getBoundingClientRect=="function"?j.getBoundingClientRect():null;O&&(p.value={x:R.clientX,y:O.bottom,ts:Date.now(),anchorRect:{left:O.left,right:O.right,top:O.top,bottom:O.bottom}})},b=ke(()=>{m.value;const R=n.value;if(!R)return h;const P=s.value,j=a.value;if(!P||!j)return h;const O=P.getBoundingClientRect(),V=j.getBoundingClientRect(),Q=U9(p),F=Q?null:G9({rootEl:P,comment:R,pendingComment:t});let N=NaN,x=NaN;return Q?(N=Q.y-V.top,x=Q.x):F?(N=F.bottom-V.top,x=F.left):N=W9(u,R),!ji(N)&&K9({selectionPosition:o,comment:R,pendingComment:t})&&(N=q9({rootEl:P,layersRect:V,comment:R})),ji(N)||(N=Y9({comment:R,pendingComment:t,selectionPosition:o,activeZoom:i})),ji(N)?X9(Z9({rootRect:O,layersRect:V,anchorBottom:N,anchorClientX:x})):h});return Lt([e,t,o,i,r,p],()=>{const R=typeof window<"u"?window.requestAnimationFrame:null,P=typeof window<"u"?window.cancelAnimationFrame:null;v!=null&&P?.(v),R&&(v=R(()=>{m.value+=1,v=null}))},{deep:!1}),Lt(n,(R,P)=>{if(!P&&R){const j=document.activeElement;j instanceof HTMLElement&&(_=j)}},{deep:!1}),Lt(t,(R,P)=>{!P&&R&&C()}),Nn(()=>{document.addEventListener("pointerdown",y,!0)}),or(()=>{document.removeEventListener("pointerdown",y,!0);const R=typeof window<"u"?window.cancelAnimationFrame:null;v!=null&&(R?.(v),v=null),_=null}),{compactCommentPopoverStyle:b,closeCompactCommentPopover:()=>{n.value&&(t.value&&d(),c(),_&&typeof _.focus=="function"&&_.focus(),_=null)},resetClickAnchor:C}}function tl(...e){const t={};for(const n of e)if(!(typeof n!="object"||n===null))for(const[r,o]of Object.entries(n))o!==void 0&&(t[r]=o);return t}function N_(...e){for(const t of e)if(t!==void 0)return t}function B_(e){if(e?.type!=="mutation:committed")return null;const t=e.origin==="history"?e.result:e.receipt;if(!t||typeof t!="object")return null;const n=new Set,r=new Set,o=[],i=(a,l)=>{a?.kind!=="entity"||a.entityType!=="trackedChange"||typeof a.entityId=="string"&&a.entityId.length>0&&l.add(a.entityId)},s=a=>a?.kind!=="entity"||a.entityType!=="trackedChange"?null:typeof a.entityId=="string"&&a.entityId.length>0?a.entityId:null;if(Array.isArray(t.inserted)&&t.inserted.forEach(a=>i(a,n)),Array.isArray(t.updated)&&t.updated.forEach(a=>i(a,n)),Array.isArray(t.trackedChangeRefs)&&t.trackedChangeRefs.forEach(a=>i(a,n)),Array.isArray(t.removed)&&t.removed.forEach(a=>i(a,r)),Array.isArray(t.invalidatedRefs)&&t.invalidatedRefs.forEach(a=>i(a,r)),Array.isArray(t.remappedRefs))for(const a of t.remappedRefs){const l=s(a?.from),u=s(a?.to);l&&r.add(l),u&&n.add(u),l&&u&&l!==u&&o.push({from:l,to:u})}for(const a of r)n.delete(a);return n.size===0&&r.size===0?null:{upsertIds:n,removedIds:r,remappedPairs:o,reconcileMode:e.origin==="history"?"authoritative":"targeted"}}var hf=e=>new Set(Array.from(e??[]).filter(t=>typeof t=="string"&&t.length>0)),J9=e=>typeof e?.id=="string"&&e.id.length>0?e.id:typeof e?.changeId=="string"&&e.changeId.length>0?e.changeId:typeof e?.address?.entityId=="string"&&e.address.entityId.length>0?e.address.entityId:null,$9=(e,t)=>e?.adapter===t?.adapter&&e?.documentId===t?.documentId&&e?.editor===t?.editor&&e?.reconcileToken===t?.reconcileToken;function z_({getContext:e,reconcile:t,hydrate:n,onReconciled:r}){const o=new Map;let i=0,s=0,a=null,l=!1;const u=(R,P)=>s===R&&$9(P,e()),c=(R,P)=>{const j=new Set;for(const O of R)o.get(O)===P.get(O)&&(o.delete(O),j.add(O));return j},d=R=>new Map([...o].filter(([,P])=>P.ready===!0&&P.reconcileMode===R)),h=()=>{let R=!1;for(const P of o.values())P.gate!=="render"||P.ready||(P.ready=!0,R=!0);return R},m=R=>{let P=!1;for(const j of o.values())j.version>R||j.ready||(j.ready=!0,P=!0);return P},p=async(R,P,j,O=!1)=>{if(!(!O&&P.size===0||typeof r!="function"))try{await r(R,P,j)}catch{}},v=R=>hf(R?.resolvedIds??(R?.items??[]).map(J9).filter(Boolean)),_=async(R,P,j)=>{const O=await t(R,{upsertIds:new Set(P.keys()),removedIds:new Set,reconcileMode:"targeted"});if(!u(j,R)||(await p(R,c(v(O),P),O),new Set([...P].filter(([Q,F])=>o.get(Q)===F).map(([Q])=>Q)).size===0))return;const V=await n(R,{trackedChangesListMode:"interaction-prime",refreshReason:"mutation-render-reconcile",blocking:!1});u(j,R)&&await p(R,c(v(V),P),V)},C=async(R,P,j)=>{const O=await n(R,{trackedChangesListMode:"all",refreshReason:"mutation-history-render-reconcile",blocking:!0});if(!u(j,R)||![...P].some(([x,z])=>o.get(x)===z))return;const V=O?.ok===!0,Q=V&&O?.complete===!0&&O?.sourceCoverageComplete===!0,F=V?v(O):new Set,N=Q?c(new Set(P.keys()),P):new Set;await p(R,Q?N:F,{...O,reconcileMode:"authoritative"},!0)},k=()=>{if(a)return a;const R=d("targeted"),P=d("authoritative");if(R.size===0&&P.size===0)return null;const j=e();if(!j?.adapter)return null;l=!1;const O=s;return a=Promise.resolve().then(async()=>{P.size>0&&await C(j,P,O).catch(()=>{}),R.size>0&&await _(j,R,O).catch(()=>{})}).catch(()=>{}).finally(()=>{a=null,l&&k()}),a},y=(R,P)=>{if(!R)return;const j=R.reconcileMode==="authoritative"?"authoritative":"targeted",O=hf(R.removedIds),V=hf(R.upsertIds);for(const F of O){const N=o.get(F);N?.reconcileMode==="authoritative"?o.set(F,{...N,version:++i,gate:P,ready:!1}):o.delete(F)}const Q=e();if(O.size>0&&V.size===0&&Q?.adapter)try{Promise.resolve(t(Q,{upsertIds:new Set,removedIds:O})).catch(()=>{})}catch{}for(const F of V)if(!O.has(F)){const N=o.get(F);o.set(F,{version:++i,gate:P,ready:!1,reconcileMode:j==="authoritative"||N?.reconcileMode==="authoritative"?"authoritative":"targeted"})}},b=R=>y(R,"render");return{enqueue:b,enqueueAfterPaint(R,P){if(!R||typeof P!="function"){b(R);return}y(R,"exact-paint");const j=e();if(!j?.adapter)return;const O=s,V=i,Q=new Set([...hf(R.upsertIds),...hf(R.removedIds)]),F=new Map([...Q].flatMap(N=>{const x=o.get(N);return x?[[N,x]]:[]}));Promise.resolve().then(()=>P()).then(()=>{if(!u(O,j))return;let N=h();m(V)&&(N=!0);for(const[x,z]of F)o.get(x)===z&&(z.ready||(N=!0),z.ready=!0);a&&(N||V>0)&&(l=!0),k()}).catch(()=>{if(u(O,j))for(const[N,x]of F)o.get(N)===x&&(x.gate="render")})},onRender:(R=!1)=>{const P=h();a&&(P||R)&&(l=!0),k()},reset(){s+=1,o.clear(),l=!1},getPendingIds(){return new Set(o.keys())}}}function eM(e,t){if(!e||typeof e.entityId!="string"||e.entityType!=="comment"&&e.entityType!=="trackedChange")return null;const n=typeof t=="function"?t(e.entityId):null,r=n?.commentId??n?.importedId??e.entityId;return r!=null?String(r):null}var tM=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]);const V_=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:tM.has(e.editableCommandKind);function H_(e){return e==null?null:String(e)}function nM({hydrate:e,getActiveDocumentId:t,debounceMs:n=250,ceilingMs:r=1e3,now:o=()=>Date.now(),setTimer:i=(a,l)=>setTimeout(a,l),clearTimer:s=a=>clearTimeout(a)}){let a=null,l=null,u=null;const c=m=>H_(t())===m,d=()=>{a!=null&&s(a),a=null,l=null,u=null};return{schedule:m=>{const p=H_(m);if(!c(p))return!1;u!==p&&d();const v=o();u=p,l??=v,a!=null&&s(a);const _=Math.max(0,r-(v-l));return a=i(()=>{const C=u;a=null,l=null,u=null,c(C)&&e()},Math.min(n,_)),!0},clear:d}}var rM="no-author-configured";const oM="author-required",j_="This edit needs an author identity. Set `user.name` in your SuperDoc configuration and reopen the document to make tracked or revision-overlapping edits.";function U_(e){return typeof e=="string"&&e.includes(rM)}function iM(e){if(!e||e.type!=="mutation:rejected")return!1;if(e.failureSource==="receipt"){const t=e.failure;return t?t.code==="PRECONDITION_FAILED"&&U_(t.message):!1}return e.failureSource==="shell"?e.reason==="author-required"?!0:e.reason==="PRECONDITION_FAILED"&&U_(e.message):!1}function sM(){const e=new Set,t=n=>typeof n=="string"&&n.length>0?n:"__default__";return{shouldNotify(n,r){if(!iM(r))return!1;const o=t(n);return e.has(o)?!1:(e.add(o),!0)},clear(n){e.delete(t(n))}}}const aM=e=>!!(e?.anchor&&e?.focus&&(e.anchor.blockId!==e.focus.blockId||e.anchor.blockOffset!==e.focus.blockOffset)),lM=(e,t)=>{if(!e||e.rangeCount<1||e.isCollapsed||!t)return!1;const n=e.getRangeAt(0);return!t.contains(n.startContainer)&&!t.contains(n.endContainer)},cM=(e,t)=>e!=="editing"&&e!=="suggesting"?!1:aM(t);var uM=Ir((()=>{})),dM=nd({default:()=>eS},1),G_,W_,K_,q_,Y_,X_,Z_,Q_,J_,$_,eS,fM=Ir((()=>{xt(),uM(),gn(),G_=["onKeydown"],W_=["id"],K_={class:"sd-password-prompt__description"},q_={class:"sd-password-prompt__field"},Y_=["placeholder","disabled","aria-label"],X_={key:0,class:"sd-password-prompt__error",role:"alert"},Z_={class:"sd-password-prompt__actions"},Q_=["disabled"],J_=["disabled"],$_={__name:"PasswordPromptSurface",props:{surfaceId:{type:String,default:""},mode:{type:String,default:"dialog"},request:{type:Object,default:()=>({})},resolve:{type:Function,default:()=>{}},close:{type:Function,default:()=>{}},passwordPrompt:{type:Object,required:!0}},setup(e){const t=e,n=ne(""),r=ne(!1),o=ne(t.passwordPrompt.errorCode==="DOCX_PASSWORD_INVALID"),i=ne(o.value?t.passwordPrompt.texts.invalidMessage:""),s=ke(()=>o.value?t.passwordPrompt.texts.invalidTitle:t.passwordPrompt.texts.title),a=ke(()=>n.value.length>0&&!r.value);async function l(){if(!a.value)return;r.value=!0,i.value="";const c=await t.passwordPrompt.attemptPassword(n.value);if(c.success){t.resolve({password:n.value});return}r.value=!1,n.value="",c.errorCode==="DOCX_PASSWORD_INVALID"?(o.value=!0,i.value=t.passwordPrompt.texts.invalidMessage):c.errorCode==="timeout"?i.value=t.passwordPrompt.texts.timeoutMessage:i.value=t.passwordPrompt.texts.genericErrorMessage}function u(){t.close("user-cancelled")}return(c,d)=>(ge(),Ae("div",{class:"sd-password-prompt",onKeydown:Yo(tn(l,["prevent"]),["enter"])},[Me("h3",{id:`sd-password-prompt-heading-${e.surfaceId}`,class:"sd-password-prompt__heading"},Bt(s.value),9,W_),Me("p",K_,Bt(e.passwordPrompt.texts.description),1),Me("div",q_,[Us(Me("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>n.value=h),type:"password",class:"sd-password-prompt__input",placeholder:e.passwordPrompt.texts.placeholder,disabled:r.value,autocomplete:"current-password","aria-label":e.passwordPrompt.texts.inputAriaLabel},null,8,Y_),[[Ai,n.value]])]),i.value?(ge(),Ae("p",X_,Bt(i.value),1)):ht("",!0),Me("div",Z_,[Me("button",{type:"button",class:"sd-password-prompt__btn sd-password-prompt__btn--cancel",disabled:r.value,onClick:u},Bt(e.passwordPrompt.texts.cancelLabel),9,Q_),Me("button",{type:"button",class:"sd-password-prompt__btn sd-password-prompt__btn--submit",disabled:!a.value,onClick:l},Bt(r.value?e.passwordPrompt.texts.busyLabel:e.passwordPrompt.texts.submitLabel),9,J_)])],40,G_))}},eS=fn($_,[["__scopeId","data-v-ecf7f6fb"]])}));xt();var hM=["DOCX_PASSWORD_REQUIRED","DOCX_PASSWORD_INVALID"],pM=3e4,Ii={title:"Password Required",invalidTitle:"Incorrect Password",description:"This document is password protected. Enter the password to open it.",placeholder:"Enter password",inputAriaLabel:"Document password",submitLabel:"Open",cancelLabel:"Cancel",busyLabel:"Decrypting…",invalidMessage:"Incorrect password. Please try again.",timeoutMessage:"Timed out while decrypting. Please try again.",genericErrorMessage:"Unable to decrypt this document."};function mM({getSurfaceManager:e,getPasswordPromptConfig:t,onUnhandled:n}){const r=[],o=Kr(null),i=new Map;let s=!1;function a(p,v,_){if(!p||!hM.includes(v)||t()===!1||!e())return!1;const C=i.get(p.id);if(C)return clearTimeout(C.timer),C.resolve({success:!1,errorCode:v}),i.delete(p.id),!0;const k=r.find(y=>y.doc.id===p.id);return k?(k.errorCode=v,k.originalException=_,!0):(o.value?.doc.id===p.id||(r.push({doc:p,errorCode:v,originalException:_}),c()),!0)}function l(p){if(!p)return;const v=i.get(p.id);v&&(clearTimeout(v.timer),v.resolve({success:!0}),i.delete(p.id))}function u(){s=!0;for(const[,p]of i)clearTimeout(p.timer),p.resolve({success:!1,errorCode:"destroyed"});i.clear(),r.length=0,o.value=null}function c(){if(s||o.value||r.length===0)return;const p=r.shift();p&&d(p).catch(v=>{o.value=null,console.error("[SuperDoc] Password prompt error:",v),n?.(p.doc,p.errorCode,p.originalException),c()})}async function d({doc:p,errorCode:v,originalException:_}){const C=e();if(!C||s)return;const k=h(),y=P=>(p.password=P,p.editorMountNonce++,new Promise(j=>{const O=setTimeout(()=>{i.delete(p.id),j({success:!1,errorCode:"timeout"})},pM);i.set(p.id,{resolve:j,timer:O})})),b={documentId:p.id,errorCode:v,texts:k.texts,attemptPassword:y},T=m(k,{documentId:p.id,errorCode:v,texts:k.texts});if(T.suppressed){n?.(p,v,_),c();return}o.value={doc:p,surfaceHandle:null};let R;if(T.component)R=C.open({mode:"dialog",closeOnBackdrop:!1,ariaLabel:k.texts.title,component:Wr(T.component),props:{...T.props,passwordPrompt:b}});else if(T.render){const P=T.render;R=C.open({mode:"dialog",closeOnBackdrop:!1,ariaLabel:k.texts.title,render:j=>P({container:j.container,passwordPrompt:b,resolve:j.resolve,close:j.close,surfaceId:j.surfaceId,mode:j.mode})})}else{const P=(await Promise.resolve().then(()=>(fM(),dM))).default,j=`password-prompt-${p.id}`;R=C.open({id:j,mode:"dialog",closeOnBackdrop:!1,ariaLabelledBy:`sd-password-prompt-heading-${j}`,component:Wr(P),props:{passwordPrompt:b}})}o.value={doc:p,surfaceHandle:R},await R.result,o.value=null,c()}function h(){const p=t();if(p===!1)return{enabled:!1,texts:Ii};const v=typeof p=="object"&&p!==null?p:{};if(v.component!=null&&typeof v.render=="function")throw new Error('modules.surfaces.passwordPrompt cannot provide both "component" and "render". Use one or the other.');return{enabled:!0,texts:{title:v.title??Ii.title,invalidTitle:v.invalidTitle??Ii.invalidTitle,description:v.description??Ii.description,placeholder:v.placeholder??Ii.placeholder,inputAriaLabel:v.inputAriaLabel??Ii.inputAriaLabel,submitLabel:v.submitLabel??Ii.submitLabel,cancelLabel:v.cancelLabel??Ii.cancelLabel,busyLabel:v.busyLabel??Ii.busyLabel,invalidMessage:v.invalidMessage??Ii.invalidMessage,timeoutMessage:v.timeoutMessage??Ii.timeoutMessage,genericErrorMessage:v.genericErrorMessage??Ii.genericErrorMessage},component:v.component,props:v.props,render:v.render,resolver:v.resolver}}function m(p,v){if(typeof p.resolver=="function"){const _=p.resolver(v);if(_!=null&&_.type!=="default"){if(_.type==="none")return{suppressed:!0};if(_.type==="custom")return{component:_.component,props:_.props};if(_.type==="external")return{render:_.render}}}return p.component!=null?{component:p.component,props:p.props}:typeof p.render=="function"?{render:p.render}:{builtin:!0}}return{handleEncryptionError:a,handleEditorReady:l,destroy:u}}function tS(e,{getCurrentSession:t,applySlice:n,onSettled:r}){return()=>{if(e===t())try{n(e.getSnapshot())}catch{}r()}}var gM=Ir((()=>{})),vM=nd({default:()=>kS},1),nS,rS,oS,iS,sS,aS,lS,cS,uS,dS,fS,hS,pS,mS,gS,vS,yS,bS,wS,CS,_S,SS,kS,yM=Ir((()=>{xt(),gM(),gn(),nS=["onKeydown"],rS={class:"sd-find-replace__row"},oS=["title","aria-label","aria-expanded"],iS=["value","placeholder","aria-label"],sS={key:0,class:"sd-find-replace__count"},aS=["title","aria-label","aria-pressed"],lS=["title","aria-label","aria-pressed"],cS=["title","aria-label","aria-pressed"],uS={class:"sd-find-replace__nav"},dS=["disabled","title","aria-label"],fS=["disabled","title","aria-label"],hS=["title","aria-label"],pS={key:0,class:"sd-find-replace__row"},mS={class:"sd-find-replace__field"},gS=["value","placeholder","aria-label"],vS={class:"sd-find-replace__nav sd-find-replace__nav--actions"},yS=["disabled","title"],bS=["disabled","title"],wS={key:1,class:"sd-find-replace__error",role:"alert"},CS={key:0,class:"sd-find-replace__row-indent","aria-hidden":"true"},_S={class:"sd-find-replace__error-text"},SS={__name:"FindReplaceSurface",props:{surfaceId:{type:String,default:""},mode:{type:String,default:"floating"},request:{type:Object,default:()=>({})},resolve:{type:Function,default:()=>{}},close:{type:Function,default:()=>{}},findReplace:{type:Object,required:!0}},setup(e){const t=e,n=ne(null),r=ke(()=>{const p=t.findReplace;return!!(!p.hasMatches?.value||p.replacePending?.value===!0||p.canReplace&&p.canReplace.value===!1)}),o=ke(()=>t.findReplace.ignoreDiacriticsSupported?.value!==!1),i=ke(()=>t.findReplace.replaceEnabled&&t.findReplace.replaceCanMutate?.value!==!1),s=ke(()=>t.findReplace.regexSupported?.value===!0),a=ke(()=>t.findReplace.searchError?.value??null);function l(p){p.key==="Enter"&&!p.shiftKey?(p.preventDefault(),u()):p.key==="Enter"&&p.shiftKey&&(p.preventDefault(),c())}function u(){t.findReplace.goNext(),m()}function c(){t.findReplace.goPrev(),m()}function d(){t.findReplace.close("user-closed")}function h(p){const v=[];let _=p?.parentElement??null;for(;_;){const k=_.ownerDocument?.defaultView?.getComputedStyle?.(_);if(k){const y=`${k.overflowY} ${k.overflowX}`;(y.includes("auto")||y.includes("scroll"))&&v.push(_)}_=_.parentElement}const C=p?.ownerDocument?.scrollingElement;return C&&!v.includes(C)&&v.push(C),v}function m(){const p=n.value;if(!p)return;const v=h(p).map(_=>({el:_,top:_.scrollTop,left:_.scrollLeft}));p.focus({preventScroll:!0});for(const{el:_,top:C,left:k}of v)_.scrollTop!==C&&(_.scrollTop=C),_.scrollLeft!==k&&(_.scrollLeft=k)}return Nn(()=>{n.value?.focus(),t.findReplace.registerFocusFn(m)}),(p,v)=>(ge(),Ae("div",{class:"sd-find-replace",onKeydown:Yo(tn(d,["stop"]),["esc"])},[Me("div",rS,[i.value?(ge(),Ae("button",{key:0,type:"button",class:rn(["sd-find-replace__btn sd-find-replace__btn--expander",{"sd-find-replace__btn--expander-open":e.findReplace.showReplace.value}]),title:e.findReplace.texts.toggleReplaceLabel,"aria-label":e.findReplace.texts.toggleReplaceAriaLabel,"aria-expanded":e.findReplace.showReplace.value?"true":"false",onClick:v[0]||(v[0]=_=>e.findReplace.showReplace.value=!e.findReplace.showReplace.value)},[...v[14]||(v[14]=[Me("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},[Me("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],10,oS)):ht("",!0),Me("div",{class:rn(["sd-find-replace__field",{"sd-find-replace__field--error":a.value}])},[v[15]||(v[15]=Me("svg",{class:"sd-find-replace__search-icon",viewBox:"0 0 16 16",width:"15",height:"15","aria-hidden":"true"},[Me("path",{d:"M7 1a6 6 0 1 0 3.7 10.7l3.3 3.3 1-1-3.3-3.3A6 6 0 0 0 7 1Zm0 1.5a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Z",fill:"currentColor"})],-1)),Me("input",{ref_key:"findInputRef",ref:n,value:e.findReplace.findQuery.value,onInput:v[1]||(v[1]=_=>e.findReplace.findQuery.value=_.target.value),type:"text",class:"sd-find-replace__input sd-find-replace__input--search","data-sd-autofocus":"",placeholder:e.findReplace.texts.findPlaceholder,"aria-label":e.findReplace.texts.findAriaLabel,onKeydown:l},null,40,iS),e.findReplace.findQuery.value&&!a.value?(ge(),Ae("span",sS,Bt(e.findReplace.matchLabel.value),1)):ht("",!0),Me("button",{type:"button",class:rn(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.caseSensitive.value}]),title:e.findReplace.texts.matchCaseAriaLabel,"aria-label":e.findReplace.texts.matchCaseAriaLabel,"aria-pressed":e.findReplace.caseSensitive.value?"true":"false",onMousedown:v[2]||(v[2]=tn(()=>{},["prevent"])),onClick:v[3]||(v[3]=_=>e.findReplace.caseSensitive.value=!e.findReplace.caseSensitive.value)},Bt(e.findReplace.texts.matchCaseLabel),43,aS),o.value?(ge(),Ae("button",{key:1,type:"button",class:rn(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.ignoreDiacritics.value}]),title:e.findReplace.texts.ignoreDiacriticsAriaLabel,"aria-label":e.findReplace.texts.ignoreDiacriticsAriaLabel,"aria-pressed":e.findReplace.ignoreDiacritics.value?"true":"false",onMousedown:v[4]||(v[4]=tn(()=>{},["prevent"])),onClick:v[5]||(v[5]=_=>e.findReplace.ignoreDiacritics.value=!e.findReplace.ignoreDiacritics.value)},Bt(e.findReplace.texts.ignoreDiacriticsLabel),43,lS)):ht("",!0),s.value?(ge(),Ae("button",{key:2,type:"button",class:rn(["sd-find-replace__btn sd-find-replace__btn--toggle",{"sd-find-replace__btn--active":e.findReplace.regex.value}]),title:e.findReplace.texts.regexAriaLabel,"aria-label":e.findReplace.texts.regexAriaLabel,"aria-pressed":e.findReplace.regex.value?"true":"false",onMousedown:v[6]||(v[6]=tn(()=>{},["prevent"])),onClick:v[7]||(v[7]=_=>e.findReplace.regex.value=!e.findReplace.regex.value)},Bt(e.findReplace.texts.regexLabel),43,cS)):ht("",!0)],2),Me("div",uS,[Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",disabled:!e.findReplace.hasMatches.value,title:e.findReplace.texts.previousMatchLabel,"aria-label":e.findReplace.texts.previousMatchAriaLabel,onClick:v[8]||(v[8]=_=>c())},[...v[16]||(v[16]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"M10 3.5 5.5 8 10 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,dS),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",disabled:!e.findReplace.hasMatches.value,title:e.findReplace.texts.nextMatchLabel,"aria-label":e.findReplace.texts.nextMatchAriaLabel,onClick:v[9]||(v[9]=_=>u())},[...v[17]||(v[17]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"M6 3.5 10.5 8 6 12.5",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,fS),v[19]||(v[19]=Me("span",{class:"sd-find-replace__divider","aria-hidden":"true"},null,-1)),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--icon",title:e.findReplace.texts.closeLabel,"aria-label":e.findReplace.texts.closeAriaLabel,onClick:d},[...v[18]||(v[18]=[Me("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true"},[Me("path",{d:"m4.5 4.5 7 7m0-7-7 7",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])],8,hS)])]),e.findReplace.showReplace.value&&i.value?(ge(),Ae("div",pS,[v[20]||(v[20]=Me("span",{class:"sd-find-replace__row-indent","aria-hidden":"true"},null,-1)),Me("div",mS,[Me("input",{value:e.findReplace.replaceText.value,onInput:v[10]||(v[10]=_=>e.findReplace.replaceText.value=_.target.value),type:"text",class:"sd-find-replace__input",placeholder:e.findReplace.texts.replacePlaceholder,"aria-label":e.findReplace.texts.replaceAriaLabel,onKeydown:v[11]||(v[11]=Yo(tn(_=>e.findReplace.replaceCurrent(),["prevent"]),["enter"]))},null,40,gS)]),Me("div",vS,[Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--action",disabled:r.value,title:e.findReplace.texts.replaceLabel,onClick:v[12]||(v[12]=_=>e.findReplace.replaceCurrent())},Bt(e.findReplace.texts.replaceLabel),9,yS),Me("button",{type:"button",class:"sd-find-replace__btn sd-find-replace__btn--action",disabled:r.value,title:e.findReplace.texts.replaceAllLabel,onClick:v[13]||(v[13]=_=>e.findReplace.replaceAll())},Bt(e.findReplace.texts.replaceAllLabel),9,bS)])])):ht("",!0),a.value?(ge(),Ae("div",wS,[i.value?(ge(),Ae("span",CS)):ht("",!0),Me("span",_S,Bt(a.value),1)])):ht("",!0)],40,nS))}},kS=fn(SS,[["__scopeId","data-v-fed15bd3"]])}));xt();var ar={findPlaceholder:"Find",findAriaLabel:"Find text",replacePlaceholder:"Replace",replaceAriaLabel:"Replace text",noResultsLabel:"No results",previousMatchLabel:"Previous match (Shift+Enter)",previousMatchAriaLabel:"Previous match",nextMatchLabel:"Next match (Enter)",nextMatchAriaLabel:"Next match",closeLabel:"Close (Escape)",closeAriaLabel:"Close find and replace",replaceLabel:"Replace",replaceAllLabel:"All",toggleReplaceLabel:"Toggle replace",toggleReplaceAriaLabel:"Toggle replace",matchCaseLabel:"Aa",matchCaseAriaLabel:"Match case",regexLabel:".*",regexAriaLabel:"Use regular expression",invalidPatternLabel:"Invalid pattern",ignoreDiacriticsLabel:"À≑a",ignoreDiacriticsAriaLabel:"Ignore diacritics"};function bM(e){if(!e)return null;const t=e.extensionStorage,n=e.storage,r=t?.Search??n?.Search;if(r?.searchIndex||r?.searchResults)return r;const o=e.extensionStorage??e.storage;if(o)for(const i of Object.keys(o)){const s=o[i];if(s&&typeof s=="object"&&"searchIndex"in s&&"searchResults"in s)return s}return null}function wM({getSurfaceManager:e,getActiveEditor:t,activeEditorRef:n,getFindReplaceConfig:r,getSuperDocUI:o}){let i=null,s=null,a=null,l=!1,u=!1;const c=ne(!1);let d=null;const h=ne(""),m=ne(""),p=ne(!1),v=ne(!1),_=ne(!1),C=ne(!1),k=ne(0),y=ne(-1),b=ne(!0),T=ne(!1),R=ne(!0),P=ne(!1),j=ne(null);let O=ar;const V=ke(()=>h.value?k.value===0?O.noResultsLabel:`${y.value+1} of ${k.value}`:""),Q=ke(()=>k.value>0),F=ke(()=>Q.value&&!T.value&&b.value);let N=null,x=null;function z(G){return typeof G?.commands?.setSearchSession=="function"}function J(){try{const G=(typeof o=="function"?o():null)?.search;return G&&typeof G.search=="function"?G:null}catch{return null}}function X(G){G&&(k.value=typeof G.total=="number"?G.total:0,y.value=typeof G.activeIndex=="number"?G.activeIndex:-1,b.value=G.canReplace===!0,j.value=G.reason==="search-invalid-pattern"?O.invalidPatternLabel:null)}function ae(){if(a){pe();return}if(s){if(!h.value){try{s.commands.clearSearchSession()}catch{}k.value=0,y.value=-1;return}try{const G=s.commands.setSearchSession(h.value,{caseSensitive:p.value,ignoreDiacritics:v.value,highlight:!0,searchModel:Ee().includeDeletedText?"raw":"visible"});k.value=G.matches.length,y.value=G.activeMatchIndex}catch{}}}function pe(){const G=a;if(G){if(!h.value){try{G.clear()}catch{}k.value=0,y.value=-1,j.value=null;return}try{X(G.search(h.value,{caseSensitive:p.value,includeDeletedText:Ee().includeDeletedText===!0,regex:_.value}))}catch{}}}function Fe(){N&&clearTimeout(N),N=setTimeout(ae,150)}Lt(h,()=>{c.value&&Fe()}),Lt(p,()=>{c.value&&ae()}),Lt(v,()=>{c.value&&ae()}),Lt(_,()=>{c.value&&ae()});let fe=!0;function ye(){if(Q.value){if(a){try{a.next(),X(a.getSnapshot())}catch{}return}if(s)try{y.value=s.commands.nextSearchMatch().activeMatchIndex}catch{}}}function le(){if(Q.value){if(a){try{a.previous(),X(a.getSnapshot())}catch{}return}if(s)try{y.value=s.commands.previousSearchMatch().activeMatchIndex}catch{}}}function Se(){if(fe&&!T.value&&Q.value){if(a){if(!b.value)return;const G=a;T.value=!0;const te=tS(G,{getCurrentSession:()=>a,applySlice:X,onSettled:()=>{T.value=!1}});let Y=null;try{Y=G.replace(m.value)}catch{}Y&&typeof Y.then=="function"?Promise.resolve(Y).then(te,te):te();return}if(s)try{const G=s.commands.replaceSearchMatch(m.value);k.value=G.matches.length,y.value=G.activeMatchIndex}catch{}}}function re(){if(fe&&!T.value&&Q.value){if(a){if(!b.value)return;const G=a;T.value=!0;const te=tS(G,{getCurrentSession:()=>a,applySlice:X,onSettled:()=>{T.value=!1}});let Y=null;try{Y=G.replaceAll(m.value)}catch{}Y&&typeof Y.then=="function"?Promise.resolve(Y).then(te,te):te();return}if(s)try{s.commands.replaceAllSearchMatches(m.value),k.value=0,y.value=-1}catch{}}}function xe(){if(a){try{X(a.getSnapshot())}catch{}return}const G=bM(s);if(!G)return;const te=G.searchResults,Y=Array.isArray(te)?te.length:0,K=G.activeMatchIndex??-1;Y!==k.value&&(k.value=Y),K!==y.value&&(y.value=K)}function $e(){st(),x=setInterval(xe,200)}function st(){N&&clearTimeout(N),N=null,x&&clearInterval(x),x=null}function At(){h.value="",m.value="",p.value=!1,v.value=!1,_.value=!1,j.value=null,C.value=!1,k.value=0,y.value=-1,b.value=!0,T.value=!1}function Ee(){const G=typeof r=="function"?r():void 0;if(G===!1||G==null)return{enabled:!1,texts:ar,replaceEnabled:!0};if(G===!0)return{enabled:!0,texts:ar,replaceEnabled:!0};const te=typeof G=="object"?G:{};if(te.component!=null&&typeof te.render=="function")throw new Error('modules.surfaces.findReplace cannot provide both "component" and "render". Use one or the other.');return{enabled:!0,texts:{findPlaceholder:te.findPlaceholder??ar.findPlaceholder,findAriaLabel:te.findAriaLabel??ar.findAriaLabel,replacePlaceholder:te.replacePlaceholder??ar.replacePlaceholder,replaceAriaLabel:te.replaceAriaLabel??ar.replaceAriaLabel,noResultsLabel:te.noResultsLabel??ar.noResultsLabel,previousMatchLabel:te.previousMatchLabel??ar.previousMatchLabel,previousMatchAriaLabel:te.previousMatchAriaLabel??ar.previousMatchAriaLabel,nextMatchLabel:te.nextMatchLabel??ar.nextMatchLabel,nextMatchAriaLabel:te.nextMatchAriaLabel??ar.nextMatchAriaLabel,closeLabel:te.closeLabel??ar.closeLabel,closeAriaLabel:te.closeAriaLabel??ar.closeAriaLabel,replaceLabel:te.replaceLabel??ar.replaceLabel,replaceAllLabel:te.replaceAllLabel??ar.replaceAllLabel,toggleReplaceLabel:te.toggleReplaceLabel??ar.toggleReplaceLabel,toggleReplaceAriaLabel:te.toggleReplaceAriaLabel??ar.toggleReplaceAriaLabel,matchCaseLabel:te.matchCaseLabel??ar.matchCaseLabel,matchCaseAriaLabel:te.matchCaseAriaLabel??ar.matchCaseAriaLabel,regexLabel:te.regexLabel??ar.regexLabel,regexAriaLabel:te.regexAriaLabel??ar.regexAriaLabel,invalidPatternLabel:te.invalidPatternLabel??ar.invalidPatternLabel,ignoreDiacriticsLabel:te.ignoreDiacriticsLabel??ar.ignoreDiacriticsLabel,ignoreDiacriticsAriaLabel:te.ignoreDiacriticsAriaLabel??ar.ignoreDiacriticsAriaLabel},replaceEnabled:te.replaceEnabled??!0,includeDeletedText:te.includeDeletedText??!1,component:te.component,props:te.props,render:te.render,resolver:te.resolver,floating:te.floating&&typeof te.floating=="object"?te.floating:void 0}}function Ge(G,te){if(typeof G.resolver=="function"){const Y=G.resolver(te);if(Y!=null&&Y.type!=="default"){if(Y.type==="none")return{suppressed:!0};if(Y.type==="custom")return{component:Y.component,props:Y.props};if(Y.type==="external")return{render:Y.render}}}return G.component!=null?{component:G.component,props:G.props}:typeof G.render=="function"?{render:G.render}:{builtin:!0}}function qe(G,te){return{findQuery:h,replaceText:m,caseSensitive:p,ignoreDiacritics:v,regex:_,showReplace:C,matchCount:k,activeMatchIndex:y,matchLabel:V,hasMatches:Q,canReplace:F,replaceCanMutate:b,replacePending:T,ignoreDiacriticsSupported:R,regexSupported:P,searchError:j,replaceEnabled:G.replaceEnabled??!0,texts:G.texts,goNext:ye,goPrev:le,replaceCurrent:Se,replaceAll:re,registerFocusFn:Y=>{d=Y},close:Y=>te(Y)}}function Z(G){return{get findQuery(){return G.findQuery.value},set findQuery(te){G.findQuery.value=te},get replaceText(){return G.replaceText.value},set replaceText(te){G.replaceText.value=te},get caseSensitive(){return G.caseSensitive.value},set caseSensitive(te){G.caseSensitive.value=te},get ignoreDiacritics(){return G.ignoreDiacritics.value},set ignoreDiacritics(te){G.ignoreDiacritics.value=te},get regex(){return G.regex.value},set regex(te){G.regex.value=te},get regexSupported(){return G.regexSupported.value},get searchError(){return G.searchError.value},get replaceCanMutate(){return G.replaceCanMutate.value},get showReplace(){return G.showReplace.value},set showReplace(te){G.showReplace.value=te},get matchCount(){return G.matchCount.value},get activeMatchIndex(){return G.activeMatchIndex.value},get matchLabel(){return G.matchLabel.value},get hasMatches(){return G.hasMatches.value},get canReplace(){return G.canReplace.value},get replacePending(){return G.replacePending.value},get ignoreDiacriticsSupported(){return G.ignoreDiacriticsSupported.value},replaceEnabled:G.replaceEnabled,texts:G.texts,goNext:G.goNext,goPrev:G.goPrev,replaceCurrent:G.replaceCurrent,replaceAll:G.replaceAll,registerFocusFn:G.registerFocusFn,close:G.close}}function S(G){if(G){if(typeof G?.commands?.clearSearchSession=="function"){try{G.commands.clearSearchSession()}catch{}return}if(a&&G===s)try{a.clear()}catch{}}}function ee(){try{if(l||!e()||!t())return!1;if(i&&c.value)return!0;const G=Ee();if(!G.enabled||Ge(G,{texts:G.texts,replaceEnabled:G.replaceEnabled??!0}).suppressed)return!1;if(!z(t())){const te=J();if(!te)return!1;try{if(te.getSnapshot?.().available!==!0)return!1}catch{return!1}}return!0}catch{return!1}}async function D(){if(l)return;const G=e();if(G){if(i&&c.value){d?.();return}if(!u){u=!0;try{const te=t();if(!te){u=!1;return}const Y=Ee();if(!Y.enabled){u=!1;return}const K=Ge(Y,{texts:Y.texts,replaceEnabled:Y.replaceEnabled??!0});if(K.suppressed){u=!1;return}At(),O=Y.texts,fe=Y.replaceEnabled??!0;const be={placement:"top-right",autoFocus:!0,width:420,...Y.floating??{}};if(s&&s!==te&&S(s),s=te,a=z(te)?null:J(),R.value=!a,P.value=!!a,a)try{X(a.getSnapshot())}catch{}d=null;let me=()=>{};const Ce=qe(Y,He=>me(He));let Pe;if(K.component)Pe=G.open({mode:"floating",ariaLabel:Y.texts.findAriaLabel,closeOnEscape:!0,floating:be,component:Wr(K.component),props:{...K.props,findReplace:Ce}});else if(K.render){const He=K.render;Pe=G.open({mode:"floating",ariaLabel:Y.texts.findAriaLabel,closeOnEscape:!0,floating:be,render:Ct=>He({container:Ct.container,findReplace:Z(Ce),resolve:Ct.resolve,close:Ct.close,surfaceId:Ct.surfaceId,mode:Ct.mode})})}else{let He;try{He=(await Promise.resolve().then(()=>(yM(),vM))).default}catch{u=!1;return}if(l||i&&c.value){u=!1;return}const Ct=t()||te;s!==Ct&&(S(s),s=Ct,a=z(Ct)?null:J(),R.value=!a),Pe=G.open({mode:"floating",ariaLabel:Y.texts.findAriaLabel,component:Wr(He),closeOnEscape:!0,floating:be,props:{findReplace:Ce}})}me=He=>Pe.close(He??"programmatic"),i=Pe,c.value=!0,u=!1,$e();const it=Pe.id;Pe.result.then(()=>{i?.id===it?(st(),S(s),i=null,c.value=!1,d=null):S(te!==s?te:null)})}catch(te){throw u=!1,te}}}}function U(){i&&i.close("programmatic")}n&&Lt(n,(G,te)=>{!c.value||!i||G!==te&&(S(te),U())});function H(){l=!0,st(),U(),s=null,a=null,d=null}return{open:D,close:U,isOpen:c,wouldOpen:ee,destroy:H}}var pf=null;function p0(e){e!=null&&(pf=e)}function CM(e){pf===e&&(pf=null)}function _M(e){return pf===null||pf===e}function SM(e,{focusInside:t,owner:n}){if(e.defaultPrevented)return!1;if(t)return!0;const r=document.activeElement;return(!r||r===document.body||r===document.documentElement)&&_M(n)}var kM=/^(https?|mailto|tel):/i,AM=/^(javascript|data|vbscript):/i,IM=/^[a-z][a-z0-9+.-]*:/i;function EM(e){if(typeof e!="string")return null;const t=e.trim();return t?t.startsWith("#")?{href:t}:AM.test(t)?null:IM.test(t)?kM.test(t)?{href:t}:null:{href:t}:null}var xM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"/></svg>',TM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"/></svg>',RM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"/></svg>',AS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M40 48C26.7 48 16 58.7 16 72l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24L40 48zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM16 232l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0c-13.3 0-24 10.7-24 24zM40 368c-13.3 0-24 10.7-24 24l0 48c0 13.3 10.7 24 24 24l48 0c13.3 0 24-10.7 24-24l0-48c0-13.3-10.7-24-24-24l-48 0z"/></svg>',MM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc. (bullet shapes modified)--><path fill-rule="evenodd" d="M192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 48 A48 48 0 1 0 64 144 A48 48 0 1 0 64 48 Z M64 68 A28 28 0 1 1 64 124 A28 28 0 1 1 64 68 Z M64 208 A48 48 0 1 0 64 304 A48 48 0 1 0 64 208 Z M64 228 A28 28 0 1 1 64 284 A28 28 0 1 1 64 228 Z M64 368 A48 48 0 1 0 64 464 A48 48 0 1 0 64 368 Z M64 388 A28 28 0 1 1 64 444 A28 28 0 1 1 64 388 Z"/></svg>
15
+ `,LM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc. (bullet shapes modified)--><path d="M192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM16 48 L112 48 L112 144 L16 144 Z M16 208 L112 208 L112 304 L16 304 Z M16 368 L112 368 L112 464 L16 464 Z"/></svg>
16
+ `,PM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>',DM=`<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
17
+ <g clip-path="url(#clip0_0_1)">
18
+ <path d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z" fill="currentColor"/>
19
+ <path d="M131.823 9.18182V111H110.296V29.6151H109.7L86.3828 44.2315V25.1406L111.589 9.18182H131.823ZM163.132 112.293C159.85 112.293 157.033 111.133 154.68 108.812C152.36 106.459 151.2 103.642 151.2 100.361C151.2 97.1127 152.36 94.3286 154.68 92.0085C157.033 89.6884 159.85 88.5284 163.132 88.5284C166.314 88.5284 169.098 89.6884 171.484 92.0085C173.87 94.3286 175.064 97.1127 175.064 100.361C175.064 102.548 174.5 104.554 173.373 106.376C172.279 108.166 170.838 109.608 169.048 110.702C167.258 111.762 165.286 112.293 163.132 112.293Z" fill="currentColor"/>
20
+ <path d="M62.37 284V268.489L98.6129 234.93C101.695 231.947 104.281 229.263 106.369 226.876C108.49 224.49 110.097 222.153 111.191 219.866C112.285 217.546 112.832 215.044 112.832 212.359C112.832 209.376 112.152 206.808 110.793 204.653C109.434 202.466 107.578 200.792 105.225 199.632C102.872 198.439 100.204 197.842 97.2209 197.842C94.1054 197.842 91.3875 198.472 89.0675 199.732C86.7474 200.991 84.9576 202.797 83.6982 205.151C82.4387 207.504 81.8089 210.304 81.8089 213.553H61.3757C61.3757 206.891 62.8838 201.107 65.8999 196.202C68.916 191.296 73.1418 187.501 78.5774 184.817C84.013 182.132 90.2772 180.79 97.37 180.79C104.662 180.79 111.009 182.082 116.411 184.668C121.847 187.22 126.073 190.766 129.089 195.307C132.105 199.848 133.613 205.051 133.613 210.918C133.613 214.762 132.851 218.557 131.326 222.303C129.835 226.048 127.166 230.207 123.322 234.781C119.477 239.322 114.058 244.774 107.065 251.138L92.1996 265.705V266.401H134.955V284H62.37ZM163.132 285.293C159.85 285.293 157.033 284.133 154.68 281.812C152.36 279.459 151.2 276.642 151.2 273.361C151.2 270.113 152.36 267.329 154.68 265.009C157.033 262.688 159.85 261.528 163.132 261.528C166.314 261.528 169.098 262.688 171.484 265.009C173.87 267.329 175.064 270.113 175.064 273.361C175.064 275.548 174.5 277.554 173.373 279.376C172.279 281.166 170.838 282.608 169.048 283.702C167.258 284.762 165.286 285.293 163.132 285.293Z" fill="currentColor"/>
21
+ <path d="M98.7745 451.392C91.3503 451.392 84.738 450.116 78.9379 447.564C73.1708 444.979 68.6135 441.432 65.266 436.925C61.9516 432.384 60.2447 427.147 60.1452 421.214H81.8214C81.954 423.7 82.766 425.888 84.2575 427.777C85.7821 429.633 87.8039 431.075 90.3228 432.102C92.8417 433.13 95.6755 433.643 98.8242 433.643C102.105 433.643 105.006 433.063 107.525 431.903C110.043 430.743 112.016 429.136 113.441 427.081C114.866 425.026 115.578 422.656 115.578 419.972C115.578 417.254 114.816 414.851 113.292 412.763C111.8 410.642 109.646 408.984 106.828 407.791C104.044 406.598 100.73 406.001 96.8853 406.001H87.3896V390.192H96.8853C100.133 390.192 103 389.628 105.486 388.501C108.005 387.375 109.961 385.817 111.353 383.828C112.745 381.806 113.441 379.453 113.441 376.768C113.441 374.216 112.828 371.979 111.601 370.057C110.408 368.101 108.718 366.577 106.53 365.483C104.376 364.389 101.857 363.842 98.9734 363.842C96.0567 363.842 93.3886 364.373 90.9691 365.433C88.5496 366.461 86.6107 367.936 85.1523 369.858C83.694 371.78 82.9151 374.034 82.8157 376.619H62.1836C62.283 370.753 63.9568 365.582 67.2049 361.108C70.453 356.634 74.828 353.137 80.3299 350.618C85.8649 348.066 92.1126 346.79 99.0728 346.79C106.099 346.79 112.248 348.066 117.517 350.618C122.787 353.17 126.881 356.617 129.797 360.959C132.747 365.268 134.205 370.107 134.172 375.476C134.205 381.177 132.432 385.933 128.853 389.744C125.306 393.556 120.683 395.975 114.982 397.003V397.798C122.472 398.759 128.173 401.361 132.084 405.604C136.028 409.813 137.984 415.083 137.951 421.413C137.984 427.214 136.31 432.367 132.929 436.875C129.582 441.383 124.958 444.929 119.059 447.514C113.159 450.099 106.398 451.392 98.7745 451.392ZM163.132 451.293C159.85 451.293 157.033 450.133 154.68 447.812C152.36 445.459 151.2 442.642 151.2 439.361C151.2 436.113 152.36 433.329 154.68 431.009C157.033 428.688 159.85 427.528 163.132 427.528C166.314 427.528 169.098 428.688 171.484 431.009C173.87 433.329 175.064 436.113 175.064 439.361C175.064 441.548 174.5 443.554 173.373 445.376C172.279 447.166 170.838 448.608 169.048 449.702C167.258 450.762 165.286 451.293 163.132 451.293Z" fill="currentColor"/>
22
+ </g>
23
+ <defs>
24
+ <clipPath id="clip0_0_1">
25
+ <rect width="512" height="512" fill="white"/>
26
+ </clipPath>
27
+ </defs>
28
+ </svg>
29
+ `,OM=`<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
30
+ <g clip-path="url(#clip0_1_12)">
31
+ <path d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z" fill="currentColor"/>
32
+ <path d="M119.768 25.1818V127H98.2415V45.6151H97.6449L74.3281 60.2315V41.1406L99.5341 25.1818H119.768ZM179.863 76.0909C179.863 88.4536 178.205 99.822 174.891 110.196C171.61 120.57 166.572 130.182 159.777 139.031H139.543C142.128 135.75 144.531 131.74 146.752 127C148.972 122.26 150.911 117.09 152.569 111.489C154.226 105.854 155.518 100.021 156.446 93.9886C157.374 87.9564 157.838 81.9905 157.838 76.0909C157.838 68.2358 157.026 60.3144 155.402 52.3267C153.811 44.3059 151.624 36.8816 148.84 30.054C146.089 23.1932 142.99 17.5753 139.543 13.2003H159.777C166.572 22.0497 171.61 31.6615 174.891 42.0355C178.205 52.4096 179.863 63.7614 179.863 76.0909Z" fill="currentColor"/>
33
+ <path d="M55.7841 300V284.489L92.027 250.93C95.1094 247.947 97.6946 245.263 99.7827 242.876C101.904 240.49 103.511 238.153 104.605 235.866C105.699 233.546 106.246 231.044 106.246 228.359C106.246 225.376 105.566 222.808 104.207 220.653C102.848 218.466 100.992 216.792 98.6392 215.632C96.286 214.439 93.6179 213.842 90.6349 213.842C87.5194 213.842 84.8016 214.472 82.4815 215.732C80.1615 216.991 78.3717 218.797 77.1122 221.151C75.8527 223.504 75.223 226.304 75.223 229.553H54.7898C54.7898 222.891 56.2978 217.107 59.3139 212.202C62.33 207.296 66.5559 203.501 71.9915 200.817C77.4271 198.132 83.6913 196.79 90.7841 196.79C98.0758 196.79 104.423 198.082 109.825 200.668C115.261 203.22 119.487 206.766 122.503 211.307C125.519 215.848 127.027 221.051 127.027 226.918C127.027 230.762 126.265 234.557 124.74 238.303C123.249 242.048 120.58 246.207 116.736 250.781C112.891 255.322 107.472 260.774 100.479 267.138L85.6136 281.705V282.401H128.369V300H55.7841ZM179.863 249.091C179.863 261.454 178.205 272.822 174.891 283.196C171.61 293.57 166.572 303.182 159.777 312.031H139.543C142.128 308.75 144.531 304.74 146.752 300C148.972 295.26 150.911 290.09 152.569 284.489C154.226 278.854 155.518 273.021 156.446 266.989C157.374 260.956 157.838 254.991 157.838 249.091C157.838 241.236 157.026 233.314 155.402 225.327C153.811 217.306 151.624 209.882 148.84 203.054C146.089 196.193 142.99 190.575 139.543 186.2H159.777C166.572 195.05 171.61 204.661 174.891 215.036C178.205 225.41 179.863 236.761 179.863 249.091Z" fill="currentColor"/>
34
+ <path d="M89.3175 473.392C81.8932 473.392 75.281 472.116 69.4808 469.564C63.7138 466.979 59.1565 463.432 55.8089 458.925C52.4946 454.384 50.7876 449.147 50.6882 443.214H72.3643C72.4969 445.7 73.3089 447.888 74.8004 449.777C76.325 451.633 78.3468 453.075 80.8658 454.102C83.3847 455.13 86.2185 455.643 89.3672 455.643C92.6484 455.643 95.5485 455.063 98.0675 453.903C100.586 452.743 102.558 451.136 103.984 449.081C105.409 447.026 106.121 444.656 106.121 441.972C106.121 439.254 105.359 436.851 103.835 434.763C102.343 432.642 100.189 430.984 97.3715 429.791C94.5874 428.598 91.273 428.001 87.4283 428.001H77.9325V412.192H87.4283C90.6764 412.192 93.5433 411.628 96.0291 410.501C98.5481 409.375 100.504 407.817 101.896 405.828C103.288 403.806 103.984 401.453 103.984 398.768C103.984 396.216 103.371 393.979 102.144 392.057C100.951 390.101 99.2607 388.577 97.0732 387.483C94.9188 386.389 92.3999 385.842 89.5163 385.842C86.5997 385.842 83.9316 386.373 81.5121 387.433C79.0926 388.461 77.1536 389.936 75.6953 391.858C74.237 393.78 73.4581 396.034 73.3587 398.619H52.7266C52.826 392.753 54.4998 387.582 57.7479 383.108C60.996 378.634 65.371 375.137 70.8729 372.618C76.4079 370.066 82.6555 368.79 89.6158 368.79C96.6423 368.79 102.79 370.066 108.06 372.618C113.33 375.17 117.424 378.617 120.34 382.959C123.29 387.268 124.748 392.107 124.715 397.476C124.748 403.177 122.975 407.933 119.396 411.744C115.849 415.556 111.226 417.975 105.525 419.003V419.798C113.015 420.759 118.716 423.361 122.627 427.604C126.571 431.813 128.527 437.083 128.494 443.413C128.527 449.214 126.853 454.367 123.472 458.875C120.125 463.383 115.501 466.929 109.602 469.514C103.702 472.099 96.9406 473.392 89.3175 473.392ZM179.863 421.091C179.863 433.454 178.205 444.822 174.891 455.196C171.61 465.57 166.572 475.182 159.777 484.031H139.543C142.128 480.75 144.531 476.74 146.752 472C148.972 467.26 150.911 462.09 152.569 456.489C154.226 450.854 155.518 445.021 156.446 438.989C157.374 432.956 157.838 426.991 157.838 421.091C157.838 413.236 157.026 405.314 155.402 397.327C153.811 389.306 151.624 381.882 148.84 375.054C146.089 368.193 142.99 362.575 139.543 358.2H159.777C166.572 367.05 171.61 376.661 174.891 387.036C178.205 397.41 179.863 408.761 179.863 421.091Z" fill="currentColor"/>
35
+ </g>
36
+ <defs>
37
+ <clipPath id="clip0_1_12">
38
+ <rect width="512" height="512" fill="white"/>
39
+ </clipPath>
40
+ </defs>
41
+ </svg>
42
+ `,FM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
43
+ <path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
44
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="86" dominant-baseline="central">I.</text>
45
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="256" dominant-baseline="central">II.</text>
46
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="426" dominant-baseline="central">III.</text>
47
+ </svg>
48
+ `,NM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
49
+ <path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
50
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="86" dominant-baseline="central">i.</text>
51
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="256" dominant-baseline="central">ii.</text>
52
+ <text fill="currentColor" font-family="Georgia, serif" font-weight="bold" font-size="120" text-anchor="end" x="210" y="426" dominant-baseline="central">iii.</text>
53
+ </svg>
54
+ `,BM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
55
+ <path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
56
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="86" dominant-baseline="central">A.</text>
57
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="256" dominant-baseline="central">B.</text>
58
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="426" dominant-baseline="central">C.</text>
59
+ </svg>
60
+ `,zM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
61
+ <path fill="currentColor" d="M260 54c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L260 54zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0zm0 170c-17.7 0-32 14.3-32 32s14.3 32 32 32l220 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-220 0z"/>
62
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="86" dominant-baseline="central">A)</text>
63
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="256" dominant-baseline="central">B)</text>
64
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="426" dominant-baseline="central">C)</text>
65
+ </svg>
66
+ `,VM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
67
+ <path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
68
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="74" dominant-baseline="central">a.</text>
69
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="244" dominant-baseline="central">b.</text>
70
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="414" dominant-baseline="central">c.</text>
71
+ </svg>
72
+ `,HM=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
73
+ <path fill="currentColor" d="M260 54C242.3 54 228 68.3 228 86C228 103.7 242.3 118 260 118H480C497.7 118 512 103.7 512 86C512 68.3 497.7 54 480 54H260ZM260 224C242.3 224 228 238.3 228 256C228 273.7 242.3 288 260 288H480C497.7 288 512 273.7 512 256C512 238.3 497.7 224 480 224H260ZM260 394C242.3 394 228 408.3 228 426C228 443.7 242.3 458 260 458H480C497.7 458 512 443.7 512 426C512 408.3 497.7 394 480 394H260Z"/>
74
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="74" dominant-baseline="central">a)</text>
75
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="244" dominant-baseline="central">b)</text>
76
+ <text fill="currentColor" font-family="sans-serif" font-weight="bold" font-size="140" text-anchor="end" x="210" y="414" dominant-baseline="central">c)</text>
77
+ </svg>
78
+ `,jM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>',IS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"/></svg>',UM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg>',GM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"/></svg>',WM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg>',KM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M448 64c0-17.7-14.3-32-32-32L32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l384 0c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32L32 288c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 192c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32zM448 448c0-17.7-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32z"/></svg>',qM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>',YM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"/></svg>',XM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0L352 0c35.3 0 64 28.7 64 64l0 64c0 35.3-28.7 64-64 64L64 192c-35.3 0-64-28.7-64-64L0 64zM160 352c0-17.7 14.3-32 32-32l0-16c0-44.2 35.8-80 80-80l144 0c17.7 0 32-14.3 32-32l0-32 0-90.5c37.3 13.2 64 48.7 64 90.5l0 32c0 53-43 96-96 96l-144 0c-8.8 0-16 7.2-16 16l0 16c17.7 0 32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32-14.3-32-32l0-128z"/></svg>',ZM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96 503 96 497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32L376.1 32l-.3 0L204.5 32c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96l116.7 0L301.3 210.8l-94.5-74.1zM243.3 416L192 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-42.2 0 17.6-62.1L272.9 311 243.3 416z"/></svg>',QM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"/></svg>',JM='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 0c17.7 0 32 14.3 32 32l0 32 128 0 0-32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 32 48 0c26.5 0 48 21.5 48 48l0 48L0 160l0-48C0 85.5 21.5 64 48 64l48 0 0-32c0-17.7 14.3-32 32-32zM0 192l448 0 0 272c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 192zM329 305c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-95 95-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L329 305z"/></svg>',$M='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 0c17.7 0 32 14.3 32 32l0 32 128 0 0-32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 32 48 0c26.5 0 48 21.5 48 48l0 48L0 160l0-48C0 85.5 21.5 64 48 64l48 0 0-32c0-17.7 14.3-32 32-32zM0 192l448 0 0 272c0 26.5-21.5 48-48 48L48 512c-26.5 0-48-21.5-48-48L0 192zM305 305c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-47 47-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l47 47-47 47c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l47-47 47 47c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-47-47 47-47z"/></svg>',eL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M152.1 38.2c9.9 8.9 10.7 24 1.8 33.9l-72 80c-4.4 4.9-10.6 7.8-17.2 7.9s-12.9-2.4-17.6-7L7 113C-2.3 103.6-2.3 88.4 7 79s24.6-9.4 33.9 0l22.1 22.1 55.1-61.2c8.9-9.9 24-10.7 33.9-1.8zm0 160c9.9 8.9 10.7 24 1.8 33.9l-72 80c-4.4 4.9-10.6 7.8-17.2 7.9s-12.9-2.4-17.6-7L7 273c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l22.1 22.1 55.1-61.2c8.9-9.9 24-10.7 33.9-1.8zM224 96c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zm0 160c0-17.7 14.3-32 32-32l224 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32zM160 416c0-17.7 14.3-32 32-32l288 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-288 0c-17.7 0-32-14.3-32-32zM48 368a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"/></svg>',ES='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512l293.1 0c-3.1-8.8-3.7-18.4-1.4-27.8l15-60.1c2.8-11.3 8.6-21.5 16.8-29.7l40.3-40.3c-32.1-31-75.7-50.1-123.9-50.1l-91.4 0zm435.5-68.3c-15.6-15.6-40.9-15.6-56.6 0l-29.4 29.4 71 71 29.4-29.4c15.6-15.6 15.6-40.9 0-56.6l-14.4-14.4zM375.9 417c-4.1 4.1-7 9.2-8.4 14.9l-15 60.1c-1.4 5.5 .2 11.2 4.2 15.2s9.7 5.6 15.2 4.2l60.1-15c5.6-1.4 10.8-4.3 14.9-8.4L576.1 358.7l-71-71L375.9 417z"/></svg>',xS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z"/></svg>',tL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 288c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128z"/></svg>',nL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"/></svg>',rL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 0C28.7 0 0 28.7 0 64L0 320l384 0 0-160-128 0c-17.7 0-32-14.3-32-32L224 0 64 0zM256 0l0 128 128 0L256 0zM0 416l64 0 0-64L0 352l0 64zm288 32l-80 0 0 64 80 0 0-64zm-112 0l-80 0 0 64 80 0 0-64zM64 448L0 448c0 35.3 28.7 64 64 64l0-64zm256 0l0 64c35.3 0 64-28.7 64-64l-64 0zm64-32l0-64-64 0 0 64 64 0z"/></svg>',oL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/></svg>',iL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-128c0-17.7-14.3-32-32-32L352 0zM80 32C35.8 32 0 67.8 0 112L0 432c0 44.2 35.8 80 80 80l320 0c44.2 0 80-35.8 80-80l0-112c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 112c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-320c0-8.8 7.2-16 16-16l112 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 32z"/></svg>',sL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"/></svg>',aL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M177.9 494.1c-18.7 18.7-49.1 18.7-67.9 0L17.9 401.9c-18.7-18.7-18.7-49.1 0-67.9l50.7-50.7 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 41.4-41.4 48 48c6.2 6.2 16.4 6.2 22.6 0s6.2-16.4 0-22.6l-48-48 50.7-50.7c18.7-18.7 49.1-18.7 67.9 0l92.1 92.1c18.7 18.7 18.7 49.1 0 67.9L177.9 494.1z"/></svg>',lL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M339.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L568.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S517.7-4.4 499.1 9.6L262.4 187.2c-24 18-38.2 46.1-38.4 76.1L339.3 367.1zm-19.6 25.4l-116-104.4C143.9 290.3 96 339.6 96 400c0 3.9 .2 7.8 .6 11.6C98.4 429.1 86.4 448 68.8 448L64 448c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z"/></svg>',cL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M315 315l158.4-215L444.1 70.6 229 229 315 315zm-187 5s0 0 0 0l0-71.7c0-15.3 7.2-29.6 19.5-38.6L420.6 8.4C428 2.9 437 0 446.2 0c11.4 0 22.4 4.5 30.5 12.6l54.8 54.8c8.1 8.1 12.6 19 12.6 30.5c0 9.2-2.9 18.2-8.4 25.6L334.4 396.5c-9 12.3-23.4 19.5-38.6 19.5L224 416l-25.4 25.4c-12.5 12.5-32.8 12.5-45.3 0l-50.7-50.7c-12.5-12.5-12.5-32.8 0-45.3L128 320zM7 466.3l63-63 70.6 70.6-31 31c-4.5 4.5-10.6 7-17 7L24 512c-13.3 0-24-10.7-24-24l0-4.7c0-6.4 2.5-12.5 7-17z"/></svg>
79
+ `,uL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M224 96l16-32 32-16-32-16-16-32-16 32-32 16 32 16 16 32zM80 160l26.7-53.3L160 80l-53.3-26.7L80 0 53.3 53.3 0 80l53.3 26.7L80 160zm352 128l-26.7 53.3L352 368l53.3 26.7L432 448l26.7-53.3L512 368l-53.3-26.7L432 288zm70.6-193.8L417.8 9.4C411.5 3.1 403.3 0 395.2 0c-8.2 0-16.4 3.1-22.6 9.4L9.4 372.5c-12.5 12.5-12.5 32.8 0 45.3l84.9 84.9c6.3 6.3 14.4 9.4 22.6 9.4 8.2 0 16.4-3.1 22.6-9.4l363.1-363.2c12.5-12.5 12.5-32.8 0-45.2zM359.5 203.5l-50.9-50.9 86.6-86.6 50.9 50.9-86.6 86.6z"/></svg>',dL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"/></svg>',fL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm64 64l0 256 160 0 0-256L64 160zm384 0l-160 0 0 256 160 0 0-256z"/></svg>',hL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M406.6 374.6l96-96c12.5-12.5 12.5-32.8 0-45.3l-96-96c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 224l-293.5 0 41.4-41.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 288l293.5 0-41.4 41.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/></svg>',pL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 0c17.7 0 32 14.3 32 32l0 32 32 0c12.9 0 24.6 7.8 29.6 19.8s2.2 25.7-6.9 34.9l-64 64c-12.5 12.5-32.8 12.5-45.3 0l-64-64c-9.2-9.2-11.9-22.9-6.9-34.9s16.6-19.8 29.6-19.8l32 0 0-32c0-17.7 14.3-32 32-32zM169.4 393.4l64-64c12.5-12.5 32.8-12.5 45.3 0l64 64c9.2 9.2 11.9 22.9 6.9 34.9s-16.6 19.8-29.6 19.8l-32 0 0 32c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-32-32 0c-12.9 0-24.6-7.8-29.6-19.8s-2.2-25.7 6.9-34.9zM32 224l32 0 0-32c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l64 64c12.5 12.5 12.5 32.8 0 45.3l-64 64c-9.2 9.2-22.9 11.9-34.9 6.9s-19.8-16.6-19.8-29.6l0-32-32 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm297.4 54.6c-12.5-12.5-12.5-32.8 0-45.3l64-64c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 32 32 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-32 0 0 32c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-64-64zM256 224a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>',Dp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"/></svg>',m0='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M135.2 17.7C140.6 6.8 151.7 0 163.8 0L284.2 0c12.1 0 23.2 6.8 28.6 17.7L320 32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 7.2-14.3zM32 128l384 0 0 320c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-320zm96 64c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16l0 224c0 8.8 7.2 16 16 16s16-7.2 16-16l0-224c0-8.8-7.2-16-16-16z"/></svg>',mL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M352 320c88.4 0 160-71.6 160-160c0-15.3-2.2-30.1-6.2-44.2c-3.1-10.8-16.4-13.2-24.3-5.3l-76.8 76.8c-3 3-7.1 4.7-11.3 4.7L336 192c-8.8 0-16-7.2-16-16l0-57.4c0-4.2 1.7-8.3 4.7-11.3l76.8-76.8c7.9-7.9 5.4-21.2-5.3-24.3C382.1 2.2 367.3 0 352 0C263.6 0 192 71.6 192 160c0 19.1 3.4 37.5 9.5 54.5L19.9 396.1C7.2 408.8 0 426.1 0 444.1C0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9L297.5 310.5c17 6.2 35.4 9.5 54.5 9.5zM80 408a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"/></svg>',gL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M32 480a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm96-64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-384a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM320 416a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-320a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM224 480a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm0-448a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0 256a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM416 416a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm0-384a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM32 96a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM416 224a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM32 288a32 32 0 1 1 0-64 32 32 0 1 1 0 64zm192 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm192 64a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM32 320a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM416 192a32 32 0 1 1 0-64 32 32 0 1 1 0 64zM32 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zm192 64a32 32 0 1 1 0-64 32 32 0 1 1 0 64z"/></svg>',vL=`<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" viewBox="3 4 18 16"><path stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 10V5m0 0L4 7m2-2 2 2m-2 7v5m0 0 2-2m-2 2-2-2m8-10h8m0 5h-8m0 5h8"></path></svg>
80
+ `,yL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>
81
+ `,bL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M278.1 256L444.5 89.6c4.7-4.7 4.7-12.3 0-17-32.8-32.8-86-32.8-118.8 0L210.2 188.1l-24.9-24.9c4.3-10.9 6.7-22.8 6.7-35.3 0-53-43-96-96-96S0 75 0 128s43 96 96 96c4.5 0 9-.3 13.4-.9L142.3 256l-32.9 32.9c-4.4-.6-8.8-.9-13.4-.9-53 0-96 43-96 96s43 96 96 96 96-43 96-96c0-12.5-2.4-24.3-6.7-35.3l24.9-24.9L325.7 439.4c32.8 32.8 86 32.8 118.8 0 4.7-4.7 4.7-12.3 0-17L278.1 256zM96 160c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm0 256c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32z"/></svg>',wL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 448v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V120c0-13.3 10.7-24 24-24h72v296c0 30.9 25.1 56 56 56h168zm0-344V0H152c-13.3 0-24 10.7-24 24v368c0 13.3 10.7 24 24 24h272c13.3 0 24-10.7 24-24V128H344c-13.2 0-24-10.8-24-24zm121-31L375 7A24 24 0 0 0 358.1 0H352v96h96v-6.1a24 24 0 0 0 -7-17z"/></svg>',CL='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M128 184c0-30.9 25.1-56 56-56h136V56c0-13.3-10.7-24-24-24h-80.6C204.3 12.9 183.6 0 160 0s-44.3 12.9-55.4 32H24C10.7 32 0 42.7 0 56v336c0 13.3 10.7 24 24 24h104V184zm32-144c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm184 248h104v200c0 13.3-10.7 24-24 24H184c-13.3 0-24-10.7-24-24V184c0-13.3 10.7-24 24-24h136v104c0 13.2 10.8 24 24 24zm104-38.1V256h-96v-96h6.1a24 24 0 0 1 17 7l65.9 65.9a24 24 0 0 1 7 17z"/></svg>',_L=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>
82
+ `,SL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><text x="12" y="18" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="20" font-weight="700" fill="currentColor">ΒΆ</text></svg>
83
+ `,kL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="96 96 448 448"><!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M96 160C96 124.7 124.7 96 160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM160 160L160 224L224 224L224 160L160 160zM480 160L288 160L288 224L480 224L480 160zM160 288L160 352L224 352L224 288L160 288zM480 288L288 288L288 352L480 352L480 288zM160 416L160 480L224 480L224 416L160 416zM480 416L288 416L288 480L480 480L480 416z"></path></svg>
84
+ `,AL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z"/></svg>
85
+ `,IL=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/></svg>
86
+ `;const er={undo:b_,redo:QM,bold:xM,italic:TM,underline:RM,color:nL,link:IS,image:jM,tableOfContents:kL,alignLeft:UM,alignRight:WM,alignCenter:GM,alignJustify:KM,bulletList:AS,bulletListDisc:AS,bulletListCircle:MM,bulletListSquare:LM,numberedList:PM,numberedListDecimal:DM,numberedListDecimalParen:OM,numberedListUpperRoman:FM,numberedListLowerRoman:NM,numberedListUpperAlpha:BM,numberedListUpperAlphaParen:zM,numberedListLowerAlpha:VM,numberedListLowerAlphaParen:HM,indentLeft:YM,indentRight:qM,directionLtr:AL,directionRtl:IL,pageBreak:rL,copyFormat:XM,clearFormatting:ZM,trackChanges:eL,trackChangesFinal:tL,trackChangesOriginal:xS,trackChangesAccept:JM,trackChangesReject:$M,documentMode:ES,documentEditingMode:ES,documentSuggestingMode:m_,documentViewingMode:xS,colorOption:oL,colorOptionCheck:i0,linkInput:IS,removeLink:v_,openLink:iL,overflow:y_,dropdownCaretUp:sL,dropdownCaretDown:g_,ruler:aL,paintbrush:lL,highlight:cL,ai:uL,table:dL,tableActions:fL,splitCell:hL,mergeCells:pL,addRowBefore:Dp,addRowAfter:Dp,addColumnBefore:Dp,addColumnAfter:Dp,deleteRow:m0,deleteColumn:m0,deleteTable:m0,deleteBorders:gL,fixTables:mL,lineHeight:vL,search:yL,cut:bL,copy:wL,paste:CL,strikethrough:_L,formattingMarks:SL};xt(),gn();var EL={key:0,class:"link-title"},xL={key:1,class:"link-title"},TL={key:2,class:"link-title"},RL={key:3,class:"link-title"},ML={key:4,class:"link-input-wrapper"},LL={class:"input-row text-input-row"},PL=["readonly","onKeydown"],DL={class:"input-row url-input-row"},OL=["innerHTML"],FL=["readonly","onKeydown"],NL=["innerHTML"],BL={key:0,class:"input-row link-buttons"},zL=["innerHTML"],VL={key:5,class:"input-row go-to-anchor clickable"},HL={__name:"LinkInput",props:{showInput:{type:Boolean,default:!0},showLink:{type:Boolean,default:!0},goToAnchor:{type:Function,default:()=>{}},ui:{type:Object,default:null},linkItem:{type:Object,default:null},closePopover:{type:Function,default:()=>{}},href:{type:String,default:null},target:{type:String,default:null},rel:{type:String,default:null},tooltip:{type:String,default:null},clickedElement:{type:Object,default:null},hyperlinkTarget:{type:Object,default:null},hyperlinkText:{type:String,default:null},textTarget:{type:Object,default:null},restoreSelection:{type:Function,default:()=>{}},documentMode:{type:String,default:null}},setup(e){const t=e,{isHighContrastMode:n}=Hi(),r=ne(!1),o=()=>{if(typeof t.hyperlinkText=="string"&&t.hyperlinkText)return t.hyperlinkText;const j=t.ui?.selection?.getSnapshot?.();if(typeof j?.quotedText=="string"&&j.quotedText)return j.quotedText;const O=t.clickedElement?.innerText??t.clickedElement?.textContent;return typeof O=="string"?O:""},i=()=>{if(typeof t.href=="string"&&t.href)return t.href;const j=t.ui?.toolbar?.getSnapshot?.()?.commands?.link?.value;if(typeof j=="string"&&j)return j;const O=t.linkItem?.attributes?.value?.href;return typeof O=="string"?O:""},s=()=>t.documentMode??t.ui?.document?.getSnapshot?.()?.mode??null,a=ne(""),l=ne(""),u=ne(!1),c=/^[a-z][a-z0-9+.-]*:/i,d=ke(()=>{const j=l.value.trim();return j?j.startsWith("#")||c.test(j)?j:"https://"+j:""}),h=ke(()=>d.value?EM(d.value):null),m=ke(()=>h.value!==null),p=ne(!1),v=ke(()=>!u.value&&p.value),_=ke(()=>!m.value),C=ke(()=>s()==="viewing"),k=()=>{const j=h.value?.href;j&&window.open(j,"_blank","noopener")},y=()=>{const j=document.querySelector(".link-input-ctn input");j&&j.focus()};Nn(()=>{a.value=o(),l.value=i(),p.value=!!l.value,u.value=l.value.startsWith("#"),t.showInput&&!C.value&&y()});const b=j=>{const O=t.ui;return O?.commands?.execute?(t.restoreSelection?.(),O.commands.execute("link",j)):!1},T=()=>{if(C.value)return;if(!l.value){b({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover();return}if(!m.value){r.value=!0;return}const j=h.value?.href;if(!j){r.value=!0;return}const O={href:j,currentText:o(),hyperlinkTarget:t.hyperlinkTarget,textTarget:t.textTarget};a.value?O.text=a.value:v.value||(O.text=j),b(O),t.closePopover()},R=()=>{b({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover()},P=j=>{t.goToAnchor&&t.goToAnchor(j)};return(j,O)=>(ge(),Ae("div",{class:rn(["link-input-ctn",{"high-contrast":et(n)}])},[u.value?(ge(),Ae("div",EL,"Page anchor")):C.value?(ge(),Ae("div",xL,"Link details")):v.value?(ge(),Ae("div",TL,"Edit link")):(ge(),Ae("div",RL,"Add link")),e.showInput&&!u.value?(ge(),Ae("div",ML,[Me("div",LL,[O[4]||(O[4]=Me("div",{class:"input-icon text-input-icon"},"T",-1)),Us(Me("input",{type:"text",name:"text",placeholder:"Text","onUpdate:modelValue":O[0]||(O[0]=V=>a.value=V),readonly:C.value,onKeydown:Yo(tn(T,["stop","prevent"]),["enter"])},null,40,PL),[[Ai,a.value]])]),Me("div",DL,[Me("div",{class:"input-icon",innerHTML:et(er).linkInput},null,8,OL),Us(Me("input",{type:"text",name:"link",placeholder:"Type or paste a link",class:rn({"sd-error":r.value}),"onUpdate:modelValue":O[1]||(O[1]=V=>l.value=V),readonly:C.value,onKeydown:[Yo(tn(T,["stop","prevent"]),["enter"]),O[2]||(O[2]=V=>r.value=!1)]},null,42,FL),[[Ai,l.value]]),Me("div",{class:rn(["open-link-icon",{"sd-disabled":!m.value}]),innerHTML:et(er).openLink,onClick:k,"data-item":"btn-link-open"},null,10,NL)]),C.value?ht("",!0):(ge(),Ae("div",BL,[v.value?(ge(),Ae("button",{key:0,class:"remove-btn",onClick:R,"data-item":"btn-link-remove"},[Me("div",{class:"remove-btn__icon",innerHTML:et(er).removeLink},null,8,zL),O[5]||(O[5]=Ni(" Remove ",-1))])):ht("",!0),Me("button",{class:rn(["sd-submit-btn",{"disable-btn":_.value}]),onClick:T,"data-item":"btn-link-apply"}," Apply ",2)]))])):u.value?(ge(),Ae("div",VL,[Me("a",{onClick:O[3]||(O[3]=tn(V=>P(l.value),["stop","prevent"]))},"Go to "+Bt(l.value.startsWith("#_")?l.value.substring(2):l.value),1)])):ht("",!0)],2))}},TS=fn(HL,[["__scopeId","data-v-3e4bd44e"]]);function jL(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(/(auto|scroll)/.test(n)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return document.scrollingElement||document.documentElement}function mf(e,t={behavior:"smooth",block:"start"}){if(!e)return;const n=jL(e),r=n.getBoundingClientRect(),o=e.getBoundingClientRect().top-r.top+n.scrollTop,i=window.getComputedStyle(n).scrollPaddingTop?.trim(),s=i?.endsWith("px")?Number(i.slice(0,-2)):0,a=Number.isFinite(s)&&s>=0?s:0;n.scrollTo({top:t.block==="start"?o-a:o-n.clientHeight+e.offsetHeight,behavior:t.behavior})}xt();var UL="link-popover",GL=500,WL=e=>!!(e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"),KL=e=>!!(e&&typeof e=="object"&&!Array.isArray(e));function qL(e){return KL(e)?e.type==="default"||e.type==="none"?!0:e.type==="custom"?e.component!=null:e.type==="external"?typeof e.render=="function":!1:!1}function RS(e){return e instanceof Error?e:new Error(String(e))}function YL(e){return typeof e!="string"?"":e.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(t=>t==="noopener"||t==="noreferrer").filter((t,n,r)=>r.indexOf(t)===n).join(",")}function XL(e,t){const n=YL(e);if(t!=="_blank")return n;const r=n?n.split(","):[];return r.includes("noopener")||r.unshift("noopener"),r.join(",")}function MS(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):String(e).replace(/['"\\]/g,"\\$&")}function ZL(e){const t=e?.dataset?.sourceAnchor;if(typeof t!="string")return null;try{const n=JSON.parse(t)?.sourceRef?.xpathLikePath,r=typeof n=="string"?n.match(/w:p\[ordinal=(\d+)\]/):null;return r?Number(r[1]):null}catch{return null}}function QL(e,t){const n=ZL(e),r=t?.blocks?.list?.()?.blocks,o=Array.isArray(r)?r.find(i=>i.ordinal===n):null;return typeof o?.nodeId=="string"?o.nodeId:e?.dataset?.blockId}function LS(e,t){const n=e?.closest?.("[data-block-id][data-pm-start]"),r=QL(n,t);if(!r||!n||!e?.ownerDocument)return null;const o=Number(e?.dataset?.pmStart),i=Number(e?.dataset?.pmEnd);if(Number.isFinite(o)&&Number.isFinite(i)&&i>o){const m=Number(n?.dataset?.pmStart),p=Number.isFinite(m)&&o>=m,v=p?o-m:o,_=p?i-m:i;return v<0||_<=v?null:{kind:"selection",start:{kind:"text",blockId:r,offset:v},end:{kind:"text",blockId:r,offset:_}}}const s=e.ownerDocument.defaultView,a=s?.NodeFilter,l=s?.Node;if(!a||!l)return null;let u=0;const c=e.ownerDocument.createTreeWalker(n,a.SHOW_ELEMENT|a.SHOW_TEXT);let d=c.nextNode();for(;d&&d!==e;)d.nodeType===l.TEXT_NODE&&!e.contains(d)&&(u+=d.textContent?.length??0),d=c.nextNode();if(d!==e)return null;const h=u+(e.textContent?.length??0);return h<=u?null:{kind:"selection",start:{kind:"text",blockId:r,offset:u},end:{kind:"text",blockId:r,offset:h}}}function g0(e){if(typeof e!="string")return"";try{return new URL(e,window.location.href).href}catch{return e}}function v0(e){return typeof e?.externalTarget=="string"&&e.externalTarget?e.externalTarget:typeof e?.anchor=="string"&&e.anchor?`#${e.anchor}`:""}function PS(e){const t=e?.anchor?.start,n=e?.anchor?.end;return typeof t?.blockId!="string"||typeof t?.offset!="number"||typeof n?.blockId!="string"||typeof n?.offset!="number"||t.blockId!==n.blockId?null:{kind:"selection",start:{kind:"text",blockId:t.blockId,offset:t.offset},end:{kind:"text",blockId:n.blockId,offset:n.offset}}}function JL(e,t){const n=PS(t);return n?n.start.blockId===e?.start?.blockId&&n.start.offset===e?.start?.offset&&n.end.blockId===e?.end?.blockId&&n.end.offset===e?.end?.offset:!1}function $L(e,t,n){if(typeof t!="string"||!t)return null;const r=e?.query?.match?.({select:{type:"text",pattern:t,caseSensitive:!0},require:"any"}),o=(Array.isArray(r?.items)?r.items:[]).map(s=>s?.target).filter(s=>s?.kind==="selection"&&!!s?.start?.blockId&&!!s?.end?.blockId),i=typeof n=="string"?o.filter(s=>s.start.blockId===n&&s.end.blockId===n):o;return i.length===1?i[0]:typeof n=="string"?null:o.length===1?o[0]:null}function eP(e){return!!(e&&typeof e.closest=="function"&&e.closest(".superdoc-toc-entry"))}function tP({getSurfaceManager:e,getActiveEditor:t,getUi:n,getResolver:r,getLayerElement:o,emitException:i}){let s=null,a=null,l=0;function u(){l+=1}function c(N,x){if(!N||!s||s.handle!==N)return;const z=s;z.unbindPointerDown?.();const J=z.element.ownerDocument?.defaultView?.Node,X=J!=null&&z.pointerDownTarget instanceof J&&z.element.contains(z.pointerDownTarget);x?.status==="closed"&&x.reason===void 0&&X&&(a={href:z.href,element:z.element,closedAt:Date.now()}),s=null}function d(N="closed"){u();const x=s;s=null,a=null,x?.unbindPointerDown?.(),x?.handle?.close?.(N)}function h(N){return{id:UL,mode:"floating",closeOnEscape:!0,floating:{top:N.position.top,left:N.position.left,autoFocus:!0,closeOnOutsidePointerDown:!0,width:"auto"}}}function m(N,x){const z={href:N.href,element:N.element,handle:x,pointerDownTarget:null,unbindPointerDown:null},J=N.element.ownerDocument,X=ae=>{z.pointerDownTarget=ae.target??null};J.addEventListener("pointerdown",X,!0),z.unbindPointerDown=()=>J.removeEventListener("pointerdown",X,!0),s=z,a=null,x.result?.then?.(ae=>c(x,ae),()=>c(x))}function p(N,x){return N?.querySelector?.(`a[name='${x}'], [data-bookmark-marker='start'][data-bookmark-name='${x}']`)??null}function v(N,x){if(!N)return null;const z=MS(x);return N.querySelector(`[data-source-node-id='${z}']`)??N.querySelector(`[data-layout-paraid='${z}']`)??N.querySelector(`[data-block-id$='/${z}']`)??N.querySelector(`[data-layout-block-ref$='/${z}']`)??null}function _(N,x=30){return new Promise(z=>{const J=typeof window<"u"?window.requestAnimationFrame:null;let X=0;const ae=()=>{const pe=N();if(pe||X>=x||typeof J!="function"){z(pe??null);return}X+=1,J(ae)};ae()})}async function C(N){const x=t()?.authoring?.setSelectionTarget;if(typeof x!="function")return;const z={kind:"story",storyType:"body"},J={kind:"text",blockId:N,offset:0,story:z},X={kind:"selection",start:J,end:J,story:z};try{await Promise.resolve(x({target:X,collapse:"start",focus:!0}))}catch{}}async function k(N,{placeCaret:x=!1}={}){if(typeof N!="string"||!N.startsWith("#"))return;const z=N.slice(1),J=MS(z),X=p(n()?.viewport?.getHost?.()??null,J);if(X){mf(X);return}const ae=t()?.doc;let pe=null;try{pe=await Promise.resolve(ae?.bookmarks?.get?.({target:{kind:"entity",entityType:"bookmark",name:z}})),pe??=null}catch{pe=null}const Fe=pe?.address?.story;if(Fe&&Fe.storyType!=="body")return;const fe=pe?.range?.from?.blockId;if(typeof fe!="string")return;x&&await C(fe);const ye=v(n()?.viewport?.getHost?.()??null,fe);if(ye){mf(ye);return}const le=t()?.pageMetrics,Se=le?.revealBodyTarget;let re;try{re=await Se?.({paraId:fe})}catch{re=void 0}if(re?.status==="revealed"){const Ee=v(n()?.viewport?.getHost?.()??null,fe);Ee&&mf(Ee);return}if(Se&&re?.reason!=="editing-not-mounted")return;const xe=le?.pageIndexForBodyTarget,$e=le?.scrollToPage,st=xe?.({paraId:fe});if(typeof st!="number"||!$e?.(st))return;const At=await _(()=>v(n()?.viewport?.getHost?.()??null,fe));At&&mf(At)}async function y(N){const x=N.editor?.doc;let z;try{z=await Promise.resolve(x?.hyperlinks?.list?.())}catch{return null}const J=Array.isArray(z?.stories)?z.stories:[],X=N.element?.dataset?.linkRid,ae=N.element?.textContent??"",pe=g0(N.href),Fe=LS(N.element,x);for(const fe of J){const ye=Array.isArray(fe?.hyperlinks)?fe.hyperlinks:[],le=async D=>{if(!D?.hyperlinkNodeId||!fe?.storyId||D.address)return D;try{const U=await Promise.resolve(x?.hyperlinks?.get?.({storyId:fe.storyId,hyperlinkNodeId:D.hyperlinkNodeId}));return U?.success&&U.hyperlink?U.hyperlink:D}catch{return D}},Se=async D=>{if(!Fe)return null;const U=(await Promise.all(D.map(le))).filter(H=>JL(Fe,H.address));return U.length===1?U[0]:null},re=X?ye.filter(D=>D.rId===X):[],xe=re.filter(D=>D.text===ae),$e=ye.filter(D=>g0(v0(D))===pe&&D.text===ae),st=ye.filter(D=>D.text===ae),At=ye.filter(D=>{const U=g0(v0(D));return ae&&U===pe&&D.text?.includes?.(ae)}),Ee=xe.length===1?xe[0]:null,Ge=$e.length===1?$e[0]:null,qe=st.length===1?st[0]:null,Z=At.length===1?At[0]:null,S=re.length===1?re[0]:null,ee=Ee??await Se(xe)??Ge??await Se($e)??qe??await Se(st)??Z??await Se(At)??S??await Se(re);if(ee?.hyperlinkNodeId&&fe?.storyId){const D=await le(ee),U=PS(D.address);return{storyId:fe.storyId,hyperlinkNodeId:D.hyperlinkNodeId,href:v0(D),text:D.text,targetKind:D.targetKind,textTarget:U??$L(x,D.text,Fe?.start?.blockId)}}}return null}function b(N){if(!a)return!1;const x=a.element===N.element&&a.href===N.href,z=Date.now()-a.closedAt<=GL;return!x||!z?!1:(a=null,!0)}function T(N,x){const z=e();if(!z?.open)return;const J=l;queueMicrotask(()=>{J===l&&m(N,z.open(x))})}function R(N){if(d("replace"),N.isAnchorLink&&eP(N.element)){k(N.href,{placeCaret:N.documentMode!=="viewing"});return}if(N.documentMode==="viewing"){if(N.isAnchorLink)k(N.href);else if(N.href){const ae=N.target||"_self",pe=XL(N.rel,ae);pe?window.open(N.href,ae,pe):window.open(N.href,ae)}return}const x=()=>d("closed"),z=ae=>{x(),k(ae,{placeCaret:!0})},J=l,X=ae=>{J===l&&T(N,{...h(N),component:Wr(TS),props:{href:ae?.href||N.href,target:N.target,rel:N.rel,tooltip:N.tooltip,clickedElement:N.element,hyperlinkTarget:ae,hyperlinkText:ae?.text,textTarget:ae?.textTarget??LS(N.element,N.editor?.doc),documentMode:N.documentMode,ui:n(),closePopover:x,goToAnchor:z}})};y(N).then(X,()=>X(null))}function P(N,x){d("replace");const z=()=>d("closed");T(N,{...h(N),component:Wr(x.component),props:{...x.props,editor:N.editor,href:N.href,closePopover:z}})}function j(N,x){d("replace");const z=x.render;T(N,{...h(N),render:J=>{try{return z({container:J.container,closePopover:()=>J.close("closed"),editor:N.editor,href:N.href})}catch(X){i({error:RS(X),source:"linkPopoverExternalRender"}),J.close("external-error");const ae=l;queueMicrotask(()=>{ae===l&&R(N)});return}}})}function O(N){const x=o()?.getBoundingClientRect?.(),z=typeof x?.left=="number"?x.left:0,J=typeof x?.top=="number"?x.top:0;return{editor:t(),href:N.href,target:N.target,rel:N.rel,tooltip:N.tooltip,element:N.element,clientX:N.clientX,clientY:N.clientY,isAnchorLink:N.href.startsWith("#"),documentMode:N.documentMode,position:{left:`${Math.max(0,N.clientX-z)}px`,top:`${Math.max(0,N.clientY-J)}px`},closePopover:()=>d("closed")}}function V(N){const x=r();if(typeof x!="function")return{type:"default"};try{const z=x(N);return WL(z)?(i({error:new Error("modules.links.popoverResolver must return synchronously."),source:"linkPopoverResolver"}),{type:"default"}):z==null?{type:"default"}:qL(z)?z:(i({error:new Error("modules.links.popoverResolver returned an invalid resolution."),source:"linkPopoverResolver"}),{type:"default"})}catch(z){return i({error:RS(z),source:"linkPopoverResolver"}),{type:"default"}}}function Q(N){if(!N?.element||typeof N.href!="string")return;if(u(),s&&s.element===N.element&&s.href===N.href){d("toggle");return}if(b(N))return;const x=O(N),z=V(x);if(z.type==="none"){d("none");return}if(z.type==="custom"){P(x,z);return}if(z.type==="external"){j(x,z);return}R(x)}function F(){d("destroyed")}return{handleLinkClick:Q,closeCurrentPopover:d,destroy:F}}var nP=Object.freeze({editorVersion:2,commands:null,state:null,view:null}),rP=["text.insert","text.replace","text.deleteBackward","text.deleteForward","text.paste","history.undo","history.redo","structural.splitBlock","structural.indent","structural.outdent"],DS=["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit","trackedChanges.accept","trackedChanges.reject","trackedChanges.acceptAll","trackedChanges.rejectAll"],oP=["trackedChanges.setAuthoringMode"];function gf(e){return e.state!=="ready"?e.state:e.documentMode==="viewing"?"review-ready":"editing-ready"}function Op(e){return e==="review-ready"||e==="editing-ready"}function OS(e){switch(e){case"text.insert":return"text.insert";case"text.replace":return"text.replace";case"text.deleteBackward":return"text.deleteBackward";case"text.deleteForward":return"text.deleteForward";case"text.paste":return"text.pastePlain";case"history.undo":return"history.undo";case"history.redo":return"history.redo";case"structural.splitBlock":return"structural.enter";case"structural.indent":return"structural.listIndent";case"structural.outdent":return"structural.listOutdent";default:return null}}function FS(e){switch(e){case"comments.create":return"comments.createFromSelection";case"comments.resolve":return"review.commentResolve";case"comments.reopen":return"review.commentReopen";case"comments.delete":return"review.commentDelete";case"comments.reply":return"review.commentReply";case"comments.edit":return"review.commentEdit";case"trackedChanges.accept":case"trackedChanges.reject":return"review.trackedChangeDecide";case"trackedChanges.acceptAll":return"trackedChanges.acceptAll";case"trackedChanges.rejectAll":return"trackedChanges.rejectAll";default:return null}}function NS(e,t){return e.editableSubset.commands.find(n=>n.command===t)??null}function iP(e){return e?.status==="supported"||e?.enabled===!0}function sP(e){return e?.rejectionCode??e?.reason??null}function aP(e){return e?.detail??void 0}function Fp(e,t){return iP(NS(e,t))}function BS(e,t){const n=NS(e,t),r=sP(n);return r?{reason:VS(r),detail:aP(n)}:e.documentMode==="viewing"?{reason:"document-readonly",detail:"review-surface-read-only"}:{reason:"command-unsupported",detail:`unsupported:${t}`}}function zS(e,t){const n=t?.reason;return e==="history.undo"?n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-undo":n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-redo"}function VS(e){switch(e){case"host-saving":return"host-saving";case"document-readonly":return"document-readonly";case"selection-invalidated":case"review-target-invalidated":return"selection-invalidated";case"review-command-unavailable":return"review-command-unavailable";case"review-surface-read-only":return"document-readonly";case"editing-selection-required":return"selection-unsupported";case"format-target-unsupported":case"selection-target-unsupported":case"input-target-unsupported":case"composition-target-unsupported":case"enter-context-unsupported":case"boundary-merge-unsupported":case"tracked-structural-edit-unsupported":case"comment-anchor-create-unsupported":case"comment-anchor-move-unsupported":return"target-unsupported";case"unsupported-command":return"command-unsupported";case"editing-mount-required":case"host-not-ready":case"host-disposed":return"runtime-not-ready";default:return"command-failed"}}function lP(e){const{id:t,documentId:n,root:r,host:o,getLegacyEditorProjection:i,onUnregister:s}=e;let a=o.getSnapshot(),l=!1,u=!1,c=null,d=0,h=0,m=null,p=null,v=null,_=null;const C=new Map,k=new Set;function y(le){for(const Se of Array.from(k))try{Se(le)}catch{}}function b(){d+=1,C.clear()}function T(le){const Se=`v2-runtime-pos-${h++}`;return C.set(Se,le),{runtimeId:t,tokenId:Se,revision:d}}function R(le){return le.runtimeId!==t?{ok:!1,reason:"wrong-runtime-token"}:le.revision!==d||!C.has(le.tokenId)?{ok:!1,reason:"stale-position-token"}:{ok:!0}}function P(){return o.getHandles().editing?.selection??null}function j(){const le=P()?.getSnapshot()??null;return le?{isRange:le.anchor!==le.focus,isEmpty:le.anchor===le.focus,text:"",anchor:T(le.anchor),focus:T(le.focus)}:null}function O(){const le=P();le!==_&&(m?.(),m=null,_=le,le&&(m=le.subscribe(Se=>{b(),y({type:"selection-change",selection:Se?{isRange:Se.anchor!==Se.focus,isEmpty:Se.anchor===Se.focus,text:"",anchor:T(Se.anchor),focus:T(Se.focus)}:{isRange:!1,isEmpty:!0,text:""}})})))}function V(){const le=o.getDocumentFacade?.()??null;return le?.available===!0?le.doc:null}function Q(){const le=V();return!!(le?.comments&&le.trackChanges)}function F(le){if(!Op(gf(le)))return[];const Se=rP.filter(xe=>{const $e=OS(xe);return $e!==null&&Fp(le,$e)}),re=Q()?DS.filter(xe=>{const $e=FS(xe);return $e!==null&&Fp(le,$e)}):[];return[...Se,...re,...oP]}function N(le=a){const Se=gf(le),re=Se!=="disposed",xe=F(le);return{lifecycle:{canFocus:re,canDispose:!0},selection:{canReadSelectedText:!0,canReadSelectionSnapshot:!0,canMintPositionTokens:!0},commands:{canDispatch:Op(Se)&&xe.length>0,supportedCommands:xe},layout:{supported:!0,hasSyncSnapshot:!0},zoom:{supported:!0,min:25,max:400},navigation:{supported:!1,targets:[]},persistence:{canSave:!0,canExportDocx:!0},comments:{supported:!0,canMutate:le.commentCommandsReason!=="author-required"&&["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit"].some($e=>xe.includes($e))},trackedChanges:{supported:!0,canDecide:xe.includes("trackedChanges.accept")||xe.includes("trackedChanges.reject"),canToggleAuthoring:Op(Se)}}}function x(){const le=o.getPageMetricsSnapshot();return{pageCount:le.pages.length,currentPage:1,zoom:le.zoom.percent}}function z(le=a){return{id:t,kind:"v2",documentId:n,state:gf(le),documentMode:le.documentMode,reason:le.reason,capabilities:N(le)}}function J(le){return le?.success===!0?(b(),{status:"committed",receipt:le}):le&&"failure"in le?{status:"receipt-failure",failure:le.failure}:{status:"rejected",reason:"command-failed"}}function X(le,Se){return Se?Se.noop===!0?{status:"history-noop",reason:zS(le,Se),result:Se}:(b(),{status:"history-committed",result:Se}):{status:"rejected",reason:"command-failed"}}async function ae(le){const Se=FS(le.kind);if(Se&&!Fp(a,Se)){const $e=BS(a,Se);return{status:"rejected",reason:$e.reason,detail:$e.detail}}const re=OS(le.kind);if((le.kind==="history.undo"||le.kind==="history.redo")&&re&&!Fp(a,re)){const $e=BS(a,re);return{status:"rejected",reason:$e.reason,detail:$e.detail}}const xe=V();if(!xe)return DS.includes(le.kind)?{status:"rejected",reason:"review-command-unavailable"}:null;try{switch(le.kind){case"comments.create":{const $e=await xe.selection?.current?.(),st=$e?.empty===!1?$e.target:void 0;return J(await xe.comments?.create?.({text:le.text,...st?{target:st}:{}}))}case"comments.resolve":return J(await xe.comments?.patch?.({commentId:le.commentId,status:"resolved"}));case"comments.reopen":return J(await xe.comments?.patch?.({commentId:le.commentId,status:"active"}));case"comments.delete":return J(await xe.comments?.delete?.({commentId:le.commentId}));case"comments.reply":return J(await xe.comments?.create?.({parentCommentId:le.parentCommentId,text:le.text}));case"comments.edit":return J(await xe.comments?.patch?.({commentId:le.commentId,text:le.text}));case"trackedChanges.accept":return J(await xe.trackChanges?.decide?.({decision:"accept",target:{kind:"id",id:le.id}}));case"trackedChanges.reject":return J(await xe.trackChanges?.decide?.({decision:"reject",target:{kind:"id",id:le.id}}));case"trackedChanges.acceptAll":return J(await xe.trackChanges?.decide?.({decision:"accept",target:{kind:"all"}}));case"trackedChanges.rejectAll":return J(await xe.trackChanges?.decide?.({decision:"reject",target:{kind:"all"}}));case"history.undo":return X("history.undo",await xe.history?.undo?.());case"history.redo":return X("history.redo",await xe.history?.redo?.());default:return null}}catch($e){return{status:"rejected",reason:"command-failed",detail:$e instanceof Error?$e.message:String($e)}}}function pe(le){a=le,b(),O(),y({type:"state-change",state:gf(le)}),y({type:"capabilities-change",capabilities:N(le)}),le.state==="disposed"&&!l&&(l=!0,p?.(),v?.(),m?.(),m=null,y({type:"disposed"}),k.clear(),u||(u=!0,s?.(t)))}p=o.subscribe(pe),v=o.subscribePageMetrics?.(()=>{y({type:"layout-change",layout:x()})})??null,O();async function Fe(le){const Se=gf(a);if(Se==="disposed")return{status:"rejected",reason:"runtime-not-ready"};if(Se==="saving")return{status:"rejected",reason:"host-saving"};if(!Op(Se))return{status:"rejected",reason:"runtime-not-ready"};const re="at"in le?le.at:"range"in le?le.range:void 0;if(re){const At=R(re);return At.ok?{status:"rejected",reason:"target-unsupported",detail:"positioned dispatch is deferred until the shared runtime can target host selections explicitly"}:{status:"rejected",reason:At.reason}}if(le.kind==="trackedChanges.setAuthoringMode")return o.setDocumentMode(le.mode==="tracked"?"suggesting":"editing"),b(),{status:"committed"};const xe=await ae(le);if(xe)return xe;let $e=null;switch(le.kind){case"text.insert":$e={kind:"text.insert",text:le.text};break;case"text.replace":$e={kind:"text.replace",text:le.text};break;case"text.deleteBackward":$e={kind:"text.deleteBackward"};break;case"text.deleteForward":$e={kind:"text.deleteForward"};break;case"text.paste":$e={kind:"text.pastePlain",text:le.text};break;case"history.undo":$e={kind:"history.undo"};break;case"history.redo":$e={kind:"history.redo"};break;case"structural.splitBlock":$e={kind:"structural.enter"};break;case"structural.indent":$e={kind:"structural.listIndent"};break;case"structural.outdent":$e={kind:"structural.listOutdent"};break;default:return{status:"rejected",reason:"command-unsupported",detail:le.kind}}const st=await o.dispatch($e);switch(st.status){case"committed":return b(),{status:"committed",receipt:st.receipt};case"history-committed":return b(),{status:"history-committed",result:st.result};case"history-noop":return{status:"history-noop",reason:zS(le.kind,st.result),result:st.result};case"receipt-failure":return{status:"receipt-failure",failure:st.failure};case"rejected":return{status:"rejected",reason:VS(st.rejection.code),detail:st.rejection.detail}}}async function fe(le){if(l||a.state==="disposed")return!1;const Se=c?.focus;return Se&&typeof Se.focus=="function"?await Se.focus({restoreSelection:le?.restoreSelection,preventScroll:le?.preventScroll})!==!1:typeof r.focus=="function"?(r.focus({preventScroll:le?.preventScroll}),!0):!1}async function ye(){l||(await o.dispose(),l||(l=!0,p?.(),v?.(),m?.(),m=null,y({type:"disposed"}),k.clear(),u||(u=!0,s?.(t))))}return{runtime:{id:t,kind:"v2",documentId:n,root:r,getCapabilities:()=>N(),getSnapshot:()=>z(),setDocumentMode(le){o.setDocumentMode(le)},getDocumentMode:()=>o.getDocumentMode(),getLegacyEditorProjection:()=>i?.()??nP,focus:fe,dispose:ye,dispatch:Fe,getSelectedText:()=>"",getSelectionSnapshot:j,getToolbarState(){return{activeMarks:[],disabled:["formatting.applyMark","formatting.applyParagraph"]}},getLayoutSnapshot:x,save:()=>o.save(),exportDocx:le=>o.save({format:"docx",commentExportMode:le?.commentsType==="clean"?"strip":"preserve"}),async setZoom(le){const Se=o.setZoom(le);return Se.status==="ok"?{status:"committed"}:{status:"rejected",reason:Se.reason==="host-disposed"?"runtime-not-ready":"target-unsupported",detail:Se.reason}},async reveal(le){if(le.kind==="position"){const Se=R(le.position);if(!Se.ok)return{status:"rejected",reason:Se.reason}}return{status:"rejected",reason:"capability-unsupported",detail:`${le.kind} reveal is not exposed through the shared runtime yet`}},subscribe(le){return k.add(le),()=>{k.delete(le)}}},attachMountHandle(le){c=le,O()}}}var HS=".superdoc-toolbar";function cP(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]}function uP(e){if(e&&typeof e=="object"){const t=e;return t.target??t.address??t.handle??e}return e}function Np(e){return typeof e=="function"}function jS(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Bp(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function dP(e){return Bp(e)&&e.kind==="text"&&Array.isArray(e.segments)&&e.segments.length>0}function fP(e){return Bp(e)&&e.kind==="story"&&(e.storyType==="headerFooterSlot"||e.storyType==="headerFooterPart")}function hP(e){if(!Np(e.selection?.current))return{handled:!1,reason:"page-field-selection-unavailable"};let t;try{t=e.selection.current({includeText:!1})}catch{return{handled:!1,reason:"page-field-selection-unavailable"}}return jS(t)?{handled:!1,reason:"page-field-selection-async"}:!Bp(t)||!dP(t.target)?{handled:!1,reason:"page-field-selection-unavailable"}:fP(t.target.story)?{handled:!0,target:t.target}:{handled:!1,reason:"page-field-context-unavailable"}}function y0(e,t){return!Np(e)||!Np(t)?!1:(Promise.resolve().then(()=>e()).then(n=>{for(const r of cP(n))try{Promise.resolve(t({target:uP(r)})).catch(()=>{})}catch{}}).catch(()=>{}),!0)}function pP(e){return{focusToolbar:()=>{const o=e.resolveToolbarElement();if(!o)return{handled:!1,reason:"no-toolbar"};const i=typeof o.matches=="function"&&o.matches(HS)?o:o.querySelector?.(HS)??o;return i?(i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),typeof i.focus!="function"?{handled:!1,reason:"no-toolbar"}:(i.focus(),!0)):{handled:!1,reason:"no-toolbar"}},updateFields:()=>{const o=e.getDocumentApi();if(!o)return{handled:!1,reason:"document-api-unavailable"};let i=y0(o.toc?.list,o.toc?.update);return i=y0(o.fields?.list,o.fields?.rebuild)||i,i=y0(o.index?.list,o.index?.rebuild)||i,i?!0:{handled:!1,reason:"field-update-workflow-unavailable"}},insertPageField:o=>{const i=e.getDocumentApi();if(!i)return{handled:!1,reason:"document-api-unavailable"};if(!Np(i.fields?.insert))return{handled:!1,reason:"page-field-insert-unavailable"};const s=hP(i);if(!s.handled||!s.target)return{handled:!1,reason:s.reason??"page-field-context-unavailable"};const a=o==="page"?"PAGE":"NUMPAGES";try{const l=i.fields.insert({at:s.target,instruction:a,mode:"raw"});if(jS(l))l.catch(()=>{});else if(Bp(l)&&l.success===!1)return{handled:!1,reason:"page-field-insert-failed"}}catch{return{handled:!1,reason:"page-field-insert-failed"}}return!0}}}const zp="data-superdoc-runtime-id";function mP(e,t){e.setAttribute(zp,t)}function US(e){e.removeAttribute(zp)}function GS(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function Vp(e){return typeof e=="string"&&e.length>0?e:null}function gP(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function vP(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function yP(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function WS(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function KS(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function bP(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function wP(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function qS(e,t){const n=Vp(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=gP(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${GS(r)}).`};const i=yP(t.params),s=e==="hocuspocus"?Vp(t.token):null,a=WS(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:KS()}function CP(e,t){const n=Vp(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty v2Collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=Vp(e.publicApiKey),o=WS(e.roomMode);if(!o)return KS();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=vP(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function YS(e){const{v2Collaboration:t,legacyCollaboration:n,documentType:r,documentCount:o,authEndpointBaseUrl:i}=e;if(typeof o=="number"&&o>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${o}.`};if(r!=null&&r!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(t!=null&&typeof t=="object")){const l=wP(n);if(l){const u=l==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",c=GS(n?.url);return{ok:!1,reason:u,message:l==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a v2Collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${l}" through the legacy modules.collaboration block (server: ${c}). Configure it as a v2Collaboration target ({ providerType: "${l}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a v2Collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=t;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a v2Collaboration target ({ providerType, documentId, url | publicApiKey | authEndpoint }) instead."};const a=bP(s);return a===null||a==="y-websocket"?qS("y-websocket",s):a==="hocuspocus"?qS("hocuspocus",s):a==="liveblocks"?CP(s,i):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${a}" provider family. Supported families are y-websocket, hocuspocus, and liveblocks.`}}xt(),gn();var _P={__name:"SurfaceExternalMount",props:{surfaceId:{type:String,required:!0},mode:{type:String,required:!0},request:{type:Object,required:!0},render:{type:Function,required:!0},resolve:{type:Function,required:!0},close:{type:Function,required:!0}},setup(e){const t=e,n=ne(null);let r=null;function o(){i(),!(!n.value||!t.render)&&(r=t.render({container:n.value,surfaceId:t.surfaceId,mode:t.mode,request:t.request,resolve:t.resolve,close:t.close})?.destroy??null)}function i(){typeof r=="function"&&r(),r=null,n.value&&(n.value.innerHTML="")}return Nn(o),or(i),Lt(()=>t.surfaceId,()=>{o()}),(s,a)=>(ge(),Ae("div",{ref_key:"container",ref:n,class:"sd-surface-external-mount"},null,512))}},XS=fn(_P,[["__scopeId","data-v-b2412c5d"]]);const b0=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");xt(),gn();var SP=["aria-labelledby","aria-label"],kP=["id"],AP={class:"sd-surface-dialog__content"},IP={__name:"SurfaceDialog",props:{surface:{type:Object,required:!0},scrollLockTarget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=ne(null),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel);let l=null;function u(T){if(!o.value)return;const R=o.value.querySelectorAll(b0);if(R.length===0)return;const P=R[0],j=R[R.length-1];T.shiftKey&&document.activeElement===P?(T.preventDefault(),j.focus()):!T.shiftKey&&document.activeElement===j&&(T.preventDefault(),P.focus())}function c(){if(!o.value)return;const T=o.value.querySelector(b0);T?T.focus():o.value.focus()}let d=null,h="";function m(){if(n.scrollLockTarget)d=n.scrollLockTarget;else{const T=o.value?.closest(".superdoc");d=T?.querySelector(".superdoc__layers")??T}d&&(h=d.style.overflow,d.style.overflow="hidden")}function p(){d&&(d.style.overflow=h,d=null,h="")}function v(T){if(T.key==="Tab"){u(T);return}T.key==="Escape"&&n.surface.request.closeOnEscape!==!1&&(T.stopPropagation(),r("close"))}function _(T){T.target===T.currentTarget&&n.surface.request.closeOnBackdrop!==!1&&r("close")}const C=ke(()=>({surfaceId:n.surface.id,mode:"dialog",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),k=ke(()=>({...n.surface.props??{},...C.value})),y=ke(()=>{const T=n.surface.request.dialog?.maxWidth;if(T!=null)return typeof T=="number"?`${T}px`:T}),b=ke(()=>{const T={};return y.value&&(T["max-width"]=y.value),T});return Nn(async()=>{l=document.activeElement,m(),await _t(),c()}),Lt(()=>n.scrollLockTarget,(T,R)=>{T!==R&&(p(),m())}),or(()=>{p(),l&&typeof l.focus=="function"&&l.focus(),l=null}),(T,R)=>(ge(),Ae("div",{class:"sd-surface-dialog-backdrop",onMousedown:tn(_,["self"]),onKeydown:v},[Me("div",{ref_key:"dialogRef",ref:o,class:"sd-surface-dialog",style:yn(b.value),role:"dialog","aria-modal":"true","aria-labelledby":s.value,"aria-label":a.value,tabindex:"-1"},[e.surface.request.title?(ge(),Ae("div",{key:0,id:i.value,class:"sd-surface-dialog__title"},Bt(e.surface.request.title),9,kP)):ht("",!0),Me("div",AP,[e.surface.render?(ge(),dn(XS,{key:0,"surface-id":e.surface.id,mode:"dialog",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ge(),dn(Pg(e.surface.component),Zm(fs({key:1},k.value)),null,16)):ht("",!0)])],12,SP)],32))}},EP=fn(IP,[["__scopeId","data-v-20bf8e4b"]]);xt(),gn();var xP=["aria-labelledby","aria-label"],TP=["id"],RP={class:"sd-surface-floating__content"},MP={__name:"SurfaceFloating",props:{surface:{type:Object,required:!0}},setup(e,{expose:t}){const n=e,r=ne(null);t({rootEl:r});const o=ne({}),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel),l=ke(()=>n.surface.request.floating??{}),u=ke(()=>{const y=l.value;return y.top!=null||y.right!=null||y.bottom!=null||y.left!=null}),c=ke(()=>{const y=["sd-surface-floating"];if(!u.value){const b=l.value.placement??"top-right";y.push(`sd-surface-floating--${b}`)}return y});function d(y){if(y!=null)return typeof y=="number"?`${y}px`:y}const h=ke(()=>{const y=l.value,b={};return y.top!=null&&(b.top=d(y.top)),y.right!=null&&(b.right=d(y.right)),y.bottom!=null&&(b.bottom=d(y.bottom)),y.left!=null&&(b.left=d(y.left)),y.width!=null&&(b.width=d(y.width)),y.maxWidth!=null&&(b["max-width"]=d(y.maxWidth)),y.maxHeight!=null&&(b["max-height"]=d(y.maxHeight)),{...b,...o.value}});async function m(){if(o.value={},!u.value)return;await _t(),await new Promise(V=>requestAnimationFrame(V));const y=r.value,b=y?.parentElement;if(!y||!b)return;const T=8,R=y.getBoundingClientRect(),P=b.getBoundingClientRect(),j={},O=l.value;if(O.left!=null&&O.right==null){const V=R.left-P.left,Q=Math.max(T,P.width-R.width-T),F=Math.min(Math.max(V,T),Q);F!==V&&(j.left=`${F}px`)}if(O.top!=null&&O.bottom==null){const V=R.top-P.top,Q=Math.max(T,P.height-R.height-T),F=Math.min(Math.max(V,T),Q);F!==V&&(j.top=`${F}px`)}o.value=j}Lt(l,m,{deep:!0});const p=ke(()=>({surfaceId:n.surface.id,mode:"floating",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),v=ke(()=>({...n.surface.props??{},...p.value}));let _=null,C=!1,k=null;return Nn(async()=>{if(m(),window.addEventListener("resize",m),typeof ResizeObserver<"u"&&r.value?.parentElement&&(k=new ResizeObserver(m),k.observe(r.value.parentElement),k.observe(r.value)),l.value.autoFocus===!1||(await _t(),!r.value))return;const y=r.value.querySelector("[data-sd-autofocus]")??r.value.querySelector(b0);y&&(_=document.activeElement,y.focus(),C=!0)}),or(()=>{window.removeEventListener("resize",m),k?.disconnect(),k=null,C&&_&&typeof _.focus=="function"&&_.focus(),_=null,C=!1}),(y,b)=>(ge(),Ae("div",{ref_key:"floatingRef",ref:r,class:rn(c.value),style:yn(h.value),role:"dialog","aria-labelledby":s.value,"aria-label":a.value,"data-editor-ui-surface":""},[e.surface.request.title?(ge(),Ae("div",{key:0,id:i.value,class:"sd-surface-floating__title"},Bt(e.surface.request.title),9,TP)):ht("",!0),Me("div",RP,[e.surface.render?(ge(),dn(XS,{key:0,"surface-id":e.surface.id,mode:"floating",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ge(),dn(Pg(e.surface.component),Zm(fs({key:1},v.value)),null,16)):ht("",!0)])],14,xP))}},LP=fn(MP,[["__scopeId","data-v-cd2be5db"]]);xt(),gn();var PP={__name:"SurfaceHost",props:{geometryTarget:{type:Object,default:null}},setup(e){const t=e,n=Ba("surfaceManager",null),r=ke(()=>n?.activeDialog.value??null),o=ke(()=>n?.activeFloating.value??null),i=ke(()=>r.value!=null||o.value!=null),s=ne(null),a=ne(null),l=ne({}),u=new Set(["hidden","scroll","auto","clip"]);function c(N){const x=[];let z=N.parentElement;for(;z;){const J=getComputedStyle(z);(u.has(J.overflowX)||u.has(J.overflowY))&&x.push(z),z=z.parentElement}return x}function d(N,x){let z=0,J=0,X=window.innerWidth,ae=window.innerHeight;for(const Fe of x){const fe=Fe.getBoundingClientRect(),ye=getComputedStyle(Fe);u.has(ye.overflowX)&&(J=Math.max(J,fe.left),X=Math.min(X,fe.right)),u.has(ye.overflowY)&&(z=Math.max(z,fe.top),ae=Math.min(ae,fe.bottom))}const pe=N.getBoundingClientRect();return z=Math.max(z,pe.top),J=Math.max(J,pe.left),X=Math.min(X,pe.right),ae=Math.min(ae,pe.bottom),{top:z,left:J,width:Math.max(X-J,0),height:Math.max(ae-z,0)}}let h=null,m=[],p=0,v=null;function _(){if(!h)return;const{top:N,left:x,width:z,height:J}=d(h,m);l.value={position:"fixed",top:`${N}px`,left:`${x}px`,width:`${z}px`,height:`${J}px`}}function C(){p||(p=requestAnimationFrame(()=>{p=0,_()}))}function k(){if(h=t.geometryTarget??null,!!h){m=c(h),_(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),v=new ResizeObserver(C),v.observe(h);for(const N of m)v.observe(N)}}function y(){p&&(cancelAnimationFrame(p),p=0),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C),v&&(v.disconnect(),v=null),h=null,m=[]}Lt(i,N=>{N?k():y()}),Lt(()=>t.geometryTarget,N=>{N&&i.value&&!h&&k()}),Nn(()=>{i.value&&k()});function b(N){const x=o.value;!x||x.settled||r.value||N.key==="Escape"&&x.request.closeOnEscape!==!1&&(N.stopPropagation(),n.close(x.id))}let T=!1;function R(){T||(document.addEventListener("keydown",b,!0),T=!0)}function P(){T&&(document.removeEventListener("keydown",b,!0),T=!1)}function j(N){const x=o.value;if(!x||x.settled||r.value)return;const z=a.value?.rootEl;z&&!z.contains(N.target)&&n.close(x.id)}let O=!1;function V(){O||(document.addEventListener("pointerdown",j,!0),O=!0)}function Q(){O&&(document.removeEventListener("pointerdown",j,!0),O=!1)}Lt(o,N=>{N&&!N.settled?(R(),N.request.floating?.closeOnOutsidePointerDown?V():Q()):(P(),Q())},{immediate:!0}),or(()=>{y(),P(),Q()});function F(){const N=r.value;N&&!N.settled&&n.close(N.id)}return(N,x)=>(ge(),dn(Ha,{to:"body"},[i.value?(ge(),Ae("div",{key:0,ref_key:"hostRef",ref:s,class:"sd-surface-host",style:yn(l.value)},[o.value?(ge(),dn(LP,{key:o.value.id,surface:o.value,ref_key:"floatingRef",ref:a},null,8,["surface"])):ht("",!0),r.value?(ge(),dn(EP,{key:r.value.id,surface:r.value,"scroll-lock-target":et(h),onClose:F},null,8,["surface","scroll-lock-target"])):ht("",!0)],4)):ht("",!0)]))}},DP=fn(PP,[["__scopeId","data-v-c6a3b75f"]]),w0,OP=Ir((()=>{w0=(e,t)=>{const n=10**(t||0);return Math.floor(e*n)/n}})),ZS,FP=Ir((()=>{ZS=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=o=>t(o.target.result),r.onerror=n,r.readAsDataURL(e)})})),QS,NP=Ir((()=>{QS=(e,t)=>{const n=t-e;return Array.from({length:n},(r,o)=>e+o)}}));function BP(e){return`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${e}/pdf.worker.min.mjs`}var JS,$S,ek,tk,zP=Ir((()=>{NP(),JS=e=>({adapter:"pdfjs",...e}),$S=class rI{constructor(){if(Object.getPrototypeOf(this).constructor===rI)throw new Error("Abstract class should not be instantiated")}},ek=class extends $S{constructor(e){super(),this.pdfLib=e.pdfLib,this.workerSrc=e.workerSrc,e.setWorker&&(this.workerSrc?this.pdfLib.GlobalWorkerOptions.workerSrc=e.workerSrc:this.pdfLib.GlobalWorkerOptions.workerSrc=BP(this.pdfLib.version))}async getDocument(e){return await this.pdfLib.getDocument(e).promise}async getPages(e,t,n){const r=QS(t,n+1).map(o=>e.getPage(o));return await Promise.all(r)}},tk=class{static create(e){const t={pdfjs:()=>new ek(e),default:()=>{throw new Error("Unsupported adapter")}};return(t[e.adapter]??t.default)()}}})),VP=Ir((()=>{})),HP=Ir((()=>{})),nk,rk,ok,ik,jP=Ir((()=>{xt(),u0(),VP(),HP(),gn(),nk=["data-page-id","data-page-number"],rk={class:"sd-pdf-viewer-page__canvas-wrapper"},ok={__name:"PdfViewerPage",props:{config:{type:Object,required:!0},page:{type:Object,required:!0},pages:{type:Array,required:!0},scale:{type:Number,required:!0},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number,default:2},documentEl:{type:[Object],default:null}},emits:["page-rendered","page-error","text-layer-rendered","text-layer-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=e,o=Kr(null),i=ne(null),s=ne(null),a=ne(null);let l;const u=ke(()=>r.pages.findIndex(V=>V.pageId===r.page.pageId)),c=ke(()=>u.value===-1?0:u.value+1);function d(V){const Q=window.getSelection();if(!Q||Q.rangeCount===0)return null;const F=Q.getRangeAt(0).getClientRects();if(!F.length)return null;const N=V.getBoundingClientRect(),x=r.scale??1,z=F[0];let J={top:z.top,left:z.left,bottom:z.bottom,right:z.right};for(let X=1;X<F.length;X+=1){const ae=F[X];ae.width===0||ae.height===0||(J.top=Math.min(J.top,ae.top),J.left=Math.min(J.left,ae.left),J.bottom=Math.max(J.bottom,ae.bottom),J.right=Math.max(J.right,ae.right))}return{top:(J.top-N.top)/x+V.scrollTop,left:(J.left-N.left)/x+V.scrollLeft,bottom:(J.bottom-N.top)/x+V.scrollTop,right:(J.right-N.left)/x+V.scrollLeft}}const h=ke(()=>{let{width:V,height:Q}=o.value;return[V,Q]=[V,Q].map(F=>Math.ceil(F)),{width:V,height:Q}}),m=ke(()=>{const{width:V,height:Q}=h.value;return{width:V,height:Q}}),p=ke(()=>{const{width:V,height:Q}=C();return{"--scale-factor":`${y()}`,width:`calc(var(--scale-factor) * ${V}px)`,height:`calc(var(--scale-factor) * ${Q}px)`}});function v(){const V=window.getSelection();if(!V||V.toString().length===0)return;const Q=d(r.documentEl?.value??r.documentEl??i.value);Q&&n("selection-raw",{selectionBounds:Q,documentId:r.page.documentId,page:c.value,source:"pdf"})}function _(V){V?.target&&V.target.tagName!=="SPAN"&&n("bypass-selection",V)}function C(){const V=$a*r.outputScale;let{width:Q,height:F}=o.value;return Q=Q/V,F=F/V,[Q,F]=[Q,F].map(N=>Math.ceil(N)),{width:Q,height:F}}function k(){const{width:V,height:Q}=C(),F=y();return{width:V*F,height:Q*F}}function y(){return(r.scale??1)*$a}function b(){const{pdfjsPage:V}=r.page;o.value=V.getViewport({scale:$a*r.outputScale})}async function T(){if(l)return;const V=s.value;if(!V||!o.value)return;const Q={canvasContext:V.getContext("2d"),viewport:o.value};try{const{pdfjsPage:F}=r.page;l=F.render(Q),await l.promise;const N=k(),x=C();n("page-rendered",{page:r.page,documentId:r.page.documentId,pageIndex:u.value,pageNumber:c.value,width:N.width,height:N.height,originalWidth:x.width*$a,originalHeight:x.height*$a})}catch{O(),n("page-error",r.page)}}async function R(){if(!r.hasTextLayer)return;const V=a.value;if(!V)return;V.innerHTML="";const Q=r.config?.pdfLib?.TextLayer;if(Q)try{const F=(r.scale??1)*$a,N=r.page.pdfjsPage.getViewport({scale:F});await new Q({textContentSource:await r.page.pdfjsPage.getTextContent(),container:V,viewport:N}).render(),n("text-layer-rendered",r.page)}catch(F){n("text-layer-error",r.page),console.error(F)}}async function P(){await T(),await R()}function j(V){V?.pdfjsPage&&V.pdfjsPage.cleanup(),O()}function O(){l&&(l.cancel(),l=null)}return Lt(()=>r.scale,()=>{R()}),b(),Nn(()=>{P()}),or(()=>{j(r.page)}),(V,Q)=>(ge(),Ae("div",{class:"sd-pdf-viewer-page","data-page-id":e.page.pageId,"data-page-number":c.value,style:yn(p.value),"data-pdf-page":"",ref_key:"pageRef",ref:i,onMousedown:_,onMouseup:v},[Me("div",rk,[Me("canvas",fs({class:"sd-pdf-viewer-page__canvas"},m.value,{ref_key:"canvasRef",ref:s}),null,16)]),e.hasTextLayer?(ge(),Ae("div",{key:0,class:"sd-pdf-viewer-page__text-layer",ref_key:"textLayerRef",ref:a},null,512)):ht("",!0)],44,nk))}},ik=fn(ok,[["__scopeId","data-v-d7a9857d"]])})),UP=Ir((()=>{})),sk,ak,GP=Ir((()=>{xt(),jP(),UP(),gn(),sk={__name:"PdfViewerDocument",props:{config:{type:Object,required:!0},pdf:{type:Object},pages:{type:Array,required:!0},scale:{type:Number},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number}},emits:["page-focus","page-rendered","page-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=ne(null),o=ne(null);function i(u){n("page-rendered",u)}function s(u){n("page-error",u)}function a(u){n("selection-raw",u)}function l(u){n("bypass-selection",u)}return(u,c)=>(ge(),Ae("div",{class:"sd-pdf-viewer-document",ref_key:"documentRef",ref:r},[Me("div",{class:"sd-pdf-viewer-document__wrapper",ref_key:"documentWrapper",ref:o},[(ge(!0),Ae(Wt,null,rr(e.pages,d=>(ge(),dn(ik,fs({key:d.pageId},{ref_for:!0},{page:d,pages:e.pages,scale:e.scale,config:e.config,hasTextLayer:e.hasTextLayer,outputScale:e.outputScale,documentEl:r.value},{onPageRendered:i,onPageError:s,onSelectionRaw:a,onBypassSelection:l}),null,16))),128))],512)],512))}},ak=fn(sk,[["__scopeId","data-v-2152178b"]])})),WP=Ir((()=>{})),KP=nd({default:()=>uk},1),lk,ck,uk,qP=Ir((()=>{xt(),OP(),FP(),u0(),zP(),GP(),WP(),gn(),lk={class:"sd-pdf-viewer__main"},ck={__name:"PdfViewer",props:{config:{type:Object,required:!0},file:{type:Object,required:!0},fileId:{type:String},initialScale:{type:Number,default:1}},emits:["page-rendered","pages-loaded","document-loaded","document-ready","document-error","selection-raw","bypass-selection"],setup(e,{expose:t,emit:n}){const r=n,o=e,i=JS({pdfLib:Wr(o.config.pdfLib),workerSrc:o.config.workerSrc,setWorker:o.config.setWorker}),s=tk.create(i),a=ne(null),l=ne(null),u=ne(null),c=ne([]),d=ne(typeof o.initialScale=="number"&&Number.isFinite(o.initialScale)&&o.initialScale>0?w0(o.initialScale,2):1),h=ne(0),m=ne(0),p=ke(()=>o.config?.textLayer===!0),v=ke(()=>o.config?.outputScale??2);function _(Q){const F=Q?.page;F&&(F.pageIsRendered=!0),y(),r("page-rendered",Q)}function C(Q){r("selection-raw",Q)}function k(Q){r("bypass-selection",Q)}function y(){h.value<=0||(m.value+=1,m.value>=h.value&&r("document-ready",{documentId:u.value?.documentId,viewerContainer:a.value}))}function b(Q){c.value=Q,h.value=Q.length,m.value=0}function T(Q){d.value=w0(Q,2)}t({updateScale:T});async function R(Q){if(Q)try{const F=await ZS(Q);u.value={documentId:o.fileId||O("document"),pdfjsDocument:Wr(await s.getDocument(F))},r("document-loaded",Q)}catch(F){r("document-error",F),console.error(F)}}async function P(){if(!u.value)return;const{pdfjsDocument:Q}=u.value,F=1,N=Q.numPages;try{const x=await s.getPages(Q,F,N),z=X=>({documentId:u.value.documentId,pageId:V(u.value.documentId,X.pageNumber),pageNumber:X.pageNumber,pageIsRendered:!1,pdfjsPage:Wr(X)}),J=x.map(z);b(J),r("pages-loaded",J)}catch(x){r("document-error",x),console.error(x)}}function j(){c.value=[],d.value=1}function O(Q){return`pdf-${Q.replace(/\W/g,"")}-${Math.random().toString(36).slice(2)}-${Date.now()}`}function V(Q,F){return`${Q}-page-${F}`}return Lt(()=>o.file,Q=>{R(Q)},{immediate:!0}),Lt(u,(Q,F)=>{Q&&(F&&j(),P())}),(Q,F)=>(ge(),Ae("div",{class:"sd-pdf-viewer",ref_key:"rootRef",ref:a},[Me("div",lk,[jt(ak,fs({pdf:u.value,pages:c.value,scale:d.value,config:e.config,hasTextLayer:p.value,outputScale:v.value},{onPageRendered:_,onSelectionRaw:C,onBypassSelection:k,ref_key:"documentRef",ref:l}),null,16)])],512))}},uk=fn(ck,[["__scopeId","data-v-05c9d9b5"]])}));xt(),gn();var YP={key:0,class:"sd-visually-hidden",role:"status","aria-live":"assertive","data-superdoc-v2-author-required":""},XP=["innerHTML"],ZP={class:"superdoc__document document"},QP={class:"floating-comments"},JP=!1,$P=3,C0=6500,_0=8e3,eD=250,tD={__name:"SuperDoc",emits:["selection-update"],setup(e,{emit:t}){const n=W2(()=>Promise.resolve().then(()=>(qP(),KP))),r=L=>L.password??D.$superdoc.config.password,o=L=>{const W=L?.v2Collaboration,we=W&&typeof W=="object"&&"value"in W?W.value:W;if(we==null)return{state:"absent"};const Be=YS({v2Collaboration:we,documentType:L?.type??null,documentCount:a.value.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!Be.ok)return{state:"invalid",failure:{code:Be.reason==="invalid-room-mode"?"collaboration-open-intent-invalid":"collaboration-config-invalid",message:`SuperDoc rejected the v2 collaboration configuration (${Be.reason}).`}};const{providerFamily:gt,...vn}=Be.target;return{state:"valid",config:{providerType:gt,...vn}}},i=hu(),s=aa(),{documents:a,isReady:l,areDocumentsReady:u,selectionPosition:c,activeSelection:d,activeZoom:h,zoomMode:m,measurementUnit:p,viewportMetrics:v}=Js(i),{handlePageReady:_,modules:C,user:k,getDocument:y}=i,b=Ba("surfaceManager",null),T=mM({getSurfaceManager:()=>b,getPasswordPromptConfig:()=>D.$superdoc?.config?.modules?.surfaces?.passwordPrompt,onUnhandled:(L,W,we)=>{D.$superdoc?.emit("exception",{error:we?.error??new Error(`Password prompt unhandled: ${W}`),editor:we?.editor??null,code:W,documentId:L?.id})}}),{getConfig:R,documentsWithConverations:P,commentsList:j,pendingComment:O,activeComment:V,skipSelectionUpdate:Q,commentsByDocument:F,isCommentsListVisible:N,isFloatingCommentsReady:x,generalCommentIds:z,hasSyncedCollaborationComments:J,editorCommentPositions:X,hasInitializedLocations:ae,isCommentHighlighted:pe,hasOpenTrackedChanges:Fe}=Js(s),{showAddComment:fe,handleEditorLocationsUpdate:ye,handleTrackedChangeUpdate:le,refreshTrackedChangeCommentsByIds:Se,syncTrackedChangePositionsWithDocument:re,syncTrackedChangeComments:xe,addComment:$e,addHydratedComment:st,getComment:At,resolveCommentPositionEntry:Ee,belongsToDocument:Ge,COMMENT_EVENTS:qe,requestInstantSidebarAlignment:Z,peekInstantSidebarAlignment:S,clearInstantSidebarAlignment:ee}=s,{proxy:D}=ir();s.proxy=D;const U=O8(D.$superdoc.config),H=Wr(U.EditorComponent),G=U.RulerComponent?Wr(U.RulerComponent):null,te=ke(()=>{const L=et(s.getFloatingComments);return Array.isArray(L)?L:[]}),{isHighContrastMode:Y}=Hi(),{uiFontFamily:K}=s0(),be=()=>s.viewingVisibility.documentMode==="viewing",me=()=>!!D?.$superdoc?.config?.allowSelectionInViewMode,Ce=ke(()=>be()&&s.viewingVisibility.commentsVisible===!0),Pe=ke(()=>D?.$superdoc?.uiConfig?.search?.enabled===!0);ke(()=>be()&&s.viewingVisibility.trackChangesVisible===!0);const it=ke(()=>s.shouldRenderReviewInViewing),He=ke(()=>D.$superdoc.config.proofing!==void 0?D.$superdoc.config.proofing:D.$superdoc.config.layoutEngineOptions?.proofing),Ct=ke(()=>{const L=C.comments;if(L===!1||L==null)return null;const W=D.$superdoc?.uiConfig?.comments?.options;return!W||Object.keys(W).length===0?L:tl(L,W)}),Yt=ke(()=>{const L={"--sd-ui-font-family":K.value},W=Ct.value;if(!W)return L;W.highlightHoverColor&&(L["--sd-comments-highlight-hover"]=W.highlightHoverColor);const we={...W.trackChangeHighlightColors||{},...W.trackChangeActiveHighlightColors||{}};return we.insertBorder&&(L["--sd-tracked-changes-insert-border"]=we.insertBorder),we.insertBackground&&(L["--sd-tracked-changes-insert-background"]=we.insertBackground),we.deleteBorder&&(L["--sd-tracked-changes-delete-border"]=we.deleteBorder),we.deleteBackground&&(L["--sd-tracked-changes-delete-background"]=we.deleteBackground),we.formatBorder&&(L["--sd-tracked-changes-format-border"]=we.formatBorder),L}),St=ne(null),Ft=ne(null),Nt=ne(null),sn=ne(null),_n=ne(!1),Qt=Gr({top:null,right:"-25px",zIndex:101}),{superdocContainerWidth:Ye,isCompactCommentsMode:Et,recalculateCompactCommentsMode:Ot,ensureCompactMeasurementObserver:wn}=B9({commentsModuleConfig:Ct,superdocRoot:St,layers:Ft}),Kt=ke(()=>!0),Sn=Kr(null),Pt=ne(!1),De=ne(!1),je=ne(null);let Ke=0,pt=0,kt=null,ft=null;const an=ke(()=>D.$superdoc.activeEditor),qt=()=>D.$superdoc?.ui??null,cn=Object.freeze({enabled:!1,active:!1,supported:!1}),hn=wM({getSurfaceManager:()=>b,getActiveEditor:()=>D.$superdoc?.activeEditor,activeEditorRef:an,getFindReplaceConfig:()=>D.$superdoc?.uiConfig?.search?.enabled?D.$superdoc.uiConfig.search.options:!1,getSuperDocUI:qt}),Jt=tP({getSurfaceManager:()=>b||(typeof D.$superdoc?.openSurface!="function"?null:{open:L=>D.$superdoc.openSurface(L)}),getActiveEditor:()=>D.$superdoc?.activeEditor,getUi:qt,getResolver:()=>D.$superdoc?.uiConfig?.linkPopover?.suppressed?()=>({type:"none"}):D.$superdoc?.config?.modules?.links?.popoverResolver,getLayerElement:()=>Ft.value,emitException:L=>{D.$superdoc?.emit("exception",{...L,editor:D.$superdoc?.activeEditor??null})}}),Yn=D.$superdoc.config.modules?.pdf||{},Nr=()=>{_n.value&&(_n.value=!1,xe({superdoc:D.$superdoc,editor:D.$superdoc?.activeEditor}))},io=()=>{_n.value=!0,_t(()=>{Nr()})},vo=(L,W)=>{const we=y(L);we.isReady=!0,we.container=W,u.value&&(D.$superdoc.config.collaboration||(l.value=!0)),zt(),x.value=!0,ae.value=!0,D.$superdoc.broadcastPdfDocumentReady()},$t=()=>{if(!c.value||!Ft.value)return null;const L=c.value.source==="pdf"?(h.value??100)/100:1,W=Number(c.value.top);return Number.isFinite(W)?Ft.value.getBoundingClientRect().top+W*L:null},Bn=async()=>{if((await fe(D.$superdoc,$t()))?.ok===!1||!Kt.value)return;const L=ba();L&&ts(L)},xi=async L=>{const W={comments:()=>Bn()};L in W&&await W[L](d.value,c.value),d.value=null,Qt.top=null},Is=()=>Qt.top=null,so=new Map,cr=new Map,Qo=new Map,Zi=new Map;let va=0;const Qi=L=>{const W=Qo.get(L);if(W){Qo.delete(L);try{W.unbind?.()}catch(we){console.warn("[SuperDoc] v2 command-shortcut unbind failed",we)}}},hl=()=>{const L=D.$superdoc?.toolbar;return!L||typeof L.getToolbarItemByName!="function"?null:()=>{const W=L.getToolbarItemByName("link");!W||W.disabled?.value===!0||(W.expand&&typeof W.expand=="object"&&"value"in W.expand&&(W.expand.value=!0),L.updateToolbarState?.())}},Ti=({documentId:L,bindEditShortcuts:W})=>{if(!L||(Qi(L),typeof W!="function"))return;const we=hl(),Be=W({commandRoute:{executeAsync:(gt,vn)=>{const Dn=qt();return Dn?Dn.commands.executeAsync(gt,vn):Promise.resolve(JP)},getState:gt=>qt()?.commands.get(gt).getState()??cn},...we?{openLinkWorkflow:we}:{}});Qo.set(L,{unbind:Be})},ao=L=>{const W=Zi.get(L);if(W){Zi.delete(L);try{W.unbind?.()}catch(we){console.warn("[SuperDoc] v2 session-shortcut unbind failed",we)}}},Ri=({documentId:L,bindSessionShortcuts:W,documentApi:we})=>{if(!L||(ao(L),typeof W!="function"))return;const Be=W({routes:pP({resolveToolbarElement:()=>D.$superdoc?.toolbar?.toolbarContainer??null,getDocumentApi:()=>we??null}),isMutationAllowed:()=>!be()});Zi.set(L,{unbind:Be})},_e=(L,W)=>{L?.id&&(W?so.set(L.id,W):so.delete(L.id))},ze=L=>{Qi(L),ao(L);const W=cr.get(L);if(!W)return;D.$superdoc.unregisterEditorRuntime(W.runtimeId),cr.delete(L);const we=so.get(L);we&&US(we)},vt=({documentId:L,host:W,mount:we,facade:Be})=>{const gt=so.get(L);if(!gt)return console.warn("[SuperDoc] v2 runtime host root unavailable; skipping runtime registration for",L),!1;cr.has(L)&&ze(L);const vn=`v2:${L}:${++va}`,Dn=lP({id:vn,documentId:L,root:gt,host:W,getLegacyEditorProjection:()=>Be,onUnregister:hr=>{D.$superdoc.unregisterEditorRuntime(hr);const jn=cr.get(L);jn&&jn.runtimeId===hr&&cr.delete(L);const pr=so.get(L);pr&&US(pr)}});return Dn.attachMountHandle(we??null),mP(gt,vn),D.$superdoc.registerEditorRuntime(Dn.runtime),cr.set(L,{runtimeId:vn,adapter:Dn}),D.$superdoc.setActiveRuntime(vn,"v2-editor-ready"),!0},ot=U.createReviewHydrationController({hydrateComments:L=>s.hydrateCommentsFromV2?.(L),hydrateTrackedChanges:L=>s.hydrateTrackedChangesFromV2?.(L),readReviewSnapshot:L=>L.trackedChangesAdapter?.readReviewSnapshot?.(L.snapshot),validateReviewSnapshot:(L,W)=>W?.validate?.()??{ok:!1,reason:"validator-missing"},applyReviewSnapshot:(L,W)=>s.applyReviewSnapshotFromV2?.({superdoc:L.superdoc,commentsAdapter:L.commentsAdapter,trackedChangesAdapter:L.trackedChangesAdapter,documentId:L.documentId,commentItems:W.comments?.items,trackedChangeItems:W.trackedChanges?.items,trackedList:W.trackedChanges,patch:we=>s.$patch(we)})??{ok:!1,reason:"store-action-missing"}}),xn=ne({}),Tn=sM(),_r=ne({}),jr=ke(()=>Object.values(_r.value)[0]??null),gi=L=>typeof L=="string"&&L.length>0?`document:${L}`:"document:default",Ji=L=>{const W=gi(L);if(Tn.clear(W),!_r.value[W])return;const we={..._r.value};delete we[W],_r.value=we},Es=(L,W)=>{const we=gi(L);Tn.shouldNotify(we,W)&&(_r.value={..._r.value,[we]:j_},D.$superdoc.emit("exception",{error:new Error(j_),code:oM,editor:null,...typeof L=="string"&&L.length>0?{documentId:L}:{},...W.failureSource==="receipt"&&W.failure?{receipt:W.failure}:{}}))},No=(L,W)=>{L&&(xn.value={...xn.value,[L]:W})},Yr=L=>{if(!L||!xn.value[L])return;const W={...xn.value};delete W[L],xn.value=W},Jo=(L=null)=>{const W=D.$superdoc?.activeEditor,we=L??W?.documentId??W?.options?.documentId??null;if(!we){W?.editorVersion===2&&D.$superdoc.setActiveEditor(null);return}if(L&&W?.editorVersion===2){const vn=W.documentId??W.options?.documentId??null;if(vn&&vn!==L)return}const Be=we?y(we):null;Be&&(Be.isReady=!1,typeof Be.setEditor=="function"&&Be.setEditor(null));const gt=cr.has(we);ze(we),!gt&&W?.editorVersion===2&&(W.documentId??W.options?.documentId??null)===we&&D.$superdoc.setActiveEditor(null)},$i=L=>{const W=typeof L?.getExtensionManager=="function"?L.getExtensionManager():null;if(!W)return null;const we=W.commands;return{commands:{execute:(Be,gt)=>we.execute(Be,gt),getState:Be=>{const gt=we.get(Be);return gt?{enabled:!(gt.getState()??{}).disabled,reason:null}:null},list:()=>we.list().map(Be=>{const gt=Be.getState()??{};return gt.label?{id:Be.id,label:gt.label}:{id:Be.id}})},diagnostics:{getSnapshot:()=>W.diagnostics()}}},Mi=L=>{if(!L)return;Yr(L.documentId??null),Ji(L.documentId??null);const{host:W,mount:we,documentId:Be,capabilities:gt,editCommands:vn,bindEditShortcuts:Dn,bindSessionShortcuts:hr,commentsAdapter:jn,trackedChangesAdapter:pr,documentApi:Xt,documentMutationReadiness:Co,documentApiUnavailableReason:co,pageMetrics:Ra,pageLayout:Dl,pageFurniture:_o,presence:br,lock:Ol,fonts:Ma,replaceFile:Sm}=L,km=async(It={})=>{if(!W||typeof W.save!="function")throw new Error("v2-editor: save unavailable");return W.save(It)},Jf=async(It={})=>{const Ht=await km({format:"docx",commentExportMode:It?.commentsType==="clean"?"strip":"preserve"});return new Blob([Ht],{type:Or})},vb=async It=>{if(typeof Sm!="function")throw new Error("v2-editor: replaceFile unavailable");return Sm(It)},$f=(It={})=>we?.focus&&typeof we.focus.focus=="function"?we.focus.focus(It):!1,Jn=(It,Ht=void 0)=>{const bn={ok:!1,reason:It};return Ht&&(bn.detail=Ht),bn},yb=It=>Array.isArray(It?.items)?It.items:[],Am=It=>{const Ht=Number(It);return Number.isFinite(Ht)&&Ht>0?Math.floor(Ht):0},Im=async({text:It,occurrence:Ht=0}={})=>{if(typeof It!="string"||It.length===0)return Jn("invalid-text","text must be a non-empty string");if(!Xt?.query||typeof Xt.query.match!="function")return Jn("query-unavailable","activeEditor.doc.query.match is not available");const bn=Am(Ht),qn=await Xt.query.match({select:{type:"text",pattern:It},limit:bn+1}),kr=yb(qn),uo=kr[bn]??null;return uo?.target?{ok:!0,item:uo,target:uo.target,ref:typeof uo?.handle?.ref=="string"?uo.handle.ref:null,text:It,occurrence:bn,total:Number.isFinite(Number(qn?.total))?Number(qn.total):kr.length}:Jn("text-not-found",`text not found: ${It}`)},Ic=(It,Ht)=>{if(!It||typeof It!="object"||It.kind!=="selection"||Ht!=="start"&&Ht!=="end")return It;const bn=Ht==="start"?It.start:It.end;return bn?{kind:"selection",start:bn,end:bn,...It.story?{story:It.story}:{}}:It},Em=async({target:It,collapse:Ht=null,focus:bn=!0}={})=>{if(!It||typeof It!="object")return Jn("invalid-target","target must be a SelectionTarget object");const qn=Ic(It,Ht),kr=(W?.getHandles?.()?.editing??null)?.selectionTargets??null;if(typeof kr?.apply!="function")return Jn("selection-target-unavailable","editing.selectionTargets.apply is not available");let uo;try{uo=kr.apply(qn)}catch(wi){return Jn("selection-target-threw",wi instanceof Error?wi.message:String(wi))}return uo?.ok?(bn!==!1&&await Promise.resolve($f()),{ok:!0,mode:uo.mode??"range"}):Jn(uo?.reason??"selection-target-rejected",uo?.detail)},xm=()=>D.$superdoc.config.documentMode==="suggesting"?"tracked":"direct",eh=()=>{const It=(W?.getHandles?.()?.editing??null)?.selection??null;if(typeof It?.toSelectionTarget!="function")return Jn("selection-target-unavailable","editing.selection.toSelectionTarget is not available");const Ht=It.toSelectionTarget();if(!Ht||Ht.kind==="rejected"){const bn=Ht?.rejection??{};return Jn(bn.reason??bn.code??"selection-target-rejected",bn.detail)}return!Ht.target||typeof Ht.target!="object"?Jn("selection-target-rejected","selection target was not produced"):{ok:!0,target:Ht.target,mode:Ht.mode??"range",story:Ht.story}},bb=(It,Ht)=>{const bn=It?.failure??It;return Jn(bn?.code??It?.reason??Ht,bn?.message??bn?.detail??It?.detail)},Tm={focusEditable:$f,readBlocks:(It={includeText:!0})=>Xt?.blocks?.list?.(It),setSelectionTarget:(It={})=>Em(It),setSelectionByText:async(It={})=>{const Ht=await Im(It);if(!Ht.ok)return Ht;const bn=await Em({target:Ht.target,collapse:It?.collapse??null,focus:It?.focus});return bn.ok?{ok:!0,mode:bn.mode,text:Ht.text,occurrence:Ht.occurrence,target:Ht.target}:bn},replaceTextByText:async({findText:It,replacement:Ht,occurrence:bn=0,mode:qn="direct"}={})=>{if(typeof Ht!="string")return Jn("invalid-replacement","replacement must be a string");if(!Xt?.text||typeof Xt.text.replace!="function")return Jn("text-replace-unavailable","activeEditor.doc.text.replace is not available");const kr=await Im({text:It,occurrence:bn});if(!kr.ok)return kr;const uo=kr.ref?{ref:kr.ref,text:Ht,mode:qn}:{target:kr.target,text:Ht,mode:qn},wi=await Xt.text.replace(uo);return wi?.ok===!1?Jn(wi.reason??"text-replace-failed",wi.detail):(await Promise.resolve(Co?.whenPainted?.(wi)),{ok:!0,receipt:wi,text:Ht,replacedText:It,occurrence:Am(bn)})},replaceSelection:async({target:It,replacement:Ht="",mode:bn="direct"}={})=>{if(!It||typeof It!="object")return Jn("invalid-target","target must be a SelectionTarget object");if(typeof Ht!="string")return Jn("invalid-replacement","replacement must be a string");if(!Xt?.text||typeof Xt.text.replace!="function")return Jn("text-replace-unavailable","activeEditor.doc.text.replace is not available");const qn=await Xt.text.replace({target:It,text:Ht,mode:bn});return qn?.ok===!1?Jn(qn.reason??"text-replace-failed",qn.detail):(await Promise.resolve(Co?.whenPainted?.(qn)),{ok:!0,receipt:qn,text:Ht})},serializeSelectionToClipboard:async({includeHtml:It=!0}={})=>{if(!Xt?.clipboard||typeof Xt.clipboard.serializeSelection!="function")return Jn("clipboard-serialize-unavailable","activeEditor.doc.clipboard.serializeSelection is not available");const Ht=eh();if(!Ht.ok)return Ht;let bn;try{bn=await Xt.clipboard.serializeSelection({target:Ht.target,includeHtml:It!==!1})}catch(qn){return Jn("clipboard-serialize-threw",qn instanceof Error?qn.message:String(qn))}return bn?.payload?{ok:!0,payload:bn.payload,plan:bn.plan,target:Ht.target,mode:Ht.mode}:Jn("clipboard-serialize-failed","clipboard serialization did not return a payload")},pasteClipboardPayload:async({payload:It,target:Ht=null,mode:bn=xm(),fallback:qn=void 0}={})=>{if(!It||typeof It!="object")return Jn("invalid-clipboard-payload","payload must be a ClipboardPayload object");if(!Xt?.clipboard||typeof Xt.clipboard.insert!="function")return Jn("clipboard-insert-unavailable","activeEditor.doc.clipboard.insert is not available");let kr=Ht,uo=null;if(!kr){const Qu=eh();if(!Qu.ok)return Qu;kr=Qu.target,uo=Qu.mode}if(!kr||typeof kr!="object")return Jn("invalid-target","target must be a SelectionTarget or ClipboardTarget object");const wi={payload:It,target:kr,changeMode:bn==="tracked"?"tracked":"direct",...qn!==void 0?{fallback:qn}:{}},Ds=await Xt.clipboard.insert(wi);return!Ds||Ds.success===!1||Ds.ok===!1?bb(Ds,"clipboard-insert-failed"):(await Promise.resolve(Co?.whenPainted?.(Ds)),{ok:!0,receipt:Ds,target:kr,mode:uo})},pastePlainText:async({text:It,target:Ht=null,mode:bn=xm()}={})=>typeof It!="string"?Jn("invalid-text","text must be a string"):Tm.pasteClipboardPayload({payload:{source:"api",items:[{type:"text/plain",kind:"string",data:It}]},target:Ht,mode:bn})},Ec={editorVersion:2,documentId:Be,host:W,mount:we,options:{documentId:Be,documentMode:D.$superdoc.config.documentMode},capabilities:gt??W?.getCapabilities?.()??null,save:km,exportDocx:Jf,replaceFile:vb,doc:Xt??null,documentMutationReadiness:Co??null,documentApiUnavailableReason:co??null,focus:$f,authoring:Tm,editCommands:vn??null,v2Comments:jn??null,v2TrackedChanges:pr??null,pageMetrics:Ra??null,pageLayout:Dl??null,pageFurniture:_o??null,presence:br??null,lock:Ol??null,reviewHydration:{getDiagnostics:()=>ot.getDiagnostics()},extensions:$i(W),fonts:Ma??W?.getFontRuntime?.()??null,commands:null,state:null,view:null},Zu=y(Be);Zu&&(Zu.isReady=!0,typeof Zu.setEditor=="function"&&Zu.setEditor(Ec)),vt({documentId:Be,host:W,mount:we,facade:Ec})||D.$superdoc.setActiveEditor(Ec),D.$superdoc.broadcastEditorCreate(Ec),Ti({documentId:Be,bindEditShortcuts:Dn}),Ri({documentId:Be,bindSessionShortcuts:hr,documentApi:Xt}),o(y(Be)).state==="valid"&&ju({editor:Ec}),Ra&&Dl&&(Po.value=!0);const th=D.$superdoc.config.modules?.comments!==!1;if(jn&&th&&s.setV2CommentsAdapter?.(jn),pr&&th&&s.setV2TrackedChangesAdapter?.(pr),th&&(jn||pr)){ot.setContext({superdoc:D.$superdoc,documentId:Be,commentsAdapter:jn??null,trackedChangesAdapter:pr??null});try{const It=W?.getRenderReadinessSnapshot?.();It&&ot.onRenderReadiness(It)}catch(It){console.warn("[SuperDoc][v2] initial render-readiness snapshot failed",It)}}u.value&&!D.$superdoc.config.collaboration&&(l.value=!0),x.value=!0,ae.value=!0},lo=ne(!1),$o=Kr(null);let Xr=0,ur=0,Li=0;const pc=({editor:L,sourceEditor:W,surface:we="body",headerId:Be=null,sectionType:gt=null}={})=>{const vn=D.$superdoc?.activeEditor??null,Dn=L??W??vn??void 0;return{editor:Dn,sourceEditor:W??Dn,surface:we,headerId:Be,sectionType:gt}},Lu=(L={})=>{D.$superdoc.emit("editor-update",pc(L))},xs=()=>{Xr&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Xr),ur&&clearTimeout(ur),Xr=0,ur=0},Mo=(L=$P)=>{xs();const W=()=>{Xr=0,ur=0,vl(),lo.value&&ri.value&&!c.value&&L>0&&Mo(L-1)};if(typeof requestAnimationFrame=="function"){Xr=requestAnimationFrame(W);return}ur=setTimeout(W,0)},mc=()=>{Li&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Li),Li=0},ya=()=>{lo.value=!1,$o.value=null,xs(),vl()},ei=(L,W)=>{if(!L||L.rangeCount<1||L.isCollapsed||!W)return!1;const we=L.getRangeAt(0);return W.contains(we.startContainer)&&W.contains(we.endContainer)},Wn=()=>{if(Li=0,!Kt.value)return;let L=null;try{L=D.$superdoc?.activeEditor?.host?.getHandles?.()??null}catch{L=null}const W=D.$superdoc?.config?.documentMode;if(W==="editing"||W==="suggesting"){const vn=L?.editing?.selection?.getSnapshot?.()??null;if(cM(W,vn)){const Dn=vi();if(lM(window.getSelection?.()??null,Dn)){ya();return}lo.value=!0,$o.value=vn,Mo();return}}else if(W!=="viewing"){ya();return}const we=vi(),Be=window.getSelection?.()??null;if(!ei(Be,we)){ya();return}const gt=L?.editing?.selectionTargets?.applyDomSelection?.(Be);if(!gt?.ok||gt.mode!=="range"){ya();return}lo.value=!0,$o.value=L?.editing?.selection?.getSnapshot?.()??null,Mo()},jf=()=>{if(Kt.value){if(mc(),typeof requestAnimationFrame!="function"){Wn();return}Li=requestAnimationFrame(Wn)}},Ts=()=>{jf()},ti=({hasRangeSelection:L,snapshot:W}={})=>{if(lo.value=L===!0,$o.value=L===!0?W??null:null,lo.value){Mo();return}xs(),vl()},vi=()=>Sn.value?.mountContainer??D.$superdoc?.activeEditor?.mount?.container??null,pl=L=>{const W=String(L);return globalThis.CSS?.escape?globalThis.CSS.escape(W):W.replace(/["\\]/g,"\\$&")},es=()=>{const L=$o.value,W=vi();if(!L||!W?.querySelector)return null;const we=L.anchor??null,Be=[we?.fragmentId,we?.blockId,we?.position?.anchor?.nativeId].filter(gt=>gt!=null&&gt!=="");for(const gt of Be){const vn=pl(gt),Dn=W.querySelector(`[data-source-node-id="${vn}"]`)??W.querySelector(`[data-layout-block-ref="${vn}"]`)??W.querySelector(`[data-layout-fragment-id="${vn}"]`);if(Dn instanceof HTMLElement)return Dn}return null};function Pu(L=null){const W=window.getSelection?.();if(!W||W.rangeCount<1||W.isCollapsed)return null;const we=W.getRangeAt(0);if(!we)return null;if(L){const{startContainer:Be,endContainer:gt}=we;if(!L.contains(Be)||!L.contains(gt))return null}try{const Be=we.getBoundingClientRect();return!Be||Be.width<=0&&Be.height<=0?null:Be}catch{return null}}const ml=L=>{if(!L||!Ft.value)return null;const W=Ft.value.getBoundingClientRect();return{top:L.top-W.top,left:L.left-W.left,right:L.right-W.left,bottom:L.bottom-W.top,width:L.width,height:L.height}},gl=L=>{let W=L;for(;W&&W.nodeType===1;){const we=W.dataset?.pageIndex;if(we!=null&&we!==""){const Be=Number(we);if(Number.isFinite(Be))return Be}W=W.parentElement}return null},Uf=()=>{if(!lo.value||!ri.value)return null;const L=ml(Pu(vi()))??ba()?.bounds??null;if(!L)return null;const W=D.$superdoc?.activeEditor?.options?.documentId??D.$superdoc?.activeEditor?.documentId;if(!W)return null;const we=gl(es());return cf({selectionBounds:L,page:we!=null?we+1:1,documentId:W,source:fu})},ba=()=>{if(!Ft.value)return null;const L=es();if(!L)return null;const W=L.getBoundingClientRect();if(!W||W.width<=0&&W.height<=0)return null;const we=Ft.value.getBoundingClientRect(),Be={top:W.top-we.top,left:W.left-we.left,right:W.right-we.left,bottom:W.bottom-we.top,width:W.width,height:W.height},gt=gl(L);return{threadId:"pending",key:"pending",kind:"pending",storyKey:"body",bounds:Be,...gt!=null?{pageIndex:gt}:{},...je.value!=null?{generation:je.value}:{}}},vl=()=>{if(!Kt.value)return;if(!lo.value){d.value=null,Ur();return}const L=Uf();if(!L){d.value=null,Ur();return}An(L)},ts=L=>{L&&ye({...X.value??{},pending:L})},yi=U.createGeometryPublisher({getLayersContainer:()=>Ft.value??null,isCommentsEnabled:()=>it.value,publishPositions:(L,W)=>ye(L,W),clearPositions:()=>{s.clearEditorCommentPositions?.()},readCurrentPositions:()=>X.value??{},setGeometryAvailable:L=>{const W=!!L;Pt.value=W,W&&(De.value=!0,je.value=yi.getLastEpoch())}}),Gf=L=>{if(L instanceof Set)return new Set([...L].filter(Boolean).map(String));if(Array.isArray(L))return new Set(L.filter(Boolean).map(String));const W=new Set;for(const we of L?.upsertIds??[])W.add(String(we));for(const we of L?.removedIds??[])W.add(String(we));for(const we of L?.remappedPairs??[])we?.from&&W.add(String(we.from)),we?.to&&W.add(String(we.to));return W},wa=(L="tracked-change-restamp",W=null)=>{pt=Math.max(pt,3),kt=L;const we=Gf(W);we.size>0&&(ft=new Set([...ft??[],...we]))},Du=()=>{if(pt<=0)return;const L=kt??"tracked-change-restamp",W=ft?.size?Array.from(ft):null;return pt-=1,pt<=0&&(kt=null,ft=null),{retainMissingTrackedChangeGeometry:!0,...W?{retainedTrackedChangeIds:W}:{},reason:L}},Wf=()=>{pt=0,kt=null,ft=null},yl=L=>typeof L=="function"?L():L,gc=(L,W=void 0)=>{if(Sn.value=L,Ke&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Ke),typeof requestAnimationFrame!="function"){yi.publish(Sn.value,yl(W));return}Ke=requestAnimationFrame(()=>{Ke=0,yi.publish(Sn.value,yl(W))})},Ou=L=>{L&&(gc(L,()=>Du()),lo.value&&Mo())},Ca=L=>{const W=L?.snapshot??L??null;W&&ot.onRenderReadiness(W)},yo=Kr(null),bl=new Map;let Rs=null;const vc=L=>{if(!L?.snapshot)return;bc.onRender();const W=L.snapshot,we=L.stage;if(typeof HTMLElement<"u"&&we instanceof HTMLElement){Rs=we;const gt=we.dataset?.superdocV2DocumentId;gt&&bl.set(gt,we)}yo.value=W;const Be=Array.isArray(W.pages)?W.pages.length:0;D.$superdoc.emit("pagination-update",{totalPages:Be,superdoc:D.$superdoc}),_t(()=>{Ea(),Ml()})},Fu=L=>{Jt.destroy(),mc(),xs(),Ke&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Ke),Ke=0,Sn.value=null,je.value=null,Pt.value=!1,De.value=!1,Wf(),yi.reset(),lo.value=!1,$o.value=null,d.value=null,Ur(),yo.value=null;const W=L?.documentId==null?null:String(L.documentId);s.cancelImportedTrackedChangeBootstrap?.(W??void 0),W&&bl.delete(W),Rs&&(W==null||Rs.dataset?.superdocV2DocumentId===W)&&(Rs=null),ot.reset("render-cleared"),bc.reset(),zu(),wc.clear(),s.setV2CommentsAdapter?.(null),s.setV2TrackedChangesAdapter?.(null),s.clearEditorCommentPositions?.(),Jo(L?.documentId??null),Ac(),Ho.value={},Po.value=!1};let bo=0,ns=0;const Nu=()=>{const L=D.$superdoc?.activeEditor?.v2Comments??null;L&&s.hydrateCommentsFromV2?.({superdoc:D.$superdoc,adapter:L,documentId:D.$superdoc?.activeEditor?.documentId??null})},yc=(L={})=>{Nu();const W=D.$superdoc?.activeEditor?.v2TrackedChanges??null;W&&s.hydrateTrackedChangesFromV2?.({superdoc:D.$superdoc,adapter:W,documentId:D.$superdoc?.activeEditor?.documentId??null,...L})},Bu=(L={})=>{const W=D.$superdoc?.activeEditor?.v2TrackedChanges??null;W&&s.hydrateTrackedChangesFromV2?.({superdoc:D.$superdoc,adapter:W,documentId:D.$superdoc?.activeEditor?.documentId??null,trackedChangesListMode:"visible-window",refreshReason:"typing-visible-prime",blocking:!1,...L})},bc=z_({getContext:()=>{const L=D.$superdoc?.activeEditor??null,W=L?.v2TrackedChanges??null;return W?{superdoc:D.$superdoc,adapter:W,documentId:L.documentId??null}:null},reconcile:(L,W)=>s.reconcileTrackedChangeMutationFromV2?.({superdoc:L.superdoc,adapter:L.adapter,documentId:L.documentId,...W}),hydrate:(L,W)=>s.hydrateTrackedChangesFromV2?.({superdoc:L.superdoc,adapter:L.adapter,documentId:L.documentId,...W}),onReconciled:(L,W)=>yi.recollect({retainMissingTrackedChangeGeometry:!0,retainedTrackedChangeIds:W,reason:"review-reconcile"})});let Ms=0,ni=0;const zu=()=>{bo&&typeof clearTimeout=="function"&&clearTimeout(bo),ns&&typeof clearTimeout=="function"&&clearTimeout(ns),bo=0,ns=0,Ms=0,ni=0},wl=(L={})=>{ns||(ns=setTimeout(()=>{ns=0,Bu(L)},eD))},Vu=(L={})=>{Ms=Date.now(),wl(L.primeOptions),ni||(ni=Ms),bo&&typeof clearTimeout=="function"&&clearTimeout(bo);const W=()=>{bo=0;const Be=Date.now()-Ms,gt=Date.now()-ni;if(Be<C0&&gt<_0){const vn=C0-Be,Dn=_0-gt;bo=setTimeout(W,Math.min(vn,Dn));return}ni=0,yc()},we=Math.max(0,_0-(Date.now()-ni));bo=setTimeout(W,Math.min(C0,we))},wc=nM({hydrate:()=>yc(),getActiveDocumentId:()=>{const L=D.$superdoc?.activeEditor??null;return L?.documentId??L?.options?.documentId??null}}),_a=(L,W)=>{if(!W)return;const we=L?.id??null;if(W.type==="reviewTarget:changed"){Ls(W.next);return}if(W.type==="collaboration:remote-changed"){ot.invalidate("collaboration:remote-changed"),wc.schedule(we);return}if(W.type==="source:complete"){D.$superdoc.broadcastSourceComplete();return}if(W.type==="source:signals-complete"){D.$superdoc.broadcastSourceSignalsComplete();return}if(W.type==="mutation:rejected"){Es(we,W);return}if(W.type==="mutation:committed"&&(Ji(we),Lu()),W.type!=="mutation:committed")return;ot.invalidate("mutation-committed");const Be=B_(W);Array.isArray(Be?.remappedPairs)&&Be.remappedPairs.length>0&&s.remapTrackedChangeIdentities?.(Be.remappedPairs,{documentId:we}),Be&&wa("tracked-change-mutation",Be);const gt=(D.$superdoc?.activeEditor??null)?.documentMutationReadiness??null,vn=W.origin==="history"?null:W.receipt,Dn=Be&&typeof vn?.txId=="string"&&vn.txId.length>0&&typeof gt?.whenPainted=="function";if(bc.enqueueAfterPaint(Be,Dn?()=>gt.whenPainted.call(gt,vn):null),Be?.reconcileMode==="authoritative"&&Be.upsertIds.size>0){Nu();return}if(V_(W)){Vu();return}Be?.removedIds.size>0&&Be.upsertIds.size===0||yc()},rs=L=>{Jt.handleLinkClick(L)},Cl=()=>{if(Kt.value&&yi.getLastPayload()){if(Ke&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Ke),typeof requestAnimationFrame!="function"){yi.recollect();return}Ke=requestAnimationFrame(()=>{Ke=0,yi.recollect()})}},Pi=()=>{if(!Kt.value)return;try{ot.hydrateNow("document-mode-change")}catch(W){console.warn("[SuperDoc][v2] document-mode-change rehydrate failed",W)}const L=()=>{Kt.value&&(it.value?Sn.value?gc(Sn.value):Cl():(s.clearEditorCommentPositions?.(),Pt.value=!1))};_t(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>L()):L()})},Kf=L=>{switch(L){case"editing-mount-required":return"SuperDoc could not load the document editor because the page did not provide a mount container.";case"source-load-failed":return"SuperDoc could not load the document editor because the document source could not be prepared.";case"unsupported-cdn-v2-editor":return"SuperDoc could not load the document editor because this build does not include the V2 runtime.";case"v2-integration-unavailable":return"SuperDoc could not load the document editor because the bundled V2 runtime is unavailable in this environment.";case"worker-init-failed":return"SuperDoc could not load the document editor because the browser worker failed to start.";case"input-too-large-for-inline-review":return"SuperDoc could not load the document editor because this document is too large to open without the browser worker.";case"collaboration-unsupported-huge-document":return"SuperDoc could not load the document editor because large documents cannot be opened with collaboration enabled yet.";case"collaboration-v1-config-unsupported":return"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead.";case"collaboration-room-format-unsupported":return"SuperDoc v2 cannot open this collaboration state because it is not stored in the SuperDoc v2 room format. No changes were made.";case"collaboration-room-format-conflict":return"SuperDoc v2 found conflicting room formats in one collaboration document. No changes were made.";case"collaboration-room-corrupt":return"SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";case"collaboration-v2-room-missing":return'SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: "create" only when creating a new room.';case"collaboration-v2-room-already-exists":return'SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: "join" to open it.';case"collaboration-v2-room-initializing":return"The SuperDoc v2 collaboration room is still initializing. Join mode did not modify it.";case"collaboration-open-intent-invalid":return"SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";case"collaboration-config-invalid":return"SuperDoc v2 received an invalid collaboration configuration. No provider was connected.";default:return"SuperDoc could not load the document editor."}},qf=L=>typeof L=="string"&&L.trim().length>0?L.trim():null,Cc=L=>{Jo(L?.documentId??null);const W=typeof L?.reason=="string"&&L.reason.length>0?L.reason:"open-failed",we=qf(L?.detail),Be=typeof L?.documentId=="string"&&L.documentId.length>0?L.documentId:null,gt=Kf(W),vn=L?.workerFailure&&typeof L.workerFailure=="object"?L.workerFailure:null;No(Be,{reason:W,message:gt,detail:we,...vn?{workerFailure:vn}:{}});const Dn={...we?{detail:we}:{},...Be?{documentId:Be}:{},...vn?{workerFailure:vn}:{},reason:W};W==="collaboration-v1-config-unsupported"||W==="collaboration-room-format-unsupported"||W==="collaboration-room-format-conflict"||W==="collaboration-room-corrupt"||W==="collaboration-v2-room-missing"||W==="collaboration-v2-room-already-exists"||W==="collaboration-v2-room-initializing"||W==="collaboration-open-intent-invalid"||W==="collaboration-config-invalid"?console.warn(`[SuperDoc] ${gt}`,Dn):console.error(`[SuperDoc] ${gt}`,Dn),D.$superdoc.emit("exception",{error:new Error(gt),code:W,...Be?{documentId:Be}:{},editor:null})},_l=(L,W)=>{D.$superdoc?.activateRuntimeFromEventTarget?.(L.target,W)},Hu=L=>_l(L,"focusin"),Sl=L=>_l(L,"pointerdown"),Sa=L=>_l(L,"mousedown"),ju=({editor:L})=>{D.$superdoc.emit("collaboration-ready",{editor:L}),_t(()=>{l.value=!0;const W=new URLSearchParams(window.location.search).get("commentId");W&&yt(W)})};let kl=0;const Yf=()=>{kl=Date.now()+250},Al=()=>Date.now()<kl,Il=L=>{const W=St.value;W&&(!(L.target instanceof Node)||!W.contains(L.target)||(Ft.value?.contains(L.target)&&(s.setActiveComment(D.$superdoc,null),s.removePendingComment(D.$superdoc),Qe()),Yf()))},Uu=L=>{const W=D.$superdoc.listeners?.("fonts-resolved")?.length>0?D.$superdoc.listeners("fonts-resolved")[0]:null,we=D.$superdoc.config.useLayoutEngine!==!1,Be=L.isNewFile,gt=D.$superdoc.config?.benchmarkExecutionMode,vn=D.$superdoc.config?.benchmarkTraceEnabled===!0,Dn=o(L),hr=Dn.state==="valid"?Dn.config:null,jn=D.$superdoc.config.v2CollaborationPreflightFailure??(Dn.state==="invalid"?Dn.failure:null);return{isDebug:D.$superdoc.config.isDebug||!1,documentId:L.id,user:D.$superdoc.user,users:D.$superdoc.users,colors:D.$superdoc.colors,role:D.$superdoc.config.role,html:L.html,markdown:L.markdown,documentMode:D.$superdoc.config.documentMode,...gt?{benchmarkExecutionMode:gt}:{},...vn?{benchmarkTraceEnabled:!0}:{},allowSelectionInViewMode:D.$superdoc.config.allowSelectionInViewMode,rulers:L.rulers,rulerContainer:Dt.value,isInternal:D.$superdoc.config.isInternal,annotations:D.$superdoc.config.annotations,isCommentsEnabled:!!Ct.value,isAiEnabled:D.$superdoc.config.modules?.ai,contextMenuConfig:(D.$superdoc.config.modules?.slashMenu&&!D.$superdoc.config.modules?.contextMenu&&console.warn("[SuperDoc] modules.slashMenu is deprecated. Use modules.contextMenu instead."),D.$superdoc.uiConfig.contextMenu.options),slashMenuConfig:D.$superdoc.config.modules?.contextMenu??D.$superdoc.config.modules?.slashMenu,comments:{highlightColors:Ct.value?.highlightColors,highlightOpacity:Ct.value?.highlightOpacity},trackedChanges:D.$superdoc.config.modules?.trackChanges,experimental:D.$superdoc.config.experimental,...hr?{v2Collaboration:hr}:{},...jn?{collaborationPreflightFailure:jn}:{},onCollaborationReady:ju,onCommentsUpdate:Lo,onFontsResolved:W,onPageCountKnown:D.$superdoc.config.onPageCountKnown??null,fontAssets:D.$superdoc.config.fonts,proofing:He.value,isNewFile:Be,password:r(L),handleImageUpload:D.$superdoc.config.handleImageUpload,externalExtensions:D.$superdoc.config.editorExtensions||[],extensions:D.$superdoc.config.extensions||[],suppressDefaultDocxStyles:D.$superdoc.config.suppressDefaultDocxStyles,disableContextMenu:!D.$superdoc.uiConfig.contextMenu.enabled||D.$superdoc.config.disableContextMenu===!0,jsonOverride:D.$superdoc.config.jsonOverride,viewOptions:D.$superdoc.config.viewOptions,contained:D.$superdoc.config.contained,linkPopoverResolver:D.$superdoc.uiConfig.linkPopover.enabled?D.$superdoc.config.modules?.links?.popoverResolver:void 0,layoutEngineOptions:we?{...D.$superdoc.config.layoutEngineOptions||{},proofing:He.value,debugLabel:D.$superdoc.config.layoutEngineOptions?.debugLabel??L.name??L.id,zoom:(h.value??100)/100,emitCommentPositionsInViewing:be()&&it.value,enableCommentsInViewing:Ce.value,contentControlsChrome:D.$superdoc.uiConfig.contentControls.enabled?D.$superdoc.uiConfig.contentControls.options.chrome??(D.$superdoc.config.modules?.contentControls?.chrome==="none"?void 0:D.$superdoc.config.modules?.contentControls?.chrome):"none",resolveTrackedChangeColor:I9(D.$superdoc.config.modules?.trackChanges?.authorColors)}:void 0,permissionResolver:(pr={})=>D.$superdoc.canPerformPermission({role:D.$superdoc.config.role,isInternal:D.$superdoc.config.isInternal,...pr}),licenseKey:D.$superdoc.config.licenseKey,telemetry:D.$superdoc.config.telemetry?.enabled?{enabled:!0,endpoint:D.$superdoc.config.telemetry?.endpoint,metadata:D.$superdoc.config.telemetry?.metadata,licenseKey:D.$superdoc.config.telemetry?.licenseKey}:null}},Gu=new Set(["commentText","isInternal","parentCommentId","trackedChangeParentId","trackedChangeThreadParentId","threadingParentCommentId","trackedChange","trackedChangeType","trackedChangeText","trackedChangeDisplayType","semanticColorKey","semanticColor","trackedChangeStory","trackedChangeStoryKind","trackedChangeStoryLabel","trackedChangeAnchorKey","trackedChangeLabel","trackedChangeDetailLines","deletedText","resolvedTime","resolvedById","resolvedByEmail","resolvedByName","importedAuthor","docxCommentJSON"]),El=(L,W={})=>{if(!(!L||W.isDone===void 0)&&!(W.resolvedTime!=null||W.resolvedById!=null||W.resolvedByEmail!=null||W.resolvedByName!=null)){if(W.isDone){L.resolvedTime=L.resolvedTime||Date.now(),L.resolvedById=L.resolvedById||W.creatorId||null,L.resolvedByEmail=L.resolvedByEmail||W.creatorEmail||null,L.resolvedByName=L.resolvedByName||W.creatorName||null;return}L.resolvedTime=null,L.resolvedById=null,L.resolvedByEmail=null,L.resolvedByName=null}},Xf=(L,W,we)=>{!L||!W||(Array.isArray(W.elements)&&(L.docxCommentJSON=W.elements),Object.entries(W).forEach(([Be,gt])=>{gt!==void 0&&Be!=="text"&&Be!=="elements"&&Gu.has(Be)&&(L[Be]=gt)}),we!==void 0&&(L.commentText=we),El(L,W))},_c=(L={})=>{const W={...L};return!W.commentText&&W.text&&(W.commentText=W.text),!W.docxCommentJSON&&Array.isArray(W.elements)&&(W.docxCommentJSON=W.elements),El(W,W),W},xl=L=>{if(Number.isFinite(S()))return;if(L==null){ee();return}const W=Ft.value,{key:we,entry:Be}=Ee(L),gt=w_(W,Be);if(Number.isFinite(gt)){Z(gt,L,we??L);return}ee()},Zf=L=>L==null||V.value==null?!1:String(V.value)===String(L),Ls=L=>{if(L?.origin!=="document"||Al())return;const W=eM(L,At);W&&(xl(W),V.value=W,pe.value=!0,setTimeout(()=>{pe.value=!1},0))},Lo=(L={})=>{let{activeCommentId:W,type:we,comment:Be}=L,gt=Object.prototype.hasOwnProperty.call(L,"activeCommentId");const vn=hr=>{const jn=[hr?.importedId,hr?.commentId].filter(Boolean).map(pr=>String(pr));return[...new Set(jn)]},Dn=hr=>{const jn=[hr?.importedId,hr?.commentId].filter(Boolean).map(Xt=>String(Xt)),pr=D.$superdoc?.activeEditor?.options?.documentId!=null?String(D.$superdoc.activeEditor.options.documentId):null;for(const Xt of jn){const Co=j.value.find(co=>{const Ra=co?.commentId!=null?String(co.commentId):null,Dl=co?.importedId!=null?String(co.importedId):null;return Ra===Xt||Dl===Xt?!pr||typeof Ge!="function"?!0:Ge(co,pr):!1});if(Co){const co=Co?.commentId??Co?.importedId??Xt;return{id:co!=null?String(co):null,existingComment:Co}}}return{id:jn[0]||null,existingComment:null}};if(we==="replayCompleted"&&io(),qe?.ADD&&we===qe.ADD&&Be){Be=_c(Be);const hr=D.$superdoc?.user;hr&&(Be.creatorId||(Be.creatorId=hr.id),Be.creatorName||(Be.creatorName=hr.name),Be.creatorEmail||(Be.creatorEmail=hr.email)),Be.createdTime||(Be.createdTime=Date.now());const jn=Be.documentId||a.value?.[0]?.id;!Be.documentId&&jn&&(Be.documentId=jn),!Be.fileId&&jn&&(Be.fileId=jn);const{id:pr,existingComment:Xt}=Dn(Be);if(pr&&!Xt){const Co=ia(Be);st({superdoc:D.$superdoc,comment:Co,skipEditorUpdate:!0})}}if(qe?.UPDATE&&we===qe.UPDATE&&Be){const{id:hr,existingComment:jn}=Dn(Be);if(hr){const pr=Be.commentText||Be.text;if(jn)Xf(jn,Be,pr);else{const Xt=ia(_c(Be));st({superdoc:D.$superdoc,comment:Xt,skipEditorUpdate:!0})}}}if(qe?.DELETED&&we===qe.DELETED&&Be){const hr=vn(Be);if(hr.length){const jn=D.$superdoc?.activeEditor?.options?.documentId!=null?String(D.$superdoc.activeEditor.options.documentId):null,pr=Co=>!jn||typeof Ge!="function"?!0:Ge(Co,jn),Xt=D9(j.value,hr,pr);if(Xt.size){const Co=[...j.value];j.value=j.value.filter(_o=>{if(!pr(_o))return!0;const br=_o.commentId!=null?String(_o.commentId):null,Ol=_o.importedId!=null?String(_o.importedId):null;return!(br&&Xt.has(br)||Ol&&Xt.has(Ol))});const co=V.value!=null?String(V.value):null,Ra=co!=null?Co.find(_o=>{const br=_o.commentId!=null?String(_o.commentId):null,Ol=_o.importedId!=null?String(_o.importedId):null;return br===co||Ol===co}):null,Dl=Ra?pr(Ra):!1;co&&Xt.has(co)&&Dl&&(W=null,gt=!0)}}}we==="trackedChange"&&le({superdoc:D.$superdoc,params:L}),gt&&W!=null&&Al()&&(gt=!1),gt&&(W==null||!Zf(W))&&xl(W),_t(()=>{O.value||(gt&&s.setActiveComment(D.$superdoc,W),gt&&(pe.value=!0,setTimeout(()=>{pe.value=!1},0)))}),typeof D.$superdoc.config.onCommentsUpdate=="function"&&D.$superdoc.config.onCommentsUpdate(L)},ri=ke(()=>!!Ct.value),Wu=ke(()=>Array.isArray(a.value)?a.value.filter(L=>L?.type===Ql):[]),Sc=ke(()=>Wu.value.length>0),kc=ke(()=>Sc.value&&ri.value),Qf=ke(()=>new Set(Wu.value.map(L=>String(L.id)))),I=L=>typeof L=="number"?Number.isFinite(L):typeof L=="string"&&L.trim()!==""?Number.isFinite(Number(L)):!1,M=L=>{const W=L?.selection?.selectionBounds;return!!W&&I(W.top)&&I(W.left)&&I(W.right)&&I(W.bottom)},$=L=>{const W=L?.fileId??L?.documentId??L?.selection?.documentId;return W!=null?String(W):null},ie=L=>{const W=Qf.value;if(!W.size)return!1;const we=$(L);return we?W.has(we):W.size===1},se=L=>L?.selection?.source==="pdf"&&M(L)&&ie(L),de=ke(()=>{if(!Sc.value)return!1;const L=te.value.some(we=>se(we)),W=se(O.value);return L||W}),he=ke(()=>{const L=Ct.value?.displayMode??"sidebar";return!M_.has(L)||L==="sidebar"?!0:L==="inline"?!1:L!=="auto"?!0:!Et.value}),ue=ke(()=>Kt.value&&!Pt.value&&!De.value&&!de.value||!it.value||!he.value?!1:O.value||(te.value.length>0||Fe.value)&&l.value&&Ft.value&&ri.value&&!N.value),Te=ke(()=>{if(ue.value||!ri.value)return null;if(O.value)return O.value;if(!V.value)return null;const L=At(V.value)??null;return Kt.value&&he.value&&L?.trackedChange&&!de.value?null:L}),{compactCommentPopoverStyle:Ne,closeCompactCommentPopover:Oe,resetClickAnchor:Qe}=Q9({activeComment:V,pendingComment:O,activeCompactComment:Te,showCommentsSidebar:ue,superdocRoot:St,layers:Ft,documents:a,resolveCommentPositionEntry:Ee,selectionPosition:c,activeZoom:h,clearActiveComment:()=>s.setActiveComment(D.$superdoc,null),clearPendingComment:()=>s.removePendingComment(D.$superdoc)}),ct=ke(()=>ri.value?c.value&&Qt.top&&!R.value?.readOnly:!1);ke(()=>ri.value?!R.value?.readOnly&&c.value:!1),Lt(ue,L=>{D.$superdoc.broadcastSidebarToggle(L)}),$R({getSuperdoc:()=>D.$superdoc,superdocContainerWidth:Ye,isReady:l,activeZoom:h,zoomMode:m,viewportMetrics:v,showCommentsSidebar:ue,rightSidebarRef:Nt,superdocRoot:St,documents:a});const yt=L=>{D.$superdoc.scrollToComment(L)},nt=()=>{Cl()};Nn(()=>{document.addEventListener("contextmenu",Il,!0),document.addEventListener("keydown",yr,!0),D.$superdoc?.on?.("search:open",Kn),p0(Ut),St.value?.addEventListener("pointerdown",Sr,!0),St.value?.addEventListener("focusin",Sr,!0),typeof window<"u"&&(window.addEventListener("scroll",nt,!0),window.addEventListener("resize",nt,!0)),document.addEventListener("focusin",Hu,!0),document.addEventListener("pointerdown",Sl,!0),document.addEventListener("mousedown",Sa,!0),document.addEventListener("pointerup",Ts,!0),document.addEventListener("mouseup",Ts,!0),document.addEventListener("selectionchange",Ts),D.$superdoc?.on?.("document-mode-change",Pi),Ot(),wn()}),Lt(it,L=>{Kt.value&&(L?Sn.value&&gc(Sn.value):(s.clearEditorCommentPositions?.(),Pt.value=!1))}),Lt(Ft,()=>{Cl()});function ln(L){return(L.metaKey||L.ctrlKey)&&!L.altKey&&L.key?.toLowerCase?.()==="f"}function nn(L){return(L.metaKey||L.ctrlKey)&&L.shiftKey&&!L.altKey&&(L.code==="Digit8"||L.key==="8"||L.key==="*")}function Vn(){const L=St.value,W=document.activeElement;if(!(W instanceof Node))return!1;if(L?.contains(W))return!0;const we=D.$superdoc?.activeEditor?.view?.dom;return we instanceof Node&&(W===we||we.contains?.(W))}const Ut={};function Cn(L){ln(L)&&Pe.value&&SM(L,{focusInside:Vn(),owner:Ut})&&hn.wouldOpen()&&(L.preventDefault(),L.stopPropagation(),p0(Ut),hn.open())}function Sr(){p0(Ut)}function Kn(){Pe.value&&hn.open()}function dr(L){nn(L)&&(Kt.value||Vn()&&(L.preventDefault(),L.stopPropagation(),D.$superdoc.toggleFormattingMarks?.()))}function yr(L){if(L.key==="Escape"&&Te.value){L.preventDefault(),L.stopPropagation(),Oe();return}Cn(L),!L.defaultPrevented&&dr(L)}function Bo(L){Cn(L),!L.defaultPrevented&&dr(L)}or(()=>{s.cancelImportedTrackedChangeBootstrap?.(),T.destroy(),hn.destroy(),Jt.destroy(),mc(),xs();for(const L of Array.from(cr.keys()))ze(L);for(const L of Array.from(Qo.keys()))Qi(L);for(const L of Array.from(Zi.keys()))ao(L);cr.clear(),so.clear(),document.removeEventListener("contextmenu",Il,!0),document.removeEventListener("keydown",yr,!0),D.$superdoc?.off?.("search:open",Kn),St.value?.removeEventListener("pointerdown",Sr,!0),St.value?.removeEventListener("focusin",Sr,!0),CM(Ut),typeof window<"u"&&(window.removeEventListener("scroll",nt,!0),window.removeEventListener("resize",nt,!0)),Ke&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(Ke),Ke=0),zu(),wc.clear(),document.removeEventListener("focusin",Hu,!0),document.removeEventListener("pointerdown",Sl,!0),document.removeEventListener("mousedown",Sa,!0),document.removeEventListener("pointerup",Ts,!0),document.removeEventListener("mouseup",Ts,!0),document.removeEventListener("selectionchange",Ts),D.$superdoc?.off?.("document-mode-change",Pi)});const Rn=ne(null),at=ne(!1),pn=ke(()=>{if(!c.value||c.value.source==="document-editor")return{x:null,y:null};const L=c.value.source==="pdf"?(h.value??100)/100:1,W=c.value.top*L,we=c.value.left*L,Be=c.value.right*L,gt=c.value.bottom*L;return{zIndex:500,borderRadius:"4px",top:W+"px",left:we+"px",height:Math.abs(W-gt)+"px",width:Math.abs(we-Be)+"px"}}),An=L=>{if(be()&&!me()){Ur();return}if(!L.selectionBounds||!ri.value)return;Ur();const W=window.matchMedia("(max-width: 768px)").matches;if(oi({startX:L.selectionBounds.left,startY:L.selectionBounds.top,x:L.selectionBounds.right,y:L.selectionBounds.bottom,source:L.source}),!c.value)return;const we=Math.abs(c.value.left-c.value.right)>5,Be=Math.abs(c.value.top-c.value.bottom)>5;if(!we||!Be){Rn.value?.style&&(Rn.value.style.pointerEvents="none"),Ur();return}d.value=L;const gt=L.source==="pdf"||L.source?.value==="pdf"?(h.value??100)/100:1;Qt.top=L.selectionBounds.top*gt+"px",Qt.right=W?"0":"-25px"},Ur=()=>{c.value=null,Qt.top=null},oi=({startX:L,startY:W,x:we,y:Be,source:gt,page:vn})=>{if(!(typeof L=="number"||typeof W=="number")&&!(typeof we=="number"||typeof Be=="number")){Ur();return}if(!c.value){if(W==null||L==null)return;c.value={top:W,left:L,right:L,bottom:W,startX:L,startY:W,source:gt,page:vn??null}}typeof L=="number"&&(c.value.startX=L),typeof W=="number"&&(c.value.startY=W),typeof Be=="number"&&(Be<c.value.startY?c.value.top=Be:c.value.bottom=Be),typeof we=="number"&&(we<c.value.startX?c.value.left=we:c.value.right=we)},zo=L=>{const W=L?.clientX,we=L?.clientY;if(typeof W!="number"||typeof we!="number")return null;const Be=document.elementsFromPoint(W,we).find(gt=>gt?.dataset?.pdfPage!=null);if(Be){const gt=Number(Be.dataset?.pageNumber);return Number.isFinite(gt)?gt:null}return null},Ps=L=>{Ur(),Rn.value.style.pointerEvents="auto",_t(()=>{at.value=!0,Rn.value.style.pointerEvents="none";const W=zo(L);if(Rn.value.style.pointerEvents="auto",!W){at.value=!1,Rn.value.style.pointerEvents="none";return}const we=Rn.value.getBoundingClientRect(),Be=h.value/100;oi({startX:(L.clientX-we.left)/Be,startY:(L.clientY-we.top)/Be,page:W,source:"pdf"}),Rn.value.addEventListener("mousemove",ka)})},ka=L=>{if(!at.value)return;const W=Rn.value.getBoundingClientRect(),we=h.value/100;oi({x:(L.clientX-W.left)/we,y:(L.clientY-W.top)/we})},bi=L=>{if(!at.value||(Rn.value.removeEventListener("mousemove",ka),!c.value))return;const W=c.value.page??zo(L);An(cf({selectionBounds:{top:c.value.top,left:c.value.left,right:c.value.right,bottom:c.value.bottom},page:W??1,documentId:a.value[0].id,source:"pdf"})),Rn.value.style.pointerEvents="none"},Vo=ke(()=>{if(!D.$superdoc.uiConfig.comments.enabled)return!1;const L=D.$superdoc.config.modules?.comments;return!L||L===!1?!1:!L.readOnly}),Po=ne(!1),Aa=L=>L&&typeof L=="object"&&"value"in L?L.value:L,Tl=L=>{if(!Kt.value||!L||L.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||D.$superdoc.config.viewOptions?.layout==="web"||D.$superdoc.uiConfig.ruler.suppressed||!Aa(L.rulers)||!Po.value)return!1;const W=D.$superdoc?.activeEditor;if(!W||W.editorVersion!==2)return!1;const we=Aa(L.id),Be=W.documentId??W.options?.documentId??null;return we&&Be&&we!==Be?!1:!!(W.pageMetrics&&W.pageLayout)},Ho=ne({});let ut=null,Di=null;const Dt=ke(()=>D.$superdoc?.uiConfig?.ruler?.container??null),Rl=()=>{const L=Dt.value;return L?typeof L=="string"?(typeof document<"u"?document:globalThis.document)?.querySelector(L)??null:typeof HTMLElement<"u"&&L instanceof HTMLElement?L:null:null},Ia=()=>{const L=D.$superdoc?.activeEditor?.documentId??D.$superdoc?.activeEditor?.options?.documentId??null,W=L==null?Rs:bl.get(String(L))??null;return W?.isConnected?(Array.from(W.children).find(we=>we.dataset?.v2PaintWrapper==="true")??W).getBoundingClientRect():null},Ea=()=>{if(!Kt.value){Ho.value={};return}const L=Rl();if(!L){Ho.value={};return}const W=Ia();if(!W){Ho.value={};return}const we=L.getBoundingClientRect(),Be=Math.max(0,W.left-we.left),gt=Math.max(0,we.right-W.right);Ho.value={paddingLeft:`${Be}px`,paddingRight:`${gt}px`}},Ac=()=>{try{ut?.disconnect()}catch{}ut=null;try{Di?.disconnect()}catch{}Di=null},Ml=()=>{if(Ac(),typeof ResizeObserver>"u")return;const L=Ft.value,W=Rl();L&&(ut=new ResizeObserver(()=>Ea()),ut.observe(L)),W&&(Di=new ResizeObserver(()=>Ea()),Di.observe(W))},Ll=(L,W)=>{!L||!W||(L.documentMarginsLastChange=W.pageMargins??null,D.$superdoc.emit("page-margins-change",{documentId:L.id,editorVersion:2,sectionId:W.sectionId,sectionIndex:W.sectionIndex,side:W.side,value:W.value,pageMargins:W.pageMargins}))},Pl=L=>{ri.value&&(Ur(),at.value=!0,Ps(L))},xa=({selectionBounds:L,documentId:W,page:we})=>{!L||!W||An(cf({selectionBounds:L,documentId:W,page:we,source:"pdf"}))},ii=L=>{Ft.value?.querySelectorAll(".superdoc__sub-document")?.forEach(W=>{W.querySelector(".sd-pdf-viewer")||(L===1?(W.style.transformOrigin="",W.style.transform="",W.style.width=""):(W.style.transformOrigin="top left",W.style.transform=`scale(${L})`,W.style.width=`${100/L}%`))})};let wo=!1;const zt=()=>{if(wo||D.$superdoc.config.useLayoutEngine!==!1)return;const L=(h.value??100)/100;L!==1&&(wo=!0,_t(()=>ii(L)))};Lt(()=>h.value,L=>{const W=(L??100)/100,we=L??100,Be=D.$superdoc?.activeEditor?.pageMetrics??null;if(Kt.value&&D.$superdoc?.activeEditor?.editorVersion===2&&Be?.setZoom)try{Be.setZoom(we)}catch(gt){console.warn("[SuperDoc][v2] setZoom failed",gt)}else wo=!0,ii(W);Xu()?.updateScale(W),_t(()=>{qu(),Yu()})}),Lt(te,()=>{ae.value||(ae.value=!0)});const{whiteboardModuleConfig:Hn,whiteboard:Br,whiteboardPages:fr,whiteboardPageSizes:jo,whiteboardPageOffsets:os,whiteboardEnabled:is,whiteboardOpacity:Ta,handleWhiteboardPageReady:Ku,updateWhiteboardPageSizes:qu,updateWhiteboardPageOffsets:Yu}=g9({proxy:D,layers:Ft,documents:a,modules:C}),Xu=()=>Array.isArray(sn.value)?sn.value[0]:sn.value,Oi=ke(()=>Sc.value&&!!Hn.value),si=ke(()=>is.value);return(L,W)=>(ge(),Ae("div",{ref_key:"superdocRoot",ref:St,class:rn(["superdoc",{"superdoc--with-sidebar":ue.value,"superdoc--web-layout":et(D).$superdoc.config.viewOptions?.layout==="web","superdoc--contained":et(D).$superdoc.config.contained,"high-contrast":et(Y)}]),style:yn(Yt.value),onKeydown:Bo},[jr.value?(ge(),Ae("p",YP,Bt(jr.value),1)):ht("",!0),Me("div",{class:"superdoc__layers layers",ref_key:"layers",ref:Ft,role:"group"},[ct.value?(ge(),Ae("div",{key:0,class:"superdoc__tools tools",style:yn(Qt)},[Me("div",{class:"tools-item","data-id":"is-tool",onMousedown:W[0]||(W[0]=tn(we=>xi("comments"),["stop","prevent"]))},[Me("div",{class:"superdoc__tools-icon",innerHTML:et(la).comment},null,8,XP)],32)],4)):ht("",!0),Me("div",ZP,[ri.value?(ge(),Ae("div",{key:0,class:"superdoc__selection-layer selection-layer",onMousedown:Ps,onMouseup:bi,ref_key:"selectionLayer",ref:Rn},[et(c)&&Vo.value?(ge(),Ae("div",{key:0,style:yn(pn.value),class:"superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"},null,4)):ht("",!0)],544)):ht("",!0),(ge(!0),Ae(Wt,null,rr(et(a),we=>(ge(),Ae("div",{class:"superdoc__sub-document sub-document",key:`${we.id}:${we.editorMountNonce}`,ref_for:!0,ref:Be=>_e(we,Be)},[we.type===et("application/pdf")?(ge(),dn(et(n),{key:0,file:we.data,"file-id":we.id,"initial-scale":(et(h)??100)/100,config:et(Yn),onSelectionRaw:xa,onBypassSelection:Pl,onPageRendered:et(Ku),onDocumentReady:W[1]||(W[1]=({documentId:Be,viewerContainer:gt})=>vo(Be,gt)),ref_for:!0,ref_key:"pdfViewerRef",ref:sn},null,8,["file","file-id","initial-scale","config","onPageRendered"])):ht("",!0),we.type===et("application/vnd.openxmlformats-officedocument.wordprocessingml.document")&&et(G)&&Tl(we)?(ge(),Ae(Wt,{key:1},[Dt.value?(ge(),dn(Ha,{key:0,to:Dt.value},[Me("div",{class:"v2-ruler-host",style:yn(Ho.value)},[jt(et(G),{"page-layout":et(D).$superdoc.activeEditor.pageLayout,"measurement-unit":et(p),onPageMarginsChange:Be=>Ll(we,Be)},null,8,["page-layout","measurement-unit","onPageMarginsChange"])],4)],8,["to"])):(ge(),Ae("div",{key:1,class:"v2-ruler-host",style:yn(Ho.value)},[jt(et(G),{"page-layout":et(D).$superdoc.activeEditor.pageLayout,"measurement-unit":et(p),onPageMarginsChange:Be=>Ll(we,Be)},null,8,["page-layout","measurement-unit","onPageMarginsChange"])],4))],64)):ht("",!0),we.type===et("application/vnd.openxmlformats-officedocument.wordprocessingml.document")?(ge(),dn(et(H),{key:2,"file-source":we.data,"document-id":we.id,options:Uu(we),"measurement-unit":et(p),onV2EditorReady:Mi,onV2EditorFailed:Cc,onV2Render:Ou,onV2RenderCleared:Fu,onV2RenderReadiness:Ca,onV2SelectionChanged:ti,onV2HostEvent:Be=>_a(we,Be),onV2LinkClick:rs,onV2PageMetrics:vc},null,8,["file-source","document-id","options","measurement-unit","onV2HostEvent"])):ht("",!0),we.type===et("text/html")?(ge(),dn(P9,{key:3,onReady:W[2]||(W[2]=Be=>vo(Be,null)),onSelectionChange:An,"file-source":we.data,"document-id":we.id},null,8,["file-source","document-id"])):ht("",!0)]))),128)),Oi.value?(ge(),dn(C9,{key:1,class:"superdoc__whiteboard-layer",whiteboard:et(Br),pages:et(fr),"page-sizes":et(jo),"page-offsets":et(os),enabled:et(is),interactive:si.value,opacity:et(Ta)},null,8,["whiteboard","pages","page-sizes","page-offsets","enabled","interactive","opacity"])):ht("",!0),kc.value?(ge(),dn(m9,{key:2,onAnchorActivate:Is})):ht("",!0)])],512),ue.value?(ge(),Ae("div",{key:1,ref_key:"rightSidebarRef",ref:Nt,class:"superdoc__right-sidebar right-sidebar"},[Me("div",QP,[et(ae)&&(te.value.length>0||et(O))?(ge(!0),Ae(Wt,{key:0},rr(et(P),we=>(ge(),dn(l9,{parent:Ft.value,"current-document":we},null,8,["parent","current-document"]))),256)):ht("",!0)])],512)):ht("",!0),Te.value?(ge(),Ae("div",{key:2,class:"superdoc__compact-comment-popover",style:yn(et(Ne))},[jt(Pp,{comment:Te.value,parent:Ft.value},null,8,["comment","parent"])],4)):ht("",!0),jt(DP,{"geometry-target":Ft.value},null,8,["geometry-target"])],38))}},nD=fn(tD,[["__scopeId","data-v-d75089d2"]]);xt();var dk="devtools-plugin:setup",fk="dev.esm.pinia",un={disabledAppRefCounts:new Map,hook:null,originalHookEmit:null,isHookPropertyPatched:!1,originalHookPropertyDescriptor:null,hookPropertyValue:void 0,isQueuePropertyPatched:!1,originalQueuePropertyDescriptor:null,queuePropertyValue:void 0,queue:null,originalQueuePush:null},hk=(e,t)=>e===dk&&t?.id===fk&&t?.app&&un.disabledAppRefCounts.has(t.app),rD=e=>Array.isArray(e)&&hk(dk,e[0]),oD=e=>{if(un.isQueuePropertyPatched){un.queuePropertyValue=e;return}globalThis.__VUE_DEVTOOLS_PLUGINS__=e},iD=e=>{const t=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(Array.isArray(t))for(let n=t.length-1;n>=0;n--){const[r]=t[n];r?.id===fk&&r?.app===e&&t.splice(n,1)}},pk=()=>{const{queue:e,originalQueuePush:t}=un;e&&typeof t=="function"&&(e.push=t),un.queue=null,un.originalQueuePush=null},mk=()=>{const{hook:e,originalHookEmit:t}=un;e&&typeof t=="function"&&(e.emit=t),un.hook=null,un.originalHookEmit=null},vf=()=>{const e=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(e==null){oD([]),vf();return}if(!Array.isArray(e))return;const t=e;if(un.queue===t)return;pk();const n=t.push;typeof n=="function"&&(un.queue=t,un.originalQueuePush=n,t.push=function(...o){const i=o.filter(s=>!rD(s));return i.length===0?this.length:n.apply(this,i)})},sD=()=>{if(un.isQueuePropertyPatched){vf();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_PLUGINS__");if(e?.configurable===!1){vf();return}un.originalQueuePropertyDescriptor=e??null,un.queuePropertyValue=globalThis.__VUE_DEVTOOLS_PLUGINS__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return un.queuePropertyValue},set(t){un.queuePropertyValue=t,vf()}}),un.isQueuePropertyPatched=!0,vf()},aD=()=>{if(!un.isQueuePropertyPatched)return;const{queuePropertyValue:e,originalQueuePropertyDescriptor:t}=un;delete globalThis.__VUE_DEVTOOLS_PLUGINS__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_PLUGINS__=e),un.isQueuePropertyPatched=!1,un.originalQueuePropertyDescriptor=null,un.queuePropertyValue=void 0},Hp=()=>{const e=globalThis?.__VUE_DEVTOOLS_GLOBAL_HOOK__;if(!e||typeof e.emit!="function"||un.hook===e)return;mk();const t=e.emit;un.hook=e,un.originalHookEmit=t,e.emit=function(r,...o){const[i]=o;if(!hk(r,i))return t.call(this,r,...o)}},lD=()=>{if(un.isHookPropertyPatched){Hp();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__");if(e?.configurable===!1){Hp();return}un.originalHookPropertyDescriptor=e??null,un.hookPropertyValue=globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return un.hookPropertyValue},set(t){un.hookPropertyValue=t,Hp()}}),un.isHookPropertyPatched=!0,Hp()},cD=()=>{if(!un.isHookPropertyPatched)return;const{hookPropertyValue:e,originalHookPropertyDescriptor:t}=un;delete globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__=e),un.isHookPropertyPatched=!1,un.originalHookPropertyDescriptor=null,un.hookPropertyValue=void 0},uD=()=>{un.disabledAppRefCounts.size>0||(mk(),cD(),pk(),aD())},dD=(e,t)=>{if(!t)return()=>{};const n=un.disabledAppRefCounts.get(e)??0;return un.disabledAppRefCounts.set(e,n+1),lD(),sD(),()=>{const r=un.disabledAppRefCounts.get(e);r&&(r===1?un.disabledAppRefCounts.delete(e):un.disabledAppRefCounts.set(e,r-1),uD())}};const fD=({disablePiniaDevtools:e=!1}={})=>{const t=Zl(nD),n=R6(),r=dD(t,e);let o,i,s;try{t.use(n),e&&iD(t),t.directive("click-outside",Qv),o=hu(),i=aa(),s=Hi()}catch(a){throw r(),a}if(typeof t.unmount=="function"){const a=t.unmount.bind(t);t.unmount=(...l)=>(r(),a(...l))}return{app:t,pinia:n,superdocStore:o,commentsStore:i,highContrastModeStore:s}};var hD={docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",zip:"application/zip",html:"text/html",txt:"text/plain;charset=utf-8",json:"application/json"},pD=e=>!e||typeof e.toLowerCase!="function"?"application/octet-stream":hD[e.toLowerCase()]||"application/octet-stream",mD=(e,t)=>{if(e instanceof Blob)return e;const n=pD(t);if(e instanceof ArrayBuffer)return new Blob([e],{type:n});if(ArrayBuffer.isView(e)){const{buffer:r,byteOffset:o,byteLength:i}=e,s=r.slice(o,o+i);return new Blob([s],{type:n})}if(typeof e=="string")return new Blob([e],{type:n});throw e==null?new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView."):new TypeError(`Cannot create download from value of type ${typeof e}`)};const gk=(e,t,n)=>{const r=mD(e,n);if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"||typeof document.createElement!="function")return r;const o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${t}.${n}`;const s=document.body&&typeof document.body.appendChild=="function";return s&&document.body.appendChild(i),i.click(),s&&document.body.removeChild(i),typeof URL.revokeObjectURL=="function"&&setTimeout(()=>URL.revokeObjectURL(o),0),r},vk=e=>{const t=e.toLowerCase();return t.endsWith(".docx")?e.slice(0,-5):t.endsWith(".pdf")?e.slice(0,-4):e};var gD=class{#t=new Map;#n=1;idFor(e){const t=this.#t.get(e);if(t!==void 0)return t;const n=this.#n++;return this.#t.set(e,n),n}has(e){return this.#t.has(e)}};function vD(e){const t=typeof e.email=="string"&&e.email.length>0?e.email:null;return t?`email:${t}`:`label:${e.actorLabel}`}function yD(e,t){const n=e.displayName??null,r=e.email??null,o={clientId:t};return n&&(o.name=n),r&&(o.email=r),typeof e.color=="string"&&e.color.length>0&&(o.color=e.color),o}function bD(e){const t={clientId:0};e?.id!=null&&(t.id=e.id),e?.name!=null&&(t.name=e.name),e?.email!=null&&(t.email=e.email);const n=e?.color;return typeof n=="string"&&n.length>0&&(t.color=n),t}function wD(e){const t=new gD;let n=new Set;return{registry:t,next(r){const o=[],i=new Set,s=new Set;for(const u of r.remoteActors){const c=vD(u);if(s.has(c))continue;s.add(c);const d=t.idFor(c);i.add(d),o.push(yD(u,d))}const a=[];for(const u of i)n.has(u)||a.push(u);const l=[];for(const u of n)i.has(u)||l.push(u);return n=i,{states:[bD(e()),...o],added:a,removed:l}}}}var CD=class{#t=new Map;on(e,t){const n=this.#t.get(e);n?n.push(t):this.#t.set(e,[t])}emit(e,...t){const n=this.#t.get(e);if(n)for(const r of n)r.apply(this,t)}off(e,t){const n=this.#t.get(e);n&&(t?this.#t.set(e,n.filter(r=>r!==t)):this.#t.delete(e))}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};this.on(e,n)}removeAllListeners(){this.#t=new Map}};function _D(e){return e.flatMap(t=>[t[0],t[1]])}function yk(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function bk(e={}){const{value:t="",left:n,top:r,width:o,height:i,fontSize:s=16,fontFamily:a="Arial, sans-serif",color:l="#000",background:u="transparent",resize:c="none"}=e,d=document.createElement("textarea");d.value=t;const h=d.style;return h.position="absolute",n!=null&&(h.left=`${n}px`),r!=null&&(h.top=`${r}px`),o!=null&&(h.width=typeof o=="number"?`${o}px`:o),i!=null&&(h.height=typeof i=="number"?`${i}px`:i),h.minWidth=120,h.fontSize=typeof s=="number"?`${s}px`:s,h.fontFamily=a,h.color=l,h.background=u,h.border="2px solid #3c97fe80",h.padding="2px 4px",h.margin="0",h.zIndex="1000",h.overflow="hidden",h.resize=c,h.outline="none",d}var jp=18,SD=class{pageIndex=null;strokes=[];text=[];images=[];size=null;originalSize=null;#t=null;#n=null;#e=null;#i=null;#s=null;#a=null;#u=new Set;#d=!1;#l=null;#f=[];#m=null;#o="select";#r=!1;#p=null;#y="#2293fb";#w=5;#_=null;#S=null;constructor(e){this.#E(e)}#E(e){this.#t=e.Renderer,this.#r=e.enabled,this.pageIndex=e.pageIndex,this.#_=e.onChange,this.#S=e.onToolChange}#x(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{xN:e/n,yN:t/r}}#M(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{x:e*n,y:t*r}}#c(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{wN:e/n,hN:t/r}}#L(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{width:e*n,height:t*r}}#T(e){const{width:t=1,height:n=1}=this.size||{};return{points:(Array.isArray(e.pointsN)?e.pointsN:[]).map(r=>[r[0]*t,r[1]*n]),strokeWidth:Number.isFinite(e.widthN)?e.widthN*((t+n)/2):this.#w}}#P(e){const{width:t=1,height:n=1}=this.size||{};return{pointsN:(Array.isArray(e.points)?e.points:[]).map(r=>[r[0]/t,r[1]/n]),widthN:Number.isFinite(e.width)?e.width/((t+n)/2):void 0}}#k(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,fontSize:Number.isFinite(e.fontSizeN)?e.fontSizeN*n:jp}}#g(e){const{width:t=1,height:n=1}=this.size||{},r=this.originalSize?.height??n;return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,fontSizeN:Number.isFinite(e.fontSize)?e.fontSize/r:jp/r}}#U(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,height:Number.isFinite(e.heightN)?e.heightN*n:void 0}}#G(e){const{width:t=1,height:n=1}=this.size||{};return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,heightN:Number.isFinite(e.height)?e.height/n:null}}#D(){const e=this.size?.width,t=this.originalSize?.width??e;return!Number.isFinite(e)||!Number.isFinite(t)||!t?1:e/t}#O(){!this.#n||!this.#e||(this.#n.on("mousedown touchstart",e=>{this.#Y(e)}),this.#n.on("mousemove touchmove",e=>{this.#X(e)}),this.#n.on("mouseup touchend",e=>{this.#I(e)}),this.#n.on("click tap",e=>{this.#R(e)}),window.addEventListener("keydown",this.#q))}setTool(e){this.#o=e,this.#C(),this.#A(),this.render()}getTool(){return this.#o}setEnabled(e){this.#r=!!e,this.#C(),this.#A(),this.render()}isEnabled(){return this.#r}setSize(e){if(!e)return;const{width:t,height:n,originalWidth:r,originalHeight:o}=e;this.size={width:t,height:n},this.originalSize={width:r??null,height:o??null}}resize(e,t){this.#n&&(this.#n.size({width:e,height:t}),this.#F(),this.render())}mount(e){if(!e||this.#n&&this.#a===e)return;this.#n&&this.destroy();const t=this.size?.width||e.clientWidth||1,n=this.size?.height||e.clientHeight||1;this.#a=e,this.#n=new this.#t.Stage({container:e,width:t,height:n}),this.#e=new this.#t.Layer,this.#i=new this.#t.Layer,this.#n.add(this.#e),this.#n.add(this.#i),this.#F(),this.#C(),this.#O(),this.render()}render(){this.#e&&(this.#s&&(this.#s.destroy(),this.#s=null),this.#e.find(".wb-text").forEach(e=>e.destroy()),this.#i.destroyChildren(),this.renderStrokes(),this.renderText(),this.renderImages(),this.#e.batchDraw(),this.#i.batchDraw())}#F(){const e=Math.min(window.devicePixelRatio||1,1.5);this.#e?.getCanvas&&this.#e.getCanvas().setPixelRatio(e),this.#i?.getCanvas&&this.#i.getCanvas().setPixelRatio(e)}#C(){if(!this.#i)return;const e=this.#o==="draw"||this.#o==="erase",t=!!(this.#r&&e);this.#i.listening(t)}renderStrokes(){this.strokes.forEach(e=>{const{points:t,strokeWidth:n}=this.#T(e),r=new this.#t.Line({points:_D(t),stroke:e.color||this.#y,strokeWidth:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:e.type==="erase"?"destination-out":"source-over"});r.name("wb-stroke"),this.#i.add(r)})}renderText(){this.text.forEach(e=>{const{x:t,y:n,width:r,fontSize:o}=this.#k(e),i=new this.#t.Text({x:t,y:n,text:e.content,fontSize:o,fontFamily:"Arial, sans-serif",fill:"#2293fb",draggable:this.#o==="select",width:r});i.name("wb-text"),i._whiteboardId=e.id,this.#W(i,e),this.#e.add(i)})}#W(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#N(e))}),e.on("dragend",()=>{const{xN:n,yN:r}=this.#g({x:e.x(),y:e.y(),fontSize:t.fontSizeN?t.fontSizeN*(this.size?.height||1):jp,width:t.widthN?t.widthN*(this.size?.width||1):null});t.xN=n,t.yN=r,this.#v()}),e.on("transform",()=>{e.scaleY(1),e.setAttrs({width:e.width()*e.scaleX(),scaleX:1})}),e.on("transformend",()=>{e.setAttrs({width:Math.max(1,e.width()*e.scaleX()),scaleX:1,scaleY:1});const n=e.width(),r=this.size?.width||1;t.widthN=n/r,t.xN=e.x()/r,t.yN=e.y()/(this.size?.height||1),this.#v()}),e.on("dblclick dbltap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#z(e,t))})}renderImages(){const e=this.#e?.find(".wb-image")??[],t=new Map;e.forEach(o=>{t.set(o._whiteboardId,o)});const n=new Set(this.images.map(o=>o.id));e.forEach(o=>{n.has(o._whiteboardId)||o.destroy()});const r=(o,i)=>{const{x:s,y:a,width:l,height:u}=this.#U(o),c=t.get(o.id);if(c){Number.isFinite(s)&&c.x(s),Number.isFinite(a)&&c.y(a),Number.isFinite(l)&&c.width(l),Number.isFinite(u)&&c.height(u),c.draggable(this.#o==="select");return}if(this.#u.has(o.id))return;this.#u.add(o.id);const d=new window.Image;d.crossOrigin="Anonymous",d.onload=()=>{if(t.get(o.id)){this.#u.delete(o.id);return}if(!this.#e){this.#u.delete(o.id);return}const h=new this.#t.Image({x:s,y:a,image:d,width:l??d.width,height:u??d.height,draggable:this.#o==="select"});h.name(i),h._whiteboardId=o.id,this.#K(h,o),this.#e.add(h),this.#e.batchDraw(),this.#u.delete(o.id)},d.onerror=()=>{this.#u.delete(o.id)},d.src=o.src};this.images.forEach(o=>r(o,"wb-image"))}#K(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#r||(n.cancelBubble=!0,this.#N(e))}),e.on("dragend",()=>{const n=this.size?.width||1,r=this.size?.height||1;t.xN=e.x()/n,t.yN=e.y()/r,this.#v()}),e.on("transformend",()=>{const n=e.scaleX(),r=e.scaleY(),o=Math.max(1,e.width()*n),i=Math.max(1,e.height()*r);e.scale({x:1,y:1}),e.width(o),e.height(i);const s=this.size?.width||1,a=this.size?.height||1;t.widthN=o/s,t.heightN=i/a,t.xN=e.x()/s,t.yN=e.y()/a,this.#v()})}destroy(){this.#n&&this.#n.destroy(),this.#n=null,this.#e=null,this.#i=null,this.#a=null,this.#d=!1,this.#l=null,this.#f=[],this.#p=null,this.#s=null,window.removeEventListener("keydown",this.#q)}toJSON(){return{strokes:this.strokes,text:this.text,images:this.images}}applyData(e={}){const t=Array.isArray(e.strokes)?e.strokes:[],n=Array.isArray(e.text)?e.text:[],r=Array.isArray(e.images)?e.images:[];this.strokes=t,this.text=n,this.images=r,this.render()}#v(){this.#_&&this.#_()}addStroke(e){if(!e||!Array.isArray(e.points))return;const{pointsN:t,widthN:n}=this.#P(e);this.strokes.push({pointsN:t,widthN:n,color:e.color,type:e.type})}addText(e){if(!e||typeof e.content!="string")return;const{xN:t,yN:n,widthN:r,fontSizeN:o}=this.#g(e);this.text.push({id:e.id??yk("text"),xN:t,yN:n,content:e.content,fontSizeN:o,widthN:r}),this.render(),this.#v()}addImage(e){if(!e||!e.src)return;const{xN:t,yN:n,widthN:r,heightN:o}=this.#G(e),i={id:e.id??yk("image"),stickerId:e.stickerId??(e.type==="sticker"?e.id??null:null),xN:t,yN:n,src:e.src,widthN:r,heightN:o,type:e.type??"image"};this.images.push(i),this.render(),this.#v()}#A(){this.#s&&(this.#s.destroy(),this.#s=null,this.#p=null,this.#e?.batchDraw())}#N(e){if(!this.#e)return;this.#p=e;const t=e.name&&e.name()==="wb-text",n=t?["middle-left","middle-right"]:["top-left","top-right","bottom-left","bottom-right"],r=(o,i)=>i.width<20?o:t?{...i,height:o.height,y:o.y}:i.height<20?o:i;this.#s?(this.#s.nodes([e]),this.#s.enabledAnchors(n),this.#s.boundBoxFunc(r)):(this.#s=new this.#t.Transformer({nodes:[e],enabledAnchors:n,rotateEnabled:!1,keepRatio:!1,boundBoxFunc:r}),this.#e.add(this.#s)),this.#e.batchDraw()}#h(){if(!this.#p)return;const e=this.#p,t=e.name&&e.name(),n={"wb-text":()=>{const r=e._whiteboardId;this.text=this.text.filter(o=>o.id!==r)},"wb-image":()=>{const r=e._whiteboardId;this.images=this.images.filter(o=>o.id!==r)}}[t];n&&n(),e.destroy(),this.#A(),this.render()}#q=e=>{if(!this.#p||!this.#r||this.#o!=="select")return;const t=e.target?.tagName;t==="INPUT"||t==="TEXTAREA"||(e.key==="Backspace"||e.key==="Delete")&&(e.preventDefault(),this.#h(),this.#v())};#R(e){if(!this.#r||!this.#n)return;const t={text:()=>{const n=this.#n.getPointerPosition();n&&this.#B(n.x,n.y)},select:()=>{e?.target===this.#n&&this.#A()}}[this.#o];t&&t()}#Y(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase")return;this.#d=!0;const e=this.#n.getPointerPosition();if(!e)return;const t=this.#o==="erase",n=this.#w*this.#D();this.#f=[e.x,e.y],this.#l=new this.#t.Line({points:this.#f,stroke:this.#y,strokeWidth:t?n*3:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:t?"destination-out":"source-over"}),this.#m=n,this.#i.add(this.#l)}#X(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase"||!this.#d||!this.#l)return;const e=this.#n.getPointerPosition();e&&(this.#f.push(e.x,e.y),this.#l.points(this.#f),this.#i.batchDraw())}#I(){if(!this.#r||this.#o!=="draw"&&this.#o!=="erase"||!this.#d||!this.#l)return;this.#d=!1;const e=[];for(let r=0;r<this.#f.length;r+=2)e.push([this.#f[r],this.#f[r+1]]);const t=this.#o==="erase",n=this.#m??this.#w;this.addStroke({points:e,color:this.#y,width:t?n*3:n,type:t?"erase":"draw"}),this.#v(),this.#l=null,this.#f=[],this.#m=null}#B(e,t){if(!this.#a)return;const n=jp*this.#D(),r=bk({left:e,top:t,height:Math.ceil(n*1.4),background:"transparent",fontSize:n,color:"#2293fb"});this.#a.append(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(this.addText({x:e,y:t,content:s}),this.#o==="text"&&this.#S&&this.#S("select")),r.parentNode===this.#a&&this.#a.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}#z(e,t){if(!this.#a||!this.#n)return;this.#A();const n=e.position(),r=bk({value:e.text(),left:n.x,top:n.y,width:Math.max(e.width(),120),height:Math.max(e.height(),24),fontSize:e.fontSize(),fontFamily:e.fontFamily(),color:e.fill?e.fill():"#2293fb",background:"white",resize:"both"});this.#a.appendChild(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(e.text(s),t.content=s,this.#e.batchDraw(),this.#v()),r.parentNode&&r.parentNode.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}},kD=class extends CD{#t=null;#n=null;#e=new Map;#i=new Map;#s="select";#a=!1;#u=1;#d=null;#l=null;#f=null;constructor(e={}){super(),this.#m(e)}#m(e){this.#t=e.Renderer,this.#n=e.superdoc,this.#a=e.enabled,this.#d=e.onChange,this.#l=e.onSetData,this.#f=e.onEnabledChange}register(e,t){this.#i.set(e,t)}getType(e){return this.#i.get(e)}setTool(e){this.#s=e,this.#e.forEach(t=>t.setTool(e)),this.emit("tool",e)}getTool(){return this.#s}setEnabled(e){this.#a=e,this.#e.forEach(t=>t.setEnabled(this.#a)),this.emit("enabled",this.#a),this.#f&&this.#f(this.#a)}isEnabled(){return this.#a}setOpacity(e){const t=e;this.#u=Number.isFinite(t)?Math.min(1,Math.max(0,t)):1,this.emit("opacity",this.#u)}getOpacity(){return this.#u}getPages(){return Array.from(this.#e.values())}rerender(){this.#e.forEach(e=>e.render())}setPageSize(e,t){this.#o(e).setSize(t)}#o(e){const t=this.#e.get(e);if(t)return t;const n=new SD({Renderer:this.#t,enabled:this.#a,pageIndex:e,onChange:()=>{this.#r()},onToolChange:r=>{this.setTool(r)}});return n.setTool(this.#s),n.setEnabled(this.#a),this.#e.set(e,n),n}getPage(e){return this.#e.get(e)}getWhiteboardData(){const e={},t={};for(const n of this.#e.values())e[n.pageIndex]=n.toJSON(),n.size&&(t[n.pageIndex]={width:n.size.width,height:n.size.height,originalWidth:n.originalSize?.width??null,originalHeight:n.originalSize?.height??null});return{pages:e,meta:{pageSizes:t},version:1}}setWhiteboardData(e){this.#e.clear();const t=e?.pages||{};Object.keys(t).forEach(n=>{const r=Number(n),o=Number.isNaN(r)?n:r;this.#o(o).applyData(t[n])}),this.emit("setData",this.getPages()),this.#l&&this.#l(this.getPages()),this.#r()}#r(){const e=this.getWhiteboardData();this.emit("change",e),this.#d&&this.#d(e)}},AD=Math.PI/180;function ID(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const nc=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},bt={_global:nc,version:"10.2.5",isBrowser:ID(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return bt.angleDeg?e*AD:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return bt.DD.isDragging},isTransforming(){var e,t;return(t=(e=bt.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&t!==void 0?t:!1},isDragReady(){return!!bt.DD.node},releaseCanvasOnDestroy:!0,document:nc.document,_injectGlobal(e){typeof nc.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),nc.Konva=e}},wr=e=>{bt[e.prototype.getClassName()]=e};bt._injectGlobal(bt);var ED=`Konva.js unsupported environment.
87
+
88
+ Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
89
+
90
+ To use Konva.js in Node.js environment, you need to use the "canvas-backend" or "skia-backend" module.
91
+
92
+ bash: npm install canvas
93
+ js: import "konva/canvas-backend";
94
+
95
+ or
96
+
97
+ bash: npm install skia-canvas
98
+ js: import "konva/skia-backend";
99
+ `,wk=()=>{if(typeof document>"u")throw new Error(ED)},Ui=class oI{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new oI(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){const n=Math.cos(t),r=Math.sin(t),o=this.m[0]*n+this.m[2]*r,i=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,a=this.m[1]*-r+this.m[3]*n;return this.m[0]=o,this.m[1]=i,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){const r=this.m[0]+this.m[2]*n,o=this.m[1]+this.m[3]*n,i=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=s,this}multiply(t){const n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],o=this.m[0]*t.m[2]+this.m[2]*t.m[3],i=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,o=-this.m[2]*t,i=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=this.m[4],s=this.m[5],a=t*o-n*r,l={x:i,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){const u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=a/u,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const u=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/u):-Math.acos(r/u)),l.scaleX=a/u,l.scaleY=u,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Ie._getRotation(l.rotation),l}},xD="[object Array]",TD="[object Number]",RD="[object String]",MD="[object Boolean]",LD=Math.PI/180,PD=180/Math.PI,yf="#",DD="",OD="0",FD="Konva warning: ",Ck="Konva error: ",ND="rgb(",S0={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},BD=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Up=[],bf=null,zD=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)};const Ie={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===xD},_isNumber(e){return Object.prototype.toString.call(e)===TD&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===RD},_isBoolean(e){return Object.prototype.toString.call(e)===MD},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!="string")return!1;const t=e[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){Up.push(e),Up.length===1&&zD(function(){const t=Up;Up=[],t.forEach(function(n){n()})})},createCanvasElement(){wk();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return wk(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Ie.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(yf,DD);const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=OD+e;return yf+e},isCanvasFarblingActive(){if(bf!==null)return bf;if(typeof document>"u")return bf=!1,!1;const e=this.createCanvasElement();e.width=10,e.height=10;const t=e.getContext("2d",{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle="#282828",t.fillRect(0,0,10,10);const n=t.getImageData(0,0,10,10).data;let r=!1;for(let o=0;o<100;o++)if(n[o*4]!==40||n[o*4+1]!==40||n[o*4+2]!==40||n[o*4+3]!==255){r=!0;break}return bf=r,this.releaseCanvas(e),bf},getHitColor(){const e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),yf+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return yf+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in S0?(t=S0[e],{r:t[0],g:t[1],b:t[2]}):e[0]===yf?this._hexToRgb(e.substring(1)):e.substr(0,4)===ND?(t=BD.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",Ie._namedColorToRBA(e)||Ie._hex3ColorToRGBA(e)||Ie._hex4ColorToRGBA(e)||Ie._hex6ColorToRGBA(e)||Ie._hex8ColorToRGBA(e)||Ie._rgbColorToRGBA(e)||Ie._rgbaColorToRGBA(e)||Ie._hslColorToRGBA(e)},_namedColorToRBA(e){const t=S0[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,c=[0,0,0];for(let d=0;d<3;d++)a=r+1/3*-(d-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,c[d]=l*255;return{r:Math.round(c[0]),g:Math.round(c[1]),b:Math.round(c[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*LD},radToDeg(e){return e*PD},_degToRad(e){return Ie.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Ie.degToRad(e)},_radToDeg(e){return Ie.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Ie.radToDeg(e)},_getRotation(e){return bt.angleDeg?Ie.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(Ck+e)},error(e){console.error(Ck+e)},warn(e){bt.showWarnings&&console.warn(FD+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,o,i){let s,a,l;const u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,a=t,l=(o-n)*(o-n)+(i-r)*(i-r);else{const c=((o-e)*(n-e)+(i-t)*(r-t))/u;c<0?(s=e,a=t,l=(e-o)*(e-o)+(t-i)*(t-i)):c>1?(s=n,a=r,l=(n-o)*(n-o)+(r-i)*(r-i)):(s=e+c*(n-e),a=t+c*(r-t),l=(s-o)*(s-o)+(a-i)*(a-i))}return[s,a,l]},_getProjectionToLine(e,t,n){const r=Ie.cloneObject(e);let o=Number.MAX_VALUE;return t.forEach(function(i,s){if(!n&&s===t.length-1)return;const a=t[(s+1)%t.length],l=Ie._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],c=l[1],d=l[2];d<o&&(r.x=u,r.y=c,o=d)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=Ie._getProjectionToLine(s,r,n);i.push(a.x),i.push(a.y)}),i},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(const n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]=="object"){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||Ie._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Ie._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(const n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){bt.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},c={x:l.x-a.x,y:l.y-a.y},d=Math.hypot(u.x,u.y),h=Math.hypot(c.x,c.y);let m;typeof o=="number"?m=o:m=i<o.length?o[i]:0,m=r*Math.cos(Math.PI/n)*Math.min(1,m/r*2);const p={x:u.x/d,y:u.y/d},v={x:c.x/h,y:c.y/h},_={x:a.x-p.x*m,y:a.y-p.y*m},C={x:a.x+v.x*m,y:a.y+v.y*m};i===0?e.moveTo(_.x,_.y):e.lineTo(_.x,_.y),e.arcTo(a.x,a.y,C.x,C.y,m)}}};function VD(e){const t=[],n=e.length,r=Ie;for(let o=0;o<n;o++){let i=e[o];r._isNumber(i)?i=Math.round(i*1e3)/1e3:r._isString(i)||(i=i+""),t.push(i)}return t}var _k=",",HD="(",jD=")",UD="([",GD="])",WD=";",KD="()",qD="=",Sk=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],YD=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],XD=100,Gp=null;function kk(){if(Gp!==null)return Gp;try{const e=Ie.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(Gp=!1,!1)}catch{return Gp=!1,!1}}var Wp=class{constructor(e){this.canvas=e,bt.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,o="",i,s,a,l;for(i=0;i<r;i++)s=n[i],a=s.method,a?(l=s.args,o+=a,e?o+=KD:Ie._isArray(l[0])?o+=UD+l.join(_k)+GD:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=HD+l.join(_k)+jD)):(o+=s.property,e||(o+=qD+s.val)),o+=WD;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=XD&&t.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();t!==1&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}_applyMiterLimit(e){const t=e.attrs.miterLimit;t!=null&&this.setAttr("miterLimit",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,s,a,l){const u=arguments,c=this._context;u.length===3?c.drawImage(e,t,n):u.length===5?c.drawImage(e,t,n,r,o):u.length===9&&c.drawImage(e,t,n,r,o,i,s,a,l)}ellipse(e,t,n,r,o,i,s,a){this._context.ellipse(e,t,n,r,o,i,s,a)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=Sk.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=VD(Array.prototype.slice.call(arguments,0)),l=a.apply(e,arguments),e._trace({method:s,args:o}),l}};for(r=0;r<t;r++)i(Sk[r]);e.setAttr=function(){n.apply(e,arguments);const s=arguments[0];let a=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(a=a/this.canvas.getPixelRatio()),e._trace({property:s,val:a})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||t==="source-over"||this.setAttr("globalCompositeOperation",t)}};YD.forEach(function(e){Object.defineProperty(Wp.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var ZD=class extends Wp{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:t})}_fillColor(e){const t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&n==="color"){this._fillColor(e);return}const r=e.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&n==="linear-gradient"){this._fillLinearGradient(e);return}const i=e.getFillRadialGradientColorStops();if(i&&n==="radial-gradient"){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):o?this._fillLinearGradient(e):i&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let i=0;i<r.length;i+=2)o.addColorStop(r[i],r[i+1]);this.setAttr("strokeStyle",o)}}_stroke(e){const t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r;const o=(t=e.getShadowRGBA())!==null&&t!==void 0?t:"black",i=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(r=e.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},a=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=a.x*l,c=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(u),Math.abs(c))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*c)}},QD=class extends Wp{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const t=e.getStrokeScaleEnabled();if(!t){this.save();const o=this.getCanvas().getPixelRatio();this.setTransform(o,0,0,o,0,0)}this._applyLineCap(e);const n=e.hitStrokeWidth(),r=n==="auto"?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},Kp;function JD(){if(Kp)return Kp;const e=Ie.createCanvasElement(),t=e.getContext("2d");return Kp=(function(){return(bt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Ie.releaseCanvas(e),Kp}var k0=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1,this.pixelRatio=(e||{}).pixelRatio||bt.pixelRatio||JD(),this._canvas=Ie.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(r){return Ie.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},nl=class extends k0{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new ZD(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},A0=class extends k0{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new QD(this),this.setSize(e.width,e.height)}};const Pn={get isDragging(){let e=!1;return Pn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Pn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Pn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Ie._getFirstPointerId(e));const s=i._changedPointerPositions.find(a=>a.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){const a=o.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<a||(o.startDrag({evt:e}),!o.isDragging()))return}o._setDragPosition(e,n),t.push(o)}}),t.forEach(n=>{n.getStage()&&n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];Pn._dragElements.forEach(n=>{const{node:r}=n,o=r.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Pn.justDragged=!0,bt._mouseListenClick=!1,bt._touchListenClick=!1,bt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof bt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Pn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Pn._dragElements.delete(n)})}};bt.isBrowser&&(window.addEventListener("mouseup",Pn._endDragBefore,!0),window.addEventListener("touchend",Pn._endDragBefore,!0),window.addEventListener("touchcancel",Pn._endDragBefore,!0),window.addEventListener("mousemove",Pn._drag),window.addEventListener("touchmove",Pn._drag),window.addEventListener("mouseup",Pn._endDragAfter,!1),window.addEventListener("touchend",Pn._endDragAfter,!1),window.addEventListener("touchcancel",Pn._endDragAfter,!1));function rl(e){return Ie._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Ie._isBoolean(e)?e:Object.prototype.toString.call(e)}function Ak(e){return e>255?255:e<0?0:Math.round(e)}function mt(){if(bt.isUnminified)return function(e,t){return Ie._isNumber(e)||Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function qp(e){if(bt.isUnminified)return function(t,n){let r=Ie._isNumber(t),o=Ie._isArray(t)&&t.length==e;return!r&&!o&&Ie.warn(rl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function I0(){if(bt.isUnminified)return function(e,t){return Ie._isNumber(e)||e==="auto"||Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function rc(){if(bt.isUnminified)return function(e,t){return Ie._isString(e)||Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function Ik(){if(bt.isUnminified)return function(e,t){const n=Ie._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function $D(){if(bt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Ie._isArray(e)?e.forEach(function(r){Ie._isNumber(r)||Ie.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function Gi(){if(bt.isUnminified)return function(e,t){return e===!0||e===!1||Ie.warn(rl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function eO(e){if(bt.isUnminified)return function(t,n){return t==null||Ie.isObject(t)||Ie.warn(rl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var wf="get",Cf="set";const ce={addGetterSetter(e,t,n,r,o){ce.addGetter(e,t,n),ce.addSetter(e,t,r,o),ce.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=wf+Ie._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const o=this.attrs[t];return o===void 0?n:o}},addSetter(e,t,n,r){const o=Cf+Ie._capitalize(t);e.prototype[o]||ce.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Cf+Ie._capitalize(t);e.prototype[o]=function(i){return n&&i!==void 0&&i!==null&&(i=n.call(this,i,t)),this._setAttr(t,i),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){const i=n.length,s=Ie._capitalize,a=wf+s(t),l=Cf+s(t);e.prototype[a]=function(){const c={};for(let d=0;d<i;d++){const h=n[d];c[h]=this.getAttr(t+s(h))}return c};const u=eO(n);e.prototype[l]=function(c){const d=this.attrs[t];r&&(c=r.call(this,c,t)),u&&u.call(this,c,t);for(const h in c)c.hasOwnProperty(h)&&this._setAttr(t+s(h),c[h]);return c||n.forEach(h=>{this._setAttr(t+s(h),void 0)}),this._fireChangeEvent(t,d,c),o&&o.call(this),this},ce.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Ie._capitalize(t),r=Cf+n,o=wf+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Ie.error("Adding deprecated "+t);const o=wf+Ie._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Ie.error(i);const s=this.attrs[t];return s===void 0?n:s},ce.addSetter(e,t,r,function(){Ie.error(i)}),ce.addOverloadedGetterSetter(e,t)},backCompat(e,t){Ie.each(t,function(n,r){const o=e.prototype[r],i=wf+Ie._capitalize(n),s=Cf+Ie._capitalize(n);function a(){o.apply(this,arguments),Ie.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}e.prototype[n]=a,e.prototype[i]=a,e.prototype[s]=a})},afterSetFilter(){this._filterUpToDate=!1}};function tO(e){const t=/(\w+)\(([^)]+)\)/g;let n;for(;(n=t.exec(e))!==null;){const[,r,o]=n;switch(r){case"blur":{const i=parseFloat(o.replace("px",""));return function(s){this.blurRadius(i*.5);const a=bt.Filters;a&&a.Blur&&a.Blur.call(this,s)}}case"brightness":{const i=o.includes("%")?parseFloat(o)/100:parseFloat(o);return function(s){this.brightness(i);const a=bt.Filters;a&&a.Brightness&&a.Brightness.call(this,s)}}case"contrast":{const i=parseFloat(o);return function(s){const a=100*(Math.sqrt(i)-1);this.contrast(a);const l=bt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=bt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=bt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=bt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Ie.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Yp="absoluteOpacity",Ek="allEventListeners",ua="absoluteTransform",xk="absoluteScale",oc="canvas",nO="Change",rO="children",oO="konva",E0="listening",iO="mouseenter",sO="mouseleave",aO="pointerenter",lO="pointerleave",cO="touchenter",uO="touchleave",Tk="set",Rk="Shape",Xp=" ",Mk="stage",ol="transform",dO="Stage",x0="visible",fO=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Xp),hO=1,wt=class ih{constructor(t){this._id=hO++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===ol||t===ua)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){let r=this._cache.get(t);return(r===void 0||(t===ol||t===ua)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const o=n.map(i=>i+"Change.konva").join(Xp);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(oc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===ua&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(oc)){const{scene:t,filter:n,hit:r}=this._cache.get(oc);Ie.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(oc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!o||!i){Ie.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const h=Math.abs(Math.round(r.x)-a)>.5?1:0,m=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+h,i+=u*2+m,a-=u,l-=u;const p=new nl({pixelRatio:s,width:o,height:i}),v=new nl({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),_=new A0({pixelRatio:d,width:o,height:i}),C=p.getContext(),k=_.getContext(),y=new nl({width:p.width/p.pixelRatio+Math.abs(a),height:p.height/p.pixelRatio+Math.abs(l),pixelRatio:p.pixelRatio}),b=y.getContext();return _.isCache=!0,p.isCache=!0,this._cache.delete(oc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(p.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),C.save(),k.save(),b.save(),C.translate(-a,-l),k.translate(-a,-l),b.translate(-a,-l),y.x=a,y.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Yp),this._clearSelfAndDescendantCache(xk),this.drawScene(p,this,y),this.drawHit(_,this),this._isUnderCache=!1,C.restore(),k.restore(),c&&(C.save(),C.beginPath(),C.rect(0,0,o,i),C.closePath(),C.setAttr("strokeStyle","red"),C.setAttr("lineWidth",5),C.stroke(),C.restore()),Ie.releaseCanvas(y._canvas),this._cache.set(oc,{scene:p,filter:v,hit:_,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(oc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){const r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let o=1/0,i=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const c=l.point(u);o===void 0&&(o=s=c.x,i=a=c.y),o=Math.min(o,c.x),i=Math.min(i,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:o,y:i,width:s-o,height:a-i}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),o=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/o,r.height/o),t.restore()}_drawCachedHitCanvas(t){const n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),n=this._getCanvasCache(),r=n.scene,o=n.filter,i=o.getContext(),s,a,l,u;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let c=!0;for(let h=0;h<t.length;h++)if(typeof t[h]=="string"&&kk(),typeof t[h]!="string"||!kk()){c=!1;break}const d=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),c){const h=t.join(" ");return i.save(),i.setAttr("filter",h),i.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=tO(u)),u.call(this,a),i.putImageData(a,0,0)}catch(h){Ie.error("Unable to apply filter. "+h.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,o}on(...t){const n=t[0],r=t[1];if(t[2],this._cache&&this._cache.delete(Ek),t.length===3)return this._delegate.apply(this,t);const o=n.split(Xp);for(let i=0;i<o.length;i++){const s=o[i].split("."),a=s[0],l=s[1]||"";this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:l,handler:r})}return this}off(t,n){let r=(t||"").split(Xp),o=r.length,i,s,a,l,u,c;if(this._cache&&this._cache.delete(Ek),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),u=l[0],c=l[1],u)this.eventListeners[u]&&this._off(u,c,n);else for(s in this.eventListeners)this._off(s,c,n);return this}dispatchEvent(t){const n={target:this,type:t.type,evt:t};return this.fire(t.type,n),this}addEventListener(t,n){return this.on(t,function(r){n.call(this,r.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,n,r){const o=this;return this.on(t,function(i){const s=i.target.findAncestors(n,!0,o);for(let a=0;a<s.length;a++)i=Ie.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Pn._dragElements.delete(this._id),Pn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Pn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ua),this._clearSelfAndDescendantCache(Yp),this._clearSelfAndDescendantCache(xk),this._clearSelfAndDescendantCache(Mk),this._clearSelfAndDescendantCache(x0),this._clearSelfAndDescendantCache(E0)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const n="get"+Ie._capitalize(t);return Ie._isFunction(this[n])?this[n]():this.attrs[t]}getAncestors(){let t=this.getParent(),n=[];for(;t;)n.push(t),t=t.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let n,r;if(!t)return this;for(n in t)n!==rO&&(r=Tk+Ie._capitalize(n),Ie._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(E0,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(x0,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);const r=this.getLayer();let o=!1;Pn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!bt.hitOnDragEnabled&&(o||bt.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),n=this,r=0,o,i,s,a;function l(c){for(o=[],i=c.length,s=0;s<i;s++)a=c[s],r++,a.nodeType!==Rk&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const u=this.getStage();return n.nodeType!==dO&&u&&l(u.getChildren()),r}getDepth(){let t=0,n=this.parent;for(;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ol),this._clearSelfAndDescendantCache(ua)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const n=t.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);const o=this.getAbsoluteTransform(t).getMatrix(),i=new Ui,s=this.offset();return i.m=o.slice(),i.translate(s.x,s.y),i.getTranslation()}setAbsolutePosition(t){const{x:n,y:r,...o}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(ol);const i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(o),this.setPosition({x:t.x,y:t.y}),this._clearCache(ol),this._clearSelfAndDescendantCache(ua),this}_setTransform(t){let n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let n=t.x,r=t.y,o=this.x(),i=this.y();return n!==void 0&&(o+=n),r!==void 0&&(i+=r),this.setPosition({x:o,y:i}),this}_eachAncestorReverse(t,n){let r=[],o=this.getParent(),i,s;if(!(n&&n._id===this._id)){for(r.unshift(this);o&&(!n||o._id!==n._id);)r.unshift(o),o=o.parent;for(i=r.length,s=0;s<i;s++)t(r[s])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Ie.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Ie.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Ie.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Ie.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Ie.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ie.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Yp,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t=this.getAttrs(),n,r,o,i,s;const a={attrs:{},className:this.getClassName()};for(n in t)r=t[n],s=Ie.isObject(r)&&!Ie._isPlainObject(r)&&!Ie._isArray(r),!s&&(o=typeof this[n]=="function"&&this[n],delete t[n],i=o?o.call(this):null,t[n]=r,i!==r&&(a.attrs[n]=r));return Ie._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){const o=[];n&&this._isMatch(t)&&o.push(this);let i=this.parent;for(;i;){if(i===r)return o;i._isMatch(t)&&o.push(i),i=i.parent}return o}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);let n=t.replace(/ /g,"").split(","),r=n.length,o,i;for(o=0;o<r;o++)if(i=n[o],Ie.isValidSelector(i)||(Ie.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ie.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ie.warn("Konva is awesome, right?")),i.charAt(0)==="#"){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)==="."){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(Mk,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,n={},r){return n.target=n.target||this,r?this._fireAndBubble(t,n):this._fire(t,n),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(ua,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new Ui,this._eachAncestorReverse(function(r){const o=r.transformsEnabled();o==="all"?n.multiply(r.getTransform()):o==="position"&&n.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),n;{n=this._cache.get(ua)||new Ui,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const r=this.transformsEnabled();if(r==="all")n.multiply(this.getTransform());else if(r==="position"){const o=this.attrs.x||0,i=this.attrs.y||0,s=this.attrs.offsetX||0,a=this.attrs.offsetY||0;n.translate(o-s,i-a)}return n.dirty=!1,n}}getAbsoluteScale(t){let n=this;for(;n;)n._isUnderCache&&(t=n),n=n.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(ol,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(ol)||new Ui;r.reset();const o=this.x(),i=this.y(),s=bt.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,c=this.attrs.skewY||0,d=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||c!==0)&&r.skew(u,c),(a!==1||l!==1)&&r.scale(a,l),(d!==0||h!==0)&&r.translate(-1*d,-1*h),r.dirty=!1,r}clone(t){let n=Ie.cloneObject(this.attrs),r,o,i,s,a;for(r in t)n[r]=t[r];const l=new this.constructor(n);for(r in this.eventListeners)for(o=this.eventListeners[r],i=o.length,s=0;s<i;s++)a=o[s],a.name.indexOf(oO)<0&&(l.eventListeners[r]||(l.eventListeners[r]=[]),l.eventListeners[r].push(a));return l}_toKonvaCanvas(t){t=t||{};const n=this.getClientRect(),r=this.getStage(),o=t.x!==void 0?t.x:Math.floor(n.x),i=t.y!==void 0?t.y:Math.floor(n.y),s=t.pixelRatio||1,a=new nl({width:t.width||Math.ceil(n.width)||(r?r.width():0),height:t.height||Math.ceil(n.height)||(r?r.height():0),pixelRatio:s}),l=a.getContext(),u=new nl({width:a.width/a.pixelRatio+Math.abs(o),height:a.height/a.pixelRatio+Math.abs(i),pixelRatio:a.pixelRatio});return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(o||i)&&l.translate(-1*o,-1*i),this.drawScene(a,void 0,u),l.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};const n=t.mimeType||null,r=t.quality||null,o=this._toKonvaCanvas(t).toDataURL(n,r);return t.callback&&t.callback(o),o}toImage(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,Ie._urlToImage(this.toDataURL(t),function(i){n(i),o?.(i)})}catch(o){r(o)}})}toBlob(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,this.toCanvas(t).toBlob(i=>{n(i),o?.(i)},t?.mimeType,t?.quality)}catch(o){r(o)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():bt.dragDistance}_off(t,n,r){let o=this.eventListeners[t],i,s,a;for(i=0;i<o.length;i++)if(s=o[i].name,a=o[i].handler,(s!=="konva"||n==="konva")&&(!n||s===n)&&(!r||r===a)){if(o.splice(i,1),o.length===0){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,n,r){this._fire(t+nO,{oldVal:n,newVal:r})}addName(t){if(!this.hasName(t)){const n=this.name(),r=n?n+" "+t:t;this.name(r)}return this}hasName(t){if(!t)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(t)!==-1:!1}removeName(t){const n=(this.name()||"").split(/\s/g),r=n.indexOf(t);return r!==-1&&(n.splice(r,1),this.name(n.join(" "))),this}setAttr(t,n){const r=this[Tk+Ie._capitalize(t)];return Ie._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(bt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Ie.isObject(n)||(n==null?delete this.attrs[t]:this.attrs[t]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(t,r,n),this._requestDraw())}_setComponentAttr(t,n,r){let o;r!==void 0&&(o=this.attrs[t],o||(this.attrs[t]=this.getAttr(t)),this.attrs[t][n]=r,this._fireChangeEvent(t,o,r))}_fireAndBubble(t,n,r){n&&this.nodeType===Rk&&(n.target=this);const o=[iO,sO,aO,lO,cO,uO];if(!(o.indexOf(t)!==-1&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r))){this._fire(t,n);const i=o.indexOf(t)!==-1&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!i&&(r&&r.parent?this._fireAndBubble.call(this.parent,t,n,r):this._fireAndBubble.call(this.parent,t,n))}}_getProtoListeners(t){var n,r;const{nodeType:o}=this,i=ih.protoListenerMap.get(o)||{};let s=i?.[t];if(s===void 0){s=[];let a=Object.getPrototypeOf(this);for(;a;){const l=(r=(n=a.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];s.push(...l),a=Object.getPrototypeOf(a)}i[t]=s,ih.protoListenerMap.set(o,i)}return s}_fire(t,n){n=n||{},n.currentTarget=this,n.type=t;const r=this._getProtoListeners(t);if(r){const i=r.slice();for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}const o=this.eventListeners[t];if(o){const i=o.slice(),s=i.length;for(let l=0;l<i.length;l++)i[l].handler.call(this,n);const a=this.eventListeners[t];if(a)for(let l=s;l<a.length;l++)a[l].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const n=t?t.pointerId:void 0,r=this.getStage(),o=this.getAbsolutePosition();if(!r)return;const i=r._getPointerById(n)||r._changedPointerPositions[0]||o;Pn._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-o.x,y:i.y-o.y},dragStatus:"ready",pointerId:n,startEvent:t})}startDrag(t,n=!0){Pn._dragElements.has(this._id)||this._createDragElement(t);const r=Pn._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:r.startEvent&&r.startEvent.evt||t&&t.evt},n)}_setDragPosition(t,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let o={x:r.x-n.offset.x,y:r.y-n.offset.y};const i=this.dragBoundFunc();if(i!==void 0){const s=i.call(this,o,t);s?o=s:Ie.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==o.x||this._lastPos.y!==o.y)&&(this.setAbsolutePosition(o),this._requestDraw()),this._lastPos=o}stopDrag(t){const n=Pn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Pn._endDragBefore(t),Pn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Pn._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||bt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Pn._dragElements.forEach(r=>{this.isAncestorOf(r.node)&&(n=!0)}),n||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=Pn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Pn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Ie.haveIntersection(r,this.getClientRect())}static create(t,n){return Ie._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=ih.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),bt[r]||(Ie.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=bt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(ih._createNode(o[a]));return i}};wt.protoListenerMap=new Map,wt.prototype.nodeType="Node",wt.prototype._attrsAffectingSize=[],wt.prototype.eventListeners={},wt.prototype.on(fO,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(ol),this._clearSelfAndDescendantCache(ua)}),wt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(x0)}),wt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(E0)}),wt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Yp)});var Qn=ce.addGetterSetter;Qn(wt,"zIndex"),Qn(wt,"absolutePosition"),Qn(wt,"position"),Qn(wt,"x",0,mt()),Qn(wt,"y",0,mt()),Qn(wt,"globalCompositeOperation","source-over",rc()),Qn(wt,"opacity",1,mt()),Qn(wt,"name","",rc()),Qn(wt,"id","",rc()),Qn(wt,"rotation",0,mt()),ce.addComponentsGetterSetter(wt,"scale",["x","y"]),Qn(wt,"scaleX",1,mt()),Qn(wt,"scaleY",1,mt()),ce.addComponentsGetterSetter(wt,"skew",["x","y"]),Qn(wt,"skewX",0,mt()),Qn(wt,"skewY",0,mt()),ce.addComponentsGetterSetter(wt,"offset",["x","y"]),Qn(wt,"offsetX",0,mt()),Qn(wt,"offsetY",0,mt()),Qn(wt,"dragDistance",void 0,mt()),Qn(wt,"width",0,mt()),Qn(wt,"height",0,mt()),Qn(wt,"listening",!0,Gi()),Qn(wt,"preventDefault",!0,Gi()),Qn(wt,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),Qn(wt,"visible",!0,Gi()),Qn(wt,"transformsEnabled","all",rc()),Qn(wt,"size"),Qn(wt,"dragBoundFunc"),Qn(wt,"draggable",!1,Gi()),ce.backCompat(wt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var pi=class extends wt{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(r=>{const o=r._isMatch(e);return o&&n.push(r),!!(o&&t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){const e=wt.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=wt.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,c=n===this;if(u){i.save();const h=this.getAbsoluteTransform(n);let m=h.getMatrix();i.transform(m[0],m[1],m[2],m[3],m[4],m[5]),i.beginPath();let p;if(l)p=l.call(this,i,this);else{const v=this.clipX(),_=this.clipY();i.rect(v||0,_||0,s,a)}i.clip.apply(i,p),m=h.copy().invert().getMatrix(),i.transform(m[0],m[1],m[2],m[3],m[4],m[5])}const d=!c&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";d&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(h){h[e](t,n,r)}),d&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(h){if(!h.visible())return;const m=h.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});m.width===0&&m.height===0||(o===void 0?(o=m.x,i=m.y,s=m.x+m.width,a=m.y+m.height):(o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x+m.width),a=Math.max(a,m.y+m.height)))});const c=this.find("Shape");let d=!1;for(let h=0;h<c.length;h++)if(c[h]._isVisible(this)){d=!0;break}return d&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};ce.addComponentsGetterSetter(pi,"clip",["x","y","width","height"]),ce.addGetterSetter(pi,"clipX",void 0,mt()),ce.addGetterSetter(pi,"clipY",void 0,mt()),ce.addGetterSetter(pi,"clipWidth",void 0,mt()),ce.addGetterSetter(pi,"clipHeight",void 0,mt()),ce.addGetterSetter(pi,"clipFunc");var _f=new Map,Lk=bt._global.PointerEvent!==void 0;function T0(e){return _f.get(e)}function R0(e){return{evt:e,pointerId:e.pointerId}}function Pk(e,t){return _f.get(e)===t}function Dk(e,t){Sf(e),t.getStage()&&(_f.set(e,t),Lk&&t._fire("gotpointercapture",R0(new PointerEvent("gotpointercapture"))))}function Sf(e,t){const n=_f.get(e);if(!n)return;const r=n.getStage();r&&r.content,_f.delete(e),Lk&&n._fire("lostpointercapture",R0(new PointerEvent("lostpointercapture")))}var pO="Stage",mO="string",Ok="px",gO="mouseout",Fk="mouseleave",Nk="mouseover",Bk="mouseenter",zk="mousemove",Vk="mousedown",Hk="mouseup",kf="pointermove",Af="pointerdown",gu="pointerup",If="pointercancel",vO="lostpointercapture",Zp="pointerout",Ef="pointerleave",Qp="pointerover",Jp="pointerenter",M0="contextmenu",jk="touchstart",Uk="touchend",Gk="touchmove",Wk="touchcancel",L0="wheel",yO=5,bO=[[Bk,"_pointerenter"],[Vk,"_pointerdown"],[zk,"_pointermove"],[Hk,"_pointerup"],[Fk,"_pointerleave"],[jk,"_pointerdown"],[Gk,"_pointermove"],[Uk,"_pointerup"],[Wk,"_pointercancel"],[Nk,"_pointerover"],[L0,"_wheel"],[M0,"_contextmenu"],[Af,"_pointerdown"],[kf,"_pointermove"],[gu,"_pointerup"],[If,"_pointercancel"],[Ef,"_pointerleave"],[vO,"_lostpointercapture"]],P0={mouse:{[Zp]:gO,[Ef]:Fk,[Qp]:Nk,[Jp]:Bk,[kf]:zk,[Af]:Vk,[gu]:Hk,[If]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Zp]:"touchout",[Ef]:"touchleave",[Qp]:"touchover",[Jp]:"touchenter",[kf]:Gk,[Af]:jk,[gu]:Uk,[If]:Wk,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Zp]:Zp,[Ef]:Ef,[Qp]:Qp,[Jp]:Jp,[kf]:kf,[Af]:Af,[gu]:gu,[If]:If,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},xf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",vu=e=>{const t=xf(e);if(t==="pointer")return bt.pointerEventsEnabled&&P0.pointer;if(t==="touch")return P0.touch;if(t==="mouse")return P0.mouse};function Kk(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Ie.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var wO="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";const Tf=[];var $p=class extends pi{constructor(e){super(Kk(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Tf.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Kk(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Ie.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===mO){let t;if(e.charAt(0)==="."){const n=e.slice(1);e=document.getElementsByClassName(n)[0]}else e.charAt(0)!=="#"?t=e:t=e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),pi.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Ie._isInDocument(e)&&this.container().removeChild(e);const t=Tf.indexOf(this);return t>-1&&Tf.splice(t,1),Ie.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Ie.warn(wO),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new nl({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(o){if(!o.isVisible())return;const i=o._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children,n=t.length-1;for(let r=n;r>=0;r--){const o=t[r].getIntersection(e);if(o)return o}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+Ok,this.content.style.height=t+Ok),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(e);const n=this.children.length;return n>yO&&Ie.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),bt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Pk(e,this)}setPointerCapture(e){Dk(e,this)}releaseCapture(e){Sf(e,this)}getLayers(){return this.children}_bindContentEvents(){bt.isBrowser&&bO.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=vu(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=vu(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=vu(e.type),n=xf(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(bt.isDragging()||bt.isTransforming())||bt.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=vu(e.type),n=xf(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Pn.justDragged=!1,bt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}bt.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const s=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=vu(e.type),n=xf(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(bt.isDragging()&&Pn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(bt.isDragging()||bt.isTransforming())||bt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=T0(a.id)||this.getIntersection(a),u=a.id,c={evt:e,pointerId:u},d=s!==l;if(d&&s&&(s._fireAndBubble(t.pointerout,{...c},l),s._fireAndBubble(t.pointerleave,{...c},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,d&&(l._fireAndBubble(t.pointerover,{...c},s),l._fireAndBubble(t.pointerenter,{...c},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...c})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=vu(e.type),n=xf(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"],i={};let s=!1;this._changedPointerPositions.forEach(a=>{const l=T0(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,c={evt:e,pointerId:u};let d=!1;bt["_"+n+"InDblClickWindow"]?(d=!0,clearTimeout(this[n+"DblTimeout"])):Pn.justDragged||(bt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){bt["_"+n+"InDblClickWindow"]=!1},bt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...c}),bt["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...c}),d&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,{...c}))):(this[n+"ClickEndShape"]=null,s||(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),bt["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),d&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),bt["_"+n+"ListenClick"]=!1,e.cancelable&&n!=="touch"&&n!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(M0,{evt:e}):this._fire(M0,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(L0,{evt:e}):this._fire(L0,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=T0(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(gu,R0(e)),Sf(e.pointerId)}_lostpointercapture(e){Sf(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:Ie._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Ie._getFirstPointerId(e)}])}_setPointerPosition(e){Ie.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new nl({width:this.width(),height:this.height()}),this.bufferHitCanvas=new A0({pixelRatio:1,width:this.width(),height:this.height()}),!bt.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return Ie.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};$p.prototype.nodeType=pO,wr($p),ce.addGetterSetter($p,"container"),bt.isBrowser&&document.addEventListener("visibilitychange",()=>{Tf.forEach(e=>{e.batchDraw()})});var qk="hasShadow",Yk="shadowRGBA",Xk="patternImage",Zk="linearGradient",Qk="radialGradient",em;function D0(){return em||(em=Ie.createCanvasElement().getContext("2d"),em)}const Rf={};function CO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function _O(e){e.stroke()}function SO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function kO(e){e.stroke()}function AO(){this._clearCache(qk)}function IO(){this._clearCache(Yk)}function EO(){this._clearCache(Xk)}function xO(){this._clearCache(Zk)}function TO(){this._clearCache(Qk)}var dt=class extends wt{constructor(e){super(e);let t,n=0;for(;t=Ie.getHitColor(),!(t&&!(t in Rf));)if(n++,n>=1e4){Ie.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),t=Ie.getRandomColor();break}this.colorKey=t,Rf[t]=this}getContext(){return Ie.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Ie.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(qk,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Xk,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=D0().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Ui;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(bt.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r=typeof DOMMatrix>"u"?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(Zk,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=D0(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}_getRadialGradient(){return this._getCache(Qk,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=D0(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),o=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}getShadowRGBA(){return this._getCache(Yk,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Ie.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return wt.prototype.destroy.call(this),delete Rf[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!(!((t=this.attrs.perfectDrawEnabled)!==null&&t!==void 0)||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=this.getAbsoluteOpacity()!==1;if(n&&r&&o)return!0;const i=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(n&&r&&i&&s)}setStrokeHitEnabled(e){Ie.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),c=u?this.shadowOffsetX():0,d=u?this.shadowOffsetY():0,h=a+Math.abs(c),m=l+Math.abs(d),p=u&&this.shadowBlur()||0,v={width:h+p*2,height:m+p*2,x:-(s/2+p)+Math.min(c,0)+i.x,y:-(s/2+p)+Math.min(d,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const c=this.getAbsoluteTransform(t).getMatrix();return o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const c=n||l.bufferCanvas,d=c.getContext();n?(d.save(),d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height),d.restore()):d.clear(),d.save(),d._applyLineJoin(this),d._applyMiterLimit(this);const h=this.getAbsoluteTransform(t).getMatrix();d.transform(h[0],h[1],h[2],h[3],h[4],h[5]),s.call(this,d,this),d.restore();const m=c.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(c._canvas,c.x||0,c.y||0,c.width/m,c.height/m)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const c=this.getAbsoluteTransform(t).getMatrix();o.transform(c[0],c[1],c[2],c[3],c[4],c[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Ie.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();const u=this.getAbsoluteTransform(t).getMatrix();return i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,o=r.getContext(),i=r.getWidth(),s=r.getHeight();o.clear(),o.drawImage(n._canvas,0,0,i,s);try{const a=o.getImageData(0,0,i,s),l=a.data,u=l.length,c=Ie._hexToRgb(this.colorKey);for(let d=0;d<u;d+=4)l[d+3]>e?(l[d]=c.r,l[d+1]=c.g,l[d+2]=c.b,l[d+3]=255):l[d+3]=0;o.putImageData(a,0,0)}catch(a){Ie.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return Pk(e,this)}setPointerCapture(e){Dk(e,this)}releaseCapture(e){Sf(e,this)}};dt.prototype._fillFunc=CO,dt.prototype._strokeFunc=_O,dt.prototype._fillFuncHit=SO,dt.prototype._strokeFuncHit=kO,dt.prototype._centroid=!1,dt.prototype.nodeType="Shape",wr(dt),dt.prototype.eventListeners={},dt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",AO),dt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",IO),dt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",EO),dt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",xO),dt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",TO),ce.addGetterSetter(dt,"stroke",void 0,Ik()),ce.addGetterSetter(dt,"strokeWidth",2,mt()),ce.addGetterSetter(dt,"fillAfterStrokeEnabled",!1),ce.addGetterSetter(dt,"hitStrokeWidth","auto",I0()),ce.addGetterSetter(dt,"strokeHitEnabled",!0,Gi()),ce.addGetterSetter(dt,"perfectDrawEnabled",!0,Gi()),ce.addGetterSetter(dt,"shadowForStrokeEnabled",!0,Gi()),ce.addGetterSetter(dt,"lineJoin"),ce.addGetterSetter(dt,"lineCap"),ce.addGetterSetter(dt,"miterLimit"),ce.addGetterSetter(dt,"sceneFunc"),ce.addGetterSetter(dt,"hitFunc"),ce.addGetterSetter(dt,"dash"),ce.addGetterSetter(dt,"dashOffset",0,mt()),ce.addGetterSetter(dt,"shadowColor",void 0,rc()),ce.addGetterSetter(dt,"shadowBlur",0,mt()),ce.addGetterSetter(dt,"shadowOpacity",1,mt()),ce.addComponentsGetterSetter(dt,"shadowOffset",["x","y"]),ce.addGetterSetter(dt,"shadowOffsetX",0,mt()),ce.addGetterSetter(dt,"shadowOffsetY",0,mt()),ce.addGetterSetter(dt,"fillPatternImage"),ce.addGetterSetter(dt,"fill",void 0,Ik()),ce.addGetterSetter(dt,"fillPatternX",0,mt()),ce.addGetterSetter(dt,"fillPatternY",0,mt()),ce.addGetterSetter(dt,"fillLinearGradientColorStops"),ce.addGetterSetter(dt,"strokeLinearGradientColorStops"),ce.addGetterSetter(dt,"fillRadialGradientStartRadius",0),ce.addGetterSetter(dt,"fillRadialGradientEndRadius",0),ce.addGetterSetter(dt,"fillRadialGradientColorStops"),ce.addGetterSetter(dt,"fillPatternRepeat","repeat"),ce.addGetterSetter(dt,"fillEnabled",!0),ce.addGetterSetter(dt,"strokeEnabled",!0),ce.addGetterSetter(dt,"shadowEnabled",!0),ce.addGetterSetter(dt,"dashEnabled",!0),ce.addGetterSetter(dt,"strokeScaleEnabled",!0),ce.addGetterSetter(dt,"fillPriority","color"),ce.addComponentsGetterSetter(dt,"fillPatternOffset",["x","y"]),ce.addGetterSetter(dt,"fillPatternOffsetX",0,mt()),ce.addGetterSetter(dt,"fillPatternOffsetY",0,mt()),ce.addComponentsGetterSetter(dt,"fillPatternScale",["x","y"]),ce.addGetterSetter(dt,"fillPatternScaleX",1,mt()),ce.addGetterSetter(dt,"fillPatternScaleY",1,mt()),ce.addComponentsGetterSetter(dt,"fillLinearGradientStartPoint",["x","y"]),ce.addComponentsGetterSetter(dt,"strokeLinearGradientStartPoint",["x","y"]),ce.addGetterSetter(dt,"fillLinearGradientStartPointX",0),ce.addGetterSetter(dt,"strokeLinearGradientStartPointX",0),ce.addGetterSetter(dt,"fillLinearGradientStartPointY",0),ce.addGetterSetter(dt,"strokeLinearGradientStartPointY",0),ce.addComponentsGetterSetter(dt,"fillLinearGradientEndPoint",["x","y"]),ce.addComponentsGetterSetter(dt,"strokeLinearGradientEndPoint",["x","y"]),ce.addGetterSetter(dt,"fillLinearGradientEndPointX",0),ce.addGetterSetter(dt,"strokeLinearGradientEndPointX",0),ce.addGetterSetter(dt,"fillLinearGradientEndPointY",0),ce.addGetterSetter(dt,"strokeLinearGradientEndPointY",0),ce.addComponentsGetterSetter(dt,"fillRadialGradientStartPoint",["x","y"]),ce.addGetterSetter(dt,"fillRadialGradientStartPointX",0),ce.addGetterSetter(dt,"fillRadialGradientStartPointY",0),ce.addComponentsGetterSetter(dt,"fillRadialGradientEndPoint",["x","y"]),ce.addGetterSetter(dt,"fillRadialGradientEndPointX",0),ce.addGetterSetter(dt,"fillRadialGradientEndPointY",0),ce.addGetterSetter(dt,"fillPatternRotation",0),ce.addGetterSetter(dt,"fillRule",void 0,rc()),ce.backCompat(dt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var RO="beforeDraw",MO="draw",Jk=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],LO=Jk.length,ic=class extends pi{constructor(e){super(e),this.canvas=new nl,this.hitCanvas=new A0({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){wt.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!wt.prototype.moveUp.call(this))return!1;const e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(wt.prototype.moveDown.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(wt.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return wt.prototype.remove.call(this),e&&e.parentNode&&Ie._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Ie.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),wt.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Ie.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Ie.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Ie.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<LO;r++){const o=Jk[r],i=this._getIntersection({x:e.x+o.x*t,y:e.y+o.y*t}),s=i.shape;if(s)return s;if(n=!!i.antialiased,!i.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){const o=Rf[Ie.getHitColorKey(n[0],n[1],n[2])];return o?{shape:o}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas();return this._fire(RO,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),pi.prototype.drawScene.call(this,o,t,n),this._fire(MO,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),pi.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Ie.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Ie.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Ie.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};ic.prototype.nodeType="Layer",wr(ic),ce.addGetterSetter(ic,"imageSmoothingEnabled",!0),ce.addGetterSetter(ic,"clearBeforeDraw",!0),ce.addGetterSetter(ic,"hitGraphEnabled",!0,Gi());var O0=class extends ic{constructor(e){super(e),this.listening(!1),Ie.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};O0.prototype.nodeType="FastLayer",wr(O0);var yu=class extends pi{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Ie.throw("You may only add groups and shapes to groups.")}};yu.prototype.nodeType="Group",wr(yu);var F0=(function(){return nc.performance&&nc.performance.now?function(){return nc.performance.now()}:function(){return new Date().getTime()}})(),bu=class td{constructor(t,n){this.id=td.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:F0(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){let n=[];return t&&(n=Array.isArray(t)?t:[t]),this.layers=n,this}getLayers(){return this.layers}addLayer(t){const n=this.layers,r=n.length;for(let o=0;o<r;o++)if(n[o]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=td.animations,n=t.length;for(let r=0;r<n;r++)if(t[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=F0(),td._addAnimation(this),this}stop(){return td._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const n=t.id,r=this.animations,o=r.length;for(let i=0;i<o;i++)if(r[i].id===n){this.animations.splice(i,1);break}}static _runFrames(){const t={},n=this.animations;for(let r=0;r<n.length;r++){const o=n[r],i=o.layers,s=o.func;o._updateFrameObject(F0());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let u=0;u<a;u++){const c=i[u];c._id!==void 0&&(t[c._id]=c)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=td;t.animations.length?(t._runFrames(),Ie.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Ie.requestAnimFrame(this._animationLoop))}};bu.animations=[],bu.animIdCounter=0,bu.animRunning=!1;var PO={node:1,duration:1,easing:1,onFinish:1,yoyo:1},DO=1,$k=2,e4=3,t4=["fill","stroke","shadowColor"],OO=0,FO=class{constructor(e,t,n,r,o,i,s){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=i,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=o-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=$k,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=e4,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===$k?this.setTime(e):this.state===e4&&this.setTime(this.duration-e)}pause(){this.state=DO,this.fire("onPause")}getTimer(){return new Date().getTime()}},tm=class Lr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||Mf.Linear,s=!!t.yoyo;let a,l;typeof t.duration>"u"?a=.3:t.duration===0?a=.001:a=t.duration,this.node=r,this._id=OO++;const u=r.getLayer()||(r instanceof bt.Stage?r.getLayers():null);u||Ie.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new bu(function(){n.tween.onEnterFrame()},u),this.tween=new FO(l,function(c){n._tweenFunc(c)},i,0,1,a*1e3,s),this._addListeners(),Lr.attrs[o]||(Lr.attrs[o]={}),Lr.attrs[o][this._id]||(Lr.attrs[o][this._id]={}),Lr.tweens[o]||(Lr.tweens[o]={});for(l in t)PO[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){const r=this.node,o=r._id;let i,s,a,l,u;const c=Lr.tweens[o][t];c&&delete Lr.attrs[o][c][t];let d=r.getAttr(t);if(Ie._isArray(n))if(i=[],s=Math.max(n.length,d.length),t==="points"&&n.length!==d.length&&(n.length>d.length?(l=d,d=Ie._prepareArrayForTween(d,n,r.closed())):(a=n,n=Ie._prepareArrayForTween(n,d,r.closed()))),t.indexOf("fill")===0)for(let h=0;h<s;h++)if(h%2===0)i.push(n[h]-d[h]);else{const m=Ie.colorToRGBA(d[h]);u=Ie.colorToRGBA(n[h]),d[h]=m,i.push({r:u.r-m.r,g:u.g-m.g,b:u.b-m.b,a:u.a-m.a})}else for(let h=0;h<s;h++)i.push(n[h]-d[h]);else t4.indexOf(t)!==-1?(d=Ie.colorToRGBA(d),u=Ie.colorToRGBA(n),i={r:u.r-d.r,g:u.g-d.g,b:u.b-d.b,a:u.a-d.a}):i=n-d;Lr.attrs[o][this._id][t]={start:d,diff:i,end:n,trueEnd:a,trueStart:l},Lr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Lr.attrs[n._id][this._id];let o,i,s,a,l,u,c,d;for(o in r){if(i=r[o],s=i.start,a=i.diff,d=i.end,Ie._isArray(s))if(l=[],c=Math.max(s.length,d.length),o.indexOf("fill")===0)for(u=0;u<c;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<c;u++)l.push((s[u]||0)+a[u]*t);else t4.indexOf(o)!==-1?l="rgba("+Math.round(s.r+a.r*t)+","+Math.round(s.g+a.g*t)+","+Math.round(s.b+a.b*t)+","+(s.a+a.a*t)+")":l=s+a*t;n.setAttr(o,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,n=Lr.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,n=Lr.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,n=this._id,r=Lr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Lr.tweens[t][o];delete Lr.attrs[t][n],Lr.tweens[t]&&(Object.keys(Lr.tweens[t]).length===0&&delete Lr.tweens[t],Object.keys(Lr.attrs[t]).length===0&&delete Lr.attrs[t])}};tm.attrs={},tm.tweens={},wt.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new tm(e).play()};const Mf={BackEaseIn(e,t,n,r){return n*(e/=r)*e*((1.70158+1)*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*((1.70158+1)*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let o=1.70158;return(e/=r/2)<1?n/2*(e*e*(((o*=1.525)+1)*e-o))+t:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t)},ElasticEaseOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),o*Math.pow(2,-10*e)*Math.sin((e*r-s)*(2*Math.PI)/i)+n+t)},ElasticEaseInOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r/2)===2?t+n:(i||(i=r*(.3*1.5)),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),e<1?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-Mf.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?Mf.BounceEaseIn(e*2,0,n,r)*.5+t:Mf.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},n4=Ie._assign(bt,{Util:Ie,Transform:Ui,Node:wt,Container:pi,Stage:$p,stages:Tf,Layer:ic,FastLayer:O0,Group:yu,DD:Pn,Shape:dt,shapes:Rf,Animation:bu,Tween:tm,Easings:Mf,Context:Wp,Canvas:k0});var da=class extends dt{_sceneFunc(e){const t=bt.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=bt.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=1,s=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=o*(o>0?e:t),u=i*(i>0?t:e),c=s*(s>0?e:t),d=a*(a>0?t:e);return{x:l,y:n?-1*d:c,width:u-l,height:d-c}}};da.prototype._centroid=!0,da.prototype.className="Arc",da.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],wr(da),ce.addGetterSetter(da,"innerRadius",0,mt()),ce.addGetterSetter(da,"outerRadius",0,mt()),ce.addGetterSetter(da,"angle",0,mt()),ce.addGetterSetter(da,"clockwise",!1,Gi());function N0(e,t,n,r,o,i,s){const a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),u=s*a/(a+l),c=s*l/(a+l);return[n-u*(o-e),r-u*(i-t),n+c*(o-e),r+c*(i-t)]}function r4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=N0(e[o-2],e[o-1],e[o],e[o+1],e[o+2],e[o+3],t);isNaN(i[0])||(r.push(i[0]),r.push(i[1]),r.push(e[o]),r.push(e[o+1]),r.push(i[2]),r.push(i[3]))}return r}function NO(e){const t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(const r of t){const o=-3*r[0]+9*r[1]-9*r[2]+3*r[3];if(o!==0){const i=6*r[0]-12*r[1]+6*r[2],s=-3*r[0]+3*r[1],a=i*i-4*o*s;if(a>=0){const l=Math.sqrt(a);n.push((-i+l)/(2*o)),n.push((-i-l)/(2*o))}}}return n.filter(r=>r>0&&r<1).flatMap(r=>t.map(o=>{const i=1-r;return i*i*i*o[0]+3*i*i*r*o[1]+3*i*r*r*o[2]+r*r*r*o[3]}))}var fa=class extends dt{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const t=this.points(),n=t.length,r=this.tension(),o=this.closed(),i=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){const a=this.getTensionPoints(),l=a.length;for(s=o?0:4,o||e.quadraticCurveTo(a[0],a[1],a[2],a[3]);s<l-2;)e.bezierCurveTo(a[s++],a[s++],a[s++],a[s++],a[s++],a[s++]);o||e.quadraticCurveTo(a[l-2],a[l-1],t[n-2],t[n-1])}else if(i)for(s=2;s<n;)e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);else for(s=2;s<n;s+=2)e.lineTo(t[s],t[s+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():r4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=N0(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=N0(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=r4(e,n);return[r[2],r[3]].concat(i).concat([o[0],o[1],e[t-2],e[t-1],o[2],o[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...NO(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let t=e[0],n=e[0],r=e[1],o=e[1],i,s;for(let a=0;a<e.length/2;a++)i=e[a*2],s=e[a*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);return{x:t,y:r,width:n-t,height:o-r}}};fa.prototype.className="Line",fa.prototype._attrsAffectingSize=["points","bezier","tension"],wr(fa),ce.addGetterSetter(fa,"closed",!1),ce.addGetterSetter(fa,"bezier",!1),ce.addGetterSetter(fa,"tension",0,mt()),ce.addGetterSetter(fa,"points",[],$D());const BO=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],zO=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],VO=[[1],[1,1],[1,2,1],[1,3,3,1]],o4=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*BO[20][a]+s,r+=zO[20][a]*HO(e,t,o);return s*r},i4=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const c=l/(2*a),d=u/a,h=n+c,m=d-c*c,p=h*h+m>0?Math.sqrt(h*h+m):0,v=c*c+m>0?Math.sqrt(c*c+m):0,_=c+Math.sqrt(c*c+m)!==0?m*Math.log(Math.abs((h+p)/(c+v))):0;return Math.sqrt(a)/2*(h*p-c*v+_)};function HO(e,t,n){const r=B0(1,n,e),o=B0(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var B0=(e,t,n)=>{const r=n.length-1;let o,i;if(r===0)return 0;if(e===0){i=0;for(let s=0;s<=r;s++)i+=VO[r][s]*Math.pow(1-t,r-s)*Math.pow(t,s)*n[s];return i}else{o=new Array(r);for(let s=0;s<r;s++)o[s]=r*(n[s+1]-n[s]);return B0(e-1,t,o)}};const s4=(e,t,n)=>{let r=1,o=e/t,i=(e-n(o))/t,s=0;for(;r>.001;){const a=n(o+i),l=Math.abs(e-a)/t;if(l<r)r=l,o+=i;else{const u=n(o-i),c=Math.abs(e-u)/t;c<r?(r=c,o-=i):i/=2}if(s++,s>500)break}return o};var Ei=class li extends dt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=li.parsePathData(this.data()),this.pathLength=li.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],c=s[3],d=s[4],h=s[5],m=s[6],p=s[7],v=u>c?u:c,_=u>c?1:u/c,C=u>c?c/u:1;t.translate(a,l),t.rotate(m),t.scale(_,C),t.arc(0,0,v,d,d+h,1-p),t.scale(1/_,1/C),t.rotate(-m),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],c=l.points[5],d=l.points[4]+c;let h=Math.PI/180;if(Math.abs(u-d)<h&&(h=Math.abs(u-d)),c<0)for(let m=u-h;m>d;m-=h){const p=li.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(p.x,p.y)}else for(let m=u+h;m<d;m+=h){const p=li.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(p.x,p.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const c=li.getPointOnCubicBezier(u,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(c.x,c.y)}else t=t.concat(l.points)});let n=t[0],r=t[0],o=t[1],i=t[1],s,a;for(let l=0;l<t.length/2;l++)s=t[l*2],a=t[l*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(a)||(o=Math.min(o,a),i=Math.max(i,a));return{x:n,y:o,width:r-n,height:i-o}}getLength(){return this.pathLength}getPointAtLength(t){return li.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,n,r,o){return Math.sqrt((r-t)*(r-t)+(o-n)*(o-n))}static getPathLength(t){let n=0;for(let r=0;r<t.length;++r)n+=t[r].pathLength;return n}static getPointAtLengthOfDataArray(t,n){let r,o=0,i=n.length;if(!i)return null;for(;o<i&&t>n[o].pathLength;)t-=n[o].pathLength,++o;if(o===i)return r=n[o-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[o].command==="M"?(r=n[o].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[o].start.x,y:n[o].start.y};const s=n[o],a=s.points;switch(s.command){case"L":return li.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return li.getPointOnCubicBezier(s4(t,li.getPathLength(n),v=>o4([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return li.getPointOnQuadraticBezier(s4(t,li.getPathLength(n),v=>i4([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],c=a[2],d=a[3],h=a[5],m=a[6];let p=a[4];return p+=h*t/s.pathLength,li.getPointOnEllipticalArc(l,u,c,d,p,m)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),c=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),d=u*c;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+c,y:a+d};const h=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),m=n+h*(o-n),p=r+h*(i-r),v=this.getLineLength(s,a,m,p),_=Math.sqrt(t*t-v*v),C=Math.sqrt(_*_/(1+u*u))*(o<n?-1:1),k=u*C;return{x:m+C,y:p+k}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function c(p){return p*p*p}function d(p){return 3*p*p*(1-p)}function h(p){return 3*p*(1-p)*(1-p)}function m(p){return(1-p)*(1-p)*(1-p)}return{x:l*c(t)+s*d(t)+o*h(t)+n*m(t),y:u*c(t)+a*d(t)+i*h(t)+r*m(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(d){return d*d}function u(d){return 2*d*(1-d)}function c(d){return(1-d)*(1-d)}return{x:s*l(t)+o*u(t)+n*c(t),y:a*l(t)+i*u(t)+r*c(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let d=0;d<r.length;d++)n=n.replace(new RegExp(r[d],"g"),"|"+r[d]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let c;for(let d=1;d<o.length;d++){let h=o[d],m=h.charAt(0);for(h=h.slice(1),s.length=0;c=u.exec(h);)s.push(c[0]);let p=[],v=m==="A"||m==="a"?0:-1;for(let _=0,C=s.length;_<C;_++){const k=s[_];if(k==="00"){p.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(k)){p.push(parseInt(k[0],10)),p.push(parseInt(k[1],10)),p.push(parseFloat(k.slice(2))),v+=3,v>=7&&(v-=7);continue}if(k==="11"||k==="10"||k==="01"){p.push(parseInt(k[0],10)),p.push(parseInt(k[1],10)),v+=2,v>=7&&(v-=7);continue}if(k==="0"||k==="1"){p.push(parseInt(k,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(k)){p.push(parseInt(k[0],10)),p.push(parseFloat(k.slice(1))),v+=2,v>=7&&(v-=7);continue}if(k==="0"||k==="1"){p.push(parseInt(k,10)),v+=1,v>=7&&(v-=7);continue}}const y=parseFloat(k);isNaN(y)?p.push(0):p.push(y),v+=1,v>=7&&(v-=7)}else{const y=parseFloat(k);isNaN(y)?p.push(0):p.push(y)}}for(;p.length>0&&!isNaN(p[0]);){let _="",C=[];const k=a,y=l;let b,T,R,P,j,O,V,Q,F,N;switch(m){case"l":a+=p.shift(),l+=p.shift(),_="L",C.push(a,l);break;case"L":a=p.shift(),l=p.shift(),C.push(a,l);break;case"m":const x=p.shift(),z=p.shift();if(a+=x,l+=z,_="M",i.length>2&&i[i.length-1].command==="z"){for(let J=i.length-2;J>=0;J--)if(i[J].command==="M"){a=i[J].points[0]+x,l=i[J].points[1]+z;break}}C.push(a,l),m="l";break;case"M":a=p.shift(),l=p.shift(),_="M",C.push(a,l),m="L";break;case"h":a+=p.shift(),_="L",C.push(a,l);break;case"H":a=p.shift(),_="L",C.push(a,l);break;case"v":l+=p.shift(),_="L",C.push(a,l);break;case"V":l=p.shift(),_="L",C.push(a,l);break;case"C":C.push(p.shift(),p.shift(),p.shift(),p.shift()),a=p.shift(),l=p.shift(),C.push(a,l);break;case"c":C.push(a+p.shift(),l+p.shift(),a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),_="C",C.push(a,l);break;case"S":T=a,R=l,b=i[i.length-1],b.command==="C"&&(T=a+(a-b.points[2]),R=l+(l-b.points[3])),C.push(T,R,p.shift(),p.shift()),a=p.shift(),l=p.shift(),_="C",C.push(a,l);break;case"s":T=a,R=l,b=i[i.length-1],b.command==="C"&&(T=a+(a-b.points[2]),R=l+(l-b.points[3])),C.push(T,R,a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),_="C",C.push(a,l);break;case"Q":C.push(p.shift(),p.shift()),a=p.shift(),l=p.shift(),C.push(a,l);break;case"q":C.push(a+p.shift(),l+p.shift()),a+=p.shift(),l+=p.shift(),_="Q",C.push(a,l);break;case"T":T=a,R=l,b=i[i.length-1],b.command==="Q"&&(T=a+(a-b.points[0]),R=l+(l-b.points[1])),a=p.shift(),l=p.shift(),_="Q",C.push(T,R,a,l);break;case"t":T=a,R=l,b=i[i.length-1],b.command==="Q"&&(T=a+(a-b.points[0]),R=l+(l-b.points[1])),a+=p.shift(),l+=p.shift(),_="Q",C.push(T,R,a,l);break;case"A":P=p.shift(),j=p.shift(),O=p.shift(),V=p.shift(),Q=p.shift(),F=a,N=l,a=p.shift(),l=p.shift(),_="A",C=this.convertEndpointToCenterParameterization(F,N,a,l,V,Q,P,j,O);break;case"a":P=p.shift(),j=p.shift(),O=p.shift(),V=p.shift(),Q=p.shift(),F=a,N=l,a+=p.shift(),l+=p.shift(),_="A",C=this.convertEndpointToCenterParameterization(F,N,a,l,V,Q,P,j,O);break}i.push({command:_||m,points:C,start:{x:k,y},pathLength:this.calcLength(k,y,_||m,C)})}(m==="z"||m==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=li;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return o4([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return i4([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const c=o[4],d=o[5],h=o[4]+d;let m=Math.PI/180;if(Math.abs(c-h)<m&&(m=Math.abs(c-h)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],c,0),d<0)for(l=c-m;l>h;l-=m)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+m;l<h;l+=m)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],h,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const c=u*(Math.PI/180),d=Math.cos(c)*(t-r)/2+Math.sin(c)*(n-o)/2,h=-1*Math.sin(c)*(t-r)/2+Math.cos(c)*(n-o)/2,m=d*d/(a*a)+h*h/(l*l);m>1&&(a*=Math.sqrt(m),l*=Math.sqrt(m));let p=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(d*d))/(a*a*(h*h)+l*l*(d*d)));i===s&&(p*=-1),isNaN(p)&&(p=0);const v=p*a*h/l,_=p*-l*d/a,C=(t+r)/2+Math.cos(c)*v-Math.sin(c)*_,k=(n+o)/2+Math.sin(c)*v+Math.cos(c)*_,y=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},b=function(V,Q){return(V[0]*Q[0]+V[1]*Q[1])/(y(V)*y(Q))},T=function(V,Q){return(V[0]*Q[1]<V[1]*Q[0]?-1:1)*Math.acos(b(V,Q))},R=T([1,0],[(d-v)/a,(h-_)/l]),P=[(d-v)/a,(h-_)/l],j=[(-1*d-v)/a,(-1*h-_)/l];let O=T(P,j);return b(P,j)<=-1&&(O=Math.PI),b(P,j)>=1&&(O=0),s===0&&O>0&&(O=O-2*Math.PI),s===1&&O<0&&(O=O+2*Math.PI),[C,k,a,l,R,O,c,s]}};Ei.prototype.className="Path",Ei.prototype._attrsAffectingSize=["data"],wr(Ei),ce.addGetterSetter(Ei,"data");var sc=class extends fa{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const d=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],h=Ei.calcLength(r[r.length-4],r[r.length-3],"C",d),m=Ei.getPointOnQuadraticBezier(Math.min(1,1-i/h),d[0],d[1],d[2],d[3],d[4],d[5]);a=n[s-2]-m.x,l=n[s-1]-m.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,c=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,c/2),e.lineTo(-i,-c/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,c/2),e.lineTo(-i,-c/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};sc.prototype.className="Arrow",wr(sc),ce.addGetterSetter(sc,"pointerLength",10,mt()),ce.addGetterSetter(sc,"pointerWidth",10,mt()),ce.addGetterSetter(sc,"pointerAtBeginning",!1),ce.addGetterSetter(sc,"pointerAtEnding",!0);var wu=class extends dt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};wu.prototype._centroid=!0,wu.prototype.className="Circle",wu.prototype._attrsAffectingSize=["radius"],wr(wu),ce.addGetterSetter(wu,"radius",0,mt());var il=class extends dt{_sceneFunc(e){const t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};il.prototype.className="Ellipse",il.prototype._centroid=!0,il.prototype._attrsAffectingSize=["radiusX","radiusY"],wr(il),ce.addComponentsGetterSetter(il,"radius",["x","y"]),ce.addGetterSetter(il,"radiusX",0,mt()),ce.addGetterSetter(il,"radiusY",0,mt());var Wi=class iI extends dt{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),n=this.hasShadow();return t&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),o=this.cornerRadius(),i=this.attrs.image;let s;if(i){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[i,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[i,0,0,n,r]}(this.hasFill()||this.hasStroke()||o)&&(t.beginPath(),o?Ie.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),i&&(o&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){const n=this.width(),r=this.height(),o=this.cornerRadius();t.beginPath(),o?Ie.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n,r;return(r=(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&r!==void 0?r:0}getHeight(){var t,n,r;return(r=(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&r!==void 0?r:0}static fromURL(t,n,r=null){const o=Ie.createImageElement();o.onload=function(){n(new iI({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};Wi.prototype.className="Image",Wi.prototype._attrsAffectingSize=["image"],wr(Wi),ce.addGetterSetter(Wi,"cornerRadius",0,qp(4)),ce.addGetterSetter(Wi,"image"),ce.addComponentsGetterSetter(Wi,"crop",["x","y","width","height"]),ce.addGetterSetter(Wi,"cropX",0,mt()),ce.addGetterSetter(Wi,"cropY",0,mt()),ce.addGetterSetter(Wi,"cropWidth",0,mt()),ce.addGetterSetter(Wi,"cropHeight",0,mt());var a4=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],jO="Change.konva",UO="none",z0="up",V0="right",H0="down",j0="left",GO=a4.length,U0=class extends yu{constructor(e){super(e),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let t=this,n;const r=function(){t._sync()};for(n=0;n<GO;n++)e.on(a4[n]+jO,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,o,i,s,a,l;if(e&&t){switch(n=e.width(),r=e.height(),o=t.pointerDirection(),i=t.pointerWidth(),l=t.pointerHeight(),s=0,a=0,o){case z0:s=n/2,a=-1*l;break;case V0:s=n+i,a=r/2;break;case H0:s=n/2,a=r+l;break;case j0:s=-1*i,a=r/2;break}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};U0.prototype.className="Label",wr(U0);var ac=class extends dt{_sceneFunc(e){const t=this.width(),n=this.height(),r=this.pointerDirection(),o=this.pointerWidth(),i=this.pointerHeight(),s=this.cornerRadius();let a=0,l=0,u=0,c=0;typeof s=="number"?a=l=u=c=Math.min(s,t/2,n/2):(a=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),c=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===z0&&(e.lineTo((t-o)/2,0),e.lineTo(t/2,-1*i),e.lineTo((t+o)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,Math.PI*3/2,0,!1),r===V0&&(e.lineTo(t,(n-i)/2),e.lineTo(t+o,n/2),e.lineTo(t,(n+i)/2)),e.lineTo(t,n-c),e.arc(t-c,n-c,c,0,Math.PI/2,!1),r===H0&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===j0&&(e.lineTo(0,(n+i)/2),e.lineTo(-1*o,n/2),e.lineTo(0,(n-i)/2)),e.lineTo(0,a),e.arc(a,a,a,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),o=this.pointerDirection(),i=this.width(),s=this.height();return o===z0?(t-=r,s+=r):o===H0?s+=r:o===j0?(e-=n*1.5,i+=n):o===V0&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};ac.prototype.className="Tag",wr(ac),ce.addGetterSetter(ac,"pointerDirection",UO),ce.addGetterSetter(ac,"pointerWidth",0,mt()),ce.addGetterSetter(ac,"pointerHeight",0,mt()),ce.addGetterSetter(ac,"cornerRadius",0,qp(4));var Lf=class extends dt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Ie.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};Lf.prototype.className="Rect",wr(Lf),ce.addGetterSetter(Lf,"cornerRadius",0,qp(4));var sl=class extends dt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Ie.drawRoundedPolygonPath(e,t,r,n,o);else{e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();let t=e[0].x,n=e[0].x,r=e[0].y,o=e[0].y;return e.forEach(i=>{t=Math.min(t,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),o=Math.max(o,i.y)}),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};sl.prototype.className="RegularPolygon",sl.prototype._centroid=!0,sl.prototype._attrsAffectingSize=["radius"],wr(sl),ce.addGetterSetter(sl,"radius",0,mt()),ce.addGetterSetter(sl,"sides",0,mt()),ce.addGetterSetter(sl,"cornerRadius",0,qp(4));var l4=Math.PI*2,lc=class extends dt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,l4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),l4,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};lc.prototype.className="Ring",lc.prototype._centroid=!0,lc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(lc),ce.addGetterSetter(lc,"innerRadius",0,mt()),ce.addGetterSetter(lc,"outerRadius",0,mt());var Cs=class extends dt{constructor(e){super(e),this._updated=!0,this.anim=new bu(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],c=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),c)if(i){const d=i[t],h=n*2;e.drawImage(c,s,a,l,u,d[h+0],d[h+1],l,u)}else e.drawImage(c,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};Cs.prototype.className="Sprite",wr(Cs),ce.addGetterSetter(Cs,"animation"),ce.addGetterSetter(Cs,"animations"),ce.addGetterSetter(Cs,"frameOffsets"),ce.addGetterSetter(Cs,"image"),ce.addGetterSetter(Cs,"frameIndex",0,mt()),ce.addGetterSetter(Cs,"frameRate",17,mt()),ce.backCompat(Cs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var al=class extends dt{_sceneFunc(e){const t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let o=1;o<r*2;o++){const i=o%2===0?n:t,s=i*Math.sin(o*Math.PI/r),a=-1*i*Math.cos(o*Math.PI/r);e.lineTo(s,a)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};al.prototype.className="Star",al.prototype._centroid=!0,al.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(al),ce.addGetterSetter(al,"numPoints",5,mt()),ce.addGetterSetter(al,"innerRadius",0,mt()),ce.addGetterSetter(al,"outerRadius",0,mt());function ll(e){return[...e].reduce((t,n,r,o)=>{if(/\p{Emoji}/u.test(n)){const i=o[r+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(t.push(n+i),o[r+1]=""):t.push(n)}else/\p{Regional_Indicator}{2}/u.test(n+(o[r+1]||""))?t.push(n+o[r+1]):r>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(n)?t[t.length-1]+=n:n&&t.push(n);return t},[])}var Cu="auto",WO="center",c4="inherit",Pf="justify",KO="Change.konva",u4="2d",d4="-",f4="left",qO="text",YO="Text",XO="top",ZO="bottom",h4="middle",p4="normal",QO="px ",nm=" ",JO="right",m4="rtl",$O="word",eF="char",g4="none",G0="…",v4=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],tF=v4.length,Df=null;function nF(){if(Df!==null)return Df;Df=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(u4);if(t){t.globalAlpha=0,t.shadowColor="black",t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle="black",t.font="10px Arial",t.fillText("X",0,10);const n=t.getImageData(0,0,10,10).data;for(let r=3;r<n.length;r+=4)if(n[r]>0){Df=!0;break}}}catch{}return Df}function rF(e){return e.split(",").map(t=>{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var rm;function W0(){return rm||(rm=Ie.createCanvasElement().getContext(u4),rm)}function oF(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function iF(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function sF(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var tr=class extends dt{constructor(e){super(sF(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<tF;t++)this.on(v4[t]+KO,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),c=0,d=this.align(),h=this.getWidth(),m=this.letterSpacing(),p=this.charRenderFunc(),v=this.fill(),_=this.textDecoration(),C=this.underlineOffset(),k=_.indexOf("underline")!==-1,y=_.indexOf("line-through")!==-1,b;u=u===c4?e.direction:u;let T=a/2,R=h4;if(!bt.legacyTextRendering){const P=this.measureSize("M");R="alphabetic",T=(((t=P.fontBoundingBoxAscent)!==null&&t!==void 0?t:P.actualBoundingBoxAscent)-((n=P.fontBoundingBoxDescent)!==null&&n!==void 0?n:P.actualBoundingBoxDescent))/2+a/2}for(u===m4&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",R),e.setAttr("textAlign",f4),l===h4?c=(this.getHeight()-o*a-i*2)/2:l===ZO&&(c=this.getHeight()-o*a-i*2),e.translate(i,c+i),b=0;b<o;b++){let P=0,j=0;const O=r[b],V=O.text,Q=O.width,F=O.lastInParagraph;if(e.save(),d===JO?P+=h-Q-i*2:d===WO&&(P+=(h-Q-i*2)/2),k){e.save(),e.beginPath();const x=C??(bt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),z=P,J=T+j+x;e.moveTo(z,J);const X=d===Pf&&!F?h-i*2:Q;e.lineTo(z+Math.round(X),J),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const N=P;if(u!==m4&&(m!==0||d===Pf||p)){const x=V.split(" ").length-1,z=ll(V);for(let J=0;J<z.length;J++){const X=z[J];if(X===" "&&!F&&d===Pf&&(P+=(h-i*2-Q)/x),this._partialTextX=P,this._partialTextY=T+j,this._partialText=X,p){e.save();const ae=r.slice(0,b).reduce((pe,Fe)=>pe+ll(Fe.text).length,0);p({char:X,index:J+ae,x:P,y:T+j,lineIndex:b,column:J,isLastInLine:F,width:this.measureSize(X).width,context:e})}e.fillStrokeShape(this),p&&e.restore(),P+=this.measureSize(X).width+m}}else m!==0&&e.setAttr("letterSpacing",`${m}px`),this._partialTextX=P,this._partialTextY=T+j,this._partialText=V,e.fillStrokeShape(this);if(y){e.save(),e.beginPath();const x=bt.legacyTextRendering?0:-Math.round(s/4),z=N;e.moveTo(z,T+j+x);const J=d===Pf&&!F?h-i*2:Q;e.lineTo(z+Math.round(J),T+j+x),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}e.restore(),o>1&&(T+=a)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=Ie._isString(e)?e:e==null?"":e+"";return this._setAttr(qO,t),this}getWidth(){return this.attrs.width===Cu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Cu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Ie.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,c,d;let h=W0(),m=this.fontSize(),p;h.save(),h.font=this._getContextFont(),p=h.measureText(e),h.restore();const v=m/100;return{actualBoundingBoxAscent:(t=p.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=p.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=p.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=p.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=p.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=p.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=p.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=p.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=p.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(c=p.hangingBaseline)!==null&&c!==void 0?c:72.80000305175781*v,ideographicBaseline:(d=p.ideographicBaseline)!==null&&d!==void 0?d:-21*v,width:p.width,height:m}}_getContextFont(){return this.fontStyle()+nm+this.fontVariant()+nm+(this.fontSize()+QO)+rF(this.fontFamily())}_addTextLine(e){this.align()===Pf&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return W0().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
100
+ `),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==Cu&&o!==void 0,a=i!==Cu&&i!==void 0,l=this.padding(),u=o-l*2,c=i-l*2,d=0,h=this.wrap(),m=h!==eF&&h!==g4,p=this.ellipsis();this.textArr=[],W0().font=this._getContextFont();const v=p?this._getTextWidth(G0):0;for(let _=0,C=e.length;_<C;++_){let k=e[_],y=this._getTextWidth(k);if(s&&y>u)for(;k.length>0;){let b=0,T=ll(k).length,R="",P=0;for(;b<T;){const j=b+T>>>1,O=ll(k).slice(0,j+1).join(""),V=this._getTextWidth(O);(p&&a&&d+r>c?V+v:V)<=u?(b=j+1,R=O,P=V):T=j}if(R){if(m){const j=ll(k),O=ll(R),V=j[O.length],Q=V===nm||V===d4;let F;if(Q&&P<=u)F=O.length;else{const N=O.lastIndexOf(nm),x=O.lastIndexOf(d4);F=Math.max(N,x)+1}F>0&&(b=F,R=j.slice(0,b).join(""),P=this._getTextWidth(R))}if(R=R.trimRight(),this._addTextLine(R),n=Math.max(n,P),d+=r,this._shouldHandleEllipsis(d)){this._tryToAddEllipsisToLastLine();break}if(k=ll(k).slice(b).join("").trimLeft(),k.length>0&&(y=this._getTextWidth(k),y<=u)){this._addTextLine(k),d+=r,n=Math.max(n,y);break}}else break}else this._addTextLine(k),d+=r,n=Math.max(n,y),this._shouldHandleEllipsis(d)&&_<C-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&d+r>c)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==Cu&&r!==void 0,i=r-this.padding()*2;return this.wrap()===g4||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==Cu&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!r||(t&&(this._getTextWidth(o.text+G0)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+G0))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&nF()?!0:super._useBufferCanvas()}};tr.prototype._fillFunc=oF,tr.prototype._strokeFunc=iF,tr.prototype.className=YO,tr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],wr(tr),ce.overWriteSetter(tr,"width",I0()),ce.overWriteSetter(tr,"height",I0()),ce.addGetterSetter(tr,"direction",c4),ce.addGetterSetter(tr,"fontFamily","Arial"),ce.addGetterSetter(tr,"fontSize",12,mt()),ce.addGetterSetter(tr,"fontStyle",p4),ce.addGetterSetter(tr,"fontVariant",p4),ce.addGetterSetter(tr,"padding",0,mt()),ce.addGetterSetter(tr,"align",f4),ce.addGetterSetter(tr,"verticalAlign",XO),ce.addGetterSetter(tr,"lineHeight",1,mt()),ce.addGetterSetter(tr,"wrap",$O),ce.addGetterSetter(tr,"ellipsis",!1,Gi()),ce.addGetterSetter(tr,"letterSpacing",0,mt()),ce.addGetterSetter(tr,"text","",rc()),ce.addGetterSetter(tr,"textDecoration",""),ce.addGetterSetter(tr,"underlineOffset",void 0,mt()),ce.addGetterSetter(tr,"charRenderFunc",void 0);var aF="",y4="normal";function b4(e){e.fillText(this.partialText,0,0)}function w4(e){e.strokeText(this.partialText,0,0)}var qr=class extends dt{constructor(e){super(e),this.dummyCanvas=Ie.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Ei.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Ei.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Ei.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const t=this.textDecoration(),n=this.fill(),r=this.fontSize(),o=this.glyphInfo,i=t.indexOf("underline")!==-1,s=t.indexOf("line-through")!==-1;i&&e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),this.partialText=o[a].text,e.fillStrokeShape(this),i&&(a===0&&e.moveTo(0,r/2+1),e.lineTo(o[a].width,r/2+1)),e.restore()}if(i&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),s){e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),a===0&&e.moveTo(0,0),e.lineTo(o[a].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const t=this.glyphInfo;if(t.length>=1){const n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){const r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Ie.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return tr.prototype.setText.call(this,e)}_getContextFont(){return tr.prototype._getContextFont.call(this)}_getTextSize(e){const t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();const n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=ll(this.text()),t=[];let n=0;for(let h=0;h<e.length;h++)t.push({char:e[h],width:this._getTextSize(e[h]).width}),n+=t[h].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let c=0;s==="center"&&(c=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(c=Math.max(0,this.pathLength-u));let d=c;for(let h=0;h<t.length;h++){const m=this._getPointAtLength(d);if(!m)return;const p=t[h].char;let v=t[h].width+i;if(p===" "&&s==="justify"){const R=this.text().split(" ").length-1;v+=(this.pathLength-u)/R}const _=d+v,C=this._getPointAtLength(_>this.pathLength&&_-this.pathLength<=l?this.pathLength:_);if(!C)return;const k=Ei.getLineLength(m.x,m.y,C.x,C.y);let y=0;if(a)try{y=a(t[h-1].char,p)*this.fontSize()}catch{y=0}m.x+=y,C.x+=y,this.textWidth+=y;const b=Ei.getPointOnLine(y+k/2,m.x,m.y,C.x,C.y),T=Math.atan2(C.y-m.y,C.x-m.x);this.glyphInfo.push({transposeX:b.x,transposeY:b.y,text:e[h],rotation:T,p0:m,p1:C,width:k}),d+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Ie.releaseCanvas(this.dummyCanvas),super.destroy()}};qr.prototype._fillFunc=b4,qr.prototype._strokeFunc=w4,qr.prototype._fillFuncHit=b4,qr.prototype._strokeFuncHit=w4,qr.prototype.className="TextPath",qr.prototype._attrsAffectingSize=["text","fontSize","data"],wr(qr),ce.addGetterSetter(qr,"data"),ce.addGetterSetter(qr,"fontFamily","Arial"),ce.addGetterSetter(qr,"fontSize",12,mt()),ce.addGetterSetter(qr,"fontStyle",y4),ce.addGetterSetter(qr,"align","left"),ce.addGetterSetter(qr,"letterSpacing",0,mt()),ce.addGetterSetter(qr,"textBaseline","middle"),ce.addGetterSetter(qr,"fontVariant",y4),ce.addGetterSetter(qr,"text",aF),ce.addGetterSetter(qr,"textDecoration",""),ce.addGetterSetter(qr,"kerningFunc",void 0);var C4="tr-konva",lF=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${C4}`).join(" "),_4="nodesRect",cF=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],uF={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},dF="ontouchstart"in bt._global;function fF(e,t,n){if(e==="rotater")return n;t+=Ie.degToRad(uF[e]||0);const r=(Ie.radToDeg(t)%360+360)%360;return Ie._inRange(r,337.5,360)||Ie._inRange(r,0,22.5)?"ns-resize":Ie._inRange(r,22.5,67.5)?"nesw-resize":Ie._inRange(r,67.5,112.5)?"ew-resize":Ie._inRange(r,112.5,157.5)?"nwse-resize":Ie._inRange(r,157.5,202.5)?"ns-resize":Ie._inRange(r,202.5,247.5)?"nesw-resize":Ie._inRange(r,247.5,292.5)?"ew-resize":Ie._inRange(r,292.5,337.5)?"nwse-resize":(Ie.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var om=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],S4=1e8;function hF(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function k4(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:o}}function pF(e,t){return k4(e,t,hF(e))}function mF(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=bt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var K0=0,En=class extends yu{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(lF,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Ie.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return C4+this._id}setNodes(e=[]){return this._nodes&&this._nodes.length&&this.detach(),this._nodes=e=e.filter(t=>t.isAncestorOf(this)?(Ie.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0),e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(t=>{const n=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(t._attrsAffectingSize.length){const r=t._attrsAffectingSize.map(o=>o+"Change."+this._getEventNamespace()).join(" ");t.on(r,n)}t.on(cF.map(r=>r+`.${this._getEventNamespace()}`).join(" "),n),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,n),this._proxyDrag(t)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach(s=>{if(s===e||s.isDragging())return;const a=s.getAbsolutePosition();s.setAbsolutePosition({x:a.x+o,y:a.y+i}),s.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(_4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(_4,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){const r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),s=r.x*o.x-e.offsetX()*o.x,a=r.y*o.y-e.offsetY()*o.y,l=(bt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return k4({x:i.x+s*Math.cos(l)+a*Math.sin(-l),y:i.y+a*Math.cos(l)+s*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-bt.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-S4,y:-S4,width:0,height:0,rotation:0};const e=[];this.nodes().map(a=>{const l=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],c=a.getAbsoluteTransform();u.forEach(function(d){const h=c.point(d);e.push(h)})});const t=new Ui;t.rotate(-bt.getAngle(this.rotation()));let n=1/0,r=1/0,o=-1/0,i=-1/0;e.forEach(function(a){const l=t.point(a);n===void 0&&(n=o=l.x,r=i=l.y),n=Math.min(n,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),i=Math.max(i,l.y)}),t.invert();const s=t.point({x:n,y:r});return{x:s.x,y:s.y,width:o-n,height:i-r,rotation:bt.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),om.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new Lf({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:dF?10:"auto"}),n=this;t.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),t.on("dragstart",r=>{t.stopDrag(),r.cancelBubble=!0}),t.on("dragend",r=>{r.cancelBubble=!0}),t.on("mouseenter",()=>{const r=fF(e,bt.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0}),t.on("mouseout",()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(t)}_createBack(){const e=new dt({name:"back",width:0,height:0,sceneFunc(t,n){const r=n.getParent(),o=r.padding(),i=n.width(),s=n.height();if(t.beginPath(),t.rect(-o,-o,i+o*2,s+o*2),r.rotateEnabled()&&r.rotateLineVisible()){const a=r.rotateAnchorAngle(),l=r.rotateAnchorOffset(),u=Ie.degToRad(a),c=Math.sin(u),d=-Math.cos(u),h=i/2,m=s/2;let p=1/0;d<0?p=Math.min(p,-m/d):d>0&&(p=Math.min(p,(s-m)/d)),c<0?p=Math.min(p,-h/c):c>0&&(p=Math.min(p,(i-h)/c));const v=h+c*p,_=m+d*p,C=Ie._sign(s),k=v+c*l*C,y=_+d*l*C;t.moveTo(v,_),t.lineTo(k,y)}t.fillStrokeShape(n)},hitFunc:(t,n)=>{if(!this.shouldOverdrawWholeArea())return;const r=this.padding();t.beginPath(),t.rect(-r,-r,n.width()+r*2,n.height()+r*2),t.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const i=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-i.x,y:s.y-i.y},K0++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(a=>{a._fire("transformstart",{evt:e.evt,target:a})})}_handleMouseMove(e){let t,n,r;const o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const s=i.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(l,a,e)),o.setAbsolutePosition(a);const u=o.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName==="rotater"){const C=this._getNodeRect();t=o.x()-C.width/2,n=-o.y()+C.height/2;const k=bt.getAngle(this.rotateAnchorAngle());let y=Math.atan2(-n,t)+Math.PI/2-k;C.height<0&&(y-=Math.PI);const b=bt.getAngle(this.rotation())+y,T=bt.getAngle(this.rotationSnapTolerance()),R=pF(C,mF(this.rotationSnaps(),b,T)-C.rotation);this._fitNodesInto(R,e);return}const c=this.shiftBehavior();let d;c==="inverted"?d=this.keepRatio()&&!e.shiftKey:c==="none"?d=this.keepRatio():d=this.keepRatio()||e.shiftKey;let h=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(d){const C=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(C.x-o.x(),2)+Math.pow(C.y-o.y(),2));const k=this.findOne(".top-left").x()>C.x?-1:1,y=this.findOne(".top-left").y()>C.y?-1:1;t=r*this.cos*k,n=r*this.sin*y,this.findOne(".top-left").x(C.x-t),this.findOne(".top-left").y(C.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(d){const C=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-C.x,2)+Math.pow(C.y-o.y(),2));const k=this.findOne(".top-right").x()<C.x?-1:1,y=this.findOne(".top-right").y()>C.y?-1:1;t=r*this.cos*k,n=r*this.sin*y,this.findOne(".top-right").x(C.x+t),this.findOne(".top-right").y(C.y-n)}var m=o.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(d){const C=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(C.x-o.x(),2)+Math.pow(o.y()-C.y,2));const k=C.x<o.x()?-1:1,y=o.y()<C.y?-1:1;t=r*this.cos*k,n=r*this.sin*y,o.x(C.x-t),o.y(C.y+n)}m=o.position(),this.findOne(".top-left").x(m.x),this.findOne(".bottom-right").y(m.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(d){const C=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-C.x,2)+Math.pow(o.y()-C.y,2));const k=this.findOne(".bottom-right").x()<C.x?-1:1,y=this.findOne(".bottom-right").y()<C.y?-1:1;t=r*this.cos*k,n=r*this.sin*y,this.findOne(".bottom-right").x(C.x+t),this.findOne(".bottom-right").y(C.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(h=this.centeredScaling()||e.altKey,h){const C=this.findOne(".top-left"),k=this.findOne(".bottom-right"),y=C.x(),b=C.y(),T=this.getWidth()-k.x(),R=this.getHeight()-k.y();k.move({x:-y,y:-b}),C.move({x:T,y:R})}const p=this.findOne(".top-left").getAbsolutePosition();t=p.x,n=p.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),_=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:_,rotation:bt.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();K0--,this._fire("transformend",{evt:e,target:n}),(t=this.getLayer())===null||t===void 0||t.batchDraw(),n&&this._nodes.forEach(r=>{var o;r._fire("transformend",{evt:e,target:r}),(o=r.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){const n=this._getNodeRect(),r=1;if(Ie._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Ie._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new Ui;if(o.rotate(bt.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=o.point({x:-this.padding()*2,y:0});e.x+=d.x,e.y+=d.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=o.point({x:0,y:-this.padding()*2});e.x+=d.x,e.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(n,e);d?e=d:Ie.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new Ui;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new Ui,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const c=a.multiply(s.invert());this._nodes.forEach(d=>{var h;if(!d.getStage())return;const m=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const v=new Ui;v.multiply(m.copy().invert()).multiply(c).multiply(m).multiply(p);const _=v.decompose();d.setAttrs(_),(h=d.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(Ie._getRotation(e.rotation)),this._nodes.forEach(d=>{this._fire("transform",{evt:t,target:d}),d._fire("transform",{evt:t,target:d})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;const t=this._getNodeRect();this.rotation(Ie._getRotation(t.rotation));const n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),s=this.padding(),a=this.anchorSize(),l=this.find("._anchor");l.forEach(T=>{T.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:a/2+s,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:a/2+s,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:a/2-s,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:a/2+s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:a/2-s,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:a/2-s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-right")>=0});const u=this.rotateAnchorAngle(),c=this.rotateAnchorOffset(),d=Ie.degToRad(u),h=Math.sin(d),m=-Math.cos(d),p=n/2,v=r/2;let _=1/0;m<0?_=Math.min(_,-v/m):m>0&&(_=Math.min(_,(r-v)/m)),h<0?_=Math.min(_,-p/h):h>0&&(_=Math.min(_,(n-p)/h));const C=p+h*_,k=v+m*_,y=Ie._sign(r);this._batchChangeChild(".rotater",{x:C+h*c*y,y:k+m*c*y-s*m,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(T=>T.draggable()),x:0,y:0});const b=this.anchorStyleFunc();b&&l.forEach(T=>{b(T)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),yu.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Ie.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return wt.prototype.toObject.call(this)}clone(e){return wt.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};En.isTransforming=()=>K0>0;function gF(e){return e instanceof Array||Ie.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){om.indexOf(t)===-1&&Ie.warn("Unknown anchor name: "+t+". Available names are: "+om.join(", "))}),e||[]}En.prototype.className="Transformer",wr(En),ce.addGetterSetter(En,"enabledAnchors",om,gF),ce.addGetterSetter(En,"flipEnabled",!0,Gi()),ce.addGetterSetter(En,"resizeEnabled",!0),ce.addGetterSetter(En,"anchorSize",10,mt()),ce.addGetterSetter(En,"rotateEnabled",!0),ce.addGetterSetter(En,"rotateLineVisible",!0),ce.addGetterSetter(En,"rotationSnaps",[]),ce.addGetterSetter(En,"rotateAnchorOffset",50,mt()),ce.addGetterSetter(En,"rotateAnchorAngle",0,mt()),ce.addGetterSetter(En,"rotateAnchorCursor","crosshair"),ce.addGetterSetter(En,"rotationSnapTolerance",5,mt()),ce.addGetterSetter(En,"borderEnabled",!0),ce.addGetterSetter(En,"anchorStroke","rgb(0, 161, 255)"),ce.addGetterSetter(En,"anchorStrokeWidth",1,mt()),ce.addGetterSetter(En,"anchorFill","white"),ce.addGetterSetter(En,"anchorCornerRadius",0,mt()),ce.addGetterSetter(En,"borderStroke","rgb(0, 161, 255)"),ce.addGetterSetter(En,"borderStrokeWidth",1,mt()),ce.addGetterSetter(En,"borderDash"),ce.addGetterSetter(En,"keepRatio",!0),ce.addGetterSetter(En,"shiftBehavior","default"),ce.addGetterSetter(En,"centeredScaling",!1),ce.addGetterSetter(En,"ignoreStroke",!1),ce.addGetterSetter(En,"padding",0,mt()),ce.addGetterSetter(En,"nodes"),ce.addGetterSetter(En,"node"),ce.addGetterSetter(En,"boundBoxFunc"),ce.addGetterSetter(En,"anchorDragBoundFunc"),ce.addGetterSetter(En,"anchorStyleFunc"),ce.addGetterSetter(En,"shouldOverdrawWholeArea",!1),ce.addGetterSetter(En,"useSingleNodeRotation",!0),ce.backCompat(En,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var ha=class extends dt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,bt.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};ha.prototype.className="Wedge",ha.prototype._centroid=!0,ha.prototype._attrsAffectingSize=["radius"],wr(ha),ce.addGetterSetter(ha,"radius",0,mt()),ce.addGetterSetter(ha,"angle",0,mt()),ce.addGetterSetter(ha,"clockwise",!1),ce.backCompat(ha,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function A4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var vF=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],yF=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function bF(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,c,d,h,m,p,v,_,C,k,y,b,T,R,P,j;const O=t+t+1,V=r-1,Q=o-1,F=t+1,N=F*(F+1)/2,x=new A4,z=vF[t],J=yF[t];let X=null,ae=x,pe=null,Fe=null;for(let fe=1;fe<O;fe++)ae=ae.next=new A4,fe===F&&(X=ae);ae.next=x,a=s=0;for(let fe=0;fe<o;fe++){_=C=k=y=l=u=c=d=0,h=F*(b=n[s]),m=F*(T=n[s+1]),p=F*(R=n[s+2]),v=F*(P=n[s+3]),l+=N*b,u+=N*T,c+=N*R,d+=N*P,ae=x;for(let ye=0;ye<F;ye++)ae.r=b,ae.g=T,ae.b=R,ae.a=P,ae=ae.next;for(let ye=1;ye<F;ye++)i=s+((V<ye?V:ye)<<2),l+=(ae.r=b=n[i])*(j=F-ye),u+=(ae.g=T=n[i+1])*j,c+=(ae.b=R=n[i+2])*j,d+=(ae.a=P=n[i+3])*j,_+=b,C+=T,k+=R,y+=P,ae=ae.next;pe=x,Fe=X;for(let ye=0;ye<r;ye++)n[s+3]=P=d*z>>J,P!==0?(P=255/P,n[s]=(l*z>>J)*P,n[s+1]=(u*z>>J)*P,n[s+2]=(c*z>>J)*P):n[s]=n[s+1]=n[s+2]=0,l-=h,u-=m,c-=p,d-=v,h-=pe.r,m-=pe.g,p-=pe.b,v-=pe.a,i=a+((i=ye+t+1)<V?i:V)<<2,_+=pe.r=n[i],C+=pe.g=n[i+1],k+=pe.b=n[i+2],y+=pe.a=n[i+3],l+=_,u+=C,c+=k,d+=y,pe=pe.next,h+=b=Fe.r,m+=T=Fe.g,p+=R=Fe.b,v+=P=Fe.a,_-=b,C-=T,k-=R,y-=P,Fe=Fe.next,s+=4;a+=r}for(let fe=0;fe<r;fe++){C=k=y=_=u=c=d=l=0,s=fe<<2,h=F*(b=n[s]),m=F*(T=n[s+1]),p=F*(R=n[s+2]),v=F*(P=n[s+3]),l+=N*b,u+=N*T,c+=N*R,d+=N*P,ae=x;for(let le=0;le<F;le++)ae.r=b,ae.g=T,ae.b=R,ae.a=P,ae=ae.next;let ye=r;for(let le=1;le<=t;le++)s=ye+fe<<2,l+=(ae.r=b=n[s])*(j=F-le),u+=(ae.g=T=n[s+1])*j,c+=(ae.b=R=n[s+2])*j,d+=(ae.a=P=n[s+3])*j,_+=b,C+=T,k+=R,y+=P,ae=ae.next,le<Q&&(ye+=r);s=fe,pe=x,Fe=X;for(let le=0;le<o;le++)i=s<<2,n[i+3]=P=d*z>>J,P>0?(P=255/P,n[i]=(l*z>>J)*P,n[i+1]=(u*z>>J)*P,n[i+2]=(c*z>>J)*P):n[i]=n[i+1]=n[i+2]=0,l-=h,u-=m,c-=p,d-=v,h-=pe.r,m-=pe.g,p-=pe.b,v-=pe.a,i=fe+((i=le+F)<Q?i:Q)*r<<2,l+=_+=pe.r=n[i],u+=C+=pe.g=n[i+1],c+=k+=pe.b=n[i+2],d+=y+=pe.a=n[i+3],pe=pe.next,h+=b=Fe.r,m+=T=Fe.g,p+=R=Fe.b,v+=P=Fe.a,_-=b,C-=T,k-=R,y-=P,Fe=Fe.next,s+=r}}const wF=function(t){const n=Math.round(this.blurRadius());n>0&&bF(t,n)};ce.addGetterSetter(wt,"blurRadius",0,mt(),ce.afterSetFilter);const CF=function(e){const t=this.brightness()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]+=t,n[o+1]+=t,n[o+2]+=t};ce.addGetterSetter(wt,"brightness",0,mt(),ce.afterSetFilter);const _F=function(e){const t=this.brightness(),n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]=Math.min(255,n[o]*t),n[o+1]=Math.min(255,n[o+1]*t),n[o+2]=Math.min(255,n[o+2]*t)},SF=function(e){const t=Math.pow((this.contrast()+100)/100,2),n=e.data,r=n.length;let o=150,i=150,s=150;for(let a=0;a<r;a+=4)o=n[a],i=n[a+1],s=n[a+2],o/=255,o-=.5,o*=t,o+=.5,o*=255,i/=255,i-=.5,i*=t,i+=.5,i*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,o=o<0?0:o>255?255:o,i=i<0?0:i>255?255:i,s=s<0?0:s>255?255:s,n[a]=o,n[a+1]=i,n[a+2]=s};ce.addGetterSetter(wt,"contrast",0,mt(),ce.afterSetFilter);const kF=function(e){var t,n,r,o,i,s,a,l,u;const c=e.data,d=e.width,h=e.height,m=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),p=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,_=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),C=m*10,k=p*255,y=v*Math.PI/180,b=Math.cos(y),T=Math.sin(y),R=128/1020*C,P=new Uint8ClampedArray(c),j=new Float32Array(d*h);for(let N=0,x=0;x<c.length;x+=4,N++)j[N]=.2126*P[x]+.7152*P[x+1]+.0722*P[x+2];const O=[-1,0,1,-2,0,2,-1,0,1],V=[-1,-2,-1,0,0,0,1,2,1],Q=[-d-1,-d,-d+1,-1,0,1,d-1,d,d+1],F=N=>N<0?0:N>255?255:N;for(let N=1;N<h-1;N++)for(let x=1;x<d-1;x++){const z=N*d+x;let J=0,X=0;J+=j[z+Q[0]]*O[0],X+=j[z+Q[0]]*V[0],J+=j[z+Q[1]]*O[1],X+=j[z+Q[1]]*V[1],J+=j[z+Q[2]]*O[2],X+=j[z+Q[2]]*V[2],J+=j[z+Q[3]]*O[3],X+=j[z+Q[3]]*V[3],J+=j[z+Q[5]]*O[5],X+=j[z+Q[5]]*V[5],J+=j[z+Q[6]]*O[6],X+=j[z+Q[6]]*V[6],J+=j[z+Q[7]]*O[7],X+=j[z+Q[7]]*V[7],J+=j[z+Q[8]]*O[8],X+=j[z+Q[8]]*V[8];const ae=F(k+(b*J+T*X)*R),pe=z*4;if(_){const Fe=ae-k;c[pe]=F(P[pe]+Fe),c[pe+1]=F(P[pe+1]+Fe),c[pe+2]=F(P[pe+2]+Fe),c[pe+3]=P[pe+3]}else c[pe]=c[pe+1]=c[pe+2]=ae,c[pe+3]=P[pe+3]}for(let N=0;N<d;N++){let x=N*4,z=((h-1)*d+N)*4;c[x]=P[x],c[x+1]=P[x+1],c[x+2]=P[x+2],c[x+3]=P[x+3],c[z]=P[z],c[z+1]=P[z+1],c[z+2]=P[z+2],c[z+3]=P[z+3]}for(let N=1;N<h-1;N++){let x=N*d*4,z=(N*d+(d-1))*4;c[x]=P[x],c[x+1]=P[x+1],c[x+2]=P[x+2],c[x+3]=P[x+3],c[z]=P[z],c[z+1]=P[z+1],c[z+2]=P[z+2],c[z+3]=P[z+3]}return e};ce.addGetterSetter(wt,"embossStrength",.5,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"embossWhiteLevel",.5,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"embossDirection","top-left",void 0,ce.afterSetFilter),ce.addGetterSetter(wt,"embossBlend",!1,void 0,ce.afterSetFilter);function q0(e,t,n,r,o){const i=n-t,s=o-r;if(i===0)return r+s/2;if(s===0)return r;let a=(e-t)/i;return a=s*a+r,a}const AF=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],c=u,d;const h=this.enhance();if(h===0)return;for(let y=0;y<n;y+=4)i=t[y+0],i<r?r=i:i>o&&(o=i),l=t[y+1],l<s?s=l:l>a&&(a=l),d=t[y+2],d<u?u=d:d>c&&(c=d);o===r&&(o=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);let m,p,v,_,C,k;if(h>0)m=o+h*(255-o),p=r-h*(r-0),v=a+h*(255-a),_=s-h*(s-0),C=c+h*(255-c),k=u-h*(u-0);else{const y=(o+r)*.5;m=o+h*(o-y),p=r+h*(r-y);const b=(a+s)*.5;v=a+h*(a-b),_=s+h*(s-b);const T=(c+u)*.5;C=c+h*(c-T),k=u+h*(u-T)}for(let y=0;y<n;y+=4)t[y+0]=q0(t[y+0],r,o,p,m),t[y+1]=q0(t[y+1],s,a,_,v),t[y+2]=q0(t[y+2],u,c,k,C)};ce.addGetterSetter(wt,"enhance",0,mt(),ce.afterSetFilter);const IF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=.34*t[r]+.5*t[r+1]+.16*t[r+2];t[r]=o,t[r+1]=o,t[r+2]=o}};ce.addGetterSetter(wt,"hue",0,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"saturation",0,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"luminance",0,mt(),ce.afterSetFilter);const EF=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,c=.587*r-.587*a+.33*l,d=.114*r-.114*a-.497*l,h=.299*r-.299*a-.328*l,m=.587*r+.413*a+.035*l,p=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,_=.587*r-.586*a-1.05*l,C=.114*r+.886*a-.2*l;let k,y,b,T;for(let R=0;R<n;R+=4)k=t[R+0],y=t[R+1],b=t[R+2],T=t[R+3],t[R+0]=u*k+c*y+d*b+s,t[R+1]=h*k+m*y+p*b+s,t[R+2]=v*k+_*y+C*b+s,t[R+3]=T},xF=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,c=.114*r-.114*s-.497*a,d=.299*r-.299*s-.328*a,h=.587*r+.413*s+.035*a,m=.114*r-.114*s+.293*a,p=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,_=.114*r+.886*s-.2*a;for(let C=0;C<n;C+=4){const k=t[C+0],y=t[C+1],b=t[C+2],T=t[C+3];t[C+0]=l*k+u*y+c*b,t[C+1]=d*k+h*y+m*b,t[C+2]=p*k+v*y+_*b,t[C+3]=T}};ce.addGetterSetter(wt,"hue",0,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"saturation",0,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"value",0,mt(),ce.afterSetFilter);const TF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]};var RF=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),c=i-a,d=s-l;const h=Math.sqrt(c*c+d*d);u=h>u?h:u;const m=s,p=i,v=360/p*Math.PI/180;for(let _=0;_<p;_+=1){const C=Math.sin(_*v),k=Math.cos(_*v);for(let y=0;y<m;y+=1){c=Math.floor(a+u*y/m*k),d=Math.floor(l+u*y/m*C);let b=(d*i+c)*4;const T=r[b+0],R=r[b+1],P=r[b+2],j=r[b+3];b=(_+y*i)*4,o[b+0]=T,o[b+1]=R,o[b+2]=P,o[b+3]=j}}},MF=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),c=i-a,d=s-l;const h=Math.sqrt(c*c+d*d);u=h>u?h:u;const m=s,p=i,v=n.polarRotation||0;let _,C;for(c=0;c<i;c+=1)for(d=0;d<s;d+=1){const k=c-a,y=d-l,b=Math.sqrt(k*k+y*y)*m/u;let T=(Math.atan2(y,k)*180/Math.PI+360+v)%360;T=T*p/360,_=Math.floor(T),C=Math.floor(b);let R=(C*i+_)*4;const P=r[R+0],j=r[R+1],O=r[R+2],V=r[R+3];R=(d*i+c)*4,o[R+0]=P,o[R+1]=j,o[R+2]=O,o[R+3]=V}};const LF=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,c,d,h,m=Math.round(this.kaleidoscopePower());const p=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(p%360)/360);if(m<1)return;const _=Ie.createCanvasElement();_.width=t,_.height=n;const C=_.getContext("2d").getImageData(0,0,t,n);Ie.releaseCanvas(_),RF(e,C,{polarCenterX:t/2,polarCenterY:n/2});let k=t/Math.pow(2,m);for(;k<=8;)k=k*2,m-=1;k=Math.ceil(k);let y=k,b=0,T=y,R=1;for(v+k>t&&(b=y,T=0,R=-1),o=0;o<n;o+=1)for(r=b;r!==T;r+=R)i=Math.round(r+v)%t,d=(t*o+i)*4,a=C.data[d+0],l=C.data[d+1],u=C.data[d+2],c=C.data[d+3],h=(t*o+r)*4,C.data[h+0]=a,C.data[h+1]=l,C.data[h+2]=u,C.data[h+3]=c;for(o=0;o<n;o+=1)for(y=Math.floor(k),s=0;s<m;s+=1){for(r=0;r<y+1;r+=1)d=(t*o+r)*4,a=C.data[d+0],l=C.data[d+1],u=C.data[d+2],c=C.data[d+3],h=(t*o+y*2-r-1)*4,C.data[h+0]=a,C.data[h+1]=l,C.data[h+2]=u,C.data[h+3]=c;y*=2}MF(C,e,{polarRotation:0})};ce.addGetterSetter(wt,"kaleidoscopePower",2,mt(),ce.afterSetFilter),ce.addGetterSetter(wt,"kaleidoscopeAngle",0,mt(),ce.afterSetFilter);function im(e,t,n){let r=(n*e.width+t)*4;const o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function Of(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function PF(e){const t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function DF(e,t){const n=im(e,0,0),r=im(e,e.width-1,0),o=im(e,0,e.height-1),i=im(e,e.width-1,e.height-1),s=t||10;if(Of(n,r)<s&&Of(r,i)<s&&Of(i,o)<s&&Of(o,n)<s){const a=PF([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=Of(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function OF(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function FF(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const v=m*t+p,_=r[d*o+h];c+=e[v]*_}}s[u]=c===2040?255:0}return s}function NF(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const v=m*t+p,_=r[d*o+h];c+=e[v]*_}}s[u]=c>=1020?255:0}return s}function BF(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let c=0;for(let d=0;d<o;d++)for(let h=0;h<o;h++){const m=a+d-i,p=l+h-i;if(m>=0&&m<n&&p>=0&&p<t){const v=m*t+p,_=r[d*o+h];c+=e[v]*_}}s[u]=c}return s}const zF=function(e){let t=DF(e,this.threshold());return t&&(t=FF(t,e.width,e.height),t=NF(t,e.width,e.height),t=BF(t,e.width,e.height),OF(e,t)),e};ce.addGetterSetter(wt,"threshold",0,mt(),ce.afterSetFilter);const VF=function(e){const t=this.noise()*255,n=e.data,r=n.length,o=t/2;for(let i=0;i<r;i+=4)n[i+0]+=o-2*o*Math.random(),n[i+1]+=o-2*o*Math.random(),n[i+2]+=o-2*o*Math.random()};ce.addGetterSetter(wt,"noise",.2,mt(),ce.afterSetFilter);const HF=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,o=Math.ceil(n/t),i=Math.ceil(r/t),s=e.data;if(t<=0){Ie.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,c=0,d=0,h=0;const m=a*t,p=m+t,v=l*t,_=v+t;let C=0;for(let k=m;k<p;k+=1)if(!(k>=n))for(let y=v;y<_;y+=1){if(y>=r)continue;const b=(n*y+k)*4;u+=s[b+0],c+=s[b+1],d+=s[b+2],h+=s[b+3],C+=1}u=u/C,c=c/C,d=d/C,h=h/C;for(let k=m;k<p;k+=1)if(!(k>=n))for(let y=v;y<_;y+=1){if(y>=r)continue;const b=(n*y+k)*4;s[b+0]=u,s[b+1]=c,s[b+2]=d,s[b+3]=h}}};ce.addGetterSetter(wt,"pixelSize",8,mt(),ce.afterSetFilter);const jF=function(e){const t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,o=255/t;for(let i=0;i<r;i+=1)n[i]=Math.floor(n[i]/o)*o};ce.addGetterSetter(wt,"levels",.5,mt(),ce.afterSetFilter);const UF=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue();for(let s=0;s<n;s+=4){const a=(.34*t[s]+.5*t[s+1]+.16*t[s+2])/255;t[s]=a*r,t[s+1]=a*o,t[s+2]=a*i,t[s+3]=t[s+3]}};ce.addGetterSetter(wt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"blue",0,Ak,ce.afterSetFilter);const GF=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue(),s=this.alpha();for(let a=0;a<n;a+=4){const l=1-s;t[a]=r*s+t[a]*l,t[a+1]=o*s+t[a+1]*l,t[a+2]=i*s+t[a+2]*l}};ce.addGetterSetter(wt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(wt,"blue",0,Ak,ce.afterSetFilter),ce.addGetterSetter(wt,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});const WF=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=t[r+0],i=t[r+1],s=t[r+2];t[r+0]=Math.min(255,o*.393+i*.769+s*.189),t[r+1]=Math.min(255,o*.349+i*.686+s*.168),t[r+2]=Math.min(255,o*.272+i*.534+s*.131)}},KF=function(e){const n=e.data;for(let r=0;r<n.length;r+=4){const o=n[r],i=n[r+1],s=n[r+2];.2126*o+.7152*i+.0722*s>=128&&(n[r]=255-o,n[r+1]=255-i,n[r+2]=255-s)}return e},qF=function(e){const t=this.threshold()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=1)n[o]=n[o]<t?0:255};ce.addGetterSetter(wt,"threshold",.5,mt(),ce.afterSetFilter);var YF=n4.Util._assign(n4,{Arc:da,Arrow:sc,Circle:wu,Ellipse:il,Image:Wi,Label:U0,Tag:ac,Line:fa,Path:Ei,Rect:Lf,RegularPolygon:sl,Ring:lc,Sprite:Cs,Star:al,Text:tr,TextPath:qr,Transformer:En,Wedge:ha,Filters:{Blur:wF,Brightness:_F,Brighten:CF,Contrast:SF,Emboss:kF,Enhance:AF,Grayscale:IF,HSL:EF,HSV:xF,Invert:TF,Kaleidoscope:LF,Mask:zF,Noise:VF,Pixelate:HF,Posterize:jF,RGB:UF,RGBA:GF,Sepia:WF,Solarize:KF,Threshold:qF}});xt();var XF=["dialog","floating"],I4=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function ZF(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!XF.includes(e.mode))throw new Error(`SurfaceManager: mode must be "dialog" or "floating", got "${e.mode}".`);const t="kind"in e&&e.kind!=null,n="component"in e&&e.component!=null,r="render"in e&&typeof e.render=="function";if(n&&r)throw new Error('SurfaceManager: request cannot provide both "component" and "render". Use one or the other.');if(!t&&!n&&!r)throw new Error('SurfaceManager: request must provide "kind" (intent-based) or "component"/"render" (direct-render).');if(e.mode==="floating"&&e.floating?.placement!=null&&!I4.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${I4.join(", ")}, got "${e.floating.placement}".`)}var QF=class{activeDialog=Kr(null);activeFloating=Kr(null);#t=!1;#n=1;#e;constructor({getModuleConfig:e}){this.#e=e}open(e){if(this.#t)return this.#l(e);ZF(e);const t=this.#u(e),{component:n,props:r,render:o}=this.#d(t);let i,s=!1;const a=new Promise(m=>{i=p=>s?!1:(s=!0,m(p),!0)});let l;const u=m=>{i({status:"submitted",data:m})&&this.#s(l)},c=m=>{i({status:"closed",reason:m})&&this.#s(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:c,settle:m=>i(m),get settled(){return s}};const d=t.mode==="dialog"?"activeDialog":"activeFloating",h=this[d].value;return h&&!h.settled&&h.settle({status:"replaced",replacedBy:t.id}),this[d].value=l,{id:t.id,mode:t.mode,close:m=>this.#i(l,m),result:a}}close(e,t){if(e!=null){const o=this.#a(e);o&&this.#i(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#i(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#i(r,t)}settleAll(e){for(const t of[this.activeDialog,this.activeFloating]){const n=t.value;n&&!n.settled&&n.settle(e),t.value=null}}destroy(){this.#t=!0,this.settleAll({status:"destroyed"})}#i(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#s(e))}#s(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#a(e){return this.activeDialog.value?.id===e?this.activeDialog.value:this.activeFloating.value?.id===e?this.activeFloating.value:null}#u(e){const t=e.id??`surface-${this.#n++}`,n=this.#e()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#d(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#e()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#l(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},JF="https://docs.superdoc.dev/guides/migration/document-api",E4=new Set;function $F(e,t){E4.has(e)||(E4.add(e),console.warn(t))}var eN={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},x4=Symbol.for("superdoc:rawEditor"),T4=new WeakMap;function R4(e){return!e||e[x4]?e:new Proxy(e,{get(t,n){if(n===x4)return t;const r=eN[n];r&&$F(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${JF}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=T4.get(t);return i||(i=new Map,T4.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var M4=["review","original","final","off"],tN=["paired","independent"],L4=Symbol.for("@superdoc/trackChanges:normalized"),P4=new Set;function D4(e,t){P4.has(e)||(P4.add(e),console.warn(`[SuperDoc] ${e} is deprecated β€” use ${t} instead.`))}function O4(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function nN(e,t,n){return typeof e=="string"&&M4.includes(e)?e:typeof t=="string"&&M4.includes(t)?t:n}function rN(e){return typeof e=="string"&&tN.includes(e)?e:null}function cc(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function oN(e){const t=e[L4]===!0;cc(e.modules)||(e.modules={});const n=cc(e.modules.trackChanges),r=cc(e.trackChanges),o=cc(e.layoutEngineOptions?.trackedChanges);t||(r&&D4("config.trackChanges","config.modules.trackChanges"),o&&D4("config.layoutEngineOptions.trackedChanges","config.modules.trackChanges"));const i=O4(n?.visible,r?.visible,!1),s=O4(n?.enabled,o?.enabled,!0),a=rN(n?.replacements)??"paired",l=cc(n?.authorColors)?n.authorColors:void 0,u=cc(n?.semanticColors)?n.semanticColors:void 0,c=e.documentMode==="viewing"?i?"review":"original":"review",d=nN(n?.mode,o?.mode,c),h={visible:i,mode:d,enabled:s,replacements:a};return l&&(h.authorColors=l),u&&(h.semanticColors=u),e.modules.trackChanges=h,e.trackChanges={visible:i},cc(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:d,enabled:s},Object.defineProperty(e,L4,{value:!0,writable:!0,configurable:!0,enumerable:!1}),h}const Y0=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function iN(e){return!e||typeof e!="object"?{...Y0}:{...Y0,...e}}var F4=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),sN=Object.freeze(["left","center","right"]),FU=Object.freeze(Object.keys(F4)),_u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function N4(e,t){const n=e?.[t];return n===!1?!1:n===void 0?F4[t]:!0}function aN(e,t){const n=e?.[t];return _u(n)?n:{}}var B4=Object.freeze(["readOnly","allowResolve","permissionResolver"]);function lN(e){if(!B4.some(n=>n in e))return e;const t={...e};for(const n of B4)delete t[n];return t}function z4(e={}){const t=e.ui,n=t===!1,r=_u(t)?t:void 0,o=T=>!n&&N4(r,T),i=T=>n?!1:r?.[T]===void 0?void 0:N4(r,T),s=T=>n?{}:aN(r,T),a=n||i("ruler")===!1,l=s("toolbar"),u=e.modules?.toolbar,c=_u(u)?u:{},d=e.modules?.contextMenu??e.modules?.slashMenu,h=_u(d)?d:{},m=e.modules?.surfaces?.findReplace,p=_u(m)?m:{},v=[l.groups,c.groups],_=v.find(_u),C=N_(v.find(Array.isArray),c.toolbarGroups,e.toolbarGroups),k=Array.isArray(C)?C:null,y=(T,R)=>Object.prototype.hasOwnProperty.call(T,R),b=_&&k?Object.fromEntries([...k.filter(T=>y(_,T)),...Object.keys(_).filter(T=>!sN.includes(T))].map(T=>[T,_[T]])):_;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:N_(l.container,c.selector,e.toolbar)??null,options:n?{}:{...tl(c,l),groups:b,toolbarGroups:C,icons:tl(e.toolbarIcons,c.icons,l.icons),texts:tl(e.toolbarTexts,c.texts,l.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:L_(lN(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:tl(h,s("contextMenu"))},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:tl(p,s("search"))},linkPopover:{enabled:i("linkPopover")??(!n&&!!e.modules?.links?.popoverResolver),suppressed:n||i("linkPopover")===!1,options:s("linkPopover")},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),options:s("contentControls")}}}var X0=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function V4(e={}){const t=X0(e.interaction)?e.interaction:{},n=X0(t.comments)?t.comments:{},r=X0(e.modules?.comments)?e.modules.comments:{};return{comments:{readOnly:(n.readOnly??r.readOnly??!1)===!0,allowResolve:(n.allowResolve??r.allowResolve??!0)!==!1}}}var H4=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function j4(e={}){const t=H4(e.surfaces)?e.surfaces:{},n=H4(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:tl(n.dialog,t.dialog),floating:tl(n.floating,t.floating)}}var cN=class{#t=new Map;#n=new Map;#e=null;#i=new Set;register(e){if(this.#t.has(e.id))throw new Error(`EditorRuntimeRegistry: duplicate runtime id "${e.id}"`);const t=e.root,n=t?this.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#t.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#t.get(e);return t?(this.#t.delete(e),t.root&&this.#n.delete(t.root),this.#e===e&&(this.#e=null,this.#s({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#t.get(e)??null}getAll(){return Array.from(this.#t.values())}getAllByDocumentId(e){const t=[];for(const n of this.#t.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#e===null?null:this.#t.get(this.#e)}getActiveId(){return this.#e}setActive(e,t){if(e!==null&&!this.#t.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#e)return;const n=this.#e;this.#e=e;let r=null;e!==null&&(r=this.#t.get(e).getLegacyEditorProjection?.()??null),this.#s({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${zp}]`);if(!n)return null;const r=n.getAttribute(zp),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#i.add(e),()=>{this.#i.delete(e)}}clear(){this.#t.clear(),this.#n.clear(),this.#e=null,this.#i.clear()}#s(e){for(const t of Array.from(this.#i))try{t(e)}catch{}}};const lt={notReady:"not-ready",documentApiUnavailable:"document-api-unavailable",documentReadonly:"document-readonly",selectionRequired:"selection-required",rangeSelectionRequired:"range-selection-required",contextUnavailable:"context-unavailable",geometryUnavailable:"geometry-unavailable",targetUnresolved:"target-unresolved",targetNotVisible:"target-not-visible",commandUnsupported:"command-unsupported",commandDeferred:"command-deferred",tableContextUnavailable:"table-context-unavailable",operationUnavailable:"operation-unavailable",bulkDecisionsDisabled:"bulk-decisions-disabled",hostCapabilityUnavailable:"host-capability-unavailable",historyEmpty:"history-empty",searchUnavailable:"search-unavailable",searchInvalidPattern:"search-invalid-pattern",replaceUnsupported:"replace-unsupported",contentControlLocked:"content-control-locked"},U4={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",fontFamily:"font-family",fontSize:"font-size",setFontFamily:"setFontFamily",setFontSize:"setFontSize",undo:"undo",redo:"redo",acceptChange:"acceptChange",rejectChange:"rejectChange",acceptAllChanges:"acceptAllChanges",rejectAllChanges:"rejectAllChanges",bulletList:"bullet-list",numberedList:"numbered-list"};function G4(e){const t=n=>typeof n=="string"?n.replace(/\s*pt$/i,"").trim():n;if(typeof e=="string")return t(e);if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return e}function uN(e){const t=(n,r)=>!r&&n>0&&n<=5?n*100:n;if(typeof e=="string"){const n=e.includes("%"),r=Number.parseFloat(e.replace("%","").trim());return Number.isFinite(r)?t(r,n):e}return typeof e=="number"&&Number.isFinite(e)?t(e,!1):e}function dN(e){const t=e&&typeof e=="object"&&"value"in e?e.value:e;if(t==="in"||t==="cm")return t;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="in"||n==="inch"||n==="inches")return"in";if(n==="cm"||n==="centimeter"||n==="centimeters"||n==="centimetre"||n==="centimetres")return"cm"}return t}function W4(e){const t=n=>{if(n===null)return null;if(typeof n!="string")return n;const r=n.trim();return r===""?n:/^#[0-9a-fA-F]{6}$/.test(r)?r:/^[0-9a-fA-F]{6}$/.test(r)?`#${r}`:r};if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return t(e)}function Z0(e,t){if(e&&typeof e=="object"){const n=e;for(const r of t)if(r in n)return n[r]}return e}function fN(e){const t=Z0(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function hN(e){const t=Z0(e,["line","lineHeight","value"]),n=typeof t=="number"?t:typeof t=="string"?Number.parseFloat(t.trim()):NaN;return!Number.isFinite(n)||n<=0?t:n<=10?Math.round(n*240):Math.round(n)}function pN(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=Z0(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function mN(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e.mode;if(typeof t=="string")return t}return e}var gN=lt.commandUnsupported,_s=lt.tableContextUnavailable;const K4=[{id:"bold",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.bold",activeMark:"bold",inline:{key:"bold",kind:"toggle"}},{id:"italic",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.italic",activeMark:"italic",inline:{key:"italic",kind:"toggle"}},{id:"underline",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.underline",activeMark:"underline",inline:{key:"underline",kind:"toggle"}},{id:"strikethrough",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.strikethrough",activeMark:"strikethrough",inline:{key:"strike",kind:"toggle"}},{id:"font-family",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliases:["setFontFamily"],inline:{key:"fontFamily",kind:"value-string"}},{id:"font-size",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliases:["setFontSize"],normalizePayload:G4,inline:{key:"fontSize",kind:"value-number"}},{id:"setFontFamily",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliasOf:"font-family",inline:{key:"fontFamily",kind:"value-string"}},{id:"setFontSize",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliasOf:"font-size",normalizePayload:G4,inline:{key:"fontSize",kind:"value-number"}},{id:"undo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.undo"},{id:"redo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.redo"},{id:"acceptChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliases:["track-changes-accept-selection"]},{id:"rejectChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliases:["track-changes-reject-selection"]},{id:"acceptAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"all"}},{id:"rejectAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"all"}},{id:"track-changes-accept-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliasOf:"acceptChange"},{id:"track-changes-reject-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliasOf:"rejectChange"},{id:"zoom",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoom",valueFrom:"zoom",normalizePayload:uN},{id:"zoom-fit-width",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoomMode",fixedArg:"fit-width",valueFrom:"zoom"},{id:"document-mode",family:"document",disposition:"routed",mutates:!1,instanceRoute:"setDocumentMode",valueFrom:"documentMode",normalizePayload:mN},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:dN},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:W4},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:W4},{id:"link",family:"links",disposition:"routed",mutates:!0,docRoute:"hyperlinks.wrap",activeMark:"link",link:{kind:"link"}},{id:"text-align",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setAlignment",blockParagraph:{kind:"alignment"},normalizePayload:fN},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:hN},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:pN},{id:"bullet-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"bullet"}},{id:"numbered-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"ordered"}},{id:"indent-increase",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.indent",list:{mode:"indent"}},{id:"indent-decrease",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.outdent",list:{mode:"outdent"}},{id:"direction-ltr",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"ltr"}},{id:"direction-rtl",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"rtl"}},{id:"clear-formatting",family:"formatting",disposition:"routed",mutates:!0,docRoute:"format.apply",inline:{key:"*",kind:"clear"}},{id:"image",family:"media",disposition:"routed",mutates:!0,docRoute:"create.image",create:{kind:"image"}},{id:"table-of-contents-insert",family:"TOC",disposition:"routed",mutates:!0,docRoute:"create.tableOfContents",create:{kind:"toc"}},{id:"table-insert",family:"tables",disposition:"routed",mutates:!0,docRoute:"create.table",create:{kind:"table"}},{id:"table-add-row-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-before",op:"insertRow"},reason:_s},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:_s},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:_s},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:_s},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:_s},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:_s},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:_s},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:_s},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:_s},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:_s},{id:"ruler",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleRuler",valueFrom:"ruler"},{id:"formatting-marks",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleFormattingMarks",valueFrom:"formattingMarks"},{id:"copy-format",family:"formatting",disposition:"routed",mutates:!1},{id:"table-fix",family:"tables",disposition:"unsupported",mutates:!0,reason:gN}];var vN=new Map(K4.map(e=>[e.id,e]));const yN=K4.map(e=>e.id);function Su(e){return vN.get(e)??null}var bN=["table-add-row-before","table-add-row-after","table-delete-row","table-add-column-before","table-add-column-after","table-delete-column","table-delete","table-merge-cells","table-split-cell","table-remove-borders"];const q4=[{name:"bold",commandId:"bold",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"italic",commandId:"italic",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"underline",commandId:"underline",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"strike",commandId:"strikethrough",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"clearFormatting",commandId:"clear-formatting",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"copyFormat",commandId:"copy-format",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontFamily",commandId:"font-family",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontSize",commandId:"font-size",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"color",commandId:"text-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"highlight",commandId:"highlight-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"textAlign",commandId:"text-align",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"list",commandId:"bullet-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"numberedlist",commandId:"numbered-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentleft",commandId:"indent-decrease",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentright",commandId:"indent-increase",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"lineHeight",commandId:"line-height",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"linkedStyles",commandId:"linked-style",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"link",commandId:"link",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"image",commandId:"image",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:bN,note:"table editing dropdown is shell chrome; its member commands are controller-routed through the shared table-context facade (ui.tables / host.getTableContext()) and fail closed with table-context-unavailable when the caret is not in a table"},{name:"undo",commandId:"undo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"redo",commandId:"redo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"search",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"right",note:"built-in search button; opens the shared find/replace surface (the same one Cmd/Ctrl+F opens) by emitting a `search:open` event on the SuperDoc instance, which the shell handles. The surface reads/drives the controller search surface (ui.search), backed by the single V2 host search session (host.search) which owns query, navigation, reveal, and replace. Find/navigation are always available when the host exposes search; replace/replaceAll mutate through the host session and fail closed (document-readonly) in viewing/read-only mode. If a runtime cannot expose search, the surface fails closed with search-unavailable"},{name:"zoom",commandId:"zoom",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"measurementUnit",commandId:"measurement-unit",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"ruler",commandId:null,instanceMethod:"toggleRuler",disposition:"host-routed",group:"right",note:"built-in shell toggles ruler visibility through the public SuperDoc.toggleRuler() instance method; the controller also routes the ruler command through it so custom UIs drive the same chrome (active state from config.rulers)"},{name:"formattingMarks",commandId:null,instanceMethod:"toggleFormattingMarks",disposition:"host-routed",group:"right",note:"built-in shell toggles nonprinting marks through the public SuperDoc.toggleFormattingMarks()/setShowFormattingMarks() instance methods (not a controller command)"},{name:"documentMode",commandId:"document-mode",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"acceptTrackedChangeBySelection",commandId:"track-changes-accept-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"rejectTrackedChangeOnSelection",commandId:"track-changes-reject-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"customButtons",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",note:"consumer-defined buttons the rendered shell owns; their execution context surface is phase 2"}];var Y4=new Map(q4.map(e=>[e.name,e]));const NU=q4.map(e=>e.name);function Q0(e){return Y4.get(e)??null}function wN(e){const t=Y4.get(e);return t?.disposition==="controller-routed"?t.commandId:null}const CN=".png,.jpg,.jpeg,image/png,image/jpeg";var X4=new Set(["image/png","image/jpeg","image/jpg"]),_N=/\.(png|jpe?g)$/i;function SN(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?X4.has(t):_N.test(String(e.name??""))}function Z4(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(kN(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function kN(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(X4.has(r))return e;const o=String(t?.name??""),i=/\.jpe?g$/i.test(o)?"image/jpeg":/\.png$/i.test(o)?"image/png":null;return i?`data:${i};base64,${e.slice(n[0].length)}`:e}async function AN(e,t){if(typeof t=="function"){const n=await t(e);if(typeof n!="string"||n.trim()==="")throw new Error("handleImageUpload returned an empty result");return n.startsWith("data:")?n:IN(n,e)}return Z4(e)}async function IN(e,t){const n=await fetch(e);if(!n.ok)throw new Error(`image fetch failed: ${n.status}`);const r=await n.blob(),o=(/\.(?:png|jpe?g)(?:$|[?#])/i.test(e)?e.split(/[?#]/)[0]:"")||t?.name||"";return Z4(o?Object.assign(r,{name:o}):r)}function EN({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=CN,r.hidden=!0,r.tabIndex=-1,r.setAttribute("data-superdoc-image-picker","true"),r.setAttribute("aria-hidden","true"),r.addEventListener("change",()=>{const o=r.files&&r.files[0];if(r.value="",!!o){if(!SN(o)){n?.(new Error(`unsupported image type: ${o.type||o.name}`));return}try{const i=t?.(o);i&&typeof i.then=="function"&&i.catch(s=>n?.(s))}catch(i){n?.(i)}}}),e.body?.appendChild(r),{input:r,open(){r.click()},destroy(){r.remove()}}}var xN=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},TN=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const c=Date.now();!s&&n.leading===!1&&(s=c);const d=t-(c-s);return o=u,d<=0||d>t?(r&&(clearTimeout(r),r=null),s=c,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,d)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};xt(),gn();var RN={class:"sd-toolbar-icon"},MN=["innerHTML"],LN={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=ke(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=ke(()=>["color","highlight"].includes(t.name));return(o,i)=>(ge(),Ae("div",RN,[Me("div",{class:rn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,MN),r.value?(ge(),Ae("div",{key:0,class:"color-bar",style:yn(n.value)},null,4)):ht("",!0)]))}},Q4=fn(LN,[["__scopeId","data-v-d7d79424"]]);xt(),gn();var PN=["role","aria-label"],DN=["data-item"],ON=["data-item"],FN={key:1,class:"sd-button-label"},NN=["data-item","aria-label"],BN=["innerHTML"],zN={key:2},VN=["onKeydown","id"],HN=["placeholder","onKeydown","id","data-item"],jN=["data-item","innerHTML"],UN={"aria-live":"polite",class:"sd-visually-hidden"},GN={__name:"ToolbarButton",props:{iconColor:{type:String,default:null},active:{type:Boolean,default:!1},isNarrow:{type:Boolean,default:!1},isWide:{type:Boolean,default:!1},toolbarItem:{type:Object,required:!0},defaultLabel:{type:String,default:null},isOverflowItem:{type:Boolean,default:!1},allowEnterPropagation:{type:Boolean,default:!1}},emits:["buttonClick","textSubmit","mainClick"],setup(e,{emit:t}){const n=t,{proxy:r}=ir(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:c,hasCaret:d,splitButton:h,disabled:m,expand:p,inlineTextInputVisible:v,hasInlineTextInput:_,minWidth:C,style:k,attributes:y}=o.toolbarItem,b=ke(()=>!!h?.value&&!!d?.value),T=ke(()=>i?.value??""),R=ne(""),P=ne(null),{isHighContrastMode:j}=Hi();Lt(()=>l?.value,Se=>{document.activeElement!==P.value&&(R.value=Se==null?"":String(Se))},{immediate:!0});const O=()=>{_&&_t(()=>{P.value?.focus(),P.value?.select()}),n("buttonClick")},V=Se=>{m?.value||(Se?.stopPropagation(),n("mainClick"))},Q=()=>{b.value||O()},F=Se=>{if(b.value){V(Se);return}O()},N=Se=>{o.allowEnterPropagation||Se.stopPropagation(),F(Se)},x=Se=>{const re=o.toolbarItem?.nestedOptions?.value??[],xe=Se.trim();if(!xe)return"";const $e=re.find(st=>typeof st?.label=="string"&&st.label.toLowerCase()===xe.toLowerCase());return $e?.label?$e.label:re.find(st=>typeof st?.label=="string"&&st.label.toLowerCase().startsWith(xe.toLowerCase()))?.label??xe},z=()=>{const Se=String(R.value??"").trim();let re=Se;if(T.value==="fontSize"){const xe=Number.parseFloat(Se);re=Se.match(/^\d+(\.5)?$/)?Se:Number.isFinite(xe)?Math.floor(xe).toString():""}else T.value==="fontFamily"&&(re=x(Se));return re?(n("textSubmit",re),R.value=re,!0):!1},J=Se=>{const re=Se?.currentTarget;re instanceof HTMLInputElement&&(re.focus({preventScroll:!0}),re.select())},X=Se=>{requestAnimationFrame(()=>{const re=document.getElementById(`inlineTextInput-${Se}`);re instanceof HTMLInputElement&&(re.focus({preventScroll:!0}),re.select())})},ae=()=>{const Se=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Se instanceof HTMLElement?(Se.focus({preventScroll:!0}),!0):!1},pe=()=>{const Se=r?.$toolbar?.pendingSelectionCapture,re=()=>{Se&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Se)};if(ae()){re();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),re())},Fe=()=>{z()&&pe()},fe=Se=>{if(z(),Se.shiftKey){T.value==="fontSize"&&(Se.preventDefault(),_t(()=>X("fontFamily")));return}if(Se.preventDefault(),T.value==="fontFamily"){_t(()=>X("fontSize"));return}T.value==="fontSize"&&_t(pe)},ye=ke(()=>k.value?k.value:{minWidth:o.minWidth}),le=ke(()=>p?.value?er.dropdownCaretUp:er.dropdownCaretDown);return(Se,re)=>(ge(),Ae("div",{class:rn(["sd-toolbar-item",et(y).className]),style:yn(ye.value),role:e.isOverflowItem?"menuitem":"button","aria-label":et(y).ariaLabel,"data-sd-part":"toolbar-item",onClick:Q,onKeydown:re[9]||(re[9]=Yo(xe=>N(xe),["enter"])),tabindex:"0"},[Me("div",{class:rn(["sd-toolbar-button",{"sd-active":et(s),"sd-disabled":et(m),narrow:e.isNarrow,wide:e.isWide,split:b.value,"has-inline-text-input":et(_),"high-contrast":et(j)}]),"data-item":`btn-${et(i)||""}`},[b.value?(ge(),Ae("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${et(i)||""}-main`,onClick:re[0]||(re[0]=xe=>V(xe))},[et(a)?(ge(),dn(Q4,{key:0,color:et(c),class:"sd-toolbar-icon",icon:et(a),name:et(i)},null,8,["color","icon","name"])):ht("",!0),et(l)&&!et(u)&&!et(v)?(ge(),Ae("div",FN,Bt(et(l)),1)):ht("",!0)],8,ON)):ht("",!0),b.value?(ge(),Ae("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${et(i)||""}-caret`,"aria-label":`${et(y).ariaLabel} options`,role:"button"},[Me("div",{class:"sd-dropdown-caret",innerHTML:le.value,style:yn({opacity:et(m)?.6:1})},null,12,BN)],8,NN)):(ge(),Ae(Wt,{key:2},[et(a)?(ge(),dn(Q4,{key:0,color:et(c),class:"sd-toolbar-icon",icon:et(a),name:et(i)},null,8,["color","icon","name"])):ht("",!0),et(l)&&!et(u)&&(!et(v)||T.value==="fontFamily")?(ge(),Ae("div",{key:1,class:rn(["sd-button-label",{"sd-visually-hidden":et(v)&&T.value==="fontFamily"}])},Bt(et(l)),3)):ht("",!0),et(v)?(ge(),Ae("span",zN,[et(i)==="fontSize"?Us((ge(),Ae("input",{key:0,"onUpdate:modelValue":re[1]||(re[1]=xe=>R.value=xe),onKeydown:[Yo(tn(Fe,["stop","prevent"]),["enter"]),re[2]||(re[2]=Yo(xe=>fe(xe),["tab"]))],onClick:re[3]||(re[3]=tn(xe=>J(xe),["stop"])),onFocus:re[4]||(re[4]=xe=>J(xe)),type:"text",class:rn(["button-text-input button-text-input--font-size",{"high-contrast":et(j)}]),id:"inlineTextInput-"+et(i),autocomplete:"off",ref_key:"inlineInput",ref:P},null,42,VN)),[[Ai,R.value]]):Us((ge(),Ae("input",{key:1,"onUpdate:modelValue":re[5]||(re[5]=xe=>R.value=xe),placeholder:et(l),onKeydown:[Yo(tn(Fe,["stop","prevent"]),["enter"]),re[6]||(re[6]=Yo(xe=>fe(xe),["tab"]))],onClick:re[7]||(re[7]=tn(xe=>J(xe),["stop"])),onFocus:re[8]||(re[8]=xe=>J(xe)),type:"text",class:rn(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":et(j)}]),id:"inlineTextInput-"+et(i),"data-item":T.value==="fontFamily"?`btn-${et(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:P},null,42,HN)),[[Ai,R.value]])])):ht("",!0),et(d)?(ge(),Ae("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${et(i)||""}-toggle`,innerHTML:le.value,style:yn({opacity:et(m)?.6:1})},null,12,jN)):ht("",!0)],64)),Me("div",UN,Bt(`${et(y).ariaLabel} ${et(s)?"selected":"unset"}`),1)],10,DN)],46,PN))}},J0=fn(GN,[["__scopeId","data-v-dbdea151"]]);xt(),gn();var WN={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},KN={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ge(),Ae("div",WN,[Me("div",{class:"separator-inner",style:yn({backgroundColor:r()})},null,4)]))}},qN=fn(KN,[["__scopeId","data-v-cb82253a"]]);xt(),gn();var YN={class:"overflow-menu"},XN={class:"overflow-menu-trigger"},ZN={key:0,class:"overflow-menu_items",role:"group"},QN={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0}},emits:["buttonClick","close"],setup(e,{emit:t}){const{proxy:n}=ir(),r=t,o=e,i=ke(()=>o.toolbarItem.expand.value),s=ne(!1),a=ke(()=>({...o.toolbarItem,active:i.value})),l=()=>{r("buttonClick",o.toolbarItem)},u=({item:d,argument:h})=>{n.$toolbar.emitCommand({item:d,argument:h})},c=d=>{d.key==="Escape"&&i.value&&!s.value&&(d.preventDefault(),r("close"))};return Nn(()=>{document.addEventListener("keydown",c,!0)}),or(()=>{document.removeEventListener("keydown",c,!0)}),(d,h)=>(ge(),Ae("div",YN,[Me("div",XN,[jt(J0,{"toolbar-item":a.value,onButtonClick:l},null,8,["toolbar-item"])]),i.value?(ge(),Ae("div",ZN,[jt(cm,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"from-overflow":"",onCommand:u,onDropdownUpdateShow:h[0]||(h[0]=m=>s.value=m)},null,8,["toolbar-items"])])):ht("",!0)]))}},JN=fn(QN,[["__scopeId","data-v-504ecd05"]]);xt(),gn();var $N={class:"toolbar-dropdown"},eB=["onClick"],tB={key:0,class:"toolbar-dropdown-option__icon"},nB={class:"toolbar-dropdown-option__label"},sm='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',rB={__name:"ToolbarDropdown",props:{options:{type:Array,default:()=>[]},show:{type:Boolean,required:!0},placement:{type:String,default:"bottom-start"},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})},menuProps:{type:Function,default:null},nodeProps:{type:Function,default:null}},emits:["update:show","select"],setup(e,{emit:t}){const n=e,r=t,o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px",maxHeight:"none"}),a=ne([]),l=ne(-1),u=ke(()=>!!n.show),c=ke(()=>n.options.some(re=>re?.type==="render")),d=ke(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),h=ke(()=>{const{class:re,style:xe,...$e}=d.value;return $e}),m=ke(()=>{const re=d.value.class,xe=n.options.length>0&&n.options.every($e=>$e&&$e.type==="render");return["toolbar-dropdown-menu",re,{"toolbar-dropdown-menu--render-only":xe}]}),p=ke(()=>{const re=d.value.style||{};return{...n.contentStyle,...re}}),v=ke(()=>({...p.value,position:"fixed",top:s.value.top,left:s.value.left,maxHeight:s.value.maxHeight,zIndex:2e3})),_=re=>{r("update:show",re)},C=()=>{u.value&&_(!1)},k=()=>{if(!o.value)return;const re=o.value.getBoundingClientRect(),xe=i.value,$e=xe?.offsetWidth??0,st=xe?.scrollHeight??xe?.offsetHeight??0,At=window.innerWidth||document.documentElement.clientWidth||0,Ee=window.innerHeight||document.documentElement.clientHeight||0,Ge=8,qe=4,Z=re.bottom+qe,S=re.top-qe,ee=Math.max(0,Ee-Z-Ge),D=Math.max(0,S-Ge),U=ee<st&&D>ee,H=U?D:ee,G=st?Math.min(st,H):H,te=U?Math.max(Ge,S-G):Z;let Y=re.left;n.placement==="bottom-end"&&(Y=re.right-$e);const K=Math.max(Ge,At-$e-Ge);Y=Math.min(Math.max(Ge,Y),K),s.value={top:`${te}px`,left:`${Y}px`,maxHeight:`${H}px`}},y=()=>{n.disabled||_(!u.value)},b=re=>typeof n.nodeProps!="function"?{}:n.nodeProps(re)||{},T=re=>{re?.disabled||re?.type!=="render"&&(r("select",re?.key,re),C())},R=re=>re?.type==="render",P=re=>!re?.disabled&&re?.type!=="render",j=re=>typeof re?.icon=="function"||!!re?.icon,O=re=>typeof re?.icon=="function"?re.icon(re):re?.icon||null,V=re=>re?typeof re=="string"?re.split(/\s+/).includes("sd-selected"):Array.isArray(re)?re.some(V):typeof re=="object"?!!re["sd-selected"]:!1:!1,Q=re=>V(re?.props?.class)||V(re?.class),F=()=>n.options.map((re,xe)=>P(re)?xe:-1).filter(re=>re>=0),N=()=>{const re=n.options.findIndex(xe=>P(xe)&&Q(xe));return re>=0?re:F()[0]??-1},x=(re,xe)=>{if(!re){delete a.value[xe];return}a.value[xe]=re},z=()=>{a.value.forEach((xe,$e)=>{xe&&xe.setAttribute("tabindex",$e===l.value?"0":"-1")});const re=a.value[l.value];re&&typeof re.focus=="function"&&(re.focus(),re.scrollIntoView?.({block:"nearest",inline:"nearest"}))},J=re=>{const xe=F();if(!xe.length){l.value=-1;return}const $e=xe.indexOf(l.value);if($e<0){l.value=re>0?xe[0]:xe[xe.length-1];return}l.value=xe[($e+re+xe.length)%xe.length]},X=()=>{let re=n.options[l.value];if(!P(re)){const xe=F()[0];re=xe===void 0?null:n.options[xe]}re&&T(re)},ae=jl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(re){return()=>typeof re.option.render!="function"?null:re.option.render()}}),pe=jl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(re){return()=>O(re.option)}}),Fe=re=>{if(!u.value)return;const xe=re.target;if(!(xe instanceof Element))return;const $e=o.value?.contains(xe),st=i.value?.contains(xe);$e||st||C()},fe=ne(null),ye=()=>{const re=o.value,xe=document.activeElement;if(re&&xe instanceof HTMLElement&&re.contains(xe)){fe.value=xe;return}fe.value=re?.matches?.(sm)?re:re?.querySelector(sm)},le=()=>{const re=fe.value;if(re instanceof HTMLElement&&document.contains(re)){re.focus();return}const xe=o.value;if(!xe)return;const $e=xe.matches?.(sm)?xe:xe.querySelector(sm);if($e instanceof HTMLElement){$e.focus();return}xe.setAttribute("tabindex","-1"),xe.focus()},Se=re=>{if(!u.value)return;const{key:xe}=re;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(xe)){if(xe==="Escape"){re.preventDefault(),C(),_t(()=>{requestAnimationFrame(le)});return}if(!c.value){if(re.preventDefault(),xe==="ArrowDown"){J(1),z();return}if(xe==="ArrowUp"){J(-1),z();return}xe==="Enter"&&X()}}};return Lt(u,async re=>{if(!re){l.value=-1,a.value=[];return}ye(),await _t(),k(),!c.value&&(l.value=N(),await _t(),z())},{immediate:!0}),Lt(u,re=>{re?(document.addEventListener("pointerdown",Fe,!0),document.addEventListener("keydown",Se,!0),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0)):(document.removeEventListener("pointerdown",Fe,!0),document.removeEventListener("keydown",Se,!0),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0))},{immediate:!0}),or(()=>{document.removeEventListener("pointerdown",Fe,!0),document.removeEventListener("keydown",Se,!0),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}),(re,xe)=>(ge(),Ae("div",$N,[Me("div",{ref_key:"triggerRef",ref:o,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:y},[Ad(re.$slots,"trigger",{},void 0,!0)],512),(ge(),dn(Ha,{to:"body"},[jt(Xh,{name:"fade-in-scale-up-transition"},{default:Eo(()=>[u.value?(ge(),Ae("div",fs({key:0,ref_key:"menuRef",ref:i,"data-sd-part":"dropdown-menu",class:m.value,style:v.value},h.value),[(ge(!0),Ae(Wt,null,rr(e.options,($e,st)=>(ge(),Ae("div",fs({key:$e.key,ref_for:!0,ref:At=>x(At,st),class:["toolbar-dropdown-option",[$e.class,$e.props?.class,{"sd-disabled":$e.disabled,"sd-render":R($e)}]],tabindex:"-1",onClick:At=>T($e)},{ref_for:!0},{...$e.props,...b($e)}),[R($e)?(ge(),dn(et(ae),{key:0,option:$e},null,8,["option"])):(ge(),Ae(Wt,{key:1},[j($e)?(ge(),Ae("span",tB,[jt(et(pe),{option:$e},null,8,["option"])])):ht("",!0),Me("span",nB,Bt($e.label),1)],64))],16,eB))),128))],16)):ht("",!0)]),_:1})]))]))}},oB=fn(rB,[["__scopeId","data-v-fef410f7"]]),J4=e=>String(e??"").trim().toLowerCase();const am=(e,t)=>{const n=J4(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(J4(t[r]).startsWith(n))return r;return-1},iB=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=am(r,t),i=o>=0?String(t[o]??""):"";return n&&o>=0&&i.length>r.length?{matchIndex:o,display:i,selectionStart:r.length,selectionEnd:i.length}:{matchIndex:o,display:r,selectionStart:r.length,selectionEnd:r.length}};var sB=e=>{let t=String(e??"").trim();for(;t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"));)t=t.slice(1,-1).trim();return t},aB=e=>e<=31||e===127,lB=e=>e===32||e===160||e===65279,cB=e=>Array.from(String(e)).filter(t=>!aB(t.charCodeAt(0))).join(""),uB=e=>{let t="",n=!1;for(const r of String(e)){if(lB(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t};const dB=e=>uB(sB(cB(String(e??"").split(",")[0]??""))).trim();var fB=1,hB=1638;const pB=e=>{const t=String(e??"").replace(/[^0-9.-]/g,""),n=Number.parseFloat(t);if(!Number.isFinite(n))return"";const r=Math.round(n*2)/2;return r<fB?"":String(Math.min(r,hB))};xt(),gn();var mB=["data-item"],gB=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],vB=["data-item","aria-label","disabled"],yB=["innerHTML"],bB=["id","aria-label"],wB=["id","aria-selected","aria-label","onMousedown","onMouseenter"],CB={class:"toolbar-dropdown-option__label"},_B={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},SB={__name:"ToolbarComboBox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},showPreview:{type:Boolean,default:!1},normalizeValue:{type:Function,default:e=>String(e??"").trim()}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t,{isHighContrastMode:o}=Hi(),i=ne(null),s=ne(null),a=ne(null),l=ne([]),u=ne(!1),c=ne(!1),d=ne(-1),h=ne(""),m=ne(""),p=ne(!1),v=ne({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),_=ke(()=>n.item.nestedOptions?.value??[]),C=ke(()=>_.value.map(Y=>String(Y?.label??""))),k=ke(()=>String(n.item.label?.value??"")),y=ke(()=>!!n.item.disabled?.value),b=ke(()=>String(n.item.name?.value??"")),T=ke(()=>n.item.attributes?.value?.ariaLabel??"Font family"),R=ke(()=>u.value?m.value:k.value),P=ke(()=>`sd-${b.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),j=Y=>`${P.value}-option-${Y}`,O=ke(()=>c.value&&d.value>=0?j(d.value):void 0),V=ke(()=>c.value?er.dropdownCaretUp:er.dropdownCaretDown),Q=Y=>{const K=String(Y??"").trim().toLowerCase();return _.value.find(be=>String(be?.label??"").trim().toLowerCase()===K)?.props?.style?.fontFamily||Y||n.uiFontFamily},F=ke(()=>n.showPreview?{fontFamily:Q(u.value?m.value:k.value)}:{fontFamily:n.uiFontFamily}),N=()=>{const Y=n.item.selectedValue?.value;if(Y){const K=_.value.findIndex(be=>be?.key===Y);if(K>=0)return K}return C.value.findIndex(K=>K.toLowerCase()===k.value.toLowerCase())},x=(Y,K)=>{const be=i.value;if(!(!be||typeof be.setSelectionRange!="function"))try{be.setSelectionRange(Y,K)}catch{}},z=()=>{l.value[d.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},J=()=>{l.value[d.value]?.focus?.()},X=()=>{const Y=s.value;if(!Y)return;const K=Y.getBoundingClientRect(),be=a.value,me=be?.scrollHeight??be?.offsetHeight??0,Ce=window.innerHeight||document.documentElement.clientHeight||0,Pe=window.innerWidth||document.documentElement.clientWidth||0,it=8,He=4,Ct=K.bottom+He,Yt=K.top-He,St=Math.max(0,Ce-Ct-it),Ft=Math.max(0,Yt-it),Nt=St<me&&Ft>St,sn=Nt?Ft:St,_n=me?Math.min(me,sn):sn,Qt=Nt?Math.max(it,Yt-_n):Ct,Ye=Math.min(Math.max(it,K.left),Math.max(it,Pe-K.width-it));v.value={top:`${Qt}px`,left:`${Ye}px`,minWidth:`${K.width}px`,maxHeight:`${sn}px`}},ae=ke(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),pe=Y=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=Y)},Fe=(Y,{focusInput:K=!1,focusOption:be=!1}={})=>{if(y.value||!_.value.length){pe(!1);return}c.value=!0,pe(!0),d.value=Y??-1,K&&(u.value=!0,m.value=k.value,i.value?.focus()),_t(()=>{X(),z(),be&&J()})},fe=({syncItem:Y=!0}={})=>{c.value=!1,d.value=-1,Y&&pe(!1)},ye=()=>{fe(),u.value=!1,h.value="",m.value=k.value},le=()=>{y.value||(c.value||r("item-clicked"),u.value=!0,h.value="",m.value=k.value,_t(()=>x(0,m.value.length)))},Se=Y=>{if(y.value)return;const K=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,K||(h.value="",m.value=k.value,Y.preventDefault(),i.value?.focus({preventScroll:!0}),x(0,k.value.length)),!c.value){const be=N();Fe(be>=0?be:0)}},re=Y=>{const K=Y.relatedTarget;K instanceof Node&&s.value?.contains(K)||K instanceof Node&&a.value?.contains(K)||ye()},xe=Y=>{if(p.value)return;const K=Y.target,be=K.value,me=typeof K.selectionStart=="number"?K.selectionStart:be.length,Ce=typeof K.selectionEnd=="number"?K.selectionEnd:me,Pe=typeof Y.inputType=="string"&&Y.inputType.startsWith("delete"),it=me===be.length&&Ce===be.length;h.value=be;const He=iB(be,C.value,{autocomplete:!Pe&&it});m.value=He.display,K.value=He.display,He.display===be&&!it?x(me,Ce):x(He.selectionStart,He.selectionEnd),c.value&&(d.value=He.matchIndex,_t(z))},$e=Y=>{p.value=!1,xe(Y)},st=Y=>{if(!_.value.length)return;const K=_.value.length;d.value=((d.value<0?Y>0?-1:0:d.value)+Y+K)%K,_t(z)},At=(Y,K)=>{r("item-clicked"),r("command",{item:n.item,argument:Y,option:K}),K&&(n.item.selectedValue.value=K.key)},Ee=Y=>{Y&&(At(Y.label,Y),u.value=!1,h.value="",m.value=Y.label,fe())},Ge=()=>{if(c.value&&d.value>=0)return Ee(_.value[d.value]),!0;const Y=am(h.value,C.value);if(Y>=0)return Ee(_.value[Y]),!0;const K=n.normalizeValue(h.value);return K?(At(K,null),u.value=!1,h.value="",m.value=K,fe(),!0):!1},qe=Y=>{if(!(Y.isComposing||p.value||Y.keyCode===229)&&!(Y.ctrlKey||Y.metaKey||Y.altKey))switch(Y.key){case"ArrowDown":if(Y.preventDefault(),c.value)J();else{const K=am(h.value,C.value),be=K>=0?K:N();Fe(be>=0?be:0,{focusOption:!0})}break;case"ArrowUp":if(Y.preventDefault(),c.value)J();else{const K=am(h.value,C.value),be=K>=0?K:N();Fe(be>=0?be:_.value.length-1,{focusOption:!0})}break;case"Enter":Y.preventDefault(),Ge()&&r("editor-handoff"),i.value?.blur();break;case"Tab":Y.preventDefault(),Ge(),fe(),i.value?.blur(),r("tab-out",Y);break;case"Escape":Y.preventDefault(),ye(),_t(()=>i.value?.focus());break;default:break}},Z=Y=>{if(Y.preventDefault(),!y.value)if(r("item-clicked"),c.value)fe(),i.value?.focus();else{const K=N();Fe(K>=0?K:0,{focusOption:!0})}},S=(Y,K)=>{Y.preventDefault(),Ee(K),r("editor-handoff"),i.value?.blur()},ee=Y=>{d.value=Y},D=Y=>{if(!(Y.ctrlKey||Y.metaKey||Y.altKey))switch(Y.key){case"ArrowDown":Y.preventDefault(),st(1),J();break;case"ArrowUp":Y.preventDefault(),st(-1),J();break;case"Enter":Y.preventDefault(),d.value>=0&&(Ee(_.value[d.value]),r("editor-handoff"));break;case"Escape":Y.preventDefault(),ye(),_t(()=>i.value?.focus());break;case"Tab":Y.preventDefault(),d.value>=0?Ee(_.value[d.value]):fe(),r("tab-out",{shiftKey:Y.shiftKey,target:i.value});break;default:break}},U=Y=>{if(!c.value)return;const K=Y.target;K instanceof Element&&(s.value?.contains(K)||a.value?.contains(K)||ye())};Lt(c,Y=>{Y?(document.addEventListener("pointerdown",U,!0),window.addEventListener("resize",X),window.addEventListener("scroll",X,!0)):(document.removeEventListener("pointerdown",U,!0),window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0),l.value=[])},{immediate:!0}),or(()=>{document.removeEventListener("pointerdown",U,!0),window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0)});const H=(Y,K)=>{if(!Y){delete l.value[K];return}l.value[K]=Y},G=Y=>Y===d.value,te=Y=>Y?.key&&Y.key===n.item.selectedValue?.value;return Lt(k,Y=>{u.value||(m.value=Y)}),Lt(()=>!!n.item.expand?.value,Y=>{if(Y&&!c.value){const K=N();Fe(K>=0?K:0,{focusInput:!0});return}!Y&&c.value&&fe({syncItem:!1})}),(Y,K)=>(ge(),Ae("div",{ref_key:"rootRef",ref:s,class:rn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":y.value,"high-contrast":et(o)}]),style:yn(n.item.style?.value),"data-item":`btn-${b.value}`},[Me("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Se},[Me("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${b.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:R.value,style:yn(F.value),disabled:y.value,"aria-label":T.value,"aria-expanded":c.value?"true":"false","aria-controls":P.value,"aria-activedescendant":O.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${b.value}-input`,onFocus:le,onBlur:re,onInput:xe,onKeydown:qe,onCompositionstart:K[0]||(K[0]=be=>p.value=!0),onCompositionend:$e},null,44,gB)],32),Me("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${b.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:y.value,onMousedown:Z},[Me("span",{class:"sd-dropdown-caret",innerHTML:V.value},null,8,yB)],40,vB),(ge(),dn(Ha,{to:"body"},[c.value?(ge(),Ae("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:P.value,"aria-label":T.value,class:rn(["sd-font-combobox__listbox",{"high-contrast":et(o)}]),style:yn(ae.value)},[(ge(!0),Ae(Wt,null,rr(_.value,(be,me)=>(ge(),Ae("div",fs({key:be.key,ref_for:!0,ref:Ce=>H(Ce,me),id:j(me),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":G(me),"sd-selected":te(be)}],"aria-selected":te(be)?"true":"false","aria-label":`${T.value} - ${be.label}`},{ref_for:!0},be.props,{onMousedown:Ce=>S(Ce,be),onMouseenter:Ce=>ee(me),onKeydown:D}),[Me("span",CB,Bt(be.label),1)],16,wB))),128))],14,bB)):ht("",!0)])),Me("span",_B,Bt(k.value),1)],14,mB))}},$4=fn(SB,[["__scopeId","data-v-99070b63"]]);xt();var kB={__name:"FontFamilyCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ge(),dn($4,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":et(dB),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}},AB=kB;xt();var IB={__name:"FontSizeCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ge(),dn($4,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":et(pB),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}},EB=IB;xt(),gn();var xB=2500,TB=Object.assign({inheritAttrs:!1},{__name:"SdTooltip",props:{trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(e){const t=e,n=Z2(),r=ne(!1),o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px"});let a=null,l=null,u=null;const c=ke(()=>["sd-tooltip-content",n.class]),d=ke(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),h=()=>{a&&(window.clearTimeout(a),a=null)},m=()=>{l&&(window.clearTimeout(l),l=null)},p=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{p(),u=window.setTimeout(()=>{u=null,k()},xB)},_=()=>{if(!o.value||!i.value)return;const V=o.value.getBoundingClientRect(),Q=i.value.offsetWidth,F=i.value.offsetHeight,N=window.innerWidth||document.documentElement.clientWidth||0,x=8;let z=V.left+V.width/2-Q/2;z=Math.max(x,Math.min(z,N-Q-x)),s.value={top:`${V.top-F-10}px`,left:`${z}px`}},C=async()=>{t.disabled||(h(),m(),!r.value&&(r.value=!0,v(),await _t(),_()))},k=()=>{m(),h(),p(),r.value&&(r.value=!1)},y=()=>{if(h(),m(),!r.value){if(t.delay===0){C();return}l=window.setTimeout(()=>{l=null,C()},t.delay)}},b=()=>{if(m(),h(),!!r.value){if(t.duration===0){k();return}a=window.setTimeout(()=>{a=null,k()},t.duration)}},T=()=>{t.trigger==="hover"&&y()},R=()=>{t.trigger==="hover"&&b()},P=()=>{m(),h()},j=()=>{b()},O=V=>{V.key==="Escape"&&k()};return Lt(()=>t.disabled,V=>{V&&k()}),Lt(r,V=>{V?(window.addEventListener("resize",_),window.addEventListener("scroll",_,!0),document.addEventListener("keydown",O,!0)):(window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",O,!0))}),or(()=>{m(),h(),p(),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",O,!0)}),(V,Q)=>(ge(),Ae(Wt,null,[Me("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:T,onMouseleave:R,onFocusin:T,onFocusout:R},[Ad(V.$slots,"trigger",{},void 0,!0)],544),(ge(),dn(Ha,{to:"body"},[jt(Xh,{name:"fade-in-scale-up-transition"},{default:Eo(()=>[r.value&&!e.disabled?(ge(),Ae("div",{key:0,ref_key:"contentRef",ref:i,class:rn(c.value),style:yn(d.value),onMouseenter:P,onMouseleave:j},[Q[0]||(Q[0]=Me("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),Ad(V.$slots,"default",{},void 0,!0)],38)):ht("",!0)]),_:3})]))],64))}}),lm=fn(TB,[["__scopeId","data-v-2a872eae"]]);xt(),gn();var RB=["onKeydown","tabindex","data-item-id"],MB={key:0},LB={key:0},PB={key:0},DB={key:0},OB={key:0},FB={__name:"ButtonGroup",props:{toolbarItems:{type:Array,required:!0},overflowItems:{type:Array,default:()=>[]},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},position:{type:String,default:"left"},fromOverflow:{type:Boolean,default:!1},compactSideGroups:{type:Boolean,default:!1}},emits:["command","item-clicked","dropdown-update-show"],setup(e,{emit:t}){const n=t,{proxy:r}=ir(),o=ne([]),i=ne(null),s=e,a=ne(null),{isHighContrastMode:l}=Hi(),u=window.matchMedia("(max-width: 768px)").matches,c=ke(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),d=Ee=>Ee.type==="button",h=Ee=>Ee.type==="dropdown",m=Ee=>Ee.type==="dropdown"&&Ee.name?.value==="fontFamily",p=Ee=>Ee.type==="dropdown"&&Ee.name?.value==="fontSize",v=Ee=>Ee.type==="separator",_=Ee=>Ee.type==="overflow",C=Ee=>!!Ee.nestedOptions?.value?.length,k=Ee=>{if(!Ee)return!1;const Ge=Ee.expand;return typeof Ge=="object"&&Ge!==null&&"value"in Ge?!!Ge.value:!!Ge},y=(Ee,Ge)=>{Ee?.expand&&(Ee.expand.value=Ge)},b=(Ee,Ge=void 0)=>{if(Ee.disabled.value)return;if(_(Ee)){const Z=!k(Ee);Z&&P(),y(Ee,Z),a.value=Z?Ee:null,n("item-clicked");return}if(h(Ee))return;a.value&&h(a.value)&&k(a.value)&&P(),n("item-clicked");const qe=Ge!==void 0?Ge:Ee.argument?.value;n("command",qe===void 0?{item:Ee}:{item:Ee,argument:qe})},T=(Ee,Ge)=>{Ee.disabled.value||(a.value=null,n("command",{item:Ee,argument:Ge}))},R=Ee=>{if(Ee.disabled.value)return;P();const Ge=Ee.splitButtonCommand,qe=Ee.command,Z=Ge||qe;if(!Z)return;const S={...Ee,command:Z};n("item-clicked"),n("command",{item:S})},P=()=>{const Ee=r?.$toolbar?.toolbarItems||[],Ge=r?.$toolbar?.overflowItems||[],qe=[...Ee,...Ge];(qe.length?qe:s.toolbarItems).forEach(Z=>{const S=_(Z)&&!s.fromOverflow;(h(Z)||S)&&y(Z,!1)}),a.value=null},j=(Ee,Ge)=>{P(),n("command",{item:Ee,argument:Ee.dropdownValueKey.value?Ge[Ee.dropdownValueKey.value]:Ge.label,option:Ge}),Ee.selectedValue.value=Ge.key},O=Ee=>{n("command",Ee)},V=()=>{P(),n("item-clicked")},Q=()=>{const Ee=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Ee instanceof HTMLElement?(Ee.focus({preventScroll:!0}),!0):!1},F=()=>{const Ee=r?.$toolbar?.pendingSelectionCapture,Ge=()=>{Ee&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Ee)};if(Q()){Ge();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ge())},N=Ee=>!(Ee instanceof HTMLElement)||Ee.classList.contains("sd-disabled")?null:Ee.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Ee.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),x=(Ee,Ge)=>{const qe=Ee?.target?.closest?.(".sd-toolbar-item-ctn");if(!(qe instanceof HTMLElement))return!1;let Z=Ge>0?qe.nextElementSibling:qe.previousElementSibling;for(;Z;){const S=N(Z);if(S instanceof HTMLElement)return qe.setAttribute("tabindex","-1"),Z.setAttribute("tabindex","0"),S.focus(),!0;Z=Ge>0?Z.nextElementSibling:Z.previousElementSibling}return!1},z=Ee=>{P(),x(Ee,Ee?.shiftKey?-1:1)||F()},J=Ee=>{if(P(),Ee?.shiftKey){x(Ee,-1)||F();return}F()},X=()=>{F()},ae=Ee=>Ee.nestedOptions?.value?.length?Ee.nestedOptions.value.map(Ge=>{const qe=Ge?.type!=="render"&&Ee.selectedValue.value===Ge.key;return{...Ge,props:{...Ge.props,class:qe?"sd-selected":""}}}):[],pe=(Ee,Ge)=>({role:"menuitem",ariaLabel:`${Ge.attributes.value.ariaLabel} - ${Ee.label}`}),Fe=Ee=>{const Ge=Ee.target,qe=Ee.target.closest(".sd-toolbar-item-ctn").nextElementSibling;qe&&(Ge.setAttribute("tabindex","-1"),qe.setAttribute("tabindex","0"),qe.focus())},fe=Ee=>{const Ge=Ee.target,qe=Ee.target.closest(".sd-toolbar-item-ctn").previousElementSibling;qe&&(Ge.setAttribute("tabindex","-1"),qe.setAttribute("tabindex","0"),qe.focus())},ye=Ee=>{const Ge=Ee.target.closest(".button-group").nextElementSibling;if(Ge)Ge.setAttribute("tabindex","0"),Ge.focus();else{const qe=document.querySelector(".ProseMirror");qe&&qe.focus()}},le=Ee=>{const Ge=Ee.target.closest(".button-group").previousElementSibling;Ge&&(Ge.setAttribute("tabindex","0"),Ge.focus())},Se=Ee=>{if(!Ee.disabled.value){if(h(Ee)){$e(!k(Ee),Ee);return}b(Ee)}},re=(Ee,Ge)=>{const qe=Ee.target.nodeName==="INPUT"||Ee.target.nodeName==="TEXTAREA",Z=Ge.name.value==="fontSize"||Ge.name.value==="fontFamily";if(!(qe&&Z)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Ee.key))switch(Ee.preventDefault(),Ee.key){case"Enter":case" ":case"Spacebar":Se(Ge);break;case"Escape":P();break;case"ArrowRight":P(),Fe(Ee);break;case"ArrowLeft":P(),fe(Ee);break;case"Tab":Ee.shiftKey?le(Ee):ye(Ee);break;default:break}},xe=Ee=>{const Ge=o.value.find(qe=>!qe.classList.contains("sd-disabled"));Ge&&(Ge.setAttribute("tabindex","0"),Ge.focus())},$e=(Ee,Ge)=>{if(n("item-clicked"),!Ee){P(),n("dropdown-update-show",!1);return}P(),a.value=Ge,y(Ge,!0),n("dropdown-update-show",!0)},st=Ee=>{if(!a.value)return;const Ge=Ee.target;Ge instanceof Element&&(Ge.closest(".sd-toolbar-dropdown-menu")||i.value?.contains(Ge)||P())};return Lt(()=>k(a.value),Ee=>{Ee?document.addEventListener("pointerdown",st,!0):document.removeEventListener("pointerdown",st,!0)},{immediate:!0}),or(()=>{document.removeEventListener("pointerdown",st,!0)}),(Ee,Ge)=>(ge(),Ae("div",{style:yn(c.value),class:"button-group",role:"group",onFocus:xe,ref_key:"buttonGroupRef",ref:i},[(ge(!0),Ae(Wt,null,rr(e.toolbarItems,(qe,Z)=>(ge(),Ae("div",{key:qe.id.value,class:rn([{narrow:qe.isNarrow.value,wide:qe.isWide.value,"sd-disabled":qe.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:S=>re(S,qe),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:Z===0?0:-1,"data-item-id":qe.id.value},[v(qe)?(ge(),dn(qN,{key:0,style:{width:"20px"}})):ht("",!0),m(qe)&&C(qe)?(ge(),dn(lm,{key:1,trigger:"hover",disabled:!qe.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Eo(()=>[jt(AB,{item:qe,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:O,onItemClicked:V,onTabOut:Ge[0]||(Ge[0]=S=>z(S)),onEditorHandoff:X},null,8,["item","ui-font-family"])]),default:Eo(()=>[Me("div",null,[Ni(Bt(qe.tooltip)+" ",1),qe.disabled.value?(ge(),Ae("span",MB,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])):p(qe)&&C(qe)?(ge(),dn(lm,{key:2,trigger:"hover",disabled:!qe.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Eo(()=>[jt(EB,{item:qe,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:O,onItemClicked:V,onTabOut:Ge[1]||(Ge[1]=S=>J(S)),onEditorHandoff:X},null,8,["item","ui-font-family"])]),default:Eo(()=>[Me("div",null,[Ni(Bt(qe.tooltip)+" ",1),qe.disabled.value?(ge(),Ae("span",LB,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])):h(qe)&&qe.nestedOptions?.value?.length?(ge(),dn(oB,{key:3,options:ae(qe),disabled:qe.disabled.value,show:k(qe),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(S,ee)=>j(qe,ee),"onUpdate:show":S=>$e(S,qe),style:yn(qe.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":et(l)}]}),"node-props":S=>pe(S,qe)},{trigger:Eo(()=>[jt(lm,{trigger:"hover",disabled:!qe.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Eo(()=>[jt(J0,{"toolbar-item":qe,disabled:qe.disabled.value,"allow-enter-propagation":!0,onTextSubmit:S=>T(qe,S),onMainClick:S=>R(qe)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:Eo(()=>[Me("div",null,[Ni(Bt(qe.tooltip)+" ",1),qe.disabled.value?(ge(),Ae("span",PB,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):d(qe)?(ge(),dn(lm,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:Eo(()=>[jt(J0,{"toolbar-item":qe,"is-overflow-item":e.fromOverflow,onTextSubmit:S=>T(qe,S),onButtonClick:S=>b(qe)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:Eo(()=>[qe.tooltip?(ge(),Ae("div",DB,[Ni(Bt(qe.tooltip)+" ",1),qe.disabled.value?(ge(),Ae("span",OB,"(disabled)")):ht("",!0)])):ht("",!0)]),_:2},1032,["content-style"])):ht("",!0),_(qe)&&e.overflowItems.length?(ge(),dn(JN,{key:5,"toolbar-item":qe,onButtonClick:S=>b(qe),"overflow-items":e.overflowItems,onClose:P},null,8,["toolbar-item","onButtonClick","overflow-items"])):ht("",!0)],42,RB))),128))],36))}},cm=fn(FB,[["__scopeId","data-v-590293ab"]]),NB=[["Arial","sans-serif"],["Arial Black","sans-serif"],["Arial Narrow","sans-serif"],["Baskerville Old Face","serif"],["Bookman Old Style","serif"],["Brush Script MT","cursive"],["Calibri","sans-serif"],["Century","serif"],["Century Gothic","sans-serif"],["Comic Sans MS","sans-serif"],["Cooper Black","serif"],["Courier New","monospace"],["Garamond","serif"],["Georgia","serif"],["Gill Sans MT Condensed","sans-serif"],["Helvetica","sans-serif"],["Lucida Console","monospace"],["Segoe UI","sans-serif"],["Tahoma","sans-serif"],["Times New Roman","serif"],["Trebuchet MS","sans-serif"],["Verdana","sans-serif"]];const BB=NB.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function zB(e){if(e?.length)return e.map(t=>({label:t.label,key:t.value,props:{style:{fontFamily:t.previewFamily||t.label},"data-item":"btn-fontFamily-option"}}))}const VB=[{label:"8",key:"8pt",props:{"data-item":"btn-fontSize-option"}},{label:"9",key:"9pt",props:{"data-item":"btn-fontSize-option"}},{label:"10",key:"10pt",props:{"data-item":"btn-fontSize-option"}},{label:"11",key:"11pt",props:{"data-item":"btn-fontSize-option"}},{label:"12",key:"12pt",props:{"data-item":"btn-fontSize-option"}},{label:"14",key:"14pt",props:{"data-item":"btn-fontSize-option"}},{label:"18",key:"18pt",props:{"data-item":"btn-fontSize-option"}},{label:"24",key:"24pt",props:{"data-item":"btn-fontSize-option"}},{label:"30",key:"30pt",props:{"data-item":"btn-fontSize-option"}},{label:"36",key:"36pt",props:{"data-item":"btn-fontSize-option"}},{label:"48",key:"48pt",props:{"data-item":"btn-fontSize-option"}},{label:"60",key:"60pt",props:{"data-item":"btn-fontSize-option"}},{label:"72",key:"72pt",props:{"data-item":"btn-fontSize-option"}},{label:"96",key:"96pt",props:{"data-item":"btn-fontSize-option"}}],Ff={sm:768,md:1024,lg:1280,xl:1410},$0={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",strike:"strikethrough",acceptTrackedChangeBySelection:"track-changes-accept-selection",rejectTrackedChangeOnSelection:"track-changes-reject-selection",ruler:"ruler",formattingMarks:"formatting-marks",zoom:"zoom",measurementUnit:"measurement-unit",documentMode:"document-mode",link:"link",fontFamily:"font-family",fontSize:"font-size",list:"bullet-list",numberedlist:"numbered-list",table:"table-insert",image:"image",tableOfContents:"table-of-contents-insert",color:"text-color",highlight:"highlight-color",textAlign:"text-align",lineHeight:"line-height",linkedStyles:"linked-style",indentleft:"indent-decrease",indentright:"indent-increase",directionLtr:"direction-ltr",directionRtl:"direction-rtl",clearFormatting:"clear-formatting",copyFormat:"copy-format"},eA={addRowBefore:"table-add-row-before",addRowAfter:"table-add-row-after",deleteRow:"table-delete-row",addColumnBefore:"table-add-column-before",addColumnAfter:"table-add-column-after",deleteColumn:"table-delete-column",deleteTable:"table-delete",deleteCellAndTableBorders:"table-remove-borders",mergeCells:"table-merge-cells",splitCell:"table-split-cell",fixTables:"table-fix"},tA=Object.values(eA),BU=[...new Set([...Object.values($0),...tA])];var HB=new Set(["link"]);const zU=new Set(Object.keys($0).filter(e=>!HB.has(e)));xt(),gn();var jB="Arial, Helvetica, sans-serif",UB={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=ir();let r=ne(1);const o=ne(0),i=ne(!1);let s=null,a=null;const l=ke(()=>{const j=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof j=="string"&&j.trim()?j.trim():jB}),u=n.$toolbar.config?.toolbarGroups?.includes("left"),c=n.$toolbar.config?.toolbarGroups?.includes("right"),d=n.$toolbar.config?.toolbarButtonsExclude||[],h=j=>(o.value,n.$toolbar.getToolbarItemByGroup(j).filter(O=>!d.includes(O.name.value))),m=()=>{i.value=n.$toolbar.getAvailableWidth()<=Ff.lg},v=TN(async()=>{await n.$toolbar.onToolbarResize(),m(),r.value+=1},300),_=()=>{r.value+=1},C=()=>{o.value+=1};function k(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",_),n.$toolbar.off?.("toolbar-state-change",C),s?.disconnect(),s=null}function y(){k(),window.addEventListener("resize",v),n.$toolbar.on?.("toolbar-items-changed",_),n.$toolbar.on?.("toolbar-state-change",C),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{v()}),s.observe(n.$toolbar.toolbarContainer)),m()}Nn(y),Rg(y),Mg(k),or(k);const b=()=>{if(!n.$toolbar.activeEditor){a=null,n.$toolbar.pendingSelectionCapture=null;return}a=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=a},T=({item:j,argument:O,option:V})=>{R(),n.$toolbar.emitCommand({item:j,argument:O,option:V})},R=()=>{const j=n.$toolbar.activeEditor;if(!j)return;const O=n.$toolbar.pendingSelectionCapture??a;if(O&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(O);return}j.commands?.restoreSelection?.()},P=j=>{b(),!j.target.closest('input, textarea, [contenteditable="true"]')&&j.preventDefault()};return(j,O)=>(ge(),Ae("div",{class:"superdoc-toolbar",key:et(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:P},[et(u)?(ge(),dn(cm,{key:0,tabindex:"0","toolbar-items":h("left"),"overflow-items":et(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"left",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):ht("",!0),jt(cm,{tabindex:"0","toolbar-items":h("center"),"overflow-items":et(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"center",onCommand:T},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),et(c)?(ge(),dn(cm,{key:1,tabindex:"0","toolbar-items":h("right"),"overflow-items":et(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"right",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):ht("",!0)],32))}},GB=fn(UB,[["__scopeId","data-v-55b5af7a"]]);const WB=e=>{if(!e)return e;const t=e.props?.style?.fontFamily??e.label??e.key;return{...e,props:{...e.props,style:{...e.props?.style,fontFamily:t},"data-item":e.props?.["data-item"]??"btn-fontFamily-option"}}};xt();const kn=e=>{if(!["button","options","separator","dropdown","overflow"].includes(e.type))throw new Error("Invalid toolbar item type - "+e.type);if(e.type==="button"&&!e.defaultLabel&&!e.icon)throw new Error("Toolbar button item needs either icon or label - "+e.name);if(!e.name)throw new Error("Invalid toolbar item name - "+e.name);const t=ne(as()),n=e.type,r=ne(e.name),o=e.command,i=e.noArgumentCommand,s=ne(e.icon),a=ne(e.group||"center"),l=ne(e.allowWithoutEditor),u=ne(e.attributes||{}),c=e.disabled||!1,d=ne(e.disabled),h=ne(!1),m=ne(!1),p=ne(e.style),v=ne(e.isNarrow),_=ne(e.isWide),C=ne(e.minWidth),k=ne(e.suppressActiveHighlight||!1),y=ne(e.argument),b=ne(null),T=ne(null),R=ne(e.iconColor),P=ne(e.hasCaret),j=ne(!!e.splitButton),O=e.splitButtonCommand,V=!!e.restoreEditorFocus,Q=ne(e.dropdownStyles),F=ne(e.tooltip),N=ne(e.tooltipVisible),x=ne(e.tooltipTimeout),z=ne(e.defaultLabel),J=ne(e.label),X=ne(e.hideLabel),ae=ne(e.inlineTextInputVisible),pe=ne(e.hasInlineTextInput),Fe=ne(e.markName),fe=ne(e.labelAttr),ye=ne(e.selectedValue),le=ne(e.dropdownValueKey),Se=ne(e.inputRef||null),re=ne([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);re.value?.push(...e.options)}const xe=(S={},...ee)=>{Ee(S,...ee),!k.value&&(h.value=!0)},$e=()=>{Ge(),h.value=!1},st=S=>{d.value=S},At=()=>{d.value=c},Ee=e.onActivate||(()=>null),Ge=e.onDeactivate||(()=>null),qe=()=>{const S={};return Object.keys(Z).forEach(ee=>{Z[ee].value!==void 0&&(S[ee]=Z[ee].value)}),S},Z={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:F,group:a,attributes:u,disabled:d,active:h,expand:m,nestedOptions:re,style:p,isNarrow:v,isWide:_,minWidth:C,argument:y,parentItem:T,iconColor:R,hasCaret:P,splitButton:j,splitButtonCommand:O,dropdownStyles:Q,tooltipVisible:N,tooltipTimeout:x,defaultLabel:z,label:J,hideLabel:X,inlineTextInputVisible:ae,hasInlineTextInput:pe,restoreEditorFocus:V,markName:Fe,labelAttr:fe,childItem:b,allowWithoutEditor:l,dropdownValueKey:le,selectedValue:ye,inputRef:Se};return{...Z,unref:qe,activate:xe,deactivate:$e,setDisabled:st,resetDisabled:At,onActivate:Ee,onDeactivate:Ge}};xt(),gn();var KB=["onClick","innerHTML","aria-label","onKeydown"],qB={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=t,o=ne([]),i=[{key:"left",ariaLabel:"Align left",icon:er.alignLeft},{key:"center",ariaLabel:"Align center",icon:er.alignCenter},{key:"right",ariaLabel:"Align right",icon:er.alignRight},{key:"justify",ariaLabel:"Justify",icon:er.alignJustify}],s=c=>{r("select",c)},a=c=>{if(c===o.value.length-1)return;const d=o.value[c+1];d&&(d.setAttribute("tabindex","0"),d.focus())},l=c=>{if(c===0)return;const d=o.value[c-1];d&&(d.setAttribute("tabindex","0"),d.focus())},u=(c,d)=>{switch(c.key){case"ArrowLeft":l(d);break;case"ArrowRight":a(d);break;case"Enter":s(i[d].key);break;default:break}};return Nn(()=>{const c=o.value[0];c&&(c.setAttribute("tabindex","0"),c.focus())}),(c,d)=>(ge(),Ae("div",{class:rn(["alignment-buttons",{"high-contrast":et(n)}])},[(ge(),Ae(Wt,null,rr(i,(h,m)=>Me("div",{key:h.key,class:"sd-button-icon",onClick:p=>s(h.key),innerHTML:h.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":h.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:tn(p=>u(p,m),["prevent"])},null,40,KB)),64))],2))}},YB=fn(qB,[["__scopeId","data-v-13e5f7a4"]]);xt(),gn();var XB=["onClick","innerHTML","aria-label","onKeydown"],ZB={__name:"StyleButtonsList",props:{buttons:{type:Array,required:!0},selectedStyle:{type:String,default:null},iconSize:{type:Number,default:25}},emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Hi(),r=t,o=e,i=ne([]),s=ke(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=d=>{r("select",d)},l=d=>{if(d===i.value.length-1)return;const h=i.value[d+1];h&&(h.setAttribute("tabindex","0"),h.focus())},u=d=>{if(d===0)return;const h=i.value[d-1];h&&(h.setAttribute("tabindex","0"),h.focus())},c=(d,h)=>{switch(d.key){case"ArrowLeft":u(h);break;case"ArrowRight":l(h);break;case"Enter":a(o.buttons[h].key);break;default:break}};return Nn(()=>{const d=i.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,h)=>(ge(),Ae("div",{class:rn(["style-buttons-list",{"high-contrast":et(n)}])},[(ge(!0),Ae(Wt,null,rr(o.buttons,(m,p)=>(ge(),Ae("div",{key:m.key,class:rn(["sd-button-icon",{"sd-selected":o.selectedStyle===m.key}]),style:yn(s.value),onClick:v=>a(m.key),innerHTML:m.icon,role:"menuitem","aria-label":m.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:tn(v=>c(v,p),["prevent"])},null,46,XB))),128))],2))}},nA=fn(ZB,[["__scopeId","data-v-44f37ff6"]]);const QB=[{key:"disc",icon:er.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:er.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:er.bulletListSquare,ariaLabel:"Opaque square"}],JB=[{key:"decimal",icon:er.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:er.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:er.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:er.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:er.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:er.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:er.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:er.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];xt(),gn();var $B=["onClick","onKeydown"],ez={class:"document-mode-column icon-column"},tz=["innerHTML"],nz={class:"document-mode-column text-column"},rz={class:"document-mode-type"},oz={class:"document-mode-description"},iz={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),{isHighContrastMode:o}=Hi(),i=e,s=c=>{n("select",c)},a=c=>{if(c===r.value.length-1)return;const d=r.value[c+1];d&&(d.setAttribute("tabindex","0"),d.focus())},l=c=>{if(c===0)return;const d=r.value[c-1];d&&(d.setAttribute("tabindex","0"),d.focus())},u=(c,d)=>{switch(c.key){case"ArrowDown":a(d);break;case"ArrowUp":l(d);break;case"Enter":s(i.options[d]);break;default:break}};return Nn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(c,d)=>(ge(),Ae("div",{class:rn(["document-mode",{"high-contrast":et(o)}])},[(ge(!0),Ae(Wt,null,rr(e.options,(h,m)=>(ge(),Ae("div",{class:rn(["sd-option-item",{"sd-disabled":h.disabled}]),onClick:p=>s(h),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:tn(p=>u(p,m),["prevent"])},[Me("div",ez,[Me("div",{class:"icon-column__icon",innerHTML:h.icon},null,8,tz)]),Me("div",nz,[Me("div",rz,Bt(h.label),1),Me("div",oz,Bt(h.description),1)])],42,$B))),256))],2))}},sz=fn(iz,[["__scopeId","data-v-bee14d7a"]]);xt(),gn();var az={class:"linked-style-buttons","data-editor-ui-surface":""},lz=["onClick","onKeydown","aria-label"],cz={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),o=e,i=d=>{n("select",d)},s=d=>{if(d===r.value.length-1)return;const h=r.value[d+1];h.setAttribute("tabindex","0"),h.focus()},a=d=>{if(d===0)return;const h=r.value[d-1];h.setAttribute("tabindex","0"),h.focus()},l=(d,h,m)=>{switch(d.key){case"ArrowDown":s(h);break;case"ArrowUp":a(h);break;case"Enter":d.preventDefault(),i(m);break;default:break}},u=d=>d?.name??d?.id??"",c=d=>{const h=d?.preview?.css;return h&&typeof h=="object"?h:void 0};return Nn(()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())}),(d,h)=>(ge(),Ae("div",az,[(ge(!0),Ae(Wt,null,rr(o.styles,(m,p)=>(ge(),Ae("div",{key:m.id??p,class:rn(["style-item",{selected:e.selectedOption===m.id}]),onClick:v=>i(m),onKeydown:v=>l(v,p,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[Me("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:yn(c(m))},Bt(u(m)),5)],42,lz))),128))]))}},uz=fn(cz,[["__scopeId","data-v-43b5dcca"]]);xt(),gn();var dz=["placeholder"],fz={class:"sd-ai-writer__footer"},hz={key:0,class:"sd-ai-writer__error",role:"alert"},pz=["disabled"],mz="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",gz="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",vz={__name:"AIWriter",props:{selectedText:{type:String,default:""},target:{type:Object,default:null},doc:{type:Object,default:null},apiKey:{type:String,default:""},endpoint:{type:String,default:""},restoreSelection:{type:Function,default:null},handleClose:{type:Function,required:!0}},setup(e){const t=e,n=ne(""),r=ne(!1),o=ne(""),i=ne(null),s=ke(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=ke(()=>n.value.trim().length>0&&!r.value);Nn(()=>{_t(()=>{i.value?.focus()})});function l(p){if(typeof p=="string")return p;if(!p||typeof p!="object")return"";const v=p.custom_prompt;if(Array.isArray(v)){const _=v[0];if(_&&typeof _.value=="string")return _.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof p.value=="string"?p.value:typeof p.text=="string"?p.text:""}async function u(p){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const _=t.selectedText.trim(),C=_?`Rewrite the following text: "${_}" using these instructions: ${p}`:`Generate text based on the following prompt: ${p}`,k=await fetch(t.endpoint||mz,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:gz,insights:[{type:"custom_prompt",name:_?"text_rewrite":"text_generation",message:C,format:[{value:""}]}]})});if(!k.ok){const b=await k.text().catch(()=>"");throw new Error(b||`AI request failed with ${k.status}`)}const y=l((k.headers.get("content-type")||"").includes("application/json")?await k.json():await k.text()).trim();if(!y)throw new Error("AI returned no text.");return y}function c(p){return!p||typeof p!="object"?!0:!(p.success===!1||p.ok===!1)}function d(p){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let _=null,C=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(_=v.replace({target:t.target,text:p}),C=!0):t.target&&typeof v.insert=="function"?(_=v.insert({target:t.target,value:p,type:"text"}),C=!0):typeof v.insert=="function"&&(_=v.insert({value:p,type:"text"}),C=!0),!C)throw new Error("Document text insertion is unavailable.");if(!c(_))throw new Error("Unable to insert generated text.")}async function h(){if(a.value){o.value="",r.value=!0;try{d(await u(n.value.trim())),t.handleClose()}catch(p){o.value=p instanceof Error?p.message:String(p)}finally{r.value=!1}}}function m(p){p.key!=="Enter"||p.shiftKey||(p.preventDefault(),h())}return(p,v)=>(ge(),Ae("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:tn(h,["prevent"])},[Us(Me("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=_=>n.value=_),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:m},null,40,dz),[[Ai,n.value]]),Me("div",fz,[o.value?(ge(),Ae("p",hz,Bt(o.value),1)):ht("",!0),Me("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Bt(r.value?"Generating":"Generate"),9,pz)])],32))}},yz=fn(vz,[["__scopeId","data-v-67f6c6f7"]]);xt(),gn();var bz=["aria-label","onClick","onKeydown"],wz=["innerHTML"],Cz=["innerHTML"],um=7,_z={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>p=>r.activeColor.value?r.activeColor.value.toUpperCase()===p.value:!1),i=(p,v)=>v===5||["#FFFFFF","#FAFF09"].includes(p)?{color:"#000"}:{color:"#FFF"},s=p=>{n("select",p.value)},a=ne([]),l=ne([]);Nn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const p=l.value[0];p&&(p.setAttribute("tabindex","0"),p.focus({preventScroll:!0}))});const u=(p,v)=>{const _=um*p+v+1,C=l.value[_];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},c=(p,v)=>{const _=um*p+v-1,C=l.value[_];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},d=(p,v)=>{const _=v+um*(p+1),C=l.value[_];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},h=(p,v)=>{const _=v+um*(p-1),C=l.value[_];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},m=(p,v,_,C)=>{switch(p.key){case"ArrowRight":u(v,_);break;case"ArrowLeft":c(v,_);break;case"ArrowDown":d(v,_);break;case"ArrowUp":h(v,_);break;case"Enter":s(C);break;case"Escape":n("clickoutside");break;default:break}};return(p,v)=>(ge(!0),Ae(Wt,null,rr(e.icons,(_,C)=>(ge(),Ae("div",{class:"sd-option-row",key:C,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ge(!0),Ae(Wt,null,rr(_,(k,y)=>(ge(),Ae("div",{class:"sd-option",key:y,"aria-label":k.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:tn(b=>s(k),["stop","prevent"]),onKeydown:tn(b=>m(b,C,y,k),["prevent"])},[Me("div",{class:"sd-option__icon",innerHTML:k.icon,style:yn(k.style)},null,12,wz),o.value(k)?(ge(),Ae("div",{key:0,class:"sd-option__check",innerHTML:et(er).colorOptionCheck,style:yn(i(k.value,y))},null,12,Cz)):ht("",!0)],40,bz))),128))]))),128))}},rA=fn(_z,[["__scopeId","data-v-05eb02fc"]]),Sz=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>
101
+ `;xt(),gn();var kz={class:"options-grid-wrap"},Az=["innerHTML"],Iz={class:"option-grid-ctn"},Ez={__name:"IconGrid",props:{icons:{type:Array,required:!0},customIcons:{type:Array,required:!1},activeColor:{type:Object,required:!1},hasNoneIcon:{type:Boolean,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=o=>{n("select",o)};return(o,i)=>(ge(),Ae("div",kz,[e.hasNoneIcon?(ge(),Ae("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[Me("span",{innerHTML:et(Sz),class:"none-icon"},null,8,Az),i[1]||(i[1]=Ni(" None ",-1))])):ht("",!0),Me("div",Iz,[jt(rA,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ge(),Ae(Wt,{key:0},[i[2]||(i[2]=Me("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),jt(rA,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):ht("",!0)])]))}},xz=fn(Ez,[["__scopeId","data-v-52b0283a"]]);const eb=(e,t=null)=>{if(typeof t?.focus=="function"){t.focus();return}const n=e?.superdoc?.focus??e?.activeEditor?.focus;if(typeof n=="function"){n.call(e?.superdoc??e?.activeEditor,{preventScroll:!0});return}const r=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');r instanceof HTMLElement&&r.focus({preventScroll:!0})};xt();var Tz=e=>{e.expand.value=!1};const Vt=(e,t=null)=>({label:t,icon:er.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),tb=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),Tz(t),eb(e)};return Vr("div",{},[Vr(xz,{icons:Rz,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},Rz=[[Vt("#111111","black"),Vt("#333333","dark gray"),Vt("#5C5C5C","medium gray"),Vt("#858585","light gray"),Vt("#ADADAD","very light gray"),Vt("#D6D6D6","transparent gray"),Vt("#FFFFFF","white")],[Vt("#860028","dark red"),Vt("#D2003F","red"),Vt("#DB3365","coral red"),Vt("#E4668C","light red"),Vt("#ED99B2","pale pink"),Vt("#F6CCD9","transparent pink"),Vt("#FF004D","bright pink")],[Vt("#83015E","dark purple"),Vt("#CD0194","purple"),Vt("#D734A9","orchid"),Vt("#E167BF","light purple"),Vt("#EB99D4","lavender"),Vt("#F5CCEA","transparent pink"),Vt("#FF00A8","neon pink")],[Vt("#8E220A","maroon"),Vt("#DD340F","red-orange"),Vt("#E45C3F","burnt orange"),Vt("#EB856F","peach"),Vt("#F1AE9F","pale peach"),Vt("#F8D6CF","transparent peach"),Vt("#FF7A00","orange")],[Vt("#947D02","olive"),Vt("#E7C302","mustard yellow"),Vt("#ECCF35","yellow"),Vt("#F1DB67","light yellow"),Vt("#F5E79A","very pale yellow"),Vt("#FAF3CC","transparent yellow"),Vt("#FAFF09","neon yellow")],[Vt("#055432","forest green"),Vt("#07834F","green"),Vt("#399C72","medium green"),Vt("#6AB595","light green"),Vt("#9CCDB9","mint"),Vt("#CDE6DC","transparent mint"),Vt("#05F38F","bright teal")],[Vt("#063E7E","navy blue"),Vt("#0A60C5","blue"),Vt("#3B80D1","sky blue"),Vt("#6CA0DC","cornflower blue"),Vt("#9DBFE8","light blue"),Vt("#CEDFF3","very light blue"),Vt("#21c8ce","cyan")],[Vt("#3E027A","deep purple"),Vt("#6103BF","indigo"),Vt("#8136CC","violet"),Vt("#A068D9","lavender pink"),Vt("#C09AE6","light lilac"),Vt("#DFCDF2","transparent lilac"),Vt("#A91DFF","neon purple")]];xt(),gn();var Mz=["data-cols","data-rows","onKeydown","onClick"],Lz=["aria-valuetext"],dm=5,Pz={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=ne(0),o=ne(0),{isHighContrastMode:i}=Hi(),s=ne([]),a=d=>{let h=d.target;h.dataset.grid||l([...h.parentElement.querySelectorAll("[data-item]")],parseInt(h.dataset.cols,10),parseInt(h.dataset.rows,10))},l=(d,h,m)=>{o.value=h,r.value=m;for(let p=0;p<d.length;p++){let v=d[p],_=parseInt(v.dataset.cols,10),C=parseInt(v.dataset.rows,10);_<=h&&C<=m?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:d,rows:h})=>{n("select",{cols:d,rows:h})},c=(d,h,m)=>{let p=h-1,v=m-1;switch(d.key){case"ArrowRight":{if(p>=4)return;const _=v*dm;s.value[_+p+1].setAttribute("tabindex","0"),s.value[_+p+1].focus(),l(s.value,h+1,m);break}case"ArrowLeft":{if(p<=0)return;const _=v*dm;s.value[_+p-1].setAttribute("tabindex","0"),s.value[_+p-1].focus(),l(s.value,h-1,m);break}case"ArrowDown":{if(v>=4)return;const _=(v+1)*dm;s.value[_+p].setAttribute("tabindex","0"),s.value[_+p].focus(),l(s.value,h,m+1);break}case"ArrowUp":{if(v<=0)return;const _=(v-1)*dm;s.value[_+p].setAttribute("tabindex","0"),s.value[_+p].focus(),l(s.value,h,m-1);break}case"Enter":u({cols:h,rows:m});break;default:break}};return Nn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(d,h)=>(ge(),Ae("div",{class:rn(["toolbar-table-grid-wrapper",{"high-contrast":et(i)}])},[Me("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ge(),Ae(Wt,null,rr(5,m=>(ge(),Ae(Wt,{key:m},[(ge(),Ae(Wt,null,rr(5,p=>Me("div",{class:"toolbar-table-grid__item",key:`${m}_${p}`,"data-cols":p,"data-rows":m,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:tn(v=>c(v,p,m),["prevent"]),onClick:tn(v=>u({cols:p,rows:m}),["stop","prevent"])},null,40,Mz)),64))],64))),64))],32),Me("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Bt(r.value)+" x "+Bt(o.value),9,Lz)],2))}},Dz=fn(Pz,[["__scopeId","data-v-b87d6ca2"]]);xt(),gn();var Oz={class:"toolbar-table-actions"},Fz=["onClick","data-item","ariaLabel"],Nz={class:"toolbar-table-actions__icon"},Bz=["innerHTML"],zz={class:"toolbar-table-actions__label"},Vz={__name:"TableActions",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=o=>{n("select",{command:o.command})};return(o,i)=>(ge(),Ae("div",Oz,[(ge(!0),Ae(Wt,null,rr(e.options,s=>(ge(),Ae("div",{class:rn(["toolbar-table-actions__item",{"toolbar-table-actions__item--border":s.bottomBorder}]),onClick:a=>r(s),"data-item":s.props?.["data-item"]||"",ariaLabel:s.props?.ariaLabel,role:"menuitem"},[Me("div",Nz,[Me("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,Bz)]),Me("div",zz,Bt(s.label),1)],10,Fz))),256))]))}},Hz=fn(Vz,[["__scopeId","data-v-0cdad084"]]),jz=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
102
+ `;xt();var Ss=e=>{e.expand.value=!1};function nb(e,t){const n={...e??{}};return t?n.href=t:delete n.href,n}function oA(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function Uz(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function iA(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Gz(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function Wz(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}const Kz=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1}={})=>{const l=kn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),u=(r??BB).map(WB),c=kn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:u,onActivate:({fontFamily:Ye}={},Et=!1)=>{if(Et){c.label.value="",c.selectedValue.value="";return}if(!Ye)return;Ye=Ye.split(",")[0],c.label.value=Ye;const Ot=u.find(Kt=>Kt.label===c.defaultLabel.value),wn=u.find(Kt=>Kt.label===Ye);wn?c.selectedValue.value=wn.key:Ot?c.selectedValue.value=Ot.key:c.selectedValue.value=""},onDeactivate:()=>{c.label.value=c.defaultLabel.value;const Ye=u.find(Et=>Et.label===c.defaultLabel.value);Ye?c.selectedValue.value=Ye.key:c.selectedValue.value=""}}),d=kn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>h(d)}]});function h(Ye){const Et=iA(e),Ot=Et?.selectionTarget??oA(Et?.target),wn=Et?.empty?"":Uz(Et),Kt=Wz(e),Sn=()=>Ss(Ye),Pt=()=>{const De=e.pendingSelectionCapture;De&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(De)};return Vr("div",{},[Vr(yz,{handleClose:Sn,selectedText:wn,target:Ot,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Kt?.apiKey||e.config?.aiApiKey||"",endpoint:Kt?.endpoint||e.config?.aiEndpoint||"",restoreSelection:Pt})])}const m=VB,p=kn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:m,onActivate:({fontSize:Ye},Et=!1)=>{if(Et){p.label.value="",p.selectedValue.value="";return}const Ot=m.find(Pt=>Pt.label===String(p.defaultLabel.value));if(!Ye){p.label.value=p.defaultLabel.value,Ot?p.selectedValue.value=Ot.key:p.selectedValue.value="";return}let wn=xN(Ye,12);wn<8&&(wn=8),wn>96&&(wn=96);let Kt=String(wn);const Sn=m.find(Pt=>Pt.label===Kt||Pt.key===Kt);Sn?p.selectedValue.value=Sn.key:p.selectedValue.value="",p.label.value=Kt},onDeactivate:()=>{p.label.value=p.defaultLabel.value;const Ye=m.find(Et=>Et.label===String(p.defaultLabel.value));Ye?p.selectedValue.value=Ye.key:p.selectedValue.value=""}}),v=kn({type:"separator",name:"separator",isNarrow:!0}),_=kn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),C=kn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),k=kn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),y=kn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>tb(e,y,[],!0)}],onActivate:({color:Ye})=>{y.iconColor.value=Ye||""},onDeactivate:()=>y.iconColor.value=""}),b=kn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>tb(e,b)}],onActivate:({color:Ye})=>{b.iconColor.value=Ye},onDeactivate:()=>b.iconColor.value="#000"}),T=kn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),R=kn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>P(R)}],onActivate:({href:Ye})=>{R.attributes.value=nb(R.attributes.value,Ye)},onDeactivate:()=>{R.attributes.value=nb(R.attributes.value,null),R.expand.value=!1}});function P(Ye){const Et=iA(e),Ot=Et?.selectionTarget??oA(Et?.target),wn=()=>{const Kt=e.pendingSelectionCapture;Kt&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Kt)};return Vr("div",{},[Vr(TS,{ui:e.ui,linkItem:Ye,textTarget:Ot,restoreSelection:wn,closePopover:()=>Ss(Ye),goToAnchor:()=>{Ss(Ye);const Kt=Ye.attributes.value?.href;if(!Kt)return;const Sn=Kt.slice(1),Pt=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${Sn}']`);Pt&&mf(Pt)}})])}const j=kn({type:"options",name:"linkInput",command:"toggleLink",active:!1});R.childItem=j,j.parentItem=R;const O=kn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),V=kn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),Q=kn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>F(Q)}]});function F(Ye){return Vr("div",{},[Vr(Dz,{onSelect:Ot=>{e.emitCommand({item:Ye,argument:Ot}),Ss(Ye),eb(e)}})])}const N=kn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>z(N)}]}),x=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function z(Ye){return Vr(Hz,{options:x,onSelect:Et=>{Ss(Ye);const{command:Ot}=Et;e.emitCommand({item:Ye,argument:{command:Ot}})}})}const J=kn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Vr("div",{},[Vr(YB,{onSelect:Et=>{Ss(J);const Ot={...J,command:"setTextAlign"};Ot.command="setTextAlign",e.emitCommand({item:Ot,argument:Et}),X(J,Et)}})]),key:"alignment"}],onActivate:({textAlign:Ye})=>{X(J,Ye)},onDeactivate:()=>{X(J,"left")}}),X=(Ye,Et)=>{let Ot=Et==="both"?"justify":Et,wn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Kt=wn[Ot]??wn.left;Ye.icon.value=Kt},ae=kn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const Ye=Et=>{Ss(ae);const Ot={...ae,command:"toggleBulletListStyle"};e.emitCommand({item:Ot,argument:Et})};return Vr(nA,{buttons:QB,iconSize:25,selectedStyle:ae.selectedValue.value,onSelect:Ye})}}]}),pe=kn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const Ye=Et=>{Ss(pe);const Ot={...pe,command:"toggleOrderedListStyle"};e.emitCommand({item:Ot,argument:Et})};return Vr(nA,{buttons:JB,iconSize:30,selectedStyle:pe.selectedValue.value,onSelect:Ye})}}]}),Fe=kn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),fe=kn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),ye=kn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),le=kn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:Ye})=>{Ye&&(le.label.value=Ye)}}),Se=kn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:Ye})=>{Ye&&(Se.label.value=Ye)}}),re=kn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),xe=kn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),$e=kn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),st=kn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),At=kn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),Ee=kn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),Ge=(Ye,Et)=>Ye==="editor"?Et:Ye==="suggester"?Et.filter(Ot=>Ot.value==="suggesting"):Et.filter(Ot=>Ot.value==="viewing"),qe=Ye=>Ye==="editor"?"Editing":Ye==="suggester"?"Suggesting":"Viewing",Z=kn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:qe(s),label:qe(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>ee(Z)}]}),S=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function ee(Ye){return Vr(sz,{options:Ge(s,S),onSelect:Et=>{const Ot=e.superdoc?.activeEditor??e.activeEditor;Ss(Ye);const{label:wn,icon:Kt,value:Sn}=Et;Z.label.value=wn,Z.icon.value=Kt,e.emitCommand({item:Z,argument:Sn}),eb(e,Ot)}})}const D=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),U=["search","ruler","undo","overflow","documentMode"],H=kn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),G=kn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),te=kn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const Ye=Ot=>{Ss(te);const wn=typeof Ot=="string"?Ot:Ot?.id??null;if(!wn)return;const Kt={...te,command:"setLinkedStyle"};e.emitCommand({item:Kt,argument:wn})},Et=e.getActiveLinkedStyleId?.()??null;return Vr("div",{},[Vr(uz,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Ye,selectedOption:Et})])}}],onActivate:({styleId:Ye,styleName:Et})=>{const Ot=Et||Ye;te.label.value=Ye&&Ye!=="Normal"?String(Ot):n.formatText,te.disabled.value=!1},onDeactivate:()=>{te.disabled.value=!0,te.label.value=n.formatText}}),Y=(Ye,Et)=>{if(Et.value==Ye)return Vr("div",{innerHTML:jz,class:"dropdown-select-icon"})},K=kn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(Ye=>({label:Ye.toFixed(2),key:Ye,icon:()=>Y(Ye,K.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),be=20,me=32,Ce=U.reduce((Ye,Et)=>Ye+(D.get(Et)||D.get("default")),0),Pe=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],it=["zoom","fontFamily","fontSize","redo"],He=i<=Ff.lg,Ct=e.config?.showFormattingMarksButton===!0,Yt=e.config?.showTableOfContentsButton===!0;He&&(Z.attributes.value={...Z.attributes.value,className:`${Z.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),He&&(te.attributes.value={...te.attributes.value,className:`${te.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let St=[re,xe,$e,st,T,le,c,v,p,v,l,_,C,k,b,y,v,R,O,...Yt?[V]:[],Q,N,v,J,ae,pe,Fe,fe,K,v,te,v,H,Se,...Ct?[G]:[],Ee,At,...Gz(e)?[d]:[],ye,Z];if(i<=Ff.md&&o&&(St=St.filter(Ye=>Ye.type!=="separator")),e.config.mode!=="docx"){const Ye=St.findIndex(Ot=>Ot.name.value==="linkedStyles");St.splice(Ye-1,2);const Et=["ruler","zoom","undo","redo"];St=St.filter(Ot=>!Et.includes(Ot.name.value))}const Ft=[];a||(s==="viewer"&&Ft.push($e,st),St=St.filter(Ye=>!Ft.includes(Ye)));const Nt=Ye=>U.includes(Ye.name.value),sn=[],_n=[];let Qt=me+Ce;return St.forEach(Ye=>{const Et=D.get(Ye.name.value)||D.get("default");if(i<Ff.xl+be&&Pe.includes(Ye.name.value)&&o){if(sn.push(Ye),Ye.name.value==="linkedStyles"){const Ot=St.findIndex(wn=>wn.name.value==="linkedStyles");St.splice(Ot+1,1)}return}if(i<Ff.sm&&it.includes(Ye.name.value)&&o){sn.push(Ye);return}if(Nt(Ye)){_n.push(Ye),Qt+=Et;return}Qt<i||!o?(_n.push(Ye),Qt+=Et):sn.push(Ye)}),{defaultItems:_n,overflowItems:sn.filter(Ye=>Ye.type!=="separator")}},sA={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},qz=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;xt();function aA(e){return wN(e)??$0[e]??null}function fm(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n);return i&&typeof i.then=="function"&&Promise.resolve(i).then(()=>r.onSettled?.(),s=>{r.onError?.(s),r.onSettled?.()}),!0}var Yz=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),Xz=new Set(["list","numberedlist"]);function Zz(e,t){if(e==="fontFamily"||e==="fontSize"||Xz.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!Yz.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function lA(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function Qz(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var Jz=class extends Ym.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...er},texts:{...sA},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#t=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...er,...e.icons},this.config.texts={...sA,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=qz(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#e(),this.#u(),this.#l(),this.#s(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Zl(GB),this.app.directive("click-outside",Qv),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#e(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#P():this.#k()}))}#i(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#k();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#s(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#m()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#d(e){return e||zB(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#l(){const e=this.getAvailableWidth(),t=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,{defaultItems:n,overflowItems:r}=Kz({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#d(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev}),o=this.config.customButtons||[],i=o.map(l=>this.#f(l));o.length&&n.push(...i);let s=[...n.map(l=>l.name.value),...r.map(l=>l.name.value)];if(t){const l=Object.values(this.config.groups).flatMap(d=>d),u=new Set(Object.keys(this.config.groups)),c=i.filter(d=>u.has(d.group?.value||"center")).map(d=>d.name.value);s=[...new Set([...l,...c])]}const a=n.filter(l=>s.includes(l.name.value)).filter(l=>!this.config.excludeItems.includes(l.name.value));if(t)for(const[l,u]of Object.entries(this.config.groups))for(const c of a)u.includes(c.name.value)&&(c.group.value=l);this.toolbarItems=a,this.overflowItems=r.filter(l=>s.includes(l.name.value))}#f(e){const t=kn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};return n({...i,item:t,argument:s.argument,option:s.option})}});this._customCommandRegs.set(r,o)}}return t}#m(){this.#l(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#r().find(t=>t.name.value===e)}#r(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.ui?.styles?.getQuickGallery?.()??[]}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#m()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#l(),this.updateToolbarState()};#p(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#y(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#w(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#_(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>tb(this,e,[],!0)};e.nestedOptions.value=[t]}#S(e){return!!e?.active&&e?.value==null}#E(e){return!!e&&e.disabled===!1&&e.value==null}#x(e){const t=e.name.value;if(t==="tableActions"){const i=tA.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(!1),!0;if(Q0(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#p(t)?e.activate():e.deactivate(),!0;const n=aA(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];Zz(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#w()},link:()=>{e.active.value=!!r?.active,e.attributes.value=nb(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#E(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#S(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#w(),this.#_();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#M(),this.#r().forEach(n=>{n.allowWithoutEditor?.value&&this.#x(n)})):this.#r().forEach(n=>{n.resetDisabled(),this.#x(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#M(){this.#r().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#c(e,t){const n=this.superdoc;if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#L(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#g(i,n)};if(n==="image"&&t==null)return this.#T();if(n==="tableActions"){const i=eA[t?.command];return i?fm(this.ui,i,void 0,r):!1}if(Q0(n)?.disposition==="unsupported")return!0;const o=aA(n);return o?fm(this.ui,o,t,r):!1}#T(){return this.snapshot?.commands?.image?.disabled||(this.#t||(this.#t=EN({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await AN(e,this.superdoc?.config?.handleImageUpload);fm(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#g(n,"image")})},onError:e=>this.#g(e,"image")})),this.#t.open()),!0}#P(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{lA(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!lA(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}Qz(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#k(){this.#n&&(this.#n(),this.#n=null)}#g(e,t){const n=e instanceof Error?e:new Error(String(e));this.emit("exception",{error:n,originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null})}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(Q0(r)?.disposition==="host-routed"){this.#c(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;this._customCommandRegs.has(s)&&this.ui?.commands?.execute?this.ui.commands.execute(s,{argument:t,option:n}):o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc}),this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!fm(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#g(s,r)}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#L(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#g(s,r)}}}destroy(){this.#k(),this.#t?.destroy(),this.#t=null,this.#a(),this.#i(),this.app?.unmount(),this.app=null,this.toolbar=null}};function $z(e){return new Jz(e)}function eV(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function tV(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=hm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=rV(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=nV(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=oV(e.border);return i&&(t.border=i),t}function hm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function nV(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function rV(e){if(!e)return;const t={},n=hm(e.fill);n!=null&&(t.fill=n);const r=hm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function oV(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=hm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function uc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}function cA(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function iV(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of cA(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function uA(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=iV(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const p=`trackedChange:${m}`;if(!r.has(p)){r.add(p);const v={type:"trackedChange",id:m};l&&(v.storyKey=l),n.push(v),o.push(v)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;o=[]}const c=s.getAttribute("data-comment-ids");if(c)for(const m of cA(c)){const p=`comment:${m}`;r.has(p)||(r.add(p),n.push({type:"comment",id:m}))}const d=s.getAttribute("data-sdt-type"),h=s.getAttribute("data-sdt-id");if(h&&d==="structuredContent"){const m=`contentControl:${h}`;if(!r.has(m)){r.add(m);const p=s.getAttribute("data-sdt-scope"),v=s.getAttribute("data-sdt-tag"),_={type:"contentControl",id:h};(p==="block"||p==="inline")&&(_.scope=p),v&&(_.tag=v),n.push(_)}}if(t&&i===t)break;i=i.parentElement}return n}const rb={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},VU=[rb.INLINE_SDT_LABEL,rb.BLOCK_SDT_LABEL],dA={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref"},sV=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},HU=`.${rb.BLOCK_SDT}[${dA.SDT_ID}]`,jU=`[${dA.DRAGGABLE}="true"]`;var ro=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),cl=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),ku=()=>({oneOf:[{type:"number"},{type:"null"}]}),Au=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),aV={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},lV={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},cV=()=>({oneOf:[{type:"boolean"},{type:"null"},aV]}),uV=()=>({oneOf:[{type:"array",items:lV,minItems:1},{type:"null"}]});function pm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function dV(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var ob=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:pm(n),schema:ro()}),dc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:pm("textStyle",o??e),schema:r}),zn=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:dV(o??e),schema:r});const mm=[ob("bold","w:b","bold"),ob("italic","w:i","italic"),ob("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:pm("underline"),schema:cV()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:pm("highlight"),schema:cl()},dc("color","string","w:color",cl()),dc("fontSize","number","w:sz",ku()),dc("fontFamily","string","w:rFonts",cl()),dc("letterSpacing","number","w:spacing",ku()),dc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),dc("position","number","w:position",ku()),zn("dstrike","boolean","w:dstrike",ro()),zn("smallCaps","boolean","w:smallCaps",ro()),dc("caps","boolean","w:caps",ro(),"textTransform"),zn("shading","object","w:shd",Au({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),zn("border","object","w:bdr",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),zn("outline","boolean","w:outline",ro()),zn("shadow","boolean","w:shadow",ro()),zn("emboss","boolean","w:emboss",ro()),zn("imprint","boolean","w:imprint",ro()),zn("charScale","number","w:w",ku(),"w"),zn("kerning","number","w:kern",ku(),"kern"),zn("vanish","boolean","w:vanish",ro()),zn("webHidden","boolean","w:webHidden",ro()),zn("specVanish","boolean","w:specVanish",ro()),zn("rtl","boolean","w:rtl",ro()),zn("cs","boolean","w:cs",ro()),zn("bCs","boolean","w:bCs",ro(),"boldCs"),zn("iCs","boolean","w:iCs",ro(),"italicCs"),zn("eastAsianLayout","object","w:eastAsianLayout",Au({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),zn("em","string","w:em",cl()),zn("fitText","object","w:fitText",Au({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),zn("snapToGrid","boolean","w:snapToGrid",ro()),zn("lang","object","w:lang",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),zn("oMath","boolean","w:oMath",ro()),zn("rStyle","string","w:rStyle",cl(),"styleId"),zn("rFonts","object","w:rFonts",Au({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),zn("fontSizeCs","number","w:szCs",ku()),zn("ligatures","string","w14:ligatures",cl()),zn("numForm","string","w14:numForm",cl()),zn("numSpacing","string","w14:numSpacing",cl()),zn("stylisticSets","array","w14:stylisticSets",uV()),zn("contextualAlternates","boolean","w14:cntxtAlts",ro())],UU=new Set(mm.map(e=>e.key)),fV=Object.fromEntries(mm.map(e=>[e.key,e])),GU={mark:mm.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:mm.filter(e=>e.storage==="runAttribute").map(e=>e.key)};var hV=new Set(Object.values(lt));function ib(e,t){return typeof e=="string"&&hV.has(e)?e:t}function fA(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:lt.notReady}:{ok:!1,reason:ib(t,lt.targetUnresolved)}}return{ok:!0}}var pV=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],mV={[U4.bulletList]:"bullet",[U4.numberedList]:"ordered"};function hA(e){return mV[e]??null}var gV={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function vV(e){const t=gV[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var yV={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""};const bV=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: all-story tracked-changes list; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: all-story tracked-changes list; consumers already fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}];var wV=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function CV(e){return bV.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var pA={ready:0,stale:1,pending:2};function Iu(...e){let t="ready";for(const n of e)pA[n]>pA[t]&&(t=n);return t}function Tt(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function Tr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function vr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function lr(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function Nf(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function Bf(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function sb(e){if(!e||typeof e!="object")return!1;const t=e,n=i=>{if(!i||typeof i!="object")return!1;const s=i;return s.kind==="text"&&typeof s.blockId=="string"&&typeof s.offset=="number"},r=i=>{if(!i||typeof i!="object")return!1;const s=i,a=s.range;return typeof s.blockId=="string"&&typeof a?.start=="number"&&typeof a.end=="number"};if(Array.isArray(t.segments)){const i=t.segments[0],s=t.segments[t.segments.length-1];return r(i)&&r(s)}if(t.kind==="selection")return n(t.start)&&n(t.end);if(t.kind!=="text"||typeof t.blockId!="string")return!1;const o=t.range;return typeof o?.start=="number"&&typeof o.end=="number"}function _V(e){if(!e||typeof e!="object")return null;const t=Bf(e);if(sb(t))return t;const n=e,r=n.navigationTarget&&typeof n.navigationTarget=="object"?n.navigationTarget:null;return r?.kind==="block"&&typeof r.blockId=="string"&&r.blockId.length>0?{kind:"text",blockId:r.blockId,range:{start:0,end:0},...r.story&&typeof r.story=="object"?{story:r.story}:{},...n.address&&typeof n.address=="object"?{address:n.address}:{}}:t}function Cr(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function zf(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=Bf(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function Ki(e,t,n){return Gn(e)!==t?!1:n?Cr(zf(e))===Cr(n):!0}function gm(e){const t=zf(e);if(!(!t||Cr(t)===Cr(null)))return t}function SV(e){if(typeof e!="string"||e.length===0)return;const t=sV(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function kV(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function ab(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function vm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function AV(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function Gn(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function IV(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var mA=new WeakMap;function gA(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const d of a.wordIdOther)n(d);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const u=s.replacement;if(u&&typeof u=="object")for(const d of[u.inserted,u.deleted])d&&typeof d=="object"&&(n(d.id),n(d.wordId));const c=s.move;if(c&&typeof c=="object")for(const d of[c.source,c.destination])d&&typeof d=="object"&&(n(d.id),n(d.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function pa(e){const t=mA.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Gn(i);if(s){n.add(s);for(const a of gA(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return mA.set(e,o),o}var vA=new WeakMap,yA=new WeakMap;function Eu(e,t){const n=Cr(t);let r=vA.get(e);r||(r=new Map,vA.set(e,r));const o=r.get(n);if(o)return o;const i=pa(e.filter(s=>Cr(zf(s))===n));return r.set(n,i),i}function EV(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function xV(e,t){const n=t.filter(o=>e.some(i=>Gn(i)===o&&zf(i)==null));if(n.length===0)return null;if(n.length===1)return n[0];const r=new Set;for(const o of n){const i=e.find(s=>Gn(s)===o);if(i)for(const s of gA(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function TV(e){const t=yA.get(e);if(t)return t;const n=e.filter(o=>zf(o)!=null),r=n.length===e.length?e:n;return yA.set(e,r),r}function RV(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=u=>{for(const c of t){const d=u.toPublicId(c);if(d)return d}return null},a=qi(r),l=Cr(a)===Cr(null);if(i){const u=l?TV(i):i,c=s(Eu(u,a));if(c)return c;const d=n?.find(h=>u.some(m=>Ki(m,h,a)));return d||(l?s(pa(o)):EV(a)?xV(i,t):null)}return l?s(pa(o))??t[0]??null:null}function MV(e,t){const n=e.find(r=>Gn(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Gn(n)??t:null}function LV(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Fr(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var PV=64;function fc(e){return e.length<=PV}function qi(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function mo(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function ma(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function bA(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var wA=720;function ks(e){return Math.round(e*20)}function xu(e){return typeof e=="number"&&Number.isFinite(e)}function DV(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=xu(i.left)?ks(i.left):xu(i.start)?ks(i.start):void 0,a=xu(i.right)?ks(i.right):xu(i.end)?ks(i.end):void 0,l=xu(i.firstLine)?ks(i.firstLine):void 0,u=xu(i.hanging)?ks(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function lb(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function OV(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function Vf(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function ul(e){return Vf(e.target)??Vf(e.selectionTarget)}var CA=["fontFamily","fontSize","color","highlight"],FV={undo:"history.undo",redo:"history.redo"},Hf=["bold","italic","underline","strikethrough"];function cb(e){return CA.includes(e)}function Tu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,c)=>{typeof l!="string"||typeof u!="number"||typeof c!="number"||r.push({blockId:l,start:Math.min(u,c),end:Math.max(u,c)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function Yi(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function NV(e){const t=Yi(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function ga(e){const t=Tu(e);return t.length===0?null:[NV(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function _A(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:uc({selectionTarget:t})}function BV(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function zV(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function VV(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function HV(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function SA(e,t){const n=Tu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>HV(n,VV(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function jV(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function ub(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function UV(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function GV(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function kA(e,t){if(!e)return{};const n=new Map;for(const i of Tu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of CA){const s=new Map;let a=!1,l=!1;for(const u of r){const c=typeof u?.blockId=="string"?u.blockId:null;if(!c)continue;const d=n.get(c);if(!d?.length)continue;const h=Array.isArray(u?.runs)?u.runs:[];for(const m of h){const p=m?.range,v=typeof p?.start=="number"?p.start:null,_=typeof p?.end=="number"?p.end:null;if(v==null||_==null||!d.some(y=>zV(y,{start:v,end:_})))continue;a=!0;const C=jV(m?.styles,i);if(C===void 0){l=!0;continue}const k=GV(i,C);if(s.has(k)||s.set(k,C),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function db(e,t){const n=Fr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:mo(n)}:{kind:"documentEnd"}}function on(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function dl(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function ym(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function As(e){if(Tr(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function bm(e){return!!e&&typeof e=="object"&&e.success===!0}function go(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function Ru(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function fb(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const u of l.blocks)n(u);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function hc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function mi(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!go(i)&&n===null&&(n=i),bm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function WV(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function KV(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function wm(e){return Su(e)?.trackDecision??null}function qV(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function fl(e){return{found:!1,success:!1,rects:[],reason:e}}function YV(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function XV(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function AA(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(XV))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function ZV(e){return e.selectionTarget?e.selectionTarget:AA(e.target)}function Mu(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=AA(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function hb(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var pb={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},QV=Object.fromEntries(Object.entries(pb).filter(([e])=>fV[e]?.tracked===!0));function JV(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...pb}};default:return null}}function $V(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function eH(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function tH(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!1,c=Promise.resolve(),d=null,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},m=0;const p=new Set;let v={},_="",C=null;const k=()=>{const f=t?.activeEditor;return f&&typeof f=="object"?f:null},y=()=>{const f=k()?.doc;return f&&typeof f=="object"?f:null},b=()=>{const f=k()?.v2TrackedChanges;return f&&typeof f=="object"?f:null},T=()=>{const f=k()?.host;return f&&typeof f=="object"?f:null},R=f=>{if(f.storyType!=="headerFooterPart"||typeof f.refId!="string")return null;const g=k(),w=T(),A=g?.pageLayout??w?.pageLayout;if(!A||typeof A!="object")return null;const E=A.getActiveRulerContext,B=w?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof B!="function")return null;const q=Tt(()=>E.call(A),null);if(!q||typeof q.pageIndex!="number")return null;for(const oe of["header","footer"]){const ve=Tt(()=>B.call(w,{pageIndex:q.pageIndex,kind:oe}),null);if(!(ve?.status!=="ready"||ve.refId!==f.refId||typeof ve.sectionId!="string"||!["default","first","even"].includes(String(ve.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:ve.sectionId},headerFooterKind:oe,variant:ve.slotVariant}}return null},P=()=>{const f=T(),g=f?.getPendingInlineFormat;if(typeof g!="function")return null;const w=Tt(()=>g.call(f),null);return w&&typeof w=="object"?w:null},j=f=>{const g=hb(f);if(!g)return null;const w=P();if(!w||!(g in w))return null;const A=w[g];return f.inline?.kind==="toggle"?A===!0:A!=null&&A!==""},O=f=>{const g=hb(f);if(!g)return;const w=P();if(!w||!(g in w))return;const A=w[g];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number"&&Number.isFinite(A))return String(A)},V=(f,g)=>{const w=T(),A=w?.setPendingInlineFormat;typeof A=="function"&&Tt(()=>A.call(w,f,g),void 0)},Q=f=>{const g=T(),w=g?.clearPendingInlineFormat;typeof w=="function"&&Tt(()=>w.call(g,f),void 0)},F=new Set(["bold","italic","underline","strikethrough"]),N=f=>{const g=P();if(!g)return;const w=Array.isArray(f.activeMarks)?f.activeMarks:[];let A=null;for(const E of Object.keys(g)){const B=g[E];let q;if(F.has(E))q=w.includes(E)===(B===!0);else if(cb(E)){if(B==null)continue;A||(A=ni(f)),q=A[E]===B}else q=!1;q&&Q(E)}},x=()=>{const f=k()?.editCommands;return f&&typeof f=="object"?f:null},z=f=>{const g=x();if(!g||typeof g.getSnapshot!="function")return null;const w=Tt(()=>g.getSnapshot(),null)?.commands?.[f];return w&&typeof w=="object"?w:null},J=()=>z("lists.apply"),X=f=>{const g=f?.value?.seed;return g==="bullet"||g==="ordered"?g:null},ae=f=>{const g=FV[f];return g?z(g):null},pe=()=>{const f=T();if(!f||typeof f.getTableContext!="function")return null;const g=Tt(()=>f.getTableContext(),null);return g&&typeof g=="object"?g:null},Fe=()=>{const f=pe();if(!f||f.inTable!==!0)return null;const g=f.table,w=typeof g?.nodeId=="string"&&g.nodeId.length>0?g.nodeId:null;if(!w)return null;const A=f.row,E=f.column,B=f.cell,q=typeof A?.index=="number"&&Number.isInteger(A.index)?A.index:null,oe=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(q==null||oe==null)return null;const ve=typeof B?.nodeId=="string"&&B.nodeId.length>0?B.nodeId:null,Re=f.cellRange;return{tableNodeId:w,rowIndex:q,columnIndex:oe,cellNodeId:ve,mergeRange:$V(Re)}},fe=new Map;let ye=null,le=null,Se=0,re=0,xe=0;const $e=new Set,st=(f,g)=>f===g?!0:!f||!g?!1:f.id===g.id&&f.paintedEntityId===g.paintedEntityId&&Cr(f.story)===Cr(g.story),At=f=>Array.from($e).some(g=>st(g,f)),Ee=f=>{const g=T();if(typeof g?.getHandles!="function")return;const w=Tt(()=>g.getHandles(),null),A=w?.review;if(A){if(f){if(typeof A.setActiveReviewTarget!="function")return;const E=w?.layout;Tt(()=>A.setActiveReviewTarget({entityType:"trackedChange",entityId:f.id,...f.paintedEntityId?{paintedEntityId:f.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:f.story??{kind:"story",storyType:"body"}}),null);return}typeof A.getActiveReviewTarget!="function"||typeof A.clearActiveReviewTarget!="function"||Tt(()=>A.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Tt(()=>A.clearActiveReviewTarget(),void 0)}},Ge=(f,g)=>{le=f,Se+=1,xe+=1,g?.invalidateQueuedNavigation!==!1&&(re+=1)},qe=new Set;let Z=!1,S=null;const ee=new Map,D=new Set;let U=null,H=null,G=!1,te=null,Y=0,K=null,be=null,me=null;const Ce=()=>{if(G||Z)return;G=!0;const f=()=>{G=!1,Z||Dt()};typeof queueMicrotask=="function"?queueMicrotask(f):Promise.resolve().then(f)},Pe=250,it=5e3,He=f=>{Z||te&&Y<=f||(te&&clearTimeout(te),Y=f,te=setTimeout(()=>{te=null,Y=0,Z||Dt()},Math.max(0,f-Date.now())))},Ct=new WeakMap;let Yt=0;const St=f=>{if(!f)return"none";let g=Ct.get(f);return g==null&&(g=Yt+=1,Ct.set(f,g)),`e${g}`};let Ft=0,Nt={},sn=null,_n=null,Qt=0;const Ye=()=>{_n&&clearTimeout(_n),_n=null,Qt=0};let Et=f=>{},Ot=null,wn=new Set,Kt=0,Sn=null;const Pt=()=>`${St(k())}|m${Ft}`,De=()=>{Ot=null,wn=new Set},je=f=>{for(const g of["trackChanges","trackChanges:all"]){const w=ee.get(g);if(!w?.hasSettled||!Array.isArray(w.value))continue;const A=w.value.filter(E=>{const B=Gn(E);return!B||!f.has(B)});A.length!==w.value.length&&ee.set(g,{...w,value:A})}},Ke=f=>{const g=()=>{if(!Z)for(const B of[...qe])B(ut)},w=Ru(f)?f:null,A=k()?.documentMutationReadiness,E=()=>{const B=globalThis.requestAnimationFrame;return typeof B!="function"?Promise.resolve():new Promise(q=>{let oe=!1;const ve=()=>{oe||(oe=!0,clearTimeout(Re),q())},Re=setTimeout(ve,250);B(()=>B(()=>setTimeout(ve,0)))})};if(w?.success===!0&&typeof w.txId=="string"&&w.txId.length>0&&typeof A?.whenPainted=="function")try{Promise.resolve(A.whenPainted.call(A,w)).then(E,()=>{}).then(g,g);return}catch{}g()},pt=(f,g)=>{const w=ut.trackChanges,A=w.items.filter(q=>{const oe=Gn(q);return!oe||!f.has(oe)});if(A.length===w.items.length)return;le&&f.has(le.id)&&Ge(null);const E=new Set;for(const q of A){const oe=ym(q),ve=q,Re=oe.author??oe.authorEmail??ve.author??ve.authorEmail;typeof Re=="string"&&E.add(Re)}const B=w.items.length-A.length;ut={...ut,trackChanges:{...w,items:A,total:Math.max(A.length,w.total-B),activeId:w.activeId&&f.has(w.activeId)?null:w.activeId,authors:[...E]}},Ke(g)},kt=(f,g)=>{if(f.size===0)return;const w=Pt(),A=Ot===w?wn:new Set,E=new Set([...f].filter(B=>!A.has(B)));E.size!==0&&(Ot=w,wn=new Set([...A,...E]),je(wn),pt(E,g))},ft=f=>Ot===f&&wn.size>0?wn:null,an=(f,g=[])=>{const w=f.map(dl).filter(E=>E!=null&&Gn(E)!=null);if(w.length===0)return;const A=g.map(dl).map(E=>E==null?null:Gn(E)).filter(E=>E!=null);for(const E of["trackChanges","trackChanges:all"]){const B=ee.get(E),q=B?.hasSettled&&Array.isArray(B.value)?[...B.value]:[],oe=new Set;let ve=!1;for(const Re of w){const Ue=Gn(Re);if(!Ue)continue;const We=q.findIndex(Le=>Gn(Le)===Ue);if(We<0)q.push(Re),oe.add(Ue);else{const Le=q[We];q[We]=Ru(Le)?{...Le,...Re}:Re}ve=!0}if(E==="trackChanges"&&oe.size>0&&A.length>0){const Re=new Set(A.filter(Le=>oe.has(Le))),Ue=new Map(q.filter(Le=>Re.has(Gn(Le)??"")).map(Le=>[Gn(Le),Le])),We=q.filter(Le=>!Re.has(Gn(Le)??""));for(const[Le,Xe]of A.entries()){if(!Re.has(Xe))continue;const Ve=Ue.get(Xe);if(!Ve)continue;const Ze=A.slice(Le+1).map(rt=>We.findIndex(tt=>Gn(tt)===rt)).find(rt=>rt>=0);if(Ze!=null){We.splice(Ze,0,Ve);continue}const Je=A.slice(0,Le).reverse().map(rt=>We.findIndex(tt=>Gn(tt)===rt)).find(rt=>rt>=0);We.splice(Je==null?We.length:Je+1,0,Ve)}q.splice(0,q.length,...We)}ve&&ee.set(E,{token:B?.token??null,value:q,hasSettled:!0,inflightToken:null})}},qt=f=>{const g=Pt(),w=ft(g),A=f.map(dl).filter(E=>{if(E==null)return!1;const B=Gn(E);return B!=null&&!w?.has(B)});for(const E of["trackChanges","trackChanges:all"])ee.set(E,{token:g,value:[...A],hasSettled:!0,inflightToken:null})},cn=async(f,g)=>{try{const w=f.v2TrackedChanges?.listTrackedChanges;if(typeof w=="function"){const B=await Promise.resolve(w.call(f.v2TrackedChanges,{mode:g.trackedChangesListMode,refreshReason:g.refreshReason,blocking:g.blocking,...g.targetIds?.length?{targetIds:g.targetIds}:{}})),q=g.trackedChangesListMode==="all"&&g.refreshReason==="mutation-history-render-reconcile"?B?.ok===!0:B?.ok!==!1;return{ok:q,items:q&&Array.isArray(B?.items)?B.items:[],...typeof B?.complete=="boolean"?{complete:B.complete}:{},...typeof B?.sourceCoverageComplete=="boolean"?{sourceCoverageComplete:B.sourceCoverageComplete}:{}}}const A=f.docTrackChanges?.list;if(typeof A!="function")return{ok:!1,items:[]};const E=await Promise.resolve(A.call(f.docTrackChanges));return{ok:!0,items:Array.isArray(E?.items)?E.items:[]}}catch(w){return{ok:!1,items:[],failures:[w]}}},hn=z_({getContext:()=>{const f=k();if(!f)return null;const g=b(),w=y()?.trackChanges??null,A=g??w;if(!A)return null;const E=f.documentId??g?.documentId;return{editor:f,adapter:A,documentId:E==null?null:String(E),reconcileToken:Nt,v2TrackedChanges:g,docTrackChanges:w}},reconcile:async(f,g)=>{g.removedIds.size>0&&kt(new Set(g.removedIds));const w=[...new Set(g.upsertIds)];if(w.length===0)return{ok:!0,items:[],resolvedIds:[],unresolvedIds:[]};const A=ee.get("trackChanges"),E=A?.hasSettled&&Array.isArray(A.value)?A.value:null,B=new Set(E?E.map(Gn).filter(Je=>Je!=null):[]),q=E?.length===0&&vo()==="complete",oe=new Set(w.filter(Je=>!B.has(Je))),ve=f.v2TrackedChanges?.getTrackedChange,Re=f.docTrackChanges?.get;if(typeof ve!="function"&&typeof Re!="function")return{ok:!1,items:[],resolvedIds:[],unresolvedIds:w};const Ue=await Promise.all(w.map(async Je=>{try{if(typeof ve=="function"){const tt=await Promise.resolve(ve.call(f.v2TrackedChanges,Je));return{id:Je,ok:tt?.ok!==!1,items:tt?.ok!==!1&&Array.isArray(tt?.items)?tt.items:[],result:tt}}const rt=await Promise.resolve(Re.call(f.docTrackChanges,{id:Je}));return{id:Je,ok:!0,items:rt&&typeof rt=="object"?[rt]:[],result:rt}}catch(rt){return{id:Je,ok:!1,items:[],result:rt}}})),We=[],Le=[],Xe=[];for(const Je of Ue){const rt=Je.items.filter(tt=>{const Rt=dl(tt);return Rt!=null&&Gn(Rt)===Je.id});Je.ok&&rt.length>0?(We.push(...rt),Le.push(Je.id)):Xe.push(Je.id)}let Ve;const Ze=Le.filter(Je=>oe.has(Je));if(Ze.length>0&&!q){const Je=await cn(f,{trackedChangesListMode:"interaction-prime",refreshReason:"mutation-render-reconcile",blocking:!1,targetIds:Ze});Je.ok&&(Ve=Je.items)}return{ok:Xe.length===0,items:We,orderedItems:Ve,resolvedIds:Le,unresolvedIds:Xe,failures:Ue.filter(Je=>!Je.ok).map(Je=>Je.result)}},hydrate:cn,onReconciled:(f,g,w)=>{if(w?.reconcileMode==="authoritative"){if(f.reconcileToken!==Nt)return;w.ok===!0&&w.complete===!0&&w.sourceCoverageComplete===!0?(Ye(),qt(w.items??[]),sn=null):w.ok===!0?(Ye(),an(w.items??[])):Et(f.reconcileToken),Dt();return}an((w?.items??[]).filter(A=>{const E=dl(A),B=E==null?null:Gn(E);return B!=null&&g.has(B)}),w?.orderedItems??w?.items??[]),Dt()}});Et=f=>{if(Z||_n)return;const g=Math.min(Pe*2**Qt,it);Qt+=1,_n=setTimeout(()=>{_n=null,!(Z||sn===null||f!==Nt)&&hn.onRender(!0)},g)};const oo=()=>`${Pt()}|m${Wn()}|s${Kt}`,Jt=f=>JSON.stringify({t:f.target??null,s:f.selectionTarget??null}),Yn=["contentControls:inRange:","query:","effInline:"],Nr=120,io=180,vo=()=>{const f=T(),g=f?.getDocumentLoadingSnapshot;if(typeof g!="function")return"unknown";const w=Tt(()=>g.call(f),null)?.sourceStage;return w==="opening"||w==="bootstrap-ready"||w==="source-loading"?"loading":w==="source-complete"||w==="source-failed"||w==="source-cancelled"?"complete":"unknown"},$t=new Map,Bn=f=>{const g=Pt();$t.get(f)!==g&&($t.set(f,g),Ce())},xi=()=>{const f=ee.get("comments");return f?.hasSettled?Array.isArray(f.value)&&f.value.length>0:f?.inflightToken!=null},Is=(f,g)=>$t.get(f)===g,so=f=>{Bn("contentControls")},cr=()=>{const f=ee.get("trackChanges");f?.hasSettled||f?.inflightToken!=null||Bn("trackChanges")},Qo=6500,Zi=8e3,va=250;let Qi=0,hl=0,Ti=!1,ao=0,Ri=!1,_e=null;const ze=()=>{if(Z||_e)return;const f=ao||Date.now(),g=()=>{if(_e=null,Z)return;const w=Date.now()-Qi,A=_r()||w<Qo;if(A&&Date.now()-f<Zi){_e=setTimeout(g,va);return}Ti=!1,Ri=A;try{Dt()}finally{Ri=!1,ao=0}};_e=setTimeout(g,0)};let vt=null,ot=null;const xn=()=>{const f=T();if(!f||vt===f)return;ot&&(ot(),ot=null),vt=f;const g=f.subscribeDocumentLoading;if(typeof g!="function"){vt=null,jr(Qo);return}try{const w=B=>{const q=B?.sourceStage;(q==="source-complete"||q==="source-failed"||q==="source-cancelled")&&ze()},A=g.call(f,w);typeof A=="function"&&(ot=A);const E=f.getDocumentLoadingSnapshot;typeof E=="function"&&w(Tt(()=>E.call(f),null))}catch{vt=null,jr(Qo)}},Tn=()=>{const f=k()?.host,g=f?.getForegroundMutationState;if(typeof g!="function")return null;const w=Tt(()=>g.call(f),null);return{active:typeof w?.active=="number"?w.active:0,pending:typeof w?.pending=="number"?w.pending:0}},_r=()=>{const f=Tn();return!!(f&&(f.active>0||f.pending>0))},jr=(f=Nr)=>{Z||K||(K=setTimeout(()=>{if(K=null,Z)return;if(be&&_r()){jr(),Dt();return}const g=be;be=null,g===oo()&&Xr("selection",g,ml,vi),Dt()},f))},gi=(f,g)=>{if(!Tn())return!1;const w=`${f}\0${g}`;return D.has(w)?!1:(D.add(w),jr(io),!0)},Ji=f=>{if(U==null||f===U)return H?.timer&&clearTimeout(H.timer),H=null,U=f,!1;if(H?.key===f)return H.ready?(H=null,U=f,!1):!0;H?.timer&&clearTimeout(H.timer);const g={key:f,ready:!1,timer:null};return g.timer=setTimeout(()=>{Z||H!==g||(g.timer=null,g.ready=!0,Dt())},io),H=g,!0},Es=f=>V_(f),No=()=>{Mo(),Dt()};let Yr=null,Jo=!1,$i=0;const Mi=()=>{Yr=null,Jo=!1,$i+=1},lo=()=>{const f=k(),g=f?.documentMutationReadiness;if(!f||typeof g?.whenPainted!="function"||(Yr={editor:f,readiness:g,afterEpoch:typeof g.getRenderEpoch=="function"?Tt(()=>g.getRenderEpoch.call(g),null):null},Jo))return;Jo=!0;const w=$i;(async()=>{for(;!Z&&w===$i;){const E=Yr;if(Yr=null,!E){Jo=!1;return}let B=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),B=!0}catch{}if(Z||w!==$i)return;if(k()!==E.editor){Mi();return}B&&No()}})()},$o=()=>{me&&clearTimeout(me),me=setTimeout(()=>{me=null,Z||No()},500)},Xr=(f,g,w,A)=>{let E;try{E=w()}catch{E=void 0}if(!Tr(E)){const oe={token:g,value:A(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return ee.set(f,oe),oe}const B=ee.get(f),q=B?.failedToken===g;return ee.set(f,{token:B?.token??null,value:B?.value??null,hasSettled:B?.hasSettled??!1,inflightToken:g,failedToken:q?g:null,failureCount:q?B.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(oe=>{const ve=ee.get(f);!ve||ve.inflightToken!==g||(ee.set(f,{token:g,value:A(oe),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0}),Ce())},()=>{const oe=ee.get(f);if(!oe||oe.inflightToken!==g)return;const ve=oe.failedToken===g?(oe.failureCount??0)+1:1,Re=Math.min(it,Pe*2**Math.min(ve-1,8)),Ue=Date.now()+Re;ee.set(f,{...oe,inflightToken:null,failedToken:g,failureCount:ve,retryAtMs:Ue}),He(Ue)}),null},ur=(f,g,w,A)=>{const E=ee.get(f);if(E&&E.token===g&&E.hasSettled)return{value:E.value,status:"ready"};if(CV(f)&&!Is(f,g)){if(vo()==="loading")return Ti=!0,xn(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Ti&&!Ri)return ze(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!Ri){const q=Date.now();if(q-hl<Qo&&(!ao||q-ao<Zi))return ao||(ao=q),Ti=!0,ze(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};ao=0}}if(_r())return jr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===g&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return He(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&f.startsWith("effInline:")&&Ji(f))return{value:null,status:"pending"};if(!E&&gi(f,g))return{value:null,status:"pending"};if(!E||E.inflightToken!==g){const q=Xr(f,g,w,A);if(q)return{value:q.value,status:"ready"}}const B=ee.get(f);return B?.hasSettled?{value:B.value,status:"stale"}:{value:null,status:"pending"}},Li=f=>{for(const g of ee.keys())f(g)&&ee.delete(g)},pc=f=>{const g=Jt(f),w=_A(f);return new Set([`contentControls:inRange:${g}`,`query:${g}`,...w?[`effInline:${w}`]:[]])},Lu=f=>{const g=pc(f);Li(w=>Yn.some(A=>w.startsWith(A))&&!g.has(w));for(const w of D){const A=w.split("\0",1)[0];Yn.some(E=>A.startsWith(E))&&!g.has(A)&&D.delete(w)}},xs=()=>{const f=k();f!==Sn&&(Mi(),hn.reset(),Nt={},Sn=f,ee.clear(),sn=null,Ye(),te&&clearTimeout(te),te=null,Y=0,H?.timer&&clearTimeout(H.timer),H=null,U=null,C=null,o=null,be=null,D.clear(),$t.clear(),Ti=!1,ao=0,ot&&ot(),ot=null,vt=null,De())},Mo=()=>{const f=sn!==null;Ft+=1,f&&(sn=Pt()),De()},mc=f=>{if(typeof f!="string"||f.length===0)return lr("insertText requires a non-empty string.","INVALID_INPUT");if(Wn()==="viewing")return lr("The document is read-only.","DOCUMENT_READONLY");const g=y(),w=g?.insert;if(!g||typeof w!="function")return lr("insert is unavailable.");const A=g.selection?.current;if(typeof A!="function")return lr("selection.current is unavailable.");const E=q=>{const oe=q&&typeof q=="object"?q:null,ve=oe?.selectionTarget??oe?.target??null;return!ve||typeof ve!="object"?lr("insertText requires a live selection target.","PRECONDITION_FAILED"):Tt(()=>Ma(w.call(g,{type:"text",value:f,target:ve}),lr("insert failed.")),lr("insert failed."))};let B;try{B=A.call(g.selection)}catch{return lr("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Tr(B)?Promise.resolve(B).then(E,()=>lr("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(B)},ya=(f,g)=>({payload:f,state:ut,editor:k(),superdoc:t,context:g,ui:S,execute:(w,A)=>qn(w,A),executeAsync:(w,A)=>Rm(w,A),doc:y(),selection:ut.selection,documentMode:Wn(),insertText:mc}),ei=f=>f==="editing"||f==="suggesting"||f==="viewing"?f:null,Wn=()=>{const f=k(),g=t&&typeof t=="object"?t:null,w=ei(g?.config?.documentMode),A=ei(Tt(typeof g?.getActiveRuntime=="function"?()=>{const B=g.getActiveRuntime();return typeof B?.getSnapshot=="function"?B.getSnapshot():null}:void 0,null)?.documentMode),E=ei(f?.options?.documentMode);return w&&A&&w!==A?w:A??w??E},jf=()=>{const f=t&&typeof t=="object"?t:null,g=f?.interactionConfig?.comments;if(g&&typeof g.readOnly=="boolean")return g.readOnly===!0;const w=f?.config?.modules?.comments;return!!w&&typeof w=="object"&&w.readOnly===!0},Ts=()=>{const f=t&&typeof t=="object"?t:null,g=f?.interactionConfig?.comments;if(g&&typeof g.allowResolve=="boolean")return g.allowResolve===!1;const w=f?.config?.modules?.comments;return!!w&&typeof w=="object"&&w.allowResolve===!1},ti=()=>Wn()==="viewing"||jf(),vi=f=>f&&typeof f=="object"?f:null,pl=(f,g)=>{if(!f)return{...yV,status:g};const w=f.target??null,A=typeof f.text=="string"?f.text:"";return{status:g,empty:f.empty===!0,target:w,selectionTarget:f.selectionTarget??null,activeMarks:Array.isArray(f.activeMarks)?f.activeMarks:[],activeCommentIds:Array.isArray(f.activeCommentIds)?f.activeCommentIds:[],activeChangeIds:Array.isArray(f.activeChangeIds)?f.activeChangeIds:[],quotedText:A}},es=()=>{const f=y()?.selection;return ur("selection",oo(),()=>f?.current?f.current({includeText:!0}):void 0,vi)},Pu=()=>{const{value:f,status:g}=es();return pl(f,g)},ml=()=>{const f=y()?.selection;return f?.current?f.current({includeText:!0}):void 0},gl=f=>{if(f.empty!==!0)return!1;const g=f.selectionTarget,w=g?.start,A=g?.end;return w?.kind==="text"&&A?.kind==="text"&&typeof w.blockId=="string"&&w.blockId===A.blockId&&typeof w.offset=="number"&&w.offset===A.offset},Uf=f=>{const g=T(),w=g?.readLiveSelectionSyncSnapshot;if(typeof w!="function")return;const A=vi(Tt(()=>w.call(g),null));if(!A||!gl(A))return;const E=oo(),B=Tn(),q=!!(B&&(B.active>0||B.pending>0));if(q)be=E,jr();else if(be=null,Xr("selection",E,ml,vi))return;const oe=ee.get("selection"),ve=Array.isArray(A.activeMarks)&&A.activeMarks.length>0?A.activeMarks:Array.isArray(ut.selection.activeMarks)?ut.selection.activeMarks:[],Re=Array.isArray(A.activeCommentIds)?A.activeCommentIds:[],Ue=IV(f),We=ul(ut.selection),Le=Vf(A.selectionTarget)??Vf(A.target),Xe=We?.range,Ve=Le?.range,Ze=!!(B&&B.active>0&&We&&Le&&We.blockId===Le.blockId&&Cr(We.story)===Cr(Le.story)&&typeof Xe?.start=="number"&&typeof Ve?.start=="number"&&Math.abs(Ve.start-Xe.start)<=2),Je=Ue!=null||Ze?ut.selection.activeChangeIds.filter(tt=>Ue==null||pa(ut.trackChanges.items).aliasesFor(tt).includes(Ue)):[],rt=Array.isArray(A.activeChangeIds)&&A.activeChangeIds.length>0?A.activeChangeIds:Je;ee.set("selection",{token:E,value:{...A,activeMarks:ve,activeCommentIds:Re,activeChangeIds:rt},hasSettled:!0,inflightToken:q?null:oe?.inflightToken??null})},ba=async(f=0)=>{const g=y()?.selection,w=g?.current,A=oo();if(typeof w!="function")return ee.set("selection",{token:A,value:null,hasSettled:!0,inflightToken:null}),Dt(),ut.selection;let E;try{E=w.call(g,{includeText:!0}),Tr(E)&&(E=await Promise.resolve(E))}catch{E=null}return Z?pl(null,"pending"):oo()!==A?f<1?ba(f+1):ut.selection:(ee.set("selection",{token:A,value:vi(E),hasSettled:!0,inflightToken:null}),Dt(),ut.selection)},vl=f=>{const g=y()?.comments,{value:w,status:A}=ur("comments",Pt(),()=>g?.list?g.list():void 0,oe=>oe&&Array.isArray(oe.items)?oe.items:[]),E=w??[],B=f.activeCommentIds;ye&&!E.some(oe=>Gn(oe)===ye)&&(ye=null);const q=ye??B[0]??null;return{status:Iu(A,f.status),listStatus:A,items:E,total:E.length,activeIds:B,activeId:q}},ts=()=>{const f=y()?.trackChanges,g=Pt(),w=ee.get("trackChanges:all"),{value:A,status:E}=sn===g?{value:w?.hasSettled?w.value:null,status:w?.hasSettled?"stale":"pending"}:ur("trackChanges:all",g,()=>f?.list?f.list({in:"all"}):void 0,B=>(B&&Array.isArray(B.items)?B.items:[]).map(dl).filter(q=>q!=null));return E==="ready"?A:null},yi=f=>{const g=y()?.trackChanges,w=b(),A=typeof w?.listTrackedChanges=="function"?w.listTrackedChanges:null,E=Pt(),B=ft(E),q=ee.get("trackChanges"),{value:oe,status:ve}=sn===E?{value:q?.hasSettled?q.value:null,status:q?.hasSettled?"stale":"pending"}:ur("trackChanges",E,()=>A?A.call(w):g?.list?g.list({in:"all"}):void 0,en=>en&&Array.isArray(en.items)?en.items:[]),Re=(oe??[]).map(dl).filter(en=>en!=null).filter(en=>{const Mn=Gn(en);return!Mn||!B?.has(Mn)}),Ue=new Set;for(const en of Re){const Mn=ym(en),Rr=en,Ar=Mn.author??Mn.authorEmail??Rr.author??Rr.authorEmail;typeof Ar=="string"&&Ue.add(Ar)}const We=g?.list?ts():null,Le=le;Le&&(Le.story?We&&!We.some(en=>Ki(en,Le.id,Le.story))&&Ge(null):Re.some(en=>Gn(en)===Le.id)||Ge(null));const Xe=We??Re,Ve=Eu(Xe,qi(f)),Ze=B?f.activeChangeIds.filter(en=>!B.has(en)):f.activeChangeIds,Je=Ze.map(en=>Ve.toPublicId(en)??en),rt=le?.story?Eu(Xe,le.story):pa(Xe),tt=le?rt.toPublicId(le.id)??le.id:null,Rt=RV({selectionIds:Ze,publicIds:Je,selection:f,bodyItems:Re,allStoryItems:We}),Gt=tt??Rt;return{status:Iu(ve,f.status),items:Re,total:Re.length,activeId:Gt,authors:[...Ue]}},Gf=f=>{const g=y()?.contentControls,{value:w,status:A}=ur("contentControls",Pt(),()=>g?.list?g.list():void 0,oe=>oe&&Array.isArray(oe.items)?oe.items:[]),E=w??[],{ids:B,status:q}=Du(g,f);return{status:Iu(A,q,f.status),items:E,total:E.length,activeId:B[0]??null,activeIds:B}},wa=(f,g)=>{if(!f||typeof f.listInRange!="function")return{lockModesById:new Map,status:"ready"};const w=LV(g);if(!w)return{lockModesById:new Map,status:"ready"};const{value:A,status:E}=ur(`contentControls:inRange:${Jt(g)}`,Pt(),()=>f.listInRange(w),oe=>oe&&Array.isArray(oe.items)?oe.items:[]),B=A??[],q=new Map;for(const oe of B)typeof oe?.id=="string"&&q.set(oe.id,typeof oe.lockMode=="string"?oe.lockMode:"unlocked");return{lockModesById:q,status:E}},Du=(f,g)=>{const{lockModesById:w,status:A}=wa(f,g);return{ids:[...w.keys()],status:A}},Wf=()=>{const f=t?.fonts;return{options:sH(oH(Tt(f?.getDocumentFontOptions?()=>f.getDocumentFontOptions():void 0,[])),iH(Tt(f?.getFontFamilyOptions?()=>f.getFontFamilyOptions():void 0,[]))),sizeOptions:aH}},yl=()=>{const f=Tt(t?.getZoomState?()=>t.getZoomState():void 0,null),g=typeof f?.value=="number"?f.value:100,w=f?.mode;return{mode:w==="manual"||w==="fit-width"?w:w==="fixed"?"manual":null,value:g,min:typeof f?.min=="number"?f.min:10,max:typeof f?.max=="number"?f.max:100}},gc=()=>Tt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Ou=()=>{const f=k();return{ready:f!=null,mode:Wn(),dirty:f?!!f.isDirty:!1}},Ca=f=>{const g=f.quotedText;if(typeof g!="string"||g.length===0)return null;const w=Tu(f);if(w.length===0||!fc(w.map(B=>B.blockId)))return null;const A=f.target,E=w.length===1?mo(w[0].blockId,A?.story):void 0;return{select:{type:"text",pattern:g,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},yo=f=>{const g=y()?.query;if(typeof g?.match!="function")return null;const w=Ca(f);if(!w)return null;const{value:A}=ur(`query:${Jt(f)}`,Pt(),()=>g.match(w),E=>E&&typeof E=="object"?E:null);return SA(A,f)},bl=f=>{const g=T(),w=new Set(Fr(f));if(w.size===0)return{};const A=g?.readMountedProjectionBlocksByIds,E=g?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof E!="function")return{};const B=Tt(()=>{if(typeof A!="function")return E.call(g);const Ze=Yi(f);return Ze?A.call(g,[...w],Ze):A.call(g,[...w])},null);if(!Array.isArray(B))return{};const q=fb(B),oe=Ze=>{const Je={},rt=ub(Ze.fontFamily);rt&&(Je.fontFamily=rt);const tt=UV(Ze.fontSize);return tt&&(Je.fontSize=tt),typeof Ze.color=="string"&&Ze.color.trim()!==""&&(Je.color=Ze.color.trim().toUpperCase()),typeof Ze.highlight=="string"&&Ze.highlight.trim()!==""&&(Je.highlight=Ze.highlight.trim().toUpperCase()),Je},ve=ul(f),Re=ve&&typeof ve.range?.start=="number"?ve.range.start:null;if(ve&&Re!==null&&w.has(ve.blockId)){const Ze=q.find(rt=>hc(rt,ve.blockId)),Je=Ze&&Array.isArray(Ze.runs)?Ze.runs:null;if(Je&&Je.length>0&&Je.every(rt=>rt?.kind==="text"||rt?.kind==="tab")){let rt=0,tt=null;for(const Rt of Je){const Gt=typeof Rt.text=="string"?Rt.text.length:0;if(Re>=rt&&Re<rt+Gt){tt=Rt;break}rt+=Gt}if(!tt){for(let Rt=Je.length-1;Rt>=0&&!tt;Rt-=1)Je[Rt]?.kind==="text"&&(tt=Je[Rt]);tt??=Je[Je.length-1]??null}return tt?oe(tt):{}}}const Ue=Tu(f);if(Ue.length>0){const Ze=new Set,Je=new Set;let rt=!1,tt=!0;for(const Rt of Ue){const Gt=q.find(Rr=>hc(Rr,Rt.blockId));if(!Gt)return{};const en=Array.isArray(Gt.runs)?Gt.runs:[];if(en.length===0)continue;if(!en.every(Rr=>Rr?.kind==="text"||Rr?.kind==="tab")){tt=!1;break}let Mn=0;for(const Rr of en){const Ar=typeof Rr.text=="string"?Rr.text.length:0,zr=Mn,Mr=Mn+Ar;if(zr<Rt.end&&Mr>Rt.start){rt=!0;const Uo=oe(Rr);Uo.fontFamily&&Ze.add(Uo.fontFamily),Uo.fontSize&&Je.add(Uo.fontSize)}Mn=Mr}}if(tt&&rt){const Rt={};return Ze.size===1&&(Rt.fontFamily=[...Ze][0]),Je.size===1&&(Rt.fontSize=[...Je][0]),Rt}}const We=new Set,Le=new Set;let Xe=!1;for(const Ze of q){if(![...w].some(rt=>hc(Ze,rt)))continue;const Je=Array.isArray(Ze.runs)?Ze.runs:[];for(const rt of Je){if(rt?.kind!=="text")continue;Xe=!0;const tt=oe(rt);tt.fontFamily&&We.add(tt.fontFamily),tt.fontSize&&Le.add(tt.fontSize)}}if(!Xe)return{};const Ve={};return We.size===1&&(Ve.fontFamily=[...We][0]),Le.size===1&&(Ve.fontSize=[...Le][0]),Ve},Rs=f=>{const g=T(),w=new Set(Fr(f));if(w.size===0)return{};const A=g?.readMountedProjectionBlocksByIds,E=g?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof E!="function")return{};const B=Tt(()=>{if(typeof A!="function")return E.call(g);const Ve=Yi(f);return Ve?A.call(g,[...w],Ve):A.call(g,[...w])},null);if(!Array.isArray(B))return{};const q=fb(B),oe=Ve=>({bold:Ve.bold===!0,italic:Ve.italic===!0,underline:Ve.underline!=null,strikethrough:Ve.strike===!0}),ve=Ve=>{const Ze={};for(const Je of Hf){const rt=Ve[Je];rt.size===1&&(Ze[Je]=[...rt][0])}return Ze},Re=ul(f),Ue=Re&&typeof Re.range?.start=="number"?Re.range.start:null;if(Re&&Ue!==null&&w.has(Re.blockId)){const Ve=q.find(Je=>hc(Je,Re.blockId)),Ze=Ve&&Array.isArray(Ve.runs)?Ve.runs:null;if(Ze&&Ze.length>0&&Ze.every(Je=>Je?.kind==="text"||Je?.kind==="tab")){let Je=0,rt=null;for(const tt of Ze){const Rt=typeof tt.text=="string"?tt.text.length:0;if(Ue>=Je&&Ue<Je+Rt){rt=tt;break}Je+=Rt}if(!rt){for(let tt=Ze.length-1;tt>=0&&!rt;tt-=1)Ze[tt]?.kind==="text"&&(rt=Ze[tt]);rt??=Ze[Ze.length-1]??null}return rt?oe(rt):{}}}const We=Tu(f);if(We.length>0){const Ve={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1,Je=!0;for(const rt of We){const tt=q.find(en=>hc(en,rt.blockId));if(!tt)return{};const Rt=Array.isArray(tt.runs)?tt.runs:[];if(Rt.length===0)continue;if(!Rt.every(en=>en?.kind==="text"||en?.kind==="tab")){Je=!1;break}let Gt=0;for(const en of Rt){const Mn=typeof en.text=="string"?en.text.length:0,Rr=Gt,Ar=Gt+Mn;if(Rr<rt.end&&Ar>rt.start){Ze=!0;const zr=oe(en);for(const Mr of Hf)Ve[Mr].add(zr[Mr])}Gt=Ar}}if(Je&&Ze)return ve(Ve)}const Le={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Xe=!1;for(const Ve of q){if(![...w].some(Je=>hc(Ve,Je)))continue;const Ze=Array.isArray(Ve.runs)?Ve.runs:[];for(const Je of Ze){if(Je?.kind!=="text")continue;Xe=!0;const rt=oe(Je);for(const tt of Hf)Le[tt].add(rt[tt])}}return Xe?ve(Le):{}},vc=(f,g)=>{if(g.fontFamily!==void 0&&g.fontSize!==void 0&&g.color!==void 0&&g.highlight!==void 0)return{values:g,effectiveUniformityStatus:"ready"};const w=bl(f),A={...w.fontFamily!==void 0?{fontFamily:w.fontFamily}:{},...w.fontSize!==void 0?{fontSize:w.fontSize}:{},...w.color!==void 0?{color:w.color}:{},...w.highlight!==void 0?{highlight:w.highlight}:{},...g};if(!f.empty&&(A.fontFamily===void 0||A.fontSize===void 0)){const E=ns(f);return E.values&&(A.fontFamily===void 0&&E.values.fontFamily!==void 0&&(A.fontFamily=E.values.fontFamily),A.fontSize===void 0&&E.values.fontSize!==void 0&&(A.fontSize=E.values.fontSize)),{values:A,effectiveUniformityStatus:E.status}}return{values:A,effectiveUniformityStatus:"ready"}},Fu=["fontFamily","fontSize","bold","italic","underline","strikethrough"],bo=f=>{const g=f.selectionTarget;if(!g)return{value:null,status:"ready"};const w=vr(y(),"format.readEffectiveInlineUniformity");return w?ur(`effInline:${_A(f)??Jt(f)}`,Pt(),()=>w({target:g,offsetSpace:"selection",keys:Fu}),A=>A&&typeof A=="object"?A:null):{value:null,status:"ready"}},ns=f=>{const{value:g,status:w}=bo(f);if(!g||g.success!==!0)return{values:null,status:w};const A=g.values,E=B=>{const q=A?.[B];if(!(!q||q.state!=="uniform"||typeof q.value!="string"))return B==="fontFamily"?ub(q.value):q.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:w}},Nu=f=>{const{value:g,status:w}=bo(f);if(!g||g.success!==!0)return{values:null,status:w};const A=g.values,E={};for(const B of Hf){const q=A?.[B];q?.state==="uniform"&&(q.value==="true"||q.value==="false")&&(E[B]=q.value==="true")}return{values:E,status:w}},yc=(f,g)=>{const w=f.activeMark;if(!w||!Hf.includes(w))return null;const A=w,E=Rs(g)[A];if(E!==void 0)return E;const{values:B}=Nu(g),q=B?.[A];return q!==void 0?q:null},Bu=async f=>{const g=f.selectionTarget;if(!g)return null;const w=vr(y(),"format.readEffectiveInlineUniformity");if(!w)return null;try{const A=await Promise.resolve(w({target:g,offsetSpace:"selection"}));return A&&typeof A=="object"&&A.success===!0?A:null}catch{return null}},bc=(f,g,w)=>{const A=w.values;for(const E of["fontFamily","fontSize"]){if(g[E]!==void 0)continue;const B=A?.[E];B?.state==="uniform"&&typeof B.value=="string"?f[E]=E==="fontFamily"?ub(B.value):B.value:delete f[E]}},Ms=f=>vc(f,kA(yo(f),f)),ni=f=>Ms(f).values,zu=async f=>{const g=y()?.query,w=Ca(f);if(typeof g?.match!="function"||!w)return ni(f);try{const A=await Promise.resolve(g.match(w)),E=kA(SA(A&&typeof A=="object"?A:null,f),f),B=vc(f,E);if(B.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const q=await Bu(f);q&&bc(B.values,E,q)}return B.values}catch{return ni(f)}},wl=async f=>{const g=y();if(g)return typeof g.getNode=="function"?await Promise.resolve(g.getNode(f)):await Promise.resolve(g.getNodeById?.({nodeId:f.nodeId,nodeType:f.nodeType}))},Vu=f=>{const g=y()?.query;if(typeof g?.match!="function")return"ready";const w=Ca(f);if(!w)return"ready";const{status:A}=ur(`query:${Jt(f)}`,Pt(),()=>g.match(w),E=>E&&typeof E=="object"?E:null);return A},wc=f=>{const g=Ms(f),w=g.values;if(f.empty)return g;const A=ga(f);return A?f.status==="ready"&&Vu(f)==="ready"&&g.effectiveUniformityStatus==="ready"?(C={key:A,values:w},g):C&&C.key===A?{...g,values:{...C.values,...w}}:g:g},_a=f=>{const g=y(),w=wc(f),A=w.values;f.status==="ready"&&!f.empty&&Vu(f)==="ready"&&w.effectiveUniformityStatus==="ready"&&(v=A,_=`${uc(f)}:${Pt()}`);const E=g?.contentControls,{lockModesById:B}=wa(E,f),q={};for(const oe of Te())q[oe]=_l(oe,g,f,A,B);return q},rs=f=>f?lt.operationUnavailable:k()?lt.documentApiUnavailable:lt.notReady,Cl=f=>f==="contentLocked"||f==="sdtContentLocked",Pi=f=>{for(const g of f.values())if(Cl(g))return lt.contentControlLocked},Kf=(f,g,w,A,E)=>{if(!g)return f.scope==="all"?lt.bulkDecisionsDisabled:rs(E);if(w)return lt.documentReadonly;if(f.scope!=="all"&&A.activeChangeIds.length===0)return lt.selectionRequired},qf=f=>{const g=T(),w=Tt(typeof g?.getCapabilities=="function"?()=>g.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(w))return w.find(A=>A?.command===f||A?.id===f)??null;if(w&&typeof w=="object"){const A=w[f];return A&&typeof A=="object"?A:null}return null},Cc=(f,g)=>{if(f.scope!=="all"||typeof g?.[`${f.kind}All`]=="function")return;const w=qf(`trackedChanges.${f.kind}All`);if(!(w&&(w.status==="supported"||w.enabled===!0)))return lt.bulkDecisionsDisabled},_l=(f,g,w,A,E=new Map)=>{if(fe.has(f))return on({supported:!0,enabled:!0,...Tt(fe.get(f).getState?()=>fe.get(f).getState(ya(void 0)):void 0,{})},"custom");const B=Wn()==="viewing",q=hA(f);if(q&&typeof x()?.lists?.apply=="function"){const Xe=J(),Ve=typeof Xe?.shippedStatus=="string"?Xe.shippedStatus:null,Ze=Ve!=="not-shipped"&&Ve!=="disabled";return on({enabled:Ze&&(typeof Xe?.enabled=="boolean"?Xe.enabled:!0),active:(Ze?X(Xe):null)===q,supported:Ze,value:Xe?.value},"builtin")}const oe=wm(f);if(oe){const Xe=g?.trackChanges,Ve=typeof Xe?.decide=="function"||typeof Xe?.[oe.kind]=="function",Ze=typeof Xe?.decide=="function"||typeof Xe?.[`${oe.kind}All`]=="function",Je=oe.scope==="all"?Ze:Ve,rt=Cc(oe,Xe)??Kf(oe,Je,ti(),w,g);return on({enabled:rt==null,active:!1,supported:Je,reason:rt},"builtin")}if(f==="copy-format")return Wn()==="viewing"?on({supported:!0,enabled:!1,active:!1},"builtin"):k()?on({supported:!0,enabled:!0,active:h.mode!=="idle"},"builtin"):on({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const ve=Su(f);if(!ve)return on({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(ve.disposition!=="routed")return on({enabled:!1,active:!1,supported:!1,reason:ve.reason??lt.commandUnsupported},ve.disposition==="unsupported"?"unsupported":"builtin");if(ve.instanceRoute)return ie(ve);if(ve.table)return de(ve,g,B);if(ve.inline?.kind==="clear"){if(ve.mutates&&B)return on({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const Xe=Pi(E);if(Xe)return on({enabled:!1,active:!1,supported:!0,reason:Xe},"builtin");const Ve=Fr(w).length>0||Mu(w)!=null;return on({enabled:Ve,active:!1,supported:!0,reason:Ve?void 0:lt.selectionRequired},"builtin")}const Re=ve.docRoute;if(!Re)return on({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(vr(g,Re)==null)return on({enabled:!1,active:!1,supported:!1,reason:rs(g)},"builtin");const Ue=ae(f);if(Ue){const Xe=Ue.shippedStatus,Ve=Xe!=="not-shipped"&&Xe!=="disabled",Ze=typeof Ue.enabled=="boolean"?Ue.enabled:!0,Je=f==="undo"||f==="redo",rt=Je&&Ue.historyResolved===!1,tt=Je&&Ve&&Ze===!1&&Ue.reason===null&&!rt,Rt=Ue.reason===void 0?void 0:tt?lt.historyEmpty:rt?lt.notReady:ib(Ue.reason,lt.commandUnsupported);return ve.mutates&&B?on({enabled:!1,active:!1,supported:Ve,reason:lt.documentReadonly},"builtin"):on({enabled:Ve&&Ze,active:!1,supported:Ve,reason:Rt},"builtin")}const We=Sa(ve,g,w),Le=ju(ve,g,w,A);if(ve.list?.mode==="indent"||ve.list?.mode==="outdent")return I(ve,g,B,w,We,Le);if(ve.list?.mode==="toggle-seed")return M(ve,g,B,w,We,Le);if(ve.mutates&&B)return on({enabled:!1,active:We,supported:!0,value:Le,reason:lt.documentReadonly},"builtin");if(ve.inline&&!Mu(w)){const Xe=Pi(E);return on(Xe?{enabled:!1,active:We,supported:!0,value:Le,reason:Xe}:Fr(w).length>0&&typeof T()?.setPendingInlineFormat=="function"?{enabled:!0,active:We,supported:!0,value:Le}:{enabled:!1,active:We,supported:!0,value:Le,reason:lt.rangeSelectionRequired},"builtin")}if((ve.blockParagraph||ve.list)&&Fr(w).length===0)return on({enabled:!1,active:We,supported:!0,value:Le,reason:lt.selectionRequired},"builtin");if(ve.link&&!We&&lb(w).length===0&&!ul(w))return on({enabled:!1,active:We,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(ve.inline){const Xe=Pi(E);if(Xe)return on({enabled:!1,active:We,supported:!0,value:Le,reason:Xe},"builtin")}return on({enabled:!0,active:We,supported:!0,value:Le},"builtin")};function Hu(f,g){const w=f.address?.anchor,A=w?.start,E=w?.end,B=typeof A?.blockId=="string"?A.blockId:null,q=typeof E?.blockId=="string"?E.blockId:null;if(!B||!q)return!1;const oe=typeof A?.offset=="number"?A.offset:null,ve=typeof E?.offset=="number"?E.offset:null;if(oe==null||ve==null)return!1;const Re=g.target,Ue=Re&&Array.isArray(Re.segments)?Re.segments:[];for(const We of Ue){const Le=typeof We?.blockId=="string"?We.blockId:null;if(!Le)continue;const Xe=We.range,Ve=typeof Xe?.start=="number"?Xe.start:null,Ze=typeof Xe?.end=="number"?Xe.end:null;if(!(Ve==null||Ze==null)){if(B!==q){if(Le===B&&Ze>oe||Le===q&&Ve<ve)return!0;continue}if(Le===B){if(Ve===Ze){if(Ve>=oe&&Ve<=ve)return!0;continue}if(Math.max(Ve,oe)<Math.min(Ze,ve))return!0}}}return!1}const Sl=(f,g)=>{const w=f?.hyperlinks;if(!w||typeof w.list!="function")return null;const A=Fr(g);if(!fc(A))return null;for(const E of A){const B={kind:"block",nodeType:"paragraph",nodeId:E},{value:q}=ur(`hyperlinks:${E}`,Pt(),()=>w.list({within:B}),ve=>ve&&typeof ve=="object"?ve:null),oe=(q&&Array.isArray(q.items)?q.items:[]).find(ve=>Hu(ve,g));if(oe)return oe}return null},Sa=(f,g,w)=>{if(f.link)return Sl(g,w)!=null;if(f.list?.mode==="toggle-seed"&&f.list.seed)return Uu(g,w)===f.list.seed;const A=j(f);if(A!==null)return A;const E=r.get(f.id),B=ga(w);if(B&&E?.selectionSignature===B)return E.active;const q=yc(f,w);return q!==null?q:lH(f,w)},ju=(f,g,w,A)=>{if(f.inline&&cb(f.inline.key)){const E=O(f);if(E!==void 0)return E;const B=A[f.inline.key];if(B!==void 0)return B;const q=ga(w),oe=q?n.get(f.inline.key):void 0;if(q&&oe?.selectionSignature===q)return oe.value}if(f.id==="linked-style"){const{style:E}=nt(w,ct().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(f.id==="text-align")return Lo(g,w);if(f.id==="link")return $(g,w)??void 0},kl=(f,g,w)=>{const A=f?.lists;if(!A)return{value:null,status:"ready"};const E=w.storyType==="body",B=typeof A.getStateInStory=="function"?()=>A.getStateInStory({target:ma(g),story:w}):E&&typeof A.getState=="function"?()=>A.getState({target:ma(g)}):null;if(!B)return{value:null,status:"ready"};const{value:q,status:oe}=ur(`lists:${Cr(w)}:${g}`,Pt(),B,ve=>ve&&typeof ve=="object"?ve:null);return{value:q?.success===!0?q:null,status:oe}},Yf=(f,g,w)=>kl(f,g,w).value,Al=(f,g,w)=>{const A=Yf(f,g,w);return!A||A.isListItem!==!0?null:A.seed==="bullet"||A.seed==="ordered"?A.seed:null},Il=(f,g,w)=>{const A=kl(f,g,w),E=A.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:A.status}},Uu=(f,g)=>{const w=Fr(g);if(w.length===0||!fc(w))return null;const A=qi(g),E=Al(f,w[0],A);if(E!=="bullet"&&E!=="ordered")return null;for(const B of w.slice(1))if(Al(f,B,A)!==E)return null;return E},Gu=(f,g,w)=>{if(!f)return{value:null,status:"ready",refreshing:!1};const A=Cr(w),E=A==="story:body";if(E&&typeof f.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof f.getNode!="function")return{value:null,status:"ready",refreshing:!1};const B=`node:${A}:${g}`,q=Pt(),oe=ur(B,q,()=>E?f.getNodeById({nodeId:g,nodeType:"paragraph"}):f.getNode(mo(g,w)),Re=>Re&&typeof Re=="object"?Re:null),ve=ee.get(B);return{...oe,refreshing:oe.status==="stale"&&ve?.inflightToken===q&&ve.failedToken!==q}},El=f=>f==="left"||f==="center"||f==="right"||f==="justify"?f:void 0,Xf=f=>f==="start"||f==="end"||f==="distributed"||f==="numTab"||f==="lowKashida"||f==="mediumKashida"||f==="highKashida"||f==="thaiDistribute",_c=(f,g)=>{const w=T(),A=w?.readMountedProjectionBlocksByIds;if(typeof A!="function")return null;const E=Yi(f),B=Tt(()=>E?A.call(w,[...g],E):A.call(w,[...g]),null);if(!Array.isArray(B))return new Map;const q=fb(B),oe=new Map;for(const ve of g){const Re=q.find(Xe=>hc(Xe,ve));if(!Re)continue;const Ue=Re.attrs,We=El(Ue?.alignment),Le=_9(Ue);oe.set(ve,We??(Le==="rtl"?"right":"left"))}return oe},xl=(f,g,w,A)=>{const{value:E,status:B,refreshing:q}=Gu(f,g,w),oe=A?.get(g);if(B==="pending")return oe?{status:"uniform",value:oe}:{status:"pending"};if(B==="stale"&&!q)return{status:"pending"};if(B==="stale"&&oe)return{status:"uniform",value:oe};if(B==="stale"&&A&&!oe)return{status:"unavailable"};if(!E)return{status:"unavailable"};const ve=E.node;if(!ve)return{status:"unavailable"};const Re=ve.kind;if(Re!=="paragraph"&&Re!=="heading")return{status:"unavailable"};const Ue=ve[Re];if(!Ue||typeof Ue!="object")return{status:"unavailable"};const We=Ue.props?.alignment;if(We==null)return oe?{status:"uniform",value:oe}:{status:"unavailable"};const Le=El(We);return Le?{status:"uniform",value:Le}:Xf(We)&&oe?{status:"uniform",value:oe}:{status:"unavailable"}},Zf=(f,g)=>{const w=Fr(g);if(w.length===0||!fc(w))return{status:"unavailable"};const A=qi(g),E=_c(g,w),B=xl(f,w[0],A,E);if(B.status!=="uniform")return B;for(const q of w.slice(1)){const oe=xl(f,q,A,E);if(oe.status!=="uniform")return oe;if(oe.value!==B.value)return{status:"mixed"}}return B},Ls=f=>{const g=Fr(f);return g.length===0?null:`${Cr(qi(f))}:${g.join(",")}`},Lo=(f,g)=>{const w=Zf(f,g),A=w.status==="uniform"?w.value:void 0,E=o;if(!E)return A;const B=Ls(g);return B&&B!==E.selectionSignature?(o=null,A):!B||!E.settled?E.value:w.status!=="pending"?(o=null,A):E.value},ri=(f,g)=>{const w=El(g),A=Ls(f),E=Fr(f);if(!w||!A||E.length===0)return null;const B=++i;return o={selectionSignature:A,value:w,generation:B,settled:!1,canReconcile:fc(E)},Dt(),B},Wu=(f,g)=>{if(f==null)return;const w=o;if(!(!w||w.generation!==f)){if(!go(g)){o=null;return}if(!w.canReconcile){o=null;return}w.settled=!0}},Sc=async(f,g,w)=>{const A=f?.lists;if(!A)return null;try{const E=w.storyType==="body",B=typeof A.getStateInStory=="function"?await A.getStateInStory({target:ma(g),story:w}):E&&typeof A.getState=="function"?await A.getState({target:ma(g)}):null,q=B&&typeof B=="object"?B:null;return!q||q.success!==!0||typeof q.isListItem!="boolean"?null:q.isListItem}catch{return null}},kc=(f,g,w)=>{const A={resolved:!1,seed:null},E=f?.lists;if(!E)return A;const B=w.storyType==="body",q=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:ma(g),story:w}):B&&typeof E.getState=="function"?()=>E.getState({target:ma(g)}):null;if(!q)return A;const oe=ve=>{const Re=ve&&typeof ve=="object"?ve:null;return!Re||Re.success!==!0||typeof Re.isListItem!="boolean"?A:{resolved:!0,seed:Re.isListItem===!0&&(Re.seed==="bullet"||Re.seed==="ordered")?Re.seed:null}};try{const ve=q();return Tr(ve)?Promise.resolve(ve).then(oe,()=>A):oe(ve)}catch{return A}},Qf=async(f,g,w)=>{if(!f)return null;try{const A=!w||w.storyType==="body",E=w&&typeof f.getNode=="function"?await f.getNode(mo(g,w)):A&&typeof f.getNodeById=="function"?await f.getNodeById({nodeId:g,nodeType:"paragraph"}):null;return DV(E&&typeof E=="object"?E:null)}catch{return null}},I=(f,g,w,A,E,B)=>{if(f.mutates&&w)return on({enabled:!1,active:E,supported:!0,value:B,reason:lt.documentReadonly},"builtin");const q=Fr(A);if(q.length===0)return on({enabled:!1,active:E,supported:!0,value:B,reason:lt.selectionRequired},"builtin");const oe=f.docRoute?vr(g,f.docRoute):null,ve=vr(g,"format.paragraph.setIndentation"),Re=vr(g,"format.paragraph.clearIndentation"),Ue=f.list?.mode,We=Ue==="indent"?ve!=null:ve!=null||Re!=null,Le=qi(A);let Xe=null;if(Le.storyType!=="body"){Xe=[];for(const Ve of q){const{value:Ze,status:Je}=Il(g,Ve,Le);if(Ze===null)return Je!=="ready"&&(oe!=null||We)?on({enabled:!0,active:E,supported:!0,value:B},"builtin"):on({enabled:!1,active:E,supported:!1,value:B,reason:rs(g)},"builtin");Xe.push(Ze)}}if(Xe?.some(Ve=>Ve===!0)){const Ve=Ue==="indent"?"lists.indentRange":"lists.outdentRange",Ze=Wn()!=="suggesting"&&Xe.every(rt=>rt===!0)&&vr(g,Ve)!=null,Je=Ue==="outdent"&&vr(g,"lists.outdentInStory")!=null;if(!Ze&&!Je)return on({enabled:!1,active:E,supported:!1,value:B,reason:rs(g)},"builtin")}for(const[Ve,Ze]of q.entries()){const Je=Xe?{value:Xe[Ve]??null,status:"ready"}:Il(g,Ze,Le),rt=Je.value;if(rt===!0){if(oe!=null)return on({enabled:!0,active:E,supported:!0,value:B},"builtin");continue}if(rt===!1&&We){if(Le.storyType!=="body"&&typeof g?.getNode!="function")continue;return on({enabled:!0,active:E,supported:!0,value:B},"builtin")}if(rt===null)return Je.status!=="ready"&&(oe!=null||We)?on({enabled:!0,active:E,supported:!0,value:B},"builtin"):on({enabled:!1,active:E,supported:!1,value:B,reason:rs(g)},"builtin")}return on({enabled:!1,active:E,supported:!1,value:B,reason:rs(g)},"builtin")},M=(f,g,w,A,E,B)=>{if(f.mutates&&w)return on({enabled:!1,active:E,supported:!0,value:B,reason:lt.documentReadonly},"builtin");const q=Fr(A);if(q.length===0)return on({enabled:!1,active:E,supported:!0,value:B,reason:lt.selectionRequired},"builtin");const oe=qi(A),ve=g?.lists;if(!(typeof ve?.getStateInStory=="function"||oe.storyType==="body"&&typeof ve?.getState=="function"))return on({enabled:!1,active:E,supported:!1,value:B,reason:lt.operationUnavailable},"builtin");if(!fc(q))return on(oe.storyType==="body"&&vr(g,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:B}:{enabled:!1,active:E,supported:!1,value:B,reason:lt.operationUnavailable},"builtin");const Re=q.map(Xe=>kl(g,Xe,oe));if(Re.some(({status:Xe})=>Xe!=="ready"))return on({enabled:!0,active:E,supported:!0,value:B},"builtin");if(Re.some(({value:Xe})=>Xe===null))return on({enabled:!1,active:E,supported:!1,value:B,reason:lt.operationUnavailable},"builtin");const Ue=f.list?.seed,We=Re.every(({value:Xe})=>Xe?.isListItem===!0&&Xe.seed===Ue);if(oe.storyType==="body")return on(!We||vr(g,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:B}:{enabled:!1,active:E,supported:!1,value:B,reason:lt.operationUnavailable},"builtin");const Le=vr(g,"lists.removeInStory");return on(We&&Le?{enabled:!0,active:E,supported:!0,value:B}:{enabled:!1,active:E,supported:!1,value:B,reason:lt.operationUnavailable},"builtin")},$=(f,g)=>{const w=Sl(f,g)?.properties?.href;return typeof w=="string"?w:null},ie=f=>{if(!k())return on({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const g=f.instanceRoute;return typeof t?.[g]!="function"?on({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):on({enabled:!0,active:se(f),supported:!0,value:he(f)},"builtin")},se=f=>{const g=t?.config??void 0;return f.valueFrom==="ruler"?!!g?.rulers:f.valueFrom==="formattingMarks"?!!g?.layoutEngineOptions?.showFormattingMarks:!1},de=(f,g,w)=>{if(w)return on({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const A=Fe();return A!=null&&(!f.table.requiresCell||A.cellNodeId!=null)?(f.docRoute?vr(g,f.docRoute):null)==null?on({enabled:!1,active:!1,supported:!1,reason:rs(g)},"builtin"):on({enabled:!0,active:!1,supported:!0},"builtin"):on({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},he=f=>{if(f.valueFrom==="zoom")return yl().value;if(f.valueFrom==="documentMode")return Wn();if(f.valueFrom==="measurementUnit")return gc();if(f.valueFrom==="ruler"||f.valueFrom==="formattingMarks")return se(f)},ue=(f,g)=>f.id==="zoom"?typeof g=="number"&&Number.isFinite(g)&&g>0:f.id==="document-mode"?g==="editing"||g==="suggesting"||g==="viewing":f.id==="measurement-unit"?g==="in"||g==="cm":!0,Te=()=>[...new Set([...yN,...fe.keys()])],Ne="Normal",Oe={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},Qe=f=>{const g=y()?.styles;return!g||typeof g.getCatalog!="function"?{value:null,status:"ready"}:ur(`styles:catalog:${JSON.stringify(f??{})}`,Pt(),()=>g.getCatalog(f),w=>w&&typeof w=="object"?w:null)},ct=()=>{const f=Qe({includePreview:!0});if(!f.value)return{cache:null,status:f.status};const g=Qe({view:"quickGallery",includePreview:!0}),w=g.value?g.value.items:f.value.styles.filter(E=>E.visibility.quickGallery),A=new Map;for(const E of f.value.styles)A.set(E.id,E);return{cache:{full:f.value,quickGallery:w,byId:A},status:Iu(f.status,g.status)}},yt=(f,g,w)=>{const{value:A,status:E}=Gu(f,g,w);if(!A)return{ok:!1,styleRef:null,status:E};const B=A.node;if(!B||typeof B!="object")return{ok:!1,styleRef:null,status:E};const q=B.kind,oe=typeof q=="string"?B[q]:void 0,ve=oe&&typeof oe=="object"?oe.styleRef:void 0;return{ok:!0,styleRef:typeof ve=="string"&&ve.length>0?ve:null,status:E}},nt=(f,g)=>{const w=[],A=y();if(!A)return w.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:w},status:"ready"};const E=Fr(f);if(E.length===0)return w.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:w},status:"ready"};if(!fc(E))return w.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:w},status:"ready"};const B=g?.full.defaults.paragraphStyleId??(g?Ne:null),q=new Set;let oe=0,ve=0,Re=0,Ue="ready";const We=qi(f);for(const Ve of E){const Ze=yt(A,Ve,We);if(Ue=Iu(Ue,Ze.status),!Ze.ok){ve+=1;continue}if(!Ze.styleRef&&!B){Re+=1;continue}const Je=Ze.styleRef??B;if(!Je){Re+=1;continue}oe+=1,q.add(Je)}if(oe===0){const Ve=Re>0&&ve===0;return w.push({severity:"warning",code:Ve?"active-style-default-unavailable":"active-style-read-failed",message:Ve?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:w},status:Ue}}const Le=ve+Re;if(Le>0)return w.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${oe} of ${oe+Le} selected blocks; ${Le} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:w},status:Ue};if(q.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:w},status:Ue};const Xe=[...q][0];return{style:{styleId:Xe,styleName:g?.byId.get(Xe)?.name??null,mixed:!1,diagnostics:w},status:Ue}},ln=f=>{if(!k())return Oe;const{cache:g,status:w}=ct(),{style:A,status:E}=nt(f,g);let B;return g?B=A.diagnostics.length===0?g.full.diagnostics:[...g.full.diagnostics,...A.diagnostics]:B=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},...A.diagnostics],{ready:!0,status:Iu(w,E,f.status),catalogRevision:g?.full.revision??null,quickGallery:g?.quickGallery??[],activeParagraphStyleId:A.styleId,activeParagraphStyleName:A.styleName,mixedSelection:A.mixed,sourceStatus:g?.full.sourceStatus??null,diagnostics:B}},nn=()=>{const f=Wn(),g=Pu();g.status==="ready"&&Lu(g),N(g);const w=ga(g);for(const[A,E]of r)(!w||E.selectionSignature!==w||E.settled&&g.status==="ready")&&r.delete(A);return{ready:k()!=null,documentMode:f,document:Ou(),selection:g,toolbar:{context:f,commands:_a(g),copyFormatActive:h.mode!=="idle"},comments:vl(g),trackChanges:yi(g),contentControls:Gf(g),zoom:yl(),fonts:Wf(),styles:ln(g)}},Vn=f=>{const g=ga(f);g&&a&&g!==a&&(n.clear(),r.clear()),g&&(a=g)};let Ut=null,Cn=null,Sr=null,Kn=null,dr=!1;const yr=()=>{if(Z||dr)return;dr=!0;const f=()=>{dr&&(dr=!1,!Z&&Dt())};typeof queueMicrotask=="function"?queueMicrotask(f):Promise.resolve().then(f)},Bo=()=>{const f=x();if(f!==Sr&&(Kn&&(Kn(),Kn=null),Sr=f,!(!f||typeof f.subscribe!="function")))try{const g=f.subscribe(()=>yr());typeof g=="function"&&(Kn=g)}catch{Sr=null}};let Rn=null,at=null,pn=null,An=null,Ur=null,oi=null;const zo=()=>{const f=k()?.host,g=Tt(f?.getHandles?()=>f.getHandles():void 0,null)?.editing?.selection;return g&&typeof g.subscribe=="function"?g:null},Ps=()=>{const f=zo();if(f!==Ut&&(Cn&&(Cn(),Cn=null),Ut=f,!!f))try{const g=f.subscribe(w=>{Kt+=1,Uf(w),Dt()});typeof g=="function"&&(Cn=g)}catch{Ut=null}},ka=()=>{const f=k()?.host,g=Tt(f?.getHandles?()=>f.getHandles():void 0,null)?.review;return g&&typeof g.subscribe=="function"?g:null},bi=f=>f?typeof f.getActiveReviewTarget=="function"?Tt(()=>f.getActiveReviewTarget(),null):typeof f.getSnapshot=="function"?Tt(()=>f.getSnapshot(),null)?.activeReviewTarget??null:null:null;let Vo=0;const Po=(f,g)=>{const w=(g&&typeof g=="object"?g:null)?.lastInteractionRejection;if(Vo>0&&f==null&&w&&typeof w=="object"&&w.code==="review-target-invalidated"&&w.detail==="not-painted")return!1;const A=f&&typeof f=="object"?f:null;let E=null;if(A?.entityType==="trackedChange"&&typeof A.entityId=="string"&&A.entityId.length>0){const B=A.entityId,q=A.story&&typeof A.story=="object"?A.story:void 0,oe=ts(),ve=(oe?q?Eu(oe,q).toPublicId(B):pa(oe).toPublicId(B):null)??B,Re=q&&Cr(q)!==Cr(null)?q:void 0;E={id:ve,...Re?{story:Re}:{},...typeof A.paintedEntityId=="string"&&A.paintedEntityId.length>0?{paintedEntityId:A.paintedEntityId}:ve!==B?{paintedEntityId:B}:{}}}return f==null&&E==null&&le!=null&&At(le)||st(le,E)?!1:(Ge(E),!0)},Aa=()=>{const f=ka();if(f===Rn)return;if(at&&(at(),at=null),Rn=f,!f){Po(null);return}let g=!0;try{const w=f.subscribe(A=>{const E=A&&typeof A=="object"?A:null;!Po(E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:bi(f),A)||g||Dt()});typeof w=="function"&&(at=w),Po(bi(f))}catch{Rn=null}finally{g=!1}},Tl=()=>{if(Ut||Wn()!=="viewing")return null;const f=k()?.mount?.container,g=(f&&typeof f=="object"&&"ownerDocument"in f?f.ownerDocument??null:null)??globalThis.document??null;return g&&typeof g.addEventListener=="function"?g:null},Ho=()=>{const f=Tl();if(f===Ur||(oi&&(oi(),oi=null),Ur=f,!f))return;const g=()=>{Kt+=1,Dt()};f.addEventListener("selectionchange",g),f.addEventListener("pointerup",g,!0),f.addEventListener("mouseup",g,!0),oi=()=>{f.removeEventListener("selectionchange",g),f.removeEventListener("pointerup",g,!0),f.removeEventListener("mouseup",g,!0)}};xs(),Po(bi(ka()));let ut=nn();a=ga(ut.selection);const Di=()=>{const f=k()?.host?.events,g=f&&typeof f.subscribe=="function"?f:null;if(g!==pn&&(An&&(An(),An=null),pn=g,!!g))try{const w=g.subscribe(A=>{const E=A?.type;if(E==="source:complete"||E==="source:signals-complete"){sn!==null&&(Ye(),hn.onRender(!0));return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(Qi=Date.now()),E==="mutation:committed"&&(Ye(),Nt={}),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const B=E==="mutation:committed"?B_(A):null,q=E==="mutation:committed"&&hn.getPendingIds().size>0;B?.removedIds.size&&kt(new Set(B.removedIds),A.receipt);const oe=B?.reconcileMode==="authoritative"&&B.upsertIds.size>0;if(oe&&(Mo(),Ye(),sn=Pt(),Dt()),B?.upsertIds.size||q){const We=A.origin==="history"?null:A.receipt,Le=k()?.documentMutationReadiness,Xe=typeof We?.txId=="string"&&We.txId.length>0&&typeof Le?.whenPainted=="function",Ve=A.origin==="history"&&typeof Le?.getRenderEpoch=="function"?Tt(()=>Le.getRenderEpoch.call(Le),null):null,Ze=A.origin==="history"&&typeof Le?.whenPainted=="function",Je={upsertIds:B?.upsertIds??new Set,removedIds:new Set,reconcileMode:B?.reconcileMode==="authoritative"?"authoritative":"targeted"};Xe?hn.enqueueAfterPaint(Je,()=>Le.whenPainted.call(Le,We)):Ze?hn.enqueueAfterPaint(Je,()=>Le.whenPainted.call(Le,typeof Ve=="number"?{afterEpoch:Ve}:void 0)):(hn.enqueue(Je),hn.onRender(q))}if(oe)return;const ve=E==="mutation:committed"&&Es(A)||E==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0;if(ve&&(hl=Date.now()),E==="mutation:committed"&&ve){$o();return}if(B?.removedIds.size&&B.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!ve)&&lo();const Re=E==="collaboration:remote-changed"&&Array.isArray(A.changedPartUris)&&A.changedPartUris.some(We=>typeof We=="string"&&wV.has(We)),Ue=E==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0&&xi();Re&&!ve&&(Ti=!0),Mo(),(Re||Ue)&&Bn("comments"),Dt()}});typeof w=="function"&&(An=w)}catch{pn=null}},Dt=()=>{if(Z)return;dr=!1,xs(),Ps(),Bo(),Aa(),Ho(),Di();const f=nn();Vn(f.selection),ut=f;for(const g of[...qe])g(ut)},Rl=[],Ia=[],Ea=f=>{for(const g of f)try{g()}catch{}},Ac=()=>Ea(Rl),Ml=()=>Ea(Ia),Ll=[];((f,g)=>{if(!(!f||typeof f.on!="function"))for(const w of g){const A=w==="active-editor-change"?()=>{Ac(),Ml(),Dt()}:w==="document-replaced"?E=>{const B=E&&typeof E=="object"?E:null,q=B?.editor,oe=B?.host,ve=!!q&&q===k(),Re=!!oe&&oe===T();!ve&&!Re||(Ml(),ee.clear(),Mo(),Dt())}:()=>Dt();try{f.on(w,A),Ll.push(()=>{try{typeof f.off=="function"&&f.off(w,A)}catch{}})}catch{}}})(t,pV),Ps(),Bo(),Aa(),Ho(),Di();const xa=(f,g=eV)=>({get:()=>f(ut),subscribe:w=>{let A=f(ut);const E=B=>{const q=f(B);g(A,q)||(A=q,w(q))};return qe.add(E),()=>qe.delete(E)}}),ii=f=>xa(f),wo=f=>{const g=w=>{const A=B=>{try{w(B)}catch{}},E=f.subscribe(A);return A(f.get()),E};return{get:()=>f.get(),getSnapshot:()=>f.get(),observe:g,subscribe:w=>g(A=>w({snapshot:A}))}};function zt(f){return f&&typeof f=="object"&&typeof f.id=="string"?String(f.id):null}function Hn(f){const g=Yi(f);return g&&Cr(g)!==Cr(null)?g:void 0}function Br(f,g){return{kind:"id",id:f,...g?{story:g}:{}}}function fr(f){if(f.empty)return null;const g=f.selectionTarget,w=g?.start,A=g?.end;if(g?.kind!=="selection"||w?.kind!=="text"||A?.kind!=="text"||typeof w.blockId!="string"||w.blockId!==A.blockId||!Number.isInteger(w.offset)||!Number.isInteger(A.offset)||w.offset<0||A.offset<0||w.offset===A.offset)return null;const E=Math.min(w.offset,A.offset),B=Math.max(w.offset,A.offset),q=Yi(f);return{kind:"range",coordinateSpace:g.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...q?{story:q}:{},segments:[{blockId:w.blockId,range:{start:E,end:B}}]}}}function jo(f,g){if(Cr(g)!==Cr(null))return;const w=y()?.trackChanges,A=w?.list;if(typeof A!="function")return;const E=Tt(()=>A.call(w),null);if(Tr(E)||!E||typeof E!="object")return;const B=E.items;if(Array.isArray(B))return B.map(dl).find(q=>q!=null&&Ki(q,f,g))}function os(f,g){const w=is(f.quotedText);if(!w)return!1;const A=ym(g);return[A.insertedText,A.deletedText,A.excerpt].some(E=>is(E)===w)}function is(f){return typeof f=="string"?f.replace(/\s+/g," ").trim():""}function Ta(){const f=ut.selection.activeChangeIds[0];if(!f)return"unavailable";const g=Yi(ut.selection),w=(ut.trackChanges.status==="ready"?ut.trackChanges.items.find(q=>Ki(q,f,g)):void 0)??jo(f,g)??ts()?.find(q=>Ki(q,f,g));if(!w)return"unavailable";const A=ym(w),E=A.type,B=A.grouping;return os(ut.selection,w)?"id":E==="replacement"&&B==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&B==="standalone"?"range":"id"}function Ku(f,g,w,A){const E=()=>Sb(f,Br(w,A),w,A);try{const B=Sb(f,g,null);return Tr(B)?br(Promise.resolve(B).then(q=>go(As(q))?q:E())):br(go(As(B))?B:E())}catch{return!1}}function qu(f,g){if(f.scope==="all")return{target:{scope:"all"},changeId:null};if(typeof g=="string"&&g.length>0)return{target:{kind:"id",id:g},changeId:g};if(g&&typeof g=="object"){const E=g;if(E.target&&typeof E.target=="object"){const q=E.target;return{target:q,changeId:zt(q),story:q.story}}const B=typeof E.changeId=="string"?E.changeId:E.id;if(typeof B=="string"&&B.length>0)return{target:Br(B,E.story),changeId:B,story:E.story}}const w=ut.selection.activeChangeIds[0],A=Hn(ut.selection);return w?{target:Br(w,A),changeId:w,story:A}:null}function Yu(f,g){if(f.scope==="id"&&g==null){if(ut.selection.activeChangeIds.length>1)return nh(f.kind,{kind:"ids",ids:ut.selection.activeChangeIds},null);if(ut.selection.activeChangeIds.length===1&&!ut.selection.empty&&ut.selection.selectionTarget){const A=Ta();if(A==="unavailable")return!1;if(A==="range"){const E=fr(ut.selection),B=Hn(ut.selection);return E?Ku(f.kind,E,ut.selection.activeChangeIds[0],B):!1}if(A==="id"){const E=ut.selection.activeChangeIds[0],B=Yi(ut.selection),q=B&&Cr(B)!==Cr(null)?B:void 0;return _b(f.kind,q?{id:E,story:q}:E)}}}const w=qu(f,g);return w?nh(f.kind,w.target,w.changeId,w.story):!1}function Xu(f,g){const w=x()?.lists,A=w?.apply;if(typeof A!="function")return!1;const{behavior:E,preset:B,continuity:q}=typeof g=="string"?vV(g):g&&typeof g=="object"?g:{},oe={kind:f,behavior:E??"toggle"};B!==void 0&&(oe.preset=B),q!==void 0&&(oe.continuity=q);try{return br(A.call(w,oe))}catch{return!1}}let Oi=Promise.resolve(!1),si=null,L=Promise.resolve(!1);const W=async f=>{if(!bm(f))return f;const g=k()?.documentMutationReadiness,w=g?.whenPainted;if(typeof w!="function")return f;const A=typeof f.txId=="string"?f.txId:void 0;try{await w.call(g,A?{txId:A}:void 0)}catch{}return f},we=f=>{if(Tr(f)){const w=Promise.resolve(f);return{immediate:!0,committed:w.then(A=>As(A),()=>!1),settled:w.then(A=>W(As(A)),()=>!1)}}const g=As(f);return{immediate:g,committed:Promise.resolve(g),settled:W(g)}},Be=()=>{const f=s.shift();if(!f){u=!1,d?.(),d=null;return}try{f.resolve(Z?!1:f.mutate())}catch{f.resolve(!1)}},gt=()=>{let f=!1;return()=>{f||(f=!0,Be())}},vn=(f,g)=>{if(!u){u=!0,c=new Promise(B=>{d=B});try{return{result:g(),release:gt()}}catch(B){throw u=!1,d?.(),d=null,B}}const w=s.find(B=>B.key===f);if(w)return w.mutate=g,{result:w.result,release:()=>{}};let A;const E=new Promise(B=>{A=B});return s.push({key:f,mutate:g,result:E,resolve:A}),{result:E,release:gt()}},Dn=new Set(["create.tableOfContents"]),hr=f=>lr(`Tracked authoring is not supported for ${f}.`),jn=f=>{if(Wn()==="suggesting")return Dn.has(f)?hr(f):{changeMode:"tracked"}},pr=()=>Wn()==="suggesting"?QV:pb,Xt=(f,g,w)=>{const A=jn(f);return A&&A.success===!1?A:A?g(w,A):g(w)},Co=(f,g,w,A)=>{const E=f.inline;if(!E)return;const B=As(A);if(B===!1||typeof B=="object"&&B&&B.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!cb(E.key))return;const q=ga(g);if(!q)return;const oe=BV(E.key,w.value);if(oe==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:q,value:oe})},co=(f,g,w,A)=>!f.inline||f.inline.kind==="toggle"?A:Tr(A)?Promise.resolve(A).then(E=>(Co(f,g,w,E),E)):A,Ra=(f,g,w,A)=>{if(f.inline?.kind!=="toggle"||!go(As(A))||typeof w.value!="boolean"&&w.value!==null)return null;const E=ga(g);if(!E)return null;const B=++l;return r.set(f.id,{selectionSignature:E,active:w.value===!0,generation:B,settled:!1}),Dt(),B},Dl=(f,g,w)=>{if(g==null)return;const A=r.get(f.id);if(!(!A||A.generation!==g)){if(!go(w)){r.delete(f.id);return}A.settled=!0}},_o=(f,g)=>f.then(w=>(g?.(w),Mo(),Dt(),w),()=>(g?.(!1),Mo(),Dt(),!1)),br=(f,g)=>{const w=si;if(si=null,w)return Oi=_o(w,g),As(f);if(Tr(f))return Oi=_o(we(f).settled,g),!0;const A=As(f);return bm(A)&&typeof k()?.documentMutationReadiness?.whenPainted=="function"?(Oi=_o(W(A),g),A):(g?.(A),Oi=Promise.resolve(A),Mo(),Dt(),A)},Ol=(f,g)=>!f||typeof f!="object"?g:f,Ma=(f,g=lr("Document API operation failed."))=>{if(Tr(f))return Promise.resolve(f).then(A=>Ma(A,g),()=>g);const w=Ol(f,g);return Mo(),bm(w)&&typeof k()?.documentMutationReadiness?.whenPainted=="function"?(_o(W(w)),Dt(),w):(Dt(),w)},Sm=(f,g,w,A)=>{const E=[],B=[];for(const q of w){const oe=A(q);if(oe)try{const ve=we(Xt(f,g,oe));E.push(ve.immediate),B.push(ve.settled)}catch{E.push(!1),B.push(Promise.resolve(!1))}}return si=B.length?Promise.all(B).then(q=>mi(q)):null,mi(E)},km=(f,g,w,A)=>{const E=[],B=[];for(const q of w){const oe=A(q);if(oe)try{const ve=we(Xt(f,g,oe));E.push(ve.immediate),B.push(ve.settled)}catch{E.push(!1),B.push(Promise.resolve(!1))}}return si=B.length?Promise.all(B).then(q=>mi(q)):null,mi(E)},Jf=(f,g,w,A=ut.selection)=>{const E=jn(f);return E&&E.success===!1?E:A.selectionTarget?g(w,{...E??{},offsetSpace:"selection"}):E?g(w,E):g(w)},vb=(f,g,w,A)=>{const E=mo(g,A);switch(f.kind){case"alignment":{const B=w;return B!=="left"&&B!=="center"&&B!=="right"&&B!=="justify"?null:{target:E,alignment:B}}case"spacing-line":{const B=typeof w=="number"?w:Number(w);return!Number.isFinite(B)||B<=0?null:{target:E,line:B,lineRule:"auto"}}case"style":if(w&&typeof w=="object"){const B=w.role;if(B&&typeof B=="object")return{target:E,role:B}}return typeof w!="string"||w.trim()===""?null:{target:E,styleId:w};case"direction":{const B=f.fixedValue;return B!=="ltr"&&B!=="rtl"?null:{target:E,direction:B}}default:return null}},$f=(f,g)=>{const w=f.inline,A=hb(f),E=T();if(!w||typeof E?.setPendingInlineFormat!="function")return!1;if(w.kind==="clear")return Q(),!0;if(!A)return!1;let B;if(w.kind==="toggle")B=!Sa(f,y(),ut.selection);else{const q=g&&typeof g=="object"&&"value"in g?g.value:g;if(w.kind==="value-number"){const oe=typeof q=="number"?q:Number(q);B=Number.isFinite(oe)&&oe>0?oe:null}else B=typeof q=="string"&&q.trim()!==""?q:null;if(B===null)return V(A,null),!0}return V(A,B),!0},Jn=()=>{const f=y(),{lockModesById:g}=wa(f?.contentControls,ut.selection);if(Pi(g))return!1;const w=[],A=[],E=Xe=>{const Ve=we(Xe);w.push(Ve.immediate),A.push(Ve.settled)},B=(Xe,Ve,Ze)=>{try{E(Ze?Xe(Ve,Ze):Xe(Ve))}catch{w.push(!1),A.push(Promise.resolve(!1))}},q=ct().cache?.full.defaults.paragraphStyleId??Ne,oe=Mu(ut.selection);if(oe){const Xe=vr(f,"format.apply");if(Xe)try{E(Jf("format.apply",Xe,{target:oe,inline:{...pr()}}))}catch{w.push(!1),A.push(Promise.resolve(!1))}}const ve=vr(f,"format.paragraph.resetDirectFormatting"),Re=vr(f,"styles.paragraph.setStyleRef"),Ue=Yi(ut.selection),We=!Ue||Ue.storyType==="body",Le=vr(f,We?"lists.remove":"lists.removeInStory");for(const Xe of Fr(ut.selection)){const Ve=mo(Xe,Ue);if(ve&&B(ve,{target:Ve}),Le)try{const Ze=ma(Xe),Je=we(Le(We?{target:Ze}:{target:Ze,story:Ue}));A.push(Je.settled.then(rt=>go(rt)?rt:!0))}catch{}Re&&B(Re,{target:Ve,styleId:q})}if(!oe&&Wn()!=="suggesting"){const Xe=vr(f,"format.paragraph.setMarkRunProps");if(Xe)for(const Ve of Fr(ut.selection))B(Xe,{target:mo(Ve,Ue),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return si=A.length?Promise.all(A).then(Xe=>mi(Xe)):null,mi(w.length?w:[!1])},yb=(f,g,w)=>{const A=Fr(ut.selection);if(A.length===0)return!1;const E=Yi(ut.selection);return Sm(f.docRoute,g,A,B=>vb(f.blockParagraph,B,w,E))},Am=(f,g,w)=>{const A=y(),E=vr(A,"format.paragraph.setIndentation"),B=vr(A,"format.paragraph.clearIndentation"),q=f.list?.mode,oe=qi(ut.selection),ve=Yi(ut.selection),Re=async Ue=>{const We=await Sc(A,Ue,oe);if(We===!0)return{kind:"list",routeToCall:f.docRoute,opToCall:g,input:{target:bA(Ue)}};if(We===null||ve&&ve.storyType!=="body"&&typeof A?.getNode!="function")return null;const Le=await Qf(A,Ue,ve),Xe={};if(Le?.right!=null&&(Xe.right=Le.right),Le?.firstLine!=null&&(Xe.firstLine=Le.firstLine),Le?.hanging!=null&&(Xe.hanging=Le.hanging),q==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(Ue,ve),left:Math.max(0,Le?.left??0)+wA,...Xe}}:null;const Ve=Math.max(0,(Le?.left??0)-wA);return Ve>0&&(Xe.left=Ve),Object.keys(Xe).length===0?B?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:B,input:{target:mo(Ue,ve)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(Ue,ve),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:mo(Ue,ve),...Xe}}:null};return si=(async()=>{const Ue=await Promise.all(w.map(Ve=>Re(Ve).catch(()=>null)));if(Ue.length===w.length&&Ue.every(Ve=>Ve?.kind==="list")&&Wn()!=="suggesting"){const Ve=q==="indent"?"lists.indentRange":"lists.outdentRange",Ze=vr(A,Ve);if(Ze)try{return await we(Xt(Ve,Ze,{paraIds:w,story:oe})).settled}catch{return!1}}const We=oe.storyType!=="body"&&Ue.some(Ve=>Ve?.kind==="list"),Le=We&&q==="outdent"?vr(A,"lists.outdentInStory"):null;if(We&&!Le)return!1;const Xe=Ue.map(Ve=>{if(!Ve)return Promise.resolve(!1);try{return Ve.kind==="list"&&Le?we(Xt("lists.outdentInStory",Le,{target:Ve.input.target,story:oe})).settled:we(Xt(Ve.routeToCall,Ve.opToCall,Ve.input)).settled}catch{return Promise.resolve(!1)}});return mi(await Promise.all(Xe))})(),!0},Im=(f,g)=>{const w=f.list,A=y(),E=Fr(ut.selection);if(E.length===0)return!1;const B=qi(ut.selection),q=B.storyType==="body";if(w.mode==="indent"||w.mode==="outdent")return Am(f,g,E);const oe=w.seed,ve=We=>{if(We.some(rt=>!rt.resolved))return{immediate:!1,settled:null};const Le=We.every(rt=>rt.seed===oe);if(!Le&&!q)return{immediate:!1,settled:null};const Xe=Le?q?"lists.remove":"lists.removeInStory":f.docRoute,Ve=Le?vr(A,Xe):g;if(!Ve)return{immediate:!1,settled:null};const Ze=[],Je=[];return E.forEach((rt,tt)=>{if(!Le&&We[tt]?.seed===oe)return;const Rt=Le?{target:ma(rt),...q?{}:{story:B}}:{target:ma(rt),seed:oe};try{const Gt=we(Xt(Xe,Ve,Rt));Ze.push(Gt.immediate),Je.push(Gt.settled)}catch{Ze.push(!1),Je.push(Promise.resolve(!1))}}),{immediate:mi(Ze),settled:Je.length?Promise.all(Je).then(rt=>mi(rt)):null}},Re=E.map(We=>kc(A,We,B));if(Re.some(Tr))return si=Promise.all(Re).then(async We=>{const Le=ve(We);return Le.settled?await Le.settled:Le.immediate}),!0;const Ue=ve(Re);return si=Ue.settled,Ue.immediate};function Ic(f){return f&&typeof f=="object"?f:{}}function Em(f){if(typeof f=="string")return f;const g=Ic(f);if(Object.prototype.hasOwnProperty.call(g,"href"))return g.href;if(Object.prototype.hasOwnProperty.call(g,"value"))return g.value}function xm(f,g){const w=Ic(f).text;return typeof w=="string"&&w.trim()!==""?w:g}function eh(f){const g=Ic(f),w=g.capture&&typeof g.capture=="object"?g.capture:null;return g.target??w?.target??w?.selectionTarget??g.selectionTarget??g.textTarget??null}const bb=f=>{const g=y(),w=g?.hyperlinks;if(!w)return!1;const A=Ic(f),E=Em(f),B=eh(f),q=typeof A.text=="string"?A.text:void 0,oe=typeof A.currentText=="string"?A.currentText:void 0,ve=Ru(A.hyperlinkTarget)?A.hyperlinkTarget:null,Re=Ru(A.textTarget)?A.textTarget:null,Ue=Sl(g,ut.selection),We=typeof ve?.storyId=="string"&&typeof ve?.hyperlinkNodeId=="string";if(We&&E===null){const Le=w.remove;if(typeof Le!="function")return!1;try{return Xt("hyperlinks.remove",Le,{storyId:ve.storyId,hyperlinkNodeId:ve.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Ue&&E===null){const Le=w.remove;if(typeof Le!="function")return!1;try{return Xt("hyperlinks.remove",Le,{target:Ue.address,mode:"unwrap"})}catch{return!1}}if((Ue||ve)&&typeof E=="string"&&E.trim()!==""){const Le=w.patch,Xe=w.updateTarget;if(!(!We&&Ue&&typeof Le=="function")&&!(We&&typeof Xe=="function"))return!1;const Ve=typeof q=="string"&&q!==(We?oe:Ue?.text??oe),Ze=g?.text?.replace,Je=Ve?We?Re:WV(Ue?.address):null,rt=Ve&&!!Je&&typeof Ze=="function";if(Ve&&!rt)return!1;const tt=[],Rt=[];let Gt=null,en=null,Mn=null,Rr=!1;try{if(We){if(typeof Xe!="function")return!1;const Ar=Xt("hyperlinks.updateTarget",Xe,{storyId:ve.storyId,hyperlinkNodeId:ve.hyperlinkNodeId,newTarget:KV(E)});Rr=Tr(Ar);const zr=we(Ar);if(!go(zr.immediate))return!1;tt.push(zr.immediate),Rt.push(zr.settled),Gt=zr.immediate,en=zr.committed,Mn=zr.settled}else if(Ue){if(typeof Le!="function")return!1;const Ar=Xt("hyperlinks.patch",Le,{target:Ue.address,patch:{href:E}});Rr=Tr(Ar);const zr=we(Ar);if(!go(zr.immediate))return!1;tt.push(zr.immediate),Rt.push(zr.settled),Gt=zr.immediate,en=zr.committed,Mn=zr.settled}}catch{return!1}if(rt){const Ar=(Mr,Uo)=>go(Uo)?mi([Mr,Uo]):go(Mr)?Nf(Mr,Uo):Uo,zr=Mr=>{if(!go(Mr))return Mr;try{const Uo=we(Xt("text.replace",Ze,{target:Je,text:q}));return go(Uo.immediate)?Promise.all([Mn??Promise.resolve(Mr),Uo.settled]).then(([xb,ej])=>Ar(xb,ej)):Nf(Mr,Uo.immediate)}catch{return Nf(Mr,!1)}};if(Rr)return si=(en??Promise.resolve(Gt??!1)).then(zr),mi(tt);try{const Mr=we(Xt("text.replace",Ze,{target:Je,text:q}));if(!go(Mr.immediate))return Gt?Nf(Gt,Mr.immediate):Mr.immediate;tt.push(Mr.immediate),Rt.push(Mr.settled),si=Promise.all([Mn??Promise.resolve(Gt??!1),Mr.settled]).then(([Uo,xb])=>Ar(Uo,xb))}catch{return Gt?Nf(Gt,!1):!1}}return!rt&&Rt.length>0&&(si=Promise.all(Rt).then(Ar=>mi(Ar))),mi(tt)}if(typeof E=="string"&&E.trim()!==""){const Le=E.trim(),Xe=w.wrap,Ve=OV(B),Ze=Ve.length>0?Ve:lb(ut.selection);if(Ze.length>0){if(typeof Xe!="function")return!1;try{return km("hyperlinks.wrap",Xe,Ze,Rt=>({target:Rt,link:{destination:{href:Le}}}))}catch{return!1}}const Je=w.insert,rt=xm(f,Le);if(typeof Je!="function"||rt.trim()==="")return!1;const tt=Vf(B)??ul(ut.selection);if(!tt)return!1;try{return Xt("hyperlinks.insert",Je,{target:tt,text:rt,link:{destination:{href:Le}}})}catch{return!1}}return!1},Tm=(f,g,w)=>{const A=f.create.kind,E=w&&typeof w=="object"?w:{};if(A==="table"){const q=Number(E.rows??E.rowCount),oe=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(q)||q<1||!Number.isInteger(oe)||oe<1)return!1;const ve=ul(ut.selection),Re=ve&&typeof ve.blockId=="string"?{kind:"inParagraph",target:mo(ve.blockId),offset:ve.range?.start??0}:db(ut.selection,"nodeId");try{return Xt(f.docRoute,g,{rows:q,columns:oe,at:Re})}catch{return!1}}if(A==="image"){const q=E.src??E.value;if(typeof q!="string"||q.trim()==="")return!1;const oe=ul(ut.selection),ve=qi(ut.selection),Re=ve.storyType==="body"?null:ve;let Ue;oe&&typeof oe.blockId=="string"?Ue={kind:"inParagraph",target:mo(oe.blockId,Re),offset:oe.range?.start??0}:(Ue=db(ut.selection,"target"),Re&&Ue.kind==="after"&&(Ue={...Ue,target:{...Ue.target,story:Re}}));const We={src:q,at:Ue};Re&&(We.in=Ue.kind==="inParagraph"?R(Re)??Re:Re),typeof E.alt=="string"&&(We.alt=E.alt),typeof E.title=="string"&&(We.title=E.title),E.size&&typeof E.size=="object"&&(We.size=E.size);try{return Xt(f.docRoute,g,We)}catch{return!1}}const B={at:db(ut.selection,"target")};typeof E.instruction=="string"&&(B.instruction=E.instruction),E.config&&typeof E.config=="object"&&(B.config=E.config);try{return Xt(f.docRoute,g,B)}catch{return!1}},Ec=(f,g)=>{const w=f.table,A=Fe();if(!A||w.requiresCell&&!A.cellNodeId)return!1;const E=eH(w.action,A);if(!E)return!1;try{if(w.action==="insert-row-before"||w.action==="insert-row-after"){const B=T(),q=(typeof B?.getHandles=="function"?B.getHandles():null)?.editing?.tables;if(typeof q?.insertRow!="function")return!1;const oe=jn(f.docRoute);return oe&&oe.success===!1?oe:oe?q.insertRow(E,oe):q.insertRow(E)}return Xt(f.docRoute,g,E)}catch{return!1}},Zu=f=>!f||f.disposition!=="routed"?!1:!!(f.inline||f.blockParagraph||f.list||f.link||f.create),th=f=>{const g=Ic(f);return!!(eh(f)||Ru(g.hyperlinkTarget)||Ru(g.textTarget))},It=(f,g,w)=>ut.selection.status!=="ready"?!1:wm(f)?.scope==="id"||!g||g.disposition!=="routed"?!0:g.inline?.kind==="clear"?Fr(ut.selection).length>0||Mu(ut.selection)!=null:g.inline?Mu(ut.selection)!=null||Fr(ut.selection).length>0:g.blockParagraph||g.list?Fr(ut.selection).length>0:g.link?th(w)||lb(ut.selection).length>0||ul(ut.selection)!=null||Sa(g,y(),ut.selection):!0,Ht=(f,g)=>{const w=wm(f),A=Su(f);return w?.scope!=="id"&&!Zu(A)?!1:!It(f,A,g)},bn=(f,g)=>Ht(f,g)?ba().then(()=>{}):null,qn=(f,g,w)=>{if(si=null,Oi=Promise.resolve(!1),Z)return!1;const A=fe.get(f);if(A)try{return br(A.execute(ya(g,w)))}catch{return!1}const E=hA(f);if(E&&typeof x()?.lists?.apply=="function")return Xu(E,g);const B=wm(f);if(B)return Yu(B,g);if(f==="copy-format")return br(uo());const q=Su(f);if(!q||q.disposition!=="routed")return!1;const oe=q.normalizePayload?q.normalizePayload(g):g;if(q.instanceRoute){if(!k()||!ue(q,oe))return!1;const We=t?.[q.instanceRoute];if(typeof We!="function")return!1;try{const Le=q.fixedArg!==void 0?q.fixedArg:oe;return br(We.call(t,Le))}catch{return!1}}if(q.inline?.kind==="clear")return q.mutates&&Wn()==="viewing"?!1:br(Jn());const ve=q.docRoute;if(!ve||q.mutates&&Wn()==="viewing")return!1;const Re=y(),Ue=vr(Re,ve);if(!Ue)return!1;if(q.inline){const{lockModesById:We}=wa(Re?.contentControls,ut.selection);if(Pi(We))return!1;const Le=Mu(ut.selection);if(!Le)return ut.selection.empty===!1?br(!1):br($f(q,oe));const Xe=Sa(q,Re,ut.selection),Ve=JV(q.inline,Le,oe,Xe);if(!Ve)return!1;let Ze=null;try{const Je=k(),rt=Wn(),tt=()=>k()!==Je||y()!==Re||Wn()!==rt?!1:Jf(ve,Ue,Ve),Rt=ga(ut.selection)??uc(ut.selection),Gt=q.inline.kind==="toggle"?vn(`${q.id}:${Rt}`,tt):null;Ze=Gt?.release??null;const en=Gt?Gt.result:tt(),Mn=Ra(q,ut.selection,Ve,en),Rr=br(co(q,ut.selection,Ve,en),Ar=>{Dl(q,Mn,Ar),Ze?.(),Ze=null});return q.inline.kind==="toggle"&&(L=Oi),Rr}catch{return Ze?.(),!1}}if(q.blockParagraph){const We=yb(q,Ue,oe),Le=q.blockParagraph.kind==="alignment"&&go(We)?ri(ut.selection,oe):null;return br(We,Xe=>{Wu(Le,Xe)})}if(q.list)return br(Im(q,Ue));if(q.link)return br(bb(oe));if(q.create)return br(Tm(q,Ue,oe));if(q.table)return br(Ec(q,Ue));try{return br(q.mutates?Xt(ve,Ue,oe):Ue(oe))}catch{return!1}},kr=()=>{m+=1,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:h.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const f of p)f("idle");Dt()},uo=async()=>{const f=["bold","italic","underline","strikethrough"].filter(Ue=>ut.toolbar.commands[Ue]?.active===!0),g=await L;await c;const w=go(g)?f:[],A=500,E=Date.now();if(h.mode!=="idle"){if(h.mode==="armed"&&E-h.lastClickAt<A){h={...h,mode:"persistent",lastClickAt:E};for(const Ue of p)Ue("persistent");return Dt(),!0}return kr(),!1}const B=E-h.lastClickAt<A,q=++m;h={...h,lastClickAt:E};const oe=await ba(),ve=`${uc(oe)}:${Pt()}`,Re=await wi(null,oe,ve&&ve===_?v:void 0,w);if(q!==m)return!0;h={...h,mode:B?"persistent":"armed",snapshot:Re,sourceSelectionKey:uc(oe),lastClickAt:E};for(const Ue of p)Ue(h.mode);return Dt(),!0},wi=async(f,g,w,A=[])=>{const E=g?.target??f?.target;if(!E||E.kind!=="text")return null;const B=Array.isArray(E.segments)?E.segments:[];if(B.length===0)return null;const q=y();if(!q)return null;const oe=E.story;let ve=null;for(const Ve of B){const Ze=(await wl(mo(Ve.blockId,oe)))?.node??null;if(!Ze)continue;const Je=Ds(Ze),rt=Qu(Array.isArray(Je?.inlines)?Je.inlines:[],Ve.range);ve?ve=MA(ve,rt):ve=rt}const Re=ve?tV(ve):{},Ue={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},We=new Set([...g?.activeMarks??(Array.isArray(f?.activeMarks)?f.activeMarks:[]),...A]);for(const[Ve,Ze]of Object.entries(Ue))We.has(Ve)&&(Re[Ze]=!0);const Le=w??await zu(g??pl(f,"ready"));if(Le.fontFamily&&(Re.fontFamily=Le.fontFamily),Le.color&&(Re.color=Le.color),Le.highlight&&(Re.highlight=Le.highlight),Le.fontSize){const Ve=Number.parseFloat(Le.fontSize);Number.isNaN(Ve)||(Re.fontSize=Ve)}let Xe=null;if(B.length===1){const Ve=B[0],Ze=(await wl(mo(Ve.blockId,oe)))?.node??null;Ze&&Ds(Ze)&&(Xe=await TH(Ze,Ve.blockId,q,oe))}return{story:oe??null,inline:Re,paragraph:Xe}},Ds=f=>f?f.kind==="paragraph"?f.paragraph??null:f.kind==="heading"?f.heading??null:null:null,Qu=(f,g)=>{const w=q=>{const oe=q.run;return typeof oe?.text=="string"?oe.text:""},A=q=>q.run?.props;if(g.start===g.end){let q=0;for(const oe of f){const ve=w(oe),Re=q,Ue=q+ve.length;if(q=Ue,g.start>=Re&&g.start<=Ue){const We=A(oe);return We?{...We}:{}}}return{}}let E=0;const B=[];for(const q of f){const oe=w(q),ve=E,Re=E+oe.length;if(E=Re,Re<=g.start||ve>=g.end)continue;const Ue=A(q);Ue&&B.push(Ue)}return B.length===0?{}:B.length===1?{...B[0]}:MA(B[0],...B.slice(1))},MA=(f,...g)=>{const w={...f};for(const A of g)for(const E of Object.keys(w)){if(!(E in A)){delete w[E];continue}const B=w[E],q=A[E];(typeof B!=typeof q||JSON.stringify(B)!==JSON.stringify(q))&&delete w[E]}return w},TH=async(f,g,w,A)=>{const E=Ds(f),B=E.props??{},q=E.styleRef??null,oe=B.alignment??null,ve=B.spacing??null,Re=B.indent??null,Ue=Re?{...Re.left!=null?{left:Re.left}:{},...Re.right!=null?{right:Re.right}:{},...Re.firstLine!=null?{firstLine:Re.firstLine}:{},...Re.hanging!=null?{hanging:Re.hanging}:{}}:null,We=B.markRunProps??null,Le=B.numbering?.numId,Xe=typeof Le=="string"?parseInt(Le,10):typeof Le=="number"?Le:NaN,Ve=B.numbering?.level,Ze=isNaN(Xe)?null:{numId:Xe,...Ve!=null?{level:Ve}:{}};let Je=null;if(Ze&&typeof w.lists?.getState=="function")try{const rt=await w.lists.getState({target:mo(g,A)});rt&&typeof w.lists?.getStyle=="function"&&(Je=await w.lists.getStyle(rt)??null)}catch{}return{styleId:q,alignment:oe,spacing:ve,indentation:Ue,markRunProps:We,numbering:Ze,listStyle:Je}},LA=async()=>{if(h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;const f=y()?.selection,g=async()=>vi(typeof f?.current=="function"?await Promise.resolve(f.current({includeText:!0})):es().value),w=()=>new Promise(q=>setTimeout(q,16)),A=8;let E=null,B="";for(let q=0;q<A;q+=1){if(q>0&&await w(),h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;if(E=await g(),!(!E||E.empty)&&(B=uc(E),B!==h.sourceSelectionKey))break}if(E&&!E.empty&&B!==h.sourceSelectionKey){await PA(E);return}if(h.snapshot?.paragraph){const q=await g();if(!q||uc(q)===h.sourceSelectionKey)return;await PA(q)}},PA=async f=>{const g=h.snapshot;if(!g){h.mode==="armed"&&kr();return}const w=y();if(!w)return;const A=pl(f,"ready"),{lockModesById:E}=wa(w.contentControls,A);if(Pi(E)){Dt();return}const B=f.target,q=f.selectionTarget;if(f.empty!==!0&&Object.keys(g.inline).length>0){const oe=vr(w,"format.apply");if(oe&&q)try{if(!go(As(await Promise.resolve(Jf("format.apply",oe,{target:q,inline:g.inline},f))))){Dt();return}}catch{Dt();return}}if(g.paragraph){const oe=Array.isArray(B?.segments)?B.segments:[],ve=B?.story;for(const Re of oe){const Ue=mo(Re.blockId,ve),We=await wl(Ue),Le=We?.node??null,Xe=We?.address??null;if(!Le)continue;const Ve={kind:"block",nodeType:Xe?.nodeType??Le.kind??"paragraph",nodeId:Re.blockId,...ve&&typeof ve=="object"?{story:ve}:{}},{styleId:Ze,alignment:Je,spacing:rt,indentation:tt,markRunProps:Rt,numbering:Gt,listStyle:en}=g.paragraph;if(Ze&&await w.styles?.paragraph?.setStyle?.({target:Ve,styleId:Ze}),Je&&await w.format?.paragraph?.setAlignment?.({target:Ve,alignment:Je}),rt){const Mn=rt,Rr=Mn.lineRule??"auto",Ar=new Set(["auto","exact","atLeast"]).has(Rr)?Rr:"auto",zr={...Mn.before!=null?{before:Math.round(Mn.before*20)}:{},...Mn.after!=null?{after:Math.round(Mn.after*20)}:{},...Mn.line!=null?{line:Math.round(Ar==="auto"?Mn.line*240:Mn.line*20),lineRule:Ar}:{}};await w.format?.paragraph?.setSpacing?.({target:Ve,...zr})}if(tt){const Mn={...tt.left!=null?{left:ks(tt.left)}:{},...tt.right!=null?{right:ks(tt.right)}:{},...tt.firstLine!=null?{firstLine:ks(tt.firstLine)}:{},...tt.hanging!=null?{hanging:ks(tt.hanging)}:{}};await w.format?.paragraph?.setIndentation?.({target:Ve,...Mn})}Rt&&await w.format?.paragraph?.setMarkRunProps?.({target:Ve,markRunProps:Rt}),Gt&&await w.format?.paragraph?.setNumbering?.({target:Ve,...Gt}),en&&((await wl(Ue))?.address?.nodeType==="listItem"?await w.lists?.applyStyle?.({target:bA(Re.blockId,ve),style:en}):Gt&&await w.format?.paragraph?.setNumbering?.({target:Ve,...Gt}))}}h.mode==="armed"&&kr(),Dt()},Rm=(f,g,w)=>{const A=bn(f,g),E=A?A.then(()=>(qn(f,g,w),Oi)):(qn(f,g,w),Oi);return Su(f)?.inline?.kind==="toggle"&&(L=E),E},DA=f=>({id:f,getState:()=>ut.toolbar.commands[f]??_l(f,y(),ut.selection,ni(ut.selection)),observe:g=>xa(w=>w.toolbar.commands[f]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(g),execute:g=>qn(f,g),executeAsync:g=>Rm(f,g)}),RH=f=>{fe.set(f.id,f),Dt();const g=()=>{fe.delete(f.id),Dt()};return Object.assign(g,{handle:DA(f.id),unregister:g})},Mm=ii(f=>f.selection),Lm=wo(Mm),OA=()=>{const f=T();if(typeof f?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let g=null;try{g=f.getHandles()}catch(A){const E=A?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const w=g?.editing?.selectionTargets;return typeof w?.apply!="function"?{reason:lt.hostCapabilityUnavailable}:{helper:w}},FA={get:Lm.get,getSnapshot:Lm.getSnapshot,subscribe:Lm.subscribe,observe:Lm.observe,current:()=>es().value,capture:()=>{const f=Mm.get();return f.empty||!f.target&&!f.selectionTarget?null:{...f,capturedAt:Date.now()}},restore:f=>{const g=E=>(Dt(),{...E,success:E.ok});if(!f||typeof f!="object")return g({ok:!1,reason:lt.targetUnresolved});if(!k())return g({ok:!1,reason:lt.notReady});const w=ZV(f);if(!w)return g({ok:!1,reason:lt.targetUnresolved});const A=OA();if(!("helper"in A))return g({ok:!1,reason:A.reason});try{return g(fA(A.helper.apply(w)))}catch{return g({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:f=>{if(!k())return{ok:!1,reason:lt.notReady};const g=OA();if(!("helper"in g))return{ok:!1,reason:g.reason};try{const w=g.helper.apply(f);return Dt(),fA(w)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:f=>{const g=T();if(typeof g?.getSelectionAnchorRect=="function"){const w=Tt(()=>g.getSelectionAnchorRect(f),null);return w&&typeof w=="object"&&(Number(w.width)>0||Number(w.height)>0)?w:null}return null},getRects:f=>{const g=Mm.get(),w=g.selectionTarget??g.target;if(g.empty||!w)return[];const A=jm.getRect({target:w,relativeTo:f?.relativeTo});return A.found?A.rects:[]}},MH={get ids(){return Te()},has:f=>Su(f)!=null||fe.has(f),get:f=>DA(f),execute:qn,executeAsync:Rm,register:RH,getContextMenuItems:f=>{const g=[];for(const w of fe.values()){const A=w.contextMenu;A&&Tt(A.when?()=>A.when(f):void 0,!0)&&g.push({id:w.id,label:A.label,group:A.group,order:A.order,invoke:()=>qn(w.id,void 0,f)})}return g.sort((w,A)=>(w.order??0)-(A.order??0)||w.label.localeCompare(A.label))}},wb=wo(ii(f=>f.toolbar)),LH={get:wb.get,getSnapshot:()=>ut.toolbar,subscribe:wb.subscribe,observe:wb.observe,execute:qn,executeAsync:Rm},xc=async(f,g)=>{if(!k())return{success:!1,ok:!1,reason:lt.notReady};if(!f)return{success:!1,ok:!1,reason:lt.targetUnresolved};const w=T(),A=w?.scrollTargetIntoView;if(typeof A!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const E={target:f,block:g?.block??"center",behavior:g?.behavior??"smooth"},B=await Promise.resolve(g?.shouldContinue?A.call(w,E,g.shouldContinue):A.call(w,E));return B&&typeof B=="object"&&B.success===!1?{success:!1,ok:!1,reason:ib(B.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},Pm=async(f,g,w,A)=>{const E=f==="trackChanges"?A?.story:void 0,B=rt=>{if(!E||!rt||typeof rt!="object")return rt;const tt=rt,Rt=tt.address&&typeof tt.address=="object"?tt.address:null;return tt.story||Rt?.story?rt:{...tt,story:E}},q=f==="trackChanges"?_V:Bf,oe=w.find(rt=>Ki(rt,g,E)),ve=oe&&typeof oe=="object"?oe:null,Re=f==="trackChanges"&&ve?.type==="move"&&(ve.subtype==="move-to"||ve.subtype==="move-from")?ve.subtype:null,Ue=Re&&typeof ve?.trackedChangeCanonicalId=="string"?ve.trackedChangeCanonicalId:g,We=rt=>{if(!Re)return q(rt);const tt=Bf(rt);if(tt?.kind!=="move")return null;const Rt=Re==="move-to"?tt.destination:tt.source;return sb(Rt)?Rt:null},Le=q(oe),Xe=f!=="trackChanges"||!Re&&sb(Bf(oe));if(Le&&Xe)return B(Le);const Ve=y()?.[f],Ze=f==="comments"?{commentId:g}:{id:Ue,...E?{story:E}:{}},Je=Ve?.get;if(typeof Je!="function")return B(Le);try{return B(We(await Promise.resolve(Je.call(Ve,Ze)))??Le)}catch{return B(Le)}};function NA(f,g){if(ti())return lr("Comments are read-only.","DOCUMENT_READONLY");if(Ts())return lr("Resolving comments is disabled.","DOCUMENT_READONLY");const w=y()?.comments,A=w?.patch;if(typeof A!="function")return lr("comments.patch is unavailable.");const E=lr("comments.patch failed.");return Tt(()=>Ma(A.call(w,{commentId:f,status:g}),E),E)}const Dm=()=>ti()?lr("Comments are read-only.","DOCUMENT_READONLY"):null,BA=(f,g)=>{const w=g&&typeof g=="object"?g:null;let A=Array.from(f);w?.includeResolved===!1&&(A=A.filter(ve=>ve.status!=="resolved"));const E=Number(w?.offset),B=Number.isInteger(E)&&E>0?E:0,q=Number(w?.limit),oe=Number.isInteger(q)&&q>=0?B+q:void 0;return A.slice(B,oe)},Ju=ii(f=>f.comments),Om=wo(Ju),PH={get:Om.get,getSnapshot:Om.getSnapshot,subscribe:Om.subscribe,observe:Om.observe,list:f=>{const g=Ju.get();if(g.status!=="pending")return BA(g.items,f);const w=y()?.comments,A=Tt(w?.list?()=>w.list(f):void 0,null);return Tr(A)?[]:BA(Array.isArray(A?.items)?A.items:[],f)},getById:f=>{const g=Ju.get().items.find(E=>Gn(E)===f)??null;if(g)return g;const w=y()?.comments,A=Tt(w?.get?()=>w.get({commentId:f}):void 0,null);return Tr(A)?null:A},createFromCapture:(f,g)=>{const w=Dm();if(w)return w;const A=y()?.comments,E=A?.create;if(typeof E!="function")return lr("comments.create is unavailable.");const B=lr("comments.create failed.");return Tt(()=>Ma(E.call(A,{target:f.target??f.selectionTarget,text:g.text}),B),B)},createFromSelection:f=>{const g=Dm();if(g)return g;const w=y()?.comments,A=w?.create;if(typeof A!="function")return lr("comments.create is unavailable.");const E=Mm.get(),B=E.target??E.selectionTarget;if(E.empty||!B)return lr("A range selection is required to comment.","NO_SELECTION");const q=lr("comments.create failed.");return Tt(()=>Ma(A.call(w,{target:B,text:f.text}),q),q)},reply:(f,g)=>{const w=Dm();if(w)return w;const A=y()?.comments,E=A?.reply??A?.create;if(typeof E!="function")return lr("comments.reply is unavailable.");const B=lr("comments.reply failed.");return Tt(()=>Ma(E===A?.reply?E.call(A,{parentCommentId:f,text:g.text}):E.call(A,{parentCommentId:f,text:g.text}),B),B)},resolve:f=>NA(f,"resolved"),reopen:f=>NA(f,"active"),delete:f=>{const g=Dm();if(g)return g;const w=y()?.comments,A=w?.delete??w?.remove;if(typeof A!="function")return lr("comments.delete is unavailable.");const E=lr("comments.delete failed.");return Tt(()=>Ma(A.call(w,{commentId:f}),E),E)},setActive:f=>{if(f==null)return ye=null,Dt(),!0;if(!k())return!1;const g=Ju.get();if(g.listStatus!=="ready")return!1;const w=MV(g.items,f);return!w||!g.items.some(A=>Gn(A)===w)?!1:(ye=w,Dt(),!0)},scrollTo:async f=>{if(!y())return{success:!1,ok:!1,reason:k()?lt.documentApiUnavailable:lt.notReady};const g=await Pm("comments",f,Ju.get().items);return g?xc(g):{success:!1,ok:!1,reason:lt.targetUnresolved}}},La=ii(f=>f.trackChanges),Cb=(f,g)=>{const w=La.get().items.filter(We=>Gn(We)!==null);if(w.length===0)return null;const A=ut.trackChanges.activeId,E=le?.id===A?le.story:void 0,B=w.filter(We=>gm(We)==null),q=E||B.length===0?w:B;let oe=A?q.findIndex(We=>Ki(We,A,E)):-1;oe===-1&&A&&E&&(oe=q.findIndex(We=>Ki(We,A)));const ve=q[oe===-1?f>0?0:q.length-1:(oe+f+q.length)%q.length],Re=Gn(ve),Ue=gm(ve);return Ge(Ue?{id:Re,story:Ue}:{id:Re},g),Dt(),Re};let zA=Promise.resolve();const DH=f=>{const g=re;return zA.catch(()=>{}).then(()=>OH(f,g))},OH=async(f,g)=>{if(re!==g)return{success:!1};const w=le,A=Cb(f,{invalidateQueuedNavigation:!1});if(A==null)return{success:!1};const E=le,B=Se,q=()=>re===g&&le===E&&Se===B,oe=()=>{q()&&(Ge(w,{invalidateQueuedNavigation:!1}),Dt())};E&&$e.add(E);try{const ve=await Pm("trackChanges",A,La.get().items,E?.story?{story:E.story}:void 0);if(!q())return{success:!1};if(!ve)return oe(),{success:!1};Vo+=1;try{const Re=await xc(ve,{behavior:"auto",shouldContinue:q});return q()?(!Re.ok&&Re.reason!==lt.targetNotVisible?(oe(),Ee(w)):Ee(E),{success:Re.ok}):{success:!1}}finally{Vo=Math.max(0,Vo-1),Vo===0&&(q()?Rn&&Po(bi(Rn)):Ee(le))}}finally{E&&$e.delete(E)}},VA=f=>{const g=DH(f);return zA=g.then(()=>{},()=>{}),g},Fm=wo(La),FH={get:()=>(cr(),Fm.get()),getSnapshot:()=>(cr(),Fm.getSnapshot()),subscribe:f=>(cr(),Fm.subscribe(f)),observe:f=>(cr(),Fm.observe(f)),list:()=>(cr(),La.get().items),accept:f=>_b("accept",f),reject:f=>_b("reject",f),acceptAll:()=>nh("accept",{scope:"all"},null),rejectAll:()=>nh("reject",{scope:"all"},null),next:()=>Cb(1),previous:()=>Cb(-1),navigateNext:()=>VA(1),navigatePrevious:()=>VA(-1),getAt:f=>{if(!f||typeof f!="object"||typeof f.x!="number"||typeof f.y!="number")return null;const g=Ab(f);if(g.length===0)return null;const w=La.get().items;let A;for(const E of g){if(E.type!=="trackedChange")continue;let B;if(E.story){if(A===void 0&&(A=ts()),!A)continue;B=A}else B=w;const q=B.find(oe=>Ki(oe,E.id,E.story));if(q)return E.story?{id:q.id,item:q,story:E.story}:{id:q.id,item:q}}return null},setActive:f=>{if(f==null)return Ge(null),Ee(null),Dt(),!0;if(!k())return!1;const g=typeof f=="string"?{id:f}:{id:f.id,story:f.story};if(typeof g.id!="string"||g.id.length===0)return!1;const w=g.id;if(g.story){const A=ts();if(!A)return!1;const E=Eu(A,g.story).toPublicId(g.id)??g.id;if(!A.some(B=>Ki(B,E,g.story)))return!1;g.id=E}else{const A=La.get().items,E=pa(A).toPublicId(g.id)??g.id,B=A.find(q=>Gn(q)===E);if(!B)return!1;g.id=E,g.story=gm(B)}return w!==g.id&&(g.paintedEntityId=w),Ge(g),Ee(g),Dt(),!0},scrollTo:async f=>{if(!y())return{success:!1,ok:!1,reason:k()?lt.documentApiUnavailable:lt.notReady};re+=1,xe+=1;const g=xe,w=La.get().items,A=pa(w).toPublicId(f)??f,E=gm(w.find(oe=>Gn(oe)===A)),B=le,q={id:A,...E?{story:E}:{},...A!==f?{paintedEntityId:f}:{}};$e.add(q);try{const oe=await Pm("trackChanges",A,w,E?{story:E}:void 0);if(xe!==g)return{success:!1,ok:!1};if(!oe)return{success:!1,ok:!1,reason:lt.targetUnresolved};Ge(q);const ve=xe,Re=le,Ue=Se,We=()=>xe===ve&&le===Re&&Se===Ue,Le=()=>{We()&&(Ge(B,{invalidateQueuedNavigation:!1}),Dt())};Dt(),Vo+=1;try{const Xe=await xc(oe,{behavior:"auto",shouldContinue:We});return We()?(!Xe.ok&&Xe.reason!==lt.targetNotVisible?(Le(),Ee(B)):Ee(q),Xe):{success:!1,ok:!1}}finally{Vo=Math.max(0,Vo-1),Vo===0&&(We()?Rn&&Po(bi(Rn)):Ee(le))}}finally{$e.delete(q)}}},_b=(f,g)=>{const{id:w,story:A}=typeof g=="string"?{id:g,story:void 0}:g;return nh(f,{kind:"id",id:w,...A?{story:A}:{}},w,A)},nh=(f,g,w,A)=>{try{return br(Sb(f,g,w,A))}catch{return!1}},Sb=(f,g,w,A)=>{if(ti())return!1;const E=y()?.trackChanges,B=g.scope==="all",q=g.kind==="range",oe=g.kind==="ids";if(Cc({kind:f,scope:B?"all":"id"},E))return!1;const ve=B?`${f}All`:f,Re=!q&&!oe&&!A&&E&&typeof E[ve]=="function"?E[ve]:null,Ue=E&&typeof E.decide=="function"?E.decide:null;return!Re&&!Ue?!1:Re?Re.call(E,w??{}):Ue.call(E,{decision:f,target:g})},kb=ii(f=>f.contentControls),rh=f=>kb.get().items.find(g=>g?.id===f)??null,Nm=wo(kb),NH=(f=>{if(f===void 0)return Nm.get();const g=vm(f);return g?rh(g):null}),BH={get:(f=>(f!==void 0&&so("api"),NH(f))),getSnapshot:Nm.getSnapshot,subscribe:Nm.subscribe,observe:Nm.observe,list:()=>(so("api"),kb.get().items),getById:f=>(so("api"),rh(f)),getRect:f=>{const g=vm(f);if(!g)return fl("unresolved");so("panel");const w=rh(g);if(!w)return fl("unresolved");const A=ab(w);return A?jm.getRect({target:A}):fl("unavailable")},scrollIntoView:async f=>{const g=vm(f);if(!g)return{success:!1};so("panel");const w=rh(g);if(!w)return{success:!1};const A=ab(w);return A?{success:(await xc(A,{block:f.block,behavior:f.behavior})).ok}:{success:!1}},focus:async f=>{const g=vm(f);if(!g)return{success:!1,reason:"invalid-id"};if(!k())return{success:!1,reason:"not-ready"};so("panel");const w=rh(g);if(!w)return{success:!1,reason:"not-found"};const A=ab(w);if(!A)return{success:!1,reason:"not-reachable"};if(!(await xc(A,{block:f.block,behavior:f.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=AV(A);if(!E)return{success:!1,reason:"not-reachable"};const B=FA.apply(E);return!B.ok&&B.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:{success:!0}}},Bm=wo(ii(f=>f.fonts)),zH={get:Bm.get,getSnapshot:Bm.getSnapshot,subscribe:Bm.subscribe,observe:Bm.observe,getFamilyOptions:()=>ut.fonts.options,getSizeOptions:()=>ut.fonts.sizeOptions},zm=wo(ii(f=>f.zoom)),VH={get:zm.get,getSnapshot:zm.getSnapshot,subscribe:zm.subscribe,observe:zm.observe,set:f=>{if(typeof t?.setZoom=="function")try{t.setZoom(f),Dt()}catch{}},setMode:f=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(f),Dt()}catch{}}},Vm=wo(ii(f=>f.document)),HH={get:Vm.get,getSnapshot:Vm.getSnapshot,subscribe:Vm.subscribe,observe:Vm.observe,setMode:f=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(f),Dt()}catch{}},export:f=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(f))}catch{return}},getText:()=>{const f=y(),g=Tt(f?.getText?()=>f.getText({}):void 0,null);return typeof g=="string"?g:g&&typeof g=="object"&&typeof g.text=="string"?g.text:null},replaceFile:f=>{const g=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof g=="function")try{return Promise.resolve(g.call(t,f))}catch{return}}},HA=()=>{if(typeof HTMLElement>"u")return null;const f=k()?.mount?.container;if(f instanceof HTMLElement)return f;const g=t?.element;return g instanceof HTMLElement?g:null},jH=(f,g)=>{if(typeof f!="number"||typeof g!="number"||!Number.isFinite(f)||!Number.isFinite(g))return[];const w=globalThis.document;if(!w||typeof w.elementFromPoint!="function")return[];const A=HA();if(!A)return[];const E=w.elementFromPoint(f,g);if(!E||!A.contains(E))return[];const B=[E],q=tt=>{tt&&A.contains(tt)&&!B.includes(tt)&&B.push(tt)},oe=w.elementsFromPoint;if(typeof oe=="function"){let tt=[];try{tt=oe.call(w,f,g)??[]}catch{tt=[]}for(const Rt of tt)q(Rt)}const ve=[],Re=tt=>{tt&&A.contains(tt)&&!ve.includes(tt)&&!B.includes(tt)&&ve.push(tt)},Ue=tt=>{const Rt=tt.getBoundingClientRect;if(typeof Rt!="function")return!1;let Gt;try{Gt=Rt.call(tt)}catch{return!1}return Gt!=null&&f>=Gt.left&&f<=Gt.right&&g>=Gt.top&&g<=Gt.bottom};for(const tt of B){const Rt=tt.querySelectorAll;if(typeof Rt!="function")continue;let Gt;try{Gt=Rt.call(tt,"[data-track-change-marker]")}catch{continue}for(let en=0;en<Gt.length;en+=1)Ue(Gt[en])&&Re(Gt[en])}ve.reverse();const We=[...ve,...B],Le=uA(We[0],A);for(let tt=1;tt<We.length;tt+=1)for(const Rt of uA(We[tt],A))Le.push(Rt);if(Le.length===0)return Le;const Xe=La.get().items,Ve=pa(Xe);let Ze;const Je=new Set,rt=[];for(const tt of Le){if(tt.type!=="trackedChange"){const Mn=`${tt.type}:${tt.id}`;if(Je.has(Mn))continue;Je.add(Mn),rt.push(tt);continue}const Rt=kV(tt.storyKey)??SV(tt.story);let Gt;if(Rt){if(Ze===void 0&&(Ze=ts()),!Ze||(Gt=Eu(Ze,Rt).toPublicId(tt.id),!Gt||!Ze.some(Mn=>Ki(Mn,Gt,Rt))))continue}else if(Gt=Ve.toPublicId(tt.id),!Gt)continue;const en=`trackedChange:${Gt}`;Je.has(en)||(Je.add(en),rt.push(Rt?{type:"trackedChange",id:Gt,story:Rt}:{type:"trackedChange",id:Gt}))}return rt};function Ab(f,g){return typeof f=="object"?jH(f?.x,f?.y):null}const $u=new Set;let Ib=!1;const jA=f=>{const g=T();if(typeof g?.observeGeometry!="function")return;let w=!1;const A=Tt(()=>{const E=g.observeGeometry(()=>f.schedule());return w=!0,E},null);f.detach=typeof A=="function"?A:null,f.boundHost=w?g:null},Hm=f=>{if(f.detach){try{f.detach()}catch{}f.detach=null}f.boundHost=null},UA=()=>{if(Ib=!1,!(Z||T()))for(const f of $u)Hm(f)},UH=()=>{if(!Ib){if(Ib=!0,typeof queueMicrotask=="function"){queueMicrotask(UA);return}Promise.resolve().then(UA)}},GH=()=>{const f=T();if(!f){UH();return}for(const g of $u)g.boundHost&&g.boundHost===f||(Hm(g),jA(g),g.schedule())};Rl.push(GH);const jm={getRect:f=>{const g=T(),w=g?.getTargetRects;if(typeof w=="function"){const A=Tt(()=>w.call(g,{target:f.target}),null);return A&&typeof A=="object"?A.success===!0&&Array.isArray(A.rects)?YV(qV(A.rects.filter(E=>E!=null&&typeof E=="object")),f.relativeTo):fl(typeof A.reason=="string"?A.reason:"unresolved"):fl("unresolved")}return fl("unavailable")},observe:f=>{const g=[];let w=0;const A=typeof requestAnimationFrame=="function",E=()=>{if(!A){f();return}w||(w=requestAnimationFrame(()=>{w=0,f()}))},B=xa(oe=>({ready:oe.ready,selection:oe.selection,zoom:oe.zoom}));g.push(B.subscribe(()=>E()));const q={schedule:E,detach:null,boundHost:null};return jA(q),$u.add(q),()=>{$u.delete(q),Hm(q),w&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(w);for(const oe of g.splice(0))try{oe()}catch{}}},getHost:()=>HA(),entityAt:Ab,contextAt:f=>{const g=!!f&&typeof f.x=="number"&&typeof f.y=="number",w=g?f.x:0,A=g?f.y:0;return{point:{x:w,y:A},entities:g?Ab({x:w,y:A}):[],selection:ut.selection,position:null,insideSelection:!1}},scrollIntoView:async f=>{const g=f?.target;if(!g)return{success:!1};let w=null;if(g.kind==="entity"){const A=g.entityType==="comment"?"comments":"trackChanges",E=A==="comments"?Ju.get().items:La.get().items,B=g.entityType==="trackedChange"&&g.story?{story:g.story}:void 0;w=await Pm(A,g.entityId,E,B)}else{const A=g,E=g,B=Array.isArray(A.segments)&&A.segments.length>0?A.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(B){const q=g.story;w={kind:"text",segments:B,...q?{story:q}:{}}}}return w?{success:(await xc(w,{block:f.block??"center",behavior:f.behavior??"smooth"})).ok}:{success:!1}}},GA=f=>{const g=(f&&typeof f=="object"?f:null)?.target;return g&&typeof g=="object"?g:null},WA=f=>`metadata:resolve:${f}`,WH=f=>{const g=y()?.metadata;if(!g||typeof g.resolve!="function")return null;const{value:w}=ur(WA(f),Pt(),()=>g.resolve({id:f}),GA);return w},KH=async f=>{const g=y()?.metadata;if(!g||typeof g.resolve!="function")return null;try{const w=Pt(),A=await Promise.resolve(g.resolve({id:f}));if(w!==Pt())return null;const E=GA(A);return ee.set(WA(f),{token:w,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},qH={getRect:f=>{const g=y()?.metadata;if(!g||typeof g.resolve!="function")return fl("unavailable");const w=WH(f.id);return w?jm.getRect({target:w}):fl("unresolved")},scrollIntoView:async f=>{const g=await KH(f.id);return g?{success:(await xc(g,{block:f.block,behavior:f.behavior})).ok}:{success:!1}}},YH={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},XH={getContext:()=>{const f=Fe();if(!f)return{...YH};const g=pe()?.table;return{inTable:!0,tableNodeId:f.tableNodeId,rowIndex:f.rowIndex,columnIndex:f.columnIndex,cellNodeId:f.cellNodeId,rows:typeof g?.rows=="number"?g.rows:null,columns:typeof g?.columns=="number"?g.columns:null}},isInTable:()=>Fe()!=null},Um={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:lt.searchUnavailable};let On={...Um};const Gm=new Set,Pa=()=>{const f=T()?.search;return f&&typeof f=="object"?f:null},Os=()=>{const f=x()?.search;return f&&typeof f=="object"?f:null},oh=()=>{const f=Pa();if(f&&typeof f.setSession=="function")return!0;const g=Os();return!!g&&typeof g.query=="function"&&typeof g.getState=="function"},ss=()=>{for(const f of[...Gm])try{f(On)}catch{}},ai=f=>(On={...On,...f},ss(),On);let Zr=0,Tc=null;const KA=()=>{const f=Tc;Tc=null,f&&Tt(()=>(f(),null),null)},ZH=()=>{Zr+=1,KA();const f=oh();On={...Um,available:f,reason:f?void 0:lt.searchUnavailable},ss()};Ia.push(ZH);const QH=f=>{if(!f)return!1;const g=f.queryError;if(g&&typeof g=="object"&&g.code==="invalid-pattern")return!0;const w=f.rejection;return f.status==="rejected"&&!!w&&typeof w=="object"&&w.code==="invalid-pattern"},Eb=(f,g=!1)=>{const w=f&&typeof f=="object"?f:null;if(!w)return null;const A=Array.isArray(w.matches)?w.matches:[],E=typeof w.total=="number"&&Number.isFinite(w.total)?w.total:A.length,B=typeof w.activeMatchIndex=="number"?w.activeMatchIndex:typeof w.activeIndex=="number"?w.activeIndex:-1;return{...typeof w.query=="string"?{query:w.query}:{},total:E,activeIndex:B,canReplace:w.canReplace===!0||g,...w.includeDeletedText===!0?{includeDeletedText:!0}:{},...w.regex===!0?{regex:!0}:{},...QH(w)?{invalidPattern:!0}:{}}},So=()=>{const f=z("find.replace"),g=z("find.replaceAll");return f?.enabled===!0||g?.enabled===!0},ko=(f,g=!1)=>{const w=Eb(f,g);if(!w){ai({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}ai({...w.query!==void 0?{query:w.query}:{},total:w.total,activeIndex:w.activeIndex,canReplace:w.canReplace,...w.includeDeletedText!==void 0?{includeDeletedText:w.includeDeletedText}:{},...w.regex!==void 0?{regex:w.regex}:{},reason:w.invalidPattern?lt.searchInvalidPattern:void 0})},Da=()=>{const f=Pa();if(f&&typeof f.getState!="function")return On={...On,available:oh(),reason:oh()?void 0:lt.searchUnavailable},On;if(!f){const w=Os();if(w&&typeof w.getState=="function"){const A=Eb(Tt(()=>w.getState(),null),So());if(A)return On={...On,...A.query!==void 0?{query:A.query}:{},total:A.total,activeIndex:A.activeIndex,canReplace:A.canReplace,available:!0,reason:A.invalidPattern?lt.searchInvalidPattern:void 0,open:On.open||!!A.query},On}return On={...Um,query:On.query,caseSensitive:On.caseSensitive,includeDeletedText:On.includeDeletedText},On}const g=Eb(Tt(()=>f.getState(),null));return g&&(On={...On,...g.query!==void 0?{query:g.query}:{},total:g.total,activeIndex:g.activeIndex,canReplace:g.canReplace,...g.includeDeletedText!==void 0?{includeDeletedText:g.includeDeletedText}:{},...g.regex!==void 0?{regex:g.regex}:{},available:!0,reason:g.invalidPattern?lt.searchInvalidPattern:void 0,open:On.open||!!g.query}),On},ed=f=>{const g=f&&typeof f=="object"?f:null;if(g?.status==="committed")return{ok:!0};if(g?.status==="rejected"&&g.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const w=g?.rejection;return g?.status==="rejected"&&w&&typeof w=="object"&&w.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Wm=wo({get:()=>Da(),subscribe:f=>(Gm.add(f),()=>Gm.delete(f))}),JH={get:Wm.get,getSnapshot:Wm.getSnapshot,subscribe:Wm.subscribe,observe:Wm.observe,open:()=>oh()?(ai({available:!0,open:!0,reason:void 0}),{ok:!0}):(ai({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(Zr+=1,Tc)KA();else{const f=Pa();if(f&&typeof f.clear=="function")Tt(()=>f.clear(),null);else{const g=Os();g&&typeof g.query=="function"&&Tt(()=>g.query({query:""}),null)}}On={...Um,available:oh(),reason:void 0},On.available||(On.reason=lt.searchUnavailable),ss()},search:(f,g)=>{const w=Pa(),A=!!g?.caseSensitive,E=g?.includeDeletedText===!0,B=g?.regex===!0,q=++Zr;if(!w||typeof w.setSession!="function"){const oe=Os();if(oe&&typeof oe.query=="function"&&typeof oe.getState=="function"){ai({query:f,caseSensitive:A,includeDeletedText:E,regex:B,available:!0,open:!0,reason:void 0}),Tc=()=>{oe.query({query:""})};const ve=Tt(()=>oe.query({query:f,caseSensitive:A,includeDeletedText:E,regex:B}),null);return Tr(ve)?Promise.resolve(ve).then(Re=>{q===Zr&&ko(Re,So())},()=>{q===Zr&&ai({available:!1,reason:lt.searchUnavailable})}):ko(ve,So()),ko(Tt(()=>oe.getState(),null),So()),On}return ai({query:f,total:0,activeIndex:-1,available:!1,caseSensitive:A,includeDeletedText:E,regex:B,reason:lt.searchUnavailable})}if(ai({query:f,caseSensitive:A,includeDeletedText:E,regex:B,available:!0,open:!0,reason:void 0}),Tc=()=>{typeof w.clear=="function"&&w.clear()},ko(Tt(()=>w.setSession(f,{caseSensitive:A,includeDeletedText:E,...B?{regex:!0}:{},highlight:!0}),null)),f.length>0&&On.total===0&&On.reason!==lt.searchInvalidPattern){const oe=Os();if(oe&&typeof oe.query=="function"&&typeof oe.getState=="function"){const ve=Tc;Tc=()=>{ve?.(),oe.query({query:""})};const Re=Tt(()=>oe.query({query:f,caseSensitive:A,includeDeletedText:E,regex:B}),null);Tr(Re)?Promise.resolve(Re).then(Ue=>{q===Zr&&ko(Ue,So())},()=>{q===Zr&&ai({available:!1,reason:lt.searchUnavailable})}):ko(Re,So()),ko(Tt(()=>oe.getState(),null),So())}}return On},next:()=>{const f=Pa();if(!f||typeof f.next!="function"){const g=Os();if(!g||typeof g.next!="function"||typeof g.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(On.total===0)return{ok:!1,reason:lt.operationUnavailable};const w=Tt(()=>g.next(),null);if(Tr(w)){const A=Zr;Promise.resolve(w).then(E=>{A===Zr&&ko(E,So())}).catch(()=>{A===Zr&&ai({available:!1,reason:lt.searchUnavailable})})}else ko(w,So());return ko(Tt(()=>g.getState(),null),So()),{ok:!0}}return On.total===0?{ok:!1,reason:lt.operationUnavailable}:(ko(Tt(()=>f.next(),null)),{ok:!0})},previous:()=>{const f=Pa();if(!f||typeof f.previous!="function"){const g=Os();if(!g||typeof g.previous!="function"||typeof g.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(On.total===0)return{ok:!1,reason:lt.operationUnavailable};const w=Tt(()=>g.previous(),null);if(Tr(w)){const A=Zr;Promise.resolve(w).then(E=>{A===Zr&&ko(E,So())}).catch(()=>{A===Zr&&ai({available:!1,reason:lt.searchUnavailable})})}else ko(w,So());return ko(Tt(()=>g.getState(),null),So()),{ok:!0}}return On.total===0?{ok:!1,reason:lt.operationUnavailable}:(ko(Tt(()=>f.previous(),null)),{ok:!0})},clear:()=>{Zr+=1;const f=Pa();if(f&&typeof f.clear=="function"&&Tt(()=>f.clear(),null),!f||typeof f.clear!="function"){const g=Os();g&&typeof g.query=="function"&&Tt(()=>g.query({query:""}),null)}ai({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:f=>{const g=Pa();if(!g){const A=Os();if(!A||typeof A.replace!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!So())return{ok:!1,reason:lt.operationUnavailable};const E=Tt(()=>A.replace({replacement:typeof f=="string"?f:""}),null);if(Tr(E)){const B=Zr;Da(),ss();const q=()=>B===Zr;return Promise.resolve(E).then(oe=>(q()&&(ko(oe,So()),Da(),ss()),ed(oe)),()=>(q()&&ai({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Da(),ss(),ed(E)}if(typeof g.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const w=Tt(()=>g.replaceCurrent(typeof f=="string"?f:""),null);return Da(),ss(),ed(w)},replaceAll:f=>{const g=Pa();if(!g){const A=Os();if(!A||typeof A.replaceAll!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!So())return{ok:!1,reason:lt.operationUnavailable};const E=Tt(()=>A.replaceAll({replacement:typeof f=="string"?f:""}),null);if(Tr(E)){const B=Zr;Da(),ss();const q=()=>B===Zr;return Promise.resolve(E).then(oe=>(q()&&(ko(oe,So()),Da(),ss()),ed(oe)),()=>(q()&&ai({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Da(),ss(),ed(E)}if(typeof g.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const w=Tt(()=>g.replaceAll(typeof f=="string"?f:""),null);return Da(),ss(),ed(w)}},qA=ii(f=>f.styles),Km=wo(qA),$H={get:Km.get,getSnapshot:Km.getSnapshot,subscribe:Km.subscribe,observe:Km.observe,getCatalog:f=>Qe(f).value,getQuickGallery:()=>qA.get().quickGallery,getActiveParagraphStyle:()=>nt(ut.selection,ct().cache).style},YA={select:xa,get state(){return ut},selection:FA,commands:MH,toolbar:LH,comments:PH,trackChanges:FH,contentControls:BH,fonts:zH,zoom:VH,document:HH,viewport:jm,metadata:qH,tables:XH,search:JH,styles:$H,formatPainter:{setPointerSelecting(f){Z||(h={...h,pointerSelecting:f})},notifyPointerUp(){Z||(h={...h,pointerSelecting:!1},LA())},setKeyboardSelecting(f){Z||(h={...h,keyboardSelecting:f})},notifyKeyUp(){Z||(h={...h,keyboardSelecting:!1},LA())},cancel(){Z||kr()},onModeChange(f){return Z?()=>{}:(p.add(f),()=>p.delete(f))}},createScope:()=>{const f=[];return{select:(g,w)=>{const A=xa(g,w);return{get:A.get,subscribe:E=>{const B=A.subscribe(E);return f.push(B),B}}},dispose:()=>{for(const g of f.splice(0))g()}}},destroy:()=>{if(!Z){Z=!0,hn.reset(),Ye(),K&&(clearTimeout(K),K=null),te&&(clearTimeout(te),te=null,Y=0),H?.timer&&(clearTimeout(H.timer),H.timer=null),H=null,me&&(clearTimeout(me),me=null),_e&&(clearTimeout(_e),_e=null),ot&&ot(),ot=null,vt=null,$t.clear(),D.clear();for(const f of Ll.splice(0))f();Cn&&Cn(),Cn=null,Ut=null,Kn&&Kn(),Kn=null,Sr=null,at&&at(),at=null,Rn=null,An&&An(),An=null,pn=null,oi&&oi(),oi=null,Ur=null;for(const f of $u)Hm(f);$u.clear(),qe.clear(),Gm.clear(),m+=1,p.clear(),Zr+=1,fe.clear()}}};return S=YA,YA}var nH=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function rH(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function oH(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?rH(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function iH(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function sH(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:nH;for(const s of i)o(s);return n}var aH=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function lH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}xt();var cH=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]);async function uH(e,t){const n=new m6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function mb(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function IA(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function dH(e,t){if(!e)return()=>{};if(mb(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{IA(e),s()},l=u=>{u!==!1&&(u===!0||mb(e))&&(IA(e),s())};return n("synced",a),n("sync",l),mb(e)&&s(),i}function Zo(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function fH(e){const t=e&&typeof e=="object"?e.code:null;return t==="comment-export-missing-story-reference"||t==="v2-worker-comment-export-mode-unsupported"}function EA(e){return typeof e=="string"&&e.length>0?e:null}function gb(e){return e?Zo(e)?EA(e.documentId??e.options?.documentId??null):EA(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function hH(e){if(!e||Zo(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Xi(e){if(!e)return null;if(Zo(e))return e.fonts??null;const t=hH(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var Cm=class extends Ym.default{static{this.allowedTypes=[Or,Ql,ep]}#t=!1;#n=!1;#e=null;#i=null;#s=null;#a=null;#u=null;#d=null;#l=z4({});get uiConfig(){return this.#l}#f=V4({});get interactionConfig(){return this.#f}#m=j4({});get surfacesConfig(){return this.#m}#o;#r=new cN;#p=null;#y=!1;constructor(e){if(super(),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",document:{},documents:[],editorExtensions:[],colors:[],users:[],user:{...Y0},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#o=new QF({getModuleConfig:()=>this.#m}),this.#w(e,t)}async#w(e,t){this.config={...this.config,...e},!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),oN(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(n&&this.config.useLayoutEngine&&!r&&(console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine."),this.config.useLayoutEngine=!1),!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#ve(),this.config.user=iN(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=L_(this.config.modules.comments),this.#l=z4(this.config),this.#f=V4(this.config),this.#m=j4(this.config),this.config.disableContextMenu=!this.#l.contextMenu.enabled,this.config.rulers=this.#l.ruler.enabled,this.#l.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#l.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&Object.assign(i,this.#f.comments)}if(this.config.colors=S6(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.4.0-next.1",this.#b("πŸ¦‹ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||as(),this.colors=this.config.colors??[],this.#x(),await x8(),this.#t)return;if(await this.#T(this.config.modules),this.#t){this.#le();return}this.config.cspNonce&&this.#E(),this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#p||(this.#p=this.#r.subscribe(i=>{this.#be(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#u=o,this.#L(),this.#S(),this.#we(),this.#_()}#_(){if(this.#M(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#u)}#S(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new kD({Renderer:YF,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#h("requiredNumberOfEditors").documents.filter(e=>e.type===Or).length}get ui(){return this.#d||(this.#d=tH({superdoc:this}),this.#t&&this.#d.destroy()),this.#d}get state(){return{documents:this.#h("state").documents,users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#E(){const e=this.config.cspNonce,t=document.createElement;document.createElement=function(n){const r=t.call(this,n);return n.toLowerCase()==="style"&&r.setAttribute("nonce",e),r}}#x(){const e=this.config.document,t=!!e&&typeof e=="object"&&Object.keys(e)?.length,n=!!e&&typeof e=="string"&&e.length>0,r=!!e&&typeof File=="function"&&e instanceof File,o=!!e&&e instanceof Blob&&!(e instanceof File),i=this.config.documents&&this.config.documents?.length;if(t&&i&&console.warn("πŸ¦‹ [superdoc] You can only provide one of document or documents"),t){const s=Yd(this.config.document);this.config.documents=[{id:as(),...s}]}else if(n)this.config.documents=[{id:as(),type:Or,url:this.config.document,name:"document.docx"}];else if(r){const s=Yd(this.config.document);this.config.documents=[{id:as(),...s}]}else if(o){const s=Yd(this.config.document);this.config.documents=[{id:as(),...s}]}Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(s=>{const a=Yd(s);if(!a||typeof a!="object")return a;const l=typeof a=="object"&&"id"in a&&a.id||s&&typeof s=="object"&&"id"in s&&s.id;return{...a,id:l||as()}}))}#M(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=fD({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#o),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&h8(this),this.#ae()}#c(e,t){t&&this.on(e,t)}#L(){this.#c("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#c("editorCreate",this.config.onEditorCreate),this.#c("editorDestroy",this.config.onEditorDestroy),this.#c("source:complete",this.config.onSourceComplete),this.#c("source:signals-complete",this.config.onSourceSignalsComplete),this.#c("ready",this.config.onReady),this.#c("comments-update",this.config.onCommentsUpdate),this.#c("content-control:active-change",this.config.onContentControlActiveChange),this.#c("content-control:click",this.config.onContentControlClick),this.#c("awareness-update",this.config.onAwarenessUpdate),this.#c("locked",this.config.onLocked),this.#c("pdf:document-ready",this.config.onPdfDocumentReady),this.#c("sidebar-toggle",this.config.onSidebarToggle),this.#c("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#U(e?.editor??null)),this.#c("editor-update",this.config.onEditorUpdate),this.on("content-error",this.onContentError),this.#c("exception",this.config.onException),this.#c("list-definitions-change",this.config.onListDefinitionsChange),this.#c("pagination-update",this.config.onPaginationUpdate),this.#c("fonts-resolved",this.config.onFontsResolved),this.#c("fonts-changed",this.config.onFontsChanged),this.#c("zoomChange",this.config.onZoomChange),this.#c("viewport-change",this.config.onViewportChange)}async#T({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:as(),type:Or,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#P(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Wr(e),this.provider=Wr(t),this.#W();const n=this.config;this._cleanupAwareness=l8(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#k(){this.#a=null,this.#g(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#g(){if(this.#i){try{this.#i()}catch{}this.#i=null}if(this.#s){try{this.#s()}catch{}this.#s=null}}#U(e){this.#g(),Zo(e)&&(this.#G(e),this.#D(e))}#G(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=wD(()=>this.user),r=o=>{if(this.#t)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#i=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#D(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#t||this.#C(!!r.isLocked,this.#O(r.lockedBy??null))};try{if(this.#a&&typeof t.setLocked=="function"){const o=this.#a;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#a=null}const r=t.getSnapshot?.();r&&n(r),this.#s=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#O(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#F(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#C(e,t){this.isLocked===e&&this.#F(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#b("πŸ¦‹ [superdoc] Locking superdoc:",e,t,`
103
+
104
+
105
+ `),this.emit("locked",{isLocked:e,lockedBy:t}))}#W(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:cH,n=e.id||e.email||e.name||"";let r=5381;for(let o=0;o<n.length;o++)r=(r<<5)+r^n.charCodeAt(o);e.color=t[Math.abs(r)%t.length]}async upgradeToCollaboration(e){const{target:t,mountedDocumentId:n}=this.#he(e);this.#n=!0;try{const r=await this.#de(),o=this.#v(),i=this.#K();this.#N();let s=null;try{this.#a=i,s=this.#fe(n);const a=this.#ce(t,r);await s,this.#ue(a,t),this.#a=null}catch(a){if(s&&this.#e){const l=this.#e;this.#e=null,l(),await s.catch(()=>{})}throw this.#A(o),a}}finally{this.#e=null,this.#n=!1}}#K(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#v(){const e=this.config.documents.find(r=>r.type===Or),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?mn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#X(n),storeData:t?.data}}#A(e){this.#a=null;const t=this.config.documents.find(n=>n.type===Or);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#I(e.storeDoc,e.storeV2Collaboration),this.#B(e.storeDoc))}#N(){if(this.#t)throw new Error("SuperDoc: instance was destroyed during upgrade")}#h(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.superdocStore}#q(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#R(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Y(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=mn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#X(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#I(e,t){const n=mn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#B(e){const t=mn(e).editorMountNonce;if(t&&typeof t=="object"&&"value"in t&&typeof t.value=="number"){t.value+=1;return}const n=e;n.editorMountNonce=(typeof n.editorMountNonce=="number"?n.editorMountNonce:0)+1}#z(e){return e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}#ce(e,t){const n=this.config.documents.find(i=>i.type===Or),r=this.#h("upgradeToCollaboration").documents.find(i=>i.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=this.#z({...e,roomMode:"create"});return n.data=t,n.v2Collaboration=o,r.data=t,this.#I(r,o),this.isCollaborative=!0,this.readyEditors=0,this.#B(r),{configDoc:n,storeDoc:r}}#ue(e,t){const n=this.#z({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#I(e.storeDoc,n)}async#de(){const e=this.activeEditor;if(Zo(e)&&typeof e.save=="function"){const r=await e.save();return this.#Z(r)}const t=this.config.documents.find(r=>r.type===Or),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(n instanceof Uint8Array||n instanceof ArrayBuffer)return this.#Z(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#Z(e){if(e instanceof Blob)return e;if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),new Blob([t],{type:Or})}if(e instanceof ArrayBuffer)return new Blob([e],{type:Or});throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#$(e,t){const n=gb(e),r=(n?this.config.documents.find(a=>a.id===n):null)??this.config.documents.find(a=>a.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document");if(!r)return;const o=this.#Z(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,i&&this.#I(s,i))}#ke(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#Ae(){this.#k(),this.#Y(null,null)}#Ie(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing β€” collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#e=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#fe(e){return new Promise((n,r)=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(a),this.off("collaboration-ready",s))},s=l=>{const u=l?.editor;Zo(u)&&gb(u)===e&&(!u.presence&&!u.lock||(i(),n()))},a=setTimeout(()=>{i(),r(new Error(`SuperDoc: v2 collaboration runtime did not become ready within 20000 ms for mounted document "${e}".`))},2e4);this.on("collaboration-ready",s),this.#e=()=>{i(),r(new Error("SuperDoc: instance was destroyed during upgrade"))}})}#Ee(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=dH(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#e=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#he(e){if(this.#t)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#n)throw new Error("SuperDoc: upgrade already in progress");if(this.isCollaborative)throw new Error("SuperDoc: instance is already collaborative");const t=this.config,n=t.documents.filter(l=>l.type===Or);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!Zo(this.#me()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0],o=r.id;if(typeof o!="string"||o.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");const i=t.modules?.collaboration,s=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:i?{...i}:null,a=YS({v2Collaboration:e.v2Collaboration??this.#pe(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,legacyCollaboration:s,documentType:Or,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!a.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${a.reason}: ${a.message}`);return{target:a.target,mountedDocumentId:o}}#pe(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#me(){const e=this.config.documents.find(n=>n.type===Or),t=this.#h("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created β€” wait for the ready event before upgrading");return t}addSharedUser(e){this.#R("addSharedUser");const t=Qc({actor:e});t&&this.users.some(n=>Qc({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#R("removeSharedUser");const t=typeof e=="string"?Xv(e):"",n=typeof e=="string"?`email:${t}`:Qc({actor:e});this.users=this.users.filter(r=>{const o=Qc({actor:r});return n?o!==n:t?Xv(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#h("onContentError").documents.find(i=>i.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"";this.config.onContentError?.({error:e,editor:t,documentId:o,file:r?.data})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:R4(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#ge(e),this.emit("editorCreate",{editor:R4(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#ee=new WeakSet;#ge(e){if(!e||typeof e.on!="function"||this.#ee.has(e))return;this.#ee.add(e),e.on("fonts-changed",n=>{this.#te(e)&&this.#V(n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#te(e)&&this.#V(t)}#te(e){return!this.activeEditor||e===this.activeEditor}#ne=null;#V(e){this.#ne=e,this.emit("fonts-changed",e)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#ve(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is a legacy ProseMirror concept and is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`; legacy ProseMirror extensions (Node.create, Mark.create, addPmPlugins, custom schema) do not run in v2.")}#b(...e){(console.debug?console.debug:console.log)("πŸ¦‹ πŸ¦Έβ€β™€οΈ [superdoc]",...e)}#Q=null;get fonts(){return this.#Q||(this.#Q={getReport:()=>Xi(this.activeEditor)?.getReport()??[],getMissingFonts:()=>Xi(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>Xi(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>Xi(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>Xi(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?Xi(t)?.getLastFontsChangedPayload?.()??null:this.#ne??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{const t=Xi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=Xi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=Xi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=Xi(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#Q}#H(){const e=this.activeEditor!==null;this.#re(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#j=null;#re(){if(this.#j){try{this.#j()}catch{}this.#j=null}}#ye(e){this.#re();const t=Xi(e);if(!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#V(n),this.#j=t.onChanged(r=>this.#V(r))}#be(e,t){this.#y=!0;try{if(e===null){this.#H();return}this.#r.get(e)?.kind==="v2"&&Zo(t)?this.#oe(t):this.#H()}finally{this.#y=!1}}#oe(e){if(Zo(e)){!this.#y&&this.#r.getActive()&&this.#r.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#ye(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#H()}setActiveEditor(e){this.#oe(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"not-shipped",reason:"bulk-tracked-change-decisions-omitted: acceptAll/rejectAll are matrix-disabled by default in the v2 host"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() β†’ re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() β†’ re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc y-websocket collaboration is wired through document.v2Collaboration, including collaboration-ready, awareness-update, and locked event bridges; arbitrary external { ydoc, provider } adapters remain unsupported"},{feature:"shell.context-menu",status:"not-shipped",reason:"context-menu-omitted: public v2 shell disables the legacy context menu"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#r.register(e)}unregisterEditorRuntime(e){return this.#r.unregister(e)}getActiveRuntime(){return this.#r.getActive()}setActiveRuntime(e,t){this.#r.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#r.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#r.resolveFromEventTarget(e);return n?(this.#r.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#h("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return ca(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#we(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#l.toolbar;this.toolbarElement=n.container??void 0;const r=this.config.ui,o=typeof r=="object"&&r!==null&&r.toolbar!==void 0;if(!(n.enabled&&(n.container||e===!0||e!=null&&typeof e=="object"||o))){this.toolbar=null;return}try{this.toolbar=$z({...t,...n.options,selector:this.toolbarElement,superdoc:this,editor:this.activeEditor,role:this.config.role,isDev:this.isDev,documentMode:this.config.documentMode,groups:n.options.groups,toolbarGroups:n.options.toolbarGroups,icons:n.options.icons,texts:n.options.texts,uiDisplayFallbackFont:this.config.uiDisplayFallbackFont})}catch(i){console.warn("[SuperDoc] built-in toolbar mount failed",i),this.toolbar=null}}addCommentsList(e){!this.config?.modules?.comments||this.config.role==="viewer"||(e&&(this.config.modules.comments.element=e),this.commentsList=new KR(this.config.modules?.comments,this),this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!0}))}removeCommentsList(){this.commentsList&&(this.commentsList.close(),this.commentsList=null,this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!1}))}scrollToComment(e,t={}){if(!this.config?.modules?.comments||!e||typeof e!="string")return!1;const n=this.element||document,r=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"'),o=n.querySelector(`[data-comment-ids*="${r}"]`);if(!o)return!1;const{behavior:i="smooth",block:s="start"}=t??{};return o.scrollIntoView({behavior:i,block:s}),this.commentsStore?.setActiveComment?.(this,e),!0}async navigateTo(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.navigateTo?n.navigateTo(e):!1}async scrollToElement(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.scrollToElement?n.scrollToElement(e):!1}setDisableContextMenu(e=!0){if(!e&&this.#l.contextMenu.suppressed)return;const t=!!e;this.config.disableContextMenu!==t&&(this.config.disableContextMenu=t,this.superdocStore?.documents?.forEach(n=>{const r=n.getDocumentRuntime?.();r?.setContextMenuDisabled&&r.setContextMenuDisabled(t);const o=n.getEditor?.();o?.setOptions&&o.setOptions({disableContextMenu:t})}))}setShowBookmarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showBookmarks!==t&&(n.showBookmarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowBookmarks?.(t)}))}setShowFormattingMarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showFormattingMarks!==t&&(n.showFormattingMarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowFormattingMarks?.(t)}),this.emit("formatting-marks-change",{showFormattingMarks:t,superdoc:this}),this.toolbar?.updateToolbarState?.())}toggleFormattingMarks(){const e=!!this.config.layoutEngineOptions?.showFormattingMarks;this.setShowFormattingMarks(!e)}setDocumentMode(e){if(!e)return;this.#R("setDocumentMode"),e=e.toLowerCase(),this.config.documentMode=e,this.#ae();const t={viewing:()=>this.#se(),editing:()=>this.#Ce(),suggesting:()=>this.#ie()};t[e]&&(t[e](),this.emit("document-mode-change",{documentMode:e}))}#J(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#r.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{const r=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;r?.setTrackedChangesOverrides&&r.setTrackedChangesOverrides(t)})}#Ce(){if(this.config.role!=="editor")return this.#ie();const e=this.#h("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"editing")})}#ie(){if(!["editor","suggester"].includes(this.config.role??""))return this.#se();const e=this.#h("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"suggesting")})}#se(){const e=this.#h("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const t=this.config.comments?.visible===!0,n=this.config.trackChanges?.visible===!0;this.setTrackedChangesPreferences(n?{mode:"review",enabled:!0}:{mode:"original",enabled:!0}),!t&&!n&&this.commentsStore?.clearEditorCommentPositions?.(),e.documents.forEach(r=>{t||n?r.restoreComments?.():r.removeComments?.(),this.#J(r,"viewing")})}#ae(){const e=this.config.comments?.visible===!0,t=this.config.trackChanges?.visible===!0,n=this.config.documentMode==="viewing",r=e||t;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:e,trackChangesVisible:t});const o=this.superdocStore?.documents;Array.isArray(o)&&o.length>0&&o.forEach(i=>{const s=typeof i.getDocumentRuntime=="function"?i.getDocumentRuntime():null;s?.setViewingCommentOptions&&s.setViewingCommentOptions({emitCommentPositionsInViewing:n&&r,enableCommentsInViewing:n&&e})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}this.superdocStore.zoomMode!==e&&(this.superdocStore.zoomMode=e,this.emit("zoomChange",{zoom:this.getZoom(),mode:e}))}getZoomState(){const e=I_(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(Zo(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#C(!!n.isLocked,this.#O(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#C(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#h("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#C(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){const l=vk(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),c=[...r],d=[...o];if(e.includes("docx")&&u.forEach(m=>{c.push(m),d.push(`${l}.docx`)}),c.length===1)return s?gk(c[0],l,e[0]):c[0];const h=await uH(c,d);return s?gk(h,l,"zip"):h}async replaceFile(e){const t=this.activeEditor;if(Zo(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null;return(o===null||o==="review-ready"||o==="editing-ready")&&(this.#$(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}const n=t&&!Zo(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0;return(o==null||o==="review-ready"||o==="editing-ready")&&(this.#$(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=this.#h("exportEditorsToDOCX").documents.map(async c=>{if(!c||c.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const d=typeof c.getEditor=="function"?c.getEditor():null,h=()=>!c.data||c.data.type&&c.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:c.data;if(!d||typeof d.exportDocx!="function")return h();const m=d.editorVersion===2;try{const p=await d.exportDocx(m?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(p)return p}catch(p){if((!p||typeof p!="object"||!a.has(p))&&this.emit("exception",{error:p,document:c}),m&&(e==="clean"||fH(p)))throw p}return h()});return(await Promise.all(u)).filter(c=>c!=null)}finally{this.off("exception",l)}}async#_e(){this.#b("πŸ¦‹ [superdoc] Triggering collaboration saves");const e=this.#h("save");return new Promise(t=>{e.documents.forEach((n,r)=>{if(this.#b(`Before reset - Doc ${r}: pending = ${this.pendingCollaborationSaves}`),this.pendingCollaborationSaves=0,n.ydoc){this.pendingCollaborationSaves++,this.#b(`After increment - Doc ${r}: pending = ${this.pendingCollaborationSaves}`);const o=n.ydoc.getMap("meta");o.observe(i=>{i.changes.keys.has("immediate-save-finished")&&(this.pendingCollaborationSaves--,this.pendingCollaborationSaves<=0&&t())}),o.set("immediate-save",!0)}}),this.#b(`FINAL pending = ${this.pendingCollaborationSaves}, but we have ${e.documents.filter(n=>n.ydoc).length} docs!`)})}async save(){const e=[this.#_e()];this.#b("πŸ¦‹ [superdoc] Saving superdoc"),await Promise.all(e),this.#b("πŸ¦‹ [superdoc] Save complete")}#Se(e,t){const n=e.provider;n&&n!==this.provider&&!t.some(o=>o.provider===n)&&(n.disconnect?.(),n.destroy?.());const r=e.ydoc;r&&r!==this.ydoc&&!t.some(o=>o.ydoc===r)&&r.destroy?.()}#le(){this.#a=null,this.#g(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.(),e.documents.forEach(t=>{t.provider?.disconnect?.(),t.provider?.destroy?.(),t.ydoc?.destroy()})}openSurface(e){return this.#o.open(e)}closeSurface(e){this.#o.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#h("removeDocument"),r=this.activeEditor,o=gb(r);for(const s of this.#r.getAllByDocumentId(t))this.#r.unregister(s.id);o===t&&r!==null&&this.#H();const i=n.removeDocument(t);return i?(this.#Se(i,n.documents),await _t(),!0):!1}destroy(){this.#t=!0,this.#e&&(this.#e(),this.#e=null),this.#o&&this.#o.destroy(),this.toolbar?.destroy?.(),this.app&&(this.#b("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#d?.destroy(),this.#le(),this.#p?.(),this.#p=null,this.#r.clear(),this.#u&&(this.#u.remove(),this.#u=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?Zo(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#h("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Zo(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};xt();const xA="__SUPERDOC_V2_BROWSER_RUNTIME__";function pH(e=globalThis){const t=e[xA];return t&&typeof t=="object"?t:null}function mH(e={},t=globalThis){const n=pH(t)??{},r={...n,...e,vue:e.vue??n.vue??f6};return t[xA]=r,r}mH();var gH={action:"--sd-ui-action",actionHover:"--sd-ui-action-hover",actionText:"--sd-ui-action-text",bg:"--sd-ui-bg",hoverBg:"--sd-ui-hover-bg",activeBg:"--sd-ui-active-bg",disabledBg:"--sd-ui-disabled-bg",text:"--sd-ui-text",textMuted:"--sd-ui-text-muted",textDisabled:"--sd-ui-text-disabled",border:"--sd-ui-border"},vH=0;function TA(e){const{name:t,font:n,radius:r,shadow:o,colors:i,vars:s}=e,a=`sd-theme-${(t?t.replace(/[^a-zA-Z0-9-_]/g,"-"):null)||`custom-${++vH}`}`,l=[];if(i)for(const[u,c]of Object.entries(i)){if(c==null)continue;const d=gH[u];d&&l.push(` ${d}: ${c};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,c]of Object.entries(s))c!=null&&l.push(` ${u}: ${c};`);return{className:a,css:l.length>0?`.${a} {
106
+ ${l.join(`
107
+ `)}
108
+ }`:""}}function yH(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function bH(e){const{className:t,css:n}=TA(e);return yH(t,n),t}function wH(e){return TA(e)}function CH(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var _H=nd({BlankDOCX:()=>i_,DOCX:()=>Or,HTML:()=>ep,PDF:()=>Ql,SuperDoc:()=>Cm,buildTheme:()=>wH,compareVersions:()=>w6,createTheme:()=>bH,defineSuperDocExtension:()=>CH,getFileObject:()=>Zv},1),SH="SUPERDOC_ENGINE_CDN_BASE_URL",RA=Symbol.for("superdoc.docx-engine.cdn-load-state"),_m="superdocDocxEngineStatus";function kH(e,t,n=null){const r=e?.[SH],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return AH(o);if(!t)throw new Error("SuperDoc: the CDN build is missing its exact DOCX Engine version");return`https://cdn.jsdelivr.net/npm/@superdoc/docx-engine@${t}`}function AH(e){const t=e.trim().replace(/\/+$/,""),n=t.match(/^([a-z][a-z\d+.-]*):/iu)?.[1]?.toLowerCase();if(n&&n!=="http"&&n!=="https")throw new TypeError(`SuperDoc: unsupported DOCX Engine CDN URL scheme ${n}:`);return t}function IH({engineVersion:e,buildBaseUrl:t}){I8(()=>{const n=kH(globalThis,e,t),r=globalThis[RA],o=r instanceof Map?r:new Map;if(globalThis[RA]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),EH(`${n}/dist-cdn/style.css`)]).then(([s])=>s);o.set(n,i),i.catch(()=>{o.get(n)===i&&o.delete(n)})}return o.get(n)})}function EH(e){if(typeof document>"u")return Promise.resolve();const t=new URL(e,document.baseURI).href,n=Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).find(o=>o.href===t);if(n?.sheet||n?.dataset[_m]==="loaded")return Promise.resolve();const r=n?.dataset[_m]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(m,p)=>{a||(a=!0,l?.disconnect(),s.dataset[_m]=m,p())},c=()=>u("loaded",o),d=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),h=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",c,{once:!0}),s.addEventListener("error",d,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(h),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[_m]="loading",document.head.appendChild(s))})}IH({engineVersion:"0.3.0-next.1",buildBaseUrl:null});for(const[e,t]of Object.entries(_H))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(Cm,e)||(Cm[e]=t);var xH=Cm;return xH})();