/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@udecode/plate-utils@49.0.0/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of __getOwnPropNames(t))__hasOwnProp.call(e,o)||o===r||__defProp(e,o,{get:()=>t[o],enumerable:!(n=__getOwnPropDesc(t,o))||n.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),index_exports={};__export(index_exports,{ExitBreakPlugin:()=>ExitBreakPlugin,KEYS:()=>KEYS,NODES:()=>NODES,NormalizeTypesPlugin:()=>NormalizeTypesPlugin,STYLE_KEYS:()=>STYLE_KEYS,SingleBlockPlugin:()=>SingleBlockPlugin,SingleLinePlugin:()=>SingleLinePlugin,TrailingBlockPlugin:()=>TrailingBlockPlugin,withNormalizeTypes:()=>withNormalizeTypes,withTrailingBlock:()=>withTrailingBlock}),module.exports=__toCommonJS(index_exports);var NODES={a:"a",ai:"ai",aiChat:"aiChat",audio:"audio",blockquote:"blockquote",bold:"bold",callout:"callout",code:"code",codeBlock:"code_block",codeLine:"code_line",codeSyntax:"code_syntax",column:"column",columnGroup:"column_group",comment:"comment",date:"date",emojiInput:"emoji_input",equation:"equation",excalidraw:"excalidraw",file:"file",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",highlight:"highlight",hr:"hr",img:"img",inlineEquation:"inline_equation",italic:"italic",kbd:"kbd",li:"li",lic:"lic",link:"a",listTodoClassic:"action_item",mediaEmbed:"media_embed",mention:"mention",mentionInput:"mention_input",olClassic:"ol",p:"p",searchHighlight:"search_highlight",slashInput:"slash_input",strikethrough:"strikethrough",sub:"subscript",suggestion:"suggestion",sup:"superscript",table:"table",tag:"tag",td:"td",th:"th",toc:"toc",toggle:"toggle",tr:"tr",ulClassic:"ul",underline:"underline",video:"video"},STYLE_KEYS={backgroundColor:"backgroundColor",color:"color",fontFamily:"fontFamily",fontSize:"fontSize",fontWeight:"fontWeight",indent:"indent",lineHeight:"lineHeight",listType:"listStyleType",textAlign:"textAlign",textIndent:"textIndent"},KEYS={...NODES,...STYLE_KEYS,autoformat:"autoformat",blockMenu:"blockMenu",blockPlaceholder:"blockPlaceholder",blockSelection:"blockSelection",caption:"caption",copilot:"copilot",csv:"csv",cursorOverlay:"cursorOverlay",delete:"delete",dnd:"dnd",docx:"docx",emoji:"emoji",exitBreak:"exitBreak",heading:["h1","h2","h3","h4","h5","h6"],html:"html",juice:"juice",list:"list",listChecked:"checked",listClassic:"listClassic",listRestart:"listRestart",listRestartPolite:"listRestartPolite",listStart:"listStart",listTodo:"todo",markdown:"markdown",nodeId:"nodeId",normalizeTypes:"normalizeTypes",ol:"decimal",placeholder:"placeholder",playwright:"playwright",removeEmptyNodes:"removeEmptyNodes",resetNode:"resetNode",singleBlock:"singleBlock",singleLine:"singleLine",slashCommand:"slash_command",softBreak:"softBreak",tabbable:"tabbable",trailingBlock:"trailingBlock",ul:"disc",yjs:"yjs"},import_plate_core=require("@udecode/plate-core"),ExitBreakPlugin=(0,import_plate_core.createSlatePlugin)({key:KEYS.exitBreak,editOnly:!0}).extendTransforms((({editor:e})=>({insert:t=>e.tf.insertExitBreak(t),insertBefore:t=>e.tf.insertExitBreak({...t,reverse:!0})}))),import_plate_core2=require("@udecode/plate-core"),import_slate=require("@udecode/slate"),withNormalizeTypes=({editor:e,getOptions:t,tf:{normalizeNode:r}})=>({transforms:{normalizeNode([n,o]){const{rules:i,onError:a}=t();if(0===o.length){if(i.some((({path:t,strictType:r,type:n})=>{const o=import_slate.NodeApi.get(e,t);if(o){if(r&&import_slate.ElementApi.isElement(o)&&o.type!==r){const{children:n,...o}=e.api.create.block({type:r});return e.tf.setNodes(o,{at:t}),!0}}else try{return e.tf.insertNodes(e.api.create.block({type:r??n}),{at:t}),!0}catch(e){a?.(e)}return!1})))return}return r([n,o])}}}),NormalizeTypesPlugin=(0,import_plate_core2.createTSlatePlugin)({key:KEYS.normalizeTypes,options:{rules:[]}}).overrideEditor(withNormalizeTypes),import_plate_core3=require("@udecode/plate-core"),SingleBlockPlugin=(0,import_plate_core3.createSlatePlugin)({key:KEYS.singleBlock,override:{enabled:{[KEYS.trailingBlock]:!1}}}).overrideEditor((({editor:e,tf:{normalizeNode:t}})=>({transforms:{insertBreak(){e.tf.insertSoftBreak()},normalizeNode(r){const[n,o]=r;0===o.length&&e.children.length>1?e.tf.withoutNormalizing((()=>{for(;e.children.length>1;)e.tf.insertText("\n",{at:e.api.start([1])}),e.tf.mergeNodes({at:[1],match:(e,t)=>1===t.length})})):t(r)}}}))),import_plate_core4=require("@udecode/plate-core");function isObject(e){return"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject(e){var t,r;return!1!==isObject(e)&&(void 0===(t=e.constructor)||!1!==isObject(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}var NOTHING=Symbol.for("immer-nothing"),DRAFTABLE=Symbol.for("immer-draftable"),DRAFT_STATE=Symbol.for("immer-state"),errors="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function die(e,...t){if("production"!==process.env.NODE_ENV){const r=errors[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf=Object.getPrototypeOf;function isDraft(e){return!!e&&!!e[DRAFT_STATE]}function isDraftable(e){return!!e&&(isPlainObject2(e)||Array.isArray(e)||!!e[DRAFTABLE]||!!e.constructor?.[DRAFTABLE]||isMap(e)||isSet(e))}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject2(e){if(!e||"object"!=typeof e)return!1;const t=getPrototypeOf(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===objectCtorString}function each(e,t){0===getArchtype(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function getArchtype(e){const t=e[DRAFT_STATE];return t?t.type_:Array.isArray(e)?1:isMap(e)?2:isSet(e)?3:0}function has(e,t){return 2===getArchtype(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function set(e,t,r){const n=getArchtype(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function is(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function isMap(e){return e instanceof Map}function isSet(e){return e instanceof Set}function latest(e){return e.copy_||e.base_}function shallowCopy(e,t){if(isMap(e))return new Map(e);if(isSet(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=isPlainObject2(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[DRAFT_STATE];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(getPrototypeOf(e),t)}{const t=getPrototypeOf(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function freeze(e,t=!1){return isFrozen(e)||isDraft(e)||!isDraftable(e)||(getArchtype(e)>1&&(e.set=e.add=e.clear=e.delete=dontMutateFrozenCollections),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>freeze(t,!0)))),e}function dontMutateFrozenCollections(){die(2)}function isFrozen(e){return Object.isFrozen(e)}var currentScope,plugins={};function getPlugin(e){const t=plugins[e];return t||die(0,e),t}function getCurrentScope(){return currentScope}function createScope(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(e,t){t&&(getPlugin("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function revokeScope(e){leaveScope(e),e.drafts_.forEach(revokeDraft),e.drafts_=null}function leaveScope(e){e===currentScope&&(currentScope=e.parent_)}function enterScope(e){return currentScope=createScope(currentScope,e)}function revokeDraft(e){const t=e[DRAFT_STATE];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function processResult(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[DRAFT_STATE].modified_&&(revokeScope(t),die(4)),isDraftable(e)&&(e=finalize(t,e),t.parent_||maybeFreeze(t,e)),t.patches_&&getPlugin("Patches").generateReplacementPatches_(r[DRAFT_STATE].base_,e,t.patches_,t.inversePatches_)):e=finalize(t,r,[]),revokeScope(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==NOTHING?e:void 0}function finalize(e,t,r){if(isFrozen(t))return t;const n=t[DRAFT_STATE];if(!n)return each(t,((o,i)=>finalizeProperty(e,n,t,o,i,r))),t;if(n.scope_!==e)return t;if(!n.modified_)return maybeFreeze(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let o=t,i=!1;3===n.type_&&(o=new Set(t),t.clear(),i=!0),each(o,((o,a)=>finalizeProperty(e,n,t,o,a,r,i))),maybeFreeze(e,t,!1),r&&e.patches_&&getPlugin("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function finalizeProperty(e,t,r,n,o,i,a){if("production"!==process.env.NODE_ENV&&o===r&&die(5),isDraft(o)){const a=finalize(e,o,i&&t&&3!==t.type_&&!has(t.assigned_,n)?i.concat(n):void 0);if(set(r,n,a),!isDraft(a))return;e.canAutoFreeze_=!1}else a&&r.add(o);if(isDraftable(o)&&!isFrozen(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;finalize(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(r,n)||maybeFreeze(e,o)}}function maybeFreeze(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&freeze(t,r)}function createProxyProxy(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=objectTraps;r&&(o=[n],i=arrayTraps);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,s}var objectTraps={get(e,t){if(t===DRAFT_STATE)return e;const r=latest(e);if(!has(r,t))return readPropFromProto(e,r,t);const n=r[t];return e.finalized_||!isDraftable(n)?n:n===peek(e.base_,t)?(prepareCopy(e),e.copy_[t]=createProxy(n,e)):n},has:(e,t)=>t in latest(e),ownKeys:e=>Reflect.ownKeys(latest(e)),set(e,t,r){const n=getDescriptorFromProto(latest(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=peek(latest(e),t),o=n?.[DRAFT_STATE];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(is(r,n)&&(void 0!==r||has(e.base_,t)))return!0;prepareCopy(e),markChanged(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==peek(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,prepareCopy(e),markChanged(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=latest(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){die(11)},getPrototypeOf:e=>getPrototypeOf(e.base_),setPrototypeOf(){die(12)}},arrayTraps={};function peek(e,t){const r=e[DRAFT_STATE];return(r?latest(r):e)[t]}function readPropFromProto(e,t,r){const n=getDescriptorFromProto(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}function getDescriptorFromProto(e,t){if(!(t in e))return;let r=getPrototypeOf(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=getPrototypeOf(r)}}function markChanged(e){e.modified_||(e.modified_=!0,e.parent_&&markChanged(e.parent_))}function prepareCopy(e){e.copy_||(e.copy_=shallowCopy(e.base_,e.scope_.immer_.useStrictShallowCopy_))}each(objectTraps,((e,t)=>{arrayTraps[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),arrayTraps.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&die(13),arrayTraps.set.call(this,e,t,void 0)},arrayTraps.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&die(14),objectTraps.set.call(this,e[0],t,r,e[0])};var Immer2=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...o){return n.produce(e,(e=>t.call(this,e,...o)))}}let n;if("function"!=typeof t&&die(6),void 0!==r&&"function"!=typeof r&&die(7),isDraftable(e)){const o=enterScope(this),i=createProxy(e,void 0);let a=!0;try{n=t(i),a=!1}finally{a?revokeScope(o):leaveScope(o)}return usePatchesInScope(o,r),processResult(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===NOTHING&&(n=void 0),this.autoFreeze_&&freeze(n,!0),r){const t=[],o=[];getPlugin("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}die(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){isDraftable(e)||die(8),isDraft(e)&&(e=current(e));const t=enterScope(this),r=createProxy(e,void 0);return r[DRAFT_STATE].isManual_=!0,leaveScope(t),r}finishDraft(e,t){const r=e&&e[DRAFT_STATE];r&&r.isManual_||die(9);const{scope_:n}=r;return usePatchesInScope(n,t),processResult(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=getPlugin("Patches").applyPatches_;return isDraft(e)?n(e,t):this.produce(e,(e=>n(e,t)))}};function createProxy(e,t){const r=isMap(e)?getPlugin("MapSet").proxyMap_(e,t):isSet(e)?getPlugin("MapSet").proxySet_(e,t):createProxyProxy(e,t);return(t?t.scope_:getCurrentScope()).drafts_.push(r),r}function current(e){return isDraft(e)||die(10,e),currentImpl(e)}function currentImpl(e){if(!isDraftable(e)||isFrozen(e))return e;const t=e[DRAFT_STATE];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=shallowCopy(e,t.scope_.immer_.useStrictShallowCopy_)}else r=shallowCopy(e,!0);return each(r,((e,t)=>{set(r,e,currentImpl(t))})),t&&(t.finalized_=!1),r}var immer=new Immer2,produce=immer.produce,produceWithPatches=immer.produceWithPatches.bind(immer),setAutoFreeze=immer.setAutoFreeze.bind(immer),setUseStrictShallowCopy=immer.setUseStrictShallowCopy.bind(immer),applyPatches=immer.applyPatches.bind(immer),createDraft=immer.createDraft.bind(immer),finishDraft=immer.finishDraft.bind(immer),Path={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=Path.levels(e,t);return n=r?n.slice(1):n.slice(0,-1)},common(e,t){for(var r=[],n=0;n<e.length&&n<t.length;n++){var o=e[n];if(o!==t[n])break;r.push(o)}return r},compare(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return Path.equals(n,o)&&i>a},endsAt(e,t){var r=e.length,n=e.slice(0,r),o=t.slice(0,r);return Path.equals(n,o)},endsBefore(e,t){var r=e.length-1,n=e.slice(0,r),o=t.slice(0,r),i=e[r],a=t[r];return Path.equals(n,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Path.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Path.compare(e,t),isBefore:(e,t)=>-1===Path.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Path.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Path.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Path.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Path.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var r=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Path.equals(r,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,n=[],o=0;o<=e.length;o++)n.push(e.slice(0,o));return r&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Path.isAncestor(t,e)&&!Path.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:o="forward"}=r;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(Path.equals(i,n)||Path.endsBefore(i,n)||Path.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Path.equals(a,n)||Path.isAncestor(a,n))return null;Path.endsBefore(a,n)&&(n[a.length-1]-=1);break;case"merge_node":var{path:s,position:c}=t;Path.equals(s,n)||Path.endsBefore(s,n)?n[s.length-1]-=1:Path.isAncestor(s,n)&&(n[s.length-1]-=1,n[s.length]+=c);break;case"split_node":var{path:l,position:p}=t;if(Path.equals(l,n)){if("forward"===o)n[n.length-1]+=1;else if("backward"!==o)return null}else Path.endsBefore(l,n)?n[l.length-1]+=1:Path.isAncestor(l,n)&&e[l.length]>=p&&(n[l.length-1]+=1,n[l.length]-=p);break;case"move_node":var{path:f,newPath:d}=t;if(Path.equals(f,d))return n;if(Path.isAncestor(f,n)||Path.equals(f,n)){var u=d.slice();return Path.endsBefore(f,d)&&f.length<d.length&&(u[f.length-1]-=1),u.concat(n.slice(f.length))}Path.isSibling(f,d)&&(Path.isAncestor(d,n)||Path.equals(d,n))?Path.endsBefore(f,n)?n[f.length-1]-=1:n[f.length-1]+=1:Path.endsBefore(d,n)||Path.equals(d,n)||Path.isAncestor(d,n)?(Path.endsBefore(f,n)&&(n[f.length-1]-=1),n[d.length-1]+=1):Path.endsBefore(f,n)&&(Path.equals(d,n)&&(n[d.length-1]+=1),n[f.length-1]-=1)}return n}};function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys$e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$e(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$e(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var applyToDraft=(e,t,r)=>{switch(r.type){case"insert_node":var{path:n,node:o}=r,i=Node.parent(e,n),a=n[n.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,c]of Range.points(t))t[c]=Point.transform(s,r);break;case"insert_text":var{path:l,offset:p,text:f}=r;if(0===f.length)break;var d=Node.leaf(e,l),u=d.text.slice(0,p),h=d.text.slice(p);if(d.text=u+f+h,t)for(var[g,y]of Range.points(t))t[y]=Point.transform(g,r);break;case"merge_node":var{path:m}=r,b=Node.get(e,m),_=Path.previous(m),P=Node.get(e,_),v=Node.parent(e,m),S=m[m.length-1];if(Text.isText(b)&&Text.isText(P))P.text+=b.text;else{if(Text.isText(b)||Text.isText(P))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(m,"] to nodes of different interfaces: ").concat(Scrubber.stringify(b)," ").concat(Scrubber.stringify(P)));P.children.push(...b.children)}if(v.children.splice(S,1),t)for(var[w,O]of Range.points(t))t[O]=Point.transform(w,r);break;case"move_node":var{path:T,newPath:j}=r;if(Path.isAncestor(T,j))throw new Error("Cannot move a path [".concat(T,"] to new path [").concat(j,"] because the destination is inside itself."));var x=Node.get(e,T),E=Node.parent(e,T),N=T[T.length-1];E.children.splice(N,1);var k=Path.transform(T,r),D=Node.get(e,Path.parent(k)),C=k[k.length-1];if(D.children.splice(C,0,x),t)for(var[A,R]of Range.points(t))t[R]=Point.transform(A,r);break;case"remove_node":var{path:z}=r,$=z[z.length-1];if(Node.parent(e,z).children.splice($,1),t)for(var[B,F]of Range.points(t)){var I=Point.transform(B,r);if(null!=t&&null!=I)t[F]=I;else{var q=void 0,L=void 0;for(var[K,M]of Node.texts(e)){if(-1!==Path.compare(M,z)){L=[K,M];break}q=[K,M]}var W=!1;q&&L&&(W=Path.equals(L[1],z)?!Path.hasPrevious(L[1]):Path.common(q[1],z).length<Path.common(L[1],z).length),q&&!W?(B.path=q[1],B.offset=q[0].text.length):L?(B.path=L[1],B.offset=0):t=null}}break;case"remove_text":var{path:V,offset:Y,text:H}=r;if(0===H.length)break;var G=Node.leaf(e,V),J=G.text.slice(0,Y),U=G.text.slice(Y+H.length);if(G.text=J+U,t)for(var[Z,X]of Range.points(t))t[X]=Point.transform(Z,r);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=r;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var re=Node.get(e,Q);for(var ne in te){if("children"===ne||"text"===ne)throw new Error('Cannot set the "'.concat(ne,'" property of nodes!'));var oe=te[ne];null==oe?delete re[ne]:re[ne]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete re[ie];break;case"set_selection":var{newProperties:ae}=r;if(null==ae)t=ae;else{if(null==t){if(!Range.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Scrubber.stringify(ae)," when there is no current selection."));t=_objectSpread$e({},ae)}for(var se in ae){var ce=ae[se];if(null==ce){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=ce}}break;case"split_node":var{path:le,position:pe,properties:fe}=r;if(0===le.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(le,"] because the root node cannot be split."));var de,ue=Node.get(e,le),he=Node.parent(e,le),ge=le[le.length-1];if(Text.isText(ue)){var ye=ue.text.slice(0,pe),me=ue.text.slice(pe);ue.text=ye,de=_objectSpread$e(_objectSpread$e({},fe),{},{text:me})}else{var be=ue.children.slice(0,pe),_e=ue.children.slice(pe);ue.children=be,de=_objectSpread$e(_objectSpread$e({},fe),{},{children:_e})}if(he.children.splice(ge+1,0,de),t)for(var[Pe,ve]of Range.points(t))t[ve]=Point.transform(Pe,r)}return t},GeneralTransforms={transform(e,t){e.children=createDraft(e.children);var r=e.selection&&createDraft(e.selection);try{r=applyToDraft(e,r,t)}finally{e.children=finishDraft(e.children),e.selection=r?isDraft(r)?finishDraft(r):r:null}}},NodeTransforms={insertNodes(e,t,r){e.insertNodes(t,r)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,r){e.setNodes(t,r)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,r){e.unsetNodes(t,r)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,r){e.wrapNodes(t,r)}},SelectionTransforms={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,r){e.setPoint(t,r)},setSelection(e,t){e.setSelection(t)}},isDeepEqual=(e,t)=>{for(var r in e){var n=e[r],o=t[r];if(isPlainObject(n)&&isPlainObject(o)){if(!isDeepEqual(n,o))return!1}else if(Array.isArray(n)&&Array.isArray(o)){if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(n[i]!==o[i])return!1}else if(n!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var _excluded$4=["anchor","focus"];function ownKeys$d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$d(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Range={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:r=!1}=t,{anchor:n,focus:o}=e;return Range.isBackward(e)===r?[n,o]:[o,n]},end(e){var[,t]=Range.edges(e);return t},equals:(e,t)=>Point.equals(e.anchor,t.anchor)&&Point.equals(e.focus,t.focus),surrounds(e,t){var r=Range.intersection(e,t);return!!r&&Range.equals(r,t)},includes(e,t){if(Range.isRange(t)){if(Range.includes(e,t.anchor)||Range.includes(e,t.focus))return!0;var[r,n]=Range.edges(e),[o,i]=Range.edges(t);return Point.isBefore(r,o)&&Point.isAfter(n,i)}var[a,s]=Range.edges(e),c=!1,l=!1;return Point.isPoint(t)?(c=Point.compare(t,a)>=0,l=Point.compare(t,s)<=0):(c=Path.compare(t,a.path)>=0,l=Path.compare(t,s.path)<=0),c&&l},intersection(e,t){var r=_objectWithoutProperties(e,_excluded$4),[n,o]=Range.edges(e),[i,a]=Range.edges(t),s=Point.isBefore(n,i)?i:n,c=Point.isBefore(o,a)?o:a;return Point.isBefore(c,s)?null:_objectSpread$d({anchor:s,focus:c},r)},isBackward(e){var{anchor:t,focus:r}=e;return Point.isAfter(t,r)},isCollapsed(e){var{anchor:t,focus:r}=e;return Point.equals(t,r)},isExpanded:e=>!Range.isCollapsed(e),isForward:e=>!Range.isBackward(e),isRange:e=>isPlainObject(e)&&Point.isPoint(e.anchor)&&Point.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Range.edges(e);return t},transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return produce(e,(e=>{if(null===e)return null;var n,o,{affinity:i="inward"}=r;if("inward"===i){var a=Range.isCollapsed(e);Range.isForward(e)?(n="forward",o=a?n:"backward"):(n="backward",o=a?n:"forward")}else"outward"===i?Range.isForward(e)?(n="backward",o="forward"):(n="forward",o="backward"):(n=i,o=i);var s=Point.transform(e.anchor,t,{affinity:n}),c=Point.transform(e.focus,t,{affinity:o});if(!s||!c)return null;e.anchor=s,e.focus=c}))}},isElement=e=>isPlainObject(e)&&Node.isNodeList(e.children)&&!Editor.isEditor(e),Element={isAncestor:e=>isPlainObject(e)&&Node.isNodeList(e.children),isElement:isElement,isElementList:e=>Array.isArray(e)&&e.every((e=>Element.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return isElement(e)&&e[r]===t},matches(e,t){for(var r in t)if("children"!==r&&e[r]!==t[r])return!1;return!0}},_excluded$3=["children"],_excluded2$3=["text"],IS_NODE_LIST_CACHE=new WeakMap,Node={ancestor(e,t){var r=Node.get(e,t);if(Text.isText(r))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Scrubber.stringify(r)));return r},ancestors(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of Path.ancestors(t,r)){var o=[Node.ancestor(e,n),n];yield o}}()},child(e,t){if(Text.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Scrubber.stringify(e)));var r=e.children[t];if(null==r)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Scrubber.stringify(e)));return r},children(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=r,o=Node.ancestor(e,t),{children:i}=o,a=n?i.length-1:0;n?a>=0:a<i.length;){var s=Node.child(o,a),c=t.concat(a);yield[s,c],a=n?a-1:a+1}}()},common(e,t,r){var n=Path.common(t,r);return[Node.get(e,n),n]},descendant(e,t){var r=Node.get(e,t);if(Editor.isEditor(r))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Scrubber.stringify(r)));return r},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Node.nodes(e,t))0!==n.length&&(yield[r,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Node.nodes(e,t))Element.isElement(r)&&(yield[r,n])}()},extractProps:e=>Element.isAncestor(e)?_objectWithoutProperties(e,_excluded$3):_objectWithoutProperties(e,_excluded2$3),first(e,t){for(var r=t.slice(),n=Node.get(e,r);n&&!Text.isText(n)&&0!==n.children.length;)n=n.children[0],r.push(0);return[n,r]},fragment(e,t){if(Text.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Scrubber.stringify(e)));return produce({children:e.children},(e=>{var[r,n]=Range.edges(t),o=Node.nodes(e,{reverse:!0,pass:e=>{var[,r]=e;return!Range.includes(t,r)}});for(var[,i]of o){if(!Range.includes(t,i)){var a=Node.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Path.equals(i,n.path)){var c=Node.leaf(e,i);c.text=c.text.slice(0,n.offset)}if(Path.equals(i,r.path)){var l=Node.leaf(e,i);l.text=l.text.slice(r.offset)}}Editor.isEditor(e)&&(e.selection=null)})).children},get(e,t){var r=Node.getIf(e,t);if(void 0===r)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Scrubber.stringify(e)));return r},getIf(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Text.isText(r)||!r.children[o])return;r=r.children[o]}return r},has(e,t){for(var r=e,n=0;n<t.length;n++){var o=t[n];if(Text.isText(r)||!r.children[o])return!1;r=r.children[o]}return!0},isNode:e=>Text.isText(e)||Element.isElement(e)||Editor.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=IS_NODE_LIST_CACHE.get(e);if(void 0!==t)return t;var r=e.every((e=>Node.isNode(e)));return IS_NODE_LIST_CACHE.set(e,r),r},last(e,t){for(var r=t.slice(),n=Node.get(e,r);n&&!Text.isText(n)&&0!==n.children.length;){var o=n.children.length-1;n=n.children[o],r.push(o)}return[n,r]},leaf(e,t){var r=Node.get(e,t);if(!Text.isText(r))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Scrubber.stringify(r)));return r},levels(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of Path.levels(t,r)){var o=Node.get(e,n);yield[o,n]}}()},matches:(e,t)=>Element.isElement(e)&&Element.isElementProps(t)&&Element.matches(e,t)||Text.isText(e)&&Text.isTextProps(t)&&Text.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:r,reverse:n=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],c=e;!i||!(n?Path.isBefore(s,i):Path.isAfter(s,i));)if(a.has(c)||(yield[c,s]),a.has(c)||Text.isText(c)||0===c.children.length||null!=r&&!1!==r([c,s])){if(0===s.length)break;if(!n){var l=Path.next(s);if(Node.has(e,l)){s=l,c=Node.get(e,s);continue}}if(n&&0!==s[s.length-1])s=Path.previous(s),c=Node.get(e,s);else s=Path.parent(s),c=Node.get(e,s),a.add(c)}else{a.add(c);var p=n?c.children.length-1:0;Path.isAncestor(s,o)&&(p=o[s.length]),s=s.concat(p),c=Node.get(e,s)}}()},parent(e,t){var r=Path.parent(t),n=Node.get(e,r);if(Text.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>Text.isText(e)?e.text:e.children.map(Node.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[r,n]of Node.nodes(e,t))Text.isText(r)&&(yield[r,n])}()}};function ownKeys$c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$c(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Operation={isNodeOperation:e=>Operation.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!isPlainObject(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Path.isPath(e.path)&&Node.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Path.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Path.isPath(e.path)&&isPlainObject(e.properties);case"move_node":return Path.isPath(e.path)&&Path.isPath(e.newPath);case"set_node":return Path.isPath(e.path)&&isPlainObject(e.properties)&&isPlainObject(e.newProperties);case"set_selection":return null===e.properties&&Range.isRange(e.newProperties)||null===e.newProperties&&Range.isRange(e.properties)||isPlainObject(e.properties)&&isPlainObject(e.newProperties);case"split_node":return Path.isPath(e.path)&&"number"==typeof e.position&&isPlainObject(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>Operation.isOperation(e))),isSelectionOperation:e=>Operation.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>Operation.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return _objectSpread$c(_objectSpread$c({},e),{},{type:"remove_node"});case"insert_text":return _objectSpread$c(_objectSpread$c({},e),{},{type:"remove_text"});case"merge_node":return _objectSpread$c(_objectSpread$c({},e),{},{type:"split_node",path:Path.previous(e.path)});case"move_node":var{newPath:t,path:r}=e;if(Path.equals(t,r))return e;if(Path.isSibling(r,t))return _objectSpread$c(_objectSpread$c({},e),{},{path:t,newPath:r});var n=Path.transform(r,e),o=Path.transform(Path.next(r),e);return _objectSpread$c(_objectSpread$c({},e),{},{path:n,newPath:o});case"remove_node":return _objectSpread$c(_objectSpread$c({},e),{},{type:"insert_node"});case"remove_text":return _objectSpread$c(_objectSpread$c({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return _objectSpread$c(_objectSpread$c({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:c}=e;return _objectSpread$c(_objectSpread$c({},e),{},null==s?{properties:c,newProperties:null}:null==c?{properties:null,newProperties:s}:{properties:c,newProperties:s});case"split_node":return _objectSpread$c(_objectSpread$c({},e),{},{type:"merge_node",path:Path.next(e.path)})}}},IS_EDITOR_CACHE=new WeakMap,isEditor=e=>{var t=IS_EDITOR_CACHE.get(e);if(void 0!==t)return t;if(!isPlainObject(e))return!1;var r="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||isPlainObject(e.marks))&&(null===e.selection||Range.isRange(e.selection))&&Node.isNodeList(e.children)&&Operation.isOperationList(e.operations);return IS_EDITOR_CACHE.set(e,r),r},Editor={above:(e,t)=>e.above(t),addMark(e,t,r){e.addMark(t,r)},after:(e,t,r)=>e.after(t,r),before:(e,t,r)=>e.before(t,r),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteBackward(r)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:r="character"}=t;e.deleteForward(r)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,r){e.insertFragment(t,r)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,r)=>e.isEdge(t,r),isEditor:e=>isEditor(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,r)=>e.isEnd(t,r),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,r)=>e.isStart(t,r),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,r)=>e.leaf(t,r),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,r)=>e.node(t,r),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,r)=>e.parent(t,r),path:(e,t,r)=>e.path(t,r),pathRef:(e,t,r)=>e.pathRef(t,r),pathRefs:e=>e.pathRefs(),point:(e,t,r)=>e.point(t,r),pointRef:(e,t,r)=>e.pointRef(t,r),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,r)=>e.range(t,r),rangeRef:(e,t,r)=>e.rangeRef(t,r),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,r)=>e.string(t,r),unhangRange:(e,t,r)=>e.unhangRange(t,r),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,r)=>e.shouldMergeNodesRemovePrevNode(t,r)};function ownKeys$b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$b(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Point={compare(e,t){var r=Path.compare(e.path,t.path);return 0===r?e.offset<t.offset?-1:e.offset>t.offset?1:0:r},isAfter:(e,t)=>1===Point.compare(e,t),isBefore:(e,t)=>-1===Point.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Path.equals(e.path,t.path),isPoint:e=>isPlainObject(e)&&"number"==typeof e.offset&&Path.isPath(e.path),transform(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return produce(e,(e=>{if(null===e)return null;var{affinity:n="forward"}=r,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Path.transform(o,t,r);break;case"insert_text":Path.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===n)&&(e.offset+=t.text.length);break;case"merge_node":Path.equals(t.path,o)&&(e.offset+=t.position),e.path=Path.transform(o,t,r);break;case"remove_text":Path.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Path.equals(t.path,o)||Path.isAncestor(t.path,o))return null;e.path=Path.transform(o,t,r);break;case"split_node":if(Path.equals(t.path,o)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(e.offset-=t.position,e.path=Path.transform(o,t,_objectSpread$b(_objectSpread$b({},r),{},{affinity:"forward"})))}else e.path=Path.transform(o,t,r)}}))}},_scrubber=void 0,Scrubber={setScrubber(e){_scrubber=e},stringify:e=>JSON.stringify(e,_scrubber)},_excluded$2=["text"],_excluded2$2=["anchor","focus","merge"];function ownKeys$a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$a(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var CodepointType,Text={equals(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=r;function o(e){return _objectWithoutProperties(e,_excluded$2)}return isDeepEqual(n?o(e):e,n?o(t):t)},isText:e=>isPlainObject(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>Text.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var r in t)if("text"!==r&&(!e.hasOwnProperty(r)||e[r]!==t[r]))return!1;return!0},decorations(e,t){var r=[{leaf:_objectSpread$a({},e)}];for(var n of t){var{anchor:o,focus:i,merge:a}=n,s=_objectWithoutProperties(n,_excluded2$2),[c,l]=Range.edges(n),p=[],f=0,d=c.offset,u=l.offset,h=null!=a?a:Object.assign;for(var{leaf:g}of r){var{length:y}=g.text,m=f;if(f+=y,d<=m&&f<=u)h(g,s),p.push({leaf:g});else if(d!==u&&(d===f||u===m)||d>f||u<m||u===m&&0!==m)p.push({leaf:g});else{var b=g,_=void 0,P=void 0;if(u<f){var v=u-m;P={leaf:_objectSpread$a(_objectSpread$a({},b),{},{text:b.text.slice(v)})},b=_objectSpread$a(_objectSpread$a({},b),{},{text:b.text.slice(0,v)})}if(d>m){var S=d-m;_={leaf:_objectSpread$a(_objectSpread$a({},b),{},{text:b.text.slice(0,S)})},b=_objectSpread$a(_objectSpread$a({},b),{},{text:b.text.slice(S)})}h(b,s),_&&p.push(_),p.push({leaf:b}),P&&p.push(P)}}r=p}if(r.length>1){var w=0;for(var[O,T]of r.entries()){var j=w,x=j+T.leaf.text.length,E={start:j,end:x};0===O&&(E.isFirst=!0),O===r.length-1&&(E.isLast=!0),T.position=E,w=x}}return r}},getDefaultInsertLocation=e=>e.selection?e.selection:e.children.length>0?Editor.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(CodepointType||(CodepointType={}));var NonBoundaryPairs=[[CodepointType.L,CodepointType.L|CodepointType.V|CodepointType.LV|CodepointType.LVT],[CodepointType.LV|CodepointType.V,CodepointType.V|CodepointType.T],[CodepointType.LVT|CodepointType.T,CodepointType.T],[CodepointType.Any,CodepointType.Extend|CodepointType.ZWJ],[CodepointType.Any,CodepointType.SpacingMark],[CodepointType.Prepend,CodepointType.Any],[CodepointType.ZWJ,CodepointType.ExtPict],[CodepointType.RI,CodepointType.RI]],TextTransforms={delete(e,t){e.delete(t)},insertFragment(e,t,r){e.insertFragment(t,r)},insertText(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Editor.withoutNormalizing(e,(()=>{var{voids:n=!1}=r,{at:o=getDefaultInsertLocation(e)}=r;if(Path.isPath(o)&&(o=Editor.range(e,o)),Range.isRange(o))if(Range.isCollapsed(o))o=o.anchor;else{var i=Range.end(o);if(!n&&Editor.void(e,{at:i}))return;var a=Range.start(o),s=Editor.pointRef(e,a),c=Editor.pointRef(e,i);Transforms.delete(e,{at:o,voids:n});var l=s.unref(),p=c.unref();o=l||p,Transforms.setSelection(e,{anchor:o,focus:o})}if(!(!n&&Editor.void(e,{at:o})||Editor.elementReadOnly(e,{at:o}))){var{path:f,offset:d}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:d,text:t})}}))}};function ownKeys$9(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread$9(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$9(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$9(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Transforms=_objectSpread$9(_objectSpread$9(_objectSpread$9(_objectSpread$9({},GeneralTransforms),NodeTransforms),SelectionTransforms),TextTransforms),SingleLinePlugin=(0,import_plate_core4.createSlatePlugin)({key:KEYS.singleLine,override:{enabled:{[KEYS.trailingBlock]:!1}}}).overrideEditor((({editor:e,tf:{normalizeNode:t}})=>({transforms:{insertBreak(){},insertSoftBreak(){},normalizeNode(r){const[n,o]=r;if(Text.isText(n)){const t=n.text.replace(/[\r\n\u2028\u2029]/g,"");if(t!==n.text)return void e.tf.insertText(t,{at:o})}0===o.length&&e.children.length>1?e.tf.withoutNormalizing((()=>{for(;e.children.length>1;)e.tf.mergeNodes({at:[1],match:(e,t)=>1===t.length})})):t(r)}}}))),import_plate_core5=require("@udecode/plate-core"),import_slate3=require("@udecode/slate"),withTrailingBlock=({editor:e,getOptions:t,tf:{normalizeNode:r}})=>({transforms:{normalizeNode([n,o]){const{level:i,type:a,...s}=t();if(0===o.length){const t=e.api.last([],{level:i}),r=t?.[0];if(!r||r.type!==a&&(0,import_slate3.queryNode)(t,s)){const r=t?import_slate3.PathApi.next(t[1]):[0];return void e.tf.insertNodes(e.api.create.block({type:a},r),{at:r})}}return r([n,o])}}}),TrailingBlockPlugin=(0,import_plate_core5.createTSlatePlugin)({key:KEYS.trailingBlock,options:{level:0}}).overrideEditor(withTrailingBlock).extend((({editor:e})=>({options:{type:e.getType(KEYS.p)}})));
/*! Bundled license information:

is-plain-object/dist/is-plain-object.mjs:
  (*!
   * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
   *
   * Copyright (c) 2014-2017, Jon Schlinkert.
   * Released under the MIT License.
   *)
*/
//# sourceMappingURL=/sm/597d419ca1df8576d1f66ae6ad05a12f3150ff297d52f61f101632be11f21e4b.map