@frontify/fondue 12.0.0-beta.19 → 12.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/OverflowMenu/OverflowMenuItem.es.js +3 -2
- package/dist/components/OverflowMenu/OverflowMenuItem.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +2 -4
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/FloatingLink.es.js +6 -13
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/FloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/InsertLinkModal/index.d.ts +0 -1
- package/dist/components/RichTextEditor/serializer/utils/serializeLeafToHtml.es.js +1 -1
- package/dist/components/RichTextEditor/serializer/utils/serializeLeafToHtml.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/utils/serializeNodeToHtmlRecursive.es.js +1 -1
- package/dist/components/RichTextEditor/serializer/utils/serializeNodeToHtmlRecursive.es.js.map +1 -1
- package/dist/components/ScrollWrapper/ScrollWrapper.es.js +3 -2
- package/dist/components/ScrollWrapper/ScrollWrapper.es.js.map +1 -1
- package/dist/components/Table/TableCell.es.js +3 -2
- package/dist/components/Table/TableCell.es.js.map +1 -1
- package/dist/components/Table/TableColumnHeader.es.js +3 -2
- package/dist/components/Table/TableColumnHeader.es.js.map +1 -1
- package/dist/components/Tree/utils/mocks.es.js +1 -0
- package/dist/components/Tree/utils/mocks.es.js.map +1 -1
- package/dist/index.cjs.js +3 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +3 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.d.ts +0 -2
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +0 -38
- package/dist/components/RichTextEditor/Plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +0 -1
- package/dist/node_modules/@udecode/plate-core/dist/index.es.es.js +0 -1482
- package/dist/node_modules/@udecode/plate-core/dist/index.es.es.js.map +0 -1
- package/dist/node_modules/@udecode/plate-floating/dist/index.es.es.js +0 -21
- package/dist/node_modules/@udecode/plate-floating/dist/index.es.es.js.map +0 -1
- package/dist/node_modules/@udecode/zustood/dist/index.es.es.js +0 -439
- package/dist/node_modules/@udecode/zustood/dist/index.es.es.js.map +0 -1
- package/dist/node_modules/@udecode/zustood/node_modules/react-tracked/dist/index.modern.es.js +0 -21
- package/dist/node_modules/@udecode/zustood/node_modules/react-tracked/dist/index.modern.es.js.map +0 -1
- package/dist/node_modules/escape-html/index.es.js +0 -41
- package/dist/node_modules/escape-html/index.es.js.map +0 -1
- package/dist/node_modules/hotkeys-js/dist/hotkeys.esm.es.js +0 -275
- package/dist/node_modules/hotkeys-js/dist/hotkeys.esm.es.js.map +0 -1
- package/dist/node_modules/jotai/esm/index.es.js +0 -418
- package/dist/node_modules/jotai/esm/index.es.js.map +0 -1
- package/dist/node_modules/proxy-compare/dist/index.modern.es.js +0 -74
- package/dist/node_modules/proxy-compare/dist/index.modern.es.js.map +0 -1
- package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.es.js +0 -7
- package/dist/node_modules/react-hotkeys-hook/dist/react-hotkeys-hook.esm.es.js.map +0 -1
- package/dist/node_modules/zustand/esm/index.es.js +0 -62
- package/dist/node_modules/zustand/esm/index.es.js.map +0 -1
- package/dist/node_modules/zustand/esm/middleware.es.js +0 -219
- package/dist/node_modules/zustand/esm/middleware.es.js.map +0 -1
- package/dist/node_modules/zustand/esm/vanilla.es.js +0 -26
- package/dist/node_modules/zustand/esm/vanilla.es.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.es.js","sources":["../../../../../node_modules/@udecode/plate-core/dist/index.es.js"],"sourcesContent":["import { atom, useAtomValue, useSetAtom, useAtom, Provider } from 'jotai';\nexport { atom, useAtom, useAtomValue } from 'jotai';\nimport React, { useCallback, useMemo, useState, useRef, useEffect, forwardRef, memo } from 'react';\nimport { ReactEditor, withReact, DefaultElement, useSlateStatic, useSlate, Editable, Slate } from 'slate-react';\nexport { isHotkeyPressed, useHotkeys } from 'react-hotkeys-hook';\nimport { createStore } from '@udecode/zustood';\nexport { createStore } from '@udecode/zustood';\nimport { withHistory, HistoryEditor } from 'slate-history';\nimport { Editor, Element, Text, Range, Node as Node$1, createEditor as createEditor$1, Span, Path, Transforms, Point } from 'slate';\nimport { useDeepCompareMemo } from 'use-deep-compare';\nimport { nanoid } from 'nanoid';\nimport clsx from 'clsx';\nimport { Slot } from '@radix-ui/react-slot';\n\n/* eslint-disable react-hooks/rules-of-hooks */\n\nconst capitalizeFirstLetter = (str = '') => str.length ? str[0].toUpperCase() + str.slice(1) : '';\n\nconst getStoreIndex = (name = '') => name.length ? `${name}Store` : 'store';\n\nconst getUseStoreIndex = (name = '') => `use${capitalizeFirstLetter(name)}Store`;\n\n/**\n * Create an atom store from an initial value.\n * Each property will have a getter and setter.\n *\n * @example\n * const { exampleStore, useExampleStore } = createAtomStore({ count: 1, say: 'hello' }, { name: 'example' as const })\n * const [count, setCount] = useExampleStore().use.count()\n * const say = useExampleStore().get.say()\n * const setSay = useExampleStore().set.say()\n * setSay('world')\n * const countAtom = exampleStore.atom.count\n */\nconst createAtomStore = (initialState, {\n scope: storeScope,\n initialStore,\n name = ''\n} = {}) => {\n const useInitialStoreIndex = getUseStoreIndex(initialStore === null || initialStore === void 0 ? void 0 : initialStore.name);\n const initialStoreIndex = getStoreIndex(initialStore === null || initialStore === void 0 ? void 0 : initialStore.name);\n const useStoreIndex = getUseStoreIndex(name);\n const storeIndex = getStoreIndex(name);\n const getAtoms = initialStore ? initialStore[useInitialStoreIndex]().get : {};\n const setAtoms = initialStore ? initialStore[useInitialStoreIndex]().set : {};\n const useAtoms = initialStore ? initialStore[useInitialStoreIndex]().use : {};\n const atoms = initialStore ? initialStore[initialStoreIndex].atom : {};\n Object.keys(initialState).forEach(key => {\n const atomConfig = atom(initialState[key]);\n atoms[key] = atomConfig;\n\n getAtoms[key] = scope => {\n return useAtomValue(atomConfig, scope !== null && scope !== void 0 ? scope : storeScope);\n };\n\n setAtoms[key] = scope => {\n return useSetAtom(atomConfig, scope !== null && scope !== void 0 ? scope : storeScope);\n };\n\n useAtoms[key] = scope => {\n return useAtom(atomConfig, scope !== null && scope !== void 0 ? scope : storeScope);\n };\n });\n const api = {\n [useStoreIndex]: scope => {\n if (scope) {\n const getAtomsHook = { ...getAtoms\n };\n const setAtomsHook = { ...setAtoms\n };\n const useAtomsHook = { ...useAtoms\n };\n Object.keys(getAtomsHook).forEach(key => {\n const get = getAtomsHook[key];\n\n getAtomsHook[key] = _scope => {\n var _ref;\n\n return get((_ref = _scope !== null && _scope !== void 0 ? _scope : scope) !== null && _ref !== void 0 ? _ref : storeScope);\n };\n });\n Object.keys(setAtomsHook).forEach(key => {\n const set = setAtomsHook[key];\n\n setAtomsHook[key] = _scope => {\n var _ref2;\n\n return set((_ref2 = _scope !== null && _scope !== void 0 ? _scope : scope) !== null && _ref2 !== void 0 ? _ref2 : storeScope);\n };\n });\n Object.keys(useAtomsHook).forEach(key => {\n const use = useAtomsHook[key];\n\n useAtomsHook[key] = _scope => {\n var _ref3;\n\n return use((_ref3 = _scope !== null && _scope !== void 0 ? _scope : scope) !== null && _ref3 !== void 0 ? _ref3 : storeScope);\n };\n });\n return {\n get: getAtomsHook,\n set: setAtomsHook,\n use: useAtomsHook\n };\n }\n\n return {\n get: getAtoms,\n set: setAtoms,\n use: useAtoms\n };\n },\n [storeIndex]: {\n atom: atoms\n },\n name\n };\n return { ...api,\n [storeIndex]: { ...api[storeIndex],\n scope: storeScope,\n extend: (extendedState, options) => createAtomStore(extendedState, {\n scope: storeScope,\n initialStore: api,\n ...options\n })\n }\n };\n};\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\nconst DOM_HANDLERS = [// Clipboard Events\n'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', // Composition Events\n'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', // Focus Events\n'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', // Form Events\n'onDOMBeforeInput', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', // Image Events\n'onLoad', 'onLoadCapture', // Keyboard Events\n'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', // Media Events\n'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', // MouseEvents\n'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', // Selection Events\n'onSelect', 'onSelectCapture', // Touch Events\n'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', // Pointer Events\n'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', // UI Events\n'onScroll', 'onScrollCapture', // Wheel Events\n'onWheel', 'onWheelCapture', // Animation Events\n'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', // Transition Events\n'onTransitionEnd', 'onTransitionEndCapture'];\n\nconst IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);\n\nconst escapeRegExp = text => {\n return text.replace(/[-[\\]{}()*+?.,\\\\^$|#\\\\s]/g, '\\\\$&');\n};\n\nconst findHtmlParentElement = (el, nodeName) => {\n if (!el || el.nodeName === nodeName) {\n return el;\n }\n\n return findHtmlParentElement(el.parentElement, nodeName);\n};\n\n/**\n * Call a handler if defined\n */\nconst getHandler = (cb, ...args) => () => {\n cb === null || cb === void 0 ? void 0 : cb(...args);\n};\n\n/**\n * Get slate class name: slate-<type>\n */\nconst getSlateClass = type => `slate-${type}`;\n\nconst hexToBase64 = hex => {\n const hexPairs = hex.match(/\\w{2}/g) || [];\n const binary = hexPairs.map(hexPair => String.fromCharCode(parseInt(hexPair, 16)));\n return btoa(binary.join(''));\n};\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar lib = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * Constants.\n */\n\n// We make this a function so it can be tested in describe block mocks with Jest.\nvar IS_MAC = () => typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);\n\nvar MODIFIERS = {\n alt: 'altKey',\n control: 'ctrlKey',\n meta: 'metaKey',\n shift: 'shiftKey'\n};\n\n// We make this a function so it can be tested in describe block mocks with Jest.\nvar ALIASES = () => ({\n add: '+',\n break: 'pause',\n cmd: 'meta',\n command: 'meta',\n ctl: 'control',\n ctrl: 'control',\n del: 'delete',\n down: 'arrowdown',\n esc: 'escape',\n ins: 'insert',\n left: 'arrowleft',\n mod: IS_MAC() ? 'meta' : 'control',\n opt: 'alt',\n option: 'alt',\n return: 'enter',\n right: 'arrowright',\n space: ' ',\n spacebar: ' ',\n up: 'arrowup',\n win: 'meta',\n windows: 'meta'\n});\n\nvar CODES = {\n backspace: 8,\n tab: 9,\n enter: 13,\n shift: 16,\n control: 17,\n alt: 18,\n pause: 19,\n capslock: 20,\n escape: 27,\n ' ': 32,\n pageup: 33,\n pagedown: 34,\n end: 35,\n home: 36,\n arrowleft: 37,\n arrowup: 38,\n arrowright: 39,\n arrowdown: 40,\n insert: 45,\n delete: 46,\n meta: 91,\n numlock: 144,\n scrolllock: 145,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n '\\'': 222\n};\n\nfor (var f = 1; f < 20; f++) {\n CODES['f' + f] = 111 + f;\n}\n\n/**\n * Is hotkey?\n */\n\nfunction isHotkey(hotkey, options, event) {\n if (options && !('byKey' in options)) {\n event = options;\n options = null;\n }\n\n if (!Array.isArray(hotkey)) {\n hotkey = [hotkey];\n }\n\n var array = hotkey.map(function (string) {\n return parseHotkey(string, options);\n });\n var check = function check(e) {\n return array.some(function (object) {\n return compareHotkey(object, e);\n });\n };\n var ret = event == null ? check : check(event);\n return ret;\n}\n\nfunction isCodeHotkey(hotkey, event) {\n return isHotkey(hotkey, event);\n}\n\nfunction isKeyHotkey(hotkey, event) {\n return isHotkey(hotkey, { byKey: true }, event);\n}\n\n/**\n * Parse.\n */\n\nfunction parseHotkey(hotkey, options) {\n var byKey = options && options.byKey;\n var ret = {};\n\n // Special case to handle the `+` key since we use it as a separator.\n hotkey = hotkey.replace('++', '+add');\n var values = hotkey.split('+');\n var length = values.length;\n\n // Ensure that all the modifiers are set to false unless the hotkey has them.\n\n for (var k in MODIFIERS) {\n ret[MODIFIERS[k]] = false;\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var value = _step.value;\n\n var optional = value.endsWith('?') && value.length > 1;\n\n if (optional) {\n value = value.slice(0, -1);\n }\n\n var name = toKeyName(value);\n var modifier = MODIFIERS[name];\n\n if (length === 1 || !modifier) {\n if (byKey) {\n ret.key = name;\n } else {\n ret.which = toKeyCode(value);\n }\n }\n\n if (modifier) {\n ret[modifier] = optional ? null : true;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return ret;\n}\n\n/**\n * Compare.\n */\n\nfunction compareHotkey(object, event) {\n for (var key in object) {\n var expected = object[key];\n var actual = void 0;\n\n if (expected == null) {\n continue;\n }\n\n if (key === 'key' && event.key != null) {\n actual = event.key.toLowerCase();\n } else if (key === 'which') {\n actual = expected === 91 && event.which === 93 ? 91 : event.which;\n } else {\n actual = event[key];\n }\n\n if (actual == null && expected === false) {\n continue;\n }\n\n if (actual !== expected) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utils.\n */\n\nfunction toKeyCode(name) {\n name = toKeyName(name);\n var code = CODES[name] || name.toUpperCase().charCodeAt(0);\n return code;\n}\n\nfunction toKeyName(name) {\n name = name.toLowerCase();\n name = ALIASES()[name] || name;\n return name;\n}\n\n/**\n * Export.\n */\n\nexports.default = isHotkey;\nexports.isHotkey = isHotkey;\nexports.isCodeHotkey = isCodeHotkey;\nexports.isKeyHotkey = isKeyHotkey;\nexports.parseHotkey = parseHotkey;\nexports.compareHotkey = compareHotkey;\nexports.toKeyCode = toKeyCode;\nexports.toKeyName = toKeyName;\n});\n\nvar isHotkey = unwrapExports(lib);\nlib.isHotkey;\nlib.isCodeHotkey;\nvar lib_3 = lib.isKeyHotkey;\nlib.parseHotkey;\nlib.compareHotkey;\nlib.toKeyCode;\nlib.toKeyName;\n\n/**\n * Check if the user is currently composing inside the editor.\n */\nconst isComposing = editor => ReactEditor.isComposing(editor);\n\n/**\n * Hotkey mappings for each platform.\n */\n\nconst HOTKEYS = {\n bold: 'mod+b',\n compose: ['down', 'left', 'right', 'up', 'backspace', 'enter'],\n deleteBackward: 'shift?+backspace',\n deleteForward: 'shift?+delete',\n extendBackward: 'shift+left',\n extendForward: 'shift+right',\n insertSoftBreak: 'shift+enter',\n italic: 'mod+i',\n moveBackward: 'left',\n moveForward: 'right',\n moveWordBackward: 'ctrl+left',\n moveWordForward: 'ctrl+right',\n splitBlock: 'enter',\n tab: 'tab',\n untab: 'shift+tab',\n undo: 'mod+z'\n};\nconst APPLE_HOTKEYS = {\n deleteBackward: ['ctrl+backspace', 'ctrl+h'],\n deleteForward: ['ctrl+delete', 'ctrl+d'],\n deleteLineBackward: 'cmd+shift?+backspace',\n deleteLineForward: ['cmd+shift?+delete', 'ctrl+k'],\n deleteWordBackward: 'opt+shift?+backspace',\n deleteWordForward: 'opt+shift?+delete',\n extendLineBackward: 'opt+shift+up',\n extendLineForward: 'opt+shift+down',\n moveLineBackward: 'opt+up',\n moveLineForward: 'opt+down',\n moveWordBackward: 'opt+left',\n moveWordForward: 'opt+right',\n redo: 'cmd+shift+z',\n transposeCharacter: 'ctrl+t'\n};\nconst WINDOWS_HOTKEYS = {\n deleteWordBackward: 'ctrl+shift?+backspace',\n deleteWordForward: 'ctrl+shift?+delete',\n redo: ['ctrl+y', 'ctrl+shift+z']\n};\n/**\n * Create a platform-aware hotkey checker.\n */\n\nconst create = key => {\n const generic = HOTKEYS[key];\n const apple = APPLE_HOTKEYS[key];\n const windows = WINDOWS_HOTKEYS[key];\n const isGeneric = generic && lib_3(generic);\n const isApple = apple && lib_3(apple);\n const isWindows = windows && lib_3(windows);\n return event => {\n if (isGeneric && isGeneric(event)) return true;\n if (IS_APPLE && isApple && isApple(event)) return true;\n if (!IS_APPLE && isWindows && isWindows(event)) return true;\n return false;\n };\n};\n\nconst createComposing = key => (editor, event, {\n composing\n} = {}) => {\n if (!create(key)(event)) return false;\n if (!!composing !== isComposing(editor)) return false;\n return true;\n};\n\nconst Hotkeys = {\n isBold: create('bold'),\n isCompose: create('compose'),\n isMoveBackward: create('moveBackward'),\n isMoveForward: create('moveForward'),\n isDeleteBackward: create('deleteBackward'),\n isDeleteForward: create('deleteForward'),\n isDeleteLineBackward: create('deleteLineBackward'),\n isDeleteLineForward: create('deleteLineForward'),\n isDeleteWordBackward: create('deleteWordBackward'),\n isDeleteWordForward: create('deleteWordForward'),\n isExtendBackward: create('extendBackward'),\n isExtendForward: create('extendForward'),\n isExtendLineBackward: create('extendLineBackward'),\n isExtendLineForward: create('extendLineForward'),\n isItalic: create('italic'),\n isMoveLineBackward: create('moveLineBackward'),\n isMoveLineForward: create('moveLineForward'),\n isMoveWordBackward: create('moveWordBackward'),\n isMoveWordForward: create('moveWordForward'),\n isRedo: create('redo'),\n isSoftBreak: create('insertSoftBreak'),\n isSplitBlock: create('splitBlock'),\n isTab: createComposing('tab'),\n isTransposeCharacter: create('transposeCharacter'),\n isUndo: create('undo'),\n isUntab: createComposing('untab')\n};\n\n/**\n * RegExps.\n * A URL must match #1 and then at least one of #2/#3.\n * Use two levels of REs to avoid REDOS.\n */\nconst protocolAndDomainRE = /^(?:\\w+:)?\\/\\/(\\S+)$/;\nconst localhostDomainRE = /^localhost[:?\\d]*(?:[^:?\\d]\\S*)?$/;\nconst nonLocalhostDomainRE = /^[^\\s.]+\\.\\S{2,}$/;\n/**\n * Loosely validate a URL `string`.\n */\n\nconst isUrl = string => {\n if (typeof string !== 'string') {\n return false;\n }\n\n const match = string.match(protocolAndDomainRE);\n\n if (!match) {\n return false;\n }\n\n const everythingAfterProtocol = match[1];\n\n if (!everythingAfterProtocol) {\n return false;\n }\n\n try {\n new URL(string);\n } catch (err) {\n return false;\n }\n\n return localhostDomainRE.test(everythingAfterProtocol) || nonLocalhostDomainRE.test(everythingAfterProtocol);\n};\n\nconst JotaiProvider = Provider;\n\n/**\n * Merge props by composing handlers.\n */\nconst mergeProps = (props, overrideProps, {\n handlerKeys,\n handlerQuery = key => key.indexOf('on') === 0\n} = {}) => {\n const map = new Map();\n const acc = {};\n\n const mapProps = _props => {\n if (!_props) return;\n Object.entries(_props).forEach(([key, value]) => {\n if ((!handlerKeys || handlerKeys.includes(key)) && (!handlerQuery || handlerQuery(key)) && typeof value === 'function') {\n var _map$get;\n\n if (!map.has(key)) {\n map.set(key, []);\n }\n\n (_map$get = map.get(key)) === null || _map$get === void 0 ? void 0 : _map$get.push(value);\n\n acc[key] = (...args) => {\n var _map$get2;\n\n (_map$get2 = map.get(key)) === null || _map$get2 === void 0 ? void 0 : _map$get2.forEach(fn => fn(...args));\n };\n } else {\n acc[key] = value;\n }\n });\n };\n\n mapProps(props);\n mapProps(overrideProps);\n return acc;\n};\n\n/**\n * @returns whether the provided parameter is undefined.\n */\nconst isUndefined = obj => typeof obj === 'undefined';\nconst isNull = obj => obj === null;\n/**\n * @returns whether the provided parameter is undefined or null.\n */\n\nconst isUndefinedOrNull = obj => isUndefined(obj) || isNull(obj);\n/**\n * @returns whether the provided parameter is defined.\n */\n\nconst isDefined = arg => !isUndefinedOrNull(arg);\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nvar _apply = apply;\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nvar identity_1 = identity;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return _apply(func, this, otherArgs);\n };\n}\n\nvar _overRest = overRest;\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nvar constant_1 = constant;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\nvar _freeGlobal = freeGlobal;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = _freeGlobal || freeSelf || Function('return this')();\n\nvar _root = root;\n\n/** Built-in value references. */\nvar Symbol$1 = _root.Symbol;\n\nvar _Symbol = Symbol$1;\n\n/** Used for built-in method references. */\nvar objectProto$g = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$d = objectProto$g.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString$1 = objectProto$g.toString;\n\n/** Built-in value references. */\nvar symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty$d.call(value, symToStringTag$1),\n tag = value[symToStringTag$1];\n\n try {\n value[symToStringTag$1] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString$1.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag$1] = tag;\n } else {\n delete value[symToStringTag$1];\n }\n }\n return result;\n}\n\nvar _getRawTag = getRawTag;\n\n/** Used for built-in method references. */\nvar objectProto$f = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto$f.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nvar _objectToString = objectToString;\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? _getRawTag(value)\n : _objectToString(value);\n}\n\nvar _baseGetTag = baseGetTag;\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject$1(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nvar isObject_1 = isObject$1;\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag$2 = '[object Function]',\n genTag$1 = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject_1(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = _baseGetTag(value);\n return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;\n}\n\nvar isFunction_1 = isFunction;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = _root['__core-js_shared__'];\n\nvar _coreJsData = coreJsData;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nvar _isMasked = isMasked;\n\n/** Used for built-in method references. */\nvar funcProto$2 = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString$2 = funcProto$2.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString$2.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nvar _toSource = toSource;\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto$1 = Function.prototype,\n objectProto$e = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString$1 = funcProto$1.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$c = objectProto$e.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject_1(value) || _isMasked(value)) {\n return false;\n }\n var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;\n return pattern.test(_toSource(value));\n}\n\nvar _baseIsNative = baseIsNative;\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nvar _getValue = getValue;\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = _getValue(object, key);\n return _baseIsNative(value) ? value : undefined;\n}\n\nvar _getNative = getNative;\n\nvar defineProperty = (function() {\n try {\n var func = _getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nvar _defineProperty$1 = defineProperty;\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !_defineProperty$1 ? identity_1 : function(func, string) {\n return _defineProperty$1(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant_1(string),\n 'writable': true\n });\n};\n\nvar _baseSetToString = baseSetToString;\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nvar _shortOut = shortOut;\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = _shortOut(_baseSetToString);\n\nvar _setToString = setToString;\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return _setToString(_overRest(func, start, identity_1), func + '');\n}\n\nvar _baseRest = baseRest;\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nvar _listCacheClear = listCacheClear;\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nvar eq_1 = eq;\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq_1(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nvar _assocIndexOf = assocIndexOf;\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = _assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nvar _listCacheDelete = listCacheDelete;\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = _assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nvar _listCacheGet = listCacheGet;\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return _assocIndexOf(this.__data__, key) > -1;\n}\n\nvar _listCacheHas = listCacheHas;\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = _assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nvar _listCacheSet = listCacheSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = _listCacheClear;\nListCache.prototype['delete'] = _listCacheDelete;\nListCache.prototype.get = _listCacheGet;\nListCache.prototype.has = _listCacheHas;\nListCache.prototype.set = _listCacheSet;\n\nvar _ListCache = ListCache;\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new _ListCache;\n this.size = 0;\n}\n\nvar _stackClear = stackClear;\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nvar _stackDelete = stackDelete;\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nvar _stackGet = stackGet;\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nvar _stackHas = stackHas;\n\n/* Built-in method references that are verified to be native. */\nvar Map$1 = _getNative(_root, 'Map');\n\nvar _Map = Map$1;\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = _getNative(Object, 'create');\n\nvar _nativeCreate = nativeCreate;\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = _nativeCreate ? _nativeCreate(null) : {};\n this.size = 0;\n}\n\nvar _hashClear = hashClear;\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nvar _hashDelete = hashDelete;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED$2 = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto$d = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$b = objectProto$d.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (_nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED$2 ? undefined : result;\n }\n return hasOwnProperty$b.call(data, key) ? data[key] : undefined;\n}\n\nvar _hashGet = hashGet;\n\n/** Used for built-in method references. */\nvar objectProto$c = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$a = objectProto$c.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$a.call(data, key);\n}\n\nvar _hashHas = hashHas;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED$1 = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;\n return this;\n}\n\nvar _hashSet = hashSet;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = _hashClear;\nHash.prototype['delete'] = _hashDelete;\nHash.prototype.get = _hashGet;\nHash.prototype.has = _hashHas;\nHash.prototype.set = _hashSet;\n\nvar _Hash = Hash;\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new _Hash,\n 'map': new (_Map || _ListCache),\n 'string': new _Hash\n };\n}\n\nvar _mapCacheClear = mapCacheClear;\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nvar _isKeyable = isKeyable;\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return _isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nvar _getMapData = getMapData;\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = _getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nvar _mapCacheDelete = mapCacheDelete;\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return _getMapData(this, key).get(key);\n}\n\nvar _mapCacheGet = mapCacheGet;\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return _getMapData(this, key).has(key);\n}\n\nvar _mapCacheHas = mapCacheHas;\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = _getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nvar _mapCacheSet = mapCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = _mapCacheClear;\nMapCache.prototype['delete'] = _mapCacheDelete;\nMapCache.prototype.get = _mapCacheGet;\nMapCache.prototype.has = _mapCacheHas;\nMapCache.prototype.set = _mapCacheSet;\n\nvar _MapCache = MapCache;\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof _ListCache) {\n var pairs = data.__data__;\n if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new _MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nvar _stackSet = stackSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new _ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = _stackClear;\nStack.prototype['delete'] = _stackDelete;\nStack.prototype.get = _stackGet;\nStack.prototype.has = _stackHas;\nStack.prototype.set = _stackSet;\n\nvar _Stack = Stack;\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && _defineProperty$1) {\n _defineProperty$1(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nvar _baseAssignValue = baseAssignValue;\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq_1(object[key], value)) ||\n (value === undefined && !(key in object))) {\n _baseAssignValue(object, key, value);\n }\n}\n\nvar _assignMergeValue = assignMergeValue;\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nvar _createBaseFor = createBaseFor;\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = _createBaseFor();\n\nvar _baseFor = baseFor;\n\nvar _cloneBuffer = createCommonjsModule(function (module, exports) {\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? _root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n});\n\n/** Built-in value references. */\nvar Uint8Array = _root.Uint8Array;\n\nvar _Uint8Array = Uint8Array;\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));\n return result;\n}\n\nvar _cloneArrayBuffer = cloneArrayBuffer;\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nvar _cloneTypedArray = cloneTypedArray;\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nvar _copyArray = copyArray;\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject_1(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nvar _baseCreate = baseCreate;\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nvar _overArg = overArg;\n\n/** Built-in value references. */\nvar getPrototype = _overArg(Object.getPrototypeOf, Object);\n\nvar _getPrototype = getPrototype;\n\n/** Used for built-in method references. */\nvar objectProto$b = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$b;\n\n return value === proto;\n}\n\nvar _isPrototype = isPrototype;\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !_isPrototype(object))\n ? _baseCreate(_getPrototype(object))\n : {};\n}\n\nvar _initCloneObject = initCloneObject;\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nvar isObjectLike_1 = isObjectLike;\n\n/** `Object#toString` result references. */\nvar argsTag$3 = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike_1(value) && _baseGetTag(value) == argsTag$3;\n}\n\nvar _baseIsArguments = baseIsArguments;\n\n/** Used for built-in method references. */\nvar objectProto$a = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$9 = objectProto$a.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {\n return isObjectLike_1(value) && hasOwnProperty$9.call(value, 'callee') &&\n !propertyIsEnumerable$1.call(value, 'callee');\n};\n\nvar isArguments_1 = isArguments;\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nvar isArray_1 = isArray;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER$1 = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;\n}\n\nvar isLength_1 = isLength;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength_1(value.length) && !isFunction_1(value);\n}\n\nvar isArrayLike_1 = isArrayLike;\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike_1(value) && isArrayLike_1(value);\n}\n\nvar isArrayLikeObject_1 = isArrayLikeObject;\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nvar stubFalse_1 = stubFalse;\n\nvar isBuffer_1 = createCommonjsModule(function (module, exports) {\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? _root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse_1;\n\nmodule.exports = isBuffer;\n});\n\n/** `Object#toString` result references. */\nvar objectTag$4 = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto$9 = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$8 = objectProto$9.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject$1(value) {\n if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$4) {\n return false;\n }\n var proto = _getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty$8.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nvar isPlainObject_1 = isPlainObject$1;\n\n/** `Object#toString` result references. */\nvar argsTag$2 = '[object Arguments]',\n arrayTag$2 = '[object Array]',\n boolTag$3 = '[object Boolean]',\n dateTag$3 = '[object Date]',\n errorTag$2 = '[object Error]',\n funcTag$1 = '[object Function]',\n mapTag$5 = '[object Map]',\n numberTag$3 = '[object Number]',\n objectTag$3 = '[object Object]',\n regexpTag$3 = '[object RegExp]',\n setTag$5 = '[object Set]',\n stringTag$3 = '[object String]',\n weakMapTag$2 = '[object WeakMap]';\n\nvar arrayBufferTag$3 = '[object ArrayBuffer]',\n dataViewTag$4 = '[object DataView]',\n float32Tag$2 = '[object Float32Array]',\n float64Tag$2 = '[object Float64Array]',\n int8Tag$2 = '[object Int8Array]',\n int16Tag$2 = '[object Int16Array]',\n int32Tag$2 = '[object Int32Array]',\n uint8Tag$2 = '[object Uint8Array]',\n uint8ClampedTag$2 = '[object Uint8ClampedArray]',\n uint16Tag$2 = '[object Uint16Array]',\n uint32Tag$2 = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =\ntypedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =\ntypedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =\ntypedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =\ntypedArrayTags[uint32Tag$2] = true;\ntypedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] =\ntypedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] =\ntypedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] =\ntypedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] =\ntypedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] =\ntypedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] =\ntypedArrayTags[setTag$5] = typedArrayTags[stringTag$3] =\ntypedArrayTags[weakMapTag$2] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike_1(value) &&\n isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];\n}\n\nvar _baseIsTypedArray = baseIsTypedArray;\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nvar _baseUnary = baseUnary;\n\nvar _nodeUtil = createCommonjsModule(function (module, exports) {\n/** Detect free variable `exports`. */\nvar freeExports = exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && _freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n});\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;\n\nvar isTypedArray_1 = isTypedArray;\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\nvar _safeGet = safeGet;\n\n/** Used for built-in method references. */\nvar objectProto$8 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$7 = objectProto$8.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty$7.call(object, key) && eq_1(objValue, value)) ||\n (value === undefined && !(key in object))) {\n _baseAssignValue(object, key, value);\n }\n}\n\nvar _assignValue = assignValue;\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n _baseAssignValue(object, key, newValue);\n } else {\n _assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nvar _copyObject = copyObject;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nvar _baseTimes = baseTimes;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nvar _isIndex = isIndex;\n\n/** Used for built-in method references. */\nvar objectProto$7 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$6 = objectProto$7.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray_1(value),\n isArg = !isArr && isArguments_1(value),\n isBuff = !isArr && !isArg && isBuffer_1(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? _baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty$6.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n _isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nvar _arrayLikeKeys = arrayLikeKeys;\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nvar _nativeKeysIn = nativeKeysIn;\n\n/** Used for built-in method references. */\nvar objectProto$6 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$5 = objectProto$6.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject_1(object)) {\n return _nativeKeysIn(object);\n }\n var isProto = _isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty$5.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nvar _baseKeysIn = baseKeysIn;\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);\n}\n\nvar keysIn_1 = keysIn;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return _copyObject(value, keysIn_1(value));\n}\n\nvar toPlainObject_1 = toPlainObject;\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = _safeGet(object, key),\n srcValue = _safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n _assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray_1(srcValue),\n isBuff = !isArr && isBuffer_1(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray_1(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject_1(objValue)) {\n newValue = _copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = _cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = _cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {\n newValue = objValue;\n if (isArguments_1(objValue)) {\n newValue = toPlainObject_1(objValue);\n }\n else if (!isObject_1(objValue) || isFunction_1(objValue)) {\n newValue = _initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n _assignMergeValue(object, key, newValue);\n}\n\nvar _baseMergeDeep = baseMergeDeep;\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n _baseFor(source, function(srcValue, key) {\n stack || (stack = new _Stack);\n if (isObject_1(srcValue)) {\n _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n _assignMergeValue(object, key, newValue);\n }\n }, keysIn_1);\n}\n\nvar _baseMerge = baseMerge;\n\n/**\n * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source\n * objects into destination objects that are passed thru.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to merge.\n * @param {Object} object The parent object of `objValue`.\n * @param {Object} source The parent object of `srcValue`.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n * @returns {*} Returns the value to assign.\n */\nfunction customDefaultsMerge(objValue, srcValue, key, object, source, stack) {\n if (isObject_1(objValue) && isObject_1(srcValue)) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, objValue);\n _baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);\n stack['delete'](srcValue);\n }\n return objValue;\n}\n\nvar _customDefaultsMerge = customDefaultsMerge;\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject_1(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike_1(object) && _isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq_1(object[index], value);\n }\n return false;\n}\n\nvar _isIterateeCall = isIterateeCall;\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return _baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && _isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nvar _createAssigner = createAssigner;\n\n/**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\nvar mergeWith = _createAssigner(function(object, source, srcIndex, customizer) {\n _baseMerge(object, source, srcIndex, customizer);\n});\n\nvar mergeWith_1 = mergeWith;\n\n/**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.10.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaults\n * @example\n *\n * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });\n * // => { 'a': { 'b': 2, 'c': 3 } }\n */\nvar defaultsDeep = _baseRest(function(args) {\n args.push(undefined, _customDefaultsMerge);\n return _apply(mergeWith_1, undefined, args);\n});\n\nvar defaultsDeep_1 = defaultsDeep;\n\n/**\n * Recursive deep merge of each plugin from `overrideByKey`\n * into plugin with same key (plugin > plugin.plugins).\n */\nconst overridePluginsByKey = (plugin, overrideByKey = {}, nested) => {\n var _overrideByKey$plugin;\n\n if (overrideByKey[plugin.key]) {\n const {\n plugins: pluginOverridesPlugins,\n then: pluginOverridesThen,\n ...pluginOverrides\n } = overrideByKey[plugin.key]; // override plugin\n\n plugin = defaultsDeep_1(pluginOverrides, plugin);\n\n if (!nested) {\n // concat new pluginOverrides.plugins to plugin.plugins\n pluginOverridesPlugins === null || pluginOverridesPlugins === void 0 ? void 0 : pluginOverridesPlugins.forEach(pOverrides => {\n if (!plugin.plugins) plugin.plugins = [];\n const found = plugin.plugins.find(p => p.key === pOverrides.key);\n if (!found) plugin.plugins.push(pOverrides);\n });\n }\n }\n\n if (plugin.plugins) {\n // override plugin.plugins\n plugin.plugins = plugin.plugins.map(p => overridePluginsByKey(p, overrideByKey, true));\n }\n\n const {\n then\n } = plugin;\n\n if (then) {\n // override plugin.then\n plugin.then = (editor, p) => {\n const pluginThen = {\n key: plugin.key,\n ...then(editor, p)\n };\n return defaultsDeep_1(overridePluginsByKey(pluginThen, overrideByKey), pluginThen);\n };\n } else if ((_overrideByKey$plugin = overrideByKey[plugin.key]) !== null && _overrideByKey$plugin !== void 0 && _overrideByKey$plugin.then) {\n // TODO: recursvie\n plugin.then = overrideByKey[plugin.key].then;\n }\n\n return plugin;\n};\n\n/**\n * Create plugin factory with a default plugin.\n * - first param is the default plugin.\n * - the only required property of the default plugin is `key`.\n * - returns a plugin factory:\n * - first param `override` can be used to (deeply) override the default plugin.\n * - second param `overrideByKey` can be used to (deeply) override by key a nested plugin (in plugin.plugins).\n */\n\nconst createPluginFactory = defaultPlugin => (override, overrideByKey = {}) => {\n overrideByKey[defaultPlugin.key] = override;\n return overridePluginsByKey({ ...defaultPlugin\n }, overrideByKey);\n};\n\nconst KEY_DESERIALIZE_AST = 'deserializeAst';\n/**\n * Enables support for deserializing inserted content from Slate Ast format to Slate format\n * while apply a small bug fix.\n */\n\nconst createDeserializeAstPlugin = createPluginFactory({\n key: KEY_DESERIALIZE_AST,\n editor: {\n insertData: {\n format: 'application/x-slate-fragment',\n getFragment: ({\n data\n }) => {\n const decoded = decodeURIComponent(window.atob(data));\n return JSON.parse(decoded);\n }\n }\n }\n});\n\n/**\n * Store where the keys are event names and the values are editor ids.\n */\nconst eventEditorStore = createStore('event-editor')({\n blur: null,\n focus: null,\n last: null\n});\nconst eventEditorActions = eventEditorStore.set;\nconst eventEditorSelectors = eventEditorStore.get;\nconst useEventEditorSelectors = eventEditorStore.use;\n\nconst KEY_EVENT_EDITOR = 'event-editor';\nconst createEventEditorPlugin = createPluginFactory({\n key: KEY_EVENT_EDITOR,\n handlers: {\n onFocus: editor => () => {\n eventEditorActions.focus(editor.id);\n },\n onBlur: editor => () => {\n const focus = eventEditorSelectors.focus();\n\n if (focus === editor.id) {\n eventEditorActions.focus(null);\n }\n\n eventEditorActions.blur(editor.id);\n }\n }\n});\n\nconst withTHistory = editor => withHistory(editor);\n/**\n * @see {@link withHistory}\n */\n\nconst createHistoryPlugin = createPluginFactory({\n key: 'history',\n withOverrides: withTHistory\n});\n\nconst KEY_INLINE_VOID = 'inline-void';\n/**\n * Merge and register all the inline types and void types from the plugins and options,\n * using `editor.isInline` and `editor.isVoid`\n */\n\nconst withInlineVoid = editor => {\n const {\n isInline\n } = editor;\n const {\n isVoid\n } = editor;\n const inlineTypes = [];\n const voidTypes = [];\n editor.plugins.forEach(plugin => {\n if (plugin.isInline) {\n inlineTypes.push(plugin.type);\n }\n\n if (plugin.isVoid) {\n voidTypes.push(plugin.type);\n }\n });\n\n editor.isInline = element => {\n return inlineTypes.includes(element.type) ? true : isInline(element);\n };\n\n editor.isVoid = element => voidTypes.includes(element.type) ? true : isVoid(element);\n\n return editor;\n};\n/**\n * @see {@link withInlineVoid}\n */\n\nconst createInlineVoidPlugin = createPluginFactory({\n key: KEY_INLINE_VOID,\n withOverrides: withInlineVoid\n});\n\n/**\n * Get all plugins having a defined `inject.pluginsByKey[plugin.key]`.\n * It includes `plugin` itself.\n */\nconst getInjectedPlugins = (editor, plugin) => {\n const injectedPlugins = [];\n [...editor.plugins].reverse().forEach(p => {\n var _p$inject$pluginsByKe;\n\n const injectedPlugin = (_p$inject$pluginsByKe = p.inject.pluginsByKey) === null || _p$inject$pluginsByKe === void 0 ? void 0 : _p$inject$pluginsByKe[plugin.key];\n if (injectedPlugin) injectedPlugins.push(injectedPlugin);\n });\n return [plugin, ...injectedPlugins];\n};\n\n/**\n * Is the plugin disabled by another plugin.\n */\nconst pipeInsertDataQuery = (plugins, {\n data,\n dataTransfer\n}) => plugins.every(p => {\n var _p$editor, _p$editor$insertData;\n\n const query = (_p$editor = p.editor) === null || _p$editor === void 0 ? void 0 : (_p$editor$insertData = _p$editor.insertData) === null || _p$editor$insertData === void 0 ? void 0 : _p$editor$insertData.query;\n return !query || query({\n data,\n dataTransfer\n });\n});\n\n/**\n * Call a function, deferring normalization until after it completes\n * @return true if normalized.\n */\nconst withoutNormalizing = (editor, fn) => {\n let normalized = false;\n Editor.withoutNormalizing(editor, () => {\n normalized = !!fn();\n });\n return normalized;\n};\n\n/**\n * Pipe preInsert then insertFragment.\n */\nconst pipeInsertFragment = (editor, injectedPlugins, {\n fragment,\n ...options\n}) => {\n withoutNormalizing(editor, () => {\n injectedPlugins.some(p => {\n var _p$editor, _p$editor$insertData, _p$editor$insertData$;\n\n return ((_p$editor = p.editor) === null || _p$editor === void 0 ? void 0 : (_p$editor$insertData = _p$editor.insertData) === null || _p$editor$insertData === void 0 ? void 0 : (_p$editor$insertData$ = _p$editor$insertData.preInsert) === null || _p$editor$insertData$ === void 0 ? void 0 : _p$editor$insertData$.call(_p$editor$insertData, fragment, options)) === true;\n });\n editor.insertFragment(fragment);\n });\n};\n\n/**\n * Pipe editor.insertData.transformData\n */\nconst pipeTransformData = (plugins, {\n data,\n dataTransfer\n}) => {\n plugins.forEach(p => {\n var _p$editor, _p$editor$insertData;\n\n const transformData = (_p$editor = p.editor) === null || _p$editor === void 0 ? void 0 : (_p$editor$insertData = _p$editor.insertData) === null || _p$editor$insertData === void 0 ? void 0 : _p$editor$insertData.transformData;\n if (!transformData) return;\n data = transformData(data, {\n dataTransfer\n });\n });\n return data;\n};\n\n/**\n * Pipe editor.insertData.transformFragment\n */\nconst pipeTransformFragment = (plugins, {\n fragment,\n ...options\n}) => {\n plugins.forEach(p => {\n var _p$editor, _p$editor$insertData;\n\n const transformFragment = (_p$editor = p.editor) === null || _p$editor === void 0 ? void 0 : (_p$editor$insertData = _p$editor.insertData) === null || _p$editor$insertData === void 0 ? void 0 : _p$editor$insertData.transformFragment;\n if (!transformFragment) return;\n fragment = transformFragment(fragment, options);\n });\n return fragment;\n};\n\nconst withInsertData = editor => {\n const {\n insertData\n } = editor;\n\n editor.insertData = dataTransfer => {\n const inserted = [...editor.plugins].reverse().some(plugin => {\n var _fragment;\n\n const insertDataOptions = plugin.editor.insertData;\n if (!insertDataOptions) return false;\n const injectedPlugins = getInjectedPlugins(editor, plugin);\n const {\n format,\n getFragment\n } = insertDataOptions;\n if (!format) return false;\n let data = dataTransfer.getData(format);\n if (!data) return;\n\n if (!pipeInsertDataQuery(injectedPlugins, {\n data,\n dataTransfer\n })) {\n return false;\n }\n\n data = pipeTransformData(injectedPlugins, {\n data,\n dataTransfer\n });\n let fragment = getFragment === null || getFragment === void 0 ? void 0 : getFragment({\n data,\n dataTransfer\n });\n if (!((_fragment = fragment) !== null && _fragment !== void 0 && _fragment.length)) return false;\n fragment = pipeTransformFragment(injectedPlugins, {\n fragment,\n data,\n dataTransfer\n });\n if (!fragment.length) return false;\n pipeInsertFragment(editor, injectedPlugins, {\n fragment,\n data,\n dataTransfer\n });\n return true;\n });\n if (inserted) return;\n insertData(dataTransfer);\n };\n\n return editor;\n};\nconst KEY_INSERT_DATA = 'insertData';\nconst createInsertDataPlugin = createPluginFactory({\n key: KEY_INSERT_DATA,\n withOverrides: withInsertData\n});\n\nconst ELEMENT_DEFAULT = 'p';\n\nconst KEY_NODE_FACTORY = 'nodeFactory';\nconst createNodeFactoryPlugin = createPluginFactory({\n key: KEY_NODE_FACTORY,\n withOverrides: editor => {\n editor.blockFactory = node => ({\n type: getPluginType(editor, ELEMENT_DEFAULT),\n children: [{\n text: ''\n }],\n ...node\n });\n\n editor.childrenFactory = () => [editor.blockFactory()];\n\n return editor;\n }\n});\n\nconst KEY_PREV_SELECTION = 'prevSelection';\nconst createPrevSelectionPlugin = createPluginFactory({\n key: KEY_PREV_SELECTION,\n handlers: {\n onKeyDown: editor => e => {\n // React 16.x needs this event to be persistented due to it's event pooling implementation.\n // https://reactjs.org/docs/legacy-event-pooling.html\n e.persist();\n editor.currentKeyboardEvent = e;\n }\n },\n withOverrides: editor => {\n const {\n apply\n } = editor;\n\n editor.apply = operation => {\n if (operation.type === 'set_selection') {\n const {\n properties\n } = operation;\n editor.prevSelection = properties;\n apply(operation);\n editor.currentKeyboardEvent = null;\n return;\n }\n\n apply(operation);\n };\n\n return editor;\n }\n});\n\nconst withTReact = editor => withReact(editor);\n\n/**\n * @see {@link withReact}\n */\n\nconst createReactPlugin = createPluginFactory({\n key: 'react',\n withOverrides: withTReact\n});\n\n/**\n * Check if a value implements the 'Element' interface.\n */\nconst isElement = value => Element.isElement(value);\n\n/**\n * Check if a value implements the `Text` interface.\n */\nconst isText = value => Text.isText(value);\n\n/**\n * Get `editor.pluginsByKey`\n */\nconst getPluginsByKey = editor => {\n var _ref;\n\n return (_ref = editor === null || editor === void 0 ? void 0 : editor.pluginsByKey) !== null && _ref !== void 0 ? _ref : {};\n};\n\n/**\n * Get plugin options by plugin key.\n */\n\nconst getPlugin = (editor, key) => {\n var _getPluginsByKey$key;\n\n return (_getPluginsByKey$key = getPluginsByKey(editor)[key]) !== null && _getPluginsByKey$key !== void 0 ? _getPluginsByKey$key : {\n key\n };\n};\n\n/**\n * Get plugin type option by plugin key.\n */\n\nconst getPluginType = (editor, key) => {\n var _ref, _getPlugin$type;\n\n return (_ref = (_getPlugin$type = getPlugin(editor, key).type) !== null && _getPlugin$type !== void 0 ? _getPlugin$type : key) !== null && _ref !== void 0 ? _ref : '';\n};\n\nconst isInlineNode = editor => node => isText(node) || isElement(node) && editor.isInline(node);\n\nconst makeBlockLazy = type => () => ({\n type,\n children: []\n});\n\nconst hasDifferentChildNodes = (descendants, isInline) => {\n return descendants.some((descendant, index, arr) => {\n const prevDescendant = arr[index - 1];\n\n if (index !== 0) {\n return isInline(descendant) !== isInline(prevDescendant);\n }\n\n return false;\n });\n};\n/**\n * Handles 3rd constraint: \"Block nodes can only contain other blocks, or inline and text nodes.\"\n */\n\n\nconst normalizeDifferentNodeTypes = (descendants, isInline, makeDefaultBlock) => {\n const hasDifferentNodes = hasDifferentChildNodes(descendants, isInline);\n const {\n fragment\n } = descendants.reduce((memo, node) => {\n if (hasDifferentNodes && isInline(node)) {\n let block = memo.precedingBlock;\n\n if (!block) {\n block = makeDefaultBlock();\n memo.precedingBlock = block;\n memo.fragment.push(block);\n }\n\n block.children.push(node);\n } else {\n memo.fragment.push(node);\n memo.precedingBlock = null;\n }\n\n return memo;\n }, {\n fragment: [],\n precedingBlock: null\n });\n return fragment;\n};\n/**\n * Handles 1st constraint: \"All Element nodes must contain at least one Text descendant.\"\n */\n\n\nconst normalizeEmptyChildren = descendants => {\n if (!descendants.length) {\n return [{\n text: ''\n }];\n }\n\n return descendants;\n};\n\nconst normalize = (descendants, isInline, makeDefaultBlock) => {\n descendants = normalizeEmptyChildren(descendants);\n descendants = normalizeDifferentNodeTypes(descendants, isInline, makeDefaultBlock);\n descendants = descendants.map(node => {\n if (isElement(node)) {\n return { ...node,\n children: normalize(node.children, isInline, makeDefaultBlock)\n };\n }\n\n return node;\n });\n return descendants;\n};\n/**\n * Normalize the descendants to a valid document fragment.\n */\n\n\nconst normalizeDescendantsToDocumentFragment = (editor, {\n descendants\n}) => {\n const isInline = isInlineNode(editor);\n const defaultType = getPluginType(editor, ELEMENT_DEFAULT);\n const makeDefaultBlock = makeBlockLazy(defaultType);\n return normalize(descendants, isInline, makeDefaultBlock);\n};\n\n/*!\n * is-plain-object <https://github.com/jonschlinkert/is-plain-object>\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\n/**\r\n * A weak map to hold anchor tokens.\r\n */\nvar ANCHOR = new WeakMap();\n/**\r\n * A weak map to hold focus tokens.\r\n */\n\nvar FOCUS = new WeakMap();\n/**\r\n * All tokens inherit from a single constructor for `instanceof` checking.\r\n */\n\nclass Token {}\n/**\r\n * Anchor tokens represent the selection's anchor point.\r\n */\n\nclass AnchorToken extends Token {\n constructor() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n super();\n var {\n offset,\n path\n } = props;\n this.offset = offset;\n this.path = path;\n }\n\n}\n/**\r\n * Focus tokens represent the selection's focus point.\r\n */\n\nclass FocusToken extends Token {\n constructor() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n super();\n var {\n offset,\n path\n } = props;\n this.offset = offset;\n this.path = path;\n }\n\n}\n/**\r\n * Add an anchor token to the end of a text node.\r\n */\n\nvar addAnchorToken = (text, token) => {\n var offset = text.text.length;\n ANCHOR.set(text, [offset, token]);\n};\n/**\r\n * Get the offset if a text node has an associated anchor token.\r\n */\n\nvar getAnchorOffset = text => {\n return ANCHOR.get(text);\n};\n/**\r\n * Add a focus token to the end of a text node.\r\n */\n\nvar addFocusToken = (text, token) => {\n var offset = text.text.length;\n FOCUS.set(text, [offset, token]);\n};\n/**\r\n * Get the offset if a text node has an associated focus token.\r\n */\n\nvar getFocusOffset = text => {\n return FOCUS.get(text);\n};\n\nfunction ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n/**\r\n * Resolve the descedants of a node by normalizing the children that can be\r\n * passed into a hyperscript creator function.\r\n */\n\nvar STRINGS = new WeakSet();\n\nvar resolveDescendants = children => {\n var nodes = [];\n\n var addChild = child => {\n if (child == null) {\n return;\n }\n\n var prev = nodes[nodes.length - 1];\n\n if (typeof child === 'string') {\n var text = {\n text: child\n };\n STRINGS.add(text);\n child = text;\n }\n\n if (Text.isText(child)) {\n var c = child; // HACK: fix typescript complaining\n\n if (Text.isText(prev) && STRINGS.has(prev) && STRINGS.has(c) && Text.equals(prev, c, {\n loose: true\n })) {\n prev.text += c.text;\n } else {\n nodes.push(c);\n }\n } else if (Element.isElement(child)) {\n nodes.push(child);\n } else if (child instanceof Token) {\n var n = nodes[nodes.length - 1];\n\n if (!Text.isText(n)) {\n addChild('');\n n = nodes[nodes.length - 1];\n }\n\n if (child instanceof AnchorToken) {\n addAnchorToken(n, child);\n } else if (child instanceof FocusToken) {\n addFocusToken(n, child);\n }\n } else {\n throw new Error(\"Unexpected hyperscript child object: \".concat(child));\n }\n };\n\n for (var child of children.flat(Infinity)) {\n addChild(child);\n }\n\n return nodes;\n};\n/**\r\n * Create an anchor token.\r\n */\n\n\nfunction createAnchor(tagName, attributes, children) {\n return new AnchorToken(attributes);\n}\n/**\r\n * Create an anchor and a focus token.\r\n */\n\nfunction createCursor(tagName, attributes, children) {\n return [new AnchorToken(attributes), new FocusToken(attributes)];\n}\n/**\r\n * Create an `Element` object.\r\n */\n\nfunction createElement(tagName, attributes, children) {\n return _objectSpread$1(_objectSpread$1({}, attributes), {}, {\n children: resolveDescendants(children)\n });\n}\n/**\r\n * Create a focus token.\r\n */\n\nfunction createFocus(tagName, attributes, children) {\n return new FocusToken(attributes);\n}\n/**\r\n * Create a fragment.\r\n */\n\nfunction createFragment(tagName, attributes, children) {\n return resolveDescendants(children);\n}\n/**\r\n * Create a `Selection` object.\r\n */\n\nfunction createSelection(tagName, attributes, children) {\n var anchor = children.find(c => c instanceof AnchorToken);\n var focus = children.find(c => c instanceof FocusToken);\n\n if (!anchor || anchor.offset == null || anchor.path == null) {\n throw new Error(\"The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.\");\n }\n\n if (!focus || focus.offset == null || focus.path == null) {\n throw new Error(\"The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.\");\n }\n\n return _objectSpread$1({\n anchor: {\n offset: anchor.offset,\n path: anchor.path\n },\n focus: {\n offset: focus.offset,\n path: focus.path\n }\n }, attributes);\n}\n/**\r\n * Create a `Text` object.\r\n */\n\nfunction createText(tagName, attributes, children) {\n var nodes = resolveDescendants(children);\n\n if (nodes.length > 1) {\n throw new Error(\"The <text> hyperscript tag must only contain a single node's worth of children.\");\n }\n\n var [node] = nodes;\n\n if (node == null) {\n node = {\n text: ''\n };\n }\n\n if (!Text.isText(node)) {\n throw new Error(\"\\n The <text> hyperscript tag can only contain text content as children.\");\n } // COMPAT: If they used the <text> tag we want to guarantee that it won't be\n // merge with other string children.\n\n\n STRINGS.delete(node);\n Object.assign(node, attributes);\n return node;\n}\n/**\r\n * Create a top-level `Editor` object.\r\n */\n\nvar createEditor = makeEditor => (tagName, attributes, children) => {\n var otherChildren = [];\n var selectionChild;\n\n for (var child of children) {\n if (Range.isRange(child)) {\n selectionChild = child;\n } else {\n otherChildren.push(child);\n }\n }\n\n var descendants = resolveDescendants(otherChildren);\n var selection = {};\n var editor = makeEditor();\n Object.assign(editor, attributes);\n editor.children = descendants; // Search the document's texts to see if any of them have tokens associated\n // that need incorporated into the selection.\n\n for (var [node, path] of Node$1.texts(editor)) {\n var anchor = getAnchorOffset(node);\n var focus = getFocusOffset(node);\n\n if (anchor != null) {\n var [offset] = anchor;\n selection.anchor = {\n path,\n offset\n };\n }\n\n if (focus != null) {\n var [_offset] = focus;\n selection.focus = {\n path,\n offset: _offset\n };\n }\n }\n\n if (selection.anchor && !selection.focus) {\n throw new Error(\"Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.\");\n }\n\n if (!selection.anchor && selection.focus) {\n throw new Error(\"Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.\");\n }\n\n if (selectionChild != null) {\n editor.selection = selectionChild;\n } else if (Range.isRange(selection)) {\n editor.selection = selection;\n }\n\n return editor;\n};\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n/**\r\n * The default creators for Slate objects.\r\n */\n\nvar DEFAULT_CREATORS = {\n anchor: createAnchor,\n cursor: createCursor,\n editor: createEditor(createEditor$1),\n element: createElement,\n focus: createFocus,\n fragment: createFragment,\n selection: createSelection,\n text: createText\n};\n/**\r\n * Create a Slate hyperscript function with `options`.\r\n */\n\nvar createHyperscript = function createHyperscript() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var {\n elements = {}\n } = options;\n var elementCreators = normalizeElements(elements);\n\n var creators = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_CREATORS), elementCreators), options.creators);\n\n var jsx = createFactory(creators);\n return jsx;\n};\n/**\r\n * Create a Slate hyperscript function with `options`.\r\n */\n\n\nvar createFactory = creators => {\n var jsx = function jsx(tagName, attributes) {\n for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n children[_key - 2] = arguments[_key];\n }\n\n var creator = creators[tagName];\n\n if (!creator) {\n throw new Error(\"No hyperscript creator found for tag: <\".concat(tagName, \">\"));\n }\n\n if (attributes == null) {\n attributes = {};\n }\n\n if (!isPlainObject(attributes)) {\n children = [attributes].concat(children);\n attributes = {};\n }\n\n children = children.filter(child => Boolean(child)).flat();\n var ret = creator(tagName, attributes, children);\n return ret;\n };\n\n return jsx;\n};\n/**\r\n * Normalize a dictionary of element shorthands into creator functions.\r\n */\n\n\nvar normalizeElements = elements => {\n var creators = {};\n\n var _loop = function _loop(tagName) {\n var props = elements[tagName];\n\n if (typeof props !== 'object') {\n throw new Error(\"Properties specified for a hyperscript shorthand should be an object, but for the custom element <\".concat(tagName, \"> tag you passed: \").concat(props));\n }\n\n creators[tagName] = (tagName, attributes, children) => {\n return createElement('element', _objectSpread(_objectSpread({}, props), attributes), children);\n };\n };\n\n for (var tagName in elements) {\n _loop(tagName);\n }\n\n return creators;\n};\n\n/**\r\n * The default hyperscript factory that ships with Slate, without custom tags.\r\n */\n\nvar jsx = createHyperscript();\n\nconst deserializeHtmlNodeChildren = (editor, node) => Array.from(node.childNodes).map(deserializeHtmlNode(editor)).flat();\n\n/**\n * Deserialize HTML body element to Fragment.\n */\n\nconst htmlBodyToFragment = (editor, element) => {\n if (element.nodeName === 'BODY') {\n return jsx('fragment', {}, deserializeHtmlNodeChildren(editor, element));\n }\n};\n\n/**\n * Deserialize HTML to break line.\n */\nconst htmlBrToNewLine = node => {\n if (node.nodeName === 'BR') {\n return '\\n';\n }\n};\n\n/**\n * Casts `value` as an array if it's not one.\n *\n * @static\n * @memberOf _\n * @since 4.4.0\n * @category Lang\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast array.\n * @example\n *\n * _.castArray(1);\n * // => [1]\n *\n * _.castArray({ 'a': 1 });\n * // => [{ 'a': 1 }]\n *\n * _.castArray('abc');\n * // => ['abc']\n *\n * _.castArray(null);\n * // => [null]\n *\n * _.castArray(undefined);\n * // => [undefined]\n *\n * _.castArray();\n * // => []\n *\n * var array = [1, 2, 3];\n * console.log(_.castArray(array) === array);\n * // => true\n */\nfunction castArray() {\n if (!arguments.length) {\n return [];\n }\n var value = arguments[0];\n return isArray_1(value) ? value : [value];\n}\n\nvar castArray_1 = castArray;\n\n/**\n * Get a deserializer by type, node names, class names and styles.\n */\n\nconst pluginDeserializeHtml = (editor, plugin, {\n element: el,\n deserializeLeaf\n}) => {\n var _getNode;\n\n const {\n deserializeHtml,\n isElement: isElementRoot,\n isLeaf: isLeafRoot,\n type\n } = plugin;\n if (!deserializeHtml) return;\n const {\n attributeNames,\n query,\n isLeaf: isLeafRule,\n isElement: isElementRule,\n rules\n } = deserializeHtml;\n let {\n getNode\n } = deserializeHtml;\n const isElement = isElementRule || isElementRoot;\n const isLeaf = isLeafRule || isLeafRoot;\n\n if (!deserializeLeaf && !isElement) {\n return;\n }\n\n if (deserializeLeaf && !isLeaf) {\n return;\n }\n\n if (rules) {\n const isValid = rules.some(({\n validNodeName = '*',\n validStyle,\n validClassName,\n validAttribute\n }) => {\n if (validNodeName) {\n const validNodeNames = castArray_1(validNodeName); // Ignore if el nodeName is not included in rule validNodeNames (except *).\n\n if (validNodeNames.length && !validNodeNames.includes(el.nodeName) && validNodeName !== '*') return false;\n } // Ignore if the rule className is not in el class list.\n\n\n if (validClassName && !el.classList.contains(validClassName)) return false;\n\n if (validStyle) {\n for (const [key, value] of Object.entries(validStyle)) {\n var _plugin$inject$props;\n\n const values = castArray_1(value); // Ignore if el style value is not included in rule style values (except *)\n\n if (!values.includes(el.style[key]) && value !== '*') return; // Ignore if el style value is falsy (for value *)\n\n if (value === '*' && !el.style[key]) return;\n const defaultNodeValue = (_plugin$inject$props = plugin.inject.props) === null || _plugin$inject$props === void 0 ? void 0 : _plugin$inject$props.defaultNodeValue; // Ignore if the style value = plugin.inject.props.defaultNodeValue\n\n if (defaultNodeValue && defaultNodeValue === el.style[key]) {\n return false;\n }\n }\n }\n\n if (validAttribute) {\n if (typeof validAttribute === 'string') {\n if (!el.getAttributeNames().includes(validAttribute)) return false;\n } else {\n for (const [attributeName, attributeValue] of Object.entries(validAttribute)) {\n const attributeValues = castArray_1(attributeValue);\n const elAttribute = el.getAttribute(attributeName);\n if (!elAttribute || !attributeValues.includes(elAttribute)) return false;\n }\n }\n }\n\n return true;\n });\n if (!isValid) return;\n }\n\n if (query && !query(el)) {\n return;\n }\n\n if (!getNode) {\n if (isElement) {\n getNode = () => ({\n type\n });\n } else if (isLeaf) {\n getNode = () => ({\n [type]: true\n });\n } else {\n return;\n }\n }\n\n let node = (_getNode = getNode(el, {})) !== null && _getNode !== void 0 ? _getNode : {};\n if (!Object.keys(node).length) return;\n const injectedPlugins = getInjectedPlugins(editor, plugin);\n injectedPlugins.forEach(injectedPlugin => {\n var _injectedPlugin$deser, _injectedPlugin$deser2;\n\n const res = (_injectedPlugin$deser = injectedPlugin.deserializeHtml) === null || _injectedPlugin$deser === void 0 ? void 0 : (_injectedPlugin$deser2 = _injectedPlugin$deser.getNode) === null || _injectedPlugin$deser2 === void 0 ? void 0 : _injectedPlugin$deser2.call(_injectedPlugin$deser, el, node);\n\n if (res) {\n node = { ...node,\n ...res\n };\n }\n });\n\n if (attributeNames) {\n const elementAttributes = {};\n const elementAttributeNames = el.getAttributeNames();\n\n for (const elementAttributeName of elementAttributeNames) {\n if (attributeNames.includes(elementAttributeName)) {\n elementAttributes[elementAttributeName] = el.getAttribute(elementAttributeName);\n }\n }\n\n if (Object.keys(elementAttributes).length) {\n node.attributes = elementAttributes;\n }\n }\n\n return { ...deserializeHtml,\n node\n };\n};\n\nconst pipeDeserializeHtmlElement = (editor, element) => {\n let result;\n [...editor.plugins].reverse().some(plugin => {\n result = pluginDeserializeHtml(editor, plugin, {\n element\n });\n return !!result;\n });\n return result;\n};\n\n/**\n * Deserialize HTML to Element.\n */\n\nconst htmlElementToElement = (editor, element) => {\n const deserialized = pipeDeserializeHtmlElement(editor, element);\n\n if (deserialized) {\n var _node$children;\n\n const {\n node,\n withoutChildren\n } = deserialized;\n let descendants = (_node$children = node.children) !== null && _node$children !== void 0 ? _node$children : deserializeHtmlNodeChildren(editor, element);\n\n if (!descendants.length || withoutChildren) {\n descendants = [{\n text: ''\n }];\n }\n\n return jsx('element', node, descendants);\n }\n};\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = _createAssigner(function(object, source, srcIndex) {\n _baseMerge(object, source, srcIndex);\n});\n\nvar merge_1 = merge;\n\n/**\n * Get the node at a location.\n */\nconst getNodeEntry = (editor, at, options) => Editor.node(editor, at, options);\n\n/**\n * Get the path of a location.\n */\nconst getPath = (editor, at, options) => Editor.path(editor, at, options);\n\n/**\n * Check if a value is a void `Element` object.\n */\nconst isVoid = (editor, value) => {\n return Editor.isVoid(editor, value);\n};\n\n/**\n * Return a generator of all the descendant node entries inside a root node.\n */\nconst getNodeDescendants = (root, options) => Node$1.descendants(root, options);\n\n/**\n * Check if a value is a block `Element` object.\n */\nconst isBlock = (editor, value) => Editor.isBlock(editor, value);\n\n/**\n * Match the object with a predicate object or function.\n * If predicate is:\n * - object: every predicate key/value should be in obj.\n * - function: it should return true.\n */\nconst match = (obj, path, predicate) => {\n if (!predicate) return true;\n\n if (typeof predicate === 'object') {\n return Object.entries(predicate).every(([key, value]) => {\n const values = castArray_1(value);\n\n return values.includes(obj[key]);\n });\n }\n\n return predicate(obj, path);\n};\n/**\n * Extended query options for slate queries:\n * - `match` can be an object predicate where one of the values should include the node value.\n * Example: { type: ['1', '2'] } will match the nodes having one of these 2 types.\n */\n\nconst getQueryOptions = (editor, options = {}) => {\n const {\n match: _match,\n block\n } = options;\n return { ...options,\n match: _match || block ? (n, path) => match(n, path, _match) && (!block || isBlock(editor, n)) : undefined\n };\n};\n\n/**\n * Iterate through all of the nodes in the editor and return the first match. If\n * no match is found, return undefined.\n */\n/**\n * Get the first descendant node matching the condition.\n */\n\nconst findDescendant = (editor, options) => {\n // Slate throws when things aren't found so we wrap in a try catch and return undefined on throw.\n try {\n const {\n match: _match,\n at = editor.selection,\n reverse = false,\n voids = false\n } = options;\n if (!at) return;\n let from;\n let to;\n\n if (Span.isSpan(at)) {\n [from, to] = at;\n } else if (Range.isRange(at)) {\n const first = getPath(editor, at, {\n edge: 'start'\n });\n const last = getPath(editor, at, {\n edge: 'end'\n });\n from = reverse ? last : first;\n to = reverse ? first : last;\n }\n\n let root = [editor, []];\n\n if (Path.isPath(at)) {\n root = getNodeEntry(editor, at);\n }\n\n const nodeEntries = getNodeDescendants(root[0], {\n reverse,\n from,\n to,\n pass: ([n]) => voids ? false : isVoid(editor, n)\n });\n\n for (const [node, path] of nodeEntries) {\n if (match(node, path, _match)) {\n return [node, at.concat(path)];\n }\n }\n } catch (error) {\n return undefined;\n }\n};\n\n/**\n * Convert a range into a non-hanging one if:\n * - `unhang` is true,\n * - `at` (default: selection) is a range.\n */\nconst unhangRange = (editor, range, options = {}) => {\n const {\n voids,\n unhang = true\n } = options;\n\n if (Range.isRange(range) && unhang) {\n return Editor.unhangRange(editor, range, {\n voids\n });\n }\n};\n\n/**\n * Iterate through all of the nodes in the Editor.\n */\nconst getNodeEntries = (editor, options) => {\n unhangRange(editor, options === null || options === void 0 ? void 0 : options.at, options);\n return Editor.nodes(editor, getQueryOptions(editor, options));\n};\n\n/**\n * Find node matching the condition.\n */\nconst findNode = (editor, options = {}) => {\n // Slate throws when things aren't found so we wrap in a try catch and return undefined on throw.\n try {\n const nodeEntries = getNodeEntries(editor, {\n at: editor.selection || [],\n ...getQueryOptions(editor, options)\n });\n\n for (const [node, path] of nodeEntries) {\n return [node, path];\n }\n } catch (error) {\n return undefined;\n }\n};\n\n/**\n * Get the ancestor above a location in the document.\n */\nconst getAboveNode = (editor, options) => Editor.above(editor, getQueryOptions(editor, options));\n\n/**\n * Get the block above a location (default: selection).\n */\nconst getBlockAbove = (editor, options = {}) => getAboveNode(editor, { ...options,\n block: true\n});\n\n/**\n * Check if a value implements the 'Ancestor' interface.\n */\nconst isAncestor = value => Element.isAncestor(value);\n\n/**\n * Get children node entries of a node entry.\n * TODO: try Node.children\n */\nconst getChildren = nodeEntry => {\n const [node, path] = nodeEntry;\n\n if (isAncestor(node)) {\n const {\n children\n } = node;\n return children.map((child, index) => {\n const childPath = path.concat([index]);\n return [child, childPath];\n });\n }\n\n return [];\n};\n\n/**\n * Get the start and end points of a location.\n */\nconst getEdgePoints = (editor, at) => Editor.edges(editor, at);\n\n/**\n * Get the edge blocks above a location (default: selection).\n */\n\nconst getEdgeBlocksAbove = (editor, {\n at: _at,\n ...options\n} = {}) => {\n const at = _at !== null && _at !== void 0 ? _at : editor.selection;\n if (!at) return null;\n const [start, end] = getEdgePoints(editor, at !== null && at !== void 0 ? at : editor.selection);\n const startBlock = getBlockAbove(editor, {\n at: start,\n ...options\n });\n if (!startBlock) return null;\n const endBlock = getBlockAbove(editor, {\n at: end,\n ...options\n });\n if (!endBlock) return null;\n return [startBlock, endBlock];\n};\n\n/**\n * Get the last child of a node or null if no children.\n */\n\nconst getLastChild$1 = nodeEntry => {\n const [node, path] = nodeEntry;\n if (isText(node)) return null;\n if (!node.children.length) return null;\n const children = node.children;\n return [children[children.length - 1], path.concat([children.length - 1])];\n};\n/**\n * Get last child path. If there is no child, last index is 0.\n */\n\nconst getLastChildPath = nodeEntry => {\n const lastChild = getLastChild$1(nodeEntry);\n if (!lastChild) return nodeEntry[1].concat([-1]);\n return lastChild[1];\n};\n/**\n * Is the child path the last one of the parent.\n */\n\nconst isLastChild = (parentEntry, childPath) => {\n const lastChildPath = getLastChildPath(parentEntry);\n return Path.equals(lastChildPath, childPath);\n};\n\n/**\n * Get the last node at a location.\n */\nconst getLastNode = (editor, at) => Editor.last(editor, at);\n\nconst getLastChild = (node, level) => {\n if (!(level + 1) || !isAncestor(node)) return node;\n const {\n children\n } = node;\n const lastNode = children[children.length - 1];\n return getLastChild(lastNode, level - 1);\n};\n/**\n * Get the last node at a given level.\n */\n\n\nconst getLastNodeByLevel = (editor, level) => {\n const {\n children\n } = editor;\n const lastNode = children[children.length - 1];\n if (!lastNode) return;\n const [, lastPath] = getLastNode(editor, []);\n return [getLastChild(lastNode, level - 1), lastPath.slice(0, level + 1)];\n};\n\n/**\n * Get the marks that would be added to text at the current selection.\n */\nconst getMarks = editor => Editor.marks(editor);\n\n/**\n * Get selected mark by type.\n */\nconst getMark = (editor, type) => {\n if (!editor) return;\n const marks = getMarks(editor);\n return marks === null || marks === void 0 ? void 0 : marks[type];\n};\n\n/**\n * A helper type for getting the value of an editor.\n */\n\n/**\n * Get editor with typed methods and operations.\n * Note that it can't be used as a parameter of type TEditor.\n */\nconst getTEditor = editor => editor;\n\n/**\n * Add a custom property to the leaf text nodes in the current selection.\n *\n * If the selection is currently collapsed, the marks will be added to the\n * `editor.marks` property instead, and applied when text is inserted next.\n */\nconst addMark = (editor, key, value) => Editor.addMark(editor, key, value);\n\n/**\n * Create a mutable ref for a `Path` object, which will stay in sync as new\n * operations are applied to the editor.\n */\nconst createPathRef = (editor, at, options) => Editor.pathRef(editor, at, options);\n\n/**\n * Create a mutable ref for a `Point` object, which will stay in sync as new\n * operations are applied to the editor.\n */\nconst createPointRef = (editor, point, options) => Editor.pointRef(editor, point, options);\n\n/**\n * Create a mutable ref for a `Range` object, which will stay in sync as new\n * operations are applied to the editor.\n */\nconst createRangeRef = (editor, range, options) => Editor.rangeRef(editor, range, options);\n\n/**\n * Delete content in the editor backward from the current selection.\n */\nconst deleteBackward = (editor, options) => Editor.deleteBackward(editor, options);\n\n/**\n * Delete content in the editor forward from the current selection.\n */\nconst deleteForward = (editor, options) => Editor.deleteForward(editor, options);\n\n/**\n * Delete the content in the current selection.\n */\nconst deleteFragment = (editor, options) => Editor.deleteFragment(editor, options);\n\nconst hasSingleChild = node => {\n if (isText(node)) {\n return true;\n }\n\n return node.children.length === 1 && hasSingleChild(node.children[0]);\n};\n\n/**\n * Get the parent node of a location.\n * Returns undefined if there is no parent.\n */\nconst getParentNode = (editor, at, options) => {\n try {\n return Editor.parent(editor, at, options);\n } catch (err) {}\n};\n\n/**\n * Get the matching node in the branch of the document before a location.\n */\nconst getPreviousNode = (editor, options) => Editor.previous(editor, options);\n\n/**\n * Check if an element is empty, accounting for void nodes.\n */\nconst isElementEmpty = (editor, element) => Editor.isEmpty(editor, element);\n\n/**\n * Delete content in the editor.\n */\nconst deleteText = (editor, options) => {\n Transforms.delete(editor, options);\n};\n\n/**\n * Move the nodes at a location to a new location.\n */\nconst moveNodes = (editor, options) => Transforms.moveNodes(editor, options);\n\n/**\n * Remove the nodes at a specific location in the document.\n */\nconst removeNodes = (editor, options) => Transforms.removeNodes(editor, options);\n\n/**\n * Set the selection to a new value.\n */\nconst select = (editor, target) => {\n Transforms.select(editor, target);\n};\n\n/**\n * Merge a node at a location with the previous node of the same depth,\n * removing any empty containing nodes after the merge if necessary.\n */\nconst mergeNodes = (editor, options = {}) => {\n withoutNormalizing(editor, () => {\n let {\n match,\n at = editor.selection\n } = options;\n const {\n mergeNode,\n removeEmptyAncestor,\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n if (Path.isPath(at)) {\n const [parent] = getParentNode(editor, at);\n\n match = n => parent.children.includes(n);\n } else {\n match = n => isBlock(editor, n);\n }\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at);\n }\n\n if (Range.isRange(at)) {\n if (Range.isCollapsed(at)) {\n at = at.anchor;\n } else {\n const [, end] = Range.edges(at);\n const pointRef = createPointRef(editor, end);\n deleteText(editor, {\n at\n });\n at = pointRef.unref();\n\n if (options.at == null) {\n select(editor, at);\n }\n }\n }\n\n const _nodes = getNodeEntries(editor, {\n at,\n match,\n voids,\n mode\n });\n\n const [current] = Array.from(_nodes);\n const prev = getPreviousNode(editor, {\n at,\n match,\n voids,\n mode\n });\n\n if (!current || !prev) {\n return;\n }\n\n const [node, path] = current;\n const [prevNode, prevPath] = prev;\n\n if (path.length === 0 || prevPath.length === 0) {\n return;\n }\n\n const newPath = Path.next(prevPath);\n const commonPath = Path.common(path, prevPath);\n const isPreviousSibling = Path.isSibling(path, prevPath);\n\n const _levels = Editor.levels(editor, {\n at: path\n });\n\n const levels = Array.from(_levels, ([n]) => n).slice(commonPath.length).slice(0, -1); // Determine if the merge will leave an ancestor of the path empty as a\n // result, in which case we'll want to remove it after merging.\n\n const emptyAncestor = getAboveNode(editor, {\n at: path,\n mode: 'highest',\n match: n => levels.includes(n) && isElement(n) && hasSingleChild(n)\n });\n const emptyRef = emptyAncestor && createPathRef(editor, emptyAncestor[1]);\n let properties;\n let position; // Ensure that the nodes are equivalent, and figure out what the position\n // and extra properties of the merge will be.\n\n if (isText(node) && isText(prevNode)) {\n const {\n text,\n ...rest\n } = node;\n position = prevNode.text.length;\n properties = rest;\n } else if (isElement(node) && isElement(prevNode)) {\n const {\n children,\n ...rest\n } = node;\n position = prevNode.children.length;\n properties = rest;\n } else {\n throw new Error(`Cannot merge the node at path [${path}] with the previous sibling because it is not the same kind: ${JSON.stringify(node)} ${JSON.stringify(prevNode)}`);\n } // If the node isn't already the next sibling of the previous node, move\n // it so that it is before merging.\n\n\n if (!isPreviousSibling) {\n // DIFF\n if (!mergeNode) {\n moveNodes(editor, {\n at: path,\n to: newPath,\n voids\n });\n }\n } // If there was going to be an empty ancestor of the node that was merged,\n // we remove it from the tree.\n\n\n if (emptyRef) {\n // DIFF: start\n if (!removeEmptyAncestor) {\n removeNodes(editor, {\n at: emptyRef.current,\n voids\n });\n } else {\n const emptyPath = emptyRef.current;\n emptyPath && removeEmptyAncestor(editor, {\n at: emptyPath\n });\n } // DIFF: end\n\n } // If the target node that we're merging with is empty, remove it instead\n // of merging the two. This is a common rich text editor behavior to\n // prevent losing formatting when deleting entire nodes when you have a\n // hanging selection.\n // DIFF: start\n\n\n if (mergeNode) {\n mergeNode(editor, {\n at: path,\n to: newPath\n }); // DIFF: end\n } else if (isElement(prevNode) && isElementEmpty(editor, prevNode) || isText(prevNode) && prevNode.text === '') {\n removeNodes(editor, {\n at: prevPath,\n voids\n });\n } else {\n editor.apply({\n type: 'merge_node',\n path: newPath,\n position,\n properties\n });\n }\n\n if (emptyRef) {\n emptyRef.unref();\n }\n });\n};\n\n/**\n * Get the end point of a location.\n */\nconst getEndPoint = (editor, at) => Editor.end(editor, at);\n\n/**\n * Get the leaf text node at a location.\n */\nconst getLeafNode = (editor, at, options) => Editor.leaf(editor, at, options);\n\n/**\n * Get the point after a location.\n */\nconst getPointAfter = (editor, at, options) => Editor.after(editor, at, options);\n\n/**\n * Get the point before a location.\n */\nconst getPointBefore = (editor, at, options) => Editor.before(editor, at, options);\n\n/**\n * Get the start point of a location.\n */\nconst getStartPoint = (editor, at) => Editor.start(editor, at);\n\n/**\n * Match a void node in the current branch of the editor.\n */\nconst getVoidNode = (editor, options) => Editor.void(editor, options);\n\nconst deleteMerge = (editor, options = {}) => {\n withoutNormalizing(editor, () => {\n const {\n reverse = false,\n unit = 'character',\n distance = 1,\n voids = false\n } = options;\n let {\n at = editor.selection,\n hanging = false\n } = options;\n\n if (!at) {\n return;\n }\n\n if (Range.isRange(at) && Range.isCollapsed(at)) {\n at = at.anchor;\n }\n\n if (Point.isPoint(at)) {\n const furthestVoid = getVoidNode(editor, {\n at,\n mode: 'highest'\n });\n\n if (!voids && furthestVoid) {\n const [, voidPath] = furthestVoid;\n at = voidPath;\n } else {\n const opts = {\n unit,\n distance\n };\n const target = reverse ? getPointBefore(editor, at, opts) || getStartPoint(editor, []) : getPointAfter(editor, at, opts) || getEndPoint(editor, []);\n at = {\n anchor: at,\n focus: target\n };\n hanging = true;\n }\n }\n\n if (Path.isPath(at)) {\n removeNodes(editor, {\n at,\n voids\n });\n return;\n }\n\n if (Range.isCollapsed(at)) {\n return;\n }\n\n if (!hanging) {\n at = Editor.unhangRange(editor, at, {\n voids\n });\n }\n\n let [start, end] = Range.edges(at);\n const startBlock = getAboveNode(editor, {\n match: n => isBlock(editor, n),\n at: start,\n voids\n });\n const endBlock = getAboveNode(editor, {\n match: n => isBlock(editor, n),\n at: end,\n voids\n });\n const isAcrossBlocks = startBlock && endBlock && !Path.equals(startBlock[1], endBlock[1]);\n const isSingleText = Path.equals(start.path, end.path);\n const startVoid = voids ? null : getVoidNode(editor, {\n at: start,\n mode: 'highest'\n });\n const endVoid = voids ? null : getVoidNode(editor, {\n at: end,\n mode: 'highest'\n }); // If the start or end points are inside an inline void, nudge them out.\n\n if (startVoid) {\n const before = getPointBefore(editor, start);\n\n if (before && startBlock && Path.isAncestor(startBlock[1], before.path)) {\n start = before;\n }\n }\n\n if (endVoid) {\n const after = getPointAfter(editor, end);\n\n if (after && endBlock && Path.isAncestor(endBlock[1], after.path)) {\n end = after;\n }\n } // Get the highest nodes that are completely inside the range, as well as\n // the start and end nodes.\n\n\n const matches = [];\n let lastPath;\n\n const _nodes = getNodeEntries(editor, {\n at,\n voids\n });\n\n for (const entry of _nodes) {\n const [node, path] = entry;\n\n if (lastPath && Path.compare(path, lastPath) === 0) {\n continue;\n }\n\n if (!voids && isVoid(editor, node) || !Path.isCommon(path, start.path) && !Path.isCommon(path, end.path)) {\n matches.push(entry);\n lastPath = path;\n }\n }\n\n const pathRefs = Array.from(matches, ([, p]) => createPathRef(editor, p));\n const startRef = createPointRef(editor, start);\n const endRef = createPointRef(editor, end);\n\n if (!isSingleText && !startVoid) {\n const point = startRef.current;\n const [node] = getLeafNode(editor, point);\n const {\n path\n } = point;\n const {\n offset\n } = start;\n const text = node.text.slice(offset);\n editor.apply({\n type: 'remove_text',\n path,\n offset,\n text\n });\n }\n\n for (const pathRef of pathRefs) {\n const path = pathRef.unref();\n removeNodes(editor, {\n at: path,\n voids\n });\n }\n\n if (!endVoid) {\n const point = endRef.current;\n const [node] = getLeafNode(editor, point);\n const {\n path\n } = point;\n const offset = isSingleText ? start.offset : 0;\n const text = node.text.slice(offset, end.offset);\n editor.apply({\n type: 'remove_text',\n path,\n offset,\n text\n });\n }\n\n if (!isSingleText && isAcrossBlocks && endRef.current && startRef.current) {\n // DIFF: allow custom mergeNodes\n mergeNodes(editor, {\n at: endRef.current,\n hanging: true,\n voids\n });\n }\n\n const point = endRef.unref() || startRef.unref();\n\n if (options.at == null && point) {\n select(editor, point);\n }\n });\n};\n\n/**\n * Get the text string content of a location.\n *\n * Note: by default the text of void nodes is considered to be an empty\n * string, regardless of content, unless you pass in true for the voids option\n */\nconst getEditorString = (editor, at, options) => at ? Editor.string(editor, at, options) : '';\n\n/**\n * Get the first node at a location.\n */\nconst getFirstNode = (editor, at) => Editor.first(editor, at);\n\n/**\n * Get the fragment at a location.\n */\nconst getFragment = (editor, at) => Editor.fragment(editor, at);\n\n/**\n * Iterate through all of the levels at a location.\n */\nconst getLevels = (editor, options) => Editor.levels(editor, options);\n\n/**\n * Get the matching node in the branch of the document after a location.\n */\nconst getNextNode = (editor, options) => Editor.next(editor, options);\n\n/**\n * Get the set of currently tracked path refs of the editor.\n */\nconst getPathRefs = editor => Editor.pathRefs(editor);\n\n/**\n * Get the start or end point of a location.\n */\nconst getPoint = (editor, at, options) => Editor.point(editor, at, options);\n\n/**\n * Get the set of currently tracked point refs of the editor.\n */\nconst getPointRefs = editor => Editor.pointRefs(editor);\n\n/**\n * Iterate through all of the positions in the document where a `Point` can be\n * placed.\n *\n * By default it will move forward by individual offsets at a time, but you\n * can pass the `unit: 'character'` option to moved forward one character, word,\n * or line at at time.\n *\n * Note: By default void nodes are treated as a single point and iteration\n * will not happen inside their content unless you pass in true for the\n * voids option, then iteration will occur.\n */\nconst getPositions = (editor, options) => Editor.positions(editor, options);\n\n/**\n * Get a range of a location.\n */\nconst getRange = (editor, at, to) => Editor.range(editor, at, to);\n\n/**\n * Get the set of currently tracked range refs of the editor.\n */\nconst getRangeRefs = editor => Editor.rangeRefs(editor);\n\n/**\n * Check if a node has block children.\n */\nconst hasBlocks = (editor, element) => Editor.hasBlocks(editor, element);\n\n/**\n * Check if a node has inline and text children.\n */\nconst hasInlines = (editor, element) => Editor.hasInlines(editor, element);\n\n/**\n * Check if a node has text children.\n */\nconst hasTexts = (editor, element) => Editor.hasTexts(editor, element);\n\n/**\n * Insert a block break at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\nconst insertBreak = editor => Editor.insertBreak(editor);\n\n/**\n * Insert a node at the current selection.\n *\n * If the selection is currently expanded, it will be deleted first.\n */\nconst insertNode = (editor, node) => Editor.insertNode(editor, node);\n\n/**\n * Check if a point is an edge of a location.\n */\nconst isEdgePoint = (editor, point, at) => Editor.isEdge(editor, point, at);\n\n/**\n * Check if a value is an `Editor` object.\n */\nconst isEditor = value => Editor.isEditor(value);\n\n/**\n * Check if the editor is currently normalizing after each operation.\n */\nconst isEditorNormalizing = editor => Editor.isNormalizing(editor);\n\n/**\n * Check if a point is the end point of a location.\n * If point is null, return false.\n */\nconst isEndPoint = (editor, point, at) => !!point && Editor.isEnd(editor, point, at);\n\n/**\n * Check if a value is an inline `Element` object.\n */\nconst isInline = (editor, value) => Editor.isInline(editor, value);\n\n/**\n * Check if a point is the start point of a location.\n * If point is null, return false.\n */\nconst isStartPoint = (editor, point, at) => !!point && Editor.isStart(editor, point, at);\n\n/**\n * Normalize any dirty objects in the editor.\n */\nconst normalizeEditor = (editor, options) => Editor.normalize(editor, options);\n\n/**\n * Remove a custom property from all of the leaf text nodes in the current\n * selection.\n *\n * If the selection is currently collapsed, the removal will be stored on\n * `editor.marks` and applied to the text inserted next.\n */\nconst removeEditorMark = (editor, key) => Editor.removeMark(editor, key);\n\n/**\n * Check if an element matches set of properties.\n *\n * Note: this checks custom properties, and it does not ensure that any\n * children are equivalent.\n */\nconst elementMatches = (element, props) => Element.matches(element, props);\n\n/**\n * Check if a value is an array of `Element` objects.\n */\nconst isElementList = value => Element.isElementList(value);\n\n/**\n * {@link HistoryEditor.isHistoryEditor}\n */\nconst isHistoryEditor = value => HistoryEditor.isHistoryEditor(value);\n\n/**\n * {@link HistoryEditor.isMerging}\n */\nconst isHistoryMerging = editor => HistoryEditor.isMerging(editor);\n\n/**\n * {@link HistoryEditor.isSaving}\n */\nconst isHistorySaving = editor => HistoryEditor.isSaving(editor);\n\n/**\n * {@link HistoryEditor.withoutMerging}\n */\nconst withoutMergingHistory = (editor, fn) => HistoryEditor.withoutMerging(editor, fn);\n\n/**\n * {@link HistoryEditor.withoutSaving}\n */\nconst withoutSavingHistory = (editor, fn) => HistoryEditor.withoutSaving(editor, fn);\n\nconst isDescendant = node => isElement(node) || isText(node);\n\n/**\n * Get an entry for the common ancesetor node of two paths.\n */\nconst getCommonNode = (root, path, another) => Node$1.common(root, path, another);\n\n/**\n * Check if a value is a list of `Text` objects.\n */\nconst isTextList = value => Text.isTextList(value);\n\n/**\n * Check if two text nodes are equal.\n */\nconst textEquals = (text, another) => Text.equals(text, another);\n\n/**\n * Check if an text matches set of properties.\n *\n * Note: this is for matching custom properties, and it does not ensure that\n * the `text` property are two nodes equal.\n */\nconst textMatches = (text, props) => Text.matches(text, props);\n\n/**\n * Get the descendant node referred to by a specific path.\n * If the path is an empty array, it refers to the root node itself.\n * If the node is not found, return null.\n * Based on Slate get and has, performance optimization without overhead of\n * stringify on throwing\n */\nconst getNode = (root, path) => {\n try {\n for (let i = 0; i < path.length; i++) {\n const p = path[i];\n\n if (isText(root) || !root.children[p]) {\n return null;\n }\n\n root = root.children[p];\n }\n\n return root;\n } catch (e) {\n return null;\n }\n};\n\n/**\n * Get the node at a specific path, asserting that it's an ancestor node.\n */\nconst getNodeAncestor = (root, path) => Node$1.ancestor(root, path);\n\n/**\n * Return a generator of all the ancestor nodes above a specific path.\n *\n * By default the order is bottom-up, from lowest to highest ancestor in\n * the tree, but you can pass the `reverse: true` option to go top-down.\n */\nconst getNodeAncestors = (root, path, options) => Node$1.ancestors(root, path, options);\n\n/**\n * Get the child of a node at a specific index.\n */\nconst getNodeChild = (root, index) => Node$1.child(root, index);\n\n/**\n * Iterate over the children of a node at a specific path.\n */\nconst getNodeChildren = (root, path, options) => Node$1.children(root, path, options);\n\n/**\n * Get the node at a specific path, asserting that it's a descendant node.\n */\nconst getNodeDescendant = (root, path) => Node$1.descendant(root, path);\n\n/**\n * Return a generator of all the element nodes inside a root node. Each iteration\n * will return an `ElementEntry` tuple consisting of `[Element, Path]`. If the\n * root node is an element it will be included in the iteration as well.\n */\nconst getNodeElements = (root, options) => Node$1.elements(root, options);\n\n/**\n * Get the first node entry in a root node from a path.\n */\nconst getNodeFirstNode = (root, path) => Node$1.first(root, path);\n\n/**\n * Get the sliced fragment represented by a range inside a root node.\n */\nconst getNodeFragment = (root, range) => Node$1.fragment(root, range);\n\n/**\n * Get the last node entry in a root node from a path.\n */\nconst getNodeLastNode = (root, path) => Node$1.last(root, path);\n\n/**\n * Get the node at a specific path, ensuring it's a leaf text node.\n */\nconst getNodeLeaf = (root, path) => Node$1.leaf(root, path);\n\n/**\n * Return a generator of the in a branch of the tree, from a specific path.\n *\n * By default the order is top-down, from lowest to highest node in the tree,\n * but you can pass the `reverse: true` option to go bottom-up.\n */\nconst getNodeLevels = (root, path, options) => Node$1.levels(root, path, options);\n\n/**\n * Get the parent of a node at a specific path.\n */\nconst getNodeParent = (root, path) => Node$1.parent(root, path);\n\n/**\n * Extract the custom properties from a node.\n */\nconst getNodeProps = node => Node$1.extractProps(node);\n\n/**\n * Get the concatenated text string of a node's content.\n *\n * Note that this will not include spaces or line breaks between block nodes.\n * It is not a user-facing string, but a string for performing offset-related\n * computations for a node.\n */\nconst getNodeString = node => Node$1.string(node);\n\n/**\n * Return a generator of all leaf text nodes in a root node.\n */\nconst getNodeTexts = (root, options) => Node$1.texts(root, options);\n\n/**\n * Return a generator of all the node entries of a root node. Each entry is\n * returned as a `[Node, Path]` tuple, with the path referring to the node's\n * position inside the root node.\n */\nconst getNodes = (root, options) => Node$1.nodes(root, options);\n\n/**\n * Check if a descendant node exists at a specific path.\n */\nconst hasNode = (root, path) => Node$1.has(root, path);\n\n/**\n * Check if a value implements the `Node` interface.\n */\nconst isNode = value => Node$1.isNode(value);\n\n/**\n * Check if a value is a list of `Node` objects.\n */\nconst isNodeList = value => Node$1.isNodeList(value);\n\n/**\n * Check if a node matches a set of props.\n */\nconst nodeMatches = (node, props) => Node$1.matches(node, props);\n\n/**\n * See {@link Range.isCollapsed}.\n * Return false if `range` is not defined.\n */\n\nconst isCollapsed = range => !!range && Range.isCollapsed(range);\n\n/**\n * See {@link Range.isExpanded}.\n * Return false if `range` is not defined.\n */\n\nconst isExpanded = range => !!range && Range.isExpanded(range);\n\n/**\n * Blur the editor.\n */\nconst blurEditor = editor => ReactEditor.blur(editor);\n\n/**\n * Deselect the editor.\n */\nconst deselectEditor = editor => ReactEditor.deselect(editor);\n\n/**\n * Find the DOM node that implements DocumentOrShadowRoot for the editor.\n */\nconst findEditorDocumentOrShadowRoot = editor => {\n try {\n return ReactEditor.findDocumentOrShadowRoot(editor);\n } catch (e) {}\n};\n\n/**\n * {@link ReactEditor.findEventRange}\n */\nconst findEventRange = (editor, event) => {\n try {\n return ReactEditor.findEventRange(editor, event);\n } catch (e) {}\n};\n\n/**\n * Find a key for a Slate node.\n */\nconst findNodeKey = (editor, node) => {\n try {\n return ReactEditor.findKey(editor, node);\n } catch (e) {}\n};\n\n/**\n * Find the path of Slate node.\n */\nconst findNodePath = (editor, node) => {\n try {\n return ReactEditor.findPath(editor, node);\n } catch (e) {}\n};\n\n/**\n * Collapse the selection.\n */\nconst collapseSelection = (editor, options) => {\n Transforms.collapse(editor, options);\n};\n\n/**\n * Unset the selection.\n */\nconst deselect = editor => {\n Transforms.deselect(editor);\n};\n\n/**\n * Insert a fragment at a specific location in the editor.\n */\nconst insertFragment = (editor, fragment, options) => {\n Transforms.insertFragment(editor, fragment, options);\n};\n\n/**\n * Insert nodes at a specific location in the Editor.\n */\nconst insertNodes = (editor, nodes, options) => Transforms.insertNodes(editor, nodes, options);\n\n/**\n * Insert a string of text in the Editor.\n */\nconst insertText = (editor, text, options) => {\n Transforms.insertText(editor, text, options);\n};\n\n/**\n * Lift nodes at a specific location upwards in the document tree, splitting\n * their parent in two if necessary.\n */\nconst liftNodes = (editor, options) => Transforms.liftNodes(editor, options);\n\n/**\n * Move the selection's point forward or backward.\n */\nconst moveSelection = (editor, options) => {\n Transforms.move(editor, options);\n};\n\n/**\n * Set new properties on the nodes at a location.\n */\nconst setNodes = (editor, props, options) => Transforms.setNodes(editor, props, options);\n\n/**\n * Set new properties on one of the selection's points.\n */\nconst setPoint = (editor, props, options) => {\n Transforms.setPoint(editor, props, options);\n};\n\n/**\n * Set new properties on the selection.\n */\nconst setSelection = (editor, props) => {\n Transforms.setSelection(editor, props);\n};\n\n/**\n * Split the nodes at a specific location.\n */\nconst splitNodes = (editor, options) => Transforms.splitNodes(editor, options);\n\n/**\n * Unset properties on the nodes at a location.\n */\nconst unsetNodes = (editor, props, options) => {\n return Transforms.unsetNodes(editor, props, options);\n};\n\n/**\n * Unwrap the nodes at a location from a parent node, splitting the parent if\n * necessary to ensure that only the content in the range is unwrapped.\n */\nconst unwrapNodes = (editor, options) => {\n Transforms.unwrapNodes(editor, getQueryOptions(editor, options));\n};\n\n/**\n * Wrap the nodes at a location in a new container node, splitting the edges\n * of the range first to ensure that only the content in the range is wrapped.\n */\nconst wrapNodes = (editor, element, options) => {\n unhangRange(editor, options === null || options === void 0 ? void 0 : options.at, options);\n Transforms.wrapNodes(editor, element, options);\n};\n\n/**\n * Focus the editor. Extension:\n *\n * If `target` is defined:\n * - deselect the editor (otherwise it will focus the start of the editor)\n * - select the editor\n * - focus the editor\n */\nconst focusEditor = (editor, target) => {\n if (target) {\n withoutNormalizing(editor, () => {\n deselect(editor);\n select(editor, target);\n });\n }\n\n ReactEditor.focus(editor);\n};\n\n/**\n * Return the host window of the current editor.\n */\nconst getEditorWindow = editor => {\n try {\n return ReactEditor.getWindow(editor);\n } catch (e) {}\n};\n\n/**\n * Check if a DOM node is within the editor.\n */\nconst hasEditorDOMNode = (editor, target, options) => {\n try {\n return ReactEditor.hasDOMNode(editor, target, options);\n } catch (e) {}\n\n return false;\n};\n\n/**\n * Insert data from a `DataTransfer` into the editor.\n */\nconst insertData = (editor, data) => ReactEditor.insertData(editor, data);\n\n/**\n * Check if the editor is focused.\n */\nconst isEditorFocused = editor => ReactEditor.isFocused(editor);\n\n/**\n * Check if the editor is in read-only mode.\n */\nconst isEditorReadOnly = editor => ReactEditor.isReadOnly(editor);\n\n/**\n * Sets data from the currently selected fragment on a `DataTransfer`.\n */\nconst setFragmentData = (editor, data) => ReactEditor.setFragmentData(editor, data);\n\n/**\n * Find the native DOM element from a Slate node.\n */\nconst toDOMNode = (editor, node) => {\n try {\n return ReactEditor.toDOMNode(editor, node);\n } catch (e) {}\n};\n\n/**\n * Find a native DOM selection point from a Slate point.\n */\nconst toDOMPoint = (editor, point) => {\n try {\n return ReactEditor.toDOMPoint(editor, point);\n } catch (e) {}\n};\n\n/**\n * {@link ReactEditor.toDOMRange}\n */\nconst toDOMRange = (editor, range) => {\n try {\n return ReactEditor.toDOMRange(editor, range);\n } catch (e) {}\n};\n\n/**\n * {@link ReactEditor.toSlateNode}\n */\nconst toSlateNode = (editor, domNode) => {\n try {\n return ReactEditor.toSlateNode(editor, domNode);\n } catch (e) {}\n};\n\n/**\n * {@link ReactEditor.toSlatePoint}\n */\nconst toSlatePoint = (editor, domPoint, options) => {\n try {\n return ReactEditor.toSlatePoint(editor, domPoint, options);\n } catch (e) {}\n};\n\n/**\n * {@link ReactEditor.toSlateRange}\n */\nconst toSlateRange = (editor, domRange, options) => {\n try {\n return ReactEditor.toSlateRange(editor, domRange, options);\n } catch (e) {}\n};\n\n/**\n * Get the start point of the next node.\n */\nconst getNextNodeStartPoint = (editor, at) => {\n const nextEntry = getNextNode(editor, {\n at\n });\n if (!nextEntry) return;\n return getStartPoint(editor, nextEntry[1]);\n};\n\n/**\n * Get the next sibling nodes after a path.\n * @param ancestorEntry Ancestor of the sibling nodes\n * @param path Path of the reference node\n */\nconst getNextSiblingNodes = (ancestorEntry, path) => {\n const [ancestor, ancestorPath] = ancestorEntry;\n const leafIndex = path[ancestorPath.length];\n const siblings = [];\n const ancestorChildren = ancestor.children;\n\n if (leafIndex + 1 < ancestor.children.length) {\n for (let i = leafIndex + 1; i < ancestor.children.length; i++) {\n siblings.push(ancestorChildren[i]);\n }\n }\n\n return siblings;\n};\n\n/**\n * Get typed editor operations.\n */\nconst getOperations = editor => editor.operations;\n\n/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nvar _arrayMap = arrayMap;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nvar _setCacheAdd = setCacheAdd;\n\n/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nvar _setCacheHas = setCacheHas;\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new _MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;\nSetCache.prototype.has = _setCacheHas;\n\nvar _SetCache = SetCache;\n\n/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nvar _arraySome = arraySome;\n\n/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nvar _cacheHas = cacheHas;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG$5 = 1,\n COMPARE_UNORDERED_FLAG$3 = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new _SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!_arraySome(other, function(othValue, othIndex) {\n if (!_cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nvar _equalArrays = equalArrays;\n\n/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nvar _mapToArray = mapToArray;\n\n/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nvar _setToArray = setToArray;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG$4 = 1,\n COMPARE_UNORDERED_FLAG$2 = 2;\n\n/** `Object#toString` result references. */\nvar boolTag$2 = '[object Boolean]',\n dateTag$2 = '[object Date]',\n errorTag$1 = '[object Error]',\n mapTag$4 = '[object Map]',\n numberTag$2 = '[object Number]',\n regexpTag$2 = '[object RegExp]',\n setTag$4 = '[object Set]',\n stringTag$2 = '[object String]',\n symbolTag$3 = '[object Symbol]';\n\nvar arrayBufferTag$2 = '[object ArrayBuffer]',\n dataViewTag$3 = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto$2 = _Symbol ? _Symbol.prototype : undefined,\n symbolValueOf$1 = symbolProto$2 ? symbolProto$2.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag$3:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag$2:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag$2:\n case dateTag$2:\n case numberTag$2:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq_1(+object, +other);\n\n case errorTag$1:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag$2:\n case stringTag$2:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag$4:\n var convert = _mapToArray;\n\n case setTag$4:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;\n convert || (convert = _setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG$2;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag$3:\n if (symbolValueOf$1) {\n return symbolValueOf$1.call(object) == symbolValueOf$1.call(other);\n }\n }\n return false;\n}\n\nvar _equalByTag = equalByTag;\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nvar _arrayPush = arrayPush;\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));\n}\n\nvar _baseGetAllKeys = baseGetAllKeys;\n\n/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nvar _arrayFilter = arrayFilter;\n\n/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nvar stubArray_1 = stubArray;\n\n/** Used for built-in method references. */\nvar objectProto$5 = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto$5.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols$1 = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols$1 ? stubArray_1 : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return _arrayFilter(nativeGetSymbols$1(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nvar _getSymbols = getSymbols;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = _overArg(Object.keys, Object);\n\nvar _nativeKeys = nativeKeys;\n\n/** Used for built-in method references. */\nvar objectProto$4 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$4 = objectProto$4.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!_isPrototype(object)) {\n return _nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty$4.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nvar _baseKeys = baseKeys;\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);\n}\n\nvar keys_1 = keys;\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return _baseGetAllKeys(object, keys_1, _getSymbols);\n}\n\nvar _getAllKeys = getAllKeys;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG$3 = 1;\n\n/** Used for built-in method references. */\nvar objectProto$3 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$3 = objectProto$3.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,\n objProps = _getAllKeys(object),\n objLength = objProps.length,\n othProps = _getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nvar _equalObjects = equalObjects;\n\n/* Built-in method references that are verified to be native. */\nvar DataView = _getNative(_root, 'DataView');\n\nvar _DataView = DataView;\n\n/* Built-in method references that are verified to be native. */\nvar Promise$1 = _getNative(_root, 'Promise');\n\nvar _Promise = Promise$1;\n\n/* Built-in method references that are verified to be native. */\nvar Set = _getNative(_root, 'Set');\n\nvar _Set = Set;\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap$1 = _getNative(_root, 'WeakMap');\n\nvar _WeakMap = WeakMap$1;\n\n/** `Object#toString` result references. */\nvar mapTag$3 = '[object Map]',\n objectTag$2 = '[object Object]',\n promiseTag = '[object Promise]',\n setTag$3 = '[object Set]',\n weakMapTag$1 = '[object WeakMap]';\n\nvar dataViewTag$2 = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = _toSource(_DataView),\n mapCtorString = _toSource(_Map),\n promiseCtorString = _toSource(_Promise),\n setCtorString = _toSource(_Set),\n weakMapCtorString = _toSource(_WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = _baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||\n (_Map && getTag(new _Map) != mapTag$3) ||\n (_Promise && getTag(_Promise.resolve()) != promiseTag) ||\n (_Set && getTag(new _Set) != setTag$3) ||\n (_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {\n getTag = function(value) {\n var result = _baseGetTag(value),\n Ctor = result == objectTag$2 ? value.constructor : undefined,\n ctorString = Ctor ? _toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag$2;\n case mapCtorString: return mapTag$3;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag$3;\n case weakMapCtorString: return weakMapTag$1;\n }\n }\n return result;\n };\n}\n\nvar _getTag = getTag;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG$2 = 1;\n\n/** `Object#toString` result references. */\nvar argsTag$1 = '[object Arguments]',\n arrayTag$1 = '[object Array]',\n objectTag$1 = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto$2 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$2 = objectProto$2.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray_1(object),\n othIsArr = isArray_1(other),\n objTag = objIsArr ? arrayTag$1 : _getTag(object),\n othTag = othIsArr ? arrayTag$1 : _getTag(other);\n\n objTag = objTag == argsTag$1 ? objectTag$1 : objTag;\n othTag = othTag == argsTag$1 ? objectTag$1 : othTag;\n\n var objIsObj = objTag == objectTag$1,\n othIsObj = othTag == objectTag$1,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer_1(object)) {\n if (!isBuffer_1(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new _Stack);\n return (objIsArr || isTypedArray_1(object))\n ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {\n var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new _Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new _Stack);\n return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nvar _baseIsEqualDeep = baseIsEqualDeep;\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {\n return value !== value && other !== other;\n }\n return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nvar _baseIsEqual = baseIsEqual;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG$1 = 1,\n COMPARE_UNORDERED_FLAG$1 = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new _Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nvar _baseIsMatch = baseIsMatch;\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject_1(value);\n}\n\nvar _isStrictComparable = isStrictComparable;\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys_1(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, _isStrictComparable(value)];\n }\n return result;\n}\n\nvar _getMatchData = getMatchData;\n\n/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nvar _matchesStrictComparable = matchesStrictComparable;\n\n/**\n * The base implementation of `_.matches` which doesn't clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = _getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return _matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || _baseIsMatch(object, source, matchData);\n };\n}\n\nvar _baseMatches = baseMatches;\n\n/** `Object#toString` result references. */\nvar symbolTag$2 = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike_1(value) && _baseGetTag(value) == symbolTag$2);\n}\n\nvar isSymbol_1 = isSymbol;\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray_1(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol_1(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nvar _isKey = isKey;\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || _MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = _MapCache;\n\nvar memoize_1 = memoize;\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function's\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize_1(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nvar _memoizeCapped = memoizeCapped;\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = _memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nvar _stringToPath = stringToPath;\n\n/** Used as references for various `Number` constants. */\nvar INFINITY$1 = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,\n symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray_1(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return _arrayMap(value, baseToString) + '';\n }\n if (isSymbol_1(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;\n}\n\nvar _baseToString = baseToString;\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : _baseToString(value);\n}\n\nvar toString_1 = toString;\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray_1(value)) {\n return value;\n }\n return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));\n}\n\nvar _castPath = castPath;\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol_1(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nvar _toKey = toKey;\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = _castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[_toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nvar _baseGet = baseGet;\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : _baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nvar get_1 = get;\n\n/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nvar _baseHasIn = baseHasIn;\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = _castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = _toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength_1(length) && _isIndex(key, length) &&\n (isArray_1(object) || isArguments_1(object));\n}\n\nvar _hasPath = hasPath;\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && _hasPath(object, path, _baseHasIn);\n}\n\nvar hasIn_1 = hasIn;\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (_isKey(path) && _isStrictComparable(srcValue)) {\n return _matchesStrictComparable(_toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get_1(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn_1(object, path)\n : _baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nvar _baseMatchesProperty = baseMatchesProperty;\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nvar _baseProperty = baseProperty;\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return _baseGet(object, path);\n };\n}\n\nvar _basePropertyDeep = basePropertyDeep;\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return _isKey(path) ? _baseProperty(_toKey(path)) : _basePropertyDeep(path);\n}\n\nvar property_1 = property;\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == 'function') {\n return value;\n }\n if (value == null) {\n return identity_1;\n }\n if (typeof value == 'object') {\n return isArray_1(value)\n ? _baseMatchesProperty(value[0], value[1])\n : _baseMatches(value);\n }\n return property_1(value);\n}\n\nvar _baseIteratee = baseIteratee;\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && _baseFor(object, iteratee, keys_1);\n}\n\nvar _baseForOwn = baseForOwn;\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike_1(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nvar _createBaseEach = createBaseEach;\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = _createBaseEach(_baseForOwn);\n\nvar _baseEach = baseEach;\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike_1(collection) ? Array(collection.length) : [];\n\n _baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nvar _baseMap = baseMap;\n\n/**\n * Creates an array of values by running each element in `collection` thru\n * `iteratee`. The iteratee is invoked with three arguments:\n * (value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,\n * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,\n * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,\n * `template`, `trim`, `trimEnd`, `trimStart`, and `words`\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * _.map([4, 8], square);\n * // => [16, 64]\n *\n * _.map({ 'a': 4, 'b': 8 }, square);\n * // => [16, 64] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // The `_.property` iteratee shorthand.\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\nfunction map(collection, iteratee) {\n var func = isArray_1(collection) ? _arrayMap : _baseMap;\n return func(collection, _baseIteratee(iteratee));\n}\n\nvar map_1 = map;\n\n/**\n * Is the range (default: selection) across blocks.\n * - return undefined if block not found\n * - return boolean whether one of the block is not found, but the other is found\n * - return boolean whether block paths are unequal\n */\n\nconst isRangeAcrossBlocks = (editor, {\n at,\n ...options\n} = {}) => {\n if (!at) at = editor.selection;\n if (!at) return;\n const [start, end] = Range.edges(at);\n const startBlock = getBlockAbove(editor, {\n at: start,\n ...options\n });\n const endBlock = getBlockAbove(editor, {\n at: end,\n ...options\n });\n if (!startBlock && !endBlock) return;\n if (!startBlock || !endBlock) return true;\n return !Path.equals(startBlock[1], endBlock[1]);\n};\n\n/* eslint-disable no-constant-condition */\n\n/**\n * {@link getPointBefore} with additional options.\n * TODO: support for sequence of any characters.\n */\nconst getPointBeforeLocation = (editor, at, options) => {\n if (!options || !options.match && !options.matchString) {\n return getPointBefore(editor, at, options);\n }\n\n const unitOffset = !options.unit || options.unit === 'offset';\n const matchStrings = options.matchString ? castArray_1(options.matchString) : [''];\n let point;\n matchStrings.some(matchString => {\n let beforeAt = at;\n let previousBeforePoint = getPoint(editor, at, {\n edge: 'end'\n });\n const stackLength = matchString.length + 1;\n const stack = Array(stackLength);\n let count = 0;\n\n while (true) {\n var _options$match;\n\n const beforePoint = getPointBefore(editor, beforeAt, options); // not found\n\n if (!beforePoint) return; // stop looking outside of current block\n\n if (isRangeAcrossBlocks(editor, {\n at: {\n anchor: beforePoint,\n focus: previousBeforePoint\n }\n })) {\n return;\n }\n\n const beforeString = getEditorString(editor, {\n anchor: beforePoint,\n focus: previousBeforePoint\n });\n let beforeStringToMatch = beforeString;\n\n if (unitOffset && stackLength) {\n stack.unshift({\n point: beforePoint,\n text: beforeString\n });\n stack.pop();\n beforeStringToMatch = map_1(stack.slice(0, -1), 'text').join('');\n }\n\n if (matchString === beforeStringToMatch || (_options$match = options.match) !== null && _options$match !== void 0 && _options$match.call(options, {\n beforeString: beforeStringToMatch,\n beforePoint,\n at\n })) {\n if (options.afterMatch) {\n if (stackLength && unitOffset) {\n var _stack;\n\n point = (_stack = stack[stack.length - 1]) === null || _stack === void 0 ? void 0 : _stack.point;\n return !!point;\n }\n\n point = previousBeforePoint;\n return true;\n }\n\n point = beforePoint;\n return true;\n }\n\n previousBeforePoint = beforePoint;\n beforeAt = beforePoint;\n count += 1;\n\n if (!options.skipInvalid) {\n if (!matchString || count >= matchString.length) return;\n }\n }\n });\n return point;\n};\n\n/**\n * Get the point from a location (default: selection).\n * If the location is a range, get the anchor point.\n * If the location is a path, get the point at this path with offset 0.\n * If `focus` is true, get the focus point.\n */\nconst getPointFromLocation = (editor, {\n at = editor.selection,\n focus\n} = {}) => {\n let point;\n if (Range.isRange(at)) point = !focus ? at.anchor : at.focus;\n if (Point.isPoint(at)) point = at;\n if (Path.isPath(at)) point = {\n path: at,\n offset: 0\n };\n return point;\n};\n\n/**\n * If the start point is inside an inline void, get the point before or after it.\n */\n\nconst getPointNextToVoid = (editor, {\n at,\n after\n}) => {\n const startVoid = getVoidNode(editor, {\n at,\n mode: 'highest'\n });\n\n if (startVoid) {\n const blockAbove = getBlockAbove(editor, {\n at\n });\n\n if (blockAbove) {\n let nextPoint;\n\n if (after) {\n nextPoint = getPointAfter(editor, at);\n } else {\n nextPoint = getPointBefore(editor, at);\n }\n\n if (nextPoint && blockAbove && Path.isAncestor(blockAbove[1], nextPoint.path)) {\n at = nextPoint;\n }\n }\n }\n\n return at;\n};\n\n/**\n * Query the node entry.\n */\nconst queryNode = (entry, {\n filter,\n allow,\n exclude,\n level,\n maxLevel\n} = {}) => {\n if (!entry) return false;\n const [node, path] = entry;\n\n if (level) {\n const levels = castArray_1(level);\n\n if (!levels.includes(path.length)) {\n return false;\n }\n }\n\n if (maxLevel) {\n if (path.length > maxLevel) {\n return false;\n }\n }\n\n if (filter && !filter(entry)) {\n return false;\n }\n\n if (allow) {\n const allows = castArray_1(allow);\n\n if (allows.length && !allows.includes(node.type)) {\n return false;\n }\n }\n\n if (exclude) {\n const excludes = castArray_1(exclude);\n\n if (excludes.length && excludes.includes(node.type)) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Find the block before a block by id.\n * If not found, find the first block by id and return [null, its previous path]\n */\n\nconst getPreviousBlockById = (editor, id, query) => {\n const entry = findNode(editor, {\n match: {\n id\n }\n });\n\n if (entry) {\n const prevEntry = getPreviousNode(editor, {\n at: entry[1]\n });\n\n if (prevEntry && prevEntry[0].id && isBlock(editor, prevEntry[0])) {\n return prevEntry;\n }\n }\n\n let found = false;\n\n const _nodes = getNodeEntries(editor, {\n mode: 'highest',\n reverse: true,\n match: n => {\n // filter nodes that are not blocks and without id.\n if (!isBlock(editor, n) || !n.id) return false; // find the block then take the previous one.\n\n if (n.id === id) {\n found = true;\n return false;\n }\n\n return found && n.id !== id && queryNode([n, []], query);\n },\n at: []\n });\n\n const nodeEntries = Array.from(_nodes);\n\n if (nodeEntries.length) {\n return nodeEntries[0];\n }\n\n if (!found) return;\n\n const _entries = getNodeEntries(editor, {\n mode: 'highest',\n match: n => {\n return isBlock(editor, n) && !!n.id && queryNode([n, []], query);\n },\n at: []\n });\n\n const firstNodeEntry = Array.from(_entries);\n\n if (firstNodeEntry.length) {\n const [, path] = firstNodeEntry[0];\n path[path.length - 1] = path[path.length - 1] - 1;\n return [null, path];\n }\n};\n\n/**\n * Get the end point of the previous node.\n */\nconst getPreviousNodeEndPoint = (editor, at) => {\n const prevEntry = getPreviousNode(editor, {\n at\n });\n if (!prevEntry) return;\n return getEndPoint(editor, prevEntry[1]);\n};\n\nconst getPreviousPath = path => {\n if (path.length === 0) return;\n const last = path[path.length - 1];\n if (last <= 0) return;\n return path.slice(0, -1).concat(last - 1);\n};\n\n/**\n * Get range from {@link getPointBeforeLocation} to the end point of `at`.\n */\nconst getRangeBefore = (editor, at, options) => {\n const anchor = getPointBeforeLocation(editor, at, options);\n if (!anchor) return;\n const focus = getPoint(editor, at, {\n edge: 'end'\n });\n return {\n anchor,\n focus\n };\n};\n\n/**\n * Get the range from the start of the block above a location (default: selection) to the location.\n */\n\nconst getRangeFromBlockStart = (editor, options = {}) => {\n var _getBlockAbove;\n\n const path = (_getBlockAbove = getBlockAbove(editor, options)) === null || _getBlockAbove === void 0 ? void 0 : _getBlockAbove[1];\n if (!path) return;\n const start = getStartPoint(editor, path);\n const focus = getPointFromLocation(editor, options);\n if (!focus) return;\n return {\n anchor: start,\n focus\n };\n};\n\n/**\n * Get the selected text.\n * Return empty string if no selection.\n */\nconst getSelectionText = editor => getEditorString(editor, editor.selection);\n\n/**\n * Is an ancestor empty (empty text and no inline children).\n */\nconst isAncestorEmpty = (editor, node) => !getNodeString(node) && !node.children.some(n => isInline(editor, n));\n\n/**\n * Is the block above the selection empty.\n */\n\nconst isBlockAboveEmpty = editor => {\n var _getBlockAbove;\n\n const block = (_getBlockAbove = getBlockAbove(editor)) === null || _getBlockAbove === void 0 ? void 0 : _getBlockAbove[0];\n if (!block) return false;\n return isAncestorEmpty(editor, block);\n};\n\n/**\n * Is there empty text after the selection.\n * If there is no leaf after the selected leaf, return {@link isEndPoint}.\n * Else, check if the next leaves are empty.\n */\n\nconst isBlockTextEmptyAfterSelection = editor => {\n if (!editor.selection) return false;\n const blockAbove = getBlockAbove(editor);\n if (!blockAbove) return false;\n const cursor = editor.selection.focus;\n const selectionParentEntry = getParentNode(editor, editor.selection);\n if (!selectionParentEntry) return false;\n const [, selectionParentPath] = selectionParentEntry;\n if (!isEndPoint(editor, cursor, selectionParentPath)) return false;\n const siblingNodes = getNextSiblingNodes(blockAbove, cursor.path);\n\n if (siblingNodes.length) {\n for (const siblingNode of siblingNodes) {\n if (isText(siblingNode) && siblingNode.text) {\n return false;\n }\n }\n } else {\n return isEndPoint(editor, cursor, blockAbove[1]);\n }\n\n return true;\n};\n\n/**\n * Is it the first child of the parent\n */\nconst isFirstChild = path => path[path.length - 1] === 0;\n\n/**\n * Is the mark defined in the selection.\n */\n\nconst isMarkActive = (editor, type) => {\n return isDefined(getMark(editor, type));\n};\n\n// Starts with whitespace char or nothing\nconst AFTER_MATCH_REGEX = /^(\\s|$)/;\n/**\n * Is a point at the end of a word\n */\n\nconst isPointAtWordEnd = (editor, {\n at\n}) => {\n // Point after at\n const after = getPointAfter(editor, at); // From at to after\n\n const afterRange = getRange(editor, at, after);\n const afterText = getEditorString(editor, afterRange); // Match regex on after text\n\n return !!afterText.match(AFTER_MATCH_REGEX);\n};\n\n/**\n * Whether the range is in the same block.\n */\n\nconst isRangeInSameBlock = (editor, {\n at,\n ...options\n} = {}) => {\n if (!at) at = editor.selection;\n if (!at) return;\n const [start, end] = Range.edges(at);\n const startBlock = getBlockAbove(editor, {\n at: start,\n ...options\n });\n const endBlock = getBlockAbove(editor, {\n at: end,\n ...options\n });\n if (!startBlock || !endBlock) return;\n return Path.equals(startBlock[1], endBlock[1]);\n};\n\n/**\n * Is the range in the same single text path.\n */\n\nconst isRangeInSingleText = at => {\n const [start, end] = Range.edges(at);\n return Path.equals(start.path, end.path);\n};\n\n/**\n * Is the selection focus at the end of its parent block.\n */\n\nconst isSelectionAtBlockEnd = (editor, options) => {\n var _getBlockAbove, _editor$selection;\n\n const path = (_getBlockAbove = getBlockAbove(editor, options)) === null || _getBlockAbove === void 0 ? void 0 : _getBlockAbove[1];\n return !!path && isEndPoint(editor, (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.focus, path);\n};\n\n/**\n * Is the selection focus at the start of its parent block.\n *\n * Supports the same options provided by {@link getBlockAbove}.\n */\n\nconst isSelectionAtBlockStart = (editor, options) => {\n var _getBlockAbove, _editor$selection;\n\n const path = (_getBlockAbove = getBlockAbove(editor, options)) === null || _getBlockAbove === void 0 ? void 0 : _getBlockAbove[1];\n return !!path && isStartPoint(editor, (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.focus, path);\n};\n\n/**\n * Is the selection expanded.\n */\n\nconst isSelectionExpanded = editor => isExpanded(editor.selection);\n\nconst isTextByPath = (editor, path) => {\n const node = getNode(editor, path);\n return isText(node);\n};\n\n/**\n * Does the node match the type provided.\n */\n\nconst isType = (editor, node, key) => {\n const keys = castArray_1(key);\n const types = [];\n keys.forEach(_key => types.push(getPluginType(editor, _key)));\n return types.includes(node === null || node === void 0 ? void 0 : node.type);\n};\n\n/**\n * Is the word at the point after a trigger (punctuation character)\n * https://github.com/ianstormtaylor/slate/blob/main/packages/slate/src/utils/string.ts#L6\n */\n\nconst isWordAfterTrigger = (editor, {\n at,\n trigger\n}) => {\n // Point at the start of previous word (excluding punctuation)\n const wordBefore = getPointBefore(editor, at, {\n unit: 'word'\n }); // Point before wordBefore\n\n const before = wordBefore && getPointBefore(editor, wordBefore); // Range from before to start\n\n const beforeRange = before && getRange(editor, before, at); // Before text\n\n const beforeText = getEditorString(editor, beforeRange); // Starts with char and ends with word characters\n\n const escapedTrigger = escapeRegExp(trigger);\n const beforeRegex = new RegExp(`^${escapedTrigger}([\\\\w|À-ÖØ-öø-ÿ|а-яА-ЯёЁ]+)$`); // Match regex on before text\n\n const match = !!beforeText && beforeText.match(beforeRegex);\n return {\n range: beforeRange,\n match\n };\n};\n\n/**\n * Iterate through all of the nodes in the editor and break early for the first truthy match. Otherwise\n * returns false.\n */\n\nconst someNode = (editor, options) => {\n return !!findNode(editor, options);\n};\n\n/**\n * Query the editor state.\n */\n\nconst queryEditor = (editor, {\n filter,\n selectionAtBlockStart,\n selectionAtBlockEnd,\n allow,\n exclude,\n at = editor.selection || []\n} = {}) => {\n if (filter && !filter(editor) || selectionAtBlockStart && !isSelectionAtBlockStart(editor) || selectionAtBlockEnd && !isSelectionAtBlockEnd(editor)) {\n return false;\n }\n\n const allows = castArray_1(allow);\n\n if (allows.length && !someNode(editor, {\n at,\n match: {\n type: allows\n }\n })) {\n return false;\n }\n\n const excludes = castArray_1(exclude);\n\n if (excludes.length && someNode(editor, {\n at,\n match: {\n type: excludes\n }\n })) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Recursively apply an operation to children nodes with a query.\n */\nconst applyDeepToNodes = ({\n node,\n path = [],\n source,\n apply,\n query\n}) => {\n const entry = [node, path];\n\n if (queryNode(entry, query)) {\n if (source instanceof Function) {\n apply(node, source());\n } else {\n apply(node, source);\n }\n }\n\n if (!isAncestor(node)) return;\n node.children.forEach((child, index) => {\n applyDeepToNodes({\n node: child,\n path: path.concat([index]),\n source,\n apply,\n query\n });\n });\n};\n\n/**\n * Recursively merge a source object to children nodes with a query.\n */\n\nconst mergeDeepToNodes = options => {\n applyDeepToNodes({ ...options,\n apply: merge_1\n });\n};\n\nconst pipeDeserializeHtmlLeaf = (editor, element) => {\n let node = {};\n [...editor.plugins].reverse().forEach(plugin => {\n const deserialized = pluginDeserializeHtml(editor, plugin, {\n element,\n deserializeLeaf: true\n });\n if (!deserialized) return;\n node = { ...node,\n ...deserialized.node\n };\n });\n return node;\n};\n\n/**\n * Deserialize HTML to TDescendant[] with marks on Text.\n * Build the leaf from the leaf deserializers of each plugin.\n */\n\nconst htmlElementToLeaf = (editor, element) => {\n const node = pipeDeserializeHtmlLeaf(editor, element);\n return deserializeHtmlNodeChildren(editor, element).reduce((arr, child) => {\n if (!child) return arr;\n\n if (isElement(child)) {\n if (Object.keys(node).length) {\n mergeDeepToNodes({\n node: child,\n source: node,\n query: {\n filter: ([n]) => isText(n)\n }\n });\n }\n\n arr.push(child);\n } else {\n const attributes = { ...node\n }; // attributes should not override child attributes\n\n if (isText(child) && child.text) {\n Object.keys(attributes).forEach(key => {\n if (attributes[key] && child[key]) {\n attributes[key] = child[key];\n }\n });\n }\n\n arr.push(jsx('text', attributes, child));\n }\n\n return arr;\n }, []);\n};\n\nconst isHtmlText = node => node.nodeType === Node.TEXT_NODE;\n\n/**\n * Deserialize HTML text node to text.\n */\n// if (isHtmlText(node)) {\n// return node.nodeValue === '\\n' && null : node.textContent;\n// }\n// };\n\nconst htmlTextNodeToString = node => {\n if (isHtmlText(node)) {\n return node.nodeValue === '\\n' ? null : node.textContent;\n }\n};\n\nconst isHtmlElement = node => node.nodeType === Node.ELEMENT_NODE;\n\n/**\n * Deserialize HTML element or child node.\n */\n\nconst deserializeHtmlNode = editor => node => {\n const textNode = htmlTextNodeToString(node);\n if (textNode) return textNode;\n if (!isHtmlElement(node)) return null; // break line\n\n const breakLine = htmlBrToNewLine(node);\n if (breakLine) return breakLine; // body\n\n const fragment = htmlBodyToFragment(editor, node);\n if (fragment) return fragment; // element\n\n const element = htmlElementToElement(editor, node);\n if (element) return element; // leaf\n\n return htmlElementToLeaf(editor, node);\n};\n\n/**\n * Deserialize HTML element to fragment.\n */\n\nconst deserializeHtmlElement = (editor, element) => {\n return deserializeHtmlNode(editor)(element);\n};\n\n/**\n * Convert HTML string into HTML element.\n */\nconst htmlStringToDOMNode = (rawHtml, stripWhitespace = true) => {\n const node = document.createElement('body');\n node.innerHTML = rawHtml;\n\n if (stripWhitespace) {\n node.innerHTML = node.innerHTML.replace(/(\\r\\n|\\n|\\r|\\t)/gm, '');\n }\n\n return node;\n};\n\n/**\n * Deserialize HTML element to a valid document fragment.\n */\n\nconst deserializeHtml = (editor, {\n element,\n stripWhitespace = true\n}) => {\n // for serializer\n if (typeof element === 'string') {\n element = htmlStringToDOMNode(element, stripWhitespace);\n }\n\n const fragment = deserializeHtmlElement(editor, element);\n return normalizeDescendantsToDocumentFragment(editor, {\n descendants: fragment\n });\n};\n\nconst parseHtmlDocument = html => {\n return new DOMParser().parseFromString(html, 'text/html');\n};\n\nconst KEY_DESERIALIZE_HTML = 'deserializeHtml';\n/**\n * Enables support for deserializing inserted content from HTML format to Slate format.\n */\n\nconst createDeserializeHtmlPlugin = createPluginFactory({\n key: KEY_DESERIALIZE_HTML,\n then: editor => ({\n editor: {\n insertData: {\n format: 'text/html',\n getFragment: ({\n data\n }) => {\n const document = parseHtmlDocument(data);\n return deserializeHtml(editor, {\n element: document.body\n });\n }\n }\n }\n })\n});\n\n/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n var value = array[index];\n setter(accumulator, value, iteratee(value), array);\n }\n return accumulator;\n}\n\nvar _arrayAggregator = arrayAggregator;\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n _baseEach(collection, function(value, key, collection) {\n setter(accumulator, value, iteratee(value), collection);\n });\n return accumulator;\n}\n\nvar _baseAggregator = baseAggregator;\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n return function(collection, iteratee) {\n var func = isArray_1(collection) ? _arrayAggregator : _baseAggregator,\n accumulator = initializer ? initializer() : {};\n\n return func(collection, setter, _baseIteratee(iteratee), accumulator);\n };\n}\n\nvar _createAggregator = createAggregator;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The corresponding value of\n * each key is the last element responsible for generating the key. The\n * iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var array = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.keyBy(array, function(o) {\n * return String.fromCharCode(o.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.keyBy(array, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n */\nvar keyBy = _createAggregator(function(result, value, key) {\n _baseAssignValue(result, key, value);\n});\n\nvar keyBy_1 = keyBy;\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return _arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nvar _baseValues = baseValues;\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n return object == null ? [] : _baseValues(object, keys_1(object));\n}\n\nvar values_1 = values;\n\n/**\n * Recursively merge nested plugins into the root plugins\n */\nconst mergeDeepPlugins = (editor, _plugin) => {\n const plugin = { ..._plugin\n };\n const {\n then\n } = plugin;\n\n if (then) {\n delete plugin.then;\n const {\n plugins: pluginPlugins\n } = plugin;\n const pluginThen = mergeDeepPlugins(editor, defaultsDeep_1(then(editor, plugin), plugin)); // merge plugins by key\n\n if (pluginPlugins && pluginThen.plugins) {\n const merged = merge_1(keyBy_1(pluginPlugins, 'key'), keyBy_1(pluginThen.plugins, 'key'));\n pluginThen.plugins = values_1(merged);\n }\n\n return pluginThen;\n }\n\n return plugin;\n};\n\nconst setDefaultPlugin = plugin => {\n if (plugin.type === undefined) plugin.type = plugin.key;\n if (!plugin.options) plugin.options = {};\n if (!plugin.inject) plugin.inject = {};\n if (!plugin.editor) plugin.editor = {};\n return plugin;\n};\n\n/**\n * Recursively merge plugin.plugins into editor.plugins and editor.pluginsByKey\n */\n\nconst flattenDeepPlugins = (editor, plugins) => {\n if (!plugins) return;\n plugins.forEach(plugin => {\n let p = setDefaultPlugin(plugin);\n p = mergeDeepPlugins(editor, p);\n\n if (!editor.pluginsByKey[p.key]) {\n editor.plugins.push(p);\n editor.pluginsByKey[p.key] = p;\n } else {\n const index = editor.plugins.indexOf(editor.pluginsByKey[p.key]);\n const mergedPlugin = defaultsDeep_1(p, editor.pluginsByKey[p.key]);\n\n if (index >= 0) {\n editor.plugins[index] = mergedPlugin;\n }\n\n editor.pluginsByKey[p.key] = mergedPlugin;\n }\n\n flattenDeepPlugins(editor, p.plugins);\n });\n};\n\n/**\n * Flatten deep plugins then set editor.plugins and editor.pluginsByKey\n */\n\nconst setPlatePlugins = (editor, {\n disableCorePlugins,\n plugins: _plugins = []\n}) => {\n let plugins = [];\n\n if (disableCorePlugins !== true) {\n const dcp = disableCorePlugins;\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.react)) {\n var _ref, _editor$pluginsByKey;\n\n plugins.push((_ref = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey = editor.pluginsByKey) === null || _editor$pluginsByKey === void 0 ? void 0 : _editor$pluginsByKey.react) !== null && _ref !== void 0 ? _ref : createReactPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.history)) {\n var _ref2, _editor$pluginsByKey2;\n\n plugins.push((_ref2 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey2 = editor.pluginsByKey) === null || _editor$pluginsByKey2 === void 0 ? void 0 : _editor$pluginsByKey2.history) !== null && _ref2 !== void 0 ? _ref2 : createHistoryPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.nodeFactory)) {\n var _ref3, _editor$pluginsByKey3;\n\n plugins.push((_ref3 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey3 = editor.pluginsByKey) === null || _editor$pluginsByKey3 === void 0 ? void 0 : _editor$pluginsByKey3[KEY_NODE_FACTORY]) !== null && _ref3 !== void 0 ? _ref3 : createNodeFactoryPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.eventEditor)) {\n var _ref4, _editor$pluginsByKey4;\n\n plugins.push((_ref4 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey4 = editor.pluginsByKey) === null || _editor$pluginsByKey4 === void 0 ? void 0 : _editor$pluginsByKey4[KEY_EVENT_EDITOR]) !== null && _ref4 !== void 0 ? _ref4 : createEventEditorPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.inlineVoid)) {\n var _ref5, _editor$pluginsByKey5;\n\n plugins.push((_ref5 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey5 = editor.pluginsByKey) === null || _editor$pluginsByKey5 === void 0 ? void 0 : _editor$pluginsByKey5[KEY_INLINE_VOID]) !== null && _ref5 !== void 0 ? _ref5 : createInlineVoidPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.insertData)) {\n var _ref6, _editor$pluginsByKey6;\n\n plugins.push((_ref6 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey6 = editor.pluginsByKey) === null || _editor$pluginsByKey6 === void 0 ? void 0 : _editor$pluginsByKey6[KEY_INSERT_DATA]) !== null && _ref6 !== void 0 ? _ref6 : createInsertDataPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.selection)) {\n var _ref7, _editor$pluginsByKey7;\n\n plugins.push((_ref7 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey7 = editor.pluginsByKey) === null || _editor$pluginsByKey7 === void 0 ? void 0 : _editor$pluginsByKey7[KEY_PREV_SELECTION]) !== null && _ref7 !== void 0 ? _ref7 : createPrevSelectionPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.deserializeHtml)) {\n var _ref8, _editor$pluginsByKey8;\n\n plugins.push((_ref8 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey8 = editor.pluginsByKey) === null || _editor$pluginsByKey8 === void 0 ? void 0 : _editor$pluginsByKey8[KEY_DESERIALIZE_HTML]) !== null && _ref8 !== void 0 ? _ref8 : createDeserializeHtmlPlugin());\n }\n\n if (typeof dcp !== 'object' || !(dcp !== null && dcp !== void 0 && dcp.deserializeAst)) {\n var _ref9, _editor$pluginsByKey9;\n\n plugins.push((_ref9 = editor === null || editor === void 0 ? void 0 : (_editor$pluginsByKey9 = editor.pluginsByKey) === null || _editor$pluginsByKey9 === void 0 ? void 0 : _editor$pluginsByKey9[KEY_DESERIALIZE_AST]) !== null && _ref9 !== void 0 ? _ref9 : createDeserializeAstPlugin());\n }\n }\n\n plugins = [...plugins, ..._plugins];\n editor.plugins = [];\n editor.pluginsByKey = {};\n flattenDeepPlugins(editor, plugins); // override all the plugins one by one, so plugin.overrideByKey effects can be overridden by the next plugin\n\n editor.plugins.forEach(plugin => {\n if (plugin.overrideByKey) {\n const newPlugins = editor.plugins.map(p => {\n return overridePluginsByKey(p, plugin.overrideByKey);\n });\n editor.plugins = [];\n editor.pluginsByKey = {}; // flatten again the overrides\n\n flattenDeepPlugins(editor, newPlugins);\n }\n });\n};\n\n/**\n * Apply `withInlineVoid` and all plate plugins `withOverrides`.\n * Overrides:\n * - `id`: id of the editor.\n * - `key`: random key for the <Slate> component so each time the editor is created, the component resets.\n * - `options`: Plate options\n */\nconst withPlate = (e, {\n id,\n plugins = [],\n disableCorePlugins\n} = {}) => {\n let editor = e;\n editor.id = id;\n editor.prevSelection = null;\n editor.currentKeyboardEvent = null;\n\n if (!editor.key) {\n editor.key = Math.random();\n }\n\n setPlatePlugins(editor, {\n plugins: plugins,\n disableCorePlugins\n }); // withOverrides\n\n editor.plugins.forEach(plugin => {\n if (plugin.withOverrides) {\n editor = plugin.withOverrides(editor, plugin);\n }\n });\n return editor;\n};\n\nconst createTEditor = () => createEditor$1();\n\n/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nvar _arrayEach = arrayEach;\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && _copyObject(source, keys_1(source), object);\n}\n\nvar _baseAssign = baseAssign;\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && _copyObject(source, keysIn_1(source), object);\n}\n\nvar _baseAssignIn = baseAssignIn;\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return _copyObject(source, _getSymbols(source), object);\n}\n\nvar _copySymbols = copySymbols;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray_1 : function(object) {\n var result = [];\n while (object) {\n _arrayPush(result, _getSymbols(object));\n object = _getPrototype(object);\n }\n return result;\n};\n\nvar _getSymbolsIn = getSymbolsIn;\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return _copyObject(source, _getSymbolsIn(source), object);\n}\n\nvar _copySymbolsIn = copySymbolsIn;\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);\n}\n\nvar _getAllKeysIn = getAllKeysIn;\n\n/** Used for built-in method references. */\nvar objectProto$1 = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty$1 = objectProto$1.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nvar _initCloneArray = initCloneArray;\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nvar _cloneDataView = cloneDataView;\n\n/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nvar _cloneRegExp = cloneRegExp;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = _Symbol ? _Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nvar _cloneSymbol = cloneSymbol;\n\n/** `Object#toString` result references. */\nvar boolTag$1 = '[object Boolean]',\n dateTag$1 = '[object Date]',\n mapTag$2 = '[object Map]',\n numberTag$1 = '[object Number]',\n regexpTag$1 = '[object RegExp]',\n setTag$2 = '[object Set]',\n stringTag$1 = '[object String]',\n symbolTag$1 = '[object Symbol]';\n\nvar arrayBufferTag$1 = '[object ArrayBuffer]',\n dataViewTag$1 = '[object DataView]',\n float32Tag$1 = '[object Float32Array]',\n float64Tag$1 = '[object Float64Array]',\n int8Tag$1 = '[object Int8Array]',\n int16Tag$1 = '[object Int16Array]',\n int32Tag$1 = '[object Int32Array]',\n uint8Tag$1 = '[object Uint8Array]',\n uint8ClampedTag$1 = '[object Uint8ClampedArray]',\n uint16Tag$1 = '[object Uint16Array]',\n uint32Tag$1 = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag$1:\n return _cloneArrayBuffer(object);\n\n case boolTag$1:\n case dateTag$1:\n return new Ctor(+object);\n\n case dataViewTag$1:\n return _cloneDataView(object, isDeep);\n\n case float32Tag$1: case float64Tag$1:\n case int8Tag$1: case int16Tag$1: case int32Tag$1:\n case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:\n return _cloneTypedArray(object, isDeep);\n\n case mapTag$2:\n return new Ctor;\n\n case numberTag$1:\n case stringTag$1:\n return new Ctor(object);\n\n case regexpTag$1:\n return _cloneRegExp(object);\n\n case setTag$2:\n return new Ctor;\n\n case symbolTag$1:\n return _cloneSymbol(object);\n }\n}\n\nvar _initCloneByTag = initCloneByTag;\n\n/** `Object#toString` result references. */\nvar mapTag$1 = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike_1(value) && _getTag(value) == mapTag$1;\n}\n\nvar _baseIsMap = baseIsMap;\n\n/* Node.js helper references. */\nvar nodeIsMap = _nodeUtil && _nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;\n\nvar isMap_1 = isMap;\n\n/** `Object#toString` result references. */\nvar setTag$1 = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike_1(value) && _getTag(value) == setTag$1;\n}\n\nvar _baseIsSet = baseIsSet;\n\n/* Node.js helper references. */\nvar nodeIsSet = _nodeUtil && _nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;\n\nvar isSet_1 = isSet;\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG$2 = 1,\n CLONE_FLAT_FLAG$1 = 2,\n CLONE_SYMBOLS_FLAG$2 = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG$2,\n isFlat = bitmask & CLONE_FLAT_FLAG$1,\n isFull = bitmask & CLONE_SYMBOLS_FLAG$2;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject_1(value)) {\n return value;\n }\n var isArr = isArray_1(value);\n if (isArr) {\n result = _initCloneArray(value);\n if (!isDeep) {\n return _copyArray(value, result);\n }\n } else {\n var tag = _getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer_1(value)) {\n return _cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : _initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? _copySymbolsIn(value, _baseAssignIn(result, value))\n : _copySymbols(value, _baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = _initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new _Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet_1(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap_1(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? _getAllKeysIn : _getAllKeys)\n : (isFlat ? keysIn_1 : keys_1);\n\n var props = isArr ? undefined : keysFunc(value);\n _arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n _assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nvar _baseClone = baseClone;\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG$1 = 1,\n CLONE_SYMBOLS_FLAG$1 = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return _baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);\n}\n\nvar cloneDeep_1 = cloneDeep;\n\n/**\n * Creates a new array of plugins by overriding the plugins in the original array.\n * Components can be overridden by key using `components` in the second param.\n * Any other properties can be overridden by key using `overrideByKey` in the second param.\n */\n\nconst createPlugins = (plugins, {\n components,\n overrideByKey\n} = {}) => {\n let allOverrideByKey = {};\n\n if (overrideByKey) {\n allOverrideByKey = cloneDeep_1(overrideByKey);\n }\n\n if (components) {\n Object.keys(components).forEach(key => {\n if (!allOverrideByKey[key]) allOverrideByKey[key] = {};\n allOverrideByKey[key].component = components[key];\n });\n }\n\n if (Object.keys(allOverrideByKey).length) {\n return plugins.map(plugin => {\n return overridePluginsByKey(plugin, allOverrideByKey);\n });\n }\n\n return plugins;\n};\n\n/**\n * Create a plate editor with:\n * - `createTEditor` or custom `editor`\n * - `withPlate`\n * - custom `components`\n */\nconst createPlateEditor = ({\n editor = createTEditor(),\n plugins = [],\n components,\n overrideByKey,\n normalizeInitialValue: shouldNormalizeInitialValue,\n ...withPlateOptions\n} = {}) => {\n plugins = createPlugins(plugins, {\n components,\n overrideByKey\n });\n const e = withPlate(editor, {\n plugins,\n ...withPlateOptions\n });\n\n if (shouldNormalizeInitialValue) {\n normalizeEditor(e, {\n force: true\n });\n }\n\n return e;\n};\n\n/**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\nfunction last(array) {\n var length = array == null ? 0 : array.length;\n return length ? array[length - 1] : undefined;\n}\n\nvar last_1 = last;\n\n/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nvar _baseSlice = baseSlice;\n\n/**\n * Gets the parent value at `path` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path to get the parent value of.\n * @returns {*} Returns the parent value.\n */\nfunction parent(object, path) {\n return path.length < 2 ? object : _baseGet(object, _baseSlice(path, 0, -1));\n}\n\nvar _parent = parent;\n\n/**\n * The base implementation of `_.unset`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The property path to unset.\n * @returns {boolean} Returns `true` if the property is deleted, else `false`.\n */\nfunction baseUnset(object, path) {\n path = _castPath(path, object);\n object = _parent(object, path);\n return object == null || delete object[_toKey(last_1(path))];\n}\n\nvar _baseUnset = baseUnset;\n\n/**\n * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain\n * objects.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {string} key The key of the property to inspect.\n * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.\n */\nfunction customOmitClone(value) {\n return isPlainObject_1(value) ? undefined : value;\n}\n\nvar _customOmitClone = customOmitClone;\n\n/** Built-in value references. */\nvar spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray_1(value) || isArguments_1(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nvar _isFlattenable = isFlattenable;\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = _isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n _arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nvar _baseFlatten = baseFlatten;\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? _baseFlatten(array, 1) : [];\n}\n\nvar flatten_1 = flatten;\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return _setToString(_overRest(func, undefined, flatten_1), func + '');\n}\n\nvar _flatRest = flatRest;\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable property paths of `object` that are not omitted.\n *\n * **Note:** This method is considerably slower than `_.pick`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to omit.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.omit(object, ['a', 'c']);\n * // => { 'b': '2' }\n */\nvar omit = _flatRest(function(object, paths) {\n var result = {};\n if (object == null) {\n return result;\n }\n var isDeep = false;\n paths = _arrayMap(paths, function(path) {\n path = _castPath(path, object);\n isDeep || (isDeep = path.length > 1);\n return path;\n });\n _copyObject(object, _getAllKeysIn(object), result);\n if (isDeep) {\n result = _baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, _customOmitClone);\n }\n var length = paths.length;\n while (length--) {\n _baseUnset(result, paths[length]);\n }\n return result;\n});\n\nvar omit_1 = omit;\n\n/**\n * A unique id used as a provider scope.\n * Use it if you have multiple `PlateProvider` in the same React tree.\n * @default PLATE_SCOPE\n */\n\nconst PLATE_SCOPE = Symbol('plate');\nconst GLOBAL_PLATE_SCOPE = Symbol('global-plate');\nconst plateIdAtom = atom(PLATE_SCOPE);\n/**\n * Get the closest `Plate` id.\n */\n\nconst usePlateId = () => useAtom(plateIdAtom, GLOBAL_PLATE_SCOPE)[0];\nconst createPlateStore = ({\n decorate = null,\n editor = null,\n id,\n isRendered = false,\n keyDecorate = '1',\n keyEditor = '1',\n keySelection = '1',\n onChange = null,\n plugins = [],\n rawPlugins = [],\n renderElement = null,\n renderLeaf = null,\n value = null,\n ...state\n} = {}) => {\n const stores = createAtomStore({\n decorate,\n editor,\n id,\n isRendered,\n keyDecorate,\n keyEditor,\n keySelection,\n onChange,\n plugins,\n rawPlugins,\n renderElement,\n renderLeaf,\n value,\n ...state\n }, {\n scope: PLATE_SCOPE,\n name: 'plate'\n });\n return {\n plateStore: stores.plateStore,\n usePlateStore: _id => {\n const closestId = usePlateId(); // get targeted store if id defined or if the store is found\n\n if (isDefined(_id) || stores.usePlateStore(_id).get.id(_id)) {\n return stores.usePlateStore(_id);\n }\n\n return stores.usePlateStore(closestId);\n }\n };\n};\nconst {\n plateStore,\n usePlateStore\n} = createPlateStore();\nconst usePlateSelectors = id => usePlateStore(id).get;\nconst usePlateActions = id => usePlateStore(id).set;\nconst usePlateStates = id => usePlateStore(id).use;\n\nconst useUpdatePlateKey = (key, id) => {\n const set = usePlateActions(id)[key]();\n return useCallback(() => {\n set(nanoid());\n }, [set]);\n};\n\nconst useRedecorate = id => {\n const updateDecorate = useUpdatePlateKey('keyDecorate', id);\n return useCallback(() => {\n updateDecorate();\n }, [updateDecorate]);\n};\n\n/**\n * Set a new editor with plate.\n */\n\nconst useResetPlateEditor = id => {\n const editor = usePlateSelectors(id).editor();\n const setEditor = usePlateActions(id).editor();\n return useCallback(() => {\n const newEditor = createPlateEditor({\n id: editor.id,\n plugins: editor.plugins,\n // disable core plugins as it's already included\n disableCorePlugins: true\n });\n setEditor(newEditor);\n }, [editor, setEditor]);\n};\n\n/**\n * Get editor ref which is never updated.\n */\n\nconst usePlateEditorRef = id => usePlateSelectors(id).editor();\n\n/**\n * Get editor state which is updated on editor change.\n */\n\nconst usePlateEditorState = id => {\n usePlateSelectors(id).keyEditor();\n return usePlateEditorRef(id);\n};\n\n/**\n * Get the editor selection which is updated on editor change.\n */\n\nconst usePlateSelection = id => {\n usePlateSelectors(id).keySelection();\n return usePlateEditorRef(id).selection;\n};\n\nconst getEventPlateId = id => {\n var _eventEditorSelectors;\n\n if (id) return id;\n const focus = eventEditorSelectors.focus();\n if (focus) return focus;\n const blur = eventEditorSelectors.blur();\n if (blur) return blur;\n return (_eventEditorSelectors = eventEditorSelectors.last()) !== null && _eventEditorSelectors !== void 0 ? _eventEditorSelectors : PLATE_SCOPE;\n};\n\n/**\n * Get last event editor id: focus, blur or last.\n */\n\nconst useEventPlateId = id => {\n var _ref;\n\n const focus = useEventEditorSelectors.focus();\n const blur = useEventEditorSelectors.blur();\n const last = useEventEditorSelectors.last();\n const providerId = usePlateSelectors().id();\n if (id) return id;\n if (focus) return focus;\n if (blur) return blur;\n return (_ref = last !== null && last !== void 0 ? last : providerId) !== null && _ref !== void 0 ? _ref : PLATE_SCOPE;\n};\n\n/**\n * @see {@link Decorate}.\n * Optimization: return undefined if empty list so Editable uses a memo.\n */\nconst pipeDecorate = (editor, decorateProp) => {\n const decorates = editor.plugins.flatMap(plugin => {\n var _plugin$decorate, _plugin$decorate2;\n\n return (_plugin$decorate = (_plugin$decorate2 = plugin.decorate) === null || _plugin$decorate2 === void 0 ? void 0 : _plugin$decorate2.call(plugin, editor, plugin)) !== null && _plugin$decorate !== void 0 ? _plugin$decorate : [];\n });\n\n if (decorateProp) {\n decorates.push(decorateProp);\n }\n\n if (!decorates.length) return;\n return entry => {\n let ranges = [];\n\n const addRanges = newRanges => {\n if (newRanges !== null && newRanges !== void 0 && newRanges.length) ranges = [...ranges, ...newRanges];\n };\n\n decorates.forEach(decorate => {\n addRanges(decorate(entry));\n });\n return ranges;\n };\n};\n\n/**\n * Check if an event is overrided by a handler.\n */\nconst isEventHandled = (event, handler) => {\n if (!handler) {\n return false;\n } // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n\n\n const shouldTreatEventAsHandled = handler(event);\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled;\n }\n\n return event.isPropagationStopped();\n};\n/**\n * Generic pipe for handlers.\n * - Get all the plugins handlers by `handlerKey`.\n * - If there is no plugin handler or editable prop handler for this key, return `undefined`.\n * - Return a handler calling all the plugins handlers then the prop handler.\n * - Any handler returning true will stop the next handlers to be called, including slate internal handler.\n */\n\nconst pipeHandler = (editor, {\n editableProps,\n handlerKey\n}) => {\n let pluginsHandlers = [];\n pluginsHandlers = editor.plugins.flatMap(plugin => {\n var _plugin$handlers$hand, _plugin$handlers, _plugin$handlers$hand2;\n\n return (_plugin$handlers$hand = (_plugin$handlers = plugin.handlers) === null || _plugin$handlers === void 0 ? void 0 : (_plugin$handlers$hand2 = _plugin$handlers[handlerKey]) === null || _plugin$handlers$hand2 === void 0 ? void 0 : _plugin$handlers$hand2.call(_plugin$handlers, editor, plugin)) !== null && _plugin$handlers$hand !== void 0 ? _plugin$handlers$hand : [];\n });\n const propsHandler = editableProps === null || editableProps === void 0 ? void 0 : editableProps[handlerKey];\n if (!pluginsHandlers.length && !propsHandler) return;\n return event => {\n const eventIsHandled = pluginsHandlers.some(handler => isEventHandled(event, handler));\n if (eventIsHandled) return true;\n return isEventHandled(event, propsHandler);\n };\n};\n\n/**\n * Return if `element`, `text`, `nodeKey` is defined.\n * Return if `node.type` is not in `validTypes` (if defined).\n * Return if `value = node[nodeKey]` is not in `validNodeValues` (if defined).\n * If `classNames[value]` is defined, override `className` with it.\n * If `styleKey` is defined, override `style` with `[styleKey]: value`.\n */\nconst pluginInjectProps = (editor, {\n key,\n inject: {\n props\n }\n}, nodeProps) => {\n var _transformNodeValue;\n\n const {\n element,\n text,\n className,\n style\n } = nodeProps;\n const node = element !== null && element !== void 0 ? element : text;\n if (!node) return;\n if (!props) return;\n const {\n nodeKey = key,\n styleKey = nodeKey,\n validTypes,\n classNames,\n transformClassName,\n transformNodeValue,\n transformStyle,\n validNodeValues,\n defaultNodeValue\n } = props;\n\n if (validTypes && isElement(node) && node.type && !validTypes.includes(node.type)) {\n return;\n }\n\n const nodeValue = node[nodeKey]; // early return if there is now reason to add styles\n\n if (!nodeValue || validNodeValues && !validNodeValues.includes(nodeValue) || nodeValue === defaultNodeValue) {\n return;\n }\n\n const res = {};\n const transformOptions = { ...nodeProps,\n nodeValue\n };\n const value = (_transformNodeValue = transformNodeValue === null || transformNodeValue === void 0 ? void 0 : transformNodeValue(transformOptions)) !== null && _transformNodeValue !== void 0 ? _transformNodeValue : nodeValue;\n\n if (element) {\n res.className = clsx(className, `slate-${nodeKey}-${nodeValue}`);\n }\n\n if (classNames !== null && classNames !== void 0 && classNames[nodeValue] || transformClassName) {\n var _transformClassName;\n\n res.className = (_transformClassName = transformClassName === null || transformClassName === void 0 ? void 0 : transformClassName(transformOptions)) !== null && _transformClassName !== void 0 ? _transformClassName : clsx(className, classNames === null || classNames === void 0 ? void 0 : classNames[value]);\n }\n\n if (styleKey) {\n var _transformStyle;\n\n res.style = (_transformStyle = transformStyle === null || transformStyle === void 0 ? void 0 : transformStyle(transformOptions)) !== null && _transformStyle !== void 0 ? _transformStyle : { ...style,\n [styleKey]: value\n };\n }\n\n return res;\n};\n\n/**\n * Inject plugin props, editor.\n */\n\nconst pipeInjectProps = (editor, nodeProps) => {\n editor.plugins.forEach(plugin => {\n if (plugin.inject.props) {\n const props = pluginInjectProps(editor, plugin, nodeProps);\n\n if (props) {\n nodeProps = { ...nodeProps,\n ...props\n };\n }\n }\n });\n return { ...nodeProps,\n editor\n };\n};\n\n/**\n * Override node props with plugin props.\n * `props.element.attributes` are passed as `nodeProps`.\n * Extend the class name with the node type.\n */\n\nconst getRenderNodeProps = ({\n attributes,\n nodeProps,\n props,\n type\n}) => {\n let newProps = {};\n\n if (props) {\n var _ref;\n\n newProps = (_ref = typeof props === 'function' ? props(nodeProps) : props) !== null && _ref !== void 0 ? _ref : {};\n }\n\n if (!newProps.nodeProps && attributes) {\n newProps.nodeProps = attributes;\n }\n\n nodeProps = { ...nodeProps,\n ...newProps\n };\n const {\n className\n } = nodeProps;\n return { ...nodeProps,\n className: clsx(getSlateClass(type), className)\n };\n};\n\n/**\n * Get a `Editable.renderElement` handler for `options.type`.\n * If the type is equals to the slate element type, render `options.component`.\n * Else, return `undefined` so the pipeline can check the next plugin.\n */\n\nconst pluginRenderElement = (editor, {\n key,\n type,\n component: _component,\n props\n}) => nodeProps => {\n const {\n element,\n children: _children\n } = nodeProps;\n\n if (element.type === type) {\n const Element = _component !== null && _component !== void 0 ? _component : DefaultElement;\n const injectAboveComponents = editor.plugins.flatMap(o => {\n var _o$inject$aboveCompon, _o$inject;\n\n return (_o$inject$aboveCompon = (_o$inject = o.inject) === null || _o$inject === void 0 ? void 0 : _o$inject.aboveComponent) !== null && _o$inject$aboveCompon !== void 0 ? _o$inject$aboveCompon : [];\n });\n const injectBelowComponents = editor.plugins.flatMap(o => {\n var _o$inject$belowCompon, _o$inject2;\n\n return (_o$inject$belowCompon = (_o$inject2 = o.inject) === null || _o$inject2 === void 0 ? void 0 : _o$inject2.belowComponent) !== null && _o$inject$belowCompon !== void 0 ? _o$inject$belowCompon : [];\n });\n nodeProps = getRenderNodeProps({\n attributes: element.attributes,\n nodeProps: nodeProps,\n props,\n type: type\n });\n let children = _children;\n injectBelowComponents.forEach(withHOC => {\n const hoc = withHOC({ ...nodeProps,\n key\n });\n\n if (hoc) {\n children = hoc({ ...nodeProps,\n children\n });\n }\n });\n let component = /*#__PURE__*/React.createElement(Element, nodeProps, children);\n injectAboveComponents.forEach(withHOC => {\n const hoc = withHOC({ ...nodeProps,\n key\n });\n\n if (hoc) {\n component = hoc({ ...nodeProps,\n children: component\n });\n }\n });\n return /*#__PURE__*/React.createElement(ElementProvider, {\n element: element,\n scope: key\n }, component);\n }\n};\n\n/**\n * @see {@link RenderElement}\n */\n\nconst pipeRenderElement = (editor, renderElementProp) => {\n const renderElements = [];\n editor.plugins.forEach(plugin => {\n if (plugin.isElement) {\n renderElements.push(pluginRenderElement(editor, plugin));\n }\n });\n return nodeProps => {\n const props = pipeInjectProps(editor, nodeProps);\n let element;\n renderElements.some(renderElement => {\n element = renderElement(props);\n return !!element;\n });\n if (element) return element;\n\n if (renderElementProp) {\n return renderElementProp(props);\n }\n\n return /*#__PURE__*/React.createElement(DefaultElement, props);\n };\n};\n\nconst DefaultLeaf = ({\n attributes,\n children,\n text,\n leaf,\n editor,\n nodeProps,\n ...props\n}) => /*#__PURE__*/React.createElement(\"span\", _extends({}, attributes, props), children);\n\n/**\n * Get a `Editable.renderLeaf` handler for `options.type`.\n * If the type is equals to the slate leaf type, render `options.component`.\n * Else, return `children`.\n */\n\nconst pluginRenderLeaf = (editor, {\n key,\n type = key,\n component,\n props\n}) => nodeProps => {\n const {\n leaf,\n children\n } = nodeProps;\n\n if (leaf[type]) {\n const Leaf = component !== null && component !== void 0 ? component : DefaultLeaf;\n nodeProps = getRenderNodeProps({\n attributes: leaf.attributes,\n props,\n nodeProps: nodeProps,\n type\n });\n return /*#__PURE__*/React.createElement(Leaf, nodeProps, children);\n }\n\n return children;\n};\n\n/**\n * @see {@link RenderLeaf}\n */\n\nconst pipeRenderLeaf = (editor, renderLeafProp) => {\n const renderLeafs = [];\n editor.plugins.forEach(plugin => {\n if (plugin.isLeaf && plugin.key) {\n renderLeafs.push(pluginRenderLeaf(editor, plugin));\n }\n });\n return nodeProps => {\n const props = pipeInjectProps(editor, nodeProps);\n renderLeafs.forEach(renderLeaf => {\n const newChildren = renderLeaf(props);\n\n if (newChildren !== undefined) {\n props.children = newChildren;\n }\n });\n\n if (renderLeafProp) {\n return renderLeafProp(props);\n }\n\n return /*#__PURE__*/React.createElement(DefaultLeaf, props);\n };\n};\n\nconst useEditableProps = ({\n id,\n ...editableProps\n} = {}) => {\n var _selectors$decorate, _selectors$renderLeaf, _selectors$renderElem;\n\n const editor = usePlateEditorRef(id);\n const selectors = usePlateSelectors(id);\n const keyDecorate = selectors.keyDecorate();\n const storeDecorate = (_selectors$decorate = selectors.decorate()) === null || _selectors$decorate === void 0 ? void 0 : _selectors$decorate.fn;\n const storeRenderLeaf = (_selectors$renderLeaf = selectors.renderLeaf()) === null || _selectors$renderLeaf === void 0 ? void 0 : _selectors$renderLeaf.fn;\n const storeRenderElement = (_selectors$renderElem = selectors.renderElement()) === null || _selectors$renderElem === void 0 ? void 0 : _selectors$renderElem.fn;\n const decorateMemo = useMemo(() => {\n return pipeDecorate(editor, storeDecorate !== null && storeDecorate !== void 0 ? storeDecorate : editableProps === null || editableProps === void 0 ? void 0 : editableProps.decorate);\n }, [editableProps === null || editableProps === void 0 ? void 0 : editableProps.decorate, editor, storeDecorate]);\n const decorate = useMemo(() => {\n if (!keyDecorate || !decorateMemo) return;\n return entry => decorateMemo(entry);\n }, [decorateMemo, keyDecorate]);\n const renderElement = useMemo(() => {\n return pipeRenderElement(editor, storeRenderElement !== null && storeRenderElement !== void 0 ? storeRenderElement : editableProps === null || editableProps === void 0 ? void 0 : editableProps.renderElement);\n }, [editableProps === null || editableProps === void 0 ? void 0 : editableProps.renderElement, editor, storeRenderElement]);\n const renderLeaf = useMemo(() => {\n return pipeRenderLeaf(editor, storeRenderLeaf !== null && storeRenderLeaf !== void 0 ? storeRenderLeaf : editableProps === null || editableProps === void 0 ? void 0 : editableProps.renderLeaf);\n }, [editableProps === null || editableProps === void 0 ? void 0 : editableProps.renderLeaf, editor, storeRenderLeaf]);\n const props = useDeepCompareMemo(() => {\n const _props = {\n decorate,\n renderElement,\n renderLeaf\n };\n DOM_HANDLERS.forEach(handlerKey => {\n const handler = pipeHandler(editor, {\n editableProps,\n handlerKey\n });\n\n if (handler) {\n _props[handlerKey] = handler;\n }\n });\n return _props;\n }, [decorate, editableProps, renderElement, renderLeaf]);\n return useDeepCompareMemo(() => ({ ...omit_1(editableProps, [...DOM_HANDLERS, 'renderElement', 'renderLeaf']),\n ...props\n }), [editableProps, props]);\n};\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nconst setRef = (ref, value) => {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n};\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\n\n\nconst composeRefs = (...refs) => node => refs.forEach(ref => setRef(ref, node));\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\n\nconst useComposedRef = (...refs) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback(composeRefs(...refs), refs);\n};\n\nconst canUsePassiveEvents = () => {\n if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') return false;\n let passive = false;\n const options = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line getter-return\n get() {\n passive = true;\n }\n\n });\n\n const noop = () => null;\n\n window.addEventListener('test', noop, options);\n window.removeEventListener('test', noop, options);\n return passive;\n};\n\nconst DEFAULT_IGNORE_CLASS = 'ignore-onclickoutside';\n\nconst checkClass = (el, cl) => {\n var _el$classList;\n\n return (_el$classList = el.classList) === null || _el$classList === void 0 ? void 0 : _el$classList.contains(cl);\n};\n\nconst hasIgnoreClass = (e, ignoreClass) => {\n let el = e.target || e;\n\n while (el) {\n if (Array.isArray(ignoreClass)) {\n // eslint-disable-next-line no-loop-func\n if (ignoreClass.some(c => checkClass(el, c))) return true;\n } else if (checkClass(el, ignoreClass)) {\n return true;\n }\n\n el = el.parentElement;\n }\n\n return false;\n};\n\nconst clickedOnScrollbar = e => document.documentElement.clientWidth <= e.clientX || document.documentElement.clientHeight <= e.clientY;\n\nconst getEventOptions = type => type.includes('touch') && canUsePassiveEvents() ? {\n passive: true\n} : false;\n\nconst useOnClickOutside = (callback, {\n refs: refsOpt,\n disabled,\n eventTypes = ['mousedown', 'touchstart'],\n excludeScrollbar,\n ignoreClass = DEFAULT_IGNORE_CLASS,\n detectIFrame = true\n} = {}) => {\n const [refsState, setRefsState] = useState([]);\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n const ref = useCallback(el => setRefsState(prevState => [...prevState, {\n current: el\n }]), []);\n useEffect(() => {\n if (!(refsOpt !== null && refsOpt !== void 0 && refsOpt.length) && !refsState.length) return;\n\n const getEls = () => {\n const els = [];\n (refsOpt || refsState).forEach(({\n current\n }) => current && els.push(current));\n return els;\n };\n\n const handler = e => {\n if (!hasIgnoreClass(e, ignoreClass) && !(excludeScrollbar && clickedOnScrollbar(e)) && getEls().every(el => !el.contains(e.target))) callbackRef.current(e);\n };\n\n const blurHandler = e => // On firefox the iframe becomes document.activeElement in the next event loop\n setTimeout(() => {\n const {\n activeElement\n } = document;\n if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === 'IFRAME' && !hasIgnoreClass(activeElement, ignoreClass) && !getEls().includes(activeElement)) callbackRef.current(e);\n }, 0);\n\n const removeEventListener = () => {\n eventTypes.forEach(type => // @ts-ignore\n document.removeEventListener(type, handler, getEventOptions(type)));\n if (detectIFrame) window.removeEventListener('blur', blurHandler);\n };\n\n if (disabled) {\n removeEventListener();\n return;\n }\n\n eventTypes.forEach(type => document.addEventListener(type, handler, getEventOptions(type)));\n if (detectIFrame) window.addEventListener('blur', blurHandler); // eslint-disable-next-line consistent-return\n\n return () => removeEventListener();\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [refsState, ignoreClass, excludeScrollbar, disabled, detectIFrame, // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(eventTypes)]);\n return ref;\n};\n\n/**\n * Returns props with an additional `wrapElement` prop.\n * @see https://github.com/ariakit/ariakit/blob/3c74257c9e/packages/ariakit-utils/src/hooks.ts\n */\nconst useWrapElement = (props, callback, deps = []) => {\n const wrapElement = useCallback(element => {\n if (props.wrapElement) {\n element = props.wrapElement(element);\n }\n\n return callback(element);\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [...deps, props.wrapElement]);\n return { ...props,\n wrapElement\n };\n};\n\n/**\n * Get root element props for Slate element.\n */\nconst useElementProps = ({\n attributes,\n nodeProps,\n element,\n editor,\n elementToAttributes,\n ...props\n}) => {\n var _elementToAttributes;\n\n const htmlProps = { ...attributes,\n ...props,\n ...nodeProps,\n ...((_elementToAttributes = elementToAttributes === null || elementToAttributes === void 0 ? void 0 : elementToAttributes(element)) !== null && _elementToAttributes !== void 0 ? _elementToAttributes : {}),\n ref: useComposedRef(props.ref, attributes.ref)\n };\n return htmlProps;\n};\n\n/**\n * A hook to update the store when the props changes.\n * Undefined props are ignored.\n */\nconst usePlateStoreOnChange = ({\n setState,\n state,\n nextState,\n nextStateValue = nextState\n}) => {\n useEffect(() => {\n if (nextState !== state && !isUndefined(nextState)) {\n setState(nextStateValue);\n }\n }, [setState, state, nextState, nextStateValue]);\n};\n\nconst usePlateEffects = ({\n id,\n disableCorePlugins,\n value: valueProp,\n onChange: onChangeProp,\n plugins: pluginsProp,\n decorate: decorateProp,\n renderElement: renderElementProp,\n renderLeaf: renderLeafProp\n}) => {\n const editor = usePlateEditorRef(id);\n const states = usePlateStates(id);\n const [value, setValue] = states.value();\n const [decorate, setDecorate] = states.decorate();\n const [renderElement, setRenderElement] = states.renderElement();\n const [renderLeaf, setRenderLeaf] = states.renderLeaf();\n const [rawPlugins, setRawPlugins] = states.rawPlugins();\n const [, setPlugins] = states.plugins();\n const [onChange, setOnChange] = states.onChange(); // Store Slate.value\n\n usePlateStoreOnChange({\n state: value,\n setState: setValue,\n nextState: valueProp\n });\n usePlateStoreOnChange({\n state: rawPlugins,\n setState: setPlugins,\n nextState: pluginsProp,\n nextStateValue: pluginsProp !== null && pluginsProp !== void 0 ? pluginsProp : []\n });\n usePlateStoreOnChange({\n state: onChange === null || onChange === void 0 ? void 0 : onChange.fn,\n setState: setOnChange,\n nextState: onChangeProp,\n nextStateValue: onChangeProp ? {\n fn: onChangeProp\n } : null\n });\n usePlateStoreOnChange({\n state: decorate === null || decorate === void 0 ? void 0 : decorate.fn,\n setState: setDecorate,\n nextState: decorateProp,\n nextStateValue: decorateProp ? {\n fn: decorateProp\n } : null\n });\n usePlateStoreOnChange({\n state: renderElement === null || renderElement === void 0 ? void 0 : renderElement.fn,\n setState: setRenderElement,\n nextState: renderElementProp,\n nextStateValue: renderElementProp ? {\n fn: renderElementProp\n } : null\n });\n usePlateStoreOnChange({\n state: renderLeaf === null || renderLeaf === void 0 ? void 0 : renderLeaf.fn,\n setState: setRenderLeaf,\n nextState: renderLeafProp,\n nextStateValue: renderLeafProp ? {\n fn: renderLeafProp\n } : null\n });\n useEffect(() => {\n if (pluginsProp !== rawPlugins) {\n setRawPlugins(rawPlugins);\n setPlatePlugins(editor, {\n plugins: pluginsProp,\n disableCorePlugins\n });\n setPlugins(editor.plugins);\n }\n }, [disableCorePlugins, editor, rawPlugins, pluginsProp, setPlugins, setRawPlugins]);\n};\n\nconst pipeOnChange = editor => {\n const onChanges = editor.plugins.flatMap(plugin => {\n var _plugin$handlers$onCh, _plugin$handlers, _plugin$handlers$onCh2;\n\n return (_plugin$handlers$onCh = (_plugin$handlers = plugin.handlers) === null || _plugin$handlers === void 0 ? void 0 : (_plugin$handlers$onCh2 = _plugin$handlers.onChange) === null || _plugin$handlers$onCh2 === void 0 ? void 0 : _plugin$handlers$onCh2.call(_plugin$handlers, editor, plugin)) !== null && _plugin$handlers$onCh !== void 0 ? _plugin$handlers$onCh : [];\n });\n return nodes => {\n return onChanges.some(handler => {\n if (!handler) {\n return false;\n } // The custom event handler may return a boolean to specify whether the event\n // shall be treated as being handled or not.\n\n\n const shouldTreatEventAsHandled = handler(nodes);\n\n if (shouldTreatEventAsHandled != null) {\n return shouldTreatEventAsHandled;\n }\n\n return false;\n });\n };\n};\n\n/**\n * Get Slate props stored in a global store.\n */\n\nconst useSlateProps = ({\n id\n}) => {\n var _usePlateSelectors$on;\n\n const editor = usePlateEditorRef(id);\n const value = usePlateSelectors(id).value();\n const setValue = usePlateActions(id).value();\n const onChangeProp = (_usePlateSelectors$on = usePlateSelectors(id).onChange()) === null || _usePlateSelectors$on === void 0 ? void 0 : _usePlateSelectors$on.fn;\n const onChange = useCallback(newValue => {\n const eventIsHandled = pipeOnChange(editor)(newValue);\n\n if (!eventIsHandled) {\n onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(newValue);\n }\n\n setValue(newValue);\n }, [editor, setValue, onChangeProp]);\n return useMemo(() => {\n return {\n key: editor.key,\n editor,\n onChange,\n value\n };\n }, [editor, onChange, value]);\n};\n\n/**\n * Typed {@link useSlateStatic} & PlateEditor.\n * Needs to be called in a child component of `Plate`.\n * Else, use `usePlateEditorRef`.\n */\nconst useEditorRef = () => useSlateStatic();\n\n/**\n * Typed {@link useSlate} & PlateEditor.\n * Needs to be called in a child component of `Plate`.\n * Else, use `usePlateEditorState`.\n */\nconst useEditorState = () => useSlate();\n\n/**\n * @see https://github.com/radix-ui/primitives/blob/b324ec2d7ddf13a2a115cb5b11478e24d2f45b87/packages/core/primitive/src/primitive.tsx#L1\n */\nconst composeEventHandlers = (originalEventHandler, ourEventHandler, {\n checkForDefaultPrevented = true\n} = {}) => event => {\n originalEventHandler === null || originalEventHandler === void 0 ? void 0 : originalEventHandler(event);\n\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);\n }\n};\n\n/**\n * Creates a type-safe component with the `as` prop and `React.forwardRef`.\n * Also supports `asChild` prop.\n *\n * @see https://www.radix-ui.com/docs/primitives/overview/styling#changing-the-rendered-element\n * @see https://github.com/ariakit/ariakit/blob/ddd19e97a07a21e4d5fc93719d1fdc5bdab697f7/packages/ariakit-utils/src/system.tsx#L33\n *\n * @example\n * import { createComponent } from \"ariakit-utils/system\";\n *\n * type Props = {\n * as?: \"div\";\n * customProp?: boolean;\n * };\n *\n * const Component = createComponent<Props>(({ customProp, ...props }) => {\n * return <div {...props} />;\n * });\n *\n * <Component as=\"button\" customProp />\n */\nconst createComponentAs = render => {\n const Role = ({\n asChild,\n ...props\n }, ref) => {\n const Comp = asChild ? Slot : render;\n return Comp({\n ref,\n ...props\n });\n };\n\n return /*#__PURE__*/forwardRef(Role);\n};\n\nconst isRenderProp = children => typeof children === 'function';\n/**\n * Creates a React element that supports the `as` prop, children as a\n * function (render props) and a `wrapElement` function.\n *\n * @see https://github.com/ariakit/ariakit/blob/ddd19e97a07a21e4d5fc93719d1fdc5bdab697f7/packages/ariakit-utils/src/system.tsx#L57\n *\n * @example\n * import { createElement } from \"ariakit-utils/system\";\n *\n * function Component() {\n * const props = {\n * as: \"button\" as const,\n * children: (htmlProps) => <button {...htmlProps} />,\n * wrapElement: (element) => <div>{element}</div>,\n * };\n * return createElement(\"div\", props);\n * }\n */\n\n\nconst createElementAs = (Type, props) => {\n const {\n as: As,\n wrapElement,\n ...rest\n } = props;\n let element;\n\n if (As && typeof As !== 'string') {\n element = /*#__PURE__*/React.createElement(As, rest);\n } else if (isRenderProp(props.children)) {\n const {\n children,\n ...otherProps\n } = rest;\n element = props.children(otherProps);\n } else if (As) {\n element = /*#__PURE__*/React.createElement(As, rest);\n } else {\n element = /*#__PURE__*/React.createElement(Type, rest);\n }\n\n if (wrapElement) {\n return wrapElement(element);\n }\n\n return element;\n};\n\nconst createNodeHOC = HOC => (Component, props) => childrenProps => /*#__PURE__*/React.createElement(HOC, _extends({}, childrenProps, props), /*#__PURE__*/React.createElement(Component, childrenProps));\n\nconst createHOC = withHOC => {\n return (components, options) => {\n const _components = { ...components\n };\n const optionsByKey = {};\n\n const optionsList = castArray_1(options);\n\n optionsList.forEach(({\n key,\n keys,\n ...opt\n }) => {\n const _keys = key ? [key] : keys !== null && keys !== void 0 ? keys : Object.keys(_components);\n\n _keys.forEach(_key => {\n optionsByKey[_key] = { ...optionsByKey[_key],\n ...opt\n };\n });\n });\n Object.keys(optionsByKey).forEach(key => {\n if (!_components[key]) return;\n _components[key] = withHOC(_components[key], optionsByKey[key]);\n });\n return _components;\n };\n};\n/**\n * Create components HOC by plugin key.\n */\n\n\nconst createNodesHOC = HOC => {\n return createHOC(createNodeHOC(HOC));\n};\n/**\n * Create components HOC by plugin key with a custom HOC.\n */\n\nconst createNodesWithHOC = withHOC => {\n return createHOC(withHOC);\n};\n\n/**\n * Prevent default and call a handler if defined\n */\nconst getPreventDefaultHandler = (cb, ...args) => event => {\n event.preventDefault();\n cb === null || cb === void 0 ? void 0 : cb(...args);\n};\n\nconst withHOC = (HOC, Component, hocProps) => props => /*#__PURE__*/React.createElement(HOC, hocProps, /*#__PURE__*/React.createElement(Component, props));\n\n/**\n * HOC adding props.\n */\n\nconst withProps = (Component, props) => _props => /*#__PURE__*/React.createElement(Component, _extends({}, _props, props));\n\n/**\n * Wrap a component into multiple providers.\n * If there are any props that you want a provider to receive,\n * you can simply pass an array.\n */\n\nconst withProviders = (...providers) => WrappedComponent => props => providers.reduceRight((acc, prov) => {\n let Provider = prov;\n\n if (Array.isArray(prov)) {\n [Provider] = prov;\n return /*#__PURE__*/React.createElement(Provider, prov[1], acc);\n }\n\n return /*#__PURE__*/React.createElement(Provider, null, acc);\n}, /*#__PURE__*/React.createElement(WrappedComponent, props));\n\n/**\n * Create the top-level React component for a Slate element.\n */\nconst createPlateElementComponent = ({\n as = 'div',\n elementToAttributes\n} = {}) => createComponentAs(props => {\n const htmlProps = useElementProps({ ...props,\n elementToAttributes\n });\n return createElementAs(as, htmlProps);\n});\n\n/**\n * Get plugin keys by types\n */\nconst getKeysByTypes = (editor, type) => {\n const types = castArray_1(type);\n\n const found = Object.values(editor.pluginsByKey).filter(plugin => {\n return types.includes(plugin.type);\n });\n return found.map(p => p.key);\n};\n\n/**\n * Get plugin key by type\n */\n\nconst getKeyByType = (editor, type) => {\n return getKeysByTypes(editor, type)[0];\n};\n\nconst getPluginInjectProps = (editor, key) => {\n var _getPlugin$inject$pro, _getPlugin$inject;\n\n return (_getPlugin$inject$pro = (_getPlugin$inject = getPlugin(editor, key).inject) === null || _getPlugin$inject === void 0 ? void 0 : _getPlugin$inject.props) !== null && _getPlugin$inject$pro !== void 0 ? _getPlugin$inject$pro : {};\n};\n\nconst getPluginOptions = (editor, key) => {\n var _getPlugin$options;\n\n return (_getPlugin$options = getPlugin(editor, key).options) !== null && _getPlugin$options !== void 0 ? _getPlugin$options : {};\n};\n\n/**\n * Get plugin types option by plugin keys.\n */\n\nconst getPluginTypes = (editor, keys) => keys.map(key => getPluginType(editor, key));\n\n/**\n * Get `editor.plugins`\n */\nconst getPlugins = editor => {\n var _ref;\n\n return (_ref = editor === null || editor === void 0 ? void 0 : editor.plugins) !== null && _ref !== void 0 ? _ref : [];\n};\n\n/**\n * Map plugin inject props to injected plugin\n */\n\nconst mapInjectPropsToPlugin = (editor, plugin, injectedPlugin) => {\n var _plugin$inject$props;\n\n const validTypes = (_plugin$inject$props = plugin.inject.props) === null || _plugin$inject$props === void 0 ? void 0 : _plugin$inject$props.validTypes;\n if (!validTypes) return;\n const keys = getKeysByTypes(editor, validTypes);\n const injected = {};\n keys.forEach(key => {\n injected[key] = injectedPlugin;\n });\n return {\n inject: {\n pluginsByKey: injected\n }\n };\n};\n\nconst mockPlugin = plugin => ({\n key: '',\n type: '',\n editor: {},\n inject: {},\n options: {},\n ...plugin\n});\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return _baseIsEqual(value, other);\n}\n\nvar isEqual_1 = isEqual;\n\n/**\n * Normalize initial value from editor plugins. Set into plate store if diff.\n */\nconst normalizeInitialValue = (editor, value) => {\n let normalizedValue = cloneDeep_1(value);\n\n editor.plugins.forEach(p => {\n var _p$normalizeInitialVa;\n\n const _normalizedValue = (_p$normalizeInitialVa = p.normalizeInitialValue) === null || _p$normalizeInitialVa === void 0 ? void 0 : _p$normalizeInitialVa.call(p, normalizedValue);\n\n if (_normalizedValue) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n normalizedValue = _normalizedValue;\n }\n });\n\n if (!isEqual_1(value, normalizedValue)) {\n return normalizedValue;\n }\n};\n\nconst createDocumentNode = (type = 'p', text = '', remaining = []) => [{\n children: [{\n type,\n children: [{\n text\n }]\n }, ...remaining]\n}];\n\nconst createNode = (type = 'p', text = '') => ({\n type,\n children: [{\n text\n }]\n});\n\nconst SCOPE_ELEMENT = 'element';\nconst {\n elementStore,\n useElementStore\n} = createAtomStore({\n element: null\n}, {\n name: 'element'\n});\nconst useElement = (pluginKey = SCOPE_ELEMENT) => {\n const value = useElementStore().get.element(pluginKey);\n if (!value) throw new Error(`The \\`useElement(pluginKey)\\` hook must be used inside the node component's context`);\n return value;\n};\nconst ElementProviderChild = ({\n element,\n scope,\n children\n}) => {\n const setElement = useElementStore().set.element(scope);\n const setGlobalElement = useElementStore().set.element(SCOPE_ELEMENT);\n useEffect(() => {\n setElement(element);\n setGlobalElement(element);\n }, [element, setElement, setGlobalElement]);\n return children;\n};\n/**\n * Global and scoped provider above element.\n */\n\nconst ElementProvider = ({\n element,\n scope,\n children,\n ...props\n}) => /*#__PURE__*/React.createElement(JotaiProvider, _extends({\n initialValues: [[elementStore.atom.element, element]],\n scope: SCOPE_ELEMENT\n}, props), /*#__PURE__*/React.createElement(JotaiProvider, _extends({\n initialValues: [[elementStore.atom.element, element]],\n scope: scope\n}, props), /*#__PURE__*/React.createElement(ElementProviderChild, {\n element: element,\n scope: scope\n}, children)));\n\nconst Box = createComponentAs(props => createElementAs('div', props));\n\nconst EditorRefPluginEffect = ({\n plugin\n}) => {\n var _plugin$useHooks;\n\n const editor = useEditorRef();\n (_plugin$useHooks = plugin.useHooks) === null || _plugin$useHooks === void 0 ? void 0 : _plugin$useHooks.call(plugin, editor, plugin);\n return null;\n};\nconst EditorRefEffect = ({\n id\n}) => {\n const setIsRendered = usePlateActions(id).isRendered();\n const plugins = usePlateSelectors(id).plugins();\n useEffect(() => {\n setIsRendered(true);\n return () => {\n setIsRendered(false);\n };\n }, [setIsRendered]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, plugins.map(plugin => /*#__PURE__*/React.createElement(EditorRefPluginEffect, {\n key: plugin.key,\n plugin: plugin\n })));\n};\n\nconst EditorStateEffect = /*#__PURE__*/memo(({\n id\n}) => {\n const editorState = useEditorState();\n const updateKeyEditor = useUpdatePlateKey('keyEditor', id);\n const updateKeySelection = useUpdatePlateKey('keySelection', id);\n useEffect(() => {\n updateKeyEditor();\n });\n useEffect(() => {\n updateKeySelection();\n }, [editorState.selection, updateKeySelection]);\n return null;\n});\n\nconst PlateEditable = ({\n children,\n renderEditable,\n editableRef,\n firstChildren,\n ...props\n}) => {\n const {\n id\n } = props;\n const editor = useEditorRef();\n const {\n plugins\n } = editor;\n const editableProps = useEditableProps(props);\n const editable = /*#__PURE__*/React.createElement(Editable, _extends({\n ref: editableRef\n }, editableProps));\n let afterEditable = null;\n let beforeEditable = null;\n plugins.forEach(plugin => {\n const {\n renderBeforeEditable,\n renderAfterEditable\n } = plugin;\n\n if (renderAfterEditable) {\n afterEditable = /*#__PURE__*/React.createElement(React.Fragment, null, afterEditable, renderAfterEditable());\n }\n\n if (renderBeforeEditable) {\n beforeEditable = /*#__PURE__*/React.createElement(React.Fragment, null, beforeEditable, renderBeforeEditable());\n }\n });\n let aboveEditable = /*#__PURE__*/React.createElement(React.Fragment, null, firstChildren, beforeEditable, renderEditable ? renderEditable(editable) : editable, /*#__PURE__*/React.createElement(EditorStateEffect, {\n id: id\n }), /*#__PURE__*/React.createElement(EditorRefEffect, {\n id: id\n }), afterEditable, children);\n plugins.forEach(plugin => {\n const {\n renderAboveEditable\n } = plugin;\n if (renderAboveEditable) aboveEditable = renderAboveEditable({\n children: aboveEditable\n });\n });\n return aboveEditable;\n};\n\nconst PlateProviderEffects = ({\n children,\n ...props\n}) => {\n usePlateEffects(props);\n return /*#__PURE__*/React.createElement(React.Fragment, null, children);\n};\n\nconst PlateProviderContent = ({\n normalizeInitialValue: shouldNormalizeInitialValue,\n ...props\n}) => {\n const {\n id = PLATE_SCOPE,\n editor: _editor,\n initialValue,\n value: _value,\n children,\n plugins: _plugins,\n disableCorePlugins,\n onChange,\n decorate,\n renderElement,\n renderLeaf\n } = props;\n const editor = useMemo(() => _editor !== null && _editor !== void 0 ? _editor : createPlateEditor({\n id,\n plugins: _plugins,\n disableCorePlugins\n }), // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n const value = useMemo(() => {\n let currValue = initialValue !== null && initialValue !== void 0 ? initialValue : _value;\n\n if (!currValue) {\n currValue = editor.children.length ? editor.children : editor.childrenFactory();\n }\n\n const normalizedValue = normalizeInitialValue(editor, currValue);\n\n if (normalizedValue) {\n currValue = normalizedValue;\n }\n\n editor.children = currValue;\n\n if (shouldNormalizeInitialValue) {\n normalizeEditor(editor, {\n force: true\n });\n }\n\n return editor.children;\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n []);\n return /*#__PURE__*/React.createElement(JotaiProvider, {\n initialValues: [[plateStore.atom.id, id], [plateStore.atom.editor, editor], [plateStore.atom.plugins, editor.plugins], [plateStore.atom.rawPlugins, _plugins], [plateStore.atom.value, value], [plateStore.atom.decorate, {\n fn: decorate\n }], [plateStore.atom.onChange, {\n fn: onChange\n }], [plateStore.atom.renderElement, {\n fn: renderElement\n }], [plateStore.atom.renderLeaf, {\n fn: renderLeaf\n }]],\n scope: id\n }, /*#__PURE__*/React.createElement(JotaiProvider, {\n initialValues: [[plateIdAtom, id]],\n scope: GLOBAL_PLATE_SCOPE\n }, /*#__PURE__*/React.createElement(PlateProviderEffects, props, children)));\n};\n\nconst PlateProvider = props => {\n const {\n id\n } = props;\n return /*#__PURE__*/React.createElement(PlateProviderContent, _extends({\n key: id === null || id === void 0 ? void 0 : id.toString()\n }, props));\n};\nconst withPlateProvider = (Component, hocProps) => withHOC(PlateProvider, Component, hocProps);\n\nconst PlateSlate = ({\n id,\n children\n}) => {\n const slateProps = useSlateProps({\n id\n });\n const {\n plugins\n } = usePlateSelectors(id).editor();\n let aboveSlate = /*#__PURE__*/React.createElement(Slate, slateProps, children);\n plugins === null || plugins === void 0 ? void 0 : plugins.forEach(plugin => {\n const {\n renderAboveSlate\n } = plugin;\n if (renderAboveSlate) aboveSlate = renderAboveSlate({\n children: aboveSlate\n });\n });\n return aboveSlate;\n};\n\nconst Plate = ({\n children,\n editableRef,\n firstChildren,\n renderEditable,\n editableProps,\n ...props\n}) => {\n const {\n id = PLATE_SCOPE\n } = props;\n const providerId = usePlateSelectors(id).id();\n const editable = /*#__PURE__*/React.createElement(PlateSlate, {\n id: id\n }, /*#__PURE__*/React.createElement(PlateEditable, _extends({\n id: id,\n editableRef: editableRef,\n firstChildren: firstChildren,\n renderEditable: renderEditable\n }, editableProps), children));\n return providerId ? editable : /*#__PURE__*/React.createElement(PlateProvider, props, editable);\n};\n\nconst PlateTest = ({\n variant = 'wordProcessor',\n editableProps,\n normalizeInitialValue,\n ...props\n}) => {\n const {\n editor: _editor,\n id,\n plugins\n } = props;\n let editor = _editor;\n\n if (editor && !editor.plugins) {\n editor = createPlateEditor({\n editor,\n plugins,\n id,\n normalizeInitialValue\n });\n }\n\n return /*#__PURE__*/React.createElement(Plate, _extends({}, props, {\n editor: editor,\n editableProps: {\n 'data-variant': variant,\n 'data-testid': 'slate-content-editable',\n autoFocus: true,\n ...editableProps\n }\n }));\n};\n\nconst setElements = (editor, props, options) => setNodes(editor, props, options);\n\n/**\n * Toggle the type of the selected node.\n * Don't do anything if activeType === inactiveType.\n */\nconst toggleNodeType = (editor, options, editorNodesOptions) => {\n const {\n activeType,\n inactiveType = getPluginType(editor, ELEMENT_DEFAULT)\n } = options;\n if (!activeType || !editor.selection) return;\n const isActive = someNode(editor, { ...editorNodesOptions,\n match: {\n type: activeType\n }\n });\n if (isActive && activeType === inactiveType) return;\n setElements(editor, {\n type: isActive ? inactiveType : activeType\n });\n};\n\nconst onKeyDownToggleElement = (editor, {\n type,\n options: {\n hotkey\n }\n}) => e => {\n const defaultType = getPluginType(editor, ELEMENT_DEFAULT);\n if (!hotkey) return;\n\n const hotkeys = castArray_1(hotkey);\n\n for (const _hotkey of hotkeys) {\n if (isHotkey(_hotkey, e)) {\n e.preventDefault();\n toggleNodeType(editor, {\n activeType: type,\n inactiveType: defaultType\n });\n return;\n }\n }\n};\n\n/**\n * Remove mark and trigger `onChange` if collapsed selection.\n */\nconst removeMark = (editor, {\n key,\n at,\n shouldChange = true,\n ...rest\n}) => {\n const selection = at !== null && at !== void 0 ? at : editor.selection;\n key = castArray_1(key);\n\n if (selection) {\n if (Range.isRange(selection) && Range.isExpanded(selection)) {\n unsetNodes(editor, key, {\n at: selection,\n match: isText,\n split: true,\n ...rest\n });\n } else if (editor.selection) {\n const marks = { ...(getMarks(editor) || {})\n };\n key.forEach(k => {\n delete marks[k];\n });\n editor.marks = marks;\n shouldChange && editor.onChange();\n }\n }\n};\n\n/**\n * Add/remove marks in the selection.\n * @param editor\n * @param key mark to toggle\n * @param clear marks to clear when adding mark\n */\nconst toggleMark = (editor, {\n key,\n clear\n}) => {\n if (!editor.selection) return;\n withoutNormalizing(editor, () => {\n const isActive = isMarkActive(editor, key);\n\n if (isActive) {\n removeMark(editor, {\n key\n });\n return;\n }\n\n if (clear) {\n const clears = castArray_1(clear);\n removeMark(editor, {\n key: clears\n });\n }\n\n editor.addMark(key, true);\n });\n};\n\nconst onKeyDownToggleMark = (editor, {\n type,\n options: {\n hotkey,\n clear\n }\n}) => e => {\n if (!hotkey) return;\n\n if (isHotkey(hotkey, e)) {\n e.preventDefault();\n toggleMark(editor, {\n key: type,\n clear\n });\n }\n};\n\nconst CARRIAGE_RETURN = '\\u000D';\nconst LINE_FEED = '\\u000A';\nconst NO_BREAK_SPACE = '\\u00A0';\nconst SPACE = '\\u0020';\nconst TAB = '\\u0009';\nconst ZERO_WIDTH_SPACE = '\\u200B';\n\n/**\n * Depth-first pre-order tree traverse the given HTML node and calls the given callback for each node.\n * see: https://en.wikipedia.org/wiki/Tree_traversal#Pre-order_(NLR)\n *\n * @param callback returns a boolean indicating whether traversal should be continued\n */\nconst traverseHtmlNode = (node, callback) => {\n const keepTraversing = callback(node);\n\n if (!keepTraversing) {\n return;\n }\n\n let child = node.firstChild;\n\n while (child) {\n const currentChild = child;\n const previousChild = child.previousSibling;\n child = child.nextSibling;\n traverseHtmlNode(currentChild, callback);\n\n if ( // An unwrap was made. Need to compute the next child again.\n !currentChild.previousSibling && !currentChild.nextSibling && !currentChild.parentNode && child && previousChild !== child.previousSibling && child.parentNode) {\n if (previousChild) {\n child = previousChild.nextSibling;\n } else {\n child = node.firstChild;\n }\n } else if ( // A list was created. Need to compute the next child again.\n !currentChild.previousSibling && !currentChild.nextSibling && !currentChild.parentNode && child && !child.previousSibling && !child.nextSibling && !child.parentNode) {\n if (previousChild) {\n if (previousChild.nextSibling) {\n child = previousChild.nextSibling.nextSibling;\n } else {\n child = null;\n }\n } else if (node.firstChild) {\n child = node.firstChild.nextSibling;\n }\n }\n }\n};\n\n/**\n * Traverse the HTML elements of the given HTML node.\n * @param rootNode The root HTML node to traverse.\n * @param callback The callback to call for each HTML element.\n */\nconst traverseHtmlElements = (rootNode, callback) => {\n traverseHtmlNode(rootNode, node => {\n if (!isHtmlElement(node)) {\n return true;\n }\n\n return callback(node);\n });\n};\n\n/**\n * Replace BR elements with line feeds.\n */\n\nconst cleanHtmlBrElements = rootNode => {\n traverseHtmlElements(rootNode, element => {\n if (element.tagName !== 'BR') {\n return true;\n }\n\n const replacementTextNode = document.createTextNode(LINE_FEED);\n\n if (element.parentElement) {\n element.parentElement.replaceChild(replacementTextNode, element);\n }\n\n return false;\n });\n};\n\n/**\n * Replace \\r\\n and \\r with \\n\n */\nconst cleanHtmlCrLf = html => {\n return html.replace(/(\\r\\n|\\r)/gm, '\\n');\n};\n\nconst ALLOWED_EMPTY_ELEMENTS = ['BR', 'IMG'];\n\nconst isEmpty = element => {\n return !ALLOWED_EMPTY_ELEMENTS.includes(element.nodeName) && !element.innerHTML.trim();\n};\n\nconst removeIfEmpty = element => {\n if (isEmpty(element)) {\n const {\n parentElement\n } = element;\n element.remove();\n\n if (parentElement) {\n removeIfEmpty(parentElement);\n }\n }\n};\n/**\n * Remove empty elements from rootNode.\n * Allowed empty elements: BR, IMG.\n */\n\n\nconst cleanHtmlEmptyElements = rootNode => {\n traverseHtmlElements(rootNode, element => {\n removeIfEmpty(element);\n return true;\n });\n};\n\n/**\n * Replace `element` tag name by `tagName`.\n * Attributes, innerHTML and parent relationship is kept.\n */\nconst replaceTagName = (element, tagName) => {\n const newElement = document.createElement(tagName);\n newElement.innerHTML = element.innerHTML;\n\n for (const {\n name\n } of element.attributes) {\n const value = element.getAttribute(name);\n\n if (value) {\n newElement.setAttribute(name, value);\n }\n }\n\n if (element.parentNode) {\n element.parentNode.replaceChild(newElement, element);\n }\n\n return newElement;\n};\n\n/**\n * Replace FONT elements with SPAN elements if there is textContent (remove otherwise).\n */\n\nconst cleanHtmlFontElements = rootNode => {\n traverseHtmlElements(rootNode, element => {\n if (element.tagName === 'FONT') {\n if (element.textContent) {\n replaceTagName(element, 'span');\n } else {\n element.remove();\n }\n }\n\n return true;\n });\n};\n\n/**\n * If href starts with '#'.\n */\nconst isHtmlFragmentHref = href => href.startsWith('#');\n\n/**\n * Unwrap the given HTML element.\n */\nconst unwrapHtmlElement = element => {\n element.outerHTML = element.innerHTML;\n};\n\n/**\n * Remove fragment hrefs and spans without inner text.\n */\n\nconst cleanHtmlLinkElements = rootNode => {\n traverseHtmlElements(rootNode, element => {\n if (element.tagName !== 'A') {\n return true;\n }\n\n const href = element.getAttribute('href');\n\n if (!href || isHtmlFragmentHref(href)) {\n unwrapHtmlElement(element);\n }\n\n if (href && element.querySelector('img')) {\n for (const span of element.querySelectorAll('span')) {\n if (!span.innerText) {\n unwrapHtmlElement(span);\n }\n }\n }\n\n return true;\n });\n};\n\nconst traverseHtmlTexts = (rootNode, callback) => {\n traverseHtmlNode(rootNode, node => {\n if (!isHtmlText(node)) {\n return true;\n }\n\n return callback(node);\n });\n};\n\nconst cleanHtmlTextNodes = rootNode => {\n traverseHtmlTexts(rootNode, textNode => {\n if (/^\\n\\s*$/.test(textNode.data) && (textNode.previousElementSibling || textNode.nextElementSibling)) {\n textNode.remove();\n return true;\n }\n\n textNode.data = textNode.data.replace(/\\n\\s*/g, '\\n');\n\n if (textNode.data.includes(CARRIAGE_RETURN) || textNode.data.includes(LINE_FEED) || textNode.data.includes(NO_BREAK_SPACE)) {\n const hasSpace = textNode.data.includes(SPACE);\n const hasNonWhitespace = /\\S/.test(textNode.data);\n const hasLineFeed = textNode.data.includes(LINE_FEED);\n\n if (!(hasSpace || hasNonWhitespace) && !hasLineFeed) {\n if (textNode.data === NO_BREAK_SPACE) {\n textNode.data = SPACE;\n return true;\n }\n\n textNode.remove();\n return true;\n }\n\n if (textNode.previousSibling && textNode.previousSibling.nodeName === 'BR' && textNode.parentElement) {\n textNode.parentElement.removeChild(textNode.previousSibling);\n const matches = textNode.data.match(/^[\\r\\n]+/);\n const offset = matches ? matches[0].length : 0;\n textNode.data = textNode.data.substring(offset).replace(new RegExp(LINE_FEED, 'g'), SPACE).replace(new RegExp(CARRIAGE_RETURN, 'g'), SPACE);\n textNode.data = `\\n${textNode.data}`;\n } else {\n textNode.data = textNode.data.replace(new RegExp(LINE_FEED, 'g'), SPACE).replace(new RegExp(CARRIAGE_RETURN, 'g'), SPACE);\n }\n }\n\n return true;\n });\n};\n\n/**\n * Is the element a block element?\n */\nconst isHtmlBlockElement = element => {\n const blockRegex = /^(address|blockquote|body|center|dir|div|dl|fieldset|form|h[1-6]|hr|isindex|menu|noframes|noscript|ol|p|pre|table|ul|dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|html)$/i;\n return blockRegex.test(element.nodeName);\n};\n\n/**\n * Set HTML blocks mark styles to a new child span element if any.\n * This allows Plate to use block marks.\n */\n\nconst copyBlockMarksToSpanChild = rootNode => {\n traverseHtmlElements(rootNode, element => {\n const el = element;\n const styleAttribute = element.getAttribute('style');\n if (!styleAttribute) return true;\n\n if (isHtmlBlockElement(el)) {\n const {\n style: {\n backgroundColor,\n color,\n fontFamily,\n fontSize,\n fontStyle,\n fontWeight,\n textDecoration\n }\n } = el;\n\n if (backgroundColor || color || fontFamily || fontSize || fontStyle || fontWeight || textDecoration) {\n const span = document.createElement('span');\n\n if (!['initial', 'inherit'].includes(color)) {\n span.style.color = color;\n }\n\n span.style.fontFamily = fontFamily;\n span.style.fontSize = fontSize;\n\n if (!['normal', 'initial', 'inherit'].includes(color)) {\n span.style.fontStyle = fontStyle;\n }\n\n if (!['normal', 400].includes(fontWeight)) {\n span.style.fontWeight = fontWeight;\n }\n\n span.style.textDecoration = textDecoration;\n span.innerHTML = el.innerHTML;\n element.innerHTML = span.outerHTML;\n }\n }\n\n return true;\n });\n};\n\n/**\n * Find the first HTML element that matches the given selector.\n * @param rootNode\n * @param predicate\n */\n\nconst findHtmlElement = (rootNode, predicate) => {\n let res = null;\n traverseHtmlElements(rootNode, node => {\n if (predicate(node)) {\n res = node;\n return false;\n }\n\n return true;\n });\n return res;\n};\nconst someHtmlElement = (rootNode, predicate) => {\n return !!findHtmlElement(rootNode, predicate);\n};\n\nconst acceptNode = () => NodeFilter.FILTER_ACCEPT;\n\nconst getHtmlComments = node => {\n const comments = [];\n const iterator = document.createNodeIterator(node, NodeFilter.SHOW_COMMENT, {\n acceptNode\n });\n let currentNode = iterator.nextNode();\n\n while (currentNode) {\n if (currentNode.nodeValue) {\n comments.push(currentNode.nodeValue);\n }\n\n currentNode = iterator.nextNode();\n }\n\n return comments;\n};\n\nconst isHtmlComment = node => node.nodeType === Node.COMMENT_NODE;\n\nconst isOlSymbol = symbol => {\n return /[0-9a-np-z]\\S/g.test(symbol.toLowerCase());\n};\n\nconst parseHtmlElement = html => {\n const {\n body\n } = parseHtmlDocument(html);\n return body.firstElementChild;\n};\n\n/**\n * Trim the html and remove zero width spaces,\n * then wrap it with a body element.\n */\n\nconst postCleanHtml = html => {\n const cleanHtml = html.trim().replace(new RegExp(ZERO_WIDTH_SPACE, 'g'), '');\n return `<body>${cleanHtml}</body>`;\n};\n\n/**\n * Remove string before <html\n */\nconst removeBeforeHtml = html => {\n const index = html.indexOf('<html');\n\n if (index === -1) {\n return html;\n }\n\n return html.substring(index);\n};\n/**\n * Remove string after </html>\n */\n\n\nconst removeAfterHtml = html => {\n const index = html.lastIndexOf('</html>');\n\n if (index === -1) {\n return html;\n }\n\n return html.substring(0, index + '</html>'.length);\n};\n/**\n * Remove string before <html and after </html>\n */\n\n\nconst removeHtmlSurroundings = html => {\n return removeBeforeHtml(removeAfterHtml(html));\n};\n\nconst cleaners = [removeHtmlSurroundings, cleanHtmlCrLf];\n/**\n * Remove HTML surroundings and clean HTML from CR/LF\n */\n\nconst preCleanHtml = html => {\n return cleaners.reduce((result, clean) => clean(result), html);\n};\n\n/**\n * Traverse HTML comments.\n */\nconst traverseHtmlComments = (rootNode, callback) => {\n traverseHtmlNode(rootNode, node => {\n if (!isHtmlComment(node)) {\n return true;\n }\n\n return callback(node);\n });\n};\n\n/**\n * Removes HTML nodes between HTML comments.\n */\n\nconst removeHtmlNodesBetweenComments = (rootNode, start, end) => {\n const isClosingComment = node => isHtmlComment(node) && node.data === end;\n\n traverseHtmlComments(rootNode, comment => {\n if (comment.data === start) {\n let node = comment.nextSibling;\n comment.remove();\n\n while (node && !isClosingComment(node)) {\n const {\n nextSibling\n } = node;\n node.remove();\n node = nextSibling;\n }\n\n if (node && isClosingComment(node)) {\n node.remove();\n }\n }\n\n return true;\n });\n};\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = _baseRest(function(object, sources) {\n object = Object(object);\n\n var index = -1;\n var length = sources.length;\n var guard = length > 2 ? sources[2] : undefined;\n\n if (guard && _isIterateeCall(sources[0], sources[1], guard)) {\n length = 1;\n }\n\n while (++index < length) {\n var source = sources[index];\n var props = keysIn_1(source);\n var propsIndex = -1;\n var propsLength = props.length;\n\n while (++propsIndex < propsLength) {\n var key = props[propsIndex];\n var value = object[key];\n\n if (value === undefined ||\n (eq_1(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n object[key] = source[key];\n }\n }\n }\n\n return object;\n});\n\nvar defaults_1 = defaults;\n\n/**\n * Recursively merge a source object to children nodes with a query.\n */\n\nconst defaultsDeepToNodes = options => {\n applyDeepToNodes({ ...options,\n apply: defaults_1\n });\n};\n\nconst insertElements = (editor, nodes, options) => insertNodes(editor, nodes, options);\n\nconst insertEmptyElement = (editor, type, options) => {\n insertElements(editor, {\n type,\n children: [{\n text: ''\n }]\n }, getQueryOptions(editor, options));\n};\n\n/**\n * Move the children of a node to a path.\n * Returns the number of children moved.\n */\nconst moveChildren = (editor, {\n at,\n to,\n match,\n fromStartIndex = 0\n}) => {\n let moved = 0;\n const parentPath = Path.isPath(at) ? at : at[1];\n const parentNode = Path.isPath(at) ? getNode(editor, parentPath) : at[0];\n if (!isBlock(editor, parentNode)) return moved;\n\n for (let i = parentNode.children.length - 1; i >= fromStartIndex; i--) {\n const childPath = [...parentPath, i];\n const childNode = getNode(editor, childPath);\n\n if (!match || childNode && match([childNode, childPath])) {\n moveNodes(editor, {\n at: childPath,\n to\n });\n moved++;\n }\n }\n\n return moved;\n};\n\n/**\n * Remove node children.\n */\n\nconst removeNodeChildren = (editor, path, options) => {\n withoutNormalizing(editor, () => {\n for (const [, childPath] of getNodeChildren(editor, path, {\n reverse: true\n })) {\n removeNodes(editor, { ...options,\n at: childPath\n });\n }\n });\n};\n\n/**\n * Replace node children: remove then insert.\n */\nconst replaceNodeChildren = (editor, {\n at,\n nodes,\n insertOptions,\n removeOptions\n}) => {\n withoutNormalizing(editor, () => {\n removeNodeChildren(editor, at, removeOptions);\n insertNodes(editor, nodes, { ...insertOptions,\n at: at.concat([0])\n });\n });\n};\n\n/**\n * Replace editor children by default block.\n */\n\nconst resetEditorChildren = (editor, options) => {\n replaceNodeChildren(editor, {\n at: [],\n nodes: editor.childrenFactory(),\n ...options\n });\n};\n\n/**\n * Select an editor at a target or an edge (start, end).\n */\nconst selectEditor = (editor, {\n at,\n edge,\n focus\n}) => {\n if (focus) {\n focusEditor(editor);\n }\n\n let location = at;\n\n if (edge === 'start') {\n location = getStartPoint(editor, []);\n }\n\n if (edge === 'end') {\n location = getEndPoint(editor, []);\n }\n\n if (location) {\n select(editor, location);\n }\n};\n\n/**\n * Select the end point of the block above the selection.\n */\n\nconst selectEndOfBlockAboveSelection = editor => {\n var _getBlockAbove;\n\n const path = (_getBlockAbove = getBlockAbove(editor)) === null || _getBlockAbove === void 0 ? void 0 : _getBlockAbove[1];\n path && select(editor, getEndPoint(editor, path));\n};\n\n/**\n * Set marks to selected text.\n */\n\nconst setMarks = (editor, marks, clear = []) => {\n if (!editor.selection) return;\n withoutNormalizing(editor, () => {\n const clears = castArray_1(clear);\n removeMark(editor, {\n key: clears\n });\n removeMark(editor, {\n key: Object.keys(marks)\n });\n Object.keys(marks).forEach(key => {\n editor.addMark(key, marks[key]);\n });\n });\n};\n\n/**\n * Unwrap if the node type is in selection.\n * Wrap otherwise.\n */\n\nconst toggleWrapNodes = (editor, type) => {\n if (someNode(editor, {\n match: {\n type\n }\n })) {\n unwrapNodes(editor, {\n match: {\n type\n }\n });\n } else {\n wrapNodes(editor, {\n type,\n children: []\n });\n }\n};\n\n/**\n * Wrap node children into a single element:\n * - wraps the first child node into the element\n * - move the other child nodes next to the element children.\n */\n\nconst wrapNodeChildren = (editor, element, options) => {\n const path = options === null || options === void 0 ? void 0 : options.at;\n const node = getNode(editor, path);\n if (!(node !== null && node !== void 0 && node.children)) return;\n withoutNormalizing(editor, () => {\n const firstChildPath = path.concat([0]);\n wrapNodes(editor, element, { ...options,\n at: firstChildPath\n });\n if (node.children.length < 2) return;\n moveChildren(editor, {\n at: path,\n to: firstChildPath.concat([1]),\n fromStartIndex: 1\n });\n });\n};\n\nexport { Box, CARRIAGE_RETURN, DEFAULT_IGNORE_CLASS, DOM_HANDLERS, DefaultLeaf, ELEMENT_DEFAULT, EditorRefEffect, EditorRefPluginEffect, EditorStateEffect, ElementProvider, ElementProviderChild, GLOBAL_PLATE_SCOPE, Hotkeys, IS_APPLE, JotaiProvider, KEY_DESERIALIZE_AST, KEY_DESERIALIZE_HTML, KEY_EVENT_EDITOR, KEY_INLINE_VOID, KEY_INSERT_DATA, KEY_NODE_FACTORY, KEY_PREV_SELECTION, LINE_FEED, NO_BREAK_SPACE, PLATE_SCOPE, Plate, PlateEditable, PlateProvider, PlateProviderEffects, PlateSlate, PlateTest, SCOPE_ELEMENT, SPACE, TAB, ZERO_WIDTH_SPACE, addMark, applyDeepToNodes, blurEditor, cleanHtmlBrElements, cleanHtmlCrLf, cleanHtmlEmptyElements, cleanHtmlFontElements, cleanHtmlLinkElements, cleanHtmlTextNodes, collapseSelection, composeEventHandlers, composeRefs, copyBlockMarksToSpanChild, createAtomStore, createComponentAs, createDeserializeAstPlugin, createDeserializeHtmlPlugin, createDocumentNode, createElementAs, createEventEditorPlugin, createHistoryPlugin, createInlineVoidPlugin, createInsertDataPlugin, createNode, createNodeFactoryPlugin, createNodeHOC, createNodesHOC, createNodesWithHOC, createPathRef, createPlateEditor, createPlateElementComponent, createPlateStore, createPluginFactory, createPlugins, createPointRef, createPrevSelectionPlugin, createRangeRef, createReactPlugin, createTEditor, defaultsDeepToNodes, deleteBackward, deleteForward, deleteFragment, deleteMerge, deleteText, deselect, deselectEditor, deserializeHtml, deserializeHtmlElement, deserializeHtmlNode, deserializeHtmlNodeChildren, elementMatches, elementStore, escapeRegExp, eventEditorActions, eventEditorSelectors, eventEditorStore, findDescendant, findEditorDocumentOrShadowRoot, findEventRange, findHtmlElement, findHtmlParentElement, findNode, findNodeKey, findNodePath, flattenDeepPlugins, focusEditor, getAboveNode, getBlockAbove, getChildren, getCommonNode, getEdgeBlocksAbove, getEdgePoints, getEditorString, getEditorWindow, getEndPoint, getEventPlateId, getFirstNode, getFragment, getHandler, getHtmlComments, getInjectedPlugins, getKeyByType, getKeysByTypes, getLastChild$1 as getLastChild, getLastChildPath, getLastNode, getLastNodeByLevel, getLeafNode, getLevels, getMark, getMarks, getNextNode, getNextNodeStartPoint, getNextSiblingNodes, getNode, getNodeAncestor, getNodeAncestors, getNodeChild, getNodeChildren, getNodeDescendant, getNodeDescendants, getNodeElements, getNodeEntries, getNodeEntry, getNodeFirstNode, getNodeFragment, getNodeLastNode, getNodeLeaf, getNodeLevels, getNodeParent, getNodeProps, getNodeString, getNodeTexts, getNodes, getOperations, getParentNode, getPath, getPathRefs, getPlugin, getPluginInjectProps, getPluginOptions, getPluginType, getPluginTypes, getPlugins, getPluginsByKey, getPoint, getPointAfter, getPointBefore, getPointBeforeLocation, getPointFromLocation, getPointNextToVoid, getPointRefs, getPositions, getPreventDefaultHandler, getPreviousBlockById, getPreviousNode, getPreviousNodeEndPoint, getPreviousPath, getQueryOptions, getRange, getRangeBefore, getRangeFromBlockStart, getRangeRefs, getRenderNodeProps, getSelectionText, getSlateClass, getStartPoint, getTEditor, getVoidNode, hasBlocks, hasEditorDOMNode, hasInlines, hasNode, hasSingleChild, hasTexts, hexToBase64, htmlBodyToFragment, htmlBrToNewLine, htmlElementToElement, htmlElementToLeaf, htmlStringToDOMNode, htmlTextNodeToString, insertBreak, insertData, insertElements, insertEmptyElement, insertFragment, insertNode, insertNodes, insertText, isAncestor, isAncestorEmpty, isBlock, isBlockAboveEmpty, isBlockTextEmptyAfterSelection, isCollapsed, isComposing, isDefined, isDescendant, isEdgePoint, isEditor, isEditorFocused, isEditorNormalizing, isEditorReadOnly, isElement, isElementEmpty, isElementList, isEndPoint, isEventHandled, isExpanded, isFirstChild, isHistoryEditor, isHistoryMerging, isHistorySaving, isHtmlBlockElement, isHtmlComment, isHtmlElement, isHtmlFragmentHref, isHtmlText, isInline, isLastChild, isMarkActive, isNode, isNodeList, isNull, isOlSymbol, isPointAtWordEnd, isRangeAcrossBlocks, isRangeInSameBlock, isRangeInSingleText, isSelectionAtBlockEnd, isSelectionAtBlockStart, isSelectionExpanded, isStartPoint, isText, isTextByPath, isTextList, isType, isUndefined, isUndefinedOrNull, isUrl, isVoid, isWordAfterTrigger, liftNodes, mapInjectPropsToPlugin, match, mergeDeepPlugins, mergeDeepToNodes, mergeNodes, mergeProps, mockPlugin, moveChildren, moveNodes, moveSelection, nodeMatches, normalizeDescendantsToDocumentFragment, normalizeEditor, normalizeInitialValue, onKeyDownToggleElement, onKeyDownToggleMark, overridePluginsByKey, parseHtmlDocument, parseHtmlElement, pipeDecorate, pipeDeserializeHtmlElement, pipeDeserializeHtmlLeaf, pipeHandler, pipeInjectProps, pipeInsertDataQuery, pipeInsertFragment, pipeOnChange, pipeRenderElement, pipeRenderLeaf, pipeTransformData, pipeTransformFragment, plateIdAtom, plateStore, pluginDeserializeHtml, pluginInjectProps, pluginRenderElement, pluginRenderLeaf, postCleanHtml, preCleanHtml, queryEditor, queryNode, removeEditorMark, removeHtmlNodesBetweenComments, removeHtmlSurroundings, removeMark, removeNodeChildren, removeNodes, replaceNodeChildren, replaceTagName, resetEditorChildren, select, selectEditor, selectEndOfBlockAboveSelection, setDefaultPlugin, setElements, setFragmentData, setMarks, setNodes, setPlatePlugins, setPoint, setSelection, someHtmlElement, someNode, splitNodes, textEquals, textMatches, toDOMNode, toDOMPoint, toDOMRange, toSlateNode, toSlatePoint, toSlateRange, toggleMark, toggleNodeType, toggleWrapNodes, traverseHtmlComments, traverseHtmlElements, traverseHtmlNode, traverseHtmlTexts, unhangRange, unsetNodes, unwrapHtmlElement, unwrapNodes, useComposedRef, useEditableProps, useEditorRef, useEditorState, useElement, useElementProps, useElementStore, useEventEditorSelectors, useEventPlateId, useOnClickOutside, usePlateActions, usePlateEditorRef, usePlateEditorState, usePlateEffects, usePlateId, usePlateSelection, usePlateSelectors, usePlateStates, usePlateStore, useRedecorate, useResetPlateEditor, useSlateProps, useUpdatePlateKey, useWrapElement, withHOC, withInlineVoid, withInsertData, withPlate, withPlateProvider, withProps, withProviders, withTHistory, withTReact, withoutMergingHistory, withoutNormalizing, withoutSavingHistory, wrapNodeChildren, wrapNodes };\n//# sourceMappingURL=index.es.js.map\n"],"names":["Node$1"],"mappings":";;;;;;;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