@notectl/core 2.3.1 → 2.3.3

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 (197) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +129 -0
  3. package/dist/chunks/{AlignmentPlugin--xAFlRqE.mjs → AlignmentPlugin-C9Rr_R-g.mjs} +2 -2
  4. package/dist/chunks/{AlignmentPlugin--xAFlRqE.mjs.map → AlignmentPlugin-C9Rr_R-g.mjs.map} +1 -1
  5. package/dist/chunks/{AttributedMarkCommands-bagbH8Qt.mjs → AttributedMarkCommands-BCvmqeFZ.mjs} +2 -2
  6. package/dist/chunks/{AttributedMarkCommands-bagbH8Qt.mjs.map → AttributedMarkCommands-BCvmqeFZ.mjs.map} +1 -1
  7. package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs → BidiIsolationPlugin-Cw2KMk-H.mjs} +2 -2
  8. package/dist/chunks/{BidiIsolationPlugin-DBXyXpgm.mjs.map → BidiIsolationPlugin-Cw2KMk-H.mjs.map} +1 -1
  9. package/dist/chunks/{BlockInsertion-CJusvrDL.mjs → BlockInsertion-CYH2gRkY.mjs} +2 -2
  10. package/dist/chunks/{BlockInsertion-CJusvrDL.mjs.map → BlockInsertion-CYH2gRkY.mjs.map} +1 -1
  11. package/dist/chunks/{BlockquotePlugin-Bz2glHwX.mjs → BlockquotePlugin-0bZSbkyo.mjs} +2 -2
  12. package/dist/chunks/{BlockquotePlugin-Bz2glHwX.mjs.map → BlockquotePlugin-0bZSbkyo.mjs.map} +1 -1
  13. package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs +2 -0
  14. package/dist/chunks/CaretNavigationPlugin-BPZ9b6XR.mjs.map +1 -0
  15. package/dist/chunks/CodeBlockPlugin-BCJ3faXx.mjs +2 -0
  16. package/dist/chunks/{CodeBlockPlugin-C1hrdbSZ.mjs.map → CodeBlockPlugin-BCJ3faXx.mjs.map} +1 -1
  17. package/dist/chunks/{ColorGrid-C9RQoEWF.mjs → ColorGrid-DQEkJ-0y.mjs} +2 -2
  18. package/dist/chunks/{ColorGrid-C9RQoEWF.mjs.map → ColorGrid-DQEkJ-0y.mjs.map} +1 -1
  19. package/dist/chunks/ColorPickerPopup-CyF26zIU.mjs +2 -0
  20. package/dist/chunks/{ColorPickerPopup-DiA68Pzz.mjs.map → ColorPickerPopup-CyF26zIU.mjs.map} +1 -1
  21. package/dist/chunks/Commands-D5ND50PQ.mjs +2 -0
  22. package/dist/chunks/{Commands-1dFFldi7.mjs.map → Commands-D5ND50PQ.mjs.map} +1 -1
  23. package/dist/chunks/{Decoration-BpoEOANl.mjs → Decoration-BOP1TAUd.mjs} +2 -2
  24. package/dist/chunks/{Decoration-BpoEOANl.mjs.map → Decoration-BOP1TAUd.mjs.map} +1 -1
  25. package/dist/chunks/{FontPlugin-By-TGrQo.mjs → FontPlugin-D041tiLe.mjs} +2 -2
  26. package/dist/chunks/{FontPlugin-By-TGrQo.mjs.map → FontPlugin-D041tiLe.mjs.map} +1 -1
  27. package/dist/chunks/{FontSizePlugin-Dln-tYXV.mjs → FontSizePlugin-8CAvj1RD.mjs} +2 -2
  28. package/dist/chunks/{FontSizePlugin-Dln-tYXV.mjs.map → FontSizePlugin-8CAvj1RD.mjs.map} +1 -1
  29. package/dist/chunks/{FormulaPlugin-By1befrR.mjs → FormulaPlugin-DJ39BtqV.mjs} +2 -2
  30. package/dist/chunks/FormulaPlugin-DJ39BtqV.mjs.map +1 -0
  31. package/dist/chunks/GapCursorNavigation-DCWOmopl.mjs +2 -0
  32. package/dist/chunks/{GapCursorNavigation-BuXngVu-.mjs.map → GapCursorNavigation-DCWOmopl.mjs.map} +1 -1
  33. package/dist/chunks/GapCursorPlugin-2iR6506y.mjs +2 -0
  34. package/dist/chunks/{GapCursorPlugin-DAxVzXRs.mjs.map → GapCursorPlugin-2iR6506y.mjs.map} +1 -1
  35. package/dist/chunks/{HardBreakPlugin-DlbSlrdq.mjs → HardBreakPlugin-vniSvTgq.mjs} +2 -2
  36. package/dist/chunks/{HardBreakPlugin-DlbSlrdq.mjs.map → HardBreakPlugin-vniSvTgq.mjs.map} +1 -1
  37. package/dist/chunks/{HeadingPlugin-uMAjPOk5.mjs → HeadingPlugin-DUKsLuMd.mjs} +2 -2
  38. package/dist/chunks/{HeadingPlugin-uMAjPOk5.mjs.map → HeadingPlugin-DUKsLuMd.mjs.map} +1 -1
  39. package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs → HighlightPlugin-DRTAE1N5.mjs} +2 -2
  40. package/dist/chunks/{HighlightPlugin-Bj7FPkIQ.mjs.map → HighlightPlugin-DRTAE1N5.mjs.map} +1 -1
  41. package/dist/chunks/HorizontalRulePlugin-B9OvwrKB.mjs +2 -0
  42. package/dist/chunks/{HorizontalRulePlugin-DUVmTQpX.mjs.map → HorizontalRulePlugin-B9OvwrKB.mjs.map} +1 -1
  43. package/dist/chunks/{ImagePlugin-FToCOjd5.mjs → ImagePlugin-CwxTRr6d.mjs} +2 -2
  44. package/dist/chunks/{ImagePlugin-FToCOjd5.mjs.map → ImagePlugin-CwxTRr6d.mjs.map} +1 -1
  45. package/dist/chunks/{InlineCodePlugin-pISIoGQE.mjs → InlineCodePlugin-uxgMUX_E.mjs} +2 -2
  46. package/dist/chunks/{InlineCodePlugin-pISIoGQE.mjs.map → InlineCodePlugin-uxgMUX_E.mjs.map} +1 -1
  47. package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs → LinkPlugin-CvWHbSkb.mjs} +2 -2
  48. package/dist/chunks/{LinkPlugin-Ct5Z180S.mjs.map → LinkPlugin-CvWHbSkb.mjs.map} +1 -1
  49. package/dist/chunks/{ListPlugin-DAY5ezNs.mjs → ListPlugin-BchSFWVn.mjs} +2 -2
  50. package/dist/chunks/{ListPlugin-DAY5ezNs.mjs.map → ListPlugin-BchSFWVn.mjs.map} +1 -1
  51. package/dist/chunks/{MarkdownHTMLRegistry-CKEx7LkR.mjs → MarkdownHTMLRegistry-Q7l0d6Ma.mjs} +2 -2
  52. package/dist/chunks/{MarkdownHTMLRegistry-CKEx7LkR.mjs.map → MarkdownHTMLRegistry-Q7l0d6Ma.mjs.map} +1 -1
  53. package/dist/chunks/{MarkdownParser-CWt3M6jR.mjs → MarkdownParser-Dp62mfUq.mjs} +2 -2
  54. package/dist/chunks/{MarkdownParser-CWt3M6jR.mjs.map → MarkdownParser-Dp62mfUq.mjs.map} +1 -1
  55. package/dist/chunks/{MarkdownSerializer-J-i28out.mjs → MarkdownSerializer-DBELFAeo.mjs} +2 -2
  56. package/dist/chunks/{MarkdownSerializer-J-i28out.mjs.map → MarkdownSerializer-DBELFAeo.mjs.map} +1 -1
  57. package/dist/chunks/MathFont-BS8IwYh2.mjs +2 -0
  58. package/dist/chunks/MathFont-BS8IwYh2.mjs.map +1 -0
  59. package/dist/chunks/NodeSelectionCommands-WH5snxr_.mjs +2 -0
  60. package/dist/chunks/{NodeSelectionCommands-1PjwUDTJ.mjs.map → NodeSelectionCommands-WH5snxr_.mjs.map} +1 -1
  61. package/dist/chunks/PluginHelpers-KDuTlmXm.mjs +2 -0
  62. package/dist/chunks/{PluginHelpers-Dx_0hfDe.mjs.map → PluginHelpers-KDuTlmXm.mjs.map} +1 -1
  63. package/dist/chunks/{PopupManager-CT-fMZJn.mjs → PopupManager-Cj86uDEB.mjs} +2 -2
  64. package/dist/chunks/{PopupManager-CT-fMZJn.mjs.map → PopupManager-Cj86uDEB.mjs.map} +1 -1
  65. package/dist/chunks/PrintPlugin-D2javl_d.mjs +2 -0
  66. package/dist/chunks/{PrintPlugin-7zz9mhhU.mjs.map → PrintPlugin-D2javl_d.mjs.map} +1 -1
  67. package/dist/chunks/SimpleMark-gTQaSJcO.mjs +2 -0
  68. package/dist/chunks/{SimpleMark-7CQcA4RK.mjs.map → SimpleMark-gTQaSJcO.mjs.map} +1 -1
  69. package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs +2 -0
  70. package/dist/chunks/SmartPastePlugin-BvJQ-fOz.mjs.map +1 -0
  71. package/dist/chunks/StarterFonts-BDQPg-cu.mjs +2 -0
  72. package/dist/chunks/StarterFonts-BDQPg-cu.mjs.map +1 -0
  73. package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs → StrikethroughPlugin-BdrG1TTY.mjs} +2 -2
  74. package/dist/chunks/{StrikethroughPlugin-C2oWvGc3.mjs.map → StrikethroughPlugin-BdrG1TTY.mjs.map} +1 -1
  75. package/dist/chunks/{SuperSubPlugin-D1xaKrSu.mjs → SuperSubPlugin-DTZB0Y3D.mjs} +2 -2
  76. package/dist/chunks/{SuperSubPlugin-D1xaKrSu.mjs.map → SuperSubPlugin-DTZB0Y3D.mjs.map} +1 -1
  77. package/dist/chunks/{TablePlugin-PJe3zwr-.mjs → TablePlugin-CPvg9YZS.mjs} +2 -2
  78. package/dist/chunks/{TablePlugin-PJe3zwr-.mjs.map → TablePlugin-CPvg9YZS.mjs.map} +1 -1
  79. package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs → TextColorPlugin-Ckg3KWvb.mjs} +2 -2
  80. package/dist/chunks/{TextColorPlugin-CTd9tfeG.mjs.map → TextColorPlugin-Ckg3KWvb.mjs.map} +1 -1
  81. package/dist/chunks/{TextDirectionAutoPlugin-CPnKVVuI.mjs → TextDirectionAutoPlugin-DRGbgTlx.mjs} +2 -2
  82. package/dist/chunks/{TextDirectionAutoPlugin-CPnKVVuI.mjs.map → TextDirectionAutoPlugin-DRGbgTlx.mjs.map} +1 -1
  83. package/dist/chunks/TextDirectionPlugin-BCeYyJHo.mjs +2 -0
  84. package/dist/chunks/{TextDirectionPlugin-Bns_03vL.mjs.map → TextDirectionPlugin-BCeYyJHo.mjs.map} +1 -1
  85. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  86. package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
  87. package/dist/chunks/TextFormattingPlugin-BhRxSC8q.mjs +2 -0
  88. package/dist/chunks/{TextFormattingPlugin-DBVlePqj.mjs.map → TextFormattingPlugin-BhRxSC8q.mjs.map} +1 -1
  89. package/dist/chunks/ThemeEngine-BUVo_zaT.mjs +3 -0
  90. package/dist/chunks/ThemeEngine-BUVo_zaT.mjs.map +1 -0
  91. package/dist/chunks/ToolbarPlugin-dmTj1jIz.mjs +2 -0
  92. package/dist/chunks/{ToolbarPlugin-DtfGTO_V.mjs.map → ToolbarPlugin-dmTj1jIz.mjs.map} +1 -1
  93. package/dist/chunks/{VideoPlugin-BrR8g6Rz.mjs → VideoPlugin-BugkI7-m.mjs} +2 -2
  94. package/dist/chunks/{VideoPlugin-BrR8g6Rz.mjs.map → VideoPlugin-BugkI7-m.mjs.map} +1 -1
  95. package/dist/chunks/XmlSupport-DIXH5on9.mjs +2 -0
  96. package/dist/chunks/XmlSupport-DIXH5on9.mjs.map +1 -0
  97. package/dist/chunks/full-JM0-SwWy.mjs +2 -0
  98. package/dist/chunks/{full-DSWM4cKQ.mjs.map → full-JM0-SwWy.mjs.map} +1 -1
  99. package/dist/chunks/minimal-DSlR2A27.mjs +2 -0
  100. package/dist/chunks/{minimal-CFkkPXef.mjs.map → minimal-DSlR2A27.mjs.map} +1 -1
  101. package/dist/chunks/register-BjsdJ3Aq.mjs +2 -0
  102. package/dist/chunks/register-BjsdJ3Aq.mjs.map +1 -0
  103. package/dist/chunks/src-5GKFQ2mQ.mjs +2 -0
  104. package/dist/chunks/src-5GKFQ2mQ.mjs.map +1 -0
  105. package/dist/chunks/xml-BsV44TrJ.mjs +2 -0
  106. package/dist/chunks/xml-BsV44TrJ.mjs.map +1 -0
  107. package/dist/editor/NotectlEditor.d.ts.map +1 -1
  108. package/dist/fonts/math.d.ts +3 -0
  109. package/dist/fonts/math.d.ts.map +1 -0
  110. package/dist/fonts/math.mjs +1 -0
  111. package/dist/fonts/starter.d.ts +3 -0
  112. package/dist/fonts/starter.d.ts.map +1 -0
  113. package/dist/fonts/starter.mjs +1 -0
  114. package/dist/fonts.d.ts +4 -4
  115. package/dist/fonts.mjs +1 -1
  116. package/dist/full.d.ts +1 -1
  117. package/dist/full.mjs +1 -1
  118. package/dist/index.d.ts +2 -1
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/markdown.mjs +1 -1
  121. package/dist/notectl-core.mjs +1 -1
  122. package/dist/notectl-core.umd.js +1 -1
  123. package/dist/notectl-core.umd.js.map +1 -1
  124. package/dist/plugins/alignment.mjs +1 -1
  125. package/dist/plugins/bidi-isolation.mjs +1 -1
  126. package/dist/plugins/blockquote.mjs +1 -1
  127. package/dist/plugins/caret-navigation.mjs +1 -1
  128. package/dist/plugins/code-block/CodeBlockHighlighting.d.ts.map +1 -1
  129. package/dist/plugins/code-block.mjs +1 -1
  130. package/dist/plugins/font-size.mjs +1 -1
  131. package/dist/plugins/font.mjs +1 -1
  132. package/dist/plugins/formula/FormulaTypes.d.ts +1 -1
  133. package/dist/plugins/formula.mjs +1 -1
  134. package/dist/plugins/gap-cursor.mjs +1 -1
  135. package/dist/plugins/hard-break.mjs +1 -1
  136. package/dist/plugins/heading.mjs +1 -1
  137. package/dist/plugins/highlight.mjs +1 -1
  138. package/dist/plugins/horizontal-rule.mjs +1 -1
  139. package/dist/plugins/image.mjs +1 -1
  140. package/dist/plugins/inline-code.mjs +1 -1
  141. package/dist/plugins/language.mjs +1 -1
  142. package/dist/plugins/link.mjs +1 -1
  143. package/dist/plugins/list.mjs +1 -1
  144. package/dist/plugins/print.mjs +1 -1
  145. package/dist/plugins/shared.mjs +1 -1
  146. package/dist/plugins/smart-paste/SmartPastePlugin.d.ts.map +1 -1
  147. package/dist/plugins/smart-paste.mjs +1 -1
  148. package/dist/plugins/strikethrough.mjs +1 -1
  149. package/dist/plugins/super-sub.mjs +1 -1
  150. package/dist/plugins/table.mjs +1 -1
  151. package/dist/plugins/text-color.mjs +1 -1
  152. package/dist/plugins/text-direction-auto.mjs +1 -1
  153. package/dist/plugins/text-direction.mjs +1 -1
  154. package/dist/plugins/text-formatting.mjs +1 -1
  155. package/dist/plugins/toolbar.mjs +1 -1
  156. package/dist/plugins/video.mjs +1 -1
  157. package/dist/presets/full.d.ts +1 -1
  158. package/dist/presets/full.mjs +1 -1
  159. package/dist/presets/minimal.d.ts +1 -1
  160. package/dist/presets/minimal.mjs +1 -1
  161. package/dist/presets.d.ts +1 -1
  162. package/dist/presets.mjs +1 -1
  163. package/dist/register.d.ts +3 -0
  164. package/dist/register.d.ts.map +1 -0
  165. package/dist/register.mjs +1 -0
  166. package/package.json +24 -223
  167. package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs +0 -2
  168. package/dist/chunks/CaretNavigationPlugin-CNsT0eb4.mjs.map +0 -1
  169. package/dist/chunks/CodeBlockPlugin-C1hrdbSZ.mjs +0 -2
  170. package/dist/chunks/ColorPickerPopup-DiA68Pzz.mjs +0 -2
  171. package/dist/chunks/Commands-1dFFldi7.mjs +0 -2
  172. package/dist/chunks/FormulaPlugin-By1befrR.mjs.map +0 -1
  173. package/dist/chunks/GapCursorNavigation-BuXngVu-.mjs +0 -2
  174. package/dist/chunks/GapCursorPlugin-DAxVzXRs.mjs +0 -2
  175. package/dist/chunks/HorizontalRulePlugin-DUVmTQpX.mjs +0 -2
  176. package/dist/chunks/NodeSelectionCommands-1PjwUDTJ.mjs +0 -2
  177. package/dist/chunks/PluginHelpers-Dx_0hfDe.mjs +0 -2
  178. package/dist/chunks/PrintPlugin-7zz9mhhU.mjs +0 -2
  179. package/dist/chunks/PrintTypes-CxU69qu3.mjs +0 -3
  180. package/dist/chunks/PrintTypes-CxU69qu3.mjs.map +0 -1
  181. package/dist/chunks/SimpleMark-7CQcA4RK.mjs +0 -2
  182. package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs +0 -2
  183. package/dist/chunks/SmartPastePlugin-CYa_nD9v.mjs.map +0 -1
  184. package/dist/chunks/TextDirectionPlugin-Bns_03vL.mjs +0 -2
  185. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  186. package/dist/chunks/TextFormattingPlugin-DBVlePqj.mjs +0 -2
  187. package/dist/chunks/ToolbarPlugin-DtfGTO_V.mjs +0 -2
  188. package/dist/chunks/XmlDetector-D7TQpw-e.mjs +0 -2
  189. package/dist/chunks/XmlDetector-D7TQpw-e.mjs.map +0 -1
  190. package/dist/chunks/XmlSupport-BYiRwlkK.mjs +0 -2
  191. package/dist/chunks/XmlSupport-BYiRwlkK.mjs.map +0 -1
  192. package/dist/chunks/fonts-DQC6Uj4r.mjs +0 -2
  193. package/dist/chunks/fonts-DQC6Uj4r.mjs.map +0 -1
  194. package/dist/chunks/full-DSWM4cKQ.mjs +0 -2
  195. package/dist/chunks/minimal-CFkkPXef.mjs +0 -2
  196. package/dist/chunks/src-DiAOfuOT.mjs +0 -2
  197. package/dist/chunks/src-DiAOfuOT.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import{n as t,r as e}from"./HTMLUtils-Bhg3_P8B.mjs";import{_ as n,o,p as i,w as r}from"./Document-827l3P80.mjs";import{c as a,l,o as s,r as d,t as c,u}from"./Selection-HYoVFpAx.mjs";import{a as p}from"./TypeBrands-Ch9856Gb.mjs";import{n as h}from"./DomUtils-Bf7JLFlx.mjs";import{s as m}from"./BlockInsertion-CJusvrDL.mjs";import{t as v}from"./NodeSelectionCommands-1PjwUDTJ.mjs";import{t as f}from"./Platform-ByobkiCc.mjs";import{c as b,r as g}from"./StyleRuntime-DW6omotc.mjs";import{c as y,o as x}from"./PluginHelpers-Dx_0hfDe.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";import{a as w}from"./PopupPositioning-BFh6Ed1D.mjs";import A from"dompurify";var k=/^[A-Za-z0-9_-]{11}$/,C=/^\d+$/,P=/^[A-Za-z0-9]+$/,z=/^[A-Za-z0-9]+$/;function E(t,e){const n=t.indexOf(e);if(-1!==n)return t[n+1]}function L(t,e,n){const o=e.searchParams.get("h")??n;return o&&P.test(o)?{videoId:t,hash:o}:{videoId:t}}var S=[{id:"youtube",label:"YouTube",hostnames:["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be","youtube-nocookie.com","www.youtube-nocookie.com"],embedHostnames:["www.youtube-nocookie.com","youtube-nocookie.com","www.youtube.com","youtube.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("youtu.be"===e){const t=n[0];return t&&k.test(t)?{videoId:t}:null}const o=t.searchParams.get("v");if(o&&k.test(o))return{videoId:o};for(const i of["embed","shorts","live","v"]){const t=E(n,i);if(t&&k.test(t))return{videoId:t}}return null},buildEmbedUrl(t,e){const n=e.privacy?"www.youtube-nocookie.com":"www.youtube.com",o=V({rel:"0",...e.autoplay?{autoplay:"1"}:{}});return`https://${n}/embed/${t.videoId}${o}`},buildWatchUrl:t=>`https://www.youtube.com/watch?v=${t.videoId}`,thumbnailUrl:t=>`https://i.ytimg.com/vi/${t.videoId}/hqdefault.jpg`},{id:"vimeo",label:"Vimeo",hostnames:["vimeo.com","www.vimeo.com","player.vimeo.com"],embedHostnames:["player.vimeo.com"],parse(t){const e=t.pathname.split("/").filter(Boolean),n=E(e,"video");if(n&&C.test(n))return L(n,t,void 0);const o=e.find(t=>C.test(t));return o?L(o,t,e[e.indexOf(o)+1]):null},buildEmbedUrl(t,e){const n=V({...t.hash?{h:t.hash}:{},...e.privacy?{dnt:"1"}:{},...e.autoplay?{autoplay:"1"}:{}});return`https://player.vimeo.com/video/${t.videoId}${n}`},buildWatchUrl(t){const e=`https://vimeo.com/${t.videoId}`;return t.hash?`${e}/${t.hash}`:e}},{id:"dailymotion",label:"Dailymotion",hostnames:["dailymotion.com","www.dailymotion.com","geo.dailymotion.com","dai.ly"],embedHostnames:["www.dailymotion.com","geo.dailymotion.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("dai.ly"===e){const t=n[0];return t&&z.test(t)?{videoId:t}:null}const o=E(n,"video");return o&&z.test(o)?{videoId:o}:null},buildEmbedUrl(t,e){const n=V(e.autoplay?{autoplay:"1"}:{});return`https://www.dailymotion.com/embed/video/${t.videoId}${n}`},buildWatchUrl:t=>`https://www.dailymotion.com/video/${t.videoId}`,thumbnailUrl:t=>`https://www.dailymotion.com/thumbnail/video/${t.videoId}`}];function I(t,e=S){const n=B(t);if(!n)return null;if("https:"!==n.protocol&&"http:"!==n.protocol)return null;const o=n.hostname.toLowerCase();for(const i of e){if(!i.hostnames.includes(o))continue;const t=i.parse(n);if(t)return{provider:i.id,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}return null}function R(t,e=S){return e.find(e=>e.id===t)}function $(t,e){const n=R(t.provider,e);return n?n.buildWatchUrl(t):null}function N(t,e){return R(t.provider,e)?.thumbnailUrl?.(t)}function H(t,e=S){return R(t,e)?.label??t}function B(t){try{return new URL(t.trim())}catch{return null}}function V(t){const e=Object.entries(t);return 0===e.length?"":`?${e.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&")}`}var M={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},W={providers:S,facade:!0,useProviderThumbnail:!1,privacy:!0,allowedAspectRatios:["16/9","4/3","1/1","9/16"],defaultAspectRatio:"16/9",defaultWidthPercent:100,minWidthPercent:25,widthStep:10,widthStepLarge:25,resizable:!0},j="video",D=/^\d+(?:\.\d+)?\s*\/\s*\d+(?:\.\d+)?$/;function T(t,e){if(!t||!D.test(t.trim()))return e.defaultAspectRatio;const[n,o]=t.split("/");return`${n?.trim()} / ${o?.trim()}`}function O(t,e){return Number.isFinite(t)?Math.max(e.minWidthPercent,Math.min(100,Math.round(t))):e.defaultWidthPercent}var U=/^[A-Za-z0-9_-]+$/;function F(t){return t.length>0&&t.length<=64&&U.test(t)}function K(t,e){return{provider:t?.provider??"",videoId:t?.videoId??"",...t?.hash?{hash:t.hash}:{},aspectRatio:T(t?.aspectRatio,e),widthPercent:O(t?.widthPercent??e.defaultWidthPercent,e),align:t?.align??"center",title:t?.title??"",...t?.caption?{caption:t.caption}:{},privacy:t?.privacy??e.privacy}}function q(t,e){const n=I(t.url,e.providers);return n?{provider:n.provider,videoId:n.videoId,...n.hash?{hash:n.hash}:{},aspectRatio:T(t.aspectRatio,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.title,...t.caption?{caption:t.caption}:{},privacy:e.privacy}:null}function G(t){return{provider:t.provider,videoId:t.videoId,aspectRatio:t.aspectRatio,widthPercent:t.widthPercent,align:t.align,title:t.title,privacy:t.privacy,...t.hash?{hash:t.hash}:{},...t.caption?{caption:t.caption}:{}}}function X(t){const e=t.selection;if(!l(e))return null;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return null;const o=t.getNodePath(e.nodeId);return o?{block:n,path:o}:null}function Z(t,e){const n=t.getState(),o=X(n);return!!o&&(t.dispatch(n.transaction("command").setNodeAttr(o.path,e).build()),!0)}function Y(t){const e=t.getState(),n=X(e);if(!n)return!1;const o=v(e,d(n.block.id,n.path));return!!o&&(t.dispatch(o),!0)}var J=0;function Q(t){return`${t}-${J+=1}`}function tt(t,e){const n=Q("notectl-video-field"),o=document.createElement("div");o.className="notectl-video-popup__field";const i=document.createElement("label");i.className="notectl-video-popup__label",i.setAttribute("for",n),i.textContent=e.label,o.appendChild(i);const r=document.createElement("input");r.id=n,r.type=e.type,r.value=e.value,r.placeholder=e.placeholder,r.className="notectl-video-popup__input",r.setAttribute("aria-label",e.ariaLabel),e.required&&r.setAttribute("aria-required","true");const a=[];if(e.hint){const t=`${n}-hint`,i=document.createElement("p");i.id=t,i.className="notectl-video-popup__hint",i.textContent=e.hint,o.appendChild(i),a.push(t)}return e.describedBy&&a.push(e.describedBy),a.length>0&&r.setAttribute("aria-describedby",a.join(" ")),o.insertBefore(r,o.children[1]??null),t.appendChild(o),r}var et=class{context;config;locale;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.config=e,this.locale=n}get isOpen(){return null!==this.panel}openInsert(){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,onSubmit:t=>{const e=q(t,this.config);e&&function(t,e){const n=t.getState(),s=n.selection;if(a(s))return!1;const c=G(e),u=l(s)?s.nodeId:s.anchor.blockId,h=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const o of n)if("table_cell"===t.getBlock(o)?.type)return o}(n,u);h?function(t,e,n,a){const l=t.getNodePath(n),s=t.getBlock(n);if(!l||!s)return!1;const c=o(p(j),[],void 0,a),u=t.transaction("command"),h=i(s);for(let o=h.length-1;o>=0;o--){const t=s.children.findIndex(t=>r(t)&&t.id===h[o]?.id);-1!==t&&u.removeNode(l,t)}u.insertNode(l,0,c),u.setSelection(d(c.id,[...l,c.id])),e.dispatch(u.build())}(n,t,h,c):function(t,e,n,i){const r=o(p(j),[],void 0,i),a=t.transaction("command");!!m(t,a,n,r)&&(a.setSelection(d(r.id,[])),e.dispatch(a.build()))}(n,t,u,c)}(this.context,e)}})}openInsertReplacingRange(t,e){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,initial:{url:e},onSubmit:e=>{const i=q(e,this.config);i&&function(t,e,i){const a=t.getState(),l=a.getBlock(e.blockId);if(!l)return!1;const s=function(t,e){const n=t.getNodePath(e);if(!n||0===n.length)return null;if(1===n.length){const n=t.doc.children.findIndex(t=>t.id===e);return-1===n?null:{parentPath:[],index:n}}const o=n[n.length-2],i=o?t.getBlock(o):void 0;if(!i)return null;const a=i.children.findIndex(t=>r(t)&&t.id===e);return-1===a?null:{parentPath:n.slice(0,-1),index:a}}(a,e.blockId);if(!s)return!1;const c=0===Math.max(0,n(l).length-(e.end-e.start))&&"paragraph"===l.type,u=o(p(j),[],void 0,G(i)),h=0===s.parentPath.length?[]:[...s.parentPath,u.id],m=a.transaction("command");c?(m.removeNode(s.parentPath,s.index),m.insertNode(s.parentPath,s.index,u),0===s.parentPath.length&&s.index>=a.doc.children.length-1&&m.insertNode([],s.index+1,o(p("paragraph")))):(m.deleteTextAt(e.blockId,e.start,e.end),m.insertNode(s.parentPath,s.index+1,u)),m.setSelection(d(u.id,h)),t.dispatch(m.build())}(this.context,t,i)}})}openEditForSelected(){if(this.context.isReadOnly())return;const t=this.context.getState(),e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=K(n.attrs,this.config),i={url:$({provider:o.provider,videoId:o.videoId,...o.hash?{hash:o.hash}:{}},this.config.providers)??"",title:o.title,caption:o.caption??"",aspectRatio:o.aspectRatio};this.open({rect:this.videoRect(e.nodeId),mode:"edit",label:this.locale.editDialogLabel,initial:i,onSubmit:t=>{!function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=I(e.url,n.providers);if(!i)return!1;const r=function(t,e){const n={};for(const[o,i]of Object.entries(t??{}))e.includes(o)||"string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||(n[o]=i);return n}(o.block.attrs,["hash","caption"]);r.provider=i.provider,r.videoId=i.videoId,r.title=e.title,r.aspectRatio=T(e.aspectRatio,n),i.hash&&(r.hash=i.hash),e.caption.trim()&&(r.caption=e.caption.trim()),Z(t,r)}(this.context,t,this.config)}})}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-video-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.setAttribute("aria-label",t.label),this.panel=e,function(t,e){const{config:n,locale:o,initial:i,mode:r}=e;t.classList.add("notectl-video-popup");const a=Q("notectl-video-error"),l=document.createElement("p");l.id=a,l.className="notectl-video-popup__error",l.setAttribute("role","alert");const s=tt(t,{label:o.urlLabel,ariaLabel:o.urlAria,placeholder:o.urlPlaceholder,value:i?.url??"",type:"url",required:!0,describedBy:a}),d=tt(t,{label:o.titleLabel,ariaLabel:o.titleAria,placeholder:o.titlePlaceholder,value:i?.title??"",type:"text",required:!0,hint:o.titleHint}),c=tt(t,{label:o.captionLabel,ariaLabel:o.captionAria,placeholder:o.captionPlaceholder,value:i?.caption??"",type:"text"}),u=function(t,e,n,o){const i=Q("notectl-video-field"),r=document.createElement("div");r.className="notectl-video-popup__field";const a=document.createElement("label");a.className="notectl-video-popup__label",a.setAttribute("for",i),a.textContent=n.aspectRatioLabel,r.appendChild(a);const l=document.createElement("select");l.id=i,l.className="notectl-video-popup__select",l.setAttribute("aria-label",n.aspectRatioAria);const s=e.allowedAspectRatios.includes(o)?e.allowedAspectRatios:[o,...e.allowedAspectRatios];for(const d of s){const t=document.createElement("option");t.value=d,t.textContent=d,d===o&&(t.selected=!0),l.appendChild(t)}return r.appendChild(l),t.appendChild(r),l}(t,n,o,i?.aspectRatio??n.defaultAspectRatio);t.appendChild(l);const p=document.createElement("div");p.className="notectl-video-popup__actions";const h=document.createElement("button");h.type="button",h.className="notectl-video-popup__cancel",h.textContent=o.cancelButton;const m=document.createElement("button");m.type="button",m.className="notectl-video-popup__submit",m.textContent="edit"===r?o.updateButton:o.insertButton,m.setAttribute("aria-label","edit"===r?o.updateAria:o.insertAria),p.append(h,m),t.appendChild(p);const v=(t,e)=>{l.textContent=t,e.focus()},f=()=>{const t=s.value.trim();if(!I(t,n.providers))return void v(o.invalidUrl,s);const i=d.value.trim();i?(l.textContent="",e.onSubmit({url:t,title:i,caption:c.value.trim(),aspectRatio:u.value}),e.onClose()):v(o.titleRequired,d)};h.addEventListener("mousedown",t=>t.preventDefault()),h.addEventListener("click",t=>{t.preventDefault(),e.onClose()}),m.addEventListener("mousedown",t=>t.preventDefault()),m.addEventListener("click",t=>{t.preventDefault(),f()});for(const b of[s,d,c])b.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),f())});requestAnimationFrame(()=>s.focus())}(e,{mode:t.mode,initial:t.initial,config:this.config,locale:this.locale,onSubmit:t.onSubmit,onClose:()=>this.close(!0)}),e.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||320,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}videoRect(t){const e=this.context.getContainer().querySelector(`[data-block-id="${t}"]`);return e?e.getBoundingClientRect():null}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function nt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}var ot={insertVideo:"Insert Video",insertVideoTooltip:"Insert Video",urlLabel:"Video URL",urlPlaceholder:"https://www.youtube.com/watch?v=...",urlAria:"Video URL",titleLabel:"Title",titlePlaceholder:"Describe the video",titleAria:"Video title",titleHint:"Describes the video for screen readers. Required.",captionLabel:"Caption",captionPlaceholder:"Optional visible caption",captionAria:"Video caption",aspectRatioLabel:"Aspect ratio",aspectRatioAria:"Video aspect ratio",insertButton:"Insert",insertAria:"Insert video",updateButton:"Update",updateAria:"Update video",cancelButton:"Cancel",insertDialogLabel:"Insert video",editDialogLabel:"Edit video",invalidUrl:"Enter a YouTube, Vimeo, or Dailymotion video URL.",titleRequired:"Enter a title so screen readers can describe the video.",play:t=>t?`Play video: ${t}`:"Play video",loading:"Loading video...",providerBadge:t=>`${t} video`,closePlayer:"Close video player",videoAria:(t,e)=>e?`${t} video: ${e}`:`${t} video`,videoSelected:"Video selected.",videoSelectedWithTitle:t=>`Video selected: ${t}.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`,videoResized:t=>`Video resized to ${t} percent width.`,resetToDefaultSize:"Video reset to full width.",enteredPlayer:t=>t?`Playing ${t}. Press Escape to return to the document.`:"Playing video. Press Escape to return to the document.",exitedPlayer:"Returned to the document.",videoOptions:"Video options",editVideo:"Edit video",alignStart:"Align left",alignCenter:"Align center",alignEnd:"Align right",deleteVideo:"Delete video",embedPrompt:"Embed this video?",embedConfirm:"Embed",embedDismiss:"Keep as link",embedOfferAnnounce:t=>`${t} link pasted. Press Embed to turn it into a video, or continue editing to keep it as a link.`,embeddedAnnounce:"Video embedded."},it=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--O0A9OTR.mjs"),"./locales/de.ts":()=>import("./de-BxQIt_1Y.mjs"),"./locales/es.ts":()=>import("./es-BQweZX6P.mjs"),"./locales/fr.ts":()=>import("./fr-C3EKRThN.mjs"),"./locales/hi.ts":()=>import("./hi-L6pJxZam.mjs"),"./locales/pt.ts":()=>import("./pt-Bb908r0n.mjs"),"./locales/ru.ts":()=>import("./ru-DkW9XZFy.mjs"),"./locales/zh.ts":()=>import("./zh-ikm3rSTR.mjs")});async function rt(t){return y(it,t,ot)}var at={start:"notectl-video--start",center:"notectl-video--center",end:"notectl-video--end"};function lt(t,e){for(const o of Object.values(at))t.classList.remove(o);const n=at[e]??at.center;t.classList.add(n)}function st(t,e,n){b(t,"aspect-ratio",e),b(t,"width",`${n}%`)}var dt=/^[A-Za-z0-9]+$/;function ct(t){return{provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}function ut(t,e){const n=Number.parseFloat(t.getAttribute("width")??""),o=Number.parseFloat(t.getAttribute("height")??"");return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?T(`${n}/${o}`,e):e.defaultAspectRatio}function pt(t,e,n){const o=function(t,e,n){const o=R(t.provider,e);return o?o.buildEmbedUrl(t,n):null}({provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}},e.providers,{privacy:t.privacy,autoplay:!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches})??"",i=document.createElement("iframe");return i.className="notectl-video__iframe",i.setAttribute("src",o),i.setAttribute("title",t.title||n.providerBadge(H(t.provider,e.providers))),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","no-referrer"),i.setAttribute("loading","lazy"),i.setAttribute("frameborder","0"),i}var ht=class{frame;getAttrs;config;locale;announce;facadeButton=null;player=null;iframe=null;escapeHandler=null;renderedKey="";constructor(t){this.frame=t.frame,this.getAttrs=t.getAttrs,this.config=t.config,this.locale=t.locale,this.announce=t.announce,this.renderFacade()}get isActive(){return null!==this.player}facadeKey(t){return[t.provider,t.videoId,t.hash??"",t.privacy,t.title,this.config.useProviderThumbnail].join("|")}renderFacade(){this.facadeButton?.remove();const t=this.getAttrs();this.renderedKey=this.facadeKey(t);const e=document.createElement("button");e.type="button",e.className="notectl-video__facade",e.setAttribute("aria-label",this.locale.play(t.title));const n=document.createElement("span");if(n.className="notectl-video__poster",n.setAttribute("aria-hidden","true"),this.config.useProviderThumbnail){const e=N({provider:t.provider,videoId:t.videoId},this.config.providers);e&&b(n,"background-image",`url("${e}")`)}const o=document.createElement("span");o.className="notectl-video__play-icon",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 68 48" width="48" height="34" aria-hidden="true" focusable="false"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.5C4 2.3 2.3 4.8 1.5 7.7.1 13 0 24 0 24s.1 11 1.5 16.3c.8 2.9 2.5 5.4 5.4 6.2C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.5c2.9-.8 4.6-3.3 5.4-6.2C67.9 35 68 24 68 24s-.1-11-1.5-16.3z" fill="currentColor"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>';const i=document.createElement("span");i.className="notectl-video__badge",i.setAttribute("aria-hidden","true"),i.textContent=this.locale.providerBadge(H(t.provider,this.config.providers)),e.append(n,o,i),e.addEventListener("mousedown",t=>t.stopPropagation()),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.activate()}),this.facadeButton=e,this.frame.insertBefore(e,this.frame.firstChild)}update(){const t=this.getAttrs(),e=this.facadeKey(t);if(e!==this.renderedKey){if(this.renderedKey=e,this.isActive&&this.iframe){const e=pt(t,this.config,this.locale);return this.iframe.replaceWith(e),void(this.iframe=e)}this.renderFacade()}}activate(){if(this.isActive||!this.facadeButton)return;const t=this.getAttrs(),e=document.createElement("div");e.className="notectl-video__player";const n=document.createElement("button");n.type="button",n.className="notectl-video__exit",n.setAttribute("aria-label",this.locale.closePlayer),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z" fill="currentColor"/></svg>',n.addEventListener("mousedown",t=>t.stopPropagation()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deactivate(!0)});const o=pt(t,this.config,this.locale);e.append(n,o),this.facadeButton.remove(),this.facadeButton=null,this.frame.insertBefore(e,this.frame.firstChild),this.player=e,this.iframe=o,this.escapeHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.deactivate(!0))},this.frame.addEventListener("keydown",this.escapeHandler),o.focus(),this.announce(this.locale.enteredPlayer(t.title))}deactivate(t){this.player&&(this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player.remove(),this.player=null,this.iframe=null,this.renderFacade(),t&&this.facadeButton?.focus(),this.announce(this.locale.exitedPlayer))}destroy(){this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player?.remove(),this.player=null,this.iframe=null,this.facadeButton?.remove(),this.facadeButton=null}},mt=["w","e"],vt={w:-1,e:1},ft=null;function bt(){ft?.remove(),ft=null}function gt(t,e,n,o,i,r){let a=0,l=0,s=0,d=0,c=vt[e];const u=t=>{const e=(t.clientX-a)*c;var n,r;n=l+(s>0?e/s*100:0),r=i.minPercent,d=Math.max(r,Math.min(100,n)),i.applyLiveWidth(d),o.textContent=i.formatPercent(Math.round(d))},p=t=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p),n.classList.remove("notectl-video__resize-overlay--active"),o.classList.remove("notectl-video__size-indicator--visible"),bt(),i.commit(Math.round(d)),t.target?.releasePointerCapture?.(t.pointerId)};r(()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p)}),t.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation(),a=t.clientX,l=i.getWidthPercent(),d=l,s=i.getReferenceWidth(),c=i.isRtl()?-vt[e]:vt[e],n.classList.add("notectl-video__resize-overlay--active"),o.textContent=i.formatPercent(Math.round(l)),o.classList.add("notectl-video__size-indicator--visible"),function(t){bt(),ft=document.createElement("style");const e=g(t);e&&ft.setAttribute("nonce",e),ft.textContent="*{cursor:ew-resize!important;user-select:none!important}",document.head.appendChild(ft)}(n),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",u),document.addEventListener("pointerup",p)})}function yt(t,e,n){const o=document.createElement("button");return o.type="button",o.className="notectl-video__tool",o.setAttribute("aria-label",t),o.title=t,o.innerHTML=e,o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),n()}),o}function xt(t){const{config:e,locale:n,resolvedKeymap:o,announce:i,actions:r}=t;return(t,a,l)=>{const s=document.createElement("figure");s.className="notectl-video",s.setAttribute("data-block-id",t.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const d=document.createElement("div");d.className="notectl-video__frame",s.appendChild(d);let c=t.id,u=K(t.attrs,e),p=null,h=null,m=null;const v=new ht({frame:d,getAttrs:()=>u,config:e,locale:n,announce:i});function g(t){var o;u=K(t.attrs,e),st(d,u.aspectRatio,u.widthPercent),lt(s,u.align),s.setAttribute("aria-label",n.videoAria(H(u.provider,e.providers),u.title)),(o=u.caption)?(p||(p=document.createElement("figcaption"),p.className="notectl-video__caption",s.appendChild(p)),p.textContent!==o&&(p.textContent=o)):p&&(p.remove(),p=null),v.update(),m?.update(u.align)}function y(){h&&(h.destroy(),h.element.remove(),h=null)}return g(t),{dom:s,contentDOM:null,update:t=>"video"===t.type&&(c=t.id,s.setAttribute("data-block-id",t.id),g(t),!0),selectNode(){s.classList.add("notectl-video--selected"),e.resizable&&!h&&(h=function(t,e){const n=document.createElement("div");n.className="notectl-video__resize-overlay",n.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-video__size-indicator",n.appendChild(o);let i=null;for(const r of mt){const e=document.createElement("div");e.className=`notectl-video__resize-handle notectl-video__resize-handle--${r}`,e.setAttribute("aria-hidden","true"),gt(e,r,n,o,t,t=>{i=t}),n.appendChild(e)}if(e){const t=document.createElement("div");t.className="notectl-video__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,n.appendChild(t)}return{element:n,destroy(){i?.(),bt()}}}({minPercent:e.minWidthPercent,getWidthPercent:()=>u.widthPercent,getReferenceWidth:()=>s.clientWidth||d.clientWidth,isRtl:()=>"rtl"===f(s),applyLiveWidth:t=>b(d,"width",`${t}%`),commit:t=>function(t){const e=a(),n=e.getBlock(c);if(!n)return;const o=e.getNodePath(c);if(!o)return;const i={...n.attrs??{},widthPercent:t};l(e.transaction("command").setNodeAttr(o,i).build())}(t),formatPercent:t=>`${t}%`},function(t,e){const n=t.shrinkWidth??null,o=t.growWidth??null;return n&&o?e.keyboardResizeHint(_(n),_(o)):""}(o,n)),d.appendChild(h.element)),m||(m=function(t){const{locale:e,actions:n}=t,o=document.createElement("div");o.className="notectl-video__toolbar",o.setAttribute("role","toolbar"),o.setAttribute("aria-label",e.videoOptions),o.setAttribute("data-notectl-no-print",""),o.addEventListener("mousedown",t=>t.stopPropagation());const i=yt(e.editVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="currentColor"/></svg>',()=>n.edit()),r={start:yt(e.alignStart,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2zm0-3.5h12v-2H3v2z" fill="currentColor"/></svg>',()=>n.align("start")),center:yt(e.alignCenter,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm3 7h12v2H6v-2zm-3 7h18v2H3v-2zm3-3.5h12v-2H6v2z" fill="currentColor"/></svg>',()=>n.align("center")),end:yt(e.alignEnd,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2zm6-3.5h12v-2H9v2z" fill="currentColor"/></svg>',()=>n.align("end"))},a=yt(e.deleteVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="currentColor"/></svg>',()=>n.remove()),l=()=>{const t=document.createElement("span");return t.className="notectl-video__tool-separator",t.setAttribute("aria-hidden","true"),t};o.append(i,l(),r.start,r.center,r.end,l(),a);const s=t=>{for(const e of["start","center","end"]){const n=e===t;r[e].classList.toggle("notectl-video__tool--active",n),r[e].setAttribute("aria-pressed",n?"true":"false")}};return s(t.initialAlign),{element:o,update:s,destroy(){o.remove()}}}({locale:n,actions:r,initialAlign:u.align}),s.appendChild(m.element))},deselectNode(){s.classList.remove("notectl-video--selected"),y(),m?.destroy(),m=null},destroy(){y(),m?.destroy(),m=null,v.destroy()}}}}function _t(t){return(e,n,o)=>{const i=function(t,e,n){const o=t.trim();if(o&&!/\s/.test(o)){const t=I(o,n);if(t)return{url:o,match:t}}const i=function(t){if(!t)return null;const e=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t),n=e.querySelector("iframe");if(!n)return null;const o=e.cloneNode(!0);for(const i of Array.from(o.querySelectorAll("iframe")))i.remove();return""!==(o.textContent??"").trim()?null:n.getAttribute("src")}(e);if(i){const t=I(i,n);if(t)return{url:$(t,n)??i,match:t}}return null}(e,n,t.providers);if(!i)return null;const r=o.selection;if(!u(r)||!s(r))return null;const a=r.anchor.blockId,l=r.anchor.offset,d=l+i.url.length,p=o.transaction("paste").insertText(a,l,i.url,[]).setSelection(c(a,d)).build();return t.onOffer({blockId:a,start:l,end:d},i.match),p}}var wt=0,At=/* @__PURE__ */new Set,kt=null;var Ct=class{id="video";name="Video";priority=47;config;resolvedKeymap;context=null;locale=ot;overlay=null;embedPrompt=null;constructor(t){this.config={...W,...t},this.resolvedKeymap={...M,...t?.keymap}}async init(n){this.context=n,this.locale=await x(n,this.config.locale,ot,rt),n.registerStyleSheet('\n.notectl-video {\n\tmargin: 12px 0;\n\tposition: relative;\n\tuser-select: none;\n}\n\n.notectl-video--center { text-align: center; }\n.notectl-video--start { text-align: start; }\n.notectl-video--end { text-align: end; }\n\n.notectl-video__frame {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\tmax-width: 100%;\n\tvertical-align: top;\n\toverflow: hidden;\n\tborder-radius: 8px;\n\tbackground: #000;\n\ttext-align: start;\n}\n\n/* Facade (click-to-load) */\n.notectl-video__facade {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\tborder: 0;\n\tcursor: pointer;\n\tbackground: #14181c;\n\tcolor: #fff;\n}\n\n.notectl-video__facade:focus-visible {\n\toutline: 3px solid var(--notectl-primary);\n\toutline-offset: -3px;\n}\n\n.notectl-video__poster {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-size: cover;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n}\n\n.notectl-video__poster::after {\n\tcontent: "";\n\tposition: absolute;\n\tinset: 0;\n\tbackground: rgba(0, 0, 0, 0.25);\n}\n\n.notectl-video__play-icon {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: inline-flex;\n\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));\n\ttransition: transform 0.12s ease;\n}\n\n.notectl-video__facade:hover .notectl-video__play-icon {\n\ttransform: scale(1.08);\n}\n\n.notectl-video__badge {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 8px;\n\tinset-inline-start: 8px;\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tfont-weight: 600;\n}\n\n/* Player (activated iframe + exit control) */\n.notectl-video__player {\n\tposition: absolute;\n\tinset: 0;\n}\n\n.notectl-video__iframe {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n}\n\n.notectl-video__exit {\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 6px;\n\tinset-inline-end: 6px;\n\twidth: 28px;\n\theight: 28px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 0;\n\tborder-radius: 50%;\n\tcursor: pointer;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n}\n\n.notectl-video__exit:focus-visible {\n\toutline: 2px solid #fff;\n\toutline-offset: 2px;\n}\n\n/* Static fallback link (no-JS / export rehydration) */\n.notectl-video__fallback-link {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 8px;\n\tcolor: #fff;\n\ttext-decoration: underline;\n\ttext-align: center;\n}\n\n/* Caption */\n.notectl-video__caption {\n\tmargin-top: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n\ttext-align: center;\n}\n\n/* Selection */\n.notectl-video--selected .notectl-video__frame {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Resize overlay + side handles */\n.notectl-video__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-video__resize-handle {\n\tposition: absolute;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\twidth: 8px;\n\theight: 44px;\n\tmax-height: 60%;\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-raised);\n\tpointer-events: all;\n\tcursor: ew-resize;\n\tz-index: 2;\n}\n\n.notectl-video__resize-handle--w { inset-inline-start: -5px; }\n.notectl-video__resize-handle--e { inset-inline-end: -5px; }\n\n.notectl-video__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-video__size-indicator--visible { opacity: 1; }\n\n.notectl-video__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-video--selected .notectl-video__keyboard-hint { display: block; }\n.notectl-video__resize-overlay--active ~ .notectl-video__keyboard-hint,\n.notectl-video__resize-overlay--active .notectl-video__keyboard-hint { display: none; }\n\n/* On-selection toolbar */\n.notectl-video__toolbar {\n\tposition: absolute;\n\ttop: -44px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n\tpadding: 2px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-overlay);\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-video__tool {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-video__tool:hover { background: var(--notectl-hover-bg); }\n\n.notectl-video__tool--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary);\n}\n\n.notectl-video__tool:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video__tool svg { width: 16px; height: 16px; }\n\n.notectl-video__tool-separator {\n\twidth: 1px;\n\theight: 18px;\n\tmargin: 0 2px;\n\tbackground: var(--notectl-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-video__play-icon,\n\t.notectl-video__size-indicator {\n\t\ttransition: none;\n\t}\n}\n\n@media (forced-colors: active) {\n\t.notectl-video__frame { outline: 1px solid CanvasText; }\n\t.notectl-video__facade { border: 1px solid ButtonText; }\n\t.notectl-video__play-icon { forced-color-adjust: none; }\n\t.notectl-video__resize-handle { background: ButtonFace; border-color: ButtonText; }\n\t.notectl-video--selected .notectl-video__frame { outline: 2px solid Highlight; }\n}\n'),n.registerStyleSheet("\n.notectl-video-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tbox-sizing: border-box;\n\tmin-width: 300px;\n\tmax-width: 92vw;\n\tpadding: 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 6px 24px var(--notectl-shadow);\n}\n\n.notectl-video-popup {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.notectl-video-popup__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-video-popup__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__input,\n.notectl-video-popup__select {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__input:focus-visible,\n.notectl-video-popup__select:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video-popup__hint {\n\tmargin: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__error:not(:empty) {\n\tmargin: 0;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n\tfont-size: 12px;\n}\n\n.notectl-video-popup__actions {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tmargin-top: 2px;\n}\n\n.notectl-video-popup__cancel,\n.notectl-video-popup__submit {\n\tpadding: 7px 14px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__submit {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-popup__cancel:focus-visible,\n.notectl-video-popup__submit:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Ask-first paste affordance */\n.notectl-video-embed-prompt {\n\tposition: fixed;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 6px 8px 6px 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px var(--notectl-shadow);\n\tfont-size: 13px;\n}\n\n.notectl-video-embed-prompt__text {\n\tmargin-inline-end: 4px;\n}\n\n.notectl-video-embed-prompt__embed,\n.notectl-video-embed-prompt__dismiss {\n\tpadding: 4px 10px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-embed-prompt__embed {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-embed-prompt__embed:focus-visible,\n.notectl-video-embed-prompt__dismiss:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n@media (forced-colors: active) {\n\t.notectl-video-overlay,\n\t.notectl-video-embed-prompt {\n\t\tborder: 1px solid CanvasText;\n\t}\n\t.notectl-video-popup__submit,\n\t.notectl-video-embed-prompt__embed {\n\t\tborder: 1px solid ButtonText;\n\t}\n}\n"),function(t){for(const e of t)At.add(e);wt+=1,kt||(kt=t=>{if("iframe"!==t.nodeName.toLowerCase())return;const e=t;e.hasAttribute("srcdoc")?e.parentNode?.removeChild(e):function(t,e){const n=B(t);return!!n&&"https:"===n.protocol&&e.has(n.hostname.toLowerCase())}(e.getAttribute("src")??"",At)||e.parentNode?.removeChild(e)},A.addHook("uponSanitizeElement",kt))}(function(t=S){const e=/* @__PURE__ */new Set;for(const n of t)for(const t of n.embedHostnames)e.add(t.toLowerCase());return e}(this.config.providers)),n.registerNodeSpec(function(n,o){const i=n.providers;return{type:"video",group:"block",isVoid:!0,selectable:!0,attrs:{provider:{default:""},videoId:{default:""},hash:{default:""},aspectRatio:{default:n.defaultAspectRatio},widthPercent:{default:n.defaultWidthPercent},align:{default:"center"},title:{default:""},caption:{default:""},privacy:{default:n.privacy}},toDOM(t){const e=K(t.attrs,n),r=h("figure",t.id);r.className="notectl-video",r.setAttribute("data-void","true"),r.setAttribute("data-selectable","true"),r.setAttribute("data-video-provider",e.provider),r.setAttribute("data-video-id",e.videoId),e.hash&&r.setAttribute("data-video-hash",e.hash),lt(r,e.align),r.setAttribute("aria-label",o.videoAria(H(e.provider,i),e.title));const a=document.createElement("div");a.className="notectl-video__frame",st(a,e.aspectRatio,e.widthPercent);const l=$(ct(e),i);if(l){const t=document.createElement("a");t.className="notectl-video__fallback-link",t.href=l,t.rel="noopener noreferrer",t.textContent=e.title||l,a.appendChild(t)}if(r.appendChild(a),e.caption){const t=document.createElement("figcaption");t.className="notectl-video__caption",t.textContent=e.caption,r.appendChild(t)}return r},toHTML(o){const r=K(o.attrs,n),a=ct(r),l=$(a,i),s=[`data-video-provider="${t(r.provider)}"`,`data-video-id="${t(r.videoId)}"`,`data-video-ratio="${t(r.aspectRatio)}"`,`data-video-width="${r.widthPercent}"`,`data-video-privacy="${r.privacy?"true":"false"}"`];r.hash&&s.push(`data-video-hash="${t(r.hash)}"`),r.title&&s.push(`data-video-title="${t(r.title)}"`);const d=n.useProviderThumbnail?N(a,i):void 0,c=d?`<img src="${t(d)}" alt="">`:e(r.title||l||""),u=l?`<a href="${t(l)}" rel="noopener noreferrer">${c}</a>`:c,p=r.caption?`<figcaption>${e(r.caption)}</figcaption>`:"";return`<figure ${s.join(" ")}>${u}${p}</figure>`},parseHTML:[{tag:"figure",priority:60,getAttrs:t=>function(t,e){const n=t.getAttribute("data-video-provider"),o=t.getAttribute("data-video-id");if(!n||!o)return!1;if(!F(o))return!1;if(!R(n,e.providers))return!1;const i=t.getAttribute("data-video-title")??t.querySelector("a")?.textContent?.trim()??t.getAttribute("aria-label")??"",r=t.querySelector("figcaption")?.textContent?.trim()??"",a=t.getAttribute("data-video-width"),l={provider:n,videoId:o,aspectRatio:T(t.getAttribute("data-video-ratio")??void 0,e),widthPercent:O(a?Number.parseFloat(a):e.defaultWidthPercent,e),align:"center",title:i,privacy:"false"!==t.getAttribute("data-video-privacy")},s=t.getAttribute("data-video-hash");return s&&dt.test(s)&&(l.hash=s),r&&(l.caption=r),l}(t,n)},{tag:"iframe",priority:60,getAttrs:t=>function(t,e){const n=I(t.getAttribute("src")??"",e.providers);if(!n||!F(n.videoId))return!1;const o={provider:n.provider,videoId:n.videoId,aspectRatio:ut(t,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.getAttribute("title")??"",privacy:e.privacy};return n.hash&&(o.hash=n.hash),o}(t,n)}],sanitize:{tags:["figure","figcaption","a","img","iframe"],attrs:["href","rel","src","alt","title","allow","allowfullscreen","referrerpolicy","loading","width","height","frameborder","class","style"]}}}(this.config,this.locale)),this.overlay=new et(n,this.config,this.locale),this.registerNodeView(n),function(t){t.registerCommand("removeVideo",()=>Y(t))}(n),this.registerInsertCommand(n),this.registerResizeCommands(n),this.registerResizeKeymaps(n),this.registerPasteInterceptor(n),this.registerToolbarItem(n)}destroy(){(wt=Math.max(0,wt-1))>0||!kt||(A.removeHook("uponSanitizeElement"),kt=null,At.clear()),this.embedPrompt?.close(),this.embedPrompt=null,this.overlay?.close(!1),this.overlay=null,this.context=null}onStateChange(t,e,n){this.context&&!this.isVideoSelected(t)&&this.isVideoSelected(e)&&this.announceVideoSelection(e)}registerNodeView(t){t.registerNodeView(j,xt({config:this.config,locale:this.locale,resolvedKeymap:this.resolvedKeymap,announce:e=>t.announce(e),actions:{edit:()=>this.overlay?.openEditForSelected(),align:e=>function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},align:e})}(t,e),remove:()=>Y(t)}}))}registerInsertCommand(t){t.registerCommand("insertVideo",()=>(this.isVideoSelected(t.getState())?this.overlay?.openEditForSelected():this.overlay?.openInsert(),!0))}registerResizeCommands(t){const e=this.config.widthStep,n=this.config.widthStepLarge,o=e=>{const n=function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=o.block.attrs?.widthPercent??n.defaultWidthPercent,r=O(i+e,n);return r!==i&&Z(t,{...o.block.attrs??{},widthPercent:r})}(t,e,this.config);return n&&this.announceCurrentSize(t),n};t.registerCommand("resizeVideoGrow",()=>o(e)),t.registerCommand("resizeVideoShrink",()=>o(-e)),t.registerCommand("resizeVideoGrowLarge",()=>o(n)),t.registerCommand("resizeVideoShrinkLarge",()=>o(-n)),t.registerCommand("resetVideoSize",()=>{const e=function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},widthPercent:e.defaultWidthPercent})}(t,this.config);return e&&t.announce(this.locale.resetToDefaultSize),e})}registerResizeKeymaps(t){const e={growWidth:"resizeVideoGrow",shrinkWidth:"resizeVideoShrink",growWidthLarge:"resizeVideoGrowLarge",shrinkWidthLarge:"resizeVideoShrinkLarge",resetSize:"resetVideoSize"},n={};for(const[o,i]of Object.entries(e)){const e=this.resolvedKeymap[o]??null;e&&(n[e]=()=>t.executeCommand(i))}Object.keys(n).length>0&&t.registerKeymap(n)}registerPasteInterceptor(t){t.registerPasteInterceptor(_t({providers:this.config.providers,onOffer:(t,e)=>this.offerEmbed(t,e)}),{name:"video",priority:40})}offerEmbed(t,e){if(!this.context)return;const o=this.context,i=H(e.provider,this.config.providers);this.embedPrompt?.close(),requestAnimationFrame(()=>{o.announce(this.locale.embedOfferAnnounce(i));const e=function(t,e){const o=t.getBlock(e.blockId);if(!o)return"";const i=n(o);return i.slice(e.start,Math.min(e.end,i.length))}(o.getState(),t);this.embedPrompt=function(t){const{locale:e}=t,n=document.createElement("div");n.className="notectl-video-embed-prompt",n.setAttribute("role","dialog"),n.setAttribute("aria-label",e.embedPrompt);const o=document.createElement("span");o.className="notectl-video-embed-prompt__text",o.textContent=e.embedPrompt;const i=document.createElement("button");i.type="button",i.className="notectl-video-embed-prompt__embed",i.textContent=e.embedConfirm;const r=document.createElement("button");r.type="button",r.className="notectl-video-embed-prompt__dismiss",r.textContent=e.embedDismiss,n.append(o,i,r);let a=null,l=!1;const s=()=>{l||(l=!0,a&&(document.removeEventListener("mousedown",a,!0),a=null),n.remove())},d=t=>{s(),t()};return i.addEventListener("mousedown",t=>t.preventDefault()),i.addEventListener("click",e=>{e.preventDefault(),d(t.onEmbed)}),r.addEventListener("mousedown",t=>t.preventDefault()),r.addEventListener("click",e=>{e.preventDefault(),d(t.onDismiss)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),d(t.onDismiss))}),t.container.appendChild(n),w(n),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||240,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(n,t.rect),a=e=>{e.composedPath().includes(n)||d(t.onDismiss)},requestAnimationFrame(()=>{a&&document.addEventListener("mousedown",a,!0),i.focus()}),{close:s}}({container:o.getPluginContainer("top"),rect:Pt(),locale:this.locale,onEmbed:()=>{this.embedPrompt=null,this.overlay?.openInsertReplacingRange(t,e)},onDismiss:()=>{this.embedPrompt=null,o.getContainer().focus()}})})}registerToolbarItem(t){t.registerToolbarItem({id:"video",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm6 4.5v7l6-3.5-6-3.5z" fill="currentColor"/></svg>',label:this.locale.insertVideo,tooltip:this.locale.insertVideoTooltip,command:"insertVideo"})}isVideoSelected(t){const e=t.selection;return!!l(e)&&t.getBlock(e.nodeId)?.type===j}announceVideoSelection(t){if(!this.context)return;const e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=n.attrs?.title??"",i=[o?this.locale.videoSelectedWithTitle(o):this.locale.videoSelected],r=this.resolvedKeymap.shrinkWidth??null,a=this.resolvedKeymap.growWidth??null;r&&a&&i.push(this.locale.resizeHint(_(r),_(a))),this.context.announce(i.join(" "))}announceCurrentSize(t){const e=function(t,e){const n=X(t);return n?n.block.attrs?.widthPercent??e.defaultWidthPercent:null}(t.getState(),this.config);null!==e&&t.announce(this.locale.videoResized(e))}};function Pt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}export{M as a,W as i,ot as n,S as o,rt as r,I as s,Ct as t};
2
- //# sourceMappingURL=VideoPlugin-BrR8g6Rz.mjs.map
1
+ import{n as t,r as e}from"./HTMLUtils-Bhg3_P8B.mjs";import{_ as n,o,p as i,w as r}from"./Document-827l3P80.mjs";import{c as a,l,o as s,r as d,t as c,u}from"./Selection-HYoVFpAx.mjs";import{a as p}from"./TypeBrands-Ch9856Gb.mjs";import{s as h}from"./BlockInsertion-CYH2gRkY.mjs";import{t as m}from"./NodeSelectionCommands-WH5snxr_.mjs";import{c as v,o as f}from"./PluginHelpers-KDuTlmXm.mjs";import{c as b,r as g}from"./StyleRuntime-DW6omotc.mjs";import{t as y}from"./Platform-ByobkiCc.mjs";import{n as x}from"./DomUtils-Bf7JLFlx.mjs";import{t as _}from"./ShortcutFormatting-TwiufqeV.mjs";import{a as w}from"./PopupPositioning-BFh6Ed1D.mjs";import A from"dompurify";var k=/^[A-Za-z0-9_-]{11}$/,C=/^\d+$/,P=/^[A-Za-z0-9]+$/,z=/^[A-Za-z0-9]+$/;function E(t,e){const n=t.indexOf(e);if(-1!==n)return t[n+1]}function L(t,e,n){const o=e.searchParams.get("h")??n;return o&&P.test(o)?{videoId:t,hash:o}:{videoId:t}}var S=[{id:"youtube",label:"YouTube",hostnames:["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtu.be","youtube-nocookie.com","www.youtube-nocookie.com"],embedHostnames:["www.youtube-nocookie.com","youtube-nocookie.com","www.youtube.com","youtube.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("youtu.be"===e){const t=n[0];return t&&k.test(t)?{videoId:t}:null}const o=t.searchParams.get("v");if(o&&k.test(o))return{videoId:o};for(const i of["embed","shorts","live","v"]){const t=E(n,i);if(t&&k.test(t))return{videoId:t}}return null},buildEmbedUrl(t,e){const n=e.privacy?"www.youtube-nocookie.com":"www.youtube.com",o=V({rel:"0",...e.autoplay?{autoplay:"1"}:{}});return`https://${n}/embed/${t.videoId}${o}`},buildWatchUrl:t=>`https://www.youtube.com/watch?v=${t.videoId}`,thumbnailUrl:t=>`https://i.ytimg.com/vi/${t.videoId}/hqdefault.jpg`},{id:"vimeo",label:"Vimeo",hostnames:["vimeo.com","www.vimeo.com","player.vimeo.com"],embedHostnames:["player.vimeo.com"],parse(t){const e=t.pathname.split("/").filter(Boolean),n=E(e,"video");if(n&&C.test(n))return L(n,t,void 0);const o=e.find(t=>C.test(t));return o?L(o,t,e[e.indexOf(o)+1]):null},buildEmbedUrl(t,e){const n=V({...t.hash?{h:t.hash}:{},...e.privacy?{dnt:"1"}:{},...e.autoplay?{autoplay:"1"}:{}});return`https://player.vimeo.com/video/${t.videoId}${n}`},buildWatchUrl(t){const e=`https://vimeo.com/${t.videoId}`;return t.hash?`${e}/${t.hash}`:e}},{id:"dailymotion",label:"Dailymotion",hostnames:["dailymotion.com","www.dailymotion.com","geo.dailymotion.com","dai.ly"],embedHostnames:["www.dailymotion.com","geo.dailymotion.com"],parse(t){const e=t.hostname.toLowerCase(),n=t.pathname.split("/").filter(Boolean);if("dai.ly"===e){const t=n[0];return t&&z.test(t)?{videoId:t}:null}const o=E(n,"video");return o&&z.test(o)?{videoId:o}:null},buildEmbedUrl(t,e){const n=V(e.autoplay?{autoplay:"1"}:{});return`https://www.dailymotion.com/embed/video/${t.videoId}${n}`},buildWatchUrl:t=>`https://www.dailymotion.com/video/${t.videoId}`,thumbnailUrl:t=>`https://www.dailymotion.com/thumbnail/video/${t.videoId}`}];function I(t,e=S){const n=B(t);if(!n)return null;if("https:"!==n.protocol&&"http:"!==n.protocol)return null;const o=n.hostname.toLowerCase();for(const i of e){if(!i.hostnames.includes(o))continue;const t=i.parse(n);if(t)return{provider:i.id,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}return null}function R(t,e=S){return e.find(e=>e.id===t)}function $(t,e){const n=R(t.provider,e);return n?n.buildWatchUrl(t):null}function N(t,e){return R(t.provider,e)?.thumbnailUrl?.(t)}function H(t,e=S){return R(t,e)?.label??t}function B(t){try{return new URL(t.trim())}catch{return null}}function V(t){const e=Object.entries(t);return 0===e.length?"":`?${e.map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&")}`}var M={growWidth:"Mod-Shift-ArrowRight",shrinkWidth:"Mod-Shift-ArrowLeft",growWidthLarge:"Mod-Shift-Alt-ArrowRight",shrinkWidthLarge:"Mod-Shift-Alt-ArrowLeft",resetSize:"Mod-Shift-0"},W={providers:S,facade:!0,useProviderThumbnail:!1,privacy:!0,allowedAspectRatios:["16/9","4/3","1/1","9/16"],defaultAspectRatio:"16/9",defaultWidthPercent:100,minWidthPercent:25,widthStep:10,widthStepLarge:25,resizable:!0},D="video",j=/^\d+(?:\.\d+)?\s*\/\s*\d+(?:\.\d+)?$/;function T(t,e){if(!t||!j.test(t.trim()))return e.defaultAspectRatio;const[n,o]=t.split("/");return`${n?.trim()} / ${o?.trim()}`}function O(t,e){return Number.isFinite(t)?Math.max(e.minWidthPercent,Math.min(100,Math.round(t))):e.defaultWidthPercent}var U=/^[A-Za-z0-9_-]+$/;function F(t){return t.length>0&&t.length<=64&&U.test(t)}function K(t,e){return{provider:t?.provider??"",videoId:t?.videoId??"",...t?.hash?{hash:t.hash}:{},aspectRatio:T(t?.aspectRatio,e),widthPercent:O(t?.widthPercent??e.defaultWidthPercent,e),align:t?.align??"center",title:t?.title??"",...t?.caption?{caption:t.caption}:{},privacy:t?.privacy??e.privacy}}function q(t,e){const n=I(t.url,e.providers);return n?{provider:n.provider,videoId:n.videoId,...n.hash?{hash:n.hash}:{},aspectRatio:T(t.aspectRatio,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.title,...t.caption?{caption:t.caption}:{},privacy:e.privacy}:null}function G(t){return{provider:t.provider,videoId:t.videoId,aspectRatio:t.aspectRatio,widthPercent:t.widthPercent,align:t.align,title:t.title,privacy:t.privacy,...t.hash?{hash:t.hash}:{},...t.caption?{caption:t.caption}:{}}}function X(t){const e=t.selection;if(!l(e))return null;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return null;const o=t.getNodePath(e.nodeId);return o?{block:n,path:o}:null}function Z(t,e){const n=t.getState(),o=X(n);return!!o&&(t.dispatch(n.transaction("command").setNodeAttr(o.path,e).build()),!0)}function Y(t){const e=t.getState(),n=X(e);if(!n)return!1;const o=m(e,d(n.block.id,n.path));return!!o&&(t.dispatch(o),!0)}var J=0;function Q(t){return`${t}-${J+=1}`}function tt(t,e){const n=Q("notectl-video-field"),o=document.createElement("div");o.className="notectl-video-popup__field";const i=document.createElement("label");i.className="notectl-video-popup__label",i.setAttribute("for",n),i.textContent=e.label,o.appendChild(i);const r=document.createElement("input");r.id=n,r.type=e.type,r.value=e.value,r.placeholder=e.placeholder,r.className="notectl-video-popup__input",r.setAttribute("aria-label",e.ariaLabel),e.required&&r.setAttribute("aria-required","true");const a=[];if(e.hint){const t=`${n}-hint`,i=document.createElement("p");i.id=t,i.className="notectl-video-popup__hint",i.textContent=e.hint,o.appendChild(i),a.push(t)}return e.describedBy&&a.push(e.describedBy),a.length>0&&r.setAttribute("aria-describedby",a.join(" ")),o.insertBefore(r,o.children[1]??null),t.appendChild(o),r}var et=class{context;config;locale;panel=null;outsideHandler=null;constructor(t,e,n){this.context=t,this.config=e,this.locale=n}get isOpen(){return null!==this.panel}openInsert(){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,onSubmit:t=>{const e=q(t,this.config);e&&function(t,e){const n=t.getState(),s=n.selection;if(a(s))return!1;const c=G(e),u=l(s)?s.nodeId:s.anchor.blockId,m=function(t,e){if("table_cell"===t.getBlock(e)?.type)return e;const n=t.getNodePath(e);if(n)for(const o of n)if("table_cell"===t.getBlock(o)?.type)return o}(n,u);m?function(t,e,n,a){const l=t.getNodePath(n),s=t.getBlock(n);if(!l||!s)return!1;const c=o(p(D),[],void 0,a),u=t.transaction("command"),h=i(s);for(let o=h.length-1;o>=0;o--){const t=s.children.findIndex(t=>r(t)&&t.id===h[o]?.id);-1!==t&&u.removeNode(l,t)}u.insertNode(l,0,c),u.setSelection(d(c.id,[...l,c.id])),e.dispatch(u.build())}(n,t,m,c):function(t,e,n,i){const r=o(p(D),[],void 0,i),a=t.transaction("command");!!h(t,a,n,r)&&(a.setSelection(d(r.id,[])),e.dispatch(a.build()))}(n,t,u,c)}(this.context,e)}})}openInsertReplacingRange(t,e){this.context.isReadOnly()||this.open({rect:nt(),mode:"insert",label:this.locale.insertDialogLabel,initial:{url:e},onSubmit:e=>{const i=q(e,this.config);i&&function(t,e,i){const a=t.getState(),l=a.getBlock(e.blockId);if(!l)return!1;const s=function(t,e){const n=t.getNodePath(e);if(!n||0===n.length)return null;if(1===n.length){const n=t.doc.children.findIndex(t=>t.id===e);return-1===n?null:{parentPath:[],index:n}}const o=n[n.length-2],i=o?t.getBlock(o):void 0;if(!i)return null;const a=i.children.findIndex(t=>r(t)&&t.id===e);return-1===a?null:{parentPath:n.slice(0,-1),index:a}}(a,e.blockId);if(!s)return!1;const c=0===Math.max(0,n(l).length-(e.end-e.start))&&"paragraph"===l.type,u=o(p(D),[],void 0,G(i)),h=0===s.parentPath.length?[]:[...s.parentPath,u.id],m=a.transaction("command");c?(m.removeNode(s.parentPath,s.index),m.insertNode(s.parentPath,s.index,u),0===s.parentPath.length&&s.index>=a.doc.children.length-1&&m.insertNode([],s.index+1,o(p("paragraph")))):(m.deleteTextAt(e.blockId,e.start,e.end),m.insertNode(s.parentPath,s.index+1,u)),m.setSelection(d(u.id,h)),t.dispatch(m.build())}(this.context,t,i)}})}openEditForSelected(){if(this.context.isReadOnly())return;const t=this.context.getState(),e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=K(n.attrs,this.config),i={url:$({provider:o.provider,videoId:o.videoId,...o.hash?{hash:o.hash}:{}},this.config.providers)??"",title:o.title,caption:o.caption??"",aspectRatio:o.aspectRatio};this.open({rect:this.videoRect(e.nodeId),mode:"edit",label:this.locale.editDialogLabel,initial:i,onSubmit:t=>{!function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=I(e.url,n.providers);if(!i)return!1;const r=function(t,e){const n={};for(const[o,i]of Object.entries(t??{}))e.includes(o)||"string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i||(n[o]=i);return n}(o.block.attrs,["hash","caption"]);r.provider=i.provider,r.videoId=i.videoId,r.title=e.title,r.aspectRatio=T(e.aspectRatio,n),i.hash&&(r.hash=i.hash),e.caption.trim()&&(r.caption=e.caption.trim()),Z(t,r)}(this.context,t,this.config)}})}close(t){this.panel&&(this.outsideHandler&&(document.removeEventListener("mousedown",this.outsideHandler,!0),this.outsideHandler=null),this.panel.remove(),this.panel=null,t&&this.context.getContainer().focus())}open(t){this.close(!1);const e=document.createElement("div");e.className="notectl-video-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","false"),e.setAttribute("aria-label",t.label),this.panel=e,function(t,e){const{config:n,locale:o,initial:i,mode:r}=e;t.classList.add("notectl-video-popup");const a=Q("notectl-video-error"),l=document.createElement("p");l.id=a,l.className="notectl-video-popup__error",l.setAttribute("role","alert");const s=tt(t,{label:o.urlLabel,ariaLabel:o.urlAria,placeholder:o.urlPlaceholder,value:i?.url??"",type:"url",required:!0,describedBy:a}),d=tt(t,{label:o.titleLabel,ariaLabel:o.titleAria,placeholder:o.titlePlaceholder,value:i?.title??"",type:"text",required:!0,hint:o.titleHint}),c=tt(t,{label:o.captionLabel,ariaLabel:o.captionAria,placeholder:o.captionPlaceholder,value:i?.caption??"",type:"text"}),u=function(t,e,n,o){const i=Q("notectl-video-field"),r=document.createElement("div");r.className="notectl-video-popup__field";const a=document.createElement("label");a.className="notectl-video-popup__label",a.setAttribute("for",i),a.textContent=n.aspectRatioLabel,r.appendChild(a);const l=document.createElement("select");l.id=i,l.className="notectl-video-popup__select",l.setAttribute("aria-label",n.aspectRatioAria);const s=e.allowedAspectRatios.includes(o)?e.allowedAspectRatios:[o,...e.allowedAspectRatios];for(const d of s){const t=document.createElement("option");t.value=d,t.textContent=d,d===o&&(t.selected=!0),l.appendChild(t)}return r.appendChild(l),t.appendChild(r),l}(t,n,o,i?.aspectRatio??n.defaultAspectRatio);t.appendChild(l);const p=document.createElement("div");p.className="notectl-video-popup__actions";const h=document.createElement("button");h.type="button",h.className="notectl-video-popup__cancel",h.textContent=o.cancelButton;const m=document.createElement("button");m.type="button",m.className="notectl-video-popup__submit",m.textContent="edit"===r?o.updateButton:o.insertButton,m.setAttribute("aria-label","edit"===r?o.updateAria:o.insertAria),p.append(h,m),t.appendChild(p);const v=(t,e)=>{l.textContent=t,e.focus()},f=()=>{const t=s.value.trim();if(!I(t,n.providers))return void v(o.invalidUrl,s);const i=d.value.trim();i?(l.textContent="",e.onSubmit({url:t,title:i,caption:c.value.trim(),aspectRatio:u.value}),e.onClose()):v(o.titleRequired,d)};h.addEventListener("mousedown",t=>t.preventDefault()),h.addEventListener("click",t=>{t.preventDefault(),e.onClose()}),m.addEventListener("mousedown",t=>t.preventDefault()),m.addEventListener("click",t=>{t.preventDefault(),f()});for(const b of[s,d,c])b.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),f())});requestAnimationFrame(()=>s.focus())}(e,{mode:t.mode,initial:t.initial,config:this.config,locale:this.locale,onSubmit:t.onSubmit,onClose:()=>this.close(!0)}),e.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),this.context.getPluginContainer("top").appendChild(e),w(e),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||320,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(e,t.rect),this.installOutsideHandler()}videoRect(t){const e=this.context.getContainer().querySelector(`[data-block-id="${t}"]`);return e?e.getBoundingClientRect():null}installOutsideHandler(){const t=t=>{this.panel&&!t.composedPath().includes(this.panel)&&this.close(!1)};this.outsideHandler=t,requestAnimationFrame(()=>{this.outsideHandler&&document.addEventListener("mousedown",t,!0)})}};function nt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}var ot={insertVideo:"Insert Video",insertVideoTooltip:"Insert Video",urlLabel:"Video URL",urlPlaceholder:"https://www.youtube.com/watch?v=...",urlAria:"Video URL",titleLabel:"Title",titlePlaceholder:"Describe the video",titleAria:"Video title",titleHint:"Describes the video for screen readers. Required.",captionLabel:"Caption",captionPlaceholder:"Optional visible caption",captionAria:"Video caption",aspectRatioLabel:"Aspect ratio",aspectRatioAria:"Video aspect ratio",insertButton:"Insert",insertAria:"Insert video",updateButton:"Update",updateAria:"Update video",cancelButton:"Cancel",insertDialogLabel:"Insert video",editDialogLabel:"Edit video",invalidUrl:"Enter a YouTube, Vimeo, or Dailymotion video URL.",titleRequired:"Enter a title so screen readers can describe the video.",play:t=>t?`Play video: ${t}`:"Play video",loading:"Loading video...",providerBadge:t=>`${t} video`,closePlayer:"Close video player",videoAria:(t,e)=>e?`${t} video: ${e}`:`${t} video`,videoSelected:"Video selected.",videoSelectedWithTitle:t=>`Video selected: ${t}.`,resizeHint:(t,e)=>`${t} / ${e} to resize.`,keyboardResizeHint:(t,e)=>`${t} / ${e} to resize`,videoResized:t=>`Video resized to ${t} percent width.`,resetToDefaultSize:"Video reset to full width.",enteredPlayer:t=>t?`Playing ${t}. Press Escape to return to the document.`:"Playing video. Press Escape to return to the document.",exitedPlayer:"Returned to the document.",videoOptions:"Video options",editVideo:"Edit video",alignStart:"Align left",alignCenter:"Align center",alignEnd:"Align right",deleteVideo:"Delete video",embedPrompt:"Embed this video?",embedConfirm:"Embed",embedDismiss:"Keep as link",embedOfferAnnounce:t=>`${t} link pasted. Press Embed to turn it into a video, or continue editing to keep it as a link.`,embeddedAnnounce:"Video embedded."},it=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar--O0A9OTR.mjs"),"./locales/de.ts":()=>import("./de-BxQIt_1Y.mjs"),"./locales/es.ts":()=>import("./es-BQweZX6P.mjs"),"./locales/fr.ts":()=>import("./fr-C3EKRThN.mjs"),"./locales/hi.ts":()=>import("./hi-L6pJxZam.mjs"),"./locales/pt.ts":()=>import("./pt-Bb908r0n.mjs"),"./locales/ru.ts":()=>import("./ru-DkW9XZFy.mjs"),"./locales/zh.ts":()=>import("./zh-ikm3rSTR.mjs")});async function rt(t){return v(it,t,ot)}var at={start:"notectl-video--start",center:"notectl-video--center",end:"notectl-video--end"};function lt(t,e){for(const o of Object.values(at))t.classList.remove(o);const n=at[e]??at.center;t.classList.add(n)}function st(t,e,n){b(t,"aspect-ratio",e),b(t,"width",`${n}%`)}var dt=/^[A-Za-z0-9]+$/;function ct(t){return{provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}}}function ut(t,e){const n=Number.parseFloat(t.getAttribute("width")??""),o=Number.parseFloat(t.getAttribute("height")??"");return Number.isFinite(n)&&Number.isFinite(o)&&n>0&&o>0?T(`${n}/${o}`,e):e.defaultAspectRatio}function pt(t,e,n){const o=function(t,e,n){const o=R(t.provider,e);return o?o.buildEmbedUrl(t,n):null}({provider:t.provider,videoId:t.videoId,...t.hash?{hash:t.hash}:{}},e.providers,{privacy:t.privacy,autoplay:!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches})??"",i=document.createElement("iframe");return i.className="notectl-video__iframe",i.setAttribute("src",o),i.setAttribute("title",t.title||n.providerBadge(H(t.provider,e.providers))),i.setAttribute("allow","autoplay; fullscreen; picture-in-picture; encrypted-media"),i.setAttribute("allowfullscreen","true"),i.setAttribute("referrerpolicy","no-referrer"),i.setAttribute("loading","lazy"),i.setAttribute("frameborder","0"),i}var ht=class{frame;getAttrs;config;locale;announce;facadeButton=null;player=null;iframe=null;escapeHandler=null;renderedKey="";constructor(t){this.frame=t.frame,this.getAttrs=t.getAttrs,this.config=t.config,this.locale=t.locale,this.announce=t.announce,this.renderFacade()}get isActive(){return null!==this.player}facadeKey(t){return[t.provider,t.videoId,t.hash??"",t.privacy,t.title,this.config.useProviderThumbnail].join("|")}renderFacade(){this.facadeButton?.remove();const t=this.getAttrs();this.renderedKey=this.facadeKey(t);const e=document.createElement("button");e.type="button",e.className="notectl-video__facade",e.setAttribute("aria-label",this.locale.play(t.title));const n=document.createElement("span");if(n.className="notectl-video__poster",n.setAttribute("aria-hidden","true"),this.config.useProviderThumbnail){const e=N({provider:t.provider,videoId:t.videoId},this.config.providers);e&&b(n,"background-image",`url("${e}")`)}const o=document.createElement("span");o.className="notectl-video__play-icon",o.setAttribute("aria-hidden","true"),o.innerHTML='<svg viewBox="0 0 68 48" width="48" height="34" aria-hidden="true" focusable="false"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.5C4 2.3 2.3 4.8 1.5 7.7.1 13 0 24 0 24s.1 11 1.5 16.3c.8 2.9 2.5 5.4 5.4 6.2C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.5c2.9-.8 4.6-3.3 5.4-6.2C67.9 35 68 24 68 24s-.1-11-1.5-16.3z" fill="currentColor"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>';const i=document.createElement("span");i.className="notectl-video__badge",i.setAttribute("aria-hidden","true"),i.textContent=this.locale.providerBadge(H(t.provider,this.config.providers)),e.append(n,o,i),e.addEventListener("mousedown",t=>t.stopPropagation()),e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.activate()}),this.facadeButton=e,this.frame.insertBefore(e,this.frame.firstChild)}update(){const t=this.getAttrs(),e=this.facadeKey(t);if(e!==this.renderedKey){if(this.renderedKey=e,this.isActive&&this.iframe){const e=pt(t,this.config,this.locale);return this.iframe.replaceWith(e),void(this.iframe=e)}this.renderFacade()}}activate(){if(this.isActive||!this.facadeButton)return;const t=this.getAttrs(),e=document.createElement("div");e.className="notectl-video__player";const n=document.createElement("button");n.type="button",n.className="notectl-video__exit",n.setAttribute("aria-label",this.locale.closePlayer),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="M19 6.4 17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z" fill="currentColor"/></svg>',n.addEventListener("mousedown",t=>t.stopPropagation()),n.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deactivate(!0)});const o=pt(t,this.config,this.locale);e.append(n,o),this.facadeButton.remove(),this.facadeButton=null,this.frame.insertBefore(e,this.frame.firstChild),this.player=e,this.iframe=o,this.escapeHandler=t=>{"Escape"===t.key&&(t.stopPropagation(),this.deactivate(!0))},this.frame.addEventListener("keydown",this.escapeHandler),o.focus(),this.announce(this.locale.enteredPlayer(t.title))}deactivate(t){this.player&&(this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player.remove(),this.player=null,this.iframe=null,this.renderFacade(),t&&this.facadeButton?.focus(),this.announce(this.locale.exitedPlayer))}destroy(){this.escapeHandler&&(this.frame.removeEventListener("keydown",this.escapeHandler),this.escapeHandler=null),this.player?.remove(),this.player=null,this.iframe=null,this.facadeButton?.remove(),this.facadeButton=null}},mt=["w","e"],vt={w:-1,e:1},ft=null;function bt(){ft?.remove(),ft=null}function gt(t,e,n,o,i,r){let a=0,l=0,s=0,d=0,c=vt[e];const u=t=>{const e=(t.clientX-a)*c;var n,r;n=l+(s>0?e/s*100:0),r=i.minPercent,d=Math.max(r,Math.min(100,n)),i.applyLiveWidth(d),o.textContent=i.formatPercent(Math.round(d))},p=t=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p),n.classList.remove("notectl-video__resize-overlay--active"),o.classList.remove("notectl-video__size-indicator--visible"),bt(),i.commit(Math.round(d)),t.target?.releasePointerCapture?.(t.pointerId)};r(()=>{document.removeEventListener("pointermove",u),document.removeEventListener("pointerup",p)}),t.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation(),a=t.clientX,l=i.getWidthPercent(),d=l,s=i.getReferenceWidth(),c=i.isRtl()?-vt[e]:vt[e],n.classList.add("notectl-video__resize-overlay--active"),o.textContent=i.formatPercent(Math.round(l)),o.classList.add("notectl-video__size-indicator--visible"),function(t){bt(),ft=document.createElement("style");const e=g(t);e&&ft.setAttribute("nonce",e),ft.textContent="*{cursor:ew-resize!important;user-select:none!important}",document.head.appendChild(ft)}(n),t.target.setPointerCapture(t.pointerId),document.addEventListener("pointermove",u),document.addEventListener("pointerup",p)})}function yt(t,e,n){const o=document.createElement("button");return o.type="button",o.className="notectl-video__tool",o.setAttribute("aria-label",t),o.title=t,o.innerHTML=e,o.addEventListener("mousedown",t=>t.preventDefault()),o.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),n()}),o}function xt(t){const{config:e,locale:n,resolvedKeymap:o,announce:i,actions:r}=t;return(t,a,l)=>{const s=document.createElement("figure");s.className="notectl-video",s.setAttribute("data-block-id",t.id),s.setAttribute("data-void","true"),s.setAttribute("data-selectable","true");const d=document.createElement("div");d.className="notectl-video__frame",s.appendChild(d);let c=t.id,u=K(t.attrs,e),p=null,h=null,m=null;const v=new ht({frame:d,getAttrs:()=>u,config:e,locale:n,announce:i});function f(t){var o;u=K(t.attrs,e),st(d,u.aspectRatio,u.widthPercent),lt(s,u.align),s.setAttribute("aria-label",n.videoAria(H(u.provider,e.providers),u.title)),(o=u.caption)?(p||(p=document.createElement("figcaption"),p.className="notectl-video__caption",s.appendChild(p)),p.textContent!==o&&(p.textContent=o)):p&&(p.remove(),p=null),v.update(),m?.update(u.align)}function g(){h&&(h.destroy(),h.element.remove(),h=null)}return f(t),{dom:s,contentDOM:null,update:t=>"video"===t.type&&(c=t.id,s.setAttribute("data-block-id",t.id),f(t),!0),selectNode(){s.classList.add("notectl-video--selected"),e.resizable&&!h&&(h=function(t,e){const n=document.createElement("div");n.className="notectl-video__resize-overlay",n.setAttribute("data-notectl-no-print","");const o=document.createElement("div");o.className="notectl-video__size-indicator",n.appendChild(o);let i=null;for(const r of mt){const e=document.createElement("div");e.className=`notectl-video__resize-handle notectl-video__resize-handle--${r}`,e.setAttribute("aria-hidden","true"),gt(e,r,n,o,t,t=>{i=t}),n.appendChild(e)}if(e){const t=document.createElement("div");t.className="notectl-video__keyboard-hint",t.setAttribute("aria-hidden","true"),t.textContent=e,n.appendChild(t)}return{element:n,destroy(){i?.(),bt()}}}({minPercent:e.minWidthPercent,getWidthPercent:()=>u.widthPercent,getReferenceWidth:()=>s.clientWidth||d.clientWidth,isRtl:()=>"rtl"===y(s),applyLiveWidth:t=>b(d,"width",`${t}%`),commit:t=>function(t){const e=a(),n=e.getBlock(c);if(!n)return;const o=e.getNodePath(c);if(!o)return;const i={...n.attrs??{},widthPercent:t};l(e.transaction("command").setNodeAttr(o,i).build())}(t),formatPercent:t=>`${t}%`},function(t,e){const n=t.shrinkWidth??null,o=t.growWidth??null;return n&&o?e.keyboardResizeHint(_(n),_(o)):""}(o,n)),d.appendChild(h.element)),m||(m=function(t){const{locale:e,actions:n}=t,o=document.createElement("div");o.className="notectl-video__toolbar",o.setAttribute("role","toolbar"),o.setAttribute("aria-label",e.videoOptions),o.setAttribute("data-notectl-no-print",""),o.addEventListener("mousedown",t=>t.stopPropagation());const i=yt(e.editVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" fill="currentColor"/></svg>',()=>n.edit()),r={start:yt(e.alignStart,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm0 7h12v2H3v-2zm0 7h18v2H3v-2zm0-3.5h12v-2H3v2z" fill="currentColor"/></svg>',()=>n.align("start")),center:yt(e.alignCenter,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm3 7h12v2H6v-2zm-3 7h18v2H3v-2zm3-3.5h12v-2H6v2z" fill="currentColor"/></svg>',()=>n.align("center")),end:yt(e.alignEnd,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 4h18v2H3V4zm6 7h12v2H9v-2zm-6 7h18v2H3v-2zm6-3.5h12v-2H9v2z" fill="currentColor"/></svg>',()=>n.align("end"))},a=yt(e.deleteVideo,'<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="currentColor"/></svg>',()=>n.remove()),l=()=>{const t=document.createElement("span");return t.className="notectl-video__tool-separator",t.setAttribute("aria-hidden","true"),t};o.append(i,l(),r.start,r.center,r.end,l(),a);const s=t=>{for(const e of["start","center","end"]){const n=e===t;r[e].classList.toggle("notectl-video__tool--active",n),r[e].setAttribute("aria-pressed",n?"true":"false")}};return s(t.initialAlign),{element:o,update:s,destroy(){o.remove()}}}({locale:n,actions:r,initialAlign:u.align}),s.appendChild(m.element))},deselectNode(){s.classList.remove("notectl-video--selected"),g(),m?.destroy(),m=null},destroy(){g(),m?.destroy(),m=null,v.destroy()}}}}function _t(t){return(e,n,o)=>{const i=function(t,e,n){const o=t.trim();if(o&&!/\s/.test(o)){const t=I(o,n);if(t)return{url:o,match:t}}const i=function(t){if(!t)return null;const e=function(t){const e=document.createElement("template");return e.innerHTML=t,e.content}(t),n=e.querySelector("iframe");if(!n)return null;const o=e.cloneNode(!0);for(const i of Array.from(o.querySelectorAll("iframe")))i.remove();return""!==(o.textContent??"").trim()?null:n.getAttribute("src")}(e);if(i){const t=I(i,n);if(t)return{url:$(t,n)??i,match:t}}return null}(e,n,t.providers);if(!i)return null;const r=o.selection;if(!u(r)||!s(r))return null;const a=r.anchor.blockId,l=r.anchor.offset,d=l+i.url.length,p=o.transaction("paste").insertText(a,l,i.url,[]).setSelection(c(a,d)).build();return t.onOffer({blockId:a,start:l,end:d},i.match),p}}var wt=0,At=/* @__PURE__ */new Set,kt=null;var Ct=class{id="video";name="Video";priority=47;config;resolvedKeymap;context=null;locale=ot;overlay=null;embedPrompt=null;constructor(t){this.config={...W,...t},this.resolvedKeymap={...M,...t?.keymap}}async init(n){this.context=n,this.locale=await f(n,this.config.locale,ot,rt),n.registerStyleSheet('\n.notectl-video {\n\tmargin: 12px 0;\n\tposition: relative;\n\tuser-select: none;\n}\n\n.notectl-video--center { text-align: center; }\n.notectl-video--start { text-align: start; }\n.notectl-video--end { text-align: end; }\n\n.notectl-video__frame {\n\tdisplay: inline-block;\n\tposition: relative;\n\twidth: 100%;\n\tmax-width: 100%;\n\tvertical-align: top;\n\toverflow: hidden;\n\tborder-radius: 8px;\n\tbackground: #000;\n\ttext-align: start;\n}\n\n/* Facade (click-to-load) */\n.notectl-video__facade {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\tborder: 0;\n\tcursor: pointer;\n\tbackground: #14181c;\n\tcolor: #fff;\n}\n\n.notectl-video__facade:focus-visible {\n\toutline: 3px solid var(--notectl-primary);\n\toutline-offset: -3px;\n}\n\n.notectl-video__poster {\n\tposition: absolute;\n\tinset: 0;\n\tbackground-size: cover;\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n}\n\n.notectl-video__poster::after {\n\tcontent: "";\n\tposition: absolute;\n\tinset: 0;\n\tbackground: rgba(0, 0, 0, 0.25);\n}\n\n.notectl-video__play-icon {\n\tposition: relative;\n\tz-index: 1;\n\tdisplay: inline-flex;\n\tfilter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));\n\ttransition: transform 0.12s ease;\n}\n\n.notectl-video__facade:hover .notectl-video__play-icon {\n\ttransform: scale(1.08);\n}\n\n.notectl-video__badge {\n\tposition: absolute;\n\tz-index: 1;\n\tbottom: 8px;\n\tinset-inline-start: 8px;\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n\tfont-size: 12px;\n\tfont-weight: 600;\n}\n\n/* Player (activated iframe + exit control) */\n.notectl-video__player {\n\tposition: absolute;\n\tinset: 0;\n}\n\n.notectl-video__iframe {\n\tposition: absolute;\n\tinset: 0;\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n}\n\n.notectl-video__exit {\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 6px;\n\tinset-inline-end: 6px;\n\twidth: 28px;\n\theight: 28px;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 0;\n\tborder-radius: 50%;\n\tcursor: pointer;\n\tbackground: rgba(0, 0, 0, 0.65);\n\tcolor: #fff;\n}\n\n.notectl-video__exit:focus-visible {\n\toutline: 2px solid #fff;\n\toutline-offset: 2px;\n}\n\n/* Static fallback link (no-JS / export rehydration) */\n.notectl-video__fallback-link {\n\tposition: absolute;\n\tinset: 0;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 8px;\n\tcolor: #fff;\n\ttext-decoration: underline;\n\ttext-align: center;\n}\n\n/* Caption */\n.notectl-video__caption {\n\tmargin-top: 6px;\n\tfont-size: 13px;\n\tcolor: var(--notectl-fg-muted);\n\ttext-align: center;\n}\n\n/* Selection */\n.notectl-video--selected .notectl-video__frame {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Resize overlay + side handles */\n.notectl-video__resize-overlay {\n\tposition: absolute;\n\tinset: 0;\n\tpointer-events: none;\n}\n\n.notectl-video__resize-handle {\n\tposition: absolute;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\twidth: 8px;\n\theight: 44px;\n\tmax-height: 60%;\n\tborder: 2px solid var(--notectl-primary);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-raised);\n\tpointer-events: all;\n\tcursor: ew-resize;\n\tz-index: 2;\n}\n\n.notectl-video__resize-handle--w { inset-inline-start: -5px; }\n.notectl-video__resize-handle--e { inset-inline-end: -5px; }\n\n.notectl-video__size-indicator {\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-tooltip-bg);\n\tcolor: var(--notectl-tooltip-fg);\n\tfont-size: 11px;\n\tfont-weight: 500;\n\twhite-space: nowrap;\n\tpointer-events: none;\n\topacity: 0;\n\ttransition: opacity 0.15s;\n\tz-index: 3;\n}\n\n.notectl-video__size-indicator--visible { opacity: 1; }\n\n.notectl-video__keyboard-hint {\n\tdisplay: none;\n\tposition: absolute;\n\tbottom: -28px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tpadding: 2px 8px;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\twhite-space: nowrap;\n\tpointer-events: none;\n\tz-index: 3;\n}\n\n.notectl-video--selected .notectl-video__keyboard-hint { display: block; }\n.notectl-video__resize-overlay--active ~ .notectl-video__keyboard-hint,\n.notectl-video__resize-overlay--active .notectl-video__keyboard-hint { display: none; }\n\n/* On-selection toolbar */\n.notectl-video__toolbar {\n\tposition: absolute;\n\ttop: -44px;\n\tleft: 50%;\n\ttransform: translateX(-50%);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 2px;\n\tpadding: 2px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 6px;\n\tbackground: var(--notectl-surface-overlay);\n\tbox-shadow: 0 2px 8px var(--notectl-shadow);\n\tz-index: 10;\n}\n\n.notectl-video__tool {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 28px;\n\theight: 28px;\n\tborder: none;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcursor: pointer;\n\tcolor: var(--notectl-fg);\n}\n\n.notectl-video__tool:hover { background: var(--notectl-hover-bg); }\n\n.notectl-video__tool--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary);\n}\n\n.notectl-video__tool:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video__tool svg { width: 16px; height: 16px; }\n\n.notectl-video__tool-separator {\n\twidth: 1px;\n\theight: 18px;\n\tmargin: 0 2px;\n\tbackground: var(--notectl-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t.notectl-video__play-icon,\n\t.notectl-video__size-indicator {\n\t\ttransition: none;\n\t}\n}\n\n@media (forced-colors: active) {\n\t.notectl-video__frame { outline: 1px solid CanvasText; }\n\t.notectl-video__facade { border: 1px solid ButtonText; }\n\t.notectl-video__play-icon { forced-color-adjust: none; }\n\t.notectl-video__resize-handle { background: ButtonFace; border-color: ButtonText; }\n\t.notectl-video--selected .notectl-video__frame { outline: 2px solid Highlight; }\n}\n'),n.registerStyleSheet("\n.notectl-video-overlay {\n\tposition: fixed;\n\tz-index: 1000;\n\tbox-sizing: border-box;\n\tmin-width: 300px;\n\tmax-width: 92vw;\n\tpadding: 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 6px 24px var(--notectl-shadow);\n}\n\n.notectl-video-popup {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.notectl-video-popup__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.notectl-video-popup__label {\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__input,\n.notectl-video-popup__select {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tbox-sizing: border-box;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__input:focus-visible,\n.notectl-video-popup__select:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 1px;\n}\n\n.notectl-video-popup__hint {\n\tmargin: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n}\n\n.notectl-video-popup__error:not(:empty) {\n\tmargin: 0;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tbackground: var(--notectl-danger-muted);\n\tcolor: var(--notectl-danger);\n\tfont-size: 12px;\n}\n\n.notectl-video-popup__actions {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tgap: 8px;\n\tmargin-top: 2px;\n}\n\n.notectl-video-popup__cancel,\n.notectl-video-popup__submit {\n\tpadding: 7px 14px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-popup__submit {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-popup__cancel:focus-visible,\n.notectl-video-popup__submit:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n/* Ask-first paste affordance */\n.notectl-video-embed-prompt {\n\tposition: fixed;\n\tz-index: 1000;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 6px 8px 6px 12px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px var(--notectl-shadow);\n\tfont-size: 13px;\n}\n\n.notectl-video-embed-prompt__text {\n\tmargin-inline-end: 4px;\n}\n\n.notectl-video-embed-prompt__embed,\n.notectl-video-embed-prompt__dismiss {\n\tpadding: 4px 10px;\n\tcursor: pointer;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-surface-raised);\n\tcolor: var(--notectl-fg);\n\tfont: inherit;\n}\n\n.notectl-video-embed-prompt__embed {\n\tborder-color: var(--notectl-primary);\n\tbackground: var(--notectl-primary);\n\tcolor: var(--notectl-primary-fg);\n\tfont-weight: 600;\n}\n\n.notectl-video-embed-prompt__embed:focus-visible,\n.notectl-video-embed-prompt__dismiss:focus-visible {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: 2px;\n}\n\n@media (forced-colors: active) {\n\t.notectl-video-overlay,\n\t.notectl-video-embed-prompt {\n\t\tborder: 1px solid CanvasText;\n\t}\n\t.notectl-video-popup__submit,\n\t.notectl-video-embed-prompt__embed {\n\t\tborder: 1px solid ButtonText;\n\t}\n}\n"),function(t){for(const e of t)At.add(e);wt+=1,kt||(kt=t=>{if("iframe"!==t.nodeName.toLowerCase())return;const e=t;e.hasAttribute("srcdoc")?e.parentNode?.removeChild(e):function(t,e){const n=B(t);return!!n&&"https:"===n.protocol&&e.has(n.hostname.toLowerCase())}(e.getAttribute("src")??"",At)||e.parentNode?.removeChild(e)},A.addHook("uponSanitizeElement",kt))}(function(t=S){const e=/* @__PURE__ */new Set;for(const n of t)for(const t of n.embedHostnames)e.add(t.toLowerCase());return e}(this.config.providers)),n.registerNodeSpec(function(n,o){const i=n.providers;return{type:"video",group:"block",isVoid:!0,selectable:!0,attrs:{provider:{default:""},videoId:{default:""},hash:{default:""},aspectRatio:{default:n.defaultAspectRatio},widthPercent:{default:n.defaultWidthPercent},align:{default:"center"},title:{default:""},caption:{default:""},privacy:{default:n.privacy}},toDOM(t){const e=K(t.attrs,n),r=x("figure",t.id);r.className="notectl-video",r.setAttribute("data-void","true"),r.setAttribute("data-selectable","true"),r.setAttribute("data-video-provider",e.provider),r.setAttribute("data-video-id",e.videoId),e.hash&&r.setAttribute("data-video-hash",e.hash),lt(r,e.align),r.setAttribute("aria-label",o.videoAria(H(e.provider,i),e.title));const a=document.createElement("div");a.className="notectl-video__frame",st(a,e.aspectRatio,e.widthPercent);const l=$(ct(e),i);if(l){const t=document.createElement("a");t.className="notectl-video__fallback-link",t.href=l,t.rel="noopener noreferrer",t.textContent=e.title||l,a.appendChild(t)}if(r.appendChild(a),e.caption){const t=document.createElement("figcaption");t.className="notectl-video__caption",t.textContent=e.caption,r.appendChild(t)}return r},toHTML(o){const r=K(o.attrs,n),a=ct(r),l=$(a,i),s=[`data-video-provider="${t(r.provider)}"`,`data-video-id="${t(r.videoId)}"`,`data-video-ratio="${t(r.aspectRatio)}"`,`data-video-width="${r.widthPercent}"`,`data-video-privacy="${r.privacy?"true":"false"}"`];r.hash&&s.push(`data-video-hash="${t(r.hash)}"`),r.title&&s.push(`data-video-title="${t(r.title)}"`);const d=n.useProviderThumbnail?N(a,i):void 0,c=d?`<img src="${t(d)}" alt="">`:e(r.title||l||""),u=l?`<a href="${t(l)}" rel="noopener noreferrer">${c}</a>`:c,p=r.caption?`<figcaption>${e(r.caption)}</figcaption>`:"";return`<figure ${s.join(" ")}>${u}${p}</figure>`},parseHTML:[{tag:"figure",priority:60,getAttrs:t=>function(t,e){const n=t.getAttribute("data-video-provider"),o=t.getAttribute("data-video-id");if(!n||!o)return!1;if(!F(o))return!1;if(!R(n,e.providers))return!1;const i=t.getAttribute("data-video-title")??t.querySelector("a")?.textContent?.trim()??t.getAttribute("aria-label")??"",r=t.querySelector("figcaption")?.textContent?.trim()??"",a=t.getAttribute("data-video-width"),l={provider:n,videoId:o,aspectRatio:T(t.getAttribute("data-video-ratio")??void 0,e),widthPercent:O(a?Number.parseFloat(a):e.defaultWidthPercent,e),align:"center",title:i,privacy:"false"!==t.getAttribute("data-video-privacy")},s=t.getAttribute("data-video-hash");return s&&dt.test(s)&&(l.hash=s),r&&(l.caption=r),l}(t,n)},{tag:"iframe",priority:60,getAttrs:t=>function(t,e){const n=I(t.getAttribute("src")??"",e.providers);if(!n||!F(n.videoId))return!1;const o={provider:n.provider,videoId:n.videoId,aspectRatio:ut(t,e),widthPercent:e.defaultWidthPercent,align:"center",title:t.getAttribute("title")??"",privacy:e.privacy};return n.hash&&(o.hash=n.hash),o}(t,n)}],sanitize:{tags:["figure","figcaption","a","img","iframe"],attrs:["href","rel","src","alt","title","allow","allowfullscreen","referrerpolicy","loading","width","height","frameborder","class","style"]}}}(this.config,this.locale)),this.overlay=new et(n,this.config,this.locale),this.registerNodeView(n),function(t){t.registerCommand("removeVideo",()=>Y(t))}(n),this.registerInsertCommand(n),this.registerResizeCommands(n),this.registerResizeKeymaps(n),this.registerPasteInterceptor(n),this.registerToolbarItem(n)}destroy(){(wt=Math.max(0,wt-1))>0||!kt||(A.removeHook("uponSanitizeElement"),kt=null,At.clear()),this.embedPrompt?.close(),this.embedPrompt=null,this.overlay?.close(!1),this.overlay=null,this.context=null}onStateChange(t,e,n){this.context&&!this.isVideoSelected(t)&&this.isVideoSelected(e)&&this.announceVideoSelection(e)}registerNodeView(t){t.registerNodeView(D,xt({config:this.config,locale:this.locale,resolvedKeymap:this.resolvedKeymap,announce:e=>t.announce(e),actions:{edit:()=>this.overlay?.openEditForSelected(),align:e=>function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},align:e})}(t,e),remove:()=>Y(t)}}))}registerInsertCommand(t){t.registerCommand("insertVideo",()=>(this.isVideoSelected(t.getState())?this.overlay?.openEditForSelected():this.overlay?.openInsert(),!0))}registerResizeCommands(t){const e=this.config.widthStep,n=this.config.widthStepLarge,o=e=>{const n=function(t,e,n){const o=X(t.getState());if(!o)return!1;const i=o.block.attrs?.widthPercent??n.defaultWidthPercent,r=O(i+e,n);return r!==i&&Z(t,{...o.block.attrs??{},widthPercent:r})}(t,e,this.config);return n&&this.announceCurrentSize(t),n};t.registerCommand("resizeVideoGrow",()=>o(e)),t.registerCommand("resizeVideoShrink",()=>o(-e)),t.registerCommand("resizeVideoGrowLarge",()=>o(n)),t.registerCommand("resizeVideoShrinkLarge",()=>o(-n)),t.registerCommand("resetVideoSize",()=>{const e=function(t,e){const n=X(t.getState());return!!n&&Z(t,{...n.block.attrs??{},widthPercent:e.defaultWidthPercent})}(t,this.config);return e&&t.announce(this.locale.resetToDefaultSize),e})}registerResizeKeymaps(t){const e={growWidth:"resizeVideoGrow",shrinkWidth:"resizeVideoShrink",growWidthLarge:"resizeVideoGrowLarge",shrinkWidthLarge:"resizeVideoShrinkLarge",resetSize:"resetVideoSize"},n={};for(const[o,i]of Object.entries(e)){const e=this.resolvedKeymap[o]??null;e&&(n[e]=()=>t.executeCommand(i))}Object.keys(n).length>0&&t.registerKeymap(n)}registerPasteInterceptor(t){t.registerPasteInterceptor(_t({providers:this.config.providers,onOffer:(t,e)=>this.offerEmbed(t,e)}),{name:"video",priority:40})}offerEmbed(t,e){if(!this.context)return;const o=this.context,i=H(e.provider,this.config.providers);this.embedPrompt?.close(),requestAnimationFrame(()=>{o.announce(this.locale.embedOfferAnnounce(i));const e=function(t,e){const o=t.getBlock(e.blockId);if(!o)return"";const i=n(o);return i.slice(e.start,Math.min(e.end,i.length))}(o.getState(),t);this.embedPrompt=function(t){const{locale:e}=t,n=document.createElement("div");n.className="notectl-video-embed-prompt",n.setAttribute("role","dialog"),n.setAttribute("aria-label",e.embedPrompt);const o=document.createElement("span");o.className="notectl-video-embed-prompt__text",o.textContent=e.embedPrompt;const i=document.createElement("button");i.type="button",i.className="notectl-video-embed-prompt__embed",i.textContent=e.embedConfirm;const r=document.createElement("button");r.type="button",r.className="notectl-video-embed-prompt__dismiss",r.textContent=e.embedDismiss,n.append(o,i,r);let a=null,l=!1;const s=()=>{l||(l=!0,a&&(document.removeEventListener("mousedown",a,!0),a=null),n.remove())},d=t=>{s(),t()};return i.addEventListener("mousedown",t=>t.preventDefault()),i.addEventListener("click",e=>{e.preventDefault(),d(t.onEmbed)}),r.addEventListener("mousedown",t=>t.preventDefault()),r.addEventListener("click",e=>{e.preventDefault(),d(t.onDismiss)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),d(t.onDismiss))}),t.container.appendChild(n),w(n),function(t,e){const n=e?e.bottom:window.innerHeight/3,o=e?e.left:window.innerWidth/3,i=t.offsetWidth||240,r=window.innerWidth-i-8,a=Math.max(8,Math.min(o,r)),l=window.innerHeight-t.offsetHeight-8,s=Math.min(n+8,Math.max(8,l));t.style.left=`${Math.round(a)}px`,t.style.top=`${Math.round(s)}px`}(n,t.rect),a=e=>{e.composedPath().includes(n)||d(t.onDismiss)},requestAnimationFrame(()=>{a&&document.addEventListener("mousedown",a,!0),i.focus()}),{close:s}}({container:o.getPluginContainer("top"),rect:Pt(),locale:this.locale,onEmbed:()=>{this.embedPrompt=null,this.overlay?.openInsertReplacingRange(t,e)},onDismiss:()=>{this.embedPrompt=null,o.getContainer().focus()}})})}registerToolbarItem(t){t.registerToolbarItem({id:"video",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm6 4.5v7l6-3.5-6-3.5z" fill="currentColor"/></svg>',label:this.locale.insertVideo,tooltip:this.locale.insertVideoTooltip,command:"insertVideo"})}isVideoSelected(t){const e=t.selection;return!!l(e)&&t.getBlock(e.nodeId)?.type===D}announceVideoSelection(t){if(!this.context)return;const e=t.selection;if(!l(e))return;const n=t.getBlock(e.nodeId);if(!n||"video"!==n.type)return;const o=n.attrs?.title??"",i=[o?this.locale.videoSelectedWithTitle(o):this.locale.videoSelected],r=this.resolvedKeymap.shrinkWidth??null,a=this.resolvedKeymap.growWidth??null;r&&a&&i.push(this.locale.resizeHint(_(r),_(a))),this.context.announce(i.join(" "))}announceCurrentSize(t){const e=function(t,e){const n=X(t);return n?n.block.attrs?.widthPercent??e.defaultWidthPercent:null}(t.getState(),this.config);null!==e&&t.announce(this.locale.videoResized(e))}};function Pt(){const t=window.getSelection();if(!t||0===t.rangeCount)return null;const e=t.getRangeAt(0).getBoundingClientRect();return 0===e.width&&0===e.height&&0===e.top&&0===e.left?null:e}export{M as a,W as i,ot as n,S as o,rt as r,I as s,Ct as t};
2
+ //# sourceMappingURL=VideoPlugin-BugkI7-m.mjs.map