@yiitap/vue 0.13.0 → 0.15.0

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 (68) hide show
  1. package/dist/index.cjs +270 -22
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +270 -22
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +52672 -25834
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/vue.css +1 -1
  8. package/package.json +55 -58
  9. package/types/components/YiiEditor.vue.d.ts +8 -12
  10. package/types/components/buttons/OExtensionDropdown.vue.d.ts +11 -0
  11. package/types/components/common/OBlockPlaceholder.vue.d.ts +1 -1
  12. package/types/components/common/OBlockPopover.vue.d.ts +1 -1
  13. package/types/components/common/OCommandBtn.vue.d.ts +8 -8
  14. package/types/components/common/OCommonBtn.vue.d.ts +8 -8
  15. package/types/components/common/OMenubarBtn.vue.d.ts +7 -7
  16. package/types/components/common/OMetaInput.vue.d.ts +1 -1
  17. package/types/components/common/ONodeView.vue.d.ts +4 -8
  18. package/types/components/index.d.ts +1 -0
  19. package/types/components/menus/OSideMenu.vue.d.ts +9 -0
  20. package/types/components/ui/OBtn.vue.d.ts +3 -3
  21. package/types/components/ui/OBtnGroup.vue.d.ts +3 -3
  22. package/types/components/ui/OCheckbox.vue.d.ts +1 -1
  23. package/types/components/ui/ODialog.vue.d.ts +2 -2
  24. package/types/components/ui/OIcon.vue.d.ts +1 -1
  25. package/types/components/ui/OImageViewer.vue.d.ts +1 -1
  26. package/types/components/ui/OInput.vue.d.ts +2 -2
  27. package/types/components/ui/OPopover.vue.d.ts +4 -4
  28. package/types/components/ui/OTextarea.vue.d.ts +2 -2
  29. package/types/components/ui/OTooltip.vue.d.ts +1 -1
  30. package/types/constants/brand-color.d.ts +4 -0
  31. package/types/constants/empty-block.d.ts +75 -5
  32. package/types/constants/index.d.ts +1 -1
  33. package/types/extensions/audio/index.d.ts +4 -0
  34. package/types/extensions/blockquote/index.d.ts +1 -1
  35. package/types/extensions/char-command/emoji/view.vue.d.ts +2 -2
  36. package/types/extensions/char-command/index.d.ts +4 -0
  37. package/types/extensions/char-command/slash/view.vue.d.ts +1 -1
  38. package/types/extensions/code-block/index.d.ts +3 -3
  39. package/types/extensions/details/index.d.ts +1 -1
  40. package/types/extensions/extensions.d.ts +55 -0
  41. package/types/extensions/factory.d.ts +111 -0
  42. package/types/extensions/horizontal-rule/index.d.ts +3 -1
  43. package/types/extensions/index.d.ts +3 -51
  44. package/types/extensions/multi-column/__tests__/index.spec.d.ts +1 -0
  45. package/types/extensions/multi-column/core/dom.d.ts +13 -0
  46. package/types/extensions/multi-column/core/keymap.d.ts +3 -0
  47. package/types/extensions/multi-column/core/schema.d.ts +3 -0
  48. package/types/extensions/multi-column/core/state.d.ts +16 -0
  49. package/types/extensions/multi-column/extensions/column-container.d.ts +5 -0
  50. package/types/extensions/multi-column/extensions/column-dropcursor.d.ts +5 -0
  51. package/types/extensions/multi-column/extensions/column.d.ts +5 -0
  52. package/types/extensions/multi-column/extensions/multi-column.d.ts +20 -0
  53. package/types/extensions/multi-column/index.d.ts +4 -0
  54. package/types/extensions/multi-column/plugins/resize.d.ts +6 -0
  55. package/types/extensions/multi-column/utils/utils.d.ts +15 -0
  56. package/types/extensions/paragraph/index.d.ts +3 -1
  57. package/types/extensions/side-menu/utils.d.ts +9 -0
  58. package/types/extensions/starter-kit.d.ts +20 -0
  59. package/types/index.d.ts +1 -0
  60. package/types/components/common/o-side-node/AddNode.vue.d.ts +0 -92
  61. package/types/components/common/o-side-node/AddNodeView.vue.d.ts +0 -96
  62. package/types/components/common/o-side-node/DragNode.vue.d.ts +0 -96
  63. package/types/components/common/o-side-node/DragNodeView.vue.d.ts +0 -96
  64. package/types/components/common/o-side-node/index.vue.d.ts +0 -96
  65. package/types/constants/color.d.ts +0 -5
  66. package/types/extensions/dynamic.d.ts +0 -8
  67. package/types/extensions/heading/index.d.ts +0 -7
  68. /package/types/extensions/{heading → audio}/view.vue.d.ts +0 -0
package/dist/index.cjs CHANGED
@@ -1,36 +1,178 @@
1
- "use strict";var Nl=Object.defineProperty;var Cl=(t,n,o)=>n in t?Nl(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o;var Ce=(t,n,o)=>Cl(t,typeof n!="symbol"?n+"":n,o);/**
1
+ "use strict";var JT=Object.defineProperty;var GT=(n,e,t)=>e in n?JT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ke=(n,e,t)=>GT(n,typeof e!="symbol"?e+"":e,t);/**
2
2
  * Copyright 2026 Yiitap
3
3
  * @license MIT
4
- **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),K=require("@tiptap/vue-3"),Sl=require("@tiptap/starter-kit"),Pr=require("@tiptap/extension-document"),Tl=require("@tiptap/extension-collaboration"),Ol=require("@tiptap/extension-collaboration-caret"),Al=require("@tiptap/extensions"),Wo=require("@tiptap/extension-details"),Bl=require("@tiptap/extension-list"),Yo=require("@tiptap/extension-mathematics"),Wt=require("@tiptap/extension-table"),Kn=require("@tiptap/extension-text-style"),Ml=require("@tiptap/markdown"),Rl=require("@tiptap/extension-highlight"),Fr=require("@tiptap/extension-emoji"),Il=require("@tiptap/extension-image"),Sa=require("@tiptap/extension-link");require("@tiptap/extension-mention");const Dl=require("@tiptap/extension-subscript"),Ll=require("@tiptap/extension-superscript"),Vl=require("@tiptap/extension-text-align"),$l=require("@tiptap/extension-typography"),Pl=require("@tiptap/extension-underline"),Fl=require("@tiptap/extension-unique-id"),Ul=require("@yiitap/extension-color-highlighter");require("@yiitap/extension-focus");const zl=require("@yiitap/extension-inline-placeholder"),pn=require("@yiitap/extension-placeholder"),Hl=require("@yiitap/extension-selection-decoration"),Ur=require("@yiitap/extension-shortcut"),ql=require("@yiitap/extension-table"),Gl=require("@yiitap/extension-task-item"),Lo=require("@yiitap/extension-char-command"),Kl=require("@yiitap/extension-ai-block"),Te=require("@tiptap/core"),Wl=require("@yiitap/i18n"),Yl=require("openai"),jl=require("markdown-it"),Zl=require("katex"),Xl=require("@tiptap/extension-blockquote"),Ct=require("@tiptap/pm/state"),Ql=require("@yiitap/extension-callout"),Jl=require("@tiptap/extension-code-block-lowlight"),Vo=require("mermaid"),es=require("@mermaid-js/layout-elk"),ts=require("@yiitap/core"),ns=require("@tiptap/extension-heading"),os=require("@tiptap/extension-horizontal-rule"),rs=require("@yiitap/extension-image"),as=require("@tiptap/extension-paragraph"),is=require("@yiitap/extension-table-wrapper"),ls=require("@yiitap/extension-video"),Bn=require("@yiitap/util-emoji"),Ta=require("@tiptap/vue-3/menus"),ss=require("@tiptap/pm/model");require("@tiptap/suggestion");function Q(){const t=e.inject("locale",{value:"en"}),n=e.computed(()=>Wl.getMessage(t.value)),o=e.computed(()=>{var a;return((a=n.value)==null?void 0:a.name)||"English"});function r(a){return a.split(".").reduce((l,i)=>{if(l)return l[i]},n.value)}return{languageName:o,locale:t,message:n,tr:r}}const un=[{type:"paragraph",content:[]}],Oa=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Aa=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],cs=[{type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:un}]}],Ba=[{type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
5
- Mermaid --> Diagram`}]}];function ie(){const t=e.inject("isEditable",{value:!0});function n(l,i,s={}){if(!l.isEditable)return;const c=l==null?void 0:l.chain().focus(),d=l==null?void 0:l.commands;switch(i){case"inlineMath":r(l);break;default:o(d,c,i,s);break}}function o(l,i,s,c={}){switch(s){case"aiBlock":i.toggleAiBlock().run();break;case"highlight":c.color?l.setHighlight({color:c.color}):l.unsetHighlight();break;case"backgroundColor":c.color?l.setBackgroundColor(c.color):l.unsetBackgroundColor();break;case"blockMath":l.insertBlockMath({latex:""});break;case"blockquote":i.toggleBlockquote().run();break;case"bold":i.toggleBold().run();break;case"bulletList":i.toggleBulletList().run();break;case"callout":i.toggleCallout().run();break;case"clearFormat":i.unsetAllMarks().run();break;case"code":i.toggleCode().run();break;case"codeBlock":l.toggleCodeBlock({language:"bash"});break;case"color":i.setColor(c.color).run();break;case"copySelected":l.copySelected();break;case"content":l.insertContent(c.content);break;case"deleteSelected":l.deleteSelected();break;case"details":c.type==="detailsSummary"?l.unsetDetails():l.setDetails();break;case"diagram":l.insertContent(Ba);break;case"duplicateSelected":l.duplicateSelected();break;case"emoji":l.insertContent(":");break;case"fontFamily":l.setFontFamily(c.fontFamily);break;case"heading":i.toggleHeading(c).run();break;case"horizontalRule":i.setHorizontalRule().run();break;case"image":i.setImage({src:"init"}).run();break;case"imageUpdate":i.setImage(c).run();break;case"inlineMathDelete":l.deleteInlineMath(c);break;case"inlineMathInsert":l.insertInlineMath(c);break;case"inlineMathUpdate":l.updateInlineMath(c);break;case"italic":i.toggleItalic().run();break;case"linkSet":i.extendMarkRange("link").setLink(c).run();break;case"linkUnset":i.extendMarkRange("link").unsetLink().run();break;case"orderedList":i.toggleOrderedList().run();break;case"paragraph":i.setParagraph().run();break;case"strike":i.toggleStrike().run();break;case"subscript":l.toggleSubscript();break;case"superscript":l.toggleSuperscript();break;case"table":i.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":i.addColumnAfter().run();break;case"tableAddRow":i.addRowAfter().run();break;case"tableCellAttribute":i.setCellAttribute(c.name,c.value).run();break;case"tableDeleteColumn":i.deleteColumn().run();break;case"tableDeleteRow":i.deleteRow().run();break;case"tableDelete":i.deleteTable().run();break;case"tableInsert":i.insertTable(c).run();break;case"tableMergeCells":i.mergeCells().run();break;case"tableSelectColumn":i.selectColumn(c.pos).run();break;case"tableSelectRow":i.selectRow(c.pos).run();break;case"tableSplitCell":i.splitCell().run();break;case"taskList":l.toggleTaskList();break;case"textAlign":i.setTextAlign(c.textAlign).run();break;case"underline":i.toggleUnderline().run();break;case"video":i.setVideo({src:"init"}).run()}}function r(l){const{state:i,view:s}=l,{from:c}=i.selection,u=s.domAtPos(c).node.getBoundingClientRect(),p=i.tr.setMeta(pn.InlinePlaceholderKey,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:c,rect:u}}).setSelection(i.selection);s.dispatch(p)}function a(l){const i=[];return l.state.doc.descendants((s,c)=>{s.type.name==="image"&&i.push({pos:c,attrs:s.attrs})}),i}return{isEditable:t,onCommand:o,run:n,getEditorImages:a}}const ar=e.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.left"),value:"left",icon:"format_align_left"},{label:o("editor.center"),value:"center",icon:"format_align_center"},{label:o("editor.right"),value:"right",icon:"format_align_right"},{label:o("editor.justify"),value:"justify",icon:"format_align_justify"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,"textAlign",{textAlign:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:t.placement,trigger:t.trigger,"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:e.unref(o)("editor.align")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createBlock(e.unref(ze),{key:u,class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:m=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive({textAlign:d.value})?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),Ma=e.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),{run:l}=ie(),i=e.ref(null),s=e.computed(()=>[{label:a("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function c(u){return o.modelValue===u.value}function d(u){var p;(p=i.value)==null||p.setShow(!1),r("download",u.value)}return(u,p)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:e.unref(a)("label.download")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(m,f)=>(e.openBlock(),e.createBlock(e.unref(ze),{key:f,class:e.normalizeClass({"is-active":c(m)}),onClick:v=>d(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:m.icon},null,8,["name"])]),suffix:e.withCtx(()=>[c(m)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),Ra=e.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),{run:l}=ie(),i=e.ref(null),s=e.computed(()=>[{label:a("editor.code"),value:"code",icon:"code"},{label:a("label.preview"),value:"preview",icon:"mermaid"},{label:a("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:a("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:a("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),c=e.computed(()=>s.value.find(p=>p.value===o.modelValue));function d(p){return o.modelValue===p.value}function u(p){var m;switch((m=i.value)==null||m.setShow(!1),p.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:r("update:modelValue",p.value)}}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{"content-class":"o-code-block-view-dropdown dropdown",icon:c.value.icon,tooltip:e.unref(a)("label.view")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(f,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[f.separator?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:e.normalizeClass({"is-active":d(f)}),onClick:b=>u(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:f.icon},null,8,["name"])]),suffix:e.withCtx(()=>[f.suffixIcon?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:f.suffixIcon,small:""},null,8,["name"])):d(f)?(e.openBlock(),e.createBlock(e.unref(U),{key:1,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),ir=e.defineComponent({__name:"OLinkBtn",props:{editor:{type:Te.Editor}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var m;i.value="",s.value=!0;const p=(m=n.editor)==null?void 0:m.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank",console.log("show",l.value,p,s.value))}function d(){var p;(p=a.value)==null||p.setShow(!1)}function u(p){var m;p?r(n.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(n.editor,"linkUnset"),(m=a.value)==null||m.setShow(!1)}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[m[1]||(m[1]=f=>l.value=f),c]},{trigger:e.withCtx(()=>{var f;return[e.createVNode(e.unref(Ne),{icon:"link","content-class":{"is-active":(f=t.editor)==null?void 0:f.isActive("link")},tooltip:e.unref(o)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(yo),{key:0,title:e.unref(o)("editor.hyperlink"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Cr),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=f=>s.value=f),label:e.unref(o)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),us={class:"o-block-placeholder"},ds={class:"icon"},ps={class:"placeholder"},bo=e.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("section",us,[e.createElementVNode("div",ds,[e.createVNode(e.unref(U),{name:t.icon},null,8,["name"])]),e.createElementVNode("div",ps,e.toDisplayString(t.placeholder),1)]))}}),fs={class:"group o-tips"},ms={key:1,class:"item"},vo=e.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),l=e.ref([]),i=(f,v)=>{f&&(l.value[v]=f)},s=e.ref(0);function c(f,v,b){r("select",f,b),l.value[v]&&l.value[v].setShow(!1)}function d(){s.value=(s.value+o.items.length-1)%o.items.length}function u(){s.value=(s.value+1)%o.items.length}function p(){c(o.items[s.value],s.value)}function m(f){switch(f.key){case"ArrowUp":f.preventDefault(),d();break;case"ArrowDown":f.preventDefault(),u();break;case"Enter":f.preventDefault(),p();break}}return e.watch(()=>o.useKeyboard,f=>{f?window.addEventListener("keydown",m):window.removeEventListener("keydown",m)}),e.onMounted(()=>{o.useKeyboard&&window.addEventListener("keydown",m)}),e.onBeforeUnmount(()=>{o.useKeyboard&&window.removeEventListener("keydown",m)}),(f,v)=>(e.openBlock(),e.createBlock(e.unref(Ge),{class:"o-block-list",hoverable:"",clickable:""},{default:e.withCtx(()=>[t.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.items,(b,h)=>{var _;return e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[b.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[h>0?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",fs,e.toDisplayString(e.unref(a)(b.group)),1)],64)):e.createCommentVNode("",!0),(_=b.children)!=null&&_.length?(e.openBlock(),e.createBlock(e.unref(ge),{key:1,ref_for:!0,ref:y=>i(y,h),placement:"right-start",offset:[-10,16]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(jo),{item:b,class:e.normalizeClass(["item",{"is-active":h===s.value}]),clickable:""},null,8,["item","class"])]),default:e.withCtx(()=>[e.createVNode(e.unref(vo),{items:b.children,onSelect:y=>c(b,h,y)},null,8,["items","onSelect"])]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(jo),{key:2,item:b,class:e.normalizeClass(["item",{"is-active":h===s.value}]),clickable:"",onClick:y=>c(b,h)},null,8,["item","class","onClick"]))],64)}),128)):(e.openBlock(),e.createElementBlock("div",ms,e.toDisplayString(e.unref(a)("label.noResults")),1))]),_:1}))}}),gs={key:0,class:"o-tips"},jo=e.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:n}){const{tr:o}=Q();return(r,a)=>(e.openBlock(),e.createBlock(e.unref(ze),{class:"o-block-list-item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:t.item.icon,color:t.item.color},null,8,["name","color"])]),suffix:e.withCtx(()=>{var l;return[t.item.tips?(e.openBlock(),e.createElementBlock("span",gs,e.toDisplayString(t.item.tips),1)):e.createCommentVNode("",!0),(l=t.item.children)!=null&&l.length?(e.openBlock(),e.createBlock(e.unref(U),{key:1,name:"navigate_next",class:"o-tips"})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)(t.item.label)),1)]),_:1}))}}),Zo=(t,n)=>Te.generateJSON(n,t.extensionManager.extensions),bs=()=>{const t=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:t?"⌘":"Ctrl",alt:t?"⌥":"Alt",shift:t?"⇧":"Shift",ctrl:t?"⌃":"Ctrl",meta:t?"⌘":"Meta"}},vs=t=>{const n=t==null?void 0:t.split("+").map(a=>a.trim().toLowerCase()).filter(Boolean);if(!n||!n.length)return t;const o=bs();return n.map(a=>o[a]??a.toUpperCase()).join("+")},ee={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},hs=[{label:"blue",value:"#2172e0",name:"blue"},{label:"indigo",value:"#3f51b5",name:"indigo"},{label:"cyan",value:"#00bcd4",name:"cyan"},{label:"teal",value:"#009688",name:"teal"},{label:"green",value:"#4caf50",name:"green"},{label:"deep-purple",value:"#673ab7",name:"deep-purple"},{label:"red",value:"#f44336",name:"red"},{label:"deep-orange",value:"#ff5722",name:"deep-orange"}],kn=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:ee.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:ee.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:ee.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:ee.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:ee.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:ee.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:ee.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:ee.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:ee.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:ee.blue},{label:"editor.callout",value:"callout",color:ee.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:ee.blue}],fn=kn.filter(t=>t.style),mn=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:ee.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:ee.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:ee.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:ee.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:ee.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:ee.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:ee.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:ee.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:ee.purple}],Ia=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:ee.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:ee.indigo,tips:"math",keywords:"block, math, equation"}],ho=[...kn,...mn,...Ia],no=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ee.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:ee.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:ee.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:ee.blue,filter:"image,video,model"},{label:"label.color",value:"color",icon:"palette",color:ee.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:ee.purple,filter:"callout",component:"OCalloutColorBoard"}],Da=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:ee.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:ee.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:ee.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:ee.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.makeLonger",value:"makeLonger",icon:"subject",color:ee.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:ee.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:ee.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:ee.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],La=[{label:"ai.summarize",value:"summarize",icon:"notes",color:ee.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:ee.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],_s={key:1,class:"group o-tips"},ks={class:"suffix o-tips"},ys={key:1,class:"item"},Ht=e.defineComponent({__name:"OBlockMenu",props:{...K.nodeViewProps,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),{run:l}=ie(),i=e.ref([]),s=e.computed(()=>{var _;return(_=o.node)==null?void 0:_.type.name}),c=e.computed(()=>fn.find(_=>_.value===s.value)),d=e.computed(()=>{const _=c.value?no.filter(g=>{var N;return((N=g.filter)==null?void 0:N.indexOf("style"))>=0})??[]:[];let y=no.filter(g=>{var N;return((N=g.filter)==null?void 0:N.indexOf(s.value))>=0})??[];if(y=y.concat(_),y.length>0){const g=y[0];g.group=`editor.${s.value}`}const E=no.filter(g=>{var N;return((N=g.filter)==null?void 0:N.indexOf("common"))>=0});return[...y,...E]});function u(_){switch(_.component){case"OCalloutColorBoard":return dr;case"OTextColorBoard":return yr;default:return null}}function p(_){setTimeout(()=>{m(_),r("action",_)},0)}function m(_){switch(_.value){case"copy":f();break;case"delete":v();break;case"duplicate":b();break}}function f(){l(o.editor,"copySelected")}function v(){l(o.editor,"deleteSelected")}function b(){l(o.editor,"duplicateSelected")}function h(_,y){switch(console.log("select",_,y),y.name){case"backColor":o.updateAttributes({backColor:y.value});break;case"foreColor":o.updateAttributes({borderColor:y.value});break;case"color":l(o.editor,y.name,{color:y.value});break;case"backgroundColor":l(o.editor,y.name,{color:y.value});break}}return(_,y)=>(e.openBlock(),e.createBlock(e.unref(Ge),{class:"o-block-menu",hoverable:"",clickable:""},{default:e.withCtx(()=>[d.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.value,(E,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[E.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[g>0||c.value?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),t.showGroup?(e.openBlock(),e.createElementBlock("div",_s,e.toDisplayString(e.unref(a)(E.group)),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),u(E)?(e.openBlock(),e.createBlock(e.unref(ge),{key:1,ref_for:!0,ref:i.value[E.value],offset:[0,4],placement:"right"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ze),{class:"item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:E.icon,color:t.colorful?E.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"navigate_next",class:"o-tips"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(a)(E.label)),1)]),_:2},1024)]),default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u(E)),{onSelect:N=>h(E,N)},null,40,["onSelect"]))]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(ze),{key:2,class:"item",clickable:"",onClick:e.withModifiers(N=>p(E),["stop"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:E.icon,color:t.colorful?E.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("div",ks,e.toDisplayString(e.unref(vs)(E.tips)),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(a)(E.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(e.openBlock(),e.createElementBlock("div",ys,"No result"))]),_:1}))}}),Ot=e.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:n}){const o=t,r=n,a=e.ref();function l(s){r("update:modelValue",s)}function i(){console.log("click outside"),o.hideClickOutside&&r("update:modelValue",!1)}return e.watch(()=>o.modelValue,s=>{var c,d;s&&!o.readonly?(c=a.value)==null||c.setShow(!0):(d=a.value)==null||d.setShow(!1)}),e.onMounted(()=>{var s;o.modelValue&&((s=a.value)==null||s.setShow(!0))}),e.onUnmounted(()=>{var s;(s=a.value)==null||s.setShow(!1)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,placement:t.placement,"tippy-class":t.tippyClass,"content-class":t.contentClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue&&!t.readonly,"onUpdate:show":l,onClickoutside:i},{trigger:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),default:e.withCtx(()=>[e.renderSlot(s.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),Va={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},lr=(t,n)=>{const o=Va[t];return o?o[n]:null},sr={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},$a=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],Pa=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],Fa=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],Ua=["inline-math-edit","inlineMathDelete"],za=["link-open","link-edit","linkUnset"],Ha=["align-group","separator","link"],qa=["align-group","separator","link-open","link-edit","linkUnset"],Ga=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],Ka=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Es=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Wa=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],ws=["table-group","separator","align-group"],xs={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},Ns=new jl({breaks:!0});function cr(){const t=e.inject("aiOption"),n=e.ref(null);function o(){if(!t.value)return;const{provider:a,apiKey:l,baseURL:i}=t.value,s=i||lr(a,"baseURL");!a||!l||!s||(n.value=new Yl({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0}))}const r=async(a,l)=>{var i,s,c;if(!n.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const d=await((i=n.value)==null?void 0:i.chat.completions.create({model:"deepseek-chat",messages:a,temperature:.7,stream:!0}));let u="";for await(const p of d){const m=((c=(s=p.choices[0])==null?void 0:s.delta)==null?void 0:c.content)||"";u+=m,l(m)}return u}catch(d){throw console.error("API Error:",d),new Error(d.message||"API request failed")}};return e.watch(()=>t,a=>{o()},{deep:!0}),e.onMounted(()=>{o()}),{md:Ns,aiOption:t,createStreamingChatCompletion:r}}function _o(){const t=(r,a,l)=>{const i={type:"text/plain"};switch(r){case"svg":i.type="image/svg+xml;charset=utf-8";break}const s=new Blob([l],i),c=URL.createObjectURL(s),d=document.createElement("a");d.href=c,d.download=a,d.click(),URL.revokeObjectURL(c)},n=async r=>{try{const l=await(await fetch(r)).blob(),i=window.URL.createObjectURL(l),s=o(r),c=document.createElement("a");c.href=i,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)}catch{window.open(r,"_blank")}},o=(r,a="png")=>{try{const s=new URL(r).pathname.split("/"),c=s[s.length-1];return c&&c.includes(".")?decodeURIComponent(c):`image-${Date.now()}.${a}`}catch{return`download-${Date.now()}.${a}`}};return{commonDownload:t,downloadImage:n}}function Ya(){const t=e.ref(),n=e.ref(!1);function o(i){t.value=i,i.editor.on("selectionUpdate",l)}function r(){var i;(i=t.value)==null||i.editor.off("selectionUpdate",l)}const a=e.computed(()=>{var c;const i=(c=t.value)==null?void 0:c.getPos();if(typeof i!="number")return null;const s=t.value.editor.state.doc.nodeAt(i);return s?{start:i+1,end:i+s.nodeSize-1}:null}),l=()=>{if(!t.value)return;const{editor:i}=t.value;if(!i.isFocused){n.value=!1;return}const{selection:s}=i.state;s&&(n.value=(s==null?void 0:s.$from.pos)>=a.value.start&&(s==null?void 0:s.$to.pos)<=a.value.end)};return{isFocused:n,bind:o,unbind:r,checkFocus:l}}function tn(){const t=e.inject("darkMode",{value:!1}),n=e.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:n}}const Cs={class:"o-block-toolbar editable-only"},Ss={class:"button-group"},ur=e.defineComponent({__name:"OBlockToolbar",props:{...K.nodeViewProps,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Q(),{isEditable:i,run:s}=ie(),c=e.ref();function d(u){var p;r("action",u),(p=c.value)==null||p.setShow(!1)}return(u,p)=>(e.openBlock(),e.createElementBlock("div",Cs,[e.createElementVNode("section",Ss,[e.renderSlot(u.$slots,"default"),e.createVNode(e.unref(ge),{ref_key:"popover",ref:c,placement:"bottom-end",size:"medium",trigger:t.trigger,"show-arrow":!1},{trigger:e.withCtx(()=>[e.unref(i)?(e.openBlock(),e.createBlock(e.unref(Ne),{key:0,icon:"more_horiz",tooltip:e.unref(l)("label.more")},null,8,["tooltip"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createVNode(e.unref(Ht),e.mergeProps(o,{onAction:d}),null,16)]),_:1},8,["trigger"])])]))}}),Ts={class:"o-callout-color-board"},Os={class:"fore-colors"},As={class:"color-row"},Bs={class:"color-row"},Ms={class:"back-colors"},Rs={class:"color-row"},Is={class:"color-row"},dr=e.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=n;function r(i,s){o("select",{name:i,value:s.value})}const a=e.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),l=e.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(i,s)=>(e.openBlock(),e.createElementBlock("section",Ts,[e.createElementVNode("section",Os,[s[4]||(s[4]=e.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),e.createElementVNode("div",As,[e.createVNode(e.unref(pe),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:s[0]||(s[0]=c=>r("foreColor",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:s[1]||(s[1]=c=>r("foreColor",{value:t.foreColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Bs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>r("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),e.createElementVNode("section",Ms,[s[5]||(s[5]=e.createElementVNode("div",{class:"label o-tips"},"Background",-1)),e.createElementVNode("div",Rs,[e.createVNode(e.unref(pe),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:s[2]||(s[2]=c=>r("backColor",{value:"#F5F5F5"}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:s[3]||(s[3]=c=>r("backColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Is,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>r("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Ds=e.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:n}){const o=n,{tr:r}=Q(),{run:a}=ie(),l=e.ref(null),i=e.ref(""),s=e.ref("");function c(d,u){d==="foreColor"?(i.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(s.value=u,localStorage.setItem("yiitap.text-color.back",u)),o("select",d,u)}return e.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:l,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"palette",tooltip:e.unref(r)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var p;return[e.createVNode(e.unref(dr),{"fore-color":i.value,"back-color":s.value,"default-label":e.unref(r)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Vn=e.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,a=e.ref();e.computed(()=>{var s;return o.clientX||((s=o.event)==null?void 0:s.clientX)||0}),e.computed(()=>{var s;return o.clientY||((s=o.event)==null?void 0:s.clientY)||0});function l(s){r("update:modelValue",s)}function i(){r("update:modelValue",!1)}return e.watch(()=>o.modelValue,s=>{var c;s?setTimeout(()=>{var d;(d=a.value)==null||d.setShow(s)},0):(c=a.value)==null||c.setShow(s)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":l,onClickoutside:i},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},8,["show","event"]))}}),Ls={class:"o-color-board"},Vs={class:"cell-container"},$s={class:"label"},Ps=["onClick"],Xt=e.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=t,r=n;function a(c){r("select",c.hex)}function l(c){return o.activeColor===c}function i(c){return"abc"}const s=e.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,d)=>(e.openBlock(),e.createElementBlock("section",Ls,[t.defaultDisabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"default-color",onClick:d[0]||(d[0]=u=>a({hex:t.defaultColor}))},[e.createElementVNode("div",Vs,[e.createElementVNode("div",{class:"cell border",style:e.normalizeStyle({background:t.defaultColor})},[e.createVNode(e.unref(U),{name:"slash_forward"})],4)]),e.createElementVNode("div",$s,e.toDisplayString(t.defaultLabel),1)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(u,p)=>(e.openBlock(),e.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(m,f)=>(e.openBlock(),e.createElementBlock("div",{class:"",key:`col-${f}`},[e.createElementVNode("div",{class:"cell-container",onClick:v=>a(m)},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{border:m.border}]),style:e.normalizeStyle({backgroundColor:m.hex})},[l(m.hex)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",style:e.normalizeStyle({color:i(m.rgb)})},null,8,["style"])):e.createCommentVNode("",!0)],6)],8,Ps)]))),128))]))),128))]))}}),Ne=e.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createBlock(e.unref(st),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:a[0]||(a[0]=l=>o("click",l))},[t.icon?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Fs={key:0,class:"spinner"},ft=e.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=t,r=n;function a(l){o.loading||r("click",l)}return(l,i)=>(e.openBlock(),e.createBlock(e.unref(st),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:e.withModifiers(a,["stop"])},[t.loading?(e.openBlock(),e.createElementBlock("div",Fs)):(e.openBlock(),e.createBlock(e.unref(U),{key:1,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])),e.renderSlot(l.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Us={key:0,class:"o-doc-toc toc"},zs={class:"mini-view"},Hs={class:"toc__list"},qs={class:"main-view o-scroll",style:{"max-width":"480px"}},Gs={class:"toc__title"},Ks={class:"toc__list"},Ws=["onClick"],Ys=e.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Te.Editor},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:n,emit:o}){const r=t,a=o,{tr:l}=Q(),i=e.ref([]),s=e.ref("");function c(){var f;s.value=window.location.hash,(f=r.editor)==null||f.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const f=document.querySelector(".yiitap"),v=f==null?void 0:f.parentElement;v==null||v.addEventListener("scroll",p)}function u(){var v;const f=[];(v=r.editor)==null||v.state.doc.descendants((b,h)=>{if(b.type.name==="heading"){const _=b.attrs.id;f.push({level:b.attrs.level,text:b.textContent,id:_})}}),i.value=f}function p(f){for(const v of i.value){const b=document.querySelector(`[data-id="${v.id}"]`);if(!b)continue;const h=b.getBoundingClientRect();if(h.top>=0&&h.top<window.innerHeight/2){s.value=v.id;break}}a("docScroll",f)}function m(f){s.value=f.id;const v=document.querySelector(`[data-id="${f.id}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"start"})}return e.watch(()=>r.editor,f=>{c()}),n({onScroll:p,headings:i}),(f,v)=>i.value.length?(e.openBlock(),e.createElementBlock("section",Us,[e.createVNode(e.unref(ge),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:e.withCtx(()=>[e.createElementVNode("div",zs,[e.createElementVNode("ul",Hs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[b.level<=Math.max(Math.min(t.maxLevel,3),2)?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass(["toc__item",[s.value===b.id?"selected":"",`toc__item--${b.level}`]])},null,2)):e.createCommentVNode("",!0)],64))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",qs,[e.createElementVNode("div",Gs,e.toDisplayString(e.unref(l)("label.toc")),1),e.renderSlot(f.$slots,"title"),e.createElementVNode("ul",Ks,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,h)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["toc__item",`toc__item--${b.level}`]),key:h},[e.createElementVNode("span",{class:e.normalizeClass(["heading",{selected:s.value===b.id}]),onClick:_=>m(b)},e.toDisplayString(b.text),11,Ws)],2))),128))])])]),_:3},512)])):e.createCommentVNode("",!0)}}),js={class:"o-emoji-select"},Zs={key:0},Xs={class:"groups o-scroll"},Qs={class:"items"},Js=["onClick"],ec={key:0,class:"groups-empty"},tc={class:"group-icons"},nc=["onClick"],ko=e.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,a=e.ref(null),l=e.ref(""),i=e.ref([]),s=e.ref([]),c=e.ref(0),d=e.computed(()=>l.value?i.value:o.items),u=e.computed(()=>{let v=!1;return d.value.map(b=>{v=v||b.emojis.length}),v});function p(){c.value=0,i.value=l.value?Bn.filterEmojiGroups(l.value):[]}function m(v){r("select",v)}function f(v,b){c.value=b,s.value[b].scrollIntoView({behavior:"instant",block:"start"})}return e.onMounted(()=>{}),(v,b)=>(e.openBlock(),e.createElementBlock("section",js,[t.enableSearch?(e.openBlock(),e.createElementBlock("div",Zs,[e.createVNode(e.unref(bt),{ref_key:"input",ref:a,modelValue:l.value,"onUpdate:modelValue":[b[0]||(b[0]=h=>l.value=h),p],type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("section",Xs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(h,_)=>{var y;return e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`group-${_}`,class:"group"},[e.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:s},e.toDisplayString(h.name),513),e.createElementVNode("section",Qs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.emojis,(E,g)=>(e.openBlock(),e.createElementBlock("div",{key:`item-${g}`},[e.createElementVNode("div",{class:"item",onClick:N=>m(E)},e.toDisplayString(E.emoji),9,Js)]))),128))])],512)),[[e.vShow,(y=h.emojis)==null?void 0:y.length]])}),128)),u.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ec,"没有记录"))]),e.createElementVNode("section",tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(h,_)=>(e.openBlock(),e.createBlock(e.unref(st),{key:`target-${_}`,delay:300},{trigger:e.withCtx(()=>{var y;return[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["item",{active:c.value===_}]),onClick:E=>f(h,_)},[e.createVNode(e.unref(U),{name:e.unref(Bn.emojiGroupIcons)[h.slug]},null,8,["name"])],10,nc),[[e.vShow,(y=h.emojis)==null?void 0:y.length]])]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(h.name),1)]),_:2},1024))),128))])]))}}),oo=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],oc={class:"selected-language"},rc={class:"header"},ac={class:"o-scroll"},ja=e.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),l=e.ref(),i=e.ref(),s=e.ref(""),c=e.ref(0),d=e.ref(""),u=e.computed(()=>s.value?oo.filter(_=>_.value.toLowerCase().indexOf(s.value.toLowerCase())>=0):oo),p=e.computed(()=>oo.find(_=>_.value===d.value));function m(_){_&&setTimeout(()=>{var y;(y=i.value)==null||y.focus(),c.value=0,window.addEventListener("keyup",h)},0)}function f(){var _;window.removeEventListener("keyup",h),(_=l.value)==null||_.setShow(!1)}function v(_){f(),d.value=_.value,r("select",_.value)}function b(){v(u.value[c.value])}function h(_){if(u.value.length>0){switch(_.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":b();break}c.value>=u.value.length&&(c.value=0),c.value<0&&(c.value=u.value.length-1)}else c.value=0}return e.onMounted(()=>{d.value=o.language}),(_,y)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:l,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":m},{trigger:e.withCtx(()=>[e.createVNode(e.unref(he),{class:"o-dropdown-btn"},{default:e.withCtx(()=>{var E;return[e.createElementVNode("span",oc,e.toDisplayString((E=p.value)==null?void 0:E.label),1),e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:e.withCtx(()=>[e.createElementVNode("header",rc,[e.createVNode(e.unref(bt),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=E=>s.value=E),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),e.createElementVNode("section",ac,[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(E,g)=>(e.openBlock(),e.createBlock(e.unref(ze),{key:g,onClick:N=>v(E),class:e.normalizeClass({"is-active":E.value===d.value,"is-select":g===c.value})},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:E.icon},null,8,["name"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(E.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),ic={class:"o-media-input"},lc={class:"fields"},sc={class:"actions"},pr=e.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),l=e.ref(),i=e.ref(""),s=e.ref("");function c(){return s.value?(i.value="null",!0):(i.value="error",!1)}function d(){c()&&r("input",s.value)}return e.onMounted(()=>{s.value=o.val,setTimeout(()=>{var u;(u=l.value)==null||u.focus()},0)}),(u,p)=>(e.openBlock(),e.createElementBlock("section",ic,[e.createElementVNode("section",lc,[p[1]||(p[1]=e.createElementVNode("div",{class:"o-media-title"},"Link",-1)),e.createVNode(e.unref(bt),{ref_key:"input",ref:l,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=m=>s.value=m),status:i.value,type:"text",autofocus:"",clearable:"",onEnter:d},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),e.createElementVNode("footer",sc,[e.createVNode(e.unref(he),{type:"info",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.ok")),1)]),_:1})])]))}}),cc={class:"o-meta-input"},uc={class:"header"},dc={class:"title"},pc={class:"fields"},fc={class:"actions"},yo=e.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Q(),l=e.ref(null),i=e.ref("");function s(){console.log("confirm",i.value),r("confirm",i.value)}return e.onMounted(()=>{i.value=o.val,setTimeout(()=>{var c;(c=l.value)==null||c.focus()},0)}),(c,d)=>(e.openBlock(),e.createElementBlock("section",cc,[e.createElementVNode("section",uc,[e.createElementVNode("div",dc,e.toDisplayString(t.title),1),e.createElementVNode("div",null,[e.renderSlot(c.$slots,"header-right")])]),e.createElementVNode("section",pc,[e.createVNode(e.unref(bt),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),type:"text",autofocus:"",clearable:"",onEnter:s},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),e.createElementVNode("footer",fc,[e.createVNode(e.unref(he),{type:"tertiary",onClick:d[1]||(d[1]=u=>r("cancel"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.cancel")),1)]),_:1}),e.createVNode(e.unref(he),{type:"info",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.ok")),1)]),_:1})])]))}}),U=e.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["o-icon",{small:t.small}]),style:e.normalizeStyle({color:t.color})},[e.createElementVNode("i",{class:e.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}});var je="top",it="bottom",lt="right",Ze="left",fr="auto",$n=[je,it,lt,Ze],gn="start",Mn="end",mc="clippingParents",Za="viewport",Cn="popper",gc="reference",zr=$n.reduce(function(t,n){return t.concat([n+"-"+gn,n+"-"+Mn])},[]),Xa=[].concat($n,[fr]).reduce(function(t,n){return t.concat([n,n+"-"+gn,n+"-"+Mn])},[]),bc="beforeRead",vc="read",hc="afterRead",_c="beforeMain",kc="main",yc="afterMain",Ec="beforeWrite",wc="write",xc="afterWrite",Nc=[bc,vc,hc,_c,kc,yc,Ec,wc,xc];function At(t){return t?(t.nodeName||"").toLowerCase():null}function nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function Qt(t){var n=nt(t).Element;return t instanceof n||t instanceof Element}function at(t){var n=nt(t).HTMLElement;return t instanceof n||t instanceof HTMLElement}function mr(t){if(typeof ShadowRoot>"u")return!1;var n=nt(t).ShadowRoot;return t instanceof n||t instanceof ShadowRoot}function Cc(t){var n=t.state;Object.keys(n.elements).forEach(function(o){var r=n.styles[o]||{},a=n.attributes[o]||{},l=n.elements[o];!at(l)||!At(l)||(Object.assign(l.style,r),Object.keys(a).forEach(function(i){var s=a[i];s===!1?l.removeAttribute(i):l.setAttribute(i,s===!0?"":s)}))})}function Sc(t){var n=t.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow),function(){Object.keys(n.elements).forEach(function(r){var a=n.elements[r],l=n.attributes[r]||{},i=Object.keys(n.styles.hasOwnProperty(r)?n.styles[r]:o[r]),s=i.reduce(function(c,d){return c[d]="",c},{});!at(a)||!At(a)||(Object.assign(a.style,s),Object.keys(l).forEach(function(c){a.removeAttribute(c)}))})}}const Qa={name:"applyStyles",enabled:!0,phase:"write",fn:Cc,effect:Sc,requires:["computeStyles"]};function St(t){return t.split("-")[0]}var Yt=Math.max,io=Math.min,bn=Math.round;function Xo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(n){return n.brand+"/"+n.version}).join(" "):navigator.userAgent}function Ja(){return!/^((?!chrome|android).)*safari/i.test(Xo())}function vn(t,n,o){n===void 0&&(n=!1),o===void 0&&(o=!1);var r=t.getBoundingClientRect(),a=1,l=1;n&&at(t)&&(a=t.offsetWidth>0&&bn(r.width)/t.offsetWidth||1,l=t.offsetHeight>0&&bn(r.height)/t.offsetHeight||1);var i=Qt(t)?nt(t):window,s=i.visualViewport,c=!Ja()&&o,d=(r.left+(c&&s?s.offsetLeft:0))/a,u=(r.top+(c&&s?s.offsetTop:0))/l,p=r.width/a,m=r.height/l;return{width:p,height:m,top:u,right:d+p,bottom:u+m,left:d,x:d,y:u}}function gr(t){var n=vn(t),o=t.offsetWidth,r=t.offsetHeight;return Math.abs(n.width-o)<=1&&(o=n.width),Math.abs(n.height-r)<=1&&(r=n.height),{x:t.offsetLeft,y:t.offsetTop,width:o,height:r}}function ei(t,n){var o=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(o&&mr(o)){var r=n;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Vt(t){return nt(t).getComputedStyle(t)}function Tc(t){return["table","td","th"].indexOf(At(t))>=0}function qt(t){return((Qt(t)?t.ownerDocument:t.document)||window.document).documentElement}function Eo(t){return At(t)==="html"?t:t.assignedSlot||t.parentNode||(mr(t)?t.host:null)||qt(t)}function Hr(t){return!at(t)||Vt(t).position==="fixed"?null:t.offsetParent}function Oc(t){var n=/firefox/i.test(Xo()),o=/Trident/i.test(Xo());if(o&&at(t)){var r=Vt(t);if(r.position==="fixed")return null}var a=Eo(t);for(mr(a)&&(a=a.host);at(a)&&["html","body"].indexOf(At(a))<0;){var l=Vt(a);if(l.transform!=="none"||l.perspective!=="none"||l.contain==="paint"||["transform","perspective"].indexOf(l.willChange)!==-1||n&&l.willChange==="filter"||n&&l.filter&&l.filter!=="none")return a;a=a.parentNode}return null}function Pn(t){for(var n=nt(t),o=Hr(t);o&&Tc(o)&&Vt(o).position==="static";)o=Hr(o);return o&&(At(o)==="html"||At(o)==="body"&&Vt(o).position==="static")?n:o||Oc(t)||n}function br(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Tn(t,n,o){return Yt(t,io(n,o))}function Ac(t,n,o){var r=Tn(t,n,o);return r>o?o:r}function ti(){return{top:0,right:0,bottom:0,left:0}}function ni(t){return Object.assign({},ti(),t)}function oi(t,n){return n.reduce(function(o,r){return o[r]=t,o},{})}var Bc=function(n,o){return n=typeof n=="function"?n(Object.assign({},o.rects,{placement:o.placement})):n,ni(typeof n!="number"?n:oi(n,$n))};function Mc(t){var n,o=t.state,r=t.name,a=t.options,l=o.elements.arrow,i=o.modifiersData.popperOffsets,s=St(o.placement),c=br(s),d=[Ze,lt].indexOf(s)>=0,u=d?"height":"width";if(!(!l||!i)){var p=Bc(a.padding,o),m=gr(l),f=c==="y"?je:Ze,v=c==="y"?it:lt,b=o.rects.reference[u]+o.rects.reference[c]-i[c]-o.rects.popper[u],h=i[c]-o.rects.reference[c],_=Pn(l),y=_?c==="y"?_.clientHeight||0:_.clientWidth||0:0,E=b/2-h/2,g=p[f],N=y-m[u]-p[v],x=y/2-m[u]/2+E,I=Tn(g,x,N),L=c;o.modifiersData[r]=(n={},n[L]=I,n.centerOffset=I-x,n)}}function Rc(t){var n=t.state,o=t.options,r=o.element,a=r===void 0?"[data-popper-arrow]":r;a!=null&&(typeof a=="string"&&(a=n.elements.popper.querySelector(a),!a)||ei(n.elements.popper,a)&&(n.elements.arrow=a))}const Ic={name:"arrow",enabled:!0,phase:"main",fn:Mc,effect:Rc,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function hn(t){return t.split("-")[1]}var Dc={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Lc(t,n){var o=t.x,r=t.y,a=n.devicePixelRatio||1;return{x:bn(o*a)/a||0,y:bn(r*a)/a||0}}function qr(t){var n,o=t.popper,r=t.popperRect,a=t.placement,l=t.variation,i=t.offsets,s=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,p=t.isFixed,m=i.x,f=m===void 0?0:m,v=i.y,b=v===void 0?0:v,h=typeof u=="function"?u({x:f,y:b}):{x:f,y:b};f=h.x,b=h.y;var _=i.hasOwnProperty("x"),y=i.hasOwnProperty("y"),E=Ze,g=je,N=window;if(d){var x=Pn(o),I="clientHeight",L="clientWidth";if(x===nt(o)&&(x=qt(o),Vt(x).position!=="static"&&s==="absolute"&&(I="scrollHeight",L="scrollWidth")),x=x,a===je||(a===Ze||a===lt)&&l===Mn){g=it;var T=p&&x===N&&N.visualViewport?N.visualViewport.height:x[I];b-=T-r.height,b*=c?1:-1}if(a===Ze||(a===je||a===it)&&l===Mn){E=lt;var P=p&&x===N&&N.visualViewport?N.visualViewport.width:x[L];f-=P-r.width,f*=c?1:-1}}var Z=Object.assign({position:s},d&&Dc),O=u===!0?Lc({x:f,y:b},nt(o)):{x:f,y:b};if(f=O.x,b=O.y,c){var M;return Object.assign({},Z,(M={},M[g]=y?"0":"",M[E]=_?"0":"",M.transform=(N.devicePixelRatio||1)<=1?"translate("+f+"px, "+b+"px)":"translate3d("+f+"px, "+b+"px, 0)",M))}return Object.assign({},Z,(n={},n[g]=y?b+"px":"",n[E]=_?f+"px":"",n.transform="",n))}function Vc(t){var n=t.state,o=t.options,r=o.gpuAcceleration,a=r===void 0?!0:r,l=o.adaptive,i=l===void 0?!0:l,s=o.roundOffsets,c=s===void 0?!0:s,d={placement:St(n.placement),variation:hn(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:a,isFixed:n.options.strategy==="fixed"};n.modifiersData.popperOffsets!=null&&(n.styles.popper=Object.assign({},n.styles.popper,qr(Object.assign({},d,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:i,roundOffsets:c})))),n.modifiersData.arrow!=null&&(n.styles.arrow=Object.assign({},n.styles.arrow,qr(Object.assign({},d,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})}const $c={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Vc,data:{}};var Wn={passive:!0};function Pc(t){var n=t.state,o=t.instance,r=t.options,a=r.scroll,l=a===void 0?!0:a,i=r.resize,s=i===void 0?!0:i,c=nt(n.elements.popper),d=[].concat(n.scrollParents.reference,n.scrollParents.popper);return l&&d.forEach(function(u){u.addEventListener("scroll",o.update,Wn)}),s&&c.addEventListener("resize",o.update,Wn),function(){l&&d.forEach(function(u){u.removeEventListener("scroll",o.update,Wn)}),s&&c.removeEventListener("resize",o.update,Wn)}}const Fc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Pc,data:{}};var Uc={left:"right",right:"left",bottom:"top",top:"bottom"};function ro(t){return t.replace(/left|right|bottom|top/g,function(n){return Uc[n]})}var zc={start:"end",end:"start"};function Gr(t){return t.replace(/start|end/g,function(n){return zc[n]})}function vr(t){var n=nt(t),o=n.pageXOffset,r=n.pageYOffset;return{scrollLeft:o,scrollTop:r}}function hr(t){return vn(qt(t)).left+vr(t).scrollLeft}function Hc(t,n){var o=nt(t),r=qt(t),a=o.visualViewport,l=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){l=a.width,i=a.height;var d=Ja();(d||!d&&n==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}return{width:l,height:i,x:s+hr(t),y:c}}function qc(t){var n,o=qt(t),r=vr(t),a=(n=t.ownerDocument)==null?void 0:n.body,l=Yt(o.scrollWidth,o.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),i=Yt(o.scrollHeight,o.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),s=-r.scrollLeft+hr(t),c=-r.scrollTop;return Vt(a||o).direction==="rtl"&&(s+=Yt(o.clientWidth,a?a.clientWidth:0)-l),{width:l,height:i,x:s,y:c}}function _r(t){var n=Vt(t),o=n.overflow,r=n.overflowX,a=n.overflowY;return/auto|scroll|overlay|hidden/.test(o+a+r)}function ri(t){return["html","body","#document"].indexOf(At(t))>=0?t.ownerDocument.body:at(t)&&_r(t)?t:ri(Eo(t))}function On(t,n){var o;n===void 0&&(n=[]);var r=ri(t),a=r===((o=t.ownerDocument)==null?void 0:o.body),l=nt(r),i=a?[l].concat(l.visualViewport||[],_r(r)?r:[]):r,s=n.concat(i);return a?s:s.concat(On(Eo(i)))}function Qo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Gc(t,n){var o=vn(t,!1,n==="fixed");return o.top=o.top+t.clientTop,o.left=o.left+t.clientLeft,o.bottom=o.top+t.clientHeight,o.right=o.left+t.clientWidth,o.width=t.clientWidth,o.height=t.clientHeight,o.x=o.left,o.y=o.top,o}function Kr(t,n,o){return n===Za?Qo(Hc(t,o)):Qt(n)?Gc(n,o):Qo(qc(qt(t)))}function Kc(t){var n=On(Eo(t)),o=["absolute","fixed"].indexOf(Vt(t).position)>=0,r=o&&at(t)?Pn(t):t;return Qt(r)?n.filter(function(a){return Qt(a)&&ei(a,r)&&At(a)!=="body"}):[]}function Wc(t,n,o,r){var a=n==="clippingParents"?Kc(t):[].concat(n),l=[].concat(a,[o]),i=l[0],s=l.reduce(function(c,d){var u=Kr(t,d,r);return c.top=Yt(u.top,c.top),c.right=io(u.right,c.right),c.bottom=io(u.bottom,c.bottom),c.left=Yt(u.left,c.left),c},Kr(t,i,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function ai(t){var n=t.reference,o=t.element,r=t.placement,a=r?St(r):null,l=r?hn(r):null,i=n.x+n.width/2-o.width/2,s=n.y+n.height/2-o.height/2,c;switch(a){case je:c={x:i,y:n.y-o.height};break;case it:c={x:i,y:n.y+n.height};break;case lt:c={x:n.x+n.width,y:s};break;case Ze:c={x:n.x-o.width,y:s};break;default:c={x:n.x,y:n.y}}var d=a?br(a):null;if(d!=null){var u=d==="y"?"height":"width";switch(l){case gn:c[d]=c[d]-(n[u]/2-o[u]/2);break;case Mn:c[d]=c[d]+(n[u]/2-o[u]/2);break}}return c}function Rn(t,n){n===void 0&&(n={});var o=n,r=o.placement,a=r===void 0?t.placement:r,l=o.strategy,i=l===void 0?t.strategy:l,s=o.boundary,c=s===void 0?mc:s,d=o.rootBoundary,u=d===void 0?Za:d,p=o.elementContext,m=p===void 0?Cn:p,f=o.altBoundary,v=f===void 0?!1:f,b=o.padding,h=b===void 0?0:b,_=ni(typeof h!="number"?h:oi(h,$n)),y=m===Cn?gc:Cn,E=t.rects.popper,g=t.elements[v?y:m],N=Wc(Qt(g)?g:g.contextElement||qt(t.elements.popper),c,u,i),x=vn(t.elements.reference),I=ai({reference:x,element:E,placement:a}),L=Qo(Object.assign({},E,I)),T=m===Cn?L:x,P={top:N.top-T.top+_.top,bottom:T.bottom-N.bottom+_.bottom,left:N.left-T.left+_.left,right:T.right-N.right+_.right},Z=t.modifiersData.offset;if(m===Cn&&Z){var O=Z[a];Object.keys(P).forEach(function(M){var V=[lt,it].indexOf(M)>=0?1:-1,F=[je,it].indexOf(M)>=0?"y":"x";P[M]+=O[F]*V})}return P}function Yc(t,n){n===void 0&&(n={});var o=n,r=o.placement,a=o.boundary,l=o.rootBoundary,i=o.padding,s=o.flipVariations,c=o.allowedAutoPlacements,d=c===void 0?Xa:c,u=hn(r),p=u?s?zr:zr.filter(function(v){return hn(v)===u}):$n,m=p.filter(function(v){return d.indexOf(v)>=0});m.length===0&&(m=p);var f=m.reduce(function(v,b){return v[b]=Rn(t,{placement:b,boundary:a,rootBoundary:l,padding:i})[St(b)],v},{});return Object.keys(f).sort(function(v,b){return f[v]-f[b]})}function jc(t){if(St(t)===fr)return[];var n=ro(t);return[Gr(t),n,Gr(n)]}function Zc(t){var n=t.state,o=t.options,r=t.name;if(!n.modifiersData[r]._skip){for(var a=o.mainAxis,l=a===void 0?!0:a,i=o.altAxis,s=i===void 0?!0:i,c=o.fallbackPlacements,d=o.padding,u=o.boundary,p=o.rootBoundary,m=o.altBoundary,f=o.flipVariations,v=f===void 0?!0:f,b=o.allowedAutoPlacements,h=n.options.placement,_=St(h),y=_===h,E=c||(y||!v?[ro(h)]:jc(h)),g=[h].concat(E).reduce(function(Se,_e){return Se.concat(St(_e)===fr?Yc(n,{placement:_e,boundary:u,rootBoundary:p,padding:d,flipVariations:v,allowedAutoPlacements:b}):_e)},[]),N=n.rects.reference,x=n.rects.popper,I=new Map,L=!0,T=g[0],P=0;P<g.length;P++){var Z=g[P],O=St(Z),M=hn(Z)===gn,V=[je,it].indexOf(O)>=0,F=V?"width":"height",H=Rn(n,{placement:Z,boundary:u,rootBoundary:p,altBoundary:m,padding:d}),te=V?M?lt:Ze:M?it:je;N[F]>x[F]&&(te=ro(te));var B=ro(te),D=[];if(l&&D.push(H[O]<=0),s&&D.push(H[te]<=0,H[B]<=0),D.every(function(Se){return Se})){T=Z,L=!1;break}I.set(Z,D)}if(L)for(var X=v?3:1,re=function(_e){var W=g.find(function(se){var ce=I.get(se);if(ce)return ce.slice(0,_e).every(function(Oe){return Oe})});if(W)return T=W,"break"},fe=X;fe>0;fe--){var xe=re(fe);if(xe==="break")break}n.placement!==T&&(n.modifiersData[r]._skip=!0,n.placement=T,n.reset=!0)}}const Xc={name:"flip",enabled:!0,phase:"main",fn:Zc,requiresIfExists:["offset"],data:{_skip:!1}};function Wr(t,n,o){return o===void 0&&(o={x:0,y:0}),{top:t.top-n.height-o.y,right:t.right-n.width+o.x,bottom:t.bottom-n.height+o.y,left:t.left-n.width-o.x}}function Yr(t){return[je,lt,it,Ze].some(function(n){return t[n]>=0})}function Qc(t){var n=t.state,o=t.name,r=n.rects.reference,a=n.rects.popper,l=n.modifiersData.preventOverflow,i=Rn(n,{elementContext:"reference"}),s=Rn(n,{altBoundary:!0}),c=Wr(i,r),d=Wr(s,a,l),u=Yr(c),p=Yr(d);n.modifiersData[o]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}const Jc={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Qc};function eu(t,n,o){var r=St(t),a=[Ze,je].indexOf(r)>=0?-1:1,l=typeof o=="function"?o(Object.assign({},n,{placement:t})):o,i=l[0],s=l[1];return i=i||0,s=(s||0)*a,[Ze,lt].indexOf(r)>=0?{x:s,y:i}:{x:i,y:s}}function tu(t){var n=t.state,o=t.options,r=t.name,a=o.offset,l=a===void 0?[0,0]:a,i=Xa.reduce(function(u,p){return u[p]=eu(p,n.rects,l),u},{}),s=i[n.placement],c=s.x,d=s.y;n.modifiersData.popperOffsets!=null&&(n.modifiersData.popperOffsets.x+=c,n.modifiersData.popperOffsets.y+=d),n.modifiersData[r]=i}const nu={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tu};function ou(t){var n=t.state,o=t.name;n.modifiersData[o]=ai({reference:n.rects.reference,element:n.rects.popper,placement:n.placement})}const ru={name:"popperOffsets",enabled:!0,phase:"read",fn:ou,data:{}};function au(t){return t==="x"?"y":"x"}function iu(t){var n=t.state,o=t.options,r=t.name,a=o.mainAxis,l=a===void 0?!0:a,i=o.altAxis,s=i===void 0?!1:i,c=o.boundary,d=o.rootBoundary,u=o.altBoundary,p=o.padding,m=o.tether,f=m===void 0?!0:m,v=o.tetherOffset,b=v===void 0?0:v,h=Rn(n,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),_=St(n.placement),y=hn(n.placement),E=!y,g=br(_),N=au(g),x=n.modifiersData.popperOffsets,I=n.rects.reference,L=n.rects.popper,T=typeof b=="function"?b(Object.assign({},n.rects,{placement:n.placement})):b,P=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),Z=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,O={x:0,y:0};if(x){if(l){var M,V=g==="y"?je:Ze,F=g==="y"?it:lt,H=g==="y"?"height":"width",te=x[g],B=te+h[V],D=te-h[F],X=f?-L[H]/2:0,re=y===gn?I[H]:L[H],fe=y===gn?-L[H]:-I[H],xe=n.elements.arrow,Se=f&&xe?gr(xe):{width:0,height:0},_e=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:ti(),W=_e[V],se=_e[F],ce=Tn(0,I[H],Se[H]),Oe=E?I[H]/2-X-ce-W-P.mainAxis:re-ce-W-P.mainAxis,Ae=E?-I[H]/2+X+ce+se+P.mainAxis:fe+ce+se+P.mainAxis,rt=n.elements.arrow&&Pn(n.elements.arrow),vt=rt?g==="y"?rt.clientTop||0:rt.clientLeft||0:0,ct=(M=Z==null?void 0:Z[g])!=null?M:0,ut=te+Oe-ct-vt,ht=te+Ae-ct,ue=Tn(f?io(B,ut):B,te,f?Yt(D,ht):D);x[g]=ue,O[g]=ue-te}if(s){var Ke,We=g==="x"?je:Ze,_t=g==="x"?it:lt,Pe=x[N],Xe=N==="y"?"height":"width",kt=Pe+h[We],Qe=Pe-h[_t],He=[je,Ze].indexOf(_)!==-1,It=(Ke=Z==null?void 0:Z[N])!=null?Ke:0,Fe=He?kt:Pe-I[Xe]-L[Xe]-It+P.altAxis,dt=He?Pe+I[Xe]+L[Xe]-It-P.altAxis:Qe,yt=f&&He?Ac(Fe,Pe,dt):Tn(f?Fe:kt,Pe,f?dt:Qe);x[N]=yt,O[N]=yt-Pe}n.modifiersData[r]=O}}const lu={name:"preventOverflow",enabled:!0,phase:"main",fn:iu,requiresIfExists:["offset"]};function su(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function cu(t){return t===nt(t)||!at(t)?vr(t):su(t)}function uu(t){var n=t.getBoundingClientRect(),o=bn(n.width)/t.offsetWidth||1,r=bn(n.height)/t.offsetHeight||1;return o!==1||r!==1}function du(t,n,o){o===void 0&&(o=!1);var r=at(n),a=at(n)&&uu(n),l=qt(n),i=vn(t,a,o),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!o)&&((At(n)!=="body"||_r(l))&&(s=cu(n)),at(n)?(c=vn(n,!0),c.x+=n.clientLeft,c.y+=n.clientTop):l&&(c.x=hr(l))),{x:i.left+s.scrollLeft-c.x,y:i.top+s.scrollTop-c.y,width:i.width,height:i.height}}function pu(t){var n=new Map,o=new Set,r=[];t.forEach(function(l){n.set(l.name,l)});function a(l){o.add(l.name);var i=[].concat(l.requires||[],l.requiresIfExists||[]);i.forEach(function(s){if(!o.has(s)){var c=n.get(s);c&&a(c)}}),r.push(l)}return t.forEach(function(l){o.has(l.name)||a(l)}),r}function fu(t){var n=pu(t);return Nc.reduce(function(o,r){return o.concat(n.filter(function(a){return a.phase===r}))},[])}function mu(t){var n;return function(){return n||(n=new Promise(function(o){Promise.resolve().then(function(){n=void 0,o(t())})})),n}}function gu(t){var n=t.reduce(function(o,r){var a=o[r.name];return o[r.name]=a?Object.assign({},a,r,{options:Object.assign({},a.options,r.options),data:Object.assign({},a.data,r.data)}):r,o},{});return Object.keys(n).map(function(o){return n[o]})}var jr={placement:"bottom",modifiers:[],strategy:"absolute"};function Zr(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return!n.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function bu(t){t===void 0&&(t={});var n=t,o=n.defaultModifiers,r=o===void 0?[]:o,a=n.defaultOptions,l=a===void 0?jr:a;return function(s,c,d){d===void 0&&(d=l);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},jr,l),modifiersData:{},elements:{reference:s,popper:c},attributes:{},styles:{}},p=[],m=!1,f={state:u,setOptions:function(_){var y=typeof _=="function"?_(u.options):_;b(),u.options=Object.assign({},l,u.options,y),u.scrollParents={reference:Qt(s)?On(s):s.contextElement?On(s.contextElement):[],popper:On(c)};var E=fu(gu([].concat(r,u.options.modifiers)));return u.orderedModifiers=E.filter(function(g){return g.enabled}),v(),f.update()},forceUpdate:function(){if(!m){var _=u.elements,y=_.reference,E=_.popper;if(Zr(y,E)){u.rects={reference:du(y,Pn(E),u.options.strategy==="fixed"),popper:gr(E)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(P){return u.modifiersData[P.name]=Object.assign({},P.data)});for(var g=0;g<u.orderedModifiers.length;g++){if(u.reset===!0){u.reset=!1,g=-1;continue}var N=u.orderedModifiers[g],x=N.fn,I=N.options,L=I===void 0?{}:I,T=N.name;typeof x=="function"&&(u=x({state:u,options:L,name:T,instance:f})||u)}}}},update:mu(function(){return new Promise(function(h){f.forceUpdate(),h(u)})}),destroy:function(){b(),m=!0}};if(!Zr(s,c))return f;f.setOptions(d).then(function(h){!m&&d.onFirstUpdate&&d.onFirstUpdate(h)});function v(){u.orderedModifiers.forEach(function(h){var _=h.name,y=h.options,E=y===void 0?{}:y,g=h.effect;if(typeof g=="function"){var N=g({state:u,name:_,instance:f,options:E}),x=function(){};p.push(N||x)}})}function b(){p.forEach(function(h){return h()}),p=[]}return f}}var vu=[Fc,ru,$c,Qa,nu,Xc,lu,Ic,Jc],hu=bu({defaultModifiers:vu}),_u="tippy-box",ii="tippy-content",ku="tippy-backdrop",li="tippy-arrow",si="tippy-svg-arrow",Kt={passive:!0,capture:!0},ci=function(){return document.body};function yu(t,n){return{}.hasOwnProperty.call(t,n)}function $o(t,n,o){if(Array.isArray(t)){var r=t[n];return r??(Array.isArray(o)?o[n]:o)}return t}function kr(t,n){var o={}.toString.call(t);return o.indexOf("[object")===0&&o.indexOf(n+"]")>-1}function ui(t,n){return typeof t=="function"?t.apply(void 0,n):t}function Xr(t,n){if(n===0)return t;var o;return function(r){clearTimeout(o),o=setTimeout(function(){t(r)},n)}}function Eu(t,n){var o=Object.assign({},t);return n.forEach(function(r){delete o[r]}),o}function wu(t){return t.split(/\s+/).filter(Boolean)}function ln(t){return[].concat(t)}function Qr(t,n){t.indexOf(n)===-1&&t.push(n)}function xu(t){return t.filter(function(n,o){return t.indexOf(n)===o})}function Nu(t){return t.split("-")[0]}function lo(t){return[].slice.call(t)}function Jr(t){return Object.keys(t).reduce(function(n,o){return t[o]!==void 0&&(n[o]=t[o]),n},{})}function An(){return document.createElement("div")}function In(t){return["Element","Fragment"].some(function(n){return kr(t,n)})}function Cu(t){return kr(t,"NodeList")}function Su(t){return kr(t,"MouseEvent")}function Tu(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function Ou(t){return In(t)?[t]:Cu(t)?lo(t):Array.isArray(t)?t:lo(document.querySelectorAll(t))}function Po(t,n){t.forEach(function(o){o&&(o.style.transitionDuration=n+"ms")})}function ea(t,n){t.forEach(function(o){o&&o.setAttribute("data-state",n)})}function Au(t){var n,o=ln(t),r=o[0];return r!=null&&(n=r.ownerDocument)!=null&&n.body?r.ownerDocument:document}function Bu(t,n){var o=n.clientX,r=n.clientY;return t.every(function(a){var l=a.popperRect,i=a.popperState,s=a.props,c=s.interactiveBorder,d=Nu(i.placement),u=i.modifiersData.offset;if(!u)return!0;var p=d==="bottom"?u.top.y:0,m=d==="top"?u.bottom.y:0,f=d==="right"?u.left.x:0,v=d==="left"?u.right.x:0,b=l.top-r+p>c,h=r-l.bottom-m>c,_=l.left-o+f>c,y=o-l.right-v>c;return b||h||_||y})}function Fo(t,n,o){var r=n+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(a){t[r](a,o)})}function ta(t,n){for(var o=n;o;){var r;if(t.contains(o))return!0;o=o.getRootNode==null||(r=o.getRootNode())==null?void 0:r.host}return!1}var Nt={isTouch:!1},na=0;function Mu(){Nt.isTouch||(Nt.isTouch=!0,window.performance&&document.addEventListener("mousemove",di))}function di(){var t=performance.now();t-na<20&&(Nt.isTouch=!1,document.removeEventListener("mousemove",di)),na=t}function Ru(){var t=document.activeElement;if(Tu(t)){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}function Iu(){document.addEventListener("touchstart",Mu,Kt),window.addEventListener("blur",Ru)}var Du=typeof window<"u"&&typeof document<"u",Lu=Du?!!window.msCrypto:!1;function an(t){var n=t==="destroy"?"n already-":" ";return[t+"() was called on a"+n+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function oa(t){var n=/[ \t]{2,}/g,o=/^[ \t]*/gm;return t.replace(n," ").replace(o,"").trim()}function Vu(t){return oa(`
4
+ **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("vue"),XT=require("openai"),YT=require("markdown-it"),QT=require("@yiitap/i18n"),Tl=require("@yiitap/util-emoji"),Nl=require("@tiptap/extension-mathematics"),yk=require("@tiptap/markdown"),ts=require("yjs"),ZT=require("@tiptap/extension-audio"),eN=require("katex"),by=require("lowlight"),cf=require("mermaid"),tN=require("@mermaid-js/layout-elk");function nN(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const re=nN(ts);function At(n){this.content=n}At.prototype={constructor:At,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new At(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new At(t)},addToStart:function(n,e){return new At([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new At(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new At(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=At.from(n),n.size?new At(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=At.from(n),n.size?new At(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=At.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};At.from=function(n){if(n instanceof At)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new At(e)};function bk(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=bk(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function vk(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=vk(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class _{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new _(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new _(o,r)}cutByIndex(e,t){return e==t?_.empty:e==0&&t==this.content.length?this:new _(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new _(r,i)}addToStart(e){return new _([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return bk(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return vk(this,e,t,o)}findIndex(e){if(e==0)return Ba(0,e);if(e==this.size)return Ba(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Ba(t+1,i):Ba(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return _.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new _(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new _(t||e,o)}static from(e){if(!e)return _.empty;if(e instanceof _)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new _([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}_.empty=new _([],0);const uf={index:0,offset:0};function Ba(n,e){return uf.index=n,uf.offset=e,uf}function Dc(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Dc(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Dc(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Fe=class hp{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Dc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hp.none;if(e instanceof hp)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};Fe.none=[];class _c extends Error{}class F{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=kk(this.content,e+this.openStart,t);return o&&new F(o,this.openStart,this.openEnd)}removeBetween(e,t){return new F(wk(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return F.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new F(_.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new F(e,o,r)}}F.empty=new F(_.empty,0,0);function wk(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(wk(i.content,e-r-1,t-r-1)))}function kk(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=kk(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function oN(n,e,t){if(t.openStart>n.depth)throw new _c("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new _c("Inconsistent open depths");return xk(n,e,t,0)}function xk(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=xk(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return ni(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=rN(t,n);return ni(i,Sk(n,s,l,e,o))}else return ni(i,Ic(n,e,o))}function Ck(n,e){if(!e.type.compatibleContent(n.type))throw new _c("Cannot join "+e.type.name+" onto "+n.type.name)}function mp(n,e,t){let o=n.node(t);return Ck(o,e.node(t)),o}function ti(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ll(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ti(n.nodeAfter,o),i++));for(let l=i;l<s;l++)ti(r.child(l),o);e&&e.depth==t&&e.textOffset&&ti(e.nodeBefore,o)}function ni(n,e){return n.type.checkContent(e),n.copy(e)}function Sk(n,e,t,o,r){let i=n.depth>r&&mp(n,e,r+1),s=o.depth>r&&mp(t,o,r+1),l=[];return ll(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(Ck(i,s),ti(ni(i,Sk(n,e,t,o,r+1)),l)):(i&&ti(ni(i,Ic(n,e,r+1)),l),ll(e,t,r,l),s&&ti(ni(s,Ic(t,o,r+1)),l)),ll(o,null,r,l),new _(l)}function Ic(n,e,t){let o=[];if(ll(null,n,t,o),n.depth>t){let r=mp(n,e,t+1);ti(ni(r,Ic(n,e,t+1)),o)}return ll(e,null,t,o),new _(o)}function rN(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)r=e.node(i).copy(_.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Al{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Fe.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Lc(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new Al(t,o,i)}static resolveCached(e,t){let o=vy.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else vy.set(e,o=new iN);let r=o.elts[o.i]=Al.resolve(e,t);return o.i=(o.i+1)%sN,r}}class iN{constructor(){this.elts=[],this.i=0}}const sN=12,vy=new WeakMap;class Lc{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const lN=Object.create(null);let Bn=class gp{constructor(e,t,o,r=Fe.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||_.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&Dc(this.attrs,t||e.defaultAttrs||lN)&&Fe.sameSet(this.marks,o||Fe.none)}copy(e=null){return e==this.content?this:new gp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new gp(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return F.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),u=r.node(s).content.cut(r.pos-l,i.pos-l);return new F(u,r.depth-s,i.depth-s)}replace(e,t,o){return oN(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return Al.resolveCached(this,e)}resolveNoCache(e){return Al.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ek(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=_.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Fe.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Fe.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=_.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Bn.prototype.text=void 0;class Pc extends Bn{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ek(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Pc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Pc(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ek(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class mi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new aN(e,t);if(o.next==null)return mi.empty;let r=Mk(o);o.next&&o.err("Unexpected trailing text");let i=mN(hN(r));return gN(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return _.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
5
+ `)}}mi.empty=new mi(!0);class aN{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Mk(n){let e=[];do e.push(cN(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cN(n){let e=[];do e.push(uN(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function uN(n){let e=pN(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=dN(n,e);else break;return e}function wy(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function dN(n,e){let t=wy(n),o=t;return n.eat(",")&&(n.next!="}"?o=wy(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function fN(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function pN(n){if(n.eat("(")){let e=Mk(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=fN(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function hN(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Tk(n,e){return e-n}function ky(n,e){let t=[];return o(e),t.sort(Tk);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function mN(n){let e=Object.create(null);return t(ky(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);ky(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new mi(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Tk);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function gN(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Nk(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function Ak(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function Ok(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function $k(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new bN(n,o,e[o]);return t}let xy=class Rk{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=$k(e,o.attrs),this.defaultAttrs=Nk(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ak(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Bn(this,this.computeAttrs(e),_.from(t),Fe.setFrom(o))}createChecked(e=null,t,o){return t=_.from(t),this.checkContent(t),new Bn(this,this.computeAttrs(e),t,Fe.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=_.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(_.empty,!0);return i?new Bn(this,e,t.append(i),Fe.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ok(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:Fe.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Rk(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function yN(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class bN{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?yN(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class od{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=$k(e,r.attrs),this.excluded=null;let i=Nk(this.attrs);this.instance=i?new Fe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Fe(this,Ak(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new od(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ok(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Bk=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=At.from(e.nodes),t.marks=At.from(e.marks||{}),this.nodes=xy.compile(this.spec.nodes,this),this.marks=od.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=mi.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Cy(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Cy(this,s.split(" "))}this.nodeFromJSON=r=>Bn.fromJSON(this,r),this.markFromJSON=r=>Fe.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof xy){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new Pc(o,o.defaultAttrs,e,Fe.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function Cy(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function vN(n){return n.tag!=null}function wN(n){return n.style!=null}let rs=class yp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(vN(r))this.tags.push(r);else if(wN(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new Ey(this,t,!1);return o.addAll(e,Fe.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Ey(this,t,!0);return o.addAll(e,Fe.none,t.from,t.to),F.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(CN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=My(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=My(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new yp(e,yp.schemaRules(e)))}};const Dk={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},kN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},_k={ol:!0,ul:!0},Ol=1,bp=2,al=4;function Sy(n,e,t){return e!=null?(e?Ol:0)|(e==="full"?bp:0):n&&n.whitespace=="pre"?Ol|bp:t&~al}class Da{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=Fe.none,this.match=i||(s&al?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(_.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ol)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=_.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(_.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Dk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Ey{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=Sy(null,t.preserveWhitespace,0)|(o?al:0);r?i=new Da(r.type,r.attrs,Fe.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Da(null,null,Fe.none,!0,null,s):i=new Da(e.schema.topNodeType,null,Fe.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&bp?"full":this.localPreserveWS||(r.options&Ol)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
6
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;_k.hasOwnProperty(s)&&this.parser.normalizeLists&&xN(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:kN.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(Dk.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Fe.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Ty(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Sy(e,i,s.options);s.options&al&&s.content.length==0&&(l|=al);let a=Fe.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):Ty(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Da(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ol)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function xN(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&_k.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function CN(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function My(n){let e={};for(let t in n)e[t]=n[t];return e}function Ty(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class $i{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=df(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=dc(df(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&dc(df(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return dc(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new $i(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ny(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Ny(e.marks)}}function Ny(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function df(n){return n.document||window.document}const Ay=new WeakMap;function SN(n){let e=Ay.get(n);return e===void 0&&Ay.set(n,e=EN(n)),e}function EN(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function dc(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=SN(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=dc(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Ik=65535,Lk=Math.pow(2,16);function MN(n,e){return n+e*Lk}function Oy(n){return n&Ik}function TN(n){return(n-(n&Ik))/Lk}const Pk=1,Vk=2,fc=4,zk=8;class vp{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&zk)>0}get deletedBefore(){return(this.delInfo&(Pk|fc))>0}get deletedAfter(){return(this.delInfo&(Vk|fc))>0}get deletedAcross(){return(this.delInfo&fc)>0}}class yn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yn.empty)return yn.empty}recover(e){let t=0,o=Oy(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+TN(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:MN(l/3,e-a),g=e==a?Vk:e==f?Pk:fc;return(t<0?e!=a:e!=f)&&(g|=zk),new vp(h,g,m)}r+=d-u}return o?e+r:new vp(e+r,0,null)}touches(e,t){let o=0,r=Oy(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new yn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yn.empty:new yn(e<0?[0,-e,0]:[0,0,e])}}yn.empty=new yn([]);class $l{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new $l(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new $l;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new vp(e,r,null)}}const ff=Object.create(null);class Jt{getMap(){return yn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=ff[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in ff)throw new RangeError("Duplicate use of step JSON ID "+e);return ff[e]=t,t.prototype.jsonID=e,t}}class dt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new dt(e,null)}static fail(e){return new dt(null,e)}static fromReplace(e,t,o,r){try{return dt.ok(e.replace(t,o,r))}catch(i){if(i instanceof _c)return dt.fail(i.message);throw i}}}function Qh(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Qh(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return _.fromArray(o)}class kr extends Jt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new F(Qh(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return dt.fromReplace(e,this.from,this.to,i)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new kr(t.pos,o.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}Jt.jsonID("addMark",kr);class qn extends Jt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new F(Qh(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return dt.fromReplace(e,this.from,this.to,o)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new qn(t.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qn(t.from,t.to,e.markFromJSON(t.mark))}}Jt.jsonID("removeMark",qn);class xr extends Jt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return dt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return dt.fromReplace(e,this.pos,this.pos+1,new F(_.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new xr(this.pos,t.marks[r]);return new xr(this.pos,this.mark)}}return new gi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xr(t.pos,e.markFromJSON(t.mark))}}Jt.jsonID("addNodeMark",xr);class gi extends Jt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return dt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return dt.fromReplace(e,this.pos,this.pos+1,new F(_.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new xr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new gi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new gi(t.pos,e.markFromJSON(t.mark))}}Jt.jsonID("removeNodeMark",gi);class wt extends Jt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&wp(e,this.from,this.to)?dt.fail("Structure replace would overwrite content"):dt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yn([this.from,this.to-this.from,this.slice.size])}invert(e){return new wt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new wt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wt(t.from,t.to,F.fromJSON(e,t.slice),!!t.structure)}}Jt.jsonID("replace",wt);class xt extends Jt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(wp(e,this.from,this.gapFrom)||wp(e,this.gapTo,this.to)))return dt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return dt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?dt.fromReplace(e,this.from,this.to,o):dt.fail("Content does not fit in gap")}getMap(){return new yn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new xt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new xt(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new xt(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}Jt.jsonID("replaceAround",xt);function wp(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function NN(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new qn(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new kr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function AN(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof od){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new qn(s.from,s.to,s.style)))}function Zh(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new wt(l,d,F.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new qn(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new F(_.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new wt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(_.empty,!0);n.replace(l,l,new F(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function ON(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ri(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let s=n.$from.node(o),l=n.$from.index(o)+r,a=n.$to.indexAfter(o)-i;if(o<n.depth&&s.canReplace(l,a,t))return o;if(o==0||s.type.spec.isolating||!ON(s,l,a))break;l&&(r=1),a<s.childCount&&(i=1)}return null}function $N(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=_.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=_.from(o.node(m).copy(d)),f++):a--;let p=_.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=_.from(r.node(m).copy(p)),h++):u++;n.step(new xt(a,u,s,l,new F(d.append(p),f,h),d.size-f,!0))}function em(n,e,t=null,o=n){let r=RN(n,e),i=r&&BN(o,e);return i?r.map($y).concat({type:e,attrs:t}).concat(i.map($y)):null}function $y(n){return{type:n,attrs:null}}function RN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function BN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let u=o;a&&u<r;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:s}function DN(n,e,t){let o=_.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=_.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new xt(r,i,r,i,new F(o,0,0),t.length,!0))}function _N(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&IN(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&Fk(n,s,l,i),Zh(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new xt(f,p,f+1,p-1,new F(_.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&Hk(n,s,l,i),!1}})}function Hk(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Fk(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
8
+ `))}})}function IN(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function LN(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new xt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new F(_.from(s),0,0),1,!0))}function vo(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function PN(n,e,t=1,o){let r=n.doc.resolve(e),i=_.empty,s=_.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=_.from(r.node(l).copy(i));let d=o&&o[u];s=_.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new wt(e,e,new F(i.append(s),t,t),!0))}function Pr(n,e){let t=n.resolve(e),o=t.index();return jk(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function VN(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function jk(n,e){return!!(n&&e&&!n.isLeaf&&VN(n,e))}function rd(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&jk(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function zN(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);Fk(n,d.node(),d.before(),l)}s.inlineContent&&Zh(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new wt(u,a.map(e+t,-1),F.empty,!0)),o===!0){let d=n.doc.resolve(u);Hk(n,d.node(),d.before(),n.steps.length)}return n}function HN(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Wk(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function id(n,e,t=e,o=F.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Uk(r,i,o)?new wt(e,t,o):new FN(r,i,o).fit()}function Uk(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class FN{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=_.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=_.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new F(i,s,l);return e>-1?new xt(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new wt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=pf(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(_.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=pf(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new F(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=pf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new F(Us(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new F(Us(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(qk(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=qs(this.placed,t,_.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?F.empty:new F(Us(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new F(Us(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!hf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=hf(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=hf(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=qs(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=qs(this.placed,this.depth,_.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(_.empty,!0);t.childCount&&(this.placed=qs(this.placed,this.frontier.length,t))}}function Us(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Us(n.firstChild.content,e-1,t)))}function qs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(qs(n.lastChild.content,e-1,t)))}function pf(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function qk(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,qk(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(_.empty,!0)))),n.copy(o)}function hf(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!jN(t,i.content,s)?l:null}function jN(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function WN(n){return n.spec.defining||n.spec.definingForContent}function UN(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Uk(r,i,o))return n.step(new wt(e,t,o));let s=Jk(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=WN(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),k=r.index(y-1);if(v.canReplaceWith(k,k,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new F(Kk(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function Kk(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Kk(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(_.empty,!0))}return n}function qN(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=HN(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new F(_.from(o),0,0))}function KN(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Jk(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function Jk(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class is extends Jt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return dt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return dt.fromReplace(e,this.pos,this.pos+1,new F(_.from(r),0,t.isLeaf?0:1))}getMap(){return yn.empty}invert(e){return new is(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new is(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new is(t.pos,t.attr,t.value)}}Jt.jsonID("attr",is);class Rl extends Jt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return dt.ok(o)}getMap(){return yn.empty}invert(e){return new Rl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Rl(t.attr,t.value)}}Jt.jsonID("docAttr",Rl);let ds=class extends Error{};ds=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};ds.prototype=Object.create(Error.prototype);ds.prototype.constructor=ds;ds.prototype.name="TransformError";class tm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $l}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ds(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=F.empty){let r=id(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new F(_.from(o),0,0))}delete(e,t){return this.replace(e,t,F.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return UN(this,e,t,o),this}replaceRangeWith(e,t,o){return qN(this,e,t,o),this}deleteRange(e,t){return KN(this,e,t),this}lift(e,t){return $N(this,e,t),this}join(e,t=1){return zN(this,e,t),this}wrap(e,t){return DN(this,e,t),this}setBlockType(e,t=e,o,r=null){return _N(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return LN(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new is(e,t,o)),this}setDocAttribute(e,t){return this.step(new Rl(e,t)),this}addNodeMark(e,t){return this.step(new xr(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof Fe)t.isInSet(o.marks)&&this.step(new gi(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new gi(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return PN(this,e,t,o),this}addMark(e,t,o){return NN(this,e,t,o),this}removeMark(e,t,o){return AN(this,e,t,o),this}clearIncompatible(e,t,o){return Zh(this,e,t,o),this}}const mf=Object.create(null);class se{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Gk(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=F.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?F.empty:t),l==0&&Dy(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),Dy(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new U(e):qi(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?qi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):qi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new on(e.node(0))}static atStart(e){return qi(e,e,0,0,1)||new on(e)}static atEnd(e){return qi(e,e,e.content.size,e.childCount,-1)||new on(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=mf[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in mf)throw new RangeError("Duplicate use of selection JSON ID "+e);return mf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return U.between(this.$anchor,this.$head).getBookmark()}}se.prototype.visible=!0;class Gk{constructor(e,t){this.$from=e,this.$to=t}}let Ry=!1;function By(n){!Ry&&!n.parent.inlineContent&&(Ry=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class U extends se{constructor(e,t=e){By(e),By(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return se.near(o);let r=e.resolve(t.map(this.anchor));return new U(r.parent.inlineContent?r:o,o)}replace(e,t=F.empty){if(super.replace(e,t),t==F.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof U&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new sd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new U(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=se.findFrom(t,o,!0)||se.findFrom(t,-o,!0);if(i)t=i.$head;else return se.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(se.findFrom(e,-o,!0)||se.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new U(e,t)}}se.jsonID("text",U);class sd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new sd(e.map(this.anchor),e.map(this.head))}resolve(e){return U.between(e.resolve(this.anchor),e.resolve(this.head))}}class Q extends se{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?se.near(i):new Q(i)}content(){return new F(_.from(this.node),0,0)}eq(e){return e instanceof Q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new nm(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Q(e.resolve(t.anchor))}static create(e,t){return new Q(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Q.prototype.visible=!1;se.jsonID("node",Q);class nm{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new sd(o,o):new nm(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Q.isSelectable(o)?new Q(t):se.near(t)}}class on extends se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=F.empty){if(t==F.empty){e.delete(0,e.doc.content.size);let o=se.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new on(e)}map(e){return new on(e)}eq(e){return e instanceof on}getBookmark(){return JN}}se.jsonID("all",on);const JN={map(){return this},resolve(n){return new on(n)}};function qi(n,e,t,o,r,i=!1){if(e.inlineContent)return U.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Q.isSelectable(l))return Q.create(n,t-(r<0?l.nodeSize:0))}else{let a=qi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function Dy(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof wt||r instanceof xt))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}const _y=1,_a=2,Iy=4;class GN extends tm{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|_y)&~_a,this.storedMarks=null,this}get selectionSet(){return(this.updated&_y)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_a,this}ensureMarks(e){return Fe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_a)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~_a,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Fe.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=o==t?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(se.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Iy,this}get scrolledIntoView(){return(this.updated&Iy)>0}}function Ly(n,e){return!e||!n?n:n.bind(e)}class Ks{constructor(e,t,o){this.name=e,this.init=Ly(t.init,o),this.apply=Ly(t.apply,o)}}const XN=[new Ks("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Ks("selection",{init(n,e){return n.selection||se.atStart(e.doc)},apply(n){return n.selection}}),new Ks("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Ks("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class gf{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=XN.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Ks(o.key,o.spec.state,o))})}}class ns{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=t){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=r?r[s].n:0,u=r?r[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,o);if(d&&o.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:t.length}:{state:this,n:0})}t.push(d),o=o.applyInner(d),i=!0}r&&(r[s]={state:o,n:t.length})}}if(!i)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ns(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new GN(this)}static create(e){let t=new gf(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new ns(t);for(let r=0;r<t.fields.length;r++)o[t.fields[r].name]=t.fields[r].init(e,o);return o}reconfigure(e){let t=new gf(this.schema,e.plugins),o=t.fields,r=new ns(t);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(t[o]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new gf(e.schema,e.plugins),i=new ns(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Bn.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=se.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=u.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Xk(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Xk(r,e,{})),t[o]=r}return t}class ue{constructor(e){this.spec=e,this.props={},e.props&&Xk(e.props,this,this.props),this.key=e.key?e.key.key:Yk("plugin")}getState(e){return e[this.key]}}const yf=Object.create(null);function Yk(n){return n in yf?n+"$"+ ++yf[n]:(yf[n]=0,n+"$")}class ae{constructor(e="key"){this.key=Yk(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const om=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Qk(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Zk=(n,e,t)=>{let o=Qk(n,t);if(!o)return!1;let r=rm(o);if(!r){let s=o.blockRange(),l=s&&Ri(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(l0(n,r,e,-1))return!0;if(o.parent.content.size==0&&(fs(i,"end")||Q.isSelectable(i)))for(let s=o.depth;;s--){let l=id(n.doc,o.before(s),o.after(s),F.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(fs(i,"end")?se.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):Q.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},YN=(n,e,t)=>{let o=Qk(n,t);if(!o)return!1;let r=rm(o);return r?e0(n,r,e):!1},QN=(n,e,t)=>{let o=n0(n,t);if(!o)return!1;let r=im(o);return r?e0(n,r,e):!1};function e0(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=id(n.doc,i,a,F.empty);if(!u||u.from!=i||u instanceof wt&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(U.create(d.doc,i)),t(d.scrollIntoView())}return!0}function fs(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const t0=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=rm(o)}let s=i&&i.nodeBefore;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rm(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function n0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const o0=(n,e,t)=>{let o=n0(n,t);if(!o)return!1;let r=im(o);if(!r)return!1;let i=r.nodeAfter;if(l0(n,r,e,1))return!0;if(o.parent.content.size==0&&(fs(i,"start")||Q.isSelectable(i))){let s=id(n.doc,o.before(),o.after(),F.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(fs(i,"start")?se.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Q.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},r0=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=im(o)}let s=i&&i.nodeAfter;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos)).scrollIntoView()),!0)};function im(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const ZN=(n,e)=>{let t=n.selection,o=t instanceof Q,r;if(o){if(t.node.isTextblock||!Pr(n.doc,t.from))return!1;r=t.from}else if(r=rd(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Q.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},eA=(n,e)=>{let t=n.selection,o;if(t instanceof Q){if(t.node.isTextblock||!Pr(n.doc,t.to))return!1;o=t.to}else if(o=rd(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},tA=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Ri(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},sm=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
9
+ `).scrollIntoView()),!0)};function lm(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const nA=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=lm(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(se.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},am=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof on||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=lm(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(U.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},i0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(vo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Ri(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function oA(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!o.parentOffset||!vo(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=lm(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof U||e.selection instanceof on)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=vo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const s0=oA(),rA=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(Q.create(n.doc,r))),!0)};function iA(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Pr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function l0(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&iA(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=_.empty;for(let b=s.length-1;b>=0;b--)m=_.from(s[b].create(null,m));m=_.from(r.copy(m));let g=n.tr.step(new xt(e.pos-1,h,e.pos,h,new F(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Pr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:se.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&Ri(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&fs(i,"start",!0)&&fs(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=_.empty;for(let k=m.length-1;k>=0;k--)b=_.from(m[k].copy(b));let v=n.tr.step(new xt(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new F(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function a0(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(U.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const sA=a0(-1),lA=a0(1);function aA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&em(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Py(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function ld(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}ld(om,Zk,t0);ld(om,o0,r0);ld(sm,am,i0,s0);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function cA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return uA(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function uA(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Lc(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Lc(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=em(i,t,o,e);return l?(n&&dA(n,e,l,r,t),!0):!1}function dA(n,e,t,o,r){let i=_.empty;for(let d=t.length-1;d>=0;d--)i=_.from(t[d].type.create(t[d].attrs,i));n.step(new xt(e.start-(o?2:0),e.end,e.start,e.end,new F(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&vo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function fA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?pA(e,t,n,i):hA(e,t,i):!0:!1}}function pA(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new xt(i-1,s,i,s,new F(_.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Lc(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=Ri(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return Pr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function hA(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?_.empty:_.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new xt(f-(l?1:0),p+(a?1:0),f+1,p-1,new F((l?_.empty:_.from(r.copy(_.empty))).append(a?_.empty:_.from(r.copy(_.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function mA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=_.from(u?n.create():null),f=new F(_.from(n.create(null,_.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new xt(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const Rt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},ps=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let kp=null;const Wo=function(n,e,t){let o=kp||(kp=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},gA=function(){kp=null},yi=function(n,e,t,o){return t&&(Vy(n,e,t,o,-1)||Vy(n,e,t,o,1))},yA=/^(img|br|input|textarea|hr)$/i;function Vy(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:$n(n))){let s=n.parentNode;if(!s||s.nodeType!=1||fa(n)||yA.test(n.nodeName)||n.contentEditable=="false")return!1;e=Rt(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?$n(n):0}else return!1}}function $n(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function bA(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=$n(n)}else if(n.parentNode&&!fa(n))e=Rt(n),n=n.parentNode;else return null}}function vA(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!fa(n))e=Rt(n)+1,n=n.parentNode;else return null}}function wA(n,e,t){for(let o=e==0,r=e==$n(n);o||r;){if(n==t)return!0;let i=Rt(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==$n(n)}}function fa(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ad=function(n){return n.focusNode&&yi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Gr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function kA(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function xA(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min($n(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min($n(o.startContainer),o.startOffset)}}}const So=typeof navigator<"u"?navigator:null,zy=typeof document<"u"?document:null,Vr=So&&So.userAgent||"",xp=/Edge\/(\d+)/.exec(Vr),c0=/MSIE \d/.exec(Vr),Cp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vr),un=!!(c0||Cp||xp),Tr=c0?document.documentMode:Cp?+Cp[1]:xp?+xp[1]:0,Dn=!un&&/gecko\/(\d+)/i.test(Vr);Dn&&+(/Firefox\/(\d+)/.exec(Vr)||[0,0])[1];const Sp=!un&&/Chrome\/(\d+)/.exec(Vr),_t=!!Sp,u0=Sp?+Sp[1]:0,Wt=!un&&!!So&&/Apple Computer/.test(So.vendor),hs=Wt&&(/Mobile\/\w+/.test(Vr)||!!So&&So.maxTouchPoints>2),An=hs||(So?/Mac/.test(So.platform):!1),d0=So?/Win/.test(So.platform):!1,qo=/Android \d/.test(Vr),pa=!!zy&&"webkitFontSmoothing"in zy.documentElement.style,CA=pa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function SA(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Po(n,e){return typeof n=="number"?n:n[e]}function EA(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function Hy(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=ps(s);continue}let l=s,a=l==i.body,u=a?SA(i):EA(l),d=0,f=0;if(e.top<u.top+Po(o,"top")?f=-(u.top-e.top+Po(r,"top")):e.bottom>u.bottom-Po(o,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Po(r,"top")-u.top:e.bottom-u.bottom+Po(r,"bottom")),e.left<u.left+Po(o,"left")?d=-(u.left-e.left+Po(r,"left")):e.right>u.right-Po(o,"right")&&(d=e.right-u.right+Po(r,"right")),d||f)if(a)i.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:ps(s)}}function MA(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){o=l,r=a.top;break}}return{refDOM:o,refTop:r,stack:f0(n.dom)}}function f0(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=ps(o));return e}function TA({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;p0(t,o==0?0:o-e)}function p0(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:r,left:i}=n[t];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let zi=null;function NA(n){if(n.setActive)return n.setActive();if(zi)return n.focus(zi);let e=f0(n);n.focus(zi==null?{get preventScroll(){return zi={preventScroll:!0},!0}}:void 0),zi||(zi=!1,p0(e,0))}function h0(n,e){let t,o=2e8,r,i=0,s=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let p;if(d.nodeType==1)p=d.getClientRects();else if(d.nodeType==3)p=Wo(d).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=d,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!t&&a&&(t=a,r=u,o=0),t&&t.nodeType==3?AA(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:h0(t,r)}function AA(n,e){let t=n.nodeValue.length,o=document.createRange(),r;for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let s=fr(o,1);if(s.top!=s.bottom&&cm(e,s)){r={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function cm(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function OA(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function $A(n,e,t){let{node:o,offset:r}=h0(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function RA(n,e,t,o){let r=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>o.left||a.top>o.top?r=l.posBefore:(!s&&a.right<o.left||a.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function m0(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),i=r;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(cm(e,u))return m0(s,e,u)}}if((i=(i+1)%o)==r)break}return n}function BA(n,e){let t=n.dom.ownerDocument,o,r=0,i=xA(t,e.left,e.top);i&&({node:o,offset:r}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=n.dom.getBoundingClientRect();if(!cm(e,u)||(s=m0(n.dom,e,u),!s))return null}if(Wt)for(let u=s;o&&u;u=ps(u))u.draggable&&(o=void 0);if(s=OA(s,e),o){if(Dn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let u;pa&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=RA(n,o,r,e))}l==null&&(l=$A(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Fy(n){return n.top<n.bottom||n.left<n.right}function fr(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Fy(o))return o}return Array.prototype.find.call(t,Fy)||n.getBoundingClientRect()}const DA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function g0(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=pa||Dn;if(o.nodeType==3)if(s&&(DA.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let a=fr(Wo(o,r,r),t);if(Dn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let u=fr(Wo(o,r-1,r-1),-1);if(u.top==a.top){let d=fr(Wo(o,r,r+1),-1);if(d.top!=a.top)return zs(d,d.left<u.left)}}return a}else{let a=r,u=r,d=t<0?1:-1;return t<0&&!r?(u++,d=-1):t>=0&&r==o.nodeValue.length?(a--,d=1):t<0?a--:u++,zs(fr(Wo(o,a,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==$n(o))){let a=o.childNodes[r-1];if(a.nodeType==1)return bf(a.getBoundingClientRect(),!1)}if(i==null&&r<$n(o)){let a=o.childNodes[r];if(a.nodeType==1)return bf(a.getBoundingClientRect(),!0)}return bf(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==$n(o))){let a=o.childNodes[r-1],u=a.nodeType==3?Wo(a,$n(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return zs(fr(u,1),!1)}if(i==null&&r<$n(o)){let a=o.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?Wo(a,0,s?0:1):a.nodeType==1?a:null:null;if(u)return zs(fr(u,-1),!0)}return zs(fr(o.nodeType==3?Wo(o):o,-t),t>=0)}function zs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function bf(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function y0(n,e,t){let o=n.state,r=n.root.activeElement;o!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function _A(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return y0(n,e,()=>{let{node:i}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=g0(n,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Wo(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const IA=/[\u0590-\u08ac]/;function LA(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=n.domSelection();return l?!IA.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:y0(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let jy=null,Wy=null,Uy=!1;function PA(n,e,t){return jy==e&&Wy==t?Uy:(jy=e,Wy=t,Uy=t=="up"||t=="down"?_A(n,e,t):LA(n,e,t))}const _n=0,qy=1,Yr=2,Eo=3;class ha{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=_n,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let r=this.children[t];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Rt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!t||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let r=this.children[t],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof v0){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof b0&&i.side>=0;o--);if(t<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Rt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Rt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let a=this.children[l],u=s+a.size;if(r==-1&&e<=u){let d=s+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Rt(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Rt(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((Dn||Wt)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
10
+ `),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Rt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Dn&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&Wt)&&yi(l.node,l.offset,d.anchorNode,d.anchorOffset)&&yi(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((u.extend||e==t)&&!(f&&Dn)){u.collapse(l.node,l.offset);try{e!=t&&u.extend(a.node,a.offset),p=!0}catch{}}if(!p){if(e>t){let m=l;l=a,a=m}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let l=o+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==o||t==s?Yr:qy,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Eo:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Yr:Eo}o=s}this.dirty=Yr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?Yr:qy;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class b0 extends ha{constructor(e,t,o,r){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==_n&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class VA extends ha{constructor(e,t,o,r){super(e,[],t,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class bi extends ha{constructor(e,t,o,r,i){super(e,[],o,r),this.mark=t,this.spec=i}static create(e,t,o,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,o);return(!s||!s.dom)&&(s=$i.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new bi(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Eo||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Eo&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=_n){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=_n}}slice(e,t,o){let r=bi.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=Mp(i,t,s,o)),e>0&&(i=Mp(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Nr extends ha{constructor(e,t,o,r,i,s,l,a,u){super(e,[],i,s),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,s){let l=i.nodeViews[t.type.name],a,u=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,r),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=$i.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=x0(d,o,t),u?a=new zA(e,t,o,r,d,f||null,p,u,i,s+1):t.isText?new cd(e,t,o,r,d,p,i):new Nr(e,t,o,r,d,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>_.empty)}return e}matchesNode(e,t,o){return this.dirty==_n&&e.eq(this.node)&&Vc(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new FA(this,s&&s.node,e);UA(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,o,e,d):u.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?Fe.none:this.node.child(d).marks,o,e,d),a.placeWidget(u,e,r)},(u,d,f,p)=>{a.syncToMarks(u.marks,o,e,p);let h;a.findNodeMatch(u,d,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,d,f,h,e)||a.updateNextNode(u,d,f,e,p,r)||a.addNode(u,d,f,e,r),r+=u.nodeSize}),a.syncToMarks([],o,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Yr)&&(s&&this.protectLocalComposition(e,s),w0(this.contentDOM,this.children,e),hs&&qA(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof U)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=KA(this.node.content,s,o-t,r-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new VA(this,i,t,r);e.input.compositionNodes.push(s),this.children=Mp(this.children,o,o+r.length,e,s)}update(e,t,o,r){return this.dirty==Eo||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,r),!0)}updateInner(e,t,o,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=_n}updateOuterDeco(e){if(Vc(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=k0(this.dom,this.nodeDOM,Ep(this.outerDeco,this.node,t),Ep(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ky(n,e,t,o,r){x0(o,e,n);let i=new Nr(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class cd extends Nr{constructor(e,t,o,r,i,s,l){super(e,t,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,r){return this.dirty==Eo||this.dirty!=_n&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=_n||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=_n,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new cd(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Eo)}get domAtom(){return!1}isText(e){return this.node.text==e}}class v0 extends ha{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_n&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class zA extends Nr{constructor(e,t,o,r,i,s,l,a,u,d){super(e,t,o,r,i,s,l,u,d),this.spec=a}update(e,t,o,r){if(this.dirty==Eo)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function w0(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=Jy(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof bi){let a=o?o.previousSibling:n.lastChild;w0(s.contentDOM,s.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=Jy(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const cl=function(n){n&&(this.nodeName=n)};cl.prototype=Object.create(null);const Qr=[new cl];function Ep(n,e,t){if(n.length==0)return Qr;let o=t?Qr[0]:new cl,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new cl(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&r.length==1&&r.push(o=new cl(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return r}function k0(n,e,t,o){if(t==Qr&&o==Qr)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=Qr[0]),r=a}HA(r,l||Qr[0],s)}return r}function HA(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function x0(n,e,t){return k0(n,n,Qr,Ep(e,t,n.nodeType!=1))}function Vc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Jy(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class FA{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=jA(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=_n,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;r<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=d;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let d=bi.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(e,t,o)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,r,i){let s=this.top.children[r];return s.dirty==Eo&&s.dom==s.contentDOM&&(s.dirty=Yr),s.update(e,t,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=t}}updateNextNode(e,t,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Nr){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let d=a.dom,f,p=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Eo&&Vc(t,a.outerDeco));if(!p&&a.update(e,t,o,r))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(a,e,t,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Yr,f.updateChildren(r,s+1),f.dirty=_n),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Vc(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Nr.create(this.top,t,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,o,r,i){let s=Nr.create(this.top,e,t,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new b0(this.top,e,t,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof bi;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof cd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Wt||_t)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new v0(this.top,[],o,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function jA(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let u=t.children[o-1];if(u instanceof bi)t=u,o=u.children.length;else{l=u,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function WA(n,e){return n.type.side-e.type.side}function UA(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);o(d,r,e.forChild(i,d),u),i+=d.nodeSize}return}let s=0,l=[],a=null;for(let u=0;;){let d,f;for(;s<r.length&&r[s].to==i;){let y=r[s++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(WA);for(let y=0;y<f.length;y++)t(f[y],u,!!a)}else t(d,u,!!a);let p,h;if(a)h=-1,p=a,a=null;else if(u<n.childCount)h=u,p=n.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let y=m;s<r.length&&r[s].from<y&&(y=r[s].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=p.cut(y-i),p=p.cut(0,y-i),m=y,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=p.isInline&&!p.isLeaf?l.filter(y=>!y.inline):l.slice();o(p,g,e.forChild(i,p),h),i=m}}function qA(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function KA(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let s=n.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;r<n.childCount;){let u=n.child(r++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=t){if(i>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let u=l<o?a.lastIndexOf(e,o-l-1):-1;if(u>=0&&u+e.length+l>=t)return l+u;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Mp(n,e,t,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],u=l,d=l+=a.size;u>=t||d<=e?i.push(a):(u<e&&i.push(a.slice(0,e-u,o)),r&&(i.push(r),r=void 0),d>t&&i.push(a.slice(t-u,a.size,o)))}return i}function um(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,u;if(ad(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Q.isSelectable(f)&&r.parent&&!(f.isInline&&wA(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=new Q(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=dm(n,d,l,f)}return u}function C0(n){return n.editable?n.hasFocus():E0(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Go(n,e=!1){let t=n.state.selection;if(S0(n,t),!!C0(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&_t){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&yi(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)GA(n);else{let{anchor:o,head:r}=t,i,s;Gy&&!(t instanceof U)&&(t.$from.parent.inlineContent||(i=Xy(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Xy(n,t.to))),n.docView.setSelection(o,r,n,e),Gy&&(i&&Yy(i),s&&Yy(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&JA(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Gy=Wt||_t&&u0<63;function Xy(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(Wt&&r&&r.contentEditable=="false")return vf(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return vf(r);if(i)return vf(i)}}function vf(n){return n.contentEditable="true",Wt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Yy(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function JA(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!C0(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function GA(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Rt(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&un&&Tr<=11&&(t.disabled=!0,t.disabled=!1)}function S0(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Qy(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Qy(n)}function Qy(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function dm(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||U.between(e,t,o)}function Zy(n){return n.editable&&!n.hasFocus()?!1:E0(n)}function E0(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function XA(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return yi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Tp(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&se.findFrom(i,e)}function pr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function eb(n,e,t){let o=n.state.selection;if(o instanceof U)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return pr(n,new U(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Tp(n.state,e);return r&&r instanceof Q?pr(n,r):!1}else if(!(An&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Q.isSelectable(i)?pr(n,new Q(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):pa?pr(n,new U(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Q&&o.node.isInline)return pr(n,new U(e>0?o.$to:o.$from));{let r=Tp(n.state,e);return r?pr(n,r):!1}}}function zc(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ul(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Hi(n,e){return e<0?YA(n):QA(n)}function YA(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Dn&&t.nodeType==1&&o<zc(t)&&ul(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(ul(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(M0(t))break;{let l=t.previousSibling;for(;l&&ul(l,-1);)r=t.parentNode,i=Rt(l),l=l.previousSibling;if(l)t=l,o=zc(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?Np(n,t,o):r&&Np(n,r,i)}function QA(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=zc(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(ul(l,1))i=t,s=++o;else break}else{if(M0(t))break;{let l=t.nextSibling;for(;l&&ul(l,1);)i=l.parentNode,s=Rt(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=zc(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&Np(n,i,s)}function M0(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function ZA(n,e){for(;n&&e==n.childNodes.length&&!fa(n);)e=Rt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function eO(n,e){for(;n&&!e&&!fa(n);)e=Rt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Np(n,e,t){if(e.nodeType!=3){let i,s;(s=ZA(e,t))?(e=s,t=0):(i=eO(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(ad(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Go(n)},50)}function tb(n,e){let t=n.state.doc.resolve(e);if(!(_t||d0)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function nb(n,e,t){let o=n.state.selection;if(o instanceof U&&!o.empty||t.indexOf("s")>-1||An&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Tp(n.state,e);if(s&&s instanceof Q)return pr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof on?se.near(s,e):se.findFrom(s,e);return l?pr(n,l):!1}return!1}function ob(n,e){if(!(n.state.selection instanceof U))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function rb(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function tO(n){if(!Wt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;rb(n,o,"true"),setTimeout(()=>rb(n,o,"false"),20)}return!1}function nO(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function oO(n,e){let t=e.keyCode,o=nO(e);if(t==8||An&&t==72&&o=="c")return ob(n,-1)||Hi(n,-1);if(t==46&&!e.shiftKey||An&&t==68&&o=="c")return ob(n,1)||Hi(n,1);if(t==13||t==27)return!0;if(t==37||An&&t==66&&o=="c"){let r=t==37?tb(n,n.state.selection.from)=="ltr"?-1:1:-1;return eb(n,r,o)||Hi(n,r)}else if(t==39||An&&t==70&&o=="c"){let r=t==39?tb(n,n.state.selection.from)=="ltr"?1:-1:1;return eb(n,r,o)||Hi(n,r)}else{if(t==38||An&&t==80&&o=="c")return nb(n,-1,o)||Hi(n,-1);if(t==40||An&&t==78&&o=="c")return tO(n)||nb(n,1,o)||Hi(n,1);if(o==(An?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function fm(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||$i.fromSchema(n.state.schema),l=R0(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=$0[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
11
+
12
+ `);return{dom:a,text:p,slice:e}}function T0(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new F(_.from(n.state.schema.text(e.replace(/\r\n?/g,`
13
+ `))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=$i.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=lO(t),pa&&aO(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||rs.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!rO.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=cO(ib(l,+d[1],+d[2]),d[4]);else if(l=F.maxOpen(iO(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=ib(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const rO=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function iO(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=r.findWrapping(l.type),u;if(!a)return s=null;if(u=s.length&&i.length&&A0(a,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=O0(s[s.length-1],i.length));let d=N0(l,a);s.push(d),r=r.matchType(d.type),i=a}}),s)return _.from(s)}return n}function N0(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,_.from(n));return n}function A0(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=A0(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(_.from(N0(t,n,r+1))))}}function O0(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,O0(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(_.empty,!0);return n.copy(t.append(o))}function Ap(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=Ap(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(_.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function ib(n,e,t){return e<n.openStart&&(n=new F(Ap(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new F(Ap(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const $0={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let sb=null;function R0(){return sb||(sb=document.implementation.createHTMLDocument("title"))}let wf=null;function sO(n){let e=window.trustedTypes;return e?(wf||(wf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),wf.createHTML(n)):n}function lO(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=R0().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&$0[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=sO(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function aO(n){let e=n.querySelectorAll(_t?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function cO(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=_.from(a.create(o[l+1],r)),i++,s++}return new F(r,i,s)}const rn={},sn={},uO={touchstart:!0,touchmove:!0};class dO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function fO(n){for(let e in rn){let t=rn[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{hO(n,o)&&!pm(n,o)&&(n.editable||!(o.type in sn))&&t(n,o)},uO[e]?{passive:!0}:void 0)}Wt&&n.dom.addEventListener("input",()=>null),Op(n)}function Cr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function pO(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Op(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>pm(n,o))})}function pm(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function hO(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function mO(n,e){!pm(n,e)&&rn[e.type]&&(n.editable||!(e.type in sn))&&rn[e.type](n,e)}sn.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!D0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(qo&&_t&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),hs&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,Gr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||oO(n,t)?t.preventDefault():Cr(n,"key")};sn.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};sn.keypress=(n,e)=>{let t=e;if(D0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||An&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof U)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function ud(n){return{left:n.clientX,top:n.clientY}}function gO(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function hm(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function ss(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function yO(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Q.isSelectable(o)?(ss(n,new Q(t)),!0):!1}function bO(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Q&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Q.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(ss(n,Q.create(n.state.doc,r)),!0):!1}function vO(n,e,t,o,r){return hm(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?bO(n,t):yO(n,t))}function wO(n,e,t,o){return hm(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function kO(n,e,t,o){return hm(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||xO(n,t,o)}function xO(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(ss(n,U.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)ss(n,U.create(o,l+1,l+1+s.content.size));else if(Q.isSelectable(s))ss(n,Q.create(o,l));else continue;return!0}}function mm(n){return Hc(n)}const B0=An?"metaKey":"ctrlKey";rn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=mm(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&gO(t,n.input.lastClick)&&!t[B0]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(ud(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new CO(n,s,t,!!o)):(i=="doubleClick"?wO:kO)(n,s.pos,s.inside,t)?t.preventDefault():Cr(n,"pointer"))};class CO{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[B0],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Q&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Cr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Go(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ud(e))),this.updateAllowDefault(e),this.allowDefault||!t?Cr(this.view,"pointer"):vO(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Wt&&this.mightDrag&&!this.mightDrag.node.isAtom||_t&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(ss(this.view,se.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Cr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Cr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}rn.touchstart=n=>{n.input.lastTouch=Date.now(),mm(n),Cr(n,"pointer")};rn.touchmove=n=>{n.input.lastTouch=Date.now(),Cr(n,"pointer")};rn.contextmenu=n=>mm(n);function D0(n,e){return n.composing?!0:Wt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const SO=qo?5e3:-1;sn.compositionstart=sn.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof U&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||_t&&d0&&EO(n)))n.markCursor=n.state.storedMarks||t.marks(),Hc(n,!0),n.markCursor=null;else if(Hc(n,!e.selection.empty),Dn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}_0(n,SO)};function EO(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}sn.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,_0(n,20))};function _0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Hc(n),e))}function I0(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=TO());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function MO(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=bA(e.focusNode,e.focusOffset),o=vA(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return o}}return t||o}function TO(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Hc(n,e=!1){if(!(qo&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),I0(n),e||n.docView&&n.docView.dirty){let t=um(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function NO(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Bl=un&&Tr<15||hs&&CA<604;rn.copy=sn.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Bl?null:t.clipboardData,s=o.content(),{dom:l,text:a}=fm(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):NO(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function AO(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function OO(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?Dl(n,o.value,null,r,e):Dl(n,o.textContent,o.innerHTML,r,e)},50)}function Dl(n,e,t,o,r){let i=T0(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||F.empty)))return!0;if(!i)return!1;let s=AO(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function L0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}sn.paste=(n,e)=>{let t=e;if(n.composing&&!qo)return;let o=Bl?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Dl(n,L0(o),o.getData("text/html"),r,t)?t.preventDefault():OO(n,t)};class P0{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const $O=An?"altKey":"ctrlKey";function V0(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[$O]}rn.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(ud(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Q?r.to-1:r.to))){if(o&&o.mightDrag)s=Q.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Q.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:u,slice:d}=fm(n,l);(!t.dataTransfer.files.length||!_t||u0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Bl?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Bl||t.dataTransfer.setData("text/plain",u),n.dragging=new P0(d,V0(n,t),s)};rn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};sn.dragover=sn.dragenter=(n,e)=>e.preventDefault();sn.drop=(n,e)=>{try{RO(n,e,n.dragging)}finally{n.dragging=null}};function RO(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(ud(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=T0(n,L0(e.dataTransfer),Bl?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&V0(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||F.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Wk(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&Q.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Q(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(dm(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}rn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Go(n)},20))};rn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};rn.beforeinput=(n,e)=>{if(_t&&qo&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Gr(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in sn)rn[n]=sn[n];function _l(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Fc{constructor(e,t){this.toDOM=e,this.spec=t||oi,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new Ve(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Fc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&_l(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ar{constructor(e,t){this.attrs=e,this.spec=t||oi}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Ve(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ar&&_l(this.attrs,e.attrs)&&_l(this.spec,e.spec)}static is(e){return e.type instanceof Ar}destroy(){}}class gm{constructor(e,t){this.attrs=e,this.spec=t||oi}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Ve(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof gm&&_l(this.attrs,e.attrs)&&_l(this.spec,e.spec)}destroy(){}}class Ve{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Ve(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Ve(e,e,new Fc(t,o))}static inline(e,t,o,r){return new Ve(e,t,new Ar(o,r))}static node(e,t,o,r){return new Ve(e,t,new gm(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ar}get widget(){return this.type instanceof Fc}}const Ki=[],oi={};class Ce{constructor(e,t){this.local=e.length?e:Ki,this.children=t.length?t:Ki}static create(e,t){return t.length?jc(t,e,0,oi):Ht}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==Ht||e.maps.length==0?this:this.mapInner(e,t,0,0,o||oi)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?BO(this.children,s||[],e,t,o,r,i):s?new Ce(s.sort(ri),Ki):Ht}add(e,t){return t.length?this==Ht?Ce.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=H0(t,l,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,d,u+1):r.splice(i,0,a,a+l.nodeSize,jc(d,l,u+1,oi)),i+=3}});let s=z0(i?F0(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Ce(s.length?this.local.concat(s).sort(ri):this.local,r||this.children)}remove(e){return e.length==0||this==Ht?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=Ht?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Ce(r,o):Ht}forChild(e,t){if(this==Ht)return this;if(t.isLeaf)return Ce.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Ar){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new Ce(r.sort(ri),Ki);return o?new yr([l,o]):l}return o||Ht}eq(e){if(this==e)return!0;if(!(e instanceof Ce)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ym(this.localsInner(e))}localsInner(e){if(this==Ht)return Ki;if(e.inlineContent||!this.local.some(Ar.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Ar||t.push(this.local[o]);return t}forEachSet(e){e(this)}}Ce.empty=new Ce([],[]);Ce.removeOverlap=ym;const Ht=Ce.empty;class yr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,oi));return yr.from(o)}forChild(e,t){if(t.isLeaf)return Ce.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=Ht&&(i instanceof yr?o=o.concat(i.members):o.push(i))}return yr.from(o)}eq(e){if(!(e instanceof yr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?ym(o?t:t.sort(ri)):Ki}static from(e){switch(e.length){case 0:return Ht;case 1:return e[0];default:return new yr(e.every(t=>t instanceof Ce)?e:e.reduce((t,o)=>t.concat(o instanceof Ce?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function BO(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let k=l[b]+d-f;h>=k?l[b+1]=p<=k?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=Ht?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=DO(l,n,e,t,r,i,s),d=jc(u,o,0,s);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new Ce(e.sort(ri),l)}function z0(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new Ve(r.from+e,r.to+e,r.type))}return t}function DO(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function H0(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function F0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function jc(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=H0(n,l,a+t);if(u){i=!0;let d=jc(u,l,t+a+1,o);d!=Ht&&r.push(a,a+l.nodeSize,d)}});let s=z0(i?F0(n):n,-t).sort(ri);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Ce(s,r):Ht}function ri(n,e){return n.from-e.from||n.to-e.to}function ym(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),lb(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),lb(e,r,o.copy(i.from,o.to)));break}}}return e}function lb(n,e,t){for(;e<n.length&&ri(t,n[e])>0;)e++;n.splice(e,0,t)}function kf(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=Ht&&e.push(o)}),n.cursorWrapper&&e.push(Ce.create(n.state.doc,[n.cursorWrapper.deco])),yr.from(e)}const _O={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},IO=un&&Tr<=11;class LO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class PO{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new LO,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);un&&Tr<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():Wt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),IO&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,_O)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Zy(this.view)){if(this.suppressingSelectionUpdates)return Go(this.view);if(un&&Tr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&yi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let i=e.focusNode;i;i=ps(i))t.add(i);for(let i=e.anchorNode;i;i=ps(i))if(t.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Zy(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],a);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(a.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of a)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&d.parentNode.removeChild(d)}}else if(Dn&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,p]=d;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of d){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||HO(e,f)!=h)&&p.remove()}}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ad(o)&&(u=um(e))&&u.eq(se.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Go(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),VO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,FO(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Go(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(un&&Tr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:p}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?Rt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Rt(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,a,1);return{from:l,to:u}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ab=new WeakMap,cb=!1;function VO(n){if(!ab.has(n)&&(ab.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Dn,cb)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),cb=!0}}function ub(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return yi(s.node,s.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function zO(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return ub(n,r)}let t;function o(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?ub(n,t):null}function HO(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function FO(n,e){var t;let{focusNode:o,focusOffset:r}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),o==i&&n.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function jO(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),u,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:a.anchorOffset}],ad(a)||u.push({node:a.focusNode,offset:a.focusOffset})),_t&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let b=o.childNodes[y-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let f=n.state.doc,p=n.someProp("domParser")||rs.fromSchema(n.state.schema),h=f.resolve(s),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:WO,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function WO(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Wt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||Wt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const UO=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function qO(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,T=um(n,S);if(T&&!n.state.selection.eq(T)){if(_t&&qo&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,Gr(13,"Enter"))))return;let N=n.state.tr.setSelection(T);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),n.dispatch(N)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,u=jO(n,e,t),d=n.state.doc,f=d.slice(u.from,u.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=GO(f.content,u.doc.content,u.from,p,h);if(m&&n.input.domChangeCount++,(hs&&n.input.lastIOSEnter>Date.now()-225||qo)&&r.some(S=>S.nodeType==1&&!UO.test(S.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",S=>S(n,Gr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&a instanceof U&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let S=db(n,n.state.doc,u.sel);if(S&&!S.eq(n.state.selection)){let T=n.state.tr.setSelection(S);i&&T.setMeta("composition",i),n.dispatch(T)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof U&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),un&&Tr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((hs&&n.input.lastIOSEnter>Date.now()-225&&(!v||r.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",S=>S(n,Gr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&JO(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",S=>S(n,Gr(8,"Backspace")))){qo&&_t&&n.domObserver.suppressSelectionUpdates();return}_t&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),qo&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(S){return S(n,Gr(13,"Enter"))})},20));let k=m.start,w=m.endA,x=S=>{let T=S||n.state.tr.replace(k,w,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let N=db(n,T.doc,u.sel);N&&!(_t&&n.composing&&N.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(N.head==k||N.head==T.mapping.map(w)-1)||un&&N.empty&&N.head==k)&&T.setSelection(N)}return i&&T.setMeta("composition",i),T.scrollIntoView()},C;if(v)if(g.pos==y.pos){un&&Tr<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Go(n),20));let S=x(n.state.tr.delete(k,w)),T=d.resolve(m.start).marksAcross(d.resolve(m.endA));T&&S.ensureMarks(T),n.dispatch(S)}else if(m.endA==m.endB&&(C=KO(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=x(n.state.tr);C.type=="add"?S.addMark(k,w,C.mark):S.removeMark(k,w,C.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),T=()=>x(n.state.tr.insertText(S,k,w));n.someProp("handleTextInput",N=>N(n,k,w,S,T))||n.dispatch(T())}else n.dispatch(x());else n.dispatch(x())}function db(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:dm(n,e.resolve(t.anchor),e.resolve(t.head))}function KO(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,s,l,a;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(a(e.child(d)));if(_.from(u).eq(n))return{mark:l,type:s}}function JO(n,e,t,o,r){if(t-e<=r.pos-o.pos||xf(o,!0,!1)<r.pos)return!1;let i=n.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(xf(i,!0,!0));return!s.parent.isTextblock||s.pos>t||xf(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function xf(n,e,t){let o=n.depth,r=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,r++,e=!1;if(t){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function GO(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let a=Math.max(0,i-Math.min(s,l));o-=s+a-i}if(s<i&&n.size<e.size){let a=o<=i&&o>=s?i-o:0;i-=a,i&&i<e.size&&fb(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=o<=i&&o>=l?i-o:0;i-=a,i&&i<n.size&&fb(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function fb(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class j0{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new dO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(yb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=mb(this),hb(this),this.nodeViews=gb(this),this.docView=Ky(this.state.doc,pb(this),kf(this),this.dom,this),this.domObserver=new PO(this,(o,r,i,s)=>qO(this,o,r,i,s)),this.domObserver.start(),fO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Op(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(yb),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(I0(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=gb(this);YO(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Op(this),this.editable=mb(this),hb(this);let a=kf(this),u=pb(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(r.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&MA(this);if(s){this.domObserver.stop();let h=f&&(un||_t)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&XO(r.selection,e.selection);if(f){let m=_t?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=MO(this)),(i||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Ky(e.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&XA(this))?Go(this,h):(S0(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&TA(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Hy(this,t.getBoundingClientRect(),e)}else Hy(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new P0(e.slice,e.move,r<0?void 0:Q.create(this.state.doc,r))}someProp(e,t){let o=this._props&&this._props[e],r;if(o!=null&&(r=t?t(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(un){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&NA(this.dom),Go(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return BA(this,e)}coordsAtPos(e,t=1){return g0(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let r=this.docView.posFromDOM(e,t,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return PA(this,t||this.state,e)}pasteHTML(e,t){return Dl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Dl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return fm(this,e)}destroy(){this.docView&&(pO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,gA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return mO(this,e)}domSelectionRange(){let e=this.domSelection();return e?Wt&&this.root.nodeType===11&&kA(this.dom.ownerDocument)==this.dom&&zO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}j0.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function pb(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[Ve.node(0,n.state.doc.content.size,e)]}function hb(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ve.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function mb(n){return!n.someProp("editable",e=>e(n.state)===!1)}function XO(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function gb(n){let e=Object.create(null);function t(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function YO(n,e){let t=0,o=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)o++;return t!=o}function yb(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Wc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},QO=typeof navigator<"u"&&/Mac/.test(navigator.platform),ZO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Bt=0;Bt<10;Bt++)Br[48+Bt]=Br[96+Bt]=String(Bt);for(var Bt=1;Bt<=24;Bt++)Br[Bt+111]="F"+Bt;for(var Bt=65;Bt<=90;Bt++)Br[Bt]=String.fromCharCode(Bt+32),Wc[Bt]=String.fromCharCode(Bt);for(var Cf in Br)Wc.hasOwnProperty(Cf)||(Wc[Cf]=Br[Cf]);function e$(n){var e=QO&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ZO&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Wc:Br)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const t$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),n$=typeof navigator<"u"&&/Win/.test(navigator.platform);function o$(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))t$?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function r$(n){let e=Object.create(null);for(let t in n)e[o$(t)]=n[t];return e}function Sf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function W0(n){return new ue({props:{handleKeyDown:bm(n)}})}function bm(n){let e=r$(n);return function(t,o){let r=e$(o),i,s=e[Sf(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Sf(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(n$&&o.ctrlKey&&o.altKey)&&(i=Br[o.keyCode])&&i!=r){let l=e[Sf(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var i$=Object.defineProperty,vm=(n,e)=>{for(var t in e)i$(n,t,{get:e[t],enumerable:!0})};function dd(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var fd=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:o}=e,{tr:r}=t,i=this.buildProps(r);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...u)=>{const d=l(...u)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s=[],l=!!n,a=n||r.tr,u=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(a,e),y=p(...m)(g);return s.push(y),d}])),run:u};return d}createCan(n){const{rawCommands:e,state:t}=this,o=!1,r=n||t.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>a(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s={tr:n,editor:o,view:i,state:dd({state:r,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)(s)]))}};return s}},U0={};vm(U0,{blur:()=>s$,clearContent:()=>l$,clearNodes:()=>a$,command:()=>c$,createParagraphNear:()=>u$,cut:()=>d$,deleteCurrentNode:()=>f$,deleteNode:()=>p$,deleteRange:()=>h$,deleteSelection:()=>m$,enter:()=>g$,exitCode:()=>y$,extendMarkRange:()=>b$,first:()=>v$,focus:()=>k$,forEach:()=>x$,insertContent:()=>C$,insertContentAt:()=>M$,joinBackward:()=>A$,joinDown:()=>N$,joinForward:()=>O$,joinItemBackward:()=>$$,joinItemForward:()=>R$,joinTextblockBackward:()=>B$,joinTextblockForward:()=>D$,joinUp:()=>T$,keyboardShortcut:()=>I$,lift:()=>L$,liftEmptyBlock:()=>P$,liftListItem:()=>V$,newlineInCode:()=>z$,resetAttributes:()=>H$,scrollIntoView:()=>F$,selectAll:()=>j$,selectNodeBackward:()=>W$,selectNodeForward:()=>U$,selectParentNode:()=>q$,selectTextblockEnd:()=>K$,selectTextblockStart:()=>J$,setContent:()=>G$,setMark:()=>cR,setMeta:()=>uR,setNode:()=>dR,setNodeSelection:()=>fR,setTextDirection:()=>pR,setTextSelection:()=>hR,sinkListItem:()=>mR,splitBlock:()=>gR,splitListItem:()=>yR,toggleList:()=>bR,toggleMark:()=>vR,toggleNode:()=>wR,toggleWrap:()=>kR,undoInputRule:()=>xR,unsetAllMarks:()=>CR,unsetMark:()=>SR,unsetTextDirection:()=>ER,updateAttributes:()=>MR,wrapIn:()=>TR,wrapInList:()=>NR});var s$=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),l$=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),a$=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Ri(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},c$=n=>e=>n(e),u$=()=>({state:n,dispatch:e})=>am(n,e),d$=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new U(o.doc.resolve(Math.max(s-1,0)))),!0},f$=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),a=r.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1};function pt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var p$=n=>({tr:e,state:t,dispatch:o})=>{const r=pt(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const a=i.before(s),u=i.after(s);e.delete(a,u).scrollIntoView()}return!0}return!1},h$=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},m$=()=>({state:n,dispatch:e})=>om(n,e),g$=()=>({commands:n})=>n.keyboardShortcut("Enter"),y$=()=>({state:n,dispatch:e})=>nA(n,e);function wm(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Uc(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:wm(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function q0(n,e,t={}){return n.find(o=>o.type===e&&Uc(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function bb(n,e,t={}){return!!q0(n,e,t)}function Os(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!q0([...r.node.marks],e,t)))return;let s=r.index,l=n.start()+r.offset,a=s+1,u=l+r.node.nodeSize;for(;s>0&&bb([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&bb([...n.parent.child(a).marks],e,t);)u+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function er(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var b$=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=er(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=Os(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=U.create(s,f.from,f.to);t.setSelection(p)}}return!0},v$=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function pd(n){return n instanceof U}function Ko(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function K0(n,e=null){if(!e)return null;const t=se.atStart(n),o=se.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?U.create(n,Ko(0,r,i),Ko(n.content.size,r,i)):U.create(n,Ko(e,r,i),Ko(e,r,i))}function $p(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Il(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function w$(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var k$=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Il()||$p())&&o.dom.focus(),w$()&&!Il()&&!$p()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(o.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!pd(t.state.selection))return s(),!0;const l=K0(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},x$=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),C$=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),J0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&J0(o)}return n};function Js(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return J0(t)}function Ll(n,e,t){if(n instanceof Bn||n instanceof _)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return _.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Ll("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new Bk({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?rs.fromSchema(a).parseSlice(Js(n),t.parseOptions):rs.fromSchema(a).parse(Js(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=rs.fromSchema(e);return t.slice?i.parseSlice(Js(n),t.parseOptions).content:i.parse(Js(n),t.parseOptions)}return Ll("",e,t)}function S$(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof wt||r instanceof xt))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}var E$=n=>!("type"in n),M$=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ll(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Ll(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((E$(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),d===f&&h){const{parent:y}=o.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof _){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,d,f)}else{g=l;const y=o.doc.resolve(d),b=y.node(),v=y.parentOffset===0,k=b.isText||b.isTextblock,w=b.content.size>0;v&&k&&w&&(d=Math.max(0,d-1)),o.replaceWith(d,f,g)}t.updateSelection&&S$(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:g})}return!0},T$=()=>({state:n,dispatch:e})=>ZN(n,e),N$=()=>({state:n,dispatch:e})=>eA(n,e),A$=()=>({state:n,dispatch:e})=>Zk(n,e),O$=()=>({state:n,dispatch:e})=>o0(n,e),$$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=rd(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},R$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=rd(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},B$=()=>({state:n,dispatch:e})=>YN(n,e),D$=()=>({state:n,dispatch:e})=>QN(n,e);function G0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function _$(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Il()||G0()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var I$=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=_$(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Dr(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?pt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const a=r-o,u=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Uc(f.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((f,p)=>f+p.to-p.from,0)>=a}var L$=(n,e={})=>({state:t,dispatch:o})=>{const r=pt(n,t.schema);return Dr(t,r,e)?tA(t,o):!1},P$=()=>({state:n,dispatch:e})=>i0(n,e),V$=n=>({state:e,dispatch:t})=>{const o=pt(n,e.schema);return fA(o)(e,t)},z$=()=>({state:n,dispatch:e})=>sm(n,e);function hd(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function vb(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var H$=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=hd(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=pt(n,o.schema)),l==="mark"&&(s=er(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,vb(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(vb(p.attrs,e))))})})}),a},F$=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),j$=()=>({tr:n,dispatch:e})=>{if(e){const t=new on(n.doc);n.setSelection(t)}return!0},W$=()=>({state:n,dispatch:e})=>t0(n,e),U$=()=>({state:n,dispatch:e})=>r0(n,e),q$=()=>({state:n,dispatch:e})=>rA(n,e),K$=()=>({state:n,dispatch:e})=>lA(n,e),J$=()=>({state:n,dispatch:e})=>sA(n,e);function Rp(n,e,t={},o={}){return Ll(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var G$=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const u=Rp(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function X0(n,e){const t=er(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function km(n,e){const t=new tm(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function xm(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Or(n,e){const t=[];return n.descendants((o,r)=>{e(o)&&t.push({node:o,pos:r})}),t}function Y0(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Cm(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Bi(n){return e=>Cm(e.$from,n)}function oe(n,e,t){return n.config[e]===void 0&&n.parent?oe(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?oe(n.parent,e,t):null}):n.config[e]}function Sm(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=oe(e,"addExtensions",t);return o?[e,...Sm(o())]:e}).flat(10)}function md(n,e){const t=$i.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Q0(n){return typeof n=="function"}function _e(n,e=void 0,...t){return Q0(n)?e?n.bind(e)(...t):n(...t):n}function X$(n={}){return Object.keys(n).length===0&&n.constructor===Object}function ms(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Z0(n){const e=[],{nodeExtensions:t,markExtensions:o}=ms(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=t.filter(u=>u.name!=="text").map(u=>u.name),l=o.map(u=>u.name),a=[...s,...l];return n.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:r},f=oe(u,"addGlobalAttributes",d);if(!f)return;f().forEach(h=>{let m;Array.isArray(h.types)?m=h.types:h.types==="*"?m=a:h.types==="nodes"?m=s:h.types==="marks"?m=l:m=[],m.forEach(g=>{Object.entries(h.attributes).forEach(([y,b])=>{e.push({type:g,name:y,attribute:{...i,...b}})})})})}),r.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage},f=oe(u,"addAttributes",d);if(!f)return;const p=f();Object.entries(p).forEach(([h,m])=>{const g={...i,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:u.name,name:h,attribute:g})})}),e}function pe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],a=o[r]?o[r].split(" "):[],u=l.filter(d=>!a.includes(d));o[r]=[...a,...u].join(" ")}else if(r==="style"){const l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],a=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;a.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),l.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),o[r]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else o[r]=i}),o},{})}function Pl(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>pe(t,o),{})}function Y$(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function wb(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):Y$(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function kb(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&X$(t)?!1:t!=null))}function xb(n){var e,t;const o={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(o.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function ex(n,e){var t;const o=Z0(n),{nodeExtensions:r,markExtensions:i}=ms(n),s=(t=r.find(u=>oe(u,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(u=>{const d=o.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((b,v)=>{const k=oe(v,"extendNodeSchema",f);return{...b,...k?k(u):{}}},{}),h=kb({...p,content:_e(oe(u,"content",f)),marks:_e(oe(u,"marks",f)),group:_e(oe(u,"group",f)),inline:_e(oe(u,"inline",f)),atom:_e(oe(u,"atom",f)),selectable:_e(oe(u,"selectable",f)),draggable:_e(oe(u,"draggable",f)),code:_e(oe(u,"code",f)),whitespace:_e(oe(u,"whitespace",f)),linebreakReplacement:_e(oe(u,"linebreakReplacement",f)),defining:_e(oe(u,"defining",f)),isolating:_e(oe(u,"isolating",f)),attrs:Object.fromEntries(d.map(xb))}),m=_e(oe(u,"parseHTML",f));m&&(h.parseDOM=m.map(b=>wb(b,d)));const g=oe(u,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Pl(b,d)}));const y=oe(u,"renderText",f);return y&&(h.toText=y),[u.name,h]})),a=Object.fromEntries(i.map(u=>{const d=o.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((y,b)=>{const v=oe(b,"extendMarkSchema",f);return{...y,...v?v(u):{}}},{}),h=kb({...p,inclusive:_e(oe(u,"inclusive",f)),excludes:_e(oe(u,"excludes",f)),group:_e(oe(u,"group",f)),spanning:_e(oe(u,"spanning",f)),code:_e(oe(u,"code",f)),attrs:Object.fromEntries(d.map(xb))}),m=_e(oe(u,"parseHTML",f));m&&(h.parseDOM=m.map(y=>wb(y,d)));const g=oe(u,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Pl(y,d)})),[u.name,h]}));return new Bk({topNode:s,nodes:l,marks:a})}function Q$(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function dl(n){return n.sort((t,o)=>{const r=oe(t,"priority")||100,i=oe(o,"priority")||100;return r>i?-1:r<i?1:0})}function Em(n){const e=dl(Sm(n)),t=Q$(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function tx(n,e){const t=Em(n);return ex(t,e)}function Z$(n,e){const t=tx(e),o=Bn.fromJSON(t,n);return md(o.content,t)}function nx(n,e){const t=tx(e),o=Js(n);return rs.fromSchema(t).parse(o).toJSON()}function ox(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
14
+
15
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function rx(n,e){const t={from:0,to:n.content.size};return ox(n,t,e)}function Mm(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function eR(n,e){const t=pt(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function ix(n,e){const t=hd(typeof e=="string"?e:e.name,n.schema);return t==="node"?eR(n,e):t==="mark"?X0(n,e):{}}function tR(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function nR(n){const e=tR(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,s)=>s!==o).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function Tm(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),nR(o)}function Nm(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),s=Os(i,r.type);s&&o.push({mark:r,...s})}):t.nodesBetween(n,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var oR=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function Hs(n,e){return e.nodes[n]||e.marks[n]||null}function pc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rR=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var a,u;const d=((u=(a=r.type.spec).toText)==null?void 0:u.call(a,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),t};function Bp(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?er(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Uc(f.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),v=Math.min(m,y+g.nodeSize),k=v-b;s+=k,l.push(...g.marks.map(w=>({mark:w,from:b,to:v})))})}),s===0)return!1;const a=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Uc(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),u=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(a>0?a+u:a)>=s}function sx(n,e,t={}){if(!e)return Dr(n,null,t)||Bp(n,null,t);const o=hd(e,n.schema);return o==="node"?Dr(n,e,t):o==="mark"?Bp(n,e,t):!1}var iR=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Bi(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},sR=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Cb(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Sb(n,e){const{nodeExtensions:t}=ms(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=_e(oe(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function gd(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(gd(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function lx(n){return n instanceof Q}var Am=class ax{constructor(e){this.position=e}static fromJSON(e){return new ax(e.position)}toJSON(){return{position:this.position}}};function cx(n,e){const t=e.mapping.mapResult(n.position);return{position:new Am(t.pos),mapResult:t}}function lR(n){return new Am(n)}function ux(n,e,t){const r=n.state.doc.content.size,i=Ko(e,0,r),s=Ko(t,0,r),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),u=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),p=Math.max(l.right,a.right),h=p-f,m=d-u,b={top:u,bottom:d,left:f,right:p,width:h,height:m,x:f,y:u};return{...b,toJSON:()=>b}}function aR(n,e,t){var o;const{selection:r}=e;let i=null;if(pd(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(u=>u.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var cR=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=er(n,o.schema);if(r)if(s){const u=X0(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===a)?p.marks.forEach(b=>{a===b.type&&t.addMark(m,g,a.create({...b.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return aR(o,t,a)},uR=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),dR=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=pt(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Py(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Py(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fR=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=Ko(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},pR=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},hR=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=U.atStart(o).from,l=U.atEnd(o).to,a=Ko(r,s,l),u=Ko(i,s,l),d=U.create(o,a,u);e.setSelection(d)}return!0},mR=n=>({state:e,dispatch:t})=>{const o=pt(n,e.schema);return mA(o)(e,t)};function Eb(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var gR=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=pc(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!vo(s,l.pos)?!1:(o&&(n&&Eb(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:xm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=vo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),o){if(m&&(i instanceof U&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Eb(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},yR=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=pt(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=_.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-v;T>=a.depth-3;T-=1)b=_.from(a.node(T).copy(b));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...pc(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(_.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-k),new F(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(T,N)=>{if(S>-1)return!1;T.isTextblock&&T.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(U.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...pc(p,f.type.name,f.attrs),...e},g={...pc(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!vo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:k}=i.extensionManager,w=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!w||!r)return!0;const x=w.filter(C=>k.includes(C.type.name));t.ensureMarks(x)}return!0},Ef=(n,e)=>{const t=Bi(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Pr(n.doc,t.pos)&&n.join(t.pos),!0},Mf=(n,e)=>{const t=Bi(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Pr(n.doc,o)&&n.join(o),!0},bR=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=pt(n,s.schema),m=pt(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,k=b.blockRange(v),w=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const x=Bi(C=>Sb(C.type.name,f))(g);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(Sb(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>Ef(i,h)).command(()=>Mf(i,h)).run()}return!t||!w||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Ef(i,h)).command(()=>Mf(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=w.filter(T=>p.includes(T.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Ef(i,h)).command(()=>Mf(i,h)).run()},vR=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=er(n,o.schema);return Bp(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},wR=(n,e,t={})=>({state:o,commands:r})=>{const i=pt(n,o.schema),s=pt(e,o.schema),l=Dr(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},kR=(n,e={})=>({state:t,commands:o})=>{const r=pt(n,t.schema);return Dr(t,r,e)?o.lift(r):o.wrapIn(r,e)},xR=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},CR=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},SR=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=er(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=Os(u,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},ER=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},MR=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=hd(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=pt(n,o.schema)),l==="mark"&&(s=er(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const k=Math.max(b,d),w=Math.min(b+y.nodeSize,f);t.addMark(k,w,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},TR=(n,e={})=>({state:t,dispatch:o})=>{const r=pt(n,t.schema);return aA(r,e)(t,o)},NR=(n,e={})=>({state:t,dispatch:o})=>{const r=pt(n,t.schema);return cA(r,e)(t,o)},AR=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},zr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},OR=(n,e)=>{if(wm(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Ia(n){var e;const{editor:t,from:o,to:r,text:i,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const u=a.state.doc.resolve(o);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let d=!1;const f=rR(u)+i;return s.forEach(p=>{if(d)return;const h=OR(f,p.find);if(!h)return;const m=a.state.tr,g=dd({state:a.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:b,chain:v,can:k}=new fd({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:v,can:k})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),a.dispatch(m),d=!0)}),d}function $R(n){const{editor:e,rules:t}=n,o=new ue({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const a=r.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=md(_.from(d),s.schema);const{from:f}=a,p=f+d.length;Ia({editor:e,from:f,to:p,text:d,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Ia({editor:e,from:i,to:s,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Ia({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Ia({editor:e,from:s.pos,to:s.pos,text:`
16
+ `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function RR(n){return Object.prototype.toString.call(n).slice(8,-1)}function La(n){return RR(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function dx(n,e){const t={...n};return La(n)&&La(e)&&Object.keys(e).forEach(o=>{La(e[o])&&La(n[o])?t[o]=dx(n[o],e[o]):t[o]=e[o]}),t}var Om=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{..._e(oe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{..._e(oe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>dx(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},no=class fx extends Om{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new fx(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(u=>(u==null?void 0:u.type.name)===t.name))return!1;const a=s.find(u=>(u==null?void 0:u.type.name)===t.name);return a&&o.removeStoredMark(a),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function BR(n){return typeof n=="number"}var DR=class{constructor(n){this.find=n.find,this.handler=n.handler}},_R=(n,e,t)=>{if(wm(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function IR(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:u,can:d}=new fd({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,b,v,k;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(k=(v=(b=h.content)==null?void 0:b.size)!=null?v:h.nodeSize)!=null?k:0,x=Math.max(o,m),C=Math.min(r,m+w);if(x>=C)return;const S=h.isText?h.text||"":h.textBetween(x-m,C-m,void 0,"");_R(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const $=x+N.index+1,O=$+N[0].length,A={from:t.tr.mapping.map($),to:t.tr.mapping.map(O)},B=i.handler({state:t,range:A,match:N,commands:a,chain:u,can:d,pasteEvent:s,dropEvent:l});f.push(B)})}),f.every(h=>h!==null)}var Pa=null,LR=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function PR(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:d,from:f,to:p,rule:h,pasteEvt:m})=>{const g=d.tr,y=dd({state:d,transaction:g});if(!(!IR({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new ue({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(Pa=e)},h=()=>{Pa&&(Pa=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=Pa;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),v=!!b;if(!g&&!y&&!v)return;if(v){let{text:x}=b;typeof x=="string"?x=x:x=md(_.from(x),h.schema);const{from:C}=b,S=C+x.length,T=LR(x);return a({rule:d,state:h,from:C,to:{b:S},pasteEvt:T})}const k=p.doc.content.findDiffStart(h.doc.content),w=p.doc.content.findDiffEnd(h.doc.content);if(!(!BR(k)||!w||k===w.b))return a({rule:d,state:h,from:k,to:w,pasteEvt:s})}}))}var yd=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Em(n),this.schema=ex(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hs(e.name,this.schema)},o=oe(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return dl([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:Hs(o.name,this.schema)},i=[],s=oe(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&oe(o,"exitable",r)&&(l.ArrowRight=()=>no.handleExit({editor:n,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const a=W0(l);i.push(a);const u=oe(o,"addInputRules",r);if(Cb(o,n.options.enableInputRules)&&u){const p=u();if(p&&p.length){const h=$R({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const d=oe(o,"addPasteRules",r);if(Cb(o,n.options.enablePasteRules)&&d){const p=d();if(p&&p.length){const h=PR({editor:n,rules:p});i.push(...h)}}const f=oe(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Z0(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=ms(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addNodeView")).map(t=>{const o=this.attributes.filter(a=>a.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:pt(t.name,this.schema)},i=oe(t,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(a,u,d,f,p)=>{const h=Pl(a,o);return s({node:a,view:u,getPos:d,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return dl([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Hs(r.name,this.schema)},s=oe(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},n)}transformPastedHTML(n){const{editor:e}=this;return dl([...this.extensions]).reduce((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Hs(r.name,this.schema)},s=oe(r,"transformPastedHTML",i);return s?(l,a)=>{const u=o(l,a);return s.call(i,u)}:o},n||(o=>o))}get markViews(){const{editor:n}=this,{markExtensions:e}=ms(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addMarkView")).map(t=>{const o=this.attributes.filter(l=>l.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:er(t.name,this.schema)},i=oe(t,"addMarkView",r);if(!i)return[];const s=(l,a,u)=>{const d=Pl(l,o);return i()({mark:l,view:a,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:f=>{GR(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hs(e.name,this.schema)};e.type==="mark"&&((t=_e(oe(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=oe(e,"onBeforeCreate",o),i=oe(e,"onCreate",o),s=oe(e,"onUpdate",o),l=oe(e,"onSelectionUpdate",o),a=oe(e,"onTransaction",o),u=oe(e,"onFocus",o),d=oe(e,"onBlur",o),f=oe(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};yd.resolve=Em;yd.sort=dl;yd.flatten=Sm;var VR={};vm(VR,{ClipboardTextSerializer:()=>hx,Commands:()=>mx,Delete:()=>gx,Drop:()=>yx,Editable:()=>bx,FocusEvents:()=>wx,Keymap:()=>kx,Paste:()=>xx,Tabindex:()=>Cx,TextDirection:()=>Sx,focusEventsPluginKey:()=>vx});var be=class px extends Om{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new px(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},hx=be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ue({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),a=Mm(t);return ox(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),mx=be.create({name:"commands",addCommands(){return{...U0}}}),gx=be.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=km(n.before,[n,...e]);Tm(d).forEach(h=>{d.mapping.mapResult(h.oldRange.from).deletedAfter&&d.mapping.mapResult(h.oldRange.to).deletedBefore&&d.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const p=d.mapping;d.steps.forEach((h,m)=>{var g,y;if(h instanceof qn){const b=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),k=p.invert().map(b,-1),w=p.invert().map(v),x=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(S=>S.eq(h.mark)),C=(y=d.doc.nodeAt(v))==null?void 0:y.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:k,to:w},newRange:{from:b,to:v},partial:!!(C||x),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),yx=be.create({name:"drop",addProseMirrorPlugins(){return[new ue({key:new ae("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),bx=be.create({name:"editable",addProseMirrorPlugins(){return[new ue({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vx=new ae("focusEvents"),wx=be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ue({key:vx,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),kx=be.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:d,$anchor:f}=a,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:se.atStart(u).from===p;return!d||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Il()||G0()?i:r},addProseMirrorPlugins(){return[new ue({key:new ae("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=se.atStart(e.doc).from,u=se.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!gd(t.doc))return;const p=t.tr,h=dd({state:t,transaction:p}),{commands:m}=new fd({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),xx=be.create({name:"paste",addProseMirrorPlugins(){return[new ue({key:new ae("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Cx=be.create({name:"tabindex",addProseMirrorPlugins(){return[new ue({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Sx=be.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=ms(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ue({key:new ae("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),zR=class Gs{constructor(e,t,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Gs(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Gs(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Gs(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=t.isInline,l=this.pos+o+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!r&&!s&&a.depth<=this.depth)return;const u=new Gs(a,this.editor,r,r||s?t:null);r&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(t).length>0){const i=r.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==t[a])break}}else o=r;r=r.parent}return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(t);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,t,o))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},HR=`.ProseMirror {
17
+ position: relative;
18
+ }
19
+
20
+ .ProseMirror {
21
+ word-wrap: break-word;
22
+ white-space: pre-wrap;
23
+ white-space: break-spaces;
24
+ -webkit-font-variant-ligatures: none;
25
+ font-variant-ligatures: none;
26
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
27
+ }
28
+
29
+ .ProseMirror [contenteditable="false"] {
30
+ white-space: normal;
31
+ }
32
+
33
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
34
+ white-space: pre-wrap;
35
+ }
36
+
37
+ .ProseMirror pre {
38
+ white-space: pre-wrap;
39
+ }
40
+
41
+ img.ProseMirror-separator {
42
+ display: inline !important;
43
+ border: none !important;
44
+ margin: 0 !important;
45
+ width: 0 !important;
46
+ height: 0 !important;
47
+ }
48
+
49
+ .ProseMirror-gapcursor {
50
+ display: none;
51
+ pointer-events: none;
52
+ position: absolute;
53
+ margin: 0;
54
+ }
55
+
56
+ .ProseMirror-gapcursor:after {
57
+ content: "";
58
+ display: block;
59
+ position: absolute;
60
+ top: -2px;
61
+ width: 20px;
62
+ border-top: 1px solid black;
63
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
64
+ }
65
+
66
+ @keyframes ProseMirror-cursor-blink {
67
+ to {
68
+ visibility: hidden;
69
+ }
70
+ }
71
+
72
+ .ProseMirror-hideselection *::selection {
73
+ background: transparent;
74
+ }
75
+
76
+ .ProseMirror-hideselection *::-moz-selection {
77
+ background: transparent;
78
+ }
79
+
80
+ .ProseMirror-hideselection * {
81
+ caret-color: transparent;
82
+ }
83
+
84
+ .ProseMirror-focused .ProseMirror-gapcursor {
85
+ display: block;
86
+ }`;function FR(n,e,t){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}var Lt=class extends AR{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:cx,createMappablePosition:lR},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=K0(t,this.options.autofocus);this.editorState=ns.create({doc:t,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=FR(HR,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const o=Q0(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),t.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[bx,hx.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),mx,wx,kx,Cx,yx,xx,gx,Sx.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new yd(r,this)}createCommandManager(){this.commandManager=new fd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Rp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Rp(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new j0(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=o.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return ix(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return sx(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return md(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
87
+
88
+ `,textSerializers:o={}}=e||{};return rx(this.state.doc,{blockSeparator:t,textSerializers:{...Mm(this.schema),...o}})}get isEmpty(){return gd(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new zR(t,this)}get $doc(){return this.$pos(0)}};function vi(n){return new zr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=_e(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const a=l.search(/\S/),u=t.from+l.indexOf(s),d=u+s.length;if(Nm(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+a,u);const p=t.from+a+s.length;i.addMark(t.from+a,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function bd(n){return new zr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=_e(n.getAttributes,void 0,o)||{},{tr:i}=e,s=t.from;let l=t.to;const a=n.type.create(r);if(o[1]){const u=o[0].lastIndexOf(o[1]);let d=s+u;d>l?d=l:l=d+o[1].length;const f=o[0][o[0].length-1];i.insertText(f,s+o[0].length-1),i.replaceWith(d,l,a)}else if(o[0]){const u=n.type.isInline?s:s-1;i.insert(u,n.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function Dp(n){return new zr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=e.doc.resolve(t.from),i=_e(n.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function lt(n){return new zr({find:n.find,handler:({state:e,range:t,match:o})=>{let r=n.replace,i=t.from;const s=t.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const a=i-s;a>0&&(r=o[0].slice(l-a,l)+r,i=s)}e.tr.insertText(r,i,s)},undoable:n.undoable})}function gs(n){return new zr({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=_e(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),u=a&&em(a,n.type,i);if(!u)return null;if(s.wrap(a,u),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Pr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,d))&&s.join(t.from-1)},undoable:n.undoable})}var jR=n=>"touches"in n,Ex=class{constructor(n){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(a,u)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const u=a.clientX-this.startX,d=a.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,o,r,i,s;this.node=n.node,this.editor=n.editor,this.element=n.element,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(o=n==null?void 0:n.options)!=null&&o.directions&&(this.directions=n.options.directions),(r=n.options)!=null&&r.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(i=n.options)!=null&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(s=n.options)!=null&&s.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!=null?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display="flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),o=e.includes("bottom"),r=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),o&&(n.style.bottom="0"),r&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,jR(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:o,height:r}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(o,r,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let o=this.startWidth,r=this.startHeight;const i=n.includes("right"),s=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return i?o=this.startWidth+e:s&&(o=this.startWidth-e),l?r=this.startHeight+t:a&&(r=this.startHeight-t),(n==="right"||n==="left")&&(o=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(r=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(o,r,n):{width:o,height:r}}applyConstraints(n,e,t){var o,r,i,s;if(!t){let u=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return(o=this.maxSize)!=null&&o.width&&(u=Math.min(this.maxSize.width,u)),(r=this.maxSize)!=null&&r.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let l=n,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(s=this.maxSize)!=null&&s.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){const o=t==="left"||t==="right",r=t==="top"||t==="bottom";return o?{width:n,height:n/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}};function WR(n,e){const{selection:t}=n,{$from:o}=t;if(t instanceof Q){const i=o.index();return o.parent.canReplaceWith(i,i+1,e)}let r=o.depth;for(;r>=0;){const i=o.index(r);if(o.node(r).contentMatchAt(i).matchType(e))return!0;r-=1}return!1}function Mx(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var UR={};vm(UR,{createAtomBlockMarkdownSpec:()=>qR,createBlockMarkdownSpec:()=>vd,createInlineMarkdownSpec:()=>Tx,parseAttributes:()=>$m,parseIndentedBlocks:()=>_p,renderNestedMarkdownContent:()=>Bm,serializeAttributes:()=>Rm});function $m(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const u=r.map(d=>d.trim().slice(1));e.class=u.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,u,d])=>{var f;const p=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[u]=h.slice(1,-1))});const a=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Rm(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function qR(n){const{nodeName:e,name:t,parseAttributes:o=$m,serializeAttributes:r=Rm,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function vd(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=$m,serializeAttributes:i=Rm,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${u}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,k=r(v);let w=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,T=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(T);if(N===null)break;const $=N.index,O=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if(O)w+=1;else if(w-=1,w===0){const A=T.slice(0,$);C=A.trim();const B=f.slice(0,x+$+N[0].length);let I=[];if(C)if(l==="block")for(I=h.blockTokens(A),I.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});I.length>0;){const L=I[I.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))I.pop();else break}else I=h.inlineTokens(C);return{type:e,raw:B,attributes:k,content:C,tokens:I}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
89
+
90
+ `);return`:::${u}${g}
91
+
92
+ ${y}
93
+
94
+ :::`}}}function KR(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function JR(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Tx(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=KR,serializeAttributes:i=JR,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",v="";if(l){const[,w]=y;v=w}else{const[,w,x]=y;v=w,b=x||""}const k=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:k}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function _p(n,e,t){var o,r,i,s;const l=n.split(`
95
+ `),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
96
+ `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
97
+ `;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const S=l.slice(d+1).findIndex($=>$.trim()!=="");if(S===-1)break;if((((r=(o=l[d+1+S].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
98
+ `,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
99
+ `,d+=1;else break}let v;const k=b.slice(1);if(k.length>0){const x=k.map(C=>C.slice(g+f)).join(`
100
+ `);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const w=e.createToken(m,v);a.push(w)}if(a.length!==0)return{items:a,raw:u}}function Bm(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
101
+ `).map(p=>p?e.indent(p):"").join(`
102
+ `);a.push(f)}}),a.join(`
103
+ `)}function GR(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,s=n;r.descendants((l,a)=>{const u=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==s)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});i.removeMark(u,d,n.type),i.addMark(u,d,h)}}),i.docChanged&&e.view.dispatch(i)}var Be=class Nx extends Om{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Nx(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},XR=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,o,r,i,s,l;const{view:a}=this.editor,u=n.target,d=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!d)return;let f=0,p=0;if(this.dom!==d){const v=this.dom.getBoundingClientRect(),k=d.getBoundingClientRect(),w=(r=n.offsetX)!=null?r:(o=n.nativeEvent)==null?void 0:o.offsetX,x=(s=n.offsetY)!=null?s:(i=n.nativeEvent)==null?void 0:i.offsetY;f=k.x-v.x+w,p=k.y-v.y+x}const h=this.dom.cloneNode(!0);try{const v=this.dom.getBoundingClientRect();h.style.width=`${Math.round(v.width)}px`,h.style.height=`${Math.round(v.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(h),document.body.appendChild(m),(l=n.dataTransfer)==null||l.setDragImage(h,f,p)}finally{m&&setTimeout(()=>{try{m==null||m.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=Q.create(a.state.doc,g),b=a.state.tr.setSelection(y);a.dispatch(b)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,u=!!this.node.type.spec.draggable,d=Q.isSelectable(this.node),f=n.type==="copy",p=n.type==="paste",h=n.type==="cut",m=n.type==="mousedown";if(!u&&d&&r&&n.target===this.dom&&n.preventDefault(),u&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(u&&l&&!a&&m){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||f||p||h||m&&d)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(Il()||$p())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function _r(n){return new DR({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=_e(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],a=o[0];let u=t.to;if(l){const d=a.search(/\S/),f=t.from+a.indexOf(l),p=f+l.length;if(Nm(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&s.delete(p,t.to),f>t.from&&s.delete(t.from+d,f),u=t.from+d+l.length,s.addMark(t.from+d,u,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Mb(n){return c.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var Ax=class extends Lt{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Mb(this.view.state),this.reactiveExtensionStorage=Mb(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),c.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},YR=c.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=c.ref(),t=c.getCurrentInstance();return c.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&c.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=c.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:i}),o.createNodeViews()})}),c.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return c.h("div",{ref:n=>{this.rootEl=n}})}}),tr=c.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return c.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Dm=c.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return c.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}}),QR=(n={})=>{const e=c.shallowRef();return c.onMounted(()=>{e.value=new Ax(n)}),c.onBeforeUnmount(()=>{var t,o,r,i;const s=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)==null||r.replaceChild(l,s),(i=e.value)==null||i.destroy()}),e},wd=class{constructor(n,{props:e={},editor:t}){this.destroyed=!1,this.editor=t,this.component=c.markRaw(n),this.el=document.createElement("div"),this.props=c.reactive(e),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var n,e,t,o;return(e=(n=this.renderedComponent.vNode)==null?void 0:n.component)!=null&&e.exposed?this.renderedComponent.vNode.component.exposed:(o=(t=this.renderedComponent.vNode)==null?void 0:t.component)==null?void 0:o.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let n=c.h(this.component,this.props);return this.editor.appContext&&(n.appContext=this.editor.appContext),typeof document<"u"&&this.el&&c.render(n,this.el),{vNode:n,destroy:()=>{this.el&&c.render(null,this.el),this.el=null,n=null},el:this.el?this.el.firstElementChild:null}}updateProps(n={}){this.destroyed||(Object.entries(n).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};c.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return c.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var ht={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}},ZR=class extends XR{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,o,r){var i;return o==="storage"?(i=n.storage[e.name])!=null?i:{}:Reflect.get(t,o,r)}})}return this.cachedExtensionWithSyncedStorage}mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},e=this.onDragStart.bind(this);this.decorationClasses=c.ref(this.getDecorationClasses());const t=c.defineComponent({extends:{...this.component},props:Object.keys(n),template:this.component.template,setup:o=>{var r,i;return c.provide("onDragStart",e),c.provide("decorationClasses",this.decorationClasses),(i=(r=this.component).setup)==null?void 0:i.call(r,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new wd(t,{editor:this.editor,props:n})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(n,e,t){const o=r=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(r)};if(typeof this.options.update=="function"){const r=this.node,i=this.decorations,s=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:r,oldDecorations:i,newNode:n,newDecorations:e,oldInnerDecorations:s,innerDecorations:t,updateProps:()=>o({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}return n.type!==this.node.type?!1:(n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,o({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(n=>n.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function En(n,e){return t=>{if(!t.editor.contentComponent)return{};const o=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new ZR(o,t,e)}}var qc=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},eB=/^\s*>\s$/,Ox=Be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return qc("blockquote",{...pe(this.options.HTMLAttributes,n),children:qc("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",o=[];return n.content.forEach(r=>{const l=e.renderChildren([r]).split(`
104
+ `).map(a=>a.trim()===""?t:`${t} ${a}`);o.push(l.join(`
105
+ `))}),o.join(`
106
+ ${t}
107
+ `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[gs({find:eB,type:this.type})]}}),tB=Ox,nB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,oB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,iB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sB=no.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return qc("strong",{...pe(this.options.HTMLAttributes,n),children:qc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[vi({find:nB,type:this.type}),vi({find:rB,type:this.type})]},addPasteRules(){return[_r({find:oB,type:this.type}),_r({find:iB,type:this.type})]}}),lB=/(^|[^`])`([^`]+)`(?!`)$/,aB=/(^|[^`])`([^`]+)`(?!`)/g,cB=no.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",pe(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[vi({find:lB,type:this.type})]},addPasteRules(){return[_r({find:aB,type:this.type})]}}),Tf=4,uB=/^```([a-z]+)?[\s\n]$/,dB=/^~~~([a-z]+)?[\s\n]$/,$x=Be.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Tf,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",pe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let o="";const r=((t=n.attrs)==null?void 0:t.language)||"";return n.content?o=[`\`\`\`${r}`,e.renderChildren(n.content),"```"].join(`
108
+ `):o=`\`\`\`${r}
109
+
110
+ \`\`\``,o},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Tf,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;if(i.parent.type!==this.type)return!1;const l=" ".repeat(t);return s?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:u,to:d}=r,h=o.doc.textBetween(u,d,`
111
+ `,`
112
+ `).split(`
113
+ `).map(m=>l+m).join(`
114
+ `);return a.replaceWith(u,d,o.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Tf,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;return i.parent.type!==this.type?!1:s?n.commands.command(({tr:l})=>{var a;const{pos:u}=i,d=i.start(),f=i.end(),h=o.doc.textBetween(d,f,`
115
+ `,`
116
+ `).split(`
117
+ `);let m=0,g=0;const y=u-d;for(let C=0;C<h.length;C+=1){if(g+h[C].length>=y){m=C;break}g+=h[C].length+1}const v=((a=h[m].match(/^ */))==null?void 0:a[0])||"",k=Math.min(v.length,t);if(k===0)return!0;let w=d;for(let C=0;C<m;C+=1)w+=h[C].length+1;return l.delete(w,w+k),u-w<=k&&l.setSelection(U.create(l.doc,w)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:u}=r,p=o.doc.textBetween(a,u,`
118
+ `,`
119
+ `).split(`
120
+ `).map(h=>{var m;const g=((m=h.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return h.slice(y)}).join(`
121
+ `);return l.replaceWith(a,u,o.schema.text(p)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:o,empty:r}=t;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
122
+
123
+ `);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:o}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:o.nodeAt(l)?n.commands.command(({tr:u})=>(u.setSelection(se.near(o.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Dp({find:uB,type:this.type,getAttributes:n=>({language:n[1]})}),Dp({find:dB,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ue({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!t||!i)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
124
+ `));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(U.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),Rx=Be.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
125
+
126
+ `):""}),Ip=Rx,fB=Be.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",pe(this.options.HTMLAttributes,n)]},renderText(){return`
127
+ `},renderMarkdown:()=>`
128
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=t;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,a=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&a&&s){const f=a.filter(p=>l.includes(p.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pB=Be.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,pe(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const o=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,r="#".repeat(o);return n.content?`${r} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Dp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),Bx=Be.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",pe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!WR(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:o}=t,r=n();return lx(t)?r.insertContentAt(o.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(U.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(Q.create(s.doc,a.pos)):s.setSelection(U.create(s.doc,a.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=d==null?void 0:d.create();f&&(s.insert(u,f),s.setSelection(U.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[bd({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hB=Bx,mB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,gB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,yB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,bB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,vB=no.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",pe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[vi({find:mB,type:this.type}),vi({find:yB,type:this.type})]},addPasteRules(){return[_r({find:gB,type:this.type}),_r({find:bB,type:this.type})]}});const wB="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",kB="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Lp="numeric",Pp="ascii",Vp="alpha",fl="asciinumeric",Xs="alphanumeric",zp="domain",Dx="emoji",xB="scheme",CB="slashscheme",Nf="whitespace";function SB(n,e){return n in e||(e[n]=[]),e[n]}function Zr(n,e,t){e[Lp]&&(e[fl]=!0,e[Xs]=!0),e[Pp]&&(e[fl]=!0,e[Vp]=!0),e[fl]&&(e[Xs]=!0),e[Vp]&&(e[Xs]=!0),e[Xs]&&(e[zp]=!0),e[Dx]&&(e[zp]=!0);for(const o in e){const r=SB(o,t);r.indexOf(n)<0&&r.push(n)}}function EB(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function cn(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}cn.groups={};cn.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,o)},tr(n,e,t,o){o=o||cn.groups;let r;return e&&e.j?r=e:(r=new cn(e),t&&o&&Zr(e,t,o)),this.jr.push([n,r]),r},ts(n,e,t,o){let r=this;const i=n.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(n[s]);return r.tt(n[i-1],e,t,o)},tt(n,e,t,o){o=o||cn.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let s,l=r.go(n);if(l?(s=new cn,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new cn,i){if(o)if(s.t&&typeof s.t=="string"){const a=Object.assign(EB(s.t,o),t);Zr(i,a,o)}else t&&Zr(i,t,o);s.t=i}return r.j[n]=s,s}};const Se=(n,e,t,o,r)=>n.ta(e,t,o,r),ot=(n,e,t,o,r)=>n.tr(e,t,o,r),Tb=(n,e,t,o,r)=>n.ts(e,t,o,r),V=(n,e,t,o,r)=>n.tt(e,t,o,r),Ho="WORD",Hp="UWORD",_x="ASCIINUMERICAL",Ix="ALPHANUMERICAL",Vl="LOCALHOST",Fp="TLD",jp="UTLD",hc="SCHEME",Ji="SLASH_SCHEME",_m="NUM",Wp="WS",Im="NL",pl="OPENBRACE",hl="CLOSEBRACE",Kc="OPENBRACKET",Jc="CLOSEBRACKET",Gc="OPENPAREN",Xc="CLOSEPAREN",Yc="OPENANGLEBRACKET",Qc="CLOSEANGLEBRACKET",Zc="FULLWIDTHLEFTPAREN",eu="FULLWIDTHRIGHTPAREN",tu="LEFTCORNERBRACKET",nu="RIGHTCORNERBRACKET",ou="LEFTWHITECORNERBRACKET",ru="RIGHTWHITECORNERBRACKET",iu="FULLWIDTHLESSTHAN",su="FULLWIDTHGREATERTHAN",lu="AMPERSAND",au="APOSTROPHE",cu="ASTERISK",hr="AT",uu="BACKSLASH",du="BACKTICK",fu="CARET",br="COLON",Lm="COMMA",pu="DOLLAR",po="DOT",hu="EQUALS",Pm="EXCLAMATION",Nn="HYPHEN",ml="PERCENT",mu="PIPE",gu="PLUS",yu="POUND",gl="QUERY",Vm="QUOTE",Lx="FULLWIDTHMIDDLEDOT",zm="SEMI",ho="SLASH",yl="TILDE",bu="UNDERSCORE",Px="EMOJI",vu="SYM";var Vx=Object.freeze({__proto__:null,ALPHANUMERICAL:Ix,AMPERSAND:lu,APOSTROPHE:au,ASCIINUMERICAL:_x,ASTERISK:cu,AT:hr,BACKSLASH:uu,BACKTICK:du,CARET:fu,CLOSEANGLEBRACKET:Qc,CLOSEBRACE:hl,CLOSEBRACKET:Jc,CLOSEPAREN:Xc,COLON:br,COMMA:Lm,DOLLAR:pu,DOT:po,EMOJI:Px,EQUALS:hu,EXCLAMATION:Pm,FULLWIDTHGREATERTHAN:su,FULLWIDTHLEFTPAREN:Zc,FULLWIDTHLESSTHAN:iu,FULLWIDTHMIDDLEDOT:Lx,FULLWIDTHRIGHTPAREN:eu,HYPHEN:Nn,LEFTCORNERBRACKET:tu,LEFTWHITECORNERBRACKET:ou,LOCALHOST:Vl,NL:Im,NUM:_m,OPENANGLEBRACKET:Yc,OPENBRACE:pl,OPENBRACKET:Kc,OPENPAREN:Gc,PERCENT:ml,PIPE:mu,PLUS:gu,POUND:yu,QUERY:gl,QUOTE:Vm,RIGHTCORNERBRACKET:nu,RIGHTWHITECORNERBRACKET:ru,SCHEME:hc,SEMI:zm,SLASH:ho,SLASH_SCHEME:Ji,SYM:vu,TILDE:yl,TLD:Fp,UNDERSCORE:bu,UTLD:jp,UWORD:Hp,WORD:Ho,WS:Wp});const Vo=/[a-z]/,Fs=new RegExp("\\p{L}","u"),Af=new RegExp("\\p{Emoji}","u"),zo=/\d/,Of=/\s/,Nb="\r",$f=`
129
+ `,MB="️",TB="‍",Rf="";let Va=null,za=null;function NB(n=[]){const e={};cn.groups=e;const t=new cn;Va==null&&(Va=Ab(wB)),za==null&&(za=Ab(kB)),V(t,"'",au),V(t,"{",pl),V(t,"}",hl),V(t,"[",Kc),V(t,"]",Jc),V(t,"(",Gc),V(t,")",Xc),V(t,"<",Yc),V(t,">",Qc),V(t,"(",Zc),V(t,")",eu),V(t,"「",tu),V(t,"」",nu),V(t,"『",ou),V(t,"』",ru),V(t,"<",iu),V(t,">",su),V(t,"&",lu),V(t,"*",cu),V(t,"@",hr),V(t,"`",du),V(t,"^",fu),V(t,":",br),V(t,",",Lm),V(t,"$",pu),V(t,".",po),V(t,"=",hu),V(t,"!",Pm),V(t,"-",Nn),V(t,"%",ml),V(t,"|",mu),V(t,"+",gu),V(t,"#",yu),V(t,"?",gl),V(t,'"',Vm),V(t,"/",ho),V(t,";",zm),V(t,"~",yl),V(t,"_",bu),V(t,"\\",uu),V(t,"・",Lx);const o=ot(t,zo,_m,{[Lp]:!0});ot(o,zo,o);const r=ot(o,Vo,_x,{[fl]:!0}),i=ot(o,Fs,Ix,{[Xs]:!0}),s=ot(t,Vo,Ho,{[Pp]:!0});ot(s,zo,r),ot(s,Vo,s),ot(r,zo,r),ot(r,Vo,r);const l=ot(t,Fs,Hp,{[Vp]:!0});ot(l,Vo),ot(l,zo,i),ot(l,Fs,l),ot(i,zo,i),ot(i,Vo),ot(i,Fs,i);const a=V(t,$f,Im,{[Nf]:!0}),u=V(t,Nb,Wp,{[Nf]:!0}),d=ot(t,Of,Wp,{[Nf]:!0});V(t,Rf,d),V(u,$f,a),V(u,Rf,d),ot(u,Of,d),V(d,Nb),V(d,$f),ot(d,Of,d),V(d,Rf,d);const f=ot(t,Af,Px,{[Dx]:!0});V(f,"#"),ot(f,Af,f),V(f,MB,f);const p=V(f,TB);V(p,"#"),ot(p,Af,f);const h=[[Vo,s],[zo,r]],m=[[Vo,null],[Fs,l],[zo,i]];for(let g=0;g<Va.length;g++)dr(t,Va[g],Fp,Ho,h);for(let g=0;g<za.length;g++)dr(t,za[g],jp,Hp,m);Zr(Fp,{tld:!0,ascii:!0},e),Zr(jp,{utld:!0,alpha:!0},e),dr(t,"file",hc,Ho,h),dr(t,"mailto",hc,Ho,h),dr(t,"http",Ji,Ho,h),dr(t,"https",Ji,Ho,h),dr(t,"ftp",Ji,Ho,h),dr(t,"ftps",Ji,Ho,h),Zr(hc,{scheme:!0,ascii:!0},e),Zr(Ji,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],v=n[g][1]?{[xB]:!0}:{[CB]:!0};y.indexOf("-")>=0?v[zp]=!0:Vo.test(y)?zo.test(y)?v[fl]=!0:v[Pp]=!0:v[Lp]=!0,Tb(t,y,y,v)}return Tb(t,"localhost",Vl,{ascii:!0}),t.jd=new cn(vu),{start:t,tokens:Object.assign({groups:e},Vx)}}function zx(n,e){const t=AB(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,s=0;for(;s<o;){let l=n,a=null,u=0,d=null,f=-1,p=-1;for(;s<o&&(a=l.go(t[s]));)l=a,l.accepts()?(f=0,p=0,d=l):f>=0&&(f+=t[s].length,p++),u+=t[s].length,i+=t[s].length,s++;i-=f,s-=p,u-=f,r.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return r}function AB(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,s=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(s),o+=s.length}return e}function dr(n,e,t,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?i=n.j[a]:(i=new cn(o),i.jr=r.slice(),n.j[a]=i),n=i}return i=new cn(t),i.jr=r.slice(),n.j[e[s-1]]=i,i}function Ab(n){const e=[],t=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(o,o+i),10);s>0;s--)t.pop();o+=i}else t.push(n[o]),o++}return e}const zl={defaultProtocol:"http",events:null,format:Ob,formatHref:Ob,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hm(n,e=null){let t=Object.assign({},zl);n&&(t=Object.assign(t,n instanceof Hm?n.o:n));const o=t.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}Hm.prototype={o:zl,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:zl[n],typeof r=="function"&&o&&(r=r(e,t))):typeof r=="function"&&o&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Ob(n){return n}function Hx(n,e){this.t="token",this.v=n,this.tk=e}Hx.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=zl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=o,l&&(s.class=l),a&&(s.target=a),u&&(s.rel=u),d&&Object.assign(s,d),{tagName:r,attributes:s,content:i,eventListeners:f}}};function kd(n,e){class t extends Hx{constructor(r,i){super(r,i),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const $b=kd("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Rb=kd("text"),OB=kd("nl"),Ha=kd("url",{isLink:!0,toHref(n=zl.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Vl&&n[1].t===br}}),Tn=n=>new cn(n);function $B({groups:n}){const e=n.domain.concat([lu,cu,hr,uu,du,fu,pu,hu,Nn,_m,ml,mu,gu,yu,ho,vu,yl,bu]),t=[au,br,Lm,po,Pm,ml,gl,Vm,zm,Yc,Qc,pl,hl,Jc,Kc,Gc,Xc,Zc,eu,tu,nu,ou,ru,iu,su],o=[lu,au,cu,uu,du,fu,pu,hu,Nn,pl,hl,ml,mu,gu,yu,gl,ho,vu,yl,bu],r=Tn(),i=V(r,yl);Se(i,o,i),Se(i,n.domain,i);const s=Tn(),l=Tn(),a=Tn();Se(r,n.domain,s),Se(r,n.scheme,l),Se(r,n.slashscheme,a),Se(s,o,i),Se(s,n.domain,s);const u=V(s,hr);V(i,hr,u),V(l,hr,u),V(a,hr,u);const d=V(i,po);Se(d,o,i),Se(d,n.domain,i);const f=Tn();Se(u,n.domain,f),Se(f,n.domain,f);const p=V(f,po);Se(p,n.domain,f);const h=Tn($b);Se(p,n.tld,h),Se(p,n.utld,h),V(u,Vl,h);const m=V(f,Nn);V(m,Nn,m),Se(m,n.domain,f),Se(h,n.domain,f),V(h,po,p),V(h,Nn,m);const g=V(h,br);Se(g,n.numeric,$b);const y=V(s,Nn),b=V(s,po);V(y,Nn,y),Se(y,n.domain,s),Se(b,o,i),Se(b,n.domain,s);const v=Tn(Ha);Se(b,n.tld,v),Se(b,n.utld,v),Se(v,n.domain,s),Se(v,o,i),V(v,po,b),V(v,Nn,y),V(v,hr,u);const k=V(v,br),w=Tn(Ha);Se(k,n.numeric,w);const x=Tn(Ha),C=Tn();Se(x,e,x),Se(x,t,C),Se(C,e,x),Se(C,t,C),V(v,ho,x),V(w,ho,x);const S=V(l,br),T=V(a,br),N=V(T,ho),$=V(N,ho);Se(l,n.domain,s),V(l,po,b),V(l,Nn,y),Se(a,n.domain,s),V(a,po,b),V(a,Nn,y),Se(S,n.domain,x),V(S,ho,x),V(S,gl,x),Se($,n.domain,x),Se($,e,x),V($,ho,x);const O=[[pl,hl],[Kc,Jc],[Gc,Xc],[Yc,Qc],[Zc,eu],[tu,nu],[ou,ru],[iu,su]];for(let A=0;A<O.length;A++){const[B,I]=O[A],L=V(x,B);V(C,B,L),V(L,I,x);const R=Tn(Ha);Se(L,e,R);const q=Tn();Se(L,t),Se(R,e,R),Se(R,t,q),Se(q,e,R),Se(q,t,q),V(R,I,x),V(q,I,x)}return V(r,Vl,v),V(r,Im,OB),{start:r,tokens:Vx}}function RB(n,e,t){let o=t.length,r=0,i=[],s=[];for(;r<o;){let l=n,a=null,u=null,d=0,f=null,p=-1;for(;r<o&&!(a=l.go(t[r].t));)s.push(t[r++]);for(;r<o&&(u=a||l.go(t[r].t));)a=null,l=u,l.accepts()?(p=0,f=l):p>=0&&p++,r++,d++;if(p<0)r-=d,r<o&&(s.push(t[r]),r++);else{s.length>0&&(i.push(Bf(Rb,e,s)),s=[]),r-=p,d-=p;const h=f.t,m=t.slice(r-d,r);i.push(Bf(h,e,m))}}return s.length>0&&i.push(Bf(Rb,e,s)),i}function Bf(n,e,t){const o=t[0].s,r=t[t.length-1].e,i=e.slice(o,r);return new n(i,t)}const BB=typeof console<"u"&&console&&console.warn||(()=>{}),DB="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Qe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function _B(){return cn.groups={},Qe.scanner=null,Qe.parser=null,Qe.tokenQueue=[],Qe.pluginQueue=[],Qe.customSchemes=[],Qe.initialized=!1,Qe}function Bb(n,e=!1){if(Qe.initialized&&BB(`linkifyjs: already initialized - will not register custom scheme "${n}" ${DB}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
130
+ 1. Must only contain digits, lowercase ASCII letters or "-"
131
+ 2. Cannot start or end with "-"
132
+ 3. "-" cannot repeat`);Qe.customSchemes.push([n,e])}function IB(){Qe.scanner=NB(Qe.customSchemes);for(let n=0;n<Qe.tokenQueue.length;n++)Qe.tokenQueue[n][1]({scanner:Qe.scanner});Qe.parser=$B(Qe.scanner.tokens);for(let n=0;n<Qe.pluginQueue.length;n++)Qe.pluginQueue[n][1]({scanner:Qe.scanner,parser:Qe.parser});return Qe.initialized=!0,Qe}function Fm(n){return Qe.initialized||IB(),RB(Qe.parser.start,n,zx(Qe.scanner.start,n))}Fm.scan=zx;function Fx(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const o=new Hm(t),r=Fm(n),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var jm="[\0-   ᠎ -\u2029  ]",LB=new RegExp(jm),PB=new RegExp(`${jm}$`),VB=new RegExp(jm,"g");function zB(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function HB(n){return new ue({key:new ae("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(u=>u.docChanged)&&!t.doc.eq(o.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=km(t.doc,[...e]);if(Tm(l).forEach(({newRange:u})=>{const d=Y0(o.doc,u,h=>h.isTextblock);let f,p;if(d.length>1)f=d[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const h=o.doc.textBetween(u.from,u.to," "," ");if(!PB.test(h))return;f=d[0],p=o.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&p){const h=p.split(LB).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Fm(m).map(b=>b.toObject(n.defaultProtocol));if(!zB(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>o.schema.marks.code?!o.doc.rangeHasMark(b.from,b.to,o.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Nm(b.from,b.to,o.doc).some(v=>v.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function FB(n){return new ue({key:new ae("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=null;if(o.target instanceof HTMLAnchorElement)s=o.target;else{const a=o.target;if(!a)return!1;const u=n.editor.view.dom;s=a.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const a=ix(e.state,n.type.name),u=(r=s.href)!=null?r:a.href,d=(i=s.target)!=null?i:a.target;u&&(window.open(u,d),l=!0)}return l}}})}function jB(n){return new ue({key:new ae("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";o.content.forEach(d=>{a+=d.textContent});const u=Fx(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!u||r!==void 0&&!r(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Kr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&t.push(r)}),!n||n.replace(VB,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var jx=no.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Bb(n);return}Bb(n.scheme,n.optionalSlashes)})},onDestroy(){_B()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Kr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Kr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Kr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",pe(this.options.HTMLAttributes,n),0]:["a",pe(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,o,r,i;const s=(o=(t=n.attrs)==null?void 0:t.href)!=null?o:"",l=(i=(r=n.attrs)==null?void 0:r.title)!=null?i:"",a=e.renderChildren(n);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!Kr(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:o=>!!Kr(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[_r({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=Fx(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Kr(s,t),protocols:t,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(HB({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Kr(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(FB({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(jB({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Wm=jx,WB=Object.defineProperty,UB=(n,e)=>{for(var t in e)WB(n,t,{get:e[t],enumerable:!0})},qB="listItem",Db="textStyle",_b=/^\s*([-+*])\s$/,Wx=Be.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",pe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
133
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qB,this.editor.getAttributes(Db)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=gs({find:_b,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=gs({find:_b,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Db),editor:this.editor})),[n]}}),Ux=Be.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",pe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Bm(n,e,o=>{var r,i;return o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${(((i=(r=o.meta)==null?void 0:r.parentAttrs)==null?void 0:i.start)||1)+o.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),KB={};UB(KB,{findListItemPos:()=>ma,getNextListDepth:()=>Um,handleBackspace:()=>Up,handleDelete:()=>qp,hasListBefore:()=>qx,hasListItemAfter:()=>JB,hasListItemBefore:()=>Kx,listItemHasSubList:()=>Jx,nextListIsDeeper:()=>Gx,nextListIsHigher:()=>Xx});var ma=(n,e)=>{const{$from:t}=e.selection,o=pt(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Um=(n,e)=>{const t=ma(n,e);if(!t)return!1;const[,o]=oR(e,n,t.$pos.pos+4);return o},qx=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},Kx=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},Jx=(n,e,t)=>{if(!t)return!1;const o=pt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Up=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Dr(n.state,e)&&qx(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),u=[];a.node().descendants((p,h)=>{p.type.name===e&&u.push({node:p,pos:h})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Dr(n.state,e)||!sR(n.state))return!1;const o=ma(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=Jx(e,n.state,i);return Kx(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Gx=(n,e)=>{const t=Um(n,e),o=ma(n,e);return!o||!t?!1:t>o.depth},Xx=(n,e)=>{const t=Um(n,e),o=ma(n,e);return!o||!t?!1:t<o.depth},qp=(n,e)=>{if(!Dr(n.state,e)||!iR(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:Gx(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Xx(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},JB=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},Yx=be.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&qp(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&qp(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Up(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Up(n,t,o)&&(e=!0)}),e}}}}),Ib=/^(\s*)(\d+)\.\s+(.*)$/,GB=/^\s/;function XB(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(Ib);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(Ib))break;if(h.trim()==="")p.push(h),d+=`
134
+ `,f+=1;else if(h.match(GB))p.push(h),d+=`
135
+ ${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
136
+ `)}),o=f,t=f}return[e,o]}function Qx(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
137
+ `),a=((o=l[0])==null?void 0:o.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
138
+ `).trim();if(d){const h=t.blockTokens(d);u.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=Qx(p,h,t);u.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
139
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:u}),i=f}else i+=1}return r}function YB(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var QB="listItem",Lb="textStyle",Pb=/^(\d+)\.\s$/,Zx=Be.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",pe(this.options.HTMLAttributes,t),0]:["ol",pe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?YB(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
140
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
141
+ `),[i,s]=XB(r);if(i.length===0)return;const l=Qx(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
142
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(QB,this.editor.getAttributes(Lb)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=gs({find:Pb,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=gs({find:Pb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Lb)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ZB=/^\s*(\[([( |x])?\])\s$/,e1=Be.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",pe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Bm(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let d=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,u(f);const p=o.extensionManager.attributes,h=Pl(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),d=m,!0}}}},addInputRules(){return[gs({find:ZB,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),qm=Be.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",pe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
143
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=_p(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=_p(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});be.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Wx.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Ux.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Yx.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Zx.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(e1.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(qm.configure(this.options.taskList)),n}});var Vb="&nbsp;",eD=" ",tD=Be.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",pe(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const o=e.parseInline(t);return o.length===1&&o[0].type==="text"&&(o[0].text===Vb||o[0].text===eD)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,o)},renderMarkdown:(n,e)=>{if(!n)return"";const t=Array.isArray(n.content)?n.content:[];return t.length===0?Vb:e.renderChildren(t)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,oD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rD=no.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",pe(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vi({find:nD,type:this.type})]},addPasteRules(){return[_r({find:oD,type:this.type})]}}),iD=Be.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),t1=no.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",pe(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),n1=t1;function sD(n={}){return new ue({view(e){return new lD(e,n)}})}class lD{constructor(e,t){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=t.width)!==null&&o!==void 0?o:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,o,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,l=i.height/r.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;o={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!o){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),p=f.width/a.offsetWidth,h=f.height/a.offsetHeight;u=f.left-a.scrollLeft*p,d=f.top-a.scrollTop*h}this.element.style.left=(o.left-u)/s+"px",this.element.style.top=(o.top-d)/l+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,t,e):r;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Wk(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class et extends se{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return et.valid(o)?new et(o):se.near(o)}content(){return F.empty}eq(e){return e instanceof et&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new et(e.resolve(t.pos))}getBookmark(){return new Km(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!aD(e)||!cD(e))return!1;let o=t.type.spec.allowGapCursor;if(o!=null)return o;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,o=!1){e:for(;;){if(!o&&et.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=t;let a=e.doc.resolve(r);if(et.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Q.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),o=!1;continue e}break}i=s,r+=t;let l=e.doc.resolve(r);if(et.valid(l))return l}return null}}}et.prototype.visible=!1;et.findFrom=et.findGapCursorFrom;se.jsonID("gapcursor",et);class Km{constructor(e){this.pos=e}map(e){return new Km(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return et.valid(t)?new et(t):se.near(t)}}function o1(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function aD(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),o=n.node(e);if(t==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||o1(r.type))return!0;if(r.inlineContent)return!1}}return!0}function cD(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),o=n.node(e);if(t==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||o1(r.type))return!0;if(r.inlineContent)return!1}}return!0}function uD(){return new ue({props:{decorations:hD,createSelectionBetween(n,e,t){return e.pos==t.pos&&et.valid(t)?new et(t):null},handleClick:fD,handleKeyDown:dD,handleDOMEvents:{beforeinput:pD}}})}const dD=bm({ArrowLeft:Fa("horiz",-1),ArrowRight:Fa("horiz",1),ArrowUp:Fa("vert",-1),ArrowDown:Fa("vert",1)});function Fa(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof U){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=o.doc.resolve(e>0?l.after():l.before())}let u=et.findGapCursorFrom(l,e,a);return u?(r&&r(o.tr.setSelection(new et(u))),!0):!1}}function fD(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!et.valid(o))return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&Q.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new et(o))),!0)}function pD(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof et))return!1;let{$from:t}=n.state.selection,o=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let r=_.empty;for(let s=o.length-1;s>=0;s--)r=_.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(t.pos,t.pos,new F(r,0,0));return i.setSelection(U.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function hD(n){if(!(n.selection instanceof et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Ce.create(n.doc,[Ve.widget(n.selection.head,e,{key:"gapcursor"})])}var wu=200,Ct=function(){};Ct.prototype.append=function(e){return e.length?(e=Ct.from(e),!this.length&&e||e.length<wu&&this.leafAppend(e)||this.length<wu&&e.leafPrepend(this)||this.appendInner(e)):this};Ct.prototype.prepend=function(e){return e.length?Ct.from(e).append(this):this};Ct.prototype.appendInner=function(e){return new mD(this,e)};Ct.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ct.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Ct.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ct.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};Ct.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},t,o),r};Ct.from=function(e){return e instanceof Ct?e:e&&e.length?new r1(e):Ct.empty};var r1=(function(n){function e(o){n.call(this),this.values=o}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var a=i;a<s;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var a=i-1;a>=s;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=wu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=wu)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ct);Ct.empty=new r1([]);var mD=(function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e})(Ct);const gD=500;class Un{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;t&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,a,u=[],d=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,d.push(f);return}if(r){d.push(new mo(f.map));let h=f.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new mo(m,void 0,void 0,u.length+d.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return l=r?f.selection.map(r.slice(i)):f.selection,a=new Un(this.items.slice(0,o).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,o,r){let i=[],s=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),p=new mo(e.mapping.maps[d],f,t),h;(h=a&&a.merge(p))&&(p=h,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),r||(a=p)}let u=s-o.depth;return u>bD&&(l=yD(l,u),s-=u),new Un(l.append(i),s)}remapping(e,t){let o=new $l;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,t),o}addMaps(e){return this.eventCount==0?this:new Un(this.items.append(e.map(t=>new mo(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},r);let a=t;this.items.forEach(p=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(i.slice(a+1,h));y&&l++,o.push(new mo(m,g,y))}else o.push(new mo(m))},r);let u=[];for(let p=t;p<s;p++)u.push(new mo(i.maps[p]));let d=this.items.slice(0,r).append(u).append(o),f=new Un(d,l);return f.emptyItemCount()>gD&&(f=f.compress(this.items.length-o.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(o)),u=a&&a.getMap();if(o--,u&&t.appendMap(u,o),a){let d=s.selection&&s.selection.map(t.slice(o));d&&i++;let f=new mo(u.invert(),a,d),p,h=r.length-1;(p=r.length&&r[h].merge(f))?r[h]=p:r.push(f)}}else s.map&&o--},this.items.length,0),new Un(Ct.from(r.reverse()),i)}}Un.empty=new Un(Ct.empty,0);function yD(n,e){let t;return n.forEach((o,r)=>{if(o.selection&&e--==0)return t=r,!1}),n.slice(t)}class mo{constructor(e,t,o,r){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new mo(t.getMap().invert(),t,this.selection)}}}class mr{constructor(e,t,o,r,i){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const bD=20;function vD(n,e,t,o){let r=t.getMeta(ii),i;if(r)return r.historyState;t.getMeta(xD)&&(n=new mr(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(ii))return s.getMeta(ii).redo?new mr(n.done.addTransform(t,void 0,o,mc(e)),n.undone,zb(t.mapping.maps),n.prevTime,n.prevComposition):new mr(n.done,n.undone.addTransform(t,void 0,o,mc(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!wD(t,n.prevRanges)),u=s?Df(n.prevRanges,t.mapping):zb(t.mapping.maps);return new mr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,mc(e)),Un.empty,u,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new mr(n.done.rebased(t,i),n.undone.rebased(t,i),Df(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new mr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Df(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function wD(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(t=!0)}),t}function zb(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,r,i,s)=>e.push(i,s));return e}function Df(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let r=e.map(n[o],1),i=e.map(n[o+1],-1);r<=i&&t.push(r,i)}return t}function kD(n,e,t){let o=mc(e),r=ii.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),a=new mr(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ii,{redo:t,historyState:a})}let _f=!1,Hb=null;function mc(n){let e=n.plugins;if(Hb!=e){_f=!1,Hb=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){_f=!0;break}}return _f}const ii=new ae("history"),xD=new ae("closeHistory");function CD(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ue({key:ii,state:{init(){return new mr(Un.empty,Un.empty,null,0,-1)},apply(e,t,o){return vD(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,r=o=="historyUndo"?s1:o=="historyRedo"?l1:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function i1(n,e){return(t,o)=>{let r=ii.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=kD(r,t,n);i&&o(e?i.scrollIntoView():i)}return!0}}const s1=i1(!1,!0),l1=i1(!0,!0);be.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ue({key:new ae("characterCount"),appendTransaction:(e,t,o)=>{if(n)return;const r=this.options.limit;if(r==null||r===0){n=!0;return}const i=this.storage.characters({node:o.doc});if(i>r){const s=i-r,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(l,a);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=o||r>o&&i>o&&i<=r)return!0;if(r>o&&i>o&&i>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-o,u=l-a,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>o)}})]}});var SD=be.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[sD(this.options)]}}),a1=be.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ue({key:new ae("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!t||!o)return Ce.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(a.isText)return;if(!(r>=u&&r<=u+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,u)=>{if(a.isText||!(r>=u&&r<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ve.node(u,u+a.nodeSize,{class:this.options.className}))}),Ce.create(n,i)}}})]}}),ED=be.create({name:"gapCursor",addProseMirrorPlugins(){return[uD()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=_e(oe(n,"allowGapCursor",t)))!=null?e:null}}}),Fb="placeholder";function MD(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Fb,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${MD(this.options.dataAttribute)}`:`data-${Fb}`;return[new ue({key:new ae("placeholder"),props:{decorations:({doc:e,selection:t})=>{const o=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!o)return null;const s=this.editor.isEmpty;return e.descendants((l,a)=>{const u=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&gd(l);if((u||!this.options.showOnlyCurrent)&&d){const f=[this.options.emptyNodeClass];s&&f.push(this.options.emptyEditorClass);const p=Ve.node(a,a+l.nodeSize,{class:f.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:u}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),Ce.create(e,i)}}})]}});be.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ue({key:new ae("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||lx(t.selection)||n.view.dragging?null:Ce.create(t.doc,[Ve.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function jb({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var TD=be.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ae(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",o=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(t).includes(r.name));return[new ue({key:e,appendTransaction:(r,i,s)=>{const{doc:l,tr:a,schema:u}=s,d=e.getState(s),f=l.content.size,p=u.nodes[t];if(d)return a.insert(f,p.create())},state:{init:(r,i)=>{const s=i.tr.doc.lastChild;return!jb({node:s,types:o})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const s=r.doc.lastChild;return!jb({node:s,types:o})}}})]}}),ND=be.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>s1(n,e),redo:()=>({state:n,dispatch:e})=>l1(n,e)}},addProseMirrorPlugins(){return[CD(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),AD=be.create({name:"starterKit",addExtensions(){var n,e,t,o;const r=[];return this.options.bold!==!1&&r.push(sB.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(Ox.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Wx.configure(this.options.bulletList)),this.options.code!==!1&&r.push(cB.configure(this.options.code)),this.options.codeBlock!==!1&&r.push($x.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Rx.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(SD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(ED.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(fB.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(pB.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(ND.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(Bx.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(vB.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Ux.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Yx.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&r.push(jx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(Zx.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(tD.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(rD.configure(this.options.strike)),this.options.text!==!1&&r.push(iD.configure(this.options.text)),this.options.underline!==!1&&r.push(t1.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&r.push(TD.configure((o=this.options)==null?void 0:o.trailingNode)),r}}),OD=AD;const X=c.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("span",{class:c.normalizeClass(["o-icon",{small:n.small}]),style:c.normalizeStyle({color:n.color})},[c.createElementVNode("i",{class:c.normalizeClass(["yiitip-icon",`icon-${n.name}`])},null,2)],6))}});var dn="top",Ln="bottom",Pn="right",fn="left",Jm="auto",ga=[dn,Ln,Pn,fn],ys="start",Hl="end",$D="clippingParents",c1="viewport",js="popper",RD="reference",Wb=ga.reduce(function(n,e){return n.concat([e+"-"+ys,e+"-"+Hl])},[]),u1=[].concat(ga,[Jm]).reduce(function(n,e){return n.concat([e,e+"-"+ys,e+"-"+Hl])},[]),BD="beforeRead",DD="read",_D="afterRead",ID="beforeMain",LD="main",PD="afterMain",VD="beforeWrite",zD="write",HD="afterWrite",FD=[BD,DD,_D,ID,LD,PD,VD,zD,HD];function Mo(n){return n?(n.nodeName||"").toLowerCase():null}function Cn(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function wi(n){var e=Cn(n).Element;return n instanceof e||n instanceof Element}function In(n){var e=Cn(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function Gm(n){if(typeof ShadowRoot>"u")return!1;var e=Cn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function jD(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var o=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];!In(i)||!Mo(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function WD(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:t[o]),l=s.reduce(function(a,u){return a[u]="",a},{});!In(r)||!Mo(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(a){r.removeAttribute(a)}))})}}const d1={name:"applyStyles",enabled:!0,phase:"write",fn:jD,effect:WD,requires:["computeStyles"]};function wo(n){return n.split("-")[0]}var si=Math.max,ku=Math.min,bs=Math.round;function Kp(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function f1(){return!/^((?!chrome|android).)*safari/i.test(Kp())}function vs(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var o=n.getBoundingClientRect(),r=1,i=1;e&&In(n)&&(r=n.offsetWidth>0&&bs(o.width)/n.offsetWidth||1,i=n.offsetHeight>0&&bs(o.height)/n.offsetHeight||1);var s=wi(n)?Cn(n):window,l=s.visualViewport,a=!f1()&&t,u=(o.left+(a&&l?l.offsetLeft:0))/r,d=(o.top+(a&&l?l.offsetTop:0))/i,f=o.width/r,p=o.height/i;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function Xm(n){var e=vs(n),t=n.offsetWidth,o=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:o}}function p1(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&Gm(t)){var o=e;do{if(o&&n.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Qo(n){return Cn(n).getComputedStyle(n)}function UD(n){return["table","td","th"].indexOf(Mo(n))>=0}function Hr(n){return((wi(n)?n.ownerDocument:n.document)||window.document).documentElement}function xd(n){return Mo(n)==="html"?n:n.assignedSlot||n.parentNode||(Gm(n)?n.host:null)||Hr(n)}function Ub(n){return!In(n)||Qo(n).position==="fixed"?null:n.offsetParent}function qD(n){var e=/firefox/i.test(Kp()),t=/Trident/i.test(Kp());if(t&&In(n)){var o=Qo(n);if(o.position==="fixed")return null}var r=xd(n);for(Gm(r)&&(r=r.host);In(r)&&["html","body"].indexOf(Mo(r))<0;){var i=Qo(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function ya(n){for(var e=Cn(n),t=Ub(n);t&&UD(t)&&Qo(t).position==="static";)t=Ub(t);return t&&(Mo(t)==="html"||Mo(t)==="body"&&Qo(t).position==="static")?e:t||qD(n)||e}function Ym(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function bl(n,e,t){return si(n,ku(e,t))}function KD(n,e,t){var o=bl(n,e,t);return o>t?t:o}function h1(){return{top:0,right:0,bottom:0,left:0}}function m1(n){return Object.assign({},h1(),n)}function g1(n,e){return e.reduce(function(t,o){return t[o]=n,t},{})}var JD=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,m1(typeof e!="number"?e:g1(e,ga))};function GD(n){var e,t=n.state,o=n.name,r=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,l=wo(t.placement),a=Ym(l),u=[fn,Pn].indexOf(l)>=0,d=u?"height":"width";if(!(!i||!s)){var f=JD(r.padding,t),p=Xm(i),h=a==="y"?dn:fn,m=a==="y"?Ln:Pn,g=t.rects.reference[d]+t.rects.reference[a]-s[a]-t.rects.popper[d],y=s[a]-t.rects.reference[a],b=ya(i),v=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,k=g/2-y/2,w=f[h],x=v-p[d]-f[m],C=v/2-p[d]/2+k,S=bl(w,C,x),T=a;t.modifiersData[o]=(e={},e[T]=S,e.centerOffset=S-C,e)}}function XD(n){var e=n.state,t=n.options,o=t.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||p1(e.elements.popper,r)&&(e.elements.arrow=r))}const YD={name:"arrow",enabled:!0,phase:"main",fn:GD,effect:XD,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ws(n){return n.split("-")[1]}var QD={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ZD(n,e){var t=n.x,o=n.y,r=e.devicePixelRatio||1;return{x:bs(t*r)/r||0,y:bs(o*r)/r||0}}function qb(n){var e,t=n.popper,o=n.popperRect,r=n.placement,i=n.variation,s=n.offsets,l=n.position,a=n.gpuAcceleration,u=n.adaptive,d=n.roundOffsets,f=n.isFixed,p=s.x,h=p===void 0?0:p,m=s.y,g=m===void 0?0:m,y=typeof d=="function"?d({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=s.hasOwnProperty("x"),v=s.hasOwnProperty("y"),k=fn,w=dn,x=window;if(u){var C=ya(t),S="clientHeight",T="clientWidth";if(C===Cn(t)&&(C=Hr(t),Qo(C).position!=="static"&&l==="absolute"&&(S="scrollHeight",T="scrollWidth")),C=C,r===dn||(r===fn||r===Pn)&&i===Hl){w=Ln;var N=f&&C===x&&x.visualViewport?x.visualViewport.height:C[S];g-=N-o.height,g*=a?1:-1}if(r===fn||(r===dn||r===Ln)&&i===Hl){k=Pn;var $=f&&C===x&&x.visualViewport?x.visualViewport.width:C[T];h-=$-o.width,h*=a?1:-1}}var O=Object.assign({position:l},u&&QD),A=d===!0?ZD({x:h,y:g},Cn(t)):{x:h,y:g};if(h=A.x,g=A.y,a){var B;return Object.assign({},O,(B={},B[w]=v?"0":"",B[k]=b?"0":"",B.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",B))}return Object.assign({},O,(e={},e[w]=v?g+"px":"",e[k]=b?h+"px":"",e.transform="",e))}function e_(n){var e=n.state,t=n.options,o=t.gpuAcceleration,r=o===void 0?!0:o,i=t.adaptive,s=i===void 0?!0:i,l=t.roundOffsets,a=l===void 0?!0:l,u={placement:wo(e.placement),variation:ws(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,qb(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,qb(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const t_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:e_,data:{}};var ja={passive:!0};function n_(n){var e=n.state,t=n.instance,o=n.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,a=Cn(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(d){d.addEventListener("scroll",t.update,ja)}),l&&a.addEventListener("resize",t.update,ja),function(){i&&u.forEach(function(d){d.removeEventListener("scroll",t.update,ja)}),l&&a.removeEventListener("resize",t.update,ja)}}const o_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:n_,data:{}};var r_={left:"right",right:"left",bottom:"top",top:"bottom"};function gc(n){return n.replace(/left|right|bottom|top/g,function(e){return r_[e]})}var i_={start:"end",end:"start"};function Kb(n){return n.replace(/start|end/g,function(e){return i_[e]})}function Qm(n){var e=Cn(n),t=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:t,scrollTop:o}}function Zm(n){return vs(Hr(n)).left+Qm(n).scrollLeft}function s_(n,e){var t=Cn(n),o=Hr(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;var u=f1();(u||!u&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}return{width:i,height:s,x:l+Zm(n),y:a}}function l_(n){var e,t=Hr(n),o=Qm(n),r=(e=n.ownerDocument)==null?void 0:e.body,i=si(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=si(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+Zm(n),a=-o.scrollTop;return Qo(r||t).direction==="rtl"&&(l+=si(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function eg(n){var e=Qo(n),t=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+o)}function y1(n){return["html","body","#document"].indexOf(Mo(n))>=0?n.ownerDocument.body:In(n)&&eg(n)?n:y1(xd(n))}function vl(n,e){var t;e===void 0&&(e=[]);var o=y1(n),r=o===((t=n.ownerDocument)==null?void 0:t.body),i=Cn(o),s=r?[i].concat(i.visualViewport||[],eg(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(vl(xd(s)))}function Jp(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function a_(n,e){var t=vs(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Jb(n,e,t){return e===c1?Jp(s_(n,t)):wi(e)?a_(e,t):Jp(l_(Hr(n)))}function c_(n){var e=vl(xd(n)),t=["absolute","fixed"].indexOf(Qo(n).position)>=0,o=t&&In(n)?ya(n):n;return wi(o)?e.filter(function(r){return wi(r)&&p1(r,o)&&Mo(r)!=="body"}):[]}function u_(n,e,t,o){var r=e==="clippingParents"?c_(n):[].concat(e),i=[].concat(r,[t]),s=i[0],l=i.reduce(function(a,u){var d=Jb(n,u,o);return a.top=si(d.top,a.top),a.right=ku(d.right,a.right),a.bottom=ku(d.bottom,a.bottom),a.left=si(d.left,a.left),a},Jb(n,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function b1(n){var e=n.reference,t=n.element,o=n.placement,r=o?wo(o):null,i=o?ws(o):null,s=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(r){case dn:a={x:s,y:e.y-t.height};break;case Ln:a={x:s,y:e.y+e.height};break;case Pn:a={x:e.x+e.width,y:l};break;case fn:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var u=r?Ym(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(i){case ys:a[u]=a[u]-(e[d]/2-t[d]/2);break;case Hl:a[u]=a[u]+(e[d]/2-t[d]/2);break}}return a}function Fl(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=o===void 0?n.placement:o,i=t.strategy,s=i===void 0?n.strategy:i,l=t.boundary,a=l===void 0?$D:l,u=t.rootBoundary,d=u===void 0?c1:u,f=t.elementContext,p=f===void 0?js:f,h=t.altBoundary,m=h===void 0?!1:h,g=t.padding,y=g===void 0?0:g,b=m1(typeof y!="number"?y:g1(y,ga)),v=p===js?RD:js,k=n.rects.popper,w=n.elements[m?v:p],x=u_(wi(w)?w:w.contextElement||Hr(n.elements.popper),a,d,s),C=vs(n.elements.reference),S=b1({reference:C,element:k,placement:r}),T=Jp(Object.assign({},k,S)),N=p===js?T:C,$={top:x.top-N.top+b.top,bottom:N.bottom-x.bottom+b.bottom,left:x.left-N.left+b.left,right:N.right-x.right+b.right},O=n.modifiersData.offset;if(p===js&&O){var A=O[r];Object.keys($).forEach(function(B){var I=[Pn,Ln].indexOf(B)>=0?1:-1,L=[dn,Ln].indexOf(B)>=0?"y":"x";$[B]+=A[L]*I})}return $}function d_(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=t.boundary,i=t.rootBoundary,s=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,u=a===void 0?u1:a,d=ws(o),f=d?l?Wb:Wb.filter(function(m){return ws(m)===d}):ga,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var h=p.reduce(function(m,g){return m[g]=Fl(n,{placement:g,boundary:r,rootBoundary:i,padding:s})[wo(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function f_(n){if(wo(n)===Jm)return[];var e=gc(n);return[Kb(n),e,Kb(e)]}function p_(n){var e=n.state,t=n.options,o=n.name;if(!e.modifiersData[o]._skip){for(var r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!0:s,a=t.fallbackPlacements,u=t.padding,d=t.boundary,f=t.rootBoundary,p=t.altBoundary,h=t.flipVariations,m=h===void 0?!0:h,g=t.allowedAutoPlacements,y=e.options.placement,b=wo(y),v=b===y,k=a||(v||!m?[gc(y)]:f_(y)),w=[y].concat(k).reduce(function(He,Te){return He.concat(wo(Te)===Jm?d_(e,{placement:Te,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:g}):Te)},[]),x=e.rects.reference,C=e.rects.popper,S=new Map,T=!0,N=w[0],$=0;$<w.length;$++){var O=w[$],A=wo(O),B=ws(O)===ys,I=[dn,Ln].indexOf(A)>=0,L=I?"width":"height",R=Fl(e,{placement:O,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),q=I?B?Pn:fn:B?Ln:dn;x[L]>C[L]&&(q=gc(q));var z=gc(q),W=[];if(i&&W.push(R[A]<=0),l&&W.push(R[q]<=0,R[z]<=0),W.every(function(He){return He})){N=O,T=!1;break}S.set(O,W)}if(T)for(var me=m?3:1,Ee=function(Te){var te=w.find(function(we){var Ne=S.get(we);if(Ne)return Ne.slice(0,Te).every(function(gt){return gt})});if(te)return N=te,"break"},De=me;De>0;De--){var je=Ee(De);if(je==="break")break}e.placement!==N&&(e.modifiersData[o]._skip=!0,e.placement=N,e.reset=!0)}}const h_={name:"flip",enabled:!0,phase:"main",fn:p_,requiresIfExists:["offset"],data:{_skip:!1}};function Gb(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function Xb(n){return[dn,Pn,Ln,fn].some(function(e){return n[e]>=0})}function m_(n){var e=n.state,t=n.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=Fl(e,{elementContext:"reference"}),l=Fl(e,{altBoundary:!0}),a=Gb(s,o),u=Gb(l,r,i),d=Xb(a),f=Xb(u);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const g_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:m_};function y_(n,e,t){var o=wo(n),r=[fn,dn].indexOf(o)>=0?-1:1,i=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=i[0],l=i[1];return s=s||0,l=(l||0)*r,[fn,Pn].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function b_(n){var e=n.state,t=n.options,o=n.name,r=t.offset,i=r===void 0?[0,0]:r,s=u1.reduce(function(d,f){return d[f]=y_(f,e.rects,i),d},{}),l=s[e.placement],a=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const v_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:b_};function w_(n){var e=n.state,t=n.name;e.modifiersData[t]=b1({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const k_={name:"popperOffsets",enabled:!0,phase:"read",fn:w_,data:{}};function x_(n){return n==="x"?"y":"x"}function C_(n){var e=n.state,t=n.options,o=n.name,r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!1:s,a=t.boundary,u=t.rootBoundary,d=t.altBoundary,f=t.padding,p=t.tether,h=p===void 0?!0:p,m=t.tetherOffset,g=m===void 0?0:m,y=Fl(e,{boundary:a,rootBoundary:u,padding:f,altBoundary:d}),b=wo(e.placement),v=ws(e.placement),k=!v,w=Ym(b),x=x_(w),C=e.modifiersData.popperOffsets,S=e.rects.reference,T=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,$=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,A={x:0,y:0};if(C){if(i){var B,I=w==="y"?dn:fn,L=w==="y"?Ln:Pn,R=w==="y"?"height":"width",q=C[w],z=q+y[I],W=q-y[L],me=h?-T[R]/2:0,Ee=v===ys?S[R]:T[R],De=v===ys?-T[R]:-S[R],je=e.elements.arrow,He=h&&je?Xm(je):{width:0,height:0},Te=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:h1(),te=Te[I],we=Te[L],Ne=bl(0,S[R],He[R]),gt=k?S[R]/2-me-Ne-te-$.mainAxis:Ee-Ne-te-$.mainAxis,yt=k?-S[R]/2+me+Ne+we+$.mainAxis:De+Ne+we+$.mainAxis,so=e.elements.arrow&&ya(e.elements.arrow),rr=so?w==="y"?so.clientTop||0:so.clientLeft||0:0,Bo=(B=O==null?void 0:O[w])!=null?B:0,Do=q+gt-Bo-rr,ir=q+yt-Bo,Mn=bl(h?ku(z,Do):z,q,h?si(W,ir):W);C[w]=Mn,A[w]=Mn-q}if(l){var _o,sr=w==="x"?dn:fn,lr=w==="x"?Ln:Pn,Pt=C[x],hn=x==="y"?"height":"width",lo=Pt+y[sr],mn=Pt-y[lr],Qt=[dn,fn].indexOf(b)!==-1,Io=(_o=O==null?void 0:O[x])!=null?_o:0,Vt=Qt?lo:Pt-S[hn]-T[hn]-Io+$.altAxis,jn=Qt?Pt+S[hn]+T[hn]-Io-$.altAxis:mn,ao=h&&Qt?KD(Vt,Pt,jn):bl(h?Vt:lo,Pt,h?jn:mn);C[x]=ao,A[x]=ao-Pt}e.modifiersData[o]=A}}const S_={name:"preventOverflow",enabled:!0,phase:"main",fn:C_,requiresIfExists:["offset"]};function E_(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function M_(n){return n===Cn(n)||!In(n)?Qm(n):E_(n)}function T_(n){var e=n.getBoundingClientRect(),t=bs(e.width)/n.offsetWidth||1,o=bs(e.height)/n.offsetHeight||1;return t!==1||o!==1}function N_(n,e,t){t===void 0&&(t=!1);var o=In(e),r=In(e)&&T_(e),i=Hr(e),s=vs(n,r,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!t)&&((Mo(e)!=="body"||eg(i))&&(l=M_(e)),In(e)?(a=vs(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=Zm(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function A_(n){var e=new Map,t=new Set,o=[];n.forEach(function(i){e.set(i.name,i)});function r(i){t.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&r(a)}}),o.push(i)}return n.forEach(function(i){t.has(i.name)||r(i)}),o}function O_(n){var e=A_(n);return FD.reduce(function(t,o){return t.concat(e.filter(function(r){return r.phase===o}))},[])}function $_(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function R_(n){var e=n.reduce(function(t,o){var r=t[o.name];return t[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,t},{});return Object.keys(e).map(function(t){return e[t]})}var Yb={placement:"bottom",modifiers:[],strategy:"absolute"};function Qb(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function B_(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,o=t===void 0?[]:t,r=e.defaultOptions,i=r===void 0?Yb:r;return function(l,a,u){u===void 0&&(u=i);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Yb,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},f=[],p=!1,h={state:d,setOptions:function(b){var v=typeof b=="function"?b(d.options):b;g(),d.options=Object.assign({},i,d.options,v),d.scrollParents={reference:wi(l)?vl(l):l.contextElement?vl(l.contextElement):[],popper:vl(a)};var k=O_(R_([].concat(o,d.options.modifiers)));return d.orderedModifiers=k.filter(function(w){return w.enabled}),m(),h.update()},forceUpdate:function(){if(!p){var b=d.elements,v=b.reference,k=b.popper;if(Qb(v,k)){d.rects={reference:N_(v,ya(k),d.options.strategy==="fixed"),popper:Xm(k)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function($){return d.modifiersData[$.name]=Object.assign({},$.data)});for(var w=0;w<d.orderedModifiers.length;w++){if(d.reset===!0){d.reset=!1,w=-1;continue}var x=d.orderedModifiers[w],C=x.fn,S=x.options,T=S===void 0?{}:S,N=x.name;typeof C=="function"&&(d=C({state:d,options:T,name:N,instance:h})||d)}}}},update:$_(function(){return new Promise(function(y){h.forceUpdate(),y(d)})}),destroy:function(){g(),p=!0}};if(!Qb(l,a))return h;h.setOptions(u).then(function(y){!p&&u.onFirstUpdate&&u.onFirstUpdate(y)});function m(){d.orderedModifiers.forEach(function(y){var b=y.name,v=y.options,k=v===void 0?{}:v,w=y.effect;if(typeof w=="function"){var x=w({state:d,name:b,instance:h,options:k}),C=function(){};f.push(x||C)}})}function g(){f.forEach(function(y){return y()}),f=[]}return h}}var D_=[o_,k_,t_,d1,v_,h_,S_,YD,g_],__=B_({defaultModifiers:D_}),I_="tippy-box",v1="tippy-content",L_="tippy-backdrop",w1="tippy-arrow",k1="tippy-svg-arrow",Jr={passive:!0,capture:!0},x1=function(){return document.body};function P_(n,e){return{}.hasOwnProperty.call(n,e)}function If(n,e,t){if(Array.isArray(n)){var o=n[e];return o??(Array.isArray(t)?t[e]:t)}return n}function tg(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function C1(n,e){return typeof n=="function"?n.apply(void 0,e):n}function Zb(n,e){if(e===0)return n;var t;return function(o){clearTimeout(t),t=setTimeout(function(){n(o)},e)}}function V_(n,e){var t=Object.assign({},n);return e.forEach(function(o){delete t[o]}),t}function z_(n){return n.split(/\s+/).filter(Boolean)}function Gi(n){return[].concat(n)}function ev(n,e){n.indexOf(e)===-1&&n.push(e)}function H_(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function F_(n){return n.split("-")[0]}function xu(n){return[].slice.call(n)}function tv(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function wl(){return document.createElement("div")}function jl(n){return["Element","Fragment"].some(function(e){return tg(n,e)})}function j_(n){return tg(n,"NodeList")}function W_(n){return tg(n,"MouseEvent")}function U_(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function q_(n){return jl(n)?[n]:j_(n)?xu(n):Array.isArray(n)?n:xu(document.querySelectorAll(n))}function Lf(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function nv(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function K_(n){var e,t=Gi(n),o=t[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function J_(n,e){var t=e.clientX,o=e.clientY;return n.every(function(r){var i=r.popperRect,s=r.popperState,l=r.props,a=l.interactiveBorder,u=F_(s.placement),d=s.modifiersData.offset;if(!d)return!0;var f=u==="bottom"?d.top.y:0,p=u==="top"?d.bottom.y:0,h=u==="right"?d.left.x:0,m=u==="left"?d.right.x:0,g=i.top-o+f>a,y=o-i.bottom-p>a,b=i.left-t+h>a,v=t-i.right-m>a;return g||y||b||v})}function Pf(n,e,t){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[o](r,t)})}function ov(n,e){for(var t=e;t;){var o;if(n.contains(t))return!0;t=t.getRootNode==null||(o=t.getRootNode())==null?void 0:o.host}return!1}var go={isTouch:!1},rv=0;function G_(){go.isTouch||(go.isTouch=!0,window.performance&&document.addEventListener("mousemove",S1))}function S1(){var n=performance.now();n-rv<20&&(go.isTouch=!1,document.removeEventListener("mousemove",S1)),rv=n}function X_(){var n=document.activeElement;if(U_(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function Y_(){document.addEventListener("touchstart",G_,Jr),window.addEventListener("blur",X_)}var Q_=typeof window<"u"&&typeof document<"u",Z_=Q_?!!window.msCrypto:!1;function Fi(n){var e=n==="destroy"?"n already-":" ";return[n+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function iv(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function eI(n){return iv(`
6
144
  %ctippy.js
7
145
 
8
- %c`+oa(t)+`
146
+ %c`+iv(n)+`
9
147
 
10
148
  %c👷‍ This is a development-only message. It will be removed in production.
11
- `)}function pi(t){return[Vu(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Dn;process.env.NODE_ENV!=="production"&&$u();function $u(){Dn=new Set}function Lt(t,n){if(t&&!Dn.has(n)){var o;Dn.add(n),(o=console).warn.apply(o,pi(n))}}function Jo(t,n){if(t&&!Dn.has(n)){var o;Dn.add(n),(o=console).error.apply(o,pi(n))}}function Pu(t){var n=!t,o=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;Jo(n,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Jo(o,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var fi={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Fu={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},et=Object.assign({appendTo:ci,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},fi,Fu),Uu=Object.keys(et),zu=function(n){process.env.NODE_ENV!=="production"&&gi(n,[]);var o=Object.keys(n);o.forEach(function(r){et[r]=n[r]})};function mi(t){var n=t.plugins||[],o=n.reduce(function(r,a){var l=a.name,i=a.defaultValue;if(l){var s;r[l]=t[l]!==void 0?t[l]:(s=et[l])!=null?s:i}return r},{});return Object.assign({},t,o)}function Hu(t,n){var o=n?Object.keys(mi(Object.assign({},et,{plugins:n}))):Uu,r=o.reduce(function(a,l){var i=(t.getAttribute("data-tippy-"+l)||"").trim();if(!i)return a;if(l==="content")a[l]=i;else try{a[l]=JSON.parse(i)}catch{a[l]=i}return a},{});return r}function ra(t,n){var o=Object.assign({},n,{content:ui(n.content,[t])},n.ignoreAttributes?{}:Hu(t,n.plugins));return o.aria=Object.assign({},et.aria,o.aria),o.aria={expanded:o.aria.expanded==="auto"?n.interactive:o.aria.expanded,content:o.aria.content==="auto"?n.interactive?null:"describedby":o.aria.content},o}function gi(t,n){t===void 0&&(t={}),n===void 0&&(n=[]);var o=Object.keys(t);o.forEach(function(r){var a=Eu(et,Object.keys(fi)),l=!yu(a,r);l&&(l=n.filter(function(i){return i.name===r}).length===0),Lt(l,["`"+r+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
149
+ `)}function E1(n){return[eI(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Wl;process.env.NODE_ENV!=="production"&&tI();function tI(){Wl=new Set}function Uo(n,e){if(n&&!Wl.has(e)){var t;Wl.add(e),(t=console).warn.apply(t,E1(e))}}function Gp(n,e){if(n&&!Wl.has(e)){var t;Wl.add(e),(t=console).error.apply(t,E1(e))}}function nI(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;Gp(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Gp(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var M1={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},oI={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},bn=Object.assign({appendTo:x1,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},M1,oI),rI=Object.keys(bn),iI=function(e){process.env.NODE_ENV!=="production"&&N1(e,[]);var t=Object.keys(e);t.forEach(function(o){bn[o]=e[o]})};function T1(n){var e=n.plugins||[],t=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var l;o[i]=n[i]!==void 0?n[i]:(l=bn[i])!=null?l:s}return o},{});return Object.assign({},n,t)}function sI(n,e){var t=e?Object.keys(T1(Object.assign({},bn,{plugins:e}))):rI,o=t.reduce(function(r,i){var s=(n.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function sv(n,e){var t=Object.assign({},e,{content:C1(e.content,[n])},e.ignoreAttributes?{}:sI(n,e.plugins));return t.aria=Object.assign({},bn.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}function N1(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(o){var r=V_(bn,Object.keys(M1)),i=!P_(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Uo(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
12
150
 
13
151
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
14
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var qu=function(){return"innerHTML"};function er(t,n){t[qu()]=n}function aa(t){var n=An();return t===!0?n.className=li:(n.className=si,In(t)?n.appendChild(t):er(n,t)),n}function ia(t,n){In(n.content)?(er(t,""),t.appendChild(n.content)):typeof n.content!="function"&&(n.allowHTML?er(t,n.content):t.textContent=n.content)}function tr(t){var n=t.firstElementChild,o=lo(n.children);return{box:n,content:o.find(function(r){return r.classList.contains(ii)}),arrow:o.find(function(r){return r.classList.contains(li)||r.classList.contains(si)}),backdrop:o.find(function(r){return r.classList.contains(ku)})}}function bi(t){var n=An(),o=An();o.className=_u,o.setAttribute("data-state","hidden"),o.setAttribute("tabindex","-1");var r=An();r.className=ii,r.setAttribute("data-state","hidden"),ia(r,t.props),n.appendChild(o),o.appendChild(r),a(t.props,t.props);function a(l,i){var s=tr(n),c=s.box,d=s.content,u=s.arrow;i.theme?c.setAttribute("data-theme",i.theme):c.removeAttribute("data-theme"),typeof i.animation=="string"?c.setAttribute("data-animation",i.animation):c.removeAttribute("data-animation"),i.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof i.maxWidth=="number"?i.maxWidth+"px":i.maxWidth,i.role?c.setAttribute("role",i.role):c.removeAttribute("role"),(l.content!==i.content||l.allowHTML!==i.allowHTML)&&ia(d,t.props),i.arrow?u?l.arrow!==i.arrow&&(c.removeChild(u),c.appendChild(aa(i.arrow))):c.appendChild(aa(i.arrow)):u&&c.removeChild(u)}return{popper:n,onUpdate:a}}bi.$$tippy=!0;var Gu=1,Yn=[],Uo=[];function Ku(t,n){var o=ra(t,Object.assign({},et,mi(Jr(n)))),r,a,l,i=!1,s=!1,c=!1,d=!1,u,p,m,f=[],v=Xr(ut,o.interactiveDebounce),b,h=Gu++,_=null,y=xu(o.plugins),E={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},g={id:h,reference:t,popper:An(),popperInstance:_,props:o,state:E,plugins:y,clearDelayTimeouts:Fe,setProps:dt,setContent:yt,show:En,hide:wn,hideWithInteractivity:nn,enable:He,disable:It,unmount:on,destroy:rn};if(!o.render)return process.env.NODE_ENV!=="production"&&Jo(!0,"render() function has not been supplied."),g;var N=o.render(g),x=N.popper,I=N.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+g.id,g.popper=x,t._tippy=g,x._tippy=g;var L=y.map(function(w){return w.fn(g)}),T=t.hasAttribute("aria-expanded");return rt(),X(),te(),B("onCreate",[g]),o.showOnCreate&&kt(),x.addEventListener("mouseenter",function(){g.props.interactive&&g.state.isVisible&&g.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){g.props.interactive&&g.props.trigger.indexOf("mouseenter")>=0&&V().addEventListener("mousemove",v)}),g;function P(){var w=g.props.touch;return Array.isArray(w)?w:[w,0]}function Z(){return P()[0]==="hold"}function O(){var w;return!!((w=g.props.render)!=null&&w.$$tippy)}function M(){return b||t}function V(){var w=M().parentNode;return w?Au(w):document}function F(){return tr(x)}function H(w){return g.state.isMounted&&!g.state.isVisible||Nt.isTouch||u&&u.type==="focus"?0:$o(g.props.delay,w?0:1,et.delay)}function te(w){w===void 0&&(w=!1),x.style.pointerEvents=g.props.interactive&&!w?"":"none",x.style.zIndex=""+g.props.zIndex}function B(w,S,q){if(q===void 0&&(q=!0),L.forEach(function(J){J[w]&&J[w].apply(J,S)}),q){var ae;(ae=g.props)[w].apply(ae,S)}}function D(){var w=g.props.aria;if(w.content){var S="aria-"+w.content,q=x.id,ae=ln(g.props.triggerTarget||t);ae.forEach(function(J){var Be=J.getAttribute(S);if(g.state.isVisible)J.setAttribute(S,Be?Be+" "+q:q);else{var De=Be&&Be.replace(q,"").trim();De?J.setAttribute(S,De):J.removeAttribute(S)}})}}function X(){if(!(T||!g.props.aria.expanded)){var w=ln(g.props.triggerTarget||t);w.forEach(function(S){g.props.interactive?S.setAttribute("aria-expanded",g.state.isVisible&&S===M()?"true":"false"):S.removeAttribute("aria-expanded")})}}function re(){V().removeEventListener("mousemove",v),Yn=Yn.filter(function(w){return w!==v})}function fe(w){if(!(Nt.isTouch&&(c||w.type==="mousedown"))){var S=w.composedPath&&w.composedPath()[0]||w.target;if(!(g.props.interactive&&ta(x,S))){if(ln(g.props.triggerTarget||t).some(function(q){return ta(q,S)})){if(Nt.isTouch||g.state.isVisible&&g.props.trigger.indexOf("click")>=0)return}else B("onClickOutside",[g,w]);g.props.hideOnClick===!0&&(g.clearDelayTimeouts(),g.hide(),s=!0,setTimeout(function(){s=!1}),g.state.isMounted||W())}}}function xe(){c=!0}function Se(){c=!1}function _e(){var w=V();w.addEventListener("mousedown",fe,!0),w.addEventListener("touchend",fe,Kt),w.addEventListener("touchstart",Se,Kt),w.addEventListener("touchmove",xe,Kt)}function W(){var w=V();w.removeEventListener("mousedown",fe,!0),w.removeEventListener("touchend",fe,Kt),w.removeEventListener("touchstart",Se,Kt),w.removeEventListener("touchmove",xe,Kt)}function se(w,S){Oe(w,function(){!g.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&S()})}function ce(w,S){Oe(w,S)}function Oe(w,S){var q=F().box;function ae(J){J.target===q&&(Fo(q,"remove",ae),S())}if(w===0)return S();Fo(q,"remove",p),Fo(q,"add",ae),p=ae}function Ae(w,S,q){q===void 0&&(q=!1);var ae=ln(g.props.triggerTarget||t);ae.forEach(function(J){J.addEventListener(w,S,q),f.push({node:J,eventType:w,handler:S,options:q})})}function rt(){Z()&&(Ae("touchstart",ct,{passive:!0}),Ae("touchend",ht,{passive:!0})),wu(g.props.trigger).forEach(function(w){if(w!=="manual")switch(Ae(w,ct),w){case"mouseenter":Ae("mouseleave",ht);break;case"focus":Ae(Lu?"focusout":"blur",ue);break;case"focusin":Ae("focusout",ue);break}})}function vt(){f.forEach(function(w){var S=w.node,q=w.eventType,ae=w.handler,J=w.options;S.removeEventListener(q,ae,J)}),f=[]}function ct(w){var S,q=!1;if(!(!g.state.isEnabled||Ke(w)||s)){var ae=((S=u)==null?void 0:S.type)==="focus";u=w,b=w.currentTarget,X(),!g.state.isVisible&&Su(w)&&Yn.forEach(function(J){return J(w)}),w.type==="click"&&(g.props.trigger.indexOf("mouseenter")<0||i)&&g.props.hideOnClick!==!1&&g.state.isVisible?q=!0:kt(w),w.type==="click"&&(i=!q),q&&!ae&&Qe(w)}}function ut(w){var S=w.target,q=M().contains(S)||x.contains(S);if(!(w.type==="mousemove"&&q)){var ae=Xe().concat(x).map(function(J){var Be,De=J._tippy,$t=(Be=De.popperInstance)==null?void 0:Be.state;return $t?{popperRect:J.getBoundingClientRect(),popperState:$t,props:o}:null}).filter(Boolean);Bu(ae,w)&&(re(),Qe(w))}}function ht(w){var S=Ke(w)||g.props.trigger.indexOf("click")>=0&&i;if(!S){if(g.props.interactive){g.hideWithInteractivity(w);return}Qe(w)}}function ue(w){g.props.trigger.indexOf("focusin")<0&&w.target!==M()||g.props.interactive&&w.relatedTarget&&x.contains(w.relatedTarget)||Qe(w)}function Ke(w){return Nt.isTouch?Z()!==w.type.indexOf("touch")>=0:!1}function We(){_t();var w=g.props,S=w.popperOptions,q=w.placement,ae=w.offset,J=w.getReferenceClientRect,Be=w.moveTransition,De=O()?tr(x).arrow:null,$t=J?{getBoundingClientRect:J,contextElement:J.contextElement||M()}:t,xn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(C){var R=C.state;if(O()){var ne=F(),we=ne.box;["placement","reference-hidden","escaped"].forEach(function(ke){ke==="placement"?we.setAttribute("data-placement",R.placement):R.attributes.popper["data-popper-"+ke]?we.setAttribute("data-"+ke,""):we.removeAttribute("data-"+ke)}),R.attributes.popper={}}}},Ye=[{name:"offset",options:{offset:ae}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Be}},xn];O()&&De&&Ye.push({name:"arrow",options:{element:De,padding:3}}),Ye.push.apply(Ye,(S==null?void 0:S.modifiers)||[]),g.popperInstance=hu($t,x,Object.assign({},S,{placement:q,onFirstUpdate:m,modifiers:Ye}))}function _t(){g.popperInstance&&(g.popperInstance.destroy(),g.popperInstance=null)}function Pe(){var w=g.props.appendTo,S,q=M();g.props.interactive&&w===ci||w==="parent"?S=q.parentNode:S=ui(w,[q]),S.contains(x)||S.appendChild(x),g.state.isMounted=!0,We(),process.env.NODE_ENV!=="production"&&Lt(g.props.interactive&&w===et.appendTo&&q.nextElementSibling!==x,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
152
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var lI=function(){return"innerHTML"};function Xp(n,e){n[lI()]=e}function lv(n){var e=wl();return n===!0?e.className=w1:(e.className=k1,jl(n)?e.appendChild(n):Xp(e,n)),e}function av(n,e){jl(e.content)?(Xp(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Xp(n,e.content):n.textContent=e.content)}function Yp(n){var e=n.firstElementChild,t=xu(e.children);return{box:e,content:t.find(function(o){return o.classList.contains(v1)}),arrow:t.find(function(o){return o.classList.contains(w1)||o.classList.contains(k1)}),backdrop:t.find(function(o){return o.classList.contains(L_)})}}function A1(n){var e=wl(),t=wl();t.className=I_,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var o=wl();o.className=v1,o.setAttribute("data-state","hidden"),av(o,n.props),e.appendChild(t),t.appendChild(o),r(n.props,n.props);function r(i,s){var l=Yp(e),a=l.box,u=l.content,d=l.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&av(u,n.props),s.arrow?d?i.arrow!==s.arrow&&(a.removeChild(d),a.appendChild(lv(s.arrow))):a.appendChild(lv(s.arrow)):d&&a.removeChild(d)}return{popper:e,onUpdate:r}}A1.$$tippy=!0;var aI=1,Wa=[],Vf=[];function cI(n,e){var t=sv(n,Object.assign({},bn,T1(tv(e)))),o,r,i,s=!1,l=!1,a=!1,u=!1,d,f,p,h=[],m=Zb(Do,t.interactiveDebounce),g,y=aI++,b=null,v=H_(t.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},w={id:y,reference:n,popper:wl(),popperInstance:b,props:t,state:k,plugins:v,clearDelayTimeouts:Vt,setProps:jn,setContent:ao,show:Is,hide:Ls,hideWithInteractivity:Li,enable:Qt,disable:Io,unmount:Pi,destroy:Vi};if(!t.render)return process.env.NODE_ENV!=="production"&&Gp(!0,"render() function has not been supplied."),w;var x=t.render(w),C=x.popper,S=x.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+w.id,w.popper=C,n._tippy=w,C._tippy=w;var T=v.map(function(M){return M.fn(w)}),N=n.hasAttribute("aria-expanded");return so(),me(),q(),z("onCreate",[w]),t.showOnCreate&&lo(),C.addEventListener("mouseenter",function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&I().addEventListener("mousemove",m)}),w;function $(){var M=w.props.touch;return Array.isArray(M)?M:[M,0]}function O(){return $()[0]==="hold"}function A(){var M;return!!((M=w.props.render)!=null&&M.$$tippy)}function B(){return g||n}function I(){var M=B().parentNode;return M?K_(M):document}function L(){return Yp(C)}function R(M){return w.state.isMounted&&!w.state.isVisible||go.isTouch||d&&d.type==="focus"?0:If(w.props.delay,M?0:1,bn.delay)}function q(M){M===void 0&&(M=!1),C.style.pointerEvents=w.props.interactive&&!M?"":"none",C.style.zIndex=""+w.props.zIndex}function z(M,P,ee){if(ee===void 0&&(ee=!0),T.forEach(function(fe){fe[M]&&fe[M].apply(fe,P)}),ee){var ve;(ve=w.props)[M].apply(ve,P)}}function W(){var M=w.props.aria;if(M.content){var P="aria-"+M.content,ee=C.id,ve=Gi(w.props.triggerTarget||n);ve.forEach(function(fe){var at=fe.getAttribute(P);if(w.state.isVisible)fe.setAttribute(P,at?at+" "+ee:ee);else{var Mt=at&&at.replace(ee,"").trim();Mt?fe.setAttribute(P,Mt):fe.removeAttribute(P)}})}}function me(){if(!(N||!w.props.aria.expanded)){var M=Gi(w.props.triggerTarget||n);M.forEach(function(P){w.props.interactive?P.setAttribute("aria-expanded",w.state.isVisible&&P===B()?"true":"false"):P.removeAttribute("aria-expanded")})}}function Ee(){I().removeEventListener("mousemove",m),Wa=Wa.filter(function(M){return M!==m})}function De(M){if(!(go.isTouch&&(a||M.type==="mousedown"))){var P=M.composedPath&&M.composedPath()[0]||M.target;if(!(w.props.interactive&&ov(C,P))){if(Gi(w.props.triggerTarget||n).some(function(ee){return ov(ee,P)})){if(go.isTouch||w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else z("onClickOutside",[w,M]);w.props.hideOnClick===!0&&(w.clearDelayTimeouts(),w.hide(),l=!0,setTimeout(function(){l=!1}),w.state.isMounted||te())}}}function je(){a=!0}function He(){a=!1}function Te(){var M=I();M.addEventListener("mousedown",De,!0),M.addEventListener("touchend",De,Jr),M.addEventListener("touchstart",He,Jr),M.addEventListener("touchmove",je,Jr)}function te(){var M=I();M.removeEventListener("mousedown",De,!0),M.removeEventListener("touchend",De,Jr),M.removeEventListener("touchstart",He,Jr),M.removeEventListener("touchmove",je,Jr)}function we(M,P){gt(M,function(){!w.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&P()})}function Ne(M,P){gt(M,P)}function gt(M,P){var ee=L().box;function ve(fe){fe.target===ee&&(Pf(ee,"remove",ve),P())}if(M===0)return P();Pf(ee,"remove",f),Pf(ee,"add",ve),f=ve}function yt(M,P,ee){ee===void 0&&(ee=!1);var ve=Gi(w.props.triggerTarget||n);ve.forEach(function(fe){fe.addEventListener(M,P,ee),h.push({node:fe,eventType:M,handler:P,options:ee})})}function so(){O()&&(yt("touchstart",Bo,{passive:!0}),yt("touchend",ir,{passive:!0})),z_(w.props.trigger).forEach(function(M){if(M!=="manual")switch(yt(M,Bo),M){case"mouseenter":yt("mouseleave",ir);break;case"focus":yt(Z_?"focusout":"blur",Mn);break;case"focusin":yt("focusout",Mn);break}})}function rr(){h.forEach(function(M){var P=M.node,ee=M.eventType,ve=M.handler,fe=M.options;P.removeEventListener(ee,ve,fe)}),h=[]}function Bo(M){var P,ee=!1;if(!(!w.state.isEnabled||_o(M)||l)){var ve=((P=d)==null?void 0:P.type)==="focus";d=M,g=M.currentTarget,me(),!w.state.isVisible&&W_(M)&&Wa.forEach(function(fe){return fe(M)}),M.type==="click"&&(w.props.trigger.indexOf("mouseenter")<0||s)&&w.props.hideOnClick!==!1&&w.state.isVisible?ee=!0:lo(M),M.type==="click"&&(s=!ee),ee&&!ve&&mn(M)}}function Do(M){var P=M.target,ee=B().contains(P)||C.contains(P);if(!(M.type==="mousemove"&&ee)){var ve=hn().concat(C).map(function(fe){var at,Mt=fe._tippy,ar=(at=Mt.popperInstance)==null?void 0:at.state;return ar?{popperRect:fe.getBoundingClientRect(),popperState:ar,props:t}:null}).filter(Boolean);J_(ve,M)&&(Ee(),mn(M))}}function ir(M){var P=_o(M)||w.props.trigger.indexOf("click")>=0&&s;if(!P){if(w.props.interactive){w.hideWithInteractivity(M);return}mn(M)}}function Mn(M){w.props.trigger.indexOf("focusin")<0&&M.target!==B()||w.props.interactive&&M.relatedTarget&&C.contains(M.relatedTarget)||mn(M)}function _o(M){return go.isTouch?O()!==M.type.indexOf("touch")>=0:!1}function sr(){lr();var M=w.props,P=M.popperOptions,ee=M.placement,ve=M.offset,fe=M.getReferenceClientRect,at=M.moveTransition,Mt=A()?Yp(C).arrow:null,ar=fe?{getBoundingClientRect:fe,contextElement:fe.contextElement||B()}:n,Ps={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(D){var j=D.state;if(A()){var ge=L(),Ye=ge.box;["placement","reference-hidden","escaped"].forEach(function(We){We==="placement"?Ye.setAttribute("data-placement",j.placement):j.attributes.popper["data-popper-"+We]?Ye.setAttribute("data-"+We,""):Ye.removeAttribute("data-"+We)}),j.attributes.popper={}}}},an=[{name:"offset",options:{offset:ve}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!at}},Ps];A()&&Mt&&an.push({name:"arrow",options:{element:Mt,padding:3}}),an.push.apply(an,(P==null?void 0:P.modifiers)||[]),w.popperInstance=__(ar,C,Object.assign({},P,{placement:ee,onFirstUpdate:p,modifiers:an}))}function lr(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function Pt(){var M=w.props.appendTo,P,ee=B();w.props.interactive&&M===x1||M==="parent"?P=ee.parentNode:P=C1(M,[ee]),P.contains(C)||P.appendChild(C),w.state.isMounted=!0,sr(),process.env.NODE_ENV!=="production"&&Uo(w.props.interactive&&M===bn.appendTo&&ee.nextElementSibling!==C,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
15
153
 
16
154
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
17
155
 
18
156
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
19
157
 
20
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Xe(){return lo(x.querySelectorAll("[data-tippy-root]"))}function kt(w){g.clearDelayTimeouts(),w&&B("onTrigger",[g,w]),_e();var S=H(!0),q=P(),ae=q[0],J=q[1];Nt.isTouch&&ae==="hold"&&J&&(S=J),S?r=setTimeout(function(){g.show()},S):g.show()}function Qe(w){if(g.clearDelayTimeouts(),B("onUntrigger",[g,w]),!g.state.isVisible){W();return}if(!(g.props.trigger.indexOf("mouseenter")>=0&&g.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&i)){var S=H(!1);S?a=setTimeout(function(){g.state.isVisible&&g.hide()},S):l=requestAnimationFrame(function(){g.hide()})}}function He(){g.state.isEnabled=!0}function It(){g.hide(),g.state.isEnabled=!1}function Fe(){clearTimeout(r),clearTimeout(a),cancelAnimationFrame(l)}function dt(w){if(process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("setProps")),!g.state.isDestroyed){B("onBeforeUpdate",[g,w]),vt();var S=g.props,q=ra(t,Object.assign({},S,Jr(w),{ignoreAttributes:!0}));g.props=q,rt(),S.interactiveDebounce!==q.interactiveDebounce&&(re(),v=Xr(ut,q.interactiveDebounce)),S.triggerTarget&&!q.triggerTarget?ln(S.triggerTarget).forEach(function(ae){ae.removeAttribute("aria-expanded")}):q.triggerTarget&&t.removeAttribute("aria-expanded"),X(),te(),I&&I(S,q),g.popperInstance&&(We(),Xe().forEach(function(ae){requestAnimationFrame(ae._tippy.popperInstance.forceUpdate)})),B("onAfterUpdate",[g,w])}}function yt(w){g.setProps({content:w})}function En(){process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("show"));var w=g.state.isVisible,S=g.state.isDestroyed,q=!g.state.isEnabled,ae=Nt.isTouch&&!g.props.touch,J=$o(g.props.duration,0,et.duration);if(!(w||S||q||ae)&&!M().hasAttribute("disabled")&&(B("onShow",[g],!1),g.props.onShow(g)!==!1)){if(g.state.isVisible=!0,O()&&(x.style.visibility="visible"),te(),_e(),g.state.isMounted||(x.style.transition="none"),O()){var Be=F(),De=Be.box,$t=Be.content;Po([De,$t],0)}m=function(){var Ye;if(!(!g.state.isVisible||d)){if(d=!0,x.offsetHeight,x.style.transition=g.props.moveTransition,O()&&g.props.animation){var k=F(),C=k.box,R=k.content;Po([C,R],J),ea([C,R],"visible")}D(),X(),Qr(Uo,g),(Ye=g.popperInstance)==null||Ye.forceUpdate(),B("onMount",[g]),g.props.animation&&O()&&ce(J,function(){g.state.isShown=!0,B("onShown",[g])})}},Pe()}}function wn(){process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("hide"));var w=!g.state.isVisible,S=g.state.isDestroyed,q=!g.state.isEnabled,ae=$o(g.props.duration,1,et.duration);if(!(w||S||q)&&(B("onHide",[g],!1),g.props.onHide(g)!==!1)){if(g.state.isVisible=!1,g.state.isShown=!1,d=!1,i=!1,O()&&(x.style.visibility="hidden"),re(),W(),te(!0),O()){var J=F(),Be=J.box,De=J.content;g.props.animation&&(Po([Be,De],ae),ea([Be,De],"hidden"))}D(),X(),g.props.animation?O()&&se(ae,g.unmount):g.unmount()}}function nn(w){process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("hideWithInteractivity")),V().addEventListener("mousemove",v),Qr(Yn,v),v(w)}function on(){process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("unmount")),g.state.isVisible&&g.hide(),g.state.isMounted&&(_t(),Xe().forEach(function(w){w._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),Uo=Uo.filter(function(w){return w!==g}),g.state.isMounted=!1,B("onHidden",[g]))}function rn(){process.env.NODE_ENV!=="production"&&Lt(g.state.isDestroyed,an("destroy")),!g.state.isDestroyed&&(g.clearDelayTimeouts(),g.unmount(),vt(),delete t._tippy,g.state.isDestroyed=!0,B("onDestroy",[g]))}}function Mt(t,n){n===void 0&&(n={});var o=et.plugins.concat(n.plugins||[]);process.env.NODE_ENV!=="production"&&(Pu(t),gi(n,o)),Iu();var r=Object.assign({},n,{plugins:o}),a=Ou(t);if(process.env.NODE_ENV!=="production"){var l=In(r.content),i=a.length>1;Lt(l&&i,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
158
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function hn(){return xu(C.querySelectorAll("[data-tippy-root]"))}function lo(M){w.clearDelayTimeouts(),M&&z("onTrigger",[w,M]),Te();var P=R(!0),ee=$(),ve=ee[0],fe=ee[1];go.isTouch&&ve==="hold"&&fe&&(P=fe),P?o=setTimeout(function(){w.show()},P):w.show()}function mn(M){if(w.clearDelayTimeouts(),z("onUntrigger",[w,M]),!w.state.isVisible){te();return}if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(M.type)>=0&&s)){var P=R(!1);P?r=setTimeout(function(){w.state.isVisible&&w.hide()},P):i=requestAnimationFrame(function(){w.hide()})}}function Qt(){w.state.isEnabled=!0}function Io(){w.hide(),w.state.isEnabled=!1}function Vt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function jn(M){if(process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("setProps")),!w.state.isDestroyed){z("onBeforeUpdate",[w,M]),rr();var P=w.props,ee=sv(n,Object.assign({},P,tv(M),{ignoreAttributes:!0}));w.props=ee,so(),P.interactiveDebounce!==ee.interactiveDebounce&&(Ee(),m=Zb(Do,ee.interactiveDebounce)),P.triggerTarget&&!ee.triggerTarget?Gi(P.triggerTarget).forEach(function(ve){ve.removeAttribute("aria-expanded")}):ee.triggerTarget&&n.removeAttribute("aria-expanded"),me(),q(),S&&S(P,ee),w.popperInstance&&(sr(),hn().forEach(function(ve){requestAnimationFrame(ve._tippy.popperInstance.forceUpdate)})),z("onAfterUpdate",[w,M])}}function ao(M){w.setProps({content:M})}function Is(){process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("show"));var M=w.state.isVisible,P=w.state.isDestroyed,ee=!w.state.isEnabled,ve=go.isTouch&&!w.props.touch,fe=If(w.props.duration,0,bn.duration);if(!(M||P||ee||ve)&&!B().hasAttribute("disabled")&&(z("onShow",[w],!1),w.props.onShow(w)!==!1)){if(w.state.isVisible=!0,A()&&(C.style.visibility="visible"),q(),Te(),w.state.isMounted||(C.style.transition="none"),A()){var at=L(),Mt=at.box,ar=at.content;Lf([Mt,ar],0)}p=function(){var an;if(!(!w.state.isVisible||u)){if(u=!0,C.offsetHeight,C.style.transition=w.props.moveTransition,A()&&w.props.animation){var E=L(),D=E.box,j=E.content;Lf([D,j],fe),nv([D,j],"visible")}W(),me(),ev(Vf,w),(an=w.popperInstance)==null||an.forceUpdate(),z("onMount",[w]),w.props.animation&&A()&&Ne(fe,function(){w.state.isShown=!0,z("onShown",[w])})}},Pt()}}function Ls(){process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("hide"));var M=!w.state.isVisible,P=w.state.isDestroyed,ee=!w.state.isEnabled,ve=If(w.props.duration,1,bn.duration);if(!(M||P||ee)&&(z("onHide",[w],!1),w.props.onHide(w)!==!1)){if(w.state.isVisible=!1,w.state.isShown=!1,u=!1,s=!1,A()&&(C.style.visibility="hidden"),Ee(),te(),q(!0),A()){var fe=L(),at=fe.box,Mt=fe.content;w.props.animation&&(Lf([at,Mt],ve),nv([at,Mt],"hidden"))}W(),me(),w.props.animation?A()&&we(ve,w.unmount):w.unmount()}}function Li(M){process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("hideWithInteractivity")),I().addEventListener("mousemove",m),ev(Wa,m),m(M)}function Pi(){process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("unmount")),w.state.isVisible&&w.hide(),w.state.isMounted&&(lr(),hn().forEach(function(M){M._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Vf=Vf.filter(function(M){return M!==w}),w.state.isMounted=!1,z("onHidden",[w]))}function Vi(){process.env.NODE_ENV!=="production"&&Uo(w.state.isDestroyed,Fi("destroy")),!w.state.isDestroyed&&(w.clearDelayTimeouts(),w.unmount(),rr(),delete n._tippy,w.state.isDestroyed=!0,z("onDestroy",[w]))}}function Ao(n,e){e===void 0&&(e={});var t=bn.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(nI(n),N1(e,t)),Y_();var o=Object.assign({},e,{plugins:t}),r=q_(n);if(process.env.NODE_ENV!=="production"){var i=jl(o.content),s=r.length>1;Uo(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
21
159
 
22
160
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
23
161
 
24
162
  `,`1) content: element.innerHTML
25
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var s=a.reduce(function(c,d){var u=d&&Ku(d,r);return u&&c.push(u),c},[]);return In(t)?s[0]:s}Mt.defaultProps=et;Mt.setDefaultProps=zu;Mt.currentInput=Nt;Object.assign({},Qa,{effect:function(n){var o=n.state,r={popper:{position:o.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(o.elements.popper.style,r.popper),o.styles=r,o.elements.arrow&&Object.assign(o.elements.arrow.style,r.arrow)}});Mt.setDefaultProps({render:bi});const st=e.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const n=t,{theme:o}=tn(),r=e.ref(),a=e.ref(),l=e.ref();function i(){l.value=Mt(r.value,{appendTo:()=>document.body,animation:"perspective",content:a.value,duration:n.duration,delay:n.delay,interactive:!0,offset:n.offset,placement:n.placement,trigger:n.trigger})}function s(){l.value.setProps({theme:o.value})}return e.watch(o,c=>{s()}),e.onMounted(()=>{i()}),e.onUnmounted(()=>{l.value&&l.value.destroy()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:r,"data-tippy-role":"tooltip"},[e.renderSlot(c.$slots,"trigger"),e.createElementVNode("div",{ref_key:"contentRef",ref:a,class:"tooltip-content"},[e.renderSlot(c.$slots,"default")],512)],512))}}),pe=e.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createBlock(st,{class:"o-tooltip",placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:a[0]||(a[0]=l=>o("click",l))},[e.createVNode(U,{name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"]),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Wu={class:"o-table-grid"},Yu=["onMouseover"],vi=e.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:n}){const o=n,r=e.ref(6),a=e.ref(6),l=e.ref(2),i=e.ref(2);function s(d,u){l.value=d,i.value=u,r.value===d&&r.value<10&&(r.value+=1),a.value===u&&a.value<10&&(a.value+=1)}function c(){o("select",{rows:l.value,cols:i.value,withHeaderRow:!0})}return(d,u)=>(e.openBlock(),e.createElementBlock("section",Wu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:"rows",key:`row-${m}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,v)=>(e.openBlock(),e.createElementBlock("div",{key:`col-${v}`},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{selected:p<=l.value&&f<=i.value}]),onMouseover:b=>s(p,f),onClick:c},null,42,Yu)]))),128))]))),128)),e.createElementVNode("footer",null,e.toDisplayString(l.value)+" x "+e.toDisplayString(i.value),1)]))}}),ju={class:"o-table-cell-background o-button-group"},Zu={class:"o-command-btn"},hi=e.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"tableCellAttribute",{name:"background",value:l.value})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),{trigger:"hover"},{trigger:e.withCtx(()=>[e.createElementVNode("div",ju,[e.createElementVNode("div",{class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},[e.createVNode(e.unref(U),{name:"crop_16_9",class:"arrow"}),e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),e.createElementVNode("div",Zu,[e.createVNode(e.unref(U),{name:"arrow_drop_down"})])])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),onSelect:s},null,8,["default-label"])]),_:1},512))}}),Xu={class:"o-simple-color-board"},Qu={class:"fore-colors"},Ju={class:"label o-tips"},ed={class:"color-row"},td={class:"color-row"},nd={class:"back-colors"},od={class:"label o-tips"},rd={class:"color-row"},ad={class:"color-row"},yr=e.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=n,{tr:r}=Q();function a(s,c){o("select",{name:s,value:c.value})}const l=e.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=e.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,c)=>(e.openBlock(),e.createElementBlock("section",Xu,[e.createElementVNode("section",Qu,[e.createElementVNode("header",null,[e.createElementVNode("div",Ju,e.toDisplayString(e.unref(r)("editor.textColor")),1),e.createVNode(e.unref(ge),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(he),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-disabled":"",onSelect:c[0]||(c[0]=d=>a("color",{value:d}))})]),_:1},512)]),e.createElementVNode("div",ed,[e.createVNode(e.unref(pe),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:c[1]||(c[1]=d=>a("color",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:c[2]||(c[2]=d=>a("color",{value:t.foreColor}))},null,8,["color"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",td,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:`col-${u}`,icon:"format_text",color:d.value,tooltip:d.label,onClick:p=>a("color",d)},null,8,["color","tooltip","onClick"]))),128))])]),e.createElementVNode("section",nd,[e.createElementVNode("header",null,[e.createElementVNode("div",od,e.toDisplayString(e.unref(r)("editor.backgroundColor")),1),e.createVNode(e.unref(ge),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(he),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-disabled":"",onSelect:c[3]||(c[3]=d=>a("backgroundColor",{value:d}))})]),_:1},512)]),e.createElementVNode("div",rd,[e.createVNode(e.unref(pe),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:c[4]||(c[4]=d=>a("backgroundColor",{value:""}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:c[5]||(c[5]=d=>a("backgroundColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ad,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:`col-${u}`,icon:"format_text",tooltip:d.label,"content-style":{backgroundColor:d.value},onClick:p=>a("backgroundColor",d)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),so=Math.min,jt=Math.max,co=Math.round,jn=Math.floor,Tt=t=>({x:t,y:t}),id={left:"right",right:"left",bottom:"top",top:"bottom"},ld={start:"end",end:"start"};function la(t,n,o){return jt(t,so(n,o))}function wo(t,n){return typeof t=="function"?t(n):t}function Jt(t){return t.split("-")[0]}function xo(t){return t.split("-")[1]}function _i(t){return t==="x"?"y":"x"}function ki(t){return t==="y"?"height":"width"}const sd=new Set(["top","bottom"]);function Ut(t){return sd.has(Jt(t))?"y":"x"}function yi(t){return _i(Ut(t))}function cd(t,n,o){o===void 0&&(o=!1);const r=xo(t),a=yi(t),l=ki(a);let i=a==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(i=uo(i)),[i,uo(i)]}function ud(t){const n=uo(t);return[nr(t),n,nr(n)]}function nr(t){return t.replace(/start|end/g,n=>ld[n])}const sa=["left","right"],ca=["right","left"],dd=["top","bottom"],pd=["bottom","top"];function fd(t,n,o){switch(t){case"top":case"bottom":return o?n?ca:sa:n?sa:ca;case"left":case"right":return n?dd:pd;default:return[]}}function md(t,n,o,r){const a=xo(t);let l=fd(Jt(t),o==="start",r);return a&&(l=l.map(i=>i+"-"+a),n&&(l=l.concat(l.map(nr)))),l}function uo(t){return t.replace(/left|right|bottom|top/g,n=>id[n])}function gd(t){return{top:0,right:0,bottom:0,left:0,...t}}function bd(t){return typeof t!="number"?gd(t):{top:t,right:t,bottom:t,left:t}}function po(t){const{x:n,y:o,width:r,height:a}=t;return{width:r,height:a,top:o,left:n,right:n+r,bottom:o+a,x:n,y:o}}function ua(t,n,o){let{reference:r,floating:a}=t;const l=Ut(n),i=yi(n),s=ki(i),c=Jt(n),d=l==="y",u=r.x+r.width/2-a.width/2,p=r.y+r.height/2-a.height/2,m=r[s]/2-a[s]/2;let f;switch(c){case"top":f={x:u,y:r.y-a.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-a.width,y:p};break;default:f={x:r.x,y:r.y}}switch(xo(n)){case"start":f[i]-=m*(o&&d?-1:1);break;case"end":f[i]+=m*(o&&d?-1:1);break}return f}const vd=async(t,n,o)=>{const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:i}=o,s=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(n));let d=await i.getElementRects({reference:t,floating:n,strategy:a}),{x:u,y:p}=ua(d,r,c),m=r,f={},v=0;for(let b=0;b<s.length;b++){const{name:h,fn:_}=s[b],{x:y,y:E,data:g,reset:N}=await _({x:u,y:p,initialPlacement:r,placement:m,strategy:a,middlewareData:f,rects:d,platform:i,elements:{reference:t,floating:n}});u=y??u,p=E??p,f={...f,[h]:{...f[h],...g}},N&&v<=50&&(v++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:t,floating:n,strategy:a}):N.rects),{x:u,y:p}=ua(d,m,c)),b=-1)}return{x:u,y:p,placement:m,strategy:a,middlewareData:f}};async function Ei(t,n){var o;n===void 0&&(n={});const{x:r,y:a,platform:l,rects:i,elements:s,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:f=0}=wo(n,t),v=bd(f),h=s[m?p==="floating"?"reference":"floating":p],_=po(await l.getClippingRect({element:(o=await(l.isElement==null?void 0:l.isElement(h)))==null||o?h:h.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(s.floating)),boundary:d,rootBoundary:u,strategy:c})),y=p==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(s.floating)),g=await(l.isElement==null?void 0:l.isElement(E))?await(l.getScale==null?void 0:l.getScale(E))||{x:1,y:1}:{x:1,y:1},N=po(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:E,strategy:c}):y);return{top:(_.top-N.top+v.top)/g.y,bottom:(N.bottom-_.bottom+v.bottom)/g.y,left:(_.left-N.left+v.left)/g.x,right:(N.right-_.right+v.right)/g.x}}const hd=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,r;const{placement:a,middlewareData:l,rects:i,initialPlacement:s,platform:c,elements:d}=n,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...h}=wo(t,n);if((o=l.arrow)!=null&&o.alignmentOffset)return{};const _=Jt(a),y=Ut(s),E=Jt(s)===s,g=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(E||!b?[uo(s)]:ud(s)),x=v!=="none";!m&&x&&N.push(...md(s,b,v,g));const I=[s,...N],L=await Ei(n,h),T=[];let P=((r=l.flip)==null?void 0:r.overflows)||[];if(u&&T.push(L[_]),p){const V=cd(a,i,g);T.push(L[V[0]],L[V[1]])}if(P=[...P,{placement:a,overflows:T}],!T.every(V=>V<=0)){var Z,O;const V=(((Z=l.flip)==null?void 0:Z.index)||0)+1,F=I[V];if(F&&(!(p==="alignment"?y!==Ut(F):!1)||P.every(B=>Ut(B.placement)===y?B.overflows[0]>0:!0)))return{data:{index:V,overflows:P},reset:{placement:F}};let H=(O=P.filter(te=>te.overflows[0]<=0).sort((te,B)=>te.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!H)switch(f){case"bestFit":{var M;const te=(M=P.filter(B=>{if(x){const D=Ut(B.placement);return D===y||D==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(D=>D>0).reduce((D,X)=>D+X,0)]).sort((B,D)=>B[1]-D[1])[0])==null?void 0:M[0];te&&(H=te);break}case"initialPlacement":H=s;break}if(a!==H)return{reset:{placement:H}}}return{}}}},_d=new Set(["left","top"]);async function kd(t,n){const{placement:o,platform:r,elements:a}=t,l=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Jt(o),s=xo(o),c=Ut(o)==="y",d=_d.has(i)?-1:1,u=l&&c?-1:1,p=wo(n,t);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return s&&typeof v=="number"&&(f=s==="end"?v*-1:v),c?{x:f*u,y:m*d}:{x:m*d,y:f*u}}const yd=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,r;const{x:a,y:l,placement:i,middlewareData:s}=n,c=await kd(n,t);return i===((o=s.offset)==null?void 0:o.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:l+c.y,data:{...c,placement:i}}}}},Ed=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:r,placement:a}=n,{mainAxis:l=!0,crossAxis:i=!1,limiter:s={fn:h=>{let{x:_,y}=h;return{x:_,y}}},...c}=wo(t,n),d={x:o,y:r},u=await Ei(n,c),p=Ut(Jt(a)),m=_i(p);let f=d[m],v=d[p];if(l){const h=m==="y"?"top":"left",_=m==="y"?"bottom":"right",y=f+u[h],E=f-u[_];f=la(y,f,E)}if(i){const h=p==="y"?"top":"left",_=p==="y"?"bottom":"right",y=v+u[h],E=v-u[_];v=la(y,v,E)}const b=s.fn({...n,[m]:f,[p]:v});return{...b,data:{x:b.x-o,y:b.y-r,enabled:{[m]:l,[p]:i}}}}}};function No(){return typeof window<"u"}function yn(t){return wi(t)?(t.nodeName||"").toLowerCase():"#document"}function tt(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function Rt(t){var n;return(n=(wi(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function wi(t){return No()?t instanceof Node||t instanceof tt(t).Node:!1}function mt(t){return No()?t instanceof Element||t instanceof tt(t).Element:!1}function Bt(t){return No()?t instanceof HTMLElement||t instanceof tt(t).HTMLElement:!1}function da(t){return!No()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof tt(t).ShadowRoot}const wd=new Set(["inline","contents"]);function Fn(t){const{overflow:n,overflowX:o,overflowY:r,display:a}=gt(t);return/auto|scroll|overlay|hidden|clip/.test(n+r+o)&&!wd.has(a)}const xd=new Set(["table","td","th"]);function Nd(t){return xd.has(yn(t))}const Cd=[":popover-open",":modal"];function Co(t){return Cd.some(n=>{try{return t.matches(n)}catch{return!1}})}const Sd=["transform","translate","scale","rotate","perspective"],Td=["transform","translate","scale","rotate","perspective","filter"],Od=["paint","layout","strict","content"];function Er(t){const n=wr(),o=mt(t)?gt(t):t;return Sd.some(r=>o[r]?o[r]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Td.some(r=>(o.willChange||"").includes(r))||Od.some(r=>(o.contain||"").includes(r))}function Ad(t){let n=zt(t);for(;Bt(n)&&!_n(n);){if(Er(n))return n;if(Co(n))return null;n=zt(n)}return null}function wr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Bd=new Set(["html","body","#document"]);function _n(t){return Bd.has(yn(t))}function gt(t){return tt(t).getComputedStyle(t)}function So(t){return mt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function zt(t){if(yn(t)==="html")return t;const n=t.assignedSlot||t.parentNode||da(t)&&t.host||Rt(t);return da(n)?n.host:n}function xi(t){const n=zt(t);return _n(n)?t.ownerDocument?t.ownerDocument.body:t.body:Bt(n)&&Fn(n)?n:xi(n)}function Ln(t,n,o){var r;n===void 0&&(n=[]),o===void 0&&(o=!0);const a=xi(t),l=a===((r=t.ownerDocument)==null?void 0:r.body),i=tt(a);if(l){const s=or(i);return n.concat(i,i.visualViewport||[],Fn(a)?a:[],s&&o?Ln(s):[])}return n.concat(a,Ln(a,[],o))}function or(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ni(t){const n=gt(t);let o=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const a=Bt(t),l=a?t.offsetWidth:o,i=a?t.offsetHeight:r,s=co(o)!==l||co(r)!==i;return s&&(o=l,r=i),{width:o,height:r,$:s}}function xr(t){return mt(t)?t:t.contextElement}function dn(t){const n=xr(t);if(!Bt(n))return Tt(1);const o=n.getBoundingClientRect(),{width:r,height:a,$:l}=Ni(n);let i=(l?co(o.width):o.width)/r,s=(l?co(o.height):o.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const Md=Tt(0);function Ci(t){const n=tt(t);return!wr()||!n.visualViewport?Md:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Rd(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==tt(t)?!1:n}function en(t,n,o,r){n===void 0&&(n=!1),o===void 0&&(o=!1);const a=t.getBoundingClientRect(),l=xr(t);let i=Tt(1);n&&(r?mt(r)&&(i=dn(r)):i=dn(t));const s=Rd(l,o,r)?Ci(l):Tt(0);let c=(a.left+s.x)/i.x,d=(a.top+s.y)/i.y,u=a.width/i.x,p=a.height/i.y;if(l){const m=tt(l),f=r&&mt(r)?tt(r):r;let v=m,b=or(v);for(;b&&r&&f!==v;){const h=dn(b),_=b.getBoundingClientRect(),y=gt(b),E=_.left+(b.clientLeft+parseFloat(y.paddingLeft))*h.x,g=_.top+(b.clientTop+parseFloat(y.paddingTop))*h.y;c*=h.x,d*=h.y,u*=h.x,p*=h.y,c+=E,d+=g,v=tt(b),b=or(v)}}return po({width:u,height:p,x:c,y:d})}function To(t,n){const o=So(t).scrollLeft;return n?n.left+o:en(Rt(t)).left+o}function Si(t,n){const o=t.getBoundingClientRect(),r=o.left+n.scrollLeft-To(t,o),a=o.top+n.scrollTop;return{x:r,y:a}}function Id(t){let{elements:n,rect:o,offsetParent:r,strategy:a}=t;const l=a==="fixed",i=Rt(r),s=n?Co(n.floating):!1;if(r===i||s&&l)return o;let c={scrollLeft:0,scrollTop:0},d=Tt(1);const u=Tt(0),p=Bt(r);if((p||!p&&!l)&&((yn(r)!=="body"||Fn(i))&&(c=So(r)),Bt(r))){const f=en(r);d=dn(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const m=i&&!p&&!l?Si(i,c):Tt(0);return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:o.y*d.y-c.scrollTop*d.y+u.y+m.y}}function Dd(t){return Array.from(t.getClientRects())}function Ld(t){const n=Rt(t),o=So(t),r=t.ownerDocument.body,a=jt(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),l=jt(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let i=-o.scrollLeft+To(t);const s=-o.scrollTop;return gt(r).direction==="rtl"&&(i+=jt(n.clientWidth,r.clientWidth)-a),{width:a,height:l,x:i,y:s}}const pa=25;function Vd(t,n){const o=tt(t),r=Rt(t),a=o.visualViewport;let l=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){l=a.width,i=a.height;const u=wr();(!u||u&&n==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}const d=To(r);if(d<=0){const u=r.ownerDocument,p=u.body,m=getComputedStyle(p),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,v=Math.abs(r.clientWidth-p.clientWidth-f);v<=pa&&(l-=v)}else d<=pa&&(l+=d);return{width:l,height:i,x:s,y:c}}const $d=new Set(["absolute","fixed"]);function Pd(t,n){const o=en(t,!0,n==="fixed"),r=o.top+t.clientTop,a=o.left+t.clientLeft,l=Bt(t)?dn(t):Tt(1),i=t.clientWidth*l.x,s=t.clientHeight*l.y,c=a*l.x,d=r*l.y;return{width:i,height:s,x:c,y:d}}function fa(t,n,o){let r;if(n==="viewport")r=Vd(t,o);else if(n==="document")r=Ld(Rt(t));else if(mt(n))r=Pd(n,o);else{const a=Ci(t);r={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return po(r)}function Ti(t,n){const o=zt(t);return o===n||!mt(o)||_n(o)?!1:gt(o).position==="fixed"||Ti(o,n)}function Fd(t,n){const o=n.get(t);if(o)return o;let r=Ln(t,[],!1).filter(s=>mt(s)&&yn(s)!=="body"),a=null;const l=gt(t).position==="fixed";let i=l?zt(t):t;for(;mt(i)&&!_n(i);){const s=gt(i),c=Er(i);!c&&s.position==="fixed"&&(a=null),(l?!c&&!a:!c&&s.position==="static"&&!!a&&$d.has(a.position)||Fn(i)&&!c&&Ti(t,i))?r=r.filter(u=>u!==i):a=s,i=zt(i)}return n.set(t,r),r}function Ud(t){let{element:n,boundary:o,rootBoundary:r,strategy:a}=t;const i=[...o==="clippingAncestors"?Co(n)?[]:Fd(n,this._c):[].concat(o),r],s=i[0],c=i.reduce((d,u)=>{const p=fa(n,u,a);return d.top=jt(p.top,d.top),d.right=so(p.right,d.right),d.bottom=so(p.bottom,d.bottom),d.left=jt(p.left,d.left),d},fa(n,s,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function zd(t){const{width:n,height:o}=Ni(t);return{width:n,height:o}}function Hd(t,n,o){const r=Bt(n),a=Rt(n),l=o==="fixed",i=en(t,!0,l,n);let s={scrollLeft:0,scrollTop:0};const c=Tt(0);function d(){c.x=To(a)}if(r||!r&&!l)if((yn(n)!=="body"||Fn(a))&&(s=So(n)),r){const f=en(n,!0,l,n);c.x=f.x+n.clientLeft,c.y=f.y+n.clientTop}else a&&d();l&&!r&&a&&d();const u=a&&!r&&!l?Si(a,s):Tt(0),p=i.left+s.scrollLeft-c.x-u.x,m=i.top+s.scrollTop-c.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function zo(t){return gt(t).position==="static"}function ma(t,n){if(!Bt(t)||gt(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return Rt(t)===o&&(o=o.ownerDocument.body),o}function Oi(t,n){const o=tt(t);if(Co(t))return o;if(!Bt(t)){let a=zt(t);for(;a&&!_n(a);){if(mt(a)&&!zo(a))return a;a=zt(a)}return o}let r=ma(t,n);for(;r&&Nd(r)&&zo(r);)r=ma(r,n);return r&&_n(r)&&zo(r)&&!Er(r)?o:r||Ad(t)||o}const qd=async function(t){const n=this.getOffsetParent||Oi,o=this.getDimensions,r=await o(t.floating);return{reference:Hd(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gd(t){return gt(t).direction==="rtl"}const Kd={convertOffsetParentRelativeRectToViewportRelativeRect:Id,getDocumentElement:Rt,getClippingRect:Ud,getOffsetParent:Oi,getElementRects:qd,getClientRects:Dd,getDimensions:zd,getScale:dn,isElement:mt,isRTL:Gd};function Ai(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function Wd(t,n){let o=null,r;const a=Rt(t);function l(){var s;clearTimeout(r),(s=o)==null||s.disconnect(),o=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),l();const d=t.getBoundingClientRect(),{left:u,top:p,width:m,height:f}=d;if(s||n(),!m||!f)return;const v=jn(p),b=jn(a.clientWidth-(u+m)),h=jn(a.clientHeight-(p+f)),_=jn(u),E={rootMargin:-v+"px "+-b+"px "+-h+"px "+-_+"px",threshold:jt(0,so(1,c))||1};let g=!0;function N(x){const I=x[0].intersectionRatio;if(I!==c){if(!g)return i();I?i(!1,I):r=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!Ai(d,t.getBoundingClientRect())&&i(),g=!1}try{o=new IntersectionObserver(N,{...E,root:a.ownerDocument})}catch{o=new IntersectionObserver(N,E)}o.observe(t)}return i(!0),l}function Yd(t,n,o,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=xr(t),u=a||l?[...d?Ln(d):[],...Ln(n)]:[];u.forEach(_=>{a&&_.addEventListener("scroll",o,{passive:!0}),l&&_.addEventListener("resize",o)});const p=d&&s?Wd(d,o):null;let m=-1,f=null;i&&(f=new ResizeObserver(_=>{let[y]=_;y&&y.target===d&&f&&(f.unobserve(n),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var E;(E=f)==null||E.observe(n)})),o()}),d&&!c&&f.observe(d),f.observe(n));let v,b=c?en(t):null;c&&h();function h(){const _=en(t);b&&!Ai(b,_)&&o(),b=_,v=requestAnimationFrame(h)}return o(),()=>{var _;u.forEach(y=>{a&&y.removeEventListener("scroll",o),l&&y.removeEventListener("resize",o)}),p==null||p(),(_=f)==null||_.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const ga=yd,ba=Ed,va=hd,rr=(t,n,o)=>{const r=new Map,a={platform:Kd,...o},l={...a.platform,_c:r};return vd(t,n,{...a,platform:l})};let jd=class{constructor(){Ce(this,"instances",[])}error(n,o=3e3){this.show(n,"error",o)}info(n,o=3e3){this.show(n,"info",o)}success(n,o=3e3){this.show(n,"success",o)}warning(n,o=3e3){this.show(n,"warning",o)}show(n,o="info",r=3e3){const a=document.createElement("div");a.className=`o-toast ${o}`,a.innerHTML=`
26
- <i class="yiitip-icon icon-${o}"></i>
27
- <span class="message">${n}</span>
28
- `,a.style.position="absolute",a.style.transition="opacity 0.3s ease, transform 0.3s ease",a.style.opacity="0",a.style.zIndex="9999",document.body.appendChild(a);const l=Yd(document.body,a,()=>{rr(document.body,a,{placement:"bottom",middleware:[ga(this.instances.length*15),va(),ba()]}).then(({x:s,y:c})=>{Object.assign(a.style,{left:`${s}px`,top:`${c}px`})})});requestAnimationFrame(()=>{a.style.opacity="1",a.style.transform="translateY(0)"});const i={el:a,cleanup:l,type:o,duration:r};this.instances.push(i),this.repositionToasts(),r>0&&setTimeout(()=>this.hide(i),r)}hide(n){const{el:o}=n;o.style.opacity="0",o.style.transform="translateY(-10px)",setTimeout(()=>{n.cleanup(),o.remove(),this.instances=this.instances.filter(r=>r!==n),this.repositionToasts()},300)}repositionToasts(){this.instances.forEach((n,o)=>{const{el:r}=n;rr(document.body,r,{placement:"bottom",middleware:[ga(o*55),va(),ba()]}).then(({x:a,y:l})=>{Object.assign(r.style,{left:`${a}px`,top:`${l}px`})})})}};const Zd=new jd;class Xd{constructor(){Ce(this,"instances",[])}error(n,o=3e3){this.show(n,"error",o)}info(n,o=3e3){this.show(n,"info",o)}success(n,o=3e3){this.show(n,"success",o)}warning(n,o=3e3){this.show(n,"warning",o)}show(n,o="info",r=3e3){const a=`
29
- <div class="o-toast ${o}">
30
- <i class="yiitip-icon icon-${o}"></i>
31
- <span class="message">${n}</span>
163
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(a,u){var d=u&&cI(u,o);return d&&a.push(d),a},[]);return jl(n)?l[0]:l}Ao.defaultProps=bn;Ao.setDefaultProps=iI;Ao.currentInput=go;Object.assign({},d1,{effect:function(e){var t=e.state,o={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,o.popper),t.styles=o,t.elements.arrow&&Object.assign(t.elements.arrow.style,o.arrow)}});Ao.setDefaultProps({render:A1});const O1={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},ng=(n,e)=>{const t=O1[n];return t?t[e]:null},og={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},he={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},ba=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:he.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:he.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:he.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:he.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:he.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:he.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:he.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:he.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:he.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:he.blue},{label:"editor.callout",value:"callout",color:he.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:he.blue}],Cu=ba.filter(n=>n.style),Su=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:he.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:he.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:he.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:he.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:he.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:he.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:he.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:he.purple},{label:"label.audio",value:"audio",icon:"graphic_eq",tips:"audio",color:he.teal},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:he.purple}],$1=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:he.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:he.indigo,tips:"math",keywords:"block, math, equation"},{label:"editor.multiColumn",value:"multiColumn",icon:"view_column",color:he.amber,tips:"column",keywords:"column,columns"}],Eu=[...ba,...Su,...$1],yc=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:he.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:he.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:he.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:he.blue,filter:"audio,image,video,model"},{label:"label.color",value:"color",icon:"palette",color:he.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:he.purple,filter:"callout",component:"OCalloutColorBoard"}],R1=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:he.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:he.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:he.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:he.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.makeLonger",value:"makeLonger",icon:"subject",color:he.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:he.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:he.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:he.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],B1=[{label:"ai.summarize",value:"summarize",icon:"notes",color:he.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:he.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],D1=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],_1=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],I1=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],L1=["inline-math-edit","inlineMathDelete"],P1=["link-open","link-edit","linkUnset"],V1=["align-group","separator","link"],z1=["align-group","separator","link-open","link-edit","linkUnset"],H1=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],F1=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],uI=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],j1=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],dI=["table-group","separator","align-group"],fI={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},pI=new YT({breaks:!0});function rg(){const n=c.inject("aiOption"),e=c.ref(null);function t(){if(!n.value)return;const{provider:r,apiKey:i,baseURL:s}=n.value,l=s||ng(r,"baseURL");!r||!i||!l||(e.value=new XT({apiKey:i,baseURL:l,dangerouslyAllowBrowser:!0}))}const o=async(r,i)=>{var s,l,a;if(!e.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const u=await((s=e.value)==null?void 0:s.chat.completions.create({model:"deepseek-chat",messages:r,temperature:.7,stream:!0}));let d="";for await(const f of u){const p=((a=(l=f.choices[0])==null?void 0:l.delta)==null?void 0:a.content)||"";d+=p,i(p)}return d}catch(u){throw console.error("API Error:",u),new Error(u.message||"API request failed")}};return c.watch(()=>n,r=>{t()},{deep:!0}),c.onMounted(()=>{t()}),{md:pI,aiOption:n,createStreamingChatCompletion:o}}function Cd(){const n=(o,r,i)=>{const s={type:"text/plain"};switch(o){case"svg":s.type="image/svg+xml;charset=utf-8";break}const l=new Blob([i],s),a=URL.createObjectURL(l),u=document.createElement("a");u.href=a,u.download=r,u.click(),URL.revokeObjectURL(a)},e=async o=>{try{const i=await(await fetch(o)).blob(),s=window.URL.createObjectURL(i),l=t(o),a=document.createElement("a");a.href=s,a.download=l,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(s)}catch{window.open(o,"_blank")}},t=(o,r="png")=>{try{const l=new URL(o).pathname.split("/"),a=l[l.length-1];return a&&a.includes(".")?decodeURIComponent(a):`image-${Date.now()}.${r}`}catch{return`download-${Date.now()}.${r}`}};return{commonDownload:n,downloadImage:e}}function W1(){const n=c.ref(),e=c.ref(!1);function t(s){n.value=s,s.editor.on("selectionUpdate",i)}function o(){var s;(s=n.value)==null||s.editor.off("selectionUpdate",i)}const r=c.computed(()=>{var a;const s=(a=n.value)==null?void 0:a.getPos();if(typeof s!="number")return null;const l=n.value.editor.state.doc.nodeAt(s);return l?{start:s+1,end:s+l.nodeSize-1}:null}),i=()=>{if(!n.value)return;const{editor:s}=n.value;if(!s.isFocused){e.value=!1;return}const{selection:l}=s.state;l&&(e.value=(l==null?void 0:l.$from.pos)>=r.value.start&&(l==null?void 0:l.$to.pos)<=r.value.end)};return{isFocused:e,bind:t,unbind:o,checkFocus:i}}function de(){const n=c.inject("locale",{value:"en"}),e=c.computed(()=>QT.getMessage(n.value)),t=c.computed(()=>{var r;return((r=e.value)==null?void 0:r.name)||"English"});function o(r){return r.split(".").reduce((i,s)=>{if(i)return i[s]},e.value)}return{languageName:t,locale:n,message:e,tr:o}}function Di(){const n=c.inject("darkMode",{value:!1}),e=c.computed(()=>n.value?"dark":"light");return{darkMode:n,theme:e}}/**
164
+ * Copyright 2026 Yiitap
165
+ * @license MIT
166
+ **/const Jo=new ae("inlinePlaceholder"),U1=be.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1,onShowInline:n=>{},onHideInline:()=>{}}},addProseMirrorPlugins(){return[new ue({key:new ae("placeholder"),props:{decorations:n=>{var l;const{doc:e,selection:t,tr:o}=n,r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,s=[];return(l=Jo.getState(n))!=null&&l.active||!r?null:(e.descendants((a,u)=>{const d=i>=u&&i<=u+a.nodeSize,f=!a.isLeaf&&!a.childCount,p=this.options.showOnlyCurrent;if((d||!p)&&f){const h=[this.options.emptyNodeClass];this.editor.isEmpty&&h.push(this.options.emptyEditorClass);const m=Ve.node(u,u+a.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:u,hasAnchor:d}):this.options.placeholder});s.push(m)}return this.options.includeChildren}),Ce.create(e,s))}}}),new ue({key:Jo,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Jo);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=Jo.getState(n))==null?void 0:o.active;if(!e)return null;const t=Ve.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShowInline(e)}),r});return Ce.create(n.doc,[t])}},view:()=>({destroy:this.options.onHideInline})})]}}),Sd=[{type:"paragraph",content:[]}],hI={type:"aiBlock",content:Sd},mI={type:"audio",attrs:{src:"//init.mp3"}},gI={type:"blockquote",content:Sd},yI={type:"callout",attrs:{icon:"💡"},content:Sd},bI={type:"codeBlock",attrs:{attrs:{language:"shell"}},content:[]},vI={type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:Sd}]},q1={type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
167
+ Mermaid --> Diagram`}]},wI={type:"paragraph",content:[{type:"text",text:":"}]},kI={type:"image",attrs:{src:"init"}},xI=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],CI={type:"table",content:Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:3},()=>({type:"tableCell",content:[{type:"paragraph"}]}))}))},SI=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],EI={type:"video",attrs:{src:"init"}};function xe(){const n=c.inject("isEditable",{value:!0});function e(i,s,l={}){if(!i.isEditable)return;const a=i==null?void 0:i.chain().focus(),u=i==null?void 0:i.commands;switch(s){case"inlineMath":o(i);break;default:t(u,a,s,l);break}}function t(i,s,l,a={}){switch(l){case"aiBlock":s.toggleAiBlock().run();break;case"audio":s.setAudio({src:"//init.mp3"}).run();break;case"highlight":a.color?i.setHighlight({color:a.color}):i.unsetHighlight();break;case"backgroundColor":a.color?i.setBackgroundColor(a.color):i.unsetBackgroundColor();break;case"blockMath":i.insertBlockMath({latex:""});break;case"blockquote":s.toggleBlockquote().run();break;case"bold":s.toggleBold().run();break;case"bulletList":s.toggleBulletList().run();break;case"callout":s.toggleCallout().run();break;case"clearFormat":s.unsetAllMarks().run();break;case"code":s.toggleCode().run();break;case"codeBlock":i.toggleCodeBlock({language:"bash"});break;case"color":s.setColor(a.color).run();break;case"copySelected":i.copySelected();break;case"content":i.insertContent(a.content);break;case"deleteSelected":i.deleteSelected();break;case"details":a.type==="detailsSummary"?i.unsetDetails():i.setDetails();break;case"diagram":i.insertContent(q1);break;case"duplicateSelected":i.duplicateSelected();break;case"emoji":i.insertContent(":");break;case"fontFamily":i.setFontFamily(a.fontFamily);break;case"heading":s.toggleHeading(a).run();break;case"horizontalRule":s.setHorizontalRule().run();break;case"image":s.setImage({src:"init"}).run();break;case"imageUpdate":s.setImage(a).run();break;case"inlineMathDelete":i.deleteInlineMath(a);break;case"inlineMathInsert":i.insertInlineMath(a);break;case"inlineMathUpdate":i.updateInlineMath(a);break;case"italic":s.toggleItalic().run();break;case"linkSet":s.extendMarkRange("link").setLink(a).run();break;case"linkUnset":s.extendMarkRange("link").unsetLink().run();break;case"multiColumn":i.insertMultiColumn(2);break;case"orderedList":s.toggleOrderedList().run();break;case"paragraph":s.setParagraph().run();break;case"strike":s.toggleStrike().run();break;case"subscript":i.toggleSubscript();break;case"superscript":i.toggleSuperscript();break;case"table":s.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":s.addColumnAfter().run();break;case"tableAddRow":s.addRowAfter().run();break;case"tableCellAttribute":s.setCellAttribute(a.name,a.value).run();break;case"tableDeleteColumn":s.deleteColumn().run();break;case"tableDeleteRow":s.deleteRow().run();break;case"tableDelete":s.deleteTable().run();break;case"tableInsert":s.insertTable(a).run();break;case"tableMergeCells":s.mergeCells().run();break;case"tableSelectColumn":s.selectColumn(a.pos).run();break;case"tableSelectRow":s.selectRow(a.pos).run();break;case"tableSplitCell":s.splitCell().run();break;case"taskList":i.toggleTaskList();break;case"textAlign":s.setTextAlign(a.textAlign).run();break;case"underline":s.toggleUnderline().run();break;case"video":s.setVideo({src:"init"}).run()}}function o(i){const{state:s,view:l}=i,{from:a}=s.selection,d=l.domAtPos(a).node.getBoundingClientRect(),f=s.tr.setMeta(Jo,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:a,rect:d}}).setSelection(s.selection);l.dispatch(f)}function r(i){const s=[];return i.state.doc.descendants((l,a)=>{l.type.name==="image"&&s.push({pos:a,attrs:l.attrs})}),s}return{isEditable:n,onCommand:t,run:e,getEditorImages:r}}const Vn=c.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(n){const e=n,{theme:t}=Di(),o=c.ref(),r=c.ref(),i=c.ref();function s(){i.value=Ao(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function l(){i.value.setProps({theme:t.value})}return c.watch(t,a=>{l()}),c.onMounted(()=>{s()}),c.onUnmounted(()=>{i.value&&i.value.destroy()}),(a,u)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[c.renderSlot(a.$slots,"trigger"),c.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[c.renderSlot(a.$slots,"default")],512)],512))}}),Oe=c.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(Vn,{class:"o-tooltip",placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[c.createVNode(X,{name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"]),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),MI=c.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const e=n,{run:t}=xe(),{tr:o}=de(),r=c.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:o("label.ai")},audio:{icon:"music_cast",tooltip:o("label.ai")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},inlineMath:{icon:"function",tooltip:o("editor.inlineMath")},blockMath:{icon:"functions",tooltip:o("editor.blockMath")},inlineMathDelete:{icon:"close",tooltip:o("editor.delete")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},multiColumn:{icon:"view_column",tooltip:o("editor.multiColumn")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:o("editor.aiBlock")},diagram:{icon:"mermaid",tooltip:o("diagram.name")}})),i=c.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){t(e.editor,e.name)}return(l,a)=>{var u;return c.openBlock(),c.createBlock(Oe,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive(n.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),ig=c.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"},{label:t("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"textAlign",{textAlign:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:n.placement,trigger:n.trigger,"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:c.unref(t)("editor.align")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createBlock(c.unref(Ut),{key:d,class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive({textAlign:u.value})}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive({textAlign:u.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),K1=c.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function a(d){return t.modelValue===d.value}function u(d){var f;(f=s.value)==null||f.setShow(!1),o("download",d.value)}return(d,f)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:c.unref(r)("label.download")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(p,h)=>(c.openBlock(),c.createBlock(c.unref(Ut),{key:h,class:c.normalizeClass({"is-active":a(p)}),onClick:m=>u(p)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:p.icon},null,8,["name"])]),suffix:c.withCtx(()=>[a(p)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),J1=c.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:r("label.preview"),value:"preview",icon:"mermaid"},{label:r("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:r("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:r("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),a=c.computed(()=>l.value.find(f=>f.value===t.modelValue));function u(f){return t.modelValue===f.value}function d(f){var p;switch((p=s.value)==null||p.setShow(!1),f.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:o("update:modelValue",f.value)}}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{"content-class":"o-code-block-view-dropdown dropdown",icon:a.value.icon,tooltip:c.unref(r)("label.view")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":u(h)}),onClick:g=>d(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon},null,8,["name"])]),suffix:c.withCtx(()=>[h.suffixIcon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:h.suffixIcon,small:""},null,8,["name"])):u(h)?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(h.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),G1=c.defineComponent({__name:"OExtensionDropdown",props:{editor:{type:Lt}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.computed(()=>[{label:t("editor.photo"),value:"image",icon:"image"},{label:t("editor.video"),value:"video",icon:"videocam"},{label:t("editor.inlineMath"),value:"inlineMath",icon:"function",separator:!0},{label:t("editor.blockMath"),value:"blockMath",icon:"functions"},{label:t("diagram.name"),value:"diagram",icon:"mermaid",separator:!0},{label:t("editor.multiColumn"),value:"multiColumn",icon:"view_column",separator:!0}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,l)}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"extension","content-class":"o-extension-dropdown dropdown",tooltip:c.unref(t)("editor.textFormat")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(u.value)}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(u.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),sg=c.defineComponent({__name:"OLinkBtn",props:{editor:{type:Lt}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank",console.log("show",i.value,f,l.value))}function u(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>{var h;return[c.createVNode(c.unref(Ze),{icon:"link","content-class":{"is-active":(h=n.editor)==null?void 0:h.isActive("link")},tooltip:c.unref(t)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ad),{key:0,title:c.unref(t)("editor.hyperlink"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(gg),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),TI={class:"o-block-placeholder"},NI={class:"icon"},AI={class:"placeholder"},va=c.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("section",TI,[c.createElementVNode("div",NI,[c.createVNode(c.unref(X),{name:n.icon},null,8,["name"])]),c.createElementVNode("div",AI,c.toDisplayString(n.placeholder),1)]))}}),OI={class:"group o-tips"},$I={key:1,class:"item"},Ed=c.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref([]),s=(h,m)=>{h&&(i.value[m]=h)},l=c.ref(0);function a(h,m,g){o("select",h,g),i.value[m]&&i.value[m].setShow(!1)}function u(){l.value=(l.value+t.items.length-1)%t.items.length}function d(){l.value=(l.value+1)%t.items.length}function f(){a(t.items[l.value],l.value)}function p(h){switch(h.key){case"ArrowUp":h.preventDefault(),u();break;case"ArrowDown":h.preventDefault(),d();break;case"Enter":h.preventDefault(),f();break}}return c.watch(()=>t.useKeyboard,h=>{h?window.addEventListener("keydown",p):window.removeEventListener("keydown",p)}),c.onMounted(()=>{t.useKeyboard&&window.addEventListener("keydown",p)}),c.onBeforeUnmount(()=>{t.useKeyboard&&window.removeEventListener("keydown",p)}),(h,m)=>(c.openBlock(),c.createBlock(c.unref(ln),{class:"o-block-list",hoverable:"",clickable:""},{default:c.withCtx(()=>[n.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(n.items,(g,y)=>{var b;return c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[y>0?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",OI,c.toDisplayString(c.unref(r)(g.group)),1)],64)):c.createCommentVNode("",!0),(b=g.children)!=null&&b.length?(c.openBlock(),c.createBlock(c.unref($e),{key:1,ref_for:!0,ref:v=>s(v,y),placement:"right-start",offset:[-10,16]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Qp),{item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:""},null,8,["item","class"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Ed),{items:g.children,onSelect:v=>a(g,y,v)},null,8,["items","onSelect"])]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(Qp),{key:2,item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:"",onClick:v=>a(g,y)},null,8,["item","class","onClick"]))],64)}),128)):(c.openBlock(),c.createElementBlock("div",$I,c.toDisplayString(c.unref(r)("label.noResults")),1))]),_:1}))}}),RI={key:0,class:"o-tips"},Qp=c.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(n,{emit:e}){const{tr:t}=de();return(o,r)=>(c.openBlock(),c.createBlock(c.unref(Ut),{class:"o-block-list-item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.item.icon,color:n.item.color},null,8,["name","color"])]),suffix:c.withCtx(()=>{var i;return[n.item.tips?(c.openBlock(),c.createElementBlock("span",RI,c.toDisplayString(n.item.tips),1)):c.createCommentVNode("",!0),(i=n.item.children)!=null&&i.length?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"navigate_next",class:"o-tips"})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)(n.item.label)),1)]),_:1}))}}),Zp=(n,e)=>nx(e,n.extensionManager.extensions),BI=()=>{const n=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:n?"⌘":"Ctrl",alt:n?"⌥":"Alt",shift:n?"⇧":"Shift",ctrl:n?"⌃":"Ctrl",meta:n?"⌘":"Meta"}},DI=n=>{const e=n==null?void 0:n.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(!e||!e.length)return n;const t=BI();return e.map(r=>t[r]??r.toUpperCase()).join("+")},_I={key:1,class:"group o-tips"},II={class:"suffix o-tips"},LI={key:1,class:"item"},Fr=c.defineComponent({__name:"OBlockMenu",props:{...ht,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref([]),l=c.computed(()=>{var b;return(b=t.node)==null?void 0:b.type.name}),a=c.computed(()=>Cu.find(b=>b.value===l.value)),u=c.computed(()=>{const b=a.value?yc.filter(w=>{var x;return((x=w.filter)==null?void 0:x.indexOf("style"))>=0})??[]:[];let v=yc.filter(w=>{var x;return((x=w.filter)==null?void 0:x.indexOf(l.value))>=0})??[];if(v=v.concat(b),v.length>0){const w=v[0];w.group=`editor.${l.value}`}const k=yc.filter(w=>{var x;return((x=w.filter)==null?void 0:x.indexOf("common"))>=0});return[...v,...k]});function d(b){switch(b.component){case"OCalloutColorBoard":return lg;case"OTextColorBoard":return ag;default:return null}}function f(b){setTimeout(()=>{p(b),o("action",b)},0)}function p(b){switch(b.value){case"copy":h();break;case"delete":m();break;case"duplicate":g();break}}function h(){i(t.editor,"copySelected")}function m(){i(t.editor,"deleteSelected")}function g(){i(t.editor,"duplicateSelected")}function y(b,v){switch(console.log("select",b,v),v.name){case"backColor":t.updateAttributes({backColor:v.value});break;case"foreColor":t.updateAttributes({borderColor:v.value});break;case"color":i(t.editor,v.name,{color:v.value});break;case"backgroundColor":i(t.editor,v.name,{color:v.value});break}}return(b,v)=>(c.openBlock(),c.createBlock(c.unref(ln),{class:"o-block-menu",hoverable:"",clickable:""},{default:c.withCtx(()=>[u.value.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(u.value,(k,w)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:w},[k.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[w>0||a.value?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),n.showGroup?(c.openBlock(),c.createElementBlock("div",_I,c.toDisplayString(c.unref(r)(k.group)),1)):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),d(k)?(c.openBlock(),c.createBlock(c.unref($e),{key:1,ref_for:!0,ref:s.value[k.value],offset:[0,4],placement:"right"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ut),{class:"item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:k.icon,color:n.colorful?k.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"navigate_next",class:"o-tips"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(k.label)),1)]),_:2},1024)]),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(d(k)),{onSelect:x=>y(k,x)},null,40,["onSelect"]))]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(Ut),{key:2,class:"item",clickable:"",onClick:c.withModifiers(x=>f(k),["stop"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:k.icon,color:n.colorful?k.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("div",II,c.toDisplayString(c.unref(DI)(k.tips)),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(k.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(c.openBlock(),c.createElementBlock("div",LI,"No result"))]),_:1}))}}),Yn=c.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();function i(l){o("update:modelValue",l)}function s(){console.log("click outside"),t.hideClickOutside&&o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a,u;l&&!t.readonly?(a=r.value)==null||a.setShow(!0):(u=r.value)==null||u.setShow(!1)}),c.onMounted(()=>{var l;t.modelValue&&((l=r.value)==null||l.setShow(!0))}),c.onUnmounted(()=>{var l;(l=r.value)==null||l.setShow(!1)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,placement:n.placement,"tippy-class":n.tippyClass,"content-class":n.contentClass,trigger:"manual",arrow:n.showArrow,offset:n.offset,show:n.modelValue&&!n.readonly,"onUpdate:show":i,onClickoutside:s},{trigger:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),default:c.withCtx(()=>[c.renderSlot(l.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),PI={class:"o-block-toolbar editable-only"},VI={class:"button-group"},Md=c.defineComponent({__name:"OBlockToolbar",props:{...ht,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{isEditable:s,run:l}=xe(),a=c.ref();function u(d){var f;o("action",d),(f=a.value)==null||f.setShow(!1)}return(d,f)=>(c.openBlock(),c.createElementBlock("div",PI,[c.createElementVNode("section",VI,[c.renderSlot(d.$slots,"default"),c.createVNode(c.unref($e),{ref_key:"popover",ref:a,placement:"bottom-end",size:"medium",trigger:n.trigger,"show-arrow":!1},{trigger:c.withCtx(()=>[c.unref(s)?(c.openBlock(),c.createBlock(c.unref(Ze),{key:0,icon:"more_horiz",tooltip:c.unref(i)("label.more")},null,8,["tooltip"])):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(t,{onAction:u}),null,16)]),_:1},8,["trigger"])])]))}}),zI={class:"o-callout-color-board"},HI={class:"fore-colors"},FI={class:"color-row"},jI={class:"color-row"},WI={class:"back-colors"},UI={class:"color-row"},qI={class:"color-row"},lg=c.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e;function o(s,l){t("select",{name:s,value:l.value})}const r=c.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=c.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(c.openBlock(),c.createElementBlock("section",zI,[c.createElementVNode("section",HI,[l[4]||(l[4]=c.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),c.createElementVNode("div",FI,[c.createVNode(c.unref(Oe),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:l[0]||(l[0]=a=>o("foreColor",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,tooltip:"Last used","content-style":{borderColor:n.foreColor},onClick:l[1]||(l[1]=a=>o("foreColor",{value:n.foreColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",jI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:`col-${u}`,tooltip:a.label,"content-style":{borderColor:a.value},onClick:d=>o("foreColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])]),c.createElementVNode("section",WI,[l[5]||(l[5]=c.createElementVNode("div",{class:"label o-tips"},"Background",-1)),c.createElementVNode("div",UI,[c.createVNode(c.unref(Oe),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:l[2]||(l[2]=a=>o("backColor",{value:"#F5F5F5"}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,"content-style":{backgroundColor:n.backColor},tooltip:"Last used","content-class":"border",onClick:l[3]||(l[3]=a=>o("backColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",qI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:`col-${u}`,tooltip:a.label,"content-style":{backgroundColor:a.value},onClick:d=>o("backColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),KI=c.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de(),{run:r}=xe(),i=c.ref(null),s=c.ref(""),l=c.ref("");function a(u,d){u==="foreColor"?(s.value=d,localStorage.setItem("yiitap.text-color.fore",d)):u==="backColor"&&(l.value=d,localStorage.setItem("yiitap.text-color.back",d)),t("select",u,d)}return c.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(u,d)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"palette",tooltip:c.unref(o)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var f;return[c.createVNode(c.unref(lg),{"fore-color":s.value,"back-color":l.value,"default-label":c.unref(o)("editor.defaultColor"),"active-color":(f=n.editor)==null?void 0:f.getAttributes("textStyle").color,onSelect:a},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),$s=c.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();c.computed(()=>{var l;return t.clientX||((l=t.event)==null?void 0:l.clientX)||0}),c.computed(()=>{var l;return t.clientY||((l=t.event)==null?void 0:l.clientY)||0});function i(l){o("update:modelValue",l)}function s(){o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a;l?setTimeout(()=>{var u;(u=r.value)==null||u.setShow(l)},0):(a=r.value)==null||a.setShow(l)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:n.modelValue,"show-arrow":!1,event:n.event,"onUpdate:show":i,onClickoutside:s},{default:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),_:3},8,["show","event"]))}}),JI={class:"o-color-board"},GI={class:"cell-container"},XI={class:"label"},YI=["onClick"],ki=c.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=n,o=e;function r(a){o("select",a.hex)}function i(a){return t.activeColor===a}function s(a){return"abc"}const l=c.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(a,u)=>(c.openBlock(),c.createElementBlock("section",JI,[n.defaultDisabled?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"default-color",onClick:u[0]||(u[0]=d=>r({hex:n.defaultColor}))},[c.createElementVNode("div",GI,[c.createElementVNode("div",{class:"cell border",style:c.normalizeStyle({background:n.defaultColor})},[c.createVNode(c.unref(X),{name:"slash_forward"})],4)]),c.createElementVNode("div",XI,c.toDisplayString(n.defaultLabel),1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(d,f)=>(c.openBlock(),c.createElementBlock("div",{class:"color-row",key:`row-${f}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d,(p,h)=>(c.openBlock(),c.createElementBlock("div",{class:"",key:`col-${h}`},[c.createElementVNode("div",{class:"cell-container",onClick:m=>r(p)},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{border:p.border}]),style:c.normalizeStyle({backgroundColor:p.hex})},[i(p.hex)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",style:c.normalizeStyle({color:s(p.rgb)})},null,8,["style"])):c.createCommentVNode("",!0)],6)],8,YI)]))),128))]))),128))]))}}),Ze=c.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(c.unref(Vn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),QI={key:0,class:"o-doc-toc toc"},ZI={class:"mini-view"},eL={class:"toc__list"},tL={class:"main-view o-scroll",style:{"max-width":"480px"}},nL={class:"toc__title"},oL={class:"toc__list"},rL=["onClick"],iL=c.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Lt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref([]),l=c.ref("");function a(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",d),setTimeout(()=>{u(),d()},0)}function u(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",f)}function d(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,y)=>{if(g.type.name==="heading"){const b=g.attrs.id;h.push({level:g.attrs.level,text:g.textContent,id:b})}}),s.value=h}function f(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const y=g.getBoundingClientRect();if(y.top>=0&&y.top<window.innerHeight/2){l.value=m.id;break}}r("docScroll",h)}function p(h){l.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return c.watch(()=>o.editor,h=>{a()}),e({onScroll:f,headings:s}),(h,m)=>s.value.length?(c.openBlock(),c.createElementBlock("section",QI,[c.createVNode(c.unref($e),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:c.withCtx(()=>[c.createElementVNode("div",ZI,[c.createElementVNode("ul",eL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.level<=Math.max(Math.min(n.maxLevel,3),2)?(c.openBlock(),c.createElementBlock("li",{key:0,class:c.normalizeClass(["toc__item",[l.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):c.createCommentVNode("",!0)],64))),128))])])]),default:c.withCtx(()=>[c.createElementVNode("div",tL,[c.createElementVNode("div",nL,c.toDisplayString(c.unref(i)("label.toc")),1),c.renderSlot(h.$slots,"title"),c.createElementVNode("ul",oL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock("li",{class:c.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:y},[c.createElementVNode("span",{class:c.normalizeClass(["heading",{selected:l.value===g.id}]),onClick:b=>p(g)},c.toDisplayString(g.text),11,rL)],2))),128))])])]),_:3},512)])):c.createCommentVNode("",!0)}}),sL={class:"o-emoji-select"},lL={key:0},aL={class:"groups o-scroll"},cL={class:"items"},uL=["onClick"],dL={key:0,class:"groups-empty"},fL={class:"group-icons"},pL=["onClick"],Td=c.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,r=c.ref(null),i=c.ref(""),s=c.ref([]),l=c.ref([]),a=c.ref(0),u=c.computed(()=>i.value?s.value:t.items),d=c.computed(()=>{let m=!1;return u.value.map(g=>{m=m||g.emojis.length}),m});function f(){a.value=0,s.value=i.value?Tl.filterEmojiGroups(i.value):[]}function p(m){o("select",m)}function h(m,g){a.value=g,l.value[g].scrollIntoView({behavior:"instant",block:"start"})}return c.onMounted(()=>{}),(m,g)=>(c.openBlock(),c.createElementBlock("section",sL,[n.enableSearch?(c.openBlock(),c.createElementBlock("div",lL,[c.createVNode(c.unref(to),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=y=>i.value=y),f],type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("section",aL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>{var v;return c.withDirectives((c.openBlock(),c.createElementBlock("div",{key:`group-${b}`,class:"group"},[c.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:l},c.toDisplayString(y.name),513),c.createElementVNode("section",cL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(y.emojis,(k,w)=>(c.openBlock(),c.createElementBlock("div",{key:`item-${w}`},[c.createElementVNode("div",{class:"item",onClick:x=>p(k)},c.toDisplayString(k.emoji),9,uL)]))),128))])],512)),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])}),128)),d.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",dL,"没有记录"))]),c.createElementVNode("section",fL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>(c.openBlock(),c.createBlock(c.unref(Vn),{key:`target-${b}`,delay:300},{trigger:c.withCtx(()=>{var v;return[c.withDirectives(c.createElementVNode("div",{class:c.normalizeClass(["item",{active:a.value===b}]),onClick:k=>h(y,b)},[c.createVNode(c.unref(X),{name:c.unref(Tl.emojiGroupIcons)[y.slug]},null,8,["name"])],10,pL),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(y.name),1)]),_:2},1024))),128))])]))}}),Ys=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TOML",value:"toml",ext:["toml"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],hL={class:"selected-language"},mL={class:"header"},gL={class:"o-scroll"},X1=c.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(),l=c.ref(""),a=c.ref(0),u=c.ref(""),d=c.computed(()=>l.value?Ys.filter(b=>b.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):Ys),f=c.computed(()=>{let b=Ys.find(v=>v.value===u.value);return b||(b=Ys.find(v=>v.ext.includes(u.value))),b});function p(b){b&&setTimeout(()=>{var v;(v=s.value)==null||v.focus(),a.value=0,window.addEventListener("keyup",y)},0)}function h(){var b;window.removeEventListener("keyup",y),(b=i.value)==null||b.setShow(!1)}function m(b){h(),u.value=b.value,o("select",b.value)}function g(){m(d.value[a.value])}function y(b){if(d.value.length>0){switch(b.code){case"ArrowDown":a.value=a.value+1;break;case"ArrowUp":a.value=a.value-1;break;case"Enter":g();break}a.value>=d.value.length&&(a.value=0),a.value<0&&(a.value=d.value.length-1)}else a.value=0}return c.onMounted(()=>{u.value=t.language}),(b,v)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":p},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ge),{class:"o-dropdown-btn"},{default:c.withCtx(()=>{var k;return[c.createElementVNode("span",hL,c.toDisplayString((k=f.value)==null?void 0:k.label),1),c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:c.withCtx(()=>[c.createElementVNode("header",mL,[c.createVNode(c.unref(to),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":v[0]||(v[0]=k=>l.value=k),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),c.createElementVNode("section",gL,[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,(k,w)=>(c.openBlock(),c.createBlock(c.unref(Ut),{key:w,onClick:x=>m(k),class:c.normalizeClass({"is-active":k.value===u.value,"is-select":w===a.value})},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:k.icon},null,8,["name"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(k.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),yL={class:"o-media-input"},bL={class:"fields"},vL={class:"o-media-title"},wL={class:"actions"},Nd=c.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(""),l=c.ref("");function a(){return l.value?(s.value="null",!0):(s.value="error",!1)}function u(){a()&&o("input",l.value)}return c.onMounted(()=>{l.value=t.val,setTimeout(()=>{var d;(d=i.value)==null||d.focus()},0)}),(d,f)=>(c.openBlock(),c.createElementBlock("section",yL,[c.createElementVNode("section",bL,[c.createElementVNode("div",vL,c.toDisplayString(c.unref(r)("label.link")),1),c.createVNode(c.unref(to),{ref_key:"input",ref:i,modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),status:s.value,type:"text",autofocus:"",clearable:"",onEnter:u},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),c.createElementVNode("footer",wL,[c.createVNode(c.unref(Ge),{type:"info",onClick:u},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),kL={class:"o-meta-input"},xL={class:"header"},CL={class:"title"},SL={class:"fields"},EL={class:"actions"},Ad=c.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(null),s=c.ref("");function l(){console.log("confirm",s.value),o("confirm",s.value)}return c.onMounted(()=>{s.value=t.val,setTimeout(()=>{var a;(a=i.value)==null||a.focus()},0)}),(a,u)=>(c.openBlock(),c.createElementBlock("section",kL,[c.createElementVNode("section",xL,[c.createElementVNode("div",CL,c.toDisplayString(n.title),1),c.createElementVNode("div",null,[c.renderSlot(a.$slots,"header-right")])]),c.createElementVNode("section",SL,[c.createVNode(c.unref(to),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d),type:"text",autofocus:"",clearable:"",onEnter:l},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),c.createElementVNode("footer",EL,[c.createVNode(c.unref(Ge),{type:"tertiary",onClick:u[1]||(u[1]=d=>o("cancel"))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.cancel")),1)]),_:1}),c.createVNode(c.unref(Ge),{type:"info",onClick:l},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),ML={class:"o-table-grid"},TL=["onMouseover"],Y1=c.defineComponent({__name:"OTableGrid",emits:["select"],setup(n,{emit:e}){const t=e,o=c.ref(6),r=c.ref(6),i=c.ref(2),s=c.ref(2);function l(u,d){i.value=u,s.value=d,o.value===u&&o.value<10&&(o.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function a(){t("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(u,d)=>(c.openBlock(),c.createElementBlock("section",ML,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,(f,p)=>(c.openBlock(),c.createElementBlock("div",{class:"rows",key:`row-${p}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(h,m)=>(c.openBlock(),c.createElementBlock("div",{key:`col-${m}`},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{selected:f<=i.value&&h<=s.value}]),onMouseover:g=>l(f,h),onClick:a},null,42,TL)]))),128))]))),128)),c.createElementVNode("footer",null,c.toDisplayString(i.value)+" x "+c.toDisplayString(s.value),1)]))}}),NL={class:"o-table-cell-background o-button-group"},AL={class:"o-command-btn"},Q1=c.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),{trigger:"hover"},{trigger:c.withCtx(()=>[c.createElementVNode("div",NL,[c.createElementVNode("div",{class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},[c.createVNode(c.unref(X),{name:"crop_16_9",class:"arrow"}),c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),c.createElementVNode("div",AL,[c.createVNode(c.unref(X),{name:"arrow_drop_down"})])])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),OL={class:"o-simple-color-board"},$L={class:"fore-colors"},RL={class:"label o-tips"},BL={class:"color-row"},DL={class:"color-row"},_L={class:"back-colors"},IL={class:"label o-tips"},LL={class:"color-row"},PL={class:"color-row"},ag=c.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de();function r(l,a){t("select",{name:l,value:a.value})}const i=c.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),s=c.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(l,a)=>(c.openBlock(),c.createElementBlock("section",OL,[c.createElementVNode("section",$L,[c.createElementVNode("header",null,[c.createElementVNode("div",RL,c.toDisplayString(c.unref(o)("editor.textColor")),1),c.createVNode(c.unref($e),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ge),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-disabled":"",onSelect:a[0]||(a[0]=u=>r("color",{value:u}))})]),_:1},512)]),c.createElementVNode("div",BL,[c.createVNode(c.unref(Oe),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[1]||(a[1]=u=>r("color",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:"format_text",color:n.foreColor,tooltip:"Last used","content-class":"border",onClick:a[2]||(a[2]=u=>r("color",{value:n.foreColor}))},null,8,["color"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",DL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:`col-${d}`,icon:"format_text",color:u.value,tooltip:u.label,onClick:f=>r("color",u)},null,8,["color","tooltip","onClick"]))),128))])]),c.createElementVNode("section",_L,[c.createElementVNode("header",null,[c.createElementVNode("div",IL,c.toDisplayString(c.unref(o)("editor.backgroundColor")),1),c.createVNode(c.unref($e),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ge),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-disabled":"",onSelect:a[3]||(a[3]=u=>r("backgroundColor",{value:u}))})]),_:1},512)]),c.createElementVNode("div",LL,[c.createVNode(c.unref(Oe),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[4]||(a[4]=u=>r("backgroundColor",{value:""}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:n.backColor},onClick:a[5]||(a[5]=u=>r("backgroundColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",PL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:`col-${d}`,icon:"format_text",tooltip:u.label,"content-style":{backgroundColor:u.value},onClick:f=>r("backgroundColor",u)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Z1=["top","right","bottom","left"],cv=["start","end"],uv=Z1.reduce((n,e)=>n.concat(e,e+"-"+cv[0],e+"-"+cv[1]),[]),Qn=Math.min,Ft=Math.max,Mu=Math.round,Ua=Math.floor,ko=n=>({x:n,y:n}),VL={left:"right",right:"left",bottom:"top",top:"bottom"},zL={start:"end",end:"start"};function eh(n,e,t){return Ft(n,Qn(e,t))}function nr(n,e){return typeof n=="function"?n(e):n}function zn(n){return n.split("-")[0]}function Jn(n){return n.split("-")[1]}function eC(n){return n==="x"?"y":"x"}function cg(n){return n==="y"?"height":"width"}const HL=new Set(["top","bottom"]);function yo(n){return HL.has(zn(n))?"y":"x"}function ug(n){return eC(yo(n))}function tC(n,e,t){t===void 0&&(t=!1);const o=Jn(n),r=ug(n),i=cg(r);let s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Nu(s)),[s,Nu(s)]}function FL(n){const e=Nu(n);return[Tu(n),e,Tu(e)]}function Tu(n){return n.replace(/start|end/g,e=>zL[e])}const dv=["left","right"],fv=["right","left"],jL=["top","bottom"],WL=["bottom","top"];function UL(n,e,t){switch(n){case"top":case"bottom":return t?e?fv:dv:e?dv:fv;case"left":case"right":return e?jL:WL;default:return[]}}function qL(n,e,t,o){const r=Jn(n);let i=UL(zn(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Tu)))),i}function Nu(n){return n.replace(/left|right|bottom|top/g,e=>VL[e])}function KL(n){return{top:0,right:0,bottom:0,left:0,...n}}function dg(n){return typeof n!="number"?KL(n):{top:n,right:n,bottom:n,left:n}}function ks(n){const{x:e,y:t,width:o,height:r}=n;return{width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function pv(n,e,t){let{reference:o,floating:r}=n;const i=yo(e),s=ug(e),l=cg(s),a=zn(e),u=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[l]/2-r[l]/2;let h;switch(a){case"top":h={x:d,y:o.y-r.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}switch(Jn(e)){case"start":h[s]-=p*(t&&u?-1:1);break;case"end":h[s]+=p*(t&&u?-1:1);break}return h}async function JL(n,e){var t;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:l,strategy:a}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=nr(e,n),m=dg(h),y=l[p?f==="floating"?"reference":"floating":f],b=ks(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:a})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},x=ks(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:k,strategy:a}):v);return{top:(b.top-x.top+m.top)/w.y,bottom:(x.bottom-b.bottom+m.bottom)/w.y,left:(b.left-x.left+m.left)/w.x,right:(x.right-b.right+m.right)/w.x}}const GL=async(n,e,t)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:f}=pv(u,o,a),p=o,h={},m=0;for(let y=0;y<l.length;y++){var g;const{name:b,fn:v}=l[y],{x:k,y:w,data:x,reset:C}=await v({x:d,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:u,platform:{...s,detectOverflow:(g=s.detectOverflow)!=null?g:JL},elements:{reference:n,floating:e}});d=k??d,f=w??f,h={...h,[b]:{...h[b],...x}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:r}):C.rects),{x:d,y:f}=pv(u,p,a)),y=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:h}},XL=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:o,placement:r,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:u,padding:d=0}=nr(n,e)||{};if(u==null)return{};const f=dg(d),p={x:t,y:o},h=ug(r),m=cg(h),g=await s.getDimensions(u),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",k=y?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[h]-p[h]-i.floating[m],x=p[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=C?C[k]:0;(!S||!await(s.isElement==null?void 0:s.isElement(C)))&&(S=l.floating[k]||i.floating[m]);const T=w/2-x/2,N=S/2-g[m]/2-1,$=Qn(f[b],N),O=Qn(f[v],N),A=$,B=S-g[m]-O,I=S/2-g[m]/2+T,L=eh(A,I,B),R=!a.arrow&&Jn(r)!=null&&I!==L&&i.reference[m]/2-(I<A?$:O)-g[m]/2<0,q=R?I<A?I-A:I-B:0;return{[h]:p[h]+q,data:{[h]:L,centerOffset:I-L-q,...R&&{alignmentOffset:q}},reset:R}}});function YL(n,e,t){return(n?[...t.filter(r=>Jn(r)===n),...t.filter(r=>Jn(r)!==n)]:t.filter(r=>zn(r)===r)).filter(r=>n?Jn(r)===n||(e?Tu(r)!==r:!1):!0)}const QL=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,o,r;const{rects:i,middlewareData:s,placement:l,platform:a,elements:u}=e,{crossAxis:d=!1,alignment:f,allowedPlacements:p=uv,autoAlignment:h=!0,...m}=nr(n,e),g=f!==void 0||p===uv?YL(f||null,h,p):p,y=await a.detectOverflow(e,m),b=((t=s.autoPlacement)==null?void 0:t.index)||0,v=g[b];if(v==null)return{};const k=tC(v,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==v)return{reset:{placement:g[0]}};const w=[y[zn(v)],y[k[0]],y[k[1]]],x=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:w}],C=g[b+1];if(C)return{data:{index:b+1,overflows:x},reset:{placement:C}};const S=x.map($=>{const O=Jn($.placement);return[$.placement,O&&d?$.overflows.slice(0,2).reduce((A,B)=>A+B,0):$.overflows[0],$.overflows]}).sort(($,O)=>$[1]-O[1]),N=((r=S.filter($=>$[2].slice(0,Jn($[0])?2:3).every(O=>O<=0))[0])==null?void 0:r[0])||S[0][0];return N!==l?{data:{index:b+1,overflows:x},reset:{placement:N}}:{}}}},ZL=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=nr(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=zn(r),v=yo(l),k=zn(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(u.floating)),x=p||(k||!g?[Nu(l)]:FL(l)),C=m!=="none";!p&&C&&x.push(...qL(l,g,m,w));const S=[l,...x],T=await a.detectOverflow(e,y),N=[];let $=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&N.push(T[b]),f){const I=tC(r,s,w);N.push(T[I[0]],T[I[1]])}if($=[...$,{placement:r,overflows:N}],!N.every(I=>I<=0)){var O,A;const I=(((O=i.flip)==null?void 0:O.index)||0)+1,L=S[I];if(L&&(!(f==="alignment"?v!==yo(L):!1)||$.every(z=>yo(z.placement)===v?z.overflows[0]>0:!0)))return{data:{index:I,overflows:$},reset:{placement:L}};let R=(A=$.filter(q=>q.overflows[0]<=0).sort((q,z)=>q.overflows[1]-z.overflows[1])[0])==null?void 0:A.placement;if(!R)switch(h){case"bestFit":{var B;const q=(B=$.filter(z=>{if(C){const W=yo(z.placement);return W===v||W==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(W=>W>0).reduce((W,me)=>W+me,0)]).sort((z,W)=>z[1]-W[1])[0])==null?void 0:B[0];q&&(R=q);break}case"initialPlacement":R=l;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function hv(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function mv(n){return Z1.some(e=>n[e]>=0)}const eP=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:o}=e,{strategy:r="referenceHidden",...i}=nr(n,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),l=hv(s,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:mv(l)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),l=hv(s,t.floating);return{data:{escapedOffsets:l,escaped:mv(l)}}}default:return{}}}}};function nC(n){const e=Qn(...n.map(i=>i.left)),t=Qn(...n.map(i=>i.top)),o=Ft(...n.map(i=>i.right)),r=Ft(...n.map(i=>i.bottom));return{x:e,y:t,width:o-e,height:r-t}}function tP(n){const e=n.slice().sort((r,i)=>r.y-i.y),t=[];let o=null;for(let r=0;r<e.length;r++){const i=e[r];!o||i.y-o.y>o.height/2?t.push([i]):t[t.length-1].push(i),o=i}return t.map(r=>ks(nC(r)))}const nP=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:o,rects:r,platform:i,strategy:s}=e,{padding:l=2,x:a,y:u}=nr(n,e),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(o.reference))||[]),f=tP(d),p=ks(nC(d)),h=dg(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&u!=null)return f.find(y=>a>y.left-h.left&&a<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||p;if(f.length>=2){if(yo(t)==="y"){const $=f[0],O=f[f.length-1],A=zn(t)==="top",B=$.top,I=O.bottom,L=A?$.left:O.left,R=A?$.right:O.right,q=R-L,z=I-B;return{top:B,bottom:I,left:L,right:R,width:q,height:z,x:L,y:B}}const y=zn(t)==="left",b=Ft(...f.map($=>$.right)),v=Qn(...f.map($=>$.left)),k=f.filter($=>y?$.left===v:$.right===b),w=k[0].top,x=k[k.length-1].bottom,C=v,S=b,T=S-C,N=x-w;return{top:w,bottom:x,left:C,right:S,width:T,height:N,x:C,y:w}}return p}const g=await i.getElementRects({reference:{getBoundingClientRect:m},floating:o.floating,strategy:s});return r.reference.x!==g.reference.x||r.reference.y!==g.reference.y||r.reference.width!==g.reference.width||r.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},oP=new Set(["left","top"]);async function rP(n,e){const{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=zn(t),l=Jn(t),a=yo(t)==="y",u=oP.has(s)?-1:1,d=i&&a?-1:1,f=nr(e,n);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(h=l==="end"?m*-1:m),a?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const iP=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;const{x:r,y:i,placement:s,middlewareData:l}=e,a=await rP(e,n);return s===((t=l.offset)==null?void 0:t.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},sP=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:o,placement:r,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:b=>{let{x:v,y:k}=b;return{x:v,y:k}}},...u}=nr(n,e),d={x:t,y:o},f=await i.detectOverflow(e,u),p=yo(zn(r)),h=eC(p);let m=d[h],g=d[p];if(s){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",k=m+f[b],w=m-f[v];m=eh(k,m,w)}if(l){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",k=g+f[b],w=g-f[v];g=eh(k,g,w)}const y=a.fn({...e,[h]:m,[p]:g});return{...y,data:{x:y.x-t,y:y.y-o,enabled:{[h]:s,[p]:l}}}}}},lP=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,o;const{placement:r,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...u}=nr(n,e),d=await s.detectOverflow(e,u),f=zn(r),p=Jn(r),h=yo(r)==="y",{width:m,height:g}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=p===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=p==="end"?"top":"bottom");const v=g-d.top-d.bottom,k=m-d.left-d.right,w=Qn(g-d[y],v),x=Qn(m-d[b],k),C=!e.middlewareData.shift;let S=w,T=x;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(T=k),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(S=v),C&&!p){const $=Ft(d.left,0),O=Ft(d.right,0),A=Ft(d.top,0),B=Ft(d.bottom,0);h?T=m-2*($!==0||O!==0?$+O:Ft(d.left,d.right)):S=g-2*(A!==0||B!==0?A+B:Ft(d.top,d.bottom))}await a({...e,availableWidth:T,availableHeight:S});const N=await s.getDimensions(l.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Od(){return typeof window<"u"}function Rs(n){return oC(n)?(n.nodeName||"").toLowerCase():"#document"}function xn(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Oo(n){var e;return(e=(oC(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function oC(n){return Od()?n instanceof Node||n instanceof xn(n).Node:!1}function Zn(n){return Od()?n instanceof Element||n instanceof xn(n).Element:!1}function To(n){return Od()?n instanceof HTMLElement||n instanceof xn(n).HTMLElement:!1}function gv(n){return!Od()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof xn(n).ShadowRoot}const aP=new Set(["inline","contents"]);function wa(n){const{overflow:e,overflowX:t,overflowY:o,display:r}=eo(n);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&!aP.has(r)}const cP=new Set(["table","td","th"]);function uP(n){return cP.has(Rs(n))}const dP=[":popover-open",":modal"];function $d(n){return dP.some(e=>{try{return n.matches(e)}catch{return!1}})}const fP=["transform","translate","scale","rotate","perspective"],pP=["transform","translate","scale","rotate","perspective","filter"],hP=["paint","layout","strict","content"];function fg(n){const e=pg(),t=Zn(n)?eo(n):n;return fP.some(o=>t[o]?t[o]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||pP.some(o=>(t.willChange||"").includes(o))||hP.some(o=>(t.contain||"").includes(o))}function mP(n){let e=Ir(n);for(;To(e)&&!xs(e);){if(fg(e))return e;if($d(e))return null;e=Ir(e)}return null}function pg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gP=new Set(["html","body","#document"]);function xs(n){return gP.has(Rs(n))}function eo(n){return xn(n).getComputedStyle(n)}function Rd(n){return Zn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ir(n){if(Rs(n)==="html")return n;const e=n.assignedSlot||n.parentNode||gv(n)&&n.host||Oo(n);return gv(e)?e.host:e}function rC(n){const e=Ir(n);return xs(e)?n.ownerDocument?n.ownerDocument.body:n.body:To(e)&&wa(e)?e:rC(e)}function Ul(n,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=rC(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=xn(r);if(i){const l=th(s);return e.concat(s,s.visualViewport||[],wa(r)?r:[],l&&t?Ul(l):[])}return e.concat(r,Ul(r,[],t))}function th(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function iC(n){const e=eo(n);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=To(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,l=Mu(t)!==i||Mu(o)!==s;return l&&(t=i,o=s),{width:t,height:o,$:l}}function hg(n){return Zn(n)?n:n.contextElement}function ls(n){const e=hg(n);if(!To(e))return ko(1);const t=e.getBoundingClientRect(),{width:o,height:r,$:i}=iC(e);let s=(i?Mu(t.width):t.width)/o,l=(i?Mu(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const yP=ko(0);function sC(n){const e=xn(n);return!pg()||!e.visualViewport?yP:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bP(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==xn(n)?!1:e}function xi(n,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=hg(n);let s=ko(1);e&&(o?Zn(o)&&(s=ls(o)):s=ls(n));const l=bP(i,t,o)?sC(i):ko(0);let a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const p=xn(i),h=o&&Zn(o)?xn(o):o;let m=p,g=th(m);for(;g&&o&&h!==m;){const y=ls(g),b=g.getBoundingClientRect(),v=eo(g),k=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,u*=y.y,d*=y.x,f*=y.y,a+=k,u+=w,m=xn(g),g=th(m)}}return ks({width:d,height:f,x:a,y:u})}function Bd(n,e){const t=Rd(n).scrollLeft;return e?e.left+t:xi(Oo(n)).left+t}function lC(n,e){const t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Bd(n,t),r=t.top+e.scrollTop;return{x:o,y:r}}function vP(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n;const i=r==="fixed",s=Oo(o),l=e?$d(e.floating):!1;if(o===s||l&&i)return t;let a={scrollLeft:0,scrollTop:0},u=ko(1);const d=ko(0),f=To(o);if((f||!f&&!i)&&((Rs(o)!=="body"||wa(s))&&(a=Rd(o)),To(o))){const h=xi(o);u=ls(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=s&&!f&&!i?lC(s,a):ko(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+d.x+p.x,y:t.y*u.y-a.scrollTop*u.y+d.y+p.y}}function wP(n){return Array.from(n.getClientRects())}function kP(n){const e=Oo(n),t=Rd(n),o=n.ownerDocument.body,r=Ft(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=Ft(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-t.scrollLeft+Bd(n);const l=-t.scrollTop;return eo(o).direction==="rtl"&&(s+=Ft(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:l}}const yv=25;function xP(n,e){const t=xn(n),o=Oo(n),r=t.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;const d=pg();(!d||d&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const u=Bd(o);if(u<=0){const d=o.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-f.clientWidth-h);m<=yv&&(i-=m)}else u<=yv&&(i+=u);return{width:i,height:s,x:l,y:a}}const CP=new Set(["absolute","fixed"]);function SP(n,e){const t=xi(n,!0,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=To(n)?ls(n):ko(1),s=n.clientWidth*i.x,l=n.clientHeight*i.y,a=r*i.x,u=o*i.y;return{width:s,height:l,x:a,y:u}}function bv(n,e,t){let o;if(e==="viewport")o=xP(n,t);else if(e==="document")o=kP(Oo(n));else if(Zn(e))o=SP(e,t);else{const r=sC(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ks(o)}function aC(n,e){const t=Ir(n);return t===e||!Zn(t)||xs(t)?!1:eo(t).position==="fixed"||aC(t,e)}function EP(n,e){const t=e.get(n);if(t)return t;let o=Ul(n,[],!1).filter(l=>Zn(l)&&Rs(l)!=="body"),r=null;const i=eo(n).position==="fixed";let s=i?Ir(n):n;for(;Zn(s)&&!xs(s);){const l=eo(s),a=fg(s);!a&&l.position==="fixed"&&(r=null),(i?!a&&!r:!a&&l.position==="static"&&!!r&&CP.has(r.position)||wa(s)&&!a&&aC(n,s))?o=o.filter(d=>d!==s):r=l,s=Ir(s)}return e.set(n,o),o}function MP(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n;const s=[...t==="clippingAncestors"?$d(e)?[]:EP(e,this._c):[].concat(t),o],l=s[0],a=s.reduce((u,d)=>{const f=bv(e,d,r);return u.top=Ft(f.top,u.top),u.right=Qn(f.right,u.right),u.bottom=Qn(f.bottom,u.bottom),u.left=Ft(f.left,u.left),u},bv(e,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function TP(n){const{width:e,height:t}=iC(n);return{width:e,height:t}}function NP(n,e,t){const o=To(e),r=Oo(e),i=t==="fixed",s=xi(n,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=ko(0);function u(){a.x=Bd(r)}if(o||!o&&!i)if((Rs(e)!=="body"||wa(r))&&(l=Rd(e)),o){const h=xi(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else r&&u();i&&!o&&r&&u();const d=r&&!o&&!i?lC(r,l):ko(0),f=s.left+l.scrollLeft-a.x-d.x,p=s.top+l.scrollTop-a.y-d.y;return{x:f,y:p,width:s.width,height:s.height}}function zf(n){return eo(n).position==="static"}function vv(n,e){if(!To(n)||eo(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Oo(n)===t&&(t=t.ownerDocument.body),t}function cC(n,e){const t=xn(n);if($d(n))return t;if(!To(n)){let r=Ir(n);for(;r&&!xs(r);){if(Zn(r)&&!zf(r))return r;r=Ir(r)}return t}let o=vv(n,e);for(;o&&uP(o)&&zf(o);)o=vv(o,e);return o&&xs(o)&&zf(o)&&!fg(o)?t:o||mP(n)||t}const AP=async function(n){const e=this.getOffsetParent||cC,t=this.getDimensions,o=await t(n.floating);return{reference:NP(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function OP(n){return eo(n).direction==="rtl"}const $P={convertOffsetParentRelativeRectToViewportRelativeRect:vP,getDocumentElement:Oo,getClippingRect:MP,getOffsetParent:cC,getElementRects:AP,getClientRects:wP,getDimensions:TP,getScale:ls,isElement:Zn,isRTL:OP};function uC(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function RP(n,e){let t=null,o;const r=Oo(n);function i(){var l;clearTimeout(o),(l=t)==null||l.disconnect(),t=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const u=n.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(l||e(),!p||!h)return;const m=Ua(f),g=Ua(r.clientWidth-(d+p)),y=Ua(r.clientHeight-(f+h)),b=Ua(d),k={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Ft(0,Qn(1,a))||1};let w=!0;function x(C){const S=C[0].intersectionRatio;if(S!==a){if(!w)return s();S?s(!1,S):o=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!uC(u,n.getBoundingClientRect())&&s(),w=!1}try{t=new IntersectionObserver(x,{...k,root:r.ownerDocument})}catch{t=new IntersectionObserver(x,k)}t.observe(n)}return s(!0),i}function BP(n,e,t,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,u=hg(n),d=r||i?[...u?Ul(u):[],...Ul(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=u&&l?RP(u,t):null;let p=-1,h=null;s&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(e)})),t()}),u&&!a&&h.observe(u),h.observe(e));let m,g=a?xi(n):null;a&&y();function y(){const b=xi(n);g&&!uC(g,b)&&t(),g=b,m=requestAnimationFrame(y)}return t(),()=>{var b;d.forEach(v=>{r&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const Au=iP,dC=QL,Ou=sP,$u=ZL,fC=lP,pC=eP,hC=XL,mC=nP,ql=(n,e,t)=>{const o=new Map,r={platform:$P,...t},i={...r.platform,_c:o};return GL(n,e,{...r,platform:i})};let DP=class{constructor(){Ke(this,"instances",[])}error(e,t=3e3){this.show(e,"error",t)}info(e,t=3e3){this.show(e,"info",t)}success(e,t=3e3){this.show(e,"success",t)}warning(e,t=3e3){this.show(e,"warning",t)}show(e,t="info",o=3e3){const r=document.createElement("div");r.className=`o-toast ${t}`,r.innerHTML=`
168
+ <i class="yiitip-icon icon-${t}"></i>
169
+ <span class="message">${e}</span>
170
+ `,r.style.position="absolute",r.style.transition="opacity 0.3s ease, transform 0.3s ease",r.style.opacity="0",r.style.zIndex="9999",document.body.appendChild(r);const i=BP(document.body,r,()=>{ql(document.body,r,{placement:"bottom",middleware:[Au(this.instances.length*15),$u(),Ou()]}).then(({x:l,y:a})=>{Object.assign(r.style,{left:`${l}px`,top:`${a}px`})})});requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateY(0)"});const s={el:r,cleanup:i,type:t,duration:o};this.instances.push(s),this.repositionToasts(),o>0&&setTimeout(()=>this.hide(s),o)}hide(e){const{el:t}=e;t.style.opacity="0",t.style.transform="translateY(-10px)",setTimeout(()=>{e.cleanup(),t.remove(),this.instances=this.instances.filter(o=>o!==e),this.repositionToasts()},300)}repositionToasts(){this.instances.forEach((e,t)=>{const{el:o}=e;ql(document.body,o,{placement:"bottom",middleware:[Au(t*55),$u(),Ou()]}).then(({x:r,y:i})=>{Object.assign(o.style,{left:`${r}px`,top:`${i}px`})})})}};const _P=new DP;class IP{constructor(){Ke(this,"instances",[])}error(e,t=3e3){this.show(e,"error",t)}info(e,t=3e3){this.show(e,"info",t)}success(e,t=3e3){this.show(e,"success",t)}warning(e,t=3e3){this.show(e,"warning",t)}show(e,t="info",o=3e3){const r=`
171
+ <div class="o-toast ${t}">
172
+ <i class="yiitip-icon icon-${t}"></i>
173
+ <span class="message">${e}</span>
32
174
  </div>
33
- `,l=Mt(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:a,onHidden:i=>{i.destroy(),this.instances=this.instances.filter(s=>s!==i)}});l.show(),r>0&&setTimeout(()=>{l.hide()},r),this.instances.push(l),this.repositionToasts()}repositionToasts(){this.instances.forEach((n,o)=>{n.setProps({placement:"bottom",offset:[0,o*55]})})}}const Nr=new Xd,Qd={class:"o-add-node-view"},Jd={key:0,class:"view-main"},ep={class:"group o-tips"},tp={class:"panel"},np={class:"group o-tips"},op={key:1,class:"item"},rp={key:1,class:"view-emoji"},ap=e.defineComponent({__name:"AddNodeView",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Q(),{run:i}=ie(),s=e.ref("main"),c=e.ref(0);function d(m){const f=o.editor.chain();let v=null;switch(m.value){case"blockquote":v={content:un};break;case"callout":v={content:un,attrs:{icon:"💡"}};break;case"codeBlock":v={content:[],attrs:{language:"shell"}};break;case"emoji":v={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":v={attrs:m.options};break;case"horizontalRule":v={};break;case"paragraph":v={content:[]};break;case"bulletList":case"orderedList":v={content:Oa};break;case"taskList":v={content:Aa};break;case"table":setTimeout(()=>{f.insertContentAt(p.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":v={type:"paragraph",content:[{type:m.value,attrs:{src:"init"}}]};break;case"model-viewer":v={attrs:{src:"init"}};break}v&&(v.type=v.type||m.value,setTimeout(()=>{u.value?f.insertContent(v).focus().run():f.insertContentAt(p.value,v).focus().run()},1)),r("action",m)}const u=e.computed(()=>o.node.content.size===0),p=e.computed(()=>u.value?c.value:c.value+o.node.nodeSize);return e.onMounted(()=>{c.value=o.getPos()}),(m,f)=>(e.openBlock(),e.createElementBlock("section",Qd,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",Jd,[e.createElementVNode("section",null,[e.createElementVNode("div",ep,e.toDisplayString(e.unref(l)("label.basic")),1),e.createElementVNode("section",tp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(kn),(v,b)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:b,icon:v.icon,tooltip:e.unref(l)(v.label),quaternary:"",onClick:h=>d(v)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(mn).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(mn),(v,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[v.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[b>0?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",np,e.toDisplayString(e.unref(l)(v.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:"item",clickable:"",onClick:h=>d(v)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:v.icon,color:v.color},null,8,["name","color"])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(v.label)),1)]),_:2},1032,["onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",op,"No result"))]),_:1})])):s.value==="emoji"?(e.openBlock(),e.createElementBlock("section",rp)):e.createCommentVNode("",!0)]))}}),ip=e.defineComponent({__name:"AddNode",props:K.nodeViewProps,setup(t){const n=t,o=e.ref(null),r=e.ref(!1);function a(i){r.value=i}function l(){var i;(i=o.value)==null||i.setShow(!1),r.value=!1}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:o,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":a},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-add-node",{"is-selected":r.value}])},[e.createVNode(e.unref(he),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(ap,e.mergeProps(n,{onAction:l}),null,16)]),_:1},512))}}),lp={class:"o-drag-node-view"},sp={key:0,class:"view-main"},cp={key:0},up={class:"group o-tips"},dp={class:"panel"},pp=e.defineComponent({__name:"DragNodeView",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Q(),{run:i,onCommand:s}=ie(),c=e.ref("main"),d=e.ref(["heading","codeBlock","paragraph"]),u=e.computed(()=>{var h,_;const b=(h=o.node)==null?void 0:h.content.content;if(b.length>0){const y=b[0];if(y.type.name==="image")return y.type.name}return(_=o.node)==null?void 0:_.type.name}),p=e.computed(()=>fn.find(b=>b.value===u.value));function m(b){var h;return b.value===u.value&&((h=o.editor)==null?void 0:h.isActive(u.value,b.options))}function f(b){switch(b.value){default:v(b);break}r("action",b)}function v(b){var E,g,N,x,I;const h=o.getPos();if(b.value===u.value&&d.value.indexOf(u.value)<0){const L=(E=o.editor)==null?void 0:E.isActive(u.value),T=(g=o.editor)==null?void 0:g.commands.lift(u.value);console.log("lift",u.value,L,T);return}const _=(N=o.editor)==null?void 0:N.commands,y=(x=o.editor)==null?void 0:x.chain().focus(h+1);console.log("runCommand",b),s(_,y,b.value,b.options),(I=o.editor)==null||I.commands.setNodeSelection(h)}return e.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ee.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:ee.deepOrange}]),(b,h)=>(e.openBlock(),e.createElementBlock("section",lp,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",sp,[p.value?(e.openBlock(),e.createElementBlock("section",cp,[e.createElementVNode("div",up,e.toDisplayString(e.unref(l)("label.turnInto")),1),e.createElementVNode("section",dp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fn),(_,y)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:y,icon:_.icon,tooltip:e.unref(l)(_.label),"content-class":{"is-active":m(_)},quaternary:"",onClick:E=>f(_)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ht),e.mergeProps(o,{colorful:"","show-group":"",onAction:f}),null,16)])):e.createCommentVNode("",!0)]))}}),fp=e.defineComponent({__name:"DragNode",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{run:a}=ie(),l=e.ref(null),i=e.ref(0),s=e.ref(!1),c=e.ref(["heading","codeBlock","paragraph"]),d=e.ref(!1),u=e.computed(()=>{var y,E;const _=(y=o.node)==null?void 0:y.content.content;if(_.length>0){const g=_[0];if(g.type.name==="image")return g.type.name}return(E=o.node)==null?void 0:E.type.name}),p=e.computed(()=>{var y;let _=u.value;return _==="heading"?{icon:`format_h${((y=o.node.attrs)==null?void 0:y.level)||1}`,color:ee.blue}:(_==="table-wrapper"&&(_="table"),ho.find(E=>E.value===_)||{icon:"title"})});function m(_){var y;(y=l.value)==null||y.setShow(!1),r("action",_)}function f(_){s.value=_,console.log("show",_),_&&v()}function v(){var y;let _=o.getPos();c.value.includes(u.value)||(_+=1),(y=o.editor)==null||y.commands.setNodeSelection(_),i.value=_}function b(_){d.value=!0,setTimeout(()=>{d.value=!1},10)}function h(_){d.value=!1}return(_,y)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:l,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":f},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-drag-node",{"is-selected":s.value,"is-dragging":d.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:b,onDragend:h},[e.createVNode(e.unref(he),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref(U),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(pp,e.mergeProps(o,{onAction:m}),null,16)]),_:1},512))}}),mp=e.defineComponent({__name:"index",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,a=e.ref(!1),l=e.ref(0);e.ref(0);const i=e.computed(()=>s.value==="paragraph"&&o.node.content.size===0),s=e.computed(()=>{var m,f;const p=(m=o.node)==null?void 0:m.content.content;if(p.length>0){const v=p[0];if(v.type.name==="image")return v.type.name}return(f=o.node)==null?void 0:f.type.name}),c=e.computed(()=>{var p;return l.value||((p=o.node.attrs)==null?void 0:p.level)}),d=e.computed(()=>s.value==="heading"?`type-heading-${c.value}`:`type-${s.value}`);function u(p){r("action",p)}return e.onMounted(()=>{l.value=0}),(p,m)=>{var f;return(f=p.editor)!=null&&f.isEditable?(e.openBlock(),e.createElementBlock("section",{key:0,class:e.normalizeClass(["o-side-node",{"is-active":a.value,"is-empty":i.value}])},[e.createElementVNode("section",{class:e.normalizeClass(["action-container",d.value])},[e.createVNode(ip,e.normalizeProps(e.guardReactiveProps(o)),null,16),i.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(fp,e.mergeProps({key:0},o,{onAction:u}),null,16))],2)],2)):e.createCommentVNode("",!0)}}}),ot=e.defineComponent({__name:"ONodeView",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,a=e.inject("sideNode",{value:!1});return e.computed(()=>{const l={};return o.node.attrs["data-id"]&&(l["data-id"]=o.node.attrs["data-id"]),l}),(l,i)=>(e.openBlock(),e.createBlock(e.unref(K.NodeViewWrapper),{class:"o-node-view","data-id":l.node.attrs.id},{default:e.withCtx(()=>{var s;return[e.unref(a)&&((s=l.editor)!=null&&s.isEditable)?(e.openBlock(),e.createBlock(mp,e.mergeProps({key:0},o,{onAction:i[0]||(i[0]=c=>r("action"))}),null,16)):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")]}),_:3},8,["data-id"]))}}),gp={class:"o-add-node-view"},bp={key:0,class:"view-main"},vp={class:"group o-tips"},hp={class:"panel"},_p={class:"group o-tips"},kp={key:1,class:"item"},yp=e.defineComponent({__name:"AddNodeView",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Q(),{run:i}=ie(),s=e.ref("main");function c(p){const m=o.editor.chain();let f=null;switch(p.value){case"aiBlock":f={content:un,attrs:{icon:"💡"}};break;case"blockquote":f={content:un};break;case"callout":f={content:un,attrs:{icon:"💡"}};break;case"codeBlock":f={content:[],attrs:{language:"shell"}};break;case"details":f=cs;break;case"diagram":f=Ba;break;case"emoji":f={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":f={attrs:p.options};break;case"horizontalRule":f={};break;case"paragraph":f={content:[]};break;case"bulletList":case"orderedList":f={content:Oa};break;case"taskList":f={content:Aa};break;case"table":setTimeout(()=>{m.insertContentAt(u.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),r("action",p);return;case"image":f={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":f={attrs:{src:"init"}};break}if(f){const v=u.value;f.type=f.type||p.value,setTimeout(()=>{d.value?m.insertContent(f).focus().run():m.insertContentAt(v,f).focus().run()},1)}r("action",p)}const d=e.computed(()=>{var p;return((p=o.node)==null?void 0:p.content.size)===0}),u=e.computed(()=>d.value?o.getPos():o.getPos()+o.node.nodeSize);return(p,m)=>(e.openBlock(),e.createElementBlock("section",gp,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",bp,[e.createElementVNode("section",null,[e.createElementVNode("div",vp,e.toDisplayString(e.unref(l)("label.basic")),1),e.createElementVNode("section",hp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(kn),(f,v)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:v,icon:f.icon,tooltip:e.unref(l)(f.label),quaternary:"",onClick:b=>c(f)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref($e)),e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(mn).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(mn),(f,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[f.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[v>0?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",_p,e.toDisplayString(e.unref(l)(f.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:"item",clickable:"",onClick:b=>c(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:f.icon,color:f.color},null,8,["name","color"])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(f.label)),1)]),_:2},1032,["onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",kp,"No result"))]),_:1})])):e.createCommentVNode("",!0)]))}}),Bi=e.defineComponent({__name:"AddNode",props:{...K.nodeViewProps,add:{type:String,default:"menu"}},setup(t){const n=t,o=e.ref(),r=e.ref(!1),a=e.computed(()=>{var u;return((u=n.node)==null?void 0:u.content.size)===0}),l=e.computed(()=>a.value?n.getPos():n.getPos()+n.node.nodeSize);function i(u){r.value=u}function s(){var u;n.add==="menu"?(u=o.value)==null||u.setShow(!0):c()}function c(){const u={type:"paragraph",content:[{type:"text",text:"/"}]},p=n.editor.chain();setTimeout(()=>{a.value?p.insertContent(u).focus().run():p.insertContentAt(l.value,u).focus().run()},1)}function d(){var u;(u=o.value)==null||u.setShow(!1),r.value=!1}return(u,p)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:o,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-add-btn",{"is-selected":r.value}])},[e.createVNode(e.unref(he),{type:"tertiary",class:"o-node-btn",onClick:s},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(yp,e.mergeProps(n,{onAction:d}),null,16)]),_:1},512))}}),Ep={class:"o-drag-node-view"},wp={key:0,class:"view-main"},xp={key:0},Np={class:"group o-tips"},Cp={class:"panel"},Sp=e.defineComponent({__name:"DragNodeView",props:K.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Q(),{run:i,onCommand:s}=ie(),c=e.ref("main"),d=e.ref(["heading","codeBlock","paragraph"]),u=e.computed(()=>{var h,_;const b=(h=o.node)==null?void 0:h.content.content;if(b.length>0){const y=b[0];if(y.type.name==="image")return y.type.name}return(_=o.node)==null?void 0:_.type.name}),p=e.computed(()=>fn.find(b=>b.value===u.value));function m(b){var h;return b.value===u.value&&((h=o.editor)==null?void 0:h.isActive(u.value,b.options))}function f(b){switch(b.value){case"copy":case"delete":case"duplicate":break;default:v(b);break}r("action",b)}function v(b){var E,g,N,x,I;const h=o.getPos();if(b.value===u.value&&d.value.indexOf(u.value)<0){const L=(E=o.editor)==null?void 0:E.isActive(u.value),T=(g=o.editor)==null?void 0:g.commands.lift(u.value);console.log("lift",u.value,L,T);return}const _=(N=o.editor)==null?void 0:N.commands,y=(x=o.editor)==null?void 0:x.chain().focus(h+1);console.log("runCommand",b),s(_,y,b.value,b.options),(I=o.editor)==null||I.commands.focus()}return(b,h)=>(e.openBlock(),e.createElementBlock("section",Ep,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",wp,[p.value?(e.openBlock(),e.createElementBlock("section",xp,[e.createElementVNode("div",Np,e.toDisplayString(e.unref(l)("label.turnInto")),1),e.createElementVNode("section",Cp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(fn),(_,y)=>(e.openBlock(),e.createBlock(e.unref(pe),{key:y,icon:_.icon,tooltip:e.unref(l)(_.label),"content-class":{"is-active":m(_)},quaternary:"",onClick:E=>f(_)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ht),e.mergeProps(o,{colorful:"","show-group":"",onAction:f}),null,16)])):e.createCommentVNode("",!0)]))}}),Mi=e.defineComponent({__name:"DragNode",props:K.nodeViewProps,emits:["dragstart","dragend"],setup(t,{emit:n}){const o=t,r=n,{run:a}=ie(),l=e.ref(null),i=e.ref(!1),s=e.ref(["heading","codeBlock","paragraph"]),c=e.computed(()=>{var h,_,y;const b=(_=(h=o.node)==null?void 0:h.content)==null?void 0:_.content;if((b==null?void 0:b.length)>0){const E=b[0];if(E.type.name==="image")return E.type.name}return(y=o.node)==null?void 0:y.type.name}),d=e.computed(()=>{var h;let b=c.value;return b==="heading"?{icon:`format_h${((h=o.node.attrs)==null?void 0:h.level)||1}`,color:ee.blue}:(b==="table-wrapper"&&(b="table"),ho.find(_=>_.value===b)||{icon:"title"})});function u(b){r("dragstart",b)}function p(b){r("dragend",b)}function m(b){var h;(h=l.value)==null||h.setShow(!1)}function f(b){i.value=b,b&&v()}function v(){var h;let b=o.getPos();s.value.includes(c.value),(h=o.editor)==null||h.commands.setNodeSelection(b)}return e.watch(()=>o.getPos(),b=>{var h;(h=l.value)==null||h.setShow(!1)}),(b,h)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:l,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":f},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-drag-btn",{selected:i.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:u,onDragend:p},[e.createVNode(e.unref(he),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref(U),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(Sp,e.mergeProps(o,{onAction:m}),null,16)]),_:1},512))}}),Tp={key:0,class:"spinner"},Op={key:2,class:"o-btn__label"},he=e.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:a[0]||(a[0]=l=>o("click",l))},[t.loading?(e.openBlock(),e.createElementBlock("div",Tp)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.icon?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:t.icon,class:e.normalizeClass(t.iconClass)},null,8,["name","class"])):e.createCommentVNode("",!0)],64)),t.label?(e.openBlock(),e.createElementBlock("span",Op,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],2))}}),Ap={class:"o-btn-group"},Ri=e.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:n}){return(o,r)=>(e.openBlock(),e.createElementBlock("div",Ap,[e.renderSlot(o.$slots,"default")]))}}),Bp={class:"o-checkbox"},Mp={class:"o-checkbox__main"},Rp={class:"o-checkbox__suffix"},Cr=e.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,a=e.computed({get(){return o.modelValue},set(l){r("update:modelValue",l)}});return(l,i)=>(e.openBlock(),e.createElementBlock("div",Bp,[e.createElementVNode("div",Mp,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=s=>a.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,a.value]])]),e.createElementVNode("div",Rp,e.toDisplayString(t.label),1)]))}}),Ip={class:"dialog-header"},Dp={class:"dialog-body"},Lp={class:"dialog-footer"},Ii=e.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean},icon:{},title:{},fullscreen:{type:Boolean}},emits:["close","update:show"],setup(t,{emit:n}){const o=n,r=()=>{o("update:show",!1),o("close")};return(a,l)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dialog-overlay o-dialog",onClick:e.withModifiers(r,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["dialog-box",{fullscreen:t.fullscreen}])},[e.createElementVNode("div",Ip,[e.renderSlot(a.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),e.createVNode(e.unref(he),{icon:"close",class:"close",onClick:r})]),e.createElementVNode("div",Dp,[e.renderSlot(a.$slots,"default")]),e.createElementVNode("div",Lp,[e.renderSlot(a.$slots,"footer")])],2)])):e.createCommentVNode("",!0)]))}}),$e=e.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),Vp={key:0,class:"dialog-overlay o-image-viewer"},$p={class:"dialog-box"},Pp={class:"dialog-body"},Fp=["src"],Up={class:"action-group"},zp={class:"action-group"},Hp={class:"o-btn scale"},Di=e.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(t,{emit:n}){const o=t,r=n,{downloadImage:a}=_o(),l=e.ref(0),i=e.ref(1),s=e.ref({x:0,y:0}),c=e.ref(!1),d=e.ref({x:0,y:0}),u=e.ref(null),p=e.ref(null),m={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},f=e.computed(()=>{const O=o.images.length;let M={};return O>0&&(M=l.value>=0&&l.value<O?o.images.at(l.value):o.images.at(0)),M}),v=e.computed(()=>({transform:`translate(${s.value.x}px, ${s.value.y}px) scale(${i.value})`,transformOrigin:"center center",cursor:c.value?"grabbing":i.value>1?"grab":"default"})),b=e.computed(()=>parseInt(`${i.value*100}`)),h=O=>{O.preventDefault();const M=-O.deltaY*m.WHEEL_SENSITIVITY;let V=i.value+M;if(V=Math.max(m.MIN_SCALE,Math.min(m.MAX_SCALE,V)),p.value&&u.value){const F=p.value.getBoundingClientRect(),H=O.clientX-F.left-F.width/2,te=O.clientY-F.top-F.height/2,B=V-i.value;s.value.x-=H*B,s.value.y-=te*B}i.value=V},_=O=>{i.value<=1||(O.preventDefault(),c.value=!0,d.value={x:O.clientX-s.value.x,y:O.clientY-s.value.y},document.addEventListener("mousemove",y),document.addEventListener("mouseup",E))},y=O=>{c.value&&(s.value.x=O.clientX-d.value.x,s.value.y=O.clientY-d.value.y)},E=()=>{c.value=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",E)},g=()=>{i.value=Math.min(m.MAX_SCALE,i.value+m.STEP)},N=()=>{i.value=Math.max(m.MIN_SCALE,i.value-m.STEP)},x=()=>{i.value=1,s.value={x:0,y:0}},I=()=>{l.value>0&&(l.value-=1,x())},L=()=>{l.value<o.images.length-1&&(l.value+=1,x())},T=()=>{x(),r("update:show",!1)},P=()=>{var O;a((O=f.value.attrs)==null?void 0:O.src)},Z=O=>{if(o.show)switch(O.preventDefault(),O.stopPropagation(),O.key){case"+":case"=":O.preventDefault(),g();break;case"-":O.preventDefault(),N();break;case"0":O.preventDefault(),x();break;case"ArrowLeft":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),I());break;case"ArrowRight":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),L());break;case"Escape":T();break}};return e.watch(()=>o.current,O=>{l.value=O,x()}),e.onMounted(()=>{l.value=o.current,document.addEventListener("keydown",Z)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",Z),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",E)}),(O,M)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",Vp,[e.createElementVNode("header",null,[e.createVNode(e.unref(he),{icon:"close",onClick:T})]),e.createElementVNode("div",$p,[e.createElementVNode("div",Pp,[e.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:p,onWheel:e.withModifiers(h,["prevent"]),onDblclick:x},[e.createElementVNode("img",{ref_key:"imageRef",ref:u,src:f.value.attrs.src,alt:"image",style:e.normalizeStyle(v.value),onMousedown:_},null,44,Fp)],544)])]),e.createElementVNode("footer",null,[e.createElementVNode("div",Up,[e.createVNode(e.unref(he),{icon:"arrow_back",class:e.normalizeClass({disabled:l.value<=0}),onClick:I},null,8,["class"]),e.createVNode(e.unref(he),{icon:"arrow_back","icon-class":"rotate-180",class:e.normalizeClass({disabled:l.value>=o.images.length-1}),onClick:L},null,8,["class"])]),e.createElementVNode("div",zp,[e.createVNode(e.unref(he),{icon:"horizontal_rule",onClick:N}),e.createElementVNode("div",Hp,e.toDisplayString(b.value)+"%",1),e.createVNode(e.unref(he),{icon:"add",onClick:g}),e.createVNode(e.unref(he),{icon:"download",onClick:P}),e.createVNode(e.unref(he),{icon:"close",onClick:T})])])])):e.createCommentVNode("",!0)]))}}),qp={class:"o-input__prefix"},Gp={class:"o-input__main"},Kp=["placeholder"],Wp={class:"o-input__suffix"},bt=e.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","enter","focus","update:modelValue"],setup(t,{expose:n,emit:o}){const r=t,a=o,l=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){a("update:modelValue",d)}});function s(){var d;(d=l.value)==null||d.focus()}function c(){i.value="",s()}return n({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-input",`type-${t.type}`])},[e.createElementVNode("div",qp,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",Gp,[e.withDirectives(e.createElementVNode("input",{ref_key:"input",ref:l,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,onFocus:u[1]||(u[1]=p=>a("focus")),onBlur:u[2]||(u[2]=p=>a("blur")),onKeyup:u[3]||(u[3]=e.withKeys(p=>a("enter"),["enter"]))},null,40,Kp),[[e.vModelText,i.value]])]),e.createElementVNode("div",Wp,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(U,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),Ge=e.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[e.renderSlot(n.$slots,"default")],2))}}),Yp={class:"o-list-item"},jp={class:"o-list-item__prefix"},Zp={class:"o-list-item__main"},Xp={class:"o-list-item__suffix"},ze=e.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("li",Yp,[e.createElementVNode("div",jp,[e.renderSlot(n.$slots,"prefix")]),e.createElementVNode("div",Zp,[e.renderSlot(n.$slots,"default")]),e.createElementVNode("div",Xp,[e.renderSlot(n.$slots,"suffix")])]))}}),ge=e.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:n,emit:o}){const r=t,a=o,{theme:l}=tn(),i=e.ref(null),s=e.ref(),c=e.ref();function d(f){var v,b,h,_;f?((b=c.value)==null||b.setProps({getReferenceClientRect:(v=r.event)!=null&&v.clientX?u:null}),(h=c.value)==null||h.show()):(_=c.value)==null||_.hide()}function u(){var f,v;return{width:0,height:0,left:r.event.clientX,right:r.event.clientX,top:r.event.clientY,bottom:r.event.clientY,x:((f=r.event)==null?void 0:f.clientX)||0,y:((v=r.event)==null?void 0:v.clientY)||0,toJSON:()=>{var b,h;return{width:100,height:100,left:((b=r.event)==null?void 0:b.clientX)||0,top:((h=r.event)==null?void 0:h.clientY)||0}}}}function p(){c.value=Mt(i.value,{appendTo:()=>document.body,animation:"shift-away",arrow:r.arrow,content:s.value,duration:r.duration,delay:r.delay,interactive:!0,offset:r.offset,placement:r.placement,trigger:r.trigger,theme:l.value,onShow:f=>{f.popper.classList.add(r.tippyClass||"tippy"),a("update:show",!0)},onHide:f=>{a("update:show",!1)}})}function m(){c.value.setProps({theme:l.value})}return e.watch(l,f=>{m()}),n({setShow:d}),e.onMounted(()=>{p()}),e.onUnmounted(()=>{c.value&&c.value.destroy()}),(f,v)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:i,"data-tippy-role":"popover",class:"o-popover"},[e.renderSlot(f.$slots,"trigger"),t.disable?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contentRef",ref:s,class:e.normalizeClass(["popover-content",t.contentClass])},[e.renderSlot(f.$slots,"default")],2))],512))}}),Qp={class:"o-textarea__prefix"},Jp={class:"o-textarea__main"},ef=["placeholder","rows"],tf={class:"o-textarea__suffix"},Li=e.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(t,{expose:n,emit:o}){const r=t,a=o,l=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){a("update:modelValue",d)}});function s(){var d;(d=l.value)==null||d.focus()}function c(){i.value="",s()}return n({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-textarea",`type-${t.type}`])},[e.createElementVNode("div",Qp,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",Jp,[e.withDirectives(e.createElementVNode("textarea",{ref_key:"input",ref:l,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,rows:t.rows,onFocus:u[1]||(u[1]=p=>a("focus")),onBlur:u[2]||(u[2]=p=>a("blur"))},null,40,ef),[[e.vModelText,i.value]])]),e.createElementVNode("div",tf,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(U,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),nf=e.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const n=t,{run:o}=ie(),{tr:r}=Q(),a=e.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:r("label.ai")},blockquote:{icon:"format_quote_open",tooltip:r("editor.blockquote")},bold:{icon:"format_bold",tooltip:r("editor.bold")},callout:{icon:"card_text",tooltip:r("editor.callout")},clearFormat:{icon:"format_clear",tooltip:r("editor.removeFormat")},code:{icon:"code",tooltip:r("editor.code")},codeBlock:{icon:"code_braces",tooltip:r("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:r("editor.hr")},italic:{icon:"format_italic",tooltip:r("editor.italic")},image:{icon:"image",tooltip:r("editor.photo")},inlineMath:{icon:"function",tooltip:r("editor.inlineMath")},blockMath:{icon:"functions",tooltip:r("editor.blockMath")},inlineMathDelete:{icon:"close",tooltip:r("editor.delete")},linkUnset:{icon:"link_off",tooltip:r("link.off")},modelViewer:{icon:"3d_rotation",tooltip:r("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:r("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:r("editor.underline")},video:{icon:"videocam",tooltip:r("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:r("editor.aiBlock")},diagram:{icon:"mermaid",tooltip:r("diagram.name")}})),l=e.computed(()=>a.value[n.name]||{icon:"",isActive:!1,command:()=>{}});function i(){o(n.editor,n.name)}return(s,c)=>{var d;return e.openBlock(),e.createBlock(pe,{class:"o-simple-command-btn",icon:l.value.icon,tooltip:l.value.tooltip,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(t.name),"rotate-90":l.value.rotate},onClick:i},null,8,["icon","tooltip","content-class"])}}}),of=e.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:n}=Q();return(o,r)=>(e.openBlock(),e.createBlock(ft,{"content-class":"o-ai-btn",icon:"auto_awesome",color:e.unref(ee).purple,tooltip:e.unref(n)("ai.askAi")},null,8,["color","tooltip"]))}}),rf={class:"o-align-group"},af=e.defineComponent({__name:"OAlignGroup",props:{editor:{type:Te.Editor}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.computed(()=>[{label:o("editor.left"),value:"left",icon:"format_align_left"},{label:o("editor.center"),value:"center",icon:"format_align_center"},{label:o("editor.right"),value:"right",icon:"format_align_right"}]);function l(i){r(n.editor,"textAlign",{textAlign:i.value})}return(i,s)=>(e.openBlock(),e.createElementBlock("div",rf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(pe,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>l(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),lf={class:"o-background-color-dropdown o-button-group"},sf=e.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"backgroundColor",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",lf,[e.createVNode(e.unref(he),{icon:"background_color",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(he),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").backgroundColor,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),cf={class:"o-highlight-dropdown o-button-group"},uf=e.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"highlight",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",cf,[e.createVNode(e.unref(he),{icon:"ink_highlighter",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(he),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),df=e.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(t){const n=t,{run:o}=ie(),{tr:r}=Q();function a(){const{state:l}=n.editor,{selection:i}=l,{$from:s}=i,d=s.node().type.name;o(n.editor,"details",{type:d})}return(l,i)=>{var s;return e.openBlock(),e.createBlock(pe,{class:"o-details-btn",icon:"toggle_list",tooltip:e.unref(r)("editor.toggleList"),"content-class":{"is-active":(s=t.editor)==null?void 0:s.isActive("details")},onClick:a},null,8,["tooltip","content-class"])}}}),pf=e.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null);function l(i){var s;(s=a.value)==null||s.setShow(!1),r(n.editor,"content",{content:i.emoji})}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:e.unref(o)("editor.emoji")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ko),{items:e.unref(Bn.emojiGroups),onSelect:l,"enable-search":""},null,8,["items"])]),_:1},512))}}),ff=e.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,"fontFamily",{fontFamily:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:e.unref(o)("editor.fontFamily")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:m=>i(d.value)},{suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive("textStyle",{fontFamily:d.value})?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("span",{style:e.normalizeStyle(`font-family: ${d.value}`)},e.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),mf={class:"o-fore-color-dropdown o-button-group"},gf=e.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.ref("#ff4d4f");function i(){s(l.value)}function s(c){var d;(d=a.value)==null||d.setShow(!1),l.value=c,r(n.editor,"color",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",mf,[e.createVNode(e.unref(he),{icon:"format_color_text",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(he),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.textColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),bf=e.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:o("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:o("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:o("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:o("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:o("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function i(c){var d,u;return c.value==="heading"?(d=n.editor)==null?void 0:d.isActive(c.value,{level:c.valueAlt}):(u=n.editor)==null?void 0:u.isActive(c.value)}function s(c){var d;(d=a.value)==null||d.setShow(!1),r(n.editor,c.value,{level:c.valueAlt})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:e.unref(o)("editor.heading")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:e.normalizeClass({"is-active":i(u)}),onClick:m=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),vf=e.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:Te.Editor,required:!0}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(null);function c(){if(n.editor.isActive("inlineMath")){const{state:m}=n.editor,{selection:f,schema:v}=m;if(f instanceof Ct.NodeSelection){const b=f.node;s.value=f.from,b.type.name==="inlineMath"&&(i.value=b.attrs.latex)}}}function d(){var m;(m=a.value)==null||m.setShow(!1)}function u(m){var f;console.log("confirm",m),m?r(n.editor,"inlineMathUpdate",{latex:m,pos:s.value}):r(n.editor,"inlineMathDelete",{pos:s.value}),(f=a.value)==null||f.setShow(!1)}function p(){window.open("https://katex.org/docs/supported.html","target")}return(m,f)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[f[0]||(f[0]=v=>l.value=v),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"edit",tooltip:e.unref(o)("label.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(yo),{key:0,title:e.unref(o)("label.edit"),val:i.value,icon:"function",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"help",tooltip:e.unref(o)("label.help"),onClick:p},null,8,["tooltip"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),hf={class:"o-list-dropdown o-button-group"},_f=e.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.ref();function i(){r(n.editor,l.value.value)}function s(d){a.value.setShow(!1),l.value=d,r(n.editor,d.value)}const c=e.computed(()=>[{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.todoList"),value:"taskList",icon:"check_box"}]);return e.onMounted(()=>{l.value=c.value[0]}),(d,u)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(st),null,{trigger:e.withCtx(()=>{var p;return[e.createElementVNode("div",hf,[e.createVNode(e.unref(he),{icon:(p=l.value)==null?void 0:p.icon,class:"o-command-btn",onClick:e.withModifiers(i,["stop"])},null,8,["icon"]),e.createVNode(e.unref(he),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:e.withCtx(()=>{var p;return[e.createTextVNode(" "+e.toDisplayString((p=l.value)==null?void 0:p.label),1)]}),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(p,m)=>{var f;return e.openBlock(),e.createBlock(e.unref(ze),{key:m,class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive(p.value)}),onClick:v=>s(p)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var v;return[(v=t.editor)!=null&&v.isActive(p.value)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),kf={class:"o-list-group"},yf=e.defineComponent({__name:"OListGroup",props:{editor:{type:Te.Editor,required:!0}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.computed(()=>[{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.todoList"),value:"taskList",icon:"check_box"}]);function l(i){r(n.editor,i.value)}return(i,s)=>(e.openBlock(),e.createElementBlock("div",kf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(pe,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(c.value)},onClick:p=>l(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Ef=e.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Te.Editor,required:!0}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var m;i.value="",s.value=!0;const p=(m=n.editor)==null?void 0:m.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank")}function d(){var p;(p=a.value)==null||p.setShow(!1)}function u(p){var m;p?r(n.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(n.editor,"linkUnset"),(m=a.value)==null||m.setShow(!1)}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[m[1]||(m[1]=f=>l.value=f),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"edit",tooltip:e.unref(o)("link.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(yo),{key:0,title:e.unref(o)("link.edit"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Cr),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=f=>s.value=f),label:e.unref(o)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),wf=e.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q();function r(){var l;const a=(l=n.editor)==null?void 0:l.getAttributes("link");a!=null&&a.href&&window.open(a.href,"target")}return(a,l)=>(e.openBlock(),e.createBlock(pe,{icon:"open_in_new",tooltip:e.unref(o)("link.open"),"content-class":"o-link-open-btn",onClick:r},null,8,["tooltip"]))}}),xf={class:"o-command-btn"},Nf={class:"o-more-bubble"},Cf=e.defineComponent({__name:"OMoreBubble",props:{editor:{type:Te.Editor,required:!0}},setup(t){const n=e.ref();return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:n,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:e.withCtx(()=>[e.createElementVNode("div",xf,[e.createVNode(e.unref(U),{name:"more_horiz"})])]),default:e.withCtx(()=>[e.createElementVNode("section",Nf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Ga),(a,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l},[a==="separator"?(e.openBlock(),e.createBlock(e.unref($e),{key:0,vertical:""})):typeof a=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oo)(a)),{key:1,name:a,editor:t.editor},null,8,["name","editor"])):e.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),Sf=e.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.paragraph"),value:"paragraph",icon:"title"},{label:o("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:o("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:o("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:o("editor.todoList"),value:"taskList",icon:"check_box"},{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:o("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function i(c){var d;return(d=n.editor)==null?void 0:d.isActive(c.value,c.options)}function s(c){a.value.setShow(!1),r(n.editor,c.value,c.options)}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:e.unref(o)("label.styles")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:e.normalizeClass({"is-active":i(u)}),onClick:m=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),Tf=e.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null);function l(i){var s;(s=a.value)==null||s.setShow(!1),r(n.editor,"tableInsert",i)}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"window","content-class":"o-table-btn",tooltip:e.unref(o)("table.insert")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(vi),{onSelect:l})]),_:1},512))}}),Of={class:"o-table-group"},Af=e.defineComponent({__name:"OTableGroup",props:{editor:{type:Te.Editor,required:!0}},setup(t){const{tr:n}=Q(),{run:o}=ie();return(r,a)=>{var l,i;return e.openBlock(),e.createElementBlock("section",Of,[(l=t.editor)!=null&&l.can().mergeCells()?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:"cell_merge",tooltip:e.unref(n)("table.merge"),onClick:a[0]||(a[0]=s=>e.unref(o)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):e.createCommentVNode("",!0),(i=t.editor)!=null&&i.can().splitCell()?(e.openBlock(),e.createBlock(e.unref(pe),{key:1,icon:"splitscreen_left",tooltip:e.unref(n)("table.split"),onClick:a[1]||(a[1]=s=>e.unref(o)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(hi),{editor:t.editor},null,8,["editor"])])}}}),Bf=e.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Te.Editor}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(null),l=e.ref(""),i=e.ref("");function s(c){c.name==="color"?(l.value=c.value,localStorage.setItem("yiitap.text-color.fore",c.value)):c.name==="backColor"&&(i.value=c.value,localStorage.setItem("yiitap.text-color.back",c.value)),a.value.setShow(!1),r(n.editor,c.name,{color:c.value})}return e.onMounted(()=>{l.value=localStorage.getItem("yiitap.text-color.fore")||"",i.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,d)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:e.unref(o)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(yr),{"fore-color":l.value,"back-color":i.value,"default-label":e.unref(o)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Mf=e.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Te.Editor}},setup(t){const n=t,{tr:o}=Q(),{run:r}=ie(),a=e.ref(),l=e.computed(()=>[{label:o("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:o("editor.underline"),value:"underline",icon:"format_underlined"},{label:o("editor.code"),value:"code",icon:"code",separator:!0},{label:o("editor.code"),value:"subscript",icon:"subscript",separator:!0},{label:o("editor.code"),value:"superscript",icon:"superscript"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(ge),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:e.unref(o)("editor.textFormat")},{default:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ge),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref($e),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ze),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:m=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive(d.value)?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),Rf={ai:of,"align-dropdown":ar,"align-group":af,"background-color":sf,color:gf,details:df,"font-family":ff,heading:bf,highlight:uf,"inline-math-edit":vf,"list-dropdown":_f,"list-group":yf,link:ir,"link-edit":Ef,"link-open":wf,emoji:pf,more:Cf,"style-dropdown":Sf,table:Tf,"table-group":Af,"text-color-dropdown":Bf,"text-format-dropdown":Mf},Oo=t=>Rf[t]||nf,If={key:0,class:"o-main-menu"},Df={class:"left"},Lf={class:"right"},Vi=e.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const n=t,o=e.computed(()=>{var a;let r=n.menu;return(a=n.editor)!=null&&a.isActive("table")&&(r=Pa),r.length>0?r:$a});return(r,a)=>t.editor?(e.openBlock(),e.createElementBlock("section",If,[e.createElementVNode("section",Df,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(l,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[l==="separator"?(e.openBlock(),e.createBlock(e.unref($e),{key:0,vertical:""})):typeof l=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oo)(l)),{key:1,name:l,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),e.renderSlot(r.$slots,"left")]),e.createElementVNode("section",Lf,[e.renderSlot(r.$slots,"right")])])):e.createCommentVNode("",!0)}}),$i=[`
175
+ `,i=Ao(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:r,onHidden:s=>{s.destroy(),this.instances=this.instances.filter(l=>l!==s)}});i.show(),o>0&&setTimeout(()=>{i.hide()},o),this.instances.push(i),this.repositionToasts()}repositionToasts(){this.instances.forEach((e,t)=>{e.setProps({placement:"bottom",offset:[0,t*55]})})}}const mg=new IP,Hn=c.defineComponent({__name:"ONodeView",props:ht,setup(n){return(e,t)=>(c.openBlock(),c.createBlock(c.unref(Dm),{class:"o-node-view","data-id":e.node.attrs.id},{default:c.withCtx(()=>[c.renderSlot(e.$slots,"default")]),_:3},8,["data-id"]))}}),LP={class:"o-add-node-view"},PP={key:0,class:"view-main"},VP={class:"group o-tips"},zP={class:"panel"},HP={class:"group o-tips"},FP={key:1,class:"item"},jP=c.defineComponent({__name:"AddNodeView",props:ht,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s}=xe(),l=c.ref("main");function a(f){let p=null;switch(f.value){case"aiBlock":p=hI;break;case"audio":p=mI;break;case"blockquote":p=gI;break;case"callout":p=yI;break;case"codeBlock":p=bI;break;case"details":p=vI;break;case"diagram":p=q1;break;case"emoji":p=wI;break;case"heading":p={attrs:f.options};break;case"horizontalRule":p={};break;case"paragraph":p={type:"paragraph",content:[]};break;case"bulletList":case"orderedList":p={content:xI};break;case"taskList":p={content:SI};break;case"table":p=CI;break;case"image":p=kI;break;case"model-viewer":p={attrs:{src:"init"}};break;case"video":p=EI;break}if(p){p.type=p.type||f.value;const h=u.value?d.value+1:d.value,m=f.value==="emoji"?h+2:h+1;requestAnimationFrame(()=>{t.editor.chain().insertContentAt(h,p).focus(m).scrollIntoView().run()})}o("action",f)}const u=c.computed(()=>{var f;return((f=t.node)==null?void 0:f.content.size)===0}),d=c.computed(()=>u.value?t.getPos():t.getPos()+t.node.nodeSize);return(f,p)=>(c.openBlock(),c.createElementBlock("section",LP,[l.value==="main"?(c.openBlock(),c.createElementBlock("section",PP,[c.createElementVNode("section",null,[c.createElementVNode("div",VP,c.toDisplayString(c.unref(i)("label.basic")),1),c.createElementVNode("section",zP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(ba),(h,m)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:m,icon:h.icon,tooltip:c.unref(i)(h.label),quaternary:"",onClick:g=>a(h)},null,8,["icon","tooltip","onClick"]))),128))])]),c.createVNode(c.unref(It)),c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[c.unref(Su).length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(Su),(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[m>0?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",HP,c.toDisplayString(c.unref(i)(h.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:"item",clickable:"",onClick:g=>a(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon,color:h.color},null,8,["name","color"])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",FP,"No result"))]),_:1})])):c.createCommentVNode("",!0)]))}}),gC=c.defineComponent({__name:"AddNode",props:{...ht,add:{type:String,default:"menu"}},setup(n){const e=n,t=c.ref(),o=c.ref(!1),r=c.computed(()=>{var d;return((d=e.node)==null?void 0:d.content.size)===0}),i=c.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function s(d){o.value=d}function l(){var d;e.add==="menu"?(d=t.value)==null||d.setShow(!0):a()}function a(){const d={type:"paragraph",content:[{type:"text",text:"/"}]},f=r.value?i.value+1:i.value,p=f+2;requestAnimationFrame(()=>{e.editor.chain().insertContentAt(f,d).focus(p).scrollIntoView().run()})}function u(){var d;(d=t.value)==null||d.setShow(!1),o.value=!1}return(d,f)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:t,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":s},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[c.createVNode(c.unref(Ge),{type:"tertiary",class:"o-node-btn",onClick:l},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"add",small:""})]),_:1})],2)]),default:c.withCtx(()=>[c.createVNode(jP,c.mergeProps(e,{onAction:u}),null,16)]),_:1},512))}}),WP={class:"o-drag-node-view"},UP={key:0,class:"view-main"},qP={key:0},KP={class:"group o-tips"},JP={class:"panel"},GP=c.defineComponent({__name:"DragNodeView",props:ht,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s,onCommand:l}=xe(),a=c.ref("main"),u=c.ref(["heading","codeBlock","paragraph"]),d=c.computed(()=>{var y,b;const g=(y=t.node)==null?void 0:y.content.content;if(g.length>0){const v=g[0];if(v.type.name==="image")return v.type.name}return(b=t.node)==null?void 0:b.type.name}),f=c.computed(()=>Cu.find(g=>g.value===d.value));function p(g){var y;return g.value===d.value&&((y=t.editor)==null?void 0:y.isActive(d.value,g.options))}function h(g){switch(g.value){case"copy":case"delete":case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var k,w,x,C,S;const y=t.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const T=(k=t.editor)==null?void 0:k.isActive(d.value),N=(w=t.editor)==null?void 0:w.commands.lift(d.value);console.log("lift",d.value,T,N);return}const b=(x=t.editor)==null?void 0:x.commands,v=(C=t.editor)==null?void 0:C.chain().focus(y+1);console.log("runCommand",g),l(b,v,g.value,g.options),(S=t.editor)==null||S.commands.focus()}return(g,y)=>(c.openBlock(),c.createElementBlock("section",WP,[a.value==="main"?(c.openBlock(),c.createElementBlock("section",UP,[f.value?(c.openBlock(),c.createElementBlock("section",qP,[c.createElementVNode("div",KP,c.toDisplayString(c.unref(i)("label.turnInto")),1),c.createElementVNode("section",JP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(Cu),(b,v)=>(c.openBlock(),c.createBlock(c.unref(Oe),{key:v,icon:b.icon,tooltip:c.unref(i)(b.label),"content-class":{"is-active":p(b)},quaternary:"",onClick:k=>h(b)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):c.createCommentVNode("",!0),c.createVNode(c.unref(Fr),c.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):c.createCommentVNode("",!0)]))}}),yC=c.defineComponent({__name:"DragNode",props:ht,emits:["dragstart","dragend"],setup(n,{emit:e}){const t=n,o=e,{run:r}=xe(),i=c.ref(null),s=c.ref(!1),l=c.ref(["heading","codeBlock","paragraph"]),a=c.computed(()=>{var y,b,v;const g=(b=(y=t.node)==null?void 0:y.content)==null?void 0:b.content;if((g==null?void 0:g.length)>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(v=t.node)==null?void 0:v.type.name}),u=c.computed(()=>{var y;let g=a.value;return g==="heading"?{icon:`format_h${((y=t.node.attrs)==null?void 0:y.level)||1}`,color:he.blue}:(g==="table-wrapper"&&(g="table"),Eu.find(b=>b.value===g)||Eu.find(b=>{var v;return(v=b.keywords)==null?void 0:v.split(",").includes(g)})||{icon:"title"})});function d(g){o("dragstart",g)}function f(g){o("dragend",g)}function p(g){var y;(y=i.value)==null||y.setShow(!1)}function h(g){s.value=g,g&&m()}function m(){var y;let g=t.getPos();l.value.includes(a.value),(y=t.editor)==null||y.commands.setNodeSelection(g)}return c.watch(()=>t.getPos(),g=>{var y;(y=i.value)==null||y.setShow(!1)}),(g,y)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:d,onDragend:f},[c.createVNode(c.unref(Ge),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.value.icon,color:u.value.color,small:""},null,8,["name","color"]),c.createVNode(c.unref(X),{name:"drag_indicator",small:""})]),_:1})],34)]),default:c.withCtx(()=>[c.createVNode(GP,c.mergeProps(t,{onAction:p}),null,16)]),_:1},512))}}),XP={key:0,class:"spinner"},YP={key:2,class:"o-btn__label"},Ge=c.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["o-btn",n.type?`type-${n.type}`:""]),onClick:r[0]||(r[0]=i=>t("click",i))},[n.loading?(c.openBlock(),c.createElementBlock("div",XP)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,class:c.normalizeClass(n.iconClass)},null,8,["name","class"])):c.createCommentVNode("",!0)],64)),n.label?(c.openBlock(),c.createElementBlock("span",YP,c.toDisplayString(n.label),1)):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],2))}}),QP={class:"o-btn-group"},bC=c.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(n,{emit:e}){return(t,o)=>(c.openBlock(),c.createElementBlock("div",QP,[c.renderSlot(t.$slots,"default")]))}}),ZP={class:"o-checkbox"},eV={class:"o-checkbox__main"},tV={class:"o-checkbox__suffix"},gg=c.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.computed({get(){return t.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(c.openBlock(),c.createElementBlock("div",ZP,[c.createElementVNode("div",eV,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),type:"checkbox"},null,512),[[c.vModelCheckbox,r.value]])]),c.createElementVNode("div",tV,c.toDisplayString(n.label),1)]))}}),nV={class:"dialog-header"},oV={class:"dialog-body"},rV={class:"dialog-footer"},vC=c.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean},icon:{},title:{},fullscreen:{type:Boolean}},emits:["close","update:show"],setup(n,{emit:e}){const t=e,o=()=>{t("update:show",!1),t("close")};return(r,i)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",{key:0,class:"dialog-overlay o-dialog",onClick:c.withModifiers(o,["self"])},[c.createElementVNode("div",{class:c.normalizeClass(["dialog-box",{fullscreen:n.fullscreen}])},[c.createElementVNode("div",nV,[c.renderSlot(r.$slots,"title",{},()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),c.createVNode(c.unref(Ge),{icon:"close",class:"close",onClick:o})]),c.createElementVNode("div",oV,[c.renderSlot(r.$slots,"default")]),c.createElementVNode("div",rV,[c.renderSlot(r.$slots,"footer")])],2)])):c.createCommentVNode("",!0)]))}}),It=c.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-divider",{"o-divider-vertical":n.vertical}])},null,2))}}),iV={key:0,class:"dialog-overlay o-image-viewer"},sV={class:"dialog-box"},lV={class:"dialog-body"},aV=["src"],cV={class:"action-group"},uV={class:"action-group"},dV={class:"o-btn scale"},wC=c.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(n,{emit:e}){const t=n,o=e,{downloadImage:r}=Cd(),i=c.ref(0),s=c.ref(1),l=c.ref({x:0,y:0}),a=c.ref(!1),u=c.ref({x:0,y:0}),d=c.ref(null),f=c.ref(null),p={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},h=c.computed(()=>{const A=t.images.length;let B={};return A>0&&(B=i.value>=0&&i.value<A?t.images.at(i.value):t.images.at(0)),B}),m=c.computed(()=>({transform:`translate(${l.value.x}px, ${l.value.y}px) scale(${s.value})`,transformOrigin:"center center",cursor:a.value?"grabbing":s.value>1?"grab":"default"})),g=c.computed(()=>parseInt(`${s.value*100}`)),y=A=>{A.preventDefault();const B=-A.deltaY*p.WHEEL_SENSITIVITY;let I=s.value+B;if(I=Math.max(p.MIN_SCALE,Math.min(p.MAX_SCALE,I)),f.value&&d.value){const L=f.value.getBoundingClientRect(),R=A.clientX-L.left-L.width/2,q=A.clientY-L.top-L.height/2,z=I-s.value;l.value.x-=R*z,l.value.y-=q*z}s.value=I},b=A=>{s.value<=1||(A.preventDefault(),a.value=!0,u.value={x:A.clientX-l.value.x,y:A.clientY-l.value.y},document.addEventListener("mousemove",v),document.addEventListener("mouseup",k))},v=A=>{a.value&&(l.value.x=A.clientX-u.value.x,l.value.y=A.clientY-u.value.y)},k=()=>{a.value=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)},w=()=>{s.value=Math.min(p.MAX_SCALE,s.value+p.STEP)},x=()=>{s.value=Math.max(p.MIN_SCALE,s.value-p.STEP)},C=()=>{s.value=1,l.value={x:0,y:0}},S=()=>{i.value>0&&(i.value-=1,C())},T=()=>{i.value<t.images.length-1&&(i.value+=1,C())},N=()=>{C(),o("update:show",!1)},$=()=>{var A;r((A=h.value.attrs)==null?void 0:A.src)},O=A=>{if(t.show)switch(A.preventDefault(),A.stopPropagation(),A.key){case"+":case"=":A.preventDefault(),w();break;case"-":A.preventDefault(),x();break;case"0":A.preventDefault(),C();break;case"ArrowLeft":(A.ctrlKey||A.metaKey)&&(A.preventDefault(),S());break;case"ArrowRight":(A.ctrlKey||A.metaKey)&&(A.preventDefault(),T());break;case"Escape":N();break}};return c.watch(()=>t.current,A=>{i.value=A,C()}),c.onMounted(()=>{i.value=t.current,document.addEventListener("keydown",O)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",O),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",k)}),(A,B)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",iV,[c.createElementVNode("header",null,[c.createVNode(c.unref(Ge),{icon:"close",onClick:N})]),c.createElementVNode("div",sV,[c.createElementVNode("div",lV,[c.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:f,onWheel:c.withModifiers(y,["prevent"]),onDblclick:C},[c.createElementVNode("img",{ref_key:"imageRef",ref:d,src:h.value.attrs.src,alt:"image",style:c.normalizeStyle(m.value),onMousedown:b},null,44,aV)],544)])]),c.createElementVNode("footer",null,[c.createElementVNode("div",cV,[c.createVNode(c.unref(Ge),{icon:"arrow_back",class:c.normalizeClass({disabled:i.value<=0}),onClick:S},null,8,["class"]),c.createVNode(c.unref(Ge),{icon:"arrow_back","icon-class":"rotate-180",class:c.normalizeClass({disabled:i.value>=t.images.length-1}),onClick:T},null,8,["class"])]),c.createElementVNode("div",uV,[c.createVNode(c.unref(Ge),{icon:"horizontal_rule",onClick:x}),c.createElementVNode("div",dV,c.toDisplayString(g.value)+"%",1),c.createVNode(c.unref(Ge),{icon:"add",onClick:w}),c.createVNode(c.unref(Ge),{icon:"download",onClick:$}),c.createVNode(c.unref(Ge),{icon:"close",onClick:N})])])])):c.createCommentVNode("",!0)]))}}),fV={class:"o-input__prefix"},pV={class:"o-input__main"},hV=["placeholder"],mV={class:"o-input__suffix"},to=c.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","enter","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-input",`type-${n.type}`])},[c.createElementVNode("div",fV,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",pV,[c.withDirectives(c.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur")),onKeyup:d[3]||(d[3]=c.withKeys(f=>r("enter"),["enter"]))},null,40,hV),[[c.vModelText,s.value]])]),c.createElementVNode("div",mV,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),ln=c.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("ul",{class:c.normalizeClass(["o-list",{clickable:n.clickable,hoverable:n.hoverable}])},[c.renderSlot(e.$slots,"default")],2))}}),gV={class:"o-list-item"},yV={class:"o-list-item__prefix"},bV={class:"o-list-item__main"},vV={class:"o-list-item__suffix"},Ut=c.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("li",gV,[c.createElementVNode("div",yV,[c.renderSlot(e.$slots,"prefix")]),c.createElementVNode("div",bV,[c.renderSlot(e.$slots,"default")]),c.createElementVNode("div",vV,[c.renderSlot(e.$slots,"suffix")])]))}}),$e=c.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(n,{expose:e,emit:t}){const o=n,r=t,{theme:i}=Di(),s=c.ref(null),l=c.ref(),a=c.ref();function u(h){var m,g,y,b;h?((g=a.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?d:null}),(y=a.value)==null||y.show()):(b=a.value)==null||b.hide()}function d(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,y;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((y=o.event)==null?void 0:y.clientY)||0}}}}function f(){a.value=Ao(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:l.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function p(){a.value.setProps({theme:i.value})}return c.watch(i,h=>{p()}),e({setShow:u}),c.onMounted(()=>{f()}),c.onUnmounted(()=>{a.value&&a.value.destroy()}),(h,m)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[c.renderSlot(h.$slots,"trigger"),n.disable?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"contentRef",ref:l,class:c.normalizeClass(["popover-content",n.contentClass])},[c.renderSlot(h.$slots,"default")],2))],512))}}),wV={class:"o-textarea__prefix"},kV={class:"o-textarea__main"},xV=["placeholder","rows"],CV={class:"o-textarea__suffix"},kC=c.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-textarea",`type-${n.type}`])},[c.createElementVNode("div",wV,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",kV,[c.withDirectives(c.createElementVNode("textarea",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,rows:n.rows,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur"))},null,40,xV),[[c.vModelText,s.value]])]),c.createElementVNode("div",CV,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),xC=[`
34
176
  Certainly! Here's a detailed prompt you can use to instruct a Large Language Model (LLM) to act as a writing expert:
35
177
 
36
178
  ---
@@ -56,14 +198,120 @@ Let’s begin! What type of writing assistance do you need today?"
56
198
  ---
57
199
 
58
200
  This prompt ensures the LLM acts as a professional writing assistant, capable of handling diverse writing tasks with precision and creativity. Let me know if you'd like further customization!
59
- `],Vf={key:0,class:"o-ai-menu tiptap-toolbar"},$f={key:0,class:"o-scroll"},Pf={class:"view-main"},Ff={key:1,class:"view-output"},Uf={class:"action-container"},zf={class:"actions"},Hf={key:0,class:"o-scroll"},qf=["innerHTML"],Gf={class:"ai-io-panel"},Kf={class:"o-flex o-item-center actions"},Pi=e.defineComponent({__name:"OAiMenu",props:{editor:{type:Te.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:n}){const o=t,r=n,{md:a,aiOption:l,createStreamingChatCompletion:i}=cr(),{languageName:s,tr:c}=Q(),d=e.ref(),u=e.ref(!1),p=e.ref(""),m=e.ref(""),f=e.ref("main"),v=e.ref(""),b=e.ref(!1),h=e.ref(!1),_=e.computed(()=>({role:"system",content:sr.writing.replace("[LANGUAGE]",s.value)})),y=e.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),E=e.computed(()=>Da.filter(M=>M.value.indexOf(p.value)>=0));function g(){const{from:M,to:V}=o.editor.state.selection;return o.editor.state.doc.textBetween(M,V,"")}function N(){setTimeout(()=>{u.value=!0},0)}function x(M,V){switch(V&&(u.value=!0),v.value=M.options.prompt.replaceAll("[CONTENT]",g()),M.value){case"translate":v.value=v.value.replace("[LANGUAGE]",V.value);break;case"changeTone":v.value=v.value.replace("[TONE]",V.value);break}return p.value=c(M.label),T(),!0}function I(){var M;O(),(M=d.value)==null||M.focus()}function L(){const M=Zo(o.editor,m.value);let V=0;for(const F of M.content){const H=ss.Node.fromJSON(o.editor.schema,F);V+=H.nodeSize}o.editor.chain().focus().deleteSelection().insertContent(M.content).setTextSelection({from:o.editor.state.selection.from,to:o.editor.state.selection.from+V+1}).run(),O(),u.value=!1,setTimeout(()=>{r("confirm")},0)}function T(){f.value="output",b.value=!0,h.value?Z():P()}async function P(){let M="";y.value.push({role:"user",content:v.value}),y.value[0].role==="system"&&(y.value.shift(),y.value.unshift(_.value));try{const V=await i(y.value,F=>{M+=F,y.value=[...y.value.slice(0,-1),{role:"assistant",content:M}],m.value=a.render(M)})}catch(V){y.value.pop(),console.error(V),Nr.error(c("ai.error"))}b.value=!1}async function Z(){let M="";for(const V of $i)await new Promise(F=>setTimeout(F,500)),M+=V,m.value=a.render(M);b.value=!1}function O(){f.value="main",m.value="",p.value=""}return e.onMounted(()=>{setTimeout(()=>{var M;(M=d.value)==null||M.focus(),u.value=!0},300)}),(M,V)=>t.editor?(e.openBlock(),e.createElementBlock("section",Vf,[e.createVNode(e.unref(Ot),{modelValue:u.value,"onUpdate:modelValue":V[1]||(V[1]=F=>u.value=F),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":e.withCtx(()=>[f.value==="main"?(e.openBlock(),e.createElementBlock("div",$f,[e.createElementVNode("section",Pf,[e.createVNode(e.unref(vo),{items:E.value,onSelect:x,"use-keyboard":u.value},null,8,["items","use-keyboard"])])])):e.createCommentVNode("",!0),f.value==="output"?(e.openBlock(),e.createElementBlock("section",Ff,[e.createElementVNode("div",Uf,[e.createElementVNode("div",null,[e.createVNode(e.unref(U),{name:"auto_awesome",class:"o-tips"})]),e.createElementVNode("div",zf,[e.createVNode(e.unref(ft),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:b.value,onClick:L},null,8,["loading"]),b.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(ft),{key:0,icon:"close",tooltip:"Cancel",onClick:I}))])]),m.value?(e.openBlock(),e.createElementBlock("div",Hf,[e.createElementVNode("div",{class:"tiptap output",innerHTML:m.value},null,8,qf)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("section",Gf,[e.createVNode(e.unref(bt),{ref_key:"inputRef",ref:d,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":V[0]||(V[0]=F=>p.value=F),type:"text",placeholder:e.unref(c)("ai.askAi"),autofocus:"",onFocus:N},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"auto_awesome",class:"o-tips"})]),suffix:e.withCtx(()=>[e.createElementVNode("div",Kf,[e.createVNode(e.unref(ft),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0)}}),Wf={key:0,class:"o-inline-math-menu tiptap-toolbar"},Fi=e.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:Te.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:n}){const o=t,r=n,{run:a}=ie(),l=e.ref(null),i=e.ref(""),s=e.ref(null);e.computed(()=>{const p=pn.InlinePlaceholderKey.getState(o.editor.state);return!!(p!=null&&p.active)});function c(){if(i.value="",s.value=null,o.editor.isActive("inlineMath")){const{state:p}=o.editor,{selection:m,schema:f}=p;if(m instanceof Ct.NodeSelection){const v=m.node;s.value=m.from,v.type.name==="inlineMath"&&(i.value=v.attrs.latex)}}setTimeout(()=>{var p;(p=l.value)==null||p.focus()},300)}function d(){console.log("latex",i.value,s.value),s.value?i.value?a(o.editor,"inlineMathUpdate",{latex:i.value}):a(o.editor,"inlineMathDelete",{pos:s.value}):i.value&&a(o.editor,"inlineMathInsert",{latex:i.value}),setTimeout(()=>{r("confirm")},0)}const u=()=>{o.editor.view.dispatch(o.editor.state.tr.setMeta(pn.InlinePlaceholderKey,{type:"hide"}))};return e.onMounted(()=>{c(),o.editor.on("focus",u)}),e.onUnmounted(()=>{o.editor.off("focus",u)}),(p,m)=>t.editor?(e.openBlock(),e.createElementBlock("section",Wf,[e.createVNode(e.unref(bt),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=f=>i.value=f),type:"text",autofocus:"",clearable:"",onKeydown:e.withKeys(e.withModifiers(d,["prevent"]),["enter"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"function",class:"o-tips"})]),suffix:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.unref(U),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:d})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):e.createCommentVNode("",!0)}}),Yf={class:"o-scroll"},jf={class:"view-main"},Zf={class:"block-container"},Xf={class:"block-content"},Qf={key:0,class:"edit-prompt"},Jf={key:1},em={"data-tippy-role":"tooltip"},tm={class:"label"},nm={class:"block-container"},om={class:"block-content"},rm=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{md:o,aiOption:r,createStreamingChatCompletion:a}=cr(),{languageName:l,tr:i}=Q(),{isFocused:s,bind:c,unbind:d,checkFocus:u}=Ya(),{theme:p}=tn(),{isEditable:m}=ie(),{getPos:f}=n,v=e.ref(null),b=e.ref(""),h=e.ref(!1),_=e.ref({}),y=e.ref(!1),E=e.ref(!1),g=e.ref(""),N=e.ref(null),x=e.ref(!1),I=e.ref(!1),L=e.computed(()=>({role:"system",content:sr.writing.replace("[LANGUAGE]",l.value)})),T=e.ref([L.value]),P=e.computed(()=>!n.node.textContent),Z=e.computed(()=>La),O=e.computed({get(){return n.node.attrs.provider},set(W){n.updateAttributes({provider:W})}}),M=e.computed({get(){return n.node.attrs.prompt},set(W){n.updateAttributes({prompt:W})}}),V=e.computed({get(){return n.node.attrs.time},set(W){n.updateAttributes({time:W})}});function F(){b.value=M.value,P.value&&!M.value&&setTimeout(()=>{var W;(W=v.value)==null||W.focus()},0)}function H(){setTimeout(()=>{},0)}function te(){g.value="edit",setTimeout(()=>{var W;(W=N.value)==null||W.focus()},0)}function B(){O.value=r.value.provider,M.value=b.value,V.value=Date.now(),x.value=!0,g.value&&(g.value=""),I.value?X():D()}async function D(){const W=f();let se="";T.value.push({role:"user",content:M.value}),T.value[0].role==="system"&&(T.value.shift(),T.value.unshift(L.value));try{const ce=await a(T.value,Oe=>{se+=Oe,T.value=[...T.value.slice(0,-1),{role:"assistant",content:se}];const Ae=Zo(n.editor,o.render(se));re(W,Ae)})}catch(ce){T.value.pop(),console.error(ce),Nr.error(i("ai.error"))}x.value=!1}async function X(){const W=f();let se="";try{for(const ce of $i){await new Promise(Ae=>setTimeout(Ae,500)),se+=ce;const Oe=Zo(n.editor,o.render(se));re(W,Oe)}}catch(ce){console.error(ce)}x.value=!1}function re(W,se){var Oe;const ce=n.node.toJSON();ce.content=se.content,(Oe=n.editor)==null||Oe.commands.updateAiBlock(W,ce),n.editor.commands.setNodeSelection(W),n.editor.view.focus(),fe()}function fe(){const se=n.node.content.lastChild;if(se&&se.attrs["data-id"]){const ce=se.attrs["data-id"],Oe=document.querySelector(`[data-id="${ce}"]`);Oe&&Oe.scrollIntoView({behavior:"smooth",block:"center"})}}function xe(W){h.value=!1,W.value}function Se(W,se){se?b.value=i(se.label):b.value=i(W.label),y.value=!1}function _e(W){h.value=!0,_.value=W}return e.watch(()=>n.node.content,W=>{u()}),e.watch(P,W=>{W&&(E.value=!1)}),e.watch(s,W=>{W&&!P.value&&setTimeout(()=>{b.value=M.value,g.value="",E.value=W},100)}),e.onMounted(()=>{F(),c(n)}),e.onBeforeUnmount(()=>{d()}),(W,se)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-ai-block-view",{"is-empty":P.value,"has-focus":e.unref(s)}],onContextmenu:e.withModifiers(_e,["prevent"])}),{default:e.withCtx(()=>[P.value?(e.openBlock(),e.createBlock(e.unref(Ot),{key:0,modelValue:y.value,"onUpdate:modelValue":se[1]||(se[1]=ce=>y.value=ce),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":e.withCtx(()=>[e.createElementVNode("section",Yf,[e.createElementVNode("section",jf,[e.createVNode(e.unref(vo),{items:Z.value,onSelect:Se,"use-keyboard":y.value},null,8,["items","use-keyboard"])])])]),default:e.withCtx(()=>[e.createElementVNode("div",Zf,[e.createElementVNode("div",Xf,[e.createVNode(e.unref(bt),{ref_key:"inputRef",ref:v,modelValue:b.value,"onUpdate:modelValue":se[0]||(se[0]=ce=>b.value=ce),placeholder:e.unref(i)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:H},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(ft),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(i)("label.generate"),loading:x.value,onClick:B},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.withDirectives(e.createVNode(e.unref(Ot),{modelValue:E.value,"onUpdate:modelValue":se[4]||(se[4]=ce=>E.value=ce),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":e.withCtx(()=>[g.value==="edit"?(e.openBlock(),e.createElementBlock("section",Qf,[e.createVNode(e.unref(bt),{ref_key:"updateInputRef",ref:N,modelValue:b.value,"onUpdate:modelValue":se[2]||(se[2]=ce=>b.value=ce),placeholder:e.unref(i)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(U),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(ft),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(i)("label.generate"),loading:x.value,onClick:B},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(e.openBlock(),e.createElementBlock("section",Jf,[e.createVNode(e.unref(Ri),null,{default:e.withCtx(()=>[e.createElementVNode("div",em,[e.createVNode(e.unref(he),{icon:"auto_awesome",onClick:te},{default:e.withCtx(()=>[e.createElementVNode("span",tm,e.toDisplayString(e.unref(i)("label.generatedBy"))+" "+e.toDisplayString(e.unref(lr)(O.value,"name")||"AI"),1)]),_:1})]),e.createVNode(e.unref(ft),{icon:"autorenew",tooltip:e.unref(i)("label.update"),loading:x.value,onClick:B},null,8,["tooltip","loading"])]),_:1})]))]),default:e.withCtx(()=>[e.createElementVNode("div",nm,[e.createElementVNode("div",om,[e.createVNode(e.unref(K.NodeViewContent))]),e.unref(m)?(e.openBlock(),e.createBlock(e.unref(Vn),{key:0,modelValue:h.value,"onUpdate:modelValue":se[3]||(se[3]=ce=>h.value=ce),event:_.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ht),e.mergeProps(n,{onAction:xe}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[e.vShow,!P.value]])]),_:1},16,["class"]))}}),am=Kl.extend({addNodeView(){return K.VueNodeViewRenderer(rm)}}),im={class:"header o-tips"},lm={style:{display:"flex"}},sm=["innerHTML"],cm=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{tr:o}=Q(),{isEditable:r}=ie(),a=e.ref(!1),l=e.ref(null),i=e.computed({get(){return n.node.attrs.latex},set(u){n.updateAttributes({latex:u||""})}}),s=e.computed(()=>Zl.renderToString(i.value,{throwOnError:!1}));function c(u){a.value=u,u&&setTimeout(()=>{var p;(p=l.value)==null||p.focus()},100)}function d(){window.open("https://katex.org/docs/supported.html","target")}return e.onMounted(()=>{c(!i.value)}),(u,p)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-block-math-view",{init:!i.value}],as:"div",onClick:p[3]||(p[3]=m=>c(!0))}),{default:e.withCtx(()=>[e.createVNode(e.unref(Ot),{modelValue:a.value,"onUpdate:modelValue":p[2]||(p[2]=m=>a.value=m),"content-class":"o-block-math-editor",placement:i.value==="init"?"bottom":"top",readonly:!e.unref(r),"show-arrow":""},{"popover-content":e.withCtx(()=>[e.createElementVNode("header",im,[e.createElementVNode("div",lm,[e.createVNode(e.unref(U),{name:"functions"}),e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.blockMath")),1)]),e.createElementVNode("div",null,[e.createVNode(e.unref(Ne),{icon:"help",tooltip:e.unref(o)("label.help"),onClick:d},null,8,["tooltip"])])]),e.createVNode(e.unref(Li),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=m=>i.value=m),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"block-math-container",onClick:p[1]||(p[1]=m=>c(!0))},[e.createElementVNode("div",{class:"katex-container",innerHTML:s.value},null,8,sm)])):(e.openBlock(),e.createBlock(e.unref(bo),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),um=Yo.BlockMath.extend({addCommands(){return{insertBlockMath:(t={})=>({tr:n,dispatch:o,state:r})=>{const a=r.schema.nodes.blockMath.create({latex:t.latex??""});return o&&(n.replaceSelectionWith(a),n.scrollIntoView()),!0}}},addNodeView(){return K.VueNodeViewRenderer(cm)}}),dm=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-blockquote-view"}),{default:e.withCtx(()=>[e.createElementVNode("blockquote",null,[e.createVNode(e.unref(K.NodeViewContent))])]),_:1},16))}}),pm=Xl.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:t}=this.options,n=t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),o=new RegExp(`^[${n}]\\s$`);return[new Te.InputRule({find:o,handler:({state:r,range:a})=>{const{tr:l,schema:i}=r,{$from:s}=l.selection,c=s.before(s.depth),d=s.after(s.depth);l.delete(a.from,a.to);const u=i.nodes.blockquote.create(null,i.nodes.paragraph.create());l.replaceRangeWith(c,d,u);const p=Ct.TextSelection.near(l.doc.resolve(c+2));l.setSelection(p)}})]},addNodeView(){return K.VueNodeViewRenderer(dm)}}),fm={class:"callout-container"},mm={class:"callout-icon"},gm={class:"callout-content"},bm=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{theme:o}=tn(),{isEditable:r}=ie(),a=e.ref(!1),l=e.ref(!1),i=e.ref({}),s=e.ref(null),c=e.computed(()=>{const{selection:g}=n.editor.view.state,N=g.from,x=n.getPos(),I=x+n.node.nodeSize;return N>=x&&N<=I}),d=e.computed({get(){return n.node.attrs.backColor},set(g){n.updateAttributes({backColor:g})}}),u=e.computed({get(){return n.node.attrs.backColorDark},set(g){n.updateAttributes({backColorDark:g})}}),p=e.computed({get(){return n.node.attrs.borderColor},set(g){n.updateAttributes({borderColor:g})}}),m=e.computed({get(){return n.node.attrs.borderColorDark},set(g){n.updateAttributes({borderColorDark:g})}}),f=e.computed(()=>o.value==="dark"?u.value:d.value),v=e.computed(()=>o.value==="dark"?m.value:p.value);function b(g){n.updateAttributes({icon:g})}function h(g){switch(a.value=!1,g.value){case"palette":y(!0);break}}function _(g){a.value=!0,i.value=g}function y(g){l.value=g}function E(g,N){var x;switch(g){case"backColor":d.value=N;break;case"foreColor":p.value=N;break;case"icon":b(N.emoji),(x=s.value)==null||x.setShow(!1);break}}return e.watch(c,g=>{y(g)}),(g,N)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-callout-view",style:`--callout-border-color: ${v.value}; --callout-back-color: ${f.value}`,onContextmenu:e.withModifiers(_,["prevent"])}),{default:e.withCtx(()=>[e.createElementVNode("div",fm,[e.createVNode(e.unref(ge),{ref_key:"iconPopover",ref:s,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!e.unref(r)},{trigger:e.withCtx(()=>[e.createElementVNode("div",mm,e.toDisplayString(g.node.attrs.icon),1)]),default:e.withCtx(()=>[e.createVNode(e.unref(ko),{items:e.unref(Bn.emojiGroups),onSelect:N[0]||(N[0]=x=>E("icon",x)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),e.createElementVNode("div",gm,[e.createVNode(e.unref(K.NodeViewContent))]),e.unref(r)?(e.openBlock(),e.createBlock(e.unref(Vn),{key:0,modelValue:a.value,"onUpdate:modelValue":N[1]||(N[1]=x=>a.value=x),event:i.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ht),e.mergeProps(n,{onAction:h}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),vm=Ql.extend({addNodeView(){return K.VueNodeViewRenderer(bm)}});function hm(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],h=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],_=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],g={type:b,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:h},N={className:"function.dispatch",relevance:0,keywords:{_hint:_},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},x=[N,p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:x.concat([{begin:/\(/,end:/\)/,keywords:g,contains:x.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,L,N,x,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:g,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function _m(t){const n={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},o=hm(t),r=o.keywords;return r.type=[...r.type,...n.type],r.literal=[...r.literal,...n.literal],r.built_in=[...r.built_in,...n.built_in],r._hints=n._hints,o.name="Arduino",o.aliases=["ino"],o.supersetOf="cpp",o}function km(t){const n=t.regex,o={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[o]}]};Object.assign(o,{className:"variable",variants:[{begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},l=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),i={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,o,a]};a.contains.push(s);const c={match:/\\"/},d={className:"string",begin:/'/,end:/'/},u={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,o]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],h=["true","false"],_={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],E=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],g=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:h,built_in:[...y,...E,"set","shopt",...g,...N]},contains:[f,t.SHEBANG(),v,p,l,i,_,s,c,d,u,o]}}function ym(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",h={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},_=[p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:h,contains:_.concat([{begin:/\(/,end:/\)/,keywords:h,contains:_.concat(["self"]),relevance:0}]),relevance:0},E={begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:h,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:h,relevance:0},{begin:f,returnBegin:!0,contains:[t.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:h,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:h,disableAutodetect:!0,illegal:"</",contains:[].concat(y,E,_,[p,{begin:t.IDENT_RE+"::",keywords:h},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:p,strings:d,keywords:h}}}function Em(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],h=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],_=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],g={type:b,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:h},N={className:"function.dispatch",relevance:0,keywords:{_hint:_},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},x=[N,p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],I={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:x.concat([{begin:/\(/,end:/\)/,keywords:g,contains:x.concat(["self"]),relevance:0}]),relevance:0},L={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(I,L,N,x,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:g,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function wm(t){const n=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],o=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],l=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],i={keyword:a.concat(l),built_in:n,literal:r},s=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=t.inherit(u,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:i},f=t.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},h=t.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});m.contains=[b,v,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],f.contains=[h,v,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const _={variants:[d,b,v,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},s]},E=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",g={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:i,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},_,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},s,y,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,y,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+E+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:i,contains:[{beginKeywords:o.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,y],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,relevance:0,contains:[_,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},g]}}const xm=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Nm=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Cm=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Sm=[...Nm,...Cm],Tm=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Om=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Am=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Bm=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Mm(t){const n=t.regex,o=xm(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="and or not only",l=/@-?\w[\w]*(-\w+)*/,i="[a-zA-Z-][a-zA-Z0-9_-]*",s=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[o.BLOCK_COMMENT,r,o.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+i,relevance:0},o.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Om.join("|")+")"},{begin:":(:)?("+Am.join("|")+")"}]},o.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Bm.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[o.BLOCK_COMMENT,o.HEXCOLOR,o.IMPORTANT,o.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},o.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:l},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:Tm.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,o.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Sm.join("|")+")\\b"}]}}function Rm(t){const n=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Im(t){const l={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:l,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:l,illegal:/["']/}]}]}}function Dm(t){const n=t.regex,o=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:n.concat(o,n.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Lm(t){const n=t.regex,o={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},l={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},s={begin:/\[/,end:/\]/,contains:[r,l,a,i,o,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,d=/"(\\"|[^"])*"/,u=/'[^']*'/,p=n.either(c,d,u),m=n.concat(p,"(\\s*\\.\\s*",p,")*",n.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,s,l,a,i,o]}}]}}var sn="[0-9](_*[0-9])*",Zn=`\\.(${sn})`,Xn="[0-9a-fA-F](_*[0-9a-fA-F])*",ha={className:"number",variants:[{begin:`(\\b(${sn})((${Zn})|\\.)?|(${Zn}))[eE][+-]?(${sn})[fFdD]?\\b`},{begin:`\\b(${sn})((${Zn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Zn})[fFdD]?\\b`},{begin:`\\b(${sn})[fFdD]\\b`},{begin:`\\b0[xX]((${Xn})\\.?|(${Xn})?\\.(${Xn}))[pP][+-]?(${sn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Xn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Ui(t,n,o){return o===-1?"":t.replace(n,r=>Ui(t,n,o-1))}function Vm(t){const n=t.regex,o="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=o+Ui("(?:<"+o+"~~~(?:\\s*,\\s*"+o+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+o,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[n.concat(/(?!else)/,o),/\s+/,o,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,o],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,ha,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},ha,d]}}const _a="[A-Za-z$_][0-9A-Za-z$_]*",$m=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Pm=["true","false","null","undefined","NaN","Infinity"],zi=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Hi=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],qi=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Fm=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Um=[].concat(qi,zi,Hi);function zm(t){const n=t.regex,o=(B,{after:D})=>{const X="</"+B[0].slice(1);return B.input.indexOf(X,D)!==-1},r=_a,a={begin:"<>",end:"</>"},l=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,D)=>{const X=B[0].length+B.index,re=B.input[X];if(re==="<"||re===","){D.ignoreMatch();return}re===">"&&(o(B,{after:X})||D.ignoreMatch());let fe;const xe=B.input.substring(X);if(fe=xe.match(/^\s*=/)){D.ignoreMatch();return}if((fe=xe.match(/^\s+extends\s+/))&&fe.index===0){D.ignoreMatch();return}}},s={$pattern:_a,keyword:$m,literal:Pm,built_in:Um,"variable.language":Fm},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},h={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,h,{match:/\$\d+/},p];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(E)});const g=[].concat(y,m.contains),N=g.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(g)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:N},I={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...zi,...Hi]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(B){return n.concat("(?!",B.join("|"),")")}const M={match:n.concat(/\b/,O([...qi,"super","import"].map(B=>`${B}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},H="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(H)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,h,y,{match:/\$\d+/},p,L,{scope:"attr",match:r+n.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:H,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:l},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},P,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},M,Z,I,F,{match:/\$[(.]/}]}}function Hm(t){const n={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},o={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[n,o,t.QUOTE_STRING_MODE,a,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var cn="[0-9](_*[0-9])*",Qn=`\\.(${cn})`,Jn="[0-9a-fA-F](_*[0-9a-fA-F])*",qm={className:"number",variants:[{begin:`(\\b(${cn})((${Qn})|\\.)?|(${Qn}))[eE][+-]?(${cn})[fFdD]?\\b`},{begin:`\\b(${cn})((${Qn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Qn})[fFdD]?\\b`},{begin:`\\b(${cn})[fFdD]\\b`},{begin:`\\b0[xX]((${Jn})\\.?|(${Jn})?\\.(${Jn}))[pP][+-]?(${cn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Jn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Gm(t){const n={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},o={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},l={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},i={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[l,a]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,l,a]}]};a.contains.push(i);const s={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(i,{className:"string"}),"self"]}]},d=qm,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=p;return m.variants[1].contains=[p],p.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:n,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,o,r,s,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[p,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,s,c,i,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},i,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
60
- `},d]}}const Km=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Wm=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Ym=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],jm=[...Wm,...Ym],Zm=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Gi=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Ki=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Xm=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Qm=Gi.concat(Ki).sort().reverse();function Jm(t){const n=Km(t),o=Qm,r="and or not only",a="[\\w-]+",l="("+a+"|@\\{"+a+"\\})",i=[],s=[],c=function(E){return{className:"string",begin:"~?"+E+".*?"+E}},d=function(E,g,N){return{className:E,begin:g,relevance:N}},u={$pattern:/[a-z-]+/,keyword:r,attribute:Zm.join(" ")},p={begin:"\\(",end:"\\)",contains:s,keywords:u,relevance:0};s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),n.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},n.HEXCOLOR,p,d("variable","@@?"+a,10),d("variable","@\\{"+a+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const m=s.concat({begin:/\{/,end:/\}/,contains:i}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(s)},v={begin:l+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Xm.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:s,relevance:0}},h={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:m}},_={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:l,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,f,d("keyword","all\\b"),d("variable","@\\{"+a+"\\}"),{begin:"\\b("+jm.join("|")+")\\b",className:"selector-tag"},n.CSS_NUMBER_MODE,d("selector-tag",l,0),d("selector-id","#"+l),d("selector-class","\\."+l,0),d("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+Gi.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Ki.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},n.FUNCTION_DISPATCH]},y={begin:a+`:(:)?(${o.join("|")})`,returnBegin:!0,contains:[_]};return i.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,b,h,y,v,_,f,n.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function eg(t){const n="\\[=*\\[",o="\\]=*\\]",r={begin:n,end:o,contains:["self"]},a=[t.COMMENT("--(?!"+n+")","$"),t.COMMENT("--"+n,o,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:n,end:o,contains:[r],relevance:5}])}}function tg(t){const n={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},o={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[n,o]},a={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},l={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},i={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[n]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,n,o,r,a,l,i]}}function ng(t){const n=t.regex,o={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},l={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},s=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:n.concat(/\[.+?\]\(/,s,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=t.inherit(d,{contains:[]}),m=t.inherit(u,{contains:[]});d.contains.push(m),u.contains.push(p);let f=[o,c];return[d,u,p,m].forEach(_=>{_.contains=_.contains.concat(f)}),f=f.concat(d,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},o,l,d,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},a,r,c,i,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function og(t){const n={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},o=/[a-zA-Z@][a-zA-Z0-9_]*/,s={"variable.language":["this","super"],$pattern:o,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:o,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:s,illegal:"</",contains:[n,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function rg(t){const n=t.regex,o=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:o.join(" ")},l={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},i={begin:/->\{/,end:/\}/},s={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:n.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},d={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,l,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(b,h,_="\\1")=>{const y=_==="\\1"?_:n.concat(_,h);return n.concat(n.concat("(?:",b,")"),h,/(?:\\.|[^\\\/])*?/,y,/(?:\\.|[^\\\/])*?/,_,r)},f=(b,h,_)=>n.concat(n.concat("(?:",b,")"),h,/(?:\\.|[^\\\/])*?/,_,r),v=[c,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),i,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",n.either(...p,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",n.either(...p,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,s]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,s,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return l.contains=v,i.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:a,contains:v}}function ag(t){const n=t.regex,o=/(?![A-Za-z0-9])(?![$])/,r=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,o),a=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,o),l=n.concat(/[A-Z]+/,o),i={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(V,F)=>{F.data._beginMatch=V[1]||V[2]},"on:end":(V,F)=>{F.data._beginMatch!==V[1]&&F.ignoreMatch()}},m=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[
61
- ]`,v={scope:"string",variants:[u,d,p,m]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},h=["false","null","true"],_=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],g={keyword:_,literal:(V=>{const F=[];return V.forEach(H=>{F.push(H),H.toLowerCase()===H?F.push(H.toUpperCase()):F.push(H.toLowerCase())}),F})(h),built_in:y},N=V=>V.map(F=>F.replace(/\|\d+$/,"")),x={variants:[{match:[/new/,n.concat(f,"+"),n.concat("(?!",N(y).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},I=n.concat(r,"\\b(?!\\()"),L={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),I],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,n.concat(/::/,n.lookahead(/(?!class\b)/)),I],scope:{1:"title.class",3:"variable.constant"}},{match:[a,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:n.concat(r,n.lookahead(":"),n.lookahead(/(?!::)/))},P={relevance:0,begin:/\(/,end:/\)/,keywords:g,contains:[T,i,L,t.C_BLOCK_COMMENT_MODE,v,b,x]},Z={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",N(_).join("\\b|"),"|",N(y).join("\\b|"),"\\b)"),r,n.concat(f,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[P]};P.contains.push(Z);const O=[T,L,t.C_BLOCK_COMMENT_MODE,v,b,x],M={begin:n.concat(/#\[\s*\\?/,n.either(a,l)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:h,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:h,keyword:["new","array"]},contains:["self",...O]},...O,{scope:"meta",variants:[{match:a},{match:l}]}]};return{case_insensitive:!1,keywords:g,contains:[M,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},i,Z,L,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},x,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:g,contains:["self",M,i,L,t.C_BLOCK_COMMENT_MODE,v,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},v,b]}}function ig(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function lg(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function sg(t){const n=t.regex,o=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},u={begin:/\{\{/,relevance:0},p={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",f=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${f}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${v})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${v})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${v})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${v})`},{begin:`\\b(${m})[jJ](?=${v})`}]},h={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},_={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",c,b,p,t.HASH_COMMENT_MODE]}]};return d.contains=[p,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,h,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[_]},{variants:[{match:[/\bclass/,/\s+/,o,/\s*/,/\(\s*/,o,/\s*\)/]},{match:[/\bclass/,/\s+/,o]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,_,p]}]}}function cg(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function ug(t){const n=t.regex,o=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,l=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:o,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:o},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[l,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[o,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:l},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function dg(t){const n=t.regex,o="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=n.concat(r,/(::\w+)*/),i={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},d=[t.COMMENT("#","$",{contains:[s]}),t.COMMENT("^=begin","^=end",{contains:[s],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:i},p={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},m="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:i}]},x=[p,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:i},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:i},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:o}],relevance:0},v,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:i},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,d),relevance:0}].concat(c,d);u.contains=x,b.contains=x;const P=[{begin:/^\s*=>/,starts:{end:"$",contains:x}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:i,contains:x}}];return d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:i,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(P).concat(d).concat(x)}}function pg(t){const n=t.regex,o=/(r#)?/,r=n.concat(o,t.UNDERSCORE_IDENT_RE),a=n.concat(o,t.IDENT_RE),l={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,n.lookahead(/\s*\(/))},i="([ui](8|16|32|64|128|size)|f(32|64))?",s=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:s,literal:c,built_in:d},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+i}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},l]}}const fg=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),mg=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],gg=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],bg=[...mg,...gg],vg=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),hg=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),_g=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),kg=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function yg(t){const n=fg(t),o=_g,r=hg,a="@[a-z-]+",l="and or not only",s={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,n.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+bg.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+o.join("|")+")"},s,{begin:/\(/,end:/\)/,contains:[n.CSS_NUMBER_MODE]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+kg.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[n.BLOCK_COMMENT,s,n.HEXCOLOR,n.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,n.IMPORTANT,n.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:vg.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},s,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,n.HEXCOLOR,n.CSS_NUMBER_MODE]},n.FUNCTION_DISPATCH]}}function Eg(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function wg(t){const n=t.regex,o=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={begin:/"/,end:/"/,contains:[{match:/""/}]},l=["true","false","unknown"],i=["double precision","large object","with timezone","without timezone"],s=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,v=[...d,...c].filter(N=>!u.includes(N)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},h={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:n.concat(/\b/,n.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function y(N){return n.concat(/\b/,n.either(...N.map(x=>x.replace(/\s+/,"\\s+"))),/\b/)}const E={scope:"keyword",match:y(m),relevance:0};function g(N,{exceptions:x,when:I}={}){const L=I;return x=x||[],N.map(T=>T.match(/\|\d+$/)||x.includes(T)?T:L(T)?`${T}|0`:T)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:g(v,{when:N=>N.length<3}),literal:l,type:s,built_in:p},contains:[{scope:"type",match:y(i)},E,_,b,r,a,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,o,h]}}function Wi(t){return t?typeof t=="string"?t:t.source:null}function Sn(t){return ve("(?=",t,")")}function ve(...t){return t.map(o=>Wi(o)).join("")}function xg(t){const n=t[t.length-1];return typeof n=="object"&&n.constructor===Object?(t.splice(t.length-1,1),n):{}}function qe(...t){return"("+(xg(t).capture?"":"?:")+t.map(r=>Wi(r)).join("|")+")"}const Sr=t=>ve(/\b/,t,/\w$/.test(t)?/\b/:/\B/),Ng=["Protocol","Type"].map(Sr),ka=["init","self"].map(Sr),Cg=["Any","Self"],Ho=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],ya=["false","nil","true"],Sg=["assignment","associativity","higherThan","left","lowerThan","none","right"],Tg=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Ea=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Yi=qe(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),ji=qe(Yi,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),qo=ve(Yi,ji,"*"),Zi=qe(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),fo=qe(Zi,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),xt=ve(Zi,fo,"*"),eo=ve(/[A-Z]/,fo,"*"),Og=["attached","autoclosure",ve(/convention\(/,qe("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ve(/objc\(/,xt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Ag=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Bg(t){const n={match:/\s+/,relevance:0},o=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,o],a={match:[/\./,qe(...Ng,...ka)],className:{2:"keyword"}},l={match:ve(/\./,qe(...Ho)),relevance:0},i=Ho.filter(ue=>typeof ue=="string").concat(["_|0"]),s=Ho.filter(ue=>typeof ue!="string").concat(Cg).map(Sr),c={variants:[{className:"keyword",match:qe(...s,...ka)}]},d={$pattern:qe(/\b\w+/,/#\w+/),keyword:i.concat(Tg),literal:ya},u=[a,l,c],p={match:ve(/\./,qe(...Ea)),relevance:0},m={className:"built_in",match:ve(/\b/,qe(...Ea),/(?=\()/)},f=[p,m],v={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:qo},{match:`\\.(\\.|${ji})+`}]},h=[v,b],_="([0-9]_*)+",y="([0-9a-fA-F]_*)+",E={className:"number",relevance:0,variants:[{match:`\\b(${_})(\\.(${_}))?([eE][+-]?(${_}))?\\b`},{match:`\\b0x(${y})(\\.(${y}))?([pP][+-]?(${_}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(ue="")=>({className:"subst",variants:[{match:ve(/\\/,ue,/[0\\tnr"']/)},{match:ve(/\\/,ue,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(ue="")=>({className:"subst",match:ve(/\\/,ue,/[\t ]*(?:[\r\n]|\r\n)/)}),x=(ue="")=>({className:"subst",label:"interpol",begin:ve(/\\/,ue,/\(/),end:/\)/}),I=(ue="")=>({begin:ve(ue,/"""/),end:ve(/"""/,ue),contains:[g(ue),N(ue),x(ue)]}),L=(ue="")=>({begin:ve(ue,/"/),end:ve(/"/,ue),contains:[g(ue),x(ue)]}),T={className:"string",variants:[I(),I("#"),I("##"),I("###"),L(),L("#"),L("##"),L("###")]},P=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],Z={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:P},O=ue=>{const Ke=ve(ue,/\//),We=ve(/\//,ue);return{begin:Ke,end:We,contains:[...P,{scope:"comment",begin:`#(?!.*${We})`,end:/$/}]}},M={scope:"regexp",variants:[O("###"),O("##"),O("#"),Z]},V={match:ve(/`/,xt,/`/)},F={className:"variable",match:/\$\d+/},H={className:"variable",match:`\\$${fo}+`},te=[V,F,H],B={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Ag,contains:[...h,E,T]}]}},D={scope:"keyword",match:ve(/@/,qe(...Og),Sn(qe(/\(/,/\s+/)))},X={scope:"meta",match:ve(/@/,xt)},re=[B,D,X],fe={match:Sn(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ve(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,fo,"+")},{className:"type",match:eo,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ve(/\s+&\s+/,Sn(eo)),relevance:0}]},xe={begin:/</,end:/>/,keywords:d,contains:[...r,...u,...re,v,fe]};fe.contains.push(xe);const Se={match:ve(xt,/\s*:/),keywords:"_|0",relevance:0},_e={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",Se,...r,M,...u,...f,...h,E,T,...te,...re,fe]},W={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,fe]},se={begin:qe(Sn(ve(xt,/\s*:/)),Sn(ve(xt,/\s+/,xt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:xt}]},ce={begin:/\(/,end:/\)/,keywords:d,contains:[se,...r,...u,...h,E,T,...re,fe,_e],endsParent:!0,illegal:/["']/},Oe={match:[/(func|macro)/,/\s+/,qe(V.match,xt,qo)],className:{1:"keyword",3:"title.function"},contains:[W,ce,n],illegal:[/\[/,/%/]},Ae={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[W,ce,n],illegal:/\[|%/},rt={match:[/operator/,/\s+/,qo],className:{1:"keyword",3:"title"}},vt={begin:[/precedencegroup/,/\s+/,eo],className:{1:"keyword",3:"title"},contains:[fe],keywords:[...Sg,...ya],end:/}/},ct={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ut={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ht={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,xt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[W,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:eo},...u],relevance:0}]};for(const ue of T.variants){const Ke=ue.contains.find(_t=>_t.label==="interpol");Ke.keywords=d;const We=[...u,...f,...h,E,T,...te];Ke.contains=[...We,{begin:/\(/,end:/\)/,contains:["self",...We]}]}return{name:"Swift",keywords:d,contains:[...r,Oe,Ae,ct,ut,ht,rt,vt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},M,...u,...f,...h,E,T,...te,...re,fe,_e]}}const mo="[A-Za-z$_][0-9A-Za-z$_]*",Xi=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Qi=["true","false","null","undefined","NaN","Infinity"],Ji=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],el=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],tl=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],nl=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ol=[].concat(tl,Ji,el);function Mg(t){const n=t.regex,o=(B,{after:D})=>{const X="</"+B[0].slice(1);return B.input.indexOf(X,D)!==-1},r=mo,a={begin:"<>",end:"</>"},l=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,D)=>{const X=B[0].length+B.index,re=B.input[X];if(re==="<"||re===","){D.ignoreMatch();return}re===">"&&(o(B,{after:X})||D.ignoreMatch());let fe;const xe=B.input.substring(X);if(fe=xe.match(/^\s*=/)){D.ignoreMatch();return}if((fe=xe.match(/^\s+extends\s+/))&&fe.index===0){D.ignoreMatch();return}}},s={$pattern:mo,keyword:Xi,literal:Qi,built_in:ol,"variable.language":nl},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},h={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},y={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},E=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,h,{match:/\$\d+/},p];m.contains=E.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(E)});const g=[].concat(y,m.contains),N=g.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(g)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:N},I={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Ji,...el]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},Z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(B){return n.concat("(?!",B.join("|"),")")}const M={match:n.concat(/\b/,O([...tl,"super","import"].map(B=>`${B}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},H="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(H)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,h,y,{match:/\$\d+/},p,L,{scope:"attr",match:r+n.lookahead(":"),relevance:0},te,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,t.REGEXP_MODE,{className:"function",begin:H,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:l},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},P,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},M,Z,I,F,{match:/\$[(.]/}]}}function Rg(t){const n=t.regex,o=Mg(t),r=mo,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],l={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[o.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:mo,keyword:Xi.concat(c),literal:Qi,built_in:ol.concat(a),"variable.language":nl},u={className:"meta",begin:"@"+r},p=(b,h,_)=>{const y=b.contains.findIndex(E=>E.label===h);if(y===-1)throw new Error("can not find mode to replace");b.contains.splice(y,1,_)};Object.assign(o.keywords,d),o.exports.PARAMS_CONTAINS.push(u);const m=o.contains.find(b=>b.scope==="attr"),f=Object.assign({},m,{match:n.concat(r,n.lookahead(/\s*\?:/))});o.exports.PARAMS_CONTAINS.push([o.exports.CLASS_REFERENCE,m,f]),o.contains=o.contains.concat([u,l,i,f]),p(o,"shebang",t.SHEBANG()),p(o,"use_strict",s);const v=o.contains.find(b=>b.label==="func.def");return v.relevance=0,Object.assign(o,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),o}function Ig(t){const n=t.regex,o={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\d{1,2}\/\d{1,2}\/\d{4}/,l=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:n.concat(/# */,n.either(l,a),/ *#/)},{begin:n.concat(/# */,s,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{begin:n.concat(/# */,n.either(l,a),/ +/,n.either(i,s),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},p=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[o,r,c,d,u,p,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function Dg(t){t.regex;const n=t.COMMENT(/\(;/,/;\)/);n.contains.push("self");const o=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],a={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},l={className:"variable",begin:/\$[\w_]+/},i={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},s={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[o,n,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},l,i,a,t.QUOTE_STRING_MODE,c,d,s]}}function Lg(t){const n=t.regex,o=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},l={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=t.inherit(l,{begin:/\(/,end:/\)/}),s=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[l,c,s,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[l,i,c,s]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(/</,n.lookahead(n.concat(o,n.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:o,relevance:0,starts:d}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(o,/>/))),contains:[{className:"name",begin:o,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Vg(t){const n="true false yes no null",o="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},l={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},i={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,a]},s=t.inherit(i,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},v={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},h=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+o},{className:"type",begin:"!<"+o+">"},{className:"type",begin:"!"+o},{className:"type",begin:"!!"+o},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},m,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},v,b,l,i],_=[...h];return _.pop(),_.push(s),f.contains=_,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:h}}const $g={arduino:_m,bash:km,c:ym,cpp:Em,csharp:wm,css:Mm,diff:Rm,go:Im,graphql:Dm,ini:Lm,java:Vm,javascript:zm,json:Hm,kotlin:Gm,less:Jm,lua:eg,makefile:tg,markdown:ng,objectivec:og,perl:rg,php:ag,"php-template":ig,plaintext:lg,python:sg,"python-repl":cg,r:ug,ruby:dg,rust:pg,scss:yg,shell:Eg,sql:wg,swift:Bg,typescript:Rg,vbnet:Ig,wasm:Dg,xml:Lg,yaml:Vg};function Pg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Go,wa;function Fg(){if(wa)return Go;wa=1;function t(k){return k instanceof Map?k.clear=k.delete=k.set=function(){throw new Error("map is read-only")}:k instanceof Set&&(k.add=k.clear=k.delete=function(){throw new Error("set is read-only")}),Object.freeze(k),Object.getOwnPropertyNames(k).forEach(C=>{const R=k[C],ne=typeof R;(ne==="object"||ne==="function")&&!Object.isFrozen(R)&&t(R)}),k}class n{constructor(C){C.data===void 0&&(C.data={}),this.data=C.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function o(k){return k.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(k,...C){const R=Object.create(null);for(const ne in k)R[ne]=k[ne];return C.forEach(function(ne){for(const we in ne)R[we]=ne[we]}),R}const a="</span>",l=k=>!!k.scope,i=(k,{prefix:C})=>{if(k.startsWith("language:"))return k.replace("language:","language-");if(k.includes(".")){const R=k.split(".");return[`${C}${R.shift()}`,...R.map((ne,we)=>`${ne}${"_".repeat(we+1)}`)].join(" ")}return`${C}${k}`};class s{constructor(C,R){this.buffer="",this.classPrefix=R.classPrefix,C.walk(this)}addText(C){this.buffer+=o(C)}openNode(C){if(!l(C))return;const R=i(C.scope,{prefix:this.classPrefix});this.span(R)}closeNode(C){l(C)&&(this.buffer+=a)}value(){return this.buffer}span(C){this.buffer+=`<span class="${C}">`}}const c=(k={})=>{const C={children:[]};return Object.assign(C,k),C};class d{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(C){this.top.children.push(C)}openNode(C){const R=c({scope:C});this.add(R),this.stack.push(R)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(C){return this.constructor._walk(C,this.rootNode)}static _walk(C,R){return typeof R=="string"?C.addText(R):R.children&&(C.openNode(R),R.children.forEach(ne=>this._walk(C,ne)),C.closeNode(R)),C}static _collapse(C){typeof C!="string"&&C.children&&(C.children.every(R=>typeof R=="string")?C.children=[C.children.join("")]:C.children.forEach(R=>{d._collapse(R)}))}}class u extends d{constructor(C){super(),this.options=C}addText(C){C!==""&&this.add(C)}startScope(C){this.openNode(C)}endScope(){this.closeNode()}__addSublanguage(C,R){const ne=C.root;R&&(ne.scope=`language:${R}`),this.add(ne)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(k){return k?typeof k=="string"?k:k.source:null}function m(k){return b("(?=",k,")")}function f(k){return b("(?:",k,")*")}function v(k){return b("(?:",k,")?")}function b(...k){return k.map(R=>p(R)).join("")}function h(k){const C=k[k.length-1];return typeof C=="object"&&C.constructor===Object?(k.splice(k.length-1,1),C):{}}function _(...k){return"("+(h(k).capture?"":"?:")+k.map(ne=>p(ne)).join("|")+")"}function y(k){return new RegExp(k.toString()+"|").exec("").length-1}function E(k,C){const R=k&&k.exec(C);return R&&R.index===0}const g=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(k,{joinWith:C}){let R=0;return k.map(ne=>{R+=1;const we=R;let ke=p(ne),G="";for(;ke.length>0;){const z=g.exec(ke);if(!z){G+=ke;break}G+=ke.substring(0,z.index),ke=ke.substring(z.index+z[0].length),z[0][0]==="\\"&&z[1]?G+="\\"+String(Number(z[1])+we):(G+=z[0],z[0]==="("&&R++)}return G}).map(ne=>`(${ne})`).join(C)}const x=/\b\B/,I="[a-zA-Z]\\w*",L="[a-zA-Z_]\\w*",T="\\b\\d+(\\.\\d+)?",P="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Z="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",M=(k={})=>{const C=/^#![ ]*\//;return k.binary&&(k.begin=b(C,/.*\b/,k.binary,/\b.*/)),r({scope:"meta",begin:C,end:/$/,relevance:0,"on:begin":(R,ne)=>{R.index!==0&&ne.ignoreMatch()}},k)},V={begin:"\\\\[\\s\\S]",relevance:0},F={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[V]},H={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[V]},te={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},B=function(k,C,R={}){const ne=r({scope:"comment",begin:k,end:C,contains:[]},R);ne.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const we=_("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ne.contains.push({begin:b(/[ ]+/,"(",we,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ne},D=B("//","$"),X=B("/\\*","\\*/"),re=B("#","$"),fe={scope:"number",begin:T,relevance:0},xe={scope:"number",begin:P,relevance:0},Se={scope:"number",begin:Z,relevance:0},_e={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[V,{begin:/\[/,end:/\]/,relevance:0,contains:[V]}]},W={scope:"title",begin:I,relevance:0},se={scope:"title",begin:L,relevance:0},ce={begin:"\\.\\s*"+L,relevance:0};var Ae=Object.freeze({__proto__:null,APOS_STRING_MODE:F,BACKSLASH_ESCAPE:V,BINARY_NUMBER_MODE:Se,BINARY_NUMBER_RE:Z,COMMENT:B,C_BLOCK_COMMENT_MODE:X,C_LINE_COMMENT_MODE:D,C_NUMBER_MODE:xe,C_NUMBER_RE:P,END_SAME_AS_BEGIN:function(k){return Object.assign(k,{"on:begin":(C,R)=>{R.data._beginMatch=C[1]},"on:end":(C,R)=>{R.data._beginMatch!==C[1]&&R.ignoreMatch()}})},HASH_COMMENT_MODE:re,IDENT_RE:I,MATCH_NOTHING_RE:x,METHOD_GUARD:ce,NUMBER_MODE:fe,NUMBER_RE:T,PHRASAL_WORDS_MODE:te,QUOTE_STRING_MODE:H,REGEXP_MODE:_e,RE_STARTERS_RE:O,SHEBANG:M,TITLE_MODE:W,UNDERSCORE_IDENT_RE:L,UNDERSCORE_TITLE_MODE:se});function rt(k,C){k.input[k.index-1]==="."&&C.ignoreMatch()}function vt(k,C){k.className!==void 0&&(k.scope=k.className,delete k.className)}function ct(k,C){C&&k.beginKeywords&&(k.begin="\\b("+k.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",k.__beforeBegin=rt,k.keywords=k.keywords||k.beginKeywords,delete k.beginKeywords,k.relevance===void 0&&(k.relevance=0))}function ut(k,C){Array.isArray(k.illegal)&&(k.illegal=_(...k.illegal))}function ht(k,C){if(k.match){if(k.begin||k.end)throw new Error("begin & end are not supported with match");k.begin=k.match,delete k.match}}function ue(k,C){k.relevance===void 0&&(k.relevance=1)}const Ke=(k,C)=>{if(!k.beforeMatch)return;if(k.starts)throw new Error("beforeMatch cannot be used with starts");const R=Object.assign({},k);Object.keys(k).forEach(ne=>{delete k[ne]}),k.keywords=R.keywords,k.begin=b(R.beforeMatch,m(R.begin)),k.starts={relevance:0,contains:[Object.assign(R,{endsParent:!0})]},k.relevance=0,delete R.beforeMatch},We=["of","and","for","in","not","or","if","then","parent","list","value"],_t="keyword";function Pe(k,C,R=_t){const ne=Object.create(null);return typeof k=="string"?we(R,k.split(" ")):Array.isArray(k)?we(R,k):Object.keys(k).forEach(function(ke){Object.assign(ne,Pe(k[ke],C,ke))}),ne;function we(ke,G){C&&(G=G.map(z=>z.toLowerCase())),G.forEach(function(z){const oe=z.split("|");ne[oe[0]]=[ke,Xe(oe[0],oe[1])]})}}function Xe(k,C){return C?Number(C):kt(k)?0:1}function kt(k){return We.includes(k.toLowerCase())}const Qe={},He=k=>{console.error(k)},It=(k,...C)=>{console.log(`WARN: ${k}`,...C)},Fe=(k,C)=>{Qe[`${k}/${C}`]||(console.log(`Deprecated as of ${k}. ${C}`),Qe[`${k}/${C}`]=!0)},dt=new Error;function yt(k,C,{key:R}){let ne=0;const we=k[R],ke={},G={};for(let z=1;z<=C.length;z++)G[z+ne]=we[z],ke[z+ne]=!0,ne+=y(C[z-1]);k[R]=G,k[R]._emit=ke,k[R]._multi=!0}function En(k){if(Array.isArray(k.begin)){if(k.skip||k.excludeBegin||k.returnBegin)throw He("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),dt;if(typeof k.beginScope!="object"||k.beginScope===null)throw He("beginScope must be object"),dt;yt(k,k.begin,{key:"beginScope"}),k.begin=N(k.begin,{joinWith:""})}}function wn(k){if(Array.isArray(k.end)){if(k.skip||k.excludeEnd||k.returnEnd)throw He("skip, excludeEnd, returnEnd not compatible with endScope: {}"),dt;if(typeof k.endScope!="object"||k.endScope===null)throw He("endScope must be object"),dt;yt(k,k.end,{key:"endScope"}),k.end=N(k.end,{joinWith:""})}}function nn(k){k.scope&&typeof k.scope=="object"&&k.scope!==null&&(k.beginScope=k.scope,delete k.scope)}function on(k){nn(k),typeof k.beginScope=="string"&&(k.beginScope={_wrap:k.beginScope}),typeof k.endScope=="string"&&(k.endScope={_wrap:k.endScope}),En(k),wn(k)}function rn(k){function C(G,z){return new RegExp(p(G),"m"+(k.case_insensitive?"i":"")+(k.unicodeRegex?"u":"")+(z?"g":""))}class R{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(z,oe){oe.position=this.position++,this.matchIndexes[this.matchAt]=oe,this.regexes.push([oe,z]),this.matchAt+=y(z)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const z=this.regexes.map(oe=>oe[1]);this.matcherRe=C(N(z,{joinWith:"|"}),!0),this.lastIndex=0}exec(z){this.matcherRe.lastIndex=this.lastIndex;const oe=this.matcherRe.exec(z);if(!oe)return null;const Ie=oe.findIndex((Nn,Ao)=>Ao>0&&Nn!==void 0),Me=this.matchIndexes[Ie];return oe.splice(0,Ie),Object.assign(oe,Me)}}class ne{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(z){if(this.multiRegexes[z])return this.multiRegexes[z];const oe=new R;return this.rules.slice(z).forEach(([Ie,Me])=>oe.addRule(Ie,Me)),oe.compile(),this.multiRegexes[z]=oe,oe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(z,oe){this.rules.push([z,oe]),oe.type==="begin"&&this.count++}exec(z){const oe=this.getMatcher(this.regexIndex);oe.lastIndex=this.lastIndex;let Ie=oe.exec(z);if(this.resumingScanAtSamePosition()&&!(Ie&&Ie.index===this.lastIndex)){const Me=this.getMatcher(0);Me.lastIndex=this.lastIndex+1,Ie=Me.exec(z)}return Ie&&(this.regexIndex+=Ie.position+1,this.regexIndex===this.count&&this.considerAll()),Ie}}function we(G){const z=new ne;return G.contains.forEach(oe=>z.addRule(oe.begin,{rule:oe,type:"begin"})),G.terminatorEnd&&z.addRule(G.terminatorEnd,{type:"end"}),G.illegal&&z.addRule(G.illegal,{type:"illegal"}),z}function ke(G,z){const oe=G;if(G.isCompiled)return oe;[vt,ht,on,Ke].forEach(Me=>Me(G,z)),k.compilerExtensions.forEach(Me=>Me(G,z)),G.__beforeBegin=null,[ct,ut,ue].forEach(Me=>Me(G,z)),G.isCompiled=!0;let Ie=null;return typeof G.keywords=="object"&&G.keywords.$pattern&&(G.keywords=Object.assign({},G.keywords),Ie=G.keywords.$pattern,delete G.keywords.$pattern),Ie=Ie||/\w+/,G.keywords&&(G.keywords=Pe(G.keywords,k.case_insensitive)),oe.keywordPatternRe=C(Ie,!0),z&&(G.begin||(G.begin=/\B|\b/),oe.beginRe=C(oe.begin),!G.end&&!G.endsWithParent&&(G.end=/\B|\b/),G.end&&(oe.endRe=C(oe.end)),oe.terminatorEnd=p(oe.end)||"",G.endsWithParent&&z.terminatorEnd&&(oe.terminatorEnd+=(G.end?"|":"")+z.terminatorEnd)),G.illegal&&(oe.illegalRe=C(G.illegal)),G.contains||(G.contains=[]),G.contains=[].concat(...G.contains.map(function(Me){return S(Me==="self"?G:Me)})),G.contains.forEach(function(Me){ke(Me,oe)}),G.starts&&ke(G.starts,z),oe.matcher=we(oe),oe}if(k.compilerExtensions||(k.compilerExtensions=[]),k.contains&&k.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return k.classNameAliases=r(k.classNameAliases||{}),ke(k)}function w(k){return k?k.endsWithParent||w(k.starts):!1}function S(k){return k.variants&&!k.cachedVariants&&(k.cachedVariants=k.variants.map(function(C){return r(k,{variants:null},C)})),k.cachedVariants?k.cachedVariants:w(k)?r(k,{starts:k.starts?r(k.starts):null}):Object.isFrozen(k)?r(k):k}var q="11.11.1";class ae extends Error{constructor(C,R){super(C),this.name="HTMLInjectionError",this.html=R}}const J=o,Be=r,De=Symbol("nomatch"),$t=7,xn=function(k){const C=Object.create(null),R=Object.create(null),ne=[];let we=!0;const ke="Could not find the language '{}', did you forget to load/include a language module?",G={disableAutodetect:!0,name:"Plain text",contains:[]};let z={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function oe(A){return z.noHighlightRe.test(A)}function Ie(A){let j=A.className+" ";j+=A.parentNode?A.parentNode.className:"";const me=z.languageDetectRe.exec(j);if(me){const ye=Pt(me[1]);return ye||(It(ke.replace("{}",me[1])),It("Falling back to no-highlight mode for this block.",A)),ye?me[1]:"no-highlight"}return j.split(/\s+/).find(ye=>oe(ye)||Pt(ye))}function Me(A,j,me){let ye="",Re="";typeof j=="object"?(ye=A,me=j.ignoreIllegals,Re=j.language):(Fe("10.7.0","highlight(lang, code, ...args) has been deprecated."),Fe("10.7.0",`Please use highlight(code, options) instead.
62
- https://github.com/highlightjs/highlight.js/issues/2277`),Re=A,ye=j),me===void 0&&(me=!0);const pt={code:ye,language:Re};zn("before:highlight",pt);const Ft=pt.result?pt.result:Nn(pt.language,pt.code,me);return Ft.code=pt.code,zn("after:highlight",Ft),Ft}function Nn(A,j,me,ye){const Re=Object.create(null);function pt($,Y){return $.keywords[Y]}function Ft(){if(!le.keywords){Le.addText(Ee);return}let $=0;le.keywordPatternRe.lastIndex=0;let Y=le.keywordPatternRe.exec(Ee),de="";for(;Y;){de+=Ee.substring($,Y.index);const be=wt.case_insensitive?Y[0].toLowerCase():Y[0],Ue=pt(le,be);if(Ue){const[Dt,wl]=Ue;if(Le.addText(de),de="",Re[be]=(Re[be]||0)+1,Re[be]<=$t&&(Gn+=wl),Dt.startsWith("_"))de+=Y[0];else{const xl=wt.classNameAliases[Dt]||Dt;Et(Y[0],xl)}}else de+=Y[0];$=le.keywordPatternRe.lastIndex,Y=le.keywordPatternRe.exec(Ee)}de+=Ee.substring($),Le.addText(de)}function Hn(){if(Ee==="")return;let $=null;if(typeof le.subLanguage=="string"){if(!C[le.subLanguage]){Le.addText(Ee);return}$=Nn(le.subLanguage,Ee,!0,$r[le.subLanguage]),$r[le.subLanguage]=$._top}else $=Bo(Ee,le.subLanguage.length?le.subLanguage:null);le.relevance>0&&(Gn+=$.relevance),Le.__addSublanguage($._emitter,$.language)}function Je(){le.subLanguage!=null?Hn():Ft(),Ee=""}function Et($,Y){$!==""&&(Le.startScope(Y),Le.addText($),Le.endScope())}function Ir($,Y){let de=1;const be=Y.length-1;for(;de<=be;){if(!$._emit[de]){de++;continue}const Ue=wt.classNameAliases[$[de]]||$[de],Dt=Y[de];Ue?Et(Dt,Ue):(Ee=Dt,Ft(),Ee=""),de++}}function Dr($,Y){return $.scope&&typeof $.scope=="string"&&Le.openNode(wt.classNameAliases[$.scope]||$.scope),$.beginScope&&($.beginScope._wrap?(Et(Ee,wt.classNameAliases[$.beginScope._wrap]||$.beginScope._wrap),Ee=""):$.beginScope._multi&&(Ir($.beginScope,Y),Ee="")),le=Object.create($,{parent:{value:le}}),le}function Lr($,Y,de){let be=E($.endRe,de);if(be){if($["on:end"]){const Ue=new n($);$["on:end"](Y,Ue),Ue.isMatchIgnored&&(be=!1)}if(be){for(;$.endsParent&&$.parent;)$=$.parent;return $}}if($.endsWithParent)return Lr($.parent,Y,de)}function hl($){return le.matcher.regexIndex===0?(Ee+=$[0],1):(Do=!0,0)}function _l($){const Y=$[0],de=$.rule,be=new n(de),Ue=[de.__beforeBegin,de["on:begin"]];for(const Dt of Ue)if(Dt&&(Dt($,be),be.isMatchIgnored))return hl(Y);return de.skip?Ee+=Y:(de.excludeBegin&&(Ee+=Y),Je(),!de.returnBegin&&!de.excludeBegin&&(Ee=Y)),Dr(de,$),de.returnBegin?0:Y.length}function kl($){const Y=$[0],de=j.substring($.index),be=Lr(le,$,de);if(!be)return De;const Ue=le;le.endScope&&le.endScope._wrap?(Je(),Et(Y,le.endScope._wrap)):le.endScope&&le.endScope._multi?(Je(),Ir(le.endScope,$)):Ue.skip?Ee+=Y:(Ue.returnEnd||Ue.excludeEnd||(Ee+=Y),Je(),Ue.excludeEnd&&(Ee=Y));do le.scope&&Le.closeNode(),!le.skip&&!le.subLanguage&&(Gn+=le.relevance),le=le.parent;while(le!==be.parent);return be.starts&&Dr(be.starts,$),Ue.returnEnd?0:Y.length}function yl(){const $=[];for(let Y=le;Y!==wt;Y=Y.parent)Y.scope&&$.unshift(Y.scope);$.forEach(Y=>Le.openNode(Y))}let qn={};function Vr($,Y){const de=Y&&Y[0];if(Ee+=$,de==null)return Je(),0;if(qn.type==="begin"&&Y.type==="end"&&qn.index===Y.index&&de===""){if(Ee+=j.slice(Y.index,Y.index+1),!we){const be=new Error(`0 width match regex (${A})`);throw be.languageName=A,be.badRule=qn.rule,be}return 1}if(qn=Y,Y.type==="begin")return _l(Y);if(Y.type==="illegal"&&!me){const be=new Error('Illegal lexeme "'+de+'" for mode "'+(le.scope||"<unnamed>")+'"');throw be.mode=le,be}else if(Y.type==="end"){const be=kl(Y);if(be!==De)return be}if(Y.type==="illegal"&&de==="")return Ee+=`
63
- `,1;if(Io>1e5&&Io>Y.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ee+=de,de.length}const wt=Pt(A);if(!wt)throw He(ke.replace("{}",A)),new Error('Unknown language: "'+A+'"');const El=rn(wt);let Ro="",le=ye||El;const $r={},Le=new z.__emitter(z);yl();let Ee="",Gn=0,Gt=0,Io=0,Do=!1;try{if(wt.__emitTokens)wt.__emitTokens(j,Le);else{for(le.matcher.considerAll();;){Io++,Do?Do=!1:le.matcher.considerAll(),le.matcher.lastIndex=Gt;const $=le.matcher.exec(j);if(!$)break;const Y=j.substring(Gt,$.index),de=Vr(Y,$);Gt=$.index+de}Vr(j.substring(Gt))}return Le.finalize(),Ro=Le.toHTML(),{language:A,value:Ro,relevance:Gn,illegal:!1,_emitter:Le,_top:le}}catch($){if($.message&&$.message.includes("Illegal"))return{language:A,value:J(j),illegal:!0,relevance:0,_illegalBy:{message:$.message,index:Gt,context:j.slice(Gt-100,Gt+100),mode:$.mode,resultSoFar:Ro},_emitter:Le};if(we)return{language:A,value:J(j),illegal:!1,relevance:0,errorRaised:$,_emitter:Le,_top:le};throw $}}function Ao(A){const j={value:J(A),illegal:!1,relevance:0,_top:G,_emitter:new z.__emitter(z)};return j._emitter.addText(A),j}function Bo(A,j){j=j||z.languages||Object.keys(C);const me=Ao(A),ye=j.filter(Pt).filter(Rr).map(Je=>Nn(Je,A,!1));ye.unshift(me);const Re=ye.sort((Je,Et)=>{if(Je.relevance!==Et.relevance)return Et.relevance-Je.relevance;if(Je.language&&Et.language){if(Pt(Je.language).supersetOf===Et.language)return 1;if(Pt(Et.language).supersetOf===Je.language)return-1}return 0}),[pt,Ft]=Re,Hn=pt;return Hn.secondBest=Ft,Hn}function ll(A,j,me){const ye=j&&R[j]||me;A.classList.add("hljs"),A.classList.add(`language-${ye}`)}function Mo(A){let j=null;const me=Ie(A);if(oe(me))return;if(zn("before:highlightElement",{el:A,language:me}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(z.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(A)),z.throwUnescapedHTML))throw new ae("One of your code blocks includes unescaped HTML.",A.innerHTML);j=A;const ye=j.textContent,Re=me?Me(ye,{language:me,ignoreIllegals:!0}):Bo(ye);A.innerHTML=Re.value,A.dataset.highlighted="yes",ll(A,me,Re.language),A.result={language:Re.language,re:Re.relevance,relevance:Re.relevance},Re.secondBest&&(A.secondBest={language:Re.secondBest.language,relevance:Re.secondBest.relevance}),zn("after:highlightElement",{el:A,result:Re,text:ye})}function sl(A){z=Be(z,A)}const cl=()=>{Un(),Fe("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ul(){Un(),Fe("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Br=!1;function Un(){function A(){Un()}if(document.readyState==="loading"){Br||window.addEventListener("DOMContentLoaded",A,!1),Br=!0;return}document.querySelectorAll(z.cssSelector).forEach(Mo)}function dl(A,j){let me=null;try{me=j(k)}catch(ye){if(He("Language definition for '{}' could not be registered.".replace("{}",A)),we)He(ye);else throw ye;me=G}me.name||(me.name=A),C[A]=me,me.rawDefinition=j.bind(null,k),me.aliases&&Mr(me.aliases,{languageName:A})}function pl(A){delete C[A];for(const j of Object.keys(R))R[j]===A&&delete R[j]}function fl(){return Object.keys(C)}function Pt(A){return A=(A||"").toLowerCase(),C[A]||C[R[A]]}function Mr(A,{languageName:j}){typeof A=="string"&&(A=[A]),A.forEach(me=>{R[me.toLowerCase()]=j})}function Rr(A){const j=Pt(A);return j&&!j.disableAutodetect}function ml(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=j=>{A["before:highlightBlock"](Object.assign({block:j.el},j))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=j=>{A["after:highlightBlock"](Object.assign({block:j.el},j))})}function gl(A){ml(A),ne.push(A)}function bl(A){const j=ne.indexOf(A);j!==-1&&ne.splice(j,1)}function zn(A,j){const me=A;ne.forEach(function(ye){ye[me]&&ye[me](j)})}function vl(A){return Fe("10.7.0","highlightBlock will be removed entirely in v12.0"),Fe("10.7.0","Please use highlightElement now."),Mo(A)}Object.assign(k,{highlight:Me,highlightAuto:Bo,highlightAll:Un,highlightElement:Mo,highlightBlock:vl,configure:sl,initHighlighting:cl,initHighlightingOnLoad:ul,registerLanguage:dl,unregisterLanguage:pl,listLanguages:fl,getLanguage:Pt,registerAliases:Mr,autoDetection:Rr,inherit:Be,addPlugin:gl,removePlugin:bl}),k.debugMode=function(){we=!1},k.safeMode=function(){we=!0},k.versionString=q,k.regex={concat:b,lookahead:m,either:_,optional:v,anyNumberOfTimes:f};for(const A in Ae)typeof Ae[A]=="object"&&t(Ae[A]);return Object.assign(k,Ae),k},Ye=xn({});return Ye.newInstance=()=>xn({}),Go=Ye,Ye.HighlightJS=Ye,Ye.default=Ye,Go}var Ug=Fg();const zg=Pg(Ug),xa={},Hg="hljs-";function qg(t){const n=zg.newInstance();return t&&l(t),{highlight:o,highlightAuto:r,listLanguages:a,register:l,registerAlias:i,registered:s};function o(c,d,u){const p=u||xa,m=typeof p.prefix=="string"?p.prefix:Hg;if(!n.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");n.configure({__emitter:Gg,classPrefix:m});const f=n.highlight(d,{ignoreIllegals:!0,language:c});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const v=f._emitter.root,b=v.data;return b.language=f.language,b.relevance=f.relevance,v}function r(c,d){const p=(d||xa).subset||a();let m=-1,f=0,v;for(;++m<p.length;){const b=p[m];if(!n.getLanguage(b))continue;const h=o(b,c,d);h.data&&h.data.relevance!==void 0&&h.data.relevance>f&&(f=h.data.relevance,v=h)}return v||{type:"root",children:[],data:{language:void 0,relevance:f}}}function a(){return n.listLanguages()}function l(c,d){if(typeof c=="string")n.registerLanguage(c,d);else{let u;for(u in c)Object.hasOwn(c,u)&&n.registerLanguage(u,c[u])}}function i(c,d){if(typeof c=="string")n.registerAliases(typeof d=="string"?d:[...d],{languageName:c});else{let u;for(u in c)if(Object.hasOwn(c,u)){const p=c[u];n.registerAliases(typeof p=="string"?p:[...p],{languageName:u})}}}function s(c){return!!n.getLanguage(c)}}class Gg{constructor(n){this.options=n,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(n){if(n==="")return;const o=this.stack[this.stack.length-1],r=o.children[o.children.length-1];r&&r.type==="text"?r.value+=n:o.children.push({type:"text",value:n})}startScope(n){this.openNode(String(n))}endScope(){this.closeNode()}__addSublanguage(n,o){const r=this.stack[this.stack.length-1],a=n.root.children;o?r.children.push({type:"element",tagName:"span",properties:{className:[o]},children:a}):r.children.push(...a)}openNode(n){const o=this,r=n.split(".").map(function(i,s){return s?i+"_".repeat(s):o.options.classPrefix+i}),a=this.stack[this.stack.length-1],l={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(l),this.stack.push(l)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const Kg=t=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[t.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});var Ve=[];for(var Ko=0;Ko<256;++Ko)Ve.push((Ko+256).toString(16).slice(1));function Wg(t,n=0){return(Ve[t[n+0]]+Ve[t[n+1]]+Ve[t[n+2]]+Ve[t[n+3]]+"-"+Ve[t[n+4]]+Ve[t[n+5]]+"-"+Ve[t[n+6]]+Ve[t[n+7]]+"-"+Ve[t[n+8]]+Ve[t[n+9]]+"-"+Ve[t[n+10]]+Ve[t[n+11]]+Ve[t[n+12]]+Ve[t[n+13]]+Ve[t[n+14]]+Ve[t[n+15]]).toLowerCase()}var to,Yg=new Uint8Array(16);function jg(){if(!to&&(to=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!to))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return to(Yg)}var Zg=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Na={randomUUID:Zg};function Xg(t,n,o){if(Na.randomUUID&&!t)return Na.randomUUID();t=t||{};var r=t.random||(t.rng||jg)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Wg(r)}const Qg=()=>Xg(),Jg={class:"code-block-toolbar"},eb={class:"wrap"},tb={class:"language readonly"},nb={class:"wrap"},ob=["srcdoc"],rb={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},ab={key:0,class:"preview"},ib={key:0,class:"error"},lb=["innerHTML"],sb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{commonDownload:o}=_o(),{tr:r}=Q(),{darkMode:a}=tn(),{isEditable:l}=ie(),i=e.ref("content_copy"),s=e.ref({show:!1,fullscreen:!1}),c=e.ref(""),d=e.ref(""),u=e.ref(""),p=e.ref(""),m=e.ref("splitVertical"),f=e.ref(""),v=e.ref("default");Vo.registerLayoutLoaders(es);const b={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},h=e.computed({get(){return n.node.attrs.language},set(D){n.updateAttributes({language:D})}}),_=e.computed(()=>{var D;return((D=n.node.content.content[0])==null?void 0:D.text)||""}),y=e.computed({get(){return n.node.attrs.wrap},set(D){n.updateAttributes({wrap:D})}}),E=e.computed(()=>["html","svg"].includes(h.value)),g=e.computed(()=>y.value?"text_select_move_down":"format_text_wrap"),N=e.computed(()=>h.value==="mermaid"),x=e.computed(()=>h.value==="mermaid"?l.value?m.value:"preview":"");function I(D){h.value=D}function L(){const D=n.node.content.content[0].text;ts.copyToClipboard(D).then(()=>{i.value="done",setTimeout(()=>{i.value="content_copy"},2e3)})}function T(D="code"){switch(D){case"svg":Z();break;default:P();break}}function P(){const D=h.value;let X=D;const re=oo.find(Se=>Se.value===D);re&&(X=re.ext.at(0));const fe=`${D}-${Date.now()}.${X}`,xe=n.node.content.content[0].text;o("code",fe,xe)}function Z(){if(!u.value)return;const D=`mermaid-${Date.now()}.svg`,X=u.value;o("svg",D,X)}function O(){const D=n.node.content.content[0].text;d.value=V(D),c.value="run",s.value={show:!0,fullscreen:!1}}function M(){c.value==="mermaid"&&(m.value=f.value)}function V(D){return`
201
+ `],SV={key:0,class:"o-ai-menu tiptap-toolbar"},EV={key:0,class:"o-scroll"},MV={class:"view-main"},TV={key:1,class:"view-output"},NV={class:"action-container"},AV={class:"actions"},OV={key:0,class:"o-scroll"},$V=["innerHTML"],RV={class:"ai-io-panel"},BV={class:"o-flex o-item-center actions"},CC=c.defineComponent({__name:"OAiMenu",props:{editor:{type:Lt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{md:r,aiOption:i,createStreamingChatCompletion:s}=rg(),{languageName:l,tr:a}=de(),u=c.ref(),d=c.ref(!1),f=c.ref(""),p=c.ref(""),h=c.ref("main"),m=c.ref(""),g=c.ref(!1),y=c.ref(!1),b=c.computed(()=>({role:"system",content:og.writing.replace("[LANGUAGE]",l.value)})),v=c.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),k=c.computed(()=>R1.filter(B=>B.value.indexOf(f.value)>=0));function w(){const{from:B,to:I}=t.editor.state.selection;return t.editor.state.doc.textBetween(B,I,"")}function x(){setTimeout(()=>{d.value=!0},0)}function C(B,I){switch(I&&(d.value=!0),m.value=B.options.prompt.replaceAll("[CONTENT]",w()),B.value){case"translate":m.value=m.value.replace("[LANGUAGE]",I.value);break;case"changeTone":m.value=m.value.replace("[TONE]",I.value);break}return f.value=a(B.label),N(),!0}function S(){var B;A(),(B=u.value)==null||B.focus()}function T(){const B=Zp(t.editor,p.value);let I=0;for(const L of B.content){const R=Bn.fromJSON(t.editor.schema,L);I+=R.nodeSize}t.editor.chain().focus().deleteSelection().insertContent(B.content).setTextSelection({from:t.editor.state.selection.from,to:t.editor.state.selection.from+I+1}).run(),A(),d.value=!1,setTimeout(()=>{o("confirm")},0)}function N(){h.value="output",g.value=!0,y.value?O():$()}async function $(){let B="";v.value.push({role:"user",content:m.value}),v.value[0].role==="system"&&(v.value.shift(),v.value.unshift(b.value));try{const I=await s(v.value,L=>{B+=L,v.value=[...v.value.slice(0,-1),{role:"assistant",content:B}],p.value=r.render(B)})}catch(I){v.value.pop(),console.error(I),mg.error(a("ai.error"))}g.value=!1}async function O(){let B="";for(const I of xC)await new Promise(L=>setTimeout(L,500)),B+=I,p.value=r.render(B);g.value=!1}function A(){h.value="main",p.value="",f.value=""}return c.onMounted(()=>{setTimeout(()=>{var B;(B=u.value)==null||B.focus(),d.value=!0},300)}),(B,I)=>n.editor?(c.openBlock(),c.createElementBlock("section",SV,[c.createVNode(c.unref(Yn),{modelValue:d.value,"onUpdate:modelValue":I[1]||(I[1]=L=>d.value=L),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":c.withCtx(()=>[h.value==="main"?(c.openBlock(),c.createElementBlock("div",EV,[c.createElementVNode("section",MV,[c.createVNode(c.unref(Ed),{items:k.value,onSelect:C,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):c.createCommentVNode("",!0),h.value==="output"?(c.openBlock(),c.createElementBlock("section",TV,[c.createElementVNode("div",NV,[c.createElementVNode("div",null,[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"})]),c.createElementVNode("div",AV,[c.createVNode(c.unref(Gn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:g.value,onClick:T},null,8,["loading"]),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createBlock(c.unref(Gn),{key:0,icon:"close",tooltip:"Cancel",onClick:S}))])]),p.value?(c.openBlock(),c.createElementBlock("div",OV,[c.createElementVNode("div",{class:"tiptap output",innerHTML:p.value},null,8,$V)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createElementVNode("section",RV,[c.createVNode(c.unref(to),{ref_key:"inputRef",ref:u,class:"caption-input",modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=L=>f.value=L),type:"text",placeholder:c.unref(a)("ai.askAi"),autofocus:"",onFocus:x},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"})]),suffix:c.withCtx(()=>[c.createElementVNode("div",BV,[c.createVNode(c.unref(Gn),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0)}}),DV={key:0,class:"o-inline-math-menu tiptap-toolbar"},SC=c.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:Lt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{run:r}=xe(),i=c.ref(null),s=c.ref(""),l=c.ref(null);c.computed(()=>{const f=Jo.getState(t.editor.state);return!!(f!=null&&f.active)});function a(){if(s.value="",l.value=null,t.editor.isActive("inlineMath")){const{state:f}=t.editor,{selection:p,schema:h}=f;if(p instanceof Q){const m=p.node;l.value=p.from,m.type.name==="inlineMath"&&(s.value=m.attrs.latex)}}setTimeout(()=>{var f;(f=i.value)==null||f.focus()},300)}function u(){console.log("latex",s.value,l.value),l.value?s.value?r(t.editor,"inlineMathUpdate",{latex:s.value}):r(t.editor,"inlineMathDelete",{pos:l.value}):s.value&&r(t.editor,"inlineMathInsert",{latex:s.value}),setTimeout(()=>{o("confirm")},0)}const d=()=>{t.editor.view.dispatch(t.editor.state.tr.setMeta(Jo,{type:"hide"}))};return c.onMounted(()=>{a(),t.editor.on("focus",d)}),c.onUnmounted(()=>{t.editor.off("focus",d)}),(f,p)=>n.editor?(c.openBlock(),c.createElementBlock("section",DV,[c.createVNode(c.unref(to),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=h=>s.value=h),type:"text",autofocus:"",clearable:"",onKeydown:c.withKeys(c.withModifiers(u,["prevent"]),["enter"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"function",class:"o-tips"})]),suffix:c.withCtx(()=>[s.value?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:u})):c.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):c.createCommentVNode("",!0)}}),_V={key:0,class:"spinner"},Gn=c.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=n,o=e;function r(i){t.loading||o("click",i)}return(i,s)=>(c.openBlock(),c.createBlock(c.unref(Vn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:c.withModifiers(r,["stop"])},[n.loading?(c.openBlock(),c.createElementBlock("div",_V)):(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])),c.renderSlot(i.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),IV=c.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const{tr:e}=de();return(t,o)=>(c.openBlock(),c.createBlock(Gn,{"content-class":"o-ai-btn",icon:"auto_awesome",color:c.unref(he).purple,tooltip:c.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),LV={class:"o-align-group"},PV=c.defineComponent({__name:"OAlignGroup",props:{editor:{type:Lt}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,l)=>(c.openBlock(),c.createElementBlock("div",LV,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Oe,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive({textAlign:a.value})},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),VV={class:"o-background-color-dropdown o-button-group"},zV=c.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"backgroundColor",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",VV,[c.createVNode(c.unref(Ge),{icon:"background_color",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ge),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").backgroundColor,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),HV={class:"o-highlight-dropdown o-button-group"},FV=c.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"highlight",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",HV,[c.createVNode(c.unref(Ge),{icon:"ink_highlighter",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ge),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),jV=c.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(n){const e=n,{run:t}=xe(),{tr:o}=de();function r(){const{state:i}=e.editor,{selection:s}=i,{$from:l}=s,u=l.node().type.name;t(e.editor,"details",{type:u})}return(i,s)=>{var l;return c.openBlock(),c.createBlock(Oe,{class:"o-details-btn",icon:"toggle_list",tooltip:c.unref(o)("editor.toggleList"),"content-class":{"is-active":(l=n.editor)==null?void 0:l.isActive("details")},onClick:r},null,8,["tooltip","content-class"])}}}),WV=c.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,l)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:c.unref(t)("editor.emoji")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Td),{items:c.unref(Tl.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),UV=c.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"fontFamily",{fontFamily:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:c.unref(t)("editor.fontFamily")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive("textStyle",{fontFamily:u.value})}),onClick:p=>s(u.value)},{suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive("textStyle",{fontFamily:u.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("span",{style:c.normalizeStyle(`font-family: ${u.value}`)},c.toDisplayString(u.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),qV={class:"o-fore-color-dropdown o-button-group"},KV=c.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ff4d4f");function s(){l(i.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),i.value=a,o(e.editor,"color",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",qV,[c.createVNode(c.unref(Ge),{icon:"format_color_text",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ge),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.textColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),JV=c.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:t("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:t("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:t("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:t("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:t("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(a){var u,d;return a.value==="heading"?(u=e.editor)==null?void 0:u.isActive(a.value,{level:a.valueAlt}):(d=e.editor)==null?void 0:d.isActive(a.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),o(e.editor,a.value,{level:a.valueAlt})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:c.unref(t)("editor.heading")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),GV=c.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:Lt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(null);function a(){if(e.editor.isActive("inlineMath")){const{state:p}=e.editor,{selection:h,schema:m}=p;if(h instanceof Q){const g=h.node;l.value=h.from,g.type.name==="inlineMath"&&(s.value=g.attrs.latex)}}}function u(){var p;(p=r.value)==null||p.setShow(!1)}function d(p){var h;console.log("confirm",p),p?o(e.editor,"inlineMathUpdate",{latex:p,pos:l.value}):o(e.editor,"inlineMathDelete",{pos:l.value}),(h=r.value)==null||h.setShow(!1)}function f(){window.open("https://katex.org/docs/supported.html","target")}return(p,h)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[h[0]||(h[0]=m=>i.value=m),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"edit",tooltip:c.unref(t)("label.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ad),{key:0,title:c.unref(t)("label.edit"),val:s.value,icon:"function",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:f},null,8,["tooltip"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),XV={class:"o-list-dropdown o-button-group"},YV=c.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref();function s(){o(e.editor,i.value.value)}function l(u){r.value.setShow(!1),i.value=u,o(e.editor,u.value)}const a=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);return c.onMounted(()=>{i.value=a.value[0]}),(u,d)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Vn),null,{trigger:c.withCtx(()=>{var f;return[c.createElementVNode("div",XV,[c.createVNode(c.unref(Ge),{icon:(f=i.value)==null?void 0:f.icon,class:"o-command-btn",onClick:c.withModifiers(s,["stop"])},null,8,["icon"]),c.createVNode(c.unref(Ge),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:c.withCtx(()=>{var f;return[c.createTextVNode(" "+c.toDisplayString((f=i.value)==null?void 0:f.label),1)]}),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(f,p)=>{var h;return c.openBlock(),c.createBlock(c.unref(Ut),{key:p,class:c.normalizeClass({"is-active":(h=n.editor)==null?void 0:h.isActive(f.value)}),onClick:m=>l(f)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:f.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var m;return[(m=n.editor)!=null&&m.isActive(f.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),QV={class:"o-list-group"},ZV=c.defineComponent({__name:"OListGroup",props:{editor:{type:Lt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,l)=>(c.openBlock(),c.createElementBlock("div",QV,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Oe,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive(a.value)},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),ez=c.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Lt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank")}function u(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"edit",tooltip:c.unref(t)("link.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ad),{key:0,title:c.unref(t)("link.edit"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(gg),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),tz=c.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(c.openBlock(),c.createBlock(Oe,{icon:"open_in_new",tooltip:c.unref(t)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),nz={class:"o-command-btn"},oz={class:"o-more-bubble"},rz=c.defineComponent({__name:"OMoreBubble",props:{editor:{type:Lt,required:!0}},setup(n){const e=c.ref();return(t,o)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:c.withCtx(()=>[c.createElementVNode("div",nz,[c.createVNode(c.unref(X),{name:"more_horiz"})])]),default:c.withCtx(()=>[c.createElementVNode("section",oz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(H1),(r,i)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:i},[r==="separator"?(c.openBlock(),c.createBlock(c.unref(It),{key:0,vertical:""})):typeof r=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Dd)(r)),{key:1,name:r,editor:n.editor},null,8,["name","editor"])):c.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),iz=c.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",icon:"title"},{label:t("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:t("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:t("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:t("editor.todoList"),value:"taskList",icon:"check_box"},{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:t("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(a){var u;return(u=e.editor)==null?void 0:u.isActive(a.value,a.options)}function l(a){r.value.setShow(!1),o(e.editor,a.value,a.options)}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:c.unref(t)("label.styles")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),sz=c.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"tableInsert",s)}return(s,l)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"window","content-class":"o-table-btn",tooltip:c.unref(t)("table.insert")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Y1),{onSelect:i})]),_:1},512))}}),lz={class:"o-table-group"},az=c.defineComponent({__name:"OTableGroup",props:{editor:{type:Lt,required:!0}},setup(n){const{tr:e}=de(),{run:t}=xe();return(o,r)=>{var i,s;return c.openBlock(),c.createElementBlock("section",lz,[(i=n.editor)!=null&&i.can().mergeCells()?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:"cell_merge",tooltip:c.unref(e)("table.merge"),onClick:r[0]||(r[0]=l=>c.unref(t)(n.editor,"tableMergeCells"))},null,8,["tooltip"])):c.createCommentVNode("",!0),(s=n.editor)!=null&&s.can().splitCell()?(c.openBlock(),c.createBlock(c.unref(Oe),{key:1,icon:"splitscreen_left",tooltip:c.unref(e)("table.split"),onClick:r[1]||(r[1]=l=>c.unref(t)(n.editor,"tableSplitCell"))},null,8,["tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(Q1),{editor:n.editor},null,8,["editor"])])}}}),cz=c.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Lt}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref(""),s=c.ref("");function l(a){a.name==="color"?(i.value=a.value,localStorage.setItem("yiitap.text-color.fore",a.value)):a.name==="backColor"&&(s.value=a.value,localStorage.setItem("yiitap.text-color.back",a.value)),r.value.setShow(!1),o(e.editor,a.name,{color:a.value})}return c.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:c.unref(t)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ag),{"fore-color":i.value,"back-color":s.value,"default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),uz=c.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Lt}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.computed(()=>[{label:t("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:t("editor.underline"),value:"underline",icon:"format_underlined"},{label:t("editor.code"),value:"code",icon:"code",separator:!0},{label:t("editor.subscript"),value:"subscript",icon:"subscript",separator:!0},{label:t("editor.superscript"),value:"superscript",icon:"superscript"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,l)}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:c.unref(t)("editor.textFormat")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(It),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(u.value)}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(u.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),dz={ai:IV,"align-dropdown":ig,"align-group":PV,"background-color":zV,color:KV,details:jV,"extension-dropdown":G1,"font-family":UV,heading:JV,highlight:FV,"inline-math-edit":GV,"list-dropdown":YV,"list-group":ZV,link:sg,"link-edit":ez,"link-open":tz,emoji:WV,more:rz,"style-dropdown":iz,table:sz,"table-group":az,"text-color-dropdown":cz,"text-format-dropdown":uz},Dd=n=>dz[n]||MI,fz={key:0,class:"o-main-menu"},pz={class:"left"},hz={class:"right"},EC=c.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(n){const e=n,t=c.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=_1),o.length>0?o:D1});return(o,r)=>n.editor?(c.openBlock(),c.createElementBlock("section",fz,[c.createElementVNode("section",pz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.value,(i,s)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:s},[i==="separator"?(c.openBlock(),c.createBlock(c.unref(It),{key:0,vertical:""})):typeof i=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Dd)(i)),{key:1,name:i,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i),{key:2,editor:n.editor},null,8,["editor"]))],64))),128)),c.renderSlot(o.$slots,"left")]),c.createElementVNode("section",hz,[c.renderSlot(o.$slots,"right")])])):c.createCommentVNode("",!0)}});let nh,oh;if(typeof WeakMap<"u"){let n=new WeakMap;nh=e=>n.get(e),oh=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;nh=o=>{for(let r=0;r<n.length;r+=2)if(n[r]==o)return n[r+1]},oh=(o,r)=>(t==10&&(t=0),n[t++]=o,n[t++]=r)}var it=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return nh(n)||oh(n,mz(n))}};function mz(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=gz(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:v}=g.attrs;for(let k=0;k<b;k++){if(k+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-k});break}const w=r+k*e;for(let x=0;x<y;x++){o[w+x]==0?o[w+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(w+x)%e*2,T=s[S];T==null||T!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):T==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new it(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&yz(l,s,n),l}function gz(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function yz(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=bz(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function bz(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function qt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const vr=new ae("selectingCells");function Ci(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function vz(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function oo(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function _d(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ci(e.$head)||wz(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function wz(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function rh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function kz(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function yg(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function MC(n,e,t){const o=n.node(-1),r=it.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Si(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function TC(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function xz(n,e,t){const o=qt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var ze=class Fo extends se{constructor(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new Gk(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(rh(o)&&rh(r)&&yg(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?Fo.rowSelection(o,r):i&&this.isColSelection()?Fo.colSelection(o,r):new Fo(o,r)}return U.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=it.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Si(b,0,g)),y>0&&(b=Si(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}s.push(e.child(a).copy(_.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new F(_.from(l),1,1)}replace(e,t=F.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?F.empty:t)}const i=se.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new F(_.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=it.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new Fo(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=it.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Fo&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new Fo(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Fo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Fo(e.resolve(t),e.resolve(o))}getBookmark(){return new Cz(this.$anchorCell.pos,this.$headCell.pos)}};ze.prototype.visible=!1;se.jsonID("cell",ze);var Cz=class NC{constructor(e,t){this.anchor=e,this.head=t}map(e){return new NC(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&yg(t,o)?new ze(t,o):se.near(o,1)}};function Sz(n){if(!(n.selection instanceof ze))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(Ve.node(o,o+t.nodeSize,{class:"selectedCell"}))}),Ce.create(n.doc,e)}function Ez({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function Mz({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function Tz(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof Q&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ze.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=ze.rowSelection(l,l)}else if(!t){const l=it.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=ze.create(r,a+1,u)}}else o instanceof U&&Ez(o)?i=U.create(r,o.from):o instanceof U&&Mz(o)&&(i=U.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const Nz=new ae("fix-tables");function AC(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?AC(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function OC(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=Az(n,r,i,t))};return e?e.doc!=n.doc&&AC(e.doc,n.doc,0,o):n.doc.descendants(o),t}function Az(n,e,t,o){const r=it.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,Si(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=qt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(Nz,{fixTables:!0})}function $o(n){const e=n.selection,t=_d(n),o=t.node(-1),r=t.start(-1),i=it.get(o);return{...e instanceof ze?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function $C(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;xz(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,TC(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?qt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function Oz(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e($C(n.tr,t,t.left))}return!0}function $z(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e($C(n.tr,t,t.right))}return!0}function Rz(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],u=t.nodeAt(a),d=u.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Si(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function Bz(n,e){if(!oo(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;Rz(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=it.get(i)}e(o)}return!0}function Dz(n,e,t){var o;const r=qt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function RC(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;Dz(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?qt(o.type.schema).cell:(a=o.nodeAt(e.map[d+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,qt(o.type.schema).row.create(null,s)),n}function _z(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(RC(n.tr,t,t.top))}return!0}function Iz(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(RC(n.tr,t,t.bottom))}return!0}function Lz(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function Pz(n,e){if(!oo(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;Lz(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=it.get(t.table)}e(o)}return!0}function wv(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Vz({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function kv(n,e){const t=n.selection;if(!(t instanceof ze)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=$o(n),{map:r}=o;if(Vz(r,o))return!1;if(e){const i=n.tr,s={};let l=_.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{wv(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...TC(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=wv(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new ze(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function xv(n,e){const t=qt(n.schema);return zz(({node:o})=>t[o.type.spec.tableRole])(n,e)}function zz(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof ze){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=vz(o.$from),!r)return!1;i=(s=Ci(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=$o(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),o instanceof ze&&f.setSelection(new ze(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function Hz(n,e){return function(t,o){if(!oo(t))return!1;const r=_d(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof ze?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function Fz(n){return function(e,t){if(!oo(e))return!1;if(t){const o=qt(e.schema),r=$o(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function Cv(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function Kl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Fz(n):function(t,o){if(!oo(t))return!1;if(o){const r=qt(t.schema),i=$o(t),s=t.tr,l=Cv("row",i,r),a=Cv("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}Kl("row",{useDeprecatedLogic:!0});Kl("column",{useDeprecatedLogic:!0});const jz=Kl("cell",{useDeprecatedLogic:!0});function Wz(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function Sv(n){return function(e,t){if(!oo(e))return!1;const o=Wz(_d(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(U.between(r,kz(r))).scrollIntoView())}return!0}}function Uz(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function qa(n,e){const t=n.selection;if(!(t instanceof ze))return!1;if(e){const o=n.tr,r=qt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new F(r,0,0))}),o.docChanged&&e(o)}return!0}function qz(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=ih(qt(s).row,new F(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?ih(qt(s).row,new F(e,t,o)).content:e);else return null;return Kz(s,l)}function Kz(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let u=r;u<r+l;u++)t[u]=(t[u]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(_.empty),t[r]<o){const i=qt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(_.from(s))}return{height:e.length,width:o,rows:e}}function ih(n,e){const t=n.createAndFill();return new tm(t).replace(0,t.content.size,e).doc}function Jz({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Si(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(_.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(_.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function Gz(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=qt(l);let u,d;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,_.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(u||d)}function Ev(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),u+=p.attrs.colspan-1}}return a}function Mv(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,Si(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Si(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function Tv(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=it.get(i);const{top:l,left:a}=o,u=a+r.width,d=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=it.get(i),p=f.mapping.maps.length}Gz(f,s,i,t,u,d,p)&&h(),Ev(f,s,i,t,a,u,l,p)&&h(),Ev(f,s,i,t,a,u,d,p)&&h(),Mv(f,s,i,t,l,d,a,p)&&h(),Mv(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new F(r.rows[m-l],0,0))}h(),f.setSelection(new ze(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(d-1,u-1,i)))),e(f)}const Xz=bm({ArrowLeft:Ka("horiz",-1),ArrowRight:Ka("horiz",1),ArrowUp:Ka("vert",-1),ArrowDown:Ka("vert",1),"Shift-ArrowLeft":Ja("horiz",-1),"Shift-ArrowRight":Ja("horiz",1),"Shift-ArrowUp":Ja("vert",-1),"Shift-ArrowDown":Ja("vert",1),Backspace:qa,"Mod-Backspace":qa,Delete:qa,"Mod-Delete":qa});function bc(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Ka(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof ze)return bc(t,o,se.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=BC(r,n,e);if(s==null)return!1;if(n=="horiz")return bc(t,o,se.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=MC(l,n,e);let u;return a?u=se.near(a,1):e<0?u=se.near(t.doc.resolve(l.before(-1)),-1):u=se.near(t.doc.resolve(l.after(-1)),1),bc(t,o,u)}}}function Ja(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof ze)s=i;else{const a=BC(r,n,e);if(a==null)return!1;s=new ze(t.doc.resolve(a))}const l=MC(s.$headCell,n,e);return l?bc(t,o,new ze(s.$anchorCell,l)):!1}}function Yz(n,e){const t=n.state.doc,o=Ci(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new ze(o))),!0):!1}function Qz(n,e,t){if(!oo(n.state))return!1;let o=qz(t);const r=n.state.selection;if(r instanceof ze){o||(o={width:1,height:1,rows:[_.from(ih(qt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=it.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=Jz(o,l.right-l.left,l.bottom-l.top),Tv(n.state,n.dispatch,s,l,o),!0}else if(o){const i=_d(n.state),s=i.start(-1);return Tv(n.state,n.dispatch,s,it.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function Zz(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=Nv(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof ze)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Ci(n.state.selection.$anchor))!=null&&((t=Hf(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=Hf(n,u);const f=vr.getState(n.state)==null;if(!d||!yg(a,d))if(f)d=a;else return;const p=new ze(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(vr,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),vr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(vr,-1))}function l(a){const u=a,d=vr.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(Nv(n,u.target)!=o&&(f=Hf(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function BC(n,e,t){if(!(n.state.selection instanceof U))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function Nv(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Hf(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&Ci(n.state.doc.resolve(o))||Ci(n.state.doc.resolve(r))}var e2=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),sh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,sh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function sh(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const vn=new ae("tableColumnResizing");function t2({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=e2,lastColumnResizable:r=!0}={}){const i=new ue({key:vn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=qt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new n2(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=vn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{o2(s,l,n,r)},mouseleave:s=>{r2(s)},mousedown:(s,l)=>{i2(s,l,e,t)}},decorations:s=>{const l=vn.getState(s);if(l&&l.activeHandle>-1)return u2(s,l.activeHandle)},nodeViews:{}}});return i}var n2=class vc{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(vn);if(o&&o.setHandle!=null)return new vc(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new vc(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return rh(e.doc.resolve(r))||(r=-1),new vc(r,t.dragging)}return t}};function o2(n,e,t,o){if(!n.editable)return;const r=vn.getState(n.state);if(r&&!r.dragging){const i=l2(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Av(n,e,"left",t):a-e.clientX<=t&&(s=Av(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=it.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}DC(n,s)}}}function r2(n){if(!n.editable)return;const e=vn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&DC(n,-1)}function i2(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=vn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=s2(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(vn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=vn.getState(n.state);p!=null&&p.dragging&&(a2(n,p.activeHandle,Ov(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(vn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=vn.getState(n.state);if(p&&p.dragging){const h=Ov(p.dragging,f,t);$v(n,p.activeHandle,h,o)}}return $v(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function s2(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function l2(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Av(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=Ci(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=it.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function Ov(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function DC(n,e){n.dispatch(n.state.tr.setMeta(vn,{setHandle:e}))}function a2(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=it.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():c2(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function $v(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=it.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&sh(i,a.firstChild,a,o,l,t)}function c2(n){return Array(n).fill(0)}function u2(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return Ce.empty;const i=it.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=vn.getState(n))===null||a===void 0)&&a.dragging&&t.push(Ve.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(Ve.widget(p,h))}}return Ce.create(n.doc,t)}function d2({allowTableNodeSelection:n=!1}={}){return new ue({key:vr,state:{init(){return null},apply(e,t){const o=e.getMeta(vr);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:Sz,handleDOMEvents:{mousedown:Zz},createSelectionBetween(e){return vr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Yz,handleKeyDown:Xz,handlePaste:Qz},appendTransaction(e,t,o){return Tz(o,OC(o,t),n)}})}function f2(n,e){const t=Math.min(n.top,e.top),o=Math.max(n.bottom,e.bottom),r=Math.min(n.left,e.left),s=Math.max(n.right,e.right)-r,l=o-t,a=r,u=t;return new DOMRect(a,u,s,l)}var p2=class{constructor({editor:n,element:e,view:t,pluginKey:o="bubbleMenu",updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:l,getReferencedVirtualElement:a,options:u}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:f,state:p,from:h,to:m})=>{const{doc:g,selection:y}=p,{empty:b}=y,v=!g.textBetween(h,m).length&&pd(p.selection),k=this.element.contains(document.activeElement);return!(!(f.hasFocus()||k)||b||v||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:f})=>{var p;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}f!=null&&f.relatedTarget&&((p=this.element.parentNode)!=null&&p.contains(f.relatedTarget))||(f==null?void 0:f.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(f,p)=>{const h=!(p!=null&&p.selection.eq(f.state.selection)),m=!(p!=null&&p.doc.eq(f.state.doc));!h&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(f,h,m,p)},this.updateDelay))},this.updateHandler=(f,p,h,m)=>{const{composing:g}=f;if(g||!p&&!h)return;if(!this.getShouldShow(m)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:f})=>{const p=f.getMeta(this.pluginKey);p==="updatePosition"?this.updatePosition():p&&typeof p=="object"&&p.type==="updateOptions"&&this.updateOptions(p.options)};var d;this.editor=n,this.element=e,this.view=t,this.pluginKey=o,this.updateDelay=r,this.resizeDelay=i,this.appendTo=l,this.scrollTarget=(d=u==null?void 0:u.scrollTarget)!=null?d:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...u},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push($u(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Ou(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Au(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(hC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(fC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(dC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(pC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(mC(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n,e,t;const{selection:o}=this.editor.state,r=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(r)return r;if(!((t=(e=this.view)==null?void 0:e.dom)!=null&&t.parentNode))return;const i=ux(this.view,o.from,o.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(o instanceof Q){let l=this.view.nodeDOM(o.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(o instanceof ze){const{$anchorCell:l,$headCell:a}=o,u=l?l.pos:a.pos,d=a?a.pos:l.pos,f=this.view.nodeDOM(u),p=this.view.nodeDOM(d);if(!f||!p)return;const h=f===p?f.getBoundingClientRect():f2(f.getBoundingClientRect(),p.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}updatePosition(){const n=this.virtualElement;n&&ql(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:o,middlewareData:r})=>{var i,s;if((i=r.hide)!=null&&i.referenceHidden||(s=r.hide)!=null&&s.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,o=t.selection.from!==t.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(n,e);return}const r=!(e!=null&&e.selection.eq(n.state.selection)),i=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,r,i,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:i,to:s}))||!1}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(n){var e;if(n.updateDelay!==void 0&&(this.updateDelay=n.updateDelay),n.resizeDelay!==void 0&&(this.resizeDelay=n.resizeDelay),n.appendTo!==void 0&&(this.appendTo=n.appendTo),n.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=n.getReferencedVirtualElement),n.shouldShow!==void 0&&n.shouldShow&&(this.shouldShow=n.shouldShow),n.options!==void 0){const t=(e=n.options.scrollTarget)!=null?e:window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...n.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},h2=n=>new ue({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:e=>new p2({view:e,...n})}),m2=c.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{editor:r,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}=n,p=o.value;p&&(p.style.visibility="hidden",p.style.position="absolute",p.remove(),c.nextTick(()=>{r.registerPlugin(h2({editor:r,element:p,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}))}))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}}),g2=class{constructor({editor:n,element:e,view:t,pluginKey:o="floatingMenu",updateDelay:r=250,resizeDelay:i=60,options:s,appendTo:l,shouldShow:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:d,state:f})=>{const{selection:p}=f,{$anchor:h,empty:m}=p,g=h.depth===1,y=h.parent.isTextblock&&!h.parent.type.spec.code&&!h.parent.textContent&&h.parent.childCount===0&&!this.getTextContent(h.parent);return!(!d.hasFocus()||!m||!g||!y||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(d,f,p,h)=>{const{composing:m}=d;if(m||!f&&!p)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var f;if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(d.relatedTarget))||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:d})=>{const f=d.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"&&this.updateOptions(f.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var u;this.editor=n,this.element=e,this.view=t,this.pluginKey=o,this.updateDelay=r,this.resizeDelay=i,this.appendTo=l,this.scrollTarget=(u=s==null?void 0:s.scrollTarget)!=null?u:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(n){return rx(n,{textSerializers:Mm(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push($u(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Ou(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Au(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(hC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(fC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(dC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(pC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(mC(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:i,to:s})}updateOptions(n){var e;if(n.updateDelay!==void 0&&(this.updateDelay=n.updateDelay),n.resizeDelay!==void 0&&(this.resizeDelay=n.resizeDelay),n.appendTo!==void 0&&(this.appendTo=n.appendTo),n.shouldShow!==void 0&&n.shouldShow&&(this.shouldShow=n.shouldShow),n.options!==void 0){const t=(e=n.options.scrollTarget)!=null?e:window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...n.options}}}updatePosition(){const{selection:n}=this.editor.state,e=ux(this.view,n.from,n.to);ql({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:r,strategy:i,middlewareData:s})=>{var l,a;if((l=s.hide)!=null&&l.referenceHidden||(a=s.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${o}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!(e!=null&&e.selection.eq(n.state.selection)),o=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,t,o,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},y2=n=>new ue({key:typeof n.pluginKey=="string"?new ae(n.pluginKey):n.pluginKey,view:e=>new g2({view:e,...n})}),b2=c.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{pluginKey:r,editor:i,updateDelay:s,resizeDelay:l,options:a,appendTo:u,shouldShow:d}=n,f=o.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),i.registerPlugin(y2({pluginKey:r,editor:i,element:f,updateDelay:s,resizeDelay:l,options:a,appendTo:u,shouldShow:d})))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}});const v2={key:0},w2=c.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Lt},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,{tr:t}=de(),{theme:o}=Di(),r=c.ref(!1),i=c.ref(!1),s=c.ref(!1),l=c.ref(!1),a=c.ref({offset:10,placement:"bottom-start",onShow:()=>{r.value=!1,i.value=!1,s.value=!1},onHide:()=>{s.value=!1}});function u(){r.value=!0}function d(k){k==="ai"&&(i.value=!0)}function f(){s.value=!0}function p(k){const{schema:w}=e.editor,x=w.marks.link;if(!x||!k)return!1;const{$from:C,$to:S}=k;return!!Os(C,x)}function h({editor:k,element:w,view:x,state:C,oldState:S,from:T,to:N}){var z;const{doc:$,selection:O}=C,{empty:A}=O,B=!$.textBetween(T,N).length&&pd(C.selection);if(l.value=e.editor.isActive("inlineMath"),v.value||e.editor.isActive("inlineMath"))return!0;if(!x.hasFocus()||A||s.value||B&&k.isActive("link")&&!k.isActive("image"))return!1;const I=["image"],L=["image","toc","video","model-viewer"],R=O.node,q=(z=R==null?void 0:R.type)==null?void 0:z.name;return!(k.isActive("codeBlock")||L.indexOf(q)>=0||q&&!I.includes(q))}const m=c.computed(()=>{if(e.editor){const{state:k}=e.editor,{tr:w}=k,{selection:x}=w;return p(x)}else return!1}),g=c.computed(()=>{var k,w;return!r.value&&!((k=e.editor)!=null&&k.isActive("image"))&&(m.value||((w=e.editor)==null?void 0:w.isActive("inlineMath")))}),y=c.computed(()=>v.value||l.value),b=c.computed(()=>{var w,x,C;let k=e.menu;return r.value||((w=e.editor)!=null&&w.isActive("image")?k=m.value?z1:V1:(x=e.editor)!=null&&x.isActive("table")?k=F1:m.value?k=P1:(C=e.editor)!=null&&C.isActive("inlineMath")&&(k=L1)),k.length>0?k:I1}),v=c.computed(()=>{const k=Jo.getState(e.editor.state);return!!(k!=null&&k.active)});return c.onMounted(()=>{r.value=!1}),(k,w)=>n.editor?(c.openBlock(),c.createElementBlock("section",v2,[c.createVNode(c.unref(m2),{editor:n.editor,"should-show":h,options:a.value},{default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(CC),{key:0,editor:n.editor,onConfirm:f},null,8,["editor"])):y.value?(c.openBlock(),c.createBlock(c.unref(SC),{key:1,editor:n.editor},null,8,["editor"])):(c.openBlock(),c.createElementBlock("section",{key:2,class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[g.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(c.unref(Oe),{icon:"arrow_back",tooltip:c.unref(t)("link.back"),onClick:u},null,8,["tooltip"]),c.createVNode(c.unref(It),{vertical:""})],64)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(b.value,(x,C)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:C},[x==="separator"?(c.openBlock(),c.createBlock(c.unref(It),{key:0,vertical:""})):typeof x=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Dd)(x)),{key:1,name:x,editor:n.editor,onClick:S=>d(x)},null,8,["name","editor","onClick"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}}),k2={key:0},x2=c.defineComponent({__name:"OFloatingMenu",props:{editor:{type:Ax},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,t=c.ref(!1),o=c.ref({placement:"right",offset:168});function r(){t.value=!0}function i(d){const{schema:f}=e.editor,p=f.marks.link;if(!p||!d)return!1;const{$from:h,$to:m}=d;return!!Os(h,p)}const s=c.computed(()=>{if(e.editor){const{state:d}=e.editor,{tr:f}=d,{selection:p}=f;return i(p)}else return!1}),l=c.computed(()=>!t.value&&s.value),a=c.computed(()=>{const d=e.menu;return d.length>0?d:j1}),u=c.computed(()=>{const d=Jo.getState(e.editor.state);return!!(d!=null&&d.active)});return(d,f)=>n.editor&&!u.value?(c.openBlock(),c.createElementBlock("section",k2,[c.createVNode(c.unref(b2),{editor:n.editor,options:o.value},{default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[l.value?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:"arrow_back",onClick:r})):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(p,h)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:h},[p==="separator"?(c.openBlock(),c.createBlock(c.unref(It),{key:0,vertical:""})):typeof p=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Dd)(p)),{key:1,name:p,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(p),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}});function bg(n,e){const t=e==null?void 0:e.posAtCoords(n);if(!t)return;let o=wc(t.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function wc(n,e){return e.nodeDOM(n)||e.domAtPos(n).node}function vg(n,e){const t=bg(n,e);if(t&&t.nodeType===1){const o=e.docView,r=o.nearestDesc(t,!0);return!r||r===o?null:r.posBefore}return null}function C2(n,e){let t,o;const r=e.resolve(n.from).node().type.spec.group==="blockContent",i=e.resolve(n.to).node().type.spec.group==="blockContent",s=Math.min(n.$anchor.depth,n.$head.depth);if(r&&i){const l=n.$from.start(s-1),a=n.$to.end(s-1);t=e.resolve(l-1).pos,o=e.resolve(a+1).pos}else t=n.from,o=n.to;return{from:t,to:o}}function S2(n,e){const t=vg(n,e.view);return typeof t=="number"&&t>=0?{node:e.state.doc.nodeAt(t),pos:t}:{node:null,pos:t}}const Jl=new ae("sideMenu");class E2{constructor(){Ke(this,"hovered",!1);Ke(this,"coords",{left:0,top:0});Ke(this,"className","")}init(e){return this}apply({tr:e,oldState:t,newState:o}){return e.docChanged?this:this}setHover(e,t,o=""){this.hovered=e,this.coords=t,this.className=o}}class M2{constructor({editor:e,element:t,view:o,tippyOptions:r={},updateDelay:i=250}){Ke(this,"editor");Ke(this,"element");Ke(this,"view");Ke(this,"preventHide",!1);Ke(this,"tippy");Ke(this,"tippyOptions");Ke(this,"updateDelay");Ke(this,"updateDebounceTimer");Ke(this,"mousedownHandler",()=>{this.preventHide=!0});Ke(this,"onDragStart",e=>{this.hide()});Ke(this,"blurHandler",({event:e})=>{var t;e!=null&&e.relatedTarget&&((t=this.element.parentNode)!=null&&t.contains(e.relatedTarget))||this.hide()});Ke(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Ke(this,"handleDebouncedUpdate",(e,t)=>{const o=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,t)},this.updateDelay))});Ke(this,"updateHandler",(e,t,o,r)=>{var u,d;const{state:i,composing:s}=e,{coords:l}=Jl.getState(i),a=bg(l,e);vg(l,e),a&&(this.createTooltip(),(d=this.tippy)==null||d.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>a.getBoundingClientRect())}),this.show())});this.editor=e,this.element=t,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=e instanceof Element?e:"mount"in e?e.mount:null,o=!!(t!=null&&t.parentElement);this.tippy||!o||(this.tippy=Ao(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:o}=e,r=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,r,i,t)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,t;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)==null||t.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const T2=(n,e)=>{if(!n.dataTransfer)return;const{view:t}=e;t.dom.getBoundingClientRect();const o=Jl.getState(t.state),r={left:o.coords.left,top:o.coords.top},i=vg(r,t);if(i===null)return;const s=t.state.selection,l=t.state.doc;C2(s,l),t.dispatch(t.state.tr.setSelection(Q.create(t.state.doc,i))),t.dom.classList.add("is-dragging"),A2(t,i);const a=t.state.selection.content(),{dom:u,text:d}=t.serializeForClipboard(a);n.dataTransfer.clearData(),n.dataTransfer.setData("text/html",u.innerHTML),n.dataTransfer.setData("text/plain",d),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(li,0,0),t.dragging={slice:a,move:!0}},N2=(n,e)=>{const{view:t}=e;t.dom.classList.remove("is-dragging"),_C()};let li;function A2(n,e,t=e){const o=n.domAtPos(e).node.cloneNode(!0),r=n.domAtPos(e).node,i=(f,p)=>Array.prototype.indexOf.call(f.children,p),s=f=>{let p=f,h=p.parentElement;for(;h;){if(h===n.dom)return p;p=h,h=p.parentElement}return p};let l=-1,a=-1;e===t?(l=i(r,s(wc(e,n))),a=l):(l=i(r,s(wc(e+1,n))),a=i(r,s(wc(t-1,n))));for(let f=r.childElementCount-1;f>=0;f--)(f>l||f<a)&&o.removeChild(o.children[f]);_C(),li=o;const d=n.dom.className.split(" ").filter(f=>f!=="ProseMirror"&&f!=="yiitap-root"&&f!=="yiitap-editor").join(" ");li.className+=" yiitap-dragging-preview "+d,document.body.appendChild(li)}function _C(){li!==void 0&&(document.body.removeChild(li),li=void 0)}class O2{constructor(e){Ke(this,"options");Ke(this,"plugin");Ke(this,"sideMenuView");const t=new E2;this.options=e,this.plugin=new ue({key:Jl,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=bg(i,o),l=(s==null?void 0:s.className)||"",a=t.className;l.indexOf("o-table-wrapper-view")>=0&&a.indexOf("o-table-wrapper-view")>=0||(t.setHover(!0,i,l),o.dispatch(o.state.tr.setMeta(Jl,t)))}}},state:{init(o,r){return t.init(r)},apply(o,r,i,s){return t.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new M2({view:o,...e}),this.sideMenuView)})}dragstart(e){T2(e,this.options.editor)}dragend(e){N2(e,this.options.editor)}}const $2=c.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(n,{expose:e,slots:t}){const o=c.ref(null),r=c.ref(),i=l=>{var a;(a=r.value)==null||a.dragstart(l)},s=l=>{var a;(a=r.value)==null||a.dragend(l)};return c.onMounted(()=>{const{pluginKey:l,editor:a,updateDelay:u,tippyOptions:d}=n;r.value=new O2({updateDelay:u,editor:a,element:o.value,pluginKey:l,tippyOptions:d}),a.registerPlugin(r.value.plugin)}),c.onBeforeUnmount(()=>{const{pluginKey:l,editor:a}=n;a.unregisterPlugin(l)}),e({...n,dragstart:i,dragend:s}),()=>{var l;return c.h("div",{ref:o},(l=t.default)==null?void 0:l.call(t))}}}),R2={key:0,class:"o-side-menu"},B2={class:"container"},D2=c.defineComponent({__name:"OSideMenu",props:{editor:{type:Lt,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"},title:{type:Boolean,default:!1}},setup(n){const e=n,t=c.ref(null),o=c.ref(null),r=c.ref(0),i=c.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=c.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:a,deleteNode:l,view:{},innerDecorations:[],HTMLAttributes:{},add:e.add}));function l(){var m,g;const p=r.value,h=p+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:p,to:h})}function a(p){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...p}),!0})}function u({editor:p,transaction:h}){let m={left:0,top:0};const g=Jl.getState(e.editor.view.state);if(g){m=g.coords;const y=S2(m,p);y.node&&(e.title&&y.pos===0?o.value=null:(!e.title||y.pos>0)&&(o.value=y.node,r.value=y.pos))}}function d(p){var h;(h=t.value)==null||h.dragstart(p)}function f(p){var h;(h=t.value)==null||h.dragend(p)}return c.onMounted(()=>{var p;(p=e.editor)==null||p.on("transaction",u)}),(p,h)=>n.editor?(c.openBlock(),c.createElementBlock("section",R2,[c.createVNode(c.unref($2),{ref_key:"menu",ref:t,class:c.normalizeClass(["side-menu",n.menuClass]),editor:n.editor,"tippy-options":i.value},{default:c.withCtx(()=>[c.createElementVNode("section",B2,[o.value?(c.openBlock(),c.createBlock(c.unref(gC),c.normalizeProps(c.mergeProps({key:0},s.value)),null,16)):c.createCommentVNode("",!0),o.value?(c.openBlock(),c.createBlock(c.unref(yC),c.mergeProps({key:1},s.value,{onDragstart:d,onDragend:f}),null,16)):c.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):c.createCommentVNode("",!0)}});var Ru=(n,e)=>e.view.domAtPos(n).node.offsetParent!==null,_2=(n,e,t)=>{for(let o=n.depth;o>0;o-=1){const r=n.node(o),i=e(r),s=Ru(n.start(o),t);if(i&&s)return{pos:o>0?n.before(o):0,start:n.start(o),depth:o,node:r}}},Rv=(n,e)=>{const{state:t,view:o,extensionManager:r}=n,{schema:i,selection:s}=t,{empty:l,$anchor:a}=s,u=!!r.extensions.find(b=>b.name==="gapCursor");if(!l||a.parent.type!==i.nodes.detailsSummary||!u||e==="right"&&a.parentOffset!==a.parent.nodeSize-2)return!1;const d=Bi(b=>b.type===i.nodes.details)(s);if(!d)return!1;const f=Or(d.node,b=>b.type===i.nodes.detailsContent);if(!f.length||Ru(d.start+f[0].pos+1,n))return!1;const h=t.doc.resolve(d.pos+d.node.nodeSize),m=et.findFrom(h,1,!1);if(!m)return!1;const{tr:g}=t,y=new et(m);return g.setSelection(y),g.scrollIntoView(),o.dispatch(g),!0},IC=Be.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{persist:!1,openClassName:"is-open",HTMLAttributes:{}}},addAttributes(){return this.options.persist?{open:{default:!1,parseHTML:n=>n.hasAttribute("open"),renderHTML:({open:n})=>n?{open:""}:{}}}:[]},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:n}){return["details",pe(this.options.HTMLAttributes,n),0]},...vd({nodeName:"details",content:"block"}),addNodeView(){return({editor:n,getPos:e,node:t,HTMLAttributes:o})=>{const r=document.createElement("div"),i=pe(this.options.HTMLAttributes,o,{"data-type":this.name});Object.entries(i).forEach(([u,d])=>r.setAttribute(u,d));const s=document.createElement("button");s.type="button",r.append(s);const l=document.createElement("div");r.append(l);const a=u=>{if(u!==void 0)if(u){if(r.classList.contains(this.options.openClassName))return;r.classList.add(this.options.openClassName)}else{if(!r.classList.contains(this.options.openClassName))return;r.classList.remove(this.options.openClassName)}else r.classList.toggle(this.options.openClassName);const d=new Event("toggleDetailsContent"),f=l.querySelector(':scope > div[data-type="detailsContent"]');f==null||f.dispatchEvent(d)};return t.attrs.open&&setTimeout(()=>a()),s.addEventListener("click",()=>{if(a(),!this.options.persist){n.commands.focus(void 0,{scrollIntoView:!1});return}if(n.isEditable&&typeof e=="function"){const{from:u,to:d}=n.state.selection;n.chain().command(({tr:f})=>{const p=e();if(!p)return!1;const h=f.doc.nodeAt(p);return(h==null?void 0:h.type)!==this.type?!1:(f.setNodeMarkup(p,void 0,{open:!h.attrs.open}),!0)}).setTextSelection({from:u,to:d}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:r,contentDOM:l,ignoreMutation(u){return u.type==="selection"?!1:!r.contains(u.target)||r===u.target},update:u=>u.type!==this.type?!1:(u.attrs.open!==void 0&&a(u.attrs.open),!0)}}},addCommands(){return{setDetails:()=>({state:n,chain:e})=>{var t;const{schema:o,selection:r}=n,{$from:i,$to:s}=r,l=i.blockRange(s);if(!l)return!1;const a=n.doc.slice(l.start,l.end);if(!o.nodes.detailsContent.contentMatch.matchFragment(a.content))return!1;const d=((t=a.toJSON())==null?void 0:t.content)||[];return e().insertContentAt({from:l.start,to:l.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:d}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:n,chain:e})=>{const{selection:t,schema:o}=n,r=Bi(b=>b.type===this.type)(t);if(!r)return!1;const i=Or(r.node,b=>b.type===o.nodes.detailsSummary),s=Or(r.node,b=>b.type===o.nodes.detailsContent);if(!i.length||!s.length)return!1;const l=i[0],a=s[0],u=r.pos,d=n.doc.resolve(u),f=u+r.node.nodeSize,p={from:u,to:f},h=a.node.content.toJSON()||[],m=d.parent.type.contentMatch.defaultType,y=[m==null?void 0:m.create(null,l.node.content).toJSON(),...h];return e().insertContentAt(p,y).setTextSelection(u+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{const{schema:n,selection:e}=this.editor.state,{empty:t,$anchor:o}=e;return!t||o.parent.type!==n.nodes.detailsSummary?!1:o.parentOffset!==0?this.editor.commands.command(({tr:r})=>{const i=o.pos-1,s=o.pos;return r.delete(i,s),!0}):this.editor.commands.unsetDetails()},Enter:({editor:n})=>{const{state:e,view:t}=n,{schema:o,selection:r}=e,{$head:i}=r;if(i.parent.type!==o.nodes.detailsSummary)return!1;const s=Ru(i.after()+1,n),l=s?e.doc.nodeAt(i.after()):i.node(-2);if(!l)return!1;const a=s?0:i.indexAfter(-1),u=xm(l.contentMatchAt(a));if(!u||!l.canReplaceWith(a,a,u))return!1;const d=u.createAndFill();if(!d)return!1;const f=s?i.after()+1:i.after(-1),p=e.tr.replaceWith(f,f,d),h=p.doc.resolve(f),m=se.near(h,1);return p.setSelection(m),p.scrollIntoView(),t.dispatch(p),!0},ArrowRight:({editor:n})=>Rv(n,"right"),ArrowDown:({editor:n})=>Rv(n,"down")}},addProseMirrorPlugins(){return[new ue({key:new ae("detailsSelection"),appendTransaction:(n,e,t)=>{const{editor:o,type:r}=this;if(o.view.composing||!n.some(b=>b.selectionSet)||!e.selection.empty||!t.selection.empty||!sx(t,r.name))return;const{$from:a}=t.selection;if(Ru(a.pos,o))return;const d=_2(a,b=>b.type===r,o);if(!d)return;const f=Or(d.node,b=>b.type===t.schema.nodes.detailsSummary);if(!f.length)return;const p=f[0],m=(e.selection.from<t.selection.from?"forward":"backward")==="forward"?d.start+p.pos:d.pos+p.pos+p.node.nodeSize,g=U.create(t.doc,m);return t.tr.setSelection(g)}})]}}),LC=Be.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:n}){return["div",pe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:n})=>{const e=document.createElement("div"),t=pe(this.options.HTMLAttributes,n,{"data-type":this.name,hidden:"hidden"});return Object.entries(t).forEach(([o,r])=>e.setAttribute(o,r)),e.addEventListener("toggleDetailsContent",()=>{e.toggleAttribute("hidden")}),{dom:e,contentDOM:e,ignoreMutation(o){return o.type==="selection"?!1:!e.contains(o.target)||e===o.target},update:o=>o.type===this.type}}},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{state:e,view:t}=n,{selection:o}=e,{$from:r,empty:i}=o,s=Bi(O=>O.type===this.type)(o);if(!i||!s||!s.node.childCount)return!1;const l=r.index(s.depth),{childCount:a}=s.node;if(!(a===l+1))return!1;const d=s.node.type.contentMatch.defaultType,f=d==null?void 0:d.createAndFill();if(!f)return!1;const p=e.doc.resolve(s.pos+1),h=a-1,m=s.node.child(h),g=p.posAtIndex(h,s.depth);if(!m.eq(f))return!1;const b=r.node(-3);if(!b)return!1;const v=r.indexAfter(-3),k=xm(b.contentMatchAt(v));if(!k||!b.canReplaceWith(v,v,k))return!1;const w=k.createAndFill();if(!w)return!1;const{tr:x}=e,C=r.after(-2);x.replaceWith(C,C,w);const S=x.doc.resolve(C),T=se.near(S,1);x.setSelection(T);const N=g,$=g+m.nodeSize;return x.delete(N,$),x.scrollIntoView(),t.dispatch(x),!0}}},...vd({nodeName:"detailsContent"})}),PC=Be.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:n}){return["summary",pe(this.options.HTMLAttributes,n),0]},...vd({nodeName:"detailsSummary",content:"inline"})}),Id=Be.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",pe(this.options.HTMLAttributes,n),0]}}),Ld=Be.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",pe(this.options.HTMLAttributes,n),0]}}),Bu=Be.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",pe(this.options.HTMLAttributes,n),0]}});function lh(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Bv(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[k,w]=lh(o,b);u.style.setProperty(k,w)}u=u.nextSibling}else{const k=document.createElement("col"),[w,x]=lh(o,b);k.style.setProperty(w,x),e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var I2=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Bv(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Bv(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function L2(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let f=0,p=0;f<l.childCount;f+=1){const{colspan:h,colwidth:m}=l.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?o:m&&m[g];r+=y||e,y||(i=!1);const[b,v]=lh(e,y);s.push(["col",{style:`${b}: ${v}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function Dv(n,e){return n.createAndFill()}function P2(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function VC(n,e,t,o,r){const i=P2(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=Dv(i.cell);if(d&&l.push(d),o){const f=Dv(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function V2(n){return n instanceof ze}var Ga=({editor:n})=>{const{selection:e}=n.state;if(!V2(e))return!1;let t=0;const o=Cm(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},z2="";function H2(n){return(n||"").replace(/\s+/g," ").trim()}function F2(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:z2;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(m=>{const g=[];m.content&&m.content.forEach(y=>{let b="";y.content&&Array.isArray(y.content)&&y.content.length>1?b=y.content.map(x=>e.renderChildren(x)).join(r):b=y.content?e.renderChildren(y.content):"";const v=H2(b),k=y.type==="tableHeader";g.push({text:v,isHeader:k})}),i.push(g)});const s=i.reduce((m,g)=>Math.max(m,g.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(m=>{var g;for(let y=0;y<s;y+=1){const v=(((g=m[y])==null?void 0:g.text)||"").length;v>l[y]&&(l[y]=v),l[y]<3&&(l[y]=3)}});const a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),u=i[0],d=u.some(m=>m.isHeader);let f=`
202
+ `;const p=new Array(s).fill(0).map((m,g)=>d&&u[g]&&u[g].text||"");return f+=`| ${p.map((m,g)=>a(m,l[g])).join(" | ")} |
203
+ `,f+=`| ${l.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
204
+ `,(d?i.slice(1):i).forEach(m=>{f+=`| ${new Array(s).fill(0).map((g,y)=>a(m[y]&&m[y].text||"",l[y])).join(" | ")} |
205
+ `}),f}var j2=F2,Pd=Be.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:I2,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=L2(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",pe(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>j2(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=VC(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(U.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>Oz(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>$z(n,e),deleteColumn:()=>({state:n,dispatch:e})=>Bz(n,e),addRowBefore:()=>({state:n,dispatch:e})=>_z(n,e),addRowAfter:()=>({state:n,dispatch:e})=>Iz(n,e),deleteRow:()=>({state:n,dispatch:e})=>Pz(n,e),deleteTable:()=>({state:n,dispatch:e})=>Uz(n,e),mergeCells:()=>({state:n,dispatch:e})=>kv(n,e),splitCell:()=>({state:n,dispatch:e})=>xv(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Kl("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Kl("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>jz(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>kv(n,e)?!0:xv(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>Hz(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>Sv(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Sv(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&OC(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=ze.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ga,"Mod-Backspace":Ga,Delete:Ga,"Mod-Delete":Ga}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[t2({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],d2({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:_e(oe(n,"tableRole",e))}}});be.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(Pd.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Id.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Ld.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Bu.configure(this.options.tableRow)),n}});var W2=20,zC=(n,e=0)=>{const t=[];return!n.children.length||e>W2||Array.from(n.children).forEach(o=>{o.tagName==="SPAN"?t.push(o):o.children.length&&t.push(...zC(o,e+1))}),t},U2=n=>{if(!n.children.length)return;const e=zC(n);e&&e.forEach(t=>{var o,r;const i=t.getAttribute("style"),s=(r=(o=t.parentElement)==null?void 0:o.closest("span"))==null?void 0:r.getAttribute("style");t.setAttribute("style",`${s};${i}`)})},wg=no.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&U2(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",pe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,o)=>{if(t.isTextblock)return!0;t.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||n.removeMark(o,o+t.nodeSize,this.type)}),!0}}}}),kg=be.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),xg=be.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Cg=be.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),q2=be.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),K2=be.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});be.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(kg.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(xg.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Cg.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(q2.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(K2.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(wg.configure(this.options.textStyle)),n}});const Ei=Math.floor,J2=Math.abs,$r=(n,e)=>n<e?n:e,Cs=(n,e)=>n>e?n:e,G2=n=>n!==0?n<0:1/n<0,X2=64,Gl=128,Y2=1<<29,_v=63,kl=127,Q2=2147483647,Iv=Number.MAX_SAFE_INTEGER,Lv=Number.MIN_SAFE_INTEGER,Z2=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&Ei(n)===n),eH=()=>new Set,Sg=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},HC=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},tH=(n,e)=>{const t=new Array(n);for(let o=0;o<n;o++)t[o]=e(o,t);return t},Vd=Array.isArray,FC=String.fromCharCode,nH=n=>n.toLowerCase(),oH=/^\s*/g,rH=n=>n.replace(oH,""),iH=/([A-Z])/g,Pv=(n,e)=>rH(n.replace(iH,t=>`${e}${nH(t)}`)),sH=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,o=new Uint8Array(t);for(let r=0;r<t;r++)o[r]=e.codePointAt(r);return o},Xl=typeof TextEncoder<"u"?new TextEncoder:null,lH=n=>Xl.encode(n),aH=Xl?lH:sH;let Ff=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ff&&Ff.decode(new Uint8Array).length===1&&(Ff=null);const cH=(n,e)=>tH(e,()=>n).join("");class uH{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const dH=()=>new uH,fH=n=>{const e=dH();return n(e),hH(e)},pH=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},hH=n=>{const e=new Uint8Array(pH(n));let t=0;for(let o=0;o<n.bufs.length;o++){const r=n.bufs[o];e.set(r,t),t+=r.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},mH=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(Cs(t,e)*2),n.cpos=0)},$t=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},Yl=(n,e)=>{for(;e>kl;)$t(n,Gl|kl&e),e=Ei(e/128);$t(n,kl&e)},gH=(n,e)=>{const t=G2(e);for(t&&(e=-e),$t(n,(e>_v?Gl:0)|(t?X2:0)|_v&e),e=Ei(e/64);e>0;)$t(n,(e>kl?Gl:0)|kl&e),e=Ei(e/128)},ah=new Uint8Array(3e4),yH=ah.length/3,bH=(n,e)=>{if(e.length<yH){const t=Xl.encodeInto(e,ah).written||0;Yl(n,t);for(let o=0;o<t;o++)$t(n,ah[o])}else jC(n,aH(e))},vH=(n,e)=>{const t=unescape(encodeURIComponent(e)),o=t.length;Yl(n,o);for(let r=0;r<o;r++)$t(n,t.codePointAt(r))},Vv=Xl&&Xl.encodeInto?bH:vH,wH=(n,e)=>{const t=n.cbuf.length,o=n.cpos,r=$r(t-o,e.length),i=e.length-r;n.cbuf.set(e.subarray(0,r),o),n.cpos+=r,i>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(Cs(t*2,i)),n.cbuf.set(e.subarray(r)),n.cpos=i)},jC=(n,e)=>{Yl(n,e.byteLength),wH(n,e)},Eg=(n,e)=>{mH(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},kH=(n,e)=>Eg(n,4).setFloat32(0,e,!1),xH=(n,e)=>Eg(n,8).setFloat64(0,e,!1),CH=(n,e)=>Eg(n,8).setBigInt64(0,e,!1),zv=new DataView(new ArrayBuffer(4)),SH=n=>(zv.setFloat32(0,n),zv.getFloat32(0)===n),ch=(n,e)=>{switch(typeof e){case"string":$t(n,119),Vv(n,e);break;case"number":Z2(e)&&J2(e)<=Q2?($t(n,125),gH(n,e)):SH(e)?($t(n,124),kH(n,e)):($t(n,123),xH(n,e));break;case"bigint":$t(n,122),CH(n,e);break;case"object":if(e===null)$t(n,126);else if(Vd(e)){$t(n,117),Yl(n,e.length);for(let t=0;t<e.length;t++)ch(n,e[t])}else if(e instanceof Uint8Array)$t(n,116),jC(n,e);else{$t(n,118);const t=Object.keys(e);Yl(n,t.length);for(let o=0;o<t.length;o++){const r=t[o];Vv(n,r),ch(n,e[r])}}break;case"boolean":$t(n,e?120:121);break;default:$t(n,127)}},zd=n=>new Error(n),WC=()=>{throw zd("Method unimplemented")},ka=()=>{throw zd("Unexpected case")},kc=()=>new Map,UC=(n,e,t)=>{let o=n.get(e);return o===void 0&&n.set(e,o=t()),o},Ql=Symbol("Equality"),EH=(n,e)=>{var t;return n===e||!!((t=n==null?void 0:n[Ql])!=null&&t.call(n,e))||!1},MH=n=>typeof n=="object",qC=Object.keys,Hv=n=>qC(n).length,xa=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},KC=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),xc=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[Ql]!=null)return n[Ql](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!xc(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(Hv(n)!==Hv(e))return!1;for(const t in n)if(!KC(n,t)||!xc(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!xc(n[t],e[t]))return!1;break;default:return!1}return!0},TH=(n,e)=>e.includes(n),NH=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},AH=/[\uD800-\uDBFF]/,OH=/[\uDC00-\uDFFF]/,$H=(n,e)=>{let t=0,o=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;for(t>0&&AH.test(n[t-1])&&t--;o+t<n.length&&o+t<e.length&&n[n.length-o-1]===e[e.length-o-1];)o++;return o>0&&OH.test(n[n.length-o])&&o--,{index:t,remove:n.length-t-o,insert:e.slice(t,e.length-o)}},RH=$H,BH=Math.random,DH=n=>n[Ei(BH()*n.length)],Fv=n=>n===void 0?null:n;class _H{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let JC=new _H,IH=!0;try{typeof localStorage<"u"&&localStorage&&(JC=localStorage,IH=!1)}catch{}const LH=JC,Ss=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",GC=typeof window<"u"&&typeof document<"u"&&!Ss;let fo;const PH=()=>{if(fo===void 0)if(Ss){fo=kc();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const o=n[t];o[0]==="-"?(e!==null&&fo.set(e,""),e=o):e!==null&&(fo.set(e,o),e=null)}e!==null&&fo.set(e,"")}else typeof location=="object"?(fo=kc(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");fo.set(`--${Pv(e,"-")}`,t),fo.set(`-${Pv(e,"-")}`,t)}})):fo=kc();return fo},uh=n=>PH().has(n),dh=n=>Fv(Ss?process.env[n.toUpperCase().replaceAll("-","_")]:LH.getItem(n)),XC=n=>uh("--"+n)||dh(n)!==null,VH=XC("production"),zH=Ss&&TH(process.env.FORCE_COLOR,["true","1","2"]);zH||!uh("--no-colors")&&!XC("no-color")&&(!Ss||process.stdout.isTTY)&&(!Ss||uh("--color")||dh("COLORTERM")!==null||(dh("TERM")||"").includes("color"));const HH=n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=FC(n[t]);return btoa(e)},FH=n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),jH=GC?HH:FH,WH=n=>fH(e=>ch(e,n)),jv=n=>n.next()>=.5,jf=(n,e,t)=>Ei(n.next()*(t+1-e)+e),YC=(n,e,t)=>Ei(n.next()*(t+1-e)+e),Mg=(n,e,t)=>YC(n,e,t),UH=n=>FC(Mg(n,97,122)),qH=(n,e=0,t=20)=>{const o=Mg(n,e,t);let r="";for(let i=0;i<o;i++)r+=UH(n);return r},Wf=(n,e)=>e[Mg(n,0,e.length-1)],KH=Symbol("0schema");class JH{constructor(){this._rerrs=[]}extend(e,t,o,r=null){this._rerrs.push({path:e,expected:t,has:o,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const o=this._rerrs[t];e.push(cH(" ",(this._rerrs.length-t)*2)+`${o.path!=null?`[${o.path}] `:""}${o.has} doesn't match ${o.expected}. ${o.message}`)}return e.join(`
206
+ `)}}const fh=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[Ql]?EH(n,e):Vd(n)?Sg(n,t=>HC(e,o=>fh(t,o))):MH(n)?xa(n,(t,o)=>fh(t,e[o])):!1;class Gt{extends(e){let[t,o]=[this.shape,e.shape];return this.constructor._dilutes&&([o,t]=[t,o]),fh(t,o)}equals(e){return this.constructor===e.constructor&&xc(this.shape,e.shape)}[KH](){return!0}[Ql](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){WC()}get nullable(){return Bs(this,Ud)}get optional(){return new eS(this)}cast(e){return Wv(e,this),e}expect(e){return Wv(e,this),e}}Ke(Gt,"_dilutes",!1);class Tg extends Gt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const o=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),o}}const mt=(n,e=null)=>new Tg(n,e);mt(Tg);class Ng extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape(e);return!o&&(t==null||t.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),o}}const Et=n=>new Ng(n);mt(Ng);class Hd extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape.some(r=>r===e);return!o&&(t==null||t.extend(null,this.shape.join(" | "),e.toString())),o}}const Fd=(...n)=>new Hd(n),QC=mt(Hd),GH=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),ZC=n=>{if(Es.check(n))return[GH(n)];if(QC.check(n))return n.shape.map(e=>e+"");if(cS.check(n))return["[+-]?\\d+.?\\d*"];if(uS.check(n))return[".*"];if(_u.check(n))return n.shape.map(ZC).flat(1);ka()};class XH extends Gt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(ZC).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const o=this._r.exec(e)!=null;return!o&&(t==null||t.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),o}}mt(XH);const YH=Symbol("optional");class eS extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=e===void 0||this.shape.check(e);return!o&&(t==null||t.extend(null,"undefined (optional)","()")),o}get[YH](){return!0}}const QH=mt(eS);class ZH extends Gt{check(e,t){return t==null||t.extend(null,"never",typeof e),!1}}mt(ZH);const nd=class nd extends Gt{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}get partial(){return new nd(this.shape,!0)}check(e,t){return e==null?(t==null||t.extend(null,"object","null"),!1):xa(this.shape,(o,r)=>{const i=this._isPartial&&!KC(e,r)||o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),o.toString(),typeof e[r],"Object property does not match")),i})}};Ke(nd,"_dilutes",!0);let Du=nd;const eF=n=>new Du(n),tF=mt(Du),nF=Et(n=>n!=null&&(n.constructor===Object||n.constructor==null));class tS extends Gt{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&xa(e,(o,r)=>{const i=this.shape.keys.check(r,t);return!i&&(t==null||t.extend(r+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value")),i&&this.shape.values.check(o,t)})}}const nS=(n,e)=>new tS(n,e),oF=mt(tS);class oS extends Gt{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&xa(this.shape,(o,r)=>{const i=o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),"Tuple",typeof o)),i})}}const rF=(...n)=>new oS(n);mt(oS);class rS extends Gt{constructor(e){super(),this.shape=e.length===1?e[0]:new jd(e)}check(e,t){const o=Vd(e)&&Sg(e,r=>this.shape.check(r));return!o&&(t==null||t.extend(null,"Array","")),o}}const iS=(...n)=>new rS(n),iF=mt(rS),sF=Et(n=>Vd(n));class sS extends Gt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const o=e instanceof this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),o}}const lF=(n,e=null)=>new sS(n,e);mt(sS);const aF=lF(Gt);class cF extends Gt{constructor(e){super(),this.len=e.length-1,this.args=rF(...e.slice(-1)),this.res=e[this.len]}check(e,t){const o=e.constructor===Function&&e.length<=this.len;return!o&&(t==null||t.extend(null,"function",typeof e)),o}}const uF=mt(cF),dF=Et(n=>typeof n=="function");class fF extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=Sg(this.shape,r=>r.check(e,t));return!o&&(t==null||t.extend(null,"Intersectinon",typeof e)),o}}mt(fF,n=>n.shape.length>0);class jd extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=HC(this.shape,r=>r.check(e,t));return t==null||t.extend(null,"Union",typeof e),o}}Ke(jd,"_dilutes",!0);const Bs=(...n)=>n.findIndex(e=>_u.check(e))>=0?Bs(...n.map(e=>Zl(e)).map(e=>_u.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new jd(n),_u=mt(jd),lS=()=>!0,Iu=Et(lS),pF=mt(Ng,n=>n.shape===lS),Ag=Et(n=>typeof n=="bigint"),hF=Et(n=>n===Ag),aS=Et(n=>typeof n=="symbol");Et(n=>n===aS);const as=Et(n=>typeof n=="number"),cS=Et(n=>n===as),Es=Et(n=>typeof n=="string"),uS=Et(n=>n===Es),Wd=Et(n=>typeof n=="boolean"),mF=Et(n=>n===Wd),dS=Fd(void 0);mt(Hd,n=>n.shape.length===1&&n.shape[0]===void 0);Fd(void 0);const Ud=Fd(null),gF=mt(Hd,n=>n.shape.length===1&&n.shape[0]===null);mt(Uint8Array);mt(Tg,n=>n.shape===Uint8Array);const yF=Bs(as,Es,Ud,dS,Ag,Wd,aS);(()=>{const n=iS(Iu),e=nS(Es,Iu),t=Bs(as,Es,Ud,Wd,n,e);return n.shape=t,e.shape.values=t,t})();const Zl=n=>{if(aF.check(n))return n;if(nF.check(n)){const e={};for(const t in n)e[t]=Zl(n[t]);return eF(e)}else{if(sF.check(n))return Bs(...n.map(Zl));if(yF.check(n))return Fd(n);if(dF.check(n))return mt(n)}ka()},Wv=VH?()=>{}:(n,e)=>{const t=new JH;if(!e.check(n,t))throw zd(`Expected value to be of type ${e.constructor.name}.
207
+ ${t.toString()}`)};class bF{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Zl(e),h:t}),this}else(e){return this.if(Iu,e)}done(){return(e,t)=>{for(let o=0;o<this.patterns.length;o++){const r=this.patterns[o];if(r.if.check(e))return r.h(e,t)}throw zd("Unhandled pattern")}}}const vF=n=>new bF(n),fS=vF(Iu).if(cS,(n,e)=>jf(e,Lv,Iv)).if(uS,(n,e)=>qH(e)).if(mF,(n,e)=>jv(e)).if(hF,(n,e)=>BigInt(jf(e,Lv,Iv))).if(_u,(n,e)=>ji(e,Wf(e,n.shape))).if(tF,(n,e)=>{const t={};for(const o in n.shape){let r=n.shape[o];if(QH.check(r)){if(jv(e))continue;r=r.shape}t[o]=fS(r,e)}return t}).if(iF,(n,e)=>{const t=[],o=YC(e,0,42);for(let r=0;r<o;r++)t.push(ji(e,n.shape));return t}).if(QC,(n,e)=>Wf(e,n.shape)).if(gF,(n,e)=>null).if(uF,(n,e)=>{const t=ji(e,n.res);return()=>t}).if(pF,(n,e)=>ji(e,Wf(e,[as,Es,Ud,dS,Ag,Wd,iS(as),nS(Bs("a","b","c"),as)]))).if(oF,(n,e)=>{const t={},o=jf(e,0,3);for(let r=0;r<o;r++){const i=ji(e,n.shape.keys),s=ji(e,n.shape.values);t[i]=s}return t}).done(),ji=(n,e)=>fS(Zl(e),n),Ca=typeof document<"u"?document:{};Et(n=>n.nodeType===CF);typeof DOMParser<"u"&&new DOMParser;Et(n=>n.nodeType===wF);Et(n=>n.nodeType===kF);const wF=Ca.ELEMENT_NODE,kF=Ca.TEXT_NODE,xF=Ca.DOCUMENT_NODE,CF=Ca.DOCUMENT_FRAGMENT_NODE;Et(n=>n.nodeType===xF);const SF=n=>class{constructor(t){this._=t}destroy(){n(this._)}},EF=SF(clearTimeout),Og=(n,e)=>new EF(setTimeout(e,n)),xo=(n,e)=>n>>>e|n<<32-e,MF=n=>xo(n,2)^xo(n,13)^xo(n,22),TF=n=>xo(n,6)^xo(n,11)^xo(n,25),NF=n=>xo(n,7)^xo(n,18)^n>>>3,AF=n=>xo(n,17)^xo(n,19)^n>>>10,OF=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$F=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class RF{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set($F),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,t=this._W;for(let f=16;f<64;f++)t[f]=AF(t[f-2])+t[f-7]+NF(t[f-15])+t[f-16];let o=e[0],r=e[1],i=e[2],s=e[3],l=e[4],a=e[5],u=e[6],d=e[7];for(let f=0,p,h;f<64;f++)p=d+TF(l)+(l&a^~l&u)+OF[f]+t[f]>>>0,h=MF(o)+(o&r^o&i^r&i)>>>0,d=u,u=a,a=l,l=s+p>>>0,s=i,i=r,r=o,o=p+h>>>0;e[0]+=o,e[1]+=r,e[2]+=i,e[3]+=s,e[4]+=l,e[5]+=a,e[6]+=u,e[7]+=d}digest(e){let t=0;for(;t+56<=e.length;){let s=0;for(;s<16&&t+3<e.length;s++)this._W[s]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!==0){for(this._W.fill(0,s,16);t<e.length;)this._W[s]|=e[t]<<(3-t%4)*8,t++;this._W[s]|=Gl<<(3-t%4)*8}this._updateHash()}const o=t%64!==0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let s=3;s>=0&&t<e.length;s--)this._W[r]|=e[t++]<<s*8;o||(this._W[r-(t%4===0?0:1)]|=Gl<<(3-t%4)*8),this._W[14]=e.byteLength/Y2,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let l=0;l<4;l++)i[s*4+l]=this._H[s]>>>(3-l)*8;return i}}const BF=n=>new RF().digest(n),Je=new ae("y-sync"),Xo=new ae("y-undo"),Xa=new ae("yjs-cursor"),DF=n=>{for(let t=6;t<n.length;t++)n[t%6]=n[t%6]^n[t];return n.slice(0,6)},_F=n=>jH(DF(BF(WH(n)))),Lu=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!re.isDeleted(e.ds,n.id),IF=[{light:"#ecd44433",dark:"#ecd444"}],LF=(n,e,t)=>{if(!n.has(t)){if(n.size<e.length){const o=eH();n.forEach(r=>o.add(r)),e=e.filter(r=>!o.has(r))}n.set(t,DH(e))}return n.get(t)},PF=(n,{colors:e=IF,colorMapping:t=new Map,permanentUserData:o=null,onFirstRender:r=()=>{},mapping:i}={})=>{let s=!1;const l=new HF(n,i),a=new ue({props:{editable:u=>{const d=Je.getState(u);return d.snapshot==null&&d.prevSnapshot==null}},key:Je,state:{init:(u,d)=>({type:n,doc:n.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:o}),apply:(u,d)=>{const f=u.getMeta(Je);if(f!==void 0){d=Object.assign({},d);for(const p in f)d[p]=f[p]}return d.addToHistory=u.getMeta("addToHistory")!==!1,d.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,d.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,l.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&Og(0,()=>{l.prosemirrorView!=null&&(f.restore==null?l._renderSnapshot(f.snapshot,f.prevSnapshot,d):(l._renderSnapshot(f.snapshot,f.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:u=>(l.initView(u),i==null&&l._forceRerender(),r(),{update:()=>{const d=a.getState(u.state);if(d.snapshot==null&&d.prevSnapshot==null&&(s||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(s=!0,d.addToHistory===!1&&!d.isChangeOrigin){const f=Xo.getState(u.state),p=f&&f.undoManager;p&&p.stopCapturing()}l.mux(()=>{d.doc.transact(f=>{f.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(u.state.doc)},Je)})}},destroy:()=>{l.destroy()}})});return a},VF=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")n.setSelection(new on(n.doc));else if(e.type==="node"){const o=ai(t.doc,t.type,e.anchor,t.mapping);n.setSelection(zF(n,o))}else{const o=ai(t.doc,t.type,e.anchor,t.mapping),r=ai(t.doc,t.type,e.head,t.mapping);o!==null&&r!==null&&n.setSelection(U.between(n.doc.resolve(o),n.doc.resolve(r)))}},zF=(n,e)=>{const t=n.doc.resolve(e);return t.nodeAfter?Q.create(n.doc,e):U.near(t)},ph=(n,e)=>({type:e.selection.jsonID,anchor:ta(e.selection.anchor,n.type,n.mapping),head:ta(e.selection.head,n.type,n.mapping)});class HF{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=NH(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=ph(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(GC&&this._domSelectionInView===null&&(Og(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);const r=t.getBoundingClientRect(),i=Ca.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||i.clientWidth||0)&&r.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,t){t||(t=re.createSnapshot(re.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Je,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(o=>Cc(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(_.from(e),0,0));t.setMeta(Je,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,t=this.type.toArray().map(r=>Cc(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(_.from(t),0,0));if(e){const r=$r(Cs(e.anchor,0),o.doc.content.size),i=$r(Cs(e.head,0),o.doc.content.size);o.setSelection(U.create(o.doc,r,i))}this.prosemirrorView.dispatch(o.setMeta(Je,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,o){let r=this.doc,i=this.type;if(e||(e=re.snapshot(this.doc)),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&ka(),r=new re.Doc({gc:!1}),re.applyUpdateV2(r,t),t=re.snapshot(r),re.applyUpdateV2(r,e),e=re.snapshot(r),i._item===null){const s=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);i=r.getXmlFragment(s)}else{const s=r.store.clients.get(i._item.id.client)??[],l=re.findIndexSS(s,i._item.id.clock);i=s[l].content.type}this.mapping.clear(),this.mux(()=>{r.transact(s=>{const l=o.permanentUserData;l&&l.dss.forEach(f=>{re.iterateDeletedStructs(s,f,p=>{})});const a=(f,p)=>{const h=f==="added"?l.getUserByClientId(p.client):l.getUserByDeletedId(p);return{user:h,type:f,color:LF(o.colorMapping,o.colors,h)}},u=re.typeListToArraySnapshot(i,new re.Snapshot(t.ds,e.sv)).map(f=>!f._item.deleted||Lu(f._item,e)||Lu(f._item,t)?Cc(f,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,a):null).filter(f=>f!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(_.from(u),0,0));this.prosemirrorView.dispatch(d.setMeta(Je,{isChangeOrigin:!0}))},Je)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;const o=Je.getState(this.prosemirrorView.state);if(e.length===0||o.snapshot!=null||o.prevSnapshot!=null){this.renderSnapshot(o.snapshot,o.prevSnapshot);return}this.mux(()=>{const r=(l,a)=>this.mapping.delete(a);re.iterateDeletedStructs(t,t.deleteSet,l=>{if(l.constructor===re.Item){const a=l.content.type;a&&this.mapping.delete(a)}}),t.changed.forEach(r),t.changedParentTypes.forEach(r);const i=this.type.toArray().map(l=>pS(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(_.from(i),0,0));VF(s,this.beforeTransactionSelection,this),s=s.setMeta(Je,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof re.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{mh(this.doc,this.type,e,this),this.beforeTransactionSelection=ph(this,this.prosemirrorView.state)},Je)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const pS=(n,e,t,o,r,i)=>{const s=t.mapping.get(n);if(s===void 0){if(n instanceof re.XmlElement)return Cc(n,e,t,o,r,i);throw WC()}return s},Cc=(n,e,t,o,r,i)=>{const s=[],l=a=>{var u,d;if(a instanceof re.XmlElement){const f=pS(a,e,t,o,r,i);f!==null&&s.push(f)}else{const f=(d=(u=a._item.right)==null?void 0:u.content)==null?void 0:d.type;f instanceof re.Text&&!f._item.deleted&&f._item.id.client===f.doc.clientID&&(a.applyDelta([{retain:a.length},...f.toDelta()]),f.doc.transact(h=>{f._item.delete(h)}));const p=FF(a,e,t,o,r,i);p!==null&&p.forEach(h=>{h!==null&&s.push(h)})}};o===void 0||r===void 0?n.toArray().forEach(l):re.typeListToArraySnapshot(n,new re.Snapshot(r.ds,o.sv)).forEach(l);try{const a=n.getAttributes(o);o!==void 0&&(Lu(n._item,o)?Lu(n._item,r)||(a.ychange=i?i("added",n._item.id):{type:"added"}):a.ychange=i?i("removed",n._item.id):{type:"removed"});const u=e.node(n.nodeName,a,s);return t.mapping.set(n,u),u}catch{return n.doc.transact(u=>{n._item.delete(u)},Je),t.mapping.delete(n),null}},FF=(n,e,t,o,r,i)=>{const s=[],l=n.toDelta(o,r,i);try{for(let a=0;a<l.length;a++){const u=l[a];s.push(e.text(u.insert,JF(u.attributes,e)))}}catch{return n.doc.transact(u=>{n._item.delete(u)},Je),null}return s},jF=(n,e)=>{const t=new re.XmlText,o=n.map(r=>({insert:r.text,attributes:mS(r.marks,e)}));return t.applyDelta(o),e.mapping.set(t,n),t},WF=(n,e)=>{const t=new re.XmlElement(n.type.name);for(const o in n.attrs){const r=n.attrs[o];r!==null&&o!=="ychange"&&t.setAttribute(o,r)}return t.insert(0,qd(n).map(o=>hh(o,e))),e.mapping.set(t,n),t},hh=(n,e)=>n instanceof Array?jF(n,e):WF(n,e),Uv=n=>typeof n=="object"&&n!==null,$g=(n,e)=>{const t=Object.keys(n).filter(r=>n[r]!==null);let o=t.length===Object.keys(e).filter(r=>e[r]!==null).length;for(let r=0;r<t.length&&o;r++){const i=t[r],s=n[i],l=e[i];o=i==="ychange"||s===l||Uv(s)&&Uv(l)&&$g(s,l)}return o},qd=n=>{const e=n.content.content,t=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.isText){const i=[];for(let s=e[o];o<e.length&&s.isText;s=e[++o])i.push(s);o--,t.push(i)}else t.push(r)}return t},hS=(n,e)=>{const t=n.toDelta();return t.length===e.length&&t.every((o,r)=>o.insert===e[r].text&&qC(o.attributes||{}).length===e[r].marks.length&&xa(o.attributes,(i,s)=>{var d;const l=Rg(s),a=e[r].marks;return a.find(f=>f.type.name===l)?$g(i,(d=a.find(f=>f.type.name===l))==null?void 0:d.attrs):!1}))},ea=(n,e)=>{if(n instanceof re.XmlElement&&!(e instanceof Array)&&gh(n,e)){const t=qd(e);return n._length===t.length&&$g(n.getAttributes(),e.attrs)&&n.toArray().every((o,r)=>ea(o,t[r]))}return n instanceof re.XmlText&&e instanceof Array&&hS(n,e)},Pu=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,o)=>e[o]===t),qv=(n,e,t)=>{const o=n.toArray(),r=qd(e),i=r.length,s=o.length,l=$r(s,i);let a=0,u=0,d=!1;for(;a<l;a++){const f=o[a],p=r[a];if(Pu(t.mapping.get(f),p))d=!0;else if(!ea(f,p))break}for(;a+u<l;u++){const f=o[s-u-1],p=r[i-u-1];if(Pu(t.mapping.get(f),p))d=!0;else if(!ea(f,p))break}return{equalityFactor:a+u,foundMappedChild:d}},UF=n=>{let e="",t=n._start;const o={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof re.ContentString?e+=t.content.str:t.content instanceof re.ContentFormat&&(o[t.content.key]=null)),t=t.right;return{str:e,nAttrs:o}},qF=(n,e,t)=>{t.mapping.set(n,e);const{nAttrs:o,str:r}=UF(n),i=e.map(u=>({insert:u.text,attributes:Object.assign({},o,mS(u.marks,t))})),{insert:s,remove:l,index:a}=RH(r,i.map(u=>u.insert).join(""));n.delete(a,l),n.insert(a,s),n.applyDelta(i.map(u=>({retain:u.insert.length,attributes:u.attributes})))},KF=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Rg=n=>{var e;return((e=KF.exec(n))==null?void 0:e[1])??n},JF=(n,e)=>{const t=[];for(const o in n)t.push(e.mark(Rg(o),n[o]));return t},mS=(n,e)=>{const t={};return n.forEach(o=>{if(o.type.name!=="ychange"){const r=UC(e.isOMark,o.type,()=>!o.type.excludes(o.type));t[r?`${o.type.name}--${_F(o.toJSON())}`:o.type.name]=o.attrs}}),t},mh=(n,e,t,o)=>{if(e instanceof re.XmlElement&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(o.mapping.set(e,t),e instanceof re.XmlElement){const f=e.getAttributes(),p=t.attrs;for(const h in p)p[h]!==null?f[h]!==p[h]&&h!=="ychange"&&e.setAttribute(h,p[h]):e.removeAttribute(h);for(const h in f)p[h]===void 0&&e.removeAttribute(h)}const r=qd(t),i=r.length,s=e.toArray(),l=s.length,a=$r(i,l);let u=0,d=0;for(;u<a;u++){const f=s[u],p=r[u];if(!Pu(o.mapping.get(f),p))if(ea(f,p))o.mapping.set(f,p);else break}for(;d+u+1<a;d++){const f=s[l-d-1],p=r[i-d-1];if(!Pu(o.mapping.get(f),p))if(ea(f,p))o.mapping.set(f,p);else break}n.transact(()=>{for(;l-u-d>0&&i-u-d>0;){const p=s[u],h=r[u],m=s[l-d-1],g=r[i-d-1];if(p instanceof re.XmlText&&h instanceof Array)hS(p,h)||qF(p,h,o),u+=1;else{let y=p instanceof re.XmlElement&&gh(p,h),b=m instanceof re.XmlElement&&gh(m,g);if(y&&b){const v=qv(p,h,o),k=qv(m,g,o);v.foundMappedChild&&!k.foundMappedChild?b=!1:!v.foundMappedChild&&k.foundMappedChild||v.equalityFactor<k.equalityFactor?y=!1:b=!1}y?(mh(n,p,h,o),u+=1):b?(mh(n,m,g,o),d+=1):(o.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[hh(h,o)]),u+=1)}}const f=l-u-d;if(l===1&&i===0&&s[0]instanceof re.XmlText?(o.mapping.delete(s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(u,u+f).forEach(p=>o.mapping.delete(p)),e.delete(u,f)),u+d<i){const p=[];for(let h=u;h<i-d;h++)p.push(hh(r[h],o));e.insert(u,p)}},Je)},gh=(n,e)=>!(e instanceof Array)&&n.nodeName===e.type.name;let xl=null;const GF=()=>{const n=xl;xl=null,n.forEach((e,t)=>{const o=t.state.tr,r=Je.getState(t.state);r&&r.binding&&!r.binding.isDestroyed&&(e.forEach((i,s)=>{o.setMeta(s,i)}),t.dispatch(o))})},XF=(n,e,t)=>{xl||(xl=new Map,Og(0,GF)),UC(xl,n,kc).set(e,t)},ta=(n,e,t)=>{if(n===0)return re.createRelativePositionFromTypeIndex(e,0,-1);let o=e._first===null?null:e._first.content.type;for(;o!==null&&e!==o;){if(o instanceof re.XmlText){if(o._length>=n)return re.createRelativePositionFromTypeIndex(o,n,-1);if(n-=o._length,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{do o=o._item===null?null:o._item.parent,n--;while(o!==e&&o!==null&&o._item!==null&&o._item.next===null);o!==null&&o!==e&&(o=o._item===null?null:o._item.next.content.type)}}else{const r=(t.get(o)||{nodeSize:0}).nodeSize;if(o._first!==null&&n<r)o=o._first.content.type,n--;else{if(n===1&&o._length===0&&r>1)return new re.RelativePosition(o._item===null?null:o._item.id,o._item===null?re.findRootTypeKey(o):null,null);if(n-=r,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{if(n===0)return o=o._item===null?o:o._item.parent,new re.RelativePosition(o._item===null?null:o._item.id,o._item===null?re.findRootTypeKey(o):null,null);do o=o._item.parent,n--;while(o!==e&&o._item.next===null);o!==e&&(o=o._item.next.content.type)}}}if(o===null)throw ka();if(n===0&&o.constructor!==re.XmlText&&o!==e)return YF(o._item.parent,o._item)}return re.createRelativePositionFromTypeIndex(e,e._length,-1)},YF=(n,e)=>{let t=null,o=null;return n._item===null?o=re.findRootTypeKey(n):t=re.createID(n._item.id.client,n._item.id.clock),new re.RelativePosition(t,o,e.id)},ai=(n,e,t,o)=>{const r=re.createAbsolutePositionFromRelativePosition(t,n);if(r===null||r.type!==e&&!re.isParentOf(e,r.type._item))return null;let i=r.type,s=0;if(i.constructor===re.XmlText)s=r.index;else if(i._item===null||!i._item.deleted){let l=i._first,a=0;for(;a<i._length&&a<r.index&&l!==null;){if(!l.deleted){const u=l.content.type;a++,u instanceof re.XmlText?s+=u._length:s+=o.get(u).nodeSize}l=l.right}s+=1}for(;i!==e&&i._item!==null;){const l=i._item.parent;if(l._item===null||!l._item.deleted){s+=1;let a=l._first;for(;a!==null;){const u=a.content.type;if(u===i)break;a.deleted||(u instanceof re.XmlText?s+=u._length:s+=o.get(u).nodeSize),a=a.right}}i=l}return s-1};function QF(n){const e=n.toArray(),t=o=>{let r;if(o instanceof re.XmlText)r=o.toDelta().map(s=>{const l={type:"text",text:s.insert};return s.attributes&&(l.marks=Object.keys(s.attributes).map(a=>{const u=s.attributes[a],f={type:Rg(a)};return Object.keys(u)&&(f.attrs=u),f})),l});else if(o instanceof re.XmlElement){r={type:o.nodeName};const i=o.getAttributes();Object.keys(i).length&&(r.attrs=i);const s=o.toArray();s.length&&(r.content=s.map(t).flat())}else ka();return r};return{type:"doc",content:e.map(t)}}const ZF=(n,e,t)=>n!==e,ej=n=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null);const o=document.createTextNode("⁠"),r=document.createTextNode("⁠");return e.insertBefore(o,null),e.insertBefore(t,null),e.insertBefore(r,null),e},gS=n=>({style:`background-color: ${n.color}70`,class:"ProseMirror-yjs-selection"}),tj=/^#[0-9a-fA-F]{6}$/,Kv=(n,e,t,o,r)=>{const i=Je.getState(n);if(i==null||i.doc==null||i.binding==null)return Ce.create(n.doc,[]);const s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?Ce.create(n.doc,[]):(e.getStates().forEach((a,u)=>{if(t(s.clientID,u,a)&&a.cursor!=null){const d=a.user||{};d.color==null?d.color="#ffa500":tj.test(d.color)||console.warn("A user uses an unsupported color format",d),d.name==null&&(d.name=`User: ${u}`);let f=ai(s,i.type,re.createRelativePositionFromJSON(a.cursor.anchor),i.binding.mapping),p=ai(s,i.type,re.createRelativePositionFromJSON(a.cursor.head),i.binding.mapping);if(f!==null&&p!==null){const h=Cs(n.doc.content.size-1,0);f=$r(f,h),p=$r(p,h),l.push(Ve.widget(p,()=>o(d,u),{key:u+"",side:10}));const m=$r(f,p),g=Cs(f,p);l.push(Ve.inline(m,g,r(d,u),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Ce.create(n.doc,l))},nj=(n,{awarenessStateFilter:e=ZF,cursorBuilder:t=ej,selectionBuilder:o=gS,getSelection:r=s=>s.selection}={},i="cursor")=>new ue({key:Xa,state:{init(s,l){return Kv(l,n,e,t,o)},apply(s,l,a,u){const d=Je.getState(u),f=s.getMeta(Xa);return d&&d.isChangeOrigin||f&&f.awarenessUpdated?Kv(u,n,e,t,o):l.map(s.mapping,s.doc)}},props:{decorations:s=>Xa.getState(s)},view:s=>{const l=()=>{s.docView&&XF(s,Xa,{awarenessUpdated:!0})},a=()=>{const u=Je.getState(s.state),d=n.getLocalState()||{};if(s.hasFocus()){const f=r(s.state),p=ta(f.anchor,u.type,u.binding.mapping),h=ta(f.head,u.type,u.binding.mapping);(d.cursor==null||!re.compareRelativePositions(re.createRelativePositionFromJSON(d.cursor.anchor),p)||!re.compareRelativePositions(re.createRelativePositionFromJSON(d.cursor.head),h))&&n.setLocalStateField(i,{anchor:p,head:h})}else d.cursor!=null&&ai(u.doc,u.type,re.createRelativePositionFromJSON(d.cursor.anchor),u.binding.mapping)!==null&&n.setLocalStateField(i,null)};return n.on("change",l),s.dom.addEventListener("focusin",a),s.dom.addEventListener("focusout",a),{update:a,destroy:()=>{s.dom.removeEventListener("focusin",a),s.dom.removeEventListener("focusout",a),n.off("change",l),n.setLocalStateField(i,null)}}}}),oj=n=>{const e=Xo.getState(n).undoManager;if(e!=null)return e.undo(),!0},rj=n=>{const e=Xo.getState(n).undoManager;if(e!=null)return e.redo(),!0},ij=new Set(["paragraph"]),sj=(n,e)=>!(n instanceof ts.Item)||!(n.content instanceof ts.ContentType)||!(n.content.type instanceof ts.Text||n.content.type instanceof ts.XmlElement&&e.has(n.content.type.nodeName))||n.content.type._length===0,lj=({protectedNodes:n=ij,trackedOrigins:e=[],undoManager:t=null}={})=>new ue({key:Xo,state:{init:(o,r)=>{const i=Je.getState(r),s=t||new ts.UndoManager(i.type,{trackedOrigins:new Set([Je].concat(e)),deleteFilter:l=>sj(l,n),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(o,r,i,s)=>{const l=Je.getState(s).binding,a=r.undoManager,u=a.undoStack.length>0,d=a.redoStack.length>0;return l?{undoManager:a,prevSel:ph(l,i),hasUndoOps:u,hasRedoOps:d}:u!==r.hasUndoOps||d!==r.hasRedoOps?Object.assign({},r,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):r}},view:o=>{const r=Je.getState(o.state),i=Xo.getState(o.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const l=r.binding;l&&s.meta.set(l,Xo.getState(o.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const l=r.binding;l&&(l.beforeTransactionSelection=s.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});function aj(n){return!!n.getMeta(Je)}function cj(n,e){const t=Je.getState(n);return ai(t.doc,t.type,e,t.binding.mapping)||0}function yS(n,e){const t=Je.getState(n);return ta(e,t.type,t.binding.mapping)}var Sc=class bS extends Am{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(e){return new bS(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function uj(n,e){const t=yS(e,n);return new Sc(n,t)}function dj(n,e,t){const o=n instanceof Sc?n.yRelativePosition:null;if(aj(e)&&o){const s=cj(t,o);return{position:new Sc(s,o),mapResult:null}}const r=cx(n,e),i=r.position.position;return{position:new Sc(i,o??yS(t,i)),mapResult:r.mapResult}}var fj=be.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(n=>n.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(n,e)=>dj(n,e,this.editor.state),this.editor.utils.createMappablePosition=n=>uj(n,this.editor.state)},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Xo.getState(e).undoManager.undoStack.length===0?!1:t?oj(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Xo.getState(e).undoManager.redoStack.length===0?!1:t?rj(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var n;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=lj(this.options.yUndoOptions),o=t.spec.view;t.spec.view=s=>{const{undoManager:l}=Xo.getState(s.state);l.restore&&(l.restore(),l.restore=()=>{});const a=o?o(s):void 0;return{destroy:()=>{const u=l.trackedOrigins.has(l),d=l._observers;l.restore=()=>{u&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=d},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=PF(e,r);return this.editor.options.enableContentCheck&&((n=e.doc)==null||n.on("beforeTransaction",()=>{try{const s=QF(e);if(s.content.length===0)return;this.editor.schema.nodeFromJSON(s).check()}catch(s){return this.editor.emit("contentError",{error:s,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)==null||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[i,t,this.editor.options.enableContentCheck&&new ue({key:new ae("filterInvalidContent"),filterTransaction:()=>{var s;return this.storage.isDisabled!==!1&&((s=e.doc)==null||s.destroy()),!0}})].filter(Boolean)}}),vS=fj,Jv=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t.user})),Gv=()=>null,pj=be.create({name:"collaborationCaret",priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:n=>{const e=document.createElement("span");e.classList.add("collaboration-carets__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-carets__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},selectionRender:gS,onUpdate:Gv}},onCreate(){if(this.options.onUpdate!==Gv&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCaret.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),!this.options.provider)throw new Error('The "provider" option is required for the CollaborationCaret extension')},addStorage(){return{users:[]}},addCommands(){return{updateUser:n=>()=>(this.options.provider.awareness.setLocalStateField("user",n),!0),user:n=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),e.commands.updateUser(n))}},addProseMirrorPlugins(){return[nj((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=Jv(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=Jv(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),wS=pj,hj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,mj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,gj=no.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",pe(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const r=/^(==)([^=]+)(==)/.exec(n);if(r){const i=r[2].trim(),s=t.inlineTokens(i);return{type:"highlight",raw:r[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[vi({find:hj,type:this.type})]},addPasteRules(){return[_r({find:mj,type:this.type})]}}),kS=gj,yj=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,bj=Be.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",pe(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?`![${a}](${l} "${u}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const u=new Ex({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[bd({find:yj,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),xS=bj;function vj(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=Mx(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const k=g+y.index;let w=k+y[0].length;return a&&d.test(m.slice(w-1,w+1))&&(y[0]+=" ",w+=1),k<l.pos&&w>=l.pos?{range:{from:k,to:w},query:y[0].slice(t.length),text:y[0]}:null}var wj=new ae("suggestion");function kj({pluginKey:n=wj,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=vj,shouldShow:y}){let b;const v=h==null?void 0:h(),k=()=>{const S=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(S),{top:N,right:$,bottom:O,left:A}=T;try{return new DOMRect(A,N,$-A,O-N)}catch{return null}},w=(S,T)=>T?()=>{const N=n.getState(e.state),$=N==null?void 0:N.decorationId,O=S.dom.querySelector(`[data-decoration-id="${$}"]`);return(O==null?void 0:O.getBoundingClientRect())||null}:k;function x(S,T){var N;try{const O=n.getState(S.state),A=O!=null&&O.decorationId?S.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null,B={editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},query:(O==null?void 0:O.query)||null,text:(O==null?void 0:O.text)||null,items:[],command:I=>f({editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},props:I}),decorationNode:A,clientRect:w(S,A)};(N=v==null?void 0:v.onExit)==null||N.call(v,B)}catch{}const $=S.state.tr.setMeta(T,{exit:!0});S.dispatch($)}const C=new ue({key:n,view(){return{update:async(S,T)=>{var N,$,O,A,B,I,L;const R=(N=this.key)==null?void 0:N.getState(T),q=($=this.key)==null?void 0:$.getState(S.state),z=R.active&&q.active&&R.range.from!==q.range.from,W=!R.active&&q.active,me=R.active&&!q.active,Ee=!W&&!me&&R.query!==q.query,De=W||z&&Ee,je=Ee||z,He=me||z&&Ee;if(!De&&!je&&!He)return;const Te=He&&!De?R:q,te=S.dom.querySelector(`[data-decoration-id="${Te.decorationId}"]`);b={editor:e,range:Te.range,query:Te.query,text:Te.text,items:[],command:we=>f({editor:e,range:Te.range,props:we}),decorationNode:te,clientRect:w(S,te)},De&&((O=v==null?void 0:v.onBeforeStart)==null||O.call(v,b)),je&&((A=v==null?void 0:v.onBeforeUpdate)==null||A.call(v,b)),(je||De)&&(b.items=await p({editor:e,query:Te.query})),He&&((B=v==null?void 0:v.onExit)==null||B.call(v,b)),je&&((I=v==null?void 0:v.onUpdate)==null||I.call(v,b)),De&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,T,N,$){const{isEditable:O}=e,{composing:A}=e.view,{selection:B}=S,{empty:I,from:L}=B,R={...T},q=S.getMeta(n);if(q&&q.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R;if(R.composing=A,O&&(I||e.view.composing)){(L<T.range.from||L>T.range.to)&&!A&&!T.composing&&(R.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:B.$from}),W=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:$,range:z.range,isActive:T.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(R.active=!0,R.decorationId=T.decorationId?T.decorationId:W,R.range=z.range,R.query=z.query,R.text=z.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(S,T){var N,$,O,A;const{active:B,range:I}=C.getState(S.state);if(!B)return!1;if(T.key==="Escape"||T.key==="Esc"){const R=C.getState(S.state),q=(N=b==null?void 0:b.decorationNode)!=null?N:null,z=q??(R!=null&&R.decorationId?S.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`):null);if((($=v==null?void 0:v.onKeyDown)==null?void 0:$.call(v,{view:S,event:T,range:R.range}))||!1)return!0;const me={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:Ee=>f({editor:e,range:R.range,props:Ee}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(O=v==null?void 0:v.onExit)==null||O.call(v,me),x(S,n),!0}return((A=v==null?void 0:v.onKeyDown)==null?void 0:A.call(v,{view:S,event:T,range:I}))||!1},decorations(S){const{active:T,range:N,decorationId:$,query:O}=C.getState(S);if(!T)return null;const A=!(O!=null&&O.length),B=[a];return A&&B.push(d),Ce.create(S.doc,[Ve.inline(N.from,N.to,{nodeName:l,class:B.join(" "),"data-decoration-id":$,"data-decoration-content":u})])}}});return C}function xj({editor:n,overrideSuggestionOptions:e,extensionName:t,char:o="@"}){const r=new ae;return{editor:n,char:o,pluginKey:r,command:({editor:i,range:s,props:l})=>{var a,u,d;const f=i.view.state.selection.$to.nodeAfter;((a=f==null?void 0:f.text)==null?void 0:a.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:t,attrs:{...l,mentionSuggestionChar:o}},{type:"text",text:" "}]).run(),(d=(u=i.view.dom.ownerDocument.defaultView)==null?void 0:u.getSelection())==null||d.collapseToEnd()},allow:({state:i,range:s})=>{const l=i.doc.resolve(s.from),a=i.schema.nodes[t];return!!l.parent.type.contentMatch.matchType(a)},...e}}function CS(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>xj({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function Xv(n,e){const t=CS(n),o=t.find(r=>r.char===e);return o||(t.length?t[0]:null)}var Cj=Be.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,o;return`${(t=e==null?void 0:e.char)!=null?t:"@"}${(o=n.attrs.label)!=null?o:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var o,r;return["span",pe(this.HTMLAttributes,n.HTMLAttributes),`${(o=t==null?void 0:t.char)!=null?o:"@"}${(r=e.attrs.label)!=null?r:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=Xv(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",pe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const o={...this.options};o.HTMLAttributes=pe({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:n,suggestion:t});return typeof r=="string"?["span",pe({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},...Tx({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o,l=i??s;e[r==="char"?"mentionSuggestionChar":r]=l,o=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:Xv(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:o}=e,{empty:r,anchor:i}=o;if(!r)return!1;let s=new Bn,l=0;return e.doc.nodesBetween(i-1,i,(a,u)=>{if(a.type.name===this.name)return t=!0,s=a,l=u,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),t})}},addProseMirrorPlugins(){return CS(this).map(kj)}}),Sj=Cj,Ej=no.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",pe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),SS=Ej,Mj=no.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",pe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),ES=Mj,Tj=be.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),MS=Tj,Nj=n=>lt({find:/--$/,replace:n??"—"}),Aj=n=>lt({find:/\.\.\.$/,replace:n??"…"}),Oj=n=>lt({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:n??"“"}),$j=n=>lt({find:/"$/,replace:n??"”"}),Rj=n=>lt({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:n??"‘"}),Bj=n=>lt({find:/'$/,replace:n??"’"}),Dj=n=>lt({find:/<-$/,replace:n??"←"}),_j=n=>lt({find:/->$/,replace:n??"→"}),Ij=n=>lt({find:/\(c\)$/,replace:n??"©"}),Lj=n=>lt({find:/\(tm\)$/,replace:n??"™"}),Pj=n=>lt({find:/\(sm\)$/,replace:n??"℠"}),Vj=n=>lt({find:/\(r\)$/,replace:n??"®"}),zj=n=>lt({find:/(?:^|\s)(1\/2)\s$/,replace:n??"½"}),Hj=n=>lt({find:/\+\/-$/,replace:n??"±"}),Fj=n=>lt({find:/!=$/,replace:n??"≠"}),jj=n=>lt({find:/<<$/,replace:n??"«"}),Wj=n=>lt({find:/>>$/,replace:n??"»"}),Uj=n=>lt({find:/\d+\s?([*x])\s?\d+$/,replace:n??"×"}),qj=n=>lt({find:/\^2$/,replace:n??"²"}),Kj=n=>lt({find:/\^3$/,replace:n??"³"}),Jj=n=>lt({find:/(?:^|\s)(1\/4)\s$/,replace:n??"¼"}),Gj=n=>lt({find:/(?:^|\s)(3\/4)\s$/,replace:n??"¾"}),Xj=be.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const n=[];return this.options.emDash!==!1&&n.push(Nj(this.options.emDash)),this.options.ellipsis!==!1&&n.push(Aj(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&n.push(Oj(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push($j(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&n.push(Rj(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Bj(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&n.push(Dj(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(_j(this.options.rightArrow)),this.options.copyright!==!1&&n.push(Ij(this.options.copyright)),this.options.trademark!==!1&&n.push(Lj(this.options.trademark)),this.options.servicemark!==!1&&n.push(Pj(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(Vj(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(zj(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(Hj(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(Fj(this.options.notEqual)),this.options.laquo!==!1&&n.push(jj(this.options.laquo)),this.options.raquo!==!1&&n.push(Wj(this.options.raquo)),this.options.multiplication!==!1&&n.push(Uj(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(qj(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(Kj(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(Jj(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(Gj(this.options.threeQuarters)),n}}),TS=Xj,Nt=[];for(var Uf=0;Uf<256;++Uf)Nt.push((Uf+256).toString(16).slice(1));function Yj(n,e=0){return(Nt[n[e+0]]+Nt[n[e+1]]+Nt[n[e+2]]+Nt[n[e+3]]+"-"+Nt[n[e+4]]+Nt[n[e+5]]+"-"+Nt[n[e+6]]+Nt[n[e+7]]+"-"+Nt[n[e+8]]+Nt[n[e+9]]+"-"+Nt[n[e+10]]+Nt[n[e+11]]+Nt[n[e+12]]+Nt[n[e+13]]+Nt[n[e+14]]+Nt[n[e+15]]).toLowerCase()}var Ya,Qj=new Uint8Array(16);function Zj(){if(!Ya&&(Ya=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ya))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ya(Qj)}var e3=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Yv={randomUUID:e3};function NS(n,e,t){if(Yv.randomUUID&&!n)return Yv.randomUUID();n=n||{};var o=n.random||(n.rng||Zj)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,Yj(o)}function t3(n){const e=new Set,t=new Set;return n.forEach(o=>{e.has(o)?t.add(o):e.add(o)}),Array.from(t)}var n3=be.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>NS(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:n=>n.getAttribute(`data-${this.options.attributeName}`),renderHTML:n=>n[this.options.attributeName]?{[`data-${this.options.attributeName}`]:n[this.options.attributeName]}:{}}}}]},onCreate(){var n;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),t=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),r=[e,t].filter(Boolean).find(l=>{var a;return(a=l==null?void 0:l.options)==null?void 0:a.provider}),i=(n=r==null?void 0:r.options)==null?void 0:n.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:u,doc:d}=a,{types:f,attributeName:p,generateID:h}=this.options;Or(d,g=>f.includes(g.type.name)&&g.attrs[p]===null).forEach(({node:g,pos:y})=>{u.setNodeMarkup(y,void 0,{...g.attrs,[p]:h({node:g,pos:y})})}),u.setMeta("addToHistory",!1),l.dispatch(u),i&&i.off("synced",s)};if(r){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let n=null,e=!1;return[new ue({key:new ae("uniqueID"),appendTransaction:(t,o,r)=>{const i=t.some(g=>g.docChanged)&&!o.doc.eq(r.doc),s=this.options.filterTransaction&&t.some(g=>{var y,b;return!((b=(y=this.options).filterTransaction)!=null&&b.call(y,g))});if(t.find(g=>g.getMeta("y-sync$"))||!i||s)return;const{tr:a}=r,{types:u,attributeName:d,generateID:f}=this.options,p=km(o.doc,t),{mapping:h}=p;if(Tm(p).forEach(({newRange:g})=>{const y=Y0(r.doc,g,v=>u.includes(v.type.name)),b=y.map(({node:v})=>v.attrs[d]).filter(v=>v!==null);y.forEach(({node:v,pos:k},w)=>{var x;const C=(x=a.doc.nodeAt(k))==null?void 0:x.attrs[d];if(C===null){a.setNodeMarkup(k,void 0,{...v.attrs,[d]:f({node:v,pos:k})});return}const S=y[w+1];if(S&&v.content.size===0){const O=a.doc.nodeAt(S.pos);if(O!=null&&O.attrs[d]&&O.attrs[d]!==C)return;a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[d]:C}),b[w+1]=C;const A=f({node:v,pos:k});return a.setNodeMarkup(k,void 0,{...v.attrs,[d]:A}),b[w]=A,a}const T=t3(b),{deleted:N}=h.invert().mapResult(k);N&&T.includes(C)&&a.setNodeMarkup(k,void 0,{...v.attrs,[d]:f({node:v,pos:k})})})}),!!a.steps.length)return a.setStoredMarks(r.tr.storedMarks),a.setMeta("__uniqueIDTransaction",!0),a},view(t){const o=r=>{var i;n=(i=t.dom.parentElement)!=null&&i.contains(r.target)?t.dom.parentElement:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(t,o)=>{var r,i;return(n!==t.dom.parentElement||((r=o.dataTransfer)==null?void 0:r.effectAllowed)==="copyMove"||((i=o.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(n=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:t=>{if(!e)return t;const{types:o,attributeName:r}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!o.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const u=a.type.create({...a.attrs,[r]:null},i(a.content),a.marks);l.push(u)}),_.from(l)};return e=!1,new F(i(t.content),t.openStart,t.openEnd)}}})]}}),AS=n3;/**
208
+ * Copyright 2026 Yiitap
209
+ * @license MIT
210
+ **/const Qv=n=>{const e=/(#[0-9a-f]{3,6})\b/gi,t=[];return n.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],l=i.index||0,a=r+l,u=a+s.length,d=Ve.inline(a,u,{class:"color-highlighter",style:`--color: ${s}`});t.push(d)})}),Ce.create(n,t)},OS=be.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new ue({key:new ae("colorHighlighter"),state:{init(n,{doc:e}){return Qv(e)},apply(n,e){return n.docChanged?Qv(n.doc):e}},props:{decorations(n){return this.getState(n)}}})]}});/**
211
+ * Copyright 2026 Yiitap
212
+ * @license MIT
213
+ **/const qf=new ae("inlinePlaceholderPlugin"),$S=be.create({name:"inlinePlaceholder",addOptions(){return{onShow:n=>{},onHide:()=>{}}},addProseMirrorPlugins(){return[new ue({key:qf,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(qf);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=qf.getState(n))==null?void 0:o.active;if(!e)return null;const t=Ve.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder bg-gray-100 border border-gray-300 text-gray-500 px-1 rounded cursor-text",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShow(e)}),r});return Ce.create(n.doc,[t])}},view:()=>({destroy:this.options.onHide})})]}});/**
214
+ * Copyright 2026 Yiitap
215
+ * @license MIT
216
+ **/const RS=Be.create({name:"column",group:"block",content:"block+",defining:!0,isolating:!0,selectable:!0,addAttributes(){return{flexGrow:{default:1,parseHTML:n=>parseFloat(n.style.flexGrow)||1,renderHTML:n=>n.flexGrow?{style:`flex-grow: ${n.flexGrow};`}:{}}}},parseHTML(){return[{tag:'div[data-type="column"]'}]},renderHTML({HTMLAttributes:n}){return["div",pe(n,{"data-type":"column"}),0]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
217
+ `)+`
218
+
219
+ `:""}),BS=Be.create({name:"columns",group:"block",content:"column*",isolating:!0,selectable:!0,inline:!1,parseHTML(){return[{tag:'div[data-type="column-container"]'}]},renderHTML({HTMLAttributes:n}){return["div",pe(n,{"data-type":"column-container"}),0]},renderMarkdown:(n,e)=>{if(n.content){const t=[];return n.content.forEach(o=>{if(o.content){const r=e.renderChildren(o.content,`
220
+ `);t.push(r)}}),t.join(`
221
+
222
+ `)+`
223
+
224
+ `}else return""}}),yh=be.create({name:"columnDropCursor",addProseMirrorPlugins(){let n=null;const e=t=>{n&&(n.style.display="none"),t.dom.classList.remove("hide-native-dropcursor")};return[new ue({key:new ae("columnDropCursor"),view(t){var r;n=document.createElement("div"),n.className="column-dropcursor",Object.assign(n.style,{position:"absolute",display:"none",pointerEvents:"none",backgroundColor:"skyblue",zIndex:"1000",width:"4px",transition:"top 0.1s ease, left 0.05s ease, height 0.1s ease"}),(r=t.dom.parentElement)==null||r.appendChild(n);const o=()=>e(t);return window.addEventListener("dragend",o),{destroy(){window.removeEventListener("dragend",o),n==null||n.remove(),n=null}}},props:{handleDOMEvents:{dragover:(t,o)=>{var a,u;const r=t.dom.getBoundingClientRect(),i=(a=document.elementFromPoint(o.clientX,o.clientY))==null?void 0:a.closest('[data-type="column"]');if(i){const d=i.getBoundingClientRect();if(o.clientX>d.right-d.width*.4)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${d.height}px`,n.style.top=`${t.dom.offsetTop+(d.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(d.left-r.left)+d.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}const s=r.left+r.width/2,l=(u=document.elementFromPoint(s,o.clientY))==null?void 0:u.closest(".tiptap > *");if(l&&!l.matches('[data-type="column-container"]')){const d=l.getBoundingClientRect();if(o.clientX>d.right-40&&o.clientX<d.right)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${d.height}px`,n.style.top=`${t.dom.offsetTop+(d.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(d.left-r.left)+d.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}return e(t),!1},drop:(t,o)=>{var v;t.dom.getBoundingClientRect();const r=document.elementFromPoint(o.clientX,o.clientY),i=r==null?void 0:r.closest('[data-type="column"]'),s=i||(r==null?void 0:r.closest(".tiptap > *"));if(!s)return!1;const l=s.getBoundingClientRect();if(!(o.clientX>l.left+l.width*.5))return!1;o.preventDefault(),o.stopPropagation(),e(t);const a=t.dragging,u=a==null?void 0:a.slice;if(!u)return!1;const{state:d,dispatch:f}=t,{column:p,columns:h}=d.schema.nodes;let m=d.tr;if(a.move){const{from:k,to:w}=d.selection;m.delete(k,w)}const g=((v=u.content.firstChild)==null?void 0:v.type.name)==="columns",y=t.posAtDOM(s,0),b=d.doc.resolve(y);try{if(i){const k=m.mapping.map(b.after(b.depth)),w=[];g?u.content.firstChild.content.forEach(x=>w.push(x)):w.push(p.create({flexGrow:1},u.content)),m.insert(k,w)}else{const k=m.mapping.map(b.before(1)),w=m.doc.nodeAt(k);if(!w)return!1;if(g){const x=u.content.firstChild,C=[p.create({flexGrow:1},w)];x.content.forEach(S=>C.push(S)),m.replaceWith(k,k+w.nodeSize,h.create(null,C))}else{const x=h.create(null,[p.create({flexGrow:1},w),p.create({flexGrow:1},u.content)]);m.replaceWith(k,k+w.nodeSize,x)}}return t.dragging=null,f&&f(m),!0}catch(k){return console.error("Column drop error:",k),!1}}},handleDragLeave:t=>e(t)}})]}});function o3(n){for(let e=n.depth;e>0;e--){const t=n.node(e);if(t.type.name==="column")return{node:t,depth:e}}return null}const r3=()=>!!document.querySelector(".slash-tippy"),i3=(n,e)=>{const{$cursor:t}=n.selection;if(!t||t.parent.content.size||t.node(t.depth-1).type.name==="column")return!1;if(t.depth>1&&t.after()!=t.end(-1)){const i=t.before();if(vo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}const o=t.blockRange(),r=o&&Ri(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)},s3=W0({Enter:(n,e,t)=>r3()?!1:ld(sm,am,i3,s0)(n,e,t),"Mod-a":(n,e,t)=>{const{selection:o}=n,{$from:r}=o,i=o3(r);if(i){const{depth:s}=i,l=r.start(s),a=r.end(s),u=n.tr.setSelection(U.create(n.doc,l,a));return e&&e(u),!0}return!1}}),Kn=new ae("gridResizingPlugin");let l3=class bh{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=e.getMeta(Kn);return(t==null?void 0:t.setHandle)!==void 0?new bh(t.setHandle,this.dragging):(t==null?void 0:t.setDragging)!==void 0?new bh(this.activeHandle,t.setDragging):this}};function a3(n,e,t){const o=e.composedPath().find(i=>i instanceof Element&&i.matches('[data-type="column-container"]'));if(!o)return-1;const r=Array.from(o.children).filter(i=>i==null?void 0:i.matches('[data-type="column"]'));for(let i=0;i<r.length;i++){const s=r[i],l=s.getBoundingClientRect();if(e.clientX>=l.right-t-2&&e.clientX<=l.right+10+t){const a=n.posAtDOM(s,0);if(a!=null)return a}}return-1}function c3(n,e){const t=n.state.doc.resolve(e),o=t.parent;if(!o||o.type.name!=="column")return null;const r=n.domAtPos(t.pos);if(!r.node)return null;const i=r.node instanceof HTMLElement?r.node:r.node.childNodes[r.offset],s=i.offsetWidth;return{$pos:t,node:o,columnEl:i,domWidth:s}}function DS(n,e){n.dispatch(n.state.tr.setMeta(Kn,{setHandle:e}))}function u3(n,e,t){const o=Kn.getState(n.state);if(!o||o.dragging)return!1;const r=a3(n,e,t);return r!==o.activeHandle&&DS(n,r),!1}function d3(n){const e=Kn.getState(n.state);return e&&e.activeHandle>-1&&!e.dragging&&DS(n,-1),!1}function f3(n,e,t=.1){const o=Kn.getState(n.state);if(!o||o.activeHandle===-1||o.dragging)return!1;const r=c3(n,o.activeHandle);if(!r)return!1;const{$pos:i,node:s,columnEl:l}=r,a=i.before(),u=l.parentElement;if(!u)return!1;const d=a+s.nodeSize,f=n.state.doc.nodeAt(d),p=f&&f.type.name==="column";let h=0;i.parent.forEach(v=>{h+=v.attrs.flexGrow||1});const m=u.offsetWidth;n.dispatch(n.state.tr.setMeta(Kn,{setDragging:{startX:e.clientX,startFlex:s.attrs.flexGrow||1,nextColFlex:p?f.attrs.flexGrow||1:null,nextColPos:p?d:null,totalFlex:h,containerWidth:m}}));const g=n.dom.ownerDocument.defaultView||window,y=v=>{var B;if(!v.buttons){b();return}const k=(B=Kn.getState(n.state))==null?void 0:B.dragging;if(!k)return;const{startX:w,startFlex:x,nextColFlex:C,nextColPos:S,totalFlex:T,containerWidth:N}=k,$=(v.clientX-w)/N*T,O=n.state.tr;let A=Math.max(t,x+$);if(S!==null&&C!==null){const I=x+C;let L=Math.max(t,I-A);A=I-L,O.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:A});const R=n.state.doc.nodeAt(S);R&&R.type.name==="column"&&O.setNodeMarkup(S,void 0,{...R.attrs,flexGrow:L})}else O.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:A});n.dispatch(O.setMeta("addToHistory",!1))},b=()=>{g.removeEventListener("mouseup",b),g.removeEventListener("mousemove",y),n.dispatch(n.state.tr.setMeta(Kn,{setDragging:null}))};return g.addEventListener("mouseup",b),g.addEventListener("mousemove",y),e.preventDefault(),!0}function p3(n,e){if(n.doc.resolve(e).nodeAfter===null)return Ce.empty;const t=Ve.widget(e,()=>{const o=document.createElement("div");o.className="grid-resize-handle";const r=document.createElement("div");r.className="circle-button";const i=document.createElement("div");return i.className="plus",r.appendChild(i),o.appendChild(r),o},{key:`grid-handle-${e}`,side:0});return Ce.create(n.doc,[t])}function h3(n,e){const t=e.target;if(!t||t.className!=="circle-button"&&t.className!=="plus")return!1;const o=t.closest('[data-type="column"]');if(!o)return!1;const r=n.posAtDOM(o,0);if(!r)return!1;const{state:i}=n,s=i.doc.resolve(r),{column:l,paragraph:a}=i.schema.nodes,u=s.after(s.depth),d=l.create({flexGrow:1},a.create()),f=i.tr.insert(u,d),p=f.doc.resolve(u+2),h=U.near(p);return n.dispatch(f.setSelection(h).scrollIntoView()),n.focus(),!0}function m3(n){const e=n==null?void 0:n.handleWidth,t=n==null?void 0:n.minColumnFlex;return new ue({key:Kn,state:{init:()=>new l3(-1,null),apply:(o,r)=>r.apply(o)},props:{attributes:o=>{const r=Kn.getState(o);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,r)=>u3(o,r,e),mouseleave:o=>d3(o),mousedown:(o,r)=>f3(o,r,t),mouseup:(o,r)=>h3(o,r)},decorations:o=>{const r=Kn.getState(o);return!r||r.activeHandle===-1?null:p3(o,r.activeHandle)}}})}const _S=be.create({name:"multiColumn",addProseMirrorPlugins(){return[m3({handleWidth:2,minColumnFlex:.5}),s3]},addCommands(){return{insertMultiColumn:(n=2)=>({tr:e,dispatch:t,editor:o})=>{const{schema:r}=o,{column:i,columns:s,paragraph:l}=r.nodes;if(!i||!s||!l)return!1;const a=[];for(let d=0;d<n;d++)a.push(i.create({flexGrow:1},l.create()));const u=s.create(null,a);if(t){const d=e.selection.from;e.replaceSelectionWith(u);const f=e.doc.resolve(d),p=U.near(f);e.setSelection(p).scrollIntoView()}return!0}}}});/**
225
+ * Copyright 2026 Yiitap
226
+ * @license MIT
227
+ **/const Ws="selection-decoration",Qa={BLUR:"blur",FOCUS:"focus"},IS=be.create({name:Ws,addProseMirrorPlugins(){return[new ue({key:new ae(Ws),state:{init(n){return Ce.empty},apply:(n,e)=>{const{selection:t,doc:o}=n,r=n.getMeta(Ws),i=t&&t.from!==t.to;if(!i||(r==null?void 0:r.action)===Qa.FOCUS)return Ce.empty;if(i&&(r==null?void 0:r.action)===Qa.BLUR){const s=Ve.inline(t.from,t.to,{class:"selection-decoration-blur"});return Ce.create(o,[s])}return e}},props:{decorations(n){return this.getState(n)},handleDOMEvents:{blur:n=>{const{tr:e}=n.state,t=e.setMeta(Ws,{from:e.selection.from,to:e.selection.to,action:Qa.BLUR});n.dispatch(t)},focus:n=>{const{tr:e}=n.state,t=e.setMeta(Ws,{from:e.selection.from,to:e.selection.to,action:Qa.FOCUS});n.dispatch(t)}}}})]}});/**
228
+ * Copyright 2026 Yiitap
229
+ * @license MIT
230
+ **/const g3=n=>n?n.split(/\r?\n/).filter(e=>e.trim().length>0).length>1:!1,y3=(n,e=.2)=>{if(!n||n.trim().length<2)return!1;const t=n.split(/\r?\n/).filter(a=>a.trim().length>0);if(t.length===0)return!1;if(/```[\s\S]*?```/.test(n)||/\$\$[\s\S]+?\$\$/.test(n))return console.log("Markdown: With code or math block"),!0;const o=[/^#{1,6}\s/,/^[-*+]\s+/,/^\d+\.\s+/,/^>\s+/,/^```/,/`[^`]+`/,/\*\*[^*]+\*\*/,/_[^_]+_/,/\[([^\]]+)\]\([^)]+\)/,/!\[([^\]]*)\]\([^)]+\)/,/^(\|?[\s-:|]+\|[\s-:|]+)$/,/\$\$[\s\S]+?\$\$/,/\$[^$]+\$/,/\\\([^)]+\\\)/,/\\\[[\s\S]+?\\\]/,/^\|.*?\|.*?\|/,/^:::\s*\w+/,/<[a-z][\s\S]*?>/i,/^[ \t]*[-*_]{3,}[ \t]*$/];let r=0,i=!1;for(const a of t){const u=a.trim();if(u.startsWith("```")){i=!i,r++;continue}if(i){r++;continue}o.some(d=>d.test(u))&&r++}const s=r/t.length,l=(n.match(/[*_`#>[\]]/g)||[]).length/n.length;return console.log("isMarkdown: ",s,l),s>=e||l>.05},Zv=(n,e)=>{var r;const t=[],o=Array.isArray(n)?n:[n];for(const i of o)try{const s=(r=e.markdown)==null?void 0:r.serialize(i);s?t.push(s.trim()):console.warn("Failed to serialize: ",i)}catch(s){console.error("Failed to serialize.",s)}return t.join(`
231
+
232
+ `)},LS=["Mathematics","starterKit"],ew=(n,e)=>{const t=Array.isArray(n)?{type:"doc",content:n}:n,o=e.extensionManager.extensions.filter(r=>!LS.includes(r.name));return Z$(t,o)},b3=(n,e)=>{const t=e.extensionManager.extensions,o=[...LS,"doc"],r=t.filter(i=>!o.includes(i.name));return r.push(Ip),nx(n,r)},PS=be.create({name:"shortcut",addOptions(){return{copy:{enabled:!0,keys:["Mod-c"]},duplicate:{enabled:!0,keys:["Mod-d"]},delete:{enabled:!0,keys:["Mod-x"]},markdown:{enabled:!0},selectableNodes:["aiBlock","blockquote","callout","codeBlock","heading","listItem","paragraph","tableCell","tableHeader","taskItem"]}},addCommands(){return{copySelected:()=>({tr:n,state:e,dispatch:t})=>this.editor.commands.deleteSelected({delete:!1}),duplicateSelected:()=>({tr:n,state:e,dispatch:t})=>{const{selection:o}=e,{$from:r,$to:i}=o;if(o instanceof Q){const d=o.node,f=o.to,p=d.type.create(d.attrs,d.content,d.marks);if(t){const h=e.tr.insert(f,p);t(h.scrollIntoView()),setTimeout(()=>{this.editor.commands.setNodeSelection(f)},100)}return!0}if(!o.empty){const{from:d,to:f}=o,p=e.doc.slice(d,f),h=f;if(t){let m=e.tr.insert(h,p.content);const g=p.content.size;m=m.setSelection(U.create(m.doc,h,h+g)),t(m.scrollIntoView())}return!0}const s=r.depth,l=r.before(s),a=r.node(s);if(!a)return!1;const u=a.type.create(a.attrs,a.content,a.marks);if(t){const d=l+a.nodeSize;let f=e.tr.insert(d,u);const p=d+a.nodeSize-1;f=f.setSelection(U.create(f.doc,p)),t(f.scrollIntoView())}return!0},deleteSelected:(n={delete:!0})=>({tr:e,state:t,dispatch:o})=>{var h,m;const{selection:r}=t,{$from:i,from:s,to:l}=r;if(s!==l){try{const g=t.doc.slice(s,l).content.toJSON(),y=ew(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((h=this.options.markdown)!=null&&h.enabled){const k=Zv(g,this.editor)||"";b["text/plain"]=new Blob([k],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.deleteRange(s,l),o(e.scrollIntoView())),!0}let a=i.depth,u=a;for(;a>0;a--)if(i.node(a).isBlock){u=a;break}const d=i.node(u);if(!d)return!1;const f=i.before(u),p=f+d.nodeSize;try{const g=d.toJSON(),y=ew(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((m=this.options.markdown)!=null&&m.enabled){const k=Zv(g,this.editor)||"";b["text/plain"]=new Blob([k],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.delete(f,p),o(e.scrollIntoView())),!0}}},addKeyboardShortcuts(){var e,t,o;const n={};if((e=this.options.copy)!=null&&e.enabled){const r=this.options.copy.keys??["Mod-c"];for(const i of r)n[i]=({editor:s})=>s.commands.copySelected()}if((t=this.options.duplicate)!=null&&t.enabled){const r=this.options.duplicate.keys??["Mod-d"];for(const i of r)n[i]=({editor:s})=>s.commands.duplicateSelected()}if((o=this.options.delete)!=null&&o.enabled){const r=this.options.delete.keys??["Mod-x"];for(const i of r)n[i]=({editor:s})=>s.commands.deleteSelected()}return n["Mod-a"]=({editor:r})=>{const{state:i,view:s}=r,{selection:l,tr:a}=i,{$from:u}=l,d=u.node(-1);let f=-1,p=-1;if(this.options.selectableNodes.includes(d==null?void 0:d.type.name))f=u.start(-1)+1,p=u.end(-1)-1;else if((d==null?void 0:d.type.name)==="doc"){let h=u.depth,m=null,g=0;for(;h>0;){const y=u.node(h);if(y.isBlock){m=y,g=u.before(h);break}h--}this.options.selectableNodes.includes(m==null?void 0:m.type.name)&&(f=g+1,p=g+(m==null?void 0:m.nodeSize)-1)}if(f>-1&&p>-1){const{from:h,to:m}=l;if(h!==f||m!==p){const g=U.create(a.doc,f,p);return a.setSelection(g),s.dispatch(a),!0}}return!1},n},addProseMirrorPlugins(){return[new ue({props:{handlePaste:(n,e,t)=>{var u,d,f;const o=e.clipboardData;if(!o)return!1;const r=o.getData("text/html"),i=o.getData("text/plain");if(!r&&!i)return!1;const{state:s}=n,{selection:l}=s,{$from:a}=l;if(a.parent.type.name==="codeBlock"){console.log("Inside codeBlock",i);const p=s.tr.insertText(i,l.from,l.to);return n.dispatch(p.scrollIntoView()),!0}if(r)try{let p=!0;const h=/<html[\s\S]*>/i.test(r);let m;if(h){let y=b3(r,this.editor).content;y.length===1&&y[0].type==="paragraph"&&(p=!1,y=y[0].content),m=_.fromJSON(n.state.schema,y)}else{if(g3(i))return!1;{const y=s.tr.insertText(i,l.to);return n.dispatch(y.scrollIntoView()),!0}}const g=new F(m,0,0);if(p){const y=a.end(),b=n.state.tr.insert(y,m);n.dispatch(b.scrollIntoView())}else{const y=n.state.tr.replaceSelection(g);n.dispatch(y.scrollIntoView())}return!0}catch(p){console.error("Parse html failed.",p)}if((u=this.options.markdown)!=null&&u.enabled&&y3(i))try{const p=(f=((d=this.editor.markdown)==null?void 0:d.parse(i))||{})==null?void 0:f.content,h=_.fromJSON(n.state.schema,p),m=new F(h,0,0),g=n.state.tr.replaceSelection(m);return n.dispatch(g.scrollIntoView()),!0}catch(p){console.error("Parse Markdown failed.",p)}return!1}}})]}});/**
233
+ * Copyright 2026 Yiitap
234
+ * @license MIT
235
+ **/function tw(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:h}=u.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const g=r===f?i:h&&h[m],y=g?`${g}px`:"";if(s+=g||o,g||(l=!1),a)a.style.width!==y&&(a.style.width=y),a=a.nextSibling;else{const b=document.createElement("col");b.className=`col-${f}`,e.appendChild(b).style.width=y}}}for(;a;){const d=a.nextSibling;a.parentNode.removeChild(a),a=d}l?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}let v3=class{constructor(e,t,o){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),tw(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,tw(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}};const VS=Pd.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:v3,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),insertTable:e=>({editor:t,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:l=3,withHeaderRow:a=!0}=e||{},u=VC(t.schema,s,l,a);if(i){const d=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[u.toJSON()]}),r.scrollIntoView().setSelection(U.near(r.doc.resolve(d)))}return!0},deleteTable:()=>({state:e,dispatch:t})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return t&&t(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=ze.rowSelection(r);t.setSelection(i)}return!0},selectColumn:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=ze.colSelection(r);t.setSelection(i)}return!0}}},parseMarkdown:(n,e)=>{const t=[];if(n.header){const r=[];n.header.forEach(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}n.rows&&n.rows.forEach(r=>{const i=[];r.forEach(s=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),t.push(e.createNode("tableRow",{},i))});const o=e.createNode("table",void 0,t);return e.createNode("table-wrapper",void 0,[o])}});/**
236
+ * Copyright 2026 Yiitap
237
+ * @license MIT
238
+ **/function Ot(n){this.content=n}Ot.prototype={constructor:Ot,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new Ot(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ot(t)},addToStart:function(n,e){return new Ot([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ot(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new Ot(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ot.from(n),n.size?new Ot(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ot.from(n),n.size?new Ot(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ot.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ot.from=function(n){if(n instanceof Ot)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ot(e)};function zS(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=zS(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function HS(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=HS(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}let J=class Zt{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Zt(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new Zt(o,r)}cutByIndex(e,t){return e==t?Zt.empty:e==0&&t==this.content.length?this:new Zt(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new Zt(r,i)}addToStart(e){return new Zt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Zt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return zS(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return HS(this,e,t,o)}findIndex(e){if(e==0)return Za(0,e);if(e==this.size)return Za(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Za(t+1,i):Za(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Zt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Zt(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Zt.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Zt(t||e,o)}static from(e){if(!e)return Zt.empty;if(e instanceof Zt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Zt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};J.empty=new J([],0);const Kf={index:0,offset:0};function Za(n,e){return Kf.index=n,Kf.offset=e,Kf}function Vu(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Vu(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Vu(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let tt=class vh{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Vu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return vh.none;if(e instanceof vh)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};tt.none=[];let zu=class extends Error{},le=class Xi{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=jS(this.content,e+this.openStart,t);return o&&new Xi(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Xi(FS(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Xi.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Xi(J.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new Xi(e,o,r)}};le.empty=new le(J.empty,0,0);function FS(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(FS(i.content,e-r-1,t-r-1)))}function jS(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=jS(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function w3(n,e,t){if(t.openStart>n.depth)throw new zu("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new zu("Inconsistent open depths");return WS(n,e,t,0)}function WS(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=WS(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return ui(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=k3(t,n);return ui(i,qS(n,s,l,e,o))}else return ui(i,Hu(n,e,o))}function US(n,e){if(!e.type.compatibleContent(n.type))throw new zu("Cannot join "+e.type.name+" onto "+n.type.name)}function wh(n,e,t){let o=n.node(t);return US(o,e.node(t)),o}function ci(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Cl(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ci(n.nodeAfter,o),i++));for(let l=i;l<s;l++)ci(r.child(l),o);e&&e.depth==t&&e.textOffset&&ci(e.nodeBefore,o)}function ui(n,e){return n.type.checkContent(e),n.copy(e)}function qS(n,e,t,o,r){let i=n.depth>r&&wh(n,e,r+1),s=o.depth>r&&wh(t,o,r+1),l=[];return Cl(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(US(i,s),ci(ui(i,qS(n,e,t,o,r+1)),l)):(i&&ci(ui(i,Hu(n,e,r+1)),l),Cl(e,t,r,l),s&&ci(ui(s,Hu(t,o,r+1)),l)),Cl(o,null,r,l),new J(l)}function Hu(n,e,t){let o=[];if(Cl(null,n,t,o),n.depth>t){let r=wh(n,e,t+1);ci(ui(r,Hu(n,e,t+1)),o)}return Cl(e,null,t,o),new J(o)}function k3(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)o=e.node(r).copy(J.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}let nw=class kh{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return tt.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Fu(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new kh(t,o,i)}static resolveCached(e,t){let o=ow.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else ow.set(e,o=new x3);let r=o.elts[o.i]=kh.resolve(e,t);return o.i=(o.i+1)%C3,r}},x3=class{constructor(){this.elts=[],this.i=0}};const C3=12,ow=new WeakMap;let Fu=class{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const S3=Object.create(null);let di=class xh{constructor(e,t,o,r=tt.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&Vu(this.attrs,t||e.defaultAttrs||S3)&&tt.sameSet(this.marks,o||tt.none)}copy(e=null){return e==this.content?this:new xh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return le.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),a=r.node(s).content.cut(r.pos-l,i.pos-l);return new le(a,r.depth-s,i.depth-s)}replace(e,t,o){return w3(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return nw.resolveCached(this,e)}resolveNoCache(e){return nw.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),KS(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=J.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=tt.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!tt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=J.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};di.prototype.text=void 0;let E3=class Ch extends di{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):KS(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ch(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ch(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function KS(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}let na=class JS{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new M3(e,t);if(o.next==null)return JS.empty;let r=GS(o);o.next&&o.err("Unexpected trailing text");let i=B3(R3(r));return D3(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return J.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
239
+ `)}};na.empty=new na(!0);let M3=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function GS(n){let e=[];do e.push(T3(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function T3(n){let e=[];do e.push(N3(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function N3(n){let e=$3(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=A3(n,e);else break;return e}function rw(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function A3(n,e){let t=rw(n),o=t;return n.eat(",")&&(n.next!="}"?o=rw(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function O3(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function $3(n){if(n.eat("(")){let e=GS(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=O3(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function R3(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function XS(n,e){return e-n}function iw(n,e){let t=[];return o(e),t.sort(XS);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function B3(n){let e=Object.create(null);return t(iw(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);iw(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new na(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(XS);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function D3(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function YS(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function QS(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function ZS(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function eE(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new I3(n,o,e[o]);return t}let sw=class tE{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=eE(e,o.attrs),this.defaultAttrs=YS(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==na.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:QS(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new di(this,this.computeAttrs(e),J.from(t),tt.setFrom(o))}createChecked(e=null,t,o){return t=J.from(t),this.checkContent(t),new di(this,this.computeAttrs(e),t,tt.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=J.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(J.empty,!0);return i?new di(this,e,t.append(i),tt.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ZS(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:tt.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new tE(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function _3(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}let I3=class{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?_3(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}},nE=class oE{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=eE(e,r.attrs),this.excluded=null;let i=YS(this.attrs);this.instance=i?new tt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new tt(this,QS(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new oE(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ZS(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},L3=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Ot.from(e.nodes),t.marks=Ot.from(e.marks||{}),this.nodes=sw.compile(this.spec.nodes,this),this.marks=nE.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=na.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?lw(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:lw(this,s.split(" "))}this.nodeFromJSON=r=>di.fromJSON(this,r),this.markFromJSON=r=>tt.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof sw){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new E3(o,o.defaultAttrs,e,tt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function lw(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function P3(n){return n.tag!=null}function V3(n){return n.style!=null}let Jf=class Sh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(P3(r))this.tags.push(r);else if(V3(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new cw(this,t,!1);return o.addAll(e,tt.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new cw(this,t,!0);return o.addAll(e,tt.none,t.from,t.to),le.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(F3(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=uw(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=uw(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Sh(e,Sh.schemaRules(e)))}};const rE={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},z3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iE={ol:!0,ul:!0},oa=1,Eh=2,Sl=4;function aw(n,e,t){return e!=null?(e?oa:0)|(e==="full"?Eh:0):n&&n.whitespace=="pre"?oa|Eh:t&~Sl}class ec{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=tt.none,this.match=i||(s&Sl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(J.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&oa)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=J.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!rE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}let cw=class{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=aw(null,t.preserveWhitespace,0)|(o?Sl:0);r?i=new ec(r.type,r.attrs,tt.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new ec(null,null,tt.none,!0,null,s):i=new ec(e.schema.topNodeType,null,tt.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Eh?"full":this.localPreserveWS||(r.options&oa)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
240
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;iE.hasOwnProperty(s)&&this.parser.normalizeLists&&H3(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:z3.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(rE.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
241
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=tt.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):dw(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=aw(e,i,s.options);s.options&Sl&&s.content.length==0&&(l|=Sl);let a=tt.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):dw(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new ec(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=oa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}};function H3(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&iE.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function F3(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function uw(n){let e={};for(let t in n)e[t]=n[t];return e}function dw(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}const sE=65535,lE=Math.pow(2,16);function j3(n,e){return n+e*lE}function fw(n){return n&sE}function W3(n){return(n-(n&sE))/lE}const aE=1,cE=2,Ec=4,uE=8;let Mh=class{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&uE)>0}get deletedBefore(){return(this.delInfo&(aE|Ec))>0}get deletedAfter(){return(this.delInfo&(cE|Ec))>0}get deletedAcross(){return(this.delInfo&Ec)>0}},Mi=class Yi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Yi.empty)return Yi.empty}recover(e){let t=0,o=fw(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+W3(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:j3(l/3,e-a),g=e==a?cE:e==f?aE:Ec;return(t<0?e!=a:e!=f)&&(g|=uE),new Mh(h,g,m)}r+=d-u}return o?e+r:new Mh(e+r,0,null)}touches(e,t){let o=0,r=fw(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new Yi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Yi.empty:new Yi(e<0?[0,-e,0]:[0,0,e])}};Mi.empty=new Mi([]);let U3=class Th{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Th(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Th;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Mh(e,r,null)}};const Gf=Object.create(null);let Xt=class{getMap(){return Mi.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Gf[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Gf)throw new RangeError("Duplicate use of step JSON ID "+e);return Gf[e]=t,t.prototype.jsonID=e,t}},nn=class Qs{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Qs(e,null)}static fail(e){return new Qs(null,e)}static fromReplace(e,t,o,r){try{return Qs.ok(e.replace(t,o,r))}catch(i){if(i instanceof zu)return Qs.fail(i.message);throw i}}};function Bg(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Bg(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return J.fromArray(o)}let Dg=class Zs extends Xt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new le(Bg(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return nn.fromReplace(e,this.from,this.to,i)}invert(){return new Ds(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Zs(t.pos,o.pos,this.mark)}merge(e){return e instanceof Zs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Zs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Zs(t.from,t.to,e.markFromJSON(t.mark))}};Xt.jsonID("addMark",Dg);let Ds=class el extends Xt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new le(Bg(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return nn.fromReplace(e,this.from,this.to,o)}invert(){return new Dg(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new el(t.pos,o.pos,this.mark)}merge(e){return e instanceof el&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new el(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new el(t.from,t.to,e.markFromJSON(t.mark))}};Xt.jsonID("removeMark",Ds);let _g=class tl extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new tl(this.pos,t.marks[r]);return new tl(this.pos,this.mark)}}return new ju(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new tl(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new tl(t.pos,e.markFromJSON(t.mark))}};Xt.jsonID("addNodeMark",_g);let ju=class Nh extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new _g(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Nh(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Nh(t.pos,e.markFromJSON(t.mark))}};Xt.jsonID("removeNodeMark",ju);class kt extends Xt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Ah(e,this.from,this.to)?nn.fail("Structure replace would overwrite content"):nn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Mi([this.from,this.to-this.from,this.slice.size])}invert(e){return new kt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new kt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof kt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?le.empty:new le(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new kt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?le.empty:new le(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new kt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new kt(t.from,t.to,le.fromJSON(e,t.slice),!!t.structure)}}Xt.jsonID("replace",kt);let pn=class Mc extends Xt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ah(e,this.from,this.gapFrom)||Ah(e,this.gapTo,this.to)))return nn.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return nn.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?nn.fromReplace(e,this.from,this.to,o):nn.fail("Content does not fit in gap")}getMap(){return new Mi([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Mc(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Mc(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Mc(t.from,t.to,t.gapFrom,t.gapTo,le.fromJSON(e,t.slice),t.insert,!!t.structure)}};Xt.jsonID("replaceAround",pn);function Ah(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function q3(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new Ds(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Dg(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function K3(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof nE){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new Ds(s.from,s.to,s.style)))}function Ig(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new kt(l,d,le.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new Ds(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new le(J.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new kt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(J.empty,!0);n.replace(l,l,new le(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function J3(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function _s(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let t=n.depth,o=0,r=0;;--t){let i=n.$from.node(t),s=n.$from.index(t)+o,l=n.$to.indexAfter(t)-r;if(t<n.depth&&i.canReplace(s,l,e))return t;if(t==0||i.type.spec.isolating||!J3(i,s,l))break;s&&(o=1),l<i.childCount&&(r=1)}return null}function G3(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=J.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=J.from(o.node(m).copy(d)),f++):a--;let p=J.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=J.from(r.node(m).copy(p)),h++):u++;n.step(new pn(a,u,s,l,new le(d.append(p),f,h),d.size-f,!0))}function Lg(n,e,t=null,o=n){let r=X3(n,e),i=r&&Y3(o,e);return i?r.map(pw).concat({type:e,attrs:t}).concat(i.map(pw)):null}function pw(n){return{type:n,attrs:null}}function X3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function Y3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=o;l&&a<r;a++)l=l.matchType(t.child(a).type);return!l||!l.validEnd?null:s}function Q3(n,e,t){let o=J.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=J.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new pn(r,i,r,i,new le(o,0,0),t.length,!0))}function Z3(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&eW(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&fE(n,s,l,i),Ig(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new pn(f,p,f+1,p-1,new le(J.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&dE(n,s,l,i),!1}})}function dE(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function fE(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
242
+ `))}})}function eW(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function tW(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new pn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new le(J.from(s),0,0),1,!0))}function Yo(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function nW(n,e,t=1,o){let r=n.doc.resolve(e),i=J.empty,s=J.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=J.from(r.node(l).copy(i));let d=o&&o[u];s=J.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new kt(e,e,new le(i.append(s),t,t),!0))}function jr(n,e){let t=n.resolve(e),o=t.index();return pE(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function oW(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function pE(n,e){return!!(n&&e&&!n.isLeaf&&oW(n,e))}function Kd(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&pE(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function rW(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);fE(n,d.node(),d.before(),l)}s.inlineContent&&Ig(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new kt(u,a.map(e+t,-1),le.empty,!0)),o===!0){let d=n.doc.resolve(u);dE(n,d.node(),d.before(),n.steps.length)}return n}function iW(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Jd(n,e,t=e,o=le.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return hE(r,i,o)?new kt(e,t,o):new sW(r,i,o).fit()}function hE(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let sW=class{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=J.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=J.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new le(i,s,l);return e>-1?new pn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new kt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Xf(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(J.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Xf(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new le(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Xf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new le(nl(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new le(nl(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(mE(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=ol(this.placed,t,J.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?le.empty:new le(nl(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new le(nl(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Yf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Yf(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=Yf(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ol(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ol(this.placed,this.depth,J.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(J.empty,!0);e.childCount&&(this.placed=ol(this.placed,this.frontier.length,e))}};function nl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(nl(n.firstChild.content,e-1,t)))}function ol(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ol(n.lastChild.content,e-1,t)))}function Xf(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function mE(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,mE(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(J.empty,!0)))),n.copy(o)}function Yf(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!lW(t,i.content,s)?l:null}function lW(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function aW(n){return n.spec.defining||n.spec.definingForContent}function cW(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(hE(r,i,o))return n.step(new kt(e,t,o));let s=yE(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=aW(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),k=r.index(y-1);if(v.canReplaceWith(k,k,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new le(gE(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function gE(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(gE(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(J.empty,!0))}return n}function uW(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=iW(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new le(J.from(o),0,0))}function dW(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=yE(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function yE(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}let bE=class Tc extends Xt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(r),0,t.isLeaf?0:1))}getMap(){return Mi.empty}invert(e){return new Tc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Tc(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Tc(t.pos,t.attr,t.value)}};Xt.jsonID("attr",bE);let vE=class Oh extends Xt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return nn.ok(o)}getMap(){return Mi.empty}invert(e){return new Oh(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Oh(t.attr,t.value)}};Xt.jsonID("docAttr",vE);let Ms=class extends Error{};Ms=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ms.prototype=Object.create(Error.prototype);Ms.prototype.constructor=Ms;Ms.prototype.name="TransformError";let fW=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new U3}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ms(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=le.empty){let r=Jd(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new le(J.from(o),0,0))}delete(e,t){return this.replace(e,t,le.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return cW(this,e,t,o),this}replaceRangeWith(e,t,o){return uW(this,e,t,o),this}deleteRange(e,t){return dW(this,e,t),this}lift(e,t){return G3(this,e,t),this}join(e,t=1){return rW(this,e,t),this}wrap(e,t){return Q3(this,e,t),this}setBlockType(e,t=e,o,r=null){return Z3(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return tW(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new bE(e,t,o)),this}setDocAttribute(e,t){return this.step(new vE(e,t)),this}addNodeMark(e,t){return this.step(new _g(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof tt)t.isInSet(o.marks)&&this.step(new ju(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new ju(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return nW(this,e,t,o),this}addMark(e,t,o){return q3(this,e,t,o),this}removeMark(e,t,o){return K3(this,e,t,o),this}clearIncompatible(e,t,o){return Ig(this,e,t,o),this}};const Qf=Object.create(null);let rt=class{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new pW(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=le.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?le.empty:t),l==0&&gw(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),gw(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Zo(e):Qi(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Qi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Qi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new fi(e.node(0))}static atStart(e){return Qi(e,e,0,0,1)||new fi(e)}static atEnd(e){return Qi(e,e,e.content.size,e.childCount,-1)||new fi(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Qf[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Qf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Qf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Zo.between(this.$anchor,this.$head).getBookmark()}};rt.prototype.visible=!0;let pW=class{constructor(e,t){this.$from=e,this.$to=t}},hw=!1;function mw(n){!hw&&!n.parent.inlineContent&&(hw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}let Zo=class rl extends rt{constructor(e,t=e){mw(e),mw(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return rt.near(o);let r=e.resolve(t.map(this.anchor));return new rl(r.parent.inlineContent?r:o,o)}replace(e,t=le.empty){if(super.replace(e,t),t==le.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof rl&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wE(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new rl(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=rt.findFrom(t,o,!0)||rt.findFrom(t,-o,!0);if(i)t=i.$head;else return rt.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(rt.findFrom(e,-o,!0)||rt.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new rl(e,t)}};rt.jsonID("text",Zo);let wE=class kE{constructor(e,t){this.anchor=e,this.head=t}map(e){return new kE(e.map(this.anchor),e.map(this.head))}resolve(e){return Zo.between(e.resolve(this.anchor),e.resolve(this.head))}};class nt extends rt{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?rt.near(i):new nt(i)}content(){return new le(J.from(this.node),0,0)}eq(e){return e instanceof nt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hW(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new nt(e.resolve(t.anchor))}static create(e,t){return new nt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}nt.prototype.visible=!1;rt.jsonID("node",nt);let hW=class xE{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new wE(o,o):new xE(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&nt.isSelectable(o)?new nt(t):rt.near(t)}},fi=class Nc extends rt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=le.empty){if(t==le.empty){e.delete(0,e.doc.content.size);let o=rt.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Nc(e)}map(e){return new Nc(e)}eq(e){return e instanceof Nc}getBookmark(){return mW}};rt.jsonID("all",fi);const mW={map(){return this},resolve(n){return new fi(n)}};function Qi(n,e,t,o,r,i=!1){if(e.inlineContent)return Zo.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&nt.isSelectable(l))return nt.create(n,t-(r<0?l.nodeSize:0))}else{let a=Qi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function gw(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof kt||r instanceof pn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(rt.near(n.doc.resolve(s),t))}function yw(n,e){return!e||!n?n:n.bind(e)}let tc=class{constructor(e,t,o){this.name=e,this.init=yw(t.init,o),this.apply=yw(t.apply,o)}};new tc("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new tc("selection",{init(n,e){return n.selection||rt.atStart(e.doc)},apply(n){return n.selection}}),new tc("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new tc("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});const Pg=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function CE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const SE=(n,e,t)=>{let o=CE(n,t);if(!o)return!1;let r=Vg(o);if(!r){let s=o.blockRange(),l=s&&_s(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(BE(n,r,e,-1))return!0;if(o.parent.content.size==0&&(Ts(i,"end")||nt.isSelectable(i)))for(let s=o.depth;;s--){let l=Jd(n.doc,o.before(s),o.after(s),le.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Ts(i,"end")?rt.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):nt.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},gW=(n,e,t)=>{let o=CE(n,t);if(!o)return!1;let r=Vg(o);return r?EE(n,r,e):!1},yW=(n,e,t)=>{let o=TE(n,t);if(!o)return!1;let r=zg(o);return r?EE(n,r,e):!1};function EE(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=Jd(n.doc,i,a,le.empty);if(!u||u.from!=i||u instanceof kt&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(Zo.create(d.doc,i)),t(d.scrollIntoView())}return!0}function Ts(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const ME=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=Vg(o)}let s=i&&i.nodeBefore;return!s||!nt.isSelectable(s)?!1:(e&&e(n.tr.setSelection(nt.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Vg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function TE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const NE=(n,e,t)=>{let o=TE(n,t);if(!o)return!1;let r=zg(o);if(!r)return!1;let i=r.nodeAfter;if(BE(n,r,e,1))return!0;if(o.parent.content.size==0&&(Ts(i,"start")||nt.isSelectable(i))){let s=Jd(n.doc,o.before(),o.after(),le.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Ts(i,"start")?rt.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):nt.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},AE=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=zg(o)}let s=i&&i.nodeAfter;return!s||!nt.isSelectable(s)?!1:(e&&e(n.tr.setSelection(nt.create(n.doc,i.pos)).scrollIntoView()),!0)};function zg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const bW=(n,e)=>{let t=n.selection,o=t instanceof nt,r;if(o){if(t.node.isTextblock||!jr(n.doc,t.from))return!1;r=t.from}else if(r=Kd(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(nt.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},vW=(n,e)=>{let t=n.selection,o;if(t instanceof nt){if(t.node.isTextblock||!jr(n.doc,t.to))return!1;o=t.to}else if(o=Kd(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},wW=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&_s(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},OE=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
243
+ `).scrollIntoView()),!0)};function Hg(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const kW=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=Hg(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(rt.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},$E=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof fi||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Hg(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(Zo.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},RE=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Yo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&_s(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function xW(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof nt&&e.selection.node.isBlock)return!o.parentOffset||!Yo(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=Hg(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof Zo||e.selection instanceof fi)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=Yo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=Yo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const CW=xW(),SW=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(nt.create(n.doc,r))),!0)};function EW(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||jr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function BE(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&EW(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=J.empty;for(let b=s.length-1;b>=0;b--)m=J.from(s[b].create(null,m));m=J.from(r.copy(m));let g=n.tr.step(new pn(e.pos-1,h,e.pos,h,new le(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&jr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:rt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&_s(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&Ts(i,"start",!0)&&Ts(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=J.empty;for(let k=m.length-1;k>=0;k--)b=J.from(m[k].copy(b));let v=n.tr.step(new pn(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new le(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function DE(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(Zo.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const MW=DE(-1),TW=DE(1);function NW(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&Lg(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function bw(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function Fg(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}Fg(Pg,SE,ME);Fg(Pg,NE,AE);Fg(OE,$E,RE,CW);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function AW(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return OW(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function OW(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Fu(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Fu(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Lg(i,t,o,e);return l?(n&&$W(n,e,l,r,t),!0):!1}function $W(n,e,t,o,r){let i=J.empty;for(let d=t.length-1;d>=0;d--)i=J.from(t[d].type.create(t[d].attrs,i));n.step(new pn(e.start-(o?2:0),e.end,e.start,e.end,new le(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&Yo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function RW(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?BW(e,t,n,i):DW(e,t,i):!0:!1}}function BW(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new pn(i-1,s,i,s,new le(J.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Fu(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=_s(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return jr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function DW(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?J.empty:J.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new pn(f-(l?1:0),p+(a?1:0),f+1,p-1,new le((l?J.empty:J.from(r.copy(J.empty))).append(a?J.empty:J.from(r.copy(J.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function _W(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=J.from(u?n.create():null),f=new le(J.from(n.create(null,J.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new pn(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}var IW=Object.defineProperty,jg=(n,e)=>{for(var t in e)IW(n,t,{get:e[t],enumerable:!0})};function _E(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var LW=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:o}=this,{view:r}=t,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],a=!!e,u=e||i.tr,d=()=>(!a&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(p=>p===!0)),f={...Object.fromEntries(Object.entries(o).map(([p,h])=>[p,(...m)=>{const g=this.buildProps(u,t),y=h(...m)(g);return l.push(y),f}])),run:d};return f}createCan(e){const{rawCommands:t,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:_E({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([a,u])=>[a,(...d)=>u(...d)(l)]))}};return l}},IE={};jg(IE,{blur:()=>PW,clearContent:()=>VW,clearNodes:()=>zW,command:()=>HW,createParagraphNear:()=>FW,cut:()=>jW,deleteCurrentNode:()=>WW,deleteNode:()=>UW,deleteRange:()=>qW,deleteSelection:()=>KW,enter:()=>JW,exitCode:()=>GW,extendMarkRange:()=>YW,first:()=>QW,focus:()=>tU,forEach:()=>nU,insertContent:()=>oU,insertContentAt:()=>sU,joinBackward:()=>cU,joinDown:()=>aU,joinForward:()=>uU,joinItemBackward:()=>dU,joinItemForward:()=>fU,joinTextblockBackward:()=>pU,joinTextblockForward:()=>hU,joinUp:()=>lU,keyboardShortcut:()=>gU,lift:()=>yU,liftEmptyBlock:()=>bU,liftListItem:()=>vU,newlineInCode:()=>wU,resetAttributes:()=>kU,scrollIntoView:()=>xU,selectAll:()=>CU,selectNodeBackward:()=>SU,selectNodeForward:()=>EU,selectParentNode:()=>MU,selectTextblockEnd:()=>TU,selectTextblockStart:()=>NU,setContent:()=>OU,setMark:()=>KU,setMeta:()=>JU,setNode:()=>GU,setNodeSelection:()=>XU,setTextDirection:()=>YU,setTextSelection:()=>QU,sinkListItem:()=>ZU,splitBlock:()=>e5,splitListItem:()=>t5,toggleList:()=>n5,toggleMark:()=>o5,toggleNode:()=>r5,toggleWrap:()=>i5,undoInputRule:()=>s5,unsetAllMarks:()=>l5,unsetMark:()=>a5,unsetTextDirection:()=>c5,updateAttributes:()=>u5,wrapIn:()=>d5,wrapInList:()=>f5});var PW=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),VW=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),zW=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=_s(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},HW=n=>e=>n(e),FW=()=>({state:n,dispatch:e})=>$E(n,e),jW=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new U(o.doc.resolve(Math.max(s-1,0)))),!0},WW=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const s=r.before(i),l=r.after(i);n.delete(s,l).scrollIntoView()}return!0}return!1};function St(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var UW=n=>({tr:e,state:t,dispatch:o})=>{const r=St(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},qW=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},KW=()=>({state:n,dispatch:e})=>Pg(n,e),JW=()=>({commands:n})=>n.keyboardShortcut("Enter"),GW=()=>({state:n,dispatch:e})=>kW(n,e);function XW(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Wu(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:XW(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function LE(n,e,t={}){return n.find(o=>o.type===e&&Wu(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function vw(n,e,t={}){return!!LE(n,e,t)}function PE(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!LE([...r.node.marks],e,t)))return;let i=r.index,s=n.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(;i>0&&vw([...n.parent.child(i-1).marks],e,t);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&vw([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Wr(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var YW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Wr(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=PE(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=U.create(s,f.from,f.to);t.setSelection(p)}}return!0},QW=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function VE(n){return n instanceof U}function ei(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function ZW(n,e=null){if(!e)return null;const t=se.atStart(n),o=se.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?U.create(n,ei(0,r,i),ei(n.content.size,r,i)):U.create(n,ei(e,r,i),ei(e,r,i))}function ww(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Uu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function eU(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var tU=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Uu()||ww())&&o.dom.focus(),eU()&&!Uu()&&!ww()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(o.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!VE(t.state.selection))return s(),!0;const l=ZW(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},nU=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),oU=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),zE=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&zE(o)}return n};function nc(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return zE(t)}function ra(n,e,t){if(n instanceof di||n instanceof J)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return J.fromArray(n.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),ra("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new L3({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Jf.fromSchema(a).parseSlice(nc(n),t.parseOptions):Jf.fromSchema(a).parse(nc(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Jf.fromSchema(e);return t.slice?i.parseSlice(nc(n),t.parseOptions).content:i.parse(nc(n),t.parseOptions)}return ra("",e,t)}function rU(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof kt||r instanceof pn))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}var iU=n=>!("type"in n),sU=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ra(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=ra(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return a(g),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((iU(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),d===f&&h){const{parent:g}=o.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,f+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof J){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;o.insertText(m,d,f)}else{m=l;const g=o.doc.resolve(d),y=g.node(),b=g.parentOffset===0,v=y.isText||y.isTextblock,k=y.content.size>0;b&&v&&k&&(d=Math.max(0,d-1)),o.replaceWith(d,f,m)}t.updateSelection&&rU(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:m})}return!0},lU=()=>({state:n,dispatch:e})=>bW(n,e),aU=()=>({state:n,dispatch:e})=>vW(n,e),cU=()=>({state:n,dispatch:e})=>SE(n,e),uU=()=>({state:n,dispatch:e})=>NE(n,e),dU=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Kd(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},fU=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Kd(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},pU=()=>({state:n,dispatch:e})=>gW(n,e),hU=()=>({state:n,dispatch:e})=>yW(n,e);function HE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function mU(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Uu()||HE()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var gU=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=mU(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Ns(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?St(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(d,f)=>{if(d.isText)return;const p=Math.max(o,f),h=Math.min(r,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=r-o,u=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Wu(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var yU=(n,e={})=>({state:t,dispatch:o})=>{const r=St(n,t.schema);return Ns(t,r,e)?wW(t,o):!1},bU=()=>({state:n,dispatch:e})=>RE(n,e),vU=n=>({state:e,dispatch:t})=>{const o=St(n,e.schema);return RW(o)(e,t)},wU=()=>({state:n,dispatch:e})=>OE(n,e);function FE(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function kw(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var kU=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=FE(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=St(n,o.schema)),l==="mark"&&(s=Wr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,kw(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(kw(p.attrs,e))))})})}),a},xU=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),CU=()=>({tr:n,dispatch:e})=>{if(e){const t=new on(n.doc);n.setSelection(t)}return!0},SU=()=>({state:n,dispatch:e})=>ME(n,e),EU=()=>({state:n,dispatch:e})=>AE(n,e),MU=()=>({state:n,dispatch:e})=>SW(n,e),TU=()=>({state:n,dispatch:e})=>TW(n,e),NU=()=>({state:n,dispatch:e})=>MW(n,e);function AU(n,e,t={},o={}){return ra(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var OU=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const u=AU(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function $U(n,e){const t=Wr(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function RU(n,e){const t=new fW(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function BU(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function DU(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Gd(n){return e=>DU(e.$from,n)}function ia(n,e,t){return n.config[e]===void 0&&n.parent?ia(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ia(n.parent,e,t):null}):n.config[e]}function _U(n){return typeof n=="function"}function qu(n,e=void 0,...t){return _U(n)?e?n.bind(e)(...t):n(...t):n}function jE(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Ti(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const s=i?String(i).split(" "):[],l=o[r]?o[r].split(" "):[],a=s.filter(u=>!l.includes(u));o[r]=[...l,...a].join(" ")}else if(r==="style"){const s=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],a=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),s.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),o[r]=Array.from(a.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else o[r]=i}),o},{})}function IU(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>Ti(t,o),{})}function LU(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
244
+
245
+ `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function PU(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function VU(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function zU(n){const e=VU(n);return e.length===1?e:e.filter((t,o)=>!e.filter((r,i)=>i!==o).some(r=>t.oldRange.from>=r.oldRange.from&&t.oldRange.to<=r.oldRange.to&&t.newRange.from>=r.newRange.from&&t.newRange.to<=r.newRange.to))}function HU(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),zU(o)}var FU=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function Ac(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function jU(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Wr(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Wu(d.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;n.doc.nodesBetween(p,h,(m,g)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(p,g),b=Math.min(h,g+m.nodeSize),v=b-y;s+=v,l.push(...m.marks.map(k=>({mark:k,from:y,to:b})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Wu(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=s}var WU=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Gd(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},UU=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function xw(n,e){const{nodeExtensions:t}=jE(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=qu(ia(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function WE(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(WE(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function qU(n,e,t){var o;const{selection:r}=e;let i=null;if(VE(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(a=>a.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var KU=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=Wr(n,o.schema);if(r)if(s){const u=$U(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),g=Math.min(h+p.nodeSize,f);p.marks.find(y=>y.type===a)?p.marks.forEach(y=>{a===y.type&&t.addMark(m,g,a.create({...y.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return qU(o,t,a)},JU=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),GU=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=St(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>bw(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>bw(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},XU=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=ei(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},YU=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},QU=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=U.atStart(o).from,l=U.atEnd(o).to,a=ei(r,s,l),u=ei(i,s,l),d=U.create(o,a,u);e.setSelection(d)}return!0},ZU=n=>({state:e,dispatch:t})=>{const o=St(n,e.schema);return _W(o)(e,t)};function Cw(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var e5=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=Ac(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!Yo(s,l.pos)?!1:(o&&(n&&Cw(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:BU(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Yo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Yo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),o){if(m&&(i instanceof U&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Cw(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},t5=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=St(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=J.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-v;T>=a.depth-3;T-=1)b=J.from(a.node(T).copy(b));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Ac(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(J.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-k),new le(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(T,N)=>{if(S>-1)return!1;T.isTextblock&&T.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(U.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...Ac(p,f.type.name,f.attrs),...e},g={...Ac(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Yo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:k}=i.extensionManager,w=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!w||!r)return!0;const x=w.filter(C=>k.includes(C.type.name));t.ensureMarks(x)}return!0},Zf=(n,e)=>{const t=Gd(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&jr(n.doc,t.pos)&&n.join(t.pos),!0},ep=(n,e)=>{const t=Gd(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&jr(n.doc,o)&&n.join(o),!0},n5=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=St(n,s.schema),m=St(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,k=b.blockRange(v),w=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;const x=Gd(C=>xw(C.type.name,f))(g);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(xw(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>Zf(i,h)).command(()=>ep(i,h)).run()}return!t||!w||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Zf(i,h)).command(()=>ep(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=w.filter(T=>p.includes(T.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Zf(i,h)).command(()=>ep(i,h)).run()},o5=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=Wr(n,o.schema);return jU(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},r5=(n,e,t={})=>({state:o,commands:r})=>{const i=St(n,o.schema),s=St(e,o.schema),l=Ns(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},i5=(n,e={})=>({state:t,commands:o})=>{const r=St(n,t.schema);return Ns(t,r,e)?o.lift(r):o.wrapIn(r,e)},s5=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},l5=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},a5=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Wr(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=PE(u,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},c5=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},u5=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=FE(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=St(n,o.schema)),l==="mark"&&(s=Wr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const k=Math.max(b,d),w=Math.min(b+y.nodeSize,f);t.addMark(k,w,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},d5=(n,e={})=>({state:t,dispatch:o})=>{const r=St(n,t.schema);return NW(r,e)(t,o)},f5=(n,e={})=>({state:t,dispatch:o})=>{const r=St(n,t.schema);return AW(r,e)(t,o)},p5=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}};function h5(n){return Object.prototype.toString.call(n).slice(8,-1)}function oc(n){return h5(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function UE(n,e){const t={...n};return oc(n)&&oc(e)&&Object.keys(e).forEach(o=>{oc(e[o])&&oc(n[o])?t[o]=UE(n[o],e[o]):t[o]=e[o]}),t}var qE=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...qu(ia(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...qu(ia(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>UE(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},m5={};jg(m5,{ClipboardTextSerializer:()=>g5,Commands:()=>y5,Delete:()=>b5,Drop:()=>v5,Editable:()=>w5,FocusEvents:()=>k5,Keymap:()=>x5,Paste:()=>C5,Tabindex:()=>S5,TextDirection:()=>E5,focusEventsPluginKey:()=>JE});var Fn=class KE extends qE{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new KE(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},g5=Fn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ue({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=PU(t);return LU(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),y5=Fn.create({name:"commands",addCommands(){return{...IE}}}),b5=Fn.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=RU(n.before,[n,...e]);HU(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const g=m+h.nodeSize-2,y=p.oldRange.from<=m&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,h)=>{var m,g;if(p instanceof Ds){const y=f.slice(h).map(p.from,-1),b=f.slice(h).map(p.to),v=f.invert().map(y,-1),k=f.invert().map(b),w=(m=d.doc.nodeAt(y-1))==null?void 0:m.marks.some(C=>C.eq(p.mark)),x=(g=d.doc.nodeAt(b))==null?void 0:g.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:k},newRange:{from:y,to:b},partial:!!(x||w),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),v5=Fn.create({name:"drop",addProseMirrorPlugins(){return[new ue({key:new ae("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),w5=Fn.create({name:"editable",addProseMirrorPlugins(){return[new ue({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),JE=new ae("focusEvents"),k5=Fn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ue({key:JE,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),x5=Fn.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:l,doc:a}=s,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?s.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?g===d.pos:se.atStart(a).from===f;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),t={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...t},r={...t,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Uu()||HE()?r:o},addProseMirrorPlugins(){return[new ue({key:new ae("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(h=>h.getMeta("composition")))return;const o=n.some(h=>h.docChanged)&&!e.doc.eq(t.doc),r=n.some(h=>h.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=se.atStart(e.doc).from,u=se.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!WE(t.doc))return;const d=t.tr,f=_E({state:t,transaction:d}),{commands:p}=new LW({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}}),C5=Fn.create({name:"paste",addProseMirrorPlugins(){return[new ue({key:new ae("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),S5=Fn.create({name:"tabindex",addProseMirrorPlugins(){return[new ue({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),E5=Fn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=jE(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ue({key:new ae("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});function sa(n){return new p5({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=qu(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),a=l&&Lg(l,n.type,i);if(!a)return null;if(s.wrap(l,a),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(d,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&jr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&s.join(t.from-1)},undoable:n.undoable})}var M5={};jg(M5,{createAtomBlockMarkdownSpec:()=>T5,createBlockMarkdownSpec:()=>N5,createInlineMarkdownSpec:()=>$5,parseAttributes:()=>Wg,parseIndentedBlocks:()=>$h,renderNestedMarkdownContent:()=>qg,serializeAttributes:()=>Ug});function Wg(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,a=>(t.push(a),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const a=r.map(u=>u.trim().slice(1));e.class=a.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,a,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=t[f];p&&(e[a]=p.slice(1,-1))});const l=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(a=>{a.match(/^[a-zA-Z][\w-]*$/)&&(e[a]=!0)}),e}function Ug(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(t=>e.push(`.${t}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function T5(n){const{nodeName:e,name:t,parseAttributes:o=Wg,serializeAttributes:r=Ug,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(b=>!(b in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function N5(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Wg,serializeAttributes:i=Ug,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${u}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,k=r(v);let w=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,T=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(T);if(N===null)break;const $=N.index,O=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if(O)w+=1;else if(w-=1,w===0){const A=T.slice(0,$);C=A.trim();const B=f.slice(0,x+$+N[0].length);let I=[];if(C)if(l==="block")for(I=h.blockTokens(A),I.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});I.length>0;){const L=I[I.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))I.pop();else break}else I=h.inlineTokens(C);return{type:e,raw:B,attributes:k,content:C,tokens:I}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
246
+
247
+ `);return`:::${u}${g}
248
+
249
+ ${y}
250
+
251
+ :::`}}}function A5(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function O5(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function $5(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=A5,serializeAttributes:i=O5,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",v="";if(l){const[,w]=y;v=w}else{const[,w,x]=y;v=w,b=x||""}const k=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:k}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function $h(n,e,t){var o,r,i,s;const l=n.split(`
252
+ `),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
253
+ `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
254
+ `;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const C=l.slice(d+1).findIndex(S=>S.trim()!=="");if(C===-1)break;if((((r=(o=l[d+1+C].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
255
+ `,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
256
+ `,d+=1;else break}let v;const k=b.slice(1);if(k.length>0){const x=k.map(C=>C.slice(g+f)).join(`
257
+ `);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const w=e.createToken(m,v);a.push(w)}if(a.length!==0)return{items:a,raw:u}}function qg(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
258
+ `).map(p=>p?e.indent(p):"").join(`
259
+ `);a.push(f)}}),a.join(`
260
+ `)}var Sa=class GE extends qE{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new GE(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},R5=Object.defineProperty,B5=(n,e)=>{for(var t in e)R5(n,t,{get:e[t],enumerable:!0})},D5="listItem",Sw="textStyle",Ew=/^\s*([-+*])\s$/,_5=Sa.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Ti(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
261
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(D5,this.editor.getAttributes(Sw)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=sa({find:Ew,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=sa({find:Ew,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Sw),editor:this.editor})),[n]}}),I5=Sa.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ti(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(o=>o.type==="paragraph"))t=e.parseChildren(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const r=n.tokens.slice(1),i=e.parseChildren(r);t.push(...i)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>qg(n,e,o=>{var r,i;return o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${(((i=(r=o.meta)==null?void 0:r.parentAttrs)==null?void 0:i.start)||1)+o.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),L5={};B5(L5,{findListItemPos:()=>Ea,getNextListDepth:()=>Kg,handleBackspace:()=>Rh,handleDelete:()=>Bh,hasListBefore:()=>XE,hasListItemAfter:()=>P5,hasListItemBefore:()=>YE,listItemHasSubList:()=>QE,nextListIsDeeper:()=>ZE,nextListIsHigher:()=>eM});var Ea=(n,e)=>{const{$from:t}=e.selection,o=St(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Kg=(n,e)=>{const t=Ea(n,e);if(!t)return!1;const[,o]=FU(e,n,t.$pos.pos+4);return o},XE=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},YE=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},QE=(n,e,t)=>{if(!t)return!1;const o=St(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Rh=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Ns(n.state,e)&&XE(n.state,e,t)){const{$anchor:s}=n.state.selection,l=n.state.doc.resolve(s.before()-1),a=[];l.node().descendants((f,p)=>{f.type.name===e&&a.push({node:f,pos:p})});const u=a.at(-1);if(!u)return!1;const d=n.state.doc.resolve(l.start()+u.pos+1);return n.chain().cut({from:s.start()-1,to:s.end()+1},d.end()).joinForward().run()}if(!Ns(n.state,e)||!UU(n.state))return!1;const o=Ea(e,n.state);if(!o)return!1;const r=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),i=QE(e,n.state,r);return YE(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},ZE=(n,e)=>{const t=Kg(n,e),o=Ea(n,e);return!o||!t?!1:t>o.depth},eM=(n,e)=>{const t=Kg(n,e),o=Ea(n,e);return!o||!t?!1:t<o.depth},Bh=(n,e)=>{if(!Ns(n.state,e)||!WU(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:ZE(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():eM(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},P5=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},V5=Fn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Bh(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Bh(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Rh(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Rh(n,t,o)&&(e=!0)}),e}}}}),Mw=/^(\s*)(\d+)\.\s+(.*)$/,z5=/^\s/;function H5(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(Mw);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(Mw))break;if(h.trim()==="")p.push(h),d+=`
262
+ `,f+=1;else if(h.match(z5))p.push(h),d+=`
263
+ ${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
264
+ `)}),o=f,t=f}return[e,o]}function tM(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
265
+ `),a=((o=l[0])==null?void 0:o.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
266
+ `).trim();if(d){const h=t.blockTokens(d);u.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=tM(p,h,t);u.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
267
+ `)})}r.push({type:"list_item",raw:s.raw,tokens:u}),i=f}else i+=1}return r}function F5(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var j5="listItem",Tw="textStyle",Nw=/^(\d+)\.\s$/,W5=Sa.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Ti(this.options.HTMLAttributes,t),0]:["ol",Ti(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?F5(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
268
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
269
+ `),[i,s]=H5(r);if(i.length===0)return;const l=tM(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
270
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(j5,this.editor.getAttributes(Tw)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=sa({find:Nw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=sa({find:Nw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Tw)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),U5=/^\s*(\[([( |x])?\])\s$/,nM=Sa.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Ti(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const o=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return qg(n,e,o)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let d=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,u(f);const p=o.extensionManager.attributes,h=IU(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),d=m,!0}}}},addInputRules(){return[sa({find:U5,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),q5=Sa.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Ti(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
271
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=$h(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=$h(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Fn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(_5.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(I5.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(V5.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(W5.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(nM.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(q5.configure(this.options.taskList)),n}});var K5=nM;const oM=K5.extend({content:"paragraph block* taskList?",addKeyboardShortcuts(){return{Tab:()=>this.editor.can().sinkListItem(this.type)?this.editor.commands.sinkListItem(this.type):!1,"Shift-Tab":()=>this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1,Enter:()=>{const{$from:n}=this.editor.state.selection;return n.parent.textContent.length===0?this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1:this.editor.can().splitListItem(this.type)?this.editor.commands.splitListItem(this.type):!1}}}});/**
272
+ * Copyright 2026 Yiitap
273
+ * @license MIT
274
+ **/function J5(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=Mx(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const k=g+y.index;let w=k+y[0].length;return a&&d.test(m.slice(w-1,w+1))&&(y[0]+=" ",w+=1),k<l.pos&&w>=l.pos?{range:{from:k,to:w},query:y[0].slice(t.length),text:y[0]}:null}var G5=new ae("suggestion");function X5({pluginKey:n=G5,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=J5,shouldShow:y}){let b;const v=h==null?void 0:h(),k=()=>{const S=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(S),{top:N,right:$,bottom:O,left:A}=T;try{return new DOMRect(A,N,$-A,O-N)}catch{return null}},w=(S,T)=>T?()=>{const N=n.getState(e.state),$=N==null?void 0:N.decorationId,O=S.dom.querySelector(`[data-decoration-id="${$}"]`);return(O==null?void 0:O.getBoundingClientRect())||null}:k;function x(S,T){var N;try{const O=n.getState(S.state),A=O!=null&&O.decorationId?S.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null,B={editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},query:(O==null?void 0:O.query)||null,text:(O==null?void 0:O.text)||null,items:[],command:I=>f({editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},props:I}),decorationNode:A,clientRect:w(S,A)};(N=v==null?void 0:v.onExit)==null||N.call(v,B)}catch{}const $=S.state.tr.setMeta(T,{exit:!0});S.dispatch($)}const C=new ue({key:n,view(){return{update:async(S,T)=>{var N,$,O,A,B,I,L;const R=(N=this.key)==null?void 0:N.getState(T),q=($=this.key)==null?void 0:$.getState(S.state),z=R.active&&q.active&&R.range.from!==q.range.from,W=!R.active&&q.active,me=R.active&&!q.active,Ee=!W&&!me&&R.query!==q.query,De=W||z&&Ee,je=Ee||z,He=me||z&&Ee;if(!De&&!je&&!He)return;const Te=He&&!De?R:q,te=S.dom.querySelector(`[data-decoration-id="${Te.decorationId}"]`);b={editor:e,range:Te.range,query:Te.query,text:Te.text,items:[],command:we=>f({editor:e,range:Te.range,props:we}),decorationNode:te,clientRect:w(S,te)},De&&((O=v==null?void 0:v.onBeforeStart)==null||O.call(v,b)),je&&((A=v==null?void 0:v.onBeforeUpdate)==null||A.call(v,b)),(je||De)&&(b.items=await p({editor:e,query:Te.query})),He&&((B=v==null?void 0:v.onExit)==null||B.call(v,b)),je&&((I=v==null?void 0:v.onUpdate)==null||I.call(v,b)),De&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,T,N,$){const{isEditable:O}=e,{composing:A}=e.view,{selection:B}=S,{empty:I,from:L}=B,R={...T},q=S.getMeta(n);if(q&&q.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R;if(R.composing=A,O&&(I||e.view.composing)){(L<T.range.from||L>T.range.to)&&!A&&!T.composing&&(R.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:B.$from}),W=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:$,range:z.range,isActive:T.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(R.active=!0,R.decorationId=T.decorationId?T.decorationId:W,R.range=z.range,R.query=z.query,R.text=z.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(S,T){var N,$,O,A;const{active:B,range:I}=C.getState(S.state);if(!B)return!1;if(T.key==="Escape"||T.key==="Esc"){const L=C.getState(S.state),R=(N=b==null?void 0:b.decorationNode)!=null?N:null,q=R??(L!=null&&L.decorationId?S.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`):null);if(($=v==null?void 0:v.onKeyDown)!=null&&$.call(v,{view:S,event:T,range:L.range}))return!0;const z={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:W=>f({editor:e,range:L.range,props:W}),decorationNode:q,clientRect:q?()=>q.getBoundingClientRect()||null:null};return(O=v==null?void 0:v.onExit)==null||O.call(v,z),x(S,n),!0}return((A=v==null?void 0:v.onKeyDown)==null?void 0:A.call(v,{view:S,event:T,range:I}))||!1},decorations(S){const{active:T,range:N,decorationId:$,query:O}=C.getState(S);if(!T)return null;const A=!(O!=null&&O.length),B=[a];return A&&B.push(d),Ce.create(S.doc,[Ve.inline(N.from,N.to,{nodeName:l,class:B.join(" "),"data-decoration-id":$,"data-decoration-content":u})])}}});return C}var Xd=X5;const Y5=be.create({name:"char-command",addOptions(){return{pluginKey:"char-command",suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Xd({pluginKey:new ae(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),rM=be.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Xd({pluginKey:new ae("colon-command"),editor:this.editor,...this.options.suggestion})]}}),iM=be.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Xd({pluginKey:new ae("slash-command"),editor:this.editor,...this.options.suggestion})]}}),sM=be.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Xd({pluginKey:new ae("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}}),Q5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{run:t}=xe();return{locale:n,tr:e,run:t}},data(){return{view:"main"}},components:{OEmojiSelect:Td},methods:{onSelect(n){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(n.emoji),this.editor.chain().focus()},onKeyDown({event:n}){return!1}}},Jg=(n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t},Z5={class:"o-colon-view"};function e4(n,e,t,o,r,i){const s=c.resolveComponent("o-emoji-select");return c.openBlock(),c.createElementBlock("section",Z5,[c.createVNode(s,{items:t.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const t4=Jg(Q5,[["render",e4]]),lM={items:({query:n})=>Tl.filterEmojiGroups(n),render:()=>{let n,e;return{onStart:t=>{n=new wd(t4,{props:t,editor:t.editor}),t.clientRect&&(e=Ao("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},n4={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Lt},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{onCommand:t,run:o}=xe();return{locale:n,tr:e,onCommand:t,run:o}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:It,OIcon:X,OList:ln,OListItem:Ut},watch:{items(){this.selectedIndex=0}},methods:{onClick(n){switch(n.value){default:this.runCommand(n);break}return!0},runCommand(n){const e=this.editor.chain().focus().deleteRange(this.range),t=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","multiColumn","taskList"].includes(n.value)?(t.deleteRange(this.range),this.run(this.editor,n.value,n.options)):this.onCommand(t,e,n.value,n.options)},onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.onClick(e)},setEmoji(n){this.onClick({value:"content",options:{content:n}})}},computed:{basicBlocks(){return ba.slice(1)}},mounted(){this.selectedIndex=0}},o4={key:0,class:"view-main"},r4={class:"group o-tips"},i4={class:"o-tips"},s4={key:1,class:"item"},l4={key:1,class:"view-emoji"},a4={key:2,class:"view-emoji"};function c4(n,e,t,o,r,i){const s=c.resolveComponent("o-divider"),l=c.resolveComponent("o-icon"),a=c.resolveComponent("o-list-item"),u=c.resolveComponent("o-list");return c.openBlock(),c.createElementBlock("section",{class:c.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(c.openBlock(),c.createElementBlock("section",o4,[c.createVNode(u,{hoverable:"",clickable:""},{default:c.withCtx(()=>[t.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(t.items,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[f>0?(c.openBlock(),c.createBlock(s,{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",r4,c.toDisplayString(o.tr(d.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(a,{class:c.normalizeClass(["item",{"is-active":f===r.selectedIndex}]),clickable:"",onClick:p=>i.onClick(d)},{prefix:c.withCtx(()=>[c.createVNode(l,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("span",i4,c.toDisplayString(d.tips),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(o.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",s4,"No result"))]),_:1})])):r.view==="emoji"?(c.openBlock(),c.createElementBlock("section",l4)):r.view==="ai"?(c.openBlock(),c.createElementBlock("section",a4)):c.createCommentVNode("",!0)],2)}const u4=Jg(n4,[["render",c4]]),Dh={items:({query:n})=>Eu.filter(e=>{var t;return e.value.toLowerCase().includes(n.toLowerCase())||((t=e.keywords)==null?void 0:t.toLowerCase().includes(n.toLowerCase()))}),render:()=>{let n,e;return{onStart:t=>{n=new wd(u4,{props:t,editor:t.editor}),t.clientRect&&(e=Ao("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},d4={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.command({name:e.name})}}},f4={class:"dropdown-menu"},p4=["onClick"],h4=["src"];function m4(n,e,t,o,r,i){return c.openBlock(),c.createElementBlock("div",f4,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.items,(s,l)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass({"is-selected":l===r.selectedIndex}),key:l,onClick:a=>i.selectItem(l)},[s.fallbackImage?(c.openBlock(),c.createElementBlock("img",{key:0,src:s.fallbackImage,align:"middle"},null,8,h4)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(s.emoji),1)],64)),c.createTextVNode(" :"+c.toDisplayString(s.name)+": ",1)],10,p4))),128))])}const g4=Jg(d4,[["render",m4]]),y4={items:({editor:n,query:e})=>n.storage.emoji.emojis.filter(({shortcodes:t,tags:o})=>t.find(r=>r.startsWith(e.toLowerCase()))||o.find(r=>r.startsWith(e.toLowerCase()))).slice(0,10),render:()=>{let n;function e(t){if(!n||!n.element)return;ql({getBoundingClientRect(){return t}},n.element,{placement:"bottom-start"}).then(r=>{Object.assign(n.element.style,{left:`${r.x}px`,top:`${r.y}px`,position:r.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:t=>{n=new wd(g4,{props:t,editor:t.editor}),document.body.appendChild(n.element),e(t.clientRect())},onUpdate(t){n.updateProps(t),e(t.clientRect())},onKeyDown(t){var o;return t.event.key==="Escape"?(document.body.removeChild(n.element),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){document.body.contains(n.element)&&document.body.removeChild(n.element),n.destroy()}}}};/**
275
+ * Copyright 2026 Yiitap
276
+ * @license MIT
277
+ **/const b4=Be.create({name:"aiBlock",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{provider:{default:""},prompt:{default:""},time:{default:0}}},parseHTML(){return[{tag:'div[data-type="aiBlock"]'}]},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(o=>{const r=e.renderChildren(o);t.push(r)}),t.join(`
278
+ `)},renderHTML({HTMLAttributes:n}){return["div",pe(n,{"data-type":"aiBlock"}),0]},addCommands(){return{setAiBlock:()=>({commands:n})=>n.wrapIn(this.name),toggleAiBlock:()=>({commands:n})=>n.toggleWrap(this.name),unsetAiBlock:()=>({commands:n})=>n.lift(this.name),updateAiBlock:(n,e)=>({editor:t,tr:o,dispatch:r})=>{const i=o.doc.nodeAt(n);if(!i||i.type.name!==this.name)return console.error("Invalid node type."),!1;try{const s=Bn.fromJSON(t.schema,e),l=i.copy(s.content);return o.replaceWith(n,n+i.nodeSize,l),r==null?void 0:r(o)}catch(s){return console.error("Invalid content structure:",s),!1}}}}}),v4={class:"o-scroll"},w4={class:"view-main"},k4={class:"block-container"},x4={class:"block-content"},C4={key:0,class:"edit-prompt"},S4={key:1},E4={"data-tippy-role":"tooltip"},M4={class:"label"},T4={class:"block-container"},N4={class:"block-content"},A4=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{md:t,aiOption:o,createStreamingChatCompletion:r}=rg(),{languageName:i,tr:s}=de(),{isFocused:l,bind:a,unbind:u,checkFocus:d}=W1(),{theme:f}=Di(),{isEditable:p}=xe(),{getPos:h}=e,m=c.ref(null),g=c.ref(""),y=c.ref(!1),b=c.ref({}),v=c.ref(!1),k=c.ref(!1),w=c.ref(""),x=c.ref(null),C=c.ref(!1),S=c.ref(!1),T=c.computed(()=>({role:"system",content:og.writing.replace("[LANGUAGE]",i.value)})),N=c.ref([T.value]),$=c.computed(()=>!e.node.textContent),O=c.computed(()=>B1),A=c.computed({get(){return e.node.attrs.provider},set(te){e.updateAttributes({provider:te})}}),B=c.computed({get(){return e.node.attrs.prompt},set(te){e.updateAttributes({prompt:te})}}),I=c.computed({get(){return e.node.attrs.time},set(te){e.updateAttributes({time:te})}});function L(){g.value=B.value,$.value&&!B.value&&setTimeout(()=>{var te;(te=m.value)==null||te.focus()},0)}function R(){setTimeout(()=>{},0)}function q(){w.value="edit",setTimeout(()=>{var te;(te=x.value)==null||te.focus()},0)}function z(){A.value=o.value.provider,B.value=g.value,I.value=Date.now(),C.value=!0,w.value&&(w.value=""),S.value?me():W()}async function W(){const te=h();let we="";N.value.push({role:"user",content:B.value}),N.value[0].role==="system"&&(N.value.shift(),N.value.unshift(T.value));try{const Ne=await r(N.value,gt=>{we+=gt,N.value=[...N.value.slice(0,-1),{role:"assistant",content:we}];const yt=Zp(e.editor,t.render(we));Ee(te,yt)})}catch(Ne){N.value.pop(),console.error(Ne),mg.error(s("ai.error"))}C.value=!1}async function me(){const te=h();let we="";try{for(const Ne of xC){await new Promise(yt=>setTimeout(yt,500)),we+=Ne;const gt=Zp(e.editor,t.render(we));Ee(te,gt)}}catch(Ne){console.error(Ne)}C.value=!1}function Ee(te,we){var gt;const Ne=e.node.toJSON();Ne.content=we.content,(gt=e.editor)==null||gt.commands.updateAiBlock(te,Ne),e.editor.commands.setNodeSelection(te),e.editor.view.focus(),De()}function De(){const we=e.node.content.lastChild;if(we&&we.attrs["data-id"]){const Ne=we.attrs["data-id"],gt=document.querySelector(`[data-id="${Ne}"]`);gt&&gt.scrollIntoView({behavior:"smooth",block:"center"})}}function je(te){y.value=!1,te.value}function He(te,we){we?g.value=s(we.label):g.value=s(te.label),v.value=!1}function Te(te){y.value=!0,b.value=te}return c.watch(()=>e.node.content,te=>{d()}),c.watch($,te=>{te&&(k.value=!1)}),c.watch(l,te=>{te&&!$.value&&setTimeout(()=>{g.value=B.value,w.value="",k.value=te},100)}),c.onMounted(()=>{L(),a(e)}),c.onBeforeUnmount(()=>{u()}),(te,we)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:["o-ai-block-view",{"is-empty":$.value,"has-focus":c.unref(l)}],onContextmenu:c.withModifiers(Te,["prevent"])}),{default:c.withCtx(()=>[$.value?(c.openBlock(),c.createBlock(c.unref(Yn),{key:0,modelValue:v.value,"onUpdate:modelValue":we[1]||(we[1]=Ne=>v.value=Ne),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":c.withCtx(()=>[c.createElementVNode("section",v4,[c.createElementVNode("section",w4,[c.createVNode(c.unref(Ed),{items:O.value,onSelect:He,"use-keyboard":v.value},null,8,["items","use-keyboard"])])])]),default:c.withCtx(()=>[c.createElementVNode("div",k4,[c.createElementVNode("div",x4,[c.createVNode(c.unref(to),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":we[0]||(we[0]=Ne=>g.value=Ne),placeholder:c.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:R},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Gn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(s)("label.generate"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.withDirectives(c.createVNode(c.unref(Yn),{modelValue:k.value,"onUpdate:modelValue":we[4]||(we[4]=Ne=>k.value=Ne),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":c.withCtx(()=>[w.value==="edit"?(c.openBlock(),c.createElementBlock("section",C4,[c.createVNode(c.unref(to),{ref_key:"updateInputRef",ref:x,modelValue:g.value,"onUpdate:modelValue":we[2]||(we[2]=Ne=>g.value=Ne),placeholder:c.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Gn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(s)("label.generate"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(c.openBlock(),c.createElementBlock("section",S4,[c.createVNode(c.unref(bC),null,{default:c.withCtx(()=>[c.createElementVNode("div",E4,[c.createVNode(c.unref(Ge),{icon:"auto_awesome",onClick:q},{default:c.withCtx(()=>[c.createElementVNode("span",M4,c.toDisplayString(c.unref(s)("label.generatedBy"))+" "+c.toDisplayString(c.unref(ng)(A.value,"name")||"AI"),1)]),_:1})]),c.createVNode(c.unref(Gn),{icon:"autorenew",tooltip:c.unref(s)("label.update"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1})]))]),default:c.withCtx(()=>[c.createElementVNode("div",T4,[c.createElementVNode("div",N4,[c.createVNode(c.unref(tr))]),c.unref(p)?(c.openBlock(),c.createBlock(c.unref($s),{key:0,modelValue:y.value,"onUpdate:modelValue":we[3]||(we[3]=Ne=>y.value=Ne),event:b.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:je}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[c.vShow,!$.value]])]),_:1},16,["class"]))}}),aM=b4.extend({addNodeView(){return En(A4)}}),O4={key:1,class:"audio-container"},Wi="//init.mp3",$4=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref({});c.ref(null),c.ref(!1);const s=c.ref(!1);c.computed({get(){return e.node.attrs.caption},set(h){e.updateAttributes({caption:h})}});const l=c.computed({get(){return e.node.attrs.src},set(h){e.updateAttributes({src:h})}});function a(h){switch(r.value=!1,h.value){case"replace":p(!0);break}}function u(){l.value===Wi&&p(!0)}function d(h){r.value=!0,i.value=h}function f(h){l.value=h,p(!1)}function p(h){s.value=h}return c.onMounted(()=>{p(l.value===Wi)}),(h,m)=>{var g;return c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:["o-audio-view",{readonly:!((g=h.editor)!=null&&g.isEditable),init:l.value===Wi}],as:"div",onContextmenu:c.withModifiers(d,["prevent"]),onClick:u}),{default:c.withCtx(()=>[c.createVNode(c.unref(Yn),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y),placement:l.value===Wi?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Nd),{val:l.value===Wi?"":l.value,type:"audio",onInput:f},null,8,["val"])]),default:c.withCtx(()=>[l.value===Wi?(c.openBlock(),c.createBlock(c.unref(va),{key:0,icon:"graphic_eq",placeholder:c.unref(t)("label.audioAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",O4,[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Md),c.mergeProps({key:0},e,{onAction:a}),{default:c.withCtx(()=>[c.createCommentVNode("",!0)]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("audio",c.mergeProps(h.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(h.node.attrs)),null,16)],16)]))]),_:1},8,["modelValue","placement"]),c.createVNode(c.unref($s),{modelValue:r.value,"onUpdate:modelValue":m[1]||(m[1]=y=>r.value=y),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:a}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),cM=ZT.extend({addNodeView(){return En($4)}}),R4={class:"header o-tips"},B4={style:{display:"flex"}},D4=["innerHTML"],_4=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref(null),s=c.computed({get(){return e.node.attrs.latex},set(d){e.updateAttributes({latex:d||""})}}),l=c.computed(()=>eN.renderToString(s.value,{throwOnError:!1}));function a(d){r.value=d,d&&setTimeout(()=>{var f;(f=i.value)==null||f.focus()},100)}function u(){window.open("https://katex.org/docs/supported.html","target")}return c.onMounted(()=>{a(!s.value)}),(d,f)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:["o-block-math-view",{init:!s.value}],as:"div",onClick:f[3]||(f[3]=p=>a(!0))}),{default:c.withCtx(()=>[c.createVNode(c.unref(Yn),{modelValue:r.value,"onUpdate:modelValue":f[2]||(f[2]=p=>r.value=p),"content-class":"o-block-math-editor",placement:s.value==="init"?"bottom":"top",readonly:!c.unref(o),"show-arrow":""},{"popover-content":c.withCtx(()=>[c.createElementVNode("header",R4,[c.createElementVNode("div",B4,[c.createVNode(c.unref(X),{name:"functions"}),c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.blockMath")),1)]),c.createElementVNode("div",null,[c.createVNode(c.unref(Ze),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:u},null,8,["tooltip"])])]),c.createVNode(c.unref(kC),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=p=>s.value=p),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:c.withCtx(()=>[s.value?(c.openBlock(),c.createElementBlock("div",{key:1,class:"block-math-container",onClick:f[1]||(f[1]=p=>a(!0))},[c.createElementVNode("div",{class:"katex-container",innerHTML:l.value},null,8,D4)])):(c.openBlock(),c.createBlock(c.unref(va),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),uM=Nl.BlockMath.extend({addCommands(){return{insertBlockMath:(n={})=>({tr:e,dispatch:t,state:o})=>{const r=o.schema.nodes.blockMath.create({latex:n.latex??""});return t&&(e.replaceSelectionWith(r),e.scrollIntoView()),!0}}},addNodeView(){return En(_4)}}),I4=c.defineComponent({__name:"view",props:ht,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:"o-blockquote-view"}),{default:c.withCtx(()=>[c.createElementVNode("blockquote",null,[c.createVNode(c.unref(tr))])]),_:1},16))}}),dM=tB.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new zr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.blockquote.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,u,d);const f=U.near(i.doc.resolve(a+2));i.setSelection(f)}})]},addNodeView(){return En(I4)}});/**
279
+ * Copyright 2026 Yiitap
280
+ * @license MIT
281
+ **/const L4=Be.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{},triggerCharacters:["?","?"]}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new zr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.callout.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,u,d);const f=U.near(i.doc.resolve(a+2));i.setSelection(f)}})]},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:n}){return["div",pe(n,{"data-type":"callout"}),0]},markdownTokenName:"callout",parseMarkdown:(n,e)=>{const t=n.info.replace("info","").trim()||"🌾",o=e.parseChildren(n.tokens??[]);return console.log("callout parseMarkdown",n.info),console.log("callout parseMarkdown",n,o,t),e.createNode("callout",{icon:t},o)},renderMarkdown:(n,e)=>{var i;if(!n.content)return"";const t=`::: info ${((i=n.attrs)==null?void 0:i.icon)||"🌾"}`,o=":::",r=[];return n.content.forEach(s=>{const l=e.renderChildren(s);r.push(l)}),t+`
282
+ `+r.join(`
283
+
284
+ `)+`
285
+ `+o},markdownTokenizer:{name:"callout",level:"block",start:n=>{var e;return((e=n.match(/^:::/))==null?void 0:e.index)??-1},tokenize(n,e,t){const o=/^:::([^\n]+)\n([\s\S]*?)\n:::\s*(?:\n|$)/.exec(n);if(!o)return;const[,r,i]=o;console.log("markdownTokenizer",n,o,r,i);const s=t.blockTokens(i);return{type:"callout",raw:o[0],info:r,tokens:s}}},addCommands(){return{setCallout:()=>({commands:n})=>n.wrapIn(this.name),toggleCallout:()=>({commands:n})=>n.toggleWrap(this.name),unsetCallout:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>this.editor.commands.toggleCallout()}}}),P4={class:"callout-container"},V4={class:"callout-icon"},z4={class:"callout-content"},H4=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{theme:t}=Di(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref(!1),s=c.ref({}),l=c.ref(null),a=c.computed(()=>{const{selection:w}=e.editor.view.state,x=w.from,C=e.getPos(),S=C+e.node.nodeSize;return x>=C&&x<=S}),u=c.computed({get(){return e.node.attrs.backColor},set(w){e.updateAttributes({backColor:w})}}),d=c.computed({get(){return e.node.attrs.backColorDark},set(w){e.updateAttributes({backColorDark:w})}}),f=c.computed({get(){return e.node.attrs.borderColor},set(w){e.updateAttributes({borderColor:w})}}),p=c.computed({get(){return e.node.attrs.borderColorDark},set(w){e.updateAttributes({borderColorDark:w})}}),h=c.computed(()=>t.value==="dark"?d.value:u.value),m=c.computed(()=>t.value==="dark"?p.value:f.value);function g(w){e.updateAttributes({icon:w})}function y(w){switch(r.value=!1,w.value){case"palette":v(!0);break}}function b(w){r.value=!0,s.value=w}function v(w){i.value=w}function k(w,x){var C;switch(w){case"backColor":u.value=x;break;case"foreColor":f.value=x;break;case"icon":g(x.emoji),(C=l.value)==null||C.setShow(!1);break}}return c.watch(a,w=>{v(w)}),(w,x)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:c.withModifiers(b,["prevent"])}),{default:c.withCtx(()=>[c.createElementVNode("div",P4,[c.createVNode(c.unref($e),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!c.unref(o)},{trigger:c.withCtx(()=>[c.createElementVNode("div",V4,c.toDisplayString(w.node.attrs.icon),1)]),default:c.withCtx(()=>[c.createVNode(c.unref(Td),{items:c.unref(Tl.emojiGroups),onSelect:x[0]||(x[0]=C=>k("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),c.createElementVNode("div",z4,[c.createVNode(c.unref(tr))]),c.unref(o)?(c.openBlock(),c.createBlock(c.unref($s),{key:0,modelValue:r.value,"onUpdate:modelValue":x[1]||(x[1]=C=>r.value=C),event:s.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:y}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),fM=L4.extend({addNodeView(){return En(H4)}});function F4(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var tp,Aw;function j4(){if(Aw)return tp;Aw=1;function n(E){return E instanceof Map?E.clear=E.delete=E.set=function(){throw new Error("map is read-only")}:E instanceof Set&&(E.add=E.clear=E.delete=function(){throw new Error("set is read-only")}),Object.freeze(E),Object.getOwnPropertyNames(E).forEach(D=>{const j=E[D],ge=typeof j;(ge==="object"||ge==="function")&&!Object.isFrozen(j)&&n(j)}),E}class e{constructor(D){D.data===void 0&&(D.data={}),this.data=D.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(E){return E.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(E,...D){const j=Object.create(null);for(const ge in E)j[ge]=E[ge];return D.forEach(function(ge){for(const Ye in ge)j[Ye]=ge[Ye]}),j}const r="</span>",i=E=>!!E.scope,s=(E,{prefix:D})=>{if(E.startsWith("language:"))return E.replace("language:","language-");if(E.includes(".")){const j=E.split(".");return[`${D}${j.shift()}`,...j.map((ge,Ye)=>`${ge}${"_".repeat(Ye+1)}`)].join(" ")}return`${D}${E}`};class l{constructor(D,j){this.buffer="",this.classPrefix=j.classPrefix,D.walk(this)}addText(D){this.buffer+=t(D)}openNode(D){if(!i(D))return;const j=s(D.scope,{prefix:this.classPrefix});this.span(j)}closeNode(D){i(D)&&(this.buffer+=r)}value(){return this.buffer}span(D){this.buffer+=`<span class="${D}">`}}const a=(E={})=>{const D={children:[]};return Object.assign(D,E),D};class u{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(D){this.top.children.push(D)}openNode(D){const j=a({scope:D});this.add(j),this.stack.push(j)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(D){return this.constructor._walk(D,this.rootNode)}static _walk(D,j){return typeof j=="string"?D.addText(j):j.children&&(D.openNode(j),j.children.forEach(ge=>this._walk(D,ge)),D.closeNode(j)),D}static _collapse(D){typeof D!="string"&&D.children&&(D.children.every(j=>typeof j=="string")?D.children=[D.children.join("")]:D.children.forEach(j=>{u._collapse(j)}))}}class d extends u{constructor(D){super(),this.options=D}addText(D){D!==""&&this.add(D)}startScope(D){this.openNode(D)}endScope(){this.closeNode()}__addSublanguage(D,j){const ge=D.root;j&&(ge.scope=`language:${j}`),this.add(ge)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(E){return E?typeof E=="string"?E:E.source:null}function p(E){return g("(?=",E,")")}function h(E){return g("(?:",E,")*")}function m(E){return g("(?:",E,")?")}function g(...E){return E.map(j=>f(j)).join("")}function y(E){const D=E[E.length-1];return typeof D=="object"&&D.constructor===Object?(E.splice(E.length-1,1),D):{}}function b(...E){return"("+(y(E).capture?"":"?:")+E.map(ge=>f(ge)).join("|")+")"}function v(E){return new RegExp(E.toString()+"|").exec("").length-1}function k(E,D){const j=E&&E.exec(D);return j&&j.index===0}const w=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function x(E,{joinWith:D}){let j=0;return E.map(ge=>{j+=1;const Ye=j;let We=f(ge),ne="";for(;We.length>0;){const Y=w.exec(We);if(!Y){ne+=We;break}ne+=We.substring(0,Y.index),We=We.substring(Y.index+Y[0].length),Y[0][0]==="\\"&&Y[1]?ne+="\\"+String(Number(Y[1])+Ye):(ne+=Y[0],Y[0]==="("&&j++)}return ne}).map(ge=>`(${ge})`).join(D)}const C=/\b\B/,S="[a-zA-Z]\\w*",T="[a-zA-Z_]\\w*",N="\\b\\d+(\\.\\d+)?",$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",A="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",B=(E={})=>{const D=/^#![ ]*\//;return E.binary&&(E.begin=g(D,/.*\b/,E.binary,/\b.*/)),o({scope:"meta",begin:D,end:/$/,relevance:0,"on:begin":(j,ge)=>{j.index!==0&&ge.ignoreMatch()}},E)},I={begin:"\\\\[\\s\\S]",relevance:0},L={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[I]},R={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[I]},q={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},z=function(E,D,j={}){const ge=o({scope:"comment",begin:E,end:D,contains:[]},j);ge.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ye=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ge.contains.push({begin:g(/[ ]+/,"(",Ye,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ge},W=z("//","$"),me=z("/\\*","\\*/"),Ee=z("#","$"),De={scope:"number",begin:N,relevance:0},je={scope:"number",begin:$,relevance:0},He={scope:"number",begin:O,relevance:0},Te={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[I,{begin:/\[/,end:/\]/,relevance:0,contains:[I]}]},te={scope:"title",begin:S,relevance:0},we={scope:"title",begin:T,relevance:0},Ne={begin:"\\.\\s*"+T,relevance:0};var yt=Object.freeze({__proto__:null,APOS_STRING_MODE:L,BACKSLASH_ESCAPE:I,BINARY_NUMBER_MODE:He,BINARY_NUMBER_RE:O,COMMENT:z,C_BLOCK_COMMENT_MODE:me,C_LINE_COMMENT_MODE:W,C_NUMBER_MODE:je,C_NUMBER_RE:$,END_SAME_AS_BEGIN:function(E){return Object.assign(E,{"on:begin":(D,j)=>{j.data._beginMatch=D[1]},"on:end":(D,j)=>{j.data._beginMatch!==D[1]&&j.ignoreMatch()}})},HASH_COMMENT_MODE:Ee,IDENT_RE:S,MATCH_NOTHING_RE:C,METHOD_GUARD:Ne,NUMBER_MODE:De,NUMBER_RE:N,PHRASAL_WORDS_MODE:q,QUOTE_STRING_MODE:R,REGEXP_MODE:Te,RE_STARTERS_RE:A,SHEBANG:B,TITLE_MODE:te,UNDERSCORE_IDENT_RE:T,UNDERSCORE_TITLE_MODE:we});function so(E,D){E.input[E.index-1]==="."&&D.ignoreMatch()}function rr(E,D){E.className!==void 0&&(E.scope=E.className,delete E.className)}function Bo(E,D){D&&E.beginKeywords&&(E.begin="\\b("+E.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",E.__beforeBegin=so,E.keywords=E.keywords||E.beginKeywords,delete E.beginKeywords,E.relevance===void 0&&(E.relevance=0))}function Do(E,D){Array.isArray(E.illegal)&&(E.illegal=b(...E.illegal))}function ir(E,D){if(E.match){if(E.begin||E.end)throw new Error("begin & end are not supported with match");E.begin=E.match,delete E.match}}function Mn(E,D){E.relevance===void 0&&(E.relevance=1)}const _o=(E,D)=>{if(!E.beforeMatch)return;if(E.starts)throw new Error("beforeMatch cannot be used with starts");const j=Object.assign({},E);Object.keys(E).forEach(ge=>{delete E[ge]}),E.keywords=j.keywords,E.begin=g(j.beforeMatch,p(j.begin)),E.starts={relevance:0,contains:[Object.assign(j,{endsParent:!0})]},E.relevance=0,delete j.beforeMatch},sr=["of","and","for","in","not","or","if","then","parent","list","value"],lr="keyword";function Pt(E,D,j=lr){const ge=Object.create(null);return typeof E=="string"?Ye(j,E.split(" ")):Array.isArray(E)?Ye(j,E):Object.keys(E).forEach(function(We){Object.assign(ge,Pt(E[We],D,We))}),ge;function Ye(We,ne){D&&(ne=ne.map(Y=>Y.toLowerCase())),ne.forEach(function(Y){const ye=Y.split("|");ge[ye[0]]=[We,hn(ye[0],ye[1])]})}}function hn(E,D){return D?Number(D):lo(E)?0:1}function lo(E){return sr.includes(E.toLowerCase())}const mn={},Qt=E=>{console.error(E)},Io=(E,...D)=>{console.log(`WARN: ${E}`,...D)},Vt=(E,D)=>{mn[`${E}/${D}`]||(console.log(`Deprecated as of ${E}. ${D}`),mn[`${E}/${D}`]=!0)},jn=new Error;function ao(E,D,{key:j}){let ge=0;const Ye=E[j],We={},ne={};for(let Y=1;Y<=D.length;Y++)ne[Y+ge]=Ye[Y],We[Y+ge]=!0,ge+=v(D[Y-1]);E[j]=ne,E[j]._emit=We,E[j]._multi=!0}function Is(E){if(Array.isArray(E.begin)){if(E.skip||E.excludeBegin||E.returnBegin)throw Qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),jn;if(typeof E.beginScope!="object"||E.beginScope===null)throw Qt("beginScope must be object"),jn;ao(E,E.begin,{key:"beginScope"}),E.begin=x(E.begin,{joinWith:""})}}function Ls(E){if(Array.isArray(E.end)){if(E.skip||E.excludeEnd||E.returnEnd)throw Qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),jn;if(typeof E.endScope!="object"||E.endScope===null)throw Qt("endScope must be object"),jn;ao(E,E.end,{key:"endScope"}),E.end=x(E.end,{joinWith:""})}}function Li(E){E.scope&&typeof E.scope=="object"&&E.scope!==null&&(E.beginScope=E.scope,delete E.scope)}function Pi(E){Li(E),typeof E.beginScope=="string"&&(E.beginScope={_wrap:E.beginScope}),typeof E.endScope=="string"&&(E.endScope={_wrap:E.endScope}),Is(E),Ls(E)}function Vi(E){function D(ne,Y){return new RegExp(f(ne),"m"+(E.case_insensitive?"i":"")+(E.unicodeRegex?"u":"")+(Y?"g":""))}class j{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Y,ye){ye.position=this.position++,this.matchIndexes[this.matchAt]=ye,this.regexes.push([ye,Y]),this.matchAt+=v(Y)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Y=this.regexes.map(ye=>ye[1]);this.matcherRe=D(x(Y,{joinWith:"|"}),!0),this.lastIndex=0}exec(Y){this.matcherRe.lastIndex=this.lastIndex;const ye=this.matcherRe.exec(Y);if(!ye)return null;const vt=ye.findIndex((Vs,nf)=>nf>0&&Vs!==void 0),ct=this.matchIndexes[vt];return ye.splice(0,vt),Object.assign(ye,ct)}}class ge{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Y){if(this.multiRegexes[Y])return this.multiRegexes[Y];const ye=new j;return this.rules.slice(Y).forEach(([vt,ct])=>ye.addRule(vt,ct)),ye.compile(),this.multiRegexes[Y]=ye,ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Y,ye){this.rules.push([Y,ye]),ye.type==="begin"&&this.count++}exec(Y){const ye=this.getMatcher(this.regexIndex);ye.lastIndex=this.lastIndex;let vt=ye.exec(Y);if(this.resumingScanAtSamePosition()&&!(vt&&vt.index===this.lastIndex)){const ct=this.getMatcher(0);ct.lastIndex=this.lastIndex+1,vt=ct.exec(Y)}return vt&&(this.regexIndex+=vt.position+1,this.regexIndex===this.count&&this.considerAll()),vt}}function Ye(ne){const Y=new ge;return ne.contains.forEach(ye=>Y.addRule(ye.begin,{rule:ye,type:"begin"})),ne.terminatorEnd&&Y.addRule(ne.terminatorEnd,{type:"end"}),ne.illegal&&Y.addRule(ne.illegal,{type:"illegal"}),Y}function We(ne,Y){const ye=ne;if(ne.isCompiled)return ye;[rr,ir,Pi,_o].forEach(ct=>ct(ne,Y)),E.compilerExtensions.forEach(ct=>ct(ne,Y)),ne.__beforeBegin=null,[Bo,Do,Mn].forEach(ct=>ct(ne,Y)),ne.isCompiled=!0;let vt=null;return typeof ne.keywords=="object"&&ne.keywords.$pattern&&(ne.keywords=Object.assign({},ne.keywords),vt=ne.keywords.$pattern,delete ne.keywords.$pattern),vt=vt||/\w+/,ne.keywords&&(ne.keywords=Pt(ne.keywords,E.case_insensitive)),ye.keywordPatternRe=D(vt,!0),Y&&(ne.begin||(ne.begin=/\B|\b/),ye.beginRe=D(ye.begin),!ne.end&&!ne.endsWithParent&&(ne.end=/\B|\b/),ne.end&&(ye.endRe=D(ye.end)),ye.terminatorEnd=f(ye.end)||"",ne.endsWithParent&&Y.terminatorEnd&&(ye.terminatorEnd+=(ne.end?"|":"")+Y.terminatorEnd)),ne.illegal&&(ye.illegalRe=D(ne.illegal)),ne.contains||(ne.contains=[]),ne.contains=[].concat(...ne.contains.map(function(ct){return P(ct==="self"?ne:ct)})),ne.contains.forEach(function(ct){We(ct,ye)}),ne.starts&&We(ne.starts,Y),ye.matcher=Ye(ye),ye}if(E.compilerExtensions||(E.compilerExtensions=[]),E.contains&&E.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return E.classNameAliases=o(E.classNameAliases||{}),We(E)}function M(E){return E?E.endsWithParent||M(E.starts):!1}function P(E){return E.variants&&!E.cachedVariants&&(E.cachedVariants=E.variants.map(function(D){return o(E,{variants:null},D)})),E.cachedVariants?E.cachedVariants:M(E)?o(E,{starts:E.starts?o(E.starts):null}):Object.isFrozen(E)?o(E):E}var ee="11.11.1";class ve extends Error{constructor(D,j){super(D),this.name="HTMLInjectionError",this.html=j}}const fe=t,at=o,Mt=Symbol("nomatch"),ar=7,Ps=function(E){const D=Object.create(null),j=Object.create(null),ge=[];let Ye=!0;const We="Could not find the language '{}', did you forget to load/include a language module?",ne={disableAutodetect:!0,name:"Plain text",contains:[]};let Y={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function ye(H){return Y.noHighlightRe.test(H)}function vt(H){let ce=H.className+" ";ce+=H.parentNode?H.parentNode.className:"";const Ae=Y.languageDetectRe.exec(ce);if(Ae){const Ue=cr(Ae[1]);return Ue||(Io(We.replace("{}",Ae[1])),Io("Falling back to no-highlight mode for this block.",H)),Ue?Ae[1]:"no-highlight"}return ce.split(/\s+/).find(Ue=>ye(Ue)||cr(Ue))}function ct(H,ce,Ae){let Ue="",bt="";typeof ce=="object"?(Ue=H,Ae=ce.ignoreIllegals,bt=ce.language):(Vt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Vt("10.7.0",`Please use highlight(code, options) instead.
286
+ https://github.com/highlightjs/highlight.js/issues/2277`),bt=H,Ue=ce),Ae===void 0&&(Ae=!0);const Wn={code:Ue,language:bt};Aa("before:highlight",Wn);const ur=Wn.result?Wn.result:Vs(Wn.language,Wn.code,Ae);return ur.code=Wn.code,Aa("after:highlight",ur),ur}function Vs(H,ce,Ae,Ue){const bt=Object.create(null);function Wn(K,ie){return K.keywords[ie]}function ur(){if(!ke.keywords){Tt.addText(qe);return}let K=0;ke.keywordPatternRe.lastIndex=0;let ie=ke.keywordPatternRe.exec(qe),Me="";for(;ie;){Me+=qe.substring(K,ie.index);const Pe=uo.case_insensitive?ie[0].toLowerCase():ie[0],zt=Wn(ke,Pe);if(zt){const[Lo,qT]=zt;if(Tt.addText(Me),Me="",bt[Pe]=(bt[Pe]||0)+1,bt[Pe]<=ar&&(Ra+=qT),Lo.startsWith("_"))Me+=ie[0];else{const KT=uo.classNameAliases[Lo]||Lo;co(ie[0],KT)}}else Me+=ie[0];K=ke.keywordPatternRe.lastIndex,ie=ke.keywordPatternRe.exec(qe)}Me+=qe.substring(K),Tt.addText(Me)}function Oa(){if(qe==="")return;let K=null;if(typeof ke.subLanguage=="string"){if(!D[ke.subLanguage]){Tt.addText(qe);return}K=Vs(ke.subLanguage,qe,!0,yy[ke.subLanguage]),yy[ke.subLanguage]=K._top}else K=of(qe,ke.subLanguage.length?ke.subLanguage:null);ke.relevance>0&&(Ra+=K.relevance),Tt.__addSublanguage(K._emitter,K.language)}function gn(){ke.subLanguage!=null?Oa():ur(),qe=""}function co(K,ie){K!==""&&(Tt.startScope(ie),Tt.addText(K),Tt.endScope())}function py(K,ie){let Me=1;const Pe=ie.length-1;for(;Me<=Pe;){if(!K._emit[Me]){Me++;continue}const zt=uo.classNameAliases[K[Me]]||K[Me],Lo=ie[Me];zt?co(Lo,zt):(qe=Lo,ur(),qe=""),Me++}}function hy(K,ie){return K.scope&&typeof K.scope=="string"&&Tt.openNode(uo.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(co(qe,uo.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),qe=""):K.beginScope._multi&&(py(K.beginScope,ie),qe="")),ke=Object.create(K,{parent:{value:ke}}),ke}function my(K,ie,Me){let Pe=k(K.endRe,Me);if(Pe){if(K["on:end"]){const zt=new e(K);K["on:end"](ie,zt),zt.isMatchIgnored&&(Pe=!1)}if(Pe){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return my(K.parent,ie,Me)}function HT(K){return ke.matcher.regexIndex===0?(qe+=K[0],1):(af=!0,0)}function FT(K){const ie=K[0],Me=K.rule,Pe=new e(Me),zt=[Me.__beforeBegin,Me["on:begin"]];for(const Lo of zt)if(Lo&&(Lo(K,Pe),Pe.isMatchIgnored))return HT(ie);return Me.skip?qe+=ie:(Me.excludeBegin&&(qe+=ie),gn(),!Me.returnBegin&&!Me.excludeBegin&&(qe=ie)),hy(Me,K),Me.returnBegin?0:ie.length}function jT(K){const ie=K[0],Me=ce.substring(K.index),Pe=my(ke,K,Me);if(!Pe)return Mt;const zt=ke;ke.endScope&&ke.endScope._wrap?(gn(),co(ie,ke.endScope._wrap)):ke.endScope&&ke.endScope._multi?(gn(),py(ke.endScope,K)):zt.skip?qe+=ie:(zt.returnEnd||zt.excludeEnd||(qe+=ie),gn(),zt.excludeEnd&&(qe=ie));do ke.scope&&Tt.closeNode(),!ke.skip&&!ke.subLanguage&&(Ra+=ke.relevance),ke=ke.parent;while(ke!==Pe.parent);return Pe.starts&&hy(Pe.starts,K),zt.returnEnd?0:ie.length}function WT(){const K=[];for(let ie=ke;ie!==uo;ie=ie.parent)ie.scope&&K.unshift(ie.scope);K.forEach(ie=>Tt.openNode(ie))}let $a={};function gy(K,ie){const Me=ie&&ie[0];if(qe+=K,Me==null)return gn(),0;if($a.type==="begin"&&ie.type==="end"&&$a.index===ie.index&&Me===""){if(qe+=ce.slice(ie.index,ie.index+1),!Ye){const Pe=new Error(`0 width match regex (${H})`);throw Pe.languageName=H,Pe.badRule=$a.rule,Pe}return 1}if($a=ie,ie.type==="begin")return FT(ie);if(ie.type==="illegal"&&!Ae){const Pe=new Error('Illegal lexeme "'+Me+'" for mode "'+(ke.scope||"<unnamed>")+'"');throw Pe.mode=ke,Pe}else if(ie.type==="end"){const Pe=jT(ie);if(Pe!==Mt)return Pe}if(ie.type==="illegal"&&Me==="")return qe+=`
287
+ `,1;if(lf>1e5&&lf>ie.index*3)throw new Error("potential infinite loop, way more iterations than matches");return qe+=Me,Me.length}const uo=cr(H);if(!uo)throw Qt(We.replace("{}",H)),new Error('Unknown language: "'+H+'"');const UT=Vi(uo);let sf="",ke=Ue||UT;const yy={},Tt=new Y.__emitter(Y);WT();let qe="",Ra=0,qr=0,lf=0,af=!1;try{if(uo.__emitTokens)uo.__emitTokens(ce,Tt);else{for(ke.matcher.considerAll();;){lf++,af?af=!1:ke.matcher.considerAll(),ke.matcher.lastIndex=qr;const K=ke.matcher.exec(ce);if(!K)break;const ie=ce.substring(qr,K.index),Me=gy(ie,K);qr=K.index+Me}gy(ce.substring(qr))}return Tt.finalize(),sf=Tt.toHTML(),{language:H,value:sf,relevance:Ra,illegal:!1,_emitter:Tt,_top:ke}}catch(K){if(K.message&&K.message.includes("Illegal"))return{language:H,value:fe(ce),illegal:!0,relevance:0,_illegalBy:{message:K.message,index:qr,context:ce.slice(qr-100,qr+100),mode:K.mode,resultSoFar:sf},_emitter:Tt};if(Ye)return{language:H,value:fe(ce),illegal:!1,relevance:0,errorRaised:K,_emitter:Tt,_top:ke};throw K}}function nf(H){const ce={value:fe(H),illegal:!1,relevance:0,_top:ne,_emitter:new Y.__emitter(Y)};return ce._emitter.addText(H),ce}function of(H,ce){ce=ce||Y.languages||Object.keys(D);const Ae=nf(H),Ue=ce.filter(cr).filter(fy).map(gn=>Vs(gn,H,!1));Ue.unshift(Ae);const bt=Ue.sort((gn,co)=>{if(gn.relevance!==co.relevance)return co.relevance-gn.relevance;if(gn.language&&co.language){if(cr(gn.language).supersetOf===co.language)return 1;if(cr(co.language).supersetOf===gn.language)return-1}return 0}),[Wn,ur]=bt,Oa=Wn;return Oa.secondBest=ur,Oa}function OT(H,ce,Ae){const Ue=ce&&j[ce]||Ae;H.classList.add("hljs"),H.classList.add(`language-${Ue}`)}function rf(H){let ce=null;const Ae=vt(H);if(ye(Ae))return;if(Aa("before:highlightElement",{el:H,language:Ae}),H.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",H);return}if(H.children.length>0&&(Y.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(H)),Y.throwUnescapedHTML))throw new ve("One of your code blocks includes unescaped HTML.",H.innerHTML);ce=H;const Ue=ce.textContent,bt=Ae?ct(Ue,{language:Ae,ignoreIllegals:!0}):of(Ue);H.innerHTML=bt.value,H.dataset.highlighted="yes",OT(H,Ae,bt.language),H.result={language:bt.language,re:bt.relevance,relevance:bt.relevance},bt.secondBest&&(H.secondBest={language:bt.secondBest.language,relevance:bt.secondBest.relevance}),Aa("after:highlightElement",{el:H,result:bt,text:Ue})}function $T(H){Y=at(Y,H)}const RT=()=>{Na(),Vt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function BT(){Na(),Vt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let uy=!1;function Na(){function H(){Na()}if(document.readyState==="loading"){uy||window.addEventListener("DOMContentLoaded",H,!1),uy=!0;return}document.querySelectorAll(Y.cssSelector).forEach(rf)}function DT(H,ce){let Ae=null;try{Ae=ce(E)}catch(Ue){if(Qt("Language definition for '{}' could not be registered.".replace("{}",H)),Ye)Qt(Ue);else throw Ue;Ae=ne}Ae.name||(Ae.name=H),D[H]=Ae,Ae.rawDefinition=ce.bind(null,E),Ae.aliases&&dy(Ae.aliases,{languageName:H})}function _T(H){delete D[H];for(const ce of Object.keys(j))j[ce]===H&&delete j[ce]}function IT(){return Object.keys(D)}function cr(H){return H=(H||"").toLowerCase(),D[H]||D[j[H]]}function dy(H,{languageName:ce}){typeof H=="string"&&(H=[H]),H.forEach(Ae=>{j[Ae.toLowerCase()]=ce})}function fy(H){const ce=cr(H);return ce&&!ce.disableAutodetect}function LT(H){H["before:highlightBlock"]&&!H["before:highlightElement"]&&(H["before:highlightElement"]=ce=>{H["before:highlightBlock"](Object.assign({block:ce.el},ce))}),H["after:highlightBlock"]&&!H["after:highlightElement"]&&(H["after:highlightElement"]=ce=>{H["after:highlightBlock"](Object.assign({block:ce.el},ce))})}function PT(H){LT(H),ge.push(H)}function VT(H){const ce=ge.indexOf(H);ce!==-1&&ge.splice(ce,1)}function Aa(H,ce){const Ae=H;ge.forEach(function(Ue){Ue[Ae]&&Ue[Ae](ce)})}function zT(H){return Vt("10.7.0","highlightBlock will be removed entirely in v12.0"),Vt("10.7.0","Please use highlightElement now."),rf(H)}Object.assign(E,{highlight:ct,highlightAuto:of,highlightAll:Na,highlightElement:rf,highlightBlock:zT,configure:$T,initHighlighting:RT,initHighlightingOnLoad:BT,registerLanguage:DT,unregisterLanguage:_T,listLanguages:IT,getLanguage:cr,registerAliases:dy,autoDetection:fy,inherit:at,addPlugin:PT,removePlugin:VT}),E.debugMode=function(){Ye=!1},E.safeMode=function(){Ye=!0},E.versionString=ee,E.regex={concat:g,lookahead:p,either:b,optional:m,anyNumberOfTimes:h};for(const H in yt)typeof yt[H]=="object"&&n(yt[H]);return Object.assign(E,yt),E},an=Ps({});return an.newInstance=()=>Ps({}),tp=an,an.HighlightJS=an,an.default=an,tp}var W4=j4();const U4=F4(W4);function pM(n,e=[]){return n.flatMap(t=>{const o=[...e,...t.properties?t.properties.className:[]];return t.children?pM(t.children,o):{text:t.value,classes:o}})}function Ow(n){return n.value||n.children||[]}function q4(n){return!!U4.getLanguage(n)}function $w({doc:n,name:e,lowlight:t,defaultLanguage:o}){const r=[];return Or(n,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const a=i.node.attrs.language||o,u=t.listLanguages(),d=a&&(u.includes(a)||q4(a)||(s=t.registered)!=null&&s.call(t,a))?Ow(t.highlight(a,i.node.textContent)):Ow(t.highlightAuto(i.node.textContent));pM(d).forEach(f=>{const p=l+f.text.length;if(f.classes.length){const h=Ve.inline(l,p,{class:f.classes.join(" ")});r.push(h)}l=p})}),Ce.create(n,r)}function K4(n){return typeof n=="function"}function J4({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(r=>K4(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new ue({key:new ae("lowlight"),state:{init:(r,{doc:i})=>$w({doc:i,name:n,lowlight:e,defaultLanguage:t}),apply:(r,i,s,l)=>{const a=s.selection.$head.parent.type.name,u=l.selection.$head.parent.type.name,d=Or(s.doc,p=>p.type.name===n),f=Or(l.doc,p=>p.type.name===n);return r.docChanged&&([a,u].includes(n)||f.length!==d.length||r.steps.some(p=>p.from!==void 0&&p.to!==void 0&&d.some(h=>h.pos>=p.from&&h.pos+h.node.nodeSize<=p.to)))?$w({doc:r.doc,name:n,lowlight:e,defaultLanguage:t}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}var G4=$x.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],J4({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),X4=G4;const Y4=n=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[n.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});/**
288
+ * Copyright 2026 Yiitap
289
+ * @license MIT
290
+ **/function Q4(n){const e=document.createElement("textarea");e.value=n,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");return e.remove(),t}function Z4(n){return navigator.clipboard!==void 0?navigator.clipboard.writeText(n):new Promise((e,t)=>{const o=Q4(n);o?e(!0):t(o)})}const e8=()=>NS(),t8={class:"code-block-toolbar"},n8={class:"wrap"},o8={class:"language readonly"},r8={class:"wrap"},i8=["srcdoc"],s8={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},l8={key:0,class:"preview"},a8={key:0,class:"error"},c8=["innerHTML"],u8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{commonDownload:t}=Cd(),{tr:o}=de(),{darkMode:r}=Di(),{isEditable:i}=xe(),s=c.ref("content_copy"),l=c.ref({show:!1,fullscreen:!1}),a=c.ref(""),u=c.ref(""),d=c.ref(""),f=c.ref(""),p=c.ref("splitVertical"),h=c.ref(""),m=c.ref("default");cf.registerLayoutLoaders(tN);const g={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},y=c.computed({get(){return e.node.attrs.language},set(W){e.updateAttributes({language:W})}}),b=c.computed(()=>{var W;return((W=e.node.content.content[0])==null?void 0:W.text)||""}),v=c.computed({get(){return e.node.attrs.wrap},set(W){e.updateAttributes({wrap:W})}}),k=c.computed(()=>["html","svg"].includes(y.value)),w=c.computed(()=>v.value?"text_select_move_down":"format_text_wrap"),x=c.computed(()=>y.value==="mermaid"),C=c.computed(()=>y.value==="mermaid"?i.value?p.value:"preview":"");function S(W){y.value=W}function T(){const W=e.node.content.content[0].text;Z4(W).then(()=>{s.value="done",setTimeout(()=>{s.value="content_copy"},2e3)})}function N(W="code"){switch(W){case"svg":O();break;default:$();break}}function $(){const W=y.value;let me=W;const Ee=Ys.find(He=>He.value===W);Ee&&(me=Ee.ext.at(0));const De=`${W}-${Date.now()}.${me}`,je=e.node.content.content[0].text;t("code",De,je)}function O(){if(!d.value)return;const W=`mermaid-${Date.now()}.svg`,me=d.value;t("svg",W,me)}function A(){const W=e.node.content.content[0].text;u.value=I(W),a.value="run",l.value={show:!0,fullscreen:!1}}function B(){a.value==="mermaid"&&(p.value=h.value)}function I(W){return`
64
291
  <style>
65
292
  body { margin: 0 !important; padding: 0; }
66
293
  </style>
67
- ${D}
68
- `}function F(){y.value=!y.value}function H(){switch(h.value){case"mermaid":B();break}}function te(){Vo.initialize({...b,theme:a.value?"dark":v.value}),H()}async function B(){try{p.value="";const D=`mermaid-${Qg()}`,{svg:X}=await Vo.render(D,_.value);u.value=X}catch(D){console.error(D),p.value=D.message}}return e.watch(_,D=>{H()}),e.watch(h,D=>{H()}),e.watch(a,D=>{te()}),e.watch(x,(D,X)=>{D==="splitHorizontal"&&(f.value=X,c.value="mermaid")}),e.onMounted(()=>{var X;const D=n.editor.extensionManager.extensions.find(re=>re.name==="codeBlock");v.value=((X=D==null?void 0:D.options)==null?void 0:X.diagramTheme)||"default",te()}),(D,X)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-code-block-view",`language-${h.value} ${x.value}`]}),{default:e.withCtx(()=>[e.createElementVNode("div",Jg,[e.createElementVNode("div",eb,[e.createElementVNode("div",tb,e.toDisplayString(h.value),1),e.createVNode(e.unref(ja),{language:h.value,class:"editable",onSelect:I},null,8,["language"])]),e.createElementVNode("div",nb,[x.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[x.value==="splitHorizontal"?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:"close",tooltip:e.unref(r)("label.close"),class:"editable",onClick:M},null,8,["tooltip"])):(e.openBlock(),e.createBlock(e.unref(Ra),{key:1,modelValue:m.value,"onUpdate:modelValue":X[0]||(X[0]=re=>m.value=re),class:"editable"},null,8,["modelValue"]))],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(pe),{icon:g.value,"icon-class":{"rotate-270":y.value},tooltip:"Wrap",class:"editable",onClick:F},null,8,["icon","icon-class"]),N.value?(e.openBlock(),e.createBlock(e.unref(Ma),{key:1,onDownload:T})):(e.openBlock(),e.createBlock(e.unref(pe),{key:2,icon:"download",tooltip:e.unref(r)("label.download"),onClick:T},null,8,["tooltip"])),E.value?(e.openBlock(),e.createBlock(e.unref(pe),{key:3,icon:"play_circle",tooltip:"Run",onClick:O})):e.createCommentVNode("",!0),e.createVNode(e.unref(pe),{icon:i.value,tooltip:e.unref(r)("label.copy"),onClick:L},null,8,["icon","tooltip"])])]),e.createVNode(e.unref(Ii),e.mergeProps({show:s.value.show,"onUpdate:show":X[1]||(X[1]=re=>s.value.show=re)},s.value,{onClose:M}),{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),default:e.withCtx(()=>[c.value==="run"?(e.openBlock(),e.createElementBlock("iframe",{key:0,sandbox:"allow-same-origin allow-scripts",srcdoc:d.value},null,8,ob)):c.value==="mermaid"?(e.openBlock(),e.createElementBlock("div",rb,null,512)):e.createCommentVNode("",!0)]),_:1},16,["show"]),e.createElementVNode("pre",null,[e.createVNode(e.unref(K.NodeViewContent),{as:"code",class:e.normalizeClass({wrap:y.value})},null,8,["class"])]),N.value?(e.openBlock(),e.createElementBlock("section",ab,[p.value?(e.openBlock(),e.createElementBlock("div",ib,e.toDisplayString(p.value),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:u.value},null,8,lb))])):e.createCommentVNode("",!0)]),_:1},16,["class"]))}}),rl=qg($g);rl.register("mermaid",Kg);const cb=Jl.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),diagramTheme:"default"}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return K.VueNodeViewRenderer(sb)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:rl}),ub=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,o=e.ref(!!n.node.attrs.open);function r(){const a=!o.value;o.value=a,n.updateAttributes({open:a})}return(a,l)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-details-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["details",{"is-open":o.value}])},[e.createElementVNode("button",{type:"button",onClick:r},[e.createVNode(e.unref(U),{name:"details_arrow"})]),e.createVNode(e.unref(K.NodeViewContent))],2)]),_:1},16))}}),db=Wo.Details.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:t}=this.options,n=t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),o=new RegExp(`^[${n}]\\s$`);return[new Te.InputRule({find:o,handler:({state:r,range:a})=>{const{tr:l,schema:i}=r,{$from:s}=l.selection,c=s.before(s.depth),d=s.after(s.depth);l.delete(a.from,a.to);const u=i.nodes.details.create(null,[i.nodes.detailsSummary.create(null),i.nodes.detailsContent.create(null,i.nodes.paragraph.create())]);l.replaceRangeWith(c,d,u);const p=Ct.TextSelection.near(l.doc.resolve(c+2));return l.setSelection(p),l}})]},addNodeView(){return K.VueNodeViewRenderer(ub)}}),pb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,o=e.computed(()=>n.node.attrs.level);return(r,a)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-heading-view",`h${o.value}`],style:`text-align: ${r.node.attrs.textAlign}`}),{default:e.withCtx(()=>[e.createVNode(e.unref(K.NodeViewContent))]),_:1},16,["class","style"]))}}),fb=ns.extend({draggable:!0,addNodeView(){return K.VueNodeViewRenderer(pb)}}),mb={class:"horizontal"},gb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-horizontal-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",mb,[e.createVNode(e.unref(K.NodeViewContent),{as:"div",class:"divider"})])]),_:1},16))}}),bb=os.extend({draggable:!0,addNodeView(){return K.VueNodeViewRenderer(gb)}}),vb={key:1,class:"image-panel"},hb={class:"label"},_b={key:1,class:"resize-overlay"},kb={class:"resize-guide"},yb={class:"size-display"},Eb={key:1},wb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{tr:o}=Q(),{downloadImage:r}=_o(),{isEditable:a,getEditorImages:l}=ie(),i=e.ref(!1),s=e.ref(!1),c=e.ref({}),d=e.ref(null),u=e.ref(!1),p=e.ref(!1),m=e.ref(0),f=e.ref([]),v=e.ref(),b=e.ref(null),h=e.ref(null),_=e.ref(null),y=e.ref(!1),E=e.ref(""),g=e.ref(0),N=e.ref(0),x=e.ref(0),I=e.ref(0),L=e.ref(n.node.attrs.width||0),T=e.ref(n.node.attrs.height||0),P=e.ref(0),Z=e.ref(0),O=e.ref(0),M=e.ref(1200),V=e.ref(0),F=e.ref(0),H=e.ref(800),te=e.ref(400),B=e.ref(!1),D=e.ref(!0),X=e.ref(!1),re=e.ref(n.node.attrs.positionY||0),fe=e.ref(0),xe=e.ref(0),Se=e.ref(!1),_e=e.computed(()=>n.node.attrs),W=e.computed({get(){return n.node.attrs.src},set(w){n.updateAttributes({src:w})}}),se=e.computed({get(){return n.node.attrs.title},set(w){n.updateAttributes({title:w})}});function ce(){u.value=!0,setTimeout(()=>{var w;(w=d.value)==null||w.focus()},0)}function Oe(){r(n.node.attrs.src)}function Ae(){f.value=l(n.editor),m.value=f.value.findIndex(w=>w.pos===n.getPos())||0,p.value=!0}function rt(){u.value=!1}function vt(){W.value==="init"&&ue(!0)}function ct(w){i.value=!0,c.value=w}function ut(w){switch(i.value=!1,w.value){case"replace":ue(!0);break}}function ht(w){W.value=w,ue(!1)}function ue(w){s.value=w}const Ke=e.computed(()=>({width:`${L.value}px`,maxWidth:`${M.value}px`,height:`${P.value}px`,maxHeight:B.value?`${V.value}px`:"auto",cursor:y.value?We():"default"}));function We(){switch(E.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function _t(){var w,S,q;if(_.value){Z.value=_.value.naturalWidth,O.value=_.value.naturalHeight,H.value=((S=(w=v.value)==null?void 0:w.$el)==null?void 0:S.parentElement.getBoundingClientRect().width)??0,M.value=((q=document.querySelector(".layout"))==null?void 0:q.getBoundingClientRect().width)??1200;const ae=Z.value/O.value;H.value=Math.min(H.value,800),te.value=H.value/ae,!L.value||!T.value?(B.value=Z.value>H.value,B.value?(L.value=H.value,T.value=H.value/Z.value*O.value):(L.value=Z.value,T.value=O.value),Qe()):B.value=L.value>H.value,F.value>0?P.value=F.value:(P.value=T.value,F.value=T.value),V.value=T.value,yt()}}function Pe(w,S){y.value=!0,E.value=S,x.value=w.clientX,I.value=w.clientY,g.value=L.value,N.value=T.value,document.addEventListener("mousemove",Xe),document.addEventListener("mouseup",kt)}function Xe(w){if(!y.value)return;const S=w.clientX-x.value,q=w.clientY-I.value,ae=Z.value/O.value;let J=g.value,Be=F.value;switch(E.value){case"left":J=g.value-S;break;case"right":J=g.value+S;break;case"bottom":Be=F.value+q;break}const De=J/ae;L.value=Math.round(J),T.value=Math.round(De),B.value=J>H.value,B.value?(P.value=Be,V.value=T.value):(P.value=T.value,En())}function kt(){y.value=!1,E.value="",document.removeEventListener("mousemove",Xe),document.removeEventListener("mouseup",kt),F.value=P.value,Qe()}function Qe(){n.updateAttributes({width:L.value,height:T.value,containerHeight:F.value})}const He=e.computed(()=>!T.value||!P.value?0:Math.min(0,P.value-T.value)),It=e.computed(()=>({transform:`translateY(${re.value}px)`,cursor:Fe.value?"grab":"default",transition:X.value?"none":"transform 0.2s ease"})),Fe=e.computed(()=>D.value&&B.value&&P.value<T.value);function dt(){D.value=!D.value}function yt(){B.value&&P.value<T.value?Se.value=!0:Se.value=!1}function En(){re.value!==0&&(re.value=0,rn())}function wn(w){!Fe.value||!Se.value||y.value||w.target.closest(".block-resizer")||(w.preventDefault(),w.stopPropagation(),X.value=!0,fe.value=w.clientY,xe.value=re.value,document.addEventListener("mousemove",nn),document.addEventListener("mouseup",on),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function nn(w){if(!X.value)return;const S=w.clientY-fe.value;let q=xe.value+S;q=Math.max(He.value,Math.min(0,q)),re.value=q}function on(){X.value=!1,document.removeEventListener("mousemove",nn),document.removeEventListener("mouseup",on),document.body.style.userSelect="",document.body.style.cursor="",rn()}function rn(){n.updateAttributes({positionY:re.value})}return e.watch(()=>n.node.attrs.height,w=>{w&&(T.value=w)}),e.watch(()=>n.node.attrs.containerHeight,w=>{w&&(F.value=w,P.value=w,yt())}),e.watch(()=>n.node.attrs.positionY,w=>{w!==void 0&&(re.value=w)}),e.onMounted(()=>{ue(W.value==="init"),_e.value.width&&(L.value=_e.value.width),_e.value.height&&(T.value=_e.value.height),_e.value.containerHeight&&(F.value=_e.value.containerHeight)}),e.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(w,S)=>{var q;return e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps({ref_key:"imageView",ref:v},n,{class:["o-image-view",{max:B.value,"with-caption":_e.value.alt,readonly:!((q=w.editor)!=null&&q.isEditable),init:W.value==="init"}],as:"div",onContextmenu:e.withModifiers(ct,["prevent"]),onClick:vt}),{default:e.withCtx(()=>[e.createVNode(e.unref(Ot),{modelValue:s.value,"onUpdate:modelValue":S[4]||(S[4]=ae=>s.value=ae),placement:W.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(pr),{val:W.value==="init"?"":W.value,type:"image",onInput:ht},null,8,["val"])]),default:e.withCtx(()=>{var ae;return[W.value==="init"?(e.openBlock(),e.createBlock(e.unref(bo),{key:0,icon:"image",placeholder:"Add an image"})):(e.openBlock(),e.createElementBlock("div",vb,[e.createVNode(e.unref(ur),e.mergeProps(n,{onAction:ut}),{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Se.value?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:Fe.value?"arrow_expand":"close","icon-class":Fe.value?"rotate-315":"","content-class":"with-label",tooltip:e.unref(o)("image.repositionTips"),onClick:e.withModifiers(dt,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("span",hb,e.toDisplayString(e.unref(o)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(pe),{icon:"subtitles",tooltip:e.unref(o)("image.caption"),onClick:e.withModifiers(ce,["stop"])},null,8,["tooltip"]),e.createVNode(e.unref(ir),{editor:w.editor},null,8,["editor"]),e.createVNode(e.unref(ar),{editor:w.editor,placement:"bottom-end"},null,8,["editor"])],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(pe),{icon:"download",tooltip:e.unref(o)("label.download"),onClick:Oe},null,8,["tooltip"]),e.createVNode(e.unref(pe),{icon:"zoom_in",tooltip:e.unref(o)("image.zoom"),onClick:Ae},null,8,["tooltip"])]),_:1},16),e.createElementVNode("div",{ref_key:"imageContainer",ref:b,class:"image-container",style:e.normalizeStyle(Ke.value),onMousedown:wn},[e.createElementVNode("div",{ref_key:"imageWrapper",ref:h,class:"image-wrapper",style:e.normalizeStyle(It.value)},[e.createElementVNode("img",e.mergeProps({ref_key:"imageElement",ref:_},_e.value,{draggable:"true","data-drag-handle":"",onLoad:_t}),null,16)],4),e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"block-resizer left",onMousedown:S[0]||(S[0]=e.withModifiers(J=>Pe(J,"left"),["stop","prevent"]))},[...S[7]||(S[7]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),e.createElementVNode("div",{class:"block-resizer right",onMousedown:S[1]||(S[1]=e.withModifiers(J=>Pe(J,"right"),["stop","prevent"]))},[...S[8]||(S[8]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),B.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:S[2]||(S[2]=e.withModifiers(J=>Pe(J,"bottom"),["stop","prevent"]))},[...S[9]||(S[9]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createElementBlock("div",_b,[e.createElementVNode("div",kb,[e.createElementVNode("div",yb,e.toDisplayString(L.value)+" × "+e.toDisplayString(P.value),1)])])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],36),e.createElementVNode("div",{class:"caption",onClick:ce},[(ae=w.editor)!=null&&ae.isEditable&&u.value?(e.openBlock(),e.createBlock(e.unref(bt),{key:0,ref_key:"captionInput",ref:d,class:"caption-input",modelValue:se.value,"onUpdate:modelValue":S[3]||(S[3]=J=>se.value=J),type:"text",placeholder:"Input caption",autosize:"",onBlur:rt},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Eb,e.toDisplayString(se.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(Vn),{modelValue:i.value,"onUpdate:modelValue":S[5]||(S[5]=ae=>i.value=ae),event:c.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ht),e.mergeProps(n,{onAction:ut}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref(Di),{show:p.value,"onUpdate:show":S[6]||(S[6]=ae=>p.value=ae),images:f.value,current:m.value},{title:e.withCtx(()=>[...S[10]||(S[10]=[e.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),xb=rs.extend({addNodeView(){return K.VueNodeViewRenderer(wb)}}).configure({inline:!0});function Nb(t){return new Ct.Plugin({key:new Ct.PluginKey("handleClickSelectLink"),props:{handleClick:(n,o,r)=>{const{schema:a,doc:l,tr:i}=n.state,s=Te.getMarkRange(l.resolve(o),a.marks.link);if(!s)return!1;const c=l.resolve(s.from),d=l.resolve(s.to),u=i.setSelection(new Ct.TextSelection(c,d));return n.dispatch(u),!0}}})}const Cb=Sa.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],Nb({type:this.type})]}}).configure({openOnClick:!1}),Sb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-paragraph-view"}),{default:e.withCtx(()=>[e.createVNode(e.unref(K.NodeViewContent),{as:"p",style:e.normalizeStyle(`text-align: ${o.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),Tb=as.extend({draggable:!1,addNodeView(){return K.VueNodeViewRenderer(Sb,{stopEvent:()=>!1})}}),Ob={class:"add"},Ab=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{tr:o}=Q(),{isEditable:r,run:a}=ie(),l=e.ref(!1);function i(){l.value=!0}function s(){c("tableSelectRow",{pos:n.getPos()})}function c(d,u={}){d==="tableDeleteRow"&&(l.value=!1),setTimeout(()=>{a(n.editor,d,u)},0)}return(d,u)=>(e.openBlock(),e.createBlock(e.unref(K.NodeViewWrapper),e.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(r)?(e.openBlock(),e.createBlock(e.unref(Ot),{key:0,modelValue:l.value,"onUpdate:modelValue":u[2]||(u[2]=p=>l.value=p),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"select_all",placement:"left",tooltip:e.unref(o)("table.selectRow"),onClick:s},null,8,["tooltip"]),e.createVNode(e.unref(Ne),{icon:"delete",placement:"left",tooltip:e.unref(o)("table.removeRow"),onClick:u[1]||(u[1]=p=>c("tableDeleteRow"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["row-handler",{active:l.value}]),onClick:i},[e.createElementVNode("div",Ob,[u[3]||(u[3]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(ft),{icon:"add_circle",color:e.unref(ee).blue,tooltip:e.unref(o)("table.addRow"),placement:"left",onClick:u[0]||(u[0]=e.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(K.NodeViewContent))]),_:1},16,["style"]))}}),Bb=Wt.TableCell.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return K.VueNodeViewRenderer(Ab,{stopEvent:()=>!1})}}),Mb={class:"add"},Rb={class:"add"},Ib=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{tr:o}=Q(),{isEditable:r,run:a}=ie(),l=e.ref(!1),i=e.ref(!1);function s(){setTimeout(()=>{l.value=!0},0)}function c(){i.value=!0}function d(){l.value=!1,p("tableSelectColumn",{pos:n.getPos()})}function u(){p("tableSelectRow",{pos:n.getPos()})}function p(m,f={}){m==="tableDeleteRow"?i.value=!1:m==="tableDeleteColumn"&&(l.value=!1),setTimeout(()=>{a(n.editor,m,f)},0)}return(m,f)=>(e.openBlock(),e.createBlock(e.unref(K.NodeViewWrapper),e.mergeProps({class:"o-table-header-view",as:"th"},m.node.attrs,{style:{background:m.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(r)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(Ot),{modelValue:l.value,"onUpdate:modelValue":f[2]||(f[2]=v=>l.value=v),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"select_all",tooltip:e.unref(o)("table.selectColumn"),onClick:d},null,8,["tooltip"]),e.createVNode(e.unref(Ne),{icon:"delete",tooltip:e.unref(o)("table.removeColumn"),onClick:f[1]||(f[1]=v=>p("tableDeleteColumn"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["col-handler",{active:l.value}]),onClick:s},[e.createElementVNode("div",Mb,[f[6]||(f[6]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(ft),{icon:"add_circle",color:e.unref(ee).blue,tooltip:e.unref(o)("table.addColumn"),onClick:f[0]||(f[0]=e.withModifiers(v=>p("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),e.createVNode(e.unref(Ot),{modelValue:i.value,"onUpdate:modelValue":f[5]||(f[5]=v=>i.value=v),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Ne),{icon:"select_all",placement:"left",tooltip:e.unref(o)("table.selectRow"),onClick:u},null,8,["tooltip"]),e.createVNode(e.unref(Ne),{icon:"delete",placement:"left",tooltip:e.unref(o)("table.removeRow"),onClick:f[4]||(f[4]=v=>p("tableDeleteRow"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["row-handler",{active:i.value}]),onClick:c},[e.createElementVNode("div",Rb,[f[7]||(f[7]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(ft),{icon:"add_circle",color:e.unref(ee).blue,tooltip:e.unref(o)("table.addRow"),placement:"left",onClick:f[3]||(f[3]=e.withModifiers(v=>p("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(K.NodeViewContent))]),_:1},16,["style"]))}}),Db=Wt.TableHeader.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return K.VueNodeViewRenderer(Ib,{stopEvent:()=>!1})}}),Lb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,o=e.inject("sideNode",{value:!1}),r=e.ref(!1),a=e.computed(()=>{const{selection:i}=n.editor.view.state,s=i.from,c=n.getPos(),d=c+n.node.nodeSize;return s>=c&&s<=d});function l(i){r.value=i}return e.watch(a,i=>{console.log("isFocused",n.node.attrs),l(i)}),(i,s)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-table-wrapper-view",{"side-node-enabled":e.unref(o)}]}),{default:e.withCtx(()=>[e.createVNode(e.unref(K.NodeViewContent),{as:"table"})]),_:1},16,["class"]))}}),Vb=is.TableWrapper.extend({addNodeView(){return K.VueNodeViewRenderer(Lb,{stopEvent:()=>!1})}}),$b={key:1,class:"video-container"},Pb={key:1},Fb=e.defineComponent({__name:"view",props:K.nodeViewProps,setup(t){const n=t,{tr:o}=Q(),{isEditable:r}=ie(),a=e.ref(!1),l=e.ref({}),i=e.ref(null),s=e.ref(!1),c=e.ref(!1),d=e.computed({get(){return n.node.attrs.caption},set(y){n.updateAttributes({caption:y})}}),u=e.computed({get(){return n.node.attrs.src},set(y){n.updateAttributes({src:y})}});function p(y){switch(a.value=!1,y.value){case"replace":_(!0);break}}function m(){s.value=!0,setTimeout(()=>{var y;(y=i.value)==null||y.focus()},0)}function f(){s.value=!1}function v(){u.value==="init"&&_(!0)}function b(y){a.value=!0,l.value=y}function h(y){u.value=y,_(!1)}function _(y){c.value=y}return e.onMounted(()=>{_(u.value==="init")}),(y,E)=>{var g;return e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-video-view",{readonly:!((g=y.editor)!=null&&g.isEditable),init:u.value==="init"}],as:"div",onContextmenu:e.withModifiers(b,["prevent"]),onClick:v}),{default:e.withCtx(()=>[e.createVNode(e.unref(Ot),{modelValue:c.value,"onUpdate:modelValue":E[1]||(E[1]=N=>c.value=N),placement:u.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(pr),{val:u.value==="init"?"":u.value,type:"video",onInput:h},null,8,["val"])]),default:e.withCtx(()=>{var N;return[u.value==="init"?(e.openBlock(),e.createBlock(e.unref(bo),{key:0,icon:"videocam",placeholder:"Add a video"})):(e.openBlock(),e.createElementBlock("div",$b,[E[3]||(E[3]=e.createElementVNode("div",{class:"video-cover"},null,-1)),e.unref(r)?(e.openBlock(),e.createBlock(e.unref(ur),e.mergeProps({key:0},n,{onAction:p}),{default:e.withCtx(()=>[e.createVNode(e.unref(pe),{icon:"subtitles",tooltip:e.unref(o)("image.caption"),onClick:m},null,8,["tooltip"])]),_:1},16)):e.createCommentVNode("",!0),e.createElementVNode("video",e.mergeProps(y.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[e.createElementVNode("source",e.normalizeProps(e.guardReactiveProps(y.node.attrs)),null,16)],16),e.createElementVNode("div",{class:"caption",onClick:m},[(N=y.editor)!=null&&N.isEditable&&s.value?(e.openBlock(),e.createBlock(e.unref(bt),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":E[0]||(E[0]=x=>d.value=x),type:"text",placeholder:"Input caption",autosize:"",onBlur:f},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Pb,e.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(Vn),{modelValue:a.value,"onUpdate:modelValue":E[2]||(E[2]=N=>a.value=N),event:l.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ht),e.mergeProps(n,{onAction:p}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),Ub=ls.Video.extend({addNodeView(){return K.VueNodeViewRenderer(Fb)}}),zb=["Highlight","BackgroundColor","Color","Focus","FontFamily","Subscript","Superscript","Table","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OHorizontalRule","OSelectionDecoration"],Hb=["Highlight","BackgroundColor","BlockMath","Bold","BulletList","Color","Code","CodeBlockLowlight","Emoji","Focus","FontFamily","HorizontalRule","Image","InlineMath","Italic","Link","ListItem","Markdown","Mention","OrderedList","Strike","Subscript","Superscript","Table","TaskItem","TaskList","TextAlign","TextStyle","Typography","Underline","UniqueID"],qb=["OAiBlock","OBlockMath","OBlockquote","OCallout","OCharCommand","OCodeBlock","OColon","OColorHighlighter","ODetails","OFocus","OHeading","OHorizontalRule","OImage","OInlinePlaceholder","OLink","OParagraph","OSelectionDecoration","OShortcut","OSlash","OSlashZh","OTableWrapper","OTaskItem","OVideo"],Gb=[...Hb,...qb],Kb={key:0},Wb=e.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Te.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const n=t,{tr:o}=Q(),{theme:r}=tn(),a=e.ref(!1),l=e.ref(!1),i=e.ref(!1),s=e.ref(!1),c=e.ref({offset:10,placement:"bottom-start",onShow:()=>{a.value=!1,l.value=!1,i.value=!1},onHide:()=>{i.value=!1}});function d(){a.value=!0}function u(E){E==="ai"&&(l.value=!0)}function p(){i.value=!0}function m(E){const{schema:g}=n.editor,N=g.marks.link;if(!N||!E)return!1;const{$from:x,$to:I}=E;return!!Te.getMarkRange(x,N)}function f({editor:E,element:g,view:N,state:x,oldState:I,from:L,to:T}){var B;const{doc:P,selection:Z}=x,{empty:O}=Z,M=!P.textBetween(L,T).length&&Te.isTextSelection(x.selection);if(s.value=n.editor.isActive("inlineMath"),y.value||n.editor.isActive("inlineMath"))return!0;if(!N.hasFocus()||O||i.value||M&&E.isActive("link")&&!E.isActive("image"))return!1;const V=["image"],F=["image","toc","video","model-viewer"],H=Z.node,te=(B=H==null?void 0:H.type)==null?void 0:B.name;return!(E.isActive("codeBlock")||F.indexOf(te)>=0||te&&!V.includes(te))}const v=e.computed(()=>{if(n.editor){const{state:E}=n.editor,{tr:g}=E,{selection:N}=g;return m(N)}else return!1}),b=e.computed(()=>{var E,g;return!a.value&&!((E=n.editor)!=null&&E.isActive("image"))&&(v.value||((g=n.editor)==null?void 0:g.isActive("inlineMath")))}),h=e.computed(()=>y.value||s.value),_=e.computed(()=>{var g,N,x;let E=n.menu;return a.value||((g=n.editor)!=null&&g.isActive("image")?E=v.value?qa:Ha:(N=n.editor)!=null&&N.isActive("table")?E=Ka:v.value?E=za:(x=n.editor)!=null&&x.isActive("inlineMath")&&(E=Ua)),E.length>0?E:Fa}),y=e.computed(()=>{const E=pn.InlinePlaceholderKey.getState(n.editor.state);return!!(E!=null&&E.active)});return e.onMounted(()=>{a.value=!1}),(E,g)=>t.editor?(e.openBlock(),e.createElementBlock("section",Kb,[e.createVNode(e.unref(Ta.BubbleMenu),{editor:t.editor,"should-show":f,options:c.value},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(Pi),{key:0,editor:t.editor,onConfirm:p},null,8,["editor"])):h.value?(e.openBlock(),e.createBlock(e.unref(Fi),{key:1,editor:t.editor},null,8,["editor"])):(e.openBlock(),e.createElementBlock("section",{key:2,class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[b.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(pe),{icon:"arrow_back",tooltip:e.unref(o)("link.back"),onClick:d},null,8,["tooltip"]),e.createVNode(e.unref($e),{vertical:""})],64)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,(N,x)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x},[N==="separator"?(e.openBlock(),e.createBlock(e.unref($e),{key:0,vertical:""})):typeof N=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oo)(N)),{key:1,name:N,editor:t.editor,onClick:I=>u(N)},null,8,["name","editor","onClick"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}}),Yb={key:0},jb=e.defineComponent({__name:"OFloatingMenu",props:{editor:{type:K.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const n=t,o=e.ref(!1),r=e.ref({placement:"right",offset:168});function a(){o.value=!0}function l(u){const{schema:p}=n.editor,m=p.marks.link;if(!m||!u)return!1;const{$from:f,$to:v}=u;return!!Te.getMarkRange(f,m)}const i=e.computed(()=>{if(n.editor){const{state:u}=n.editor,{tr:p}=u,{selection:m}=p;return l(m)}else return!1}),s=e.computed(()=>!o.value&&i.value),c=e.computed(()=>{let u=n.menu;return u.length>0?u:Wa}),d=e.computed(()=>{const u=pn.InlinePlaceholderKey.getState(n.editor.state);return!!(u!=null&&u.active)});return(u,p)=>t.editor&&!d.value?(e.openBlock(),e.createElementBlock("section",Yb,[e.createVNode(e.unref(Ta.FloatingMenu),{editor:t.editor,options:r.value},{default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[s.value?(e.openBlock(),e.createBlock(e.unref(pe),{key:0,icon:"arrow_back",onClick:a})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(m,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[m==="separator"?(e.openBlock(),e.createBlock(e.unref($e),{key:0,vertical:""})):typeof m=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oo)(m)),{key:1,name:m,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}});function Tr(t,n){const o=n==null?void 0:n.posAtCoords(t);if(!o)return;let r=ao(o.pos,n);if(r!==n.dom){for(;r&&r.parentNode&&r.parentNode!==n.dom;)r=r.parentNode;if(r)return r}}function ao(t,n){return n.nodeDOM(t)||n.domAtPos(t).node}function Or(t,n){const o=Tr(t,n);if(o&&o.nodeType===1){const r=n.docView,a=r.nearestDesc(o,!0);return!a||a===r?null:a.posBefore}return null}function Zb(t,n){let o,r;const a=n.resolve(t.from).node().type.spec.group==="blockContent",l=n.resolve(t.to).node().type.spec.group==="blockContent",i=Math.min(t.$anchor.depth,t.$head.depth);if(a&&l){const s=t.$from.start(i-1),c=t.$to.end(i-1);o=n.resolve(s-1).pos,r=n.resolve(c+1).pos}else o=t.from,r=t.to;return{from:o,to:r}}function Xb(t,n){const o=Or(t,n.view);return o&&o>=0?{node:n.state.doc.nodeAt(o),pos:o}:{node:null,pos:o}}const go=new Ct.PluginKey("sideMenu");class Qb{constructor(){Ce(this,"hovered",!1);Ce(this,"coords",{left:0,top:0});Ce(this,"className","")}init(n){return this}apply({tr:n,oldState:o,newState:r}){return n.docChanged?this:this}setHover(n,o,r=""){this.hovered=n,this.coords=o,this.className=r}}class Jb{constructor({editor:n,element:o,view:r,tippyOptions:a={},updateDelay:l=250}){Ce(this,"editor");Ce(this,"element");Ce(this,"view");Ce(this,"preventHide",!1);Ce(this,"tippy");Ce(this,"tippyOptions");Ce(this,"updateDelay");Ce(this,"updateDebounceTimer");Ce(this,"mousedownHandler",()=>{this.preventHide=!0});Ce(this,"onDragStart",n=>{this.hide()});Ce(this,"blurHandler",({event:n})=>{var o;n!=null&&n.relatedTarget&&((o=this.element.parentNode)!=null&&o.contains(n.relatedTarget))||this.hide()});Ce(this,"tippyBlurHandler",n=>{this.blurHandler({event:n})});Ce(this,"handleDebouncedUpdate",(n,o)=>{const r=!(o!=null&&o.selection.eq(n.state.selection)),a=!(o!=null&&o.doc.eq(n.state.doc));!r&&!a||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(n,r,a,o)},this.updateDelay))});Ce(this,"updateHandler",(n,o,r,a)=>{var u,p;const{state:l,composing:i}=n,{coords:s}=go.getState(l),c=Tr(s,n),d=Or(s,n);!c||d<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=n,this.element=o,this.view=r,this.updateDelay=l,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=a,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:n}=this.editor.options,o=n instanceof Element?n:"mount"in n?n.mount:null,r=!!(o!=null&&o.parentElement);this.tippy||!r||(this.tippy=Mt(o,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(n,o){const{state:r}=n,a=!(o!=null&&o.selection.eq(n.state.selection)),l=!(o!=null&&o.doc.eq(n.state.doc));this.updateHandler(n,a,l,o)}show(){var n;(n=this.tippy)==null||n.show()}hide(){var n;(n=this.tippy)==null||n.hide()}destroy(){var n,o;(n=this.tippy)!=null&&n.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(o=this.tippy)==null||o.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const ev=(t,n)=>{if(!t.dataTransfer)return;const o=n.view,r=o.dom.getBoundingClientRect(),a={left:r.left+r.width/2,top:t.clientY},l=Or(a,o);if(l===null)return;const i=o.state.selection,s=o.state.doc;Zb(i,s),o.dispatch(o.state.tr.setSelection(Ct.NodeSelection.create(o.state.doc,l))),nv(o,l);const c=o.state.selection.content(),{dom:d,text:u}=o.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",d.innerHTML),t.dataTransfer.setData("text/plain",u),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Zt,0,0),o.dragging={slice:c,move:!0}},tv=(t,n)=>{al()};let Zt;function nv(t,n,o=n){const r=t.domAtPos(n).node.cloneNode(!0),a=t.domAtPos(n).node,l=(p,m)=>Array.prototype.indexOf.call(p.children,m),i=p=>{let m=p,f=m.parentElement;for(;f;){if(f===t.dom)return m;m=f,f=m.parentElement}return m};let s=-1,c=-1;n===o?(s=l(a,i(ao(n,t))),c=s):(s=l(a,i(ao(n+1,t))),c=l(a,i(ao(o-1,t))));for(let p=a.childElementCount-1;p>=0;p--)(p>s||p<c)&&r.removeChild(r.children[p]);al(),Zt=r;const u=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Zt.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Zt)}function al(){Zt!==void 0&&(document.body.removeChild(Zt),Zt=void 0)}class ov{constructor(n){Ce(this,"options");Ce(this,"plugin");Ce(this,"sideMenuView");const o=new Qb;this.options=n,this.plugin=new Ct.Plugin({key:go,props:{handleDOMEvents:{mouseover(r,a){const l={left:a.clientX,top:a.clientY},i=Tr(l,r),s=(i==null?void 0:i.className)||"",c=o.className;s.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(o.setHover(!0,l,s),r.dispatch(r.state.tr.setMeta(go,o)))}}},state:{init(r,a){return o.init(a)},apply(r,a,l,i){return o.apply({tr:r,oldState:l,newState:i})}},view:r=>(this.sideMenuView=new Jb({view:r,...n}),this.sideMenuView)})}dragstart(n){ev(n,this.options.editor)}dragend(n){tv(n,this.options.editor)}}const rv=e.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:n,slots:o}){const r=e.ref(null),a=e.ref(),l=s=>{var c;(c=a.value)==null||c.dragstart(s)},i=s=>{var c;(c=a.value)==null||c.dragend(s)};return e.onMounted(()=>{const{pluginKey:s,editor:c,updateDelay:d,tippyOptions:u}=t;a.value=new ov({updateDelay:d,editor:c,element:r.value,pluginKey:s,tippyOptions:u}),c.registerPlugin(a.value.plugin)}),e.onBeforeUnmount(()=>{const{pluginKey:s,editor:c}=t;c.unregisterPlugin(s)}),n({...t,dragstart:l,dragend:i}),()=>{var s;return e.h("div",{ref:r},(s=o.default)==null?void 0:s.call(o))}}}),av={key:0,class:"o-side-menu"},iv={class:"container"},lv=e.defineComponent({__name:"OSideMenu",props:{editor:{type:Te.Editor,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"}},setup(t){const n=t,o=e.ref(null),r=e.ref(null),a=e.ref(0),l=e.computed(()=>({arrow:!1,duration:100,placement:"left"})),i=e.computed(()=>({editor:n.editor,node:r.value,decorations:[],selected:!1,extension:{},getPos:()=>a.value,pos:a.value,updateAttributes:c,deleteNode:s,view:{},innerDecorations:[],HTMLAttributes:{},add:n.add}));function s(){var v,b;const m=a.value,f=m+((v=r.value)==null?void 0:v.nodeSize);(b=n.editor)==null||b.commands.deleteRange({from:m,to:f})}function c(m){var f;(f=n.editor)==null||f.commands.command(({tr:v})=>{var b;return v.setNodeMarkup(a.value,void 0,{...(b=r.value)==null?void 0:b.attrs,...m}),!0})}function d({editor:m,transaction:f}){let v={left:0,top:0};const b=go.getState(n.editor.view.state);if(b){v=b.coords;const h=Xb(v,m);h.node&&h.pos>0&&(r.value=h.node,a.value=h.pos)}}function u(m){var f;(f=o.value)==null||f.dragstart(m)}function p(m){var f;(f=o.value)==null||f.dragend(m)}return e.onMounted(()=>{var m;(m=n.editor)==null||m.on("transaction",d)}),(m,f)=>t.editor?(e.openBlock(),e.createElementBlock("section",av,[e.createVNode(e.unref(rv),{ref_key:"menu",ref:o,class:e.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":l.value},{default:e.withCtx(()=>[e.createElementVNode("section",iv,[r.value?(e.openBlock(),e.createBlock(e.unref(Bi),e.normalizeProps(e.mergeProps({key:0},i.value)),null,16)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(Mi),e.mergeProps({key:1},i.value,{onDragstart:u,onDragend:p}),null,16)):e.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):e.createCommentVNode("",!0)}}),sv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:n}=Q(),{run:o}=ie();return{locale:t,tr:n,run:o}},data(){return{view:"main"}},components:{OEmojiSelect:ko},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},Ar=(t,n)=>{const o=t.__vccOpts||t;for(const[r,a]of n)o[r]=a;return o},cv={class:"o-colon-view"};function uv(t,n,o,r,a,l){const i=e.resolveComponent("o-emoji-select");return e.openBlock(),e.createElementBlock("section",cv,[e.createVNode(i,{items:o.items,onSelect:l.onSelect},null,8,["items","onSelect"])])}const dv=Ar(sv,[["render",uv]]),pv={items:({query:t})=>Bn.filterEmojiGroups(t),render:()=>{let t,n;return{onStart:o=>{t=new K.VueRenderer(dv,{props:o,editor:o.editor}),o.clientRect&&(n=Mt("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(r){r.popper.classList.add("emoji-tippy")}}))},onUpdate(o){t.updateProps(o),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){var r;return o.event.key==="Escape"?(n[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){n[0].destroy(),t.destroy()}}}},fv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Te.Editor},range:{type:Object}},setup(){const{locale:t,tr:n}=Q(),{onCommand:o,run:r}=ie();return{locale:t,tr:n,onCommand:o,run:r}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:$e,OIcon:U,OList:Ge,OListItem:ze},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.runCommand(t);break}return!0},runCommand(t){const n=this.editor.chain().focus().deleteRange(this.range),o=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","taskList"].includes(t.value)?(o.deleteRange(this.range),this.run(this.editor,t.value,t.options)):this.onCommand(o,n,t.value,t.options)},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const n=this.items[t];n&&this.onClick(n)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return kn.slice(1)}},mounted(){this.selectedIndex=0}},mv={key:0,class:"view-main"},gv={class:"group o-tips"},bv={class:"o-tips"},vv={key:1,class:"item"},hv={key:1,class:"view-emoji"},_v={key:2,class:"view-emoji"};function kv(t,n,o,r,a,l){const i=e.resolveComponent("o-divider"),s=e.resolveComponent("o-icon"),c=e.resolveComponent("o-list-item"),d=e.resolveComponent("o-list");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${a.view}`])},[a.view==="main"?(e.openBlock(),e.createElementBlock("section",mv,[e.createVNode(d,{hoverable:"",clickable:""},{default:e.withCtx(()=>[o.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(o.items,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",gv,e.toDisplayString(r.tr(u.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(c,{class:e.normalizeClass(["item",{"is-active":p===a.selectedIndex}]),clickable:"",onClick:m=>l.onClick(u)},{prefix:e.withCtx(()=>[e.createVNode(s,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("span",bv,e.toDisplayString(u.tips),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(r.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",vv,"No result"))]),_:1})])):a.view==="emoji"?(e.openBlock(),e.createElementBlock("section",hv)):a.view==="ai"?(e.openBlock(),e.createElementBlock("section",_v)):e.createCommentVNode("",!0)],2)}const yv=Ar(fv,[["render",kv]]),Ca={items:({query:t})=>ho.filter(n=>{var o;return n.value.toLowerCase().includes(t.toLowerCase())||((o=n.keywords)==null?void 0:o.toLowerCase().includes(t.toLowerCase()))}),render:()=>{let t,n;return{onStart:o=>{t=new K.VueRenderer(yv,{props:o,editor:o.editor}),o.clientRect&&(n=Mt("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:r=>{r.popper.classList.add("slash-tippy")}}))},onUpdate(o){t.updateProps(o),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){var r;return o.event.key==="Escape"?(n[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){n[0].destroy(),t.destroy()}}}},Ev={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const n=this.items[t];n&&this.command({name:n.name})}}},wv={class:"dropdown-menu"},xv=["onClick"],Nv=["src"];function Cv(t,n,o,r,a,l){return e.openBlock(),e.createElementBlock("div",wv,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,(i,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass({"is-selected":s===a.selectedIndex}),key:s,onClick:c=>l.selectItem(s)},[i.fallbackImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.fallbackImage,align:"absmiddle"},null,8,Nv)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.emoji),1)],64)),e.createTextVNode(" :"+e.toDisplayString(i.name)+": ",1)],10,xv))),128))])}const Sv=Ar(Ev,[["render",Cv]]),Tv={items:({editor:t,query:n})=>t.storage.emoji.emojis.filter(({shortcodes:o,tags:r})=>o.find(a=>a.startsWith(n.toLowerCase()))||r.find(a=>a.startsWith(n.toLowerCase()))).slice(0,10),render:()=>{let t;function n(o){if(!t||!t.element)return;rr({getBoundingClientRect(){return o}},t.element,{placement:"bottom-start"}).then(a=>{Object.assign(t.element.style,{left:`${a.x}px`,top:`${a.y}px`,position:a.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:o=>{t=new K.VueRenderer(Sv,{props:o,editor:o.editor}),document.body.appendChild(t.element),n(o.clientRect())},onUpdate(o){t.updateProps(o),n(o.clientRect())},onKeyDown(o){var r;return o.event.key==="Escape"?(document.body.removeChild(t.element),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){document.body.contains(t.element)&&document.body.removeChild(t.element),t.destroy()}}}},Ov={BackgroundColor:Kn.BackgroundColor.configure({types:["textStyle"]}),BlockMath:Yo.BlockMath,Color:Kn.Color,Emoji:Fr.configure({emojis:Fr.gitHubEmojis,enableEmoticons:!0,suggestion:Tv}),Focus:Al.Focus,FontFamily:Kn.FontFamily,Highlight:Rl.configure({multicolor:!0}),Image:Il,InlineMath:Yo.InlineMath,Link:Sa,Markdown:Ml.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1}}),Subscript:Dl,Superscript:Ll,TaskItem:Gl,TaskList:Bl.TaskList.configure({itemTypeName:"taskItem"}),TextAlign:Vl.configure({types:["heading","paragraph"]}),TextStyle:Kn.TextStyle,Underline:Pl,Typography:$l,OAiBlock:am,OBlockMath:um,OColon:Lo.ColonCommand.configure({suggestion:pv}),OSlash:Lo.SlashCommand.configure({suggestion:Ca}),OSlashZh:Lo.SlashZhCommand.configure({suggestion:Ca}),OBlockquote:pm.configure({triggerCharacters:['"',"“","”"]}),OCallout:vm,OCodeBlock:cb,OColorHighlighter:Ul,OHeading:fb,OHorizontalRule:bb,OImage:xb,OInlinePlaceholder:zl,OLink:Cb.configure({openOnClick:!1}),OParagraph:Tb,OSelectionDecoration:Hl,UniqueID:Fl.configure({attributeName:"id",types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:Ub};class Av{constructor(n){return Ov[n]}}const Bv=[db.configure({persist:!0,HTMLAttributes:{class:"details"}}),Wo.DetailsContent,Wo.DetailsSummary],Mv=[Vb,ql.configure({resizable:!0}),Wt.TableRow,Db,Bb];Wt.Table.configure({resizable:!0}),Wt.TableRow,Wt.TableHeader,Wt.TableCell;const Rv=["data-theme"],il=e.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)},aiOption:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1,collaboration:null,collaborationCaret:null})}},emits:["create","transaction","update"],setup(t,{expose:n,emit:o}){const r=t,a=o,{tr:l}=Q(),i=e.ref(!1),s=e.ref(!0),c=e.ref("en"),d=e.ref(!1),u=e.ref(),p=e.ref(!1);e.provide("darkMode",i),e.provide("isEditable",s),e.provide("locale",c),e.provide("sideNode",d),e.provide("aiOption",u);const m=e.computed(()=>y()),f=K.useEditor({editable:r.editable,content:r.content,autofocus:r.autofocus,extensions:m.value,onCreate:()=>{p.value=!0,a("create",f.value)},onUpdate:({editor:E})=>{p.value&&a("update",{editor:E})},onTransaction:({editor:E,transaction:g})=>{a("transaction",{editor:E,transaction:g})}}),v=e.computed(()=>({editor:f.value,menu:r.mainMenu})),b=e.computed(()=>({editor:f.value,menu:r.bubbleMenu})),h=e.computed(()=>({editor:f.value,menu:r.floatingMenu})),_=e.computed(()=>({editor:f.value,add:r.sideMenu.add,menu:[]}));function y(){const E=[];r.title?E.push(Pr.extend({content:"heading block*"})):E.push(Pr),E.push(pn.configure({placeholder:({editor:N,node:x,pos:I})=>{if(x.type.name==="heading"){const L=x.attrs.level;return I>0?`H${L}`:l("label.untitled")}else return x.type.name==="paragraph"?l("label.typeForCommands"):""}})),E.push(Sl.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:r.extensions.includes("OBlockquote")?!1:{},heading:r.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:r.extensions.includes("OParagraph")?!1:{},trailingNode:r.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:r.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const g=zb.concat(r.extensions);for(const N of g)if(typeof N=="string"){if(!Gb.includes(N))continue;switch(N){case"ODetails":E.push(...Bv);break;case"Table":E.push(...Mv);break;default:try{const x=new Av(N);E.push(x)}catch(x){console.error(x.message)}break}}else E.push(N);return r.collab.enabled&&E.push(Tl.configure(r.collab.collaboration),Ol.configure(r.collab.collaborationCaret)),g.includes("OShortcut")&&(g.includes("Markdown")?E.push(Ur.configure({markdown:{enabled:!0}})):E.push(Ur)),E}return e.watch(()=>r.darkMode,E=>{i.value=E}),e.watch(()=>r.locale,E=>{c.value=E}),e.watch(()=>r.aiOption,E=>{u.value=E},{deep:!0}),e.watch(()=>r.editable,E=>{var g;(g=f.value)==null||g.setEditable(E),s.value=E}),e.onBeforeMount(()=>{s.value=r.editable,u.value=r.aiOption,i.value=r.darkMode,c.value=r.locale,d.value=!r.sideMenu.show&&r.showSideNode}),n({editor:f,darkMode:i,locale:c}),(E,g)=>{var N,x,I;return e.openBlock(),e.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":i.value?"dark":""},[t.showMainMenu?(e.openBlock(),e.createBlock(Vi,e.mergeProps({key:0},v.value,{class:"desktop-only"}),{left:e.withCtx(()=>[e.renderSlot(E.$slots,"toolbar-left")]),right:e.withCtx(()=>[e.renderSlot(E.$slots,"toolbar-right")]),_:3},16)):e.createCommentVNode("",!0),(N=e.unref(f))!=null&&N.isEditable&&t.showBubbleMenu?(e.openBlock(),e.createBlock(Wb,e.normalizeProps(e.mergeProps({key:1},b.value)),null,16)):e.createCommentVNode("",!0),(x=e.unref(f))!=null&&x.isEditable&&t.showFloatingMenu?(e.openBlock(),e.createBlock(jb,e.normalizeProps(e.mergeProps({key:2},h.value)),null,16)):e.createCommentVNode("",!0),(I=e.unref(f))!=null&&I.isEditable&&t.sideMenu.show?(e.openBlock(),e.createBlock(lv,e.normalizeProps(e.mergeProps({key:3},_.value)),null,16)):e.createCommentVNode("",!0),e.createVNode(e.unref(K.EditorContent),{class:e.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:e.unref(f)},null,8,["class","editor"])],8,Rv)}}}),Iv={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",il)}};exports.AddNode=Bi;exports.AdvancedBlocks=Ia;exports.AiBlocks=La;exports.AiProviders=Va;exports.AskAiBlocks=Da;exports.BasicBlocks=kn;exports.BlockMenus=no;exports.Blocks=ho;exports.Color=ee;exports.ColorList=hs;exports.CommonBlocks=mn;exports.DefaultBubble=Fa;exports.DefaultEmbedServices=xs;exports.DefaultFloating=Wa;exports.DefaultMenu=$a;exports.DragNode=Mi;exports.ImageBubble=Ha;exports.ImageLinkBubble=qa;exports.InlineMathBubble=Ua;exports.LinkBubble=za;exports.MoreBubble=Ga;exports.OAiMenu=Pi;exports.OAlignDropdown=ar;exports.OBlockList=vo;exports.OBlockListItem=jo;exports.OBlockMenu=Ht;exports.OBlockPlaceholder=bo;exports.OBlockPopover=Ot;exports.OBlockToolbar=ur;exports.OBtn=he;exports.OBtnGroup=Ri;exports.OCalloutColorBoard=dr;exports.OCalloutColorDropdown=Ds;exports.OCheckbox=Cr;exports.OCodeBlockDownloadDropdown=Ma;exports.OCodeBlockViewDropdown=Ra;exports.OColorBoard=Xt;exports.OCommandBtn=Ne;exports.OCommonBtn=ft;exports.OContextMenu=Vn;exports.ODialog=Ii;exports.ODivider=$e;exports.ODocToc=Ys;exports.OEmojiSelect=ko;exports.OFloatingToast=Zd;exports.OIcon=U;exports.OImageViewer=Di;exports.OInlineMathMenu=Fi;exports.OInput=bt;exports.OLanguageDropdown=ja;exports.OLinkBtn=ir;exports.OList=Ge;exports.OListItem=ze;exports.OMainMenu=Vi;exports.OMediaInput=pr;exports.OMenubarBtn=pe;exports.OMetaInput=yo;exports.ONodeView=ot;exports.OPopover=ge;exports.OTableCellBackground=hi;exports.OTableGrid=vi;exports.OTextColorBoard=yr;exports.OTextarea=Li;exports.OToast=Nr;exports.OTooltip=st;exports.Prompts=sr;exports.StyleBlocks=fn;exports.TableBubble=Ka;exports.TableFloating=ws;exports.TableMenu=Pa;exports.TableWrapperBubble=Es;exports.YiiEditor=il;exports.YiiEditorPlugin=Iv;exports.getProviderProp=lr;exports.useAi=cr;exports.useCommon=_o;exports.useI18n=Q;exports.useNodeView=Ya;exports.useTheme=tn;exports.useTiptap=ie;
294
+ ${W}
295
+ `}function L(){v.value=!v.value}function R(){switch(y.value){case"mermaid":z();break}}function q(){cf.initialize({...g,theme:r.value?"dark":m.value}),R()}async function z(){try{f.value="";const W=`mermaid-${e8()}`,{svg:me}=await cf.render(W,b.value);d.value=me}catch(W){console.error(W),f.value=W.message}}return c.watch(b,W=>{R()}),c.watch(y,W=>{R()}),c.watch(r,W=>{q()}),c.watch(C,(W,me)=>{W==="splitHorizontal"&&(h.value=me,a.value="mermaid")}),c.onMounted(()=>{var me;const W=e.editor.extensionManager.extensions.find(Ee=>Ee.name==="codeBlock");m.value=((me=W==null?void 0:W.options)==null?void 0:me.diagramTheme)||"default",q()}),(W,me)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:["o-code-block-view",`language-${y.value} ${C.value}`]}),{default:c.withCtx(()=>[c.createElementVNode("div",t8,[c.createElementVNode("div",n8,[c.createElementVNode("div",o8,c.toDisplayString(y.value),1),c.createVNode(c.unref(X1),{language:y.value,class:"editable",onSelect:S},null,8,["language"])]),c.createElementVNode("div",r8,[C.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[C.value==="splitHorizontal"?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:"close",tooltip:c.unref(o)("label.close"),class:"editable",onClick:B},null,8,["tooltip"])):(c.openBlock(),c.createBlock(c.unref(J1),{key:1,modelValue:p.value,"onUpdate:modelValue":me[0]||(me[0]=Ee=>p.value=Ee),class:"editable"},null,8,["modelValue"]))],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Oe),{icon:w.value,"icon-class":{"rotate-270":v.value},tooltip:"Wrap",class:"editable",onClick:L},null,8,["icon","icon-class"]),x.value?(c.openBlock(),c.createBlock(c.unref(K1),{key:1,onDownload:N})):(c.openBlock(),c.createBlock(c.unref(Oe),{key:2,icon:"download",tooltip:c.unref(o)("label.download"),onClick:N},null,8,["tooltip"])),k.value?(c.openBlock(),c.createBlock(c.unref(Oe),{key:3,icon:"play_circle",tooltip:"Run",onClick:A})):c.createCommentVNode("",!0),c.createVNode(c.unref(Oe),{icon:s.value,tooltip:c.unref(o)("label.copy"),onClick:T},null,8,["icon","tooltip"])])]),c.createVNode(c.unref(vC),c.mergeProps({show:l.value.show,"onUpdate:show":me[1]||(me[1]=Ee=>l.value.show=Ee)},l.value,{onClose:B}),{title:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(a.value),1)]),default:c.withCtx(()=>[a.value==="run"?(c.openBlock(),c.createElementBlock("iframe",{key:0,sandbox:"allow-same-origin allow-scripts",srcdoc:u.value},null,8,i8)):a.value==="mermaid"?(c.openBlock(),c.createElementBlock("div",s8,null,512)):c.createCommentVNode("",!0)]),_:1},16,["show"]),c.createElementVNode("pre",null,[c.createVNode(c.unref(tr),{as:"code",class:c.normalizeClass({wrap:v.value})},null,8,["class"])]),x.value?(c.openBlock(),c.createElementBlock("section",l8,[f.value?(c.openBlock(),c.createElementBlock("div",a8,c.toDisplayString(f.value),1)):(c.openBlock(),c.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:d.value},null,8,c8))])):c.createCommentVNode("",!0)]),_:1},16,["class"]))}}),hM=by.createLowlight(by.common);hM.register("mermaid",Y4);const mM=X4.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),diagramTheme:"default"}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return En(u8)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:hM}),d8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,t=c.ref(!!e.node.attrs.open);function o(){const r=!t.value;t.value=r,e.updateAttributes({open:r})}return(r,i)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:"o-details-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["details",{"is-open":t.value}])},[c.createElementVNode("button",{type:"button",onClick:o},[c.createVNode(c.unref(X),{name:"details_arrow"})]),c.createVNode(c.unref(tr))],2)]),_:1},16))}}),gM=IC.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new zr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.details.create(null,[s.nodes.detailsSummary.create(null),s.nodes.detailsContent.create(null,s.nodes.paragraph.create())]);i.replaceRangeWith(a,u,d);const f=U.near(i.doc.resolve(a+2));return i.setSelection(f),i}})]},addNodeView(){return En(d8)}}),f8={class:"horizontal"},p8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:"o-horizontal-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",f8,[c.createVNode(c.unref(tr),{as:"div",class:"divider"})])]),_:1},16))}}),yM=hB.extend({draggable:!0,addNodeView(){return En(p8)}});/**
296
+ * Copyright 2026 Yiitap
297
+ * @license MIT
298
+ **/var h8=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,m8=Be.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",pe(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?`![${a}](${l} "${u}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const u=new Ex({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[bd({find:h8,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),g8=m8;const y8=g8.extend({draggable:!0,addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),containerHeight:{default:0,rendered:!0},positionY:{default:0,rendered:!0},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:n,HTMLAttributes:e}){return e.containerHeight=n.attrs.containerHeight,e.positionY=n.attrs.positionY,["img",pe(this.options.HTMLAttributes,e)]}}),b8={key:1,class:"image-panel"},v8={class:"label"},w8={key:1,class:"resize-overlay"},k8={class:"resize-guide"},x8={class:"size-display"},C8={key:1},S8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{downloadImage:o}=Cd(),{isEditable:r,getEditorImages:i}=xe(),s=c.ref(!1),l=c.ref(!1),a=c.ref({}),u=c.ref(null),d=c.ref(!1),f=c.ref(!1),p=c.ref(0),h=c.ref([]),m=c.ref(),g=c.ref(null),y=c.ref(null),b=c.ref(null),v=c.ref(!1),k=c.ref(""),w=c.ref(0),x=c.ref(0),C=c.ref(0),S=c.ref(0),T=c.ref(e.node.attrs.width||0),N=c.ref(e.node.attrs.height||0),$=c.ref(0),O=c.ref(0),A=c.ref(0),B=c.ref(1200),I=c.ref(0),L=c.ref(0),R=c.ref(800),q=c.ref(400),z=c.ref(!1),W=c.ref(!0),me=c.ref(!1),Ee=c.ref(e.node.attrs.positionY||0),De=c.ref(0),je=c.ref(0),He=c.ref(!1),Te=c.computed(()=>e.node.attrs),te=c.computed({get(){return e.node.attrs.src},set(M){e.updateAttributes({src:M})}}),we=c.computed({get(){return e.node.attrs.title},set(M){e.updateAttributes({title:M})}});function Ne(){d.value=!0,setTimeout(()=>{var M;(M=u.value)==null||M.focus()},0)}function gt(){o(e.node.attrs.src)}function yt(){h.value=i(e.editor),p.value=h.value.findIndex(M=>M.pos===e.getPos())||0,f.value=!0}function so(){d.value=!1}function rr(){te.value==="init"&&Mn(!0)}function Bo(M){s.value=!0,a.value=M}function Do(M){switch(s.value=!1,M.value){case"replace":Mn(!0);break}}function ir(M){te.value=M,Mn(!1)}function Mn(M){l.value=M}const _o=c.computed(()=>({width:`${T.value}px`,maxWidth:`${B.value}px`,height:`${$.value}px`,maxHeight:z.value?`${I.value}px`:"auto",cursor:v.value?sr():"default"}));function sr(){switch(k.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function lr(){var M,P,ee;if(b.value){O.value=b.value.naturalWidth,A.value=b.value.naturalHeight,R.value=((P=(M=m.value)==null?void 0:M.$el)==null?void 0:P.parentElement.getBoundingClientRect().width)??0,B.value=((ee=document.querySelector(".layout"))==null?void 0:ee.getBoundingClientRect().width)??1200;const ve=O.value/A.value;R.value=Math.min(R.value,800),q.value=R.value/ve,!T.value||!N.value?(z.value=O.value>R.value,z.value?(T.value=R.value,N.value=R.value/O.value*A.value):(T.value=O.value,N.value=A.value),mn()):z.value=T.value>R.value,L.value>0?$.value=L.value:($.value=N.value,L.value=N.value),I.value=N.value,ao()}}function Pt(M,P){v.value=!0,k.value=P,C.value=M.clientX,S.value=M.clientY,w.value=T.value,x.value=N.value,document.addEventListener("mousemove",hn),document.addEventListener("mouseup",lo)}function hn(M){if(!v.value)return;const P=M.clientX-C.value,ee=M.clientY-S.value,ve=O.value/A.value;let fe=w.value,at=L.value;switch(k.value){case"left":fe=w.value-P;break;case"right":fe=w.value+P;break;case"bottom":at=L.value+ee;break}const Mt=fe/ve;T.value=Math.round(fe),N.value=Math.round(Mt),z.value=fe>R.value,z.value?($.value=at,I.value=N.value):($.value=N.value,Is())}function lo(){v.value=!1,k.value="",document.removeEventListener("mousemove",hn),document.removeEventListener("mouseup",lo),L.value=$.value,mn()}function mn(){e.updateAttributes({width:T.value,height:N.value,containerHeight:L.value})}const Qt=c.computed(()=>!N.value||!$.value?0:Math.min(0,$.value-N.value)),Io=c.computed(()=>({transform:`translateY(${Ee.value}px)`,cursor:Vt.value?"grab":"default",transition:me.value?"none":"transform 0.2s ease"})),Vt=c.computed(()=>W.value&&z.value&&$.value<N.value);function jn(){W.value=!W.value}function ao(){z.value&&$.value<N.value?He.value=!0:He.value=!1}function Is(){Ee.value!==0&&(Ee.value=0,Vi())}function Ls(M){!Vt.value||!He.value||v.value||M.target.closest(".block-resizer")||(M.preventDefault(),M.stopPropagation(),me.value=!0,De.value=M.clientY,je.value=Ee.value,document.addEventListener("mousemove",Li),document.addEventListener("mouseup",Pi),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function Li(M){if(!me.value)return;const P=M.clientY-De.value;let ee=je.value+P;ee=Math.max(Qt.value,Math.min(0,ee)),Ee.value=ee}function Pi(){me.value=!1,document.removeEventListener("mousemove",Li),document.removeEventListener("mouseup",Pi),document.body.style.userSelect="",document.body.style.cursor="",Vi()}function Vi(){e.updateAttributes({positionY:Ee.value})}return c.watch(()=>e.node.attrs.height,M=>{M&&(N.value=M)}),c.watch(()=>e.node.attrs.containerHeight,M=>{M&&(L.value=M,$.value=M,ao())}),c.watch(()=>e.node.attrs.positionY,M=>{M!==void 0&&(Ee.value=M)}),c.onMounted(()=>{Mn(te.value==="init"),Te.value.width&&(T.value=Te.value.width),Te.value.height&&(N.value=Te.value.height),Te.value.containerHeight&&(L.value=Te.value.containerHeight)}),c.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(M,P)=>{var ee;return c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps({ref_key:"imageView",ref:m},e,{class:["o-image-view",{max:z.value,"with-caption":Te.value.alt,readonly:!((ee=M.editor)!=null&&ee.isEditable),init:te.value==="init"}],as:"div",onContextmenu:c.withModifiers(Bo,["prevent"]),onClick:rr}),{default:c.withCtx(()=>[c.createVNode(c.unref(Yn),{modelValue:l.value,"onUpdate:modelValue":P[4]||(P[4]=ve=>l.value=ve),placement:te.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Nd),{val:te.value==="init"?"":te.value,type:"image",onInput:ir},null,8,["val"])]),default:c.withCtx(()=>{var ve;return[te.value==="init"?(c.openBlock(),c.createBlock(c.unref(va),{key:0,icon:"image",placeholder:c.unref(t)("label.imageAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",b8,[c.createVNode(c.unref(Md),c.mergeProps(e,{onAction:Do}),{default:c.withCtx(()=>[c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[He.value?(c.openBlock(),c.createBlock(c.unref(Oe),{key:0,icon:Vt.value?"arrow_expand":"close","icon-class":Vt.value?"rotate-315":"","content-class":"with-label",tooltip:c.unref(t)("image.repositionTips"),onClick:c.withModifiers(jn,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("span",v8,c.toDisplayString(c.unref(t)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(Oe),{icon:"subtitles",tooltip:c.unref(t)("image.caption"),onClick:c.withModifiers(Ne,["stop"])},null,8,["tooltip"]),c.createVNode(c.unref(sg),{editor:M.editor},null,8,["editor"]),c.createVNode(c.unref(ig),{editor:M.editor,placement:"bottom-end"},null,8,["editor"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Oe),{icon:"download",tooltip:c.unref(t)("label.download"),onClick:gt},null,8,["tooltip"]),c.createVNode(c.unref(Oe),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:yt},null,8,["tooltip"])]),_:1},16),c.createElementVNode("div",{ref_key:"imageContainer",ref:g,class:"image-container",style:c.normalizeStyle(_o.value),onMousedown:Ls},[c.createElementVNode("div",{ref_key:"imageWrapper",ref:y,class:"image-wrapper",style:c.normalizeStyle(Io.value)},[c.createElementVNode("img",c.mergeProps({ref_key:"imageElement",ref:b},Te.value,{draggable:"true","data-drag-handle":"",onLoad:lr}),null,16)],4),c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",{class:"block-resizer left",onMousedown:P[0]||(P[0]=c.withModifiers(fe=>Pt(fe,"left"),["stop","prevent"]))},[...P[7]||(P[7]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),c.createElementVNode("div",{class:"block-resizer right",onMousedown:P[1]||(P[1]=c.withModifiers(fe=>Pt(fe,"right"),["stop","prevent"]))},[...P[8]||(P[8]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),z.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:P[2]||(P[2]=c.withModifiers(fe=>Pt(fe,"bottom"),["stop","prevent"]))},[...P[9]||(P[9]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):c.createCommentVNode("",!0),v.value?(c.openBlock(),c.createElementBlock("div",w8,[c.createElementVNode("div",k8,[c.createElementVNode("div",x8,c.toDisplayString(T.value)+" × "+c.toDisplayString($.value),1)])])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0)],36),c.createElementVNode("div",{class:"caption",onClick:Ne},[(ve=M.editor)!=null&&ve.isEditable&&d.value?(c.openBlock(),c.createBlock(c.unref(to),{key:0,ref_key:"captionInput",ref:u,class:"caption-input",modelValue:we.value,"onUpdate:modelValue":P[3]||(P[3]=fe=>we.value=fe),type:"text",placeholder:"Input caption",autosize:"",onBlur:so},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",C8,c.toDisplayString(we.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref($s),{modelValue:s.value,"onUpdate:modelValue":P[5]||(P[5]=ve=>s.value=ve),event:a.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:Do}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(wC),{show:f.value,"onUpdate:show":P[6]||(P[6]=ve=>f.value=ve),images:h.value,current:p.value},{title:c.withCtx(()=>[...P[10]||(P[10]=[c.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),bM=y8.extend({addNodeView(){return En(S8)}}).configure({inline:!0});function E8(n){return new ue({key:new ae("handleClickSelectLink"),props:{handleClick:(e,t,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=Os(i.resolve(t),r.marks.link);if(!l)return!1;const a=i.resolve(l.from),u=i.resolve(l.to),d=s.setSelection(new U(a,u));return e.dispatch(d),!0}}})}const vM=Wm.extend({addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],E8({type:this.type})]}}).configure({openOnClick:!1}),M8={class:"add"},T8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{isEditable:o,run:r}=xe(),i=c.ref(!1);function s(){i.value=!0}function l(){a("tableSelectRow",{pos:e.getPos()})}function a(u,d={}){u==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,u,d)},0)}return(u,d)=>(c.openBlock(),c.createBlock(c.unref(Dm),c.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Yn),{key:0,modelValue:i.value,"onUpdate:modelValue":d[2]||(d[2]=f=>i.value=f),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"select_all",placement:"left",tooltip:c.unref(t)("table.selectRow"),onClick:l},null,8,["tooltip"]),c.createVNode(c.unref(Ze),{icon:"delete",placement:"left",tooltip:c.unref(t)("table.removeRow"),onClick:d[1]||(d[1]=f=>a("tableDeleteRow"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["row-handler",{active:i.value}]),onClick:s},[c.createElementVNode("div",M8,[d[3]||(d[3]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Gn),{icon:"add_circle",color:c.unref(he).blue,tooltip:c.unref(t)("table.addRow"),placement:"left",onClick:d[0]||(d[0]=c.withModifiers(f=>a("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.createVNode(c.unref(tr))]),_:1},16,["style"]))}}),wM=Id.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return En(T8,{stopEvent:()=>!1})}}),N8={class:"add"},A8={class:"add"},O8=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{isEditable:o,run:r}=xe(),i=c.ref(!1),s=c.ref(!1);function l(){setTimeout(()=>{i.value=!0},0)}function a(){s.value=!0}function u(){i.value=!1,f("tableSelectColumn",{pos:e.getPos()})}function d(){f("tableSelectRow",{pos:e.getPos()})}function f(p,h={}){p==="tableDeleteRow"?s.value=!1:p==="tableDeleteColumn"&&(i.value=!1),setTimeout(()=>{r(e.editor,p,h)},0)}return(p,h)=>(c.openBlock(),c.createBlock(c.unref(Dm),c.mergeProps({class:"o-table-header-view",as:"th"},p.node.attrs,{style:{background:p.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(c.unref(Yn),{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=m=>i.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"select_all",tooltip:c.unref(t)("table.selectColumn"),onClick:u},null,8,["tooltip"]),c.createVNode(c.unref(Ze),{icon:"delete",tooltip:c.unref(t)("table.removeColumn"),onClick:h[1]||(h[1]=m=>f("tableDeleteColumn"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["col-handler",{active:i.value}]),onClick:l},[c.createElementVNode("div",N8,[h[6]||(h[6]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Gn),{icon:"add_circle",color:c.unref(he).blue,tooltip:c.unref(t)("table.addColumn"),onClick:h[0]||(h[0]=c.withModifiers(m=>f("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),c.createVNode(c.unref(Yn),{modelValue:s.value,"onUpdate:modelValue":h[5]||(h[5]=m=>s.value=m),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Ze),{icon:"select_all",placement:"left",tooltip:c.unref(t)("table.selectRow"),onClick:d},null,8,["tooltip"]),c.createVNode(c.unref(Ze),{icon:"delete",placement:"left",tooltip:c.unref(t)("table.removeRow"),onClick:h[4]||(h[4]=m=>f("tableDeleteRow"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["row-handler",{active:s.value}]),onClick:a},[c.createElementVNode("div",A8,[h[7]||(h[7]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Gn),{icon:"add_circle",color:c.unref(he).blue,tooltip:c.unref(t)("table.addRow"),placement:"left",onClick:h[3]||(h[3]=c.withModifiers(m=>f("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(tr))]),_:1},16,["style"]))}}),kM=Ld.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return En(O8,{stopEvent:()=>!1})}});/**
299
+ * Copyright 2026 Yiitap
300
+ * @license MIT
301
+ **/function xM(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=xM(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function CM(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=CM(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class G{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new G(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new G(o,r)}cutByIndex(e,t){return e==t?G.empty:e==0&&t==this.content.length?this:new G(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new G(r,i)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return xM(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return CM(this,e,t,o)}findIndex(e){if(e==0)return rc(0,e);if(e==this.size)return rc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?rc(t+1,i):rc(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return G.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new G(t||e,o)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const np={index:0,offset:0};function rc(n,e){return np.index=n,np.offset=e,np}function _h(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!_h(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!_h(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class tn{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&_h(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return tn.none;if(e instanceof tn)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}}tn.none=[];class $8 extends Error{}class Z{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=EM(this.content,e+this.openStart,t);return o&&new Z(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(SM(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Z.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(G.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new Z(e,o,r)}}Z.empty=new Z(G.empty,0,0);function SM(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(SM(i.content,e-r-1,t-r-1)))}function EM(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=EM(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function R8(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function B8(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function D8(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function _8(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new L8(n,o,e[o]);return t}function I8(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class L8{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?I8(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Gg{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=_8(e,r.attrs),this.excluded=null;let i=R8(this.attrs);this.instance=i?new tn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new tn(this,B8(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Gg(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){D8(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}function P8(n){return n.tag!=null}function V8(n){return n.style!=null}class Ku{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(P8(r))this.tags.push(r);else if(V8(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new Bw(this,t,!1);return o.addAll(e,tn.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Bw(this,t,!0);return o.addAll(e,tn.none,t.from,t.to),Z.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(F8(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Dw(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Dw(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ku(e,Ku.schemaRules(e)))}}const MM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},z8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},TM={ol:!0,ul:!0},la=1,Ih=2,El=4;function Rw(n,e,t){return e!=null?(e?la:0)|(e==="full"?Ih:0):n&&n.whitespace=="pre"?la|Ih:t&~El}class ic{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=tn.none,this.match=i||(s&El?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(G.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&la)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=G.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!MM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bw{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=Rw(null,t.preserveWhitespace,0)|(o?El:0);r?i=new ic(r.type,r.attrs,tn.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new ic(null,null,tn.none,!0,null,s):i=new ic(e.schema.topNodeType,null,tn.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Ih?"full":this.localPreserveWS||(r.options&la)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
302
+ `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;TM.hasOwnProperty(s)&&this.parser.normalizeLists&&H8(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:z8.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(MM.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
303
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=tn.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):_w(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Rw(e,i,s.options);s.options&El&&s.content.length==0&&(l|=El);let a=tn.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):_w(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new ic(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=la)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function H8(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&TM.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function F8(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Dw(n){let e={};for(let t in n)e[t]=n[t];return e}function _w(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Yd{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=op(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Oc(op(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Oc(op(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Oc(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Yd(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Iw(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Iw(e.marks)}}function Iw(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function op(n){return n.document||window.document}const Lw=new WeakMap;function j8(n){let e=Lw.get(n);return e===void 0&&Lw.set(n,e=W8(n)),e}function W8(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Oc(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=j8(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Oc(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const NM=65535,AM=Math.pow(2,16);function U8(n,e){return n+e*AM}function Pw(n){return n&NM}function q8(n){return(n-(n&NM))/AM}const OM=1,$M=2,$c=4,RM=8;class Lh{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&RM)>0}get deletedBefore(){return(this.delInfo&(OM|$c))>0}get deletedAfter(){return(this.delInfo&($M|$c))>0}get deletedAcross(){return(this.delInfo&$c)>0}}class wn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wn.empty)return wn.empty}recover(e){let t=0,o=Pw(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+q8(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:U8(l/3,e-a),g=e==a?$M:e==f?OM:$c;return(t<0?e!=a:e!=f)&&(g|=RM),new Lh(h,g,m)}r+=d-u}return o?e+r:new Lh(e+r,0,null)}touches(e,t){let o=0,r=Pw(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new wn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wn.empty:new wn(e<0?[0,-e,0]:[0,0,e])}}wn.empty=new wn([]);class Ju{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ju(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Ju;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Lh(e,r,null)}}const rp=Object.create(null);class Yt{getMap(){return wn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=rp[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in rp)throw new RangeError("Duplicate use of step JSON ID "+e);return rp[e]=t,t.prototype.jsonID=e,t}}class ft{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ft(e,null)}static fail(e){return new ft(null,e)}static fromReplace(e,t,o,r){try{return ft.ok(e.replace(t,o,r))}catch(i){if(i instanceof $8)return ft.fail(i.message);throw i}}}function Xg(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Xg(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return G.fromArray(o)}class Sr extends Yt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new Z(Xg(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,i)}invert(){return new bo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Sr(t.pos,o.pos,this.mark)}merge(e){return e instanceof Sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Sr(t.from,t.to,e.markFromJSON(t.mark))}}Yt.jsonID("addMark",Sr);class bo extends Yt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new Z(Xg(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,o)}invert(){return new Sr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new bo(t.pos,o.pos,this.mark)}merge(e){return e instanceof bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new bo(t.from,t.to,e.markFromJSON(t.mark))}}Yt.jsonID("removeMark",bo);class Er extends Yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new Z(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new Er(this.pos,t.marks[r]);return new Er(this.pos,this.mark)}}return new Ni(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Er(t.pos,e.markFromJSON(t.mark))}}Yt.jsonID("addNodeMark",Er);class Ni extends Yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new Z(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ni(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ni(t.pos,e.markFromJSON(t.mark))}}Yt.jsonID("removeNodeMark",Ni);class jt extends Yt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Ph(e,this.from,this.to)?ft.fail("Structure replace would overwrite content"):ft.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wn([this.from,this.to-this.from,this.slice.size])}invert(e){return new jt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new jt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof jt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new jt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new jt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new jt(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}Yt.jsonID("replace",jt);class Xn extends Yt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ph(e,this.from,this.gapFrom)||Ph(e,this.gapTo,this.to)))return ft.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ft.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?ft.fromReplace(e,this.from,this.to,o):ft.fail("Content does not fit in gap")}getMap(){return new wn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Xn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Xn(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xn(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Yt.jsonID("replaceAround",Xn);function Ph(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function K8(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new bo(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Sr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function J8(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof Gg){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new bo(s.from,s.to,s.style)))}function Yg(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new jt(l,d,Z.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new bo(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new Z(G.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new jt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(G.empty,!0);n.replace(l,l,new Z(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function G8(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=G.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=G.from(o.node(m).copy(d)),f++):a--;let p=G.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=G.from(r.node(m).copy(p)),h++):u++;n.step(new Xn(a,u,s,l,new Z(d.append(p),f,h),d.size-f,!0))}function X8(n,e,t){let o=G.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=G.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new Xn(r,i,r,i,new Z(o,0,0),t.length,!0))}function Y8(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&Q8(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&DM(n,s,l,i),Yg(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new Xn(f,p,f+1,p-1,new Z(G.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&BM(n,s,l,i),!1}})}function BM(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function DM(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
304
+ `))}})}function Q8(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function Z8(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Xn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Z(G.from(s),0,0),1,!0))}function eq(n,e,t=1,o){let r=n.doc.resolve(e),i=G.empty,s=G.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=G.from(r.node(l).copy(i));let d=o&&o[u];s=G.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new jt(e,e,new Z(i.append(s),t,t),!0))}function tq(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);DM(n,d.node(),d.before(),l)}s.inlineContent&&Yg(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new jt(u,a.map(e+t,-1),Z.empty,!0)),o===!0){let d=n.doc.resolve(u);BM(n,d.node(),d.before(),n.steps.length)}return n}function nq(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function oq(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function rq(n,e,t=e,o=Z.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return _M(r,i,o)?new jt(e,t,o):new iq(r,i,o).fit()}function _M(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class iq{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new Z(i,s,l);return e>-1?new Xn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new jt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=ip(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(G.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=ip(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Z(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=ip(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Z(il(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new Z(il(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(IM(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=sl(this.placed,t,G.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?Z.empty:new Z(il(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new Z(il(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!sp(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=sp(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=sp(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=sl(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=sl(this.placed,this.depth,G.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(G.empty,!0);e.childCount&&(this.placed=sl(this.placed,this.frontier.length,e))}}function il(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(il(n.firstChild.content,e-1,t)))}function sl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(sl(n.lastChild.content,e-1,t)))}function ip(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function IM(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,IM(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(G.empty,!0)))),n.copy(o)}function sp(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!sq(t,i.content,s)?l:null}function sq(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function lq(n){return n.spec.defining||n.spec.definingForContent}function aq(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(_M(r,i,o))return n.step(new jt(e,t,o));let s=PM(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=lq(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),k=r.index(y-1);if(v.canReplaceWith(k,k,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new Z(LM(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function LM(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(LM(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(G.empty,!0))}return n}function cq(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=nq(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new Z(G.from(o),0,0))}function uq(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=PM(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function PM(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class cs extends Yt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return ft.fromReplace(e,this.pos,this.pos+1,new Z(G.from(r),0,t.isLeaf?0:1))}getMap(){return wn.empty}invert(e){return new cs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cs(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new cs(t.pos,t.attr,t.value)}}Yt.jsonID("attr",cs);class aa extends Yt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return ft.ok(o)}getMap(){return wn.empty}invert(e){return new aa(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new aa(t.attr,t.value)}}Yt.jsonID("docAttr",aa);let As=class extends Error{};As=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};As.prototype=Object.create(Error.prototype);As.prototype.constructor=As;As.prototype.name="TransformError";class dq{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ju}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new As(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=Z.empty){let r=rq(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new Z(G.from(o),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return aq(this,e,t,o),this}replaceRangeWith(e,t,o){return cq(this,e,t,o),this}deleteRange(e,t){return uq(this,e,t),this}lift(e,t){return G8(this,e,t),this}join(e,t=1){return tq(this,e,t),this}wrap(e,t){return X8(this,e,t),this}setBlockType(e,t=e,o,r=null){return Y8(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return Z8(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new cs(e,t,o)),this}setDocAttribute(e,t){return this.step(new aa(e,t)),this}addNodeMark(e,t){return this.step(new Er(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof tn)t.isInSet(o.marks)&&this.step(new Ni(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new Ni(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return eq(this,e,t,o),this}addMark(e,t,o){return K8(this,e,t,o),this}removeMark(e,t,o){return J8(this,e,t,o),this}clearIncompatible(e,t,o){return Yg(this,e,t,o),this}}const lp=Object.create(null);class Ie{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new VM(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Z.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?Z.empty:t),l==0&&Hw(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),Hw(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Le(e):Zi(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Zi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Zi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Co(e.node(0))}static atStart(e){return Zi(e,e,0,0,1)||new Co(e)}static atEnd(e){return Zi(e,e,e.content.size,e.childCount,-1)||new Co(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=lp[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in lp)throw new RangeError("Duplicate use of selection JSON ID "+e);return lp[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Le.between(this.$anchor,this.$head).getBookmark()}}Ie.prototype.visible=!0;class VM{constructor(e,t){this.$from=e,this.$to=t}}let Vw=!1;function zw(n){!Vw&&!n.parent.inlineContent&&(Vw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Le extends Ie{constructor(e,t=e){zw(e),zw(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return Ie.near(o);let r=e.resolve(t.map(this.anchor));return new Le(r.parent.inlineContent?r:o,o)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Le&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Qd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Le(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=Ie.findFrom(t,o,!0)||Ie.findFrom(t,-o,!0);if(i)t=i.$head;else return Ie.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(Ie.findFrom(e,-o,!0)||Ie.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new Le(e,t)}}Ie.jsonID("text",Le);class Qd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Qd(e.map(this.anchor),e.map(this.head))}resolve(e){return Le.between(e.resolve(this.anchor),e.resolve(this.head))}}class Re extends Ie{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?Ie.near(i):new Re(i)}content(){return new Z(G.from(this.node),0,0)}eq(e){return e instanceof Re&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Qg(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Re(e.resolve(t.anchor))}static create(e,t){return new Re(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Re.prototype.visible=!1;Ie.jsonID("node",Re);class Qg{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Qd(o,o):new Qg(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Re.isSelectable(o)?new Re(t):Ie.near(t)}}class Co extends Ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.empty){e.delete(0,e.doc.content.size);let o=Ie.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Co(e)}map(e){return new Co(e)}eq(e){return e instanceof Co}getBookmark(){return fq}}Ie.jsonID("all",Co);const fq={map(){return this},resolve(n){return new Co(n)}};function Zi(n,e,t,o,r,i=!1){if(e.inlineContent)return Le.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Re.isSelectable(l))return Re.create(n,t-(r<0?l.nodeSize:0))}else{let a=Zi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function Hw(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof jt||r instanceof Xn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(Ie.near(n.doc.resolve(s),t))}function Fw(n,e){return!e||!n?n:n.bind(e)}class sc{constructor(e,t,o){this.name=e,this.init=Fw(t.init,o),this.apply=Fw(t.apply,o)}}new sc("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new sc("selection",{init(n,e){return n.selection||Ie.atStart(e.doc)},apply(n){return n.selection}}),new sc("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new sc("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function zM(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=zM(r,e,{})),t[o]=r}return t}class HM{constructor(e){this.spec=e,this.props={},e.props&&zM(e.props,this,this.props),this.key=e.key?e.key.key:FM("plugin")}getState(e){return e[this.key]}}const ap=Object.create(null);function FM(n){return n in ap?n+"$"+ ++ap[n]:(ap[n]=0,n+"$")}class Zg{constructor(e="key"){this.key=FM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const _i=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},jM=function(n,e,t,o){return t&&(jw(n,e,t,o,-1)||jw(n,e,t,o,1))},pq=/^(img|br|input|textarea|hr)$/i;function jw(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Gu(n))){let s=n.parentNode;if(!s||s.nodeType!=1||ey(n)||pq.test(n.nodeName)||n.contentEditable=="false")return!1;e=_i(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?Gu(n):0}else return!1}}function Gu(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function hq(n,e,t){for(let o=e==0,r=e==Gu(n);o||r;){if(n==t)return!0;let i=_i(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Gu(n)}}function ey(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const WM=function(n){return n.focusNode&&jM(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function UM(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const No=typeof navigator<"u"?navigator:null,Ww=typeof document<"u"?document:null,Ur=No&&No.userAgent||"",Vh=/Edge\/(\d+)/.exec(Ur),qM=/MSIE \d/.exec(Ur),zh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ur),Ma=!!(qM||zh||Vh),KM=qM?document.documentMode:zh?+zh[1]:Vh?+Vh[1]:0,Zd=!Ma&&/gecko\/(\d+)/i.test(Ur);Zd&&+(/Firefox\/(\d+)/.exec(Ur)||[0,0])[1];const Hh=!Ma&&/Chrome\/(\d+)/.exec(Ur),or=!!Hh,JM=Hh?+Hh[1]:0,Ii=!Ma&&!!No&&/Apple Computer/.test(No.vendor),ty=Ii&&(/Mobile\/\w+/.test(Ur)||!!No&&No.maxTouchPoints>2),On=ty||(No?/Mac/.test(No.platform):!1),GM=No?/Win/.test(No.platform):!1,Ta=/Android \d/.test(Ur),ny=!!Ww&&"webkitFontSmoothing"in Ww.documentElement.style,mq=ny?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function gq(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,u;if(WM(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Re.isSelectable(f)&&r.parent&&!(f.isInline&&hq(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=new Re(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=YM(n,d,l,f)}return u}function XM(n){return n.editable?n.hasFocus():wq(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function oy(n,e=!1){let t=n.state.selection;if(vq(n,t),!!XM(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&or){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&jM(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)bq(n);else{let{anchor:o,head:r}=t,i,s;Uw&&!(t instanceof Le)&&(t.$from.parent.inlineContent||(i=qw(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=qw(n,t.to))),n.docView.setSelection(o,r,n,e),Uw&&(i&&Kw(i),s&&Kw(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&yq(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Uw=Ii||or&&JM<63;function qw(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(Ii&&r&&r.contentEditable=="false")return cp(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return cp(r);if(i)return cp(i)}}function cp(n){return n.contentEditable="true",Ii&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Kw(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function yq(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!XM(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function bq(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,_i(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Ma&&KM<=11&&(t.disabled=!0,t.disabled=!1)}function vq(n,e){if(e instanceof Re){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Jw(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Jw(n)}function Jw(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function YM(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Le.between(e,t,o)}function wq(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Fh(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Ie.findFrom(i,e)}function gr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Gw(n,e,t){let o=n.state.selection;if(o instanceof Le)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return gr(n,new Le(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Fh(n.state,e);return r&&r instanceof Re?gr(n,r):!1}else if(!(On&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Re.isSelectable(i)?gr(n,new Re(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):ny?gr(n,new Le(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Re&&o.node.isInline)return gr(n,new Le(e>0?o.$to:o.$from));{let r=Fh(n.state,e);return r?gr(n,r):!1}}}function Xu(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ml(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ui(n,e){return e<0?kq(n):xq(n)}function kq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Zd&&t.nodeType==1&&o<Xu(t)&&Ml(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Ml(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(QM(t))break;{let l=t.previousSibling;for(;l&&Ml(l,-1);)r=t.parentNode,i=_i(l),l=l.previousSibling;if(l)t=l,o=Xu(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?jh(n,t,o):r&&jh(n,r,i)}function xq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Xu(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Ml(l,1))i=t,s=++o;else break}else{if(QM(t))break;{let l=t.nextSibling;for(;l&&Ml(l,1);)i=l.parentNode,s=_i(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Xu(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&jh(n,i,s)}function QM(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Cq(n,e){for(;n&&e==n.childNodes.length&&!ey(n);)e=_i(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Sq(n,e){for(;n&&!e&&!ey(n);)e=_i(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function jh(n,e,t){if(e.nodeType!=3){let i,s;(s=Cq(e,t))?(e=s,t=0):(i=Sq(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(WM(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&oy(n)},50)}function Xw(n,e){let t=n.state.doc.resolve(e);if(!(or||GM)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Yw(n,e,t){let o=n.state.selection;if(o instanceof Le&&!o.empty||t.indexOf("s")>-1||On&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Fh(n.state,e);if(s&&s instanceof Re)return gr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Co?Ie.near(s,e):Ie.findFrom(s,e);return l?gr(n,l):!1}return!1}function Qw(n,e){if(!(n.state.selection instanceof Le))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Zw(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Eq(n){if(!Ii||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;Zw(n,o,"true"),setTimeout(()=>Zw(n,o,"false"),20)}return!1}function Mq(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Tq(n,e){let t=e.keyCode,o=Mq(e);if(t==8||On&&t==72&&o=="c")return Qw(n,-1)||Ui(n,-1);if(t==46&&!e.shiftKey||On&&t==68&&o=="c")return Qw(n,1)||Ui(n,1);if(t==13||t==27)return!0;if(t==37||On&&t==66&&o=="c"){let r=t==37?Xw(n,n.state.selection.from)=="ltr"?-1:1:-1;return Gw(n,r,o)||Ui(n,r)}else if(t==39||On&&t==70&&o=="c"){let r=t==39?Xw(n,n.state.selection.from)=="ltr"?1:-1:1;return Gw(n,r,o)||Ui(n,r)}else{if(t==38||On&&t==80&&o=="c")return Yw(n,-1,o)||Ui(n,-1);if(t==40||On&&t==78&&o=="c")return Eq(n)||Yw(n,1,o)||Ui(n,1);if(o==(On?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ZM(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||Yd.fromSchema(n.state.schema),l=iT(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=rT[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
305
+
306
+ `);return{dom:a,text:p,slice:e}}function eT(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new Z(G.from(n.state.schema.text(e.replace(/\r\n?/g,`
307
+ `))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=Yd.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=$q(t),ny&&Rq(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Ku.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Nq.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Bq(ek(l,+d[1],+d[2]),d[4]);else if(l=Z.maxOpen(Aq(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=ek(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const Nq=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Aq(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),r,i=[];if(n.forEach(s=>{if(!i)return;let l=o.findWrapping(s.type),a;if(!l)return i=null;if(a=i.length&&r.length&&nT(l,r,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=oT(i[i.length-1],r.length));let u=tT(s,l);i.push(u),o=o.matchType(u.type),r=l}}),i)return G.from(i)}return n}function tT(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,G.from(n));return n}function nT(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=nT(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(G.from(tT(t,n,r+1))))}}function oT(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,oT(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(G.empty,!0);return n.copy(t.append(o))}function Wh(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=Wh(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(G.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function ek(n,e,t){return e<n.openStart&&(n=new Z(Wh(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new Z(Wh(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const rT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let tk=null;function iT(){return tk||(tk=document.implementation.createHTMLDocument("title"))}let up=null;function Oq(n){let e=window.trustedTypes;return e?(up||(up=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),up.createHTML(n)):n}function $q(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=iT().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&rT[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Oq(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function Rq(n){let e=n.querySelectorAll(or?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function Bq(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=G.from(a.create(o[l+1],r)),i++,s++}return new Z(r,i,s)}const ro={},Sn={};function Mr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Sn.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!lT(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ta&&or&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ty&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,UM(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||Tq(n,t)?t.preventDefault():Mr(n,"key")};Sn.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Sn.keypress=(n,e)=>{let t=e;if(lT(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||On&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Le)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function ef(n){return{left:n.clientX,top:n.clientY}}function Dq(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function ry(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function us(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function _q(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Re.isSelectable(o)?(us(n,new Re(t)),!0):!1}function Iq(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Re&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Re.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(us(n,Re.create(n.state.doc,r)),!0):!1}function Lq(n,e,t,o,r){return ry(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?Iq(n,t):_q(n,t))}function Pq(n,e,t,o){return ry(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function Vq(n,e,t,o){return ry(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||zq(n,t,o)}function zq(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(us(n,Le.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)us(n,Le.create(o,l+1,l+1+s.content.size));else if(Re.isSelectable(s))us(n,Re.create(o,l));else continue;return!0}}function iy(n){return Yu(n)}const sT=On?"metaKey":"ctrlKey";ro.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=iy(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&Dq(t,n.input.lastClick)&&!t[sT]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(ef(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Hq(n,s,t,!!o)):(i=="doubleClick"?Pq:Vq)(n,s.pos,s.inside,t)?t.preventDefault():Mr(n,"pointer"))};class Hq{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[sT],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Re&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zd&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Mr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>oy(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ef(e))),this.updateAllowDefault(e),this.allowDefault||!t?Mr(this.view,"pointer"):Lq(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ii&&this.mightDrag&&!this.mightDrag.node.isAtom||or&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(us(this.view,Ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Mr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Mr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}ro.touchstart=n=>{n.input.lastTouch=Date.now(),iy(n),Mr(n,"pointer")};ro.touchmove=n=>{n.input.lastTouch=Date.now(),Mr(n,"pointer")};ro.contextmenu=n=>iy(n);function lT(n,e){return n.composing?!0:Ii&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Fq=Ta?5e3:-1;Sn.compositionstart=Sn.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Le&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||or&&GM&&jq(n)))n.markCursor=n.state.storedMarks||t.marks(),Yu(n,!0),n.markCursor=null;else if(Yu(n,!e.selection.empty),Zd&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}aT(n,Fq)};function jq(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}Sn.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,aT(n,20))};function aT(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Yu(n),e))}function Wq(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Uq());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Uq(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Yu(n,e=!1){if(!(Ta&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Wq(n),e||n.docView&&n.docView.dirty){let t=gq(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function qq(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const ca=Ma&&KM<15||ty&&mq<604;ro.copy=Sn.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=ca?null:t.clipboardData,s=o.content(),{dom:l,text:a}=ZM(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):qq(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Kq(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Jq(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?Uh(n,o.value,null,r,e):Uh(n,o.textContent,o.innerHTML,r,e)},50)}function Uh(n,e,t,o,r){let i=eT(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||Z.empty)))return!0;if(!i)return!1;let s=Kq(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function cT(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Sn.paste=(n,e)=>{let t=e;if(n.composing&&!Ta)return;let o=ca?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Uh(n,cT(o),o.getData("text/html"),r,t)?t.preventDefault():Jq(n,t)};class Gq{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const Xq=On?"altKey":"ctrlKey";function uT(n,e){return n.someProp("dragCopies",o=>!o(e))??!e[Xq]}ro.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(ef(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Re?r.to-1:r.to))){if(o&&o.mightDrag)s=Re.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Re.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:u,slice:d}=ZM(n,l);(!t.dataTransfer.files.length||!or||JM>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ca?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",ca||t.dataTransfer.setData("text/plain",u),n.dragging=new Gq(d,uT(n,t),s)};ro.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Sn.dragover=Sn.dragenter=(n,e)=>e.preventDefault();Sn.drop=(n,e)=>{try{Yq(n,e,n.dragging)}finally{n.dragging=null}};function Yq(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(ef(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=eT(n,cT(e.dataTransfer),ca?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&uT(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||Z.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?oq(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&Re.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Re(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(YM(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}ro.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&oy(n)},20))};ro.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};ro.beforeinput=(n,e)=>{if(or&&Ta&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:t}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=t||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,UM(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in Sn)ro[n]=Sn[n];function ua(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Qu{constructor(e,t){this.toDOM=e,this.spec=t||pi,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new Rn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Qu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ua(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Rr{constructor(e,t){this.attrs=e,this.spec=t||pi}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Rn(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Rr&&ua(this.attrs,e.attrs)&&ua(this.spec,e.spec)}static is(e){return e.type instanceof Rr}destroy(){}}class sy{constructor(e,t){this.attrs=e,this.spec=t||pi}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Rn(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof sy&&ua(this.attrs,e.attrs)&&ua(this.spec,e.spec)}destroy(){}}class Rn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Rn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Rn(e,e,new Qu(t,o))}static inline(e,t,o,r){return new Rn(e,t,new Rr(o,r))}static node(e,t,o,r){return new Rn(e,t,new sy(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Rr}get widget(){return this.type instanceof Qu}}const es=[],pi={};class ut{constructor(e,t){this.local=e.length?e:es,this.children=t.length?t:es}static create(e,t){return t.length?Zu(t,e,0,pi):en}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==en||e.maps.length==0?this:this.mapInner(e,t,0,0,o||pi)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Qq(this.children,s||[],e,t,o,r,i):s?new ut(s.sort(hi),es):en}add(e,t){return t.length?this==en?ut.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=fT(t,l,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,d,u+1):r.splice(i,0,a,a+l.nodeSize,Zu(d,l,u+1,pi)),i+=3}});let s=dT(i?pT(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ut(s.length?this.local.concat(s).sort(hi):this.local,r||this.children)}remove(e){return e.length==0||this==en?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=en?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ut(r,o):en}forChild(e,t){if(this==en)return this;if(t.isLeaf)return ut.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Rr){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new ut(r.sort(hi),es);return o?new Xr([l,o]):l}return o||en}eq(e){if(this==e)return!0;if(!(e instanceof ut)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ly(this.localsInner(e))}localsInner(e){if(this==en)return es;if(e.inlineContent||!this.local.some(Rr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Rr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}ut.empty=new ut([],[]);ut.removeOverlap=ly;const en=ut.empty;class Xr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,pi));return Xr.from(o)}forChild(e,t){if(t.isLeaf)return ut.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=en&&(i instanceof Xr?o=o.concat(i.members):o.push(i))}return Xr.from(o)}eq(e){if(!(e instanceof Xr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?ly(o?t:t.sort(hi)):es}static from(e){switch(e.length){case 0:return en;case 1:return e[0];default:return new Xr(e.every(t=>t instanceof ut)?e:e.reduce((t,o)=>t.concat(o instanceof ut?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Qq(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let k=l[b]+d-f;h>=k?l[b+1]=p<=k?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=en?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=Zq(l,n,e,t,r,i,s),d=Zu(u,o,0,s);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new ut(e.sort(hi),l)}function dT(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new Rn(r.from+e,r.to+e,r.type))}return t}function Zq(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function fT(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function pT(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Zu(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=fT(n,l,a+t);if(u){i=!0;let d=Zu(u,l,t+a+1,o);d!=en&&r.push(a,a+l.nodeSize,d)}});let s=dT(i?pT(n):n,-t).sort(hi);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ut(s,r):en}function hi(n,e){return n.from-e.from||n.to-e.to}function ly(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),nk(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),nk(e,r,o.copy(i.from,o.to)));break}}}return e}function nk(n,e,t){for(;e<n.length&&hi(t,n[e])>0;)e++;n.splice(e,0,t)}var Lr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ed={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},e6=typeof navigator<"u"&&/Mac/.test(navigator.platform),t6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Dt=0;Dt<10;Dt++)Lr[48+Dt]=Lr[96+Dt]=String(Dt);for(var Dt=1;Dt<=24;Dt++)Lr[Dt+111]="F"+Dt;for(var Dt=65;Dt<=90;Dt++)Lr[Dt]=String.fromCharCode(Dt+32),ed[Dt]=String.fromCharCode(Dt);for(var dp in Lr)ed.hasOwnProperty(dp)||(ed[dp]=Lr[dp]);function n6(n){var e=e6&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||t6&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ed:Lr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const o6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),r6=typeof navigator<"u"&&/Win/.test(navigator.platform);function i6(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))o6?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function s6(n){let e=Object.create(null);for(let t in n)e[i6(t)]=n[t];return e}function fp(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function l6(n){let e=s6(n);return function(t,o){let r=n6(o),i,s=e[fp(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[fp(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(r6&&o.ctrlKey&&o.altKey)&&(i=Lr[o.keyCode])&&i!=r){let l=e[fp(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}let qh,Kh;if(typeof WeakMap<"u"){let n=new WeakMap;qh=e=>n.get(e),Kh=(e,t)=>(n.set(e,t),t)}else{const n=[];let e=0;qh=t=>{for(let o=0;o<n.length;o+=2)if(n[o]==t)return n[o+1]},Kh=(t,o)=>(e==10&&(e=0),n[e++]=t,n[e++]=o)}var st=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return qh(n)||Kh(n,a6(n))}};function a6(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=c6(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:v}=g.attrs;for(let k=0;k<b;k++){if(k+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-k});break}const w=r+k*e;for(let x=0;x<y;x++){o[w+x]==0?o[w+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(w+x)%e*2,T=s[S];T==null||T!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):T==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new st(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&u6(l,s,n),l}function c6(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function u6(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=d6(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function d6(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Kt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const wr=new Zg("selectingCells");function Ai(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function f6(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function io(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function tf(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ai(e.$head)||p6(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function p6(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Jh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function h6(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ay(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function hT(n,e,t){const o=n.node(-1),r=st.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Oi(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function mT(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function m6(n,e,t){const o=Kt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var Xe=class jo extends Ie{constructor(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new VM(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(Jh(o)&&Jh(r)&&ay(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?jo.rowSelection(o,r):i&&this.isColSelection()?jo.colSelection(o,r):new jo(o,r)}return Le.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=st.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Oi(b,0,g)),y>0&&(b=Oi(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}s.push(e.child(a).copy(G.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new Z(G.from(l),1,1)}replace(e,t=Z.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?Z.empty:t)}const i=Ie.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Z(G.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=st.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new jo(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=st.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof jo&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new jo(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new jo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new jo(e.resolve(t),e.resolve(o))}getBookmark(){return new g6(this.$anchorCell.pos,this.$headCell.pos)}};Xe.prototype.visible=!1;Ie.jsonID("cell",Xe);var g6=class gT{constructor(e,t){this.anchor=e,this.head=t}map(e){return new gT(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&ay(t,o)?new Xe(t,o):Ie.near(o,1)}};function y6(n){if(!(n.selection instanceof Xe))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(Rn.node(o,o+t.nodeSize,{class:"selectedCell"}))}),ut.create(n.doc,e)}function b6({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function v6({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function w6(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof Re&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Xe.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Xe.rowSelection(l,l)}else if(!t){const l=st.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=Xe.create(r,a+1,u)}}else o instanceof Le&&b6(o)?i=Le.create(r,o.from):o instanceof Le&&v6(o)&&(i=Le.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const k6=new Zg("fix-tables");function yT(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?yT(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function bT(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=x6(n,r,i,t))};return e?e.doc!=n.doc&&yT(e.doc,n.doc,0,o):n.doc.descendants(o),t}function x6(n,e,t,o){const r=st.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,Oi(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Kt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(k6,{fixTables:!0})}function Ro(n){const e=n.selection,t=tf(n),o=t.node(-1),r=t.start(-1),i=st.get(o);return{...e instanceof Xe?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function vT(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;m6(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,mT(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?Kt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function C6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(vT(n.tr,t,t.left))}return!0}function S6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(vT(n.tr,t,t.right))}return!0}function E6(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],u=t.nodeAt(a),d=u.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Oi(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function M6(n,e){if(!io(n))return!1;if(e){const t=Ro(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;E6(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=st.get(i)}e(o)}return!0}function T6(n,e,t){var o;const r=Kt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function wT(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;T6(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?Kt(o.type.schema).cell:(a=o.nodeAt(e.map[d+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,Kt(o.type.schema).row.create(null,s)),n}function N6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(wT(n.tr,t,t.top))}return!0}function A6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(wT(n.tr,t,t.bottom))}return!0}function O6(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function $6(n,e){if(!io(n))return!1;if(e){const t=Ro(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;O6(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=st.get(t.table)}e(o)}return!0}function ok(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function R6({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function rk(n,e){const t=n.selection;if(!(t instanceof Xe)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=Ro(n),{map:r}=o;if(R6(r,o))return!1;if(e){const i=n.tr,s={};let l=G.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{ok(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...mT(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=ok(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new Xe(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function ik(n,e){const t=Kt(n.schema);return B6(({node:o})=>t[o.type.spec.tableRole])(n,e)}function B6(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof Xe){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=f6(o.$from),!r)return!1;i=(s=Ai(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=Ro(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),o instanceof Xe&&f.setSelection(new Xe(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function D6(n,e){return function(t,o){if(!io(t))return!1;const r=tf(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof Xe?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function _6(n){return function(e,t){if(!io(e))return!1;if(t){const o=Kt(e.schema),r=Ro(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function sk(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function da(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_6(n):function(t,o){if(!io(t))return!1;if(o){const r=Kt(t.schema),i=Ro(t),s=t.tr,l=sk("row",i,r),a=sk("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}da("row",{useDeprecatedLogic:!0});da("column",{useDeprecatedLogic:!0});const I6=da("cell",{useDeprecatedLogic:!0});function L6(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function lk(n){return function(e,t){if(!io(e))return!1;const o=L6(tf(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(Le.between(r,h6(r))).scrollIntoView())}return!0}}function P6(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function lc(n,e){const t=n.selection;if(!(t instanceof Xe))return!1;if(e){const o=n.tr,r=Kt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new Z(r,0,0))}),o.docChanged&&e(o)}return!0}function V6(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=Gh(Kt(s).row,new Z(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?Gh(Kt(s).row,new Z(e,t,o)).content:e);else return null;return z6(s,l)}function z6(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let u=r;u<r+l;u++)t[u]=(t[u]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(G.empty),t[r]<o){const i=Kt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(G.from(s))}return{height:e.length,width:o,rows:e}}function Gh(n,e){const t=n.createAndFill();return new dq(t).replace(0,t.content.size,e).doc}function H6({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Oi(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(G.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(G.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function F6(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Kt(l);let u,d;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,G.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(u||d)}function ak(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),u+=p.attrs.colspan-1}}return a}function ck(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,Oi(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Oi(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function uk(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=st.get(i);const{top:l,left:a}=o,u=a+r.width,d=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=st.get(i),p=f.mapping.maps.length}F6(f,s,i,t,u,d,p)&&h(),ak(f,s,i,t,a,u,l,p)&&h(),ak(f,s,i,t,a,u,d,p)&&h(),ck(f,s,i,t,l,d,a,p)&&h(),ck(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new Z(r.rows[m-l],0,0))}h(),f.setSelection(new Xe(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(d-1,u-1,i)))),e(f)}const j6=l6({ArrowLeft:ac("horiz",-1),ArrowRight:ac("horiz",1),ArrowUp:ac("vert",-1),ArrowDown:ac("vert",1),"Shift-ArrowLeft":cc("horiz",-1),"Shift-ArrowRight":cc("horiz",1),"Shift-ArrowUp":cc("vert",-1),"Shift-ArrowDown":cc("vert",1),Backspace:lc,"Mod-Backspace":lc,Delete:lc,"Mod-Delete":lc});function Rc(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function ac(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Xe)return Rc(t,o,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=kT(r,n,e);if(s==null)return!1;if(n=="horiz")return Rc(t,o,Ie.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=hT(l,n,e);let u;return a?u=Ie.near(a,1):e<0?u=Ie.near(t.doc.resolve(l.before(-1)),-1):u=Ie.near(t.doc.resolve(l.after(-1)),1),Rc(t,o,u)}}}function cc(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof Xe)s=i;else{const a=kT(r,n,e);if(a==null)return!1;s=new Xe(t.doc.resolve(a))}const l=hT(s.$headCell,n,e);return l?Rc(t,o,new Xe(s.$anchorCell,l)):!1}}function W6(n,e){const t=n.state.doc,o=Ai(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Xe(o))),!0):!1}function U6(n,e,t){if(!io(n.state))return!1;let o=V6(t);const r=n.state.selection;if(r instanceof Xe){o||(o={width:1,height:1,rows:[G.from(Gh(Kt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=st.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=H6(o,l.right-l.left,l.bottom-l.top),uk(n.state,n.dispatch,s,l,o),!0}else if(o){const i=tf(n.state),s=i.start(-1);return uk(n.state,n.dispatch,s,st.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function q6(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=dk(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof Xe)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Ai(n.state.selection.$anchor))!=null&&((t=pp(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=pp(n,u);const f=wr.getState(n.state)==null;if(!d||!ay(a,d))if(f)d=a;else return;const p=new Xe(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(wr,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),wr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(wr,-1))}function l(a){const u=a,d=wr.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(dk(n,u.target)!=o&&(f=pp(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function kT(n,e,t){if(!(n.state.selection instanceof Le))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function dk(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function pp(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&Ai(n.state.doc.resolve(o))||Ai(n.state.doc.resolve(r))}var K6=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Xh(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Xh(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Xh(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const kn=new Zg("tableColumnResizing");function J6({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=K6,lastColumnResizable:r=!0}={}){const i=new HM({key:kn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=Kt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new G6(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=kn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{X6(s,l,n,r)},mouseleave:s=>{Y6(s)},mousedown:(s,l)=>{Q6(s,l,e,t)}},decorations:s=>{const l=kn.getState(s);if(l&&l.activeHandle>-1)return oK(s,l.activeHandle)},nodeViews:{}}});return i}var G6=class Bc{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(kn);if(o&&o.setHandle!=null)return new Bc(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Bc(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return Jh(e.doc.resolve(r))||(r=-1),new Bc(r,t.dragging)}return t}};function X6(n,e,t,o){if(!n.editable)return;const r=kn.getState(n.state);if(r&&!r.dragging){const i=eK(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=fk(n,e,"left",t):a-e.clientX<=t&&(s=fk(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=st.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}xT(n,s)}}}function Y6(n){if(!n.editable)return;const e=kn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&xT(n,-1)}function Q6(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=kn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=Z6(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(kn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=kn.getState(n.state);p!=null&&p.dragging&&(tK(n,p.activeHandle,pk(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(kn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=kn.getState(n.state);if(p&&p.dragging){const h=pk(p.dragging,f,t);hk(n,p.activeHandle,h,o)}}return hk(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function Z6(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function eK(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function fk(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=Ai(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=st.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function pk(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function xT(n,e){n.dispatch(n.state.tr.setMeta(kn,{setHandle:e}))}function tK(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=st.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():nK(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function hk(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=st.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Xh(i,a.firstChild,a,o,l,t)}function nK(n){return Array(n).fill(0)}function oK(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return ut.empty;const i=st.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=kn.getState(n))===null||a===void 0)&&a.dragging&&t.push(Rn.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(Rn.widget(p,h))}}return ut.create(n.doc,t)}function rK({allowTableNodeSelection:n=!1}={}){return new HM({key:wr,state:{init(){return null},apply(e,t){const o=e.getMeta(wr);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:y6,handleDOMEvents:{mousedown:q6},createSelectionBetween(e){return wr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:W6,handleKeyDown:j6,handlePaste:U6},appendTransaction(e,t,o){return w6(o,bT(o,t),n)}})}var iK=Be.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",pe(this.options.HTMLAttributes,n),0]}}),sK=Be.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(t=>parseInt(t,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",pe(this.options.HTMLAttributes,n),0]}}),lK=Be.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",pe(this.options.HTMLAttributes,n),0]}});function Yh(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function mk(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[k,w]=Yh(o,b);u.style.setProperty(k,w)}u=u.nextSibling}else{const k=document.createElement("col"),[w,x]=Yh(o,b);k.style.setProperty(w,x),e.appendChild(k)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var aK=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),mk(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,mk(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function cK(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:p,colwidth:h}=l.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const g=t===f?o:h&&h[m];r+=g||e,g||(i=!1);const[y,b]=Yh(e,g);s.push(["col",{style:`${y}: ${b}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function gk(n,e){return n.createAndFill()}function uK(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function dK(n,e,t,o,r){const i=uK(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=gk(i.cell);if(d&&l.push(d),o){const f=gk(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function fK(n){return n instanceof Xe}var uc=({editor:n})=>{const{selection:e}=n.state;if(!fK(e))return!1;let t=0;const o=Cm(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},pK="";function hK(n){return(n||"").replace(/\s+/g," ").trim()}function CT(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:pK;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(h=>{const m=[];h.content&&h.content.forEach(g=>{let y="";g.content&&Array.isArray(g.content)&&g.content.length>1?y=g.content.map(k=>e.renderChildren(k)).join(r):y=g.content?e.renderChildren(g.content):"";const b=hK(y),v=g.type==="tableHeader";m.push({text:b,isHeader:v})}),i.push(m)});const s=i.reduce((h,m)=>Math.max(h,m.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(h=>{var m;for(let g=0;g<s;g+=1){const y=(((m=h[g])==null?void 0:m.text)||"").length;y>l[g]&&(l[g]=y),l[g]<3&&(l[g]=3)}});const a=(h,m)=>h+" ".repeat(Math.max(0,m-h.length)),u=i[0],d=u.some(h=>h.isHeader);let f=`
308
+ `;const p=new Array(s).fill(0).map((h,m)=>d&&u[m]&&u[m].text||"");return f+=`| ${p.map((h,m)=>a(h,l[m])).join(" | ")} |
309
+ `,f+=`| ${l.map(h=>"-".repeat(Math.max(3,h))).join(" | ")} |
310
+ `,(d?i.slice(1):i).forEach(h=>{f+=`| ${new Array(s).fill(0).map((m,g)=>a(h[g]&&h[g].text||"",l[g])).join(" | ")} |
311
+ `}),f}var mK=CT,gK=Be.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:aK,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=cK(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",pe(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>mK(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=dK(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(Le.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>C6(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>S6(n,e),deleteColumn:()=>({state:n,dispatch:e})=>M6(n,e),addRowBefore:()=>({state:n,dispatch:e})=>N6(n,e),addRowAfter:()=>({state:n,dispatch:e})=>A6(n,e),deleteRow:()=>({state:n,dispatch:e})=>$6(n,e),deleteTable:()=>({state:n,dispatch:e})=>P6(n,e),mergeCells:()=>({state:n,dispatch:e})=>rk(n,e),splitCell:()=>({state:n,dispatch:e})=>ik(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>da("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>da("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>I6(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>rk(n,e)?!0:ik(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>D6(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>lk(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>lk(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&bT(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=Xe.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:uc,"Mod-Backspace":uc,Delete:uc,"Mod-Delete":uc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[J6({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],rK({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:_e(oe(n,"tableRole",e))}}});be.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(gK.configure(this.options.table)),this.options.tableCell!==!1&&n.push(iK.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(sK.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(lK.configure(this.options.tableRow)),n}});const yK=Be.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:n}){return["table-wrapper",pe(n),0]},renderMarkdown:(n,e)=>n.content&&n.content.length?CT(n.content[0],e):""}),bK=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,t=c.ref(!1),o=c.computed(()=>{const{selection:i}=e.editor.view.state,s=i.from,l=e.getPos(),a=l+e.node.nodeSize;return s>=l&&s<=a});function r(i){t.value=i}return c.watch(o,i=>{console.log("isFocused",e.node.attrs),r(i)}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:"o-table-wrapper-view"}),{default:c.withCtx(()=>[c.createVNode(c.unref(tr),{as:"table"})]),_:1},16))}}),ST=yK.extend({addNodeView(){return En(bK,{stopEvent:()=>!1})}});/**
312
+ * Copyright 2026 Yiitap
313
+ * @license MIT
314
+ **/const vK=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,wK=Be.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:n=>{var e;return((e=n.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:n,HTMLAttributes:e}){return["video",{caption:n.attrs.caption},["source",pe(this.options.HTMLAttributes,e)]]},parseMarkdown:(n,e)=>{if(n.type==="html_block"||n.type==="html_inline"){const t=n.content,o=t.match(/<video\b([^>]*)>/i);if(!o)return{};const r=o[1],i=t.match(/<source\s+src="([^"]+)"/i),s=r.match(/caption="([^"]*)"/i);if(i)return e.createNode("video",{src:i[1],caption:s?s[1]:""})}return{}},renderMarkdown:n=>{var t,o;const e=((t=n.attrs)==null?void 0:t.src)??"";return`<video caption="${((o=n.attrs)==null?void 0:o.caption)??""}" controls>
315
+ <source src="${e}">
316
+ </video>`},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[bd({find:vK,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),kK={key:1,class:"video-container"},xK={key:1},CK=c.defineComponent({__name:"view",props:ht,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),u=c.computed({get(){return e.node.attrs.caption},set(v){e.updateAttributes({caption:v})}}),d=c.computed({get(){return e.node.attrs.src},set(v){e.updateAttributes({src:v})}});function f(v){switch(r.value=!1,v.value){case"replace":b(!0);break}}function p(){l.value=!0,setTimeout(()=>{var v;(v=s.value)==null||v.focus()},0)}function h(){l.value=!1}function m(){d.value==="init"&&b(!0)}function g(v){r.value=!0,i.value=v}function y(v){d.value=v,b(!1)}function b(v){a.value=v}return c.onMounted(()=>{b(d.value==="init")}),(v,k)=>{var w;return c.openBlock(),c.createBlock(c.unref(Hn),c.mergeProps(e,{class:["o-video-view",{readonly:!((w=v.editor)!=null&&w.isEditable),init:d.value==="init"}],as:"div",onContextmenu:c.withModifiers(g,["prevent"]),onClick:m}),{default:c.withCtx(()=>[c.createVNode(c.unref(Yn),{modelValue:a.value,"onUpdate:modelValue":k[1]||(k[1]=x=>a.value=x),placement:d.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Nd),{val:d.value==="init"?"":d.value,type:"video",onInput:y},null,8,["val"])]),default:c.withCtx(()=>{var x;return[d.value==="init"?(c.openBlock(),c.createBlock(c.unref(va),{key:0,icon:"videocam",placeholder:c.unref(t)("label.videoAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",kK,[k[3]||(k[3]=c.createElementVNode("div",{class:"video-cover"},null,-1)),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Md),c.mergeProps({key:0},e,{onAction:f}),{default:c.withCtx(()=>[c.createVNode(c.unref(Oe),{icon:"subtitles",tooltip:c.unref(t)("image.caption"),onClick:p},null,8,["tooltip"])]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("video",c.mergeProps(v.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(v.node.attrs)),null,16)],16),c.createElementVNode("div",{class:"caption",onClick:p},[(x=v.editor)!=null&&x.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(to),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":k[0]||(k[0]=C=>u.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:h},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",xK,c.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref($s),{modelValue:r.value,"onUpdate:modelValue":k[2]||(k[2]=x=>r.value=x),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:f}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),ET=wK.extend({addNodeView(){return En(CK)}}),MT=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHorizontalRule","OLink","OSelectionDecoration","OSlash","OSlashZh","OTable"],TT={BackgroundColor:n=>kg.configure({types:["textStyle"],...n}),BlockMath:n=>Nl.BlockMath.configure(n),Collaboration:n=>vS.configure(n),CollaborationCaret:n=>wS.configure(n),Color:n=>xg.configure(n),Focus:n=>a1.configure(n),FontFamily:n=>Cg.configure(n),Highlight:n=>kS.configure({multicolor:!0,...n}),Image:n=>xS.configure(n),InlineMath:n=>Nl.InlineMath.configure(n),Link:n=>Wm.configure(n),Markdown:n=>yk.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...n}),Subscript:n=>SS.configure(n),Superscript:n=>ES.configure(n),TaskItem:n=>oM.configure(n),TaskList:n=>qm.configure({itemTypeName:"taskItem",...n}),TextAlign:n=>MS.configure({types:["heading","paragraph"],...n}),TextStyle:n=>wg.configure(n),Typography:n=>TS.configure(n),Underline:n=>n1.configure(n),UniqueID:n=>AS.configure({attributeName:"id",types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"],...n}),OAiBlock:n=>aM.configure(n),OAudio:n=>cM.configure(n),OBlockMath:n=>uM.configure(n),OColon:n=>rM.configure({suggestion:lM,...n}),OSlash:n=>iM.configure({suggestion:Dh,...n}),OSlashZh:n=>sM.configure({suggestion:Dh,...n}),OBlockquote:n=>dM.configure({triggerCharacters:['"',"“","”"],...n}),OCallout:n=>fM.configure(n),OCodeBlock:n=>mM.configure(n),OColorHighlighter:n=>OS.configure(n),OHorizontalRule:n=>yM.configure(n),OImage:n=>bM.configure(n),OInlinePlaceholder:n=>$S.configure(n),OLink:n=>vM.configure({openOnClick:!1,...n}),OColumnDropCursor:n=>yh.configure(n),OSelectionDecoration:n=>IS.configure(n),OShortcut:n=>PS.configure({selectableNodes:["aiBlock","blockquote","callout","codeBlock","column","columns","heading","listItem","paragraph","tableCell","tableHeader","taskItem"],...n}),OVideo:n=>ET.configure(n),Table:n=>[Pd.configure({resizable:!0,...n}),Bu,Ld,Id],ODetails:n=>[gM.configure({persist:!0,HTMLAttributes:{class:"details"},...n}),LC,PC],OMultiColumn:n=>[BS,RS,_S.configure(n),yh],OTable:n=>[ST,VS.configure({resizable:!0,...n}),Bu,kM,wM]},NT=n=>typeof n=="object"&&n!==null&&(n.type==="extension"||n.type==="node"||n.type==="mark"),td=n=>{const{name:e,configure:t}=n,o=TT[e];return o?o(t):(console.warn(`[YiiEditor] Extension factory for "${String(e)}" not found.`),null)},cy=n=>n.flatMap(e=>Array.isArray(e)?cy(e):NT(e)?e:typeof e=="string"?td({name:e})??[]:typeof e=="object"&&e!==null&&"name"in e?td(e)??[]:[]),SK={configure(n={}){return MT.flatMap(e=>{const t=n[e];return t===!1?[]:td({name:e,configure:typeof t=="object"?t:void 0})??[]})}},EK=["data-theme"],AT=c.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:n=>["page","full"].includes(n)},aiOption:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1})}},emits:["create","transaction","update"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref(!1),l=c.ref(!0),a=c.ref("en"),u=c.ref(),d=c.ref(!1);c.provide("darkMode",s),c.provide("isEditable",l),c.provide("locale",a),c.provide("aiOption",u);const f=c.computed(()=>b()),p=QR({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:f.value,onCreate:()=>{d.value=!0,r("create",p.value)},onUpdate:({editor:v})=>{d.value&&r("update",{editor:v})},onTransaction:({editor:v,transaction:k})=>{r("transaction",{editor:v,transaction:k})}}),h=c.computed(()=>({editor:p.value,menu:o.mainMenu})),m=c.computed(()=>({editor:p.value,menu:o.bubbleMenu})),g=c.computed(()=>({editor:p.value,menu:o.floatingMenu})),y=c.computed(()=>({editor:p.value,add:o.sideMenu.add,title:o.title,menu:[]}));function b(){const v=[];o.title?v.push(Ip.extend({content:"heading block*"})):v.push(Ip),v.push(U1.configure({includeChildren:!0,placeholder:({editor:w,node:x,pos:C})=>{if(x.type.name==="heading"){const S=x.attrs.level;return C>0?`H${S}`:i("label.untitled")}else return x.type.name==="paragraph"?i("label.typeForCommands"):""}})),v.push(OD.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:!1,trailingNode:o.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:o.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const k=cy(o.extensions);return v.push(...k),v}return c.watch(()=>o.darkMode,v=>{s.value=v}),c.watch(()=>o.locale,v=>{a.value=v}),c.watch(()=>o.aiOption,v=>{u.value=v},{deep:!0}),c.watch(()=>o.editable,v=>{var k;(k=p.value)==null||k.setEditable(v),l.value=v}),c.onBeforeMount(()=>{l.value=o.editable,u.value=o.aiOption,s.value=o.darkMode,a.value=o.locale}),e({editor:p,darkMode:s,locale:a}),(v,k)=>{var w,x,C;return c.openBlock(),c.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[n.showMainMenu?(c.openBlock(),c.createBlock(EC,c.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:c.withCtx(()=>[c.renderSlot(v.$slots,"toolbar-left")]),right:c.withCtx(()=>[c.renderSlot(v.$slots,"toolbar-right")]),_:3},16)):c.createCommentVNode("",!0),(w=c.unref(p))!=null&&w.isEditable&&n.showBubbleMenu?(c.openBlock(),c.createBlock(w2,c.normalizeProps(c.mergeProps({key:1},m.value)),null,16)):c.createCommentVNode("",!0),(x=c.unref(p))!=null&&x.isEditable&&n.showFloatingMenu?(c.openBlock(),c.createBlock(x2,c.normalizeProps(c.mergeProps({key:2},g.value)),null,16)):c.createCommentVNode("",!0),(C=c.unref(p))!=null&&C.isEditable&&n.sideMenu.show?(c.openBlock(),c.createBlock(D2,c.normalizeProps(c.mergeProps({key:3},y.value)),null,16)):c.createCommentVNode("",!0),c.createVNode(c.unref(YR),{class:c.normalizeClass(["editor-content",`${n.pageView}-view`]),editor:c.unref(p)},null,8,["class","editor"])],8,EK)}}}),MK={installed:!1,spellcheck:!0,install(n){this.installed=!0,n.component("YiiEditor",AT)}};Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:()=>Nl.BlockMath});Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:()=>Nl.InlineMath});Object.defineProperty(exports,"Markdown",{enumerable:!0,get:()=>yk.Markdown});exports.AddNode=gC;exports.AdvancedBlocks=$1;exports.AiBlocks=B1;exports.AiProviders=O1;exports.AskAiBlocks=R1;exports.BackgroundColor=kg;exports.BasicBlocks=ba;exports.BlockMenus=yc;exports.Blocks=Eu;exports.BrandColor=he;exports.Collaboration=vS;exports.CollaborationCaret=wS;exports.ColonSuggestion=lM;exports.Color=xg;exports.Column=RS;exports.ColumnContainer=BS;exports.ColumnDropCursor=yh;exports.CommonBlocks=Su;exports.DefaultBubble=I1;exports.DefaultEmbedServices=fI;exports.DefaultExtensionNames=MT;exports.DefaultFloating=j1;exports.DefaultMenu=D1;exports.Details=IC;exports.DetailsContent=LC;exports.DetailsSummary=PC;exports.DragNode=yC;exports.EmojiSuggestion=y4;exports.Focus=a1;exports.FontFamily=Cg;exports.Highlight=kS;exports.Image=xS;exports.ImageBubble=V1;exports.ImageLinkBubble=z1;exports.InlineMathBubble=L1;exports.Link=Wm;exports.LinkBubble=P1;exports.Mention=Sj;exports.MoreBubble=H1;exports.MultiColumn=_S;exports.OAiBlock=aM;exports.OAiMenu=CC;exports.OAlignDropdown=ig;exports.OAudio=cM;exports.OBlockList=Ed;exports.OBlockListItem=Qp;exports.OBlockMath=uM;exports.OBlockMenu=Fr;exports.OBlockPlaceholder=va;exports.OBlockPopover=Yn;exports.OBlockToolbar=Md;exports.OBlockquote=dM;exports.OBtn=Ge;exports.OBtnGroup=bC;exports.OCallout=fM;exports.OCalloutColorBoard=lg;exports.OCalloutColorDropdown=KI;exports.OCharCommand=Y5;exports.OCheckbox=gg;exports.OCodeBlock=mM;exports.OCodeBlockDownloadDropdown=K1;exports.OCodeBlockViewDropdown=J1;exports.OColonCommand=rM;exports.OColorBoard=ki;exports.OColorHighlighter=OS;exports.OCommandBtn=Ze;exports.OCommonBtn=Gn;exports.OContextMenu=$s;exports.ODetails=gM;exports.ODialog=vC;exports.ODivider=It;exports.ODocToc=iL;exports.OEmojiSelect=Td;exports.OExtensionDropdown=G1;exports.OFloatingToast=_P;exports.OHorizontalRule=yM;exports.OIcon=X;exports.OImage=bM;exports.OImageViewer=wC;exports.OInlineMathMenu=SC;exports.OInlinePlaceholder=$S;exports.OInput=to;exports.OLanguageDropdown=X1;exports.OLink=vM;exports.OLinkBtn=sg;exports.OList=ln;exports.OListItem=Ut;exports.OMainMenu=EC;exports.OMediaInput=Nd;exports.OMenubarBtn=Oe;exports.OMetaInput=Ad;exports.ONodeView=Hn;exports.OPlaceholder=U1;exports.OPopover=$e;exports.OSelectionDecoration=IS;exports.OShortcut=PS;exports.OSlashCommand=iM;exports.OSlashZhCommand=sM;exports.OStarterKit=SK;exports.OTable=VS;exports.OTableCell=wM;exports.OTableCellBackground=Q1;exports.OTableGrid=Y1;exports.OTableHeader=kM;exports.OTableWrapper=ST;exports.OTaskItem=oM;exports.OTextColorBoard=ag;exports.OTextarea=kC;exports.OToast=mg;exports.OTooltip=Vn;exports.OVideo=ET;exports.Prompts=og;exports.SlashSuggestion=Dh;exports.StyleBlocks=Cu;exports.Subscript=SS;exports.Superscript=ES;exports.Table=Pd;exports.TableBubble=F1;exports.TableCell=Id;exports.TableFloating=dI;exports.TableHeader=Ld;exports.TableMenu=_1;exports.TableRow=Bu;exports.TableWrapperBubble=uI;exports.TaskItem=e1;exports.TaskList=qm;exports.TextAlign=MS;exports.TextStyle=wg;exports.Typography=TS;exports.Underline=n1;exports.UniqueID=AS;exports.YiiEditor=AT;exports.YiiEditorPlugin=MK;exports.createExtension=td;exports.createExtensionList=cy;exports.extensionRegistry=TT;exports.getProviderProp=ng;exports.isExtensionInstance=NT;exports.useAi=rg;exports.useCommon=Cd;exports.useI18n=de;exports.useNodeView=W1;exports.useTheme=Di;exports.useTiptap=xe;
69
317
  //# sourceMappingURL=index.cjs.map