@avocadostudio-ai/cli 0.1.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.
@@ -0,0 +1,93 @@
1
+ import{ai as ge,aj as gt,a9 as nt,ak as _t,al as ve,am as be,an as ye,a8 as z,a7 as P,a5 as $,a6 as B,ao as ke,a4 as we,ap as Me,aq as D,a3 as xe,a2 as dt,ar as Se,as as Ee,at as Te,au as Ae,av as Ce,aw as Pe,ax as $e,ay as Ne,az as zt,aA as Ie,aB as Re,aC as Oe,aD as De,aE as Be,aF as je,aG as _e,aH as ze,aI as Le,aJ as Fe,aK as Ve,aL as He,aM as At,aN as We,aO as G,aP as qe,aQ as Ue,aR as Ke,aS as Je,aT as Qe}from"./index-BVru-J_w.js";var Ze=Object.defineProperty,vt=(e,t)=>{for(var n in t)Ze(e,n,{get:t[n],enumerable:!0})};function rt(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,o=n.storedMarks,n}}}var st=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([i,c])=>[i,(...l)=>{const f=c(...l)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:o}=r,i=[],c=!!e,a=e||s.tr,l=()=>(!c&&t&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(a),i.every(u=>u===!0)),f={...Object.fromEntries(Object.entries(n).map(([u,p])=>[u,(...m)=>{const h=this.buildProps(a,t),g=p(...m)(h);return i.push(g),f}])),run:l};return f}createCan(e){const{rawCommands:t,state:n}=this,r=!1,s=e||n.tr,o=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(t).map(([c,a])=>[c,(...l)=>a(...l)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:o}=r,i={tr:e,editor:r,view:o,state:rt({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([c,a])=>[c,(...l)=>a(...l)(i)]))}};return i}},Lt={};vt(Lt,{blur:()=>Ge,clearContent:()=>Ye,clearNodes:()=>Xe,command:()=>tn,createParagraphNear:()=>en,cut:()=>nn,deleteCurrentNode:()=>rn,deleteNode:()=>sn,deleteRange:()=>on,deleteSelection:()=>an,enter:()=>cn,exitCode:()=>ln,extendMarkRange:()=>un,first:()=>dn,focus:()=>pn,forEach:()=>mn,insertContent:()=>hn,insertContentAt:()=>bn,joinBackward:()=>wn,joinDown:()=>kn,joinForward:()=>Mn,joinItemBackward:()=>xn,joinItemForward:()=>Sn,joinTextblockBackward:()=>En,joinTextblockForward:()=>Tn,joinUp:()=>yn,keyboardShortcut:()=>Cn,lift:()=>Pn,liftEmptyBlock:()=>$n,liftListItem:()=>Nn,newlineInCode:()=>In,resetAttributes:()=>Rn,scrollIntoView:()=>On,selectAll:()=>Dn,selectNodeBackward:()=>Bn,selectNodeForward:()=>jn,selectParentNode:()=>_n,selectTextblockEnd:()=>zn,selectTextblockStart:()=>Ln,setContent:()=>Fn,setMark:()=>ar,setMeta:()=>cr,setNode:()=>lr,setNodeSelection:()=>ur,setTextDirection:()=>dr,setTextSelection:()=>fr,sinkListItem:()=>pr,splitBlock:()=>mr,splitListItem:()=>hr,toggleList:()=>gr,toggleMark:()=>vr,toggleNode:()=>br,toggleWrap:()=>yr,undoInputRule:()=>kr,unsetAllMarks:()=>wr,unsetMark:()=>Mr,unsetTextDirection:()=>xr,updateAttributes:()=>Sr,wrapIn:()=>Er,wrapInList:()=>Tr});var Ge=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),Ye=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),Xe=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:o,$to:i})=>{e.doc.nodesBetween(o.pos,i.pos,(c,a)=>{if(c.type.isText)return;const{doc:l,mapping:f}=t,u=l.resolve(f.map(a)),p=l.resolve(f.map(a+c.nodeSize)),d=u.blockRange(p);if(!d)return;const m=Se(d);if(c.type.isTextblock){const{defaultType:h}=u.parent.contentMatchAt(u.index());t.setNodeMarkup(d.start,h)}(m||m===0)&&t.lift(d,m)})}),!0},tn=e=>t=>e(t),en=()=>({state:e,dispatch:t})=>Ee(e,t),nn=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,o=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const i=r.mapping.map(t);return r.insert(i,o.content),r.setSelection(new P(r.doc.resolve(Math.max(i-1,0)))),!0},rn=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===r.type){if(t){const c=s.before(o),a=s.after(o);e.delete(c,a).scrollIntoView()}return!0}return!1};function T(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var sn=e=>({tr:t,state:n,dispatch:r})=>{const s=T(e,n.schema),o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(r){const a=o.before(i),l=o.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1},on=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},an=()=>({state:e,dispatch:t})=>Te(e,t),cn=()=>({commands:e})=>e.keyboardShortcut("Enter"),ln=()=>({state:e,dispatch:t})=>Ae(e,t);function bt(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function X(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:bt(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function Ft(e,t,n={}){return e.find(r=>r.type===t&&X(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Ct(e,t,n={}){return!!Ft(e,t,n)}function yt(e,t,n){var r;if(!e||!t)return;let s=e.parent.childAfter(e.parentOffset);if((!s.node||!s.node.marks.some(f=>f.type===t))&&(s=e.parent.childBefore(e.parentOffset)),!s.node||!s.node.marks.some(f=>f.type===t)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!Ft([...s.node.marks],t,n)))return;let i=s.index,c=e.start()+s.offset,a=i+1,l=c+s.node.nodeSize;for(;i>0&&Ct([...e.parent.child(i-1).marks],t,n);)i-=1,c-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&Ct([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:c,to:l}}function R(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var un=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const o=R(e,r.schema),{doc:i,selection:c}=n,{$from:a,from:l,to:f}=c;if(s){const u=yt(a,o,t);if(u&&u.from<=l&&u.to>=f){const p=P.create(i,u.from,u.to);n.setSelection(p)}}return!0},dn=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function Vt(e){return e instanceof P}function _(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Ht(e,t=null){if(!t)return null;const n=z.atStart(e),r=z.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,o=r.to;return t==="all"?P.create(e,_(0,s,o),_(e.content.size,s,o)):P.create(e,_(t,s,o),_(t,s,o))}function Pt(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function tt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function fn(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var pn=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:o})=>{t={scrollIntoView:!0,...t};const i=()=>{(tt()||Pt())&&r.dom.focus(),fn()&&!tt()&&!Pt()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(o&&e===null&&!Vt(n.state.selection))return i(),!0;const c=Ht(s.doc,e)||n.state.selection,a=n.state.selection.eq(c);return o&&(a||s.setSelection(c),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},mn=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),hn=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Wt=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Wt(r)}return e};function K(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Wt(n)}function W(e,t,n){if(e instanceof xe||e instanceof D)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return D.fromArray(e.map(c=>t.nodeFromJSON(c)));const i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),W("",t,n)}if(s){if(n.errorOnInvalidContent){let i=!1,c="";const a=new _t({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(i=!0,c=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?dt.fromSchema(a).parseSlice(K(e),n.parseOptions):dt.fromSchema(a).parse(K(e),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=dt.fromSchema(t);return n.slice?o.parseSlice(K(e),n.parseOptions).content:o.parse(K(e),n.parseOptions)}return W("",t,n)}function gn(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof Je||s instanceof Qe))return;const o=e.mapping.maps[r];let i=0;o.forEach((c,a,l,f)=>{i===0&&(i=f)}),e.setSelection(z.near(e.doc.resolve(i),n))}var vn=e=>!("type"in e),bn=(e,t,n)=>({tr:r,dispatch:s,editor:o})=>{var i;if(s){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const a=g=>{o.emit("contentError",{editor:o,error:g,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{W(t,o.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(g){a(g)}try{c=W(t,o.schema,{parseOptions:l,errorOnInvalidContent:(i=n.errorOnInvalidContent)!=null?i:o.options.enableContentCheck})}catch(g){return a(g),!1}let{from:f,to:u}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},p=!0,d=!0;if((vn(c)?c:[c]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,d=d?g.isBlock:!1}),f===u&&d){const{parent:g}=r.doc.resolve(f);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(f-=1,u+=1)}let h;if(p){if(Array.isArray(t))h=t.map(g=>g.text||"").join("");else if(t instanceof D){let g="";t.forEach(v=>{v.text&&(g+=v.text)}),h=g}else typeof t=="object"&&t&&t.text?h=t.text:h=t;r.insertText(h,f,u)}else{h=c;const g=r.doc.resolve(f),v=g.node(),y=g.parentOffset===0,w=v.isText||v.isTextblock,M=v.content.size>0;y&&w&&M&&(f=Math.max(0,f-1)),r.replaceWith(f,u,h)}n.updateSelection&&gn(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:h})}return!0},yn=()=>({state:e,dispatch:t})=>Ce(e,t),kn=()=>({state:e,dispatch:t})=>Pe(e,t),wn=()=>({state:e,dispatch:t})=>$e(e,t),Mn=()=>({state:e,dispatch:t})=>Ne(e,t),xn=()=>({state:e,dispatch:t,tr:n})=>{try{const r=zt(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Sn=()=>({state:e,dispatch:t,tr:n})=>{try{const r=zt(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},En=()=>({state:e,dispatch:t})=>Ie(e,t),Tn=()=>({state:e,dispatch:t})=>Re(e,t);function qt(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function An(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,o,i;for(let c=0;c<t.length-1;c+=1){const a=t[c];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))tt()||qt()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var Cn=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const o=An(e).split(/-(?!$)/),i=o.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),c=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,c))});return a==null||a.steps.forEach(l=>{const f=l.map(r.mapping);f&&s&&r.maybeStep(f)}),!0};function q(e,t,n={}){const{from:r,to:s,empty:o}=e.selection,i=t?T(t,e.schema):null,c=[];e.doc.nodesBetween(r,s,(u,p)=>{if(u.isText)return;const d=Math.max(r,p),m=Math.min(s,p+u.nodeSize);c.push({node:u,from:d,to:m})});const a=s-r,l=c.filter(u=>i?i.name===u.node.type.name:!0).filter(u=>X(u.node.attrs,n,{strict:!1}));return o?!!l.length:l.reduce((u,p)=>u+p.to-p.from,0)>=a}var Pn=(e,t={})=>({state:n,dispatch:r})=>{const s=T(e,n.schema);return q(n,s,t)?Oe(n,r):!1},$n=()=>({state:e,dispatch:t})=>De(e,t),Nn=e=>({state:t,dispatch:n})=>{const r=T(e,t.schema);return Be(r)(t,n)},In=()=>({state:e,dispatch:t})=>je(e,t);function ot(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function $t(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}var Rn=(e,t)=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const c=ot(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(o=T(e,r.schema)),c==="mark"&&(i=R(e,r.schema));let a=!1;return n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(f,u)=>{o&&o===f.type&&(a=!0,s&&n.setNodeMarkup(u,void 0,$t(f.attrs,t))),i&&f.marks.length&&f.marks.forEach(p=>{i===p.type&&(a=!0,s&&n.addMark(u,u+f.nodeSize,i.create($t(p.attrs,t))))})})}),a},On=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Dn=()=>({tr:e,dispatch:t})=>{if(t){const n=new _e(e.doc);e.setSelection(n)}return!0},Bn=()=>({state:e,dispatch:t})=>ze(e,t),jn=()=>({state:e,dispatch:t})=>Le(e,t),_n=()=>({state:e,dispatch:t})=>Fe(e,t),zn=()=>({state:e,dispatch:t})=>Ve(e,t),Ln=()=>({state:e,dispatch:t})=>He(e,t);function mt(e,t,n={},r={}){return W(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Fn=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:o,dispatch:i,commands:c})=>{const{doc:a}=o;if(r.preserveWhitespace!=="full"){const l=mt(e,s.schema,r,{errorOnInvalidContent:t??s.options.enableContentCheck});return i&&o.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!n),!0}return i&&o.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:t??s.options.enableContentCheck})};function Ut(e,t){const n=R(t,e.schema),{from:r,to:s,empty:o}=e.selection,i=[];o?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,a=>{i.push(...a.marks)});const c=i.find(a=>a.type.name===n.name);return c?{...c.attrs}:{}}function Vn(e,t){const n=new ve(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function Hn(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Yr(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,o)=>{n(s)&&r.push({node:s,pos:o})}),r}function Wn(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function it(e){return t=>Wn(t.$from,e)}function b(e,t,n){return e.config[t]===void 0&&e.parent?b(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?b(e.parent,t,n):null}):e.config[t]}function kt(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=b(t,"addExtensions",n);return r?[t,...kt(r())]:t}).flat(10)}function wt(e,t){const n=we.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function Kt(e){return typeof e=="function"}function x(e,t=void 0,...n){return Kt(e)?t?e.bind(t)(...n):e(...n):e}function qn(e={}){return Object.keys(e).length===0&&e.constructor===Object}function L(e){const t=e.filter(s=>s.type==="extension"),n=e.filter(s=>s.type==="node"),r=e.filter(s=>s.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function Jt(e){const t=[],{nodeExtensions:n,markExtensions:r}=L(e),s=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},i=n.filter(l=>l.name!=="text").map(l=>l.name),c=r.map(l=>l.name),a=[...i,...c];return e.forEach(l=>{const f={name:l.name,options:l.options,storage:l.storage,extensions:s},u=b(l,"addGlobalAttributes",f);if(!u)return;u().forEach(d=>{let m;Array.isArray(d.types)?m=d.types:d.types==="*"?m=a:d.types==="nodes"?m=i:d.types==="marks"?m=c:m=[],m.forEach(h=>{Object.entries(d.attributes).forEach(([g,v])=>{t.push({type:h,name:g,attribute:{...o,...v}})})})})}),s.forEach(l=>{const f={name:l.name,options:l.options,storage:l.storage},u=b(l,"addAttributes",f);if(!u)return;const p=u();Object.entries(p).forEach(([d,m])=>{const h={...o,...m};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,t.push({type:l.name,name:d,attribute:h})})}),t}function Un(e){const t=[];let n="",r=!1,s=!1,o=0;const i=e.length;for(let c=0;c<i;c+=1){const a=e[c];if(a==="'"&&!s){r=!r,n+=a;continue}if(a==='"'&&!r){s=!s,n+=a;continue}if(!r&&!s){if(a==="("){o+=1,n+=a;continue}if(a===")"&&o>0){o-=1,n+=a;continue}if(a===";"&&o===0){t.push(n),n="";continue}}n+=a}return n&&t.push(n),t}function Nt(e){const t=[],n=Un(e||""),r=n.length;for(let s=0;s<r;s+=1){const o=n[s],i=o.indexOf(":");if(i===-1)continue;const c=o.slice(0,i).trim(),a=o.slice(i+1).trim();c&&a&&t.push([c,a])}return t}function Kn(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,o])=>{if(!r[s]){r[s]=o;return}if(s==="class"){const c=o?String(o).split(" "):[],a=r[s]?r[s].split(" "):[],l=c.filter(f=>!a.includes(f));r[s]=[...a,...l].join(" ")}else if(s==="style"){const c=new Map([...Nt(r[s]),...Nt(o)]);r[s]=Array.from(c.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}else r[s]=o}),r},{})}function et(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Kn(n,r),{})}function Jn(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function It(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((o,i)=>{const c=i.attribute.parseHTML?i.attribute.parseHTML(n):Jn(n.getAttribute(i.name));return c==null?o:{...o,[i.name]:c}},{});return{...r,...s}}}}function Rt(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&qn(n)?!1:n!=null))}function Ot(e){var t,n;const r={};return!((t=e==null?void 0:e.attribute)!=null&&t.isRequired)&&"default"in((e==null?void 0:e.attribute)||{})&&(r.default=e.attribute.default),((n=e==null?void 0:e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function Qt(e,t){var n;const r=Jt(e),{nodeExtensions:s,markExtensions:o}=L(e),i=(n=s.find(l=>b(l,"topNode")))==null?void 0:n.name,c=Object.fromEntries(s.map(l=>{const f=r.filter(v=>v.type===l.name),u={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((v,y)=>{const w=b(y,"extendNodeSchema",u);return{...v,...w?w(l):{}}},{}),d=Rt({...p,content:x(b(l,"content",u)),marks:x(b(l,"marks",u)),group:x(b(l,"group",u)),inline:x(b(l,"inline",u)),atom:x(b(l,"atom",u)),selectable:x(b(l,"selectable",u)),draggable:x(b(l,"draggable",u)),code:x(b(l,"code",u)),whitespace:x(b(l,"whitespace",u)),linebreakReplacement:x(b(l,"linebreakReplacement",u)),defining:x(b(l,"defining",u)),isolating:x(b(l,"isolating",u)),attrs:Object.fromEntries(f.map(Ot))}),m=x(b(l,"parseHTML",u));m&&(d.parseDOM=m.map(v=>It(v,f)));const h=b(l,"renderHTML",u);h&&(d.toDOM=v=>h({node:v,HTMLAttributes:et(v,f)}));const g=b(l,"renderText",u);return g&&(d.toText=g),[l.name,d]})),a=Object.fromEntries(o.map(l=>{const f=r.filter(g=>g.type===l.name),u={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((g,v)=>{const y=b(v,"extendMarkSchema",u);return{...g,...y?y(l):{}}},{}),d=Rt({...p,inclusive:x(b(l,"inclusive",u)),excludes:x(b(l,"excludes",u)),group:x(b(l,"group",u)),spanning:x(b(l,"spanning",u)),code:x(b(l,"code",u)),attrs:Object.fromEntries(f.map(Ot))}),m=x(b(l,"parseHTML",u));m&&(d.parseDOM=m.map(g=>It(g,f)));const h=b(l,"renderHTML",u);return h&&(d.toDOM=g=>h({mark:g,HTMLAttributes:et(g,f)})),[l.name,d]}));return new _t({topNode:i,nodes:c,marks:a})}function Qn(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function H(e){return e.sort((n,r)=>{const s=b(n,"priority")||100,o=b(r,"priority")||100;return s>o?-1:s<o?1:0})}function Mt(e){const t=H(kt(e)),n=Qn(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function Xr(e,t){const n=Mt(e);return Qt(n,t)}function Zt(e,t,n){const{from:r,to:s}=t,{blockSeparator:o=`
2
+
3
+ `,textSerializers:i={}}=n||{};let c="";return e.nodesBetween(r,s,(a,l,f,u)=>{var p;a.isBlock&&l>r&&(c+=o);const d=i==null?void 0:i[a.type.name];if(d)return f&&(c+=d({node:a,pos:l,parent:f,index:u,range:t})),!1;a.isText&&(c+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(r,l)-l,s-l))}),c}function Zn(e,t){const n={from:0,to:e.content.size};return Zt(e,n,t)}function Gt(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function Gn(e,t){const n=T(t,e.schema),{from:r,to:s}=e.selection,o=[];e.doc.nodesBetween(r,s,c=>{o.push(c)});const i=o.reverse().find(c=>c.type.name===n.name);return i?{...i.attrs}:{}}function Yn(e,t){const n=ot(typeof t=="string"?t:t.name,e.schema);return n==="node"?Gn(e,t):n==="mark"?Ut(e,t):{}}function Xn(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function tr(e){const t=Xn(e);return t.length===1?t:t.filter((n,r)=>!t.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function er(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((c,a)=>{i.push({from:c,to:a})});else{const{from:c,to:a}=n[o];if(c===void 0||a===void 0)return;i.push({from:c,to:a})}i.forEach(({from:c,to:a})=>{const l=t.slice(o).map(c,-1),f=t.slice(o).map(a),u=t.invert().map(l,-1),p=t.invert().map(f);r.push({oldRange:{from:u,to:p},newRange:{from:l,to:f}})})}),tr(r)}function Yt(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const o=n.resolve(e),i=yt(o,s.type);i&&r.push({mark:s,...i})}):n.nodesBetween(e,t,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),r}var ts=(e,t,n,r=20)=>{const s=e.doc.resolve(n);let o=r,i=null;for(;o>0&&i===null;){const c=s.node(o);(c==null?void 0:c.type.name)===t?i=c:o-=1}return[i,o]};function F(e,t){return t.nodes[e]||t.marks[e]||null}function Y(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(o=>o.type===t&&o.name===r);return s?s.attribute.keepOnSplit:!1}))}var nr=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,o,i,c)=>{var a,l;const f=((l=(a=s.type.spec).toText)==null?void 0:l.call(a,{node:s,pos:o,parent:i,index:c}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?f:f.slice(0,Math.max(0,r-o))}),n};function ht(e,t,n={}){const{empty:r,ranges:s}=e.selection,o=t?R(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>X(u.attrs,n,{strict:!1}));let i=0;const c=[];if(s.forEach(({$from:u,$to:p})=>{const d=u.pos,m=p.pos;e.doc.nodesBetween(d,m,(h,g)=>{if(o&&h.inlineContent&&!h.type.allowsMarkType(o))return!1;if(!h.isText&&!h.marks.length)return;const v=Math.max(d,g),y=Math.min(m,g+h.nodeSize),w=y-v;i+=w,c.push(...h.marks.map(M=>({mark:M,from:v,to:y})))})}),i===0)return!1;const a=c.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>X(u.mark.attrs,n,{strict:!1})).reduce((u,p)=>u+p.to-p.from,0),l=c.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,p)=>u+p.to-p.from,0);return(a>0?a+l:a)>=i}function rr(e,t,n={}){if(!t)return q(e,null,n)||ht(e,null,n);const r=ot(t,e.schema);return r==="node"?q(e,t,n):r==="mark"?ht(e,t,n):!1}var es=(e,t)=>{const{$from:n,$to:r,$anchor:s}=e.selection;if(t){const o=it(c=>c.type.name===t)(e.selection);if(!o)return!1;const i=e.doc.resolve(o.pos+1);return s.pos+1===i.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},ns=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Dt(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function Bt(e,t){const{nodeExtensions:n}=L(t),r=n.find(i=>i.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=x(b(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function xt(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return!/\S/.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(o=>{s!==!1&&(xt(o,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function rs(e){return e instanceof nt}var Xt=class te{constructor(t){this.position=t}static fromJSON(t){return new te(t.position)}toJSON(){return{position:this.position}}};function sr(e,t){const n=t.mapping.mapResult(e.position);return{position:new Xt(n.pos),mapResult:n}}function or(e){return new Xt(e)}function ir(e,t,n){var r;const{selection:s}=t;let o=null;if(Vt(s)&&(o=s.$cursor),o){const c=(r=e.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(l=>l.type.excludes(n)))}const{ranges:i}=s;return i.some(({$from:c,$to:a})=>{let l=c.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(c.pos,a.pos,(f,u,p)=>{if(l)return!1;if(f.isInline){const d=!p||p.type.allowsMarkType(n),m=!!n.isInSet(f.marks)||!f.marks.some(h=>h.type.excludes(n));l=d&&m}return!l}),l})}var ar=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=n,{empty:i,ranges:c}=o,a=R(e,r.schema);if(s)if(i){const l=Ut(r,a);n.addStoredMark(a.create({...l,...t}))}else c.forEach(l=>{const f=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(f,u,(p,d)=>{const m=Math.max(d,f),h=Math.min(d+p.nodeSize,u);p.marks.find(v=>v.type===a)?p.marks.forEach(v=>{a===v.type&&n.addMark(m,h,a.create({...v.attrs,...t}))}):n.addMark(m,h,a.create(t))})});return ir(r,n,a)},cr=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),lr=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const o=T(e,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:c})=>At(o,{...i,...t})(n)?!0:c.clearNodes()).command(({state:c})=>At(o,{...i,...t})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ur=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=_(e,0,r.content.size),o=nt.create(r,s);t.setSelection(o)}return!0},dr=(e,t)=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=r;let i,c;return typeof t=="number"?(i=t,c=t):t&&"from"in t&&"to"in t?(i=t.from,c=t.to):(i=o.from,c=o.to),s&&n.doc.nodesBetween(i,c,(a,l)=>{a.isText||n.setNodeMarkup(l,void 0,{...a.attrs,dir:e})}),!0},fr=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:o}=typeof e=="number"?{from:e,to:e}:e,i=P.atStart(r).from,c=P.atEnd(r).to,a=_(s,i,c),l=_(o,i,c),f=P.create(r,a,l);t.setSelection(f)}return!0},pr=e=>({state:t,dispatch:n})=>{const r=T(e,t.schema);return We(r)(t,n)};function jt(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t==null?void 0:t.includes(s.type.name));e.tr.ensureMarks(r)}}var mr=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:o,doc:i}=t,{$from:c,$to:a}=o,l=s.extensionManager.attributes,f=Y(l,c.node().type.name,c.node().attrs);if(o instanceof nt&&o.node.isBlock)return!c.parentOffset||!G(i,c.pos)?!1:(r&&(e&&jt(n,s.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,p=c.depth===0?void 0:Hn(c.node(-1).contentMatchAt(c.indexAfter(-1)));let d=u&&p?[{type:p,attrs:f}]:void 0,m=G(t.doc,t.mapping.map(c.pos),1,d);if(!d&&!m&&G(t.doc,t.mapping.map(c.pos),1,p?[{type:p}]:void 0)&&(m=!0,d=p?[{type:p,attrs:f}]:void 0),r){if(m&&(o instanceof P&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,d),p&&!u&&!c.parentOffset&&c.parent.type!==p)){const h=t.mapping.map(c.before()),g=t.doc.resolve(h);c.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&t.setNodeMarkup(t.mapping.map(c.before()),p)}e&&jt(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return m},hr=(e,t={})=>({tr:n,state:r,dispatch:s,editor:o})=>{var i;const c=T(e,r.schema),{$from:a,$to:l}=r.selection,f=r.selection.node;if(f&&f.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==c)return!1;const p=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==c||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let v=D.empty;const y=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-y;A>=a.depth-3;A-=1)v=D.from(a.node(A).copy(v));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...Y(p,a.node().type.name,a.node().attrs),...t},k=((i=c.contentMatch.defaultType)==null?void 0:i.createAndFill(M))||void 0;v=v.append(D.from(c.createAndFill(null,k)||void 0));const S=a.before(a.depth-(y-1));n.replace(S,a.after(-w),new qe(v,4-y,0));let E=-1;n.doc.nodesBetween(S,n.doc.content.size,(A,C)=>{if(E>-1)return!1;A.isTextblock&&A.content.size===0&&(E=C+1)}),E>-1&&n.setSelection(P.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const d=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,m={...Y(p,u.type.name,u.attrs),...t},h={...Y(p,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,l.pos);const g=d?[{type:c,attrs:m},{type:d,attrs:h}]:[{type:c,attrs:m}];if(!G(n.doc,a.pos,2))return!1;if(s){const{selection:v,storedMarks:y}=r,{splittableMarks:w}=o.extensionManager,M=y||v.$to.parentOffset&&v.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!M||!s)return!0;const k=M.filter(S=>w.includes(S.type.name));n.ensureMarks(k)}return!0},ft=(e,t)=>{const n=it(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&gt(e.doc,n.pos)&&e.join(n.pos),!0},pt=(e,t)=>{const n=it(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&gt(e.doc,r)&&e.join(r),!0},gr=(e,t,n,r={})=>({editor:s,tr:o,state:i,dispatch:c,chain:a,commands:l,can:f})=>{const{extensions:u,splittableMarks:p}=s.extensionManager,d=T(e,i.schema),m=T(t,i.schema),{selection:h,storedMarks:g}=i,{$from:v,$to:y}=h,w=v.blockRange(y),M=g||h.$to.parentOffset&&h.$from.marks();if(!w)return!1;const k=it(S=>Bt(S.type.name,u))(h);if(w.depth>=1&&k&&w.depth-k.depth<=1){if(k.node.type===d)return l.liftListItem(m);if(Bt(k.node.type.name,u)&&d.validContent(k.node.content)&&c)return a().command(()=>(o.setNodeMarkup(k.pos,d),!0)).command(()=>ft(o,d)).command(()=>pt(o,d)).run()}return!n||!M||!c?a().command(()=>f().wrapInList(d,r)?!0:l.clearNodes()).wrapInList(d,r).command(()=>ft(o,d)).command(()=>pt(o,d)).run():a().command(()=>{const S=f().wrapInList(d,r),E=M.filter(A=>p.includes(A.type.name));return o.ensureMarks(E),S?!0:l.clearNodes()}).wrapInList(d,r).command(()=>ft(o,d)).command(()=>pt(o,d)).run()},vr=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=n,i=R(e,r.schema);return ht(r,i,t)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,t)},br=(e,t,n={})=>({state:r,commands:s})=>{const o=T(e,r.schema),i=T(t,r.schema),c=q(r,o,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),c?s.setNode(i,a):s.setNode(o,{...a,...n})},yr=(e,t={})=>({state:n,commands:r})=>{const s=T(e,n.schema);return q(n,s,t)?r.lift(s):r.wrapIn(s,t)},kr=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let o;if(s.spec.isInputRules&&(o=s.getState(e))){if(t){const i=e.tr,c=o.transform;for(let a=c.steps.length-1;a>=0;a-=1)i.step(c.steps[a].invert(c.docs[a]));if(o.text){const a=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,e.schema.text(o.text,a))}else i.delete(o.from,o.to)}return!0}}return!1},wr=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:s}=n;return r||t&&s.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},Mr=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=t,{selection:c}=n,a=R(e,r.schema),{$from:l,empty:f,ranges:u}=c;if(!s)return!0;if(f&&i){let{from:p,to:d}=c;const m=(o=l.marks().find(g=>g.type===a))==null?void 0:o.attrs,h=yt(l,a,m);h&&(p=h.from,d=h.to),n.removeMark(p,d,a)}else u.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,a)});return n.removeStoredMark(a),!0},xr=e=>({tr:t,state:n,dispatch:r})=>{const{selection:s}=n;let o,i;return typeof e=="number"?(o=e,i=e):e&&"from"in e&&"to"in e?(o=e.from,i=e.to):(o=s.from,i=s.to),r&&t.doc.nodesBetween(o,i,(c,a)=>{if(c.isText)return;const l={...c.attrs};delete l.dir,t.setNodeMarkup(a,void 0,l)}),!0},Sr=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const c=ot(typeof e=="string"?e:e.name,r.schema);if(!c)return!1;c==="node"&&(o=T(e,r.schema)),c==="mark"&&(i=R(e,r.schema));let a=!1;return n.selection.ranges.forEach(l=>{const f=l.$from.pos,u=l.$to.pos;let p,d,m,h;n.selection.empty?r.doc.nodesBetween(f,u,(g,v)=>{o&&o===g.type&&(a=!0,m=Math.max(v,f),h=Math.min(v+g.nodeSize,u),p=v,d=g)}):r.doc.nodesBetween(f,u,(g,v)=>{v<f&&o&&o===g.type&&(a=!0,m=Math.max(v,f),h=Math.min(v+g.nodeSize,u),p=v,d=g),v>=f&&v<=u&&(o&&o===g.type&&(a=!0,s&&n.setNodeMarkup(v,void 0,{...g.attrs,...t})),i&&g.marks.length&&g.marks.forEach(y=>{if(i===y.type&&(a=!0,s)){const w=Math.max(v,f),M=Math.min(v+g.nodeSize,u);n.addMark(w,M,i.create({...y.attrs,...t}))}}))}),d&&(p!==void 0&&s&&n.setNodeMarkup(p,void 0,{...d.attrs,...t}),i&&d.marks.length&&d.marks.forEach(g=>{i===g.type&&s&&n.addMark(m,h,i.create({...g.attrs,...t}))}))}),a},Er=(e,t={})=>({state:n,dispatch:r})=>{const s=T(e,n.schema);return Ue(s,t)(n,r)},Tr=(e,t={})=>({state:n,dispatch:r})=>{const s=T(e,n.schema);return Ke(s,t)(n,r)},Ar=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},at=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},Cr=(e,t)=>{if(bt(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function J(e){var t;const{editor:n,from:r,to:s,text:o,rules:i,plugin:c}=e,{view:a}=n;if(a.composing)return!1;const l=a.state.doc.resolve(r);if(l.parent.type.spec.code||(t=l.nodeBefore||l.nodeAfter)!=null&&t.marks.find(p=>p.type.spec.code))return!1;let f=!1;const u=nr(l)+o;return i.forEach(p=>{if(f)return;const d=Cr(u,p.find);if(!d)return;const m=a.state.tr,h=rt({state:a.state,transaction:m}),g={from:r-(d[0].length-o.length),to:s},{commands:v,chain:y,can:w}=new st({editor:n,state:h});p.handler({state:h,range:g,match:d,commands:v,chain:y,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(c,{transform:m,from:r,to:s,text:o}),a.dispatch(m),f=!0)}),f}function Pr(e){const{editor:t,rules:n}=e,r=new $({state:{init(){return null},apply(s,o,i){const c=s.getMeta(r);if(c)return c;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:f}=a;typeof f=="string"?f=f:f=wt(D.from(f),i.schema);const{from:u}=a,p=u+f.length;J({editor:t,from:u,to:p,text:f,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,c){return J({editor:t,from:o,to:i,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&J({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?J({editor:t,from:i.pos,to:i.pos,text:`
4
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function $r(e){return Object.prototype.toString.call(e).slice(8,-1)}function Q(e){return $r(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ee(e,t){const n={...e};return Q(e)&&Q(t)&&Object.keys(t).forEach(r=>{Q(t[r])&&Q(e[r])?n[r]=ee(e[r],t[r]):n[r]=t[r]}),n}var St=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...x(b(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...x(b(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ee(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Nr=class ne extends St{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new ne(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const a=i.find(l=>(l==null?void 0:l.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function Ir(e){return typeof e=="number"}var Rr=class{constructor(e){this.find=e.find,this.handler=e.handler}},Or=(e,t,n)=>{if(bt(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const o=[s.text];return o.index=s.index,o.input=e,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function Dr(e){const{editor:t,state:n,from:r,to:s,rule:o,pasteEvent:i,dropEvent:c}=e,{commands:a,chain:l,can:f}=new st({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,s,(d,m)=>{var h,g,v,y,w;if((g=(h=d.type)==null?void 0:h.spec)!=null&&g.code||!(d.isText||d.isTextblock||d.isInline))return;const M=(w=(y=(v=d.content)==null?void 0:v.size)!=null?y:d.nodeSize)!=null?w:0,k=Math.max(r,m),S=Math.min(s,m+M);if(k>=S)return;const E=d.isText?d.text||"":d.textBetween(k-m,S-m,void 0,"");Or(E,o.find,i).forEach(C=>{if(C.index===void 0)return;const j=k+C.index+1,lt=j+C[0].length,U={from:n.tr.mapping.map(j),to:n.tr.mapping.map(lt)},ut=o.handler({state:n,range:U,match:C,commands:a,chain:l,can:f,pasteEvent:i,dropEvent:c});u.push(ut)})}),u.every(d=>d!==null)}var Z=null,Br=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function jr(e){const{editor:t,rules:n}=e;let r=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const a=({state:f,from:u,to:p,rule:d,pasteEvt:m})=>{const h=f.tr,g=rt({state:f,transaction:h});if(!(!Dr({editor:t,state:g,from:Math.max(u-1,0),to:p.b-1,rule:d,pasteEvent:m,dropEvent:c})||!h.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,h}};return n.map(f=>new $({view(u){const p=m=>{var h;r=(h=u.dom.parentElement)!=null&&h.contains(m.target)?u.dom.parentElement:null,r&&(Z=t)},d=()=>{Z&&(Z=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",d),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",d)}}},props:{handleDOMEvents:{drop:(u,p)=>{if(o=r===u.dom.parentElement,c=p,!o){const d=Z;d!=null&&d.isEditable&&setTimeout(()=>{const m=d.state.selection;m&&d.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(u,p)=>{var d;const m=(d=p.clipboardData)==null?void 0:d.getData("text/html");return i=p,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(u,p,d)=>{const m=u[0],h=m.getMeta("uiEvent")==="paste"&&!s,g=m.getMeta("uiEvent")==="drop"&&!o,v=m.getMeta("applyPasteRules"),y=!!v;if(!h&&!g&&!y)return;if(y){let{text:k}=v;typeof k=="string"?k=k:k=wt(D.from(k),d.schema);const{from:S}=v,E=S+k.length,A=Br(k);return a({rule:f,state:d,from:S,to:{b:E},pasteEvt:A})}const w=p.doc.content.findDiffStart(d.doc.content),M=p.doc.content.findDiffEnd(d.doc.content);if(!(!Ir(w)||!M||w===M.b))return a({rule:f,state:d,from:w,to:M,pasteEvt:i})}}))}var ct=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Mt(e),this.schema=Qt(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:F(t.name,this.schema)},r=b(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return H([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:F(r.name,this.schema)},o=[],i=b(r,"addKeyboardShortcuts",s);let c={};if(r.type==="mark"&&b(r,"exitable",s)&&(c.ArrowRight=()=>Nr.handleExit({editor:e,mark:r})),i){const p=Object.fromEntries(Object.entries(i()).map(([d,m])=>[d,()=>m({editor:e})]));c={...c,...p}}const a=ke(c);o.push(a);const l=b(r,"addInputRules",s);if(Dt(r,e.options.enableInputRules)&&l){const p=l();if(p&&p.length){const d=Pr({editor:e,rules:p}),m=Array.isArray(d)?d:[d];o.push(...m)}}const f=b(r,"addPasteRules",s);if(Dt(r,e.options.enablePasteRules)&&f){const p=f();if(p&&p.length){const d=jr({editor:e,rules:p});o.push(...d)}}const u=b(r,"addProseMirrorPlugins",s);if(u){const p=u();o.push(...p)}return o})}get attributes(){return Jt(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=L(this.extensions);return Object.fromEntries(t.filter(n=>!!b(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:T(n.name,this.schema)},o=b(n,"addNodeView",s);if(!o)return[];const i=o();if(!i)return[];const c=(a,l,f,u,p)=>{const d=et(a,r);return i({node:a,view:l,getPos:f,decorations:u,innerDecorations:p,editor:e,extension:n,HTMLAttributes:d})};return[n.name,c]}))}dispatchTransaction(e){const{editor:t}=this;return H([...this.extensions].reverse()).reduceRight((r,s)=>{const o={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:F(s.name,this.schema)},i=b(s,"dispatchTransaction",o);return i?c=>{i.call(o,{transaction:c,next:r})}:r},e)}transformPastedHTML(e){const{editor:t}=this;return H([...this.extensions]).reduce((r,s)=>{const o={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:t,type:F(s.name,this.schema)},i=b(s,"transformPastedHTML",o);return i?(c,a)=>{const l=r(c,a);return i.call(o,l)}:r},e||(r=>r))}get markViews(){const{editor:e}=this,{markExtensions:t}=L(this.extensions);return Object.fromEntries(t.filter(n=>!!b(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:R(n.name,this.schema)},o=b(n,"addMarkView",s);if(!o)return[];const i=(c,a,l)=>{const f=et(c,r);return o()({mark:c,view:a,inline:l,editor:e,extension:n,HTMLAttributes:f,updateAttributes:u=>{Zr(c,e,u)}})};return[n.name,i]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:F(t.name,this.schema)};t.type==="mark"&&((n=x(b(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const s=b(t,"onBeforeCreate",r),o=b(t,"onCreate",r),i=b(t,"onUpdate",r),c=b(t,"onSelectionUpdate",r),a=b(t,"onTransaction",r),l=b(t,"onFocus",r),f=b(t,"onBlur",r),u=b(t,"onDestroy",r);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),c&&this.editor.on("selectionUpdate",c),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),f&&this.editor.on("blur",f),u&&this.editor.on("destroy",u)})}};ct.resolve=Mt;ct.sort=H;ct.flatten=kt;var _r={};vt(_r,{ClipboardTextSerializer:()=>se,Commands:()=>oe,Delete:()=>ie,Drop:()=>ae,Editable:()=>ce,FocusEvents:()=>ue,Keymap:()=>de,Paste:()=>fe,Tabindex:()=>pe,TextDirection:()=>me,focusEventsPluginKey:()=>le});var N=class re extends St{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new re(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},se=N.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new $({key:new B("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,{ranges:o}=s,i=Math.min(...o.map(f=>f.$from.pos)),c=Math.max(...o.map(f=>f.$to.pos)),a=Gt(n);return Zt(r,{from:i,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),oe=N.create({name:"commands",addCommands(){return{...Lt}}}),ie=N.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,s;const o=()=>{var i,c,a,l;if((l=(a=(c=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:c.filterTransaction)==null?void 0:a.call(c,e))!=null?l:e.getMeta("y-sync$"))return;const f=Vn(e.before,[e,...t]);er(f).forEach(d=>{f.mapping.mapResult(d.oldRange.from).deletedAfter&&f.mapping.mapResult(d.oldRange.to).deletedBefore&&f.before.nodesBetween(d.oldRange.from,d.oldRange.to,(m,h)=>{const g=h+m.nodeSize-2,v=d.oldRange.from<=h&&g<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:h,to:g,newFrom:f.mapping.map(h),newTo:f.mapping.map(g),deletedRange:d.oldRange,newRange:d.newRange,partial:!v,editor:this.editor,transaction:e,combinedTransform:f})})});const p=f.mapping;f.steps.forEach((d,m)=>{var h,g;if(d instanceof Me){const v=p.slice(m).map(d.from,-1),y=p.slice(m).map(d.to),w=p.invert().map(v,-1),M=p.invert().map(y),k=(h=f.doc.nodeAt(v-1))==null?void 0:h.marks.some(E=>E.eq(d.mark)),S=(g=f.doc.nodeAt(y))==null?void 0:g.marks.some(E=>E.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:w,to:M},newRange:{from:v,to:y},partial:!!(S||k),editor:this.editor,transaction:e,combinedTransform:f})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(o,0):o()}}),ae=N.create({name:"drop",addProseMirrorPlugins(){return[new $({key:new B("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ce=N.create({name:"editable",addProseMirrorPlugins(){return[new $({key:new B("editable"),props:{editable:()=>this.editor.options.editable}})]}}),le=new B("focusEvents"),ue=N.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new $({key:le,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),de=N.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:c})=>{const{selection:a,doc:l}=c,{empty:f,$anchor:u}=a,{pos:p,parent:d}=u,m=u.parent.isTextblock&&p>0?c.doc.resolve(p-1):u,h=m.parent.type.spec.isolating,g=u.pos-u.parentOffset,v=h&&m.parent.childCount===1?g===u.pos:z.atStart(l).from===p;return!f||!d.type.isTextblock||d.textContent.length||!v||v&&u.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return tt()||qt()?o:s},addProseMirrorPlugins(){return[new $({key:new B("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(h=>h.getMeta("composition")))return;const r=e.some(h=>h.docChanged)&&!t.doc.eq(n.doc),s=e.some(h=>h.getMeta("preventClearDocument"));if(!r||s)return;const{empty:o,from:i,to:c}=t.selection,a=z.atStart(t.doc).from,l=z.atEnd(t.doc).to;if(o||!(i===a&&c===l)||!xt(n.doc))return;const p=n.tr,d=rt({state:n,transaction:p}),{commands:m}=new st({editor:this.editor,state:d});if(m.clearNodes(),!!p.steps.length)return p}})]}}),fe=N.create({name:"paste",addProseMirrorPlugins(){return[new $({key:new B("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),pe=N.create({name:"tabindex",addProseMirrorPlugins(){return[new $({key:new B("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),me=N.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=L(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new $({key:new B("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),zr=class V{constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new V(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new V(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new V(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,i=n.isInline,c=this.pos+r+(o?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(c);if(!s&&!i&&a.depth<=this.depth)return;const l=new V(a,this.editor,s,s||i?n:null);s&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const o=s.node.attrs,i=Object.keys(n);for(let c=0;c<i.length;c+=1){const a=i[c];if(o[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(n);return this.children.forEach(i=>{r&&s.length>0||(i.node.type.name===t&&o.every(a=>n[a]===i.node.attrs[a])&&s.push(i),!(r&&s.length>0)&&(s=s.concat(i.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},Lr=`.ProseMirror {
5
+ position: relative;
6
+ }
7
+
8
+ .ProseMirror {
9
+ word-wrap: break-word;
10
+ white-space: pre-wrap;
11
+ white-space: break-spaces;
12
+ -webkit-font-variant-ligatures: none;
13
+ font-variant-ligatures: none;
14
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
15
+ }
16
+
17
+ .ProseMirror [contenteditable="false"] {
18
+ white-space: normal;
19
+ }
20
+
21
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
22
+ white-space: pre-wrap;
23
+ }
24
+
25
+ .ProseMirror pre {
26
+ white-space: pre-wrap;
27
+ }
28
+
29
+ img.ProseMirror-separator {
30
+ display: inline !important;
31
+ border: none !important;
32
+ margin: 0 !important;
33
+ width: 0 !important;
34
+ height: 0 !important;
35
+ }
36
+
37
+ .ProseMirror-gapcursor {
38
+ display: none;
39
+ pointer-events: none;
40
+ position: absolute;
41
+ margin: 0;
42
+ }
43
+
44
+ .ProseMirror-gapcursor:after {
45
+ content: "";
46
+ display: block;
47
+ position: absolute;
48
+ top: -2px;
49
+ width: 20px;
50
+ border-top: 1px solid black;
51
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
52
+ }
53
+
54
+ @keyframes ProseMirror-cursor-blink {
55
+ to {
56
+ visibility: hidden;
57
+ }
58
+ }
59
+
60
+ .ProseMirror-hideselection *::selection {
61
+ background: transparent;
62
+ }
63
+
64
+ .ProseMirror-hideselection *::-moz-selection {
65
+ background: transparent;
66
+ }
67
+
68
+ .ProseMirror-hideselection * {
69
+ caret-color: transparent;
70
+ }
71
+
72
+ .ProseMirror-focused .ProseMirror-gapcursor {
73
+ display: block;
74
+ }`;function Fr(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}var ss=class extends Ar{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:sr,createMappablePosition:or},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:o})=>this.options.onDrop(r,s,o)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=Ht(t,this.options.autofocus);this.editorState=be.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Fr(Lr,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=Kt(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=n.filter(i=>!i.key.startsWith(o))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[ce,se.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),oe,ue,de,pe,ae,fe,ie,me.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new ct(r,this)}createCommandManager(){this.commandManager=new st({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=mt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=mt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,i=this.extensionManager.transformPastedHTML(o);this.editorView=new ye(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:s,transformPastedHTML:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(l=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(l)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),s=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=n.findLast(l=>l.getMeta("focus")||l.getMeta("blur")),c=i==null?void 0:i.getMeta("focus"),a=i==null?void 0:i.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:i}),a&&this.emit("blur",{editor:this,event:a.event,transaction:i}),!(e.getMeta("preventUpdate")||!n.some(l=>l.docChanged)||o.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return Yn(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return rr(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return wt(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
75
+
76
+ `,textSerializers:n={}}=e||{};return Zn(this.state.doc,{blockSeparator:t,textSerializers:{...Gt(this.schema),...n}})}get isEmpty(){return xt(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new zr(t,this)}get $doc(){return this.$pos(0)}};function os(e){return new at({find:e.find,handler:({state:t,range:n,match:r})=>{const s=x(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=t,i=r[r.length-1],c=r[0];if(i){const a=c.search(/\S/),l=n.from+c.indexOf(i),f=l+i.length;if(Yt(n.from,n.to,t.doc).filter(d=>d.mark.type.excluded.find(h=>h===e.type&&h!==d.mark.type)).filter(d=>d.to>l).length)return null;f<n.to&&o.delete(f,n.to),l>n.from&&o.delete(n.from+a,l);const p=n.from+a+i.length;o.addMark(n.from+a,p,e.type.create(s||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function is(e){return new at({find:e.find,handler:({state:t,range:n,match:r})=>{const s=x(e.getAttributes,void 0,r)||{},{tr:o}=t,i=n.from;let c=n.to;const a=e.type.create(s);if(r[1]){const l=r[0].lastIndexOf(r[1]);let f=i+l;f>c?f=c:c=f+r[1].length;const u=r[0][r[0].length-1];o.insertText(u,i+r[0].length-1),o.replaceWith(f,c,a)}else if(r[0]){const l=e.type.isInline?i:i-1;o.insert(l,e.type.create(s)).delete(o.mapping.map(i),o.mapping.map(c))}o.scrollIntoView()},undoable:e.undoable})}function as(e){return new at({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),o=x(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function cs(e){return new at({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const o=x(e.getAttributes,void 0,r)||{},i=t.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),l=a&&ge(a,e.type,o);if(!l)return null;if(i.wrap(a,l),e.keepMarks&&e.editor){const{selection:u,storedMarks:p}=t,{splittableMarks:d}=e.editor.extensionManager,m=p||u.$to.parentOffset&&u.$from.marks();if(m){const h=m.filter(g=>d.includes(g.type.name));i.ensureMarks(h)}}if(e.keepAttributes){const u=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,o).run()}const f=i.doc.resolve(n.from-1).nodeBefore;f&&f.type===e.type&&gt(i.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,f))&&i.join(n.from-1)},undoable:e.undoable})}function ls(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof nt){const o=r.index();return r.parent.canReplaceWith(o,o+1,t)}let s=r.depth;for(;s>=0;){const o=r.index(s);if(r.node(s).contentMatchAt(o).matchType(t))return!0;s-=1}return!1}var Vr={};vt(Vr,{createAtomBlockMarkdownSpec:()=>Hr,createBlockMarkdownSpec:()=>Wr,createInlineMarkdownSpec:()=>Kr,parseAttributes:()=>Et,parseIndentedBlocks:()=>Jr,renderNestedMarkdownContent:()=>Qr,serializeAttributes:()=>Tt});function Et(e){if(!(e!=null&&e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,l=>(n.push(l),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const l=s.map(f=>f.trim().slice(1));t.class=l.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(t.id=o[1]);const i=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(i)).forEach(([,l,f])=>{var u;const p=parseInt(((u=f.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),d=n[p];d&&(t[l]=d.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(t[f]=!0)}),t}function Tt(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function Hr(e){const{nodeName:t,name:n,parseAttributes:r=Et,serializeAttributes:s=Tt,defaultAttributes:o={},requiredAttributes:i=[],allowedAttributes:c}=e,a=n||t,l=f=>{if(!c)return f;const u={};return c.forEach(p=>{p in f&&(u[p]=f[p])}),u};return{parseMarkdown:(f,u)=>{const p={...o,...f.attributes};return u.createNode(t,p,[])},markdownTokenizer:{name:t,level:"block",start(f){var u;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),d=(u=f.match(p))==null?void 0:u.index;return d!==void 0?d:-1},tokenize(f,u,p){const d=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=f.match(d);if(!m)return;const h=m[1]||"",g=r(h);if(!i.find(y=>!(y in g)))return{type:t,raw:m[0],attributes:g}}},renderMarkdown:f=>{const u=l(f.attrs||{}),p=s(u),d=p?` {${p}}`:"";return`:::${a}${d} :::`}}}function Wr(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=Et,serializeAttributes:o=Tt,defaultAttributes:i={},content:c="block",allowedAttributes:a}=e,l=n||t,f=u=>{if(!a)return u;const p={};return a.forEach(d=>{d in u&&(p[d]=u[d])}),p};return{parseMarkdown:(u,p)=>{let d;if(r){const h=r(u);d=typeof h=="string"?[{type:"text",text:h}]:h}else c==="block"?d=p.parseChildren(u.tokens||[]):d=p.parseInline(u.tokens||[]);const m={...i,...u.attributes};return p.createNode(t,m,d)},markdownTokenizer:{name:t,level:"block",start(u){var p;const d=new RegExp(`^:::${l}`,"m"),m=(p=u.match(d))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(u,p,d){var m;const h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(h);if(!g)return;const[v,y=""]=g,w=s(y);let M=1;const k=v.length;let S="";const E=/^:::([\w-]*)(\s.*)?/gm,A=u.slice(k);for(E.lastIndex=0;;){const C=E.exec(A);if(C===null)break;const j=C.index,lt=C[1];if(!((m=C[2])!=null&&m.endsWith(":::"))){if(lt)M+=1;else if(M-=1,M===0){const U=A.slice(0,j);S=U.trim();const ut=u.slice(0,k+j+C[0].length);let O=[];if(S)if(c==="block")for(O=d.blockTokens(U),O.forEach(I=>{I.text&&(!I.tokens||I.tokens.length===0)&&(I.tokens=d.inlineTokens(I.text))});O.length>0;){const I=O[O.length-1];if(I.type==="paragraph"&&(!I.text||I.text.trim()===""))O.pop();else break}else O=d.inlineTokens(S);return{type:t,raw:ut,attributes:w,content:S,tokens:O}}}}}},renderMarkdown:(u,p)=>{const d=f(u.attrs||{}),m=o(d),h=m?` {${m}}`:"",g=p.renderChildren(u.content||[],`
77
+
78
+ `);return`:::${l}${h}
79
+
80
+ ${g}
81
+
82
+ :::`}}}function qr(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,s,o,i]=r;t[s]=o||i,r=n.exec(e)}return t}function Ur(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function Kr(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=qr,serializeAttributes:o=Ur,defaultAttributes:i={},selfClosing:c=!1,allowedAttributes:a}=e,l=n||t,f=p=>{if(!a)return p;const d={};return a.forEach(m=>{const h=typeof m=="string"?m:m.name,g=typeof m=="string"?void 0:m.skipIfDefault;if(h in p){const v=p[h];if(g!==void 0&&v===g)return;d[h]=v}}),d},u=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,d)=>{const m={...i,...p.attributes};if(c)return d.createNode(t,m);const h=r?r(p):p.content||"";return h?d.createNode(t,m,[d.createTextNode(h)]):d.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(p){const d=c?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),m=p.match(d),h=m==null?void 0:m.index;return h!==void 0?h:-1},tokenize(p,d,m){const h=c?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=p.match(h);if(!g)return;let v="",y="";if(c){const[,M]=g;y=M}else{const[,M,k]=g;y=M,v=k||""}const w=s(y.trim());return{type:t,raw:g[0],content:v.trim(),attributes:w}}},renderMarkdown:p=>{let d="";r?d=r(p):p.content&&p.content.length>0&&(d=p.content.filter(v=>v.type==="text").map(v=>v.text).join(""));const m=f(p.attrs||{}),h=o(m),g=h?` ${h}`:"";return c?`[${l}${g}]`:`[${l}${g}]${d}[/${l}]`}}}function Jr(e,t,n){var r,s,o,i;const c=e.split(`
83
+ `),a=[];let l="",f=0;const u=t.baseIndentSize||2;for(;f<c.length;){const p=c[f],d=p.match(t.itemPattern);if(!d){if(a.length>0)break;if(p.trim()===""){f+=1,l=`${l}${p}
84
+ `;continue}else return}const m=t.extractItemData(d),{indentLevel:h,mainContent:g}=m;l=`${l}${p}
85
+ `;const v=[g];for(f+=1;f<c.length;){const k=c[f];if(k.trim()===""){const E=c.slice(f+1).findIndex(j=>j.trim()!=="");if(E===-1)break;if((((s=(r=c[f+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>h){v.push(k),l=`${l}${k}
86
+ `,f+=1;continue}else break}if((((i=(o=k.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:i.length)||0)>h)v.push(k),l=`${l}${k}
87
+ `,f+=1;else break}let y;const w=v.slice(1);if(w.length>0){const k=w.map(S=>S.slice(h+u)).join(`
88
+ `);k.trim()&&(t.customNestedParser?y=t.customNestedParser(k):y=n.blockTokens(k))}const M=t.createToken(m,y);a.push(M)}if(a.length!==0)return{items:a,raw:l}}function Qr(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const s=typeof n=="function"?n(r):n,[o,...i]=e.content,c=t.renderChildren([o]);let a=`${s}${c}`;return i&&i.length>0&&i.forEach((l,f)=>{var u,p;const d=(p=(u=t.renderChild)==null?void 0:u.call(t,l,f+1))!=null?p:t.renderChildren([l]);if(d!=null){const m=d.split(`
89
+ `).map(h=>h?t.indent(h):t.indent("")).join(`
90
+ `);a+=l.type==="paragraph"?`
91
+
92
+ ${m}`:`
93
+ ${m}`}}),a}function Zr(e,t,n={}){const{state:r}=t,{doc:s,tr:o}=r,i=e;s.descendants((c,a)=>{const l=o.mapping.map(a),f=o.mapping.map(a)+c.nodeSize;let u=null;if(c.marks.forEach(d=>{if(d!==i)return!1;u=d}),!u)return;let p=!1;if(Object.keys(n).forEach(d=>{n[d]!==u.attrs[d]&&(p=!0)}),p){const d=e.type.create({...e.attrs,...n});o.removeMark(l,f,e.type),o.addMark(l,f,d)}}),o.docChanged&&t.view.dispatch(o)}var us=class he extends St{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new he(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function ds(e){return new Rr({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const o=x(e.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=t,c=r[r.length-1],a=r[0];let l=n.to;if(c){const f=a.search(/\S/),u=n.from+a.indexOf(c),p=u+c.length;if(Yt(n.from,n.to,t.doc).filter(m=>m.mark.type.excluded.find(g=>g===e.type&&g!==m.mark.type)).filter(m=>m.to>u).length)return null;p<n.to&&i.delete(p,n.to),u>n.from&&i.delete(n.from+f,u),l=n.from+f+c.length,i.addMark(n.from+f,l,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}export{N as E,Nr as M,us as N,ds as a,os as b,ls as c,Vn as d,er as e,Yr as f,Xr as g,Yt as h,rs as i,Yn as j,q as k,ns as l,Kn as m,is as n,es as o,T as p,ts as q,Qr as r,et as s,as as t,Jr as u,ss as v,cs as w};
@@ -0,0 +1 @@
1
+ import{d as a,f as d,S as p,H as c,i as f}from"./PuckPrototypeRoute-CrbybIsD.js";import{a as g}from"./index-D4SeD5gd.js";import{j as h}from"./index-BVru-J_w.js";import"./index-oh4S_G9Y.js";f();function x(){const{options:s}=a(),l=d(s),{editor:r}=a(),i=g({editor:r,selector:t=>{var e,n;if((e=t.editor)!=null&&e.isActive("paragraph"))return"p";for(let o=1;o<=6;o++)if((n=t.editor)!=null&&n.isActive("heading",{level:o}))return`h${o}`;return"p"}}),u=t=>{const e=r==null?void 0:r.chain();if(t==="p")e==null||e.focus().setParagraph().run();else{const n=parseInt(t.replace("h",""),10);e==null||e.focus().toggleHeading({level:n}).run()}};return h.jsx(p,{options:l,onChange:u,value:i??"p",defaultValue:"p",renderDefaultIcon:c})}export{x as HeadingSelectLoaded};
@@ -0,0 +1 @@
1
+ import{d as r,h as a,S as d,j as c,i as p}from"./PuckPrototypeRoute-CrbybIsD.js";import{a as f}from"./index-D4SeD5gd.js";import{j as m}from"./index-BVru-J_w.js";import"./index-oh4S_G9Y.js";p();function C(){const{options:s}=r(),l=a(s),{editor:e}=r(),i=f({editor:e,selector:o=>{var t,n;return(t=o.editor)!=null&&t.isActive("bulletList")?"ul":(n=o.editor)!=null&&n.isActive("orderedList")?"ol":"p"}}),u=o=>{const t=e==null?void 0:e.chain();o==="p"?t==null||t.focus().setParagraph().run():o==="ol"?t==null||t.focus().toggleOrderedList().run():o==="ul"&&(t==null||t.focus().toggleBulletList().run())};return m.jsx(d,{options:l,onChange:u,value:i??"p",defaultValue:"p",renderDefaultIcon:c})}export{C as ListSelectLoaded};
@@ -0,0 +1 @@
1
+ import{d as u,e as f,S as g,A,i as v}from"./PuckPrototypeRoute-CrbybIsD.js";import{a as p}from"./index-D4SeD5gd.js";import{j as m}from"./index-BVru-J_w.js";import"./index-oh4S_G9Y.js";v();function C(){var l;const{options:n}=u(),a=f(n),{editor:i}=u(),c=(l=p({editor:i,selector:t=>{var e,o,r,s;return(e=t.editor)!=null&&e.isActive({textAlign:"center"})?"center":(o=t.editor)!=null&&o.isActive({textAlign:"right"})?"right":(r=t.editor)!=null&&r.isActive({textAlign:"justify"})?"justify":n!=null&&n.textAlign&&(s=n.textAlign.defaultAlignment)!=null?s:"left"}}))!=null?l:"left",d=t=>{const e=i==null?void 0:i.chain();e==null||e.focus().setTextAlign(t).run()};return m.jsx(g,{options:a,onChange:d,value:c,defaultValue:"left",renderDefaultIcon:A})}export{C as AlignSelectLoaded};
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
2
+ <path d="M32 4C44 4 56 20 56 36C56 52 44 60 32 60C20 60 8 52 8 36C8 20 20 4 32 4Z" fill="#1F7A3A"/>
3
+ <path d="M32 9C41 9 50 22 50 36C50 50 41 55 32 55C23 55 14 50 14 36C14 22 23 9 32 9Z" fill="#7ED957"/>
4
+ <circle cx="32" cy="36" r="10" fill="#8B5E3C"/>
5
+ </svg>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
+ <title>Avocado Studio</title>
8
+ <script type="module" crossorigin src="/assets/index-BVru-J_w.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-Wz7Aw5V1.css">
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,262 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Shimmer Effects Demo</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8fafc; color: #1e293b; padding: 40px; }
10
+ h1 { font-size: 1.5rem; margin-bottom: 8px; }
11
+ p.subtitle { color: #64748b; margin-bottom: 32px; }
12
+ .demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 900px; }
13
+ .demo-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 24px; }
14
+ .demo-card h2 { font-size: 0.875rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 16px; }
15
+ .demo-content { position: relative; overflow: hidden; border-radius: 8px; }
16
+ .demo-text { padding: 20px; background: #f1f5f9; border-radius: 8px; }
17
+ .demo-text h3 { font-size: 1.25rem; margin-bottom: 8px; }
18
+ .demo-text p { color: #64748b; line-height: 1.6; }
19
+ .demo-image { width: 100%; aspect-ratio: 16/9; background: #e2e8f0; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 0.875rem; }
20
+ .demo-skeleton { min-height: 120px; border-radius: 8px; }
21
+ .btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
22
+ .btn:hover { background: #1d4ed8; }
23
+ .status { margin-top: 12px; font-size: 0.8rem; color: #94a3b8; }
24
+
25
+ /* ── Shimmer overlay (light theme) ── */
26
+ .aifx-shimmer-overlay {
27
+ position: absolute;
28
+ inset: 0;
29
+ z-index: 23;
30
+ pointer-events: none;
31
+ border-radius: inherit;
32
+ overflow: clip;
33
+ background: linear-gradient(
34
+ 105deg,
35
+ transparent 0%,
36
+ rgba(210, 216, 223, 0.06) 22%,
37
+ rgba(226, 231, 237, 0.28) 44%,
38
+ rgba(255, 255, 255, 0.30) 50%,
39
+ rgba(226, 231, 237, 0.28) 56%,
40
+ rgba(216, 222, 229, 0.06) 78%,
41
+ transparent 100%
42
+ );
43
+ background-size: 250% 100%;
44
+ background-position: 180% 0;
45
+ animation: aifx-shimmer-sweep 1.4s ease-in-out infinite;
46
+ }
47
+
48
+ @keyframes aifx-shimmer-sweep {
49
+ 0% { background-position: 180% 0; }
50
+ 100% { background-position: -80% 0; }
51
+ }
52
+
53
+ /* ── Skeleton block (light theme) ── */
54
+ .editor-skeleton-block {
55
+ min-height: 140px;
56
+ border-radius: 12px;
57
+ background: #f1f5f9;
58
+ border: 1px solid #e2e8f0;
59
+ position: relative;
60
+ overflow: hidden;
61
+ }
62
+
63
+ .editor-skeleton-block::before {
64
+ content: "";
65
+ position: absolute;
66
+ inset: 0;
67
+ background: linear-gradient(
68
+ 90deg,
69
+ transparent 0%,
70
+ rgba(148, 163, 184, 0.08) 25%,
71
+ rgba(148, 163, 184, 0.15) 50%,
72
+ rgba(148, 163, 184, 0.08) 75%,
73
+ transparent 100%
74
+ );
75
+ background-size: 200% 100%;
76
+ animation: editor-skeleton-shimmer 1.6s ease-in-out infinite;
77
+ }
78
+
79
+ .editor-skeleton-block::after {
80
+ content: "";
81
+ position: absolute;
82
+ top: 28px;
83
+ left: 24px;
84
+ right: 40%;
85
+ height: 18px;
86
+ border-radius: 6px;
87
+ background: rgba(148, 163, 184, 0.12);
88
+ }
89
+
90
+ @keyframes editor-skeleton-shimmer {
91
+ 0% { background-position: 200% 0; }
92
+ 100% { background-position: -200% 0; }
93
+ }
94
+
95
+ /* ── Live draft shimmer (from preview-adapter) ── */
96
+ .editor-live-draft-active [data-editable-target] {
97
+ position: relative;
98
+ overflow: hidden;
99
+ }
100
+
101
+ .editor-live-draft-active [data-editable-target]::after {
102
+ content: "";
103
+ position: absolute;
104
+ inset: 0;
105
+ pointer-events: none;
106
+ background: linear-gradient(
107
+ 105deg,
108
+ transparent 0%,
109
+ rgba(37, 99, 235, 0.03) 20%,
110
+ rgba(37, 99, 235, 0.10) 45%,
111
+ rgba(37, 99, 235, 0.14) 50%,
112
+ rgba(37, 99, 235, 0.10) 55%,
113
+ rgba(37, 99, 235, 0.03) 80%,
114
+ transparent 100%
115
+ );
116
+ background-size: 250% 100%;
117
+ animation: editor-live-draft-shimmer 1.8s ease-in-out infinite;
118
+ }
119
+
120
+ @keyframes editor-live-draft-shimmer {
121
+ 0% { background-position: 200% 0; }
122
+ 100% { background-position: -50% 0; }
123
+ }
124
+
125
+ /* ── Sparkle badge ── */
126
+ .aifx-shimmer-sparkle {
127
+ position: absolute;
128
+ top: 8px;
129
+ right: 8px;
130
+ z-index: 24;
131
+ width: 28px;
132
+ height: 28px;
133
+ display: inline-flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ pointer-events: none;
137
+ color: #fff;
138
+ background: rgba(37, 99, 235, 0.9);
139
+ border-radius: 50%;
140
+ box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
141
+ animation: aifx-sparkle-blink 1.2s ease-in-out infinite;
142
+ }
143
+
144
+ .aifx-shimmer-sparkle svg {
145
+ display: block;
146
+ width: 13px;
147
+ height: 13px;
148
+ filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.28));
149
+ }
150
+
151
+ @keyframes aifx-sparkle-blink {
152
+ 0%, 100% { transform: scale(1); opacity: 1; }
153
+ 50% { transform: scale(0.82); opacity: 0.7; }
154
+ }
155
+ </style>
156
+ </head>
157
+ <body>
158
+ <h1>Shimmer Effects Demo</h1>
159
+ <p class="subtitle">Click the button to activate all shimmer effects for 5 seconds.</p>
160
+ <button class="btn" onclick="activateAll()">Activate Shimmer (5s)</button>
161
+ <div class="status" id="status">Idle</div>
162
+
163
+ <div class="demo-grid" style="margin-top: 24px;">
164
+
165
+ <!-- 1. Field shimmer overlay on text -->
166
+ <div class="demo-card">
167
+ <h2>1. Field Shimmer (Text)</h2>
168
+ <div class="demo-content" id="text-target">
169
+ <div class="demo-text">
170
+ <h3>Eat Smarter. Feel Better.</h3>
171
+ <p>Get instant access to science-backed recipes, wellness tips, and expert guidance — no credit card needed.</p>
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- 2. Field shimmer overlay on image -->
177
+ <div class="demo-card">
178
+ <h2>2. Field Shimmer (Image)</h2>
179
+ <div class="demo-content" id="image-target">
180
+ <div class="demo-image">
181
+ <span>480 x 270 image placeholder</span>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
186
+ <!-- 3. Skeleton block -->
187
+ <div class="demo-card">
188
+ <h2>3. Skeleton Block (New section)</h2>
189
+ <div id="skeleton-target"></div>
190
+ </div>
191
+
192
+ <!-- 4. Live draft shimmer -->
193
+ <div class="demo-card">
194
+ <h2>4. Live Draft (Streaming text)</h2>
195
+ <div class="demo-content" id="live-draft-target">
196
+ <div class="demo-text">
197
+ <h3 data-editable-target="heading">Featured Recipes</h3>
198
+ <p data-editable-target="description">A vibrant, tropical salsa bursting with fresh mango, cilantro, and creamy avocado.</p>
199
+ </div>
200
+ </div>
201
+ </div>
202
+
203
+ </div>
204
+
205
+ <script>
206
+ const sparkleSvg = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/></svg>';
207
+
208
+ function activateAll() {
209
+ document.getElementById("status").textContent = "Shimmer active...";
210
+
211
+ // 1. Text shimmer overlay
212
+ const textTarget = document.getElementById("text-target");
213
+ textTarget.style.position = "relative";
214
+ const textOverlay = document.createElement("div");
215
+ textOverlay.className = "aifx-shimmer-overlay";
216
+ const textSparkle = document.createElement("div");
217
+ textSparkle.className = "aifx-shimmer-sparkle";
218
+ textSparkle.innerHTML = sparkleSvg;
219
+ textTarget.appendChild(textOverlay);
220
+ textTarget.appendChild(textSparkle);
221
+
222
+ // 2. Image shimmer overlay
223
+ const imageTarget = document.getElementById("image-target");
224
+ imageTarget.style.position = "relative";
225
+ const imgOverlay = document.createElement("div");
226
+ imgOverlay.className = "aifx-shimmer-overlay";
227
+ const imgSparkle = document.createElement("div");
228
+ imgSparkle.className = "aifx-shimmer-sparkle";
229
+ imgSparkle.innerHTML = sparkleSvg;
230
+ imageTarget.appendChild(imgOverlay);
231
+ imageTarget.appendChild(imgSparkle);
232
+
233
+ // 3. Skeleton block
234
+ const skeletonTarget = document.getElementById("skeleton-target");
235
+ const skeleton = document.createElement("div");
236
+ skeleton.className = "editor-skeleton-block";
237
+ skeletonTarget.appendChild(skeleton);
238
+
239
+ // 4. Live draft shimmer
240
+ const liveDraftTarget = document.getElementById("live-draft-target");
241
+ liveDraftTarget.classList.add("editor-live-draft-active");
242
+
243
+ // Remove after 5 seconds
244
+ setTimeout(() => {
245
+ textOverlay.remove();
246
+ textSparkle.remove();
247
+ textTarget.style.removeProperty("position");
248
+
249
+ imgOverlay.remove();
250
+ imgSparkle.remove();
251
+ imageTarget.style.removeProperty("position");
252
+
253
+ skeleton.remove();
254
+
255
+ liveDraftTarget.classList.remove("editor-live-draft-active");
256
+
257
+ document.getElementById("status").textContent = "Done. Click again to replay.";
258
+ }, 5000);
259
+ }
260
+ </script>
261
+ </body>
262
+ </html>
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@avocadostudio-ai/cli",
3
+ "version": "0.1.0",
4
+ "description": "Self-host launcher for the Avocado Studio editor UI",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "avocadostudio": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "editor-dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "keywords": [
17
+ "avocado",
18
+ "avocado-studio",
19
+ "cms",
20
+ "editor",
21
+ "self-host",
22
+ "nextjs",
23
+ "ai"
24
+ ],
25
+ "homepage": "https://github.com/avocadostudio-ai/avocado/tree/main/packages/avocadostudio-cli#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/avocadostudio-ai/avocado/issues"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/avocadostudio-ai/avocado.git",
32
+ "directory": "packages/avocadostudio-cli"
33
+ },
34
+ "engines": {
35
+ "node": ">=22"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "rm -rf dist && esbuild src/index.ts --bundle --platform=node --target=node22 --format=esm --outfile=dist/index.js --banner:js='#!/usr/bin/env node'",
42
+ "dev": "tsx src/index.ts",
43
+ "typecheck": "tsc --noEmit",
44
+ "sync-editor": "rm -rf editor-dist && cp -R ../../apps/editor/dist editor-dist",
45
+ "prepack": "pnpm --filter @ai-site-editor/editor build && pnpm sync-editor && pnpm build"
46
+ },
47
+ "dependencies": {},
48
+ "devDependencies": {
49
+ "@avocadostudio-ai/shared": "workspace:*",
50
+ "@types/node": "^22.13.10",
51
+ "esbuild": "^0.24.0",
52
+ "tsx": "^4.19.0",
53
+ "typescript": "^5.7.3"
54
+ }
55
+ }