"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3893],{50697:function(e,t,s){s.d(t,{AOx:function(){return eu},Ao0:function(){return eZ},HOd:function(){return eD},IGC:function(){return em},JZE:function(){return el},QR:function(){return en},WDe:function(){return ep},ZQL:function(){return e0},_y:function(){return ec},gQe:function(){return eJ},i8b:function(){return ey},nNj:function(){return es},orf:function(){return eA},uS7:function(){return er},w9d:function(){return ef},wJp:function(){return eM}});var r,n,i,o,a,l,d,u,h,c,p,m,g,f,y,v,S,x,k,E,b=s(71071),M=s(38756),w=s(27343),O=s(71688),A=s(13e3),P=s(86883),C=s(75114),T=s(30764),R=s(27191),N=s(65832),H=s(60737),_=s(52780),K=s(88892),D=s(17890),I=s(11179),L=s(41466),V=s(20242),B=s(55518),F=Object.defineProperty,U=Object.getOwnPropertyDescriptor,W=(e,t,s,r)=>{for(var n,i=r>1?void 0:r?U(t,s):t,o=e.length-1;o>=0;o--)(n=e[o])&&(i=(r?n(t,s,i):n(i))||i);return r&&i&&F(t,s,i),i},G=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},j=(e,t,s)=>(G(e,t,"read from private field"),s?s.call(e):t.get(e)),$=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},q=(e,t,s,r)=>(G(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s);function J(e,t){return e===t}function X(e){let{previousOptions:t,update:s,equals:r=J}=e,n=(0,b.vV)({...t,...s}),i=(0,b.Ry)(),o=(0,b.XP)(t);for(let a of o){let l=t[a],d=n[a];if(r(l,d)){i[a]={changed:!1};continue}i[a]={changed:!0,previousValue:l,value:d}}let u=e=>{let t=(0,b.Ry)();for(let s of e){let r=i[s];(null==r?void 0:r.changed)&&(t[s]=r.value)}return t};return{changes:(0,b.vV)(i),options:n,pickChanged:u}}var z={[M.mA.DUPLICATE_HELPER_NAMES]:"helper method",[M.mA.DUPLICATE_COMMAND_NAMES]:"command method"};function Q(e){let{name:t,set:s,code:r}=e,n=z[r];(0,b.kG)(!s.has(t),{code:r,message:`There is a naming conflict for the name: ${t} used in this '${n}'. Please rename or remove from the editor to avoid runtime errors.`}),s.add(t)}var Y="__IGNORE__",Z=class{constructor(e,...[t]){this["~O"]={},this._mappedHandlers=(0,b.Ry)(),this.populateMappedHandlers(),this._options=this._initialOptions=(0,b.RH)(e,this.constructor.defaultOptions,t??(0,b.Ry)(),this.createDefaultHandlerOptions()),this._dynamicKeys=this.getDynamicKeys(),this.init()}get options(){return this._options}get dynamicKeys(){return this._dynamicKeys}get initialOptions(){return this._initialOptions}init(){}getDynamicKeys(){let e=[],{customHandlerKeys:t,handlerKeys:s,staticKeys:r}=this.constructor;for(let n of(0,b.XP)(this._options))!(r.includes(n)||s.includes(n)||t.includes(n))&&e.push(n);return e}ensureAllKeysAreDynamic(e){if(O.NZ.isProduction)return;let t=[];for(let s of(0,b.XP)(e))!this._dynamicKeys.includes(s)&&t.push(s);(0,b.kG)((0,b.yD)(t),{code:M.mA.INVALID_SET_EXTENSION_OPTIONS,message:`Invalid properties passed into the 'setOptions()' method: ${JSON.stringify(t)}.`})}setOptions(e){var t;let s=this.getDynamicOptions();this.ensureAllKeysAreDynamic(e);let{changes:r,options:n,pickChanged:i}=X({previousOptions:s,update:e});this.updateDynamicOptions(n),null==(t=this.onSetOptions)||t.call(this,{reason:"set",changes:r,options:n,pickChanged:i,initialOptions:this._initialOptions})}resetOptions(){var e;let t=this.getDynamicOptions(),{changes:s,options:r,pickChanged:n}=X({previousOptions:t,update:this._initialOptions});this.updateDynamicOptions(r),null==(e=this.onSetOptions)||e.call(this,{reason:"reset",options:r,changes:s,pickChanged:n,initialOptions:this._initialOptions})}getDynamicOptions(){return A(this._options,[...this.constructor.customHandlerKeys,...this.constructor.handlerKeys])}updateDynamicOptions(e){this._options={...this._options,...e}}populateMappedHandlers(){for(let e of this.constructor.handlerKeys)this._mappedHandlers[e]=[]}createDefaultHandlerOptions(){let e=(0,b.Ry)();for(let t of this.constructor.handlerKeys)e[t]=(...e)=>{var s;let{handlerKeyOptions:r}=this.constructor,n=null==(s=r[t])?void 0:s.reducer,i=null==n?void 0:n.getDefault(...e);for(let[,o]of this._mappedHandlers[t]){let a=o(...e);if(ee(r,i=n?n.accumulator(i,a,...e):a,t))break}return i};return e}addHandler(e,t,s=M.xV.Default){return this._mappedHandlers[e].push([s,t]),this.sortHandlers(e),()=>this._mappedHandlers[e]=this._mappedHandlers[e].filter(([,e])=>e!==t)}hasHandlers(e){return(this._mappedHandlers[e]??[]).length>0}sortHandlers(e){this._mappedHandlers[e]=(0,b.DY)(this._mappedHandlers[e],([e],[t])=>t-e)}addCustomHandler(e,t){var s;return(null==(s=this.onAddCustomHandler)?void 0:s.call(this,{[e]:t}))??b.ZT}};function ee(e,t,s){let{__ALL__:r}=e,n=e[s];return(!!r||!!n)&&(!!n&&n.earlyReturnValue!==Y&&((0,b.mf)(n.earlyReturnValue)?!0===n.earlyReturnValue(t):t===n.earlyReturnValue)||!!r&&r.earlyReturnValue!==Y&&((0,b.mf)(r.earlyReturnValue)?!0===r.earlyReturnValue(t):t===r.earlyReturnValue))}Z.defaultOptions={},Z.staticKeys=[],Z.handlerKeys=[],Z.handlerKeyOptions={},Z.customHandlerKeys=[];var et=class extends Z{constructor(...e){for(let t of(super(ei,...e),this["~E"]={},this._extensions=(0,b.uw)(this.createExtensions(),e=>e.constructor),this.extensionMap=new Map,this._extensions))this.extensionMap.set(t.constructor,t)}get priority(){return this.priorityOverride??this.options.priority??this.constructor.defaultPriority}get constructorName(){return`${(0,w.Ho)(this.name)}Extension`}get store(){return(0,b.kG)(this._store,{code:M.mA.MANAGER_PHASE_ERROR,message:"An error occurred while attempting to access the 'extension.store' when the Manager has not yet set created the lifecycle methods."}),(0,b.vV)(this._store,{requireKeys:!0})}get extensions(){return this._extensions}replaceChildExtension(e,t){this.extensionMap.has(e)&&(this.extensionMap.set(e,t),this._extensions=this.extensions.map(s=>t.constructor===e?t:s))}createExtensions(){return[]}getExtension(e){let t=this.extensionMap.get(e);return(0,b.kG)(t,{code:M.mA.INVALID_GET_EXTENSION,message:`'${e.name}' does not exist within the preset: '${this.name}'`}),t}isOfType(e){return this.constructor===e}setStore(e){!this._store&&(this._store=e)}clone(...e){return new this.constructor(...e)}setPriority(e){this.priorityOverride=e}};et.defaultPriority=M.xV.Default;var es=class extends et{static get[M.By](){return M.lk.PlainExtensionConstructor}get[M.By](){return M.lk.PlainExtension}},er=class extends et{static get[M.By](){return M.lk.MarkExtensionConstructor}get[M.By](){return M.lk.MarkExtension}get type(){return(0,b.fp)(this.store.schema.marks,this.name)}constructor(...e){super(...e)}};er.disableExtraAttributes=!1;var en=class extends et{static get[M.By](){return M.lk.NodeExtensionConstructor}get[M.By](){return M.lk.NodeExtension}get type(){return(0,b.fp)(this.store.schema.nodes,this.name)}constructor(...e){super(...e)}};en.disableExtraAttributes=!1;var ei={priority:void 0,extraAttributes:{},disableExtraAttributes:!1,exclude:{}};function eo(e){return(0,O.gf)(e)&&(0,O.pI)(e,[M.lk.PlainExtension,M.lk.MarkExtension,M.lk.NodeExtension])}function ea(e){return(0,O.gf)(e)&&(0,O.pI)(e,M.lk.PlainExtension)}function el(e){return(0,O.gf)(e)&&(0,O.pI)(e,M.lk.NodeExtension)}function ed(e){return(0,O.gf)(e)&&(0,O.pI)(e,M.lk.MarkExtension)}function eu(e){return t=>{let{defaultOptions:s,customHandlerKeys:r,handlerKeys:n,staticKeys:i,defaultPriority:o,handlerKeyOptions:a,...l}=e,d=(0,b.RF)(t);for(let[u,h]of(s&&(d.defaultOptions=s),o&&(d.defaultPriority=o),a&&(d.handlerKeyOptions=a),d.staticKeys=i??[],d.handlerKeys=n??[],d.customHandlerKeys=r??[],Object.entries(l)))!d[u]&&(d[u]=h);return(0,b.RF)(d)}}var eh=class extends es{constructor(){super(...arguments),this.attributeList=[],this.attributeObject=(0,b.Ry)(),this.updateAttributes=(e=!0)=>{this.transformAttributes(),e&&this.store.commands.forceUpdate("attributes")}}get name(){return"attributes"}onCreate(){this.transformAttributes(),this.store.setExtensionStore("updateAttributes",this.updateAttributes)}transformAttributes(){var e,t,s;if(this.attributeObject=(0,b.Ry)(),null==(e=this.store.managerSettings.exclude)?void 0:e.attributes){this.store.setStoreKey("attributes",this.attributeObject);return}for(let r of(this.attributeList=[],this.store.extensions)){if(null==(t=r.options.exclude)?void 0:t.attributes)continue;let n=null==(s=r.createAttributes)?void 0:s.call(r),i={...n,class:(0,b.cx)(...r.classNames??[],null==n?void 0:n.class)};this.attributeList.unshift(i)}for(let o of this.attributeList)this.attributeObject={...this.attributeObject,...o,class:(0,b.cx)(this.attributeObject.class,o.class)};this.store.setStoreKey("attributes",this.attributeObject)}};function ec(e={}){return(t,s,r)=>{(t.decoratedHelpers??(t.decoratedHelpers={}))[s]=e}}function ep(e={}){return(t,s,r)=>{(t.decoratedCommands??(t.decoratedCommands={}))[s]=e}}function em(e){return(t,s,r)=>{(t.decoratedKeybindings??(t.decoratedKeybindings={}))[s]=e}}var eg=class{constructor(e){this.promiseCreator=e,this.failureHandlers=[],this.successHandlers=[],this.validateHandlers=[],this.generateCommand=()=>e=>{let t=!0,{view:s,tr:r,dispatch:n}=e;if(!s)return!1;for(let i of this.validateHandlers)if(!i({...e,dispatch(){}})){t=!1;break}if(!n||!t)return t;let o=this.promiseCreator(e);return o.then(e=>{this.runHandlers(this.successHandlers,{value:e,state:s.state,tr:s.state.tr,dispatch:s.dispatch,view:s})}).catch(e=>{this.runHandlers(this.failureHandlers,{error:e,state:s.state,tr:s.state.tr,dispatch:s.dispatch,view:s})}),n(r),!0}}validate(e,t="push"){return this.validateHandlers[t](e),this}success(e,t="push"){return this.successHandlers[t](e),this}failure(e,t="push"){return this.failureHandlers[t](e),this}runHandlers(e,t){var s;for(let r of e)if(!r({...t,dispatch(){}}))break;null==(s=t.dispatch)||s.call(t,t.tr)}};function ef(e){let{type:t,attrs:s,range:r,selection:n}=e;return e=>{let{dispatch:i,tr:o,state:a}=e,l=(0,b.HD)(t)?a.schema.marks[t]:t;if((0,b.kG)(l,{code:M.mA.SCHEMA,message:`Mark type: ${t} does not exist on the current schema.`}),r||n){let{from:d,to:u}=(0,O.b0)(n??r??o.selection,o.doc);return(0,O.yw)({trState:o,type:t,...r})?null==i||i(o.removeMark(d,u,l)):null==i||i(o.addMark(d,u,l.create(s))),!0}return(0,N.A_)((0,H.w9)(l,s))(e)}}var ey=class extends es{constructor(){super(...arguments),this.decorated=new Map,this.forceUpdateTransaction=(e,...t)=>{let{forcedUpdates:s}=this.getCommandMeta(e);return this.setCommandMeta(e,{forcedUpdates:(0,b.Nb)([...s,...t])}),e}}get name(){return"commands"}get transaction(){let e=this.store.getState();this._transaction||(this._transaction=e.tr);let t=this._transaction.before.eq(e.doc),s=!(0,b.yD)(this._transaction.steps);if(!t){let r=e.tr;if(s)for(let n of this._transaction.steps)r.step(n);this._transaction=r}return this._transaction}onCreate(){this.store.setStoreKey("getForcedUpdates",this.getForcedUpdates.bind(this))}onView(e){var t;let{extensions:s,helpers:r}=this.store,n=(0,b.Ry)(),i=new Set,o=(0,b.Ry)(),a=t=>{var s;let r=(0,b.Ry)(),i=()=>t??this.transaction,a=[];for(let[l,d]of Object.entries(n))(null==(s=o[l])||!s.disableChaining)&&(r[l]=this.chainedFactory({chain:r,command:d.original,getTr:i,getChain:()=>a}));let u=e=>{(0,b.kG)(e===i(),{message:"Chaining currently only supports `CommandFunction` methods which do not use the `state.tr` property. Instead you should use the provided `tr` property."})};return r.run=(t={})=>{let s=a;for(let r of(a=[],s))if(!r(u)&&t.exitEarly)return;e.dispatch(i())},r.tr=()=>{let e=a;for(let t of(a=[],e))t(u);return i()},r.enabled=()=>{for(let e of a)if(!e())return!1;return!0},r};for(let l of s){let d=(null==(t=l.createCommands)?void 0:t.call(l))??{},u=l.decoratedCommands??{},h={};for(let[c,p]of(o={...o,decoratedCommands:u},Object.entries(u))){let m=(0,b.HD)(p.shortcut)&&p.shortcut.startsWith("_|")?{shortcut:r.getNamedShortcut(p.shortcut,l.options)}:void 0;this.updateDecorated(c,{...p,name:l.name,...m}),d[c]=l[c].bind(l),p.active&&(h[c]=()=>{var e;return(null==(e=p.active)?void 0:e.call(p,l.options,this.store))??!1})}!(0,b.Qr)(d)&&this.addCommands({active:h,names:i,commands:n,extensionCommands:d})}let g=a();for(let[f,y]of Object.entries(g))a[f]=y;this.store.setStoreKey("commands",n),this.store.setStoreKey("chain",a),this.store.setExtensionStore("commands",n),this.store.setExtensionStore("chain",a)}onStateUpdate({state:e}){this._transaction=e.tr}createPlugin(){return{}}customDispatch(e){return e}insertText(e,t={}){return(0,b.HD)(e)?function(e,t={}){return({tr:s,dispatch:r,state:n})=>{let i=n.schema,o=s.selection,{from:a=o.from,to:l=a??o.to,marks:d={}}=t;if(!r)return!0;s.insertText(e,a,l);let u=(0,b.fp)(s.steps,s.steps.length-1).getMap().map(l);for(let[h,c]of(0,b.qh)(d))s.addMark(a,u,(0,b.fp)(i.marks,h).create(c));return r(s),!0}}(e,t):this.store.createPlaceholderCommand({promise:e,placeholder:{type:"inline"},onSuccess:(e,s,r)=>this.insertText(e,{...t,...s})(r)}).generateCommand()}selectText(e,t={}){return({tr:s,dispatch:r})=>{let n=(0,O.b0)(e,s.doc),i=s.selection.anchor===n.anchor&&s.selection.head===n.head;return(!i||!!t.forceUpdate)&&(null==r||r(s.setSelection(n)),!0)}}selectMark(e){return t=>{let{tr:s}=t,r=(0,O.IH)(s.selection.$from,e);return!!r&&this.store.commands.selectText.original({from:r.from,to:r.to})(t)}}delete(e){return({tr:t,dispatch:s})=>{let{from:r,to:n}=e??t.selection;return null==s||s(t.delete(r,n)),!0}}emptyUpdate(e){return({tr:t,dispatch:s})=>(s&&(null==e||e(),s(t)),!0)}forceUpdate(...e){return({tr:t,dispatch:s})=>(null==s||s(this.forceUpdateTransaction(t,...e)),!0)}updateNodeAttributes(e,t){return({tr:s,dispatch:r})=>(null==r||r(s.setNodeMarkup(e,void 0,t)),!0)}setContent(e,t){return s=>{let{tr:r,dispatch:n}=s,i=this.store.manager.createState({content:e,selection:t});return!!i&&(null==n||n(r.replaceRangeWith(0,r.doc.nodeSize-2,i.doc)),!0)}}resetContent(){return e=>{let{tr:t,dispatch:s}=e,r=this.store.manager.createEmptyDoc();return r?this.setContent(r)(e):(null==s||s(t.delete(0,t.doc.nodeSize)),!0)}}emptySelection(){return({tr:e,dispatch:t})=>!e.selection.empty&&(null==t||t(e.setSelection(R.Bs.near(e.selection.$anchor))),!0)}insertNewLine(){return({dispatch:e,tr:t})=>!!(0,O.hT)(t.selection)&&(null==e||e(t.insertText("\n")),!0)}insertNode(e,t={}){return({dispatch:s,tr:r,state:n})=>{var i;let{attrs:o,range:a,selection:l,replaceEmptyParentBlock:d=!1}=t,{from:u,to:h,$from:c}=(0,O.b0)(l??a??r.selection,r.doc);if((0,O.PH)(e)||(0,O.mt)(e)){let p=c.before(c.depth);return null==s||s(d&&u===h&&(0,O.mp)(c.parent)?r.replaceWith(p,p+c.parent.nodeSize,e):r.replaceWith(u,h,e)),!0}let m=(0,b.HD)(e)?n.schema.nodes[e]:e;(0,b.kG)(m,{code:M.mA.SCHEMA,message:`The requested node type ${e} does not exist in the schema.`});let g=null==(i=t.marks)?void 0:i.map(e=>{if(e instanceof T.vc)return e;let t=(0,b.HD)(e)?n.schema.marks[e]:e;return(0,b.kG)(t,{code:M.mA.SCHEMA,message:`The requested mark type ${e} does not exist in the schema.`}),t.create()}),f=m.createAndFill(o,(0,b.HD)(t.content)?n.schema.text(t.content):t.content,g);return!!f&&(null==s||s(u!==h?r.replaceRangeWith(u,h,f):r.insert(u,f)),!0)}}focus(e){return t=>{let{dispatch:s,tr:r}=t,{view:n}=this.store;if(!1===e||n.hasFocus()&&(void 0===e||!0===e))return!1;if(void 0===e||!0===e){let{from:i=0,to:o=i}=r.selection;e={from:i,to:o}}return s&&this.delayedFocus(),this.selectText(e)(t)}}blur(e){return t=>{let{view:s}=this.store;return!!s.hasFocus()&&(requestAnimationFrame(()=>{s.dom.blur()}),!e||this.selectText(e)(t))}}setBlockNodeType(e,t,s,r=!0){return(0,O.uJ)(e,t,s,r)}toggleWrappingNode(e,t,s){return(0,O.bm)(e,t,s)}toggleBlockNodeItem(e){return(0,O.zU)(e)}wrapInNode(e,t,s){return(0,O.ym)(e,t,s)}applyMark(e,t,s){var r,n,i;return({tr:r,dispatch:n,state:i})=>{let o=(0,O.b0)(s??r.selection,r.doc),a=(0,O.Lp)(o),l=(0,b.HD)(e)?i.schema.marks[e]:e;if((0,b.kG)(l,{code:M.mA.SCHEMA,message:`Mark type: ${e} does not exist on the current schema.`}),o.empty&&!a||!function(e,t,s){for(let{$from:r,$to:n}of s){let i=0===r.depth&&t.type.allowsMarkType(e);if(t.nodesBetween(r.pos,n.pos,t=>{if(i)return!1;i=t.inlineContent&&t.type.allowsMarkType(e)}),i)return!0}return!1}(l,r.doc,o.ranges))return!1;if(!n)return!0;if(a)return r.removeStoredMark(l),t&&r.addStoredMark(l.create(t)),n(r),!0;let d=!1;for(let{$from:u,$to:h}of o.ranges){if(d)break;d=r.doc.rangeHasMark(u.pos,h.pos,l)}for(let{$from:c,$to:p}of o.ranges)d&&r.removeMark(c.pos,p.pos,l),t&&r.addMark(c.pos,p.pos,l.create(t));return n(r),!0}}toggleMark(e){return ef(e)}removeMark(e){return(0,O.P9)(e)}setMeta(e,t){return({tr:s})=>(s.setMeta(e,t),!0)}selectAll(){return this.selectText("all")}copy(){return e=>!e.tr.selection.empty&&(e.dispatch&&document.execCommand("copy"),!0)}paste(){return this.store.createPlaceholderCommand({async promise(){var e;return(null==(e=navigator.clipboard)?void 0:e.readText)?await navigator.clipboard.readText():""},placeholder:{type:"inline"},onSuccess:(e,t,s)=>this.insertNode((0,O.OC)({content:e,schema:s.state.schema}),{selection:t})(s)}).generateCommand()}cut(){return e=>!e.tr.selection.empty&&(e.dispatch&&document.execCommand("cut"),!0)}replaceText(e){return(0,O.lp)(e)}getAllCommandOptions(){let e={};for(let[t,s]of this.decorated)!(0,b.Qr)(s)&&(e[t]=s);return e}getCommandOptions(e){return this.decorated.get(e)}getCommandProp(){return{tr:this.transaction,dispatch:this.store.view.dispatch,state:this.store.view.state,view:this.store.view}}updateDecorated(e,t){if(!t){this.decorated.delete(e);return}let s=this.decorated.get(e)??{name:""};this.decorated.set(e,{...s,...t})}handleIosFocus(){O.NZ.isIos&&this.store.view.dom.focus()}delayedFocus(){this.handleIosFocus(),requestAnimationFrame(()=>{this.store.view.focus(),this.store.view.dispatch(this.transaction.scrollIntoView())})}getForcedUpdates(e){return this.getCommandMeta(e).forcedUpdates}getCommandMeta(e){let t=e.getMeta(this.pluginKey)??{};return{...ev,...t}}setCommandMeta(e,t){let s=this.getCommandMeta(e);e.setMeta(this.pluginKey,{...s,...t})}addCommands(e){let{extensionCommands:t,commands:s,names:r,active:n}=e;for(let[i,o]of(0,b.qh)(t))Q({name:i,set:r,code:M.mA.DUPLICATE_COMMAND_NAMES}),(0,b.kG)(!eS.has(i),{code:M.mA.DUPLICATE_COMMAND_NAMES,message:"The command name you chose is forbidden."}),s[i]=this.createUnchainedCommand(o,n[i])}unchainedFactory(e){return(...t)=>{let{shouldDispatch:s=!0,command:r}=e,{view:n}=this.store,{state:i}=n,o;return s&&(o=n.dispatch),r(...t)({state:i,dispatch:o,view:n,tr:i.tr})}}createUnchainedCommand(e,t){let s=this.unchainedFactory({command:e});return s.enabled=this.unchainedFactory({command:e,shouldDispatch:!1}),s.isEnabled=s.enabled,s.original=e,s.active=t,s}chainedFactory(e){return(...t)=>{let{chain:s,command:r,getTr:n,getChain:i}=e,o=i(),{view:a}=this.store,{state:l}=a;return o.push(e=>r(...t)({state:l,dispatch:e,view:a,tr:n()})),s}}};W([ep()],ey.prototype,"customDispatch",1),W([ep()],ey.prototype,"insertText",1),W([ep()],ey.prototype,"selectText",1),W([ep()],ey.prototype,"selectMark",1),W([ep()],ey.prototype,"delete",1),W([ep()],ey.prototype,"emptyUpdate",1),W([ep()],ey.prototype,"forceUpdate",1),W([ep()],ey.prototype,"updateNodeAttributes",1),W([ep()],ey.prototype,"setContent",1),W([ep()],ey.prototype,"resetContent",1),W([ep()],ey.prototype,"emptySelection",1),W([ep()],ey.prototype,"insertNewLine",1),W([ep()],ey.prototype,"insertNode",1),W([ep()],ey.prototype,"focus",1),W([ep()],ey.prototype,"blur",1),W([ep()],ey.prototype,"setBlockNodeType",1),W([ep()],ey.prototype,"toggleWrappingNode",1),W([ep()],ey.prototype,"toggleBlockNodeItem",1),W([ep()],ey.prototype,"wrapInNode",1),W([ep()],ey.prototype,"applyMark",1),W([ep()],ey.prototype,"toggleMark",1),W([ep()],ey.prototype,"removeMark",1),W([ep()],ey.prototype,"setMeta",1),W([ep({description:({t:e})=>e(C.Vb.SELECT_ALL_DESCRIPTION),label:({t:e})=>e(C.Vb.SELECT_ALL_LABEL),shortcut:M.vO.SelectAll})],ey.prototype,"selectAll",1),W([ep({description:({t:e})=>e(C.Vb.COPY_DESCRIPTION),label:({t:e})=>e(C.Vb.COPY_LABEL),shortcut:M.vO.Copy,icon:"fileCopyLine"})],ey.prototype,"copy",1),W([ep({description:({t:e})=>e(C.Vb.PASTE_DESCRIPTION),label:({t:e})=>e(C.Vb.PASTE_LABEL),shortcut:M.vO.Paste,icon:"clipboardLine"})],ey.prototype,"paste",1),W([ep({description:({t:e})=>e(C.Vb.CUT_DESCRIPTION),label:({t:e})=>e(C.Vb.CUT_LABEL),shortcut:M.vO.Cut,icon:"scissorsFill"})],ey.prototype,"cut",1),W([ep()],ey.prototype,"replaceText",1),W([ec()],ey.prototype,"getAllCommandOptions",1),W([ec()],ey.prototype,"getCommandOptions",1),W([ec()],ey.prototype,"getCommandProp",1),ey=W([eu({defaultPriority:M.xV.Highest,defaultOptions:{trackerClassName:"remirror-tracker-position",trackerNodeName:"span"},staticKeys:["trackerClassName","trackerNodeName"]})],ey);var ev={forcedUpdates:[]},eS=new Set(["run","chain","original","raw","enabled","tr"]),ex=class extends es{constructor(){super(...arguments),this.placeholders=_.EH.empty,this.placeholderWidgets=new Map,this.createPlaceholderCommand=e=>{let t=(0,b.EL)(),{promise:s,placeholder:r,onFailure:n,onSuccess:i}=e;return new eg(s).validate(e=>this.addPlaceholder(t,r)(e)).success(e=>{let{state:s,tr:r,dispatch:o,view:a,value:l}=e,d=this.store.helpers.findPlaceholder(t);if(!d){let u=Error("The placeholder has been removed");return(null==n?void 0:n({error:u,state:s,tr:r,dispatch:o,view:a}))??!1}return this.removePlaceholder(t)({state:s,tr:r,view:a,dispatch(){}}),i(l,d,{state:s,tr:r,dispatch:o,view:a})}).failure(e=>(this.removePlaceholder(t)({...e,dispatch(){}}),(null==n?void 0:n(e))??!1))}}get name(){return"decorations"}onCreate(){this.store.setExtensionStore("createPlaceholderCommand",this.createPlaceholderCommand)}createPlugin(){return{state:{init(){},apply:e=>{var t,s,r,n,i,o;let{added:a,clearTrackers:l,removed:d,updated:u}=this.getMeta(e);if(l){for(let[,h]of(this.placeholders=_.EH.empty,this.placeholderWidgets))null==(s=(t=h.spec).onDestroy)||s.call(t,this.store.view,h.spec.element);this.placeholderWidgets.clear();return}for(let[,c]of(this.placeholders=this.placeholders.map(e.mapping,e.doc,{onRemove:e=>{var t,s;let r=this.placeholderWidgets.get(e.id);r&&(null==(s=(t=r.spec).onDestroy)||s.call(t,this.store.view,r.spec.element))}}),this.placeholderWidgets))null==(n=(r=c.spec).onUpdate)||n.call(r,this.store.view,c.from,c.spec.element,c.spec.data);for(let p of a){if("inline"===p.type){this.addInlinePlaceholder(p,e);continue}if("node"===p.type){this.addNodePlaceholder(p,e);continue}if("widget"===p.type){this.addWidgetPlaceholder(p,e);continue}}for(let{id:m,data:g}of u){let f=this.placeholderWidgets.get(m);if(!f)continue;let y=_.p.widget(f.from,f.spec.element,{...f.spec,data:g});this.placeholders=this.placeholders.remove([f]).add(e.doc,[y]),this.placeholderWidgets.set(m,y)}for(let v of d){let S=this.placeholders.find(void 0,void 0,e=>e.id===v&&e.__type===eE),x=this.placeholderWidgets.get(v);x&&(null==(o=(i=x.spec).onDestroy)||o.call(i,this.store.view,x.spec.element)),this.placeholders=this.placeholders.remove(S),this.placeholderWidgets.delete(v)}}},props:{decorations:e=>{let t=this.options.decorations(e);for(let s of(t=t.add(e.doc,this.placeholders.find()),this.store.extensions)){if(!s.createDecorations)continue;let r=s.createDecorations(e).find();t=t.add(e.doc,r)}return t},handleDOMEvents:{blur:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(eb,!1)),!1),focus:e=>(this.options.persistentSelectionClass&&e.dispatch(e.state.tr.setMeta(eb,!0)),!1)}}}}updateDecorations(){return({tr:e,dispatch:t})=>(null==t||t(e),!0)}addPlaceholder(e,t,s){return({dispatch:r,tr:n})=>!!this.addPlaceholderTransaction(e,t,n,!r)&&(null==r||r(s?n.deleteSelection():n),!0)}updatePlaceholder(e,t){return({dispatch:s,tr:r})=>!!this.updatePlaceholderTransaction({id:e,data:t,tr:r,checkOnly:!s})&&(null==s||s(r),!0)}removePlaceholder(e){return({dispatch:t,tr:s})=>!!this.removePlaceholderTransaction({id:e,tr:s,checkOnly:!t})&&(null==t||t(s),!0)}clearPlaceholders(){return({tr:e,dispatch:t})=>!!this.clearPlaceholdersTransaction({tr:e,checkOnly:!t})&&(null==t||t(e),!0)}findPlaceholder(e){return this.findAllPlaceholders().get(e)}findAllPlaceholders(){let e=new Map,t=this.placeholders.find(void 0,void 0,e=>e.__type===eE);for(let s of t)e.set(s.spec.id,{from:s.from,to:s.to});return e}createDecorations(e){var t,s,r;let{persistentSelectionClass:n}=this.options;return!n||(null==(t=this.store.view)?void 0:t.hasFocus())||(null==(r=(s=this.store.helpers).isInteracting)?void 0:r.call(s))?_.EH.empty:function(e,t,s){let{selection:r,doc:n}=e;if(r.empty)return t;let{from:i,to:o}=r,a=(0,O.EG)(r)?_.p.node(i,o,s):_.p.inline(i,o,s);return t.add(n,[a])}(e,_.EH.empty,{class:(0,b.HD)(n)?n:"selection"})}onApplyState(){}addWidgetPlaceholder(e,t){let{pos:s,createElement:r,onDestroy:n,onUpdate:i,className:o,nodeName:a,id:l,type:d}=e,u=(null==r?void 0:r(this.store.view,s))??document.createElement(a);u.classList.add(o);let h=_.p.widget(s,u,{id:l,__type:eE,type:d,element:u,onDestroy:n,onUpdate:i});this.placeholderWidgets.set(l,h),this.placeholders=this.placeholders.add(t.doc,[h])}addInlinePlaceholder(e,t){let{from:s=t.selection.from,to:r=t.selection.to,className:n,nodeName:i,id:o,type:a}=e,l;if(s===r){let d=document.createElement(i);d.classList.add(n),l=_.p.widget(s,d,{id:o,type:a,__type:eE,widget:d})}else l=_.p.inline(s,r,{nodeName:i,class:n},{id:o,__type:eE});this.placeholders=this.placeholders.add(t.doc,[l])}addNodePlaceholder(e,t){let{pos:s,className:r,nodeName:n,id:i}=e,o=(0,b.hj)(s)?t.doc.resolve(s):t.selection.$from,a=(0,b.hj)(s)?o.nodeAfter?{pos:s,end:o.nodeAfter.nodeSize}:void 0:(0,O.hK)(o);if(!a)return;let l=_.p.node(a.pos,a.end,{nodeName:n,class:r},{id:i,__type:eE});this.placeholders=this.placeholders.add(t.doc,[l])}withRequiredBase(e,t){let{placeholderNodeName:s,placeholderClassName:r}=this.options,{nodeName:n=s,className:i,...o}=t,a=(i?[r,i]:[r]).join(" ");return{nodeName:n,className:a,...o,id:e}}getMeta(e){let t=e.getMeta(this.pluginKey)??{};return{...ek,...t}}setMeta(e,t){let s=this.getMeta(e);e.setMeta(this.pluginKey,{...s,...t})}addPlaceholderTransaction(e,t,s,r=!1){let n=this.findPlaceholder(e);if(n)return!1;if(r)return!0;let{added:i}=this.getMeta(s);return this.setMeta(s,{added:[...i,this.withRequiredBase(e,t)]}),!0}updatePlaceholderTransaction(e){let{id:t,tr:s,checkOnly:r=!1,data:n}=e,i=this.findPlaceholder(t);if(!i)return!1;if(r)return!0;let{updated:o}=this.getMeta(s);return this.setMeta(s,{updated:(0,b.Nb)([...o,{id:t,data:n}])}),!0}removePlaceholderTransaction(e){let{id:t,tr:s,checkOnly:r=!1}=e,n=this.findPlaceholder(t);if(!n)return!1;if(r)return!0;let{removed:i}=this.getMeta(s);return this.setMeta(s,{removed:(0,b.Nb)([...i,t])}),!0}clearPlaceholdersTransaction(e){let{tr:t,checkOnly:s=!1}=e,r=this.getPluginState();return r!==_.EH.empty&&(!!s||(this.setMeta(t,{clearTrackers:!0}),!0))}};W([ep()],ex.prototype,"updateDecorations",1),W([ep()],ex.prototype,"addPlaceholder",1),W([ep()],ex.prototype,"updatePlaceholder",1),W([ep()],ex.prototype,"removePlaceholder",1),W([ep()],ex.prototype,"clearPlaceholders",1),W([ec()],ex.prototype,"findPlaceholder",1),W([ec()],ex.prototype,"findAllPlaceholders",1),ex=W([eu({defaultOptions:{persistentSelectionClass:void 0,placeholderClassName:"placeholder",placeholderNodeName:"span"},staticKeys:["placeholderClassName","placeholderNodeName"],handlerKeys:["decorations"],handlerKeyOptions:{decorations:{reducer:{accumulator:(e,t,s)=>e.add(s.doc,t.find()),getDefault:()=>_.EH.empty}}},defaultPriority:M.xV.Low})],ex);var ek={added:[],updated:[],clearTrackers:!1,removed:[]},eE="placeholderDecoration",eb="persistentSelectionFocus",eM=class extends es{get name(){return"docChanged"}onStateUpdate(e){let{firstUpdate:t,transactions:s,tr:r}=e;!t&&(s??[r]).some(e=>null==e?void 0:e.docChanged)&&this.options.docChanged(e)}};eM=W([eu({handlerKeys:["docChanged"],handlerKeyOptions:{docChanged:{earlyReturnValue:!1}},defaultPriority:M.xV.Lowest})],eM);var ew=class extends es{get name(){return"helpers"}onCreate(){var e;this.store.setStringHandler("text",this.textToProsemirrorNode.bind(this)),this.store.setStringHandler("html",O.OC);let t=(0,b.Ry)(),s=(0,b.Ry)(),r=(0,b.Ry)(),n=new Set;for(let i of this.store.extensions){el(i)&&(s[i.name]=e=>(0,O.Ig)({state:this.store.getState(),type:i.type,attrs:e}),r[i.name]=e=>{var t;return null==(t=(0,O.EM)({state:this.store.getState(),type:i.type,attrs:e}))?void 0:t.node.attrs}),ed(i)&&(s[i.name]=e=>(0,O.yw)({trState:this.store.getState(),type:i.type,attrs:e}),r[i.name]=e=>{let t=(0,O.IH)(this.store.getState().selection.$from,i.type);return t&&e?(0,O.V1)(t.mark,e)?t.mark.attrs:void 0:null==t?void 0:t.mark.attrs});let o=(null==(e=i.createHelpers)?void 0:e.call(i))??{};for(let a of Object.keys(i.decoratedHelpers??{}))o[a]=i[a].bind(i);if(!(0,b.Qr)(o))for(let[l,d]of(0,b.qh)(o))Q({name:l,set:n,code:M.mA.DUPLICATE_HELPER_NAMES}),t[l]=d}this.store.setStoreKey("attrs",r),this.store.setStoreKey("active",s),this.store.setStoreKey("helpers",t),this.store.setExtensionStore("attrs",r),this.store.setExtensionStore("active",s),this.store.setExtensionStore("helpers",t)}isSelectionEmpty(e=this.store.getState()){return(0,O.Ab)(e)}isViewEditable(e=this.store.getState()){var t,s;return(null==(s=(t=this.store.view.props).editable)?void 0:s.call(t,e))??!1}getStateJSON(e=this.store.getState()){return e.toJSON()}getJSON(e=this.store.getState()){return e.doc.toJSON()}getRemirrorJSON(e=this.store.getState()){return this.getJSON(e)}insertHtml(e,t){return s=>{let{state:r}=s,n=(0,O.OC)({content:e,schema:r.schema,fragment:!0});return this.store.commands.insertNode.original(n,t)(s)}}getText({lineBreakDivider:e="\n\n",state:t=this.store.getState()}={}){return t.doc.textBetween(0,t.doc.content.size,e,M.Vp)}getTextBetween(e,t,s=this.store.getState().doc){return s.textBetween(e,t,"\n\n",M.Vp)}getHTML(e=this.store.getState()){return(0,O.Em)(e.doc,this.store.document)}textToProsemirrorNode(e){let t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};W([ec()],ew.prototype,"isSelectionEmpty",1),W([ec()],ew.prototype,"isViewEditable",1),W([ec()],ew.prototype,"getStateJSON",1),W([ec()],ew.prototype,"getJSON",1),W([ec()],ew.prototype,"getRemirrorJSON",1),W([ep()],ew.prototype,"insertHtml",1),W([ec()],ew.prototype,"getText",1),W([ec()],ew.prototype,"getTextBetween",1),W([ec()],ew.prototype,"getHTML",1),ew=W([eu({})],ew);var eO=class extends es{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;let s=[],r=this.store.markTags[M.eX.ExcludeInputRules];for(let n of this.store.extensions)if((null==(e=this.store.managerSettings.exclude)||!e.inputRules)&&n.createInputRules&&(null==(t=n.options.exclude)||!t.inputRules))for(let i of n.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,s.push(i);return(0,K.Hw)({rules:s})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};eO=W([eu({defaultPriority:M.xV.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],eO);var eA=class extends es{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,s;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],null==(s=(t=this.store).rebuildKeymap)||s.call(t),()=>{var t,s;this.extraKeyBindings=this.extraKeyBindings.filter(t=>t!==e),null==(s=(t=this.store).rebuildKeymap)||s.call(t)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){let{shortcuts:e}=this.options;return(0,b.HD)(e)?eH[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(null==(e=this.store.managerSettings.exclude)?void 0:e.keymap)?[]:(this.setupKeydownHandler(),[new R.Sy({props:{handleKeyDown:(e,t)=>{var s;return null==(s=this.keydownHandler)?void 0:s.call(this,e,t)}}})])}setupKeydownHandler(){let e=this.generateKeymapBindings();this.keydownHandler=(0,D.$)(e)}generateKeymapBindings(){var e;let t=[],s=this.shortcutMap,r=this.store.getExtension(ey),n=e=>t=>eP({shortcut:t,map:s,store:this.store,options:e.options});for(let i of this.store.extensions){let o=i.decoratedKeybindings??{};if(null==(e=i.options.exclude)||!e.keymap)for(let[a,l]of(i.createKeymap&&t.push(eT(i.createKeymap(n(i)),s)),(0,b.qh)(o))){if(l.isActive&&!l.isActive(i.options,this.store))continue;let d=i[a].bind(i),u=eP({shortcut:l.shortcut,map:s,options:i.options,store:this.store}),h=(0,b.mf)(l.priority)?l.priority(i.options,this.store):l.priority??M.xV.Low,c=(0,b.Ry)();for(let p of u)c[p]=d;t.push([h,c]),l.command&&r.updateDecorated(l.command,{shortcut:u})}}let m=this.sortKeymaps([...this.extraKeyBindings,...t]),g=(0,O.bk)(m);return g}arrowRightShortcut(e){let t=this.store.markTags[M.eX.PreventExits],s=this.store.nodeTags[M.eX.PreventExits];return this.exitMarkForwards(t,s)(e)}arrowLeftShortcut(e){let t=this.store.markTags[M.eX.PreventExits],s=this.store.nodeTags[M.eX.PreventExits];return(0,O.Q2)(this.exitNodeBackwards(s),this.exitMarkBackwards(t,s))(e)}backspace(e){let t=this.store.markTags[M.eX.PreventExits],s=this.store.nodeTags[M.eX.PreventExits];return(0,O.Q2)(this.exitNodeBackwards(s,!0),this.exitMarkBackwards(t,s,!0))(e)}createKeymap(){let{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:s}=this.options,r=(0,b.Ry)();if(!s)for(let[n,i]of(0,b.qh)(H.YR))r[n]=(0,N.A_)(i);return t&&H.YR.Backspace&&(r.Backspace=(0,N.A_)((0,H.QF)(K.dU,H.YR.Backspace))),e&&(r.Escape=(0,N.A_)(H.N0)),[M.xV.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?eP({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,s;let{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&(null==(s=(t=this.store).rebuildKeymap)||s.call(t))}sortKeymaps(e){return(0,b.DY)(e.map(e=>(0,b.kJ)(e)?e:[M.xV.Default,e]),(e,t)=>t[0]-e[0]).map(e=>e[1])}exitMarkForwards(e,t){return s=>{let{tr:r,dispatch:n}=s;if(!(0,O.OA)(r.selection))return!1;let i=(0,O.Tr)({selection:r.selection,types:t});if(i)return!1;let o=r.selection.$from,a=o.marks().filter(t=>!e.includes(t.type.name));if((0,b.yD)(a))return!1;if(!n)return!0;for(let l of a)r.removeStoredMark(l);return n(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return s=>{let{tr:r}=s,n=t?O.GK:O.sg;if(!n(r.selection))return!1;let i=r.selection.$anchor.node();return!(!(0,O.mp)(i)||(0,O.xN)(i)||e.includes(i.type.name))&&this.store.commands.toggleBlockNodeItem.original({type:i.type})(s)}}exitMarkBackwards(e,t,s=!1){return r=>{let{tr:n,dispatch:i}=r,o=s?O.GK:O.sg;if(!o(n.selection)||this.backwardMarkExitTracker.has(n.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;let a=(0,O.Tr)({selection:n.selection,types:t});if(a)return!1;let l=[...n.storedMarks??[],...n.selection.$from.marks()].filter(t=>!e.includes(t.type.name));if((0,b.yD)(l))return!1;if(!i)return!0;for(let d of l)n.removeStoredMark(d);return this.backwardMarkExitTracker.set(n.selection.anchor,!0),i(n),!0}}};function eP({shortcut:e,map:t,options:s,store:r}){return(0,b.HD)(e)?[eC(e,t)]:(0,b.kJ)(e)?e.map(e=>eC(e,t)):(e=e(s,r),eP({shortcut:e,map:t,options:s,store:r}))}function eC(e,t){var s;return(0,b.q9)((0,b.VO)(M.vO),e)?t[e]:e}function eT(e,t){let s={},r,n;for(let[i,o]of((0,b.kJ)(e)?[n,r]=e:r=e,(0,b.qh)(r)))s[eC(i,t)]=o;return(0,b.o8)(n)?s:[n,s]}W([em({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],eA.prototype,"arrowRightShortcut",1),W([em({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],eA.prototype,"arrowLeftShortcut",1),W([em({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],eA.prototype,"backspace",1),W([ec()],eA.prototype,"getNamedShortcut",1),eA=W([eu({defaultPriority:M.xV.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],eA);var eR={[M.vO.Copy]:"Mod-c",[M.vO.Cut]:"Mod-x",[M.vO.Paste]:"Mod-v",[M.vO.PastePlain]:"Mod-Shift-v",[M.vO.SelectAll]:"Mod-a",[M.vO.Undo]:"Mod-z",[M.vO.Redo]:O.NZ.isMac?"Shift-Mod-z":"Mod-y",[M.vO.Bold]:"Mod-b",[M.vO.Italic]:"Mod-i",[M.vO.Underline]:"Mod-u",[M.vO.Strike]:"Mod-d",[M.vO.Code]:"Mod-`",[M.vO.Paragraph]:"Mod-Shift-0",[M.vO.H1]:"Mod-Shift-1",[M.vO.H2]:"Mod-Shift-2",[M.vO.H3]:"Mod-Shift-3",[M.vO.H4]:"Mod-Shift-4",[M.vO.H5]:"Mod-Shift-5",[M.vO.H6]:"Mod-Shift-6",[M.vO.TaskList]:"Mod-Shift-7",[M.vO.BulletList]:"Mod-Shift-8",[M.vO.OrderedList]:"Mod-Shift-9",[M.vO.Quote]:"Mod->",[M.vO.Divider]:"Mod-Shift-|",[M.vO.Codeblock]:"Mod-Shift-~",[M.vO.ClearFormatting]:"Mod-Shift-C",[M.vO.Superscript]:"Mod-.",[M.vO.Subscript]:"Mod-,",[M.vO.LeftAlignment]:"Mod-Shift-L",[M.vO.CenterAlignment]:"Mod-Shift-E",[M.vO.RightAlignment]:"Mod-Shift-R",[M.vO.JustifyAlignment]:"Mod-Shift-J",[M.vO.InsertLink]:"Mod-k",[M.vO.Find]:"Mod-f",[M.vO.FindBackwards]:"Mod-Shift-f",[M.vO.FindReplace]:"Mod-Shift-H",[M.vO.AddFootnote]:"Mod-Alt-f",[M.vO.AddComment]:"Mod-Alt-m",[M.vO.ContextMenu]:"Mod-Shift-\\",[M.vO.IncreaseFontSize]:"Mod-Shift-.",[M.vO.DecreaseFontSize]:"Mod-Shift-,",[M.vO.IncreaseIndent]:"Tab",[M.vO.DecreaseIndent]:"Shift-Tab",[M.vO.Shortcuts]:"Mod-/",[M.vO.Format]:O.NZ.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},eN={...eR,[M.vO.Strike]:"Mod-Shift-S",[M.vO.Code]:"Mod-Shift-M",[M.vO.Paragraph]:"Mod-Alt-0",[M.vO.H1]:"Mod-Alt-1",[M.vO.H2]:"Mod-Alt-2",[M.vO.H3]:"Mod-Alt-3",[M.vO.H4]:"Mod-Alt-4",[M.vO.H5]:"Mod-Alt-5",[M.vO.H6]:"Mod-Alt-6",[M.vO.OrderedList]:"Mod-Alt-7",[M.vO.BulletList]:"Mod-Alt-8",[M.vO.Quote]:"Mod-Alt-9",[M.vO.ClearFormatting]:"Mod-\\",[M.vO.IncreaseIndent]:"Mod-[",[M.vO.DecreaseIndent]:"Mod-]"},eH={default:eR,googleDoc:eN},e_=class extends es{get name(){return"nodeViews"}createPlugin(){let e=[],t=(0,b.Ry)();for(let s of this.store.extensions){if(!s.createNodeViews)continue;let r=s.createNodeViews();e.unshift((0,b.mf)(r)?{[s.name]:r}:r)}for(let n of(e.unshift(this.store.managerSettings.nodeViews??{}),e))Object.assign(t,n);return{props:{nodeViews:t}}}},eK=class extends es{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;let s=[];for(let r of this.store.extensions){if((null==(e=this.store.managerSettings.exclude)?void 0:e.pasteRules)||!r.createPasteRules||(null==(t=r.options.exclude)?void 0:t.pasteRules))continue;let n=r.createPasteRules(),i=(0,b.kJ)(n)?n:[n];s.push(...i)}return(0,I.N)(s)}},eD=class extends es{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=(0,b.Ry)(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{let t=this.stateGetters.get(e);return(0,b.kG)(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){let{setStoreKey:e,setExtensionStore:t,managerSettings:s,extensions:r}=this.store;this.updateExtensionStore();let{plugins:n=[]}=s;for(let i of(this.updatePlugins(n,this.managerPlugins),r))i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=n,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,s)=>{let r=s.tr,n={previousState:t,tr:r,transactions:e,state:s};for(let i of this.appendTransactionHandlers)i(n);return this.options.appendTransaction(n),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(let s of this.initStateHandlers)s(t)},apply:(e,t,s,r)=>{let n={previousState:s,state:r,tr:e};for(let i of this.applyStateHandlers)i(n);this.options.applyState(n)}}}}extractExtensionPlugins(e){var t,s;let r=!e.createPlugin&&!e.createExternalPlugins;if(!r&&(null==(t=this.store.managerSettings.exclude)||!t.plugins)&&(null==(s=e.options.exclude)||!s.plugins)){if(e.createPlugin){let n=new R.H$(e.name);this.pluginKeys[e.name]=n;let i=this.getPluginStateCreator(n);e.pluginKey=n,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);let o={...e.createPlugin(),key:n},a=new R.Sy(o);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){let l=e.createExternalPlugins();this.updatePlugins(l,e.externalPlugins),e.externalPlugins=l}}}updatePlugins(e,t){if(!t||(0,b.yD)(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(e=>!t.includes(e)),...e];return}let s=new Map;for(let[r,n]of e.entries())s.set((0,b.fp)(t,r),n);this.plugins=this.plugins.map(e=>t.includes(e)?s.get(e):e)}updateExtensionStore(){let{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){var t;let s=eo(e)?e:(0,O.gf)(e)&&(0,O.pI)(e,[M.lk.PlainExtensionConstructor,M.lk.MarkExtensionConstructor,M.lk.NodeExtensionConstructor])?this.store.manager.getExtension(e):this.store.extensions.find(t=>t.name===e);(0,b.kG)(s,{code:M.mA.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(s),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){(0,b.kG)(this.store.phase>=M.RC.EditorView,{code:M.mA.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});let{view:e,updateState:t}=this.store,s=e.state.reconfigure({plugins:this.plugins});t(s)}};eD=W([eu({defaultPriority:M.xV.Highest,handlerKeys:["applyState","appendTransaction"]})],eD);var eI=class extends es{constructor(){super(...arguments),this.dynamicAttributes={marks:(0,b.Ry)(),nodes:(0,b.Ry)()}}get name(){return"schema"}onCreate(){var e;let{managerSettings:t,tags:s,markNames:r,nodeNames:n,extensions:i}=this.store,{defaultBlockNode:o,disableExtraAttributes:a,nodeOverride:l,markOverride:d}=t;if(t.schema){let{nodes:u,marks:h}=function(e){let t=(0,b.Ry)(),s=(0,b.Ry)();for(let[r,n]of Object.entries(e.nodes))t[r]=n.spec;for(let[i,o]of Object.entries(e.marks))s[i]=o.spec;return{nodes:t,marks:s}}(t.schema);this.addSchema(t.schema,u,h);return}let c=o&&s[M.eX.Block].includes(o)?{doc:(0,b.Ry)(),[o]:(0,b.Ry)()}:(0,b.Ry)(),p=(0,b.Ry)(),m=function(e){let{settings:t,gatheredSchemaAttributes:s,nodeNames:r,markNames:n,tags:i}=e,o=(0,b.Ry)();if(t.disableExtraAttributes)return o;let a=[...s,...t.extraAttributes??[]];for(let l of a??[]){let d=eL({identifiers:l.identifiers,nodeNames:r,markNames:n,tags:i});for(let u of d){let h=o[u]??{};o[u]={...h,...l.attributes}}}return o}({settings:t,gatheredSchemaAttributes:this.gatherExtraAttributes(i),nodeNames:n,markNames:r,tags:s});for(let g of i){m[g.name]={...m[g.name],...g.options.extraAttributes};let f=!0===a||!0===g.options.disableExtraAttributes||!0===g.constructor.disableExtraAttributes;if(el(g)){let{spec:y,dynamic:v}=eV({createExtensionSpec:(e,t)=>g.createNodeSpec(e,t),extraAttributes:(0,b.fp)(m,g.name),override:{...l,...g.options.nodeOverride},ignoreExtraAttributes:f,name:g.constructorName,tags:g.tags});g.spec=y,c[g.name]=y,Object.keys(v).length>0&&(this.dynamicAttributes.nodes[g.name]=v)}if(ed(g)){let{spec:S,dynamic:x}=eV({createExtensionSpec:(e,t)=>g.createMarkSpec(e,t),extraAttributes:(0,b.fp)(m,g.name),override:{...d,...g.options.markOverride},ignoreExtraAttributes:f,name:g.constructorName,tags:g.tags??[]});g.spec=S,p[g.name]=S,Object.keys(x).length>0&&(this.dynamicAttributes.marks[g.name]=x)}}let k=new T.V_({nodes:c,marks:p,topNode:"doc"});this.addSchema(k,c,p)}createPlugin(){return{appendTransaction:(e,t,s)=>{let{tr:r}=s,n=e.some(e=>e.docChanged);return n&&(0!==Object.keys(this.dynamicAttributes.nodes).length||0!==Object.keys(this.dynamicAttributes.marks).length)?(r.doc.descendants((e,t)=>(this.checkAndUpdateDynamicNodes(e,t,r),this.checkAndUpdateDynamicMarks(e,t,r),!0)),r.steps.length>0?r:null):null}}}addSchema(e,t,s){for(let r of(this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",s),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",(0,O.JN)(e).name),Object.values(e.nodes)))if("doc"!==r.name&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,s){for(let[r,n]of(0,b.qh)(this.dynamicAttributes.nodes))if(e.type.name===r)for(let[i,o]of(0,b.qh)(n)){if(!(0,b.le)(e.attrs[i]))continue;let a={...e.attrs,[i]:o(e)};s.setNodeMarkup(t,void 0,a),(0,L.gn)(s)}}checkAndUpdateDynamicMarks(e,t,s){for(let[r,n]of(0,b.qh)(this.dynamicAttributes.marks)){let i=(0,b.fp)(this.store.schema.marks,r),o=e.marks.find(e=>e.type.name===r);if(o)for(let[a,l]of(0,b.qh)(n)){if(!(0,b.le)(o.attrs[a]))continue;let d=(0,O.IH)(s.doc.resolve(t),i);if(!d)continue;let{from:u,to:h}=d,c=i.create({...o.attrs,[a]:l(o)});s.removeMark(u,h,i).addMark(u,h,c),(0,L.gn)(s)}}}gatherExtraAttributes(e){let t=[];for(let s of e)s.createSchemaAttributes&&t.push(...s.createSchemaAttributes());return t}};function eL(e){var t;let{identifiers:s,nodeNames:r,markNames:n,tags:i}=e;if("nodes"===s)return r;if("marks"===s)return n;if("all"===s)return[...r,...n];if((0,b.kJ)(s))return s;(0,b.kG)((0,b.PO)(s)&&(0,b.kJ)(s.tags),{code:M.mA.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});let{tags:o=[],names:a=[],behavior:l="any",excludeNames:d,excludeTags:u,type:h}=s,c=new Set,p="mark"===h?n:"node"===h?r:[...n,...r],m=e=>p.includes(e)&&!(null==d?void 0:d.includes(e));for(let g of a)m(g)&&c.add(g);let f=new Map;for(let y of o)if(null==u||!u.includes(y))for(let v of i[y]){if(!m(v))continue;if("any"===l){c.add(v);continue}let S=f.get(v)??new Set;S.add(y),f.set(v,S)}for(let[x,k]of f)k.size===o.length&&c.add(x);return[...c]}function eV(e){var t,s,r,n,i,o,a,l,d;let{createExtensionSpec:u,extraAttributes:h,ignoreExtraAttributes:c,name:p,tags:m,override:g}=e,f=(0,b.Ry)();function y(e,t){f[e]=t}let v=!1,S=(s=h,r=c,n=function(){v=!0},i=y,()=>{n();let e=(0,b.Ry)();if(r)return e;for(let[t,o]of(0,b.qh)(s)){let a=eB(o),l=a.default;(0,b.mf)(l)&&(i(t,l),l=null),e[t]=void 0===l?{}:{default:l}}return e}),x=(o=h,a=c,e=>{let t=(0,b.Ry)();if(a)return t;for(let[s,r]of(0,b.qh)(o)){let{parseDOM:n,...i}=eB(r);if((0,O.jd)(e)){if((0,b.le)(n)){t[s]=e.getAttribute(s)??i.default;continue}if((0,b.mf)(n)){t[s]=n(e)??i.default;continue}t[s]=e.getAttribute(n)??i.default}}return t}),k=(l=h,d=c,e=>{let t=(0,b.Ry)();if(d)return t;function s(s,r){if(s){if((0,b.HD)(s)){t[r]=s;return}if((0,b.kJ)(s)){let[n,i]=s;t[n]=i??e.attrs[r];return}for(let[o,a]of(0,b.qh)(s))t[o]=a}}for(let[r,n]of(0,b.qh)(l)){let{toDOM:i,parseDOM:o}=eB(n);if((0,b.le)(i)){let a=(0,b.HD)(o)?o:r;t[a]=e.attrs[r];continue}if((0,b.mf)(i)){s(i(e.attrs,eF(e)),r);continue}s(i,r)}return t}),E=u({defaults:S,parse:x,dom:k},g);return(0,b.kG)(c||v,{code:M.mA.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${p}' to 'true'.`}),E.group=[...(null==(t=E.group)?void 0:t.split(" "))??[],...m].join(" ")||void 0,{spec:E,dynamic:f}}function eB(e){return(0,b.HD)(e)||(0,b.mf)(e)?{default:e}:((0,b.kG)(e,{message:`${(0,b.BB)(e)} is not supported`,code:M.mA.EXTENSION_EXTRA_ATTRIBUTES}),e)}function eF(e){return(0,O.PH)(e)?{node:e}:(0,O.K_)(e)?{mark:e}:{}}eI=W([eu({defaultPriority:M.xV.Highest})],eI);var eU=class extends es{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(e&&(null==(t=this.store.managerSettings.exclude)||!t.suggesters))return(0,L.Ek)(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>(0,L.Ek)(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>(0,L.C$)(this.store.getState(),e))}createExternalPlugins(){var e,t;let s=[];for(let r of this.store.extensions){if(null==(e=this.store.managerSettings.exclude)?void 0:e.suggesters)break;if(!r.createSuggesters||(null==(t=r.options.exclude)?void 0:t.suggesters))continue;let n=r.createSuggesters(),i=(0,b.kJ)(n)?n:[n];s.push(...i)}return[(0,L.D7)(...s)]}getSuggestState(e){return(0,L.hu)(e??this.store.getState())}getSuggestMethods(){let{addIgnored:e,clearIgnored:t,removeIgnored:s,ignoreNextExit:r,setMarkRemoved:n,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:s,ignoreNextExit:r,setMarkRemoved:n,findMatchAtPosition:i,findNextTextSelection:o,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return(0,b.q9)((0,b.kJ)(e)?e:[e],null==(t=this.getSuggestState().match)?void 0:t.suggester.name)}};W([ec()],eU.prototype,"getSuggestState",1),W([ec()],eU.prototype,"getSuggestMethods",1),W([ec()],eU.prototype,"isSuggesterActive",1),eU=W([eu({customHandlerKeys:["suggester"]})],eU);var eW=class extends es{constructor(){super(...arguments),this.allTags=(0,b.Ry)(),this.plainTags=(0,b.Ry)(),this.markTags=(0,b.Ry)(),this.nodeTags=(0,b.Ry)()}get name(){return"tags"}onCreate(){for(let e of(this.resetTags(),this.store.extensions))this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){let e=(0,b.Ry)(),t=(0,b.Ry)(),s=(0,b.Ry)(),r=(0,b.Ry)();for(let n of(0,b.VO)(M.eX))e[n]=[],t[n]=[],s[n]=[],r[n]=[];this.allTags=e,this.plainTags=t,this.markTags=s,this.nodeTags=r}updateTagForExtension(e){var t,s;let r=new Set([...e.tags??[],...(null==(t=e.createTags)?void 0:t.call(e))??[],...e.options.extraTags??[],...(null==(s=this.store.managerSettings.extraTags)?void 0:s[e.name])??[]]);for(let n of r)(0,b.kG)(eG(n),{code:M.mA.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[n].push(e.name),ea(e)&&this.plainTags[n].push(e.name),ed(e)&&this.markTags[n].push(e.name),el(e)&&this.nodeTags[n].push(e.name);e.tags=[...r]}};function eG(e){return(0,b.q9)((0,b.VO)(M.eX),e)}eW=W([eu({defaultPriority:M.xV.Highest})],eW);var ej=new R.H$("remirrorFilePlaceholderPlugin"),e$=class extends es{get name(){return"upload"}createExternalPlugins(){return[function(){let e=new R.Sy({key:ej,state:{init:()=>({set:_.EH.empty,payloads:new Map}),apply(t,{set:s,payloads:r}){s=s.map(t.mapping,t.doc);let n=t.getMeta(e);if(n){if(0===n.type){let i=document.createElement("placeholder"),o=_.p.widget(n.pos,i,{id:n.id});s=s.add(t.doc,[o]),r.set(n.id,n.payload)}else 1===n.type&&(s=s.remove(s.find(void 0,void 0,e=>e.id===n.id)),r.delete(n.id))}return{set:s,payloads:r}}},props:{decorations(t){var s;return(null==(s=e.getState(t))?void 0:s.set)??null}}});return e}()]}},eq=class extends es{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),this.options.capture)for(let e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){let t=e.decoratedCommands??{},s=e.createCommands;for(let r of Object.keys(t)){let n=e[r];e[r]=(...t)=>s=>{var i;let o=n(...t)(s);return s.dispatch&&o&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==(null==(i=s.view)?void 0:i.dispatch),name:r,extension:e.name,decorated:!0}),o}}s&&(e.createCommands=()=>{let t=s();for(let[r,n]of Object.entries(t))t[r]=(...t)=>s=>{var i;let o=n(...t)(s);return s.dispatch&&o&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==(null==(i=s.view)?void 0:i.dispatch),name:r,extension:e.name,decorated:!1}),o};return t})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){let s=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...s,t])}};eq=W([eu({defaultOptions:{capture:O.NZ.isDevelopment},staticKeys:["capture"],defaultPriority:M.xV.Highest})],eq);var eJ=class{constructor(e){$(this,r,(0,b.EL)()),$(this,n,void 0),$(this,i,void 0),$(this,o,!0),$(this,a,(0,V.i)()),$(this,l,void 0),$(this,d,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=e=>{var t,s;(0,b.kG)(!this.manager.destroyed,{code:M.mA.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),e=(null==(s=(t=this.props).onDispatchTransaction)?void 0:s.call(t,e,this.getState()))??e;let r=this.getState(),{state:n,transactions:o}=r.applyTransaction(e);q(this,i,r),this.updateState({state:n,tr:e,transactions:o});let a=this.manager.store.getForcedUpdates(e);(0,b.yD)(a)||this.updateViewProps(...a)},this.onChange=(e=(0,b.Ry)())=>{var t,s;let r=this.eventListenerProps(e);j(this,o)&&q(this,o,!1),null==(s=(t=this.props).onChange)||s.call(t,r)},this.onBlur=e=>{var t,s;let r=this.eventListenerProps();null==(s=(t=this.props).onBlur)||s.call(t,r,e),j(this,a).emit("blur",r,e)},this.onFocus=e=>{var t,s;let r=this.eventListenerProps();null==(s=(t=this.props).onFocus)||s.call(t,r,e),j(this,a).emit("focus",r,e)},this.setContent=(e,{triggerChange:t=!1}={})=>{let{doc:s}=this.manager.createState({content:e}),r=this.getState(),{state:n}=this.getState().applyTransaction(r.tr.replaceRangeWith(0,r.doc.nodeSize-2,s));if(t)return this.updateState({state:n,triggerChange:t});this.view.updateState(n)},this.clearContent=({triggerChange:e=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:e})},this.createStateFromContent=(e,t)=>this.manager.createState({content:e,selection:t}),this.focus=e=>{this.manager.store.commands.focus(e)},this.blur=e=>{this.manager.store.commands.blur(e)};let{getProps:t,initialEditorState:s,element:u}=e;if(q(this,n,t),q(this,d,s),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;let h=this.createView(s,u);this.manager.addView(h)}get addHandler(){return j(this,l)??q(this,l,j(this,a).on.bind(j(this,a)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return j(this,o)}get props(){return j(this,n).call(this)}get previousState(){return this.previousStateOverride??j(this,i)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return j(this,r)}get initialEditorState(){return j(this,d)}updateListener(e){let{state:t,tr:s}=e;return j(this,a).emit("updated",this.eventListenerProps({state:t,tr:s}))}update(e){let{getProps:t}=e;return q(this,n,t),this}updateViewProps(...e){let t=P(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;let{attributes:s,autoFocus:r,classNames:n=[],label:i,editable:o}=this.props,a=null==(t=this.manager.store)?void 0:t.attributes,l=(0,b.mf)(s)?s(this.eventListenerProps()):s,d={};(r||(0,b.hj)(r))&&(d=e?{autoFocus:!0}:{autofocus:"true"});let u=(0,b.Nb)((0,b.cx)(e&&"Prosemirror","remirror-editor",null==a?void 0:a.class,...n).split(" ")).join(" "),h={role:"textbox",...d,"aria-multiline":"true",...o??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return(0,b.Yc)({...h,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){j(this,a).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=(0,b.Ry)()){let{state:t,tr:s,transactions:r}=e;return{tr:s,transactions:r,internalUpdate:!s,view:this.view,firstRender:j(this,o),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:j(this,r),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};function eX(e,t){var s;let{gatheredExtensions:r,duplicateMap:n,parentExtensions:i,settings:o}=e,{extension:a,parentExtension:l}=t,{names:d=[]}=t;(0,b.kG)(eo(a),{code:M.mA.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});let u=a.extensions;if(a.setPriority(null==(s=o.priority)?void 0:s[a.name]),r.push(a),function(e){let{duplicateMap:t,extension:s,parentExtension:r}=e,n=s.constructor,i=t.get(n),o=r?[r]:[];t.set(n,i?[...i,...o]:o)}({duplicateMap:n,extension:a,parentExtension:l}),0!==u.length){if(d.includes(a.name)){(0,B.Z)(!1,`Circular dependency encountered when loading extensions: ${d.join(" > ")} > ${a.name}`);return}for(let h of(d=[...d,a.name],i.push(a),u))eX(e,{names:d,extension:h,parentExtension:a})}}function ez(e){let{extension:t,found:s,missing:r}=e;if(t.requiredExtensions)for(let n of t.requiredExtensions??[])!s.has(n)&&r.push({Constructor:n,extension:t})}function eQ(e){var t,s,r,n;let{extension:i,nodeNames:o,markNames:a,plainNames:l,store:d,handlers:u}=e;i.setStore(d);let h=null==(t=i.onCreate)?void 0:t.bind(i),c=null==(s=i.onView)?void 0:s.bind(i),p=null==(r=i.onStateUpdate)?void 0:r.bind(i),m=null==(n=i.onDestroy)?void 0:n.bind(i);h&&u.create.push(h),c&&u.view.push(c),p&&u.update.push(p),m&&u.destroy.push(m),ed(i)&&a.push(i.name),el(i)&&"doc"!==i.name&&o.push(i.name),ea(i)&&l.push(i.name)}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,l=new WeakMap,d=new WeakMap;var eY=class{constructor(e,t={}){$(this,u,void 0),$(this,h,(0,b.Ry)()),$(this,c,(0,b.Ry)()),$(this,p,void 0),$(this,m,void 0),$(this,g,M.RC.None),$(this,f,void 0),$(this,y,!0),$(this,v,{create:[],view:[],update:[],destroy:[]}),$(this,S,[]),$(this,x,(0,V.i)()),$(this,k,void 0),$(this,E,void 0),this.getState=()=>{var e;return j(this,g)>=M.RC.EditorView?this.view.state:((0,b.kG)(j(this,k),{code:M.mA.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),null==(e=j(this,k))?void 0:e.initialEditorState)},this.updateState=e=>{let t=this.getState();this.view.updateState(e),this.onStateUpdate({previousState:t,state:e})};let{extensions:s,extensionMap:r}=function(e,t){let s=[],r=new WeakMap,n=[],i=new WeakMap,o=[],a={duplicateMap:i,parentExtensions:n,gatheredExtensions:o,settings:t};for(let l of e)eX(a,{extension:l});o=(0,b.DY)(o,(e,t)=>t.priority-e.priority);let d=new WeakSet,u=new Set;for(let h of o){let c=h.constructor,p=h.name,m=i.get(c);(0,b.kG)(m,{message:`No entries were found for the ExtensionConstructor ${h.name}`,code:M.mA.INTERNAL}),!(d.has(c)||u.has(p))&&(d.add(c),u.add(p),s.push(h),r.set(c,h),m.forEach(e=>null==e?void 0:e.replaceChildExtension(c,h)))}let g=[];for(let f of s)ez({extension:f,found:d,missing:g});return(0,b.kG)((0,b.yD)(g),{code:M.mA.MISSING_REQUIRED_EXTENSION,message:g.map(({Constructor:e,extension:t})=>`The extension '${t.name}' requires '${e.name} in order to run correctly.`).join("\n")}),{extensions:s,extensionMap:r}}(e,t);for(let n of(q(this,f,t),q(this,p,(0,b.vV)(s)),q(this,m,r),q(this,u,this.createExtensionStore()),q(this,g,M.RC.Create),this.setupLifecycleHandlers(),j(this,v).create)){let i=n();i&&j(this,S).push(i)}}static create(e,t={}){return new eY([...(0,b.r2)(e),...function(e={}){let t={exitMarksOnArrowPress:eA.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:eA.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:eA.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:eA.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:ex.defaultOptions.persistentSelectionClass};e={...t,...e};let s=P(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=P(e,["persistentSelectionClass"]);return[new eW,new eI,new eh,new eD,new eO,new eK,new e_,new eU,new ey,new ew,new eA(s),new eM,new e$,new ex(r)]}(t.builtin)],t)}get[M.By](){return M.lk.Manager}get destroyed(){return j(this,g)===M.RC.Destroy}get mounted(){return j(this,g)>=M.RC.EditorView&&j(this,g)<M.RC.Destroy}get output(){var e;return null==(e=j(this,k))?void 0:e.frameworkOutput}get frameworkAttached(){return!!j(this,k)}get extensions(){return j(this,p)}get stringHandlers(){return j(this,h)}get store(){return(0,b.vV)(j(this,c))}get extensionStore(){return(0,b.vV)(j(this,u))}get tr(){return this.getExtension(ey).transaction}get nodes(){return j(this,c).nodes}get marks(){return j(this,c).marks}get schema(){return j(this,c).schema}get extensionTags(){return j(this,c).tags}get view(){return j(this,c).view}get settings(){return j(this,f)}get document(){return j(this,f).document??(0,O.Me)()}setupLifecycleHandlers(){let e=j(this,u),t=j(this,v),s=[],r=[],n=[];for(let i of(e.nodeNames=s,e.markNames=r,e.plainNames=n,j(this,p)))eQ({extension:i,nodeNames:s,markNames:r,plainNames:n,handlers:t,store:e})}setStringHandler(e,t){j(this,h)[e]=t}setStoreKey(e,t){j(this,c)[e]=t}getStoreKey(e){let t=j(this,c)[e];return(0,b.kG)(!(0,b.le)(t),{code:M.mA.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){(0,b.kG)(j(this,g)<=M.RC.EditorView,{code:M.mA.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),j(this,u)[e]=t}createExtensionStore(){let e=(0,b.Ry)(),t,s;return Object.defineProperties(e,{extensions:{get:()=>j(this,p),enumerable:!0},phase:{get:()=>j(this,g),enumerable:!0},view:{get:()=>this.view,enumerable:!0},managerSettings:{get:()=>(0,b.vV)(j(this,f)),enumerable:!0},getState:{value:this.getState,enumerable:!0},updateState:{value:this.updateState,enumerable:!0},isMounted:{value:()=>this.mounted,enumerable:!0},getExtension:{value:this.getExtension.bind(this),enumerable:!0},manager:{get:()=>this,enumerable:!0},document:{get:()=>this.document,enumerable:!0},stringHandlers:{get:()=>j(this,h),enumerable:!0},currentState:{get:()=>t??(t=this.getState()),set(e){t=e},enumerable:!0},previousState:{get:()=>s,set(e){s=e},enumerable:!0}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(j(this,g)>=M.RC.EditorView)return this;for(let t of(q(this,y,!0),q(this,g,M.RC.EditorView),j(this,c).view=e,j(this,v).view)){let s=t(e);s&&j(this,S).push(s)}return this}attachFramework(e,t){var s;j(this,k)!==e&&(j(this,k)&&(j(this,k).destroy(),null==(s=j(this,E))||s.call(this)),q(this,k,e),q(this,E,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;let t=null==(e=this.schema.nodes.doc)?void 0:e.createAndFill();return(0,b.kG)(t,{code:M.mA.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){let{onError:t,defaultSelection:s="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:n=s,stringHandler:i=this.settings.stringHandler}=e,{schema:o,plugins:a}=this.store,l=(0,O.EP)({stringHandler:(0,b.HD)(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:o,selection:n});return R.yy.create({schema:o,doc:l,plugins:a,selection:(0,O.b0)(n,l)})}addHandler(e,t){return j(this,x).on(e,t)}onStateUpdate(e){let t=j(this,y);j(this,u).currentState=e.state,j(this,u).previousState=e.previousState,t&&(q(this,g,M.RC.Runtime),q(this,y,!1));let s={...e,firstUpdate:t};for(let r of j(this,v).update)r(s);j(this,x).emit("stateUpdate",s)}getExtension(e){let t=j(this,m).get(e);return(0,b.kG)(t,{code:M.mA.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){let t=j(this,m).get(e);return!!t}clone(){let e=j(this,p).map(e=>e.clone(e.options)),t=eY.create(()=>e,j(this,f));return j(this,x).emit("clone",t),t}recreate(e=[],t={}){let s=j(this,p).map(e=>e.clone(e.initialOptions)),r=eY.create(()=>[...s,...e],t);return j(this,x).emit("recreate",r),r}destroy(){var e,t,s,r,n,i;for(let o of(q(this,g,M.RC.Destroy),(null==(e=this.view)?void 0:e.state.plugins)??[]))null==(s=null==(t=o.getState(this.view.state))?void 0:t.destroy)||s.call(t);for(let a of(null==(r=j(this,k))||r.destroy(),null==(n=j(this,E))||n.call(this),j(this,S)))a();for(let l of j(this,v).destroy)l();null==(i=this.view)||i.destroy(),j(this,x).emit("destroy")}includes(e){let t=[],s=[];for(let r of j(this,p))t.push(r.name,r.constructorName),s.push(r.constructor);return e.every(e=>(0,b.HD)(e)?(0,b.q9)(t,e):(0,b.q9)(s,e))}},eZ=eY;function e0(e,t){return!!((0,O.gf)(e)&&(0,O.pI)(e,M.lk.Manager))&&(!t||e.includes(t))}u=new WeakMap,h=new WeakMap,c=new WeakMap,p=new WeakMap,m=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,v=new WeakMap,S=new WeakMap,x=new WeakMap,k=new WeakMap,E=new WeakMap}}]);