@blocknote/core 0.13.2 → 0.13.4

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 (163) hide show
  1. package/dist/blocknote.js +5730 -2891
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +7 -7
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +2 -2
  8. package/src/api/exporters/html/__snapshots__/file/basic/external.html +1 -0
  9. package/src/api/exporters/html/__snapshots__/file/basic/internal.html +1 -0
  10. package/src/api/exporters/html/__snapshots__/file/button/external.html +1 -0
  11. package/src/api/exporters/html/__snapshots__/file/button/internal.html +1 -0
  12. package/src/api/exporters/html/__snapshots__/file/nested/external.html +1 -0
  13. package/src/api/exporters/html/__snapshots__/file/nested/internal.html +1 -0
  14. package/src/api/exporters/html/__snapshots__/file/noCaption/external.html +1 -0
  15. package/src/api/exporters/html/__snapshots__/file/noCaption/internal.html +1 -0
  16. package/src/api/exporters/html/__snapshots__/file/noName/external.html +1 -0
  17. package/src/api/exporters/html/__snapshots__/file/noName/internal.html +1 -0
  18. package/src/api/exporters/html/__snapshots__/image/basic/external.html +1 -1
  19. package/src/api/exporters/html/__snapshots__/image/basic/internal.html +1 -1
  20. package/src/api/exporters/html/__snapshots__/image/button/external.html +1 -1
  21. package/src/api/exporters/html/__snapshots__/image/button/internal.html +1 -1
  22. package/src/api/exporters/html/__snapshots__/image/nested/external.html +1 -1
  23. package/src/api/exporters/html/__snapshots__/image/nested/internal.html +1 -1
  24. package/src/api/exporters/html/__snapshots__/image/noCaption/external.html +1 -0
  25. package/src/api/exporters/html/__snapshots__/image/noCaption/internal.html +1 -0
  26. package/src/api/exporters/html/__snapshots__/image/noName/external.html +1 -0
  27. package/src/api/exporters/html/__snapshots__/image/noName/internal.html +1 -0
  28. package/src/api/exporters/html/__snapshots__/image/noPreview/external.html +1 -0
  29. package/src/api/exporters/html/__snapshots__/image/noPreview/internal.html +1 -0
  30. package/src/api/exporters/html/__snapshots__/lists/basic/external.html +1 -0
  31. package/src/api/exporters/html/__snapshots__/lists/basic/internal.html +1 -0
  32. package/src/api/exporters/html/__snapshots__/lists/nested/external.html +1 -0
  33. package/src/api/exporters/html/__snapshots__/lists/nested/internal.html +1 -0
  34. package/src/api/exporters/html/__snapshots__/simpleFile/basic/external.html +1 -0
  35. package/src/api/exporters/html/__snapshots__/simpleFile/basic/internal.html +1 -0
  36. package/src/api/exporters/html/__snapshots__/simpleFile/button/external.html +1 -0
  37. package/src/api/exporters/html/__snapshots__/simpleFile/button/internal.html +1 -0
  38. package/src/api/exporters/html/__snapshots__/simpleFile/nested/external.html +1 -0
  39. package/src/api/exporters/html/__snapshots__/simpleFile/nested/internal.html +1 -0
  40. package/src/api/exporters/html/__snapshots__/simpleImage/basic/external.html +1 -1
  41. package/src/api/exporters/html/__snapshots__/simpleImage/basic/internal.html +1 -1
  42. package/src/api/exporters/html/__snapshots__/simpleImage/button/external.html +1 -1
  43. package/src/api/exporters/html/__snapshots__/simpleImage/button/internal.html +1 -1
  44. package/src/api/exporters/html/__snapshots__/simpleImage/nested/external.html +1 -1
  45. package/src/api/exporters/html/__snapshots__/simpleImage/nested/internal.html +1 -1
  46. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/external.html +1 -0
  47. package/src/api/exporters/html/__snapshots__/simpleImage/noCaption/internal.html +1 -0
  48. package/src/api/exporters/html/__snapshots__/simpleImage/noName/external.html +1 -0
  49. package/src/api/exporters/html/__snapshots__/simpleImage/noName/internal.html +1 -0
  50. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/external.html +1 -0
  51. package/src/api/exporters/html/__snapshots__/simpleImage/noPreview/internal.html +1 -0
  52. package/src/api/exporters/html/externalHTMLExporter.ts +4 -3
  53. package/src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts +1 -1
  54. package/src/api/exporters/markdown/__snapshots__/file/basic/markdown.md +3 -0
  55. package/src/api/exporters/markdown/__snapshots__/file/button/markdown.md +1 -0
  56. package/src/api/exporters/markdown/__snapshots__/file/nested/markdown.md +7 -0
  57. package/src/api/exporters/markdown/__snapshots__/file/noCaption/markdown.md +1 -0
  58. package/src/api/exporters/markdown/__snapshots__/file/noName/markdown.md +3 -0
  59. package/src/api/exporters/markdown/__snapshots__/image/basic/markdown.md +1 -1
  60. package/src/api/exporters/markdown/__snapshots__/image/button/markdown.md +1 -1
  61. package/src/api/exporters/markdown/__snapshots__/image/nested/markdown.md +2 -2
  62. package/src/api/exporters/markdown/__snapshots__/image/noCaption/markdown.md +1 -0
  63. package/src/api/exporters/markdown/__snapshots__/image/noName/markdown.md +3 -0
  64. package/src/api/exporters/markdown/__snapshots__/image/noPreview/markdown.md +3 -0
  65. package/src/api/exporters/markdown/__snapshots__/lists/basic/markdown.md +8 -0
  66. package/src/api/exporters/markdown/__snapshots__/lists/nested/markdown.md +10 -0
  67. package/src/api/exporters/markdown/__snapshots__/simpleFile/basic/markdown.md +3 -0
  68. package/src/api/exporters/markdown/__snapshots__/simpleFile/button/markdown.md +1 -0
  69. package/src/api/exporters/markdown/__snapshots__/simpleFile/nested/markdown.md +7 -0
  70. package/src/api/exporters/markdown/__snapshots__/simpleImage/basic/markdown.md +3 -1
  71. package/src/api/exporters/markdown/__snapshots__/simpleImage/button/markdown.md +1 -0
  72. package/src/api/exporters/markdown/__snapshots__/simpleImage/nested/markdown.md +6 -2
  73. package/src/api/exporters/markdown/__snapshots__/simpleImage/noCaption/markdown.md +1 -0
  74. package/src/api/exporters/markdown/__snapshots__/simpleImage/noName/markdown.md +3 -0
  75. package/src/api/exporters/markdown/__snapshots__/simpleImage/noPreview/markdown.md +3 -0
  76. package/src/api/exporters/markdown/markdownExporter.ts +2 -0
  77. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +42 -0
  78. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +262 -4
  79. package/src/api/parsers/html/__snapshots__/paste/list-test.json +74 -2
  80. package/src/api/parsers/html/__snapshots__/paste/parse-basic-block-types.json +3 -1
  81. package/src/api/parsers/html/__snapshots__/paste/parse-fake-image-caption.json +3 -1
  82. package/src/api/parsers/html/__snapshots__/paste/parse-mixed-nested-lists.json +135 -10
  83. package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists-with-paragraphs.json +132 -7
  84. package/src/api/parsers/html/__snapshots__/paste/parse-nested-lists.json +111 -3
  85. package/src/api/parsers/html/parseHTML.test.ts +166 -95
  86. package/src/api/testUtil/cases/customBlocks.ts +82 -33
  87. package/src/api/testUtil/cases/customInlineContent.ts +1 -1
  88. package/src/api/testUtil/cases/customStyles.ts +1 -1
  89. package/src/api/testUtil/cases/defaultSchema.ts +185 -4
  90. package/src/blocks/AudioBlockContent/AudioBlockContent.ts +163 -0
  91. package/src/blocks/AudioBlockContent/audioBlockHelpers.ts +5 -0
  92. package/src/blocks/FileBlockContent/FileBlockContent.ts +120 -0
  93. package/src/blocks/FileBlockContent/fileBlockHelpers.ts +377 -0
  94. package/src/blocks/ImageBlockContent/ImageBlockContent.ts +134 -354
  95. package/src/blocks/ImageBlockContent/imageBlockHelpers.ts +6 -0
  96. package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +3 -0
  97. package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +266 -0
  98. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +2 -1
  99. package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +1 -0
  100. package/src/blocks/VideoBlockContent/VideoBlockContent.ts +181 -0
  101. package/src/blocks/VideoBlockContent/videoBlockHelpers.ts +6 -0
  102. package/src/blocks/defaultBlockTypeGuards.ts +53 -1
  103. package/src/blocks/defaultBlocks.ts +11 -2
  104. package/src/editor/Block.css +89 -27
  105. package/src/editor/BlockNoteEditor.ts +24 -10
  106. package/src/editor/BlockNoteSchema.ts +12 -3
  107. package/src/editor/transformPasted.ts +2 -1
  108. package/src/extensions/{ImagePanel/ImageToolbarPlugin.ts → FilePanel/FilePanelPlugin.ts} +22 -25
  109. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +14 -2
  110. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +72 -2
  111. package/src/extensions/TableHandles/TableHandlesPlugin.ts +27 -27
  112. package/src/extensions/TextAlignment/TextAlignmentExtension.ts +7 -1
  113. package/src/i18n/locales/en.ts +117 -11
  114. package/src/i18n/locales/fr.ts +118 -11
  115. package/src/i18n/locales/index.ts +8 -2
  116. package/src/i18n/locales/is.ts +295 -0
  117. package/src/i18n/locales/ja.ts +323 -0
  118. package/src/i18n/locales/ko.ts +307 -0
  119. package/src/i18n/locales/nl.ts +108 -8
  120. package/src/i18n/locales/pl.ts +287 -0
  121. package/src/i18n/locales/pt.ts +295 -0
  122. package/src/i18n/locales/vi.ts +295 -0
  123. package/src/i18n/locales/zh.ts +123 -8
  124. package/src/index.ts +9 -2
  125. package/src/pm-nodes/BlockContainer.ts +18 -6
  126. package/src/schema/blocks/createSpec.ts +1 -0
  127. package/src/schema/blocks/internal.ts +10 -0
  128. package/src/schema/blocks/types.ts +40 -5
  129. package/src/util/string.ts +12 -0
  130. package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +7 -0
  131. package/types/src/api/testUtil/cases/customBlocks.d.ts +272 -54
  132. package/types/src/api/testUtil/cases/customInlineContent.d.ts +222 -16
  133. package/types/src/api/testUtil/cases/customStyles.d.ts +222 -16
  134. package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +101 -0
  135. package/types/src/blocks/AudioBlockContent/audioBlockHelpers.d.ts +3 -0
  136. package/types/src/blocks/FileBlockContent/FileBlockContent.d.ts +93 -0
  137. package/types/src/blocks/FileBlockContent/fileBlockHelpers.d.ts +30 -0
  138. package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +50 -14
  139. package/types/src/blocks/ImageBlockContent/imageBlockHelpers.d.ts +4 -0
  140. package/types/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.d.ts +55 -0
  141. package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +129 -0
  142. package/types/src/blocks/VideoBlockContent/videoBlockHelpers.d.ts +4 -0
  143. package/types/src/blocks/defaultBlockTypeGuards.d.ts +6 -1
  144. package/types/src/blocks/defaultBlocks.d.ts +444 -32
  145. package/types/src/editor/BlockNoteEditor.d.ts +12 -5
  146. package/types/src/extensions/{ImagePanel/ImageToolbarPlugin.d.ts → FilePanel/FilePanelPlugin.d.ts} +9 -12
  147. package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +1 -1
  148. package/types/src/i18n/locales/en.d.ts +56 -7
  149. package/types/src/i18n/locales/fr.d.ts +2 -184
  150. package/types/src/i18n/locales/index.d.ts +7 -1
  151. package/types/src/i18n/locales/is.d.ts +2 -0
  152. package/types/src/i18n/locales/ja.d.ts +2 -0
  153. package/types/src/i18n/locales/ko.d.ts +2 -0
  154. package/types/src/i18n/locales/pl.d.ts +2 -0
  155. package/types/src/i18n/locales/pt.d.ts +2 -0
  156. package/types/src/i18n/locales/vi.d.ts +2 -0
  157. package/types/src/index.d.ts +8 -2
  158. package/types/src/pm-nodes/BlockContainer.d.ts +1 -1
  159. package/types/src/schema/blocks/internal.d.ts +1 -1
  160. package/types/src/schema/blocks/types.d.ts +25 -1
  161. package/types/src/util/string.d.ts +1 -0
  162. /package/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -0
  163. /package/types/src/blocks/{ImageBlockContent → FileBlockContent}/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- (function(d,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("prosemirror-model"),require("rehype-parse"),require("rehype-stringify"),require("unified"),require("@tiptap/core"),require("prosemirror-state"),require("uuid"),require("hast-util-from-dom"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-strike"),require("@tiptap/extension-underline"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/extension-table-row"),require("prosemirror-tables"),require("rehype-remark"),require("remark-gfm"),require("remark-stringify"),require("remark-parse"),require("remark-rehype"),require("prosemirror-view"),require("@tiptap/extension-collaboration"),require("@tiptap/extension-collaboration-cursor"),require("@tiptap/extension-dropcursor"),require("@tiptap/extension-gapcursor"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-history"),require("@tiptap/extension-link"),require("@tiptap/extension-text")):typeof define=="function"&&define.amd?define(["exports","prosemirror-model","rehype-parse","rehype-stringify","unified","@tiptap/core","prosemirror-state","uuid","hast-util-from-dom","@tiptap/extension-bold","@tiptap/extension-code","@tiptap/extension-italic","@tiptap/extension-strike","@tiptap/extension-underline","@tiptap/extension-table-cell","@tiptap/extension-table-header","@tiptap/extension-table-row","prosemirror-tables","rehype-remark","remark-gfm","remark-stringify","remark-parse","remark-rehype","prosemirror-view","@tiptap/extension-collaboration","@tiptap/extension-collaboration-cursor","@tiptap/extension-dropcursor","@tiptap/extension-gapcursor","@tiptap/extension-hard-break","@tiptap/extension-history","@tiptap/extension-link","@tiptap/extension-text"],y):(d=typeof globalThis<"u"?globalThis:d||self,y(d.blocknote={},d.prosemirrorModel,d.rehypeParse,d.rehypeStringify,d.unified,d.core,d.prosemirrorState,d.uuid,d.hastUtilFromDom,d.Bold,d.Code,d.Italic,d.Strike,d.Underline,d.extensionTableCell,d.extensionTableHeader,d.extensionTableRow,d.prosemirrorTables,d.rehypeRemark,d.remarkGfm,d.remarkStringify,d.remarkParse,d.remarkRehype,d.prosemirrorView,d.Collaboration,d.CollaborationCursor,d.extensionDropcursor,d.extensionGapcursor,d.extensionHardBreak,d.extensionHistory,d.extensionLink,d.extensionText))})(this,function(d,y,V,Dt,ce,b,k,Ot,He,Ut,Rt,zt,Vt,Ft,jt,qt,Gt,De,Kt,$t,Wt,Jt,Oe,_,Xt,Yt,Qt,Zt,en,tn,nn,on){"use strict";var Zo=Object.defineProperty;var ei=(d,y,V)=>y in d?Zo(d,y,{enumerable:!0,configurable:!0,writable:!0,value:V}):d[y]=V;var u=(d,y,V)=>(ei(d,typeof y!="symbol"?y+"":y,V),V);const T=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},Ue=T(V),Re=T(Dt),rn=T(Ut),sn=T(Rt),an=T(zt),ln=T(Vt),cn=T(Ft),dn=T(Kt),ze=T($t),un=T(Wt),pn=T(Jt),hn=T(Oe),mn=T(Xt),fn=T(Yt),Ve={slash_menu:{heading:{title:"Heading 1",subtext:"Used for a top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Used for key sections",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Used for subsections and group headings",aliases:["h3","heading3","subheading"],group:"Headings"},numbered_list:{title:"Numbered List",subtext:"Used to display a numbered list",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"Used to display an unordered list",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"Used for the body of your document",aliases:["p","paragraph"],group:"Basic blocks"},table:{title:"Table",subtext:"Used for for tables",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Insert an image",aliases:["image","imageUpload","upload","img","picture","media","url","drive","dropbox"],group:"Media"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",bulletListItem:"List",numberedListItem:"List"},image:{add_button:"Add Image"},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below"},suggestion_menu:{no_items_title:"No items found",loading:"Loading…"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},image_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},image_replace:{tooltip:"Replace image"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"}},image_panel:{upload:{title:"Upload",file_placeholder:"Upload image",upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:"Embed image",url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},generic:{ctrl_shortcut:"Ctrl"}},gn=Object.freeze(Object.defineProperty({__proto__:null,en:Ve,fr:{slash_menu:{heading:{title:"Titre 1",subtext:"Utilisé pour un titre de premier niveau",aliases:["h","titre1","h1"],group:"Titres"},heading_2:{title:"Titre 2",subtext:"Utilisé pour les sections clés",aliases:["h2","titre2","sous-titre"],group:"Titres"},heading_3:{title:"Titre 3",subtext:"Utilisé pour les sous-sections et les titres de groupe",aliases:["h3","titre3","sous-titre"],group:"Titres"},numbered_list:{title:"Liste Numérotée",subtext:"Utilisé pour afficher une liste numérotée",aliases:["ol","li","liste","listenumérotée","liste numérotée"],group:"Blocs de base"},bullet_list:{title:"Liste à Puces",subtext:"Utilisé pour afficher une liste non ordonnée",aliases:["ul","li","liste","listeàpuces","liste à puces"],group:"Blocs de base"},paragraph:{title:"Paragraphe",subtext:"Utilisé pour le corps de votre document",aliases:["p","paragraphe"],group:"Blocs de base"},table:{title:"Tableau",subtext:"Utilisé pour les tableaux",aliases:["tableau"],group:"Avancé"},image:{title:"Image",subtext:"Insérer une image",aliases:["image","uploadImage","télécharger","img","photo","média","url","drive","dropbox"],group:"Médias"}},placeholders:{default:"Entrez du texte ou tapez '/' pour les commandes",heading:"Titre",bulletListItem:"Liste",numberedListItem:"Liste"},image:{add_button:"Ajouter une Image"},side_menu:{add_block_label:"Ajouter un bloc",drag_handle_label:"Ouvrir le menu du bloc"},drag_handle:{delete_menuitem:"Supprimer",colors_menuitem:"Couleurs"},table_handle:{delete_column_menuitem:"Supprimer la colonne",delete_row_menuitem:"Supprimer la ligne",add_left_menuitem:"Ajouter une colonne à gauche",add_right_menuitem:"Ajouter une colonne à droite",add_above_menuitem:"Ajouter une ligne au-dessus",add_below_menuitem:"Ajouter une ligne en dessous"},suggestion_menu:{no_items_title:"Aucun élément trouvé",loading:"Chargement…"},color_picker:{text_title:"Texte",background_title:"Fond",colors:{default:"Défaut",gray:"Gris",brown:"Marron",red:"Rouge",orange:"Orange",yellow:"Jaune",green:"Vert",blue:"Bleu",purple:"Violet",pink:"Rose"}},formatting_toolbar:{bold:{tooltip:"Gras",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italique",secondary_tooltip:"Mod+I"},underline:{tooltip:"Souligner",secondary_tooltip:"Mod+U"},strike:{tooltip:"Barré",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Couleurs"},link:{tooltip:"Créer un lien",secondary_tooltip:"Mod+K"},image_caption:{tooltip:"Modifier la légende",input_placeholder:"Modifier la légende"},image_replace:{tooltip:"Remplacer l'image"},nest:{tooltip:"Emboîter le bloc",secondary_tooltip:"Tab"},unnest:{tooltip:"Démboîter le bloc",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Aligner le texte à gauche"},align_center:{tooltip:"Aligner le texte au centre"},align_right:{tooltip:"Aligner le texte à droite"},align_justify:{tooltip:"Justifier le texte"}},image_panel:{upload:{title:"Télécharger",file_placeholder:"Télécharger l'image",upload_error:"Erreur : Échec du téléchargement"},embed:{title:"Intégrer",embed_button:"Intégrer l'image",url_placeholder:"Entrez l'URL"}},link_toolbar:{delete:{tooltip:"Supprimer le lien"},edit:{text:"Modifier le lien",tooltip:"Modifier"},open:{tooltip:"Ouvrir dans un nouvel onglet"},form:{title_placeholder:"Modifier le titre",url_placeholder:"Modifier l'URL"}},generic:{ctrl_shortcut:"Ctrl"}},nl:{slash_menu:{heading:{title:"Kop 1",subtext:"Gebruikt voor een hoofdkop",aliases:["h","kop1","h1"],group:"Koppen"},heading_2:{title:"Kop 2",subtext:"Gebruikt voor belangrijke secties",aliases:["h2","kop2","subkop"],group:"Koppen"},heading_3:{title:"Kop 3",subtext:"Gebruikt voor subsecties en groepskoppen",aliases:["h3","kop3","subkop"],group:"Koppen"},numbered_list:{title:"Genummerde Lijst",subtext:"Gebruikt om een genummerde lijst weer te geven",aliases:["ol","li","lijst","genummerdelijst","genummerde lijst"],group:"Basisblokken"},bullet_list:{title:"Puntenlijst",subtext:"Gebruikt om een ongeordende lijst weer te geven",aliases:["ul","li","lijst","puntenlijst","punten lijst"],group:"Basisblokken"},paragraph:{title:"Paragraaf",subtext:"Gebruikt voor de hoofdtekst van uw document",aliases:["p","paragraaf"],group:"Basisblokken"},table:{title:"Tabel",subtext:"Gebruikt voor tabellen",aliases:["tabel"],group:"Geavanceerd"},image:{title:"Afbeelding",subtext:"Voeg een afbeelding in",aliases:["afbeelding","imageUpload","upload","img","foto","media","url","drive","dropbox"],group:"Media"}},placeholders:{default:"Voer tekst in of type '/' voor commando's",heading:"Kop",bulletListItem:"Lijst",numberedListItem:"Lijst"},image:{add_button:"Afbeelding toevoegen"},side_menu:{add_block_label:"Nieuw blok",drag_handle_label:"Open blok menu"},drag_handle:{delete_menuitem:"Verwijder",colors_menuitem:"Kleuren"},table_handle:{delete_column_menuitem:"Verwijder kolom",delete_row_menuitem:"Verwijder rij",add_left_menuitem:"Voeg kolom links toe",add_right_menuitem:"Voeg kolom rechts toe",add_above_menuitem:"Voeg rij boven toe",add_below_menuitem:"Voeg rij onder toe"},suggestion_menu:{no_items_title:"Geen items gevonden",loading:"Laden…"},color_picker:{text_title:"Tekst",background_title:"Achtergrond",colors:{default:"Standaard",gray:"Grijs",brown:"Bruin",red:"Rood",orange:"Oranje",yellow:"Geel",green:"Groen",blue:"Blauw",purple:"Paars",pink:"Roze"}},formatting_toolbar:{bold:{tooltip:"Vet",secondary_tooltip:"Mod+B"},italic:{tooltip:"Cursief",secondary_tooltip:"Mod+I"},underline:{tooltip:"Onderstrepen",secondary_tooltip:"Mod+U"},strike:{tooltip:"Doorstrepen",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Kleuren"},link:{tooltip:"Maak link",secondary_tooltip:"Mod+K"},image_caption:{tooltip:"Bewerk onderschrift",input_placeholder:"Bewerk onderschrift"},image_replace:{tooltip:"Vervang afbeelding"},nest:{tooltip:"Nest blok",secondary_tooltip:"Tab"},unnest:{tooltip:"Ontnest blok",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Tekst links uitlijnen"},align_center:{tooltip:"Tekst centreren"},align_right:{tooltip:"Tekst rechts uitlijnen"},align_justify:{tooltip:"Tekst uitvullen"}},image_panel:{upload:{title:"Upload",file_placeholder:"Upload afbeelding",upload_error:"Fout: Upload mislukt"},embed:{title:"Insluiten",embed_button:"Insluiten afbeelding",url_placeholder:"Voer URL in"}},link_toolbar:{delete:{tooltip:"Verwijder link"},edit:{text:"Bewerk link",tooltip:"Bewerk"},open:{tooltip:"Open in nieuw tabblad"},form:{title_placeholder:"Bewerk titel",url_placeholder:"Bewerk URL"}},generic:{ctrl_shortcut:"Ctrl"}},zh:{slash_menu:{heading:{title:"一级标题",subtext:"用于顶级标题",aliases:["h","heading1","h1","标题","一级标题"],group:"标题"},heading_2:{title:"二级标题",subtext:"用于关键部分",aliases:["h2","heading2","subheading","标题","二级标题","副标题"],group:"标题"},heading_3:{title:"三级标题",subtext:"用于小节和分组标题",aliases:["h3","heading3","subheading","标题","三级标题"],group:"标题"},numbered_list:{title:"有序列表",subtext:"用于显示有序列表",aliases:["ol","li","list","numberedlist","numbered list","列表","有序列表"],group:"基础"},bullet_list:{title:"无序列表",subtext:"用于显示无序列表",aliases:["ul","li","list","bulletlist","bullet list","列表","无序列表"],group:"基础"},paragraph:{title:"段落",subtext:"用于文档正文",aliases:["p","paragraph","text","正文"],group:"基础"},table:{title:"表格",subtext:"使用表格",aliases:["table","表格"],group:"高级功能"},image:{title:"图片",subtext:"插入图片",aliases:["图片","上传图片","上传","image","img","相册","媒体","url"],group:"媒体"}},placeholders:{default:"输入 '/' 以使用命令",heading:"标题",bulletListItem:"列表",numberedListItem:"列表"},image:{add_button:"添加图片"},side_menu:{add_block_label:"添加块",drag_handle_label:"打开菜单"},drag_handle:{delete_menuitem:"删除",colors_menuitem:"颜色"},table_handle:{delete_column_menuitem:"删除列",delete_row_menuitem:"删除行",add_left_menuitem:"左侧添加列",add_right_menuitem:"右侧添加列",add_above_menuitem:"上方添加行",add_below_menuitem:"下方添加行"},suggestion_menu:{no_items_title:"无匹配项",loading:"加载中…"},color_picker:{text_title:"文本",background_title:"背景色",colors:{default:"默认",gray:"灰色",brown:"棕色",red:"红色",orange:"橙色",yellow:"黄色",green:"绿色",blue:"蓝色",purple:"紫色",pink:"粉色"}},formatting_toolbar:{bold:{tooltip:"加粗",secondary_tooltip:"Mod+B"},italic:{tooltip:"斜体",secondary_tooltip:"Mod+I"},underline:{tooltip:"下划线",secondary_tooltip:"Mod+U"},strike:{tooltip:"删除线",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"代码标记",secondary_tooltip:""},colors:{tooltip:"颜色"},link:{tooltip:"添加链接",secondary_tooltip:"Mod+K"},image_caption:{tooltip:"编辑标题",input_placeholder:"编辑标题"},image_replace:{tooltip:"替换图片"},nest:{tooltip:"嵌套",secondary_tooltip:"Tab"},unnest:{tooltip:"取消嵌套",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"左对齐"},align_center:{tooltip:"居中"},align_right:{tooltip:"右对齐"},align_justify:{tooltip:"文本对齐"}},image_panel:{upload:{title:"上传",file_placeholder:"上传图片",upload_error:"Error:上传失败"},embed:{title:"嵌入",embed_button:"嵌入图片",url_placeholder:"输入图片地址"}},link_toolbar:{delete:{tooltip:"清除链接"},edit:{text:"编辑链接",tooltip:"编辑"},open:{tooltip:"新窗口打开"},form:{title_placeholder:"编辑标题",url_placeholder:"编辑链接地址"}},generic:{ctrl_shortcut:"Ctrl"}}},Symbol.toStringTag,{value:"Module"}));function bn(n,e=JSON.stringify){const t={};return n.filter(o=>{const i=e(o);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function kn(n){const e=n.filter((o,i)=>n.indexOf(o)!==i);return bn(e)}const G=b.Extension.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const n=window.__TEST_OPTIONS;return n.mockID===void 0?n.mockID=0:n.mockID++,n.mockID.toString()}return Ot.v4()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:n=>n.getAttribute(`data-${this.options.attributeName}`),renderHTML:n=>({[`data-${this.options.attributeName}`]:n[this.options.attributeName]})}}}]},addProseMirrorPlugins(){let n=null,e=!1;return[new k.Plugin({key:new k.PluginKey("uniqueID"),appendTransaction:(t,o,i)=>{const r=t.some(g=>g.docChanged)&&!o.doc.eq(i.doc),s=this.options.filterTransaction&&t.some(g=>{let S,B;return!(!((B=(S=this.options).filterTransaction)===null||B===void 0)&&B.call(S,g))});if(!r||s)return;const{tr:a}=i,{types:l,attributeName:c,generateID:p}=this.options,h=b.combineTransactionSteps(o.doc,t),{mapping:f}=h;if(b.getChangedRanges(h).forEach(({newRange:g})=>{const S=b.findChildrenInRange(i.doc,g,x=>l.includes(x.type.name)),B=S.map(({node:x})=>x.attrs[c]).filter(x=>x!==null),H=kn(B);S.forEach(({node:x,pos:q})=>{let Y;const ne=(Y=a.doc.nodeAt(q))===null||Y===void 0?void 0:Y.attrs[c];if(ne===null){const Ae=o.doc.type.createAndFill().content;if(o.doc.content.findDiffStart(Ae)===null){const le=JSON.parse(JSON.stringify(i.doc.toJSON()));if(le.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(le.content)===JSON.stringify(Ae.toJSON())){a.setNodeMarkup(q,void 0,{...x.attrs,[c]:"initialBlockId"});return}}a.setNodeMarkup(q,void 0,{...x.attrs,[c]:p()});return}const{deleted:v}=f.invert().mapResult(q);v&&H.includes(ne)&&a.setNodeMarkup(q,void 0,{...x.attrs,[c]:p()})})}),!!a.steps.length)return a},view(t){const o=i=>{let r;n=!((r=t.dom.parentElement)===null||r===void 0)&&r.contains(i.target)?t.dom.parentElement:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(t,o)=>{let i;return(n!==t.dom.parentElement||((i=o.dataTransfer)===null||i===void 0?void 0:i.effectAllowed)==="copy")&&(n=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:t=>{if(!e)return t;const{types:o,attributeName:i}=this.options,r=s=>{const a=[];return s.forEach(l=>{if(l.isText){a.push(l);return}if(!o.includes(l.type.name)){a.push(l.copy(r(l.content)));return}const c=l.type.create({...l.attrs,[i]:null},r(l.content),l.marks);a.push(c)}),y.Fragment.from(a)};return e=!1,new y.Slice(r(t.content),t.openStart,t.openEnd)}}})]}});function Fe(n){const e=n.attrs.id,t=n.firstChild,o=t.type,i=n.childCount===2?n.lastChild.childCount:0;return{id:e,node:n,contentNode:t,contentType:o,numChildBlocks:i}}function w(n,e){const o=n.nodeSize-2;if(e<=1)for(e=1+1;n.resolve(e).parent.type.name!=="blockContainer"&&e<o;)e++;else if(e>=o)for(e=o-1;n.resolve(e).parent.type.name!=="blockContainer"&&e>1;)e--;n.resolve(e).parent.type.name==="blockGroup"&&e++;const i=n.resolve(e),r=i.depth;let s=i.node(r),a=r;for(;;){if(a<0)throw new Error("Could not find blockContainer node. This can only happen if the underlying BlockNote schema has been edited.");if(s.type.name==="blockContainer")break;a-=1,s=i.node(a)}const{id:l,contentNode:c,contentType:p,numChildBlocks:h}=Fe(s),f=i.start(a),m=i.end(a);return{id:l,node:s,contentNode:c,contentType:p,numChildBlocks:h,startPos:f,endPos:m,depth:a}}function de(n){return n.type==="link"}function ue(n){return typeof n!="string"&&n.type==="link"}function K(n){return typeof n!="string"&&n.type==="text"}class I extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function yn(n,e=!0){const{"data-test":t,...o}=n;if(Object.keys(o).length>0&&e)throw new Error("Object must be empty "+JSON.stringify(n))}function je(n,e,t){const o=[];for(const[i,r]of Object.entries(n.styles)){const s=t[i];if(!s)throw new Error(`style ${i} not found in styleSchema`);if(s.propSchema==="boolean")o.push(e.mark(i));else if(s.propSchema==="string")o.push(e.mark(i,{stringValue:r}));else throw new I(s.propSchema)}return n.text.split(/(\n)/g).filter(i=>i.length>0).map(i=>i===`
2
- `?e.nodes.hardBreak.create():e.text(i,o))}function wn(n,e,t){const o=e.marks.link.create({href:n.href});return pe(n.content,e,t).map(i=>{if(i.type.name==="text")return i.mark([...i.marks,o]);if(i.type.name==="hardBreak")return i;throw new Error("unexpected node type")})}function pe(n,e,t){const o=[];if(typeof n=="string")return o.push(...je({type:"text",text:n,styles:{}},e,t)),o;for(const i of n)o.push(...je(i,e,t));return o}function Q(n,e,t){const o=[];for(const i of n)typeof i=="string"?o.push(...pe(i,e,t)):ue(i)?o.push(...wn(i,e,t)):K(i)?o.push(...pe([i],e,t)):o.push(qe(i,e,t));return o}function he(n,e,t){const o=[];for(const i of n.rows){const r=[];for(const a of i.cells){let l;if(!a)l=e.nodes.tableParagraph.create({});else if(typeof a=="string")l=e.nodes.tableParagraph.create({},e.text(a));else{const p=Q(a,e,t);l=e.nodes.tableParagraph.create({},p)}const c=e.nodes.tableCell.create({},l);r.push(c)}const s=e.nodes.tableRow.create({},r);o.push(s)}return o}function qe(n,e,t){let o,i=n.type;if(i===void 0&&(i="paragraph"),!e.nodes[i])throw new Error(`node type ${i} not found in schema`);if(!n.content)o=e.nodes[i].create(n.props);else if(typeof n.content=="string")o=e.nodes[i].create(n.props,e.text(n.content));else if(Array.isArray(n.content)){const r=Q(n.content,e,t);o=e.nodes[i].create(n.props,r)}else if(n.content.type==="tableContent"){const r=he(n.content,e,t);o=e.nodes[i].create(n.props,r)}else throw new I(n.content.type);return o}function P(n,e,t){let o=n.id;o===void 0&&(o=G.options.generateID());const i=qe(n,e,t),r=[];if(n.children)for(const a of n.children)r.push(P(a,e,t));const s=e.nodes.blockGroup.create({},r);return e.nodes.blockContainer.create({id:o,...n.props},r.length>0?[i,s]:i)}function vn(n,e,t){const o={type:"tableContent",rows:[]};return n.content.forEach(i=>{const r={cells:[]};i.content.forEach(s=>{r.cells.push(oe(s.firstChild,e,t))}),o.rows.push(r)}),o}function oe(n,e,t){const o=[];let i;return n.content.forEach(r=>{if(r.type.name==="hardBreak"){if(i)if(K(i))i.text+=`
3
- `;else if(de(i))i.content[i.content.length-1].text+=`
4
- `;else throw new Error("unexpected");else i={type:"text",text:`
5
- `,styles:{}};return}if(r.type.name!=="link"&&r.type.name!=="text"&&e[r.type.name]){i&&(o.push(i),i=void 0),o.push(me(r,e,t));return}const s={};let a;for(const l of r.marks)if(l.type.name==="link")a=l;else{const c=t[l.type.name];if(!c)throw new Error(`style ${l.type.name} not found in styleSchema`);if(c.propSchema==="boolean")s[c.type]=!0;else if(c.propSchema==="string")s[c.type]=l.attrs.stringValue;else throw new I(c.propSchema)}i?K(i)?a?(o.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:r.textContent,styles:s}]}):JSON.stringify(i.styles)===JSON.stringify(s)?i.text+=r.textContent:(o.push(i),i={type:"text",text:r.textContent,styles:s}):de(i)&&(a?i.href===a.attrs.href?JSON.stringify(i.content[i.content.length-1].styles)===JSON.stringify(s)?i.content[i.content.length-1].text+=r.textContent:i.content.push({type:"text",text:r.textContent,styles:s}):(o.push(i),i={type:"link",href:a.attrs.href,content:[{type:"text",text:r.textContent,styles:s}]}):(o.push(i),i={type:"text",text:r.textContent,styles:s})):a?i={type:"link",href:a.attrs.href,content:[{type:"text",text:r.textContent,styles:s}]}:i={type:"text",text:r.textContent,styles:s}}),i&&o.push(i),o}function me(n,e,t){if(n.type.name==="text"||n.type.name==="link")throw new Error("unexpected");const o={},i=e[n.type.name];for(const[a,l]of Object.entries(n.attrs)){if(!i)throw Error("ic node is of an unrecognized type: "+n.type.name);const c=i.propSchema;a in c&&(o[a]=l)}let r;return i.content==="styled"?r=oe(n,e,t):r=void 0,{type:n.type.name,props:o,content:r}}function E(n,e,t,o,i){if(n.type.name!=="blockContainer")throw Error("Node must be of type blockContainer, but is of type"+n.type.name+".");const r=i==null?void 0:i.get(n);if(r)return r;const s=Fe(n);let a=s.id;a===null&&(a=G.options.generateID());const l={};for(const[m,g]of Object.entries({...n.attrs,...s.contentNode.attrs})){const S=e[s.contentType.name];if(!S)throw Error("Block is of an unrecognized type: "+s.contentType.name);const B=S.propSchema;m in B&&(l[m]=g)}const c=e[s.contentType.name],p=[];for(let m=0;m<s.numChildBlocks;m++)p.push(E(n.lastChild.child(m),e,t,o,i));let h;if(c.content==="inline")h=oe(s.contentNode,t,o);else if(c.content==="table")h=vn(s.contentNode,t,o);else if(c.content==="none")h=void 0;else throw new I(c.content);const f={id:a,type:c.type,props:l,content:h,children:p};return i==null||i.set(n,f),f}function Sn(n){return n.document||window.document}const Ge=(n,e,t,o,i)=>{if(!t.nodes[n.type.name])throw new Error("Serializer is missing a node type: "+n.type.name);const{dom:r,contentDOM:s}=y.DOMSerializer.renderSpec(Sn(e),t.nodes[n.type.name](n));if(s){if(n.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");if(n.type.name==="blockContainer"){const a=n.childCount>0&&n.firstChild.type.spec.group==="blockContent"?n.firstChild:void 0,l=n.childCount>0&&n.lastChild.type.spec.group==="blockGroup"?n.lastChild:void 0;if(a!==void 0){const c=o.blockImplementations[a.type.name].implementation,h=(i?c.toExternalHTML:c.toInternalHTML)(E(n,o.schema.blockSchema,o.schema.inlineContentSchema,o.schema.styleSchema,o.blockCache),o);if(h.contentDOM!==void 0){if(n.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");h.contentDOM.appendChild(t.serializeFragment(a.content,e))}s.appendChild(h.dom)}l!==void 0&&t.serializeFragment(y.Fragment.from(l),e,s)}else t.serializeFragment(n.content,e,s)}return r},Ke=(n,e)=>{const t=e.serializeFragment(n),o=document.createElement("div");return o.appendChild(t),o.innerHTML};function En(n){const e=new Set([...n.orderedListItemBlockTypes,...n.unorderedListItemBlockTypes]),t=o=>{var s;if(o.children.length===1&&((s=o.children[0].properties)==null?void 0:s.dataNodeType)==="blockGroup"){const a=o.children[0];o.children.pop(),o.children.push(...a.children)}let i=o.children.length,r;for(let a=0;a<i;a++){const c=o.children[a].children[0],p=c.children[0],h=c.children.length===2?c.children[1]:null,f=e.has(p.properties.dataContentType),m=f?n.orderedListItemBlockTypes.has(p.properties.dataContentType)?"ol":"ul":null;if(h!==null&&t(h),r&&r.tagName!==m){o.children.splice(a-r.children.length,r.children.length,r);const g=r.children.length-1;a-=g,i-=g,r=void 0}if(f){r||(r=He.fromDom(document.createElement(m)));const g=He.fromDom(document.createElement("li"));g.children.push(p.children[0]),h!==null&&g.children.push(...h.children),r.children.push(g)}else if(h!==null){o.children.splice(a+1,0,...h.children),o.children[a]=p.children[0];const g=h.children.length;a+=g,i+=g}else o.children[a]=p.children[0]}r&&o.children.splice(i-r.children.length,r.children.length,r)};return t}const Z=(n,e)=>{const t=y.DOMSerializer.fromSchema(n);return t.serializeNodeInner=(o,i)=>Ge(o,i,t,e,!0),t.exportProseMirrorFragment=o=>ce.unified().use(Ue.default,{fragment:!0}).use(En,{orderedListItemBlockTypes:new Set(["numberedListItem"]),unorderedListItemBlockTypes:new Set(["bulletListItem"])}).use(Re.default).processSync(Ke(o,t)).value,t.exportBlocks=o=>{const i=o.map(s=>P(s,n,e.schema.styleSchema)),r=n.nodes.blockGroup.create(null,i);return t.exportProseMirrorFragment(y.Fragment.from(r))},t},fe=(n,e)=>{const t=y.DOMSerializer.fromSchema(n);return t.serializeNodeInner=(o,i)=>Ge(o,i,t,e,!1),t.serializeProseMirrorFragment=o=>Ke(o,t),t.serializeBlocks=o=>{const i=o.map(s=>P(s,n,e.schema.styleSchema)),r=n.nodes.blockGroup.create(null,i);return t.serializeProseMirrorFragment(y.Fragment.from(r))},t},Cn=async n=>{const e=new FormData;return e.append("file",n),(await(await fetch("https://tmpfiles.org/api/v1/upload",{method:"POST",body:e})).json()).data.url.replace("tmpfiles.org/","tmpfiles.org/dl/")},$e=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function F(n,e="Ctrl"){return $e()?n.replace("Mod","⌘"):n.replace("Mod",e)}function O(...n){return n.filter(e=>e).join(" ")}const Tn=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function ee(n,e,t,o){const i=document.createElement("div");i.className=O("bn-block-content",t.class),i.setAttribute("data-content-type",n);for(const[s,a]of Object.entries(t))s!=="class"&&i.setAttribute(s,a);const r=document.createElement(e);r.className=O("bn-inline-content",o.class);for(const[s,a]of Object.entries(o))s!=="class"&&r.setAttribute(s,a);return i.appendChild(r),{dom:i,contentDOM:r}}const We=(n,e)=>{const t=P(n,e._tiptapEditor.schema,e.schema.styleSchema).firstChild,o=e._tiptapEditor.schema.nodes[t.type.name].spec.toDOM;if(o===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const i=o(t);if(typeof i!="object"||!("dom"in i))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return i},C={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},ge=["backgroundColor","textColor"];function te(n){return"data-"+n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function be(n){const e={};return Object.entries(n).filter(([t,o])=>!ge.includes(t)).forEach(([t,o])=>{e[t]={default:o.default,keepOnSplit:!0,parseHTML:i=>{const r=i.getAttribute(te(t));if(r===null)return null;if(typeof o.default=="boolean")return r==="true"?!0:r==="false"?!1:null;if(typeof o.default=="number"){const s=parseFloat(r);return!Number.isNaN(s)&&Number.isFinite(s)?s:null}return r},renderHTML:i=>i[t]!==o.default?{[te(t)]:i[t]}:{}}}),e}function Je(n,e,t,o){if(typeof n=="boolean")throw new Error("Cannot find node position as getPos is a boolean, not a function.");const i=n(),s=t.state.doc.resolve(i).node().attrs.id,a=e.getBlock(s);if(a.type!==o)throw new Error("Block type does not match");return a}function ie(n,e,t,o,i){const r=document.createElement("div");if(i!==void 0)for(const[s,a]of Object.entries(i))s!=="class"&&r.setAttribute(s,a);r.className=O("bn-block-content",(i==null?void 0:i.class)||""),r.setAttribute("data-content-type",e);for(const[s,a]of Object.entries(t))!ge.includes(s)&&a!==o[s].default&&r.setAttribute(te(s),a);return r.appendChild(n.dom),n.contentDOM!==void 0&&(n.contentDOM.className=O("bn-inline-content",n.contentDOM.className),n.contentDOM.setAttribute("data-editable","")),{...n,dom:r}}function j(n){return b.Node.create(n)}function ke(n,e){return{config:n,implementation:e}}function $(n,e,t){return ke({type:n.name,content:n.config.content==="inline*"?"inline":n.config.content==="tableRow+"?"table":"none",propSchema:e},{node:n,requiredExtensions:t,toInternalHTML:We,toExternalHTML:We})}function ye(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.config]))}function Xe(n,e){const t=[{tag:"[data-content-type="+n.type+"]",contentElement:"[data-editable]"}];return e&&t.push({tag:"*",getAttrs(o){if(typeof o=="string")return!1;const i=e==null?void 0:e(o);return i===void 0?!1:i}}),t}function Ye(n,e){const t=j({name:n.type,content:n.content==="inline"?"inline*":"",group:"blockContent",selectable:!0,addAttributes(){return be(n.propSchema)},parseHTML(){return Xe(n,e.parse)},renderHTML(){const o=document.createElement("div");return o.setAttribute("data-tmp-placeholder","true"),{dom:o}},addNodeView(){return({getPos:o})=>{var l;const i=this.options.editor,r=Je(o,i,this.editor,n.type),s=((l=this.options.domAttributes)==null?void 0:l.blockContent)||{},a=e.render(r,i);return ie(a,r.type,r.props,n.propSchema,s)}}});if(t.name!==n.type)throw new Error("Node name does not match block type. This is a bug in BlockNote.");return ke(n,{node:t,toInternalHTML:(o,i)=>{var a;const r=((a=t.options.domAttributes)==null?void 0:a.blockContent)||{},s=e.render(o,i);return ie(s,o.type,o.props,n.propSchema,r)},toExternalHTML:(o,i)=>{var a,l;const r=((a=t.options.domAttributes)==null?void 0:a.blockContent)||{};let s=(l=e.toExternalHTML)==null?void 0:l.call(e,o,i);return s===void 0&&(s=e.render(o,i)),ie(s,o.type,o.props,n.propSchema,r)}})}function Qe(n,e,t,o){return n.dom.setAttribute("data-inline-content-type",e),Object.entries(t).filter(([i,r])=>r!==o[i].default).map(([i,r])=>[te(i),r]).forEach(([i,r])=>n.dom.setAttribute(i,r)),n.contentDOM!==void 0&&n.contentDOM.setAttribute("data-editable",""),n}function Ze(n){return{Backspace:({editor:e})=>{const t=e.state.selection.$from;return e.state.selection.empty&&t.node().type.name===n.type&&t.parentOffset===0}}}function et(n,e){return{config:n,implementation:e}}function tt(n,e){return et({type:n.name,propSchema:e,content:n.config.content==="inline*"?"styled":"none"},{node:n})}function we(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.config]))}function nt(n){return[{tag:`[data-inline-content-type="${n.type}"]`,contentElement:e=>{const t=e;return t.matches("[data-editable]")?t:t.querySelector("[data-editable]")||t}}]}function _n(n,e){const t=b.Node.create({name:n.type,inline:!0,group:"inline",selectable:n.content==="styled",atom:n.content==="none",content:n.content==="styled"?"inline*":"",addAttributes(){return be(n.propSchema)},addKeyboardShortcuts(){return Ze(n)},parseHTML(){return nt(n)},renderHTML({node:o}){const i=this.options.editor,r=e.render(me(o,i.schema.inlineContentSchema,i.schema.styleSchema));return Qe(r,n.type,o.attrs,n.propSchema)}});return tt(t,n.propSchema)}function ot(n){return n==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue!==void 0?{"data-value":e.stringValue}:{}}}}function it(n,e,t,o){return n.dom.setAttribute("data-style-type",e),o==="string"&&n.dom.setAttribute("data-value",t),n.contentDOM!==void 0&&n.contentDOM.setAttribute("data-editable",""),n}function ve(n,e){return{config:n,implementation:e}}function U(n,e){return ve({type:n.name,propSchema:e},{mark:n})}function Se(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t.config]))}function rt(n){return[{tag:`[data-style-type="${n.type}"]`,contentElement:e=>{const t=e;return t.matches("[data-editable]")?t:t.querySelector("[data-editable]")||t}}]}function xn(n,e){const t=b.Mark.create({name:n.type,addAttributes(){return ot(n.propSchema)},parseHTML(){return rt(n)},renderHTML({mark:o}){let i;if(n.propSchema==="boolean")i=e.render();else if(n.propSchema==="string")i=e.render(o.attrs.stringValue);else throw new I(n.propSchema);return it(i,n.type,o.attrs.stringValue,n.propSchema)}});return ve(n,{mark:t})}const Mn=b.Mark.create({name:"backgroundColor",addAttributes(){return{stringValue:{default:void 0,parseHTML:n=>n.getAttribute("data-background-color"),renderHTML:n=>({"data-background-color":n.stringValue})}}},parseHTML(){return[{tag:"span",getAttrs:n=>typeof n=="string"?!1:n.hasAttribute("data-background-color")?{stringValue:n.getAttribute("data-background-color")}:!1}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}}),Bn=U(Mn,"string"),In=b.Mark.create({name:"textColor",addAttributes(){return{stringValue:{default:void 0,parseHTML:n=>n.getAttribute("data-text-color"),renderHTML:n=>({"data-text-color":n.stringValue})}}},parseHTML(){return[{tag:"span",getAttrs:n=>typeof n=="string"?!1:n.hasAttribute("data-text-color")?{stringValue:n.getAttribute("data-text-color")}:!1}]},renderHTML({HTMLAttributes:n}){return["span",n,0]}}),Ln=U(In,"string"),A=n=>{const{contentType:e}=w(n.state.doc,n.state.selection.from);return e.spec.content},Pn={...C,level:{default:1,values:[1,2,3]}},An=j({name:"heading",content:"inline*",group:"blockContent",addAttributes(){return{level:{default:1,parseHTML:n=>{const e=n.getAttribute("data-level"),t=parseInt(e);if(isFinite(t))return t},renderHTML:n=>({"data-level":n.level.toString()})}}},addInputRules(){return[...[1,2,3].map(n=>new b.InputRule({find:new RegExp(`^(#{${n}})\\s$`),handler:({state:e,chain:t,range:o})=>{A(this.editor)==="inline*"&&t().BNUpdateBlock(e.selection.from,{type:"heading",props:{level:n}}).deleteRange({from:o.from,to:o.to})}}))]},addKeyboardShortcuts(){return{"Mod-Alt-1":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:1}}),"Mod-Alt-2":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:2}}),"Mod-Alt-3":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:3}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]",getAttrs:n=>typeof n=="string"?!1:{level:n.getAttribute("data-level")}},{tag:"h1",attrs:{level:1},node:"heading"},{tag:"h2",attrs:{level:2},node:"heading"},{tag:"h3",attrs:{level:3},node:"heading"}]},renderHTML({node:n,HTMLAttributes:e}){var t,o;return ee(this.name,`h${n.attrs.level}`,{...((t=this.options.domAttributes)==null?void 0:t.blockContent)||{},...e},((o=this.options.domAttributes)==null?void 0:o.inlineContent)||{})}}),Nn=$(An,Pn),Hn={textAlignment:C.textAlignment,backgroundColor:C.backgroundColor,url:{default:""},caption:{default:""},width:{default:512}},st=n=>{switch(n){case"left":return"flex-start";case"center":return"center";case"right":return"flex-end";default:return"flex-start"}},at=64,Dn=Ye({type:"image",propSchema:Hn,content:"none"},{render:(n,e)=>{const t=document.createElement("div");t.className="bn-image-block-content-wrapper",t.style.alignItems=st(n.props.textAlignment);const o=document.createElement("div");o.className="bn-add-image-button";const i=document.createElement("div");i.className="bn-add-image-button-icon";const r=document.createElement("p");r.className="bn-add-image-button-text",r.innerText=e.dictionary.image.add_button;const s=document.createElement("div");s.className="bn-image-and-caption-wrapper";const a=document.createElement("div");a.className="bn-image-wrapper";const l=document.createElement("img");l.className="bn-image",l.src=n.props.url,l.alt="placeholder",l.contentEditable="false",l.draggable=!1,l.style.width=`${Math.min(n.props.width,e.domElement.firstElementChild.clientWidth)}px`;const c=document.createElement("div");c.className="bn-image-resize-handle",c.style.left="4px";const p=document.createElement("div");p.className="bn-image-resize-handle",p.style.right="4px";const h=document.createElement("p");h.className="bn-image-caption",h.innerText=n.props.caption,h.style.padding=n.props.caption?"4px":"";const f=()=>{var Ne;const v=((Ne=e.getSelection())==null?void 0:Ne.blocks)||[];[e.getTextCursorPosition().block,...v].find(le=>le.id===n.id)!==void 0?(o.style.outline="4px solid rgb(100, 160, 255)",s.style.outline="4px solid rgb(100, 160, 255)"):(o.style.outline="",s.style.outline="")};e.onEditorContentChange(f),e.onEditorSelectionChange(f);let m;const g=v=>{if(!m){!e.isEditable&&a.contains(c)&&a.contains(p)&&(a.removeChild(c),a.removeChild(p));return}let D;st(n.props.textAlignment)==="center"?m.handleUsed==="left"?D=m.initialWidth+(m.initialClientX-v.clientX)*2:D=m.initialWidth+(v.clientX-m.initialClientX)*2:m.handleUsed==="left"?D=m.initialWidth+m.initialClientX-v.clientX:D=m.initialWidth+v.clientX-m.initialClientX,D<at?l.style.width=`${at}px`:D>e.domElement.firstElementChild.clientWidth?l.style.width=`${e.domElement.firstElementChild.clientWidth}px`:l.style.width=`${D}px`},S=v=>{(!v.target||!a.contains(v.target)||!e.isEditable)&&a.contains(c)&&a.contains(p)&&(a.removeChild(c),a.removeChild(p)),m&&(m=void 0,e.updateBlock(n,{type:"image",props:{width:parseFloat(l.style.width.slice(0,-2))}}))},B=v=>{v.preventDefault()},H=()=>{e._tiptapEditor.view.dispatch(e._tiptapEditor.state.tr.setMeta(e.imagePanel.plugin,{block:n}))},x=()=>{e.isEditable&&(a.appendChild(c),a.appendChild(p))},q=v=>{v.relatedTarget===c||v.relatedTarget===p||m||e.isEditable&&a.contains(c)&&a.contains(p)&&(a.removeChild(c),a.removeChild(p))},Y=v=>{v.preventDefault(),a.appendChild(c),a.appendChild(p),m={handleUsed:"left",initialWidth:n.props.width,initialClientX:v.clientX}},ne=v=>{v.preventDefault(),a.appendChild(c),a.appendChild(p),m={handleUsed:"right",initialWidth:n.props.width,initialClientX:v.clientX}};return o.appendChild(i),o.appendChild(r),s.appendChild(a),a.appendChild(l),s.appendChild(h),n.props.url===""?t.appendChild(o):t.appendChild(s),window.addEventListener("mousemove",g),window.addEventListener("mouseup",S),o.addEventListener("mousedown",B),o.addEventListener("click",H),l.addEventListener("mouseenter",x),l.addEventListener("mouseleave",q),c.addEventListener("mousedown",Y),p.addEventListener("mousedown",ne),{dom:t,destroy:()=>{window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",S),o.removeEventListener("mousedown",B),o.removeEventListener("click",H),c.removeEventListener("mousedown",Y),p.removeEventListener("mousedown",ne)}}},toExternalHTML:n=>{if(n.props.url===""){const o=document.createElement("p");return o.innerHTML="Add Image",{dom:o}}const e=document.createElement("figure"),t=document.createElement("img");if(t.src=n.props.url,e.appendChild(t),n.props.caption!==""){const o=document.createElement("figcaption");o.innerHTML=n.props.caption,e.appendChild(o)}return{dom:e}},parse:n=>{if(n.tagName==="FIGURE"){const e=n.querySelector("img"),t=n.querySelector("figcaption");return{url:(e==null?void 0:e.getAttribute("src"))||"",caption:(t==null?void 0:t.textContent)||(e==null?void 0:e.getAttribute("alt"))||void 0}}else if(n.tagName==="IMG")return{url:n.getAttribute("src")||"",caption:n.getAttribute("alt")||void 0}}}),Ee=n=>{const{node:e,contentType:t}=w(n.state.doc,n.state.selection.from),o=n.state.selection.anchor===n.state.selection.head;return!(t.name==="bulletListItem"||t.name==="numberedListItem")||!o?!1:n.commands.first(({state:i,chain:r,commands:s})=>[()=>s.command(()=>e.textContent.length===0?s.BNUpdateBlock(i.selection.from,{type:"paragraph",props:{}}):!1),()=>s.command(()=>e.textContent.length>0?(r().deleteSelection().BNSplitBlock(i.selection.from,!0).run(),!0):!1)])},On={...C},Un=j({name:"bulletListItem",content:"inline*",group:"blockContent",addInputRules(){return[new b.InputRule({find:new RegExp("^[-+*]\\s$"),handler:({state:n,chain:e,range:t})=>{A(this.editor)==="inline*"&&e().BNUpdateBlock(n.selection.from,{type:"bulletListItem",props:{}}).deleteRange({from:t.from,to:t.to})}})]},addKeyboardShortcuts(){return{Enter:()=>Ee(this.editor),"Mod-Shift-8":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"bulletListItem",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:n=>{if(typeof n=="string")return!1;const e=n.parentElement;return e===null?!1:e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement.tagName==="UL"?{}:!1},node:"bulletListItem"},{tag:"p",getAttrs:n=>{if(typeof n=="string")return!1;const e=n.parentElement;return e===null?!1:e.getAttribute("data-content-type")==="bulletListItem"?{}:!1},priority:300,node:"bulletListItem"}]},renderHTML({HTMLAttributes:n}){var e,t;return ee(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...n},((t=this.options.domAttributes)==null?void 0:t.inlineContent)||{})}}),Rn=$(Un,On),zn=new k.PluginKey("numbered-list-indexing"),Vn=()=>new k.Plugin({key:zn,appendTransaction:(n,e,t)=>{const o=t.tr;o.setMeta("numberedListIndexing",!0);let i=!1;return t.doc.descendants((r,s)=>{if(r.type.name==="blockContainer"&&r.firstChild.type.name==="numberedListItem"){let a="1";const l=s===1,c=w(o.doc,s+1);if(c===void 0)return;if(!l){const f=w(o.doc,s-2);if(f===void 0)return;if(!(c.depth!==f.depth)){const g=f.contentNode;if(f.contentType.name==="numberedListItem"){const H=g.attrs.index;a=(parseInt(H)+1).toString()}}}c.contentNode.attrs.index!==a&&(i=!0,o.setNodeMarkup(s+1,void 0,{index:a}))}}),i?o:null}}),Fn={...C},jn=j({name:"numberedListItem",content:"inline*",group:"blockContent",addAttributes(){return{index:{default:null,parseHTML:n=>n.getAttribute("data-index"),renderHTML:n=>({"data-index":n.index})}}},addInputRules(){return[new b.InputRule({find:new RegExp("^1\\.\\s$"),handler:({state:n,chain:e,range:t})=>{A(this.editor)==="inline*"&&e().BNUpdateBlock(n.selection.from,{type:"numberedListItem",props:{}}).deleteRange({from:t.from,to:t.to})}})]},addKeyboardShortcuts(){return{Enter:()=>Ee(this.editor),"Mod-Shift-7":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"numberedListItem",props:{}})}},addProseMirrorPlugins(){return[Vn()]},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:n=>{if(typeof n=="string")return!1;const e=n.parentElement;return e===null?!1:e.tagName==="OL"||e.tagName==="DIV"&&e.parentElement.tagName==="OL"?{}:!1},node:"numberedListItem"},{tag:"p",getAttrs:n=>{if(typeof n=="string")return!1;const e=n.parentElement;return e===null?!1:e.getAttribute("data-content-type")==="numberedListItem"?{}:!1},priority:300,node:"numberedListItem"}]},renderHTML({HTMLAttributes:n}){var e,t;return ee(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...n},((t=this.options.domAttributes)==null?void 0:t.inlineContent)||{})}}),qn=$(jn,Fn),Gn={...C},Kn=j({name:"paragraph",content:"inline*",group:"blockContent",addKeyboardShortcuts(){return{Enter:()=>Ee(this.editor),"Mod-Alt-0":()=>A(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"paragraph",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"p",priority:200,node:"paragraph"}]},renderHTML({HTMLAttributes:n}){var e,t;return ee(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...n},((t=this.options.domAttributes)==null?void 0:t.inlineContent)||{})}}),$n=$(Kn,Gn),Wn=b.Extension.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[De.columnResizing({cellMinWidth:100}),De.tableEditing()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.setHardBreak(),!0):!1,Backspace:()=>{const n=this.editor.state.selection,e=n.empty,t=n.$head.parentOffset===0,o=n.$head.node().type.name==="tableParagraph";return e&&t&&o}}},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:b.callOrReturn(b.getExtensionField(n,"tableRole",e))}}}),Jn={...C},Xn=j({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({HTMLAttributes:n}){var e,t;return ee(this.name,"table",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...n},((t=this.options.domAttributes)==null?void 0:t.inlineContent)||{})}}),Yn=b.Node.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",b.mergeAttributes(this.options.HTMLAttributes,n),0]}}),Qn=$(Xn,Jn,[Wn,Yn,qt.TableHeader.extend({content:"tableContent"}),jt.TableCell.extend({content:"tableContent"}),Gt.TableRow]),Ce={paragraph:$n,heading:Nn,bulletListItem:Rn,numberedListItem:qn,image:Dn,table:Qn},lt=ye(Ce),Te={bold:U(rn.default,"boolean"),italic:U(an.default,"boolean"),underline:U(cn.default,"boolean"),strike:U(ln.default,"boolean"),code:U(sn.default,"boolean"),textColor:Ln,backgroundColor:Bn},Zn=Se(Te),_e={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},eo=we(_e);function L(n,e){return n in e.schema.blockSchema&&e.schema.blockSchema[n]===lt[n]}function to(n,e,t){return e.type===n&&e.type in t.schema.blockSchema&&L(e.type,t)}function ct(n,e,t){return e in t.schema.blockSchema&&n in t.schema.blockSchema[e].propSchema&&t.schema.blockSchema[e].propSchema[n]===C[n]}function no(n,e,t){return ct(n,e.type,t)}function xe(n,e){let t,o;if(e.firstChild.descendants((i,r)=>t?!1:i.type.name!=="blockContainer"||i.attrs.id!==n?!0:(t=i,o=r+1,!1)),t===void 0||o===void 0)throw Error("Could not find block in the editor with matching ID.");return{node:t,posBeforeNode:o}}function oo(n,e,t="before",o){const i=o._tiptapEditor,r=typeof e=="string"?e:e.id,s=[];for(const p of n)s.push(P(p,i.schema,o.schema.styleSchema));const{node:a,posBeforeNode:l}=xe(r,i.state.doc);if(t==="before"&&i.view.dispatch(i.state.tr.insert(l,s)),t==="after"&&i.view.dispatch(i.state.tr.insert(l+a.nodeSize,s)),t==="nested"&&a.childCount<2){const p=i.state.schema.nodes.blockGroup.create({},s);i.view.dispatch(i.state.tr.insert(l+a.firstChild.nodeSize+1,p))}const c=[];for(const p of s)c.push(E(p,o.schema.blockSchema,o.schema.inlineContentSchema,o.schema.styleSchema,o.blockCache));return c}function io(n,e,t){const o=t._tiptapEditor,i=typeof n=="string"?n:n.id,{posBeforeNode:r}=xe(i,o.state.doc);o.commands.BNUpdateBlock(r+1,e);const s=o.state.doc.resolve(r+1).node();return E(s,t.schema.blockSchema,t.schema.inlineContentSchema,t.schema.styleSchema,t.blockCache)}function dt(n,e,t){const o=e._tiptapEditor,i=o.state.tr,r=new Set(n.map(l=>typeof l=="string"?l:l.id)),s=[];let a=0;if(o.state.doc.descendants((l,c)=>{if(r.size===0)return!1;if(l.type.name!=="blockContainer"||!r.has(l.attrs.id))return!0;s.push(E(l,e.schema.blockSchema,e.schema.inlineContentSchema,e.schema.styleSchema,e.blockCache)),r.delete(l.attrs.id),a=(t==null?void 0:t(l,c,i,a))||a;const p=i.doc.nodeSize;i.delete(c-a-1,c-a+l.nodeSize+1);const h=i.doc.nodeSize;return a+=p-h,!1}),r.size>0){const l=[...r].join(`
6
- `);throw Error("Blocks with the following IDs could not be found in the editor: "+l)}return o.view.dispatch(i),s}function ro(n,e){return dt(n,e)}function so(n,e,t){const o=t._tiptapEditor,i=[];for(const l of e)i.push(P(l,o.schema,t.schema.styleSchema));const r=typeof n[0]=="string"?n[0]:n[0].id,s=dt(n,t,(l,c,p,h)=>{if(l.attrs.id===r){const f=p.doc.nodeSize;p.insert(c,i);const m=p.doc.nodeSize;return h+f-m}return h}),a=[];for(const l of i)a.push(E(l,t.schema.blockSchema,t.schema.inlineContentSchema,t.schema.styleSchema,t.blockCache));return{insertedBlocks:a,removedBlocks:s}}function ao(n,e,t,o={updateSelection:!0}){const i=t._tiptapEditor,r=i.state.tr;let{from:s,to:a}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},l=!0,c=!0,p="";if(e.forEach(h=>{h.check(),l&&h.isText&&h.marks.length===0?p+=h.text:l=!1,c=c?h.isBlock:!1}),s===a&&c){const{parent:h}=r.doc.resolve(s);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(s-=1,a+=1)}return l?r.insertText(p,s,a):r.replaceWith(s,a,e),o.updateSelection&&b.selectionToInsertionEnd(r,r.steps.length-1,-1),i.view.dispatch(r),!0}function lo(){const n=e=>{let t=e.children.length;for(let o=0;o<t;o++){const i=e.children[o];if(i.type==="element"&&(n(i),i.tagName==="u"))if(i.children.length>0){e.children.splice(o,1,...i.children);const r=i.children.length-1;t+=r,o+=r}else e.children.splice(o,1),t--,o--}};return n}function Me(n){return ce.unified().use(Ue.default,{fragment:!0}).use(lo).use(dn.default).use(ze.default).use(un.default).processSync(n).value}function co(n,e,t){const i=Z(e,t).exportBlocks(n);return Me(i)}function uo(n){return Array.prototype.indexOf.call(n.parentElement.childNodes,n)}function po(n){return n.nodeType===3&&!/\S/.test(n.nodeValue||"")}function ho(n){n.querySelectorAll("li > ul, li > ol").forEach(e=>{const t=uo(e),o=e.parentElement,i=Array.from(o.childNodes).slice(t+1);e.remove(),i.forEach(r=>{r.remove()}),o.insertAdjacentElement("afterend",e),i.reverse().forEach(r=>{if(po(r))return;const s=document.createElement("li");s.append(r),e.insertAdjacentElement("afterend",s)}),o.childNodes.length===0&&o.remove()})}function mo(n){n.querySelectorAll("li + ul, li + ol").forEach(e=>{var r,s;const t=e.previousElementSibling,o=document.createElement("div");t.insertAdjacentElement("afterend",o),o.append(t);const i=document.createElement("div");for(i.setAttribute("data-node-type","blockGroup"),o.append(i);((r=o.nextElementSibling)==null?void 0:r.nodeName)==="UL"||((s=o.nextElementSibling)==null?void 0:s.nodeName)==="OL";)i.append(o.nextElementSibling)})}let ut=null;function fo(){return ut||(ut=document.implementation.createHTMLDocument("title"))}function pt(n){if(typeof n=="string"){const e=fo().createElement("div");e.innerHTML=n,n=e}return ho(n),mo(n),n}async function ht(n,e,t,o,i){const r=pt(n),a=y.DOMParser.fromSchema(i).parse(r,{topNode:i.nodes.blockGroup.create()}),l=[];for(let c=0;c<a.childCount;c++)l.push(E(a.child(c),e,t,o));return l}function go(n,e){const t=e.value?e.value+`
7
- `:"",o={};e.lang&&(o["data-language"]=e.lang);let i={type:"element",tagName:"code",properties:o,children:[{type:"text",value:t}]};return e.meta&&(i.data={meta:e.meta}),n.patch(e,i),i=n.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},n.patch(e,i),i}function bo(n,e,t,o,i){const r=ce.unified().use(pn.default).use(ze.default).use(hn.default,{handlers:{...Oe.defaultHandlers,code:go}}).use(Re.default).processSync(n);return ht(r.value,e,t,o,i)}class W{constructor(){u(this,"callbacks",{})}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),()=>this.off(e,t)}emit(e,...t){const o=this.callbacks[e];o&&o.forEach(i=>i.apply(this,t))}off(e,t){const o=this.callbacks[e];o&&(t?this.callbacks[e]=o.filter(i=>i!==t):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}}class mt{constructor(e,t,o){u(this,"state");u(this,"emitUpdate");u(this,"preventHide",!1);u(this,"preventShow",!1);u(this,"prevWasEditable",null);u(this,"shouldShow",({state:e})=>!e.selection.empty);u(this,"viewMousedownHandler",()=>{this.preventShow=!0});u(this,"viewMouseupHandler",()=>{this.preventShow=!1,setTimeout(()=>this.update(this.pmView))});u(this,"dragHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.referencePos=this.getSelectionBoundingBox(),this.emitUpdate())});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized formatting toolbar");o(this.state)},t.dom.addEventListener("mousedown",this.viewMousedownHandler),t.dom.addEventListener("mouseup",this.viewMouseupHandler),t.dom.addEventListener("dragstart",this.dragHandler),t.dom.addEventListener("dragover",this.dragHandler),document.addEventListener("scroll",this.scrollHandler)}update(e,t){var f,m;const{state:o,composing:i}=e,{doc:r,selection:s}=o,a=t&&t.doc.eq(r)&&t.selection.eq(s);if((this.prevWasEditable===null||this.prevWasEditable===this.editor.isEditable)&&(i||a))return;this.prevWasEditable=this.editor.isEditable;const{ranges:l}=s,c=Math.min(...l.map(g=>g.$from.pos)),p=Math.max(...l.map(g=>g.$to.pos)),h=(f=this.shouldShow)==null?void 0:f.call(this,{view:e,state:o,from:c,to:p});if(this.editor.isEditable&&!this.preventShow&&(h||this.preventHide)){this.state={show:!0,referencePos:this.getSelectionBoundingBox()},this.emitUpdate();return}if((m=this.state)!=null&&m.show&&!this.preventHide&&(!h||this.preventShow||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.dom.removeEventListener("mouseup",this.viewMouseupHandler),this.pmView.dom.removeEventListener("dragstart",this.dragHandler),this.pmView.dom.removeEventListener("dragover",this.dragHandler),document.removeEventListener("scroll",this.scrollHandler)}getSelectionBoundingBox(){const{state:e}=this.pmView,{selection:t}=e,{ranges:o}=t,i=Math.min(...o.map(s=>s.$from.pos)),r=Math.max(...o.map(s=>s.$to.pos));if(b.isNodeSelection(t)){const s=this.pmView.nodeDOM(i);if(s)return s.getBoundingClientRect()}return b.posToDOMRect(this.pmView,i,r)}}const ft=new k.PluginKey("FormattingToolbarPlugin");class gt extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:ft,view:o=>(this.view=new mt(t,o,i=>{this.emit("update",i)}),this.view),props:{handleKeyDown:(o,i)=>i.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1}})}get shown(){var t,o;return((o=(t=this.view)==null?void 0:t.state)==null?void 0:o.show)||!1}onUpdate(t){return this.on("update",t)}}class bt{constructor(e,t,o){u(this,"state");u(this,"emitUpdate");u(this,"prevWasEditable",null);u(this,"mouseDownHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"dragstartHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;if((e=this.state)!=null&&e.show){const t=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`);this.state.referencePos=t.getBoundingClientRect(),this.emitUpdate()}});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.pluginKey=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized image panel");o(this.state)},t.dom.addEventListener("mousedown",this.mouseDownHandler),t.dom.addEventListener("dragstart",this.dragstartHandler),document.addEventListener("scroll",this.scrollHandler)}update(e,t){var i,r;const o=this.pluginKey.getState(e.state);if(!((i=this.state)!=null&&i.show)&&o.block){const s=document.querySelector(`[data-node-type="blockContainer"][data-id="${o.block.id}"]`);this.state={show:!0,referencePos:s.getBoundingClientRect(),block:o.block},this.emitUpdate();return}(!e.state.selection.eq(t.selection)||!e.state.doc.eq(t.doc))&&(r=this.state)!=null&&r.show&&(this.state.show=!1,this.emitUpdate())}destroy(){this.pmView.dom.removeEventListener("mousedown",this.mouseDownHandler),this.pmView.dom.removeEventListener("dragstart",this.dragstartHandler),document.removeEventListener("scroll",this.scrollHandler)}}const Be=new k.PluginKey("ImagePanelPlugin");class kt extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:Be,view:o=>(this.view=new bt(Be,o,i=>{this.emit("update",i)}),this.view),props:{handleKeyDown:(o,i)=>i.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1},state:{init:()=>({block:void 0}),apply:o=>{var r;return{block:(r=o.getMeta(Be))==null?void 0:r.block}}}})}get shown(){var t,o;return((o=(t=this.view)==null?void 0:t.state)==null?void 0:o.show)||!1}onUpdate(t){return this.on("update",t)}}class ko{constructor(e,t,o){u(this,"state");u(this,"emitUpdate");u(this,"menuUpdateTimer");u(this,"startMenuUpdateTimer");u(this,"stopMenuUpdateTimer");u(this,"mouseHoveredLinkMark");u(this,"mouseHoveredLinkMarkRange");u(this,"keyboardHoveredLinkMark");u(this,"keyboardHoveredLinkMarkRange");u(this,"linkMark");u(this,"linkMarkRange");u(this,"mouseOverHandler",e=>{if(this.mouseHoveredLinkMark=void 0,this.mouseHoveredLinkMarkRange=void 0,this.stopMenuUpdateTimer(),e.target instanceof HTMLAnchorElement&&e.target.nodeName==="A"){const t=e.target,o=this.pmView.posAtDOM(t,0)+1,i=this.pmView.state.doc.resolve(o),r=i.marks();for(const s of r)if(s.type.name===this.pmView.state.schema.mark("link").type.name){this.mouseHoveredLinkMark=s,this.mouseHoveredLinkMarkRange=b.getMarkRange(i,s.type,s.attrs)||void 0;break}}return this.startMenuUpdateTimer(),!1});u(this,"clickHandler",e=>{var o;const t=this.pmView.dom.parentElement;this.linkMark&&e&&e.target&&!(t===e.target||t.contains(e.target))&&(o=this.state)!=null&&o.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;this.linkMark!==void 0&&(e=this.state)!=null&&e.show&&(this.state.referencePos=b.posToDOMRect(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),this.emitUpdate())});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized link toolbar");o(this.state)},this.startMenuUpdateTimer=()=>{this.menuUpdateTimer=setTimeout(()=>{this.update()},250)},this.stopMenuUpdateTimer=()=>(this.menuUpdateTimer&&(clearTimeout(this.menuUpdateTimer),this.menuUpdateTimer=void 0),!1),this.pmView.dom.addEventListener("mouseover",this.mouseOverHandler),document.addEventListener("click",this.clickHandler,!0),document.addEventListener("scroll",this.scrollHandler)}editLink(e,t){var i;const o=this.pmView.state.tr.insertText(t,this.linkMarkRange.from,this.linkMarkRange.to);o.addMark(this.linkMarkRange.from,this.linkMarkRange.from+t.length,this.pmView.state.schema.mark("link",{href:e})),this.pmView.dispatch(o),this.pmView.focus(),(i=this.state)!=null&&i.show&&(this.state.show=!1,this.emitUpdate())}deleteLink(){var e;this.pmView.dispatch(this.pmView.state.tr.removeMark(this.linkMarkRange.from,this.linkMarkRange.to,this.linkMark.type).setMeta("preventAutolink",!0)),this.pmView.focus(),(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())}update(){var t;if(!this.pmView.hasFocus())return;const e=this.linkMark;if(this.linkMark=void 0,this.linkMarkRange=void 0,this.keyboardHoveredLinkMark=void 0,this.keyboardHoveredLinkMarkRange=void 0,this.pmView.state.selection.empty){const o=this.pmView.state.selection.$from.marks();for(const i of o)if(i.type.name===this.pmView.state.schema.mark("link").type.name){this.keyboardHoveredLinkMark=i,this.keyboardHoveredLinkMarkRange=b.getMarkRange(this.pmView.state.selection.$from,i.type,i.attrs)||void 0;break}}if(this.mouseHoveredLinkMark&&(this.linkMark=this.mouseHoveredLinkMark,this.linkMarkRange=this.mouseHoveredLinkMarkRange),this.keyboardHoveredLinkMark&&(this.linkMark=this.keyboardHoveredLinkMark,this.linkMarkRange=this.keyboardHoveredLinkMarkRange),this.linkMark&&this.editor.isEditable){this.state={show:!0,referencePos:b.posToDOMRect(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),url:this.linkMark.attrs.href,text:this.pmView.state.doc.textBetween(this.linkMarkRange.from,this.linkMarkRange.to)},this.emitUpdate();return}if((t=this.state)!=null&&t.show&&e&&(!this.linkMark||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mouseover",this.mouseOverHandler),document.removeEventListener("scroll",this.scrollHandler),document.removeEventListener("click",this.clickHandler,!0)}}const yt=new k.PluginKey("LinkToolbarPlugin");class wt extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"editLink",(t,o)=>{this.view.editLink(t,o)});u(this,"deleteLink",()=>{this.view.deleteLink()});u(this,"startHideTimer",()=>{this.view.startMenuUpdateTimer()});u(this,"stopHideTimer",()=>{this.view.stopMenuUpdateTimer()});u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:yt,view:o=>(this.view=new ko(t,o,i=>{this.emit("update",i)}),this.view),props:{handleKeyDown:(o,i)=>i.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1}})}onUpdate(t){return this.on("update",t)}get shown(){var t,o;return((o=(t=this.view)==null?void 0:t.state)==null?void 0:o.show)||!1}}const yo=b.findParentNode(n=>n.type.name==="blockContainer");class wo{constructor(e,t){u(this,"state");u(this,"emitUpdate");u(this,"pluginState");u(this,"handleScroll",()=>{var e;if((e=this.state)!=null&&e.show){const t=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.state.referencePos=t.getBoundingClientRect(),this.emitUpdate(this.pluginState.triggerCharacter)}});u(this,"closeMenu",()=>{this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.view.state.tr.setMeta(R,null))});u(this,"clearQuery",()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos-(this.pluginState.fromUserInput?this.pluginState.triggerCharacter.length:0),to:this.editor._tiptapEditor.state.selection.from}).run()});this.editor=e,this.pluginState=void 0,this.emitUpdate=o=>{if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");t(o,this.state)},document.addEventListener("scroll",this.handleScroll)}update(e,t){const o=R.getState(t),i=R.getState(e.state),r=o===void 0&&i!==void 0,s=o!==void 0&&i===void 0;if(!r&&!(o!==void 0&&i!==void 0)&&!s)return;if(this.pluginState=s?o:i,s||!this.editor.isEditable){this.state.show=!1,this.emitUpdate(this.pluginState.triggerCharacter);return}const l=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&(this.state={show:!0,referencePos:l.getBoundingClientRect(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){document.removeEventListener("scroll",this.handleScroll)}}const R=new k.PluginKey("SuggestionMenuPlugin");class vt extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"triggerCharacters",[]);u(this,"addTriggerCharacter",t=>{this.triggerCharacters.push(t)});u(this,"removeTriggerCharacter",t=>{this.triggerCharacters=this.triggerCharacters.filter(o=>o!==t)});u(this,"closeMenu",()=>this.view.closeMenu());u(this,"clearQuery",()=>this.view.clearQuery());const o=this.triggerCharacters;this.plugin=new k.Plugin({key:R,view:()=>(this.view=new wo(t,(i,r)=>{this.emit(`update ${i}`,r)}),this.view),state:{init(){},apply(i,r,s,a){if(i.getMeta("orderedListIndexing")!==void 0)return r;const l=i.getMeta(R);if(typeof l=="object"&&l!==null&&r===void 0)return{triggerCharacter:l.triggerCharacter,fromUserInput:l.fromUserInput!==!1,queryStartPos:a.selection.from,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`};if(r===void 0)return r;if(a.selection.from!==a.selection.to||l===null||i.getMeta("focus")||i.getMeta("blur")||i.getMeta("pointer")||r.triggerCharacter!==void 0&&a.selection.from<r.queryStartPos)return;const c={...r};return c.query=a.doc.textBetween(r.queryStartPos,a.selection.from),c}},props:{handleTextInput(i,r,s,a){const l=this.getState(i.state);return o.includes(a)&&l===void 0?(i.dispatch(i.state.tr.insertText(a).scrollIntoView().setMeta(R,{triggerCharacter:a})),!0):!1},decorations(i){const r=this.getState(i);if(r===void 0)return null;if(!r.fromUserInput){const s=yo(i.selection);if(s)return _.DecorationSet.create(i.doc,[_.Decoration.node(s.pos,s.pos+s.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":r.decorationId})])}return _.DecorationSet.create(i.doc,[_.Decoration.inline(r.queryStartPos-r.triggerCharacter.length,r.queryStartPos,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":r.decorationId})])}}})}onUpdate(t,o){return this.triggerCharacters.includes(t)||this.addTriggerCharacter(t),this.on(`update ${t}`,o)}get shown(){var t,o;return((o=(t=this.view)==null?void 0:t.state)==null?void 0:o.show)||!1}}function vo(n,e){n.suggestionMenus.addTriggerCharacter(e)}class J extends k.Selection{constructor(t,o){super(t,o);u(this,"nodes");const i=t.node();this.nodes=[],t.doc.nodesBetween(t.pos,o.pos,(r,s,a)=>{if(a!==null&&a.eq(i))return this.nodes.push(r),!1})}static create(t,o,i=o){return new J(t.resolve(o),t.resolve(i))}content(){return new y.Slice(y.Fragment.from(this.nodes),0,0)}eq(t){if(!(t instanceof J)||this.nodes.length!==t.nodes.length||this.from!==t.from||this.to!==t.to)return!1;for(let o=0;o<this.nodes.length;o++)if(!this.nodes[o].eq(t.nodes[o]))return!1;return!0}map(t,o){const i=o.mapResult(this.from),r=o.mapResult(this.to);return r.deleted?k.Selection.near(t.resolve(i.pos)):i.deleted?k.Selection.near(t.resolve(r.pos)):new J(t.resolve(i.pos),t.resolve(r.pos))}toJSON(){return{type:"node",anchor:this.anchor,head:this.head}}}let z;function re(n,e){var i;if(!e.dom.isConnected)return;const t=e.posAtCoords(n);if(!t)return;let o=e.domAtPos(t.pos).node;if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom&&!((i=o.hasAttribute)!=null&&i.call(o,"data-id"));)o=o.parentNode;if(o)return{node:o,id:o.getAttribute("data-id")}}}function So(n,e){const t=re(n,e);if(t&&t.node.nodeType===1){const o=e.docView,i=o.nearestDesc(t.node,!0);return!i||i===o?null:i.posBefore}return null}function Eo(n,e){let t,o;const i=e.resolve(n.from).node().type.spec.group==="blockContent",r=e.resolve(n.to).node().type.spec.group==="blockContent",s=Math.min(n.$anchor.depth,n.$head.depth);if(i&&r){const a=n.$from.start(s-1),l=n.$to.end(s-1);t=e.resolve(a-1).pos,o=e.resolve(l+1).pos}else t=n.from,o=n.to;return{from:t,to:o}}function St(n,e,t=e){e===t&&(t+=n.state.doc.resolve(e+1).node().nodeSize);const o=n.domAtPos(e).node.cloneNode(!0),i=n.domAtPos(e).node,r=(p,h)=>Array.prototype.indexOf.call(p.children,h),s=r(i,n.domAtPos(e+1).node.parentElement),a=r(i,n.domAtPos(t-1).node.parentElement);for(let p=i.childElementCount-1;p>=0;p--)(p>a||p<s)&&o.removeChild(o.children[p]);Et(),z=o;const c=n.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="bn-root"&&p!=="bn-editor").join(" ");z.className=z.className+" bn-drag-preview "+c,document.body.appendChild(z)}function Et(){z!==void 0&&(document.body.removeChild(z),z=void 0)}function Co(n,e){if(!n.dataTransfer)return;const t=e.prosemirrorView,o=t.dom.getBoundingClientRect(),i={left:o.left+o.width/2,top:n.clientY},r=So(i,t);if(r!=null){const s=t.state.selection,a=t.state.doc,{from:l,to:c}=Eo(s,a),p=l<=r&&r<c,h=s.$anchor.node()!==s.$head.node()||s instanceof J;p&&h?(t.dispatch(t.state.tr.setSelection(J.create(a,l,c))),St(t,l,c)):(t.dispatch(t.state.tr.setSelection(k.NodeSelection.create(t.state.doc,r))),St(t,r));const f=t.state.selection.content(),m=e._tiptapEditor.schema,S=fe(m,e).serializeProseMirrorFragment(f.content),H=Z(m,e).exportProseMirrorFragment(f.content),x=Me(H);n.dataTransfer.clearData(),n.dataTransfer.setData("blocknote/html",S),n.dataTransfer.setData("text/html",H),n.dataTransfer.setData("text/plain",x),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(z,0,0),t.dragging={slice:f,move:!0}}}class Ct{constructor(e,t,o){u(this,"state");u(this,"emitUpdate");u(this,"horizontalPosAnchoredAtRoot");u(this,"horizontalPosAnchor");u(this,"hoveredBlock");u(this,"isDragging",!1);u(this,"menuFrozen",!1);u(this,"onDragStart",()=>{this.isDragging=!0});u(this,"onDrop",e=>{if(this.editor._tiptapEditor.commands.blur(),e.synthetic||!this.isDragging)return;const t=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(this.isDragging=!1,!t||t.inside===-1){const o=new Event("drop",e),i=this.pmView.dom.firstChild.getBoundingClientRect();o.clientX=i.left+i.width/2,o.clientY=e.clientY,o.dataTransfer=e.dataTransfer,o.preventDefault=()=>e.preventDefault(),o.synthetic=!0,this.pmView.dom.dispatchEvent(o)}});u(this,"onDragOver",e=>{if(e.synthetic||!this.isDragging)return;const t=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(!t||t.inside===-1){const o=new Event("dragover",e),i=this.pmView.dom.firstChild.getBoundingClientRect();o.clientX=i.left+i.width/2,o.clientY=e.clientY,o.dataTransfer=e.dataTransfer,o.preventDefault=()=>e.preventDefault(),o.synthetic=!0,this.pmView.dom.dispatchEvent(o)}});u(this,"onKeyDown",e=>{var t;(t=this.state)!=null&&t.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state),this.menuFrozen=!1)});u(this,"onMouseDown",e=>{this.state&&!this.state.show&&(this.state.show=!0,this.emitUpdate(this.state)),this.menuFrozen=!1});u(this,"onMouseMove",e=>{var c,p,h,f,m;if(this.menuFrozen)return;const t=this.pmView.dom.firstChild.getBoundingClientRect(),o=this.pmView.dom.getBoundingClientRect(),i=e.clientX>=o.left&&e.clientX<=o.right&&e.clientY>=o.top&&e.clientY<=o.bottom,r=this.pmView.dom.parentElement;if(i&&e&&e.target&&!(r===e.target||r.contains(e.target))){(c=this.state)!=null&&c.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.horizontalPosAnchor=t.x;const s={left:t.left+t.width/2,top:e.clientY},a=re(s,this.pmView);if(!a||!this.editor.isEditable){(p=this.state)!=null&&p.show&&(this.state.show=!1,this.emitUpdate(this.state));return}if((h=this.state)!=null&&h.show&&((f=this.hoveredBlock)!=null&&f.hasAttribute("data-id"))&&((m=this.hoveredBlock)==null?void 0:m.getAttribute("data-id"))===a.id)return;this.hoveredBlock=a.node;const l=a.node.firstChild;if(l&&this.editor.isEditable){const g=l.getBoundingClientRect();this.state={show:!0,referencePos:new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:g.x,g.y,g.width,g.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.emitUpdate(this.state)}});u(this,"onScroll",()=>{var e;if((e=this.state)!=null&&e.show){const o=this.hoveredBlock.firstChild.getBoundingClientRect();this.state.referencePos=new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:o.x,o.y,o.width,o.height),this.emitUpdate(this.state)}});this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized side menu");o(this.state)},this.horizontalPosAnchoredAtRoot=!0,this.horizontalPosAnchor=this.pmView.dom.firstChild.getBoundingClientRect().x,document.body.addEventListener("drop",this.onDrop,!0),document.body.addEventListener("dragover",this.onDragOver),this.pmView.dom.addEventListener("dragstart",this.onDragStart),document.body.addEventListener("mousemove",this.onMouseMove,!0),document.addEventListener("scroll",this.onScroll),document.body.addEventListener("mousedown",this.onMouseDown,!0),document.body.addEventListener("keydown",this.onKeyDown,!0)}destroy(){var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate(this.state)),document.body.removeEventListener("mousemove",this.onMouseMove,!0),document.body.removeEventListener("dragover",this.onDragOver),this.pmView.dom.removeEventListener("dragstart",this.onDragStart),document.body.removeEventListener("drop",this.onDrop,!0),document.removeEventListener("scroll",this.onScroll),document.body.removeEventListener("mousedown",this.onMouseDown,!0),document.body.removeEventListener("keydown",this.onKeyDown,!0)}addBlock(){var l;(l=this.state)!=null&&l.show&&(this.state.show=!1,this.emitUpdate(this.state)),this.menuFrozen=!0;const t=this.hoveredBlock.firstChild.getBoundingClientRect(),o=this.pmView.posAtCoords({left:t.left+t.width/2,top:t.top+t.height/2});if(!o)return;const i=w(this.editor._tiptapEditor.state.doc,o.pos);if(i===void 0)return;const{contentNode:r,startPos:s,endPos:a}=i;if(r.type.spec.content!=="inline*"||r.textContent.length!==0){const c=a+1,p=c+2;this.editor._tiptapEditor.chain().BNCreateBlock(c).setTextSelection(p).run()}else this.editor._tiptapEditor.commands.setTextSelection(s+1);this.pmView.focus(),this.pmView.dispatch(this.pmView.state.tr.scrollIntoView().setMeta(R,{triggerCharacter:"/",fromUserInput:!1}))}}const Tt=new k.PluginKey("SideMenuPlugin");class _t extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"addBlock",()=>this.view.addBlock());u(this,"blockDragStart",t=>{this.view.isDragging=!0,Co(t,this.editor)});u(this,"blockDragEnd",()=>Et());u(this,"freezeMenu",()=>this.view.menuFrozen=!0);u(this,"unfreezeMenu",()=>this.view.menuFrozen=!1);this.editor=t,this.plugin=new k.Plugin({key:Tt,view:o=>(this.view=new Ct(t,o,i=>{this.emit("update",i)}),this.view)})}onUpdate(t){return this.on("update",t)}}let M;function xt(){M||(M=document.createElement("div"),M.innerHTML="_",M.style.opacity="0",M.style.height="1px",M.style.width="1px",document.body.appendChild(M))}function To(){M&&(document.body.removeChild(M),M=void 0)}function se(n){return Array.prototype.indexOf.call(n.parentElement.childNodes,n)}function _o(n){for(;n&&n.nodeName!=="TD"&&n.nodeName!=="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function xo(n){n.forEach(e=>{const t=document.getElementsByClassName(e);for(let o=0;o<t.length;o++)t[o].style.visibility="hidden"})}class Mt{constructor(e,t,o){u(this,"state");u(this,"emitUpdate");u(this,"tableId");u(this,"tablePos");u(this,"menuFrozen",!1);u(this,"prevWasEditable",null);u(this,"mouseMoveHandler",e=>{var c;if(this.menuFrozen)return;const t=_o(e.target);if(!t||!this.editor.isEditable){(c=this.state)!=null&&c.show&&(this.state.show=!1,this.emitUpdate());return}const o=se(t),i=se(t.parentElement),r=t.getBoundingClientRect(),s=t.parentElement.parentElement.getBoundingClientRect(),a=re(r,this.pmView);if(!a)throw new Error("Found table cell element, but could not find surrounding blockContent element.");if(this.tableId=a.id,this.state!==void 0&&this.state.show&&this.tableId===a.id&&this.state.rowIndex===i&&this.state.colIndex===o)return;let l;return this.editor._tiptapEditor.state.doc.descendants((p,h)=>typeof l<"u"?!1:p.type.name!=="blockContainer"||p.attrs.id!==a.id?!0:(l=E(p,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema,this.editor.blockCache),this.tablePos=h+1,!1)),this.state={show:!0,referencePosCell:r,referencePosTable:s,block:l,colIndex:o,rowIndex:i,draggingState:void 0},this.emitUpdate(),!1});u(this,"dragOverHandler",e=>{var f;if(((f=this.state)==null?void 0:f.draggingState)===void 0)return;e.preventDefault(),e.dataTransfer.dropEffect="move",xo(["column-resize-handle","prosemirror-dropcursor-block","prosemirror-dropcursor-inline"]);const t={left:Math.min(Math.max(e.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(e.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},o=document.elementsFromPoint(t.left,t.top).filter(m=>m.tagName==="TD"||m.tagName==="TH");if(o.length===0)throw new Error("Could not find table cell element that the mouse cursor is hovering over.");const i=o[0];let r=!1;const s=se(i.parentElement),a=se(i),l=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,p=(this.state.draggingState.draggedCellOrientation==="row"?s:a)!==l;(this.state.rowIndex!==s||this.state.colIndex!==a)&&(this.state.rowIndex=s,this.state.colIndex=a,this.state.referencePosCell=i.getBoundingClientRect(),r=!0);const h=this.state.draggingState.draggedCellOrientation==="row"?t.top:t.left;this.state.draggingState.mousePos!==h&&(this.state.draggingState.mousePos=h,r=!0),r&&this.emitUpdate(),p&&this.pmView.dispatch(this.pmView.state.tr.setMeta(X,!0))});u(this,"dropHandler",e=>{if(this.state===void 0||this.state.draggingState===void 0)return;e.preventDefault();const t=this.state.block.content.rows;if(this.state.draggingState.draggedCellOrientation==="row"){const o=t[this.state.draggingState.originalIndex];t.splice(this.state.draggingState.originalIndex,1),t.splice(this.state.rowIndex,0,o)}else{const o=t.map(i=>i.cells[this.state.draggingState.originalIndex]);t.forEach((i,r)=>{i.cells.splice(this.state.draggingState.originalIndex,1),i.cells.splice(this.state.colIndex,0,o[r])})}this.editor.updateBlock(this.state.block,{type:"table",content:{type:"tableContent",rows:t}})});u(this,"scrollHandler",()=>{var e;if((e=this.state)!=null&&e.show){const t=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.tableId}"] table`),o=t.querySelector(`tr:nth-child(${this.state.rowIndex+1}) > td:nth-child(${this.state.colIndex+1})`);this.state.referencePosTable=t.getBoundingClientRect(),this.state.referencePosCell=o.getBoundingClientRect(),this.emitUpdate()}});this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized image toolbar");o(this.state)},t.dom.addEventListener("mousemove",this.mouseMoveHandler),document.addEventListener("dragover",this.dragOverHandler),document.addEventListener("drop",this.dropHandler),document.addEventListener("scroll",this.scrollHandler)}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),document.removeEventListener("dragover",this.dragOverHandler),document.removeEventListener("drop",this.dropHandler),document.removeEventListener("scroll",this.scrollHandler)}}const X=new k.PluginKey("TableHandlesPlugin");class Bt extends W{constructor(t){super();u(this,"view");u(this,"plugin");u(this,"colDragStart",t=>{if(this.view.state===void 0)throw new Error("Attempted to drag table column, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"col",originalIndex:this.view.state.colIndex,mousePos:t.clientX},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.colIndex,newIndex:this.view.state.colIndex,tablePos:this.view.tablePos})),xt(),t.dataTransfer.setDragImage(M,0,0),t.dataTransfer.effectAllowed="move"});u(this,"rowDragStart",t=>{if(this.view.state===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"row",originalIndex:this.view.state.rowIndex,mousePos:t.clientY},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.rowIndex,newIndex:this.view.state.rowIndex,tablePos:this.view.tablePos})),xt(),t.dataTransfer.setDragImage(M,0,0),t.dataTransfer.effectAllowed="copyMove"});u(this,"dragEnd",()=>{if(this.view.state===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState=void 0,this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,null)),To()});u(this,"freezeHandles",()=>{this.view.menuFrozen=!0});u(this,"unfreezeHandles",()=>{this.view.menuFrozen=!1});this.editor=t,this.plugin=new k.Plugin({key:X,view:o=>(this.view=new Mt(t,o,i=>{this.emit("update",i)}),this.view),props:{decorations:o=>{if(this.view===void 0||this.view.state===void 0||this.view.state.draggingState===void 0||this.view.tablePos===void 0)return;const i=this.view.state.draggingState.draggedCellOrientation==="row"?this.view.state.rowIndex:this.view.state.colIndex,r=[];if(i===this.view.state.draggingState.originalIndex)return _.DecorationSet.create(o.doc,r);const s=o.doc.resolve(this.view.tablePos+1),a=s.node();if(this.view.state.draggingState.draggedCellOrientation==="row"){const l=o.doc.resolve(s.posAtIndex(i)+1),c=l.node();for(let p=0;p<c.childCount;p++){const h=o.doc.resolve(l.posAtIndex(p)+1),f=h.node(),m=h.pos+(i>this.view.state.draggingState.originalIndex?f.nodeSize-2:0);r.push(_.Decoration.widget(m,()=>{const g=document.createElement("div");return g.className="bn-table-drop-cursor",g.style.left="0",g.style.right="0",i>this.view.state.draggingState.originalIndex?g.style.bottom="-2px":g.style.top="-3px",g.style.height="4px",g}))}}else for(let l=0;l<a.childCount;l++){const c=o.doc.resolve(s.posAtIndex(l)+1),p=o.doc.resolve(c.posAtIndex(i)+1),h=p.node(),f=p.pos+(i>this.view.state.draggingState.originalIndex?h.nodeSize-2:0);r.push(_.Decoration.widget(f,()=>{const m=document.createElement("div");return m.className="bn-table-drop-cursor",m.style.top="0",m.style.bottom="0",i>this.view.state.draggingState.originalIndex?m.style.right="-2px":m.style.left="-3px",m.style.width="4px",m}))}return _.DecorationSet.create(o.doc,r)}}})}onUpdate(t){return this.on("update",t)}}function It(n,e){const t=n.state.selection.content().content,i=fe(n.state.schema,e).serializeProseMirrorFragment(t),s=Z(n.state.schema,e).exportProseMirrorFragment(t),a=Me(s);return{internalHTML:i,externalHTML:s,plainText:a}}const Mo=n=>b.Extension.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new k.Plugin({props:{handleDOMEvents:{copy(e,t){t.preventDefault(),t.clipboardData.clearData(),"node"in e.state.selection&&e.state.selection.node.type.spec.group==="blockContent"&&e.dispatch(e.state.tr.setSelection(new k.NodeSelection(e.state.doc.resolve(e.state.selection.from-1))));const{internalHTML:o,externalHTML:i,plainText:r}=It(e,n);return t.clipboardData.setData("blocknote/html",o),t.clipboardData.setData("text/html",i),t.clipboardData.setData("text/plain",r),!0},dragstart(e,t){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;e.dispatch(e.state.tr.setSelection(new k.NodeSelection(e.state.doc.resolve(e.state.selection.from-1)))),t.preventDefault(),t.dataTransfer.clearData();const{internalHTML:o,externalHTML:i,plainText:r}=It(e,n);return t.dataTransfer.setData("blocknote/html",o),t.dataTransfer.setData("text/html",i),t.dataTransfer.setData("text/plain",r),!0}}}})]}}),Bo=["blocknote/html","text/html","text/plain"],Io=n=>b.Extension.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new k.Plugin({props:{handleDOMEvents:{paste(e,t){t.preventDefault();let o=null;for(const i of Bo)if(t.clipboardData.types.includes(i)){o=i;break}if(o!==null){let i=t.clipboardData.getData(o);o==="text/html"&&(i=pt(i.trim()).innerHTML),n._tiptapEditor.view.pasteHTML(i)}return!0}}}})]}}),Lo=b.Extension.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["blockContainer"],attributes:{backgroundColor:{default:C.backgroundColor.default,parseHTML:n=>n.hasAttribute("data-background-color")?n.getAttribute("data-background-color"):C.backgroundColor.default,renderHTML:n=>n.backgroundColor!==C.backgroundColor.default&&{"data-background-color":n.backgroundColor}}}}]}}),Po=b.Extension.create({name:"textAlignment",addGlobalAttributes(){return[{types:["paragraph","heading","bulletListItem","numberedListItem"],attributes:{textAlignment:{default:"left",parseHTML:n=>n.getAttribute("data-text-alignment"),renderHTML:n=>n.textAlignment!=="left"&&{"data-text-alignment":n.textAlignment}}}}]}}),Ao=b.Extension.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["blockContainer"],attributes:{textColor:{default:C.textColor.default,parseHTML:n=>n.hasAttribute("data-text-color")?n.getAttribute("data-text-color"):C.textColor.default,renderHTML:n=>n.textColor!==C.textColor.default&&{"data-text-color":n.textColor}}}}]}}),No=b.Extension.create({name:"trailingNode",addProseMirrorPlugins(){const n=new k.PluginKey(this.name);return[new k.Plugin({key:n,appendTransaction:(e,t,o)=>{const{doc:i,tr:r,schema:s}=o,a=n.getState(o),l=i.content.size-2,c=s.nodes.blockContainer,p=s.nodes.paragraph;if(a)return r.insert(l,c.create(void 0,p.create()))},state:{init:(e,t)=>{},apply:(e,t)=>{if(!e.docChanged)return t;let o=e.doc.lastChild;if(!o||o.type.name!=="blockGroup")throw new Error("Expected blockGroup");if(o=o.lastChild,!o||o.type.name!=="blockContainer")throw new Error("Expected blockContainer");const i=o.firstChild;if(!i)throw new Error("Expected blockContent");return o.nodeSize>4||i.type.spec.content!=="inline*"}}})]}}),Ho=new k.PluginKey("non-editable-block"),Do=()=>new k.Plugin({key:Ho,props:{handleKeyDown:(n,e)=>{if("node"in n.state.selection){if(e.ctrlKey||e.metaKey)return!1;if(e.key.length===1)return e.preventDefault(),!0;if(e.key==="Enter"){const t=n.state.tr;return n.dispatch(t.insert(n.state.tr.selection.$to.after(),n.state.schema.nodes.paragraph.create()).setSelection(new k.TextSelection(t.doc.resolve(n.state.tr.selection.$to.after()+1)))),!0}}return!1}}}),Lt=new k.PluginKey("previous-blocks"),Oo={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},Uo=()=>{let n;return new k.Plugin({key:Lt,view(e){return{update:async(t,o)=>{var i;((i=this.key)==null?void 0:i.getState(t.state).updatedBlocks.size)>0&&(n=setTimeout(()=>{t.dispatch(t.state.tr.setMeta(Lt,{clearUpdate:!0}))},0))},destroy:()=>{n&&clearTimeout(n)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(e,t,o,i){if(t.currentTransactionOldBlockAttrs={},t.updatedBlocks.clear(),!e.docChanged||o.doc.eq(i.doc))return t;const r={},s=b.findChildren(o.doc,c=>c.attrs.id),a=new Map(s.map(c=>[c.node.attrs.id,c])),l=b.findChildren(i.doc,c=>c.attrs.id);for(const c of l){const p=a.get(c.node.attrs.id),h=p==null?void 0:p.node.firstChild,f=c.node.firstChild;if(p&&h&&f){const m={index:f.attrs.index,level:f.attrs.level,type:f.type.name,depth:i.doc.resolve(c.pos).depth};let g={index:h.attrs.index,level:h.attrs.level,type:h.type.name,depth:o.doc.resolve(p.pos).depth};r[c.node.attrs.id]=g,e.getMeta("numberedListIndexing")&&(c.node.attrs.id in t.prevTransactionOldBlockAttrs&&(g=t.prevTransactionOldBlockAttrs[c.node.attrs.id]),m.type==="numberedListItem"&&(g.index=m.index)),t.currentTransactionOldBlockAttrs[c.node.attrs.id]=g,JSON.stringify(g)!==JSON.stringify(m)&&(g["depth-change"]=g.depth-m.depth,t.updatedBlocks.add(c.node.attrs.id))}}return t.prevTransactionOldBlockAttrs=r,t}},props:{decorations(e){const t=this.getState(e);if(t.updatedBlocks.size===0)return;const o=[];return e.doc.descendants((i,r)=>{if(!i.attrs.id||!t.updatedBlocks.has(i.attrs.id))return;const s=t.currentTransactionOldBlockAttrs[i.attrs.id],a={};for(const[c,p]of Object.entries(s))a["data-prev-"+Oo[c]]=p||"none";const l=_.Decoration.node(r,r+i.nodeSize,{...a});o.push(l)}),_.DecorationSet.create(e.doc,o)}}})},Ro={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},zo=b.Node.create({name:"blockContainer",group:"blockContainer",content:"blockContent blockGroup?",priority:50,defining:!0,parseHTML(){return[{tag:"div",getAttrs:n=>{if(typeof n=="string")return!1;const e={};for(const[t,o]of Object.entries(Ro))n.getAttribute(o)&&(e[t]=n.getAttribute(o));return n.getAttribute("data-node-type")==="blockContainer"?e:!1}}]},renderHTML({HTMLAttributes:n}){var i;const e=document.createElement("div");e.className="bn-block-outer",e.setAttribute("data-node-type","blockOuter");for(const[r,s]of Object.entries(n))r!=="class"&&e.setAttribute(r,s);const t={...((i=this.options.domAttributes)==null?void 0:i.block)||{},...n},o=document.createElement("div");o.className=O("bn-block",t.class),o.setAttribute("data-node-type",this.name);for(const[r,s]of Object.entries(t))r!=="class"&&o.setAttribute(r,s);return e.appendChild(o),{dom:e,contentDOM:o}},addCommands(){return{BNCreateBlock:n=>({state:e,dispatch:t})=>{const o=e.schema.nodes.blockContainer.createAndFill();return t&&e.tr.insert(n,o).scrollIntoView(),!0},BNDeleteBlock:n=>({state:e,dispatch:t})=>{const o=w(e.doc,n);if(o===void 0)return!1;const{startPos:i,endPos:r}=o;return t&&e.tr.deleteRange(i,r),!0},BNUpdateBlock:(n,e)=>({state:t,dispatch:o})=>{const i=w(t.doc,n);if(i===void 0)return!1;const{startPos:r,endPos:s,node:a,contentNode:l}=i;if(o){if(e.children!==void 0){const f=[];for(const m of e.children)f.push(P(m,t.schema,this.options.editor.schema.styleSchema));a.childCount===2?t.tr.replace(r+l.nodeSize+1,s-1,new y.Slice(y.Fragment.from(f),0,0)):t.tr.insert(r+l.nodeSize,t.schema.nodes.blockGroup.create({},f))}const c=l.type.name,p=e.type||c;let h="keep";if(e.content)if(typeof e.content=="string")h=[t.schema.text(e.content)];else if(Array.isArray(e.content))h=Q(e.content,t.schema,this.options.editor.schema.styleSchema);else if(e.content.type==="tableContent")h=he(e.content,t.schema,this.options.editor.schema.styleSchema);else throw new I(e.content.type);else{const f=t.schema.nodes[c].spec.content,m=t.schema.nodes[p].spec.content;f===""||m!==f&&(h=[])}h==="keep"?t.tr.setNodeMarkup(r,e.type===void 0?void 0:t.schema.nodes[e.type],{...l.attrs,...e.props}):t.tr.replaceWith(r,s,t.schema.nodes[p].create({...l.attrs,...e.props},h)).setSelection(t.schema.nodes[p].spec.content===""?new k.NodeSelection(t.tr.doc.resolve(r)):t.schema.nodes[p].spec.content==="inline*"?new k.TextSelection(t.tr.doc.resolve(r)):new k.TextSelection(t.tr.doc.resolve(r+4))),t.tr.setNodeMarkup(r-1,void 0,{...a.attrs,...e.props})}return!0},BNMergeBlocks:n=>({state:e,dispatch:t})=>{const o=e.doc.resolve(n+1).node().type.name==="blockContainer",i=e.doc.resolve(n-1).node().type.name==="blockContainer";if(!o||!i)return!1;const r=w(e.doc,n+1),{node:s,contentNode:a,startPos:l,endPos:c,depth:p}=r;if(s.childCount===2){const m=e.doc.resolve(l+a.nodeSize+1),g=e.doc.resolve(c-1),S=m.blockRange(g);t&&e.tr.lift(S,p-1)}let h=n-1,f=w(e.doc,h);for(;f.numChildBlocks>0;)if(h--,f=w(e.doc,h),f===void 0)return!1;return t&&(t(e.tr.deleteRange(l,l+a.nodeSize).replace(h-1,l,new y.Slice(a.content,0,0)).scrollIntoView()),e.tr.setSelection(new k.TextSelection(e.doc.resolve(h-1)))),!0},BNSplitBlock:(n,e)=>({state:t,dispatch:o})=>{const i=w(t.doc,n);if(i===void 0)return!1;const{contentNode:r,contentType:s,startPos:a,endPos:l,depth:c}=i,p=t.doc.cut(a+1,n),h=t.doc.cut(n,l-1),f=t.schema.nodes.blockContainer.createAndFill(),m=l+1,g=m+2;return o&&(t.tr.insert(m,f),t.tr.replace(g,g+1,h.content.size>0?new y.Slice(y.Fragment.from(h),c+2,c+2):void 0),e&&t.tr.setBlockType(g,g,t.schema.node(s).type,r.attrs),t.tr.setSelection(new k.TextSelection(t.doc.resolve(g))),t.tr.replace(a+1,l-1,p.content.size>0?new y.Slice(y.Fragment.from(p),c+2,c+2):void 0),t.tr.scrollIntoView()),!0}}},addProseMirrorPlugins(){return[Uo(),Do()]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:i})=>{const{contentType:r,startPos:s}=w(i.doc,i.selection.from),a=i.selection.from===s+1,l=r.name==="paragraph";return a&&!l?o.BNUpdateBlock(i.selection.from,{type:"paragraph",props:{}}):!1}),()=>o.command(({state:i})=>{const{startPos:r}=w(i.doc,i.selection.from);return i.selection.from===r+1?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:i})=>{const{depth:r,startPos:s}=w(i.doc,i.selection.from),a=i.selection.from===s+1,l=i.selection.empty,c=s===2,p=s-1;return!c&&a&&l&&r===2?o.BNMergeBlocks(p):!1})]),Delete:()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.command(({state:i})=>{const{node:r,depth:s,endPos:a}=w(i.doc,i.selection.from),l=a===i.doc.nodeSize-4,c=i.selection.from===a-1,p=i.selection.empty,h=r.childCount===2;if(!l&&c&&p&&!h){let f=s,m=a+2,g=i.doc.resolve(m).depth;for(;g<f;)f=g,m+=2,g=i.doc.resolve(m).depth;return o.BNMergeBlocks(m-1)}return!1})]),Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.command(({state:i})=>{const{node:r,depth:s}=w(i.doc,i.selection.from),a=i.selection.$anchor.parentOffset===0,l=i.selection.anchor===i.selection.head,c=r.textContent.length===0,p=s>2;return a&&l&&c&&p?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:i,chain:r})=>{const{node:s,endPos:a}=w(i.doc,i.selection.from),l=i.selection.$anchor.parentOffset===0,c=i.selection.anchor===i.selection.head,p=s.textContent.length===0;if(l&&c&&p){const h=a+1,f=h+2;return r().BNCreateBlock(h).setTextSelection(f).run(),!0}return!1}),()=>o.command(({state:i,chain:r})=>{const{node:s}=w(i.doc,i.selection.from),a=i.selection.$anchor.parentOffset===0;return s.textContent.length===0?!1:(r().deleteSelection().BNSplitBlock(i.selection.from,a).run(),!0)})]),Tab:()=>{var o,i,r;return(o=this.options.editor.formattingToolbar)!=null&&o.shown||(i=this.options.editor.linkToolbar)!=null&&i.shown||(r=this.options.editor.imagePanel)!=null&&r.shown?!1:(this.editor.commands.sinkListItem("blockContainer"),!0)},"Shift-Tab":()=>{var o,i,r;return(o=this.options.editor.formattingToolbar)!=null&&o.shown||(i=this.options.editor.linkToolbar)!=null&&i.shown||(r=this.options.editor.imagePanel)!=null&&r.shown?!1:(this.editor.commands.liftListItem("blockContainer"),!0)}}}}),Vo=b.Node.create({name:"blockGroup",group:"blockGroup",content:"blockContainer+",parseHTML(){return[{tag:"div",getAttrs:n=>typeof n=="string"?!1:n.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:n}){var o;const e={...((o=this.options.domAttributes)==null?void 0:o.blockGroup)||{},...n},t=document.createElement("div");t.className=O("bn-block-group",e.class),t.setAttribute("data-node-type","blockGroup");for(const[i,r]of Object.entries(e))i!=="class"&&t.setAttribute(i,r);return{dom:t,contentDOM:t}}}),Fo=b.Node.create({name:"doc",topNode:!0,content:"blockGroup"}),Pt=n=>{var t;const e=[b.extensions.ClipboardTextSerializer,b.extensions.Commands,b.extensions.Editable,b.extensions.FocusEvents,b.extensions.Tabindex,Zt.Gapcursor,G.configure({types:["blockContainer"]}),en.HardBreak.extend({priority:10}),on.Text,nn.Link,...Object.values(n.styleSpecs).map(o=>o.implementation.mark),Ao,Lo,Po,b.Extension.create({name:"OverrideEscape",addKeyboardShortcuts(){return{Escape:()=>n.editor.suggestionMenus.shown?!1:this.editor.commands.blur()}}}),Fo,zo.configure({editor:n.editor,domAttributes:n.domAttributes}),Vo.configure({domAttributes:n.domAttributes}),...Object.values(n.inlineContentSpecs).filter(o=>o.config!=="link"&&o.config!=="text").map(o=>o.implementation.node.configure({editor:n.editor})),...Object.values(n.blockSpecs).flatMap(o=>[...(o.implementation.requiredExtensions||[]).map(i=>i.configure({editor:n.editor,domAttributes:n.domAttributes})),o.implementation.node.configure({editor:n.editor,domAttributes:n.domAttributes})]),Mo(n.editor),Io(n.editor),Qt.Dropcursor.configure({width:5,color:"#ddeeff"}),...n.trailingBlock===void 0||n.trailingBlock?[No]:[]];if(n.collaboration){if(e.push(mn.default.configure({fragment:n.collaboration.fragment})),(t=n.collaboration.provider)!=null&&t.awareness){const o=i=>{const r=document.createElement("span");r.classList.add("collaboration-cursor__caret"),r.setAttribute("style",`border-color: ${i.color}`);const s=document.createElement("span");s.classList.add("collaboration-cursor__label"),s.setAttribute("style",`background-color: ${i.color}`),s.insertBefore(document.createTextNode(i.name),null);const a=document.createTextNode("⁠"),l=document.createTextNode("⁠");return r.insertBefore(a,null),r.insertBefore(s,null),r.insertBefore(l,null),r};e.push(fn.default.configure({user:n.collaboration.user,render:n.collaboration.renderCursor||o,provider:n.collaboration.provider}))}}else e.push(tn.History);return e};function jo(n,e){const t=[];return n.forEach((o,i,r)=>{r!==e&&t.push(o)}),y.Fragment.from(t)}function qo(n,e){let t=y.Fragment.from(n.content);for(let o=0;o<t.childCount;o++)if(t.child(o).type.spec.group==="blockContent"){const i=[t.child(o)];if(o+1<t.childCount&&t.child(o+1).type.spec.group==="blockGroup"){const s=t.child(o+1).child(0).child(0);(s.type.name==="bulletListItem"||s.type.name==="numberedListItem")&&(i.push(t.child(o+1)),t=jo(t,o+1))}const r=e.state.schema.nodes.blockContainer.create(void 0,i);t=t.replaceChild(o,r)}return new y.Slice(t,n.openStart,n.openEnd)}class ae{constructor(e){u(this,"blockSpecs");u(this,"inlineContentSpecs");u(this,"styleSpecs");u(this,"blockSchema");u(this,"inlineContentSchema");u(this,"styleSchema");u(this,"BlockNoteEditor","only for types");u(this,"Block","only for types");u(this,"PartialBlock","only for types");this.blockSpecs=(e==null?void 0:e.blockSpecs)||Ce,this.inlineContentSpecs=(e==null?void 0:e.inlineContentSpecs)||_e,this.styleSpecs=(e==null?void 0:e.styleSpecs)||Te,this.blockSchema=ye(this.blockSpecs),this.inlineContentSchema=we(this.inlineContentSpecs),this.styleSchema=Se(this.styleSpecs)}static create(e){return new ae(e)}}class Go extends b.Editor{constructor(t,o){super({...t,content:void 0});u(this,"_state");u(this,"mount",t=>{t?(this.options.element=t,this.createViewAlternative()):this.destroy()});const i=this.schema;let r;const s=i.nodes.doc.createAndFill;i.nodes.doc.createAndFill=(...l)=>{if(r)return r;const c=s.apply(i.nodes.doc,l),p=JSON.parse(JSON.stringify(c.toJSON()));return p.content[0].content[0].attrs.id="initialBlockId",r=y.Node.fromJSON(i,p),r};let a;try{const l=t==null?void 0:t.content.map(c=>P(c,this.schema,o).toJSON());a=b.createDocument({type:"doc",content:[{type:"blockGroup",content:l}]},this.schema,this.options.parseOptions)}catch(l){throw console.error("Error creating document from blocks passed as `initialContent`. Caused by exception: ",l),new Error("Error creating document from blocks passed as `initialContent`:\n"+ +JSON.stringify(t.content))}this._state=k.EditorState.create({doc:a,schema:this.schema})}get state(){return this.view&&(this._state=this.view.state),this._state}createView(){}createViewAlternative(){queueMicrotask(()=>{this.view=new _.EditorView({mount:this.options.element},{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:this.state});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.createNodeViews()})}}const Ko=new k.PluginKey("blocknote-placeholder"),$o=(n,e)=>new k.Plugin({key:Ko,view:()=>{const t=document.createElement("style");document.head.appendChild(t);const o=t.sheet,i=(s="")=>`.bn-block-content${s} .bn-inline-content:has(> .ProseMirror-trailingBreak):before`,r=(s,a=!0)=>{const l=a?"[data-is-empty-and-focused]":"";if(s==="default")return i(l);const c=`[data-content-type="${s}"]`;return i(l+c)};for(const[s,a]of Object.entries(e)){const l=s==="default";o.insertRule(`${r(s,l)}{ content: ${JSON.stringify(a)}; }`),l||o.insertRule(`${r(s,!0)}{ content: ${JSON.stringify(a)}; }`)}return{destroy:()=>{document.head.removeChild(t)}}},props:{decorations:t=>{const{doc:o,selection:i}=t;if(!n.isEditable||!i.empty)return;const r=i.$anchor,s=r.parent;if(s.content.size>0)return null;const a=r.before(),l=_.Decoration.node(a,a+s.nodeSize,{"data-is-empty-and-focused":"true"});return _.DecorationSet.create(o,[l])}}}),ri="",si="",Wo={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class Ie{constructor(e){u(this,"_tiptapEditor");u(this,"blockCache",new WeakMap);u(this,"dictionary");u(this,"schema");u(this,"blockImplementations");u(this,"inlineContentImplementations");u(this,"styleImplementations");u(this,"formattingToolbar");u(this,"linkToolbar");u(this,"sideMenu");u(this,"suggestionMenus");u(this,"imagePanel");u(this,"tableHandles");u(this,"uploadFile");var l,c,p,h,f,m,g,S;this.options=e;const t=e;if(t.onEditorContentChange)throw new Error("onEditorContentChange initialization option is deprecated, use <BlockNoteView onChange={...} />, the useEditorChange(...) hook, or editor.onChange(...)");if(t.onTextCursorPositionChange)throw new Error("onTextCursorPositionChange initialization option is deprecated, use <BlockNoteView onSelectionChange={...} />, the useEditorSelectionChange(...) hook, or editor.onSelectionChange(...)");if(t.onEditorReady)throw new Error("onEditorReady is deprecated. Editor is immediately ready for use after creation.");if(t.editable)throw new Error("editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false");this.dictionary=e.dictionary||Ve;const o={defaultStyles:!0,schema:e.schema||ae.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};this.schema=o.schema,this.blockImplementations=o.schema.blockSpecs,this.inlineContentImplementations=o.schema.inlineContentSpecs,this.styleImplementations=o.schema.styleSpecs,this.formattingToolbar=new gt(this),this.linkToolbar=new wt(this),this.sideMenu=new _t(this),this.suggestionMenus=new vt(this),L("image",this)&&(this.imagePanel=new kt(this)),L("table",this)&&(this.tableHandles=new Bt(this));const i=Pt({editor:this,domAttributes:o.domAttributes||{},blockSchema:this.schema.blockSchema,blockSpecs:this.schema.blockSpecs,styleSpecs:this.schema.styleSpecs,inlineContentSpecs:this.schema.inlineContentSpecs,collaboration:o.collaboration,trailingBlock:o.trailingBlock}),r=b.Extension.create({name:"BlockNoteUIExtension",addProseMirrorPlugins:()=>[this.formattingToolbar.plugin,this.linkToolbar.plugin,this.sideMenu.plugin,this.suggestionMenus.plugin,...this.imagePanel?[this.imagePanel.plugin]:[],...this.tableHandles?[this.tableHandles.plugin]:[],$o(this,o.placeholders)]});i.push(r),this.uploadFile=o.uploadFile,o.collaboration&&o.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const s=o.initialContent||(e.collaboration?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:G.options.generateID()}]);if(!Array.isArray(s)||s.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+s);const a={...Wo,...o._tiptapOptions,content:s,extensions:o.enableBlockNoteExtensions===!1?((l=o._tiptapOptions)==null?void 0:l.extensions)||[]:[...((c=o._tiptapOptions)==null?void 0:c.extensions)||[],...i],editorProps:{...(p=o._tiptapOptions)==null?void 0:p.editorProps,attributes:{...(f=(h=o._tiptapOptions)==null?void 0:h.editorProps)==null?void 0:f.attributes,...(m=o.domAttributes)==null?void 0:m.editor,class:O("bn-editor",o.defaultStyles?"bn-default-styles":"",((S=(g=o.domAttributes)==null?void 0:g.editor)==null?void 0:S.class)||"")},transformPasted:qo}};this._tiptapEditor=new Go(a,this.schema.styleSchema)}static create(e={}){return new Ie(e)}mount(e){this._tiptapEditor.mount(e)}get prosemirrorView(){return this._tiptapEditor.view}get domElement(){return this._tiptapEditor.view.dom}isFocused(){return this._tiptapEditor.view.hasFocus()}focus(){this._tiptapEditor.view.focus()}get topLevelBlocks(){return this.topLevelBlocks}get document(){const e=[];return this._tiptapEditor.state.doc.firstChild.descendants(t=>(e.push(E(t,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),e}getBlock(e){const t=typeof e=="string"?e:e.id;let o;return this._tiptapEditor.state.doc.firstChild.descendants(i=>typeof o<"u"?!1:i.type.name!=="blockContainer"||i.attrs.id!==t?!0:(o=E(i,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),!1)),o}forEachBlock(e,t=!1){const o=this.document.slice();t&&o.reverse();function i(r){for(const s of r){if(!e(s))return!1;const a=t?s.children.slice().reverse():s.children;if(!i(a))return!1}return!0}i(o)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}getTextCursorPosition(){const{node:e,depth:t,startPos:o,endPos:i}=w(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from),r=this._tiptapEditor.state.doc.resolve(i).index(t-1),s=this._tiptapEditor.state.doc.resolve(i+1).node().childCount;let a;r>0&&(a=this._tiptapEditor.state.doc.resolve(o-2).node());let l;return r<s-1&&(l=this._tiptapEditor.state.doc.resolve(i+2).node()),{block:E(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),prevBlock:a===void 0?void 0:E(a,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),nextBlock:l===void 0?void 0:E(l,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)}}setTextCursorPosition(e,t="start"){const o=typeof e=="string"?e:e.id,{posBeforeNode:i}=xe(o,this._tiptapEditor.state.doc),{startPos:r,contentNode:s}=w(this._tiptapEditor.state.doc,i+2),a=this.schema.blockSchema[s.type.name].content;if(a==="none"){this._tiptapEditor.commands.setNodeSelection(r);return}if(a==="inline")t==="start"?this._tiptapEditor.commands.setTextSelection(r+1):this._tiptapEditor.commands.setTextSelection(r+s.nodeSize-1);else if(a==="table")t==="start"?this._tiptapEditor.commands.setTextSelection(r+4):this._tiptapEditor.commands.setTextSelection(r+s.nodeSize-4);else throw new I(a)}getSelection(){if(this._tiptapEditor.state.selection.from===this._tiptapEditor.state.selection.to||"node"in this._tiptapEditor.state.selection)return;const e=[];return this._tiptapEditor.state.doc.descendants((t,o)=>t.type.spec.group!=="blockContent"||o+t.nodeSize<this._tiptapEditor.state.selection.from||o>this._tiptapEditor.state.selection.to?!0:(e.push(E(this._tiptapEditor.state.doc.resolve(o).node(),this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),{blocks:e}}get isEditable(){return this._tiptapEditor.isEditable}set isEditable(e){this._tiptapEditor.options.editable!==e&&this._tiptapEditor.setEditable(e)}insertBlocks(e,t,o="before"){return oo(e,t,o,this)}updateBlock(e,t){return io(e,t,this)}removeBlocks(e){return ro(e,this)}replaceBlocks(e,t){return so(e,t,this)}insertInlineContent(e){const t=Q(e,this._tiptapEditor.schema,this.schema.styleSchema);ao({from:this._tiptapEditor.state.selection.from,to:this._tiptapEditor.state.selection.to},t,this)}getActiveStyles(){const e={},t=this._tiptapEditor.state.selection.$to.marks();for(const o of t){const i=this.schema.styleSchema[o.type.name];if(!i){console.warn("mark not found in styleschema",o.type.name);continue}i.propSchema==="boolean"?e[i.type]=!0:e[i.type]=o.attrs.stringValue}return e}addStyles(e){for(const[t,o]of Object.entries(e)){const i=this.schema.styleSchema[t];if(!i)throw new Error(`style ${t} not found in styleSchema`);if(i.propSchema==="boolean")this._tiptapEditor.commands.setMark(t);else if(i.propSchema==="string")this._tiptapEditor.commands.setMark(t,{stringValue:o});else throw new I(i.propSchema)}}removeStyles(e){for(const t of Object.keys(e))this._tiptapEditor.commands.unsetMark(t)}toggleStyles(e){for(const[t,o]of Object.entries(e)){const i=this.schema.styleSchema[t];if(!i)throw new Error(`style ${t} not found in styleSchema`);if(i.propSchema==="boolean")this._tiptapEditor.commands.toggleMark(t);else if(i.propSchema==="string")this._tiptapEditor.commands.toggleMark(t,{stringValue:o});else throw new I(i.propSchema)}}getSelectedText(){return this._tiptapEditor.state.doc.textBetween(this._tiptapEditor.state.selection.from,this._tiptapEditor.state.selection.to)}getSelectedLinkUrl(){return this._tiptapEditor.getAttributes("link").href}createLink(e,t){if(e==="")return;const{from:o,to:i}=this._tiptapEditor.state.selection;t||(t=this._tiptapEditor.state.doc.textBetween(o,i));const r=this._tiptapEditor.schema.mark("link",{href:e});this._tiptapEditor.view.dispatch(this._tiptapEditor.view.state.tr.insertText(t,o,i).addMark(o,o+t.length,r))}canNestBlock(){const{startPos:e,depth:t}=w(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return this._tiptapEditor.state.doc.resolve(e).index(t-1)>0}nestBlock(){this._tiptapEditor.commands.sinkListItem("blockContainer")}canUnnestBlock(){const{depth:e}=w(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return e>2}unnestBlock(){this._tiptapEditor.commands.liftListItem("blockContainer")}async blocksToHTMLLossy(e=this.document){return Z(this._tiptapEditor.schema,this).exportBlocks(e)}async tryParseHTMLToBlocks(e){return ht(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this._tiptapEditor.schema)}async blocksToMarkdownLossy(e=this.document){return co(e,this._tiptapEditor.schema,this)}async tryParseMarkdownToBlocks(e){return bo(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this._tiptapEditor.schema)}updateCollaborationUserInfo(e){if(!this.options.collaboration)throw new Error("Cannot update collaboration user info when collaboration is disabled.");this._tiptapEditor.commands.updateUser(e)}onChange(e){const t=()=>{e(this)};return this._tiptapEditor.on("update",t),()=>{this._tiptapEditor.off("update",t)}}onSelectionChange(e){const t=()=>{e(this)};return this._tiptapEditor.on("selectionUpdate",t),()=>{this._tiptapEditor.off("selectionUpdate",t)}}}function Jo(n){let e=n.getTextCursorPosition().block,t=n.schema.blockSchema[e.type].content;for(;t==="none";)e=n.getTextCursorPosition().nextBlock,t=n.schema.blockSchema[e.type].content,n.setTextCursorPosition(e,"end")}function N(n,e){const t=n.getTextCursorPosition().block;if(t.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");Array.isArray(t.content)&&(t.content.length===1&&K(t.content[0])&&t.content[0].type==="text"&&t.content[0].text==="/"||t.content.length===0)?n.updateBlock(t,e):(n.insertBlocks([e],t,"after"),n.setTextCursorPosition(n.getTextCursorPosition().nextBlock,"end"));const o=n.getTextCursorPosition().block;return Jo(n),o}function Xo(n){const e=[];return L("heading",n)&&e.push({onItemClick:()=>{N(n,{type:"heading",props:{level:1}})},badge:F("Mod-Alt-1"),key:"heading",...n.dictionary.slash_menu.heading},{onItemClick:()=>{N(n,{type:"heading",props:{level:2}})},badge:F("Mod-Alt-2"),key:"heading_2",...n.dictionary.slash_menu.heading_2},{onItemClick:()=>{N(n,{type:"heading",props:{level:3}})},badge:F("Mod-Alt-3"),key:"heading_3",...n.dictionary.slash_menu.heading_3}),L("numberedListItem",n)&&e.push({onItemClick:()=>{N(n,{type:"numberedListItem"})},badge:F("Mod-Shift-7"),key:"numbered_list",...n.dictionary.slash_menu.numbered_list}),L("bulletListItem",n)&&e.push({onItemClick:()=>{N(n,{type:"bulletListItem"})},badge:F("Mod-Shift-8"),key:"bullet_list",...n.dictionary.slash_menu.bullet_list}),L("paragraph",n)&&e.push({onItemClick:()=>{N(n,{type:"paragraph"})},badge:F("Mod-Alt-0"),key:"paragraph",...n.dictionary.slash_menu.paragraph}),L("table",n)&&e.push({onItemClick:()=>{N(n,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...n.dictionary.slash_menu.table}),L("image",n)&&e.push({onItemClick:()=>{const t=N(n,{type:"image"});n.prosemirrorView.dispatch(n._tiptapEditor.state.tr.setMeta(n.imagePanel.plugin,{block:t}))},key:"image",...n.dictionary.slash_menu.image}),e}function Yo(n,e){return n.filter(({title:t,aliases:o})=>t.toLowerCase().includes(e.toLowerCase())||o&&o.filter(i=>i.toLowerCase().includes(e.toLowerCase())).length!==0)}function Le(n=""){return typeof n=="string"?[{type:"text",text:n,styles:{}}]:n}function At(n){return typeof n=="string"?Le(n):Array.isArray(n)?n.flatMap(e=>typeof e=="string"?Le(e):ue(e)?{...e,content:Le(e.content)}:K(e)?e:{props:{},...e,content:At(e.content)}):n}function Qo(n,e){return e.map(t=>Pe(n,t))}function Pe(n,e){const t={id:"",type:e.type,props:{},content:n[e.type].content==="inline"?[]:void 0,children:[],...e};return Object.entries(n[e.type].propSchema).forEach(([o,i])=>{t.props[o]===void 0&&(t.props[o]=i.default)}),{...t,content:At(t.content),children:t.children.map(o=>Pe(n,o))}}function Nt(n){n.id||(n.id=G.options.generateID()),n.children&&Ht(n.children)}function Ht(n){for(const e of n)Nt(e)}d.BlockNoteEditor=Ie,d.BlockNoteSchema=ae,d.FormattingToolbarProsemirrorPlugin=gt,d.FormattingToolbarView=mt,d.ImagePanelProsemirrorPlugin=kt,d.ImagePanelView=bt,d.LinkToolbarProsemirrorPlugin=wt,d.SideMenuProsemirrorPlugin=_t,d.SideMenuView=Ct,d.SuggestionMenuProseMirrorPlugin=vt,d.TableHandlesProsemirrorPlugin=Bt,d.TableHandlesView=Mt,d.UniqueID=G,d.UnreachableCaseError=I,d.addIdsToBlock=Nt,d.addIdsToBlocks=Ht,d.addInlineContentAttributes=Qe,d.addInlineContentKeyboardShortcuts=Ze,d.addStyleAttributes=it,d.assertEmpty=yn,d.blockToNode=P,d.camelToDataKebab=te,d.checkBlockHasDefaultProp=no,d.checkBlockIsDefaultType=to,d.checkBlockTypeHasDefaultProp=ct,d.checkDefaultBlockTypeInSchema=L,d.contentNodeToInlineContent=oe,d.createBlockSpec=Ye,d.createBlockSpecFromStronglyTypedTiptapNode=$,d.createExternalHTMLExporter=Z,d.createInlineContentSpec=_n,d.createInlineContentSpecFromTipTapNode=tt,d.createInternalBlockSpec=ke,d.createInternalHTMLSerializer=fe,d.createInternalInlineContentSpec=et,d.createInternalStyleSpec=ve,d.createStronglyTypedTiptapNode=j,d.createStyleSpec=xn,d.createStyleSpecFromTipTapMark=U,d.createSuggestionMenu=vo,d.defaultBlockSchema=lt,d.defaultBlockSpecs=Ce,d.defaultInlineContentSchema=eo,d.defaultInlineContentSpecs=_e,d.defaultProps=C,d.defaultStyleSchema=Zn,d.defaultStyleSpecs=Te,d.filterSuggestionItems=Yo,d.formatKeyboardShortcut=F,d.formattingToolbarPluginKey=ft,d.getBlockFromPos=Je,d.getBlockNoteExtensions=Pt,d.getBlockSchemaFromSpecs=ye,d.getDefaultSlashMenuItems=Xo,d.getDraggableBlockFromCoords=re,d.getInlineContentParseRules=nt,d.getInlineContentSchemaFromSpecs=we,d.getParseRules=Xe,d.getStyleParseRules=rt,d.getStyleSchemaFromSpecs=Se,d.inheritedProps=ge,d.inlineContentToNodes=Q,d.insertOrUpdateBlock=N,d.isAppleOS=$e,d.isLinkInlineContent=de,d.isPartialLinkInlineContent=ue,d.isSafari=Tn,d.isStyledTextInlineContent=K,d.linkToolbarPluginKey=yt,d.locales=gn,d.mergeCSSClasses=O,d.nodeToBlock=E,d.nodeToCustomInlineContent=me,d.partialBlockToBlockForTesting=Pe,d.partialBlocksToBlocksForTesting=Qo,d.propsToAttributes=be,d.sideMenuPluginKey=Tt,d.stylePropsToAttributes=ot,d.suggestionMenuPluginKey=R,d.tableContentToNodes=he,d.tableHandlesPluginKey=X,d.uploadToTmpFilesDotOrg_DEV_ONLY=Cn,d.wrapInBlockStructure=ie,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(d,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("prosemirror-model"),require("rehype-parse"),require("rehype-stringify"),require("unified"),require("@tiptap/core"),require("prosemirror-state"),require("uuid"),require("hast-util-from-dom"),require("@tiptap/extension-bold"),require("@tiptap/extension-code"),require("@tiptap/extension-italic"),require("@tiptap/extension-strike"),require("@tiptap/extension-underline"),require("@tiptap/extension-table-cell"),require("@tiptap/extension-table-header"),require("@tiptap/extension-table-row"),require("prosemirror-tables"),require("rehype-remark"),require("remark-gfm"),require("remark-stringify"),require("remark-parse"),require("remark-rehype"),require("prosemirror-view"),require("@tiptap/extension-collaboration"),require("@tiptap/extension-collaboration-cursor"),require("@tiptap/extension-dropcursor"),require("@tiptap/extension-gapcursor"),require("@tiptap/extension-hard-break"),require("@tiptap/extension-history"),require("@tiptap/extension-link"),require("@tiptap/extension-text")):typeof define=="function"&&define.amd?define(["exports","prosemirror-model","rehype-parse","rehype-stringify","unified","@tiptap/core","prosemirror-state","uuid","hast-util-from-dom","@tiptap/extension-bold","@tiptap/extension-code","@tiptap/extension-italic","@tiptap/extension-strike","@tiptap/extension-underline","@tiptap/extension-table-cell","@tiptap/extension-table-header","@tiptap/extension-table-row","prosemirror-tables","rehype-remark","remark-gfm","remark-stringify","remark-parse","remark-rehype","prosemirror-view","@tiptap/extension-collaboration","@tiptap/extension-collaboration-cursor","@tiptap/extension-dropcursor","@tiptap/extension-gapcursor","@tiptap/extension-hard-break","@tiptap/extension-history","@tiptap/extension-link","@tiptap/extension-text"],_):(d=typeof globalThis<"u"?globalThis:d||self,_(d.blocknote={},d.prosemirrorModel,d.rehypeParse,d.rehypeStringify,d.unified,d.core,d.prosemirrorState,d.uuid,d.hastUtilFromDom,d.Bold,d.Code,d.Italic,d.Strike,d.Underline,d.extensionTableCell,d.extensionTableHeader,d.extensionTableRow,d.prosemirrorTables,d.rehypeRemark,d.remarkGfm,d.remarkStringify,d.remarkParse,d.remarkRehype,d.prosemirrorView,d.Collaboration,d.CollaborationCursor,d.extensionDropcursor,d.extensionGapcursor,d.extensionHardBreak,d.extensionHistory,d.extensionLink,d.extensionText))})(this,function(d,_,V,mi,pe,b,k,fi,he,gi,bi,ki,yi,_i,vi,wi,Ei,ze,Ci,xi,Si,Ti,Ve,S,Bi,Mi,Li,Ii,Pi,Ai,Ni,Hi){"use strict";var Un=Object.defineProperty;var Rn=(d,_,V)=>_ in d?Un(d,_,{enumerable:!0,configurable:!0,writable:!0,value:V}):d[_]=V;var u=(d,_,V)=>(Rn(d,typeof _!="symbol"?_+"":_,V),V);const x=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},Fe=x(V),qe=x(mi),Di=x(gi),Ui=x(bi),Ri=x(ki),Oi=x(yi),ji=x(_i),zi=x(Ci),Ke=x(xi),Vi=x(Si),Fi=x(Ti),qi=x(Ve),Ki=x(Bi),Gi=x(Mi),Ge={slash_menu:{heading:{title:"Heading 1",subtext:"Used for a top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Used for key sections",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Used for subsections and group headings",aliases:["h3","heading3","subheading"],group:"Headings"},numbered_list:{title:"Numbered List",subtext:"Used to display a numbered list",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"Used to display an unordered list",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},check_list:{title:"Check List",subtext:"Used to display a list with checkboxes",aliases:["ul","li","list","checklist","check list","checked list","checkbox"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"Used for the body of your document",aliases:["p","paragraph"],group:"Basic blocks"},table:{title:"Table",subtext:"Used for tables",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Insert an image",aliases:["image","imageUpload","upload","img","picture","media","url"],group:"Media"},video:{title:"Video",subtext:"Insert a video",aliases:["video","videoUpload","upload","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Insert audio",aliases:["audio","audioUpload","upload","mp3","sound","media","url"],group:"Media"},file:{title:"File",subtext:"Insert a file",aliases:["file","upload","embed","media","url"],group:"Media"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",bulletListItem:"List",numberedListItem:"List",checkListItem:"List"},file_blocks:{image:{add_button_text:"Add image"},video:{add_button_text:"Add video"},audio:{add_button_text:"Add audio"},file:{add_button_text:"Add file"}},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below"},suggestion_menu:{no_items_title:"No items found",loading:"Loading…"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},file_replace:{tooltip:{image:"Replace image",video:"Replace video",audio:"Replace audio",file:"Replace file"}},file_rename:{tooltip:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"},input_placeholder:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"}},file_download:{tooltip:{image:"Download image",video:"Download video",audio:"Download audio",file:"Download file"}},file_delete:{tooltip:{image:"Delete image",video:"Delete video",audio:"Delete audio",file:"Delete file"}},file_preview_toggle:{tooltip:"Toggle preview"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload image",video:"Upload video",audio:"Upload audio",file:"Upload file"},upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:{image:"Embed image",video:"Embed video",audio:"Embed audio",file:"Embed file"},url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},generic:{ctrl_shortcut:"Ctrl"}},Wi=Object.freeze(Object.defineProperty({__proto__:null,en:Ge,fr:{slash_menu:{heading:{title:"Titre 1",subtext:"Utilisé pour un titre de premier niveau",aliases:["h","titre1","h1"],group:"Titres"},heading_2:{title:"Titre 2",subtext:"Utilisé pour les sections clés",aliases:["h2","titre2","sous-titre"],group:"Titres"},heading_3:{title:"Titre 3",subtext:"Utilisé pour les sous-sections et les titres de groupe",aliases:["h3","titre3","sous-titre"],group:"Titres"},numbered_list:{title:"Liste Numérotée",subtext:"Utilisé pour afficher une liste numérotée",aliases:["ol","li","liste","listenumérotée","liste numérotée"],group:"Blocs de base"},bullet_list:{title:"Liste à Puces",subtext:"Utilisé pour afficher une liste non ordonnée",aliases:["ul","li","liste","listeàpuces","liste à puces"],group:"Blocs de base"},check_list:{title:"Liste de vérification",subtext:"Utilisé pour afficher une liste avec des cases à cocher",aliases:["ul","li","liste","liste de vérification","liste cochée","case à cocher"],group:"Blocs de base"},paragraph:{title:"Paragraphe",subtext:"Utilisé pour le corps de votre document",aliases:["p","paragraphe"],group:"Blocs de base"},table:{title:"Tableau",subtext:"Utilisé pour les tableaux",aliases:["tableau"],group:"Avancé"},image:{title:"Image",subtext:"Insérer une image",aliases:["image","uploadImage","télécharger","img","photo","média","url"],group:"Médias"},video:{title:"Vidéo",subtext:"Insérer une vidéo",aliases:["vidéo","téléchargerVidéo","téléverser","mp4","film","média","url"],group:"Média"},audio:{title:"Audio",subtext:"Insérer un audio",aliases:["audio","téléchargerAudio","téléverser","mp3","son","média","url"],group:"Média"},file:{title:"Fichier",subtext:"Insérer un fichier",aliases:["fichier","téléverser","intégrer","média","url"],group:"Média"}},placeholders:{default:"Entrez du texte ou tapez '/' pour les commandes",heading:"Titre",bulletListItem:"Liste",numberedListItem:"Liste",checkListItem:"Liste"},file_blocks:{image:{add_button_text:"Ajouter une image"},video:{add_button_text:"Ajouter une vidéo"},audio:{add_button_text:"Ajouter un audio"},file:{add_button_text:"Ajouter un fichier"}},side_menu:{add_block_label:"Ajouter un bloc",drag_handle_label:"Ouvrir le menu du bloc"},drag_handle:{delete_menuitem:"Supprimer",colors_menuitem:"Couleurs"},table_handle:{delete_column_menuitem:"Supprimer la colonne",delete_row_menuitem:"Supprimer la ligne",add_left_menuitem:"Ajouter une colonne à gauche",add_right_menuitem:"Ajouter une colonne à droite",add_above_menuitem:"Ajouter une ligne au-dessus",add_below_menuitem:"Ajouter une ligne en dessous"},suggestion_menu:{no_items_title:"Aucun élément trouvé",loading:"Chargement…"},color_picker:{text_title:"Texte",background_title:"Fond",colors:{default:"Défaut",gray:"Gris",brown:"Marron",red:"Rouge",orange:"Orange",yellow:"Jaune",green:"Vert",blue:"Bleu",purple:"Violet",pink:"Rose"}},formatting_toolbar:{bold:{tooltip:"Gras",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italique",secondary_tooltip:"Mod+I"},underline:{tooltip:"Souligner",secondary_tooltip:"Mod+U"},strike:{tooltip:"Barré",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Couleurs"},link:{tooltip:"Créer un lien",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Modifier la légende",input_placeholder:"Modifier la légende"},file_replace:{tooltip:{image:"Remplacer l'image",video:"Remplacer la vidéo",audio:"Remplacer l'audio",file:"Remplacer le fichier"}},file_rename:{tooltip:{image:"Renommer l'image",video:"Renommer la vidéo",audio:"Renommer l'audio",file:"Renommer le fichier"},input_placeholder:{image:"Renommer l'image",video:"Renommer la vidéo",audio:"Renommer l'audio",file:"Renommer le fichier"}},file_download:{tooltip:{image:"Télécharger l'image",video:"Télécharger la vidéo",audio:"Télécharger l'audio",file:"Télécharger le fichier"}},file_delete:{tooltip:{image:"Supprimer l'image",video:"Supprimer la vidéo",audio:"Supprimer l'audio",file:"Supprimer le fichier"}},file_preview_toggle:{tooltip:"Basculer l'aperçu"},nest:{tooltip:"Emboîter le bloc",secondary_tooltip:"Tab"},unnest:{tooltip:"Démboîter le bloc",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Aligner le texte à gauche"},align_center:{tooltip:"Aligner le texte au centre"},align_right:{tooltip:"Aligner le texte à droite"},align_justify:{tooltip:"Justifier le texte"}},file_panel:{upload:{title:"Télécharger",file_placeholder:{image:"Télécharger une image",video:"Télécharger une vidéo",audio:"Télécharger un fichier audio",file:"Télécharger un fichier"},upload_error:"Erreur : Échec du téléchargement"},embed:{title:"Intégrer",embed_button:{image:"Intégrer une image",video:"Intégrer une vidéo",audio:"Intégrer un fichier audio",file:"Intégrer un fichier"},url_placeholder:"Entrez l'URL"}},link_toolbar:{delete:{tooltip:"Supprimer le lien"},edit:{text:"Modifier le lien",tooltip:"Modifier"},open:{tooltip:"Ouvrir dans un nouvel onglet"},form:{title_placeholder:"Modifier le titre",url_placeholder:"Modifier l'URL"}},generic:{ctrl_shortcut:"Ctrl"}},is:{slash_menu:{heading:{title:"Fyrirsögn 1",subtext:"Notað fyrir efstu fyrirsögn",aliases:["h","fyrirsogn1","h1"],group:"Fyrirsagnir"},heading_2:{title:"Fyrirsögn 2",subtext:"Notað fyrir lykilhluta",aliases:["h2","fyrirsogn2","undirfyrirsogn"],group:"Fyrirsagnir"},heading_3:{title:"Fyrirsögn 3",subtext:"Notað fyrir undirhluta og hópfyrirsagnir",aliases:["h3","fyrirsogn3","undirfyrirsogn"],group:"Fyrirsagnir"},numbered_list:{title:"Númeruð listi",subtext:"Notað til að birta númeraðan lista",aliases:["ol","li","listi","numeradurlisti"],group:"Grunnblokkar"},bullet_list:{title:"Punktalisti",subtext:"Notað til að birta óraðaðan lista",aliases:["ul","li","listi","punktalisti"],group:"Grunnblokkar"},check_list:{title:"Athugunarlisti",subtext:"Notað til að sýna lista með gátreitum",aliases:["ul","li","listi","athugunarlisti","merktur listi"],group:"Grunnblokkar"},paragraph:{title:"Málsgrein",subtext:"Notað fyrir meginmál skjalsins",aliases:["p","malsgrein"],group:"Grunnblokkar"},table:{title:"Tafla",subtext:"Notað fyrir töflur",aliases:["tafla"],group:"Ítarlegt"},image:{title:"Mynd",subtext:"Settu inn mynd",aliases:["mynd","myndaupphlaed","upphlaed","img","mynd","media","url"],group:"Miðlar"},video:{title:"Myndband",subtext:"Setja inn myndband",aliases:["myndband","videoUpphala","hlaða upp","mp4","kvikmynd","miðill","url"],group:"Miðill"},audio:{title:"Hljóð",subtext:"Setja inn hljóð",aliases:["hljóð","audioUpphala","hlaða upp","mp3","hljóð","miðill","url"],group:"Miðlar"},file:{title:"Skrá",subtext:"Setja inn skrá",aliases:["skrá","hlaða upp","fella inn","miðill","url"],group:"Miðlar"}},placeholders:{default:"Sláðu inn texta eða skrifaðu '/' fyrir skipanir",heading:"Fyrirsögn",bulletListItem:"Listi",numberedListItem:"Listi",checkListItem:"Listi"},file_blocks:{image:{add_button_text:"Bæta við mynd"},video:{add_button_text:"Bæta við myndbandi"},audio:{add_button_text:"Bæta við hljóði"},file:{add_button_text:"Bæta við skrá"}},side_menu:{add_block_label:"Bæta við blokki",drag_handle_label:"Opna blokkarvalmynd"},drag_handle:{delete_menuitem:"Eyða",colors_menuitem:"Litir"},table_handle:{delete_column_menuitem:"Eyða dálki",delete_row_menuitem:"Eyða röð",add_left_menuitem:"Bæta dálki við til vinstri",add_right_menuitem:"Bæta dálki við til hægri",add_above_menuitem:"Bæta röð við fyrir ofan",add_below_menuitem:"Bæta röð við fyrir neðan"},suggestion_menu:{no_items_title:"Engir hlutir fundust",loading:"Hleður…"},color_picker:{text_title:"Texti",background_title:"Bakgrunnur",colors:{default:"Sjálfgefið",gray:"Grár",brown:"Brúnn",red:"Rauður",orange:"Appelsínugulur",yellow:"Gulur",green:"Grænn",blue:"Blár",purple:"Fjólublár",pink:"Bleikur"}},formatting_toolbar:{bold:{tooltip:"Feitletrað",secondary_tooltip:"Mod+B"},italic:{tooltip:"Skáletrað",secondary_tooltip:"Mod+I"},underline:{tooltip:"Undirstrikað",secondary_tooltip:"Mod+U"},strike:{tooltip:"Yfirstrikað",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Kóði",secondary_tooltip:""},colors:{tooltip:"Litir"},link:{tooltip:"Búa til tengil",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Breyta myndatexta",input_placeholder:"Breyta myndatexta"},file_replace:{tooltip:{image:"Skipta um mynd",video:"Skipta um myndband",audio:"Skipta um hljóð",file:"Skipta um skrá"}},file_rename:{tooltip:{image:"Endurnefna mynd",video:"Endurnefna myndband",audio:"Endurnefna hljóð",file:"Endurnefna skrá"},input_placeholder:{image:"Endurnefna mynd",video:"Endurnefna myndband",audio:"Endurnefna hljóð",file:"Endurnefna skrá"}},file_download:{tooltip:{image:"Sækja mynd",video:"Sækja myndband",audio:"Sækja hljóð",file:"Sækja skrá"}},file_delete:{tooltip:{image:"Eyða mynd",video:"Eyða myndbandi",audio:"Eyða hljóði",file:"Eyða skrá"}},file_preview_toggle:{tooltip:"Skipta um forskoðun"},nest:{tooltip:"Fella blokk saman",secondary_tooltip:"Tab"},unnest:{tooltip:"Afþýða blokk",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Vinstrijafna texta"},align_center:{tooltip:"Miðjustilla texta"},align_right:{tooltip:"Hægrijafna texta"},align_justify:{tooltip:"Jafna texta"}},file_panel:{upload:{title:"Hlaða upp",file_placeholder:{image:"Hlaða upp mynd",video:"Hlaða upp myndband",audio:"Hlaða upp hljóð",file:"Hlaða upp skrá"},upload_error:"Villa: Upphleðsla mistókst"},embed:{title:"Innsetja",embed_button:{image:"Innsetja mynd",video:"Innsetja myndband",audio:"Innsetja hljóð",file:"Innsetja skrá"},url_placeholder:"Sláðu inn URL"}},link_toolbar:{delete:{tooltip:"Fjarlægja tengil"},edit:{text:"Breyta tengli",tooltip:"Breyta"},open:{tooltip:"Opna í nýjum flipa"},form:{title_placeholder:"Breyta titli",url_placeholder:"Breyta URL"}},generic:{ctrl_shortcut:"Ctrl"}},ja:{slash_menu:{heading:{title:"見出し1",subtext:"トップレベルの見出しに使用",aliases:["h","見出し1","h1","大見出し"],group:"見出し"},heading_2:{title:"見出し2",subtext:"重要なセクションに使用",aliases:["h2","見出し2","subheading","中見出し"],group:"見出し"},heading_3:{title:"見出し3",subtext:"セクションやグループの見出しに使用",aliases:["h3","見出し3","subheading","小見出し"],group:"見出し"},numbered_list:{title:"番号付リスト",subtext:"番号付リストを表示するために使用",aliases:["ol","li","numberedlist","numbered list","リスト","番号付リスト","番号 リスト"],group:"基本ブロック"},bullet_list:{title:"箇条書き",subtext:"箇条書きを表示するために使用",aliases:["ul","li","bulletlist","bullet list","リスト","箇条書きリスト"],group:"基本ブロック"},check_list:{title:"チェックリスト",subtext:"チェックボックス付きリストを表示するために使用されます",aliases:["ul","li","list","checklist","checked list","リスト","チェックリスト","チェックされたリスト"],group:"基本ブロック"},paragraph:{title:"標準テキスト",subtext:"本文に使用",aliases:["p","paragraph","標準テキスト"],group:"基本ブロック"},table:{title:"表",subtext:"表に使用",aliases:["table","表","テーブル"],group:"高度なブロック"},image:{title:"画像",subtext:"画像を挿入",aliases:["image","imageUpload","upload","img","picture","media","url","画像"],group:"メディア"},video:{title:"ビデオ",subtext:"ビデオを挿入",aliases:["video","videoUpload","upload","mp4","film","media","url","ビデオ"],group:"メディア"},audio:{title:"オーディオ",subtext:"オーディオを挿入",aliases:["audio","audioUpload","upload","mp3","sound","media","url","オーディオ"],group:"メディア"},file:{title:"ファイル",subtext:"ファイルを挿入",aliases:["file","upload","embed","media","url","ファイル"],group:"メディア"}},placeholders:{default:"テキストを入力するか'/' を入力してコマンド選択",heading:"見出し",bulletListItem:"リストを追加",numberedListItem:"リストを追加",checkListItem:"リストを追加"},file_blocks:{image:{add_button_text:"画像を追加"},video:{add_button_text:"ビデオを追加"},audio:{add_button_text:"オーディオを追加"},file:{add_button_text:"ファイルを追加"}},side_menu:{add_block_label:"ブロックを追加",drag_handle_label:"ブロックメニュー"},drag_handle:{delete_menuitem:"削除",colors_menuitem:"色を変更"},table_handle:{delete_column_menuitem:"列を削除",delete_row_menuitem:"行を削除",add_left_menuitem:"左に列を追加",add_right_menuitem:"右に列を追加",add_above_menuitem:"上に行を追加",add_below_menuitem:"下に行を追加"},suggestion_menu:{no_items_title:"アイテムが見つかりません",loading:"読込中…"},color_picker:{text_title:"文字色",background_title:"背景色",colors:{default:"デフォルト",gray:"グレー",brown:"茶色",red:"赤",orange:"オレンジ",yellow:"黄色",green:"緑",blue:"青",purple:"紫",pink:"ピンク"}},formatting_toolbar:{bold:{tooltip:"太字",secondary_tooltip:"Mod+B"},italic:{tooltip:"斜体",secondary_tooltip:"Mod+I"},underline:{tooltip:"下線",secondary_tooltip:"Mod+U"},strike:{tooltip:"打ち消し",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"コード",secondary_tooltip:""},colors:{tooltip:"色"},link:{tooltip:"リンク",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"キャプションを編集",input_placeholder:"キャプションを編集"},file_replace:{tooltip:{image:"画像を置換",video:"ビデオを置換",audio:"オーディオを置換",file:"ファイルを置換"}},file_rename:{tooltip:{image:"画像の名前を変更",video:"ビデオの名前を変更",audio:"オーディオの名前を変更",file:"ファイルの名前を変更"},input_placeholder:{image:"画像の名前を変更",video:"ビデオの名前を変更",audio:"オーディオの名前を変更",file:"ファイルの名前を変更"}},file_download:{tooltip:{image:"画像をダウンロード",video:"ビデオをダウンロード",audio:"オーディオをダウンロード",file:"ファイルをダウンロード"}},file_delete:{tooltip:{image:"画像を削除",video:"ビデオを削除",audio:"オーディオを削除",file:"ファイルを削除"}},file_preview_toggle:{tooltip:"プレビューの切り替え"},nest:{tooltip:"インデント増",secondary_tooltip:"Tab"},unnest:{tooltip:"インデント減",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"左揃え"},align_center:{tooltip:"中央揃え"},align_right:{tooltip:"右揃え"},align_justify:{tooltip:"両端揃え"}},file_panel:{upload:{title:"アップロード",file_placeholder:{image:"画像をアップロード",video:"ビデオをアップロード",audio:"オーディオをアップロード",file:"ファイルをアップロード"},upload_error:"エラー: アップロードが失敗しました"},embed:{title:"埋め込み",embed_button:{image:"画像を埋め込む",video:"ビデオを埋め込む",audio:"オーディオを埋め込む",file:"ファイルを埋め込む"},url_placeholder:"URLを入力"}},link_toolbar:{delete:{tooltip:"リンクを解除"},edit:{text:"リンクを編集",tooltip:"編集"},open:{tooltip:"新しいタブでリンクを開く"},form:{title_placeholder:"タイトルを編集",url_placeholder:"URLを編集"}},generic:{ctrl_shortcut:"Ctrl"}},ko:{slash_menu:{heading:{title:"제목1",subtext:"섹션 제목(대)",aliases:["h","제목1","h1","대제목"],group:"제목"},heading_2:{title:"제목2",subtext:"섹션 제목(중)",aliases:["h2","제목2","중제목"],group:"제목"},heading_3:{title:"제목3",subtext:"섹션 제목(소)",aliases:["h3","제목3","subheading"],group:"제목"},numbered_list:{title:"번호 매기기 목록",subtext:"번호가 매겨진 목록을 추가합니다.",aliases:["ol","li","목록","번호 매기기 목록","번호 목록"],group:"기본 블록"},bullet_list:{title:"글머리 기호 목록",subtext:"간단한 글머리 기호를 추가합니다.",aliases:["ul","li","목록","글머리 기호 목록","글머리 목록"],group:"기본 블록"},check_list:{title:"체크리스트",subtext:"체크박스가 있는 목록을 표시하는 데 사용",aliases:["ul","li","목록","체크리스트","체크 리스트","체크된 목록","체크박스"],group:"기본 블록"},paragraph:{title:"본문",subtext:"일반 텍스트",aliases:["p","paragraph","본문"],group:"기본 블록"},table:{title:"표",subtext:"간단한 표를 추가합니다.",aliases:["표"],group:"고급"},image:{title:"이미지",subtext:"이미지 파일을 업로드합니다.",aliases:["image","imageUpload","upload","img","picture","media","이미지","url"],group:"미디어"},video:{title:"비디오",subtext:"비디오 삽입",aliases:["video","videoUpload","upload","mp4","film","media","동영상","url"],group:"미디어"},audio:{title:"오디오",subtext:"오디오 삽입",aliases:["audio","audioUpload","upload","mp3","sound","media","오디오","url"],group:"미디어"},file:{title:"파일",subtext:"파일 삽입",aliases:["file","upload","embed","media","파일","url"],group:"미디어"}},placeholders:{default:"텍스트를 입력하거나 /를 입력하여 명령을 입력하세요.",heading:"제목",bulletListItem:"목록",numberedListItem:"목록",checkListItem:"목록"},file_blocks:{image:{add_button_text:"이미지 추가"},video:{add_button_text:"비디오 추가"},audio:{add_button_text:"오디오 추가"},file:{add_button_text:"파일 추가"}},side_menu:{add_block_label:"블록 추가",drag_handle_label:"블록 메뉴 열기"},drag_handle:{delete_menuitem:"삭제",colors_menuitem:"색깔"},table_handle:{delete_column_menuitem:"열 1개 삭제",delete_row_menuitem:"행 삭제",add_left_menuitem:"왼쪽에 열 1개 추가",add_right_menuitem:"오른쪽에 열 1개 추가",add_above_menuitem:"위에 행 1개 추가",add_below_menuitem:"아래에 행 1개 추가"},suggestion_menu:{no_items_title:"항목을 찾을 수 없음",loading:"로딩 중…"},color_picker:{text_title:"텍스트",background_title:"배경",colors:{default:"기본",gray:"회색",brown:"갈색",red:"빨간색",orange:"주황색",yellow:"노란색",green:"녹색",blue:"파란색",purple:"보라색",pink:"분홍색"}},formatting_toolbar:{bold:{tooltip:"진하게",secondary_tooltip:"Mod+B"},italic:{tooltip:"기울임",secondary_tooltip:"Mod+I"},underline:{tooltip:"밑줄",secondary_tooltip:"Mod+U"},strike:{tooltip:"취소선",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"코드",secondary_tooltip:""},colors:{tooltip:"색깔"},link:{tooltip:"링크 만들기",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"이미지 캡션 수정",input_placeholder:"이미지 캡션 수정"},file_replace:{tooltip:{image:"이미지 교체",video:"비디오 교체",audio:"오디오 교체",file:"파일 교체"}},file_rename:{tooltip:{image:"이미지 이름 변경",video:"비디오 이름 변경",audio:"오디오 이름 변경",file:"파일 이름 변경"},input_placeholder:{image:"이미지 이름 변경",video:"비디오 이름 변경",audio:"오디오 이름 변경",file:"파일 이름 변경"}},file_download:{tooltip:{image:"이미지 다운로드",video:"비디오 다운로드",audio:"오디오 다운로드",file:"파일 다운로드"}},file_delete:{tooltip:{image:"이미지 삭제",video:"비디오 삭제",audio:"오디오 삭제",file:"파일 삭제"}},file_preview_toggle:{tooltip:"미리보기 전환"},nest:{tooltip:"중첩 블록",secondary_tooltip:"Tab"},unnest:{tooltip:"비중첩 블록",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"텍스트 왼쪽 맞춤"},align_center:{tooltip:"텍스트 가운데 맞춤"},align_right:{tooltip:"텍스트 오른쪽 맞춤"},align_justify:{tooltip:"텍스트 양쪽 맞춤"}},file_panel:{upload:{title:"업로드",file_placeholder:{image:"이미지 업로드",video:"비디오 업로드",audio:"오디오 업로드",file:"파일 업로드"},upload_error:"오류: 업로드 실패"},embed:{title:"임베드",embed_button:{image:"이미지 삽입",video:"비디오 삽입",audio:"오디오 삽입",file:"파일 삽입"},url_placeholder:"URL을 입력하세요."}},link_toolbar:{delete:{tooltip:"링크 삭제"},edit:{text:"링크 수정",tooltip:"수정"},open:{tooltip:"새 탭으로 열기"},form:{title_placeholder:"제목 수정",url_placeholder:"URL 수정"}},generic:{ctrl_shortcut:"Ctrl"}},nl:{slash_menu:{heading:{title:"Kop 1",subtext:"Gebruikt voor een hoofdkop",aliases:["h","kop1","h1"],group:"Koppen"},heading_2:{title:"Kop 2",subtext:"Gebruikt voor belangrijke secties",aliases:["h2","kop2","subkop"],group:"Koppen"},heading_3:{title:"Kop 3",subtext:"Gebruikt voor subsecties en groepskoppen",aliases:["h3","kop3","subkop"],group:"Koppen"},numbered_list:{title:"Genummerde Lijst",subtext:"Gebruikt om een genummerde lijst weer te geven",aliases:["ol","li","lijst","genummerdelijst","genummerde lijst"],group:"Basisblokken"},bullet_list:{title:"Puntenlijst",subtext:"Gebruikt om een ongeordende lijst weer te geven",aliases:["ul","li","lijst","puntenlijst","punten lijst"],group:"Basisblokken"},check_list:{title:"Controlelijst",subtext:"Gebruikt om een lijst met selectievakjes weer te geven",aliases:["ul","li","lijst","aangevinkte lijst","selectievakje"],group:"Basisblokken"},paragraph:{title:"Paragraaf",subtext:"Gebruikt voor de hoofdtekst van uw document",aliases:["p","paragraaf"],group:"Basisblokken"},table:{title:"Tabel",subtext:"Gebruikt voor tabellen",aliases:["tabel"],group:"Geavanceerd"},image:{title:"Afbeelding",subtext:"Voeg een afbeelding in",aliases:["afbeelding","imageUpload","upload","img","foto","media","url"],group:"Media"},video:{title:"Video",subtext:"Voeg een video in",aliases:["video","videoUploaden","upload","mp4","film","media","url","drive","dropbox"],group:"Media"},audio:{title:"Audio",subtext:"Voeg audio in",aliases:["audio","audioUploaden","upload","mp3","geluid","media","url"],group:"Media"},file:{title:"Bestand",subtext:"Voeg een bestand in",aliases:["bestand","upload","insluiten","media","url"],group:"Media"}},placeholders:{default:"Voer tekst in of type '/' voor commando's",heading:"Kop",bulletListItem:"Lijst",numberedListItem:"Lijst",checkListItem:"Lijst"},file_blocks:{image:{add_button_text:"Afbeelding toevoegen"},video:{add_button_text:"Video toevoegen"},audio:{add_button_text:"Audio toevoegen"},file:{add_button_text:"Bestand toevoegen"}},side_menu:{add_block_label:"Nieuw blok",drag_handle_label:"Open blok menu"},drag_handle:{delete_menuitem:"Verwijder",colors_menuitem:"Kleuren"},table_handle:{delete_column_menuitem:"Verwijder kolom",delete_row_menuitem:"Verwijder rij",add_left_menuitem:"Voeg kolom links toe",add_right_menuitem:"Voeg kolom rechts toe",add_above_menuitem:"Voeg rij boven toe",add_below_menuitem:"Voeg rij onder toe"},suggestion_menu:{no_items_title:"Geen items gevonden",loading:"Laden…"},color_picker:{text_title:"Tekst",background_title:"Achtergrond",colors:{default:"Standaard",gray:"Grijs",brown:"Bruin",red:"Rood",orange:"Oranje",yellow:"Geel",green:"Groen",blue:"Blauw",purple:"Paars",pink:"Roze"}},formatting_toolbar:{bold:{tooltip:"Vet",secondary_tooltip:"Mod+B"},italic:{tooltip:"Cursief",secondary_tooltip:"Mod+I"},underline:{tooltip:"Onderstrepen",secondary_tooltip:"Mod+U"},strike:{tooltip:"Doorstrepen",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Kleuren"},link:{tooltip:"Maak link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Bewerk onderschrift",input_placeholder:"Bewerk onderschrift"},file_replace:{tooltip:{image:"Afbeelding vervangen",video:"Video vervangen",audio:"Audio vervangen",file:"Bestand vervangen"}},file_rename:{tooltip:{image:"Afbeelding hernoemen",video:"Video hernoemen",audio:"Audio hernoemen",file:"Bestand hernoemen"},input_placeholder:{image:"Afbeelding hernoemen",video:"Video hernoemen",audio:"Audio hernoemen",file:"Bestand hernoemen"}},file_download:{tooltip:{image:"Afbeelding downloaden",video:"Video downloaden",audio:"Audio downloaden",file:"Bestand downloaden"}},file_delete:{tooltip:{image:"Afbeelding verwijderen",video:"Video verwijderen",audio:"Audio verwijderen",file:"Bestand verwijderen"}},file_preview_toggle:{tooltip:"Voorbeeldschakelaar"},nest:{tooltip:"Nest blok",secondary_tooltip:"Tab"},unnest:{tooltip:"Ontnest blok",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Tekst links uitlijnen"},align_center:{tooltip:"Tekst centreren"},align_right:{tooltip:"Tekst rechts uitlijnen"},align_justify:{tooltip:"Tekst uitvullen"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Afbeelding uploaden",video:"Video uploaden",audio:"Audio uploaden",file:"Bestand uploaden"},upload_error:"Fout: Upload mislukt"},embed:{title:"Insluiten",embed_button:{image:"Afbeelding insluiten",video:"Video insluiten",audio:"Audio insluiten",file:"Bestand insluiten"},url_placeholder:"Voer URL in"}},link_toolbar:{delete:{tooltip:"Verwijder link"},edit:{text:"Bewerk link",tooltip:"Bewerk"},open:{tooltip:"Open in nieuw tabblad"},form:{title_placeholder:"Bewerk titel",url_placeholder:"Bewerk URL"}},generic:{ctrl_shortcut:"Ctrl"}},pl:{slash_menu:{heading:{title:"Nagłówek 1",subtext:"Używany dla nagłówka najwyższego poziomu",aliases:["h","naglowek1","h1"],group:"Nagłówki"},heading_2:{title:"Nagłówek 2",subtext:"Używany dla kluczowych sekcji",aliases:["h2","naglowek2","podnaglowek"],group:"Nagłówki"},heading_3:{title:"Nagłówek 3",subtext:"Używany dla podsekcji i grup nagłówków",aliases:["h3","naglowek3","podnaglowek"],group:"Nagłówki"},numbered_list:{title:"Lista numerowana",subtext:"Używana do wyświetlania listy numerowanej",aliases:["ol","li","lista","numerowana lista"],group:"Podstawowe bloki"},bullet_list:{title:"Lista punktowana",subtext:"Używana do wyświetlania listy bez numeracji",aliases:["ul","li","lista","punktowana lista"],group:"Podstawowe bloki"},check_list:{title:"Lista z polami wyboru",subtext:"Używana do wyświetlania listy z polami wyboru",aliases:["ul","li","lista","lista z polami wyboru","pole wyboru"],group:"Podstawowe bloki"},paragraph:{title:"Akapit",subtext:"Używany dla treści dokumentu",aliases:["p","akapit"],group:"Podstawowe bloki"},table:{title:"Tabela",subtext:"Używana do tworzenia tabel",aliases:["tabela"],group:"Zaawansowane"},image:{title:"Zdjęcie",subtext:"Wstaw zdjęcie",aliases:["obraz","wrzućZdjęcie","wrzuć","img","zdjęcie","media","url"],group:"Media"},video:{title:"Wideo",subtext:"Wstaw wideo",aliases:["wideo","wrzućWideo","wrzuć","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Wstaw audio",aliases:["audio","wrzućAudio","wrzuć","mp3","dźwięk","media","url"],group:"Media"},file:{title:"Plik",subtext:"Wstaw plik",aliases:["plik","wrzuć","wstaw","media","url"],group:"Media"}},placeholders:{default:"Wprowadź tekst lub wpisz '/' aby użyć poleceń",heading:"Nagłówek",bulletListItem:"Lista",numberedListItem:"Lista",checkListItem:"Lista"},file_blocks:{image:{add_button_text:"Dodaj zdjęcie"},video:{add_button_text:"Dodaj wideo"},audio:{add_button_text:"Dodaj audio"},file:{add_button_text:"Dodaj plik"}},side_menu:{add_block_label:"Dodaj blok",drag_handle_label:"Otwórz menu bloków"},drag_handle:{delete_menuitem:"Usuń",colors_menuitem:"Kolory"},table_handle:{delete_column_menuitem:"Usuń kolumnę",delete_row_menuitem:"Usuń wiersz",add_left_menuitem:"Dodaj kolumnę po lewej",add_right_menuitem:"Dodaj kolumnę po prawej",add_above_menuitem:"Dodaj wiersz powyżej",add_below_menuitem:"Dodaj wiersz poniżej"},suggestion_menu:{no_items_title:"Nie znaleziono elementów",loading:"Ładowanie…"},color_picker:{text_title:"Tekst",background_title:"Tło",colors:{default:"Domyślny",gray:"Szary",brown:"Brązowy",red:"Czerwony",orange:"Pomarańczowy",yellow:"Żółty",green:"Zielony",blue:"Niebieski",purple:"Fioletowy",pink:"Różowy"}},formatting_toolbar:{bold:{tooltip:"Pogrubienie",secondary_tooltip:"Mod+B"},italic:{tooltip:"Kursywa",secondary_tooltip:"Mod+I"},underline:{tooltip:"Podkreślenie",secondary_tooltip:"Mod+U"},strike:{tooltip:"Przekreślenie",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Kod",secondary_tooltip:""},colors:{tooltip:"Kolory"},link:{tooltip:"Utwórz link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Zmień podpis",input_placeholder:"Zmień podpis"},file_replace:{tooltip:{image:"Zmień obraz",video:"Zmień wideo",audio:"Zmień audio",file:"Zmień plik"}},file_rename:{tooltip:{image:"Zmień nazwę zdjęcia",video:"Zmień nazwę wideo",audio:"Zmień nazwę audio",file:"Zmień nazwę pliku"},input_placeholder:{image:"Zmień nazwę zdjęcia",video:"Zmień nazwę wideo",audio:"Zmień nazwę audio",file:"Zmień nazwę pliku"}},file_download:{tooltip:{image:"Pobierz zdjęcie",video:"Pobierz wideo",audio:"Pobierz audio",file:"Pobierz plik"}},file_delete:{tooltip:{image:"Usuń zdjęcie",video:"Usuń wideo",audio:"Usuń audio",file:"Usuń plik"}},file_preview_toggle:{tooltip:"Przełącz podgląd"},nest:{tooltip:"Zagnieźdź blok",secondary_tooltip:"Tab"},unnest:{tooltip:"Odgagnieźdź blok",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Wyrównaj tekst do lewej"},align_center:{tooltip:"Wyśrodkuj tekst"},align_right:{tooltip:"Wyrównaj tekst do prawej"},align_justify:{tooltip:"Wyjustuj tekst"}},file_panel:{upload:{title:"Wrzuć",file_placeholder:{image:"Wrzuć zdjęcie",video:"Wrzuć wideo",audio:"Wrzuć audio",file:"Wrzuć plik"},upload_error:"Błąd: Przesyłanie nie powiodło się"},embed:{title:"Wstaw",embed_button:{image:"Wstaw zdjęice",video:"Wstaw wideo",audio:"Wstaw audio",file:"Wstaw plik"},url_placeholder:"Wprowadź URL"}},link_toolbar:{delete:{tooltip:"Usuń link"},edit:{text:"Edytuj link",tooltip:"Edytuj"},open:{tooltip:"Otwórz w nowej karcie"},form:{title_placeholder:"Edytuj tytuł",url_placeholder:"Edytuj URL"}},generic:{ctrl_shortcut:"Ctrl"}},pt:{slash_menu:{heading:{title:"Título",subtext:"Usado para um título de nível superior",aliases:["h","titulo1","h1"],group:"Títulos"},heading_2:{title:"Título 2",subtext:"Usado para seções principais",aliases:["h2","titulo2","subtitulo"],group:"Títulos"},heading_3:{title:"Título 3",subtext:"Usado para subseções e títulos de grupo",aliases:["h3","titulo3","subtitulo"],group:"Títulos"},numbered_list:{title:"Lista Numerada",subtext:"Usado para exibir uma lista numerada",aliases:["ol","li","lista","listanumerada","lista numerada"],group:"Blocos Básicos"},bullet_list:{title:"Lista com Marcadores",subtext:"Usado para exibir uma lista não ordenada",aliases:["ul","li","lista","listamarcadores","lista com marcadores"],group:"Blocos Básicos"},check_list:{title:"Lista de verificação",subtext:"Usado para exibir uma lista com caixas de seleção",aliases:["ul","li","lista","lista de verificação","lista marcada","caixa de seleção"],group:"Blocos básicos"},paragraph:{title:"Parágrafo",subtext:"Usado para o corpo do seu documento",aliases:["p","paragrafo"],group:"Blocos Básicos"},table:{title:"Tabela",subtext:"Usado para tabelas",aliases:["tabela"],group:"Avançado"},image:{title:"Imagem",subtext:"Inserir uma imagem",aliases:["imagem","uploadImagem","upload","img","foto","media","url"],group:"Mídia"},video:{title:"Vídeo",subtext:"Inserir um vídeo",aliases:["vídeo","uploadVídeo","upload","mp4","filme","mídia","url"],group:"Mídia"},audio:{title:"Áudio",subtext:"Inserir um áudio",aliases:["áudio","uploadÁudio","upload","mp3","som","mídia","url"],group:"Mídia"},file:{title:"Arquivo",subtext:"Inserir um arquivo",aliases:["arquivo","upload","incorporar","mídia","url"],group:"Mídia"}},placeholders:{default:"Digite texto ou use '/' para comandos",heading:"Título",bulletListItem:"Lista",numberedListItem:"Lista",checkListItem:"Lista"},file_blocks:{image:{add_button_text:"Adicionar imagem"},video:{add_button_text:"Adicionar vídeo"},audio:{add_button_text:"Adicionar áudio"},file:{add_button_text:"Adicionar arquivo"}},side_menu:{add_block_label:"Adicionar bloco",drag_handle_label:"Abrir menu do bloco"},drag_handle:{delete_menuitem:"Excluir",colors_menuitem:"Cores"},table_handle:{delete_column_menuitem:"Excluir coluna",delete_row_menuitem:"Excluir linha",add_left_menuitem:"Adicionar coluna à esquerda",add_right_menuitem:"Adicionar coluna à direita",add_above_menuitem:"Adicionar linha acima",add_below_menuitem:"Adicionar linha abaixo"},suggestion_menu:{no_items_title:"Nenhum item encontrado",loading:"Carregando…"},color_picker:{text_title:"Texto",background_title:"Fundo",colors:{default:"Padrão",gray:"Cinza",brown:"Marrom",red:"Vermelho",orange:"Laranja",yellow:"Amarelo",green:"Verde",blue:"Azul",purple:"Roxo",pink:"Rosa"}},formatting_toolbar:{bold:{tooltip:"Negrito",secondary_tooltip:"Mod+B"},italic:{tooltip:"Itálico",secondary_tooltip:"Mod+I"},underline:{tooltip:"Sublinhado",secondary_tooltip:"Mod+U"},strike:{tooltip:"Riscado",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Código",secondary_tooltip:""},colors:{tooltip:"Cores"},link:{tooltip:"Criar link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Editar legenda",input_placeholder:"Editar legenda"},file_replace:{tooltip:{image:"Substituir imagem",video:"Substituir vídeo",audio:"Substituir áudio",file:"Substituir arquivo"}},file_rename:{tooltip:{image:"Renomear imagem",video:"Renomear vídeo",audio:"Renomear áudio",file:"Renomear arquivo"},input_placeholder:{image:"Renomear imagem",video:"Renomear vídeo",audio:"Renomear áudio",file:"Renomear arquivo"}},file_download:{tooltip:{image:"Baixar imagem",video:"Baixar vídeo",audio:"Baixar áudio",file:"Baixar arquivo"}},file_delete:{tooltip:{image:"Excluir imagem",video:"Excluir vídeo",audio:"Excluir áudio",file:"Excluir arquivo"}},file_preview_toggle:{tooltip:"Alternar visualização"},nest:{tooltip:"Aninhar bloco",secondary_tooltip:"Tab"},unnest:{tooltip:"Desaninhar bloco",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Alinhar à esquerda"},align_center:{tooltip:"Alinhar ao centro"},align_right:{tooltip:"Alinhar à direita"},align_justify:{tooltip:"Justificar texto"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload de imagem",video:"Upload de vídeo",audio:"Upload de áudio",file:"Upload de arquivo"},upload_error:"Erro: Falha no upload"},embed:{title:"Incorporar",embed_button:{image:"Incorporar imagem",video:"Incorporar vídeo",audio:"Incorporar áudio",file:"Incorporar arquivo"},url_placeholder:"Insira a URL"}},link_toolbar:{delete:{tooltip:"Remover link"},edit:{text:"Editar link",tooltip:"Editar"},open:{tooltip:"Abrir em nova aba"},form:{title_placeholder:"Editar título",url_placeholder:"Editar URL"}},generic:{ctrl_shortcut:"Ctrl"}},vi:{slash_menu:{heading:{title:"Tiêu đề H1",subtext:"Sử dụng cho tiêu đề cấp cao nhất",aliases:["h","tieude1","dd1"],group:"Tiêu đề"},heading_2:{title:"Tiêu đề H2",subtext:"Sử dụng cho các phần chính",aliases:["h2","tieude2","tieudephu"],group:"Tiêu đề"},heading_3:{title:"Tiêu đề H3",subtext:"Sử dụng cho phụ đề và tiêu đề nhóm",aliases:["h3","tieude3","tieudephu"],group:"Tiêu đề"},numbered_list:{title:"Danh sách đánh số",subtext:"Sử dụng để hiển thị danh sách có đánh số",aliases:["ol","li","ds","danhsachdso","danh sach danh so"],group:"Khối cơ bản"},bullet_list:{title:"Danh sách",subtext:"Sử dụng để hiển thị danh sách không đánh số",aliases:["ul","li","ds","danhsach","danh sach"],group:"Khối cơ bản"},check_list:{title:"Danh sách kiểm tra",subtext:"Dùng để hiển thị danh sách có hộp kiểm",aliases:["ul","li","danh sach","danh sach kiem tra","danh sach da kiem tra","hop kiem"],group:"Khối cơ bản"},paragraph:{title:"Đoạn văn",subtext:"Sử dụng cho nội dung chính của tài liệu",aliases:["p","doanvan"],group:"Khối cơ bản"},table:{title:"Bảng",subtext:"Sử dụng để tạo bảng",aliases:["bang"],group:"Nâng cao"},image:{title:"Hình ảnh",subtext:"Chèn hình ảnh",aliases:["anh","tai-len-anh","tai-len","img","hinh","media","url"],group:"Phương tiện"},video:{title:"Video",subtext:"Chèn video",aliases:["video","tai-len-video","tai-len","mp4","phim","media","url"],group:"Phương tiện"},audio:{title:"Âm thanh",subtext:"Chèn âm thanh",aliases:["âm thanh","tai-len-am-thanh","tai-len","mp3","am thanh","media","url"],group:"Phương tiện"},file:{title:"Tệp",subtext:"Chèn tệp",aliases:["tep","tai-len","nhung","media","url"],group:"Phương tiện"}},placeholders:{default:"Nhập văn bản hoặc gõ '/' để thêm định dạng",heading:"Tiêu đề",bulletListItem:"Danh sách",numberedListItem:"Danh sách",checkListItem:"Danh sách"},file_blocks:{image:{add_button_text:"Thêm ảnh"},video:{add_button_text:"Thêm video"},audio:{add_button_text:"Thêm âm thanh"},file:{add_button_text:"Thêm tệp"}},side_menu:{add_block_label:"Thêm khối",drag_handle_label:"Mở trình đơn khối"},drag_handle:{delete_menuitem:"Xóa",colors_menuitem:"Màu sắc"},table_handle:{delete_column_menuitem:"Xóa cột",delete_row_menuitem:"Xóa hàng",add_left_menuitem:"Thêm cột bên trái",add_right_menuitem:"Thêm cột bên phải",add_above_menuitem:"Thêm hàng phía trên",add_below_menuitem:"Thêm hàng phía dưới"},suggestion_menu:{no_items_title:"Không tìm thấy mục nào",loading:"Đang tải..."},color_picker:{text_title:"Văn bản",background_title:"Nền",colors:{default:"Mặc định",gray:"Xám",brown:"Nâu",red:"Đỏ",orange:"Cam",yellow:"Vàng",green:"Xanh lá",blue:"Xanh dương",purple:"Tím",pink:"Hồng"}},formatting_toolbar:{bold:{tooltip:"In đậm",secondary_tooltip:"Mod+B"},italic:{tooltip:"In nghiêng",secondary_tooltip:"Mod+I"},underline:{tooltip:"Gạch dưới",secondary_tooltip:"Mod+U"},strike:{tooltip:"Gạch ngang",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Màu sắc"},link:{tooltip:"Tạo liên kết",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Chỉnh sửa chú thích",input_placeholder:"Chỉnh sửa chú thích"},file_replace:{tooltip:{image:"Thay thế hình ảnh",video:"Thay thế video",audio:"Thay thế âm thanh",file:"Thay thế tệp"}},file_rename:{tooltip:{image:"Đổi tên hình ảnh",video:"Đổi tên video",audio:"Đổi tên âm thanh",file:"Đổi tên tệp"},input_placeholder:{image:"Đổi tên hình ảnh",video:"Đổi tên video",audio:"Đổi tên âm thanh",file:"Đổi tên tệp"}},file_download:{tooltip:{image:"Tải xuống hình ảnh",video:"Tải xuống video",audio:"Tải xuống âm thanh",file:"Tải xuống tệp"}},file_delete:{tooltip:{image:"Xóa hình ảnh",video:"Xóa video",audio:"Xóa âm thanh",file:"Xóa tệp"}},file_preview_toggle:{tooltip:"Chuyển đổi xem trước"},nest:{tooltip:"Lồng khối",secondary_tooltip:"Tab"},unnest:{tooltip:"Bỏ lồng khối",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Căn trái văn bản"},align_center:{tooltip:"Căn giữa văn bản"},align_right:{tooltip:"Căn phải văn bản"},align_justify:{tooltip:"Căn đều văn bản"}},file_panel:{upload:{title:"Tải lên",file_placeholder:{image:"Tải lên hình ảnh",video:"Tải lên video",audio:"Tải lên âm thanh",file:"Tải lên tệp"},upload_error:"Lỗi: Tải lên thất bại"},embed:{title:"Nhúng",embed_button:{image:"Nhúng hình ảnh",video:"Nhúng video",audio:"Nhúng âm thanh",file:"Nhúng tệp"},url_placeholder:"Nhập URL"}},link_toolbar:{delete:{tooltip:"Xóa liên kết"},edit:{text:"Chỉnh sửa liên kết",tooltip:"Chỉnh sửa"},open:{tooltip:"Mở trong tab mới"},form:{title_placeholder:"Chỉnh sửa tiêu đề",url_placeholder:"Chỉnh sửa URL"}},generic:{ctrl_shortcut:"Ctrl"}},zh:{slash_menu:{heading:{title:"一级标题",subtext:"用于顶级标题",aliases:["h","heading1","h1","标题","一级标题"],group:"标题"},heading_2:{title:"二级标题",subtext:"用于关键部分",aliases:["h2","heading2","subheading","标题","二级标题","副标题"],group:"标题"},heading_3:{title:"三级标题",subtext:"用于小节和分组标题",aliases:["h3","heading3","subheading","标题","三级标题"],group:"标题"},numbered_list:{title:"有序列表",subtext:"用于显示有序列表",aliases:["ol","li","list","numberedlist","numbered list","列表","有序列表"],group:"基础"},bullet_list:{title:"无序列表",subtext:"用于显示无序列表",aliases:["ul","li","list","bulletlist","bullet list","列表","无序列表"],group:"基础"},check_list:{title:"检查清单",subtext:"用于显示带有复选框的列表",aliases:["ul","li","checklist","checked list","列表","检查清单","勾选列表","复选框"],group:"基本块"},paragraph:{title:"段落",subtext:"用于文档正文",aliases:["p","paragraph","text","正文"],group:"基础"},table:{title:"表格",subtext:"使用表格",aliases:["table","表格"],group:"高级功能"},image:{title:"图片",subtext:"插入图片",aliases:["图片","上传图片","上传","image","img","相册","媒体","url"],group:"媒体"},video:{title:"视频",subtext:"插入视频",aliases:["视频","视频上传","上传","video","mp4","电影","媒体","url","驱动","dropbox"],group:"媒体"},audio:{title:"音频",subtext:"插入音频",aliases:["音频","音频上传","上传","audio","mp3","声音","媒体","url","驱动","dropbox"],group:"媒体"},file:{title:"文件",subtext:"插入文件",aliases:["文件","上传","file","嵌入","媒体","url"],group:"媒体"}},placeholders:{default:"输入 '/' 以使用命令",heading:"标题",bulletListItem:"列表",numberedListItem:"列表",checkListItem:"列表"},file_blocks:{image:{add_button_text:"添加图片"},video:{add_button_text:"添加视频"},audio:{add_button_text:"添加音频"},file:{add_button_text:"添加文件"}},side_menu:{add_block_label:"添加块",drag_handle_label:"打开菜单"},drag_handle:{delete_menuitem:"删除",colors_menuitem:"颜色"},table_handle:{delete_column_menuitem:"删除列",delete_row_menuitem:"删除行",add_left_menuitem:"左侧添加列",add_right_menuitem:"右侧添加列",add_above_menuitem:"上方添加行",add_below_menuitem:"下方添加行"},suggestion_menu:{no_items_title:"无匹配项",loading:"加载中…"},color_picker:{text_title:"文本",background_title:"背景色",colors:{default:"默认",gray:"灰色",brown:"棕色",red:"红色",orange:"橙色",yellow:"黄色",green:"绿色",blue:"蓝色",purple:"紫色",pink:"粉色"}},formatting_toolbar:{bold:{tooltip:"加粗",secondary_tooltip:"Mod+B"},italic:{tooltip:"斜体",secondary_tooltip:"Mod+I"},underline:{tooltip:"下划线",secondary_tooltip:"Mod+U"},strike:{tooltip:"删除线",secondary_tooltip:"Mod+Shift+X"},code:{tooltip:"代码标记",secondary_tooltip:""},colors:{tooltip:"颜色"},link:{tooltip:"添加链接",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"编辑标题",input_placeholder:"编辑标题"},file_replace:{tooltip:{image:"替换图片",video:"替换视频",audio:"替换音频",file:"替换文件"}},file_rename:{tooltip:{image:"重命名图片",video:"重命名视频",audio:"重命名音频",file:"重命名文件"},input_placeholder:{image:"重命名图片",video:"重命名视频",audio:"重命名音频",file:"重命名文件"}},file_download:{tooltip:{image:"下载图片",video:"下载视频",audio:"下载音频",file:"下载文件"}},file_delete:{tooltip:{image:"删除图片",video:"删除视频",audio:"删除音频",file:"删除文件"}},file_preview_toggle:{tooltip:"切换预览"},nest:{tooltip:"嵌套",secondary_tooltip:"Tab"},unnest:{tooltip:"取消嵌套",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"左对齐"},align_center:{tooltip:"居中"},align_right:{tooltip:"右对齐"},align_justify:{tooltip:"文本对齐"}},file_panel:{upload:{title:"上传",file_placeholder:{image:"上传图片",video:"上传视频",audio:"上传音频",file:"上传文件"},upload_error:"Error:上传失败"},embed:{title:"嵌入",embed_button:{image:"嵌入图片",video:"嵌入视频",audio:"嵌入音频",file:"嵌入文件"},url_placeholder:"输入图片地址"}},link_toolbar:{delete:{tooltip:"清除链接"},edit:{text:"编辑链接",tooltip:"编辑"},open:{tooltip:"新窗口打开"},form:{title_placeholder:"编辑标题",url_placeholder:"编辑链接地址"}},generic:{ctrl_shortcut:"Ctrl"}}},Symbol.toStringTag,{value:"Module"}));function $i(t,e=JSON.stringify){const i={};return t.filter(o=>{const n=e(o);return Object.prototype.hasOwnProperty.call(i,n)?!1:i[n]=!0})}function Xi(t){const e=t.filter((o,n)=>t.indexOf(o)!==n);return $i(e)}const K=b.Extension.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>{if(typeof window<"u"&&window.__TEST_OPTIONS){const t=window.__TEST_OPTIONS;return t.mockID===void 0?t.mockID=0:t.mockID++,t.mockID.toString()}return fi.v4()},filterTransaction:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:t=>t.getAttribute(`data-${this.options.attributeName}`),renderHTML:t=>({[`data-${this.options.attributeName}`]:t[this.options.attributeName]})}}}]},addProseMirrorPlugins(){let t=null,e=!1;return[new k.Plugin({key:new k.PluginKey("uniqueID"),appendTransaction:(i,o,n)=>{const r=i.some(g=>g.docChanged)&&!o.doc.eq(n.doc),a=this.options.filterTransaction&&i.some(g=>{let y,E;return!(!((E=(y=this.options).filterTransaction)===null||E===void 0)&&E.call(y,g))});if(!r||a)return;const{tr:s}=n,{types:l,attributeName:c,generateID:p}=this.options,h=b.combineTransactionSteps(o.doc,i),{mapping:m}=h;if(b.getChangedRanges(h).forEach(({newRange:g})=>{const y=b.findChildrenInRange(n.doc,g,I=>l.includes(I.type.name)),E=y.map(({node:I})=>I.attrs[c]).filter(I=>I!==null),N=Xi(E);y.forEach(({node:I,pos:ne})=>{let je;const ui=(je=s.doc.nodeAt(ne))===null||je===void 0?void 0:je.attrs[c];if(ui===null){const pi=o.doc.type.createAndFill().content;if(o.doc.content.findDiffStart(pi)===null){const hi=JSON.parse(JSON.stringify(n.doc.toJSON()));if(hi.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(hi.content)===JSON.stringify(pi.toJSON())){s.setNodeMarkup(ne,void 0,{...I.attrs,[c]:"initialBlockId"});return}}s.setNodeMarkup(ne,void 0,{...I.attrs,[c]:p()});return}const{deleted:Dn}=m.invert().mapResult(ne);Dn&&N.includes(ui)&&s.setNodeMarkup(ne,void 0,{...I.attrs,[c]:p()})})}),!!s.steps.length)return s},view(i){const o=n=>{let r;t=!((r=i.dom.parentElement)===null||r===void 0)&&r.contains(n.target)?i.dom.parentElement:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(i,o)=>{let n;return(t!==i.dom.parentElement||((n=o.dataTransfer)===null||n===void 0?void 0:n.effectAllowed)==="copy")&&(t=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:i=>{if(!e)return i;const{types:o,attributeName:n}=this.options,r=a=>{const s=[];return a.forEach(l=>{if(l.isText){s.push(l);return}if(!o.includes(l.type.name)){s.push(l.copy(r(l.content)));return}const c=l.type.create({...l.attrs,[n]:null},r(l.content),l.marks);s.push(c)}),_.Fragment.from(s)};return e=!1,new _.Slice(r(i.content),i.openStart,i.openEnd)}}})]}});function We(t){const e=t.attrs.id,i=t.firstChild,o=i.type,n=t.childCount===2?t.lastChild.childCount:0;return{id:e,node:t,contentNode:i,contentType:o,numChildBlocks:n}}function v(t,e){const o=t.nodeSize-2;if(e<=1)for(e=1+1;t.resolve(e).parent.type.name!=="blockContainer"&&e<o;)e++;else if(e>=o)for(e=o-1;t.resolve(e).parent.type.name!=="blockContainer"&&e>1;)e--;t.resolve(e).parent.type.name==="blockGroup"&&e++;const n=t.resolve(e),r=n.depth;let a=n.node(r),s=r;for(;;){if(s<0)throw new Error("Could not find blockContainer node. This can only happen if the underlying BlockNote schema has been edited.");if(a.type.name==="blockContainer")break;s-=1,a=n.node(s)}const{id:l,contentNode:c,contentType:p,numChildBlocks:h}=We(a),m=n.start(s),f=n.end(s);return{id:l,node:a,contentNode:c,contentType:p,numChildBlocks:h,startPos:m,endPos:f,depth:s}}function me(t){return t.type==="link"}function fe(t){return typeof t!="string"&&t.type==="link"}function G(t){return typeof t!="string"&&t.type==="text"}class P extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function Zi(t,e=!0){const{"data-test":i,...o}=t;if(Object.keys(o).length>0&&e)throw new Error("Object must be empty "+JSON.stringify(t))}function $e(t,e,i){const o=[];for(const[n,r]of Object.entries(t.styles)){const a=i[n];if(!a)throw new Error(`style ${n} not found in styleSchema`);if(a.propSchema==="boolean")o.push(e.mark(n));else if(a.propSchema==="string")o.push(e.mark(n,{stringValue:r}));else throw new P(a.propSchema)}return t.text.split(/(\n)/g).filter(n=>n.length>0).map(n=>n===`
2
+ `?e.nodes.hardBreak.create():e.text(n,o))}function Ji(t,e,i){const o=e.marks.link.create({href:t.href});return ge(t.content,e,i).map(n=>{if(n.type.name==="text")return n.mark([...n.marks,o]);if(n.type.name==="hardBreak")return n;throw new Error("unexpected node type")})}function ge(t,e,i){const o=[];if(typeof t=="string")return o.push(...$e({type:"text",text:t,styles:{}},e,i)),o;for(const n of t)o.push(...$e(n,e,i));return o}function Z(t,e,i){const o=[];for(const n of t)typeof n=="string"?o.push(...ge(n,e,i)):fe(n)?o.push(...Ji(n,e,i)):G(n)?o.push(...ge([n],e,i)):o.push(Xe(n,e,i));return o}function be(t,e,i){const o=[];for(const n of t.rows){const r=[];for(const s of n.cells){let l;if(!s)l=e.nodes.tableParagraph.create({});else if(typeof s=="string")l=e.nodes.tableParagraph.create({},e.text(s));else{const p=Z(s,e,i);l=e.nodes.tableParagraph.create({},p)}const c=e.nodes.tableCell.create({},l);r.push(c)}const a=e.nodes.tableRow.create({},r);o.push(a)}return o}function Xe(t,e,i){let o,n=t.type;if(n===void 0&&(n="paragraph"),!e.nodes[n])throw new Error(`node type ${n} not found in schema`);if(!t.content)o=e.nodes[n].create(t.props);else if(typeof t.content=="string")o=e.nodes[n].create(t.props,e.text(t.content));else if(Array.isArray(t.content)){const r=Z(t.content,e,i);o=e.nodes[n].create(t.props,r)}else if(t.content.type==="tableContent"){const r=be(t.content,e,i);o=e.nodes[n].create(t.props,r)}else throw new P(t.content.type);return o}function A(t,e,i){let o=t.id;o===void 0&&(o=K.options.generateID());const n=Xe(t,e,i),r=[];if(t.children)for(const s of t.children)r.push(A(s,e,i));const a=e.nodes.blockGroup.create({},r);return e.nodes.blockContainer.create({id:o,...t.props},r.length>0?[n,a]:n)}function Yi(t,e,i){const o={type:"tableContent",rows:[]};return t.content.forEach(n=>{const r={cells:[]};n.content.forEach(a=>{r.cells.push(re(a.firstChild,e,i))}),o.rows.push(r)}),o}function re(t,e,i){const o=[];let n;return t.content.forEach(r=>{if(r.type.name==="hardBreak"){if(n)if(G(n))n.text+=`
3
+ `;else if(me(n))n.content[n.content.length-1].text+=`
4
+ `;else throw new Error("unexpected");else n={type:"text",text:`
5
+ `,styles:{}};return}if(r.type.name!=="link"&&r.type.name!=="text"&&e[r.type.name]){n&&(o.push(n),n=void 0),o.push(ke(r,e,i));return}const a={};let s;for(const l of r.marks)if(l.type.name==="link")s=l;else{const c=i[l.type.name];if(!c)throw new Error(`style ${l.type.name} not found in styleSchema`);if(c.propSchema==="boolean")a[c.type]=!0;else if(c.propSchema==="string")a[c.type]=l.attrs.stringValue;else throw new P(c.propSchema)}n?G(n)?s?(o.push(n),n={type:"link",href:s.attrs.href,content:[{type:"text",text:r.textContent,styles:a}]}):JSON.stringify(n.styles)===JSON.stringify(a)?n.text+=r.textContent:(o.push(n),n={type:"text",text:r.textContent,styles:a}):me(n)&&(s?n.href===s.attrs.href?JSON.stringify(n.content[n.content.length-1].styles)===JSON.stringify(a)?n.content[n.content.length-1].text+=r.textContent:n.content.push({type:"text",text:r.textContent,styles:a}):(o.push(n),n={type:"link",href:s.attrs.href,content:[{type:"text",text:r.textContent,styles:a}]}):(o.push(n),n={type:"text",text:r.textContent,styles:a})):s?n={type:"link",href:s.attrs.href,content:[{type:"text",text:r.textContent,styles:a}]}:n={type:"text",text:r.textContent,styles:a}}),n&&o.push(n),o}function ke(t,e,i){if(t.type.name==="text"||t.type.name==="link")throw new Error("unexpected");const o={},n=e[t.type.name];for(const[s,l]of Object.entries(t.attrs)){if(!n)throw Error("ic node is of an unrecognized type: "+t.type.name);const c=n.propSchema;s in c&&(o[s]=l)}let r;return n.content==="styled"?r=re(t,e,i):r=void 0,{type:t.type.name,props:o,content:r}}function C(t,e,i,o,n){if(t.type.name!=="blockContainer")throw Error("Node must be of type blockContainer, but is of type"+t.type.name+".");const r=n==null?void 0:n.get(t);if(r)return r;const a=We(t);let s=a.id;s===null&&(s=K.options.generateID());const l={};for(const[f,g]of Object.entries({...t.attrs,...a.contentNode.attrs})){const y=e[a.contentType.name];if(!y)throw Error("Block is of an unrecognized type: "+a.contentType.name);const E=y.propSchema;f in E&&(l[f]=g)}const c=e[a.contentType.name],p=[];for(let f=0;f<a.numChildBlocks;f++)p.push(C(t.lastChild.child(f),e,i,o,n));let h;if(c.content==="inline")h=re(a.contentNode,i,o);else if(c.content==="table")h=Yi(a.contentNode,i,o);else if(c.content==="none")h=void 0;else throw new P(c.content);const m={id:s,type:c.type,props:l,content:h,children:p};return n==null||n.set(t,m),m}function Qi(t){return t.document||window.document}const Ze=(t,e,i,o,n)=>{if(!i.nodes[t.type.name])throw new Error("Serializer is missing a node type: "+t.type.name);const{dom:r,contentDOM:a}=_.DOMSerializer.renderSpec(Qi(e),i.nodes[t.type.name](t));if(a){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");if(t.type.name==="blockContainer"){const s=t.childCount>0&&t.firstChild.type.spec.group==="blockContent"?t.firstChild:void 0,l=t.childCount>0&&t.lastChild.type.spec.group==="blockGroup"?t.lastChild:void 0;if(s!==void 0){const c=o.blockImplementations[s.type.name].implementation,h=(n?c.toExternalHTML:c.toInternalHTML)(C(t,o.schema.blockSchema,o.schema.inlineContentSchema,o.schema.styleSchema,o.blockCache),o);if(h.contentDOM!==void 0){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");h.contentDOM.appendChild(i.serializeFragment(s.content,e))}a.appendChild(h.dom)}l!==void 0&&i.serializeFragment(_.Fragment.from(l),e,a)}else i.serializeFragment(t.content,e,a)}return r},Je=(t,e)=>{const i=e.serializeFragment(t),o=document.createElement("div");return o.appendChild(i),o.innerHTML};function eo(t){const e=new Set([...t.orderedListItemBlockTypes,...t.unorderedListItemBlockTypes]),i=o=>{var a;if(o.children.length===1&&((a=o.children[0].properties)==null?void 0:a.dataNodeType)==="blockGroup"){const s=o.children[0];o.children.pop(),o.children.push(...s.children)}let n=o.children.length,r;for(let s=0;s<n;s++){const c=o.children[s].children[0],p=c.children[0],h=c.children.length===2?c.children[1]:null,m=e.has(p.properties.dataContentType),f=m?t.orderedListItemBlockTypes.has(p.properties.dataContentType)?"ol":"ul":null;if(h!==null&&i(h),r&&r.tagName!==f){o.children.splice(s-r.children.length,r.children.length,r);const g=r.children.length-1;s-=g,n-=g,r=void 0}if(m){r||(r=he.fromDom(document.createElement(f)));const g=he.fromDom(document.createElement("li"));g.children.push(...p.children),h!==null&&g.children.push(...h.children),r.children.push(g)}else if(h!==null){o.children.splice(s+1,0,...h.children),o.children[s]=p.children[0];const g=h.children.length;s+=g,n+=g}else o.children[s]=p.children[0]}r&&o.children.splice(n-r.children.length,r.children.length,r)};return i}const J=(t,e)=>{const i=_.DOMSerializer.fromSchema(t);return i.serializeNodeInner=(o,n)=>Ze(o,n,i,e,!0),i.exportProseMirrorFragment=o=>pe.unified().use(Fe.default,{fragment:!0}).use(eo,{orderedListItemBlockTypes:new Set(["numberedListItem"]),unorderedListItemBlockTypes:new Set(["bulletListItem","checkListItem"])}).use(qe.default).processSync(Je(o,i)).value,i.exportBlocks=o=>{const n=o.map(a=>A(a,t,e.schema.styleSchema)),r=t.nodes.blockGroup.create(null,n);return i.exportProseMirrorFragment(_.Fragment.from(r))},i},ye=(t,e)=>{const i=_.DOMSerializer.fromSchema(t);return i.serializeNodeInner=(o,n)=>Ze(o,n,i,e,!1),i.serializeProseMirrorFragment=o=>Je(o,i),i.serializeBlocks=o=>{const n=o.map(a=>A(a,t,e.schema.styleSchema)),r=t.nodes.blockGroup.create(null,n);return i.serializeProseMirrorFragment(_.Fragment.from(r))},i},Ye=()=>typeof navigator<"u"&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function H(t,e="Ctrl"){return Ye()?t.replace("Mod","⌘"):t.replace("Mod",e)}function D(...t){return t.filter(e=>e).join(" ")}const to=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function F(t,e,i,o){const n=document.createElement("div");n.className=D("bn-block-content",i.class),n.setAttribute("data-content-type",t);for(const[a,s]of Object.entries(i))a!=="class"&&n.setAttribute(a,s);const r=document.createElement(e);r.className=D("bn-inline-content",o.class);for(const[a,s]of Object.entries(o))a!=="class"&&r.setAttribute(a,s);return n.appendChild(r),{dom:n,contentDOM:r}}const Qe=(t,e)=>{const i=A(t,e._tiptapEditor.schema,e.schema.styleSchema).firstChild,o=e._tiptapEditor.schema.nodes[i.type.name].spec.toDOM;if(o===void 0)throw new Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");const n=o(i);if(typeof n!="object"||!("dom"in n))throw new Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return n},w={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},_e=["backgroundColor","textColor"];function Y(t){return"data-"+t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function io(t){const e=t.split("/");return!e.length||e[e.length-1]===""?t:e[e.length-1]}function ve(t){const e={};return Object.entries(t).filter(([i,o])=>!_e.includes(i)).forEach(([i,o])=>{e[i]={default:o.default,keepOnSplit:!0,parseHTML:n=>{const r=n.getAttribute(Y(i));if(r===null)return null;if(typeof o.default=="boolean")return r==="true"?!0:r==="false"?!1:null;if(typeof o.default=="number"){const a=parseFloat(r);return!Number.isNaN(a)&&Number.isFinite(a)?a:null}return r},renderHTML:n=>n[i]!==o.default?{[Y(i)]:n[i]}:{}}}),e}function et(t,e,i,o){if(typeof t=="boolean")throw new Error("Cannot find node position as getPos is a boolean, not a function.");const n=t(),a=i.state.doc.resolve(n).node().attrs.id;if(!a)throw new Error("Block doesn't have id");const s=e.getBlock(a);if(s.type!==o)throw new Error("Block type does not match");return s}function ae(t,e,i,o,n=!1,r){const a=document.createElement("div");if(r!==void 0)for(const[s,l]of Object.entries(r))s!=="class"&&a.setAttribute(s,l);a.className=D("bn-block-content",(r==null?void 0:r.class)||""),a.setAttribute("data-content-type",e);for(const[s,l]of Object.entries(i))!_e.includes(s)&&l!==o[s].default&&a.setAttribute(Y(s),l);return n&&a.setAttribute("data-file-block",""),a.appendChild(t.dom),t.contentDOM!==void 0&&(t.contentDOM.className=D("bn-inline-content",t.contentDOM.className),t.contentDOM.setAttribute("data-editable","")),{...t,dom:a}}function U(t){return b.Node.create(t)}function we(t,e){return{config:t,implementation:e}}function q(t,e,i){return we({type:t.name,content:t.config.content==="inline*"?"inline":t.config.content==="tableRow+"?"table":"none",propSchema:e},{node:t,requiredExtensions:i,toInternalHTML:Qe,toExternalHTML:Qe})}function Ee(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e,i.config]))}function tt(t,e){const i=[{tag:"[data-content-type="+t.type+"]",contentElement:"[data-editable]"}];return e&&i.push({tag:"*",getAttrs(o){if(typeof o=="string")return!1;const n=e==null?void 0:e(o);return n===void 0?!1:n}}),i}function Q(t,e){const i=U({name:t.type,content:t.content==="inline"?"inline*":"",group:"blockContent",selectable:!0,addAttributes(){return ve(t.propSchema)},parseHTML(){return tt(t,e.parse)},renderHTML(){const o=document.createElement("div");return o.setAttribute("data-tmp-placeholder","true"),{dom:o}},addNodeView(){return({getPos:o})=>{var l;const n=this.options.editor,r=et(o,n,this.editor,t.type),a=((l=this.options.domAttributes)==null?void 0:l.blockContent)||{},s=e.render(r,n);return ae(s,r.type,r.props,t.propSchema,a)}}});if(i.name!==t.type)throw new Error("Node name does not match block type. This is a bug in BlockNote.");return we(t,{node:i,toInternalHTML:(o,n)=>{var s;const r=((s=i.options.domAttributes)==null?void 0:s.blockContent)||{},a=e.render(o,n);return ae(a,o.type,o.props,t.propSchema,t.isFileBlock,r)},toExternalHTML:(o,n)=>{var s,l;const r=((s=i.options.domAttributes)==null?void 0:s.blockContent)||{};let a=(l=e.toExternalHTML)==null?void 0:l.call(e,o,n);return a===void 0&&(a=e.render(o,n)),ae(a,o.type,o.props,t.propSchema,r)}})}function it(t,e,i,o){return t.dom.setAttribute("data-inline-content-type",e),Object.entries(i).filter(([n,r])=>r!==o[n].default).map(([n,r])=>[Y(n),r]).forEach(([n,r])=>t.dom.setAttribute(n,r)),t.contentDOM!==void 0&&t.contentDOM.setAttribute("data-editable",""),t}function ot(t){return{Backspace:({editor:e})=>{const i=e.state.selection.$from;return e.state.selection.empty&&i.node().type.name===t.type&&i.parentOffset===0}}}function nt(t,e){return{config:t,implementation:e}}function rt(t,e){return nt({type:t.name,propSchema:e,content:t.config.content==="inline*"?"styled":"none"},{node:t})}function Ce(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e,i.config]))}function at(t){return[{tag:`[data-inline-content-type="${t.type}"]`,contentElement:e=>{const i=e;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}]}function oo(t,e){const i=b.Node.create({name:t.type,inline:!0,group:"inline",selectable:t.content==="styled",atom:t.content==="none",content:t.content==="styled"?"inline*":"",addAttributes(){return ve(t.propSchema)},addKeyboardShortcuts(){return ot(t)},parseHTML(){return at(t)},renderHTML({node:o}){const n=this.options.editor,r=e.render(ke(o,n.schema.inlineContentSchema,n.schema.styleSchema));return it(r,t.type,o.attrs,t.propSchema)}});return rt(i,t.propSchema)}function st(t){return t==="boolean"?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>e.stringValue!==void 0?{"data-value":e.stringValue}:{}}}}function lt(t,e,i,o){return t.dom.setAttribute("data-style-type",e),o==="string"&&t.dom.setAttribute("data-value",i),t.contentDOM!==void 0&&t.contentDOM.setAttribute("data-editable",""),t}function xe(t,e){return{config:t,implementation:e}}function R(t,e){return xe({type:t.name,propSchema:e},{mark:t})}function Se(t){return Object.fromEntries(Object.entries(t).map(([e,i])=>[e,i.config]))}function dt(t){return[{tag:`[data-style-type="${t.type}"]`,contentElement:e=>{const i=e;return i.matches("[data-editable]")?i:i.querySelector("[data-editable]")||i}}]}function no(t,e){const i=b.Mark.create({name:t.type,addAttributes(){return st(t.propSchema)},parseHTML(){return dt(t)},renderHTML({mark:o}){let n;if(t.propSchema==="boolean")n=e.render();else if(t.propSchema==="string")n=e.render(o.attrs.stringValue);else throw new P(t.propSchema);return lt(n,t.type,o.attrs.stringValue,t.propSchema)}});return xe(t,{mark:i})}const ee=t=>{const e=document.createElement("div");e.className="bn-file-default-preview";const i=document.createElement("div");i.className="bn-file-default-preview-icon",i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>';const o=document.createElement("p");return o.className="bn-file-default-preview-name",o.textContent=t.props.name||"",e.appendChild(i),e.appendChild(o),{dom:e}},O=(t,e)=>{const i=document.createElement("div");i.className="bn-file-and-caption-wrapper";const o=document.createElement("p");return o.className="bn-file-caption",o.textContent=t.props.caption,i.appendChild(e),i.appendChild(o),{dom:i}},te=(t,e,i,o)=>{const n=document.createElement("div");n.className="bn-add-file-button";const r=document.createElement("div");r.className="bn-add-file-button-icon",o?r.appendChild(o):r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>';const a=document.createElement("p");a.className="bn-add-file-button-text",a.innerHTML=i||e.dictionary.file_blocks.file.add_button_text;const s=c=>{c.preventDefault()},l=()=>{e._tiptapEditor.view.dispatch(e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin,{block:t}))};return n.appendChild(r),n.appendChild(a),n.addEventListener("mousedown",s,!0),n.addEventListener("click",l,!0),{dom:n,destroy:()=>{n.removeEventListener("mousedown",s,!0),n.removeEventListener("click",l,!0)}}},Te=t=>({url:t.src||void 0}),ie=(t,e)=>{const i=t.querySelector(e);if(!i)return;const o=t.querySelector("figcaption"),n=(o==null?void 0:o.textContent)??void 0;return{targetElement:i,caption:n}},oe=(t,e)=>{const i=document.createElement("div"),o=document.createElement("p");return o.textContent=e,i.appendChild(t),i.appendChild(o),{dom:i}},se=(t,e)=>{const i=document.createElement("figure"),o=document.createElement("figcaption");return o.textContent=e,i.appendChild(t),i.appendChild(o),{dom:i}},Be=(t,e,i,o,n)=>{if(!t.props.previewWidth)throw new Error("Block must have a `previewWidth` prop.");const r=document.createElement("div");r.className="bn-visual-media-wrapper";const a=document.createElement("div");a.className="bn-visual-media-resize-handle",a.style.left="4px";const s=document.createElement("div");s.className="bn-visual-media-resize-handle",s.style.right="4px";let l;const c=y=>{if(!l){!e.isEditable&&r.contains(a)&&r.contains(s)&&(r.removeChild(a),r.removeChild(s));return}let E;t.props.textAlignment==="center"?l.handleUsed==="left"?E=l.initialWidth+(l.initialClientX-y.clientX)*2:E=l.initialWidth+(y.clientX-l.initialClientX)*2:l.handleUsed==="left"?E=l.initialWidth+l.initialClientX-y.clientX:E=l.initialWidth+y.clientX-l.initialClientX;const N=64;E<N?n(N):E>e.domElement.firstElementChild.clientWidth?n(e.domElement.firstElementChild.clientWidth):n(E)},p=y=>{(!y.target||!r.contains(y.target)||!e.isEditable)&&r.contains(a)&&r.contains(s)&&(r.removeChild(a),r.removeChild(s)),l&&(l=void 0,e.updateBlock(t,{props:{previewWidth:o()}}))},h=()=>{e.isEditable&&(r.appendChild(a),r.appendChild(s))},m=y=>{y.relatedTarget===a||y.relatedTarget===s||l||e.isEditable&&r.contains(a)&&r.contains(s)&&(r.removeChild(a),r.removeChild(s))},f=y=>{y.preventDefault(),r.appendChild(a),r.appendChild(s),l={handleUsed:"left",initialWidth:t.props.previewWidth,initialClientX:y.clientX}},g=y=>{y.preventDefault(),r.appendChild(a),r.appendChild(s),l={handleUsed:"right",initialWidth:t.props.previewWidth,initialClientX:y.clientX}};return r.appendChild(i),window.addEventListener("mousemove",c),window.addEventListener("mouseup",p),i.addEventListener("mouseenter",h),i.addEventListener("mouseleave",m),a.addEventListener("mousedown",f),s.addEventListener("mousedown",g),{dom:r,destroy:()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",p),i.removeEventListener("mouseenter",h),i.removeEventListener("mouseleave",m),a.removeEventListener("mousedown",f),s.removeEventListener("mousedown",g)}}},ct={backgroundColor:w.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},ut={type:"file",propSchema:ct,content:"none",isFileBlock:!0},pt=(t,e)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=te(t,e);return i.appendChild(o.dom),{dom:i,destroy:o.destroy}}else{const o=ee(t).dom,n=O(t,o);return i.appendChild(n.dom),{dom:i}}},ht=t=>{if(t.tagName==="EMBED")return Te(t);if(t.tagName==="FIGURE"){const e=ie(t,"embed");if(!e)return;const{targetElement:i,caption:o}=e;return{...Te(i),caption:o}}},mt=t=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add file",{dom:i}}const e=document.createElement("a");return e.href=t.props.url,e.textContent=t.props.name||t.props.url,t.props.caption?oe(e,t.props.caption):{dom:e}},ft=Q(ut,{render:pt,parse:ht,toExternalHTML:mt}),Me=t=>{const e=t.src||void 0,i=t.width||void 0;return{url:e,previewWidth:i}},gt={textAlignment:w.textAlignment,backgroundColor:w.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:512}},bt={type:"image",propSchema:gt,content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["image/*"]},kt=(t,e)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=document.createElement("div");o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';const n=te(t,e,e.dictionary.file_blocks.image.add_button_text,o.firstElementChild);return i.appendChild(n.dom),{dom:i,destroy:()=>{var r;(r=n==null?void 0:n.destroy)==null||r.call(n)}}}else if(t.props.showPreview){const o=document.createElement("img");o.className="bn-visual-media",e.resolveFileUrl(t.props.url).then(a=>{o.src=a}),o.alt=t.props.name||t.props.caption||"BlockNote image",o.contentEditable="false",o.draggable=!1,o.width=Math.min(t.props.previewWidth,e.domElement.firstElementChild.clientWidth);const n=Be(t,e,o,()=>o.width,a=>o.width=a),r=O(t,n.dom);return i.appendChild(r.dom),{dom:i,destroy:n.destroy}}else{const o=ee(t).dom;return{dom:O(t,o).dom}}},yt=t=>{if(t.tagName==="IMG")return Me(t);if(t.tagName==="FIGURE"){const e=ie(t,"img");if(!e)return;const{targetElement:i,caption:o}=e;return{...Me(i),caption:o}}},_t=t=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add image",{dom:i}}let e;return t.props.showPreview?(e=document.createElement("img"),e.src=t.props.url,e.alt=t.props.name||t.props.caption||"BlockNote image",e.width=t.props.previewWidth):(e=document.createElement("a"),e.href=t.props.url,e.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?se(e,t.props.caption):oe(e,t.props.caption):{dom:e}},vt=Q(bt,{render:kt,parse:yt,toExternalHTML:_t}),wt=t=>{const e=t.src||void 0,i=t.width||void 0;return{url:e,previewWidth:i}},Et={textAlignment:w.textAlignment,backgroundColor:w.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:512}},Ct={type:"video",propSchema:Et,content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["video/*"]},xt=(t,e)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=document.createElement("div");o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';const n=te(t,e,e.dictionary.file_blocks.video.add_button_text,o.firstElementChild);return i.appendChild(n.dom),{dom:i,destroy:()=>{var r;(r=n==null?void 0:n.destroy)==null||r.call(n)}}}else if(t.props.showPreview){const o=document.createElement("video");o.className="bn-visual-media",o.src=t.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,o.width=Math.min(t.props.previewWidth,e.domElement.firstElementChild.clientWidth);const n=Be(t,e,o,()=>o.width,a=>o.width=a),r=O(t,n.dom);return i.appendChild(r.dom),{dom:i,destroy:n.destroy}}else{const o=ee(t).dom;return{dom:O(t,o).dom}}},St=t=>{if(t.tagName==="VIDEO")return wt(t);if(t.tagName==="FIGURE"){const e=ie(t,"video");if(!e)return;const{targetElement:i,caption:o}=e;return{...wt(i),caption:o}}},Tt=t=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add video",{dom:i}}let e;return t.props.showPreview?(e=document.createElement("video"),e.src=t.props.url,e.width=t.props.previewWidth):(e=document.createElement("a"),e.href=t.props.url,e.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?se(e,t.props.caption):oe(e,t.props.caption):{dom:e}},Bt=Q(Ct,{render:xt,parse:St,toExternalHTML:Tt}),Mt=t=>({url:t.src||void 0}),Lt={backgroundColor:w.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},It={type:"audio",propSchema:Lt,content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["audio/*"]},Pt=(t,e)=>{const i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",t.props.url===""){const o=document.createElement("div");o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';const n=te(t,e,e.dictionary.file_blocks.audio.add_button_text,o.firstElementChild);return i.appendChild(n.dom),{dom:i,destroy:()=>{var r;(r=n==null?void 0:n.destroy)==null||r.call(n)}}}else if(t.props.showPreview){const o=document.createElement("audio");o.className="bn-audio",e.resolveFileUrl(t.props.url).then(r=>{o.src=r}),o.controls=!0,o.contentEditable="false",o.draggable=!1;const n=O(t,o);return i.appendChild(n.dom),{dom:i}}else{const o=ee(t).dom;return{dom:O(t,o).dom}}},At=t=>{if(t.tagName==="AUDIO")return Mt(t);if(t.tagName==="FIGURE"){const e=ie(t,"audio");if(!e)return;const{targetElement:i,caption:o}=e;return{...Mt(i),caption:o}}},Nt=t=>{if(!t.props.url){const i=document.createElement("p");return i.textContent="Add audio",{dom:i}}let e;return t.props.showPreview?(e=document.createElement("audio"),e.src=t.props.url):(e=document.createElement("a"),e.href=t.props.url,e.textContent=t.props.name||t.props.url),t.props.caption?t.props.showPreview?se(e,t.props.caption):oe(e,t.props.caption):{dom:e}},Ht=Q(It,{render:Pt,parse:At,toExternalHTML:Nt}),ro=async t=>{const e=new FormData;return e.append("file",t),(await(await fetch("https://tmpfiles.org/api/v1/upload",{method:"POST",body:e})).json()).data.url.replace("tmpfiles.org/","tmpfiles.org/dl/")},ao=b.Mark.create({name:"backgroundColor",addAttributes(){return{stringValue:{default:void 0,parseHTML:t=>t.getAttribute("data-background-color"),renderHTML:t=>({"data-background-color":t.stringValue})}}},parseHTML(){return[{tag:"span",getAttrs:t=>typeof t=="string"?!1:t.hasAttribute("data-background-color")?{stringValue:t.getAttribute("data-background-color")}:!1}]},renderHTML({HTMLAttributes:t}){return["span",t,0]}}),so=R(ao,"string"),lo=b.Mark.create({name:"textColor",addAttributes(){return{stringValue:{default:void 0,parseHTML:t=>t.getAttribute("data-text-color"),renderHTML:t=>({"data-text-color":t.stringValue})}}},parseHTML(){return[{tag:"span",getAttrs:t=>typeof t=="string"?!1:t.hasAttribute("data-text-color")?{stringValue:t.getAttribute("data-text-color")}:!1}]},renderHTML({HTMLAttributes:t}){return["span",t,0]}}),co=R(lo,"string"),M=t=>{const{contentType:e}=v(t.state.doc,t.state.selection.from);return e.spec.content},uo={...w,level:{default:1,values:[1,2,3]}},po=U({name:"heading",content:"inline*",group:"blockContent",addAttributes(){return{level:{default:1,parseHTML:t=>{const e=t.getAttribute("data-level"),i=parseInt(e);if(isFinite(i))return i},renderHTML:t=>({"data-level":t.level.toString()})}}},addInputRules(){return[...[1,2,3].map(t=>new b.InputRule({find:new RegExp(`^(#{${t}})\\s$`),handler:({state:e,chain:i,range:o})=>{M(this.editor)==="inline*"&&i().BNUpdateBlock(e.selection.from,{type:"heading",props:{level:t}}).deleteRange({from:o.from,to:o.to})}}))]},addKeyboardShortcuts(){return{"Mod-Alt-1":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:1}}),"Mod-Alt-2":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:2}}),"Mod-Alt-3":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:3}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]",getAttrs:t=>typeof t=="string"?!1:{level:t.getAttribute("data-level")}},{tag:"h1",attrs:{level:1},node:"heading"},{tag:"h2",attrs:{level:2},node:"heading"},{tag:"h3",attrs:{level:3},node:"heading"}]},renderHTML({node:t,HTMLAttributes:e}){var i,o;return F(this.name,`h${t.attrs.level}`,{...((i=this.options.domAttributes)==null?void 0:i.blockContent)||{},...e},((o=this.options.domAttributes)==null?void 0:o.inlineContent)||{})}}),ho=q(po,uo),le=t=>{const{node:e,contentType:i}=v(t.state.doc,t.state.selection.from),o=t.state.selection.anchor===t.state.selection.head;return!(i.name==="bulletListItem"||i.name==="numberedListItem"||i.name==="checkListItem")||!o?!1:t.commands.first(({state:n,chain:r,commands:a})=>[()=>a.command(()=>e.textContent.length===0?a.BNUpdateBlock(n.selection.from,{type:"paragraph",props:{}}):!1),()=>a.command(()=>e.textContent.length>0?(r().deleteSelection().BNSplitBlock(n.selection.from,!0).run(),!0):!1)])},mo={...w},fo=U({name:"bulletListItem",content:"inline*",group:"blockContent",priority:90,addInputRules(){return[new b.InputRule({find:new RegExp("^[-+*]\\s$"),handler:({state:t,chain:e,range:i})=>{M(this.editor)==="inline*"&&e().BNUpdateBlock(t.selection.from,{type:"bulletListItem",props:{}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>le(this.editor),"Mod-Shift-8":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"bulletListItem",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:t=>{if(typeof t=="string")return!1;const e=t.parentElement;return e===null?!1:e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement.tagName==="UL"?{}:!1},node:"bulletListItem"},{tag:"p",getAttrs:t=>{if(typeof t=="string")return!1;const e=t.parentElement;return e===null?!1:e.getAttribute("data-content-type")==="bulletListItem"?{}:!1},priority:300,node:"bulletListItem"}]},renderHTML({HTMLAttributes:t}){var e,i;return F(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...t},((i=this.options.domAttributes)==null?void 0:i.inlineContent)||{})}}),go=q(fo,mo),bo=new k.PluginKey("numbered-list-indexing"),ko=()=>new k.Plugin({key:bo,appendTransaction:(t,e,i)=>{const o=i.tr;o.setMeta("numberedListIndexing",!0);let n=!1;return i.doc.descendants((r,a)=>{if(r.type.name==="blockContainer"&&r.firstChild.type.name==="numberedListItem"){let s="1";const l=a===1,c=v(o.doc,a+1);if(c===void 0)return;if(!l){const m=v(o.doc,a-2);if(m===void 0)return;if(!(c.depth!==m.depth)){const g=m.contentNode;if(m.contentType.name==="numberedListItem"){const N=g.attrs.index;s=(parseInt(N)+1).toString()}}}c.contentNode.attrs.index!==s&&(n=!0,o.setNodeMarkup(a+1,void 0,{index:s}))}}),n?o:null}}),yo={...w},_o=U({name:"numberedListItem",content:"inline*",group:"blockContent",priority:90,addAttributes(){return{index:{default:null,parseHTML:t=>t.getAttribute("data-index"),renderHTML:t=>({"data-index":t.index})}}},addInputRules(){return[new b.InputRule({find:new RegExp("^1\\.\\s$"),handler:({state:t,chain:e,range:i})=>{M(this.editor)==="inline*"&&e().BNUpdateBlock(t.selection.from,{type:"numberedListItem",props:{}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>le(this.editor),"Mod-Shift-7":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"numberedListItem",props:{}})}},addProseMirrorPlugins(){return[ko()]},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:t=>{if(typeof t=="string")return!1;const e=t.parentElement;return e===null?!1:e.tagName==="OL"||e.tagName==="DIV"&&e.parentElement.tagName==="OL"?{}:!1},node:"numberedListItem"},{tag:"p",getAttrs:t=>{if(typeof t=="string")return!1;const e=t.parentElement;return e===null?!1:e.getAttribute("data-content-type")==="numberedListItem"?{}:!1},priority:300,node:"numberedListItem"}]},renderHTML({HTMLAttributes:t}){var e,i;return F(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...t},((i=this.options.domAttributes)==null?void 0:i.inlineContent)||{})}}),vo=q(_o,yo),wo={...w,checked:{default:!1}},Eo=U({name:"checkListItem",content:"inline*",group:"blockContent",addAttributes(){return{checked:{default:!1,parseHTML:t=>t.getAttribute("data-checked")==="true"||void 0,renderHTML:t=>t.checked?{"data-checked":t.checked.toString()}:{}}}},addInputRules(){return[new b.InputRule({find:new RegExp("\\[\\s*\\]\\s$"),handler:({state:t,chain:e,range:i})=>{M(this.editor)==="inline*"&&e().BNUpdateBlock(t.selection.from,{type:"checkListItem",props:{checked:!1}}).deleteRange({from:i.from,to:i.to})}}),new b.InputRule({find:new RegExp("\\[[Xx]\\]\\s$"),handler:({state:t,chain:e,range:i})=>{M(this.editor)==="inline*"&&e().BNUpdateBlock(t.selection.from,{type:"checkListItem",props:{checked:!0}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>le(this.editor),"Mod-Shift-9":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"checkListItem",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"input",getAttrs:t=>typeof t=="string"?!1:t.type==="checkbox"?{checked:t.checked}:!1,node:"checkListItem"},{tag:"li",getAttrs:t=>{if(typeof t=="string")return!1;const e=t.parentElement;if(e===null)return!1;if(e.tagName==="UL"||e.tagName==="DIV"&&e.parentElement.tagName==="UL"){const i=t.querySelector("input[type=checkbox]")||null;return i===null?!1:{checked:i.checked}}return!1},node:"checkListItem"}]},renderHTML({node:t,HTMLAttributes:e}){var r,a;const i=document.createElement("input");i.type="checkbox",i.checked=t.attrs.checked,t.attrs.checked&&i.setAttribute("checked","");const{dom:o,contentDOM:n}=F(this.name,"p",{...((r=this.options.domAttributes)==null?void 0:r.blockContent)||{},...e},((a=this.options.domAttributes)==null?void 0:a.inlineContent)||{});return o.insertBefore(i,n),{dom:o,contentDOM:n}},addNodeView(){return({node:t,getPos:e,editor:i,HTMLAttributes:o})=>{var p,h;const n=document.createElement("div"),r=document.createElement("div");r.contentEditable="false";const a=document.createElement("input");a.type="checkbox",a.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","");const s=()=>{if(!i.isEditable){a.checked=!a.checked;return}typeof e!="boolean"&&this.editor.commands.BNUpdateBlock(e(),{type:"checkListItem",props:{checked:a.checked}})};a.addEventListener("change",s);const{dom:l,contentDOM:c}=F(this.name,"p",{...((p=this.options.domAttributes)==null?void 0:p.blockContent)||{},...o},((h=this.options.domAttributes)==null?void 0:h.inlineContent)||{});if(typeof e!="boolean"){const f="label-"+this.editor.state.doc.resolve(e()).node().attrs.id;a.setAttribute("aria-labelledby",f),c.id=f}return l.removeChild(c),l.appendChild(n),n.appendChild(r),n.appendChild(c),r.appendChild(a),{dom:l,contentDOM:c,destroy:()=>{a.removeEventListener("change",s)}}}}}),Co=q(Eo,wo),xo={...w},So=U({name:"paragraph",content:"inline*",group:"blockContent",addKeyboardShortcuts(){return{Enter:()=>le(this.editor),"Mod-Alt-0":()=>M(this.editor)!=="inline*"?!0:this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"paragraph",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"p",priority:200,node:"paragraph"}]},renderHTML({HTMLAttributes:t}){var e,i;return F(this.name,"p",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...t},((i=this.options.domAttributes)==null?void 0:i.inlineContent)||{})}}),To=q(So,xo),Bo=b.Extension.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[ze.columnResizing({cellMinWidth:100}),ze.tableEditing()],addKeyboardShortcuts(){return{Enter:()=>this.editor.state.selection.empty&&this.editor.state.selection.$head.parent.type.name==="tableParagraph"?(this.editor.commands.setHardBreak(),!0):!1,Backspace:()=>{const t=this.editor.state.selection,e=t.empty,i=t.$head.parentOffset===0,o=t.$head.node().type.name==="tableParagraph";return e&&i&&o}}},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:b.callOrReturn(b.getExtensionField(t,"tableRole",e))}}}),Mo={...w},Lo=U({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",isolating:!0,parseHTML(){return[{tag:"table"}]},renderHTML({HTMLAttributes:t}){var e,i;return F(this.name,"table",{...((e=this.options.domAttributes)==null?void 0:e.blockContent)||{},...t},((i=this.options.domAttributes)==null?void 0:i.inlineContent)||{})}}),Io=b.Node.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",b.mergeAttributes(this.options.HTMLAttributes,t),0]}}),Po=q(Lo,Mo,[Bo,Io,wi.TableHeader.extend({content:"tableContent"}),vi.TableCell.extend({content:"tableContent"}),Ei.TableRow]),Le={paragraph:To,heading:ho,bulletListItem:go,numberedListItem:vo,checkListItem:Co,table:Po,file:ft,image:vt,video:Bt,audio:Ht},Dt=Ee(Le),Ie={bold:R(Di.default,"boolean"),italic:R(Ri.default,"boolean"),underline:R(ji.default,"boolean"),strike:R(Oi.default,"boolean"),code:R(Ui.default,"boolean"),textColor:co,backgroundColor:so},Ao=Se(Ie),Pe={text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}},No=Ce(Pe);function T(t,e){return t in e.schema.blockSchema&&e.schema.blockSchema[t]===Dt[t]}function Ut(t,e,i){return e.type===t&&e.type in i.schema.blockSchema&&T(e.type,i)}function Ho(t,e){return t.type in e.schema.blockSchema&&e.schema.blockSchema[t.type].isFileBlock||!1}function Do(t,e){return t.type in e.schema.blockSchema&&e.schema.blockSchema[t.type].isFileBlock&&"showPreview"in e.schema.blockSchema[t.type].propSchema||!1}function Uo(t,e){return e.schema.blockSchema[t.type].isFileBlock&&!t.props.url}function Rt(t,e,i){return e in i.schema.blockSchema&&t in i.schema.blockSchema[e].propSchema&&i.schema.blockSchema[e].propSchema[t]===w[t]}function Ro(t,e,i){return Rt(t,e.type,i)}function Ae(t,e){let i,o;if(e.firstChild.descendants((n,r)=>i?!1:n.type.name!=="blockContainer"||n.attrs.id!==t?!0:(i=n,o=r+1,!1)),i===void 0||o===void 0)throw Error("Could not find block in the editor with matching ID.");return{node:i,posBeforeNode:o}}function Oo(t,e,i="before",o){const n=o._tiptapEditor,r=typeof e=="string"?e:e.id,a=[];for(const p of t)a.push(A(p,n.schema,o.schema.styleSchema));const{node:s,posBeforeNode:l}=Ae(r,n.state.doc);if(i==="before"&&n.view.dispatch(n.state.tr.insert(l,a)),i==="after"&&n.view.dispatch(n.state.tr.insert(l+s.nodeSize,a)),i==="nested"&&s.childCount<2){const p=n.state.schema.nodes.blockGroup.create({},a);n.view.dispatch(n.state.tr.insert(l+s.firstChild.nodeSize+1,p))}const c=[];for(const p of a)c.push(C(p,o.schema.blockSchema,o.schema.inlineContentSchema,o.schema.styleSchema,o.blockCache));return c}function jo(t,e,i){const o=i._tiptapEditor,n=typeof t=="string"?t:t.id,{posBeforeNode:r}=Ae(n,o.state.doc);o.commands.BNUpdateBlock(r+1,e);const a=o.state.doc.resolve(r+1).node();return C(a,i.schema.blockSchema,i.schema.inlineContentSchema,i.schema.styleSchema,i.blockCache)}function Ot(t,e,i){const o=e._tiptapEditor,n=o.state.tr,r=new Set(t.map(l=>typeof l=="string"?l:l.id)),a=[];let s=0;if(o.state.doc.descendants((l,c)=>{if(r.size===0)return!1;if(l.type.name!=="blockContainer"||!r.has(l.attrs.id))return!0;a.push(C(l,e.schema.blockSchema,e.schema.inlineContentSchema,e.schema.styleSchema,e.blockCache)),r.delete(l.attrs.id),s=(i==null?void 0:i(l,c,n,s))||s;const p=n.doc.nodeSize;n.delete(c-s-1,c-s+l.nodeSize+1);const h=n.doc.nodeSize;return s+=p-h,!1}),r.size>0){const l=[...r].join(`
6
+ `);throw Error("Blocks with the following IDs could not be found in the editor: "+l)}return o.view.dispatch(n),a}function zo(t,e){return Ot(t,e)}function Vo(t,e,i){const o=i._tiptapEditor,n=[];for(const l of e)n.push(A(l,o.schema,i.schema.styleSchema));const r=typeof t[0]=="string"?t[0]:t[0].id,a=Ot(t,i,(l,c,p,h)=>{if(l.attrs.id===r){const m=p.doc.nodeSize;p.insert(c,n);const f=p.doc.nodeSize;return h+m-f}return h}),s=[];for(const l of n)s.push(C(l,i.schema.blockSchema,i.schema.inlineContentSchema,i.schema.styleSchema,i.blockCache));return{insertedBlocks:s,removedBlocks:a}}function Fo(t,e,i,o={updateSelection:!0}){const n=i._tiptapEditor,r=n.state.tr;let{from:a,to:s}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},l=!0,c=!0,p="";if(e.forEach(h=>{h.check(),l&&h.isText&&h.marks.length===0?p+=h.text:l=!1,c=c?h.isBlock:!1}),a===s&&c){const{parent:h}=r.doc.resolve(a);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(a-=1,s+=1)}return l?r.insertText(p,a,s):r.replaceWith(a,s,e),o.updateSelection&&b.selectionToInsertionEnd(r,r.steps.length-1,-1),n.view.dispatch(r),!0}function qo(){const t=e=>{let i=e.children.length;for(let o=0;o<i;o++){const n=e.children[o];if(n.type==="element"&&(t(n),n.tagName==="u"))if(n.children.length>0){e.children.splice(o,1,...n.children);const r=n.children.length-1;i+=r,o+=r}else e.children.splice(o,1),i--,o--}};return t}function Ko(){const t=e=>{var i;if(e.children&&"length"in e.children&&e.children.length)for(let o=e.children.length-1;o>=0;o--){const n=e.children[o],r=o+1<e.children.length?e.children[o+1]:void 0;n.type==="element"&&n.tagName==="input"&&((i=n.properties)==null?void 0:i.type)==="checkbox"&&(r==null?void 0:r.type)==="element"&&r.tagName==="p"?(r.tagName="span",r.children.splice(0,0,he.fromDom(document.createTextNode(" ")))):t(n)}};return t}function Ne(t){return pe.unified().use(Fe.default,{fragment:!0}).use(qo).use(Ko).use(zi.default).use(Ke.default).use(Vi.default).processSync(t).value}function Go(t,e,i){const n=J(e,i).exportBlocks(t);return Ne(n)}function Wo(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function $o(t){return t.nodeType===3&&!/\S/.test(t.nodeValue||"")}function Xo(t){t.querySelectorAll("li > ul, li > ol").forEach(e=>{const i=Wo(e),o=e.parentElement,n=Array.from(o.childNodes).slice(i+1);e.remove(),n.forEach(r=>{r.remove()}),o.insertAdjacentElement("afterend",e),n.reverse().forEach(r=>{if($o(r))return;const a=document.createElement("li");a.append(r),e.insertAdjacentElement("afterend",a)}),o.childNodes.length===0&&o.remove()})}function Zo(t){t.querySelectorAll("li + ul, li + ol").forEach(e=>{var r,a;const i=e.previousElementSibling,o=document.createElement("div");i.insertAdjacentElement("afterend",o),o.append(i);const n=document.createElement("div");for(n.setAttribute("data-node-type","blockGroup"),o.append(n);((r=o.nextElementSibling)==null?void 0:r.nodeName)==="UL"||((a=o.nextElementSibling)==null?void 0:a.nodeName)==="OL";)n.append(o.nextElementSibling)})}let jt=null;function Jo(){return jt||(jt=document.implementation.createHTMLDocument("title"))}function zt(t){if(typeof t=="string"){const e=Jo().createElement("div");e.innerHTML=t,t=e}return Xo(t),Zo(t),t}async function Vt(t,e,i,o,n){const r=zt(t),s=_.DOMParser.fromSchema(n).parse(r,{topNode:n.nodes.blockGroup.create()}),l=[];for(let c=0;c<s.childCount;c++)l.push(C(s.child(c),e,i,o));return l}function Yo(t,e){const i=e.value?e.value+`
7
+ `:"",o={};e.lang&&(o["data-language"]=e.lang);let n={type:"element",tagName:"code",properties:o,children:[{type:"text",value:i}]};return e.meta&&(n.data={meta:e.meta}),t.patch(e,n),n=t.applyData(e,n),n={type:"element",tagName:"pre",properties:{},children:[n]},t.patch(e,n),n}function Qo(t,e,i,o,n){const r=pe.unified().use(Fi.default).use(Ke.default).use(qi.default,{handlers:{...Ve.defaultHandlers,code:Yo}}).use(qe.default).processSync(t);return Vt(r.value,e,i,o,n)}class W{constructor(){u(this,"callbacks",{})}on(e,i){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(i),()=>this.off(e,i)}emit(e,...i){const o=this.callbacks[e];o&&o.forEach(n=>n.apply(this,i))}off(e,i){const o=this.callbacks[e];o&&(i?this.callbacks[e]=o.filter(n=>n!==i):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}}class Ft{constructor(e,i,o){u(this,"state");u(this,"emitUpdate");u(this,"prevWasEditable",null);u(this,"mouseDownHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"dragstartHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;if((e=this.state)!=null&&e.show){const i=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`);this.state.referencePos=i.getBoundingClientRect(),this.emitUpdate()}});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.pluginKey=e,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized file panel");o(this.state)},i.dom.addEventListener("mousedown",this.mouseDownHandler),i.dom.addEventListener("dragstart",this.dragstartHandler),document.addEventListener("scroll",this.scrollHandler)}update(e,i){var n,r;const o=this.pluginKey.getState(e.state);if(!((n=this.state)!=null&&n.show)&&o.block){const a=document.querySelector(`[data-node-type="blockContainer"][data-id="${o.block.id}"]`);this.state={show:!0,referencePos:a.getBoundingClientRect(),block:o.block},this.emitUpdate();return}(!e.state.selection.eq(i.selection)||!e.state.doc.eq(i.doc))&&(r=this.state)!=null&&r.show&&(this.state.show=!1,this.emitUpdate())}destroy(){this.pmView.dom.removeEventListener("mousedown",this.mouseDownHandler),this.pmView.dom.removeEventListener("dragstart",this.dragstartHandler),document.removeEventListener("scroll",this.scrollHandler)}}const He=new k.PluginKey("FilePanelPlugin");class qt extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:He,view:o=>(this.view=new Ft(He,o,n=>{this.emit("update",n)}),this.view),props:{handleKeyDown:(o,n)=>n.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1},state:{init:()=>({block:void 0}),apply:o=>{var r;return{block:(r=o.getMeta(He))==null?void 0:r.block}}}})}get shown(){var i,o;return((o=(i=this.view)==null?void 0:i.state)==null?void 0:o.show)||!1}onUpdate(i){return this.on("update",i)}}class Kt{constructor(e,i,o){u(this,"state");u(this,"emitUpdate");u(this,"preventHide",!1);u(this,"preventShow",!1);u(this,"prevWasEditable",null);u(this,"shouldShow",({state:e,from:i,to:o,view:n})=>{const{doc:r,selection:a}=e,{empty:s}=a,l=!r.textBetween(i,o).length&&b.isTextSelection(e.selection);return!(!n.hasFocus()||s||l)});u(this,"viewMousedownHandler",()=>{this.preventShow=!0});u(this,"viewMouseupHandler",()=>{this.preventShow=!1,setTimeout(()=>this.update(this.pmView))});u(this,"dragHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.referencePos=this.getSelectionBoundingBox(),this.emitUpdate())});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.editor=e,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized formatting toolbar");o(this.state)},i.dom.addEventListener("mousedown",this.viewMousedownHandler),i.dom.addEventListener("mouseup",this.viewMouseupHandler),i.dom.addEventListener("dragstart",this.dragHandler),i.dom.addEventListener("dragover",this.dragHandler),document.addEventListener("scroll",this.scrollHandler)}update(e,i){var m,f;const{state:o,composing:n}=e,{doc:r,selection:a}=o,s=i&&i.doc.eq(r)&&i.selection.eq(a);if((this.prevWasEditable===null||this.prevWasEditable===this.editor.isEditable)&&(n||s))return;this.prevWasEditable=this.editor.isEditable;const{ranges:l}=a,c=Math.min(...l.map(g=>g.$from.pos)),p=Math.max(...l.map(g=>g.$to.pos)),h=(m=this.shouldShow)==null?void 0:m.call(this,{view:e,state:o,from:c,to:p});if(this.editor.isEditable&&!this.preventShow&&(h||this.preventHide)){this.state={show:!0,referencePos:this.getSelectionBoundingBox()},this.emitUpdate();return}if((f=this.state)!=null&&f.show&&!this.preventHide&&(!h||this.preventShow||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.dom.removeEventListener("mouseup",this.viewMouseupHandler),this.pmView.dom.removeEventListener("dragstart",this.dragHandler),this.pmView.dom.removeEventListener("dragover",this.dragHandler),document.removeEventListener("scroll",this.scrollHandler)}getSelectionBoundingBox(){const{state:e}=this.pmView,{selection:i}=e,{ranges:o}=i,n=Math.min(...o.map(a=>a.$from.pos)),r=Math.max(...o.map(a=>a.$to.pos));if(b.isNodeSelection(i)){const a=this.pmView.nodeDOM(n);if(a)return a.getBoundingClientRect()}return b.posToDOMRect(this.pmView,n,r)}}const Gt=new k.PluginKey("FormattingToolbarPlugin");class Wt extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:Gt,view:o=>(this.view=new Kt(i,o,n=>{this.emit("update",n)}),this.view),props:{handleKeyDown:(o,n)=>n.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1}})}get shown(){var i,o;return((o=(i=this.view)==null?void 0:i.state)==null?void 0:o.show)||!1}onUpdate(i){return this.on("update",i)}}class en{constructor(e,i,o){u(this,"state");u(this,"emitUpdate");u(this,"menuUpdateTimer");u(this,"startMenuUpdateTimer");u(this,"stopMenuUpdateTimer");u(this,"mouseHoveredLinkMark");u(this,"mouseHoveredLinkMarkRange");u(this,"keyboardHoveredLinkMark");u(this,"keyboardHoveredLinkMarkRange");u(this,"linkMark");u(this,"linkMarkRange");u(this,"mouseOverHandler",e=>{if(this.mouseHoveredLinkMark=void 0,this.mouseHoveredLinkMarkRange=void 0,this.stopMenuUpdateTimer(),e.target instanceof HTMLAnchorElement&&e.target.nodeName==="A"){const i=e.target,o=this.pmView.posAtDOM(i,0)+1,n=this.pmView.state.doc.resolve(o),r=n.marks();for(const a of r)if(a.type.name===this.pmView.state.schema.mark("link").type.name){this.mouseHoveredLinkMark=a,this.mouseHoveredLinkMarkRange=b.getMarkRange(n,a.type,a.attrs)||void 0;break}}return this.startMenuUpdateTimer(),!1});u(this,"clickHandler",e=>{var o;const i=this.pmView.dom.parentElement;this.linkMark&&e&&e.target&&!(i===e.target||i.contains(e.target))&&(o=this.state)!=null&&o.show&&(this.state.show=!1,this.emitUpdate())});u(this,"scrollHandler",()=>{var e;this.linkMark!==void 0&&(e=this.state)!=null&&e.show&&(this.state.referencePos=b.posToDOMRect(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),this.emitUpdate())});u(this,"closeMenu",()=>{var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())});this.editor=e,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized link toolbar");o(this.state)},this.startMenuUpdateTimer=()=>{this.menuUpdateTimer=setTimeout(()=>{this.update()},250)},this.stopMenuUpdateTimer=()=>(this.menuUpdateTimer&&(clearTimeout(this.menuUpdateTimer),this.menuUpdateTimer=void 0),!1),this.pmView.dom.addEventListener("mouseover",this.mouseOverHandler),document.addEventListener("click",this.clickHandler,!0),document.addEventListener("scroll",this.scrollHandler)}editLink(e,i){var n;const o=this.pmView.state.tr.insertText(i,this.linkMarkRange.from,this.linkMarkRange.to);o.addMark(this.linkMarkRange.from,this.linkMarkRange.from+i.length,this.pmView.state.schema.mark("link",{href:e})),this.pmView.dispatch(o),this.pmView.focus(),(n=this.state)!=null&&n.show&&(this.state.show=!1,this.emitUpdate())}deleteLink(){var e;this.pmView.dispatch(this.pmView.state.tr.removeMark(this.linkMarkRange.from,this.linkMarkRange.to,this.linkMark.type).setMeta("preventAutolink",!0)),this.pmView.focus(),(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate())}update(){var i;if(!this.pmView.hasFocus())return;const e=this.linkMark;if(this.linkMark=void 0,this.linkMarkRange=void 0,this.keyboardHoveredLinkMark=void 0,this.keyboardHoveredLinkMarkRange=void 0,this.pmView.state.selection.empty){const o=this.pmView.state.selection.$from.marks();for(const n of o)if(n.type.name===this.pmView.state.schema.mark("link").type.name){this.keyboardHoveredLinkMark=n,this.keyboardHoveredLinkMarkRange=b.getMarkRange(this.pmView.state.selection.$from,n.type,n.attrs)||void 0;break}}if(this.mouseHoveredLinkMark&&(this.linkMark=this.mouseHoveredLinkMark,this.linkMarkRange=this.mouseHoveredLinkMarkRange),this.keyboardHoveredLinkMark&&(this.linkMark=this.keyboardHoveredLinkMark,this.linkMarkRange=this.keyboardHoveredLinkMarkRange),this.linkMark&&this.editor.isEditable){this.state={show:!0,referencePos:b.posToDOMRect(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),url:this.linkMark.attrs.href,text:this.pmView.state.doc.textBetween(this.linkMarkRange.from,this.linkMarkRange.to)},this.emitUpdate();return}if((i=this.state)!=null&&i.show&&e&&(!this.linkMark||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mouseover",this.mouseOverHandler),document.removeEventListener("scroll",this.scrollHandler),document.removeEventListener("click",this.clickHandler,!0)}}const $t=new k.PluginKey("LinkToolbarPlugin");class Xt extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"editLink",(i,o)=>{this.view.editLink(i,o)});u(this,"deleteLink",()=>{this.view.deleteLink()});u(this,"startHideTimer",()=>{this.view.startMenuUpdateTimer()});u(this,"stopHideTimer",()=>{this.view.stopMenuUpdateTimer()});u(this,"closeMenu",()=>this.view.closeMenu());this.plugin=new k.Plugin({key:$t,view:o=>(this.view=new en(i,o,n=>{this.emit("update",n)}),this.view),props:{handleKeyDown:(o,n)=>n.key==="Escape"&&this.shown?(this.view.closeMenu(),!0):!1}})}onUpdate(i){return this.on("update",i)}get shown(){var i,o;return((o=(i=this.view)==null?void 0:i.state)==null?void 0:o.show)||!1}}const tn=b.findParentNode(t=>t.type.name==="blockContainer");class on{constructor(e,i){u(this,"state");u(this,"emitUpdate");u(this,"pluginState");u(this,"handleScroll",()=>{var e;if((e=this.state)!=null&&e.show){const i=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.state.referencePos=i.getBoundingClientRect(),this.emitUpdate(this.pluginState.triggerCharacter)}});u(this,"closeMenu",()=>{this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.view.state.tr.setMeta(j,null))});u(this,"clearQuery",()=>{this.pluginState!==void 0&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos-(this.pluginState.fromUserInput?this.pluginState.triggerCharacter.length:0),to:this.editor._tiptapEditor.state.selection.from}).run()});this.editor=e,this.pluginState=void 0,this.emitUpdate=o=>{if(!this.state)throw new Error("Attempting to update uninitialized suggestions menu");i(o,this.state)},document.addEventListener("scroll",this.handleScroll)}update(e,i){const o=j.getState(i),n=j.getState(e.state),r=o===void 0&&n!==void 0,a=o!==void 0&&n===void 0;if(!r&&!(o!==void 0&&n!==void 0)&&!a)return;if(this.pluginState=a?o:n,a||!this.editor.isEditable){this.state.show=!1,this.emitUpdate(this.pluginState.triggerCharacter);return}const l=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&(this.state={show:!0,referencePos:l.getBoundingClientRect(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){document.removeEventListener("scroll",this.handleScroll)}}const j=new k.PluginKey("SuggestionMenuPlugin");class Zt extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"triggerCharacters",[]);u(this,"addTriggerCharacter",i=>{this.triggerCharacters.push(i)});u(this,"removeTriggerCharacter",i=>{this.triggerCharacters=this.triggerCharacters.filter(o=>o!==i)});u(this,"closeMenu",()=>this.view.closeMenu());u(this,"clearQuery",()=>this.view.clearQuery());const o=this.triggerCharacters;this.plugin=new k.Plugin({key:j,view:()=>(this.view=new on(i,(n,r)=>{this.emit(`update ${n}`,r)}),this.view),state:{init(){},apply(n,r,a,s){if(n.getMeta("orderedListIndexing")!==void 0)return r;const l=n.getMeta(j);if(typeof l=="object"&&l!==null&&r===void 0)return{triggerCharacter:l.triggerCharacter,fromUserInput:l.fromUserInput!==!1,queryStartPos:s.selection.from,query:"",decorationId:`id_${Math.floor(Math.random()*4294967295)}`};if(r===void 0)return r;if(s.selection.from!==s.selection.to||l===null||n.getMeta("focus")||n.getMeta("blur")||n.getMeta("pointer")||r.triggerCharacter!==void 0&&s.selection.from<r.queryStartPos)return;const c={...r};return c.query=s.doc.textBetween(r.queryStartPos,s.selection.from),c}},props:{handleTextInput(n,r,a,s){const l=this.getState(n.state);return o.includes(s)&&l===void 0?(n.dispatch(n.state.tr.insertText(s).scrollIntoView().setMeta(j,{triggerCharacter:s})),!0):!1},decorations(n){const r=this.getState(n);if(r===void 0)return null;if(!r.fromUserInput){const a=tn(n.selection);if(a)return S.DecorationSet.create(n.doc,[S.Decoration.node(a.pos,a.pos+a.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":r.decorationId})])}return S.DecorationSet.create(n.doc,[S.Decoration.inline(r.queryStartPos-r.triggerCharacter.length,r.queryStartPos,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":r.decorationId})])}}})}onUpdate(i,o){return this.triggerCharacters.includes(i)||this.addTriggerCharacter(i),this.on(`update ${i}`,o)}get shown(){var i,o;return((o=(i=this.view)==null?void 0:i.state)==null?void 0:o.show)||!1}}function nn(t,e){t.suggestionMenus.addTriggerCharacter(e)}class $ extends k.Selection{constructor(i,o){super(i,o);u(this,"nodes");const n=i.node();this.nodes=[],i.doc.nodesBetween(i.pos,o.pos,(r,a,s)=>{if(s!==null&&s.eq(n))return this.nodes.push(r),!1})}static create(i,o,n=o){return new $(i.resolve(o),i.resolve(n))}content(){return new _.Slice(_.Fragment.from(this.nodes),0,0)}eq(i){if(!(i instanceof $)||this.nodes.length!==i.nodes.length||this.from!==i.from||this.to!==i.to)return!1;for(let o=0;o<this.nodes.length;o++)if(!this.nodes[o].eq(i.nodes[o]))return!1;return!0}map(i,o){const n=o.mapResult(this.from),r=o.mapResult(this.to);return r.deleted?k.Selection.near(i.resolve(n.pos)):n.deleted?k.Selection.near(i.resolve(r.pos)):new $(i.resolve(n.pos),i.resolve(r.pos))}toJSON(){return{type:"node",anchor:this.anchor,head:this.head}}}let z;function de(t,e){var n;if(!e.dom.isConnected)return;const i=e.posAtCoords(t);if(!i)return;let o=e.domAtPos(i.pos).node;if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom&&!((n=o.hasAttribute)!=null&&n.call(o,"data-id"));)o=o.parentNode;if(o)return{node:o,id:o.getAttribute("data-id")}}}function rn(t,e){const i=de(t,e);if(i&&i.node.nodeType===1){const o=e.docView,n=o.nearestDesc(i.node,!0);return!n||n===o?null:n.posBefore}return null}function an(t,e){let i,o;const n=e.resolve(t.from).node().type.spec.group==="blockContent",r=e.resolve(t.to).node().type.spec.group==="blockContent",a=Math.min(t.$anchor.depth,t.$head.depth);if(n&&r){const s=t.$from.start(a-1),l=t.$to.end(a-1);i=e.resolve(s-1).pos,o=e.resolve(l+1).pos}else i=t.from,o=t.to;return{from:i,to:o}}function Jt(t,e,i=e){e===i&&(i+=t.state.doc.resolve(e+1).node().nodeSize);const o=t.domAtPos(e).node.cloneNode(!0),n=t.domAtPos(e).node,r=(p,h)=>Array.prototype.indexOf.call(p.children,h),a=r(n,t.domAtPos(e+1).node.parentElement),s=r(n,t.domAtPos(i-1).node.parentElement);for(let p=n.childElementCount-1;p>=0;p--)(p>s||p<a)&&o.removeChild(o.children[p]);Yt(),z=o;const c=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="bn-root"&&p!=="bn-editor").join(" ");z.className=z.className+" bn-drag-preview "+c,document.body.appendChild(z)}function Yt(){z!==void 0&&(document.body.removeChild(z),z=void 0)}function sn(t,e){if(!t.dataTransfer)return;const i=e.prosemirrorView,o=i.dom.getBoundingClientRect(),n={left:o.left+o.width/2,top:t.clientY},r=rn(n,i);if(r!=null){const a=i.state.selection,s=i.state.doc,{from:l,to:c}=an(a,s),p=l<=r&&r<c,h=a.$anchor.node()!==a.$head.node()||a instanceof $;p&&h?(i.dispatch(i.state.tr.setSelection($.create(s,l,c))),Jt(i,l,c)):(i.dispatch(i.state.tr.setSelection(k.NodeSelection.create(i.state.doc,r))),Jt(i,r));const m=i.state.selection.content(),f=e._tiptapEditor.schema,y=ye(f,e).serializeProseMirrorFragment(m.content),N=J(f,e).exportProseMirrorFragment(m.content),I=Ne(N);t.dataTransfer.clearData(),t.dataTransfer.setData("blocknote/html",y),t.dataTransfer.setData("text/html",N),t.dataTransfer.setData("text/plain",I),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(z,0,0),i.dragging={slice:m,move:!0}}}class Qt{constructor(e,i,o){u(this,"state");u(this,"emitUpdate");u(this,"horizontalPosAnchoredAtRoot");u(this,"horizontalPosAnchor");u(this,"hoveredBlock");u(this,"isDragging",!1);u(this,"menuFrozen",!1);u(this,"onDragStart",()=>{this.isDragging=!0});u(this,"onDrop",e=>{if(this.editor._tiptapEditor.commands.blur(),e.synthetic||!this.isDragging)return;const i=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(this.isDragging=!1,!i||i.inside===-1){const o=new Event("drop",e),n=this.pmView.dom.firstChild.getBoundingClientRect();o.clientX=n.left+n.width/2,o.clientY=e.clientY,o.dataTransfer=e.dataTransfer,o.preventDefault=()=>e.preventDefault(),o.synthetic=!0,this.pmView.dom.dispatchEvent(o)}});u(this,"onDragOver",e=>{if(e.synthetic||!this.isDragging)return;const i=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(!i||i.inside===-1){const o=new Event("dragover",e),n=this.pmView.dom.firstChild.getBoundingClientRect();o.clientX=n.left+n.width/2,o.clientY=e.clientY,o.dataTransfer=e.dataTransfer,o.preventDefault=()=>e.preventDefault(),o.synthetic=!0,this.pmView.dom.dispatchEvent(o)}});u(this,"onKeyDown",e=>{var i;(i=this.state)!=null&&i.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state),this.menuFrozen=!1)});u(this,"onMouseDown",e=>{this.state&&!this.state.show&&(this.state.show=!0,this.emitUpdate(this.state)),this.menuFrozen=!1});u(this,"onMouseMove",e=>{var c,p,h,m,f;if(this.menuFrozen)return;const i=this.pmView.dom.firstChild.getBoundingClientRect(),o=this.pmView.dom.getBoundingClientRect(),n=e.clientX>=o.left&&e.clientX<=o.right&&e.clientY>=o.top&&e.clientY<=o.bottom,r=this.pmView.dom.parentElement;if(n&&e&&e.target&&!(r===e.target||r.contains(e.target))){(c=this.state)!=null&&c.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.horizontalPosAnchor=i.x;const a={left:i.left+i.width/2,top:e.clientY},s=de(a,this.pmView);if(!s||!this.editor.isEditable){(p=this.state)!=null&&p.show&&(this.state.show=!1,this.emitUpdate(this.state));return}if((h=this.state)!=null&&h.show&&((m=this.hoveredBlock)!=null&&m.hasAttribute("data-id"))&&((f=this.hoveredBlock)==null?void 0:f.getAttribute("data-id"))===s.id)return;this.hoveredBlock=s.node;const l=s.node.firstChild;if(l&&this.editor.isEditable){const g=l.getBoundingClientRect();this.state={show:!0,referencePos:new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:g.x,g.y,g.width,g.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.emitUpdate(this.state)}});u(this,"onScroll",()=>{var e;if((e=this.state)!=null&&e.show){const o=this.hoveredBlock.firstChild.getBoundingClientRect();this.state.referencePos=new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:o.x,o.y,o.width,o.height),this.emitUpdate(this.state)}});this.editor=e,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized side menu");o(this.state)},this.horizontalPosAnchoredAtRoot=!0,this.horizontalPosAnchor=this.pmView.dom.firstChild.getBoundingClientRect().x,document.body.addEventListener("drop",this.onDrop,!0),document.body.addEventListener("dragover",this.onDragOver),this.pmView.dom.addEventListener("dragstart",this.onDragStart),document.body.addEventListener("mousemove",this.onMouseMove,!0),document.addEventListener("scroll",this.onScroll),document.body.addEventListener("mousedown",this.onMouseDown,!0),document.body.addEventListener("keydown",this.onKeyDown,!0)}destroy(){var e;(e=this.state)!=null&&e.show&&(this.state.show=!1,this.emitUpdate(this.state)),document.body.removeEventListener("mousemove",this.onMouseMove,!0),document.body.removeEventListener("dragover",this.onDragOver),this.pmView.dom.removeEventListener("dragstart",this.onDragStart),document.body.removeEventListener("drop",this.onDrop,!0),document.removeEventListener("scroll",this.onScroll),document.body.removeEventListener("mousedown",this.onMouseDown,!0),document.body.removeEventListener("keydown",this.onKeyDown,!0)}addBlock(){var l;(l=this.state)!=null&&l.show&&(this.state.show=!1,this.emitUpdate(this.state)),this.menuFrozen=!0;const i=this.hoveredBlock.firstChild.getBoundingClientRect(),o=this.pmView.posAtCoords({left:i.left+i.width/2,top:i.top+i.height/2});if(!o)return;const n=v(this.editor._tiptapEditor.state.doc,o.pos);if(n===void 0)return;const{contentNode:r,startPos:a,endPos:s}=n;if(r.type.spec.content!=="inline*"||r.textContent.length!==0){const c=s+1,p=c+2;this.editor._tiptapEditor.chain().BNCreateBlock(c).setTextSelection(p).run()}else this.editor._tiptapEditor.commands.setTextSelection(a+1);this.pmView.focus(),this.pmView.dispatch(this.pmView.state.tr.scrollIntoView().setMeta(j,{triggerCharacter:"/",fromUserInput:!1}))}}const ei=new k.PluginKey("SideMenuPlugin");class ti extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"addBlock",()=>this.view.addBlock());u(this,"blockDragStart",i=>{this.view.isDragging=!0,sn(i,this.editor)});u(this,"blockDragEnd",()=>Yt());u(this,"freezeMenu",()=>this.view.menuFrozen=!0);u(this,"unfreezeMenu",()=>this.view.menuFrozen=!1);this.editor=i,this.plugin=new k.Plugin({key:ei,view:o=>(this.view=new Qt(i,o,n=>{this.emit("update",n)}),this.view)})}onUpdate(i){return this.on("update",i)}}let L;function ii(){L||(L=document.createElement("div"),L.innerHTML="_",L.style.opacity="0",L.style.height="1px",L.style.width="1px",document.body.appendChild(L))}function ln(){L&&(document.body.removeChild(L),L=void 0)}function ce(t){return Array.prototype.indexOf.call(t.parentElement.childNodes,t)}function dn(t){for(;t&&t.nodeName!=="TD"&&t.nodeName!=="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function cn(t){t.forEach(e=>{const i=document.getElementsByClassName(e);for(let o=0;o<i.length;o++)i[o].style.visibility="hidden"})}class oi{constructor(e,i,o){u(this,"state");u(this,"emitUpdate");u(this,"tableId");u(this,"tablePos");u(this,"menuFrozen",!1);u(this,"prevWasEditable",null);u(this,"mouseMoveHandler",e=>{var c;if(this.menuFrozen)return;const i=dn(e.target);if(!i||!this.editor.isEditable){(c=this.state)!=null&&c.show&&(this.state.show=!1,this.emitUpdate());return}const o=ce(i),n=ce(i.parentElement),r=i.getBoundingClientRect(),a=i.parentElement.parentElement.getBoundingClientRect(),s=de(r,this.pmView);if(!s)return;let l;if(this.editor._tiptapEditor.state.doc.descendants((p,h)=>{if(typeof l<"u")return!1;if(p.type.name!=="blockContainer"||p.attrs.id!==s.id)return!0;const m=C(p,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema,this.editor.blockCache);return Ut("table",m,this.editor)&&(this.tablePos=h+1,l=m),!1}),!!l&&(this.tableId=s.id,!(this.state!==void 0&&this.state.show&&this.tableId===s.id&&this.state.rowIndex===n&&this.state.colIndex===o)))return this.state={show:!0,referencePosCell:r,referencePosTable:a,block:l,colIndex:o,rowIndex:n,draggingState:void 0},this.emitUpdate(),!1});u(this,"dragOverHandler",e=>{var m;if(((m=this.state)==null?void 0:m.draggingState)===void 0)return;e.preventDefault(),e.dataTransfer.dropEffect="move",cn(["column-resize-handle","prosemirror-dropcursor-block","prosemirror-dropcursor-inline"]);const i={left:Math.min(Math.max(e.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(e.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},o=document.elementsFromPoint(i.left,i.top).filter(f=>f.tagName==="TD"||f.tagName==="TH");if(o.length===0)throw new Error("Could not find table cell element that the mouse cursor is hovering over.");const n=o[0];let r=!1;const a=ce(n.parentElement),s=ce(n),l=this.state.draggingState.draggedCellOrientation==="row"?this.state.rowIndex:this.state.colIndex,p=(this.state.draggingState.draggedCellOrientation==="row"?a:s)!==l;(this.state.rowIndex!==a||this.state.colIndex!==s)&&(this.state.rowIndex=a,this.state.colIndex=s,this.state.referencePosCell=n.getBoundingClientRect(),r=!0);const h=this.state.draggingState.draggedCellOrientation==="row"?i.top:i.left;this.state.draggingState.mousePos!==h&&(this.state.draggingState.mousePos=h,r=!0),r&&this.emitUpdate(),p&&this.pmView.dispatch(this.pmView.state.tr.setMeta(X,!0))});u(this,"dropHandler",e=>{if(this.state===void 0||this.state.draggingState===void 0)return;e.preventDefault();const i=this.state.block.content.rows;if(this.state.draggingState.draggedCellOrientation==="row"){const o=i[this.state.draggingState.originalIndex];i.splice(this.state.draggingState.originalIndex,1),i.splice(this.state.rowIndex,0,o)}else{const o=i.map(n=>n.cells[this.state.draggingState.originalIndex]);i.forEach((n,r)=>{n.cells.splice(this.state.draggingState.originalIndex,1),n.cells.splice(this.state.colIndex,0,o[r])})}this.editor.updateBlock(this.state.block,{type:"table",content:{type:"tableContent",rows:i}})});u(this,"scrollHandler",()=>{var e;if((e=this.state)!=null&&e.show){const i=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.tableId}"] table`),o=i.querySelector(`tr:nth-child(${this.state.rowIndex+1}) > td:nth-child(${this.state.colIndex+1})`);this.state.referencePosTable=i.getBoundingClientRect(),this.state.referencePosCell=o.getBoundingClientRect(),this.emitUpdate()}});this.editor=e,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw new Error("Attempting to update uninitialized image toolbar");o(this.state)},i.dom.addEventListener("mousemove",this.mouseMoveHandler),document.addEventListener("dragover",this.dragOverHandler),document.addEventListener("drop",this.dropHandler),document.addEventListener("scroll",this.scrollHandler)}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),document.removeEventListener("dragover",this.dragOverHandler),document.removeEventListener("drop",this.dropHandler),document.removeEventListener("scroll",this.scrollHandler)}}const X=new k.PluginKey("TableHandlesPlugin");class ni extends W{constructor(i){super();u(this,"view");u(this,"plugin");u(this,"colDragStart",i=>{if(this.view.state===void 0)throw new Error("Attempted to drag table column, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"col",originalIndex:this.view.state.colIndex,mousePos:i.clientX},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.colIndex,newIndex:this.view.state.colIndex,tablePos:this.view.tablePos})),ii(),i.dataTransfer.setDragImage(L,0,0),i.dataTransfer.effectAllowed="move"});u(this,"rowDragStart",i=>{if(this.view.state===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"row",originalIndex:this.view.state.rowIndex,mousePos:i.clientY},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.rowIndex,newIndex:this.view.state.rowIndex,tablePos:this.view.tablePos})),ii(),i.dataTransfer.setDragImage(L,0,0),i.dataTransfer.effectAllowed="copyMove"});u(this,"dragEnd",()=>{if(this.view.state===void 0)throw new Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState=void 0,this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(X,null)),ln()});u(this,"freezeHandles",()=>{this.view.menuFrozen=!0});u(this,"unfreezeHandles",()=>{this.view.menuFrozen=!1});this.editor=i,this.plugin=new k.Plugin({key:X,view:o=>(this.view=new oi(i,o,n=>{this.emit("update",n)}),this.view),props:{decorations:o=>{if(this.view===void 0||this.view.state===void 0||this.view.state.draggingState===void 0||this.view.tablePos===void 0)return;const n=this.view.state.draggingState.draggedCellOrientation==="row"?this.view.state.rowIndex:this.view.state.colIndex,r=[];if(n===this.view.state.draggingState.originalIndex)return S.DecorationSet.create(o.doc,r);const a=o.doc.resolve(this.view.tablePos+1),s=a.node();if(this.view.state.draggingState.draggedCellOrientation==="row"){const l=o.doc.resolve(a.posAtIndex(n)+1),c=l.node();for(let p=0;p<c.childCount;p++){const h=o.doc.resolve(l.posAtIndex(p)+1),m=h.node(),f=h.pos+(n>this.view.state.draggingState.originalIndex?m.nodeSize-2:0);r.push(S.Decoration.widget(f,()=>{const g=document.createElement("div");return g.className="bn-table-drop-cursor",g.style.left="0",g.style.right="0",n>this.view.state.draggingState.originalIndex?g.style.bottom="-2px":g.style.top="-3px",g.style.height="4px",g}))}}else for(let l=0;l<s.childCount;l++){const c=o.doc.resolve(a.posAtIndex(l)+1),p=o.doc.resolve(c.posAtIndex(n)+1),h=p.node(),m=p.pos+(n>this.view.state.draggingState.originalIndex?h.nodeSize-2:0);r.push(S.Decoration.widget(m,()=>{const f=document.createElement("div");return f.className="bn-table-drop-cursor",f.style.top="0",f.style.bottom="0",n>this.view.state.draggingState.originalIndex?f.style.right="-2px":f.style.left="-3px",f.style.width="4px",f}))}return S.DecorationSet.create(o.doc,r)}}})}onUpdate(i){return this.on("update",i)}}function ri(t,e){const i=t.state.selection.content().content,n=ye(t.state.schema,e).serializeProseMirrorFragment(i),a=J(t.state.schema,e).exportProseMirrorFragment(i),s=Ne(a);return{internalHTML:n,externalHTML:a,plainText:s}}const un=t=>b.Extension.create({name:"copyToClipboard",addProseMirrorPlugins(){return[new k.Plugin({props:{handleDOMEvents:{copy(e,i){i.preventDefault(),i.clipboardData.clearData(),"node"in e.state.selection&&e.state.selection.node.type.spec.group==="blockContent"&&e.dispatch(e.state.tr.setSelection(new k.NodeSelection(e.state.doc.resolve(e.state.selection.from-1))));const{internalHTML:o,externalHTML:n,plainText:r}=ri(e,t);return i.clipboardData.setData("blocknote/html",o),i.clipboardData.setData("text/html",n),i.clipboardData.setData("text/plain",r),!0},dragstart(e,i){if(!("node"in e.state.selection)||e.state.selection.node.type.spec.group!=="blockContent")return;e.dispatch(e.state.tr.setSelection(new k.NodeSelection(e.state.doc.resolve(e.state.selection.from-1)))),i.preventDefault(),i.dataTransfer.clearData();const{internalHTML:o,externalHTML:n,plainText:r}=ri(e,t);return i.dataTransfer.setData("blocknote/html",o),i.dataTransfer.setData("text/html",n),i.dataTransfer.setData("text/plain",r),!0}}}})]}}),pn=["blocknote/html","text/html","text/plain"],hn=t=>b.Extension.create({name:"pasteFromClipboard",addProseMirrorPlugins(){return[new k.Plugin({props:{handleDOMEvents:{paste(e,i){i.preventDefault();let o=null;for(const n of pn)if(i.clipboardData.types.includes(n)){o=n;break}if(o!==null){let n=i.clipboardData.getData(o);o==="text/html"&&(n=zt(n.trim()).innerHTML),t._tiptapEditor.view.pasteHTML(n)}return!0}}}})]}}),mn=b.Extension.create({name:"blockBackgroundColor",addGlobalAttributes(){return[{types:["blockContainer"],attributes:{backgroundColor:{default:w.backgroundColor.default,parseHTML:t=>t.hasAttribute("data-background-color")?t.getAttribute("data-background-color"):w.backgroundColor.default,renderHTML:t=>t.backgroundColor!==w.backgroundColor.default&&{"data-background-color":t.backgroundColor}}}}]}}),fn=b.Extension.create({name:"textAlignment",addGlobalAttributes(){return[{types:["paragraph","heading","bulletListItem","numberedListItem","checkListItem"],attributes:{textAlignment:{default:"left",parseHTML:t=>t.getAttribute("data-text-alignment"),renderHTML:t=>t.textAlignment!=="left"&&{"data-text-alignment":t.textAlignment}}}}]}}),gn=b.Extension.create({name:"blockTextColor",addGlobalAttributes(){return[{types:["blockContainer"],attributes:{textColor:{default:w.textColor.default,parseHTML:t=>t.hasAttribute("data-text-color")?t.getAttribute("data-text-color"):w.textColor.default,renderHTML:t=>t.textColor!==w.textColor.default&&{"data-text-color":t.textColor}}}}]}}),bn=b.Extension.create({name:"trailingNode",addProseMirrorPlugins(){const t=new k.PluginKey(this.name);return[new k.Plugin({key:t,appendTransaction:(e,i,o)=>{const{doc:n,tr:r,schema:a}=o,s=t.getState(o),l=n.content.size-2,c=a.nodes.blockContainer,p=a.nodes.paragraph;if(s)return r.insert(l,c.create(void 0,p.create()))},state:{init:(e,i)=>{},apply:(e,i)=>{if(!e.docChanged)return i;let o=e.doc.lastChild;if(!o||o.type.name!=="blockGroup")throw new Error("Expected blockGroup");if(o=o.lastChild,!o||o.type.name!=="blockContainer")throw new Error("Expected blockContainer");const n=o.firstChild;if(!n)throw new Error("Expected blockContent");return o.nodeSize>4||n.type.spec.content!=="inline*"}}})]}}),kn=new k.PluginKey("non-editable-block"),yn=()=>new k.Plugin({key:kn,props:{handleKeyDown:(t,e)=>{if("node"in t.state.selection){if(e.ctrlKey||e.metaKey)return!1;if(e.key.length===1)return e.preventDefault(),!0;if(e.key==="Enter"){const i=t.state.tr;return t.dispatch(i.insert(t.state.tr.selection.$to.after(),t.state.schema.nodes.paragraph.create()).setSelection(new k.TextSelection(i.doc.resolve(t.state.tr.selection.$to.after()+1)))),!0}}return!1}}}),ai=new k.PluginKey("previous-blocks"),_n={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},vn=()=>{let t;return new k.Plugin({key:ai,view(e){return{update:async(i,o)=>{var n;((n=this.key)==null?void 0:n.getState(i.state).updatedBlocks.size)>0&&(t=setTimeout(()=>{i.dispatch(i.state.tr.setMeta(ai,{clearUpdate:!0}))},0))},destroy:()=>{t&&clearTimeout(t)}}},state:{init(){return{prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}},apply(e,i,o,n){if(i.currentTransactionOldBlockAttrs={},i.updatedBlocks.clear(),!e.docChanged||o.doc.eq(n.doc))return i;const r={},a=b.findChildren(o.doc,c=>c.attrs.id),s=new Map(a.map(c=>[c.node.attrs.id,c])),l=b.findChildren(n.doc,c=>c.attrs.id);for(const c of l){const p=s.get(c.node.attrs.id),h=p==null?void 0:p.node.firstChild,m=c.node.firstChild;if(p&&h&&m){const f={index:m.attrs.index,level:m.attrs.level,type:m.type.name,depth:n.doc.resolve(c.pos).depth};let g={index:h.attrs.index,level:h.attrs.level,type:h.type.name,depth:o.doc.resolve(p.pos).depth};r[c.node.attrs.id]=g,e.getMeta("numberedListIndexing")&&(c.node.attrs.id in i.prevTransactionOldBlockAttrs&&(g=i.prevTransactionOldBlockAttrs[c.node.attrs.id]),f.type==="numberedListItem"&&(g.index=f.index)),i.currentTransactionOldBlockAttrs[c.node.attrs.id]=g,JSON.stringify(g)!==JSON.stringify(f)&&(g["depth-change"]=g.depth-f.depth,i.updatedBlocks.add(c.node.attrs.id))}}return i.prevTransactionOldBlockAttrs=r,i}},props:{decorations(e){const i=this.getState(e);if(i.updatedBlocks.size===0)return;const o=[];return e.doc.descendants((n,r)=>{if(!n.attrs.id||!i.updatedBlocks.has(n.attrs.id))return;const a=i.currentTransactionOldBlockAttrs[n.attrs.id],s={};for(const[c,p]of Object.entries(a))s["data-prev-"+_n[c]]=p||"none";const l=S.Decoration.node(r,r+n.nodeSize,{...s});o.push(l)}),S.DecorationSet.create(e.doc,o)}}})},wn={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},En=b.Node.create({name:"blockContainer",group:"blockContainer",content:"blockContent blockGroup?",priority:50,defining:!0,parseHTML(){return[{tag:"div",getAttrs:t=>{if(typeof t=="string")return!1;const e={};for(const[i,o]of Object.entries(wn))t.getAttribute(o)&&(e[i]=t.getAttribute(o));return t.getAttribute("data-node-type")==="blockContainer"?e:!1}}]},renderHTML({HTMLAttributes:t}){var n;const e=document.createElement("div");e.className="bn-block-outer",e.setAttribute("data-node-type","blockOuter");for(const[r,a]of Object.entries(t))r!=="class"&&e.setAttribute(r,a);const i={...((n=this.options.domAttributes)==null?void 0:n.block)||{},...t},o=document.createElement("div");o.className=D("bn-block",i.class),o.setAttribute("data-node-type",this.name);for(const[r,a]of Object.entries(i))r!=="class"&&o.setAttribute(r,a);return e.appendChild(o),{dom:e,contentDOM:o}},addCommands(){return{BNCreateBlock:t=>({state:e,dispatch:i})=>{const o=e.schema.nodes.blockContainer.createAndFill();return i&&e.tr.insert(t,o).scrollIntoView(),!0},BNDeleteBlock:t=>({state:e,dispatch:i})=>{const o=v(e.doc,t);if(o===void 0)return!1;const{startPos:n,endPos:r}=o;return i&&e.tr.deleteRange(n,r),!0},BNUpdateBlock:(t,e)=>({state:i,dispatch:o})=>{const n=v(i.doc,t);if(n===void 0)return!1;const{startPos:r,endPos:a,node:s,contentNode:l}=n;if(o){if(e.children!==void 0){const m=[];for(const f of e.children)m.push(A(f,i.schema,this.options.editor.schema.styleSchema));s.childCount===2?i.tr.replace(r+l.nodeSize+1,a-1,new _.Slice(_.Fragment.from(m),0,0)):i.tr.insert(r+l.nodeSize,i.schema.nodes.blockGroup.create({},m))}const c=l.type.name,p=e.type||c;let h="keep";if(e.content)if(typeof e.content=="string")h=[i.schema.text(e.content)];else if(Array.isArray(e.content))h=Z(e.content,i.schema,this.options.editor.schema.styleSchema);else if(e.content.type==="tableContent")h=be(e.content,i.schema,this.options.editor.schema.styleSchema);else throw new P(e.content.type);else{const m=i.schema.nodes[c].spec.content,f=i.schema.nodes[p].spec.content;m===""||f!==m&&(h=[])}h==="keep"?i.tr.setNodeMarkup(r,e.type===void 0?void 0:i.schema.nodes[e.type],{...l.attrs,...e.props}):i.tr.replaceWith(r,a,i.schema.nodes[p].create({...l.attrs,...e.props},h)).setSelection(i.schema.nodes[p].spec.content===""?new k.NodeSelection(i.tr.doc.resolve(r)):i.schema.nodes[p].spec.content==="inline*"?new k.TextSelection(i.tr.doc.resolve(r)):new k.TextSelection(i.tr.doc.resolve(r+4))),i.tr.setNodeMarkup(r-1,void 0,{...s.attrs,...e.props})}return!0},BNMergeBlocks:t=>({state:e,dispatch:i})=>{const o=e.doc.resolve(t+1).node().type.name==="blockContainer",n=e.doc.resolve(t-1).node().type.name==="blockContainer";if(!o||!n)return!1;const r=v(e.doc,t+1),{node:a,contentNode:s,startPos:l,endPos:c,depth:p}=r;if(a.childCount===2){const f=e.doc.resolve(l+s.nodeSize+1),g=e.doc.resolve(c-1),y=f.blockRange(g);i&&e.tr.lift(y,p-1)}let h=t-1,m=v(e.doc,h);for(;m.numChildBlocks>0;)if(h--,m=v(e.doc,h),m===void 0)return!1;return i&&(i(e.tr.deleteRange(l,l+s.nodeSize).replace(h-1,l,new _.Slice(s.content,0,0)).scrollIntoView()),e.tr.setSelection(new k.TextSelection(e.doc.resolve(h-1)))),!0},BNSplitBlock:(t,e,i)=>({state:o,dispatch:n})=>{const r=v(o.doc,t);if(r===void 0)return!1;const{contentNode:a,contentType:s,startPos:l,endPos:c,depth:p}=r,h=o.doc.cut(l+1,t),m=o.doc.cut(t,c-1),f=o.schema.nodes.blockContainer.createAndFill(),g=c+1,y=g+2;return n&&(o.tr.insert(g,f),o.tr.replace(y,y+1,m.content.size>0?new _.Slice(_.Fragment.from(m),p+2,p+2):void 0),e&&o.tr.setBlockType(y,y,o.schema.node(s).type,i?a.attrs:void 0),o.tr.setSelection(new k.TextSelection(o.doc.resolve(y))),o.tr.replace(l+1,c-1,h.content.size>0?new _.Slice(_.Fragment.from(h),p+2,p+2):void 0),o.tr.scrollIntoView()),!0}}},addProseMirrorPlugins(){return[vn(),yn()]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.undoInputRule(),()=>o.command(({state:n})=>{const{contentType:r,startPos:a}=v(n.doc,n.selection.from),s=n.selection.from===a+1,l=r.name==="paragraph";return s&&!l?o.BNUpdateBlock(n.selection.from,{type:"paragraph",props:{}}):!1}),()=>o.command(({state:n})=>{const{startPos:r}=v(n.doc,n.selection.from);return n.selection.from===r+1?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:n})=>{const{depth:r,startPos:a}=v(n.doc,n.selection.from),s=n.selection.from===a+1,l=n.selection.empty,c=a===2,p=a-1;return!c&&s&&l&&r===2?o.BNMergeBlocks(p):!1})]),Delete:()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.command(({state:n})=>{const{node:r,depth:a,endPos:s}=v(n.doc,n.selection.from),l=s===n.doc.nodeSize-4,c=n.selection.from===s-1,p=n.selection.empty,h=r.childCount===2;if(!l&&c&&p&&!h){let m=a,f=s+2,g=n.doc.resolve(f).depth;for(;g<m;)m=g,f+=2,g=n.doc.resolve(f).depth;return o.BNMergeBlocks(f-1)}return!1})]),Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.command(({state:n})=>{const{node:r,depth:a}=v(n.doc,n.selection.from),s=n.selection.$anchor.parentOffset===0,l=n.selection.anchor===n.selection.head,c=r.textContent.length===0,p=a>2;return s&&l&&c&&p?o.liftListItem("blockContainer"):!1}),()=>o.command(({state:n,chain:r})=>{const{node:a,endPos:s}=v(n.doc,n.selection.from),l=n.selection.$anchor.parentOffset===0,c=n.selection.anchor===n.selection.head,p=a.textContent.length===0;if(l&&c&&p){const h=s+1,m=h+2;return r().BNCreateBlock(h).setTextSelection(m).run(),!0}return!1}),()=>o.command(({state:n,chain:r})=>{const{node:a}=v(n.doc,n.selection.from),s=n.selection.$anchor.parentOffset===0;return a.textContent.length===0?!1:(r().deleteSelection().BNSplitBlock(n.selection.from,s,s).run(),!0)})]),Tab:()=>{var o,n,r;return(o=this.options.editor.formattingToolbar)!=null&&o.shown||(n=this.options.editor.linkToolbar)!=null&&n.shown||(r=this.options.editor.filePanel)!=null&&r.shown?!1:(this.editor.commands.sinkListItem("blockContainer"),!0)},"Shift-Tab":()=>{var o,n,r;return(o=this.options.editor.formattingToolbar)!=null&&o.shown||(n=this.options.editor.linkToolbar)!=null&&n.shown||(r=this.options.editor.filePanel)!=null&&r.shown?!1:(this.editor.commands.liftListItem("blockContainer"),!0)}}}}),Cn=b.Node.create({name:"blockGroup",group:"blockGroup",content:"blockContainer+",parseHTML(){return[{tag:"div",getAttrs:t=>typeof t=="string"?!1:t.getAttribute("data-node-type")==="blockGroup"?null:!1}]},renderHTML({HTMLAttributes:t}){var o;const e={...((o=this.options.domAttributes)==null?void 0:o.blockGroup)||{},...t},i=document.createElement("div");i.className=D("bn-block-group",e.class),i.setAttribute("data-node-type","blockGroup");for(const[n,r]of Object.entries(e))n!=="class"&&i.setAttribute(n,r);return{dom:i,contentDOM:i}}}),xn=b.Node.create({name:"doc",topNode:!0,content:"blockGroup"}),si=t=>{var i;const e=[b.extensions.ClipboardTextSerializer,b.extensions.Commands,b.extensions.Editable,b.extensions.FocusEvents,b.extensions.Tabindex,Ii.Gapcursor,K.configure({types:["blockContainer"]}),Pi.HardBreak.extend({priority:10}),Hi.Text,Ni.Link,...Object.values(t.styleSpecs).map(o=>o.implementation.mark),gn,mn,fn,b.Extension.create({name:"OverrideEscape",addKeyboardShortcuts(){return{Escape:()=>t.editor.suggestionMenus.shown?!1:this.editor.commands.blur()}}}),xn,En.configure({editor:t.editor,domAttributes:t.domAttributes}),Cn.configure({domAttributes:t.domAttributes}),...Object.values(t.inlineContentSpecs).filter(o=>o.config!=="link"&&o.config!=="text").map(o=>o.implementation.node.configure({editor:t.editor})),...Object.values(t.blockSpecs).flatMap(o=>[...(o.implementation.requiredExtensions||[]).map(n=>n.configure({editor:t.editor,domAttributes:t.domAttributes})),o.implementation.node.configure({editor:t.editor,domAttributes:t.domAttributes})]),un(t.editor),hn(t.editor),Li.Dropcursor.configure({width:5,color:"#ddeeff"}),...t.trailingBlock===void 0||t.trailingBlock?[bn]:[]];if(t.collaboration){if(e.push(Ki.default.configure({fragment:t.collaboration.fragment})),(i=t.collaboration.provider)!=null&&i.awareness){const o=n=>{const r=document.createElement("span");r.classList.add("collaboration-cursor__caret"),r.setAttribute("style",`border-color: ${n.color}`);const a=document.createElement("span");a.classList.add("collaboration-cursor__label"),a.setAttribute("style",`background-color: ${n.color}`),a.insertBefore(document.createTextNode(n.name),null);const s=document.createTextNode("⁠"),l=document.createTextNode("⁠");return r.insertBefore(s,null),r.insertBefore(a,null),r.insertBefore(l,null),r};e.push(Gi.default.configure({user:t.collaboration.user,render:t.collaboration.renderCursor||o,provider:t.collaboration.provider}))}}else e.push(Ai.History);return e};function Sn(t,e){const i=[];return t.forEach((o,n,r)=>{r!==e&&i.push(o)}),_.Fragment.from(i)}function Tn(t,e){let i=_.Fragment.from(t.content);for(let o=0;o<i.childCount;o++)if(i.child(o).type.spec.group==="blockContent"){const n=[i.child(o)];if(o+1<i.childCount&&i.child(o+1).type.spec.group==="blockGroup"){const a=i.child(o+1).child(0).child(0);(a.type.name==="bulletListItem"||a.type.name==="numberedListItem"||a.type.name==="checkListItem")&&(n.push(i.child(o+1)),i=Sn(i,o+1))}const r=e.state.schema.nodes.blockContainer.create(void 0,n);i=i.replaceChild(o,r)}return new _.Slice(i,t.openStart,t.openEnd)}function De(t){return t&&Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0))}class ue{constructor(e){u(this,"blockSpecs");u(this,"inlineContentSpecs");u(this,"styleSpecs");u(this,"blockSchema");u(this,"inlineContentSchema");u(this,"styleSchema");u(this,"BlockNoteEditor","only for types");u(this,"Block","only for types");u(this,"PartialBlock","only for types");this.blockSpecs=De(e==null?void 0:e.blockSpecs)||Le,this.inlineContentSpecs=De(e==null?void 0:e.inlineContentSpecs)||Pe,this.styleSpecs=De(e==null?void 0:e.styleSpecs)||Ie,this.blockSchema=Ee(this.blockSpecs),this.inlineContentSchema=Ce(this.inlineContentSpecs),this.styleSchema=Se(this.styleSpecs)}static create(e){return new ue(e)}}class Bn extends b.Editor{constructor(i,o){super({...i,content:void 0});u(this,"_state");u(this,"mount",i=>{i?(this.options.element=i,this.createViewAlternative()):this.destroy()});const n=this.schema;let r;const a=n.nodes.doc.createAndFill;n.nodes.doc.createAndFill=(...l)=>{if(r)return r;const c=a.apply(n.nodes.doc,l),p=JSON.parse(JSON.stringify(c.toJSON()));return p.content[0].content[0].attrs.id="initialBlockId",r=_.Node.fromJSON(n,p),r};let s;try{const l=i==null?void 0:i.content.map(c=>A(c,this.schema,o).toJSON());s=b.createDocument({type:"doc",content:[{type:"blockGroup",content:l}]},this.schema,this.options.parseOptions)}catch(l){throw console.error("Error creating document from blocks passed as `initialContent`. Caused by exception: ",l),new Error("Error creating document from blocks passed as `initialContent`:\n"+ +JSON.stringify(i.content))}this._state=k.EditorState.create({doc:s,schema:this.schema})}get state(){return this.view&&(this._state=this.view.state),this._state}createView(){}createViewAlternative(){queueMicrotask(()=>{this.view=new S.EditorView({mount:this.options.element},{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:this.state});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews()})}}const Mn=new k.PluginKey("blocknote-placeholder"),Ln=(t,e)=>new k.Plugin({key:Mn,view:()=>{const i=document.createElement("style");document.head.appendChild(i);const o=i.sheet,n=(a="")=>`.bn-block-content${a} .bn-inline-content:has(> .ProseMirror-trailingBreak):before`,r=(a,s=!0)=>{const l=s?"[data-is-empty-and-focused]":"";if(a==="default")return n(l);const c=`[data-content-type="${a}"]`;return n(l+c)};for(const[a,s]of Object.entries(e)){const l=a==="default";o.insertRule(`${r(a,l)}{ content: ${JSON.stringify(s)}; }`),l||o.insertRule(`${r(a,!0)}{ content: ${JSON.stringify(s)}; }`)}return{destroy:()=>{document.head.removeChild(i)}}},props:{decorations:i=>{const{doc:o,selection:n}=i;if(!t.isEditable||!n.empty)return;const r=n.$anchor,a=r.parent;if(a.content.size>0)return null;const s=r.before(),l=S.Decoration.node(s,s+a.nodeSize,{"data-is-empty-and-focused":"true"});return S.DecorationSet.create(o,[l])}}}),$n="",Xn="",In={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class Ue{constructor(e){u(this,"_tiptapEditor");u(this,"blockCache",new WeakMap);u(this,"dictionary");u(this,"schema");u(this,"blockImplementations");u(this,"inlineContentImplementations");u(this,"styleImplementations");u(this,"formattingToolbar");u(this,"linkToolbar");u(this,"sideMenu");u(this,"suggestionMenus");u(this,"filePanel");u(this,"tableHandles");u(this,"uploadFile");u(this,"resolveFileUrl");var l,c,p,h,m,f,g,y;this.options=e;const i=e;if(i.onEditorContentChange)throw new Error("onEditorContentChange initialization option is deprecated, use <BlockNoteView onChange={...} />, the useEditorChange(...) hook, or editor.onChange(...)");if(i.onTextCursorPositionChange)throw new Error("onTextCursorPositionChange initialization option is deprecated, use <BlockNoteView onSelectionChange={...} />, the useEditorSelectionChange(...) hook, or editor.onSelectionChange(...)");if(i.onEditorReady)throw new Error("onEditorReady is deprecated. Editor is immediately ready for use after creation.");if(i.editable)throw new Error("editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false");this.dictionary=e.dictionary||Ge;const o={defaultStyles:!0,schema:e.schema||ue.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};this.schema=o.schema,this.blockImplementations=o.schema.blockSpecs,this.inlineContentImplementations=o.schema.inlineContentSpecs,this.styleImplementations=o.schema.styleSpecs,this.formattingToolbar=new Wt(this),this.linkToolbar=new Xt(this),this.sideMenu=new ti(this),this.suggestionMenus=new Zt(this),this.filePanel=new qt(this),T("table",this)&&(this.tableHandles=new ni(this));const n=si({editor:this,domAttributes:o.domAttributes||{},blockSchema:this.schema.blockSchema,blockSpecs:this.schema.blockSpecs,styleSpecs:this.schema.styleSpecs,inlineContentSpecs:this.schema.inlineContentSpecs,collaboration:o.collaboration,trailingBlock:o.trailingBlock}),r=b.Extension.create({name:"BlockNoteUIExtension",addProseMirrorPlugins:()=>[this.formattingToolbar.plugin,this.linkToolbar.plugin,this.sideMenu.plugin,this.suggestionMenus.plugin,...this.filePanel?[this.filePanel.plugin]:[],...this.tableHandles?[this.tableHandles.plugin]:[],Ln(this,o.placeholders)]});n.push(r),this.uploadFile=o.uploadFile,this.resolveFileUrl=o.resolveFileUrl||(async E=>E),o.collaboration&&o.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const a=o.initialContent||(e.collaboration?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:K.options.generateID()}]);if(!Array.isArray(a)||a.length===0)throw new Error("initialContent must be a non-empty array of blocks, received: "+a);const s={...In,...o._tiptapOptions,content:a,extensions:o.enableBlockNoteExtensions===!1?((l=o._tiptapOptions)==null?void 0:l.extensions)||[]:[...((c=o._tiptapOptions)==null?void 0:c.extensions)||[],...n],editorProps:{...(p=o._tiptapOptions)==null?void 0:p.editorProps,attributes:{...(m=(h=o._tiptapOptions)==null?void 0:h.editorProps)==null?void 0:m.attributes,...(f=o.domAttributes)==null?void 0:f.editor,class:D("bn-editor",o.defaultStyles?"bn-default-styles":"",((y=(g=o.domAttributes)==null?void 0:g.editor)==null?void 0:y.class)||"")},transformPasted:Tn}};this._tiptapEditor=new Bn(s,this.schema.styleSchema)}static create(e={}){return new Ue(e)}mount(e){this._tiptapEditor.mount(e)}get prosemirrorView(){return this._tiptapEditor.view}get domElement(){return this._tiptapEditor.view.dom}isFocused(){return this._tiptapEditor.view.hasFocus()}focus(){this._tiptapEditor.view.focus()}get topLevelBlocks(){return this.topLevelBlocks}get document(){const e=[];return this._tiptapEditor.state.doc.firstChild.descendants(i=>(e.push(C(i,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),e}getBlock(e){const i=typeof e=="string"?e:e.id;let o;return this._tiptapEditor.state.doc.firstChild.descendants(n=>typeof o<"u"?!1:n.type.name!=="blockContainer"||n.attrs.id!==i?!0:(o=C(n,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),!1)),o}forEachBlock(e,i=!1){const o=this.document.slice();i&&o.reverse();function n(r){for(const a of r){if(!e(a))return!1;const s=i?a.children.slice().reverse():a.children;if(!n(s))return!1}return!0}n(o)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}getTextCursorPosition(){const{node:e,depth:i,startPos:o,endPos:n}=v(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from),r=this._tiptapEditor.state.doc.resolve(n).index(i-1),a=this._tiptapEditor.state.doc.resolve(n+1).node().childCount;let s;r>0&&(s=this._tiptapEditor.state.doc.resolve(o-2).node());let l;return r<a-1&&(l=this._tiptapEditor.state.doc.resolve(n+2).node()),{block:C(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),prevBlock:s===void 0?void 0:C(s,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),nextBlock:l===void 0?void 0:C(l,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)}}setTextCursorPosition(e,i="start"){const o=typeof e=="string"?e:e.id,{posBeforeNode:n}=Ae(o,this._tiptapEditor.state.doc),{startPos:r,contentNode:a}=v(this._tiptapEditor.state.doc,n+2),s=this.schema.blockSchema[a.type.name].content;if(s==="none"){this._tiptapEditor.commands.setNodeSelection(r);return}if(s==="inline")i==="start"?this._tiptapEditor.commands.setTextSelection(r+1):this._tiptapEditor.commands.setTextSelection(r+a.nodeSize-1);else if(s==="table")i==="start"?this._tiptapEditor.commands.setTextSelection(r+4):this._tiptapEditor.commands.setTextSelection(r+a.nodeSize-4);else throw new P(s)}getSelection(){if(this._tiptapEditor.state.selection.from===this._tiptapEditor.state.selection.to||"node"in this._tiptapEditor.state.selection)return;const e=[];return this._tiptapEditor.state.doc.descendants((i,o)=>i.type.spec.group!=="blockContent"||o+i.nodeSize<this._tiptapEditor.state.selection.from||o>this._tiptapEditor.state.selection.to?!0:(e.push(C(this._tiptapEditor.state.doc.resolve(o).node(),this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),{blocks:e}}get isEditable(){return this._tiptapEditor.isEditable}set isEditable(e){this._tiptapEditor.options.editable!==e&&this._tiptapEditor.setEditable(e)}insertBlocks(e,i,o="before"){return Oo(e,i,o,this)}updateBlock(e,i){return jo(e,i,this)}removeBlocks(e){return zo(e,this)}replaceBlocks(e,i){return Vo(e,i,this)}insertInlineContent(e){const i=Z(e,this._tiptapEditor.schema,this.schema.styleSchema);Fo({from:this._tiptapEditor.state.selection.from,to:this._tiptapEditor.state.selection.to},i,this)}getActiveStyles(){const e={},i=this._tiptapEditor.state.selection.$to.marks();for(const o of i){const n=this.schema.styleSchema[o.type.name];if(!n){console.warn("mark not found in styleschema",o.type.name);continue}n.propSchema==="boolean"?e[n.type]=!0:e[n.type]=o.attrs.stringValue}return e}addStyles(e){for(const[i,o]of Object.entries(e)){const n=this.schema.styleSchema[i];if(!n)throw new Error(`style ${i} not found in styleSchema`);if(n.propSchema==="boolean")this._tiptapEditor.commands.setMark(i);else if(n.propSchema==="string")this._tiptapEditor.commands.setMark(i,{stringValue:o});else throw new P(n.propSchema)}}removeStyles(e){for(const i of Object.keys(e))this._tiptapEditor.commands.unsetMark(i)}toggleStyles(e){for(const[i,o]of Object.entries(e)){const n=this.schema.styleSchema[i];if(!n)throw new Error(`style ${i} not found in styleSchema`);if(n.propSchema==="boolean")this._tiptapEditor.commands.toggleMark(i);else if(n.propSchema==="string")this._tiptapEditor.commands.toggleMark(i,{stringValue:o});else throw new P(n.propSchema)}}getSelectedText(){return this._tiptapEditor.state.doc.textBetween(this._tiptapEditor.state.selection.from,this._tiptapEditor.state.selection.to)}getSelectedLinkUrl(){return this._tiptapEditor.getAttributes("link").href}createLink(e,i){if(e==="")return;const{from:o,to:n}=this._tiptapEditor.state.selection;i||(i=this._tiptapEditor.state.doc.textBetween(o,n));const r=this._tiptapEditor.schema.mark("link",{href:e});this._tiptapEditor.view.dispatch(this._tiptapEditor.view.state.tr.insertText(i,o,n).addMark(o,o+i.length,r))}canNestBlock(){const{startPos:e,depth:i}=v(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return this._tiptapEditor.state.doc.resolve(e).index(i-1)>0}nestBlock(){this._tiptapEditor.commands.sinkListItem("blockContainer")}canUnnestBlock(){const{depth:e}=v(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return e>2}unnestBlock(){this._tiptapEditor.commands.liftListItem("blockContainer")}async blocksToHTMLLossy(e=this.document){return J(this._tiptapEditor.schema,this).exportBlocks(e)}async tryParseHTMLToBlocks(e){return Vt(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this._tiptapEditor.schema)}async blocksToMarkdownLossy(e=this.document){return Go(e,this._tiptapEditor.schema,this)}async tryParseMarkdownToBlocks(e){return Qo(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this._tiptapEditor.schema)}updateCollaborationUserInfo(e){if(!this.options.collaboration)throw new Error("Cannot update collaboration user info when collaboration is disabled.");this._tiptapEditor.commands.updateUser(e)}onChange(e){const i=()=>{e(this)};return this._tiptapEditor.on("update",i),()=>{this._tiptapEditor.off("update",i)}}onSelectionChange(e){const i=()=>{e(this)};return this._tiptapEditor.on("selectionUpdate",i),()=>{this._tiptapEditor.off("selectionUpdate",i)}}}function Pn(t){let e=t.getTextCursorPosition().block,i=t.schema.blockSchema[e.type].content;for(;i==="none";)e=t.getTextCursorPosition().nextBlock,i=t.schema.blockSchema[e.type].content,t.setTextCursorPosition(e,"end")}function B(t,e){const i=t.getTextCursorPosition().block;if(i.content===void 0)throw new Error("Slash Menu open in a block that doesn't contain content.");Array.isArray(i.content)&&(i.content.length===1&&G(i.content[0])&&i.content[0].type==="text"&&i.content[0].text==="/"||i.content.length===0)?t.updateBlock(i,e):(t.insertBlocks([e],i,"after"),t.setTextCursorPosition(t.getTextCursorPosition().nextBlock,"end"));const o=t.getTextCursorPosition().block;return Pn(t),o}function An(t){const e=[];return T("heading",t)&&e.push({onItemClick:()=>{B(t,{type:"heading",props:{level:1}})},badge:H("Mod-Alt-1"),key:"heading",...t.dictionary.slash_menu.heading},{onItemClick:()=>{B(t,{type:"heading",props:{level:2}})},badge:H("Mod-Alt-2"),key:"heading_2",...t.dictionary.slash_menu.heading_2},{onItemClick:()=>{B(t,{type:"heading",props:{level:3}})},badge:H("Mod-Alt-3"),key:"heading_3",...t.dictionary.slash_menu.heading_3}),T("numberedListItem",t)&&e.push({onItemClick:()=>{B(t,{type:"numberedListItem"})},badge:H("Mod-Shift-7"),key:"numbered_list",...t.dictionary.slash_menu.numbered_list}),T("bulletListItem",t)&&e.push({onItemClick:()=>{B(t,{type:"bulletListItem"})},badge:H("Mod-Shift-8"),key:"bullet_list",...t.dictionary.slash_menu.bullet_list}),T("checkListItem",t)&&e.push({onItemClick:()=>{B(t,{type:"checkListItem"})},badge:H("Mod-Shift-9"),key:"check_list",...t.dictionary.slash_menu.check_list}),T("paragraph",t)&&e.push({onItemClick:()=>{B(t,{type:"paragraph"})},badge:H("Mod-Alt-0"),key:"paragraph",...t.dictionary.slash_menu.paragraph}),T("table",t)&&e.push({onItemClick:()=>{B(t,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...t.dictionary.slash_menu.table}),T("image",t)&&e.push({onItemClick:()=>{const i=B(t,{type:"image"});t.prosemirrorView.dispatch(t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin,{block:i}))},key:"image",...t.dictionary.slash_menu.image}),T("video",t)&&e.push({onItemClick:()=>{const i=B(t,{type:"video"});t.prosemirrorView.dispatch(t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin,{block:i}))},key:"video",...t.dictionary.slash_menu.video}),T("audio",t)&&e.push({onItemClick:()=>{const i=B(t,{type:"audio"});t.prosemirrorView.dispatch(t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin,{block:i}))},key:"audio",...t.dictionary.slash_menu.audio}),T("file",t)&&e.push({onItemClick:()=>{const i=B(t,{type:"file"});t.prosemirrorView.dispatch(t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin,{block:i}))},key:"image",...t.dictionary.slash_menu.file}),e}function Nn(t,e){return t.filter(({title:i,aliases:o})=>i.toLowerCase().includes(e.toLowerCase())||o&&o.filter(n=>n.toLowerCase().includes(e.toLowerCase())).length!==0)}function Re(t=""){return typeof t=="string"?[{type:"text",text:t,styles:{}}]:t}function li(t){return typeof t=="string"?Re(t):Array.isArray(t)?t.flatMap(e=>typeof e=="string"?Re(e):fe(e)?{...e,content:Re(e.content)}:G(e)?e:{props:{},...e,content:li(e.content)}):t}function Hn(t,e){return e.map(i=>Oe(t,i))}function Oe(t,e){const i={id:"",type:e.type,props:{},content:t[e.type].content==="inline"?[]:void 0,children:[],...e};return Object.entries(t[e.type].propSchema).forEach(([o,n])=>{i.props[o]===void 0&&(i.props[o]=n.default)}),{...i,content:li(i.content),children:i.children.map(o=>Oe(t,o))}}function di(t){t.id||(t.id=K.options.generateID()),t.children&&ci(t.children)}function ci(t){for(const e of t)di(e)}d.AudioBlock=Ht,d.BlockNoteEditor=Ue,d.BlockNoteSchema=ue,d.FileBlock=ft,d.FilePanelProsemirrorPlugin=qt,d.FilePanelView=Ft,d.FormattingToolbarProsemirrorPlugin=Wt,d.FormattingToolbarView=Kt,d.ImageBlock=vt,d.LinkToolbarProsemirrorPlugin=Xt,d.SideMenuProsemirrorPlugin=ti,d.SideMenuView=Qt,d.SuggestionMenuProseMirrorPlugin=Zt,d.TableHandlesProsemirrorPlugin=ni,d.TableHandlesView=oi,d.UniqueID=K,d.UnreachableCaseError=P,d.VideoBlock=Bt,d.addIdsToBlock=di,d.addIdsToBlocks=ci,d.addInlineContentAttributes=it,d.addInlineContentKeyboardShortcuts=ot,d.addStyleAttributes=lt,d.assertEmpty=Zi,d.audioBlockConfig=It,d.audioParse=At,d.audioPropSchema=Lt,d.audioRender=Pt,d.audioToExternalHTML=Nt,d.blockToNode=A,d.camelToDataKebab=Y,d.checkBlockHasDefaultProp=Ro,d.checkBlockIsDefaultType=Ut,d.checkBlockIsFileBlock=Ho,d.checkBlockIsFileBlockWithPlaceholder=Uo,d.checkBlockIsFileBlockWithPreview=Do,d.checkBlockTypeHasDefaultProp=Rt,d.checkDefaultBlockTypeInSchema=T,d.contentNodeToInlineContent=re,d.createAddFileButton=te,d.createBlockSpec=Q,d.createBlockSpecFromStronglyTypedTiptapNode=q,d.createDefaultFilePreview=ee,d.createExternalHTMLExporter=J,d.createFigureWithCaption=se,d.createFileAndCaptionWrapper=O,d.createInlineContentSpec=oo,d.createInlineContentSpecFromTipTapNode=rt,d.createInternalBlockSpec=we,d.createInternalHTMLSerializer=ye,d.createInternalInlineContentSpec=nt,d.createInternalStyleSpec=xe,d.createLinkWithCaption=oe,d.createResizeHandlesWrapper=Be,d.createStronglyTypedTiptapNode=U,d.createStyleSpec=no,d.createStyleSpecFromTipTapMark=R,d.createSuggestionMenu=nn,d.defaultBlockSchema=Dt,d.defaultBlockSpecs=Le,d.defaultInlineContentSchema=No,d.defaultInlineContentSpecs=Pe,d.defaultProps=w,d.defaultStyleSchema=Ao,d.defaultStyleSpecs=Ie,d.fileBlockConfig=ut,d.fileParse=ht,d.filePropSchema=ct,d.fileRender=pt,d.fileToExternalHTML=mt,d.filenameFromURL=io,d.filterSuggestionItems=Nn,d.formatKeyboardShortcut=H,d.formattingToolbarPluginKey=Gt,d.getBlockFromPos=et,d.getBlockNoteExtensions=si,d.getBlockSchemaFromSpecs=Ee,d.getDefaultSlashMenuItems=An,d.getDraggableBlockFromCoords=de,d.getInlineContentParseRules=at,d.getInlineContentSchemaFromSpecs=Ce,d.getParseRules=tt,d.getStyleParseRules=dt,d.getStyleSchemaFromSpecs=Se,d.imageBlockConfig=bt,d.imageParse=yt,d.imagePropSchema=gt,d.imageRender=kt,d.imageToExternalHTML=_t,d.inheritedProps=_e,d.inlineContentToNodes=Z,d.insertOrUpdateBlock=B,d.isAppleOS=Ye,d.isLinkInlineContent=me,d.isPartialLinkInlineContent=fe,d.isSafari=to,d.isStyledTextInlineContent=G,d.linkToolbarPluginKey=$t,d.locales=Wi,d.mergeCSSClasses=D,d.nodeToBlock=C,d.nodeToCustomInlineContent=ke,d.parseEmbedElement=Te,d.parseFigureElement=ie,d.parseImageElement=Me,d.partialBlockToBlockForTesting=Oe,d.partialBlocksToBlocksForTesting=Hn,d.propsToAttributes=ve,d.sideMenuPluginKey=ei,d.stylePropsToAttributes=st,d.suggestionMenuPluginKey=j,d.tableContentToNodes=be,d.tableHandlesPluginKey=X,d.uploadToTmpFilesDotOrg_DEV_ONLY=ro,d.videoBlockConfig=Ct,d.videoParse=St,d.videoPropSchema=Et,d.videoRender=xt,d.videoToExternalHTML=Tt,d.wrapInBlockStructure=ae,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
8
8
  //# sourceMappingURL=blocknote.umd.cjs.map