showai-reader 0.9.0-reader.kusarg53 → 0.9.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.
- package/README.md +1 -1
- package/chunks/{ComparisonMatrix-Y23JEUWT.js → ComparisonMatrix-SYFIP5WP.js} +1 -1
- package/chunks/{ExperimentTracker-E75KXRF2.js → ExperimentTracker-HOUNXCEC.js} +1 -1
- package/chunks/{ExternalDiagram-JL7AG5GP.js → ExternalDiagram-3BONLRGZ.js} +1 -1
- package/chunks/{Flowchart-WNVHN5AC.js → Flowchart-72CIZ5IT.js} +2 -2
- package/chunks/{G2Chart-BA5IDTUV.js → G2Chart-GQH7Q6PL.js} +2 -2
- package/chunks/{Mindmap-UG3527BI.js → Mindmap-UMIFB7CR.js} +1 -1
- package/chunks/{RichTextEditor-PWYETK5J.js → RichTextEditor-YMFOBGOU.js} +1 -1
- package/chunks/{Scene3D-W7LZXKUP.js → Scene3D-J7TCRL6V.js} +2 -2
- package/chunks/{StatusTree-5UT6FPGY.js → StatusTree-MDKGDYK5.js} +1 -1
- package/chunks/chunk-4QSHXFHM.js +21 -0
- package/chunks/{chunk-CONQMWJD.js → chunk-6WHB3GS2.js} +1 -1
- package/chunks/{chunk-NU3EF6FT.js → chunk-CEJFAFXK.js} +1 -1
- package/chunks/{chunk-2HJ7X47C.js → chunk-LAAA5HWB.js} +1 -1
- package/chunks/{chunk-JQE3ZACJ.js → chunk-MPVTJQTD.js} +2 -2
- package/chunks/{chunk-YMX2EQEL.js → chunk-SWLYSV5D.js} +1 -1
- package/chunks/{chunk-WPCUZTWD.js → chunk-YSVZKKKM.js} +1 -1
- package/index.js +1 -1
- package/manifest.json +4 -5
- package/package.json +1 -1
- package/reader-N3YKYCK3.js +40 -0
- package/chunks/chunk-LU2JYOE4.js +0 -21
- package/reader-KUSARG53.js +0 -41
- /package/chunks/{Flowchart-WNVHN5AC.js.LEGAL.txt → Flowchart-72CIZ5IT.js.LEGAL.txt} +0 -0
- /package/chunks/{G2Chart-BA5IDTUV.js.LEGAL.txt → G2Chart-GQH7Q6PL.js.LEGAL.txt} +0 -0
- /package/chunks/{Scene3D-W7LZXKUP.js.LEGAL.txt → Scene3D-J7TCRL6V.js.LEGAL.txt} +0 -0
- /package/chunks/{chunk-LU2JYOE4.js.LEGAL.txt → chunk-4QSHXFHM.js.LEGAL.txt} +0 -0
- /package/chunks/{chunk-JQE3ZACJ.js.LEGAL.txt → chunk-MPVTJQTD.js.LEGAL.txt} +0 -0
- /package/{reader-KUSARG53.js.LEGAL.txt → reader-N3YKYCK3.js.LEGAL.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as S,b as X,c as O,d as he,e as fe,f as ge,g as ye,h as we}from"./chunk-DG67SWQA.js";import{a as ve}from"./chunk-
|
|
1
|
+
import{a as S,b as X,c as O,d as he,e as fe,f as ge,g as ye,h as we}from"./chunk-DG67SWQA.js";import{a as ve}from"./chunk-6WHB3GS2.js";import{d as Ne,e as Ce}from"./chunk-YSVZKKKM.js";import{Ma as ue,Na as pe,Pa as me,Ta as be,Wa as ke,_ as re,a as ae,c as Te,ca as se,ea as le,ia as de,oa as A,q as ie,sa as ce}from"./chunk-4QSHXFHM.js";import{c as W,d as xe}from"./chunk-DUIGVKKG.js";var r=W(Te(),1);var Le=xe("mindmap",{"zh-CN":{mindmap:"\u601D\u7EF4\u5BFC\u56FE",enterNodeName:"\u8BF7\u8F93\u5165\u8282\u70B9\u540D\u79F0\u3002",nodeLimit:"\u601D\u7EF4\u5BFC\u56FE\u6700\u591A\u652F\u6301 {count} \u4E2A\u8282\u70B9\u3002",radialLayout:"\u56DB\u5468\u5C55\u5F00",treeLayout:"\u5355\u5411\u5C55\u5F00","treeLayout.right":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3","treeLayout.left":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6","treeLayout.rightToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u53F3\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u5DE6","treeLayout.leftToggle":"\u5355\u5411\u5C55\u5F00\uFF0C\u5F53\u524D\u5411\u5DE6\uFF1B\u518D\u6B21\u70B9\u51FB\u5207\u6362\u5411\u53F3",nodes:"\u5BFC\u56FE\u8282\u70B9",nodeName:"\u8282\u70B9\u540D\u79F0",view:"\u601D\u7EF4\u5BFC\u56FE\u89C6\u56FE",zoomOut:"\u7F29\u5C0F\u601D\u7EF4\u5BFC\u56FE",fit:"\u663E\u793A\u5B8C\u6574\u601D\u7EF4\u5BFC\u56FE",zoomIn:"\u653E\u5927\u601D\u7EF4\u5BFC\u56FE",nodeActions:"\u601D\u7EF4\u5BFC\u56FE\u8282\u70B9\u64CD\u4F5C",editNode:"\u7F16\u8F91\u8282\u70B9",newChild:"\u65B0\u5EFA\u5B50\u8282\u70B9",child:"\u5B50\u8282\u70B9",newSibling:"\u65B0\u5EFA\u540C\u7EA7\u8282\u70B9",sibling:"\u540C\u7EA7",expandBranch:"\u5C55\u5F00\u5206\u652F",collapseBranch:"\u6298\u53E0\u5206\u652F",toggleBranch:"\u6298\u53E0 / \u5C55\u5F00",undoAction:"\u64A4\u9500\u5BFC\u56FE\u64CD\u4F5C",undo:"\u64A4\u9500",redoAction:"\u91CD\u505A\u5BFC\u56FE\u64CD\u4F5C",redo:"\u91CD\u505A",deleteNodeAndChildren:"\u5220\u9664\u8282\u70B9\u53CA\u5176\u5B50\u8282\u70B9",deleteBranch:"\u5220\u9664\u5206\u652F"},en:{mindmap:"Mind map",enterNodeName:"Enter a node name.",nodeLimit:"A mind map can have up to {count} nodes.",radialLayout:"Radial layout",treeLayout:"One-way layout","treeLayout.right":"One-way layout, currently to the right","treeLayout.left":"One-way layout, currently to the left","treeLayout.rightToggle":"One-way layout, currently to the right. Click again to switch to the left.","treeLayout.leftToggle":"One-way layout, currently to the left. Click again to switch to the right.",nodes:"Mind map nodes",nodeName:"Node name",view:"Mind map view",zoomOut:"Zoom out mind map",fit:"Show entire mind map",zoomIn:"Zoom in mind map",nodeActions:"Mind map node actions",editNode:"Edit node",newChild:"New child node",child:"Child",newSibling:"New sibling node",sibling:"Sibling",expandBranch:"Expand branch",collapseBranch:"Collapse branch",toggleBranch:"Collapse / expand",undoAction:"Undo mind map change",undo:"Undo",redoAction:"Redo mind map change",redo:"Redo",deleteNodeAndChildren:"Delete node and its children",deleteBranch:"Delete branch"}});ae(`.sm-block{position:relative}.sm-viewport{overflow:auto;overscroll-behavior-x:contain;border-radius:8px;background:radial-gradient(var(--sb-line) .6px,transparent .6px) 0 0 / 20px 20px}.sm-scroll-space{position:relative;display:flex;justify-content:center;align-items:center}.sm-map{position:absolute;flex:none;transform-origin:top left}.sm-connections{position:absolute;inset:0;width:100%!important;height:100%!important;overflow:visible;pointer-events:none}.sm-connections path{fill:none;stroke:var(--sm-branch);stroke-width:2;opacity:.7}.sm-branch-0{--sm-branch: #5f8b78}.sm-branch-1{--sm-branch: #6b89b7}.sm-branch-2{--sm-branch: #c38b55}.sm-branch-3{--sm-branch: #ab7890}.sm-branch-4{--sm-branch: #8580b5}.sm-branch-5{--sm-branch: #789c9f}.sm-node-wrap{position:absolute}.sm-block .sm-node,.sm-block .sm-node-input{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:var(--sm-node-height);padding:10px 16px;border:1.5px solid var(--sm-branch, var(--sb-accent));border-radius:9px;background:var(--sb-surface);color:var(--sb-text);font:inherit;font-size:14px;line-height:20px;text-align:center;box-shadow:0 2px 8px #00000005}.sm-node span:first-child{overflow-wrap:anywhere;white-space:pre-wrap}.sm-node:hover{background:color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 8%,var(--sb-surface))}.sm-node.is-selected,.sm-node:focus-visible,.sm-node-input:focus{outline:3px solid color-mix(in srgb,var(--sm-branch, var(--sb-accent)) 30%,transparent);outline-offset:3px}.sm-root .sm-node{background:var(--sb-accent);color:var(--sb-surface);border-color:var(--sb-accent);font-weight:600}.sm-count{flex:none;font-size:11px;border-radius:4px;padding:1px 4px;background:var(--sb-soft);color:var(--sb-muted)}.sm-footer{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:10px 2px 0;color:var(--sb-muted);font-size:11px}.sm-view-controls{display:flex;flex:none;gap:2px}.sm-view-controls button{display:flex;align-items:center;justify-content:center;gap:6px;min-width:28px;height:28px;border-radius:4px}.sm-view-controls button:hover{background:var(--sb-soft)}.sm-notice{color:var(--sb-accent);font-size:12px}@media print{.sm-footer,.sm-notice{display:none}.sm-viewport{overflow:visible;background:none}}.sm-block .sm-root .sm-node:hover{background:var(--sb-accent);color:var(--sb-surface)}.editor-bubble[data-editor-keyboard-scope=mindmap]{--editor-line: var(--line);--editor-soft: var(--accent-soft);font-family:var( --font-sans, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif );font-size:12px;font-weight:400;line-height:1;letter-spacing:0}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool{font:inherit}.editor-bubble[data-editor-keyboard-scope=mindmap] .sm-labeled-action{width:auto;padding:0 7px;gap:4px;color:var(--text);white-space:nowrap}.editor-bubble[data-editor-keyboard-scope=mindmap] .editor-tool svg{display:block;flex:none}.sm-block>.sb-header>.sb-actions{flex-wrap:nowrap;gap:2px;border:1px solid var(--sb-line);box-shadow:0 2px 8px #00000008;pointer-events:none}.sm-block:hover>.sb-header>.sb-actions,.sm-block>.sb-header>.sb-actions:focus-within{opacity:1;pointer-events:auto}.sm-block>.sb-header.has-caption>.sb-heading{padding-right:78px}.sm-block .sb-actions .sb-icon-button[aria-pressed=true]{color:var(--sb-accent);background:var(--sb-accent-soft)}body:has([role=menu]) .sm-block>.sb-header>.sb-actions{opacity:0;pointer-events:none}@media(hover:none){.sm-block>.sb-header>.sb-actions{opacity:1;pointer-events:auto}}@media print{.sm-block>.sb-header>.sb-actions{display:none}}
|
|
2
2
|
`);var t=W(be(),1);function Je({data:Z,onChange:R,readOnly:Me=!1}){let a=ke(Le),n=(0,r.useMemo)(()=>X(Z),[Z]),d=!Me&&!!R,L=n.nodes.find(e=>e.parentId===null),[i,M]=(0,r.useState)(L.id),[H,k]=(0,r.useState)(!1),[c,z]=(0,r.useState)(null),D=(0,r.useRef)(null),K=(0,r.useRef)(!0),[Ee,Se]=(0,r.useState)(null),[_,ze]=(0,r.useState)(null),f=!d&&_?.layout||n.layout||"radial",g=!d&&_?.direction||n.direction||"right",x=Ee??new Set(n.nodes.filter(e=>e.collapsed).map(e=>e.id)),u=(0,r.useMemo)(()=>ye({...n,layout:f,direction:g},x),[n,f,g,JSON.stringify([...x])]),[h,P]=(0,r.useState)(1),[q,$]=(0,r.useState)(null),G=(0,r.useRef)(null),E=(0,r.useRef)(null),v=(0,r.useRef)(null),N=(0,r.useRef)(new Map),U=(0,r.useId)(),p=(0,r.useRef)({past:[],future:[],expected:null}),[Q,F]=(0,r.useState)(""),y=n.nodes.find(e=>e.id===i)??L,Y=O(n,y.id).length>0,ee=()=>{let e=E.current;e&&P(Math.max(.15,Math.min(1,(e.clientWidth-20)/u.width,(e.clientHeight-20)/u.height)))};(0,r.useLayoutEffect)(ee,[f,g]),(0,r.useEffect)(()=>{let e=JSON.stringify(n);p.current.expected!==null&&p.current.expected!==e&&(p.current.past=[],p.current.future=[]),p.current.expected=e},[n]),(0,r.useEffect)(()=>{!u.nodes.some(e=>e.id===i)&&c?.id!==i&&M(L.id)},[u,i,L.id,c?.id]);let w=e=>{M(e),requestAnimationFrame(()=>{let o=N.current.get(e);o?.focus({preventScroll:!0}),o?.scrollIntoView({block:"nearest",inline:"nearest"})})};(0,r.useLayoutEffect)(()=>{c&&(v.current?.focus(),K.current?v.current?.select():v.current?.setSelectionRange(c.value.length,c.value.length),v.current?.scrollIntoView({block:"nearest",inline:"nearest"}))},[c?.id,n.nodes.length]),(0,r.useLayoutEffect)(()=>{if(!H||c||!d){$(null);return}let e=()=>{let s=N.current.get(i),l=E.current;if(!s||!l)return;let m=s.getBoundingClientRect(),b=l.getBoundingClientRect();$(m.bottom<b.top||m.top>b.bottom||m.right<b.left||m.left>b.right?null:{left:Math.max(b.left,Math.min(b.right,m.left+m.width/2)),top:Math.max(b.top,m.top)})};e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e);let o=new ResizeObserver(e);return E.current&&o.observe(E.current),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),o.disconnect()}},[H,c,d,i,u,h]);let C=e=>{!d||e===n||(X(e),p.current.past=[...p.current.past.slice(-99),n],p.current.future=[],p.current.expected=JSON.stringify(e),F(""),R?.(e))},te=e=>{let o=e==="tree"&&f==="tree"?g==="right"?"left":"right":g;e===f&&o===g||(d?C({...n,layout:e,direction:o}):ze({layout:e,direction:o}))},I=(e=!1)=>{let s=(e?p.current.future:p.current.past).pop();!s||!d||((e?p.current.past:p.current.future).push(n),p.current.expected=JSON.stringify(s),R?.(s),w(s.nodes.some(l=>l.id===i)?i:L.id))},T=(e=i,o)=>{if(!d)return;let s=n.nodes.find(l=>l.id===e);s&&(D.current=e,K.current=o===void 0,$(null),z({id:e,value:o??s.label}))},J=(e=!1)=>{if(!c||D.current!==c.id)return;let o=c.value.trim();if(!e&&!o){F(a("enterNodeName")),v.current?.focus();return}D.current=null,z(null),!e&&o!==n.nodes.find(s=>s.id===c.id)?.label&&C({...n,nodes:n.nodes.map(s=>s.id===c.id?{...s,label:o}:s)}),w(c.id)},B=(e,o=!1)=>{if(!d)return;if(n.nodes.length>=S){F(a("nodeLimit",{count:S}));return}let s=crypto.randomUUID(),l=he(n,i,s,e,o);C(l),M(s),D.current=s,K.current=!0,z({id:s,value:l.nodes.find(m=>m.id===s).label})},ne=()=>{!d||y.parentId===null||(C(fe(n,i)),w(y.parentId))},V=()=>{if(!Y)return;let e=new Set(x);e.has(i)?e.delete(i):e.add(i),d?C({...n,nodes:n.nodes.map(o=>o.id===i?{...o,collapsed:e.has(i)}:o)}):Se(e),w(i)},De=e=>{if(e.nativeEvent.isComposing||e.keyCode===229||e.target.closest("input, .sm-view-controls"))return;let o=e.metaKey||e.ctrlKey,s=e.target.closest(".editor-bubble")?.id===U,l=e.target.closest(".sb-header .sb-actions");if(s||l?!o:!e.target.closest(".sm-node"))return;let m=!0;if(o&&e.key.toLowerCase()==="z"&&d)I(e.shiftKey);else if(o&&e.key.toLowerCase()==="y"&&d)I(!0);else if(o||e.altKey)m=!1;else if(e.key==="Tab"&&d&&!e.shiftKey)B("child");else if(e.key==="Tab"&&d&&e.shiftKey)C(ge(n,i)),w(i);else if(e.key==="Enter"&&d)B("sibling",e.shiftKey);else if(e.key==="F2"&&d)T();else if((e.key==="Delete"||e.key==="Backspace")&&d)ne();else if(e.key===" ")V();else if(e.key==="ArrowLeft")y.parentId&&w(y.parentId);else if(e.key==="ArrowRight")if(x.has(i))V();else{let b=O(n,i)[0];b&&w(b.id)}else if(e.key==="ArrowUp"||e.key==="ArrowDown"){let b=n.nodes.filter(j=>j.parentId===y.parentId),Ie=b.findIndex(j=>j.id===i),oe=b[Ie+(e.key==="ArrowUp"?-1:1)];oe&&w(oe.id)}else e.key==="Escape"?(k(!1),e.target.blur()):e.key.length===1&&d?T(i,e.key):m=!1;m&&(e.preventDefault(),e.stopPropagation())};return(0,t.jsxs)("section",{ref:G,className:"sb-block sm-block","aria-label":Ne(n.title,a("mindmap")),contentEditable:!1,"data-editor-keyboard-scope":"mindmap","data-mindmap-layout":f,"data-mindmap-direction":g,onClick:e=>e.stopPropagation(),onKeyDown:De,onFocus:e=>{e.target.closest(".sm-node, .sm-node-input")&&k(!0)},onBlur:e=>{!G.current?.contains(e.relatedTarget)&&!e.relatedTarget?.closest?.(`[id="${U}"]`)&&k(!1)},onContextMenu:()=>k(!1),children:[(0,t.jsxs)(Ce,{title:n.title,defaultTitle:"\u601D\u7EF4\u5BFC\u56FE",description:n.description,children:[(0,t.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":a("radialLayout"),title:a("radialLayout"),"aria-pressed":f==="radial","data-surface-ui":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>te("radial"),children:(0,t.jsx)(de,{size:16})}),(0,t.jsx)("button",{type:"button",className:"sb-icon-button","aria-label":a("treeLayout"),title:a(g==="right"?f==="tree"?"treeLayout.rightToggle":"treeLayout.right":f==="tree"?"treeLayout.leftToggle":"treeLayout.left"),"aria-pressed":f==="tree","data-surface-ui":!0,onMouseDown:e=>e.preventDefault(),onClick:()=>te("tree"),children:(0,t.jsx)(re,{size:16,style:{transform:g==="left"?"scaleX(-1)":void 0}})})]}),(0,t.jsx)("div",{ref:E,className:"sm-viewport",style:{height:n.height??460},children:(0,t.jsx)("div",{className:"sm-scroll-space",style:{width:u.width*h,height:u.height*h,minWidth:"100%",minHeight:"100%"},children:(0,t.jsxs)("div",{className:"sm-map",role:"tree","aria-label":a("nodes"),style:{width:u.width,height:u.height,transform:`scale(${h})`,left:`max(0px, calc(50% - ${u.width*h/2}px))`,top:`max(0px, calc(50% - ${u.height*h/2}px))`},children:[(0,t.jsx)("svg",{className:"sm-connections",width:u.width,height:u.height,"aria-hidden":"true",children:u.nodes.filter(e=>e.parentId).map(e=>{let o=u.nodes.find(s=>s.id===e.parentId);return(0,t.jsx)("path",{className:`sm-branch-${e.color}`,d:we(o,e)},e.id)})}),u.nodes.map(e=>{let o=O(n,e.id).length,s=c?.id===e.id;return(0,t.jsx)("div",{className:`sm-node-wrap sm-branch-${e.color}${e.parentId===null?" sm-root":""}`,style:{left:e.x,top:e.y,width:e.width,minHeight:e.height,"--sm-node-height":`${e.height}px`},children:s?(0,t.jsx)("input",{ref:v,className:"sm-node-input","aria-label":a("nodeName"),maxLength:200,value:c.value,onChange:l=>z({id:e.id,value:l.target.value}),onBlur:()=>J(),onKeyDown:l=>{l.stopPropagation(),!(l.nativeEvent.isComposing||l.keyCode===229)&&((l.key==="Enter"||l.key==="Tab")&&(l.preventDefault(),J()),l.key==="Escape"&&(l.preventDefault(),J(!0)))}}):(0,t.jsxs)("button",{type:"button",ref:l=>{l?N.current.set(e.id,l):N.current.delete(e.id)},className:`sm-node${H&&i===e.id?" is-selected":""}`,role:"treeitem","aria-level":e.depth+1,"aria-selected":i===e.id,"aria-expanded":o?!x.has(e.id):void 0,tabIndex:i===e.id?0:-1,onFocus:()=>M(e.id),onClick:l=>{l.currentTarget.focus({preventScroll:!0}),M(e.id),k(!0)},onDoubleClick:()=>T(e.id),children:[(0,t.jsx)("span",{children:e.label}),o>0&&x.has(e.id)&&(0,t.jsxs)("span",{className:"sm-count",children:["+",o]})]})},e.id)})]})})}),(0,t.jsx)("div",{className:"sm-footer",children:(0,t.jsxs)("div",{className:"sm-view-controls",role:"group","aria-label":a("view"),children:[(0,t.jsx)("button",{type:"button","aria-label":a("zoomOut"),disabled:h<=.15,onClick:()=>P(Math.max(.15,h/1.2)),children:(0,t.jsx)(le,{size:15})}),(0,t.jsxs)("button",{type:"button","aria-label":a("fit"),onClick:ee,children:[(0,t.jsx)(se,{size:15}),(0,t.jsxs)("span",{children:[Math.round(h*100),"%"]})]}),(0,t.jsx)("button",{type:"button","aria-label":a("zoomIn"),disabled:h>=2,onClick:()=>P(Math.min(2,h*1.2)),children:(0,t.jsx)(A,{size:15})})]})}),Q&&(0,t.jsx)("p",{role:"status",className:"sm-notice",children:Q}),q&&d&&!c&&(0,t.jsxs)(ve,{id:U,anchor:q,anchorElement:N.current.get(i),label:a("nodeActions"),keyboardScope:"mindmap",onEscape:()=>{k(!1),N.current.get(i)?.blur()},children:[(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("editNode"),title:a("editNode"),onClick:()=>T(),children:(0,t.jsx)(pe,{size:16})}),(0,t.jsx)("span",{className:"toolbar-divider"}),(0,t.jsxs)("button",{className:"editor-tool sm-labeled-action",type:"button","aria-label":a("newChild"),title:a("newChild"),disabled:n.nodes.length>=S,onClick:()=>B("child"),children:[(0,t.jsx)(A,{size:16}),(0,t.jsx)("span",{children:a("child")})]}),(0,t.jsxs)("button",{className:"editor-tool sm-labeled-action",type:"button","aria-label":a("newSibling"),title:a("newSibling"),disabled:n.nodes.length>=S||y.parentId===null,onClick:()=>B("sibling"),children:[(0,t.jsx)(A,{size:16}),(0,t.jsx)("span",{children:a("sibling")})]}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":x.has(i)?a("expandBranch"):a("collapseBranch"),title:a("toggleBranch"),disabled:!Y,onClick:V,children:(0,t.jsx)(ie,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("undoAction"),title:a("undo"),disabled:!p.current.past.length,onClick:()=>I(),children:(0,t.jsx)(me,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("redoAction"),title:a("redo"),disabled:!p.current.future.length,onClick:()=>I(!0),children:(0,t.jsx)(ce,{size:16})}),(0,t.jsx)("button",{className:"editor-tool",type:"button","aria-label":a("deleteNodeAndChildren"),title:a("deleteBranch"),disabled:y.parentId===null,onClick:ne,children:(0,t.jsx)(ue,{size:16})})]})]})}export{Je as MindmapBlock};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as zs,c as $s,i as du,j as fu,n as hu,o as pu,p as $e,q as Mo,r as mu,s as gu,t as Bs}from"./chunk-NU3EF6FT.js";import{a as Gg,b as Xg}from"./chunk-JQE3ZACJ.js";import"./chunk-WDYURK6F.js";import{a as yu}from"./chunk-CONQMWJD.js";import{$ as Es,B as jc,Ba as ru,C as Kc,Da as Ns,Ea as ou,Fa as Os,Ga as iu,Ha as su,Ia as Rs,Ja as Ds,Ka as Is,La as Ps,M as Uc,Ma as Co,Na as lu,O as qc,Oa as au,P as Jc,Pa as cu,Q as Gc,Qa as uu,R as Xc,S as xo,Sa as xr,Ta as yt,U as Yc,Ua as Ls,Wa as at,Y as Cs,Z as Ms,c as vr,da as Qc,e as Lc,ea as Zc,h as zc,i as $c,ja as eu,o as Bc,oa as Ft,p as Hc,q as vo,ra as Ts,sa as tu,t as Fc,u as Vc,w as Wc,xa as As,ya as nu,z as _c}from"./chunk-LU2JYOE4.js";import{c as pe,i as Hn}from"./chunk-DUIGVKKG.js";function bu(t,e){let n=t.cut(0,e).toJSON().content??[],r=t.cut(e).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var L=pe(vr(),1),Mc=pe(Ls(),1);var K=pe(vr(),1);function Re(t){this.content=t}Re.prototype={constructor:Re,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Re(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Re(n)},addToStart:function(t,e){return new Re([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Re(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Re(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Re.from(t),t.size?new Re(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Re.from(t),t.size?new Re(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Re.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Re.from=function(t){if(t instanceof Re)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Re(e)};var Hs=Re;function Nu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&Du(s.charCodeAt(a-1))&&Ru(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=Nu(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Ou(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&Du(c.charCodeAt(d-1))&&Ru(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=Ou(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function Ru(t){return t>=56320&&t<57344}function Du(t){return t>=55296&&t<56320}var v=class t{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Nu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ou(this,e,n,r)}findIndex(e){if(e==0)return Eo(0,e);if(e==this.size)return Eo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Eo(n+1,i):Eo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};v.empty=new v([],0);var Fs={index:0,offset:0};function Eo(t,e){return Fs.index=t,Fs.offset=e,Fs}function No(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!No(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!No(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var Q=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&No(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Q.none=[];var Vt=class extends Error{},A=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Pu(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Iu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(v.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};A.empty=new A(v.empty,0,0);function Iu(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Iu(i.content,e-o-1,n-o-1)))}function Pu(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Pu(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function Yg(t,e,n){if(n.openStart>t.depth)throw new Vt("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Vt("Inconsistent open depths");return Lu(t,e,n,0)}function Lu(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Lu(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return un(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Qg(n,t);return un(i,$u(t,s,l,e,r))}else return un(i,Oo(t,e,r))}function zu(t,e){if(!e.type.compatibleContent(t.type))throw new Vt("Cannot join "+e.type.name+" onto "+t.type.name)}function Vs(t,e,n){let r=t.node(n);return zu(r,e.node(n)),r}function cn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Cr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(cn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)cn(o.child(l),r);e&&e.depth==n&&e.textOffset&&cn(e.nodeBefore,r)}function un(t,e){if(!t.type.validContent(e))throw new Vt("Invalid content for node "+t.type.name);return t.copy(e)}function $u(t,e,n,r,o){let i=t.depth>o&&Vs(t,e,o+1),s=r.depth>o&&Vs(n,r,o+1),l=[];return Cr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(zu(i,s),cn(un(i,$u(t,e,n,r,o+1)),l)):(i&&cn(un(i,Oo(t,e,o+1)),l),Cr(e,n,o,l),s&&cn(un(s,Oo(n,r,o+1)),l)),Cr(r,null,o,l),new v(l)}function Oo(t,e,n){let r=[];if(Cr(null,t,n,r),t.depth>n){let o=Vs(t,e,n+1);cn(un(o,Oo(t,e,n+1)),r)}return Cr(e,null,n,r),new v(r)}function Qg(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(v.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var Ro=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Q.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new dn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=ku.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else ku.set(e,r=new Ws);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%Zg,o}},Ws=class{constructor(){this.elts=[],this.i=0}},Zg=12,ku=new WeakMap,dn=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ey=Object.create(null),nt=class t{constructor(e,n,r,o=Q.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||v.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&No(this.attrs,n||e.defaultAttrs||ey)&&Q.sameSet(this.marks,r||Q.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return A.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new A(c,o.depth-s,i.depth-s)}replace(e,n,r){return Yg(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ro.resolveCached(this,e)}resolveNoCache(e){return Ro.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Bu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=v.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);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),wu(this.type.attrs,this.attrs,"node",this.type.name);let e=Q.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];wu(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Q.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=v.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};nt.prototype.text=void 0;var _s=class t extends nt{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Bu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function wu(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var fn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new js(e,n);if(r.next==null)return t.empty;let o=Hu(r);r.next&&r.err("Unexpected trailing text");let i=ly(sy(o));return ay(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return v.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;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 n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
1
|
+
import{a as zs,c as $s,i as du,j as fu,n as hu,o as pu,p as $e,q as Mo,r as mu,s as gu,t as Bs}from"./chunk-CEJFAFXK.js";import{a as Gg,b as Xg}from"./chunk-MPVTJQTD.js";import"./chunk-WDYURK6F.js";import{a as yu}from"./chunk-6WHB3GS2.js";import{$ as Es,B as jc,Ba as ru,C as Kc,Da as Ns,Ea as ou,Fa as Os,Ga as iu,Ha as su,Ia as Rs,Ja as Ds,Ka as Is,La as Ps,M as Uc,Ma as Co,Na as lu,O as qc,Oa as au,P as Jc,Pa as cu,Q as Gc,Qa as uu,R as Xc,S as xo,Sa as xr,Ta as yt,U as Yc,Ua as Ls,Wa as at,Y as Cs,Z as Ms,c as vr,da as Qc,e as Lc,ea as Zc,h as zc,i as $c,ja as eu,o as Bc,oa as Ft,p as Hc,q as vo,ra as Ts,sa as tu,t as Fc,u as Vc,w as Wc,xa as As,ya as nu,z as _c}from"./chunk-4QSHXFHM.js";import{c as pe,i as Hn}from"./chunk-DUIGVKKG.js";function bu(t,e){let n=t.cut(0,e).toJSON().content??[],r=t.cut(e).toJSON().content??[],o=l=>l?.type==="paragraph"&&!l.content?.length||l?.type==="richText"&&!Object.keys(l.attrs?.data??{}).length&&(l.content??[]).every(o);o(n.at(-1))&&n.pop(),o(r[0])&&r.shift();let i=new Set,s=l=>{let a=l.attrs?.id;a&&(i.has(a)&&(l.attrs={...l.attrs,id:crypto.randomUUID()}),i.add(l.attrs.id)),l.content?.forEach(s)};return n.forEach(s),r.forEach(s),{before:n,after:r}}var L=pe(vr(),1),Mc=pe(Ls(),1);var K=pe(vr(),1);function Re(t){this.content=t}Re.prototype={constructor:Re,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new Re(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Re(n)},addToStart:function(t,e){return new Re([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Re(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new Re(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Re.from(t),t.size?new Re(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Re.from(t),t.size?new Re(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Re.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Re.from=function(t){if(t instanceof Re)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Re(e)};var Hs=Re;function Nu(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&Du(s.charCodeAt(a-1))&&Ru(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=Nu(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function Ou(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&Du(c.charCodeAt(d-1))&&Ru(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=Ou(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function Ru(t){return t>=56320&&t<57344}function Du(t){return t>=55296&&t<56320}var v=class t{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return Nu(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Ou(this,e,n,r)}findIndex(e){if(e==0)return Eo(0,e);if(e==this.size)return Eo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Eo(n+1,i):Eo(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};v.empty=new v([],0);var Fs={index:0,offset:0};function Eo(t,e){return Fs.index=t,Fs.offset=e,Fs}function No(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!No(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!No(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var Q=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&No(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};Q.none=[];var Vt=class extends Error{},A=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Pu(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(Iu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(v.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};A.empty=new A(v.empty,0,0);function Iu(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(Iu(i.content,e-o-1,n-o-1)))}function Pu(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=Pu(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function Yg(t,e,n){if(n.openStart>t.depth)throw new Vt("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Vt("Inconsistent open depths");return Lu(t,e,n,0)}function Lu(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=Lu(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return un(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=Qg(n,t);return un(i,$u(t,s,l,e,r))}else return un(i,Oo(t,e,r))}function zu(t,e){if(!e.type.compatibleContent(t.type))throw new Vt("Cannot join "+e.type.name+" onto "+t.type.name)}function Vs(t,e,n){let r=t.node(n);return zu(r,e.node(n)),r}function cn(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Cr(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(cn(t.nodeAfter,r),i++));for(let l=i;l<s;l++)cn(o.child(l),r);e&&e.depth==n&&e.textOffset&&cn(e.nodeBefore,r)}function un(t,e){if(!t.type.validContent(e))throw new Vt("Invalid content for node "+t.type.name);return t.copy(e)}function $u(t,e,n,r,o){let i=t.depth>o&&Vs(t,e,o+1),s=r.depth>o&&Vs(n,r,o+1),l=[];return Cr(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(zu(i,s),cn(un(i,$u(t,e,n,r,o+1)),l)):(i&&cn(un(i,Oo(t,e,o+1)),l),Cr(e,n,o,l),s&&cn(un(s,Oo(n,r,o+1)),l)),Cr(r,null,o,l),new v(l)}function Oo(t,e,n){let r=[];if(Cr(null,t,n,r),t.depth>n){let o=Vs(t,e,n+1);cn(un(o,Oo(t,e,n+1)),r)}return Cr(e,null,n,r),new v(r)}function Qg(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(v.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var Ro=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Q.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new dn(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=ku.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else ku.set(e,r=new Ws);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%Zg,o}},Ws=class{constructor(){this.elts=[],this.i=0}},Zg=12,ku=new WeakMap,dn=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ey=Object.create(null),nt=class t{constructor(e,n,r,o=Q.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||v.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,o=0){this.content.nodesBetween(e,n,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,o){return this.content.textBetween(e,n,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&No(this.attrs,n||e.defaultAttrs||ey)&&Q.sameSet(this.marks,r||Q.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return A.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new A(c,o.depth-s,i.depth-s)}replace(e,n,r){return Yg(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return Ro.resolveCached(this,e)}resolveNoCache(e){return Ro.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Bu(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=v.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);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),wu(this.type.attrs,this.attrs,"node",this.type.name);let e=Q.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];wu(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Q.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=v.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};nt.prototype.text=void 0;var _s=class t extends nt{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Bu(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function wu(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var fn=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new js(e,n);if(r.next==null)return t.empty;let o=Hu(r);r.next&&r.err("Unexpected trailing text");let i=ly(sy(o));return ay(i,r),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return v.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;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 n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[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 n(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
2
2
|
`)}};fn.empty=new fn(!0);var js=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function Hu(t){let e=[];do e.push(ty(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function ty(t){let e=[];do e.push(ny(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ny(t){let e=iy(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=ry(t,e);else break;return e}function Su(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ry(t,e){let n=Su(t),r=n;return t.eat(",")&&(t.next!="}"?r=Su(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function oy(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function iy(t){if(t.eat("(")){let e=Hu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=oy(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function sy(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Fu(t,e){return e-t}function vu(t,e){let n=[];return r(e),n.sort(Fu);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function ly(t){let e=Object.create(null);return n(vu(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);vu(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new fn(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Fu);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function ay(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vu(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Wu(t,e){let n=Object.create(null);for(let r in t){let o=t[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function _u(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Ks(t,r,e[r]);return n}var Do=class t{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_u(e,r.attrs),this.defaultAttrs=Vu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==fn.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:Wu(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new nt(this,this.computeAttrs(e),v.from(n),Q.setFrom(r))}createChecked(e=null,n,r){return n=v.from(n),this.checkContent(n),new nt(this,this.computeAttrs(e),n,Q.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=v.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(v.empty,!0);return i?new nt(this,e,n.append(i),Q.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Q.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function cy(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}var Ks=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?cy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Er=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=_u(e,o.attrs),this.excluded=null;let i=Vu(this.attrs);this.instance=i?new Q(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Q(this,Wu(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}excludes(e){return this.excluded.indexOf(e)>-1}},Tr=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Hs.from(e.nodes),n.marks=Hs.from(e.marks||{}),this.nodes=Do.compile(this.spec.nodes,this),this.marks=Er.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=fn.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?xu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:xu(this,s.split(" "))}this.nodeFromJSON=o=>nt.fromJSON(this,o),this.markFromJSON=o=>Q.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Do){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new _s(r,r.defaultAttrs,e,Q.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function xu(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function uy(t){return t.tag!=null}function dy(t){return t.style!=null}var bt=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(uy(o))this.tags.push(o);else if(dy(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Io(this,n,!1);return r.addAll(e,Q.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Io(this,n,!0);return r.addAll(e,Q.none,n.from,n.to),A.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(py(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Mu(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Mu(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},ju={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},fy={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ku={ol:!0,ul:!0},Ar=1,Us=2,Mr=4;function Cu(t,e,n){return e!=null?(e?Ar:0)|(e==="full"?Us:0):t&&t.whitespace=="pre"?Ar|Us:n&~Mr}var Fn=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Q.none,this.match=i||(s&Mr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(v.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ar)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=v.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(v.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ju.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Io=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=Cu(null,n.preserveWhitespace,0)|(r?Mr:0);o?i=new Fn(o.type,o.attrs,Q.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Fn(null,null,Q.none,!0,null,s):i=new Fn(e.schema.topNodeType,null,Q.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&Us?"full":this.localPreserveWS||(o.options&Ar)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Ku.hasOwnProperty(s)&&this.parser.normalizeLists&&hy(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:fy.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);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 c,u=this.needsBlock;if(ju.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.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?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Q.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Eu(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Cu(e,i,s.options);s.options&Mr&&s.content.length==0&&(l|=Mr);let a=Q.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Eu(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Fn(e,n,a,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ar)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function hy(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ku.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function py(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Mu(t){let e={};for(let n in t)e[n]=t[n];return e}function Eu(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}var kt=class t{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=To(n).createDocumentFragment());let o=r,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 c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return To(n).createTextNode(e.text);let{dom:r,contentDOM:o}=Ao(To(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Ao(To(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return typeof n=="string"?{dom:e.createTextNode(n)}:Ao(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Tu(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Tu(e.marks)}};function Tu(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function To(t){return t.document||window.document}var Au=new WeakMap;function my(t){let e=Au.get(t);return e===void 0&&Au.set(t,e=gy(t)),e}function gy(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Ao(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=my(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=Ao(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Xu=65535,Yu=Math.pow(2,16);function yy(t,e){return t+e*Yu}function Uu(t){return t&Xu}function by(t){return(t-(t&Xu))/Yu}var Qu=1,Zu=2,Po=4,ed=8,Rr=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&ed)>0}get deletedBefore(){return(this.delInfo&(Qu|Po))>0}get deletedAfter(){return(this.delInfo&(Zu|Po))>0}get deletedAcross(){return(this.delInfo&Po)>0}},wt=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=Uu(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+by(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,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 c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:yy(l/3,e-a),g=0;return c&&(g|=e==a?Zu:e==d?Qu:Po,(n<0?e!=a:e!=d)&&(g|=ed)),new Rr(h,g,p)}o+=u-c}return r?e+o:new Rr(e+o,0,null)}touches(e,n){let r=0,o=Uu(n),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 c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};wt.empty=new wt([]);var hn=class t{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new t(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);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}}o|=l.delInfo,e=l.pos}return r?e:new Rr(e,o,null)}},qs=Object.create(null),we=class{getMap(){return wt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=qs[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in qs)throw new RangeError("Duplicate use of step JSON ID "+e);return qs[e]=n,n.prototype.jsonID=e,n}},ve=class t{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,o){try{return t.ok(e.replace(n,r,o))}catch(i){if(i instanceof Vt)return t.fail(i.message);throw i}}};function Ys(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Ys(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return v.fromArray(r)}var Dr=class t extends we{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new A(Ys(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return ve.fromReplace(e,this.from,this.to,i)}invert(){return new St(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};we.jsonID("addMark",Dr);var St=class t extends we{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new A(Ys(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return ve.fromReplace(e,this.from,this.to,r)}invert(){return new Dr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};we.jsonID("removeMark",St);var Ir=class t extends we{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ve.fromReplace(e,this.pos,this.pos+1,new A(v.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new t(this.pos,n.marks[o]);return new t(this.pos,this.mark)}}return new Vn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};we.jsonID("addNodeMark",Ir);var Vn=class t extends we{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ve.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return ve.fromReplace(e,this.pos,this.pos+1,new A(v.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ir(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};we.jsonID("removeNodeMark",Vn);var ue=class t extends we{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Gs(e,this.from,this.to)?ve.fail("Structure replace would overwrite content"):ve.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wt([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?A.empty:new A(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?A.empty:new A(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,A.fromJSON(e,n.slice),!!n.structure)}};ue.MAP_BIAS=1;we.jsonID("replace",ue);var de=class t extends we{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Gs(e,this.from,this.gapFrom)||Gs(e,this.gapTo,this.to)))return ve.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return ve.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?ve.fromReplace(e,this.from,this.to,r):ve.fail("Content does not fit in gap")}getMap(){return new wt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,A.fromJSON(e,n.slice),n.insert,!!n.structure)}};we.jsonID("replaceAround",de);function Gs(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function ky(t,e,n,r){let o=[],i=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(s&&s.to==f&&s.mark.eq(d[g])?s.to=h:o.push(s=new St(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new Dr(f,h,r))}}),o.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function wy(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(r instanceof Er){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new St(s.from,s.to,s.style)))}function Qs(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new ue(l,u,A.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new St(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new A(v.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new ue(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(v.empty,!0);t.replace(l,l,new A(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function Sy(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function vt(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+o,a=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!Sy(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function vy(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=v.empty,d=0;for(let p=i,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,u=v.from(r.node(p).copy(u)),d++):a--;let f=v.empty,h=0;for(let p=i,g=!1;p>n;p--)g||o.after(p+1)<o.end(p)?(g=!0,f=v.from(o.node(p).copy(f)),h++):c++;t.step(new de(a,c,s,l,new A(u.append(f),d,h),u.size-d,!0))}function _n(t,e,n=null,r=t){let o=xy(t,e),i=o&&Cy(r,e);return i?o.map(qu).concat({type:e,attrs:n}).concat(i.map(qu)):null}function qu(t){return{type:t,attrs:null}}function xy(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function Cy(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function My(t,e,n){let r=v.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=v.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new de(o,i,o,i,new A(r,0,0),n.length,!0))}function Ey(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&Ty(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&nd(t,s,l,i),Qs(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new de(d,f,d+1,f-1,new A(v.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&td(t,s,l,i),!1}})}function td(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function nd(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|