, or turn it into a \") + 'drag source or a drop target itself.');\n}\n\nfunction wrapHookToRecognizeElement(hook) {\n return function () {\n var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n // When passed a node, call the hook straight away.\n if (!isValidElement(elementOrNode)) {\n var node = elementOrNode;\n hook(node, options); // return the node so it can be chained (e.g. when within callback refs\n //
connectDragSource(connectDropTarget(node))}/>\n\n return node;\n } // If passed a ReactElement, clone it and attach this function as a ref.\n // This helps us achieve a neat API where user doesn't even know that refs\n // are being used under the hood.\n\n\n var element = elementOrNode;\n throwIfCompositeComponentElement(element); // When no options are passed, use the hook directly\n\n var ref = options ? function (node) {\n return hook(node, options);\n } : hook;\n return cloneWithRef(element, ref);\n };\n}\n\nexport default function wrapConnectorHooks(hooks) {\n var wrappedHooks = {};\n Object.keys(hooks).forEach(function (key) {\n var hook = hooks[key]; // ref objects should be passed straight through without wrapping\n\n if (key.endsWith('Ref')) {\n wrappedHooks[key] = hooks[key];\n } else {\n var wrappedHook = wrapHookToRecognizeElement(hook);\n\n wrappedHooks[key] = function () {\n return wrappedHook;\n };\n }\n });\n return wrappedHooks;\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nexport function isRef(obj) {\n return (// eslint-disable-next-line no-prototype-builtins\n obj !== null && _typeof(obj) === 'object' && obj.hasOwnProperty('current')\n );\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport wrapConnectorHooks from './wrapConnectorHooks';\nimport { isRef } from '../utils/isRef';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nexport var SourceConnector =\n/*#__PURE__*/\nfunction () {\n function SourceConnector(backend) {\n var _this = this;\n\n _classCallCheck(this, SourceConnector);\n\n this.hooks = wrapConnectorHooks({\n dragSource: function dragSource(node, options) {\n _this.clearDragSource();\n\n _this.dragSourceOptions = options || null;\n\n if (isRef(node)) {\n _this.dragSourceRef = node;\n } else {\n _this.dragSourceNode = node;\n }\n\n _this.reconnectDragSource();\n },\n dragPreview: function dragPreview(node, options) {\n _this.clearDragPreview();\n\n _this.dragPreviewOptions = options || null;\n\n if (isRef(node)) {\n _this.dragPreviewRef = node;\n } else {\n _this.dragPreviewNode = node;\n }\n\n _this.reconnectDragPreview();\n }\n });\n this.handlerId = null; // The drop target may either be attached via ref or connect function\n\n this.dragSourceRef = null;\n this.dragSourceOptionsInternal = null; // The drag preview may either be attached via ref or connect function\n\n this.dragPreviewRef = null;\n this.dragPreviewOptionsInternal = null;\n this.lastConnectedHandlerId = null;\n this.lastConnectedDragSource = null;\n this.lastConnectedDragSourceOptions = null;\n this.lastConnectedDragPreview = null;\n this.lastConnectedDragPreviewOptions = null;\n this.backend = backend;\n }\n\n _createClass(SourceConnector, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(newHandlerId) {\n if (this.handlerId === newHandlerId) {\n return;\n }\n\n this.handlerId = newHandlerId;\n this.reconnect();\n }\n }, {\n key: \"reconnect\",\n value: function reconnect() {\n this.reconnectDragSource();\n this.reconnectDragPreview();\n }\n }, {\n key: \"reconnectDragSource\",\n value: function reconnectDragSource() {\n var dragSource = this.dragSource; // if nothing has changed then don't resubscribe\n\n var didChange = this.didHandlerIdChange() || this.didConnectedDragSourceChange() || this.didDragSourceOptionsChange();\n\n if (didChange) {\n this.disconnectDragSource();\n }\n\n if (!this.handlerId) {\n return;\n }\n\n if (!dragSource) {\n this.lastConnectedDragSource = dragSource;\n return;\n }\n\n if (didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDragSource = dragSource;\n this.lastConnectedDragSourceOptions = this.dragSourceOptions;\n this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);\n }\n }\n }, {\n key: \"reconnectDragPreview\",\n value: function reconnectDragPreview() {\n var dragPreview = this.dragPreview; // if nothing has changed then don't resubscribe\n\n var didChange = this.didHandlerIdChange() || this.didConnectedDragPreviewChange() || this.didDragPreviewOptionsChange();\n\n if (!this.handlerId) {\n this.disconnectDragPreview();\n } else if (this.dragPreview && didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDragPreview = dragPreview;\n this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;\n this.disconnectDragPreview();\n this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);\n }\n }\n }, {\n key: \"didHandlerIdChange\",\n value: function didHandlerIdChange() {\n return this.lastConnectedHandlerId !== this.handlerId;\n }\n }, {\n key: \"didConnectedDragSourceChange\",\n value: function didConnectedDragSourceChange() {\n return this.lastConnectedDragSource !== this.dragSource;\n }\n }, {\n key: \"didConnectedDragPreviewChange\",\n value: function didConnectedDragPreviewChange() {\n return this.lastConnectedDragPreview !== this.dragPreview;\n }\n }, {\n key: \"didDragSourceOptionsChange\",\n value: function didDragSourceOptionsChange() {\n return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions);\n }\n }, {\n key: \"didDragPreviewOptionsChange\",\n value: function didDragPreviewOptionsChange() {\n return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);\n }\n }, {\n key: \"disconnectDragSource\",\n value: function disconnectDragSource() {\n if (this.dragSourceUnsubscribe) {\n this.dragSourceUnsubscribe();\n this.dragSourceUnsubscribe = undefined;\n }\n }\n }, {\n key: \"disconnectDragPreview\",\n value: function disconnectDragPreview() {\n if (this.dragPreviewUnsubscribe) {\n this.dragPreviewUnsubscribe();\n this.dragPreviewUnsubscribe = undefined;\n this.dragPreviewNode = null;\n this.dragPreviewRef = null;\n }\n }\n }, {\n key: \"clearDragSource\",\n value: function clearDragSource() {\n this.dragSourceNode = null;\n this.dragSourceRef = null;\n }\n }, {\n key: \"clearDragPreview\",\n value: function clearDragPreview() {\n this.dragPreviewNode = null;\n this.dragPreviewRef = null;\n }\n }, {\n key: \"connectTarget\",\n get: function get() {\n return this.dragSource;\n }\n }, {\n key: \"dragSourceOptions\",\n get: function get() {\n return this.dragSourceOptionsInternal;\n },\n set: function set(options) {\n this.dragSourceOptionsInternal = options;\n }\n }, {\n key: \"dragPreviewOptions\",\n get: function get() {\n return this.dragPreviewOptionsInternal;\n },\n set: function set(options) {\n this.dragPreviewOptionsInternal = options;\n }\n }, {\n key: \"dragSource\",\n get: function get() {\n return this.dragSourceNode || this.dragSourceRef && this.dragSourceRef.current;\n }\n }, {\n key: \"dragPreview\",\n get: function get() {\n return this.dragPreviewNode || this.dragPreviewRef && this.dragPreviewRef.current;\n }\n }]);\n\n return SourceConnector;\n}();","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { registerSource } from '../../common/registration';\nimport { useDragDropManager } from './useDragDropManager';\nimport { DragSourceMonitorImpl } from '../../common/DragSourceMonitorImpl';\nimport { SourceConnector } from '../../common/SourceConnector';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nexport function useDragSourceMonitor() {\n var manager = useDragDropManager();\n var monitor = useMemo(function () {\n return new DragSourceMonitorImpl(manager);\n }, [manager]);\n var connector = useMemo(function () {\n return new SourceConnector(manager.getBackend());\n }, [manager]);\n return [monitor, connector];\n}\nexport function useDragHandler(spec, monitor, connector) {\n var manager = useDragDropManager();\n var handler = useMemo(function () {\n return {\n beginDrag: function beginDrag() {\n var _spec$current = spec.current,\n begin = _spec$current.begin,\n item = _spec$current.item;\n\n if (begin) {\n var beginResult = begin(monitor);\n invariant(beginResult == null || _typeof(beginResult) === 'object', 'dragSpec.begin() must either return an object, undefined, or null');\n return beginResult || item || {};\n }\n\n return item || {};\n },\n canDrag: function canDrag() {\n if (typeof spec.current.canDrag === 'boolean') {\n return spec.current.canDrag;\n } else if (typeof spec.current.canDrag === 'function') {\n return spec.current.canDrag(monitor);\n } else {\n return true;\n }\n },\n isDragging: function isDragging(globalMonitor, target) {\n var isDragging = spec.current.isDragging;\n return isDragging ? isDragging(monitor) : target === globalMonitor.getSourceId();\n },\n endDrag: function endDrag() {\n var end = spec.current.end;\n\n if (end) {\n end(monitor.getItem(), monitor);\n }\n\n connector.reconnect();\n }\n };\n }, []);\n useIsomorphicLayoutEffect(function registerHandler() {\n var _registerSource = registerSource(spec.current.item.type, handler, manager),\n _registerSource2 = _slicedToArray(_registerSource, 2),\n handlerId = _registerSource2[0],\n unregister = _registerSource2[1];\n\n monitor.receiveHandlerId(handlerId);\n connector.receiveHandlerId(handlerId);\n return unregister;\n }, []);\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useRef, useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { useMonitorOutput } from './internal/useMonitorOutput';\nimport { useIsomorphicLayoutEffect } from './internal/useIsomorphicLayoutEffect';\nimport { useDragSourceMonitor, useDragHandler } from './internal/drag';\n/**\n * useDragSource hook\n * @param sourceSpec The drag source specification *\n */\n\nexport function useDrag(spec) {\n var specRef = useRef(spec);\n specRef.current = spec; // TODO: wire options into createSourceConnector\n\n invariant(spec.item != null, 'item must be defined');\n invariant(spec.item.type != null, 'item type must be defined');\n\n var _useDragSourceMonitor = useDragSourceMonitor(),\n _useDragSourceMonitor2 = _slicedToArray(_useDragSourceMonitor, 2),\n monitor = _useDragSourceMonitor2[0],\n connector = _useDragSourceMonitor2[1];\n\n useDragHandler(specRef, monitor, connector);\n var result = useMonitorOutput(monitor, specRef.current.collect || function () {\n return {};\n }, function () {\n return connector.reconnect();\n });\n var connectDragSource = useMemo(function () {\n return connector.hooks.dragSource();\n }, [connector]);\n var connectDragPreview = useMemo(function () {\n return connector.hooks.dragPreview();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dragSourceOptions = specRef.current.options || null;\n connector.reconnect();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dragPreviewOptions = specRef.current.previewOptions || null;\n connector.reconnect();\n }, [connector]);\n return [result, connectDragSource, connectDragPreview];\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport wrapConnectorHooks from './wrapConnectorHooks';\nimport { isRef } from '../utils/isRef';\nexport var TargetConnector =\n/*#__PURE__*/\nfunction () {\n function TargetConnector(backend) {\n var _this = this;\n\n _classCallCheck(this, TargetConnector);\n\n this.hooks = wrapConnectorHooks({\n dropTarget: function dropTarget(node, options) {\n _this.clearDropTarget();\n\n _this.dropTargetOptions = options;\n\n if (isRef(node)) {\n _this.dropTargetRef = node;\n } else {\n _this.dropTargetNode = node;\n }\n\n _this.reconnect();\n }\n });\n this.handlerId = null; // The drop target may either be attached via ref or connect function\n\n this.dropTargetRef = null;\n this.dropTargetOptionsInternal = null;\n this.lastConnectedHandlerId = null;\n this.lastConnectedDropTarget = null;\n this.lastConnectedDropTargetOptions = null;\n this.backend = backend;\n }\n\n _createClass(TargetConnector, [{\n key: \"reconnect\",\n value: function reconnect() {\n // if nothing has changed then don't resubscribe\n var didChange = this.didHandlerIdChange() || this.didDropTargetChange() || this.didOptionsChange();\n\n if (didChange) {\n this.disconnectDropTarget();\n }\n\n var dropTarget = this.dropTarget;\n\n if (!this.handlerId) {\n return;\n }\n\n if (!dropTarget) {\n this.lastConnectedDropTarget = dropTarget;\n return;\n }\n\n if (didChange) {\n this.lastConnectedHandlerId = this.handlerId;\n this.lastConnectedDropTarget = dropTarget;\n this.lastConnectedDropTargetOptions = this.dropTargetOptions;\n this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);\n }\n }\n }, {\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(newHandlerId) {\n if (newHandlerId === this.handlerId) {\n return;\n }\n\n this.handlerId = newHandlerId;\n this.reconnect();\n }\n }, {\n key: \"didHandlerIdChange\",\n value: function didHandlerIdChange() {\n return this.lastConnectedHandlerId !== this.handlerId;\n }\n }, {\n key: \"didDropTargetChange\",\n value: function didDropTargetChange() {\n return this.lastConnectedDropTarget !== this.dropTarget;\n }\n }, {\n key: \"didOptionsChange\",\n value: function didOptionsChange() {\n return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);\n }\n }, {\n key: \"disconnectDropTarget\",\n value: function disconnectDropTarget() {\n if (this.unsubscribeDropTarget) {\n this.unsubscribeDropTarget();\n this.unsubscribeDropTarget = undefined;\n }\n }\n }, {\n key: \"clearDropTarget\",\n value: function clearDropTarget() {\n this.dropTargetRef = null;\n this.dropTargetNode = null;\n }\n }, {\n key: \"connectTarget\",\n get: function get() {\n return this.dropTarget;\n }\n }, {\n key: \"dropTargetOptions\",\n get: function get() {\n return this.dropTargetOptionsInternal;\n },\n set: function set(options) {\n this.dropTargetOptionsInternal = options;\n }\n }, {\n key: \"dropTarget\",\n get: function get() {\n return this.dropTargetNode || this.dropTargetRef && this.dropTargetRef.current;\n }\n }]);\n\n return TargetConnector;\n}();","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nvar isCallingCanDrop = false;\nexport var DropTargetMonitorImpl =\n/*#__PURE__*/\nfunction () {\n function DropTargetMonitorImpl(manager) {\n _classCallCheck(this, DropTargetMonitorImpl);\n\n this.targetId = null;\n this.internalMonitor = manager.getMonitor();\n }\n\n _createClass(DropTargetMonitorImpl, [{\n key: \"receiveHandlerId\",\n value: function receiveHandlerId(targetId) {\n this.targetId = targetId;\n }\n }, {\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.targetId;\n }\n }, {\n key: \"subscribeToStateChange\",\n value: function subscribeToStateChange(listener, options) {\n return this.internalMonitor.subscribeToStateChange(listener, options);\n }\n }, {\n key: \"canDrop\",\n value: function canDrop() {\n // Cut out early if the target id has not been set. This should prevent errors\n // where the user has an older version of dnd-core like in\n // https://github.com/react-dnd/react-dnd/issues/1310\n if (!this.targetId) {\n return false;\n }\n\n invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');\n\n try {\n isCallingCanDrop = true;\n return this.internalMonitor.canDropOnTarget(this.targetId);\n } finally {\n isCallingCanDrop = false;\n }\n }\n }, {\n key: \"isOver\",\n value: function isOver(options) {\n if (!this.targetId) {\n return false;\n }\n\n return this.internalMonitor.isOverTarget(this.targetId, options);\n }\n }, {\n key: \"getItemType\",\n value: function getItemType() {\n return this.internalMonitor.getItemType();\n }\n }, {\n key: \"getItem\",\n value: function getItem() {\n return this.internalMonitor.getItem();\n }\n }, {\n key: \"getDropResult\",\n value: function getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n }, {\n key: \"didDrop\",\n value: function didDrop() {\n return this.internalMonitor.didDrop();\n }\n }, {\n key: \"getInitialClientOffset\",\n value: function getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n }, {\n key: \"getInitialSourceClientOffset\",\n value: function getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n }, {\n key: \"getSourceClientOffset\",\n value: function getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n }, {\n key: \"getClientOffset\",\n value: function getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n }, {\n key: \"getDifferenceFromInitialOffset\",\n value: function getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n }]);\n\n return DropTargetMonitorImpl;\n}();","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useMemo } from 'react';\nimport { registerTarget } from '../../common/registration';\nimport { useDragDropManager } from './useDragDropManager';\nimport { TargetConnector } from '../../common/TargetConnector';\nimport { DropTargetMonitorImpl } from '../../common/DropTargetMonitorImpl';\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';\nexport function useDropTargetMonitor() {\n var manager = useDragDropManager();\n var monitor = useMemo(function () {\n return new DropTargetMonitorImpl(manager);\n }, [manager]);\n var connector = useMemo(function () {\n return new TargetConnector(manager.getBackend());\n }, [manager]);\n return [monitor, connector];\n}\nexport function useDropHandler(spec, monitor, connector) {\n var manager = useDragDropManager();\n var handler = useMemo(function () {\n return {\n canDrop: function canDrop() {\n var canDrop = spec.current.canDrop;\n return canDrop ? canDrop(monitor.getItem(), monitor) : true;\n },\n hover: function hover() {\n var hover = spec.current.hover;\n\n if (hover) {\n hover(monitor.getItem(), monitor);\n }\n },\n drop: function drop() {\n var drop = spec.current.drop;\n\n if (drop) {\n return drop(monitor.getItem(), monitor);\n }\n }\n };\n }, [monitor]);\n useIsomorphicLayoutEffect(function registerHandler() {\n var _registerTarget = registerTarget(spec.current.accept, handler, manager),\n _registerTarget2 = _slicedToArray(_registerTarget, 2),\n handlerId = _registerTarget2[0],\n unregister = _registerTarget2[1];\n\n monitor.receiveHandlerId(handlerId);\n connector.receiveHandlerId(handlerId);\n return unregister;\n }, [monitor, connector]);\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useRef, useMemo } from 'react';\nimport { invariant } from '@react-dnd/invariant';\nimport { useMonitorOutput } from './internal/useMonitorOutput';\nimport { useIsomorphicLayoutEffect } from './internal/useIsomorphicLayoutEffect';\nimport { useDropHandler, useDropTargetMonitor } from './internal/drop';\n/**\n * useDropTarget Hook\n * @param spec The drop target specification\n */\n\nexport function useDrop(spec) {\n var specRef = useRef(spec);\n specRef.current = spec;\n invariant(spec.accept != null, 'accept must be defined');\n\n var _useDropTargetMonitor = useDropTargetMonitor(),\n _useDropTargetMonitor2 = _slicedToArray(_useDropTargetMonitor, 2),\n monitor = _useDropTargetMonitor2[0],\n connector = _useDropTargetMonitor2[1];\n\n useDropHandler(specRef, monitor, connector);\n var result = useMonitorOutput(monitor, specRef.current.collect || function () {\n return {};\n }, function () {\n return connector.reconnect();\n });\n var connectDropTarget = useMemo(function () {\n return connector.hooks.dropTarget();\n }, [connector]);\n useIsomorphicLayoutEffect(function () {\n connector.dropTargetOptions = spec.options || null;\n connector.reconnect();\n }, [spec.options]);\n return [result, connectDropTarget];\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport { useEffect } from 'react';\nimport { useDragDropManager } from './internal/useDragDropManager';\nimport { useCollector } from './internal/useCollector';\n/**\n * useDragLayer Hook\n * @param collector The property collector\n */\n\nexport function useDragLayer(collect) {\n var dragDropManager = useDragDropManager();\n var monitor = dragDropManager.getMonitor();\n\n var _useCollector = useCollector(monitor, collect),\n _useCollector2 = _slicedToArray(_useCollector, 2),\n collected = _useCollector2[0],\n updateCollected = _useCollector2[1];\n\n useEffect(function () {\n return monitor.subscribeToOffsetChange(updateCollected);\n });\n useEffect(function () {\n return monitor.subscribeToStateChange(updateCollected);\n });\n return collected;\n}","export * from './useDrag';\nexport * from './useDrop';\nexport * from './useDragLayer';","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n// cheap lodash replacements\nexport function isFunction(input) {\n return typeof input === 'function';\n}\nexport function noop() {// noop\n}\n\nfunction isObjectLike(input) {\n return _typeof(input) === 'object' && input !== null;\n}\n\nexport function isPlainObject(input) {\n if (!isObjectLike(input)) {\n return false;\n }\n\n if (Object.getPrototypeOf(input) === null) {\n return true;\n }\n\n var proto = input;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(input) === proto;\n}","export function getDecoratedComponent(instanceRef) {\n var currentRef = instanceRef.current;\n\n if (currentRef == null) {\n return null;\n } else if (currentRef.decoratedRef) {\n // go through the private field in decorateHandler to avoid the invariant hit\n return currentRef.decoratedRef.current;\n } else {\n return currentRef;\n }\n}\nexport function isClassComponent(Component) {\n return Component && Component.prototype && typeof Component.prototype.render === 'function';\n}\nexport function isRefForwardingComponent(C) {\n return C && C.$$typeof && C.$$typeof.toString() === 'Symbol(react.forward_ref)';\n}\nexport function isRefable(C) {\n return isClassComponent(C) || isRefForwardingComponent(C);\n}\nexport function checkDecoratorArguments(functionName, signature) {\n if (process.env.NODE_ENV !== 'production') {\n for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i++) {\n var arg = i + 2 < 2 || arguments.length <= i + 2 ? undefined : arguments[i + 2];\n\n if (arg && arg.prototype && arg.prototype.render) {\n // eslint-disable-next-line no-console\n console.error('You seem to be applying the arguments in the wrong order. ' + \"It should be \".concat(functionName, \"(\").concat(signature, \")(Component), not the other way around. \") + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');\n return;\n }\n }\n }\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { isFunction, noop } from '../utils/js_utils';\n/**\n * Provides a set of static methods for creating Disposables.\n * @param {Function} action Action to run during the first call to dispose.\n * The action is guaranteed to be run at most once.\n */\n\nexport var Disposable =\n/*#__PURE__*/\nfunction () {\n function Disposable(action) {\n _classCallCheck(this, Disposable);\n\n this.isDisposed = false;\n this.action = isFunction(action) ? action : noop;\n }\n /**\n * Validates whether the given object is a disposable\n * @param {Object} Object to test whether it has a dispose method\n * @returns {Boolean} true if a disposable object, else false.\n */\n\n\n _createClass(Disposable, [{\n key: \"dispose\",\n\n /** Performs the task of cleaning up resources. */\n value: function dispose() {\n if (!this.isDisposed) {\n this.action();\n this.isDisposed = true;\n }\n }\n }], [{\n key: \"isDisposable\",\n value: function isDisposable(d) {\n return d && isFunction(d.dispose);\n }\n }, {\n key: \"_fixup\",\n value: function _fixup(result) {\n return Disposable.isDisposable(result) ? result : Disposable.empty;\n }\n /**\n * Creates a disposable object that invokes the specified action when disposed.\n * @param {Function} dispose Action to run during the first call to dispose.\n * The action is guaranteed to be run at most once.\n * @return {Disposable} The disposable object that runs the given action upon disposal.\n */\n\n }, {\n key: \"create\",\n value: function create(action) {\n return new Disposable(action);\n }\n }]);\n\n return Disposable;\n}();\n/**\n * Gets the disposable that does nothing when disposed.\n */\n\nDisposable.empty = {\n dispose: noop\n};\n/**\n * Represents a group of disposable resources that are disposed together.\n * @constructor\n */\n\nexport var CompositeDisposable =\n/*#__PURE__*/\nfunction () {\n function CompositeDisposable() {\n _classCallCheck(this, CompositeDisposable);\n\n this.isDisposed = false;\n\n for (var _len = arguments.length, disposables = new Array(_len), _key = 0; _key < _len; _key++) {\n disposables[_key] = arguments[_key];\n }\n\n this.disposables = disposables;\n }\n /**\n * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.\n * @param {Any} item Disposable to add.\n */\n\n\n _createClass(CompositeDisposable, [{\n key: \"add\",\n value: function add(item) {\n if (this.isDisposed) {\n item.dispose();\n } else {\n this.disposables.push(item);\n }\n }\n /**\n * Removes and disposes the first occurrence of a disposable from the CompositeDisposable.\n * @param {Any} item Disposable to remove.\n * @returns {Boolean} true if found; false otherwise.\n */\n\n }, {\n key: \"remove\",\n value: function remove(item) {\n var shouldDispose = false;\n\n if (!this.isDisposed) {\n var idx = this.disposables.indexOf(item);\n\n if (idx !== -1) {\n shouldDispose = true;\n this.disposables.splice(idx, 1);\n item.dispose();\n }\n }\n\n return shouldDispose;\n }\n /**\n * Disposes all disposables in the group and removes them from the group but\n * does not dispose the CompositeDisposable.\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n if (!this.isDisposed) {\n var len = this.disposables.length;\n var currentDisposables = new Array(len);\n\n for (var i = 0; i < len; i++) {\n currentDisposables[i] = this.disposables[i];\n }\n\n this.disposables = [];\n\n for (var _i = 0; _i < len; _i++) {\n currentDisposables[_i].dispose();\n }\n }\n }\n /**\n * Disposes all disposables in the group and removes them from the group.\n */\n\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n var len = this.disposables.length;\n var currentDisposables = new Array(len);\n\n for (var i = 0; i < len; i++) {\n currentDisposables[i] = this.disposables[i];\n }\n\n this.disposables = [];\n\n for (var _i2 = 0; _i2 < len; _i2++) {\n currentDisposables[_i2].dispose();\n }\n }\n }\n }]);\n\n return CompositeDisposable;\n}();\n/**\n * Represents a disposable resource whose underlying disposable resource can\n * be replaced by another disposable resource, causing automatic disposal of\n * the previous underlying disposable resource.\n */\n\nexport var SerialDisposable =\n/*#__PURE__*/\nfunction () {\n function SerialDisposable() {\n _classCallCheck(this, SerialDisposable);\n\n this.isDisposed = false;\n }\n /**\n * Gets the underlying disposable.\n * @returns {Any} the underlying disposable.\n */\n\n\n _createClass(SerialDisposable, [{\n key: \"getDisposable\",\n value: function getDisposable() {\n return this.current;\n }\n }, {\n key: \"setDisposable\",\n value: function setDisposable(value) {\n var shouldDispose = this.isDisposed;\n\n if (!shouldDispose) {\n var old = this.current;\n this.current = value;\n\n if (old) {\n old.dispose();\n }\n }\n\n if (shouldDispose && value) {\n value.dispose();\n }\n }\n /** Performs the task of cleaning up resources. */\n\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (!this.isDisposed) {\n this.isDisposed = true;\n var old = this.current;\n this.current = undefined;\n\n if (old) {\n old.dispose();\n }\n }\n }\n }]);\n\n return SerialDisposable;\n}();","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport * as React from 'react';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport { invariant } from '@react-dnd/invariant';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { DndContext } from '../index';\nimport { isPlainObject } from '../utils/js_utils';\nimport { Disposable, CompositeDisposable, SerialDisposable } from './disposables';\nimport { isRefable } from './utils';\nexport default function decorateHandler(_ref) {\n var DecoratedComponent = _ref.DecoratedComponent,\n createHandler = _ref.createHandler,\n createMonitor = _ref.createMonitor,\n createConnector = _ref.createConnector,\n registerHandler = _ref.registerHandler,\n containerDisplayName = _ref.containerDisplayName,\n getType = _ref.getType,\n collect = _ref.collect,\n options = _ref.options;\n var _options$arePropsEqua = options.arePropsEqual,\n arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;\n var Decorated = DecoratedComponent;\n var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';\n\n var DragDropContainer =\n /*#__PURE__*/\n function (_React$Component) {\n _inherits(DragDropContainer, _React$Component);\n\n function DragDropContainer(props) {\n var _this;\n\n _classCallCheck(this, DragDropContainer);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(DragDropContainer).call(this, props));\n _this.decoratedRef = React.createRef();\n\n _this.handleChange = function () {\n var nextState = _this.getCurrentState();\n\n if (!shallowEqual(nextState, _this.state)) {\n _this.setState(nextState);\n }\n };\n\n _this.disposable = new SerialDisposable();\n\n _this.receiveProps(props);\n\n _this.dispose();\n\n return _this;\n }\n\n _createClass(DragDropContainer, [{\n key: \"getHandlerId\",\n value: function getHandlerId() {\n return this.handlerId;\n }\n }, {\n key: \"getDecoratedComponentInstance\",\n value: function getDecoratedComponentInstance() {\n invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');\n return this.decoratedRef.current;\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.disposable = new SerialDisposable();\n this.currentType = undefined;\n this.receiveProps(this.props);\n this.handleChange();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!arePropsEqual(this.props, prevProps)) {\n this.receiveProps(this.props);\n this.handleChange();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.dispose();\n }\n }, {\n key: \"receiveProps\",\n value: function receiveProps(props) {\n if (!this.handler) {\n return;\n }\n\n this.handler.receiveProps(props);\n this.receiveType(getType(props));\n }\n }, {\n key: \"receiveType\",\n value: function receiveType(type) {\n if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {\n return;\n }\n\n if (type === this.currentType) {\n return;\n }\n\n this.currentType = type;\n\n var _registerHandler = registerHandler(type, this.handler, this.manager),\n _registerHandler2 = _slicedToArray(_registerHandler, 2),\n handlerId = _registerHandler2[0],\n unregister = _registerHandler2[1];\n\n this.handlerId = handlerId;\n this.handlerMonitor.receiveHandlerId(handlerId);\n this.handlerConnector.receiveHandlerId(handlerId);\n var globalMonitor = this.manager.getMonitor();\n var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {\n handlerIds: [handlerId]\n });\n this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.disposable.dispose();\n\n if (this.handlerConnector) {\n this.handlerConnector.receiveHandlerId(null);\n }\n }\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n if (!this.handlerConnector) {\n return {};\n }\n\n var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);\n }\n\n return nextState;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return React.createElement(DndContext.Consumer, null, function (_ref2) {\n var dragDropManager = _ref2.dragDropManager;\n\n _this2.receiveDragDropManager(dragDropManager);\n\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(function () {\n return _this2.handlerConnector.reconnect();\n });\n }\n\n return React.createElement(Decorated, Object.assign({}, _this2.props, _this2.getCurrentState(), {\n // NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.\n ref: isRefable(Decorated) ? _this2.decoratedRef : null\n }));\n });\n }\n }, {\n key: \"receiveDragDropManager\",\n value: function receiveDragDropManager(dragDropManager) {\n if (this.manager !== undefined) {\n return;\n }\n\n invariant(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);\n\n if (dragDropManager === undefined) {\n return;\n }\n\n this.manager = dragDropManager;\n this.handlerMonitor = createMonitor(dragDropManager);\n this.handlerConnector = createConnector(dragDropManager.getBackend());\n this.handler = createHandler(this.handlerMonitor, this.decoratedRef);\n }\n }]);\n\n return DragDropContainer;\n }(React.Component);\n\n DragDropContainer.DecoratedComponent = DecoratedComponent;\n DragDropContainer.displayName = \"\".concat(containerDisplayName, \"(\").concat(displayName, \")\");\n return hoistStatics(DragDropContainer, DecoratedComponent);\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nexport function isValidType(type, allowArray) {\n return typeof type === 'string' || _typeof(type) === 'symbol' || !!allowArray && Array.isArray(type) && type.every(function (t) {\n return isValidType(t, false);\n });\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { getDecoratedComponent } from './utils';\nvar ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];\nvar REQUIRED_SPEC_METHODS = ['beginDrag'];\n\nvar SourceImpl =\n/*#__PURE__*/\nfunction () {\n function SourceImpl(spec, monitor, ref) {\n var _this = this;\n\n _classCallCheck(this, SourceImpl);\n\n this.props = null;\n\n this.beginDrag = function () {\n if (!_this.props) {\n return;\n }\n\n var item = _this.spec.beginDrag(_this.props, _this.monitor, _this.ref.current);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(isPlainObject(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', item);\n }\n\n return item;\n };\n\n this.spec = spec;\n this.monitor = monitor;\n this.ref = ref;\n }\n\n _createClass(SourceImpl, [{\n key: \"receiveProps\",\n value: function receiveProps(props) {\n this.props = props;\n }\n }, {\n key: \"canDrag\",\n value: function canDrag() {\n if (!this.props) {\n return false;\n }\n\n if (!this.spec.canDrag) {\n return true;\n }\n\n return this.spec.canDrag(this.props, this.monitor);\n }\n }, {\n key: \"isDragging\",\n value: function isDragging(globalMonitor, sourceId) {\n if (!this.props) {\n return false;\n }\n\n if (!this.spec.isDragging) {\n return sourceId === globalMonitor.getSourceId();\n }\n\n return this.spec.isDragging(this.props, this.monitor);\n }\n }, {\n key: \"endDrag\",\n value: function endDrag() {\n if (!this.props) {\n return;\n }\n\n if (!this.spec.endDrag) {\n return;\n }\n\n this.spec.endDrag(this.props, this.monitor, getDecoratedComponent(this.ref));\n }\n }]);\n\n return SourceImpl;\n}();\n\nexport default function createSourceFactory(spec) {\n Object.keys(spec).forEach(function (key) {\n invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected \"%s\" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', ALLOWED_SPEC_METHODS.join(', '), key);\n invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);\n });\n REQUIRED_SPEC_METHODS.forEach(function (key) {\n invariant(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', key, key, spec[key]);\n });\n return function createSource(monitor, ref) {\n return new SourceImpl(spec, monitor, ref);\n };\n}","import { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { checkDecoratorArguments } from './utils';\nimport decorateHandler from './decorateHandler';\nimport { registerSource } from '../common/registration';\nimport { DragSourceMonitorImpl } from '../common/DragSourceMonitorImpl';\nimport { SourceConnector } from '../common/SourceConnector';\nimport { isValidType } from '../utils/isValidType';\nimport createSourceFactory from './createSourceFactory';\n/**\n * Decorates a component as a dragsource\n * @param type The dragsource type\n * @param spec The drag source specification\n * @param collect The props collector function\n * @param options DnD options\n */\n\nexport function DragSource(type, spec, collect) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n checkDecoratorArguments('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);\n var getType = type;\n\n if (typeof type !== 'function') {\n invariant(isValidType(type), 'Expected \"type\" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', type);\n\n getType = function getType() {\n return type;\n };\n }\n\n invariant(isPlainObject(spec), 'Expected \"spec\" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', spec);\n var createSource = createSourceFactory(spec);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source', collect);\n return function decorateSource(DecoratedComponent) {\n return decorateHandler({\n containerDisplayName: 'DragSource',\n createHandler: createSource,\n registerHandler: registerSource,\n createConnector: function createConnector(backend) {\n return new SourceConnector(backend);\n },\n createMonitor: function createMonitor(manager) {\n return new DragSourceMonitorImpl(manager);\n },\n DecoratedComponent: DecoratedComponent,\n getType: getType,\n collect: collect,\n options: options\n });\n };\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { getDecoratedComponent } from './utils';\nvar ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];\n\nvar TargetImpl =\n/*#__PURE__*/\nfunction () {\n function TargetImpl(spec, monitor, ref) {\n _classCallCheck(this, TargetImpl);\n\n this.props = null;\n this.spec = spec;\n this.monitor = monitor;\n this.ref = ref;\n }\n\n _createClass(TargetImpl, [{\n key: \"receiveProps\",\n value: function receiveProps(props) {\n this.props = props;\n }\n }, {\n key: \"receiveMonitor\",\n value: function receiveMonitor(monitor) {\n this.monitor = monitor;\n }\n }, {\n key: \"canDrop\",\n value: function canDrop() {\n if (!this.spec.canDrop) {\n return true;\n }\n\n return this.spec.canDrop(this.props, this.monitor);\n }\n }, {\n key: \"hover\",\n value: function hover() {\n if (!this.spec.hover) {\n return;\n }\n\n this.spec.hover(this.props, this.monitor, getDecoratedComponent(this.ref));\n }\n }, {\n key: \"drop\",\n value: function drop() {\n if (!this.spec.drop) {\n return undefined;\n }\n\n var dropResult = this.spec.drop(this.props, this.monitor, this.ref.current);\n\n if (process.env.NODE_ENV !== 'production') {\n invariant(typeof dropResult === 'undefined' || isPlainObject(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', dropResult);\n }\n\n return dropResult;\n }\n }]);\n\n return TargetImpl;\n}();\n\nexport default function createTargetFactory(spec) {\n Object.keys(spec).forEach(function (key) {\n invariant(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected \"%s\" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', ALLOWED_SPEC_METHODS.join(', '), key);\n invariant(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', key, key, spec[key]);\n });\n return function createTarget(monitor, ref) {\n return new TargetImpl(spec, monitor, ref);\n };\n}","import { invariant } from '@react-dnd/invariant';\nimport { isPlainObject } from '../utils/js_utils';\nimport { registerTarget } from '../common/registration';\nimport { isValidType } from '../utils/isValidType';\nimport { TargetConnector } from '../common/TargetConnector';\nimport { DropTargetMonitorImpl } from '../common/DropTargetMonitorImpl';\nimport { checkDecoratorArguments } from './utils';\nimport decorateHandler from './decorateHandler';\nimport createTargetFactory from './createTargetFactory';\nexport function DropTarget(type, spec, collect) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);\n var getType = type;\n\n if (typeof type !== 'function') {\n invariant(isValidType(type, true), 'Expected \"type\" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);\n\n getType = function getType() {\n return type;\n };\n }\n\n invariant(isPlainObject(spec), 'Expected \"spec\" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);\n var createTarget = createTargetFactory(spec);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);\n return function decorateTarget(DecoratedComponent) {\n return decorateHandler({\n containerDisplayName: 'DropTarget',\n createHandler: createTarget,\n registerHandler: registerTarget,\n createMonitor: function createMonitor(manager) {\n return new DropTargetMonitorImpl(manager);\n },\n createConnector: function createConnector(backend) {\n return new TargetConnector(backend);\n },\n DecoratedComponent: DecoratedComponent,\n getType: getType,\n collect: collect,\n options: options\n });\n };\n}","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nimport * as React from 'react';\nimport { shallowEqual } from '@react-dnd/shallowequal';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { invariant } from '@react-dnd/invariant';\nimport { DndContext } from '../index';\nimport { isPlainObject } from '../utils/js_utils';\nimport { isRefable, checkDecoratorArguments } from './utils';\nexport function DragLayer(collect) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n checkDecoratorArguments('DragLayer', 'collect[, options]', collect, options);\n invariant(typeof collect === 'function', 'Expected \"collect\" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', collect);\n invariant(isPlainObject(options), 'Expected \"options\" provided as the second argument to DragLayer to be a plain object when specified. ' + 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', options);\n return function decorateLayer(DecoratedComponent) {\n var Decorated = DecoratedComponent;\n var _options$arePropsEqua = options.arePropsEqual,\n arePropsEqual = _options$arePropsEqua === void 0 ? shallowEqual : _options$arePropsEqua;\n var displayName = Decorated.displayName || Decorated.name || 'Component';\n\n var DragLayerContainer =\n /*#__PURE__*/\n function (_React$Component) {\n _inherits(DragLayerContainer, _React$Component);\n\n function DragLayerContainer() {\n var _this;\n\n _classCallCheck(this, DragLayerContainer);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(DragLayerContainer).apply(this, arguments));\n _this.isCurrentlyMounted = false;\n _this.ref = React.createRef();\n\n _this.handleChange = function () {\n if (!_this.isCurrentlyMounted) {\n return;\n }\n\n var nextState = _this.getCurrentState();\n\n if (!shallowEqual(nextState, _this.state)) {\n _this.setState(nextState);\n }\n };\n\n return _this;\n }\n\n _createClass(DragLayerContainer, [{\n key: \"getDecoratedComponentInstance\",\n value: function getDecoratedComponentInstance() {\n invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');\n return this.ref.current;\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n return !arePropsEqual(nextProps, this.props) || !shallowEqual(nextState, this.state);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.isCurrentlyMounted = true;\n this.handleChange();\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.isCurrentlyMounted = false;\n\n if (this.unsubscribeFromOffsetChange) {\n this.unsubscribeFromOffsetChange();\n this.unsubscribeFromOffsetChange = undefined;\n }\n\n if (this.unsubscribeFromStateChange) {\n this.unsubscribeFromStateChange();\n this.unsubscribeFromStateChange = undefined;\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n return React.createElement(DndContext.Consumer, null, function (_ref) {\n var dragDropManager = _ref.dragDropManager;\n\n if (dragDropManager === undefined) {\n return null;\n }\n\n _this2.receiveDragDropManager(dragDropManager); // Let componentDidMount fire to initialize the collected state\n\n\n if (!_this2.isCurrentlyMounted) {\n return null;\n }\n\n return React.createElement(Decorated, Object.assign({}, _this2.props, _this2.state, {\n ref: isRefable(Decorated) ? _this2.ref : null\n }));\n });\n }\n }, {\n key: \"receiveDragDropManager\",\n value: function receiveDragDropManager(dragDropManager) {\n if (this.manager !== undefined) {\n return;\n }\n\n this.manager = dragDropManager;\n invariant(_typeof(dragDropManager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to render a DndProvider component in your top-level component. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);\n var monitor = this.manager.getMonitor();\n this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);\n this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);\n }\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n if (!this.manager) {\n return {};\n }\n\n var monitor = this.manager.getMonitor();\n return collect(monitor, this.props);\n }\n }]);\n\n return DragLayerContainer;\n }(React.Component);\n\n DragLayerContainer.displayName = \"DragLayer(\".concat(displayName, \")\");\n DragLayerContainer.DecoratedComponent = DecoratedComponent;\n return hoistStatics(DragLayerContainer, DecoratedComponent);\n };\n}","export * from './DragSource';\nexport * from './DropTarget';\nexport * from './DragLayer';","export * from './common';\nexport * from './hooks';\nexport * from './decorators';","// cheap lodash replacements\nexport function memoize(fn) {\n var result = null;\n\n var memoized = function memoized() {\n if (result == null) {\n result = fn();\n }\n\n return result;\n };\n\n return memoized;\n}\n/**\n * drop-in replacement for _.without\n */\n\nexport function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n}\nexport function union(itemsA, itemsB) {\n var set = new Set();\n\n var insertItem = function insertItem(item) {\n return set.add(item);\n };\n\n itemsA.forEach(insertItem);\n itemsB.forEach(insertItem);\n var result = [];\n set.forEach(function (key) {\n return result.push(key);\n });\n return result;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { union, without } from './utils/js_utils';\n\nvar EnterLeaveCounter =\n/*#__PURE__*/\nfunction () {\n function EnterLeaveCounter(isNodeInDocument) {\n _classCallCheck(this, EnterLeaveCounter);\n\n this.entered = [];\n this.isNodeInDocument = isNodeInDocument;\n }\n\n _createClass(EnterLeaveCounter, [{\n key: \"enter\",\n value: function enter(enteringNode) {\n var _this = this;\n\n var previousLength = this.entered.length;\n\n var isNodeEntered = function isNodeEntered(node) {\n return _this.isNodeInDocument(node) && (!node.contains || node.contains(enteringNode));\n };\n\n this.entered = union(this.entered.filter(isNodeEntered), [enteringNode]);\n return previousLength === 0 && this.entered.length > 0;\n }\n }, {\n key: \"leave\",\n value: function leave(leavingNode) {\n var previousLength = this.entered.length;\n this.entered = without(this.entered.filter(this.isNodeInDocument), leavingNode);\n return previousLength > 0 && this.entered.length === 0;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.entered = [];\n }\n }]);\n\n return EnterLeaveCounter;\n}();\n\nexport { EnterLeaveCounter as default };","import { memoize } from './utils/js_utils';\nexport var isFirefox = memoize(function () {\n return /firefox/i.test(navigator.userAgent);\n});\nexport var isSafari = memoize(function () {\n return Boolean(window.safari);\n});","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar MonotonicInterpolant =\n/*#__PURE__*/\nfunction () {\n function MonotonicInterpolant(xs, ys) {\n _classCallCheck(this, MonotonicInterpolant);\n\n var length = xs.length; // Rearrange xs and ys so that xs is sorted\n\n var indexes = [];\n\n for (var i = 0; i < length; i++) {\n indexes.push(i);\n }\n\n indexes.sort(function (a, b) {\n return xs[a] < xs[b] ? -1 : 1;\n }); // Get consecutive differences and slopes\n\n var dys = [];\n var dxs = [];\n var ms = [];\n var dx;\n var dy;\n\n for (var _i = 0; _i < length - 1; _i++) {\n dx = xs[_i + 1] - xs[_i];\n dy = ys[_i + 1] - ys[_i];\n dxs.push(dx);\n dys.push(dy);\n ms.push(dy / dx);\n } // Get degree-1 coefficients\n\n\n var c1s = [ms[0]];\n\n for (var _i2 = 0; _i2 < dxs.length - 1; _i2++) {\n var m2 = ms[_i2];\n var mNext = ms[_i2 + 1];\n\n if (m2 * mNext <= 0) {\n c1s.push(0);\n } else {\n dx = dxs[_i2];\n var dxNext = dxs[_i2 + 1];\n var common = dx + dxNext;\n c1s.push(3 * common / ((common + dxNext) / m2 + (common + dx) / mNext));\n }\n }\n\n c1s.push(ms[ms.length - 1]); // Get degree-2 and degree-3 coefficients\n\n var c2s = [];\n var c3s = [];\n var m;\n\n for (var _i3 = 0; _i3 < c1s.length - 1; _i3++) {\n m = ms[_i3];\n var c1 = c1s[_i3];\n var invDx = 1 / dxs[_i3];\n\n var _common = c1 + c1s[_i3 + 1] - m - m;\n\n c2s.push((m - c1 - _common) * invDx);\n c3s.push(_common * invDx * invDx);\n }\n\n this.xs = xs;\n this.ys = ys;\n this.c1s = c1s;\n this.c2s = c2s;\n this.c3s = c3s;\n }\n\n _createClass(MonotonicInterpolant, [{\n key: \"interpolate\",\n value: function interpolate(x) {\n var xs = this.xs,\n ys = this.ys,\n c1s = this.c1s,\n c2s = this.c2s,\n c3s = this.c3s; // The rightmost point in the dataset should give an exact result\n\n var i = xs.length - 1;\n\n if (x === xs[i]) {\n return ys[i];\n } // Search for the interval x is in, returning the corresponding y if x is one of the original xs\n\n\n var low = 0;\n var high = c3s.length - 1;\n var mid;\n\n while (low <= high) {\n mid = Math.floor(0.5 * (low + high));\n var xHere = xs[mid];\n\n if (xHere < x) {\n low = mid + 1;\n } else if (xHere > x) {\n high = mid - 1;\n } else {\n return ys[mid];\n }\n }\n\n i = Math.max(0, high); // Interpolate\n\n var diff = x - xs[i];\n var diffSq = diff * diff;\n return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;\n }\n }]);\n\n return MonotonicInterpolant;\n}();\n\nexport { MonotonicInterpolant as default };","import { isSafari, isFirefox } from './BrowserDetector';\nimport MonotonicInterpolant from './MonotonicInterpolant';\nvar ELEMENT_NODE = 1;\nexport function getNodeClientOffset(node) {\n var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;\n\n if (!el) {\n return null;\n }\n\n var _el$getBoundingClient = el.getBoundingClientRect(),\n top = _el$getBoundingClient.top,\n left = _el$getBoundingClient.left;\n\n return {\n x: left,\n y: top\n };\n}\nexport function getEventClientOffset(e) {\n return {\n x: e.clientX,\n y: e.clientY\n };\n}\n\nfunction isImageNode(node) {\n return node.nodeName === 'IMG' && (isFirefox() || !document.documentElement.contains(node));\n}\n\nfunction getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight) {\n var dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;\n var dragPreviewHeight = isImage ? dragPreview.height : sourceHeight; // Work around @2x coordinate discrepancies in browsers\n\n if (isSafari() && isImage) {\n dragPreviewHeight /= window.devicePixelRatio;\n dragPreviewWidth /= window.devicePixelRatio;\n }\n\n return {\n dragPreviewWidth: dragPreviewWidth,\n dragPreviewHeight: dragPreviewHeight\n };\n}\n\nexport function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint) {\n // The browsers will use the image intrinsic size under different conditions.\n // Firefox only cares if it's an image, but WebKit also wants it to be detached.\n var isImage = isImageNode(dragPreview);\n var dragPreviewNode = isImage ? sourceNode : dragPreview;\n var dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);\n var offsetFromDragPreview = {\n x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,\n y: clientOffset.y - dragPreviewNodeOffsetFromClient.y\n };\n var sourceWidth = sourceNode.offsetWidth,\n sourceHeight = sourceNode.offsetHeight;\n var anchorX = anchorPoint.anchorX,\n anchorY = anchorPoint.anchorY;\n\n var _getDragPreviewSize = getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight),\n dragPreviewWidth = _getDragPreviewSize.dragPreviewWidth,\n dragPreviewHeight = _getDragPreviewSize.dragPreviewHeight;\n\n var calculateYOffset = function calculateYOffset() {\n var interpolantY = new MonotonicInterpolant([0, 0.5, 1], [// Dock to the top\n offsetFromDragPreview.y, // Align at the center\n offsetFromDragPreview.y / sourceHeight * dragPreviewHeight, // Dock to the bottom\n offsetFromDragPreview.y + dragPreviewHeight - sourceHeight]);\n var y = interpolantY.interpolate(anchorY); // Work around Safari 8 positioning bug\n\n if (isSafari() && isImage) {\n // We'll have to wait for @3x to see if this is entirely correct\n y += (window.devicePixelRatio - 1) * dragPreviewHeight;\n }\n\n return y;\n };\n\n var calculateXOffset = function calculateXOffset() {\n // Interpolate coordinates depending on anchor point\n // If you know a simpler way to do this, let me know\n var interpolantX = new MonotonicInterpolant([0, 0.5, 1], [// Dock to the left\n offsetFromDragPreview.x, // Align at the center\n offsetFromDragPreview.x / sourceWidth * dragPreviewWidth, // Dock to the right\n offsetFromDragPreview.x + dragPreviewWidth - sourceWidth]);\n return interpolantX.interpolate(anchorX);\n }; // Force offsets if specified in the options.\n\n\n var offsetX = offsetPoint.offsetX,\n offsetY = offsetPoint.offsetY;\n var isManualOffsetX = offsetX === 0 || offsetX;\n var isManualOffsetY = offsetY === 0 || offsetY;\n return {\n x: isManualOffsetX ? offsetX : calculateXOffset(),\n y: isManualOffsetY ? offsetY : calculateYOffset()\n };\n}","export var FILE = '__NATIVE_FILE__';\nexport var URL = '__NATIVE_URL__';\nexport var TEXT = '__NATIVE_TEXT__';","export function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {\n var result = typesToTry.reduce(function (resultSoFar, typeToTry) {\n return resultSoFar || dataTransfer.getData(typeToTry);\n }, '');\n return result != null ? result : defaultValue;\n}","var _nativeTypesConfig;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport * as NativeTypes from '../NativeTypes';\nimport { getDataFromDataTransfer } from './getDataFromDataTransfer';\nexport var nativeTypesConfig = (_nativeTypesConfig = {}, _defineProperty(_nativeTypesConfig, NativeTypes.FILE, {\n exposeProperties: {\n files: function files(dataTransfer) {\n return Array.prototype.slice.call(dataTransfer.files);\n },\n items: function items(dataTransfer) {\n return dataTransfer.items;\n }\n },\n matchesTypes: ['Files']\n}), _defineProperty(_nativeTypesConfig, NativeTypes.URL, {\n exposeProperties: {\n urls: function urls(dataTransfer, matchesTypes) {\n return getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\\n');\n }\n },\n matchesTypes: ['Url', 'text/uri-list']\n}), _defineProperty(_nativeTypesConfig, NativeTypes.TEXT, {\n exposeProperties: {\n text: function text(dataTransfer, matchesTypes) {\n return getDataFromDataTransfer(dataTransfer, matchesTypes, '');\n }\n },\n matchesTypes: ['Text', 'text/plain']\n}), _nativeTypesConfig);","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nexport var NativeDragSource =\n/*#__PURE__*/\nfunction () {\n function NativeDragSource(config) {\n _classCallCheck(this, NativeDragSource);\n\n this.config = config;\n this.item = {};\n this.initializeExposedProperties();\n }\n\n _createClass(NativeDragSource, [{\n key: \"initializeExposedProperties\",\n value: function initializeExposedProperties() {\n var _this = this;\n\n Object.keys(this.config.exposeProperties).forEach(function (property) {\n Object.defineProperty(_this.item, property, {\n configurable: true,\n enumerable: true,\n get: function get() {\n // eslint-disable-next-line no-console\n console.warn(\"Browser doesn't allow reading \\\"\".concat(property, \"\\\" until the drop event.\"));\n return null;\n }\n });\n });\n }\n }, {\n key: \"loadDataTransfer\",\n value: function loadDataTransfer(dataTransfer) {\n var _this2 = this;\n\n if (dataTransfer) {\n var newProperties = {};\n Object.keys(this.config.exposeProperties).forEach(function (property) {\n newProperties[property] = {\n value: _this2.config.exposeProperties[property](dataTransfer, _this2.config.matchesTypes),\n configurable: true,\n enumerable: true\n };\n });\n Object.defineProperties(this.item, newProperties);\n }\n }\n }, {\n key: \"canDrag\",\n value: function canDrag() {\n return true;\n }\n }, {\n key: \"beginDrag\",\n value: function beginDrag() {\n return this.item;\n }\n }, {\n key: \"isDragging\",\n value: function isDragging(monitor, handle) {\n return handle === monitor.getSourceId();\n }\n }, {\n key: \"endDrag\",\n value: function endDrag() {// empty\n }\n }]);\n\n return NativeDragSource;\n}();","import { nativeTypesConfig } from './nativeTypesConfig';\nimport { NativeDragSource } from './NativeDragSource';\nexport function createNativeDragSource(type, dataTransfer) {\n var result = new NativeDragSource(nativeTypesConfig[type]);\n result.loadDataTransfer(dataTransfer);\n return result;\n}\nexport function matchNativeItemType(dataTransfer) {\n if (!dataTransfer) {\n return null;\n }\n\n var dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);\n return Object.keys(nativeTypesConfig).filter(function (nativeItemType) {\n var matchesTypes = nativeTypesConfig[nativeItemType].matchesTypes;\n return matchesTypes.some(function (t) {\n return dataTransferTypes.indexOf(t) > -1;\n });\n })[0] || null;\n}","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nexport var OptionsReader =\n/*#__PURE__*/\nfunction () {\n function OptionsReader(globalContext) {\n _classCallCheck(this, OptionsReader);\n\n this.globalContext = globalContext;\n }\n\n _createClass(OptionsReader, [{\n key: \"window\",\n get: function get() {\n if (this.globalContext) {\n return this.globalContext;\n } else if (typeof window !== 'undefined') {\n return window;\n }\n\n return undefined;\n }\n }, {\n key: \"document\",\n get: function get() {\n if (this.window) {\n return this.window.document;\n }\n\n return undefined;\n }\n }]);\n\n return OptionsReader;\n}();","function 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\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport EnterLeaveCounter from './EnterLeaveCounter';\nimport { isFirefox } from './BrowserDetector';\nimport { getNodeClientOffset, getEventClientOffset, getDragPreviewOffset } from './OffsetUtils';\nimport { createNativeDragSource, matchNativeItemType } from './NativeDragSources';\nimport * as NativeTypes from './NativeTypes';\nimport { OptionsReader } from './OptionsReader';\n\nvar HTML5Backend =\n/*#__PURE__*/\nfunction () {\n function HTML5Backend(manager, globalContext) {\n var _this = this;\n\n _classCallCheck(this, HTML5Backend);\n\n this.sourcePreviewNodes = new Map();\n this.sourcePreviewNodeOptions = new Map();\n this.sourceNodes = new Map();\n this.sourceNodeOptions = new Map();\n this.dragStartSourceIds = null;\n this.dropTargetIds = [];\n this.dragEnterTargetIds = [];\n this.currentNativeSource = null;\n this.currentNativeHandle = null;\n this.currentDragSourceNode = null;\n this.altKeyPressed = false;\n this.mouseMoveTimeoutTimer = null;\n this.asyncEndDragFrameId = null;\n this.dragOverTargetIds = null;\n\n this.getSourceClientOffset = function (sourceId) {\n return getNodeClientOffset(_this.sourceNodes.get(sourceId));\n };\n\n this.endDragNativeItem = function () {\n if (!_this.isDraggingNativeItem()) {\n return;\n }\n\n _this.actions.endDrag();\n\n _this.registry.removeSource(_this.currentNativeHandle);\n\n _this.currentNativeHandle = null;\n _this.currentNativeSource = null;\n };\n\n this.isNodeInDocument = function (node) {\n // Check the node either in the main document or in the current context\n return _this.document && _this.document.body && document.body.contains(node);\n };\n\n this.endDragIfSourceWasRemovedFromDOM = function () {\n var node = _this.currentDragSourceNode;\n\n if (_this.isNodeInDocument(node)) {\n return;\n }\n\n if (_this.clearCurrentDragSourceNode()) {\n _this.actions.endDrag();\n }\n };\n\n this.handleTopDragStartCapture = function () {\n _this.clearCurrentDragSourceNode();\n\n _this.dragStartSourceIds = [];\n };\n\n this.handleTopDragStart = function (e) {\n if (e.defaultPrevented) {\n return;\n }\n\n var dragStartSourceIds = _this.dragStartSourceIds;\n _this.dragStartSourceIds = null;\n var clientOffset = getEventClientOffset(e); // Avoid crashing if we missed a drop event or our previous drag died\n\n if (_this.monitor.isDragging()) {\n _this.actions.endDrag();\n } // Don't publish the source just yet (see why below)\n\n\n _this.actions.beginDrag(dragStartSourceIds || [], {\n publishSource: false,\n getSourceClientOffset: _this.getSourceClientOffset,\n clientOffset: clientOffset\n });\n\n var dataTransfer = e.dataTransfer;\n var nativeType = matchNativeItemType(dataTransfer);\n\n if (_this.monitor.isDragging()) {\n if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {\n // Use custom drag image if user specifies it.\n // If child drag source refuses drag but parent agrees,\n // use parent's node as drag image. Neither works in IE though.\n var sourceId = _this.monitor.getSourceId();\n\n var sourceNode = _this.sourceNodes.get(sourceId);\n\n var dragPreview = _this.sourcePreviewNodes.get(sourceId) || sourceNode;\n\n if (dragPreview) {\n var _this$getCurrentSourc = _this.getCurrentSourcePreviewNodeOptions(),\n anchorX = _this$getCurrentSourc.anchorX,\n anchorY = _this$getCurrentSourc.anchorY,\n offsetX = _this$getCurrentSourc.offsetX,\n offsetY = _this$getCurrentSourc.offsetY;\n\n var anchorPoint = {\n anchorX: anchorX,\n anchorY: anchorY\n };\n var offsetPoint = {\n offsetX: offsetX,\n offsetY: offsetY\n };\n var dragPreviewOffset = getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint);\n dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);\n }\n }\n\n try {\n // Firefox won't drag without setting data\n dataTransfer.setData('application/json', {});\n } catch (err) {} // IE doesn't support MIME types in setData\n // Store drag source node so we can check whether\n // it is removed from DOM and trigger endDrag manually.\n\n\n _this.setCurrentDragSourceNode(e.target); // Now we are ready to publish the drag source.. or are we not?\n\n\n var _this$getCurrentSourc2 = _this.getCurrentSourcePreviewNodeOptions(),\n captureDraggingState = _this$getCurrentSourc2.captureDraggingState;\n\n if (!captureDraggingState) {\n // Usually we want to publish it in the next tick so that browser\n // is able to screenshot the current (not yet dragging) state.\n //\n // It also neatly avoids a situation where render() returns null\n // in the same tick for the source element, and browser freaks out.\n setTimeout(function () {\n return _this.actions.publishDragSource();\n }, 0);\n } else {\n // In some cases the user may want to override this behavior, e.g.\n // to work around IE not supporting custom drag previews.\n //\n // When using a custom drag layer, the only way to prevent\n // the default drag preview from drawing in IE is to screenshot\n // the dragging state in which the node itself has zero opacity\n // and height. In this case, though, returning null from render()\n // will abruptly end the dragging, which is not obvious.\n //\n // This is the reason such behavior is strictly opt-in.\n _this.actions.publishDragSource();\n }\n } else if (nativeType) {\n // A native item (such as URL) dragged from inside the document\n _this.beginDragNativeItem(nativeType);\n } else if (dataTransfer && !dataTransfer.types && (e.target && !e.target.hasAttribute || !e.target.hasAttribute('draggable'))) {\n // Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.\n // Just let it drag. It's a native type (URL or text) and will be picked up in\n // dragenter handler.\n return;\n } else {\n // If by this time no drag source reacted, tell browser not to drag.\n e.preventDefault();\n }\n };\n\n this.handleTopDragEndCapture = function () {\n if (_this.clearCurrentDragSourceNode()) {\n // Firefox can dispatch this event in an infinite loop\n // if dragend handler does something like showing an alert.\n // Only proceed if we have not handled it already.\n _this.actions.endDrag();\n }\n };\n\n this.handleTopDragEnterCapture = function (e) {\n _this.dragEnterTargetIds = [];\n\n var isFirstEnter = _this.enterLeaveCounter.enter(e.target);\n\n if (!isFirstEnter || _this.monitor.isDragging()) {\n return;\n }\n\n var dataTransfer = e.dataTransfer;\n var nativeType = matchNativeItemType(dataTransfer);\n\n if (nativeType) {\n // A native item (such as file or URL) dragged from outside the document\n _this.beginDragNativeItem(nativeType, dataTransfer);\n }\n };\n\n this.handleTopDragEnter = function (e) {\n var dragEnterTargetIds = _this.dragEnterTargetIds;\n _this.dragEnterTargetIds = [];\n\n if (!_this.monitor.isDragging()) {\n // This is probably a native item type we don't understand.\n return;\n }\n\n _this.altKeyPressed = e.altKey;\n\n if (!isFirefox()) {\n // Don't emit hover in `dragenter` on Firefox due to an edge case.\n // If the target changes position as the result of `dragenter`, Firefox\n // will still happily dispatch `dragover` despite target being no longer\n // there. The easy solution is to only fire `hover` in `dragover` on FF.\n _this.actions.hover(dragEnterTargetIds, {\n clientOffset: getEventClientOffset(e)\n });\n }\n\n var canDrop = dragEnterTargetIds.some(function (targetId) {\n return _this.monitor.canDropOnTarget(targetId);\n });\n\n if (canDrop) {\n // IE requires this to fire dragover events\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = _this.getCurrentDropEffect();\n }\n }\n };\n\n this.handleTopDragOverCapture = function () {\n _this.dragOverTargetIds = [];\n };\n\n this.handleTopDragOver = function (e) {\n var dragOverTargetIds = _this.dragOverTargetIds;\n _this.dragOverTargetIds = [];\n\n if (!_this.monitor.isDragging()) {\n // This is probably a native item type we don't understand.\n // Prevent default \"drop and blow away the whole document\" action.\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = 'none';\n }\n\n return;\n }\n\n _this.altKeyPressed = e.altKey;\n\n _this.actions.hover(dragOverTargetIds || [], {\n clientOffset: getEventClientOffset(e)\n });\n\n var canDrop = (dragOverTargetIds || []).some(function (targetId) {\n return _this.monitor.canDropOnTarget(targetId);\n });\n\n if (canDrop) {\n // Show user-specified drop effect.\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = _this.getCurrentDropEffect();\n }\n } else if (_this.isDraggingNativeItem()) {\n // Don't show a nice cursor but still prevent default\n // \"drop and blow away the whole document\" action.\n e.preventDefault();\n } else {\n e.preventDefault();\n\n if (e.dataTransfer) {\n e.dataTransfer.dropEffect = 'none';\n }\n }\n };\n\n this.handleTopDragLeaveCapture = function (e) {\n if (_this.isDraggingNativeItem()) {\n e.preventDefault();\n }\n\n var isLastLeave = _this.enterLeaveCounter.leave(e.target);\n\n if (!isLastLeave) {\n return;\n }\n\n if (_this.isDraggingNativeItem()) {\n _this.endDragNativeItem();\n }\n };\n\n this.handleTopDropCapture = function (e) {\n _this.dropTargetIds = [];\n e.preventDefault();\n\n if (_this.isDraggingNativeItem()) {\n _this.currentNativeSource.loadDataTransfer(e.dataTransfer);\n }\n\n _this.enterLeaveCounter.reset();\n };\n\n this.handleTopDrop = function (e) {\n var dropTargetIds = _this.dropTargetIds;\n _this.dropTargetIds = [];\n\n _this.actions.hover(dropTargetIds, {\n clientOffset: getEventClientOffset(e)\n });\n\n _this.actions.drop({\n dropEffect: _this.getCurrentDropEffect()\n });\n\n if (_this.isDraggingNativeItem()) {\n _this.endDragNativeItem();\n } else {\n _this.endDragIfSourceWasRemovedFromDOM();\n }\n };\n\n this.handleSelectStart = function (e) {\n var target = e.target; // Only IE requires us to explicitly say\n // we want drag drop operation to start\n\n if (typeof target.dragDrop !== 'function') {\n return;\n } // Inputs and textareas should be selectable\n\n\n if (target.tagName === 'INPUT' || target.tagName === 'SELECT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {\n return;\n } // For other targets, ask IE\n // to enable drag and drop\n\n\n e.preventDefault();\n target.dragDrop();\n };\n\n this.options = new OptionsReader(globalContext);\n this.actions = manager.getActions();\n this.monitor = manager.getMonitor();\n this.registry = manager.getRegistry();\n this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument);\n } // public for test\n\n\n _createClass(HTML5Backend, [{\n key: \"setup\",\n value: function setup() {\n if (this.window === undefined) {\n return;\n }\n\n if (this.window.__isReactDndBackendSetUp) {\n throw new Error('Cannot have two HTML5 backends at the same time.');\n }\n\n this.window.__isReactDndBackendSetUp = true;\n this.addEventListeners(this.window);\n }\n }, {\n key: \"teardown\",\n value: function teardown() {\n if (this.window === undefined) {\n return;\n }\n\n this.window.__isReactDndBackendSetUp = false;\n this.removeEventListeners(this.window);\n this.clearCurrentDragSourceNode();\n\n if (this.asyncEndDragFrameId) {\n this.window.cancelAnimationFrame(this.asyncEndDragFrameId);\n }\n }\n }, {\n key: \"connectDragPreview\",\n value: function connectDragPreview(sourceId, node, options) {\n var _this2 = this;\n\n this.sourcePreviewNodeOptions.set(sourceId, options);\n this.sourcePreviewNodes.set(sourceId, node);\n return function () {\n _this2.sourcePreviewNodes.delete(sourceId);\n\n _this2.sourcePreviewNodeOptions.delete(sourceId);\n };\n }\n }, {\n key: \"connectDragSource\",\n value: function connectDragSource(sourceId, node, options) {\n var _this3 = this;\n\n this.sourceNodes.set(sourceId, node);\n this.sourceNodeOptions.set(sourceId, options);\n\n var handleDragStart = function handleDragStart(e) {\n return _this3.handleDragStart(e, sourceId);\n };\n\n var handleSelectStart = function handleSelectStart(e) {\n return _this3.handleSelectStart(e);\n };\n\n node.setAttribute('draggable', 'true');\n node.addEventListener('dragstart', handleDragStart);\n node.addEventListener('selectstart', handleSelectStart);\n return function () {\n _this3.sourceNodes.delete(sourceId);\n\n _this3.sourceNodeOptions.delete(sourceId);\n\n node.removeEventListener('dragstart', handleDragStart);\n node.removeEventListener('selectstart', handleSelectStart);\n node.setAttribute('draggable', 'false');\n };\n }\n }, {\n key: \"connectDropTarget\",\n value: function connectDropTarget(targetId, node) {\n var _this4 = this;\n\n var handleDragEnter = function handleDragEnter(e) {\n return _this4.handleDragEnter(e, targetId);\n };\n\n var handleDragOver = function handleDragOver(e) {\n return _this4.handleDragOver(e, targetId);\n };\n\n var handleDrop = function handleDrop(e) {\n return _this4.handleDrop(e, targetId);\n };\n\n node.addEventListener('dragenter', handleDragEnter);\n node.addEventListener('dragover', handleDragOver);\n node.addEventListener('drop', handleDrop);\n return function () {\n node.removeEventListener('dragenter', handleDragEnter);\n node.removeEventListener('dragover', handleDragOver);\n node.removeEventListener('drop', handleDrop);\n };\n }\n }, {\n key: \"addEventListeners\",\n value: function addEventListeners(target) {\n // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813\n if (!target.addEventListener) {\n return;\n }\n\n target.addEventListener('dragstart', this.handleTopDragStart);\n target.addEventListener('dragstart', this.handleTopDragStartCapture, true);\n target.addEventListener('dragend', this.handleTopDragEndCapture, true);\n target.addEventListener('dragenter', this.handleTopDragEnter);\n target.addEventListener('dragenter', this.handleTopDragEnterCapture, true);\n target.addEventListener('dragleave', this.handleTopDragLeaveCapture, true);\n target.addEventListener('dragover', this.handleTopDragOver);\n target.addEventListener('dragover', this.handleTopDragOverCapture, true);\n target.addEventListener('drop', this.handleTopDrop);\n target.addEventListener('drop', this.handleTopDropCapture, true);\n }\n }, {\n key: \"removeEventListeners\",\n value: function removeEventListeners(target) {\n // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813\n if (!target.removeEventListener) {\n return;\n }\n\n target.removeEventListener('dragstart', this.handleTopDragStart);\n target.removeEventListener('dragstart', this.handleTopDragStartCapture, true);\n target.removeEventListener('dragend', this.handleTopDragEndCapture, true);\n target.removeEventListener('dragenter', this.handleTopDragEnter);\n target.removeEventListener('dragenter', this.handleTopDragEnterCapture, true);\n target.removeEventListener('dragleave', this.handleTopDragLeaveCapture, true);\n target.removeEventListener('dragover', this.handleTopDragOver);\n target.removeEventListener('dragover', this.handleTopDragOverCapture, true);\n target.removeEventListener('drop', this.handleTopDrop);\n target.removeEventListener('drop', this.handleTopDropCapture, true);\n }\n }, {\n key: \"getCurrentSourceNodeOptions\",\n value: function getCurrentSourceNodeOptions() {\n var sourceId = this.monitor.getSourceId();\n var sourceNodeOptions = this.sourceNodeOptions.get(sourceId);\n return _objectSpread({\n dropEffect: this.altKeyPressed ? 'copy' : 'move'\n }, sourceNodeOptions || {});\n }\n }, {\n key: \"getCurrentDropEffect\",\n value: function getCurrentDropEffect() {\n if (this.isDraggingNativeItem()) {\n // It makes more sense to default to 'copy' for native resources\n return 'copy';\n }\n\n return this.getCurrentSourceNodeOptions().dropEffect;\n }\n }, {\n key: \"getCurrentSourcePreviewNodeOptions\",\n value: function getCurrentSourcePreviewNodeOptions() {\n var sourceId = this.monitor.getSourceId();\n var sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId);\n return _objectSpread({\n anchorX: 0.5,\n anchorY: 0.5,\n captureDraggingState: false\n }, sourcePreviewNodeOptions || {});\n }\n }, {\n key: \"isDraggingNativeItem\",\n value: function isDraggingNativeItem() {\n var itemType = this.monitor.getItemType();\n return Object.keys(NativeTypes).some(function (key) {\n return NativeTypes[key] === itemType;\n });\n }\n }, {\n key: \"beginDragNativeItem\",\n value: function beginDragNativeItem(type, dataTransfer) {\n this.clearCurrentDragSourceNode();\n this.currentNativeSource = createNativeDragSource(type, dataTransfer);\n this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);\n this.actions.beginDrag([this.currentNativeHandle]);\n }\n }, {\n key: \"setCurrentDragSourceNode\",\n value: function setCurrentDragSourceNode(node) {\n var _this5 = this;\n\n this.clearCurrentDragSourceNode();\n this.currentDragSourceNode = node; // A timeout of > 0 is necessary to resolve Firefox issue referenced\n // See:\n // * https://github.com/react-dnd/react-dnd/pull/928\n // * https://github.com/react-dnd/react-dnd/issues/869\n\n var MOUSE_MOVE_TIMEOUT = 1000; // Receiving a mouse event in the middle of a dragging operation\n // means it has ended and the drag source node disappeared from DOM,\n // so the browser didn't dispatch the dragend event.\n //\n // We need to wait before we start listening for mousemove events.\n // This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event\n // immediately in some browsers.\n //\n // See:\n // * https://github.com/react-dnd/react-dnd/pull/928\n // * https://github.com/react-dnd/react-dnd/issues/869\n //\n\n this.mouseMoveTimeoutTimer = setTimeout(function () {\n return _this5.window && _this5.window.addEventListener('mousemove', _this5.endDragIfSourceWasRemovedFromDOM, true);\n }, MOUSE_MOVE_TIMEOUT);\n }\n }, {\n key: \"clearCurrentDragSourceNode\",\n value: function clearCurrentDragSourceNode() {\n if (this.currentDragSourceNode) {\n this.currentDragSourceNode = null;\n\n if (this.window) {\n this.window.clearTimeout(this.mouseMoveTimeoutTimer || undefined);\n this.window.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);\n }\n\n this.mouseMoveTimeoutTimer = null;\n return true;\n }\n\n return false;\n }\n }, {\n key: \"handleDragStart\",\n value: function handleDragStart(e, sourceId) {\n if (e.defaultPrevented) {\n return;\n }\n\n if (!this.dragStartSourceIds) {\n this.dragStartSourceIds = [];\n }\n\n this.dragStartSourceIds.unshift(sourceId);\n }\n }, {\n key: \"handleDragEnter\",\n value: function handleDragEnter(e, targetId) {\n this.dragEnterTargetIds.unshift(targetId);\n }\n }, {\n key: \"handleDragOver\",\n value: function handleDragOver(e, targetId) {\n if (this.dragOverTargetIds === null) {\n this.dragOverTargetIds = [];\n }\n\n this.dragOverTargetIds.unshift(targetId);\n }\n }, {\n key: \"handleDrop\",\n value: function handleDrop(e, targetId) {\n this.dropTargetIds.unshift(targetId);\n }\n }, {\n key: \"window\",\n get: function get() {\n return this.options.window;\n }\n }, {\n key: \"document\",\n get: function get() {\n return this.options.document;\n }\n }]);\n\n return HTML5Backend;\n}();\n\nexport { HTML5Backend as default };","var emptyImage;\nexport function getEmptyImage() {\n if (!emptyImage) {\n emptyImage = new Image();\n emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n }\n\n return emptyImage;\n}","import HTML5Backend from './HTML5Backend';\nimport * as NativeTypes from './NativeTypes';\nexport { getEmptyImage } from './getEmptyImage';\nexport { NativeTypes };\n\nvar createBackend = function createBackend(manager, context) {\n return new HTML5Backend(manager, context);\n};\n\nexport default createBackend;","import { HotKeys, IgnoreKeys, configure, GlobalHotKeys } from 'react-hotkeys';\nexport { GlobalHotKeys, HotKeys, IgnoreKeys } from 'react-hotkeys';\nimport { getScope, getDocument, isFocused, getPlugin, isEmpty, undo, redo, focus, focusPrevious, focusNext, getParent, insertChildAfter, mayRemoveChild, removeChild, change, createStore, getRoot, getPendingChanges, hasPendingChanges, serializeRootDocument, initRoot } from '@edtr-io/store';\nimport { createContext, createElement, useContext, useCallback, useMemo, useState, useRef, useEffect, Fragment, Component, forwardRef } from 'react';\nimport { Provider as Provider$1 } from 'react-redux';\nimport { useTheme, styled, RootThemeProvider } from '@edtr-io/ui';\nimport { mergeDeepRight } from 'ramda';\nimport { createPortal } from 'react-dom';\nimport { createDefaultDocumentEditor } from '@edtr-io/default-document-editor/beta';\nimport { createDefaultPluginToolbar } from '@edtr-io/default-plugin-toolbar/beta';\nimport { DndProvider } from 'react-dnd';\nimport HTML5Backend from 'react-dnd-html5-backend';\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar createDispatchHook = /*#__PURE__*/require('react-redux').createDispatchHook;\n\nvar createSelectorHook = /*#__PURE__*/require('react-redux').createSelectorHook;\n\nvar createStoreHook = /*#__PURE__*/require('react-redux').createStoreHook;\n/** @public */\n\n\nvar ScopeContext = /*#__PURE__*/createContext({\n scope: ''\n});\n/** @public */\n\nvar EditorContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n/** @public */\n\nvar ErrorContext = /*#__PURE__*/createContext(undefined); // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Store Provider\r\n *\r\n * @param props - The {@link https://react-redux.js.org/api/provider#props | ProviderProps}\r\n * @public\r\n */\n\nfunction Provider(props) {\n return createElement(Provider$1, Object.assign({}, props, {\n context: EditorContext\n }));\n}\n/**\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n *\r\n * @public\r\n */\n\nfunction useScope(enforcedScope) {\n var _React$useContext = useContext(ScopeContext),\n scope = _React$useContext.scope;\n\n return enforcedScope === undefined ? scope : enforcedScope;\n}\n/** @public */\n\nvar useDispatch = /*#__PURE__*/createDispatchHook(EditorContext); // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * React Hook to dispatch an action in the current scope\r\n *\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @public\r\n */\n\nfunction useScopedDispatch(enforcedScope) {\n var scope = useScope(enforcedScope);\n var dispatch = useDispatch();\n return useCallback(scopeDispatch(dispatch, scope), [dispatch, scope]);\n}\n\nfunction scopeDispatch(dispatch, scope) {\n return function (scopedAction) {\n dispatch(scopedAction(scope));\n };\n}\n/** @public */\n\n\nvar useSelector = /*#__PURE__*/createSelectorHook(EditorContext);\n/**\r\n * React Hook to get the value of an selector in the current scope\r\n *\r\n * @param scopedSelector - The selector\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @returns The value of the selector in the current scope\r\n * @public\r\n */\n\nfunction useScopedSelector(scopedSelector, enforcedScope) {\n var scope = useScope(enforcedScope);\n return useSelector(function (state) {\n return scopedSelector(getScope(state, scope));\n });\n}\n/** @public */\n\nvar useStore = /*#__PURE__*/createStoreHook(EditorContext);\n/**\r\n * React Hook to obtain a reference to the scoped store\r\n *\r\n * @param enforcedScope - If provided, used as the scope instead of the current scope\r\n * @returns The scoped store\r\n * @public\r\n */\n\nfunction useScopedStore(enforcedScope) {\n var scope = useScope(enforcedScope);\n var store = useStore();\n return useMemo(function () {\n return {\n dispatch: scopeDispatch(store.dispatch, scope),\n getState: function getState() {\n return getScope(store.getState(), scope);\n },\n subscribe: function subscribe(listener) {\n return store.subscribe(listener);\n }\n };\n }, [scope, store]);\n}\n\n/** @public */\n\nvar DocumentEditorContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n\n/** @public */\n\nvar PluginToolbarContext = /*#__PURE__*/createContext( // eslint-disable-next-line @typescript-eslint/no-explicit-any\nundefined);\n\n/** @beta */\n\nvar PreferenceContext = /*#__PURE__*/createContext({\n getKey: function getKey() {},\n setKey: function setKey() {}\n});\nvar store = {};\n/**\r\n * Sets a preference\r\n *\r\n * @param key - The preference\r\n * @param val - The value\r\n * @beta\r\n */\n\nfunction setDefaultPreference(key, val) {\n store[key] = val;\n}\nfunction PreferenceContextProvider(props) {\n var _React$useState = useState(1),\n state = _React$useState[0],\n setState = _React$useState[1];\n\n function setKey(key, val) {\n store[key] = val;\n setState(state + 1);\n }\n\n function getKey(key) {\n return store[key];\n }\n\n return createElement(PreferenceContext.Provider, {\n value: {\n setKey: setKey,\n getKey: getKey\n }\n }, props.children);\n}\n\nvar StyledDocument = /*#__PURE__*/styled.div({\n outline: 'none'\n});\nvar hotKeysKeyMap = {\n FOCUS_PREVIOUS: 'up',\n FOCUS_NEXT: 'down',\n INSERT_DEFAULT_PLUGIN: 'enter',\n DELETE_EMPTY: ['backspace', 'del'],\n UNDO: ['ctrl+z', 'command+z'],\n REDO: ['ctrl+y', 'command+y', 'ctrl+shift+z', 'command+shift+z']\n};\nfunction SubDocumentEditor(_ref) {\n var id = _ref.id,\n pluginProps = _ref.pluginProps;\n\n var _React$useState = useState(false),\n hasSettings = _React$useState[0],\n setHasSettings = _React$useState[1];\n\n var _React$useState2 = useState(false),\n hasToolbar = _React$useState2[0],\n setHasToolbar = _React$useState2[1];\n\n var document = useScopedSelector(getDocument(id));\n var focused = useScopedSelector(isFocused(id));\n var plugin = useScopedSelector(function (state) {\n return document && getPlugin(document.plugin)(state);\n });\n var store = useScopedStore();\n var container = useRef(null);\n var settingsRef = useRef(window.document.createElement('div'));\n var toolbarRef = useRef(window.document.createElement('div'));\n var DocumentEditor = useContext(DocumentEditorContext);\n var PluginToolbar = useContext(PluginToolbarContext);\n var autofocusRef = useRef(null);\n useEffect(function () {\n if (focused) {\n setTimeout(function () {\n if (autofocusRef.current) {\n autofocusRef.current.focus();\n }\n });\n }\n }, [focused]);\n useEffect(function () {\n if (focused && container.current && document && plugin && !plugin.state.getFocusableChildren(document.state).length) {\n container.current.focus();\n } // `document` should not be part of the dependencies because we only want to call this once when the document gets focused\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, [focused, plugin]);\n var hotKeysHandlers = useMemo(function () {\n return {\n FOCUS_PREVIOUS: function FOCUS_PREVIOUS(e) {\n handleKeyDown(e, function () {\n store.dispatch(focusPrevious());\n });\n },\n FOCUS_NEXT: function FOCUS_NEXT(e) {\n handleKeyDown(e, function () {\n store.dispatch(focusNext());\n });\n },\n INSERT_DEFAULT_PLUGIN: function INSERT_DEFAULT_PLUGIN(e) {\n handleKeyDown(e, function () {\n var parent = getParent(id)(store.getState());\n if (!parent) return;\n store.dispatch(insertChildAfter({\n parent: parent.id,\n sibling: id\n }));\n });\n },\n DELETE_EMPTY: function DELETE_EMPTY(e) {\n if (isEmpty(id)(store.getState())) {\n handleKeyDown(e, function () {\n if (!e) return;\n\n if (mayRemoveChild(id)(store.getState())) {\n var parent = getParent(id)(store.getState());\n if (!parent) return;\n\n if (e.key === 'Backspace') {\n store.dispatch(focusPrevious());\n } else if (e.key === 'Delete') {\n store.dispatch(focusNext());\n }\n\n store.dispatch(removeChild({\n parent: parent.id,\n child: id\n }));\n }\n });\n }\n },\n // TODO: workaround for https://github.com/edtr-io/edtr-io/issues/272\n UNDO: function UNDO() {\n store.dispatch(undo());\n },\n REDO: function REDO() {\n store.dispatch(redo());\n }\n };\n\n function handleKeyDown(e, next) {\n if (e && plugin && typeof plugin.onKeyDown === 'function' && !plugin.onKeyDown(e)) {\n return;\n }\n\n e && e.preventDefault();\n next();\n }\n }, [id, store, plugin]);\n var handleFocus = useCallback(function (e) {\n // Find closest document\n var target = e.target.closest('[data-document]');\n\n if (!focused && target === container.current) {\n store.dispatch(focus(id));\n }\n }, [store, focused, id]);\n var renderIntoSettings = useCallback(function (children) {\n return createElement(RenderIntoSettings, {\n setHasSettings: setHasSettings,\n settingsRef: settingsRef\n }, children);\n }, [settingsRef]);\n var renderIntoToolbar = useCallback(function (children) {\n setHasToolbar(true);\n if (!toolbarRef.current) return null;\n return createPortal(children, toolbarRef.current);\n }, [toolbarRef]);\n var theme = useTheme();\n return useMemo(function () {\n if (!document) return null;\n\n if (!plugin) {\n // eslint-disable-next-line no-console\n console.log('Plugin does not exist');\n return null;\n }\n\n var defaultConfig = typeof plugin.config === 'function' ? plugin.config(theme) : plugin.config;\n var overrideConfig = pluginProps && pluginProps.config || {};\n var config = mergeDeepRight(defaultConfig, overrideConfig);\n\n var onChange = function onChange(initial, executor) {\n store.dispatch(change({\n id: id,\n state: {\n initial: initial,\n executor: executor\n }\n }));\n };\n\n var state = plugin.state.init(document.state, onChange);\n return createElement(HotKeys, {\n keyMap: hotKeysKeyMap,\n handlers: hotKeysHandlers,\n allowChanges: true\n }, createElement(StyledDocument, {\n onMouseDown: handleFocus,\n ref: container,\n \"data-document\": true,\n tabIndex: -1\n }, createElement(DocumentEditor, {\n hasSettings: hasSettings,\n hasToolbar: hasToolbar,\n focused: focused,\n renderSettings: pluginProps && pluginProps.renderSettings,\n renderToolbar: pluginProps && pluginProps.renderToolbar,\n settingsRef: settingsRef,\n toolbarRef: toolbarRef,\n PluginToolbar: PluginToolbar\n }, createElement(plugin.Component, {\n renderIntoSettings: renderIntoSettings,\n renderIntoToolbar: renderIntoToolbar,\n id: id,\n editable: true,\n focused: focused,\n config: config,\n state: state,\n autofocusRef: autofocusRef\n }))));\n }, [document, plugin, theme, pluginProps, handleFocus, hasSettings, hasToolbar, focused, PluginToolbar, renderIntoSettings, renderIntoToolbar, id, hotKeysHandlers, store]);\n}\n\nfunction RenderIntoSettings(_ref2) {\n var children = _ref2.children,\n setHasSettings = _ref2.setHasSettings,\n settingsRef = _ref2.settingsRef;\n useEffect(function () {\n setHasSettings(true);\n });\n if (!settingsRef.current) return null;\n return createPortal(createElement(IgnoreKeys, null, children), settingsRef.current);\n}\n\nfunction SubDocumentRenderer(_ref) {\n var id = _ref.id,\n pluginProps = _ref.pluginProps;\n var document = useScopedSelector(getDocument(id));\n var plugin = useScopedSelector(function (state) {\n return document && getPlugin(document.plugin)(state);\n });\n var focusRef = useRef(null);\n var theme = useTheme();\n if (!document) return null;\n\n if (!plugin) {\n // TODO:\n // eslint-disable-next-line no-console\n console.log('Plugin does not exist');\n return null;\n }\n\n var defaultConfig = typeof plugin.config === 'function' ? plugin.config(theme) : plugin.config;\n var overrideConfig = pluginProps && pluginProps.config || {};\n var config = mergeDeepRight(defaultConfig, overrideConfig);\n var pluginState = plugin.state.init(document.state, function () {});\n return createElement(plugin.Component, {\n config: config,\n state: pluginState,\n id: id,\n editable: false,\n focused: false,\n autofocusRef: focusRef,\n renderIntoSettings: function renderIntoSettings() {\n return null;\n },\n renderIntoToolbar: function renderIntoToolbar() {\n return null;\n }\n });\n}\n\n/**\r\n * Renders a document inside another document\r\n *\r\n * @param props - The {@link SubDocumentProps}\r\n * @public\r\n */\n\nvar SubDocument = function SubDocument(props) {\n var _React$useContext = useContext(ScopeContext),\n editable = _React$useContext.editable;\n\n var dispatch = useScopedDispatch();\n var undoMemo = useCallback(function () {\n dispatch(undo());\n }, [dispatch]);\n var Component = editable ? SubDocumentEditor : SubDocumentRenderer;\n return createElement(ErrorBoundary, {\n undo: undoMemo\n }, createElement(Component, Object.assign({}, props)));\n};\nvar ErrorBoundary = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(ErrorBoundary, _React$Component);\n\n function ErrorBoundary() {\n var _this;\n\n _this = _React$Component.apply(this, arguments) || this;\n _this.state = {\n hasError: false\n };\n return _this;\n }\n\n ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError() {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true\n };\n };\n\n var _proto = ErrorBoundary.prototype;\n\n _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {\n if (typeof this.context === 'function') {\n this.context(error, errorInfo);\n }\n\n console.log(error, errorInfo);\n };\n\n _proto.render = function render() {\n var _this2 = this;\n\n if (this.state.hasError) {\n return createElement(Fragment, null, \"Leider ist ein Fehler aufgetreten.\", createElement(\"button\", {\n onClick: function onClick() {\n _this2.props.undo();\n\n _this2.setState({\n hasError: false\n });\n }\n }, \"letzte \\xC4nderung r\\xFCckg\\xE4nging machen\"));\n }\n\n return this.props.children;\n };\n\n return ErrorBoundary;\n}(Component);\nErrorBoundary.contextType = ErrorContext;\n\nconfigure({\n ignoreEventsCondition: function ignoreEventsCondition() {\n return false;\n }\n});\nvar DefaultDocumentEditor = /*#__PURE__*/createDefaultDocumentEditor();\nvar DefaultPluginToolbar = /*#__PURE__*/createDefaultPluginToolbar();\nvar MAIN_SCOPE = 'main';\nvar mountedProvider = false;\nvar mountedScopes = {}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Renders a single editor for an Edtr.io document\r\n *\r\n * @public\r\n */\n\nfunction Editor(_ref) {\n var _ref$createStoreEnhan = _ref.createStoreEnhancer,\n createStoreEnhancer = _ref$createStoreEnhan === void 0 ? function (defaultEnhancer) {\n return defaultEnhancer;\n } : _ref$createStoreEnhan,\n props = _objectWithoutPropertiesLoose(_ref, [\"createStoreEnhancer\"]);\n\n var store = useMemo(function () {\n var _scopes;\n\n return createStore({\n scopes: (_scopes = {}, _scopes[MAIN_SCOPE] = props.plugins, _scopes),\n createEnhancer: createStoreEnhancer\n }).store; // We want to create the store only once\n // TODO: add effects that handle changes to plugins and defaultPlugin (by dispatching an action)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return createElement(Provider, {\n store: store\n }, renderChildren());\n\n function renderChildren() {\n var children = createElement(InnerDocument, Object.assign({}, props, {\n scope: MAIN_SCOPE,\n editable: props.editable === undefined ? true : props.editable\n }));\n if (props.omitDragDropContext) return children;\n return createElement(DndProvider, {\n backend: HTML5Backend\n }, children);\n }\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Hydrates the required contexts\r\n *\r\n * @param createStoreEnhancer - Optional {@link @edtr-io/store#StoreEnhancerFactory | store enhancer factory}\r\n * @param omitDragDropContext - If set to `true`, we omit the hydration of {@link react-dnd#DndProvider}\r\n * @param children - The children\r\n * @beta\r\n */\n\nfunction EditorProvider(_ref2) {\n var _ref2$createStoreEnha = _ref2.createStoreEnhancer,\n createStoreEnhancer = _ref2$createStoreEnha === void 0 ? function (defaultEnhancer) {\n return defaultEnhancer;\n } : _ref2$createStoreEnha,\n omitDragDropContext = _ref2.omitDragDropContext,\n children = _ref2.children;\n useEffect(function () {\n if (mountedProvider) {\n // eslint-disable-next-line no-console\n console.error('You may only render one
.');\n }\n\n mountedProvider = true;\n return function () {\n mountedProvider = false;\n };\n }, []);\n var store = useMemo(function () {\n return createStore({\n scopes: {},\n createEnhancer: createStoreEnhancer\n }).store; // We want to create the store only once\n // TODO: add effects that handle changes to plugins and defaultPlugin (by dispatching an action)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n var child = createElement(Provider, {\n store: store\n }, children);\n if (omitDragDropContext) return child;\n return createElement(DndProvider, {\n backend: HTML5Backend\n }, child);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Renders an editor for an Edtr.io document\r\n *\r\n * @param scope - The scope of the document\r\n * @param mirror - Should be set to `true` for all but one document of the same scope\r\n * @param props - The {@link EditorProps | props} for the document\r\n * @beta\r\n */\n\nfunction Document(_ref3) {\n var _ref3$scope = _ref3.scope,\n scope = _ref3$scope === void 0 ? MAIN_SCOPE : _ref3$scope,\n props = _objectWithoutPropertiesLoose(_ref3, [\"scope\"]);\n\n var storeContext = useContext(EditorContext);\n useEffect(function () {\n var isMainInstance = !props.mirror;\n\n if (isMainInstance) {\n if (mountedScopes[scope]) {\n // eslint-disable-next-line no-console\n console.error(\"There are multiple main instances for scope \" + scope + \". Please set the mirror prop to true to all but one instance.\");\n mountedScopes[scope] = true;\n return function () {\n mountedScopes[scope] = false;\n };\n }\n }\n }, [props.mirror, scope]);\n\n if (!storeContext) {\n // eslint-disable-next-line no-console\n console.error('Could not connect to Redux Store. Please make sure to wrap all instances of Document in an EditorProvider');\n return null;\n }\n\n return createElement(InnerDocument, Object.assign({\n scope: scope\n }, props));\n}\nvar defaultTheme = {};\nvar hotKeysKeyMap$1 = {\n UNDO: ['ctrl+z', 'command+z'],\n REDO: ['ctrl+y', 'command+y', 'ctrl+shift+z', 'command+shift+z']\n};\nfunction InnerDocument(_ref4) {\n var children = _ref4.children,\n plugins = _ref4.plugins,\n scope = _ref4.scope,\n editable = _ref4.editable,\n _ref4$theme = _ref4.theme,\n theme = _ref4$theme === void 0 ? defaultTheme : _ref4$theme,\n onChange = _ref4.onChange,\n onError = _ref4.onError,\n _ref4$DocumentEditor = _ref4.DocumentEditor,\n DocumentEditor = _ref4$DocumentEditor === void 0 ? DefaultDocumentEditor : _ref4$DocumentEditor,\n _ref4$PluginToolbar = _ref4.PluginToolbar,\n PluginToolbar = _ref4$PluginToolbar === void 0 ? DefaultPluginToolbar : _ref4$PluginToolbar,\n props = _objectWithoutPropertiesLoose(_ref4, [\"children\", \"plugins\", \"scope\", \"editable\", \"theme\", \"onChange\", \"onError\", \"DocumentEditor\", \"PluginToolbar\"]);\n\n // Can't use `useScopedSelector` here since `InnerDocument` initializes the scoped state and `ScopeContext`\n var id = useSelector(function (state) {\n var scopedState = state[scope];\n if (!scopedState) return null;\n return getRoot()(scopedState);\n });\n var dispatch = useDispatch(); // Can't use `useScopedStore` here since `InnerDocument` initializes the scoped state and `ScopeContext`\n\n var fullStore = useStore();\n useEffect(function () {\n if (typeof onChange !== 'function') return;\n var pendingChanges = getPendingChanges()(getScope(fullStore.getState(), scope));\n return fullStore.subscribe(function () {\n var currentPendingChanges = getPendingChanges()(getScope(fullStore.getState(), scope));\n\n if (currentPendingChanges !== pendingChanges) {\n onChange({\n changed: hasPendingChanges()(getScope(fullStore.getState(), scope)),\n getDocument: function getDocument() {\n return serializeRootDocument()(getScope(fullStore.getState(), scope));\n }\n });\n pendingChanges = currentPendingChanges;\n }\n });\n }, [onChange, fullStore, scope]);\n useEffect(function () {\n if (!props.mirror) {\n dispatch(initRoot({\n initialState: props.initialState,\n plugins: plugins\n })(scope));\n } // TODO: initRoot changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n\n }, [props.initialState, plugins, props.mirror]);\n var scopeContextValue = useMemo(function () {\n return {\n scope: scope,\n editable: editable\n };\n }, [scope, editable]);\n var hotKeysHandlers = useMemo(function () {\n return {\n UNDO: function UNDO() {\n return dispatch(undo()(scope));\n },\n REDO: function REDO() {\n return dispatch(redo()(scope));\n }\n };\n }, [dispatch, scope]);\n if (!id) return null;\n return createElement(GlobalHotKeys, {\n allowChanges: true,\n keyMap: hotKeysKeyMap$1,\n handlers: hotKeysHandlers\n }, createElement(\"div\", {\n style: {\n position: 'relative'\n }\n }, createElement(ErrorContext.Provider, {\n value: onError\n }, createElement(DocumentEditorContext.Provider, {\n value: DocumentEditor\n }, createElement(PluginToolbarContext.Provider, {\n value: PluginToolbar\n }, createElement(RootThemeProvider, {\n theme: theme\n }, createElement(PreferenceContextProvider, null, createElement(ScopeContext.Provider, {\n value: scopeContextValue\n }, renderChildren(id)))))))));\n\n function renderChildren(id) {\n var document = createElement(SubDocument, {\n id: id\n });\n\n if (typeof children === 'function') {\n return children(document);\n }\n\n return createElement(Fragment, null, document, children);\n }\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayButton}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayButtonProps}\r\n * @public\r\n */\n\nfunction OverlayButton(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayButton = _React$useContext.OverlayButton;\n\n return createElement(OverlayButton, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayCheckbox}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayCheckboxProps}\r\n * @public\r\n */\n\nfunction OverlayCheckbox(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayCheckbox = _React$useContext.OverlayCheckbox;\n\n return createElement(OverlayCheckbox, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayInput}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayInputProps}\r\n * @public\r\n */\n\nfunction OverlayInput(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayInput = _React$useContext.OverlayInput;\n\n return createElement(OverlayInput, Object.assign({}, props, {\n ref: undefined\n }));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlaySelect}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlaySelectProps}\r\n * @public\r\n */\n\nfunction OverlaySelect(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlaySelect = _React$useContext.OverlaySelect;\n\n return createElement(OverlaySelect, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | OverlayTextarea}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#OverlayTextareaProps}\r\n * @public\r\n */\n\nfunction OverlayTextarea(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n OverlayTextarea = _React$useContext.OverlayTextarea;\n\n return createElement(OverlayTextarea, Object.assign({}, props));\n}\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | PluginToolbarButton}\r\n *\r\n * @public\r\n */\n\nvar PluginToolbarButton = /*#__PURE__*/forwardRef(function PluginToolbarButton(props, ref) {\n var _React$useContext = useContext(PluginToolbarContext),\n PluginToolbarButton = _React$useContext.PluginToolbarButton;\n\n return createElement(PluginToolbarButton, Object.assign({}, props, {\n ref: ref\n }));\n});\n\n/**\r\n * Renders the {@link @edtr-io/plugin-toolbar#PluginToolbar | PluginToolbarOverlayButton}\r\n *\r\n * @param props - {@link @edtr-io/plugin-toolbar#PluginToolbarOverlayButtonProps}\r\n * @public\r\n */\n\nfunction PluginToolbarOverlayButton(props) {\n var _React$useContext = useContext(PluginToolbarContext),\n PluginToolbarOverlayButton = _React$useContext.PluginToolbarOverlayButton;\n\n return createElement(PluginToolbarOverlayButton, Object.assign({}, props));\n}\n\nexport { Document, DocumentEditorContext, Editor, EditorProvider, ErrorContext, OverlayButton, OverlayCheckbox, OverlayInput, OverlaySelect, OverlayTextarea, PluginToolbarButton, PluginToolbarContext, PluginToolbarOverlayButton, PreferenceContext, Provider, ScopeContext, SubDocument, setDefaultPreference, useDispatch, useScope, useScopedDispatch, useScopedSelector, useScopedStore, useSelector, useStore };\n\n","export const createTheme = (theme) => ({\n\teditor: {\n\t\tprimary: {\n\t\t\tbackground: theme.colors.primary,\n\t\t},\n\t},\n\tplugins: {\n\t\trows: {\n\t\t\tmenu: {\n\t\t\t\thighlightColor: theme.colors.primary,\n\t\t\t\tdropzone: {\n\t\t\t\t\thighlightColor: theme.colors.primary,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\ttext: {\n\t\t\thoverColor: \"#B6B6B6\",\n\t\t},\n\t},\n});","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG =\n/*#__PURE__*/\nStyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { SubDocument } from '@edtr-io/core';\nimport { mergeDeepRight, findIndex, propEq, update, map, insert, remove, move, times, flatten, mapObjIndexed, set, lensProp, values } from 'ramda';\nimport { createElement, useState, useEffect } from 'react';\nimport { generate } from 'shortid';\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\n/** @public */\n\nfunction child(_ref) {\n var plugin = _ref.plugin,\n initialState = _ref.initialState,\n config = _ref.config;\n return {\n init: function init(id, onChange) {\n return {\n get: function get() {\n return id;\n },\n id: id,\n render: function Child(props) {\n if (props === void 0) {\n props = {};\n }\n\n var pluginProps = _extends({}, props, {\n config: mergeDeepRight(config || {}, props.config || {})\n });\n\n return createElement(SubDocument, {\n key: id,\n pluginProps: pluginProps,\n id: id\n });\n },\n replace: function replace(plugin, state) {\n onChange(function (_id, helpers) {\n helpers.createDocument({\n id: id,\n plugin: plugin,\n state: state\n });\n return id;\n });\n }\n };\n },\n createInitialState: function createInitialState(_ref2) {\n var createDocument = _ref2.createDocument;\n var id = generate();\n createDocument({\n id: id,\n plugin: plugin,\n state: initialState\n });\n return id;\n },\n deserialize: function deserialize(serialized, _ref3) {\n var createDocument = _ref3.createDocument;\n var id = generate();\n createDocument(_extends({\n id: id\n }, serialized));\n return id;\n },\n serialize: function serialize(id, _ref4) {\n var getDocument = _ref4.getDocument;\n var document = getDocument(id);\n\n if (document === null) {\n throw new Error('There exists no document with the given id');\n }\n\n return document;\n },\n getFocusableChildren: function getFocusableChildren(id) {\n return [{\n id: id\n }];\n }\n };\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\r\n * @param type - The {@link @edtr-io/internal__plugin-state#StateType | state type} of the list items\r\n * @param initialCount - The initial number of list items\r\n * @public\r\n */\n\nfunction list(type, initialCount) {\n if (initialCount === void 0) {\n initialCount = 0;\n }\n\n return {\n init: function init(rawItems, onChange) {\n var items = rawItems.map(function (item) {\n return type.init(item.value, createOnChange(item.id));\n });\n return Object.assign(items, {\n set: function set(updater) {\n onChange(function (wrappedItems, helpers) {\n var unwrapped = map(function (wrapped) {\n return wrapped.value;\n }, wrappedItems);\n return map(wrap, updater(unwrapped, function (options) {\n return type.deserialize(options, helpers);\n }));\n });\n },\n insert: function insert$1(index, options) {\n onChange(function (items, helpers) {\n var wrappedSubState = wrap(options ? type.deserialize(options, helpers) : type.createInitialState(helpers));\n return insert(index === undefined ? items.length : index, wrappedSubState, items);\n });\n },\n remove: function remove$1(index) {\n onChange(function (items) {\n return remove(index, 1, items);\n });\n },\n move: function move$1(from, to) {\n onChange(function (items) {\n return move(from, to, items);\n });\n }\n });\n\n function createOnChange(id) {\n return function (initial, executor) {\n function wrapUpdater(initial) {\n return function (oldItems, helpers) {\n var index = findIndex(propEq('id', id), oldItems);\n var result = update(index, {\n value: initial(oldItems[index].value, helpers),\n id: id\n }, oldItems);\n return result;\n };\n }\n\n onChange(wrapUpdater(initial), executor ? function (resolve, reject, next) {\n executor(function (innerUpdater) {\n return resolve(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return reject(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return next(wrapUpdater(innerUpdater));\n });\n } : undefined);\n };\n }\n },\n createInitialState: function createInitialState(helpers) {\n return times(function () {\n return wrap(type.createInitialState(helpers));\n }, initialCount);\n },\n deserialize: function deserialize(serialized, helpers) {\n return map(function (s) {\n return wrap(type.deserialize(s, helpers));\n }, serialized);\n },\n serialize: function serialize(deserialized, helpers) {\n return map(function (_ref) {\n var value = _ref.value;\n return type.serialize(value, helpers);\n }, deserialized);\n },\n getFocusableChildren: function getFocusableChildren(items) {\n return flatten(map(function (item) {\n return type.getFocusableChildren(item.value);\n }, items));\n }\n };\n\n function wrap(value) {\n return {\n id: generate(),\n value: value\n };\n }\n}\n\n/**\r\n * @param initialValue - The initial value\r\n * @public\r\n */\nfunction _boolean(initialValue) {\n return scalar(initialValue || false);\n}\nfunction number(initialValue) {\n return scalar(initialValue || 0);\n}\n/**\r\n * @param initialValue - The initial value\r\n * @public\r\n */\n\nfunction string(initialValue) {\n return scalar(initialValue || '');\n}\n/**\r\n * @param initialState - The initial value\r\n * @public\r\n */\n\nfunction scalar(initialState) {\n return serializedScalar(initialState, {\n deserialize: function deserialize(state) {\n return state;\n },\n serialize: function serialize(state) {\n return state;\n }\n });\n}\n/**\r\n * @param initialState - The initial state\r\n * @param serializer - The {@link Serializer | serializer}\r\n * @public\r\n */\n\nfunction serializedScalar(initialState, serializer) {\n return _extends({\n init: function init(state, onChange) {\n var SerializedScalarType = /*#__PURE__*/function () {\n function SerializedScalarType() {}\n\n var _proto = SerializedScalarType.prototype;\n\n _proto.get = function get() {\n return state;\n };\n\n _proto.set = function set(param) {\n onChange(function (previousValue) {\n if (typeof param === 'function') {\n var updater = param;\n return updater(previousValue);\n }\n\n return param;\n });\n };\n\n _createClass(SerializedScalarType, [{\n key: \"value\",\n get: function get() {\n return state;\n },\n set: function set(param) {\n this.set(param);\n }\n }]);\n\n return SerializedScalarType;\n }();\n\n return new SerializedScalarType();\n },\n createInitialState: function createInitialState() {\n return initialState;\n },\n getFocusableChildren: function getFocusableChildren() {\n return [];\n }\n }, serializer);\n}\n/**\r\n * @param initial - The initialValue\r\n * @param isTemporaryValue - Checks whether the given value is temporary\r\n * @public\r\n */\n\nfunction asyncScalar(initial, isTemporaryValue) {\n // warp boolean to typeguard\n function isTemporary(field) {\n return isTemporaryValue(field);\n }\n\n return {\n init: function init(state, onChange) {\n return {\n value: state,\n get: function get() {\n return state;\n },\n set: function set(initial, executor) {\n onChange(function (previousState) {\n if (typeof initial === 'function') {\n var f = initial;\n return f(previousState);\n }\n\n return initial;\n }, executor ? function (resolve, reject, next) {\n if (!executor) return;\n executor(wrapResolverParam(resolve), wrapResolverParam(reject), wrapResolverParam(next));\n } : undefined);\n }\n };\n\n function wrapResolverParam(callback) {\n return function (update) {\n if (typeof update === 'function') {\n var f = update;\n return callback(f);\n }\n\n return callback(function () {\n return update;\n });\n };\n }\n },\n createInitialState: function createInitialState() {\n return initial;\n },\n getFocusableChildren: function getFocusableChildren() {\n return [];\n },\n deserialize: function deserialize(serialized) {\n return serialized;\n },\n serialize: function serialize(deserialized) {\n if (isTemporary(deserialized)) {\n return initial;\n }\n\n return deserialized;\n }\n };\n}\n\n/**\r\n * @param type - The initial {@link @edtr-io/internal__plugin-state#StateType | state type} to start the migration from\r\n * @public\r\n */\nfunction migratable(type) {\n return _migrate(function (state) {\n return state;\n }, type, 0, function (state) {\n return state;\n });\n}\n\nfunction _migrate(recursiveMigrate, nextType, nextVersion, f) {\n return _extends({}, nextType, {\n deserialize: function deserialize(serialized, helpers) {\n if (isVersionized(serialized, nextVersion)) {\n return nextType.deserialize(serialized.value, helpers);\n }\n\n var s = serialized;\n return nextType.deserialize(f(recursiveMigrate(s)), helpers);\n },\n serialize: function serialize(deserialized, helpers) {\n return {\n __version__: nextVersion,\n value: nextType.serialize(deserialized, helpers)\n };\n },\n migrate: function migrate(nextNextType, f2) {\n return _migrate(function (previousState) {\n if (isVersionized(previousState, nextVersion)) {\n return previousState.value;\n }\n\n return f(recursiveMigrate(previousState));\n }, nextNextType, nextVersion + 1, f2);\n }\n });\n}\n\nfunction isVersionized(state, version) {\n return state.__version__ === version;\n}\n\n/**\r\n * @param types - The {@link @edtr-io/internal__plugin-state#StateType | state types} of the properties of the object\r\n * @param getFocusableChildren - Allows to override the default order of focusable children\r\n * @public\r\n */\n\nfunction object(types, _getFocusableChildren) {\n if (_getFocusableChildren === void 0) {\n _getFocusableChildren = function getFocusableChildren(children) {\n return flatten(values(children));\n };\n }\n\n return {\n init: function init(state, onChange) {\n return mapObjIndexed(function (type, key) {\n return type.init(state[key], innerOnChange);\n\n function innerOnChange(initial, executor) {\n function wrapUpdater(initial) {\n return function (oldObj, helpers) {\n return set(lensProp(key), initial(oldObj[key], helpers), oldObj);\n };\n }\n\n onChange(wrapUpdater(initial), executor ? function (resolve, reject, next) {\n executor(function (innerUpdater) {\n return resolve(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return reject(wrapUpdater(innerUpdater));\n }, function (innerUpdater) {\n return next(wrapUpdater(innerUpdater));\n });\n } : undefined);\n }\n }, types);\n },\n createInitialState: function createInitialState(helpers) {\n return map(function (type) {\n return type.createInitialState(helpers);\n }, types);\n },\n deserialize: function deserialize(serialized, helpers) {\n return mapObjIndexed(function (type, key) {\n return type.deserialize(serialized[key], helpers);\n }, types);\n },\n serialize: function serialize(deserialized, helpers) {\n return mapObjIndexed(function (type, key) {\n return type.serialize(deserialized[key], helpers);\n }, types);\n },\n getFocusableChildren: function getFocusableChildren(state) {\n var children = mapObjIndexed(function (type, key) {\n return type.getFocusableChildren(state[key]);\n }, types);\n return _getFocusableChildren(children);\n }\n };\n}\n\n/**\r\n * @param type - The {@link @edtr-io/internal__plugin-state#StateType | state type} for defined values\r\n * @param initiallyDefined - Whether the value should be defined initially\r\n * @public\r\n */\nfunction optional(type, initiallyDefined) {\n if (initiallyDefined === void 0) {\n initiallyDefined = false;\n }\n\n return {\n init: function init(state, onChange) {\n if (state.defined) {\n var value = type.init(state.value, innerOnChange);\n return Object.assign(value, {\n defined: true,\n remove: function remove() {\n onChange(function () {\n return {\n defined: false,\n value: null\n };\n });\n }\n });\n }\n\n return {\n defined: false,\n create: function create(value) {\n onChange(function (_previousState, helpers) {\n return {\n defined: true,\n value: value === undefined ? type.createInitialState(helpers) : type.deserialize(value, helpers)\n };\n });\n }\n };\n\n function innerOnChange(initial, executor) {\n return onChange(wrapStateUpdater(initial), typeof executor === 'function' ? function (resolve, reject, next) {\n executor(function (value) {\n resolve(wrapStateUpdater(value));\n }, function (value) {\n reject(wrapStateUpdater(value));\n }, function (value) {\n next(wrapStateUpdater(value));\n });\n } : undefined);\n }\n\n function wrapStateUpdater(f) {\n return function (previousState, helpers) {\n if (previousState.defined) {\n return {\n defined: true,\n value: f(previousState.value, helpers)\n };\n } else {\n return {\n defined: true,\n value: f(type.createInitialState(helpers), helpers)\n };\n }\n };\n }\n },\n createInitialState: function createInitialState(helpers) {\n if (initiallyDefined) {\n return {\n defined: true,\n value: type.createInitialState(helpers)\n };\n }\n\n return {\n defined: false,\n value: null\n };\n },\n deserialize: function deserialize(serialized, helpers) {\n if (serialized === undefined) {\n return {\n defined: false,\n value: null\n };\n }\n\n return {\n defined: true,\n value: type.deserialize(serialized, helpers)\n };\n },\n serialize: function serialize(deserialized, helpers) {\n if (deserialized.defined) {\n return type.serialize(deserialized.value, helpers);\n }\n\n return undefined;\n },\n getFocusableChildren: function getFocusableChildren(state) {\n if (state.defined) return type.getFocusableChildren(state.value);\n return [];\n }\n };\n}\n\n/**\r\n * @param defaultState - The default state\r\n * @public\r\n */\n\nfunction upload(defaultState) {\n var state = asyncScalar(defaultState, isTempFile);\n return _extends({}, state, {\n init: function init() {\n var s = state.init.apply(state, arguments);\n return _extends({}, s, {\n set: function set(value) {\n s.set(value);\n },\n isPending: isTempFile(s.value) && !!s.value.pending,\n upload: function upload(file, handler) {\n var uploaded = handler(file);\n s.set(defaultState, function (resolve, reject, next) {\n var read = readFile(file);\n var uploadFinished = false;\n read.then(function (loaded) {\n if (!uploadFinished) {\n next(function () {\n return {\n uploadHandled: true,\n loaded: loaded\n };\n });\n }\n });\n uploaded.then(function (uploaded) {\n uploadFinished = true;\n return uploaded;\n }).then(function (uploaded) {\n resolve(function () {\n return uploaded;\n });\n })[\"catch\"](function () {\n reject(function () {\n return {\n uploadHandled: true,\n failed: file\n };\n });\n });\n });\n return uploaded;\n }\n });\n }\n });\n}\n\nfunction readFile(file) {\n return new Promise(function (resolve) {\n var reader = new FileReader();\n\n reader.onload = function (e) {\n if (!e.target) return;\n var result = e.target.result;\n resolve({\n file: file,\n dataUrl: result\n });\n };\n\n reader.readAsDataURL(file);\n });\n}\n/**\r\n * @param file - The {@link UploadStateReturnType | upload state type}\r\n * @param uploadHandler - The {@link UploadHandler | upload handler}\r\n * @public\r\n */\n\n\nfunction usePendingFileUploader(file, uploadHandler) {\n usePendingFilesUploader([file], uploadHandler);\n}\n/**\r\n * @param files - The {@link UploadStateReturnType | upload state type}\r\n * @param uploadHandler - The {@link UploadHandler | upload handler}\r\n * @public\r\n */\n\nfunction usePendingFilesUploader(files, uploadHandler) {\n var _React$useState = useState(0),\n uploading = _React$useState[0],\n setUploading = _React$useState[1];\n\n useEffect(function () {\n // everything uploaded already\n if (uploading >= files.length) return;\n var fileState = files[uploading];\n\n if (isTempFile(fileState.value) && fileState.value.pending && !fileState.value.uploadHandled) {\n fileState.value.uploadHandled = true;\n fileState.upload(fileState.value.pending, uploadHandler)[\"catch\"](onDone).then(onDone);\n }\n\n function onDone() {\n setUploading(function (currentUploading) {\n return currentUploading + 1;\n });\n }\n }, [files, uploadHandler, uploading]);\n}\n/**\r\n * @param state - The current {@link FileState | state}\r\n * @public\r\n */\n\nfunction isTempFile(state) {\n var file = state;\n return !!(file.pending || file.failed || file.loaded);\n}\n\nexport { asyncScalar, _boolean as boolean, child, isTempFile, list, migratable, number, object, optional, scalar, serializedScalar, string, upload, usePendingFileUploader, usePendingFilesUploader };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { list, child } from '@edtr-io/plugin';\nimport { findIndex, remove, insert, mergeDeepRight } from 'ramda';\nimport { useScopedStore, PluginToolbarButton, OverlayButton, useScopedSelector } from '@edtr-io/core';\nimport { getDocument, getFocusPath, getFocusTree, findParent, serializeDocument, isFocused, getPlugins } from '@edtr-io/store';\nimport { styled, edtrDefaultPlugin, EdtrIcon, edtrClose, edtrSearch, Icon as Icon$1, faCopy, faTrashAlt, edtrDragHandle, edtrPlus } from '@edtr-io/ui';\nimport { createElement, Fragment, useState, useCallback, useEffect, useRef, useMemo } from 'react';\nimport { useDrag, useDrop } from 'react-dnd';\nimport { NativeTypes } from 'react-dnd-html5-backend';\n\nvar Row = /*#__PURE__*/styled.div({\n marginBottom: '25px'\n});\nfunction RowsRenderer(props) {\n return createElement(Fragment, null, props.state.map(function (row) {\n return createElement(Row, {\n key: row.id\n }, row.render());\n }));\n}\n\nvar StyledPlugin = /*#__PURE__*/styled.div(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'flex-start',\n margin: '15px',\n width: '175px',\n borderRadius: '5px',\n padding: '15px',\n cursor: 'pointer',\n transition: '250ms all ease-in-out',\n color: theme.menu.primary.color,\n '&:hover': {\n backgroundColor: theme.menu.secondary.backgroundColor\n }\n };\n});\nvar DefaultIcon = /*#__PURE__*/styled(EdtrIcon)({\n height: '100%',\n width: '100%'\n});\nvar IconWrapper = /*#__PURE__*/styled.div({\n height: '50px'\n});\nvar Title = /*#__PURE__*/styled.h3({\n marginTop: '15px',\n fontSize: '24px',\n marginBottom: '10px',\n fontWeight: 'bold',\n textAlign: 'center'\n});\nvar Description = /*#__PURE__*/styled.p({\n margin: 0,\n textAlign: 'center',\n fontSize: '16px'\n});\nvar Plugin = function Plugin(_ref2) {\n var config = _ref2.config,\n plugin = _ref2.plugin,\n pluginName = _ref2.pluginName,\n onClick = _ref2.onClick;\n return createElement(StyledPlugin, {\n config: config,\n onClick: onClick\n }, createElement(IconWrapper, null, plugin.icon ? createElement(plugin.icon, null) : createElement(DefaultIcon, {\n icon: edtrDefaultPlugin\n })), createElement(Title, null, plugin.title || pluginName), plugin.description && createElement(Description, null, plugin.description));\n};\n\nvar StyledSearch = /*#__PURE__*/styled.div({\n paddingTop: '25px',\n paddingBottom: '25px',\n display: 'flex',\n justifyContent: 'center',\n width: '600px',\n '@media (max-width: 650px)': {\n width: '100%'\n }\n});\nvar InputWrapper = /*#__PURE__*/styled.div({\n position: 'relative',\n width: '100%'\n});\nvar StyledInput = /*#__PURE__*/styled.input(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n padding: '5px 30px',\n border: \"2px solid \" + theme.menu.secondary.color,\n borderRadius: '5px',\n fontSize: '20px',\n outline: 'none',\n backgroundColor: theme.menu.primary.backgroundColor,\n transition: '250ms all ease-in-out',\n width: '100%',\n '&:focus': {\n borderColor: theme.menu.highlightColor\n },\n '&::placeholder': {\n color: theme.menu.secondary.color\n }\n };\n});\nvar ClearSearchContainer = /*#__PURE__*/styled.div(function (_ref2) {\n var config = _ref2.config,\n visible = _ref2.visible;\n var theme = config.theme;\n return {\n height: '55%',\n position: 'absolute',\n top: '50%',\n right: '5px',\n transform: 'translateY(-50%)',\n opacity: visible ? 1 : 0,\n transition: '250ms all ease-in-out',\n cursor: 'pointer',\n color: theme.menu.secondary.color,\n '&:hover': {\n color: theme.menu.highlightColor\n }\n };\n});\nvar SearchIcon = /*#__PURE__*/styled(EdtrIcon)(function (_ref3) {\n var config = _ref3.config;\n var theme = config.theme;\n return {\n height: '55%',\n position: 'absolute',\n color: theme.menu.secondary.color,\n top: '50%',\n left: '5px',\n transform: 'translateY(-50%)'\n };\n});\nvar Search = function Search(_ref4) {\n var search = _ref4.search,\n setSearch = _ref4.setSearch,\n config = _ref4.config;\n return createElement(StyledSearch, null, createElement(InputWrapper, null, createElement(StyledInput, {\n config: config,\n placeholder: config.i18n.menu.searchPlaceholder,\n value: search,\n onChange: function onChange(e) {\n return setSearch(e.target.value);\n }\n }), createElement(ClearSearchContainer, {\n config: config,\n visible: search.length > 0,\n onClick: function onClick() {\n return setSearch('');\n }\n }, createElement(EdtrIcon, {\n icon: edtrClose\n })), createElement(SearchIcon, {\n config: config,\n icon: edtrSearch\n })));\n};\n\nvar Wrapper = /*#__PURE__*/styled.div(function (_ref) {\n var config = _ref.config;\n var theme = config.theme;\n return {\n display: 'flex',\n padding: '25px calc((100vw - 960px) / 2) 0',\n flexDirection: 'column',\n backgroundColor: theme.menu.primary.backgroundColor,\n alignItems: 'center',\n position: 'fixed',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vh',\n zIndex: 9999,\n '@media (max-width: 1000px)': {\n padding: '25px 20px 0'\n }\n };\n});\nvar CloseButtonContainer = /*#__PURE__*/styled.div({\n position: 'absolute',\n top: '15px',\n right: '15px',\n width: '30px',\n cursor: 'pointer'\n});\nvar PluginList = /*#__PURE__*/styled.div({\n display: 'flex',\n justifyContent: 'space-around',\n flexWrap: 'wrap',\n overflowY: 'auto',\n alignItems: 'stretch'\n});\nfunction Menu(_ref2) {\n var menu = _ref2.menu,\n setMenu = _ref2.setMenu,\n config = _ref2.config;\n\n var _React$useState = useState(''),\n search = _React$useState[0],\n setSearch = _React$useState[1];\n\n var close = useCallback(function (evt) {\n if (evt.key === 'Escape') setMenu(undefined);\n }, [setMenu]);\n useEffect(function () {\n window.addEventListener('keydown', close);\n return function () {\n window.removeEventListener('keydown', close);\n };\n }, [close]);\n var mappedPlugins = config.plugins.filter(function (_ref3) {\n var pluginKey = _ref3.name,\n title = _ref3.title,\n description = _ref3.description;\n if (!search.length) return true;\n if (title && title.toLowerCase().includes(search.toLowerCase())) return true;\n if (description && description.toLowerCase().includes(search.toLowerCase())) return true;\n return pluginKey.toLowerCase().includes(search.toLowerCase());\n }).map(function (plugin) {\n return createElement(Plugin, {\n config: config,\n onClick: function onClick() {\n return menu.onClose({\n plugin: plugin.name\n });\n },\n key: plugin.name,\n pluginName: plugin.name,\n plugin: plugin\n });\n });\n return createElement(Wrapper, {\n config: config\n }, createElement(Search, {\n config: config,\n search: search,\n setSearch: setSearch\n }), createElement(PluginList, null, mappedPlugins), createElement(CloseButtonContainer, {\n onClick: function onClick() {\n return setMenu(undefined);\n }\n }, createElement(EdtrIcon, {\n icon: edtrClose\n })));\n}\n\nfunction useCanDrop(id, draggingAbove, allowedPlugins) {\n var store = useScopedStore();\n return function (dragId) {\n return dragId && isAllowedPlugin(dragId) && !wouldDropInOwnChildren(dragId) && !wouldDropAtInitialPosition(dragId);\n };\n\n function isAllowedPlugin(dragId) {\n var doc = getDocument(dragId)(store.getState());\n return doc && allowedPlugins.includes(doc.plugin);\n }\n\n function wouldDropInOwnChildren(dragId) {\n var focusPath = getFocusPath(id)(store.getState()) || [];\n return focusPath.includes(dragId);\n }\n\n function wouldDropAtInitialPosition(dragId) {\n var focusTree = getFocusTree()(store.getState());\n if (!focusTree) return true;\n var parent = findParent(focusTree, dragId);\n var dropIndex = getChildPosition(parent, id); // Different parents, so definitely not dropped at initial position\n\n if (dropIndex === null) return false;\n var dragIndex = getChildPosition(parent, dragId);\n return draggingAbove ? dragIndex === dropIndex - 1 : dragIndex === dropIndex + 1;\n }\n\n function getChildPosition(parent, childId) {\n if (!parent) return null;\n var position = findIndex(function (node) {\n return node.id === childId;\n }, parent.children || []);\n return position > -1 ? position : null;\n }\n}\n\nvar DragToolbarButton = /*#__PURE__*/styled(PluginToolbarButton)({\n marginBottom: '5px',\n marginTop: '-3px',\n cursor: 'grab',\n userSelect: 'none',\n '&:active': {\n cursor: 'grabbing'\n }\n});\nvar ButtonContainer = /*#__PURE__*/styled.div({\n display: 'flex'\n});\nvar Left = /*#__PURE__*/styled.div({\n flex: 1\n});\nvar BorderlessOverlayButton = /*#__PURE__*/styled(OverlayButton)({\n border: 'none !important',\n padding: '0 !important',\n minWidth: '0 !important'\n});\nvar GrayOut = /*#__PURE__*/styled.div({\n opacity: 0.3\n});\nvar Inserted = /*#__PURE__*/styled.hr(function (_ref) {\n var config = _ref.config;\n return {\n margin: 0,\n padding: 0,\n border: \"1px solid \" + config.theme.highlightColor\n };\n});\nvar validFileTypes = [NativeTypes.FILE, NativeTypes.URL];\nfunction RowRenderer(_ref2) {\n var config = _ref2.config,\n row = _ref2.row,\n rows = _ref2.rows,\n index = _ref2.index,\n plugins = _ref2.plugins,\n dropContainer = _ref2.dropContainer;\n var container = useRef(null);\n\n var _React$useState = useState(true),\n draggingAbove = _React$useState[0],\n setDraggingAbove = _React$useState[1];\n\n var allowedPlugins = useMemo(function () {\n return config.plugins.map(function (plugin) {\n return plugin.name;\n });\n }, [config]);\n var canDrop = useCanDrop(row.id, draggingAbove, allowedPlugins);\n var store = useScopedStore();\n\n var _useDrag = useDrag({\n item: {\n id: row.id,\n type: 'row',\n serialized: {\n plugin: '',\n state: ''\n },\n onDrop: function onDrop() {}\n },\n begin: function begin() {\n var serialized = serializeDocument(row.id)(store.getState());\n return {\n id: row.id,\n type: 'row',\n serialized: serialized,\n onDrop: function onDrop() {\n rows.set(function (list) {\n var i = findIndex(function (id) {\n return id === row.id;\n }, list);\n return remove(i, 1, list);\n });\n }\n };\n },\n collect: function collect(monitor) {\n return {\n isDragging: !!monitor.isDragging()\n };\n }\n }),\n collectedDragProps = _useDrag[0],\n drag = _useDrag[1],\n dragPreview = _useDrag[2];\n\n var _useDrop = useDrop({\n accept: ['row'].concat(validFileTypes),\n collect: function collect(monitor) {\n var type = monitor.getItemType();\n var isDragging = monitor.canDrop() && monitor.isOver({\n shallow: true\n });\n\n if (isFileType(type)) {\n return {\n isDragging: isDragging,\n isFile: true\n };\n }\n\n if (type == 'row') {\n return {\n isDragging: isDragging,\n id: monitor.getItem().id\n };\n }\n\n return {\n isDragging: false\n };\n },\n hover: function hover(item, monitor) {\n if (monitor.getItemType() === 'row' && monitor.canDrop() && monitor.isOver({\n shallow: true\n })) {\n setDraggingAbove(isDraggingAbove(monitor));\n }\n },\n drop: function drop(item, monitor) {\n var type = monitor.getItemType(); // handled in nested drop zone\n\n if (monitor.didDrop()) return;\n\n if (!isFileType(type)) {\n if (!canDrop(item.id)) return;\n\n var _draggingAbove = isDraggingAbove(monitor);\n\n rows.set(function (list, deserializer) {\n var i = findIndex(function (id) {\n return id === row.id;\n }, list);\n return insert(_draggingAbove ? i : i + 1, deserializer(item.serialized), list);\n });\n item.onDrop();\n return;\n }\n\n var dropIndex = index;\n\n switch (type) {\n case NativeTypes.FILE:\n {\n var files = monitor.getItem().files;\n\n for (var key in plugins) {\n var onFiles = plugins[key].onFiles;\n\n if (typeof onFiles === 'function') {\n var result = onFiles(files);\n\n if (result !== undefined) {\n handleResult(key, result);\n return;\n }\n }\n }\n\n break;\n }\n\n case NativeTypes.URL:\n {\n var urls = monitor.getItem().urls;\n var text = urls[0];\n\n for (var _key in plugins) {\n var onText = plugins[_key].onText;\n\n if (typeof onText === 'function') {\n var _result = onText(text);\n\n if (_result !== undefined) {\n handleResult(_key, _result);\n return;\n }\n }\n }\n\n break;\n }\n }\n\n function handleResult(key, result) {\n if (isDraggingAbove(monitor)) {\n rows.insert(dropIndex, {\n plugin: key,\n state: result.state\n });\n } else {\n rows.insert(dropIndex + 1, {\n plugin: key,\n state: result.state\n });\n }\n }\n }\n }),\n collectedDropProps = _useDrop[0],\n drop = _useDrop[1];\n\n var pluginProps = useMemo(function () {\n return {\n renderSettings: function renderSettings(children, _ref3) {\n var close = _ref3.close;\n return createElement(Fragment, null, children, createElement(\"hr\", null), createElement(ButtonContainer, null, createElement(Left, null, createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n var document = getDocument(row.id)(store.getState());\n if (!document) return;\n rows.insert(index, document);\n close();\n },\n label: config.i18n.settings.duplicateLabel\n }, createElement(Icon$1, {\n icon: faCopy\n }), \" \", config.i18n.settings.duplicateLabel), createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n rows.remove(index);\n close();\n },\n label: config.i18n.settings.removeLabel\n }, createElement(Icon$1, {\n icon: faTrashAlt\n }), \" \", config.i18n.settings.removeLabel)), createElement(\"div\", null, createElement(BorderlessOverlayButton, {\n onClick: function onClick() {\n close();\n },\n label: config.i18n.settings.closeLabel\n }))));\n },\n renderToolbar: function renderToolbar(children) {\n return createElement(Fragment, null, createElement(DragToolbarButton, {\n ref: drag,\n icon: createElement(EdtrIcon, {\n icon: edtrDragHandle\n }),\n label: config.i18n.toolbar.dragLabel\n }), children);\n }\n };\n }, [config.i18n.settings.duplicateLabel, config.i18n.settings.removeLabel, config.i18n.settings.closeLabel, config.i18n.toolbar.dragLabel, row.id, store, rows, index, drag]);\n dragPreview(drop(dropContainer));\n var dropPreview = collectedDropProps.isDragging && (collectedDropProps.isFile || canDrop(collectedDropProps.id)) ? createElement(Inserted, {\n config: config\n }) : null;\n return createElement(Fragment, null, draggingAbove ? dropPreview : null, createElement(\"div\", {\n ref: container\n }, collectedDragProps.isDragging ? createElement(GrayOut, null, row.render(pluginProps)) : createElement(\"div\", null, row.render(pluginProps))), !draggingAbove ? dropPreview : null);\n\n function isDraggingAbove(monitor) {\n if (!container.current) {\n return false;\n }\n\n var domBoundingRect = container.current.getBoundingClientRect();\n var domMiddleY = (domBoundingRect.bottom - domBoundingRect.top) / 2;\n var dropClientOffset = monitor.getClientOffset();\n var dragClientY = dropClientOffset ? dropClientOffset.y - domBoundingRect.top : 0;\n return dragClientY < domMiddleY;\n }\n}\n\nfunction isFileType(type) {\n return validFileTypes.includes(type);\n}\n\nvar StyledSeparator = /*#__PURE__*/styled.div(function (_ref) {\n var isFirst = _ref.isFirst;\n return {\n position: 'absolute',\n height: 'auto',\n width: '100%',\n transform: isFirst ? 'translateY(-100%)' : 'translateY(100%)',\n top: isFirst ? 0 : undefined,\n bottom: isFirst ? undefined : 0\n };\n});\nvar AddTrigger = /*#__PURE__*/styled.div(function (_ref2) {\n var focused = _ref2.focused,\n config = _ref2.config;\n var theme = config.theme;\n return {\n width: '26px',\n height: '26px',\n borderRadius: '13px',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n color: theme.color,\n backgroundColor: theme.backgroundColor,\n padding: '5px 0 10px',\n opacity: focused ? 0.6 : 0,\n transition: '250ms all ease-in-out 250ms',\n // position: inline ? 'absolute' : 'relative',\n zIndex: 70,\n '&:hover': {\n color: theme.highlightColor,\n opacity: 1,\n cursor: 'pointer'\n }\n };\n});\nvar TriggerArea = /*#__PURE__*/styled.div({\n width: '100%',\n padding: '2px 0 4px',\n display: 'flex',\n justifyContent: 'center',\n '&:hover .add-trigger': {\n opacity: 0.6\n }\n});\nvar Icon = /*#__PURE__*/styled(EdtrIcon)({\n width: '26px'\n});\nfunction Add(props) {\n return createElement(AddTrigger, {\n className: \"add-trigger\",\n config: props.config,\n focused: props.focused,\n title: props.config.i18n.addLabel,\n onMouseDown: props.onClick\n }, createElement(Icon, {\n icon: edtrPlus\n }));\n}\nfunction Separator(_ref3) {\n var config = _ref3.config,\n isFirst = _ref3.isFirst,\n onClick = _ref3.onClick,\n focused = _ref3.focused;\n return createElement(StyledSeparator, {\n isFirst: isFirst\n }, createElement(TriggerArea, null, createElement(Add, {\n config: config,\n focused: focused || false,\n onClick: onClick\n })));\n}\n\nvar DropContainer = /*#__PURE__*/styled.div({\n position: 'relative',\n // increase dropZone\n marginLeft: '-50px',\n paddingLeft: '50px'\n});\n\nfunction RowEditor(_ref) {\n var config = _ref.config,\n openMenu = _ref.openMenu,\n index = _ref.index,\n row = _ref.row,\n rows = _ref.rows;\n var focused = useScopedSelector(isFocused(row.id));\n var plugins = useScopedSelector(getPlugins());\n var dropContainer = useRef(null);\n return createElement(DropContainer, {\n key: row.id,\n ref: dropContainer\n }, createElement(RowRenderer, {\n config: config,\n row: row,\n rows: rows,\n index: index,\n plugins: plugins,\n dropContainer: dropContainer\n }), createElement(Separator, {\n config: config,\n focused: focused,\n onClick: function onClick() {\n openMenu(index + 1);\n }\n }));\n}\n\nfunction RowsEditor(props) {\n var _React$useState = useState(undefined),\n menu = _React$useState[0],\n setMenu = _React$useState[1];\n\n function _openMenu(insertIndex) {\n setMenu({\n index: insertIndex,\n onClose: function onClose(pluginState) {\n props.state.insert(insertIndex, pluginState);\n setMenu(undefined);\n }\n });\n }\n\n if (!props.editable) return createElement(RowsRenderer, Object.assign({}, props));\n return createElement(\"div\", {\n style: {\n position: 'relative',\n marginTop: '25px'\n }\n }, createElement(Separator, {\n config: props.config,\n isFirst: true,\n focused: props.state.length == 0,\n onClick: function onClick() {\n _openMenu(0);\n }\n }), props.state.map(function (row, index) {\n return createElement(RowEditor, {\n config: props.config,\n key: row.id,\n openMenu: function openMenu() {\n _openMenu(index + 1);\n },\n index: index,\n rows: props.state,\n row: row\n });\n }), menu ? createElement(Menu, {\n menu: menu,\n setMenu: setMenu,\n config: props.config\n }) : null);\n}\n\n/**\r\n * @param config - {@link RowsConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createRowsPlugin(config) {\n var _config$i18n = config.i18n,\n i18n = _config$i18n === void 0 ? {} : _config$i18n,\n _config$theme = config.theme,\n theme = _config$theme === void 0 ? {} : _config$theme,\n content = config.content,\n plugins = config.plugins;\n return {\n Component: RowsEditor,\n config: function config(_ref) {\n var editor = _ref.editor;\n return {\n plugins: plugins,\n i18n: mergeDeepRight({\n menu: {\n searchPlaceholder: 'Search for tools…'\n },\n settings: {\n duplicateLabel: 'Duplicate',\n removeLabel: 'Remove',\n closeLabel: 'Close'\n },\n toolbar: {\n dragLabel: 'Drag the element within the document'\n },\n addLabel: 'Add an element'\n }, i18n),\n theme: mergeDeepRight({\n color: editor.secondary.color,\n backgroundColor: editor.primary.color,\n highlightColor: editor.primary.background,\n lightBackgroundColor: 'rgb(182,182,182)',\n menu: {\n highlightColor: editor.primary.background,\n primary: {\n backgroundColor: 'rgba(255, 255, 255, 0.95)',\n color: editor.backgroundColor\n },\n secondary: {\n backgroundColor: 'rgba(0, 0, 0, 0.1)',\n color: '#999999'\n },\n dropzone: {\n backgroundColor: 'rgb(73, 73, 73)',\n color: '#dbdbdb',\n highlightColor: editor.primary.background,\n highlightBackgroundColor: 'rgb(60,60,60)'\n }\n }\n }, theme)\n };\n },\n state: list(child(content), 1),\n insertChild: function insertChild(state, _ref2) {\n var previousSibling = _ref2.previousSibling,\n document = _ref2.document;\n var index = getIndexToInsert();\n if (index === null) return;\n state.insert(index, document);\n\n function getIndexToInsert() {\n if (!previousSibling) return 0;\n var index = findIndex(function (sibling) {\n return sibling.id === previousSibling;\n }, state);\n if (index === -1) return null;\n return index + 1;\n }\n },\n removeChild: function removeChild(state, id) {\n var index = findIndex(function (child) {\n return child.id === id;\n }, state);\n if (index === -1) return;\n state.remove(index);\n }\n };\n}\n\nexport { createRowsPlugin };\n\n","import { child } from '@edtr-io/plugin';\nimport { createElement } from 'react';\n\nfunction BlockquoteRenderer(props) {\n return createElement(\"blockquote\", null, props.state.render());\n}\n\n/**\r\n * @param config - {@link BlockquoteConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createBlockquotePlugin(config) {\n return {\n Component: BlockquoteRenderer,\n config: {},\n state: createState()\n };\n\n function createState() {\n return child(config.content);\n }\n}\n\nexport { createBlockquotePlugin };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport { createElement, Component } from 'react';\nimport { oneOfType, func, shape, any, number, object, bool, string } from 'prop-types';\n\nvar isIE = !!document.documentElement.currentStyle ;\nvar HIDDEN_TEXTAREA_STYLE = {\n 'min-height': '0',\n 'max-height': 'none',\n height: '0',\n visibility: 'hidden',\n overflow: 'hidden',\n position: 'absolute',\n 'z-index': '-1000',\n top: '0',\n right: '0'\n};\nvar SIZING_STYLE = ['letter-spacing', 'line-height', 'font-family', 'font-weight', 'font-size', 'font-style', 'tab-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', 'box-sizing'];\nvar computedStyleCache = {};\nvar hiddenTextarea = document.createElement('textarea');\n\nvar forceHiddenStyles = function forceHiddenStyles(node) {\n Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {\n node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');\n });\n};\n\n{\n hiddenTextarea.setAttribute('tab-index', '-1');\n hiddenTextarea.setAttribute('aria-hidden', 'true');\n forceHiddenStyles(hiddenTextarea);\n}\n\nfunction calculateNodeHeight(uiTextNode, uid, useCache, minRows, maxRows) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (minRows === void 0) {\n minRows = null;\n }\n\n if (maxRows === void 0) {\n maxRows = null;\n }\n\n if (hiddenTextarea.parentNode === null) {\n document.body.appendChild(hiddenTextarea);\n } // Copy all CSS properties that have an impact on the height of the content in\n // the textbox\n\n\n var nodeStyling = calculateNodeStyling(uiTextNode, uid, useCache);\n\n if (nodeStyling === null) {\n return null;\n }\n\n var paddingSize = nodeStyling.paddingSize,\n borderSize = nodeStyling.borderSize,\n boxSizing = nodeStyling.boxSizing,\n sizingStyle = nodeStyling.sizingStyle; // Need to have the overflow attribute to hide the scrollbar otherwise\n // text-lines will not calculated properly as the shadow will technically be\n // narrower for content\n\n Object.keys(sizingStyle).forEach(function (key) {\n hiddenTextarea.style[key] = sizingStyle[key];\n });\n forceHiddenStyles(hiddenTextarea);\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || 'x';\n var minHeight = -Infinity;\n var maxHeight = Infinity;\n var height = hiddenTextarea.scrollHeight;\n\n if (boxSizing === 'border-box') {\n // border-box: add border, since height = content + padding + border\n height = height + borderSize;\n } else if (boxSizing === 'content-box') {\n // remove padding, since height = content\n height = height - paddingSize;\n } // measure height of a textarea with a single row\n\n\n hiddenTextarea.value = 'x';\n var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; // Stores the value's rows count rendered in `hiddenTextarea`,\n // regardless if `maxRows` or `minRows` props are passed\n\n var valueRowCount = Math.floor(height / singleRowHeight);\n\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows;\n\n if (boxSizing === 'border-box') {\n minHeight = minHeight + paddingSize + borderSize;\n }\n\n height = Math.max(minHeight, height);\n }\n\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows;\n\n if (boxSizing === 'border-box') {\n maxHeight = maxHeight + paddingSize + borderSize;\n }\n\n height = Math.min(maxHeight, height);\n }\n\n var rowCount = Math.floor(height / singleRowHeight);\n return {\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight,\n rowCount: rowCount,\n valueRowCount: valueRowCount\n };\n}\n\nfunction calculateNodeStyling(node, uid, useCache) {\n if (useCache === void 0) {\n useCache = false;\n }\n\n if (useCache && computedStyleCache[uid]) {\n return computedStyleCache[uid];\n }\n\n var style = window.getComputedStyle(node);\n\n if (style === null) {\n return null;\n }\n\n var sizingStyle = SIZING_STYLE.reduce(function (obj, name) {\n obj[name] = style.getPropertyValue(name);\n return obj;\n }, {});\n var boxSizing = sizingStyle['box-sizing']; // probably node is detached from DOM, can't read computed dimensions\n\n if (boxSizing === '') {\n return null;\n } // IE (Edge has already correct behaviour) returns content width as computed width\n // so we need to add manually padding and border widths\n\n\n if (isIE && boxSizing === 'border-box') {\n sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(style['border-right-width']) + parseFloat(style['border-left-width']) + parseFloat(style['padding-right']) + parseFloat(style['padding-left']) + 'px';\n }\n\n var paddingSize = parseFloat(sizingStyle['padding-bottom']) + parseFloat(sizingStyle['padding-top']);\n var borderSize = parseFloat(sizingStyle['border-bottom-width']) + parseFloat(sizingStyle['border-top-width']);\n var nodeInfo = {\n sizingStyle: sizingStyle,\n paddingSize: paddingSize,\n borderSize: borderSize,\n boxSizing: boxSizing\n };\n\n if (useCache) {\n computedStyleCache[uid] = nodeInfo;\n }\n\n return nodeInfo;\n}\n\nvar purgeCache = function purgeCache(uid) {\n delete computedStyleCache[uid];\n};\n\nvar noop = function noop() {};\n\nvar uid = 0;\n\nvar TextareaAutosize =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inheritsLoose(TextareaAutosize, _React$Component);\n\n function TextareaAutosize(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n\n _this._onRef = function (node) {\n _this._ref = node;\n var inputRef = _this.props.inputRef;\n\n if (typeof inputRef === 'function') {\n inputRef(node);\n return;\n }\n\n inputRef.current = node;\n };\n\n _this._onChange = function (event) {\n if (!_this._controlled) {\n _this._resizeComponent();\n }\n\n _this.props.onChange(event, _assertThisInitialized(_this));\n };\n\n _this._resizeComponent = function (callback) {\n if (callback === void 0) {\n callback = noop;\n }\n\n var nodeHeight = calculateNodeHeight(_this._ref, _this._uid, _this.props.useCacheForDOMMeasurements, _this.props.minRows, _this.props.maxRows);\n\n if (nodeHeight === null) {\n callback();\n return;\n }\n\n var height = nodeHeight.height,\n minHeight = nodeHeight.minHeight,\n maxHeight = nodeHeight.maxHeight,\n rowCount = nodeHeight.rowCount,\n valueRowCount = nodeHeight.valueRowCount;\n _this.rowCount = rowCount;\n _this.valueRowCount = valueRowCount;\n\n if (_this.state.height !== height || _this.state.minHeight !== minHeight || _this.state.maxHeight !== maxHeight) {\n _this.setState({\n height: height,\n minHeight: minHeight,\n maxHeight: maxHeight\n }, callback);\n\n return;\n }\n\n callback();\n };\n\n _this.state = {\n height: props.style && props.style.height || 0,\n minHeight: -Infinity,\n maxHeight: Infinity\n };\n _this._uid = uid++;\n _this._controlled = props.value !== undefined;\n _this._resizeLock = false;\n return _this;\n }\n\n var _proto = TextareaAutosize.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n _inputRef = _this$props.inputRef,\n _maxRows = _this$props.maxRows,\n _minRows = _this$props.minRows,\n _onHeightChange = _this$props.onHeightChange,\n _useCacheForDOMMeasurements = _this$props.useCacheForDOMMeasurements,\n props = _objectWithoutPropertiesLoose(_this$props, [\"inputRef\", \"maxRows\", \"minRows\", \"onHeightChange\", \"useCacheForDOMMeasurements\"]);\n\n props.style = _extends({}, props.style, {\n height: this.state.height\n });\n var maxHeight = Math.max(props.style.maxHeight || Infinity, this.state.maxHeight);\n\n if (maxHeight < this.state.height) {\n props.style.overflow = 'hidden';\n }\n\n return createElement(\"textarea\", _extends({}, props, {\n onChange: this._onChange,\n ref: this._onRef\n }));\n };\n\n _proto.componentDidMount = function componentDidMount() {\n var _this2 = this;\n\n this._resizeComponent(); // Working around Firefox bug which runs resize listeners even when other JS is running at the same moment\n // causing competing rerenders (due to setState in the listener) in React.\n // More can be found here - facebook/react#6324\n\n\n this._resizeListener = function () {\n if (_this2._resizeLock) {\n return;\n }\n\n _this2._resizeLock = true;\n\n _this2._resizeComponent(function () {\n _this2._resizeLock = false;\n });\n };\n\n window.addEventListener('resize', this._resizeListener);\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (prevProps !== this.props) {\n this._resizeComponent();\n }\n\n if (this.state.height !== prevState.height) {\n this.props.onHeightChange(this.state.height, this);\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n window.removeEventListener('resize', this._resizeListener);\n purgeCache(this._uid);\n };\n\n return TextareaAutosize;\n}(Component);\n\nTextareaAutosize.defaultProps = {\n inputRef: noop,\n onChange: noop,\n onHeightChange: noop,\n useCacheForDOMMeasurements: false\n};\nprocess.env.NODE_ENV !== \"production\" ? TextareaAutosize.propTypes = {\n inputRef: oneOfType([func, shape({\n current: any\n })]),\n maxRows: number,\n minRows: number,\n onChange: func,\n onHeightChange: func,\n style: object,\n useCacheForDOMMeasurements: bool,\n value: string\n} : void 0;\n\nexport default TextareaAutosize;\n","import { styled, useEditorUiTheme, Icon, faPlus, faTimes } from '@edtr-io/ui';\nexport { styled } from '@edtr-io/ui';\nimport { createElement, Component, forwardRef, useState, useCallback, useEffect } from 'react';\nimport { IgnoreKeys, useScope, ScopeContext } from '@edtr-io/core';\nimport TextareaAutosize from 'react-textarea-autosize';\n\n/** @public */\n\nvar EditorBottomToolbar = /*#__PURE__*/styled.div(function () {\n var theme = useEditorUiTheme('bottomToolbar', function (theme) {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color\n };\n });\n return {\n boxShadow: '0 2px 4px 0 rgba(0,0,0,0.50)',\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderRadius: '4px',\n position: 'fixed',\n left: '50%',\n transform: 'translate(-50%,-50%)',\n bottom: '0',\n zIndex: 90,\n whiteSpace: 'nowrap'\n };\n});\n\n/** @public */\n\nvar EditorButton = /*#__PURE__*/styled.button(function () {\n var theme = useEditorUiTheme('button', function (theme) {\n return {\n backgroundColor: theme.backgroundColor,\n color: theme.color,\n borderColor: theme.color,\n hoverBackgroundColor: 'rgba(0,0,0,0.50)',\n hoverColor: theme.primary.background,\n hoverBorderColor: theme.primary.background\n };\n });\n return {\n margin: '3px',\n backgroundColor: theme.backgroundColor,\n outline: 'none',\n border: 'none',\n boxShadow: '0 1px 2px 0 rgba(0,0,0,0.50)',\n color: theme.color,\n borderRadius: '4px',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: theme.hoverBackgroundColor,\n color: theme.hoverColor,\n borderColor: theme.hoverBorderColor\n }\n };\n});\n\nvar useEditorCheckboxTheme = function useEditorCheckboxTheme() {\n return useEditorUiTheme('checkbox', function (theme) {\n return {\n boxSelectedColor: theme.backgroundColor,\n boxDeselectedColor: 'transparent',\n color: theme.backgroundColor\n };\n });\n};\n\nvar Container = /*#__PURE__*/styled.label(function () {\n var theme = useEditorCheckboxTheme();\n return {\n color: theme.color\n };\n});\nvar ToggleContainer = /*#__PURE__*/styled.div(function () {\n var theme = useEditorCheckboxTheme();\n return {\n cursor: 'pointer',\n margin: '0 5px -1px 5px',\n border: \"2px solid \" + theme.color,\n borderRadius: '15%',\n width: '15px',\n height: '15px',\n display: 'inline-block',\n backgroundColor: theme.boxDeselectedColor\n };\n});\nvar Label = /*#__PURE__*/styled.span({\n width: '5%'\n});\nvar Toggle = /*#__PURE__*/styled.div(function (_ref) {\n var value = _ref.value;\n var theme = useEditorCheckboxTheme();\n return {\n opacity: value ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n margin: '3px 0 0 2px',\n width: '10px',\n height: '5px',\n border: \"2px solid \" + theme.boxSelectedColor,\n borderTop: 'none',\n borderRight: 'none',\n transform: 'rotate(-45deg)',\n zIndex: 1000\n };\n});\n/** @public */\n\nfunction EditorCheckbox(_ref2) {\n var checked = _ref2.checked,\n onChange = _ref2.onChange,\n label = _ref2.label;\n return createElement(Container, null, createElement(Label, null, label), \"=\", createElement(ToggleContainer, {\n onClick: function onClick() {\n if (onChange) {\n onChange(!checked);\n }\n }\n }, createElement(Toggle, {\n value: checked\n })));\n}\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nvar AddButtonComponent = /*#__PURE__*/styled.button({\n margin: '5px 2% 5px 2%',\n width: '96%',\n borderRadius: '10px',\n backgroundColor: 'white',\n textAlign: 'left',\n color: 'lightgrey',\n minHeight: '50px',\n border: '2px solid lightgrey',\n outline: 'none',\n '&:hover': {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }\n});\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction AddButton(props) {\n return createElement(AddButtonComponent, {\n title: props.title,\n onMouseDown: props.onClick\n }, createElement(Icon, {\n icon: faPlus\n }), \" \", props.children);\n}\nvar AnswerContainer = /*#__PURE__*/styled.div({\n marginBottom: '10px',\n display: 'flex',\n alignItems: 'center'\n});\nvar CheckboxContainer = /*#__PURE__*/styled.div({\n width: '10%',\n textAlign: 'center',\n marginRight: '10px',\n fontWeight: 'bold'\n});\nvar RemoveButton = /*#__PURE__*/styled.button({\n borderRadius: '50%',\n outline: 'none',\n background: 'white',\n zIndex: 20,\n \"float\": 'right',\n transform: 'translate(50%, -40%)',\n '&:hover': {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }\n});\nvar FeedbackField = /*#__PURE__*/styled.div({\n paddingLeft: '20px',\n paddingBottom: '10px',\n paddingTop: '10px',\n marginTop: '5px'\n});\nvar FramedContainer = /*#__PURE__*/styled.div(function (_ref) {\n var _defaultBorders, _focusedBorders;\n\n var focused = _ref.focused;\n var defaultBorders = (_defaultBorders = {\n border: '2px solid lightgrey'\n }, _defaultBorders[\"\" + RemoveButton] = {\n border: '2px solid lightgrey',\n color: 'lightgrey'\n }, _defaultBorders[\"\" + FeedbackField] = {\n borderTop: '2px solid lightgrey'\n }, _defaultBorders);\n var focusedBorders = (_focusedBorders = {\n border: '3px solid #007ec1'\n }, _focusedBorders[\"\" + RemoveButton] = {\n border: '3px solid #007ec1',\n color: '#007ec1'\n }, _focusedBorders[\"\" + FeedbackField] = {\n borderTop: '2px solid #007ec1'\n }, _focusedBorders);\n return _extends({\n width: '100%',\n marginLeft: '10px',\n borderRadius: '10px'\n }, focused ? focusedBorders : defaultBorders, {\n '&:focus-within': focusedBorders\n });\n});\nvar AnswerField = /*#__PURE__*/styled.div({\n paddingLeft: '20px',\n paddingTop: '10px'\n});\nvar Container$1 = /*#__PURE__*/styled.div(function (_ref2) {\n var isRadio = _ref2.isRadio,\n checked = _ref2.checked;\n return {\n cursor: 'pointer',\n border: checked ? isRadio ? '5px solid #007ec1' : '2px solid #007ec1' : '2px solid lightgray',\n borderRadius: isRadio ? '50%' : '15%',\n width: '20px',\n height: '20px',\n display: 'inline-block',\n verticalAlign: 'middle',\n backgroundColor: checked && !isRadio ? '#007ec1' : 'white'\n };\n});\nvar Tick = /*#__PURE__*/styled.div(function (_ref3) {\n var checked = _ref3.checked;\n return {\n opacity: checked ? 1 : 0,\n content: '',\n position: 'absolute',\n fontWeight: 'bold',\n width: '15px',\n height: '10px',\n border: '3px solid white',\n borderTop: 'none',\n borderRight: 'none',\n borderRadius: '2px',\n zIndex: 10,\n transform: 'rotate(-45deg)'\n };\n});\n/** @internal */\n\nvar CheckElement = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(CheckElement, _React$Component);\n\n function CheckElement() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = CheckElement.prototype;\n\n _proto.render = function render() {\n var _this$props = this.props,\n isRadio = _this$props.isRadio,\n isActive = _this$props.isActive,\n handleChange = _this$props.handleChange;\n return createElement(Container$1, {\n isRadio: isRadio,\n checked: isActive,\n onClick: function onClick(e) {\n handleChange(e);\n }\n }, isRadio ? null : createElement(Tick, {\n checked: isActive\n }));\n };\n\n return CheckElement;\n}(Component);\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction InteractiveAnswer(props) {\n return createElement(AnswerContainer, null, createElement(CheckboxContainer, null, \"Richtig?\", createElement(CheckElement, {\n isRadio: props.isRadio || false,\n isActive: props.isActive || false,\n handleChange: props.handleChange\n })), createElement(FramedContainer, {\n focused: props.answerID === props.focusedElement || props.feedbackID === props.focusedElement\n }, createElement(AnswerField, null, props.answer), createElement(RemoveButton, {\n onClick: props.remove\n }, createElement(Icon, {\n icon: faTimes\n })), createElement(FeedbackField, null, props.feedback)));\n}\n\nfunction useEditorInputTheme() {\n return useEditorUiTheme('input', function (theme) {\n return {\n color: theme.backgroundColor,\n backgroundColor: 'transparent',\n highlightColor: theme.primary.background\n };\n });\n}\n\nvar Label$1 = /*#__PURE__*/styled.label(function (_ref) {\n var width = _ref.width;\n var theme = useEditorInputTheme();\n return {\n width: width,\n color: theme.color\n };\n});\nvar Input = /*#__PURE__*/styled.input(function (_ref2) {\n var textWidth = _ref2.textWidth;\n var theme = useEditorInputTheme();\n return {\n backgroundColor: theme.backgroundColor,\n border: 'none',\n width: textWidth,\n borderBottom: \"2px solid \" + theme.color,\n color: theme.color,\n paddingLeft: '10px',\n '&:focus': {\n outline: 'none',\n borderBottom: \"2px solid \" + theme.highlightColor\n }\n };\n});\n/** @public */\n\nvar EditorInput = /*#__PURE__*/forwardRef(function EditorInput(_ref3, ref) {\n var label = _ref3.label,\n props = _objectWithoutPropertiesLoose(_ref3, [\"label\"]);\n\n return createElement(Label$1, {\n width: props.width\n }, label ? label + \":\" : '', createElement(Input, Object.assign({\n textWidth: props.inputWidth\n }, props, {\n ref: ref\n })));\n});\n\n/** @public */\n\nvar EditorInlineSettings = /*#__PURE__*/styled.div({\n marginTop: '15px'\n});\n\nvar Textarea = /*#__PURE__*/styled(TextareaAutosize)({\n minHeight: '100px',\n width: '100%',\n margin: 'auto',\n padding: '10px',\n resize: 'none',\n fontFamily: 'Menlo, Monaco, \"Courier New\", monospace',\n border: 'none',\n outline: 'none',\n boxShadow: '0 1px 1px 0 rgba(0,0,0,0.50)',\n '&::-webkit-input-placeholder': {\n color: 'rgba(0,0,0,0.5)'\n }\n});\nvar StyledIgnoreKeys = /*#__PURE__*/styled(IgnoreKeys)({\n width: '100%'\n});\n/** @public */\n\nvar EditorTextarea = /*#__PURE__*/forwardRef(function EditorTextarea(props, ref) {\n return createElement(StyledIgnoreKeys, {\n except: ['up', 'down']\n }, createElement(Textarea, Object.assign({}, props, {\n inputRef: ref || undefined,\n onKeyDown: function onKeyDown(e) {\n if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') {\n return;\n }\n\n if (ref && typeof ref !== 'function' && ref.current) {\n var _ref$current = ref.current,\n selectionStart = _ref$current.selectionStart,\n selectionEnd = _ref$current.selectionEnd,\n value = _ref$current.value;\n\n if (selectionStart !== selectionEnd) {\n return;\n }\n\n if (e.key === 'ArrowUp' && selectionStart !== 0) {\n e.stopPropagation();\n }\n\n if (e.key === 'ArrowDown' && selectionStart !== value.length) {\n e.stopPropagation();\n }\n }\n }\n })));\n});\n\nvar NoClickArea = /*#__PURE__*/styled.div(function (props) {\n return {\n pointerEvents: props.active ? 'unset' : 'none',\n position: 'relative'\n };\n});\nvar Overlay = /*#__PURE__*/styled.div(function (props) {\n return {\n display: props.active ? 'none' : undefined,\n position: 'absolute',\n width: '100%',\n height: '100%',\n top: 0,\n backgroundColor: props.blur ? 'rgba(255,255,255,0.8)' : undefined,\n zIndex: 10\n };\n});\nvar ButtonWrapper = /*#__PURE__*/styled.div({\n width: '100%',\n height: '100%',\n textAlign: 'center',\n display: 'flex'\n});\nvar ActivateButton = /*#__PURE__*/styled.button({\n pointerEvents: 'all',\n color: 'white',\n border: 'none',\n borderRadius: '5px',\n padding: '2px 10px',\n textAlign: 'center',\n outline: 'none',\n backgroundColor: 'rgb(0,126,193)',\n zIndex: 10,\n margin: 'auto'\n});\n/**\r\n * @param props - Props\r\n * @internal\r\n */\n\nfunction PreviewOverlay(props) {\n var _React$useState = useState(false),\n active = _React$useState[0],\n setActiveState = _React$useState[1];\n\n var scope = useScope();\n var onChange = props.onChange;\n var setActive = useCallback(function (active) {\n if (typeof onChange === 'function') {\n onChange(active);\n }\n\n setActiveState(active);\n }, [onChange]);\n useEffect(function () {\n if (!props.focused && active) {\n setActive(false);\n }\n }, [props.focused, active, setActive]);\n return createElement(NoClickArea, {\n active: active\n }, createElement(Overlay, {\n blur: props.focused,\n active: active\n }, props.focused ? createElement(ButtonWrapper, null, createElement(ActivateButton, {\n onClick: function onClick() {\n setActive(true);\n }\n }, \"Aktivieren\")) : null), !props.editable ? createElement(ScopeContext.Provider, {\n value: {\n scope: scope,\n editable: false\n }\n }, props.children) : props.children, active ? createElement(ButtonWrapper, null, createElement(ActivateButton, {\n onClick: function onClick() {\n setActive(false);\n }\n }, \"Editieren\")) : null);\n}\n\nexport { AddButton, CheckElement, EditorBottomToolbar, EditorButton, EditorCheckbox, EditorInlineSettings, EditorInput, EditorTextarea, InteractiveAnswer, PreviewOverlay };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { faSortDown, faSortUp, styled, useRendererUiTheme, Icon, faSmile, faCheckCircle } from '@edtr-io/ui';\nexport { styled } from '@edtr-io/ui';\nimport { useState, createElement, Fragment, Component } from 'react';\n\nfunction useExpandableBoxTheme() {\n return useRendererUiTheme('expandableBox', function (theme) {\n return {\n containerBorderColor: 'transparent',\n toggleBackgroundColor: theme.primary.background,\n toggleBorderColor: 'transparent',\n toggleColor: theme.primary.background\n };\n });\n}\n\nvar Container = /*#__PURE__*/styled.div(function (_ref) {\n var collapsed = _ref.collapsed;\n return {\n borderRadius: '5px',\n boxShadow: \"0 5px 5px rgba(0, 0, 0, \" + (collapsed ? 0 : 0.05) + \")\"\n };\n});\nvar Toggle = /*#__PURE__*/styled.div(function (_ref2) {\n var collapsed = _ref2.collapsed,\n editable = _ref2.editable,\n alwaysVisible = _ref2.alwaysVisible;\n\n var _useExpandableBoxThem = useExpandableBoxTheme(),\n toggleBackgroundColor = _useExpandableBoxThem.toggleBackgroundColor,\n toggleColor = _useExpandableBoxThem.toggleColor;\n\n return {\n backgroundColor: alwaysVisible || !collapsed ? toggleBackgroundColor : 'transparent',\n '& a': {\n color: toggleColor\n },\n padding: '10px 15px 10px 10px',\n marginBottom: '10px',\n position: 'relative',\n textAlign: 'left',\n borderRadius: alwaysVisible && collapsed ? '5px' : undefined,\n borderTopLeftRadius: '5px',\n borderTopRightRadius: '5px',\n cursor: editable ? undefined : 'pointer'\n };\n});\nvar Content = /*#__PURE__*/styled.div(function (_ref3) {\n var collapsed = _ref3.collapsed;\n return {\n display: collapsed ? 'none' : 'block',\n position: 'relative',\n padding: '5px 0'\n };\n});\nvar ToggleIcon = /*#__PURE__*/styled(Icon)(function (_ref4) {\n var collapsed = _ref4.collapsed;\n\n var _useExpandableBoxThem2 = useExpandableBoxTheme(),\n toggleColor = _useExpandableBoxThem2.toggleColor;\n\n return {\n marginRight: '10px',\n marginBottom: collapsed ? '3px' : '-3px',\n color: toggleColor\n };\n});\n/** @public */\n\nfunction ExpandableBox(_ref5) {\n var children = _ref5.children,\n editable = _ref5.editable,\n alwaysVisible = _ref5.alwaysVisible,\n renderTitle = _ref5.renderTitle;\n\n var _React$useState = useState(!editable),\n collapsed = _React$useState[0],\n setCollapsed = _React$useState[1];\n\n return createElement(Container, {\n collapsed: collapsed\n }, createElement(Toggle, {\n editable: editable,\n alwaysVisible: alwaysVisible,\n collapsed: collapsed,\n onClick: function onClick() {\n setCollapsed(!collapsed);\n }\n }, createElement(Fragment, null, createElement(ToggleIcon, {\n collapsed: collapsed,\n icon: collapsed ? faSortDown : faSortUp\n }), createElement(\"a\", null, renderTitle(collapsed)))), createElement(Content, {\n collapsed: collapsed\n }, children));\n}\n\nvar ContainerWithBox = /*#__PURE__*/styled.div({\n backgroundColor: '#fcf8e3',\n borderColor: '#faebcc',\n color: '#8a6d3b',\n padding: '15px'\n});\nvar ContainerWithoutBox = /*#__PURE__*/styled.div(function (_ref) {\n var correct = _ref.correct,\n showOnLeft = _ref.showOnLeft;\n return {\n color: correct ? '#95bc1a' : '#f7b07c',\n fontWeight: 'bold',\n textAlign: showOnLeft ? 'left' : 'right'\n };\n});\n/** @internal */\n\nfunction Feedback(_ref2) {\n var boxFree = _ref2.boxFree,\n children = _ref2.children,\n isTrueAnswer = _ref2.isTrueAnswer,\n showOnLeft = _ref2.showOnLeft;\n var Container = boxFree ? ContainerWithoutBox : ContainerWithBox;\n return createElement(Container, {\n correct: isTrueAnswer,\n showOnLeft: showOnLeft\n }, children);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\n/** @internal */\n\nvar ExerciseState;\n\n(function (ExerciseState) {\n ExerciseState[ExerciseState[\"Default\"] = 1] = \"Default\";\n ExerciseState[ExerciseState[\"SolvedRight\"] = 2] = \"SolvedRight\";\n ExerciseState[ExerciseState[\"SolvedWrong\"] = 3] = \"SolvedWrong\";\n})(ExerciseState || (ExerciseState = {}));\n\nfunction useSubmitButtonTheme() {\n return useRendererUiTheme('submitButton', function (theme) {\n return {\n backgroundColor: '#337ab7',\n hoverBackgroundColor: '#d9edf7',\n color: theme.backgroundColor,\n correctBackgroundColor: theme.success.background,\n wrongBackgroundColor: theme.danger.background\n };\n });\n}\n\nvar getBackgroundColor = function getBackgroundColor(theme, exerciseState) {\n switch (exerciseState) {\n case ExerciseState.Default:\n {\n return theme.backgroundColor;\n }\n\n case ExerciseState.SolvedRight:\n {\n return theme.correctBackgroundColor;\n }\n\n case ExerciseState.SolvedWrong:\n {\n return theme.wrongBackgroundColor;\n }\n }\n};\n\nvar SubmitButtonComponent = /*#__PURE__*/styled.button(function (_ref) {\n var exerciseState = _ref.exerciseState;\n var theme = useSubmitButtonTheme();\n return {\n \"float\": 'right',\n margin: '10px 0px',\n border: 'none',\n padding: '3px',\n backgroundColor: getBackgroundColor(theme, exerciseState),\n color: theme.color,\n transition: 'background-color .5s ease',\n outline: 'none',\n '&hover': {\n backgroundColor: theme.hoverBackgroundColor\n }\n };\n});\n/** @internal */\n\nvar SubmitButton = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(SubmitButton, _React$Component);\n\n function SubmitButton() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = SubmitButton.prototype;\n\n _proto.render = function render() {\n return createElement(SubmitButtonComponent, {\n exerciseState: this.props.exerciseState,\n onClick: this.props.onClick\n }, this.props.exerciseState === ExerciseState.SolvedRight ? createElement(\"span\", null, createElement(Icon, {\n icon: faSmile\n }), \"Stimmt!\") : createElement(\"span\", null, createElement(Icon, {\n icon: faCheckCircle\n }), \"Stimmt\\u2019s?\"));\n };\n\n return SubmitButton;\n}(Component);\n\nexport { ExerciseState, ExpandableBox, Feedback, SubmitButton };\n\n","import StyledComponents__default, { ThemeContext as ThemeContext$1, ThemeProvider as ThemeProvider$1 } from 'styled-components';\nimport { mergeDeepRight, pick } from 'ramda';\nimport { useContext, createElement, useMemo } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nexport { faFileDownload } from '@fortawesome/free-solid-svg-icons/faFileDownload';\nexport { faFileArchive } from '@fortawesome/free-solid-svg-icons/faFileArchive';\nexport { faFileAudio } from '@fortawesome/free-solid-svg-icons/faFileAudio';\nexport { faCheckCircle } from '@fortawesome/free-solid-svg-icons/faCheckCircle';\nexport { faFileExcel } from '@fortawesome/free-solid-svg-icons/faFileExcel';\nexport { faFileImage } from '@fortawesome/free-solid-svg-icons/faFileImage';\nexport { faFilePdf } from '@fortawesome/free-solid-svg-icons/faFilePdf';\nexport { faSmile } from '@fortawesome/free-solid-svg-icons/faSmile';\nexport { faFileWord } from '@fortawesome/free-solid-svg-icons/faFileWord';\nexport { faFileVideo } from '@fortawesome/free-solid-svg-icons/faFileVideo';\nexport { faFilePowerpoint } from '@fortawesome/free-solid-svg-icons/faFilePowerpoint';\nexport { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';\nexport { faCut } from '@fortawesome/free-solid-svg-icons/faCut';\nexport { faCog } from '@fortawesome/free-solid-svg-icons/faCog';\nexport { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy';\nexport { faFileAlt } from '@fortawesome/free-solid-svg-icons/faFileAlt';\nexport { faImages } from '@fortawesome/free-solid-svg-icons/faImages';\nexport { faPhotoVideo } from '@fortawesome/free-solid-svg-icons/faPhotoVideo';\nexport { faLink } from '@fortawesome/free-solid-svg-icons/faLink';\nexport { faMinus } from '@fortawesome/free-solid-svg-icons/faMinus';\nexport { faPaste } from '@fortawesome/free-solid-svg-icons/faPaste';\nexport { faPencilAlt } from '@fortawesome/free-solid-svg-icons/faPencilAlt';\nexport { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';\nexport { faSpinner } from '@fortawesome/free-solid-svg-icons/faSpinner';\nexport { faTable } from '@fortawesome/free-solid-svg-icons/faTable';\nexport { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';\nexport { faTrashAlt } from '@fortawesome/free-solid-svg-icons/faTrashAlt';\nexport { faFilm } from '@fortawesome/free-solid-svg-icons/faFilm';\nexport { faCaretSquareUp } from '@fortawesome/free-solid-svg-icons/faCaretSquareUp';\nexport { faCaretSquareDown } from '@fortawesome/free-solid-svg-icons/faCaretSquareDown';\nexport { faSortUp } from '@fortawesome/free-solid-svg-icons/faSortUp';\nexport { faSortDown } from '@fortawesome/free-solid-svg-icons/faSortDown';\nexport { faToolbox } from '@fortawesome/free-solid-svg-icons/faToolbox';\nexport { faEllipsisH } from '@fortawesome/free-solid-svg-icons/faEllipsisH';\nexport { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';\nexport { faCloudUploadAlt } from '@fortawesome/free-solid-svg-icons/faCloudUploadAlt';\nexport { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle';\nexport { faAnchor } from '@fortawesome/free-solid-svg-icons/faAnchor';\nexport { faQuoteRight } from '@fortawesome/free-solid-svg-icons/faQuoteRight';\nexport { faEquals } from '@fortawesome/free-solid-svg-icons/faEquals';\nexport { faCubes } from '@fortawesome/free-solid-svg-icons/faCubes';\nexport { faCode } from '@fortawesome/free-solid-svg-icons/faCode';\nexport { faLightbulb } from '@fortawesome/free-solid-svg-icons/faLightbulb';\nexport { faKeyboard } from '@fortawesome/free-solid-svg-icons/faKeyboard';\nexport { faDotCircle } from '@fortawesome/free-solid-svg-icons/faDotCircle';\nexport { faCheckSquare } from '@fortawesome/free-solid-svg-icons/faCheckSquare';\nexport { faParagraph } from '@fortawesome/free-solid-svg-icons/faParagraph';\nexport { faRedoAlt } from '@fortawesome/free-solid-svg-icons/faRedoAlt';\nexport { faRandom } from '@fortawesome/free-solid-svg-icons/faRandom';\nexport { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons/faExternalLinkAlt';\nexport { faNewspaper } from '@fortawesome/free-solid-svg-icons/faNewspaper';\n\n/** @public */\n\nvar defaultEditorTheme = {\n primary: {\n color: '#ffffff',\n background: 'rgb(70, 155, 255)'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n },\n color: '#EEEEEE',\n backgroundColor: 'rgba(51,51,51,0.95)'\n};\n/**\r\n * React Hook for the editor theming\r\n *\r\n * @returns An object containing the current {@link EditorTheme | editor theme} and {@link EditorUiTheme | editor UI theme}\r\n * @public\r\n */\n\nfunction useEditorTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link EditorThemeProps} to the current theme of the specified editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link EditorThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createEditorUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.editor), theme.editorUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of an editor UI component\r\n *\r\n * @param key - The editor UI component\r\n * @param createDefaultTheme - The {@link EditorUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useEditorUiTheme(key, createDefaultTheme) {\n var theme = useEditorTheme();\n return createEditorUiTheme(key, createDefaultTheme)(theme);\n}\n\n/**\r\n * Font Awesome Icon component\r\n *\r\n * @param props - Most of {@link https://github.com/FortAwesome/react-fontawesome | FontAwesomeIconProps}\r\n * @public\r\n */\n\nfunction Icon(props) {\n var allowedProps = pick(['icon', 'mask', 'className', 'color', 'spin', 'pulse', 'border', 'fixedWidth', 'inverse', 'listItem', 'flip', 'size', 'pull', 'rotation', 'transform', 'symbol', 'style', 'tabIndex', 'title'], props);\n return createElement(FontAwesomeIcon, Object.assign({}, allowedProps));\n}\n/**\r\n * Creates an icon component\r\n *\r\n * @param i - The icon to use\r\n * @returns A component for the specified icon\r\n * @public\r\n */\n\nfunction createIcon(i) {\n return function I() {\n return createElement(Icon, {\n icon: i,\n size: \"4x\"\n });\n };\n}\nvar EdtrSVG = /*#__PURE__*/StyledComponents__default.svg({\n display: 'inline-block',\n verticalAlign: 'middle',\n overflow: 'hidden'\n});\n/**\r\n * Edtr.io icon component\r\n *\r\n * @param props - An Edtr.io icon definition and an optional className\r\n * @returns The icon\r\n * @public\r\n */\n\nfunction EdtrIcon(props) {\n return createElement(EdtrSVG, {\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n className: props.className\n }, createElement(\"path\", {\n fill: \"currentcolor\",\n d: props.icon\n }));\n}\n/** @public */\n\nvar edtrAlignBlock = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignCenter = 'M7 16c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zm-3 5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm3-5c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignRight = 'M4 21h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zm-6-4h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm6-4h10c.55 0 1-.45 1-1s-.45-1-1-1H10c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrAlignLeft = 'M14 15H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zm0-8H4c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1zM4 13h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0 8h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 4c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrClose = 'M18.3,5.71 C17.91,5.32 17.28,5.32 16.89,5.71 L12,10.59 L7.11,5.7 C6.72,5.31 6.09,5.31 5.7,5.7 C5.31,6.09 5.31,6.72 5.7,7.11 L10.59,12 L5.7,16.89 C5.31,17.28 5.31,17.91 5.7,18.3 C6.09,18.69 6.72,18.69 7.11,18.3 L12,13.41 L16.89,18.3 C17.28,18.69 17.91,18.69 18.3,18.3 C18.69,17.91 18.69,17.28 18.3,16.89 L13.41,12 L18.3,7.11 C18.68,6.73 18.68,6.09 18.3,5.71 Z';\n/** @public */\n\nvar edtrFormula = 'M9.796061,6.84358189 L9.546061,9.73358189 L11.366061,9.73358189 C11.9183457,9.73358189 12.366061,10.1812971 12.366061,10.7335819 L12.366061,10.7335819 C12.366061,11.2858666 11.9183457,11.7335819 11.366061,11.7335819 L9.366061,11.7335819 L8.926061,16.8035819 C8.726061,19.0035819 6.786061,20.6335819 4.586061,20.4335819 C3.95133688,20.3777262 3.21218763,20.0027937 2.36861326,19.3087844 L2.3686112,19.3087869 C1.93754177,18.9541458 1.8755844,18.3172015 2.23022554,17.8861321 C2.25098506,17.8608987 2.27295601,17.8366869 2.296061,17.8135819 L2.296061,17.8135819 C2.68943711,17.4202058 3.31879167,17.3943638 3.74309403,17.7541652 C4.42335978,18.3310001 5.0243456,18.5341427 5.546061,18.3635819 C6.326061,18.1235819 6.876061,17.4335819 6.946061,16.6235819 L7.366061,11.7335819 L5.366061,11.7335819 C4.81377625,11.7335819 4.366061,11.2858666 4.366061,10.7335819 L4.366061,10.7335819 C4.366061,10.1812971 4.81377625,9.73358189 5.366061,9.73358189 L7.546061,9.73358189 L7.816061,6.66358189 C8.006061,4.46358189 9.936061,2.83358189 12.146061,3.01358189 C12.7876823,3.06959645 13.5343235,3.45039469 14.3859845,4.15597662 L14.3859731,4.15599041 C14.8171452,4.51320676 14.8770982,5.1523219 14.5198819,5.58349402 C14.4997127,5.60783893 14.4784158,5.63122712 14.456061,5.65358189 L14.456061,5.65358189 C14.077745,6.03189793 13.4644763,6.03223098 13.0857495,5.65432608 C12.6951429,5.26458609 12.3219165,5.05433484 11.966061,5.02358189 C10.866061,4.92358189 9.896061,5.73358189 9.796061,6.84358189 Z M20.841061,12.6785819 L20.841061,12.6785819 C20.4517003,12.2892211 19.8204217,12.2892211 19.431061,12.6785819 L17.306061,14.8035819 L15.1860786,12.6835995 C14.7931405,12.2906614 14.1567565,12.2884206 13.761061,12.6785819 L13.761061,12.6785819 C13.3689485,13.0652103 13.3645027,13.6965046 13.7511312,14.0886171 C13.7527745,14.0902837 13.7544236,14.0919445 13.7560786,14.0935995 L15.896061,16.2335819 L13.7610785,18.3385997 C13.3717179,18.7224956 13.3672879,19.3493438 13.7511838,19.7387045 C13.7544529,19.7420201 13.7577454,19.7453127 13.761061,19.7485819 L13.761061,19.7485819 C14.1567565,20.1387432 14.7931405,20.1365024 15.1860786,19.7435643 L17.306061,17.6235819 L19.431061,19.7485819 C19.8204217,20.1379426 20.4517003,20.1379426 20.841061,19.7485819 L20.841061,19.7485819 C21.2290435,19.3605994 21.2290435,18.7315555 20.841061,18.343573 C20.8402306,18.3427426 20.8393988,18.3419137 20.8385654,18.3410863 L18.716061,16.2335819 L20.8435477,14.0910599 C21.2319346,13.6999283 21.2308227,13.0683435 20.841061,12.6785819 Z';\n/** @public */\n\nvar edtrText = 'M2.5 5.5C2.5 6.33 3.17 7 4 7h3.5v10.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V7H14c.83 0 1.5-.67 1.5-1.5S14.83 4 14 4H4c-.83 0-1.5.67-1.5 1.5zM20 9h-6c-.83 0-1.5.67-1.5 1.5S13.17 12 14 12h1.5v5.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V12H20c.83 0 1.5-.67 1.5-1.5S20.83 9 20 9z';\n/** @public */\n\nvar edtrLink = 'M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1zm2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1z';\n/** @public */\n\nvar edtrQuote = 'M7.17 17c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94zm10 0c.51 0 .98-.29 1.2-.74l1.42-2.84c.14-.28.21-.58.21-.89V8c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h2l-1.03 2.06c-.45.89.2 1.94 1.2 1.94z';\n/** @public */\n\nvar edtrListNumbered = 'M8 7h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm12 10H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zm0-6H8c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1zM4.5 16h-2c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5h-.5c-.28 0-.5.22-.5.5s.22.5.5.5H4v.5H2.5c-.28 0-.5.22-.5.5s.22.5.5.5h2c.28 0 .5-.22.5-.5v-3c0-.28-.22-.5-.5-.5zm-2-11H3v2.5c0 .28.22.5.5.5s.5-.22.5-.5v-3c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5s.22.5.5.5zm2 5h-2c-.28 0-.5.22-.5.5s.22.5.5.5h1.3l-1.68 1.96c-.08.09-.12.21-.12.32v.22c0 .28.22.5.5.5h2c.28 0 .5-.22.5-.5s-.22-.5-.5-.5H3.2l1.68-1.96c.08-.09.12-.21.12-.32v-.22c0-.28-.22-.5-.5-.5z';\n/** @public */\n\nvar edtrListBullets = 'M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM8 19h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zm0-6h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1s.45 1 1 1zM7 6c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1z';\n/** @public */\n\nvar edtrItalic = 'M10 5.5c0 .83.67 1.5 1.5 1.5h.71l-3.42 8H7.5c-.83 0-1.5.67-1.5 1.5S6.67 18 7.5 18h5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5h-.71l3.42-8h1.29c.83 0 1.5-.67 1.5-1.5S17.33 4 16.5 4h-5c-.83 0-1.5.67-1.5 1.5z';\n/** @public */\n\nvar edtrColorText = 'M10.63 3.93L6.06 15.58c-.27.68.23 1.42.97 1.42.43 0 .82-.27.98-.68L8.87 14h6.25l.87 2.32c.15.41.54.68.98.68.73 0 1.24-.74.97-1.42L13.37 3.93C13.14 3.37 12.6 3 12 3c-.6 0-1.15.37-1.37.93zM9.62 12L12 5.67 14.38 12H9.62z';\n/** @public */\n\nvar edtrFill = 'M16.56 8.94L8.32.7C7.93.31 7.3.31 6.91.7c-.39.39-.39 1.02 0 1.41l1.68 1.68-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z';\n/** @public */\n\nvar edtrBold = 'M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H8c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h5.78c2.07 0 3.96-1.69 3.97-3.77.01-1.53-.85-2.84-2.15-3.44zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z';\n/** @public */\n\nvar edtrPlus = 'M12,2 C6.48,2 2,6.48 2,12 C2,17.52 6.48,22 12,22 C17.52,22 22,17.52 22,12 C22,6.48 17.52,2 12,2 Z M16,13 L13,13 L13,16 C13,16.55 12.55,17 12,17 C11.45,17 11,16.55 11,16 L11,13 L8,13 C7.45,13 7,12.55 7,12 C7,11.45 7.45,11 8,11 L11,11 L11,8 C11,7.45 11.45,7 12,7 C12.55,7 13,7.45 13,8 L13,11 L16,11 C16.55,11 17,11.45 17,12 C17,12.55 16.55,13 16,13 Z';\n/** @public */\n\nvar edtrSearch = 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z';\n/** @public */\n\nvar edtrDefaultPlugin = 'M20.6190476,11.5238095 L19.1904762,11.5238095 L19.1904762,7.71428571 C19.1904762,6.65714286 18.3333333,5.80952381 17.2857143,5.80952381 L13.4761905,5.80952381 L13.4761905,4.38095238 C13.4761905,3.06598869 12.4102018,2 11.0952381,2 C9.78027441,2 8.71428571,3.06598869 8.71428571,4.38095238 L8.71428571,5.80952381 L4.9047619,5.80952381 C3.85279095,5.80952381 3,6.66231476 3,7.71428571 L3,11.3333333 L4.42857143,11.3333333 C5.85714286,11.3333333 7,12.4761905 7,13.9047619 C7,15.3333333 5.85714286,16.4761905 4.42857143,16.4761905 L3,16.4761905 L3,20.0952381 C3,21.147209 3.85279095,22 4.9047619,22 L8.52380952,22 L8.52380952,20.5714286 C8.52380952,19.1428571 9.66666667,18 11.0952381,18 C12.5238095,18 13.6666667,19.1428571 13.6666667,20.5714286 L13.6666667,22 L17.2857143,22 C18.3376852,22 19.1904762,21.147209 19.1904762,20.0952381 L19.1904762,16.2857143 L20.6190476,16.2857143 C21.9340113,16.2857143 23,15.2197256 23,13.9047619 C23,12.5897982 21.9340113,11.5238095 20.6190476,11.5238095 Z';\n/** @public */\n\nvar edtrDragHandle = 'M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z';\n\n/** @public */\n\nvar defaultRendererTheme = {\n backgroundColor: '#ffffff',\n color: '#333333',\n primary: {\n color: '#ffffff',\n background: '#337ab7'\n },\n secondary: {\n color: '#333333',\n background: '#eeeeee'\n },\n success: {\n color: '#ffffff',\n background: '#5cb85c'\n },\n info: {\n color: '#ffffff',\n background: '#5bc0de'\n },\n warning: {\n color: '#ffffff',\n background: '#f0ad4e'\n },\n danger: {\n color: '#ffffff',\n background: '#d9534f'\n }\n};\n/**\r\n * React Hook for the renderer theming\r\n *\r\n * @returns An object containing the current {@link RendererTheme | renderer theme} and {@link RendererUiTheme | renderer UI theme}\r\n * @public\r\n */\n\nfunction useRendererTheme() {\n return useContext(ThemeContext$1);\n}\n/**\r\n * Creates a function that maps {@link RendererThemeProps} to the current theme of the specified renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns A function that accepts {@link RendererThemeProps} and returns the current theme of the specified component\r\n * @public\r\n */\n\nfunction createRendererUiTheme(key, createDefaultTheme) {\n return function (theme) {\n return mergeDeepRight(createDefaultTheme(theme.renderer), theme.rendererUi[key] || {});\n };\n}\n/**\r\n * React Hook for the theme of a renderer UI component\r\n *\r\n * @param key - The renderer UI component\r\n * @param createDefaultTheme - The {@link RendererUiThemeFactory | factory} for the default theme\r\n * @returns The current theme of the specified component\r\n * @public\r\n */\n\nfunction useRendererUiTheme(key, createDefaultTheme) {\n var theme = useRendererTheme();\n return createRendererUiTheme(key, createDefaultTheme)(theme);\n}\n\nvar defaultTheme = {\n editor: defaultEditorTheme,\n editorUi: {},\n renderer: defaultRendererTheme,\n rendererUi: {}\n}; // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to hydrate the context for the {@link Theme | Theme}\r\n *\r\n * @remarks\r\n * You probably don't want to use this component directly since it is already used by the core.\r\n * If you want to override the theme in some plugin, you probably want to use {@link ThemeProvider | ThemeProvider} instead.\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | default Theme}, and children\r\n * @public\r\n */\n\nfunction RootThemeProvider(props) {\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n/**\r\n * Context used for the {@link Theme | Theme}, see also {@link https://styled-components.com/docs/advanced#theming | Theming }\r\n *\r\n * @public\r\n */\n\nvar ThemeContext = ThemeContext$1;\n/**\r\n * React Hook to get the current {@link Theme | Theme}\r\n *\r\n * @returns The current {@link Theme | Theme}\r\n * @public\r\n */\n\nfunction useTheme() {\n return useContext(ThemeContext);\n} // eslint-disable-next-line jsdoc/require-returns\n\n/**\r\n * Provider to override the current {@link Theme | theme}\r\n *\r\n * @param props - A {@link CustomTheme | CustomTheme} that will be deeply merged with the {@link Theme | current Theme}, and children\r\n * @public\r\n */\n\nfunction ThemeProvider(props) {\n var defaultTheme = useTheme();\n var theme = useMemo(function () {\n return mergeDeepRight(defaultTheme, props.theme);\n }, [defaultTheme, props.theme]);\n return createElement(ThemeProvider$1, Object.assign({}, props, {\n theme: theme\n }));\n}\n\n/**\r\n * Provides utils for the User Interface\r\n *\r\n * @packageDocumentation\r\n */\n/**\r\n * Re-export of {@link https://styled-components.com/docs/api#primary | `styled` in `styled-components` }\r\n *\r\n * @public\r\n */\n\nvar styled = StyledComponents__default;\n\nexport { EdtrIcon, Icon, RootThemeProvider, ThemeContext, ThemeProvider, createEditorUiTheme, createIcon, createRendererUiTheme, defaultEditorTheme, defaultRendererTheme, edtrAlignBlock, edtrAlignCenter, edtrAlignLeft, edtrAlignRight, edtrBold, edtrClose, edtrColorText, edtrDefaultPlugin, edtrDragHandle, edtrFill, edtrFormula, edtrItalic, edtrLink, edtrListBullets, edtrListNumbered, edtrPlus, edtrQuote, edtrSearch, edtrText, styled, useEditorTheme, useEditorUiTheme, useRendererTheme, useRendererUiTheme, useTheme };\n\n","import { object, string, child } from '@edtr-io/plugin';\nimport { mergeDeepRight } from 'ramda';\nimport { EditorInput } from '@edtr-io/editor-ui';\nimport { ExpandableBox } from '@edtr-io/renderer-ui';\nimport { ThemeProvider } from '@edtr-io/ui';\nimport { useMemo, useCallback, createElement, Fragment } from 'react';\n\nfunction _extends() {\n _extends = Object.assign || 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\n return _extends.apply(this, arguments);\n}\n\nfunction SpoilerEditor(_ref) {\n var config = _ref.config,\n state = _ref.state,\n editable = _ref.editable,\n autofocusRef = _ref.autofocusRef;\n var theme = config.theme;\n var spoilerTheme = useMemo(function () {\n return {\n rendererUi: {\n expandableBox: {\n toggleBackgroundColor: theme.color,\n toggleColor: '#333',\n containerBorderColor: theme.color\n }\n }\n };\n }, [theme]);\n var renderTitle = useCallback(function (_collapsed) {\n return editable ? createElement(EditorInput, {\n onChange: function onChange(e) {\n return state.title.set(e.target.value);\n },\n value: state.title.value,\n placeholder: config.i18n.title.placeholder,\n ref: autofocusRef\n }) : createElement(Fragment, null, state.title.value);\n }, [config.i18n.title.placeholder, autofocusRef, editable, state.title]);\n return createElement(ThemeProvider, {\n theme: spoilerTheme\n }, createElement(ExpandableBox, {\n renderTitle: renderTitle,\n editable: editable,\n alwaysVisible: true\n }, state.content.render()));\n}\n\n/**\r\n * @param config - {@link SpoilerConfig | Plugin configuration}\r\n * @public\r\n */\n\nfunction createSpoilerPlugin(config) {\n var _config$i18n = config.i18n,\n i18n = _config$i18n === void 0 ? {} : _config$i18n,\n _config$theme = config.theme,\n theme = _config$theme === void 0 ? {} : _config$theme,\n content = config.content;\n return {\n Component: SpoilerEditor,\n config: function config() {\n return {\n i18n: mergeDeepRight({\n title: {\n placeholder: 'Enter a title'\n }\n }, i18n),\n theme: _extends({\n color: '#f5f5f5'\n }, theme)\n };\n },\n state: object({\n title: string(''),\n content: child(content)\n })\n };\n}\n\nexport { createSpoilerPlugin };\n\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.Immutable = factory());\n}(this, function () { 'use strict';var SLICE$0 = Array.prototype.slice;\n\n function createClass(ctor, superClass) {\n if (superClass) {\n ctor.prototype = Object.create(superClass.prototype);\n }\n ctor.prototype.constructor = ctor;\n }\n\n function Iterable(value) {\n return isIterable(value) ? value : Seq(value);\n }\n\n\n createClass(KeyedIterable, Iterable);\n function KeyedIterable(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n\n createClass(IndexedIterable, Iterable);\n function IndexedIterable(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n\n createClass(SetIterable, Iterable);\n function SetIterable(value) {\n return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n\n\n function isIterable(maybeIterable) {\n return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);\n }\n\n function isKeyed(maybeKeyed) {\n return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);\n }\n\n function isIndexed(maybeIndexed) {\n return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);\n }\n\n function isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n }\n\n function isOrdered(maybeOrdered) {\n return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);\n }\n\n Iterable.isIterable = isIterable;\n Iterable.isKeyed = isKeyed;\n Iterable.isIndexed = isIndexed;\n Iterable.isAssociative = isAssociative;\n Iterable.isOrdered = isOrdered;\n\n Iterable.Keyed = KeyedIterable;\n Iterable.Indexed = IndexedIterable;\n Iterable.Set = SetIterable;\n\n\n var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n // Used for setting prototype methods that IE8 chokes on.\n var DELETE = 'delete';\n\n // Constants describing the size of trie nodes.\n var SHIFT = 5; // Resulted in best performance after ______?\n var SIZE = 1 << SHIFT;\n var MASK = SIZE - 1;\n\n // A consistent shared value representing \"not set\" which equals nothing other\n // than itself, and nothing that could be provided externally.\n var NOT_SET = {};\n\n // Boolean references, Rough equivalent of `bool &`.\n var CHANGE_LENGTH = { value: false };\n var DID_ALTER = { value: false };\n\n function MakeRef(ref) {\n ref.value = false;\n return ref;\n }\n\n function SetRef(ref) {\n ref && (ref.value = true);\n }\n\n // A function which returns a value representing an \"owner\" for transient writes\n // to tries. The return value will only ever equal itself, and will not equal\n // the return of any subsequent call of this function.\n function OwnerID() {}\n\n // http://jsperf.com/copy-array-inline\n function arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n }\n\n function ensureSize(iter) {\n if (iter.size === undefined) {\n iter.size = iter.__iterate(returnTrue);\n }\n return iter.size;\n }\n\n function wrapIndex(iter, index) {\n // This implements \"is array index\" which the ECMAString spec defines as:\n //\n // A String property name P is an array index if and only if\n // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal\n // to 2^32−1.\n //\n // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects\n if (typeof index !== 'number') {\n var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n }\n\n function returnTrue() {\n return true;\n }\n\n function wholeSlice(begin, end, size) {\n return (begin === 0 || (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size));\n }\n\n function resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n }\n\n function resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n }\n\n function resolveIndex(index, size, defaultIndex) {\n return index === undefined ?\n defaultIndex :\n index < 0 ?\n Math.max(0, size + index) :\n size === undefined ?\n index :\n Math.min(size, index);\n }\n\n /* global Symbol */\n\n var ITERATE_KEYS = 0;\n var ITERATE_VALUES = 1;\n var ITERATE_ENTRIES = 2;\n\n var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator';\n\n var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\n\n function Iterator(next) {\n this.next = next;\n }\n\n Iterator.prototype.toString = function() {\n return '[Iterator]';\n };\n\n\n Iterator.KEYS = ITERATE_KEYS;\n Iterator.VALUES = ITERATE_VALUES;\n Iterator.ENTRIES = ITERATE_ENTRIES;\n\n Iterator.prototype.inspect =\n Iterator.prototype.toSource = function () { return this.toString(); }\n Iterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n };\n\n\n function iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {\n value: value, done: false\n });\n return iteratorResult;\n }\n\n function iteratorDone() {\n return { value: undefined, done: true };\n }\n\n function hasIterator(maybeIterable) {\n return !!getIteratorFn(maybeIterable);\n }\n\n function isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n }\n\n function getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n }\n\n function getIteratorFn(iterable) {\n var iteratorFn = iterable && (\n (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]\n );\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n function isArrayLike(value) {\n return value && typeof value.length === 'number';\n }\n\n createClass(Seq, Iterable);\n function Seq(value) {\n return value === null || value === undefined ? emptySequence() :\n isIterable(value) ? value.toSeq() : seqFromValue(value);\n }\n\n Seq.of = function(/*...values*/) {\n return Seq(arguments);\n };\n\n Seq.prototype.toSeq = function() {\n return this;\n };\n\n Seq.prototype.toString = function() {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function() {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, true);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, true);\n };\n\n\n\n createClass(KeyedSeq, Seq);\n function KeyedSeq(value) {\n return value === null || value === undefined ?\n emptySequence().toKeyedSeq() :\n isIterable(value) ?\n (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) :\n keyedSeqFromValue(value);\n }\n\n KeyedSeq.prototype.toKeyedSeq = function() {\n return this;\n };\n\n\n\n createClass(IndexedSeq, Seq);\n function IndexedSeq(value) {\n return value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();\n }\n\n IndexedSeq.of = function(/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function() {\n return this;\n };\n\n IndexedSeq.prototype.toString = function() {\n return this.__toString('Seq [', ']');\n };\n\n IndexedSeq.prototype.__iterate = function(fn, reverse) {\n return seqIterate(this, fn, reverse, false);\n };\n\n IndexedSeq.prototype.__iterator = function(type, reverse) {\n return seqIterator(this, type, reverse, false);\n };\n\n\n\n createClass(SetSeq, Seq);\n function SetSeq(value) {\n return (\n value === null || value === undefined ? emptySequence() :\n !isIterable(value) ? indexedSeqFromValue(value) :\n isKeyed(value) ? value.entrySeq() : value\n ).toSetSeq();\n }\n\n SetSeq.of = function(/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function() {\n return this;\n };\n\n\n\n Seq.isSeq = isSeq;\n Seq.Keyed = KeyedSeq;\n Seq.Set = SetSeq;\n Seq.Indexed = IndexedSeq;\n\n var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';\n\n Seq.prototype[IS_SEQ_SENTINEL] = true;\n\n\n\n createClass(ArraySeq, IndexedSeq);\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n ArraySeq.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function(fn, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ArraySeq.prototype.__iterator = function(type, reverse) {\n var array = this._array;\n var maxIndex = array.length - 1;\n var ii = 0;\n return new Iterator(function() \n {return ii > maxIndex ?\n iteratorDone() :\n iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++])}\n );\n };\n\n\n\n createClass(ObjectSeq, KeyedSeq);\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n ObjectSeq.prototype.get = function(key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function(key) {\n return this._object.hasOwnProperty(key);\n };\n\n ObjectSeq.prototype.__iterate = function(fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var key = keys[reverse ? maxIndex - ii : ii];\n if (fn(object[key], key, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n ObjectSeq.prototype.__iterator = function(type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var maxIndex = keys.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var key = keys[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, key, object[key]);\n });\n };\n\n ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(IterableSeq, IndexedSeq);\n function IterableSeq(iterable) {\n this._iterable = iterable;\n this.size = iterable.length || iterable.size;\n }\n\n IterableSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n IterableSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterable = this._iterable;\n var iterator = getIterator(iterable);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n\n\n createClass(IteratorSeq, IndexedSeq);\n function IteratorSeq(iterator) {\n this._iterator = iterator;\n this._iteratorCache = [];\n }\n\n IteratorSeq.prototype.__iterateUncached = function(fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n while (iterations < cache.length) {\n if (fn(cache[iterations], iterations++, this) === false) {\n return iterations;\n }\n }\n var step;\n while (!(step = iterator.next()).done) {\n var val = step.value;\n cache[iterations] = val;\n if (fn(val, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n\n IteratorSeq.prototype.__iteratorUncached = function(type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = this._iterator;\n var cache = this._iteratorCache;\n var iterations = 0;\n return new Iterator(function() {\n if (iterations >= cache.length) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n cache[iterations] = step.value;\n }\n return iteratorValue(type, iterations, cache[iterations++]);\n });\n };\n\n\n\n\n // # pragma Helper functions\n\n function isSeq(maybeSeq) {\n return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);\n }\n\n var EMPTY_SEQ;\n\n function emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n }\n\n function keyedSeqFromValue(value) {\n var seq =\n Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() :\n isIterator(value) ? new IteratorSeq(value).fromEntrySeq() :\n hasIterator(value) ? new IterableSeq(value).fromEntrySeq() :\n typeof value === 'object' ? new ObjectSeq(value) :\n undefined;\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of [k, v] entries, '+\n 'or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values: ' + value\n );\n }\n return seq;\n }\n\n function seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value) ||\n (typeof value === 'object' && new ObjectSeq(value));\n if (!seq) {\n throw new TypeError(\n 'Expected Array or iterable object of values, or keyed object: ' + value\n );\n }\n return seq;\n }\n\n function maybeIndexedSeqFromValue(value) {\n return (\n isArrayLike(value) ? new ArraySeq(value) :\n isIterator(value) ? new IteratorSeq(value) :\n hasIterator(value) ? new IterableSeq(value) :\n undefined\n );\n }\n\n function seqIterate(seq, fn, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n for (var ii = 0; ii <= maxIndex; ii++) {\n var entry = cache[reverse ? maxIndex - ii : ii];\n if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {\n return ii + 1;\n }\n }\n return ii;\n }\n return seq.__iterateUncached(fn, reverse);\n }\n\n function seqIterator(seq, type, reverse, useKeys) {\n var cache = seq._cache;\n if (cache) {\n var maxIndex = cache.length - 1;\n var ii = 0;\n return new Iterator(function() {\n var entry = cache[reverse ? maxIndex - ii : ii];\n return ii++ > maxIndex ?\n iteratorDone() :\n iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);\n });\n }\n return seq.__iteratorUncached(type, reverse);\n }\n\n function fromJS(json, converter) {\n return converter ?\n fromJSWith(converter, json, '', {'': json}) :\n fromJSDefault(json);\n }\n\n function fromJSWith(converter, json, key, parentJSON) {\n if (Array.isArray(json)) {\n return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n if (isPlainObj(json)) {\n return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)}));\n }\n return json;\n }\n\n function fromJSDefault(json) {\n if (Array.isArray(json)) {\n return IndexedSeq(json).map(fromJSDefault).toList();\n }\n if (isPlainObj(json)) {\n return KeyedSeq(json).map(fromJSDefault).toMap();\n }\n return json;\n }\n\n function isPlainObj(value) {\n return value && (value.constructor === Object || value.constructor === undefined);\n }\n\n /**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if the it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections implement `equals` and `hashCode`.\n *\n */\n function is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function') {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n if (typeof valueA.equals === 'function' &&\n typeof valueB.equals === 'function' &&\n valueA.equals(valueB)) {\n return true;\n }\n return false;\n }\n\n function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isIterable(b) ||\n a.size !== undefined && b.size !== undefined && a.size !== b.size ||\n a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return b.every(function(v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done;\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function(v, k) {\n if (notAssociative ? !a.has(v) :\n flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n }\n\n createClass(Repeat, IndexedSeq);\n\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n Repeat.prototype.toString = function() {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function(index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function(searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function(begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size) ? this :\n new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));\n };\n\n Repeat.prototype.reverse = function() {\n return this;\n };\n\n Repeat.prototype.indexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function(searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function(fn, reverse) {\n for (var ii = 0; ii < this.size; ii++) {\n if (fn(this._value, ii, this) === false) {\n return ii + 1;\n }\n }\n return ii;\n };\n\n Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this;\n var ii = 0;\n return new Iterator(function() \n {return ii < this$0.size ? iteratorValue(type, ii++, this$0._value) : iteratorDone()}\n );\n };\n\n Repeat.prototype.equals = function(other) {\n return other instanceof Repeat ?\n is(this._value, other._value) :\n deepEqual(other);\n };\n\n\n var EMPTY_REPEAT;\n\n function invariant(condition, error) {\n if (!condition) throw new Error(error);\n }\n\n createClass(Range, IndexedSeq);\n\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n Range.prototype.toString = function() {\n if (this.size === 0) {\n return 'Range []';\n }\n return 'Range [ ' +\n this._start + '...' + this._end +\n (this._step !== 1 ? ' by ' + this._step : '') +\n ' ]';\n };\n\n Range.prototype.get = function(index, notSetValue) {\n return this.has(index) ?\n this._start + wrapIndex(this, index) * this._step :\n notSetValue;\n };\n\n Range.prototype.includes = function(searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex);\n };\n\n Range.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(this.get(begin, this._end), this.get(end, this._end), this._step);\n };\n\n Range.prototype.indexOf = function(searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function(searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function(fn, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n for (var ii = 0; ii <= maxIndex; ii++) {\n if (fn(value, ii, this) === false) {\n return ii + 1;\n }\n value += reverse ? -step : step;\n }\n return ii;\n };\n\n Range.prototype.__iterator = function(type, reverse) {\n var maxIndex = this.size - 1;\n var step = this._step;\n var value = reverse ? this._start + maxIndex * step : this._start;\n var ii = 0;\n return new Iterator(function() {\n var v = value;\n value += reverse ? -step : step;\n return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);\n });\n };\n\n Range.prototype.equals = function(other) {\n return other instanceof Range ?\n this._start === other._start &&\n this._end === other._end &&\n this._step === other._step :\n deepEqual(this, other);\n };\n\n\n var EMPTY_RANGE;\n\n createClass(Collection, Iterable);\n function Collection() {\n throw TypeError('Abstract');\n }\n\n\n createClass(KeyedCollection, Collection);function KeyedCollection() {}\n\n createClass(IndexedCollection, Collection);function IndexedCollection() {}\n\n createClass(SetCollection, Collection);function SetCollection() {}\n\n\n Collection.Keyed = KeyedCollection;\n Collection.Indexed = IndexedCollection;\n Collection.Set = SetCollection;\n\n var imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ?\n Math.imul :\n function imul(a, b) {\n a = a | 0; // int\n b = b | 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int\n };\n\n // v8 has an optimization for storing 31-bit signed numbers.\n // Values which have either 00 or 11 as the high order bits qualify.\n // This function drops the highest order bit in a signed number, maintaining\n // the sign bit.\n function smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);\n }\n\n function hash(o) {\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n if (typeof o.valueOf === 'function') {\n o = o.valueOf();\n if (o === false || o === null || o === undefined) {\n return 0;\n }\n }\n if (o === true) {\n return 1;\n }\n var type = typeof o;\n if (type === 'number') {\n if (o !== o || o === Infinity) {\n return 0;\n }\n var h = o | 0;\n if (h !== o) {\n h ^= o * 0xFFFFFFFF;\n }\n while (o > 0xFFFFFFFF) {\n o /= 0xFFFFFFFF;\n h ^= o;\n }\n return smi(h);\n }\n if (type === 'string') {\n return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);\n }\n if (typeof o.hashCode === 'function') {\n return o.hashCode();\n }\n if (type === 'object') {\n return hashJSObj(o);\n }\n if (typeof o.toString === 'function') {\n return hashString(o.toString());\n }\n throw new Error('Value type ' + type + ' cannot be hashed.');\n }\n\n function cachedHashString(string) {\n var hash = stringHashCache[string];\n if (hash === undefined) {\n hash = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hash;\n }\n return hash;\n }\n\n // http://jsperf.com/hashing-strings\n function hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hash = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hash = 31 * hash + string.charCodeAt(ii) | 0;\n }\n return smi(hash);\n }\n\n function hashJSObj(obj) {\n var hash;\n if (usingWeakMap) {\n hash = weakMap.get(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = obj[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n if (!canDefineProperty) {\n hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hash !== undefined) {\n return hash;\n }\n\n hash = getIENodeHash(obj);\n if (hash !== undefined) {\n return hash;\n }\n }\n\n hash = ++objHashUID;\n if (objHashUID & 0x40000000) {\n objHashUID = 0;\n }\n\n if (usingWeakMap) {\n weakMap.set(obj, hash);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n 'enumerable': false,\n 'configurable': false,\n 'writable': false,\n 'value': hash\n });\n } else if (obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function() {\n return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hash;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hash;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hash;\n }\n\n // Get references to ES5 object methods.\n var isExtensible = Object.isExtensible;\n\n // True if Object.defineProperty works as expected. IE8 fails this test.\n var canDefineProperty = (function() {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n }());\n\n // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n // and avoid memory leaks from the IE cloneNode bug.\n function getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n }\n\n // If possible, use a WeakMap.\n var usingWeakMap = typeof WeakMap === 'function';\n var weakMap;\n if (usingWeakMap) {\n weakMap = new WeakMap();\n }\n\n var objHashUID = 0;\n\n var UID_HASH_KEY = '__immutablehash__';\n if (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n }\n\n var STRING_HASH_CACHE_MIN_STRLEN = 16;\n var STRING_HASH_CACHE_MAX_SIZE = 255;\n var STRING_HASH_CACHE_SIZE = 0;\n var stringHashCache = {};\n\n function assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n }\n\n createClass(Map, KeyedCollection);\n\n // @pragma Construction\n\n function Map(value) {\n return value === null || value === undefined ? emptyMap() :\n isMap(value) && !isOrdered(value) ? value :\n emptyMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n Map.of = function() {var keyValues = SLICE$0.call(arguments, 0);\n return emptyMap().withMutations(function(map ) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function() {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function(k, notSetValue) {\n return this._root ?\n this._root.get(0, undefined, k, notSetValue) :\n notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function(k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.setIn = function(keyPath, v) {\n return this.updateIn(keyPath, NOT_SET, function() {return v});\n };\n\n Map.prototype.remove = function(k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteIn = function(keyPath) {\n return this.updateIn(keyPath, function() {return NOT_SET});\n };\n\n Map.prototype.update = function(k, notSetValue, updater) {\n return arguments.length === 1 ?\n k(this) :\n this.updateIn([k], notSetValue, updater);\n };\n\n Map.prototype.updateIn = function(keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeepMap(\n this,\n forceIterator(keyPath),\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? undefined : updatedValue;\n };\n\n Map.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.merge = function(/*...iters*/) {\n return mergeIntoMapWith(this, undefined, arguments);\n };\n\n Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, merger, iters);\n };\n\n Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.merge === 'function' ?\n m.merge.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoMapWith(this, deepMerger, arguments);\n };\n\n Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoMapWith(this, deepMergerWith(merger), iters);\n };\n\n Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1);\n return this.updateIn(\n keyPath,\n emptyMap(),\n function(m ) {return typeof m.mergeDeep === 'function' ?\n m.mergeDeep.apply(m, iters) :\n iters[iters.length - 1]}\n );\n };\n\n Map.prototype.sort = function(comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n // @pragma Mutability\n\n Map.prototype.withMutations = function(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n };\n\n Map.prototype.asMutable = function() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n };\n\n Map.prototype.asImmutable = function() {\n return this.__ensureOwner();\n };\n\n Map.prototype.wasAltered = function() {\n return this.__altered;\n };\n\n Map.prototype.__iterator = function(type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n this._root && this._root.iterate(function(entry ) {\n iterations++;\n return fn(entry[1], entry[0], this$0);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n\n function isMap(maybeMap) {\n return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);\n }\n\n Map.isMap = isMap;\n\n var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';\n\n var MapPrototype = Map.prototype;\n MapPrototype[IS_MAP_SENTINEL] = true;\n MapPrototype[DELETE] = MapPrototype.remove;\n MapPrototype.removeIn = MapPrototype.deleteIn;\n\n\n // #pragma Trie Nodes\n\n\n\n function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n }\n\n ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n };\n\n\n\n\n function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n }\n\n BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0 ? notSetValue :\n this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);\n };\n\n BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;\n var newNodes = exists ? newNode ?\n setIn(nodes, idx, newNode, isEditable) :\n spliceOut(nodes, idx, isEditable) :\n spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n };\n\n\n\n\n function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n }\n\n HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;\n };\n\n HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n };\n\n\n\n\n function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n }\n\n HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n };\n\n HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n for (var len = entries.length; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n };\n\n\n\n\n function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n }\n\n ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n };\n\n ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n };\n\n\n\n // #pragma Iterators\n\n ArrayMapNode.prototype.iterate =\n HashCollisionNode.prototype.iterate = function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n }\n\n BitmapIndexedNode.prototype.iterate =\n HashArrayMapNode.prototype.iterate = function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n }\n\n ValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n }\n\n createClass(MapIterator, Iterator);\n\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n MapIterator.prototype.next = function() {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex;\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n\n function mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n }\n\n function mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev\n };\n }\n\n function makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_MAP;\n function emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n }\n\n function updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef(CHANGE_LENGTH);\n var didAlter = MakeRef(DID_ALTER);\n newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n }\n\n function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);\n }\n\n function isLeafNode(node) {\n return node.constructor === ValueNode || node.constructor === HashCollisionNode;\n }\n\n function mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes = idx1 === idx2 ?\n [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] :\n ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n }\n\n function createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n }\n\n function packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n }\n\n function expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n }\n\n function mergeIntoMapWith(map, merger, iterables) {\n var iters = [];\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = KeyedIterable(value);\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n return mergeIntoCollectionWith(map, merger, iters);\n }\n\n function deepMerger(existing, value, key) {\n return existing && existing.mergeDeep && isIterable(value) ?\n existing.mergeDeep(value) :\n is(existing, value) ? existing : value;\n }\n\n function deepMergerWith(merger) {\n return function(existing, value, key) {\n if (existing && existing.mergeDeepWith && isIterable(value)) {\n return existing.mergeDeepWith(merger, value);\n }\n var nextValue = merger(existing, value, key);\n return is(existing, nextValue) ? existing : nextValue;\n };\n }\n\n function mergeIntoCollectionWith(collection, merger, iters) {\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return collection;\n }\n if (collection.size === 0 && !collection.__ownerID && iters.length === 1) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function(collection ) {\n var mergeIntoMap = merger ?\n function(value, key) {\n collection.update(key, NOT_SET, function(existing )\n {return existing === NOT_SET ? value : merger(existing, value, key)}\n );\n } :\n function(value, key) {\n collection.set(key, value);\n }\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoMap);\n }\n });\n }\n\n function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {\n var isNotSet = existing === NOT_SET;\n var step = keyPathIter.next();\n if (step.done) {\n var existingValue = isNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n invariant(\n isNotSet || (existing && existing.set),\n 'invalid keyPath'\n );\n var key = step.value;\n var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);\n var nextUpdated = updateInDeepMap(\n nextExisting,\n keyPathIter,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting ? existing :\n nextUpdated === NOT_SET ? existing.remove(key) :\n (isNotSet ? emptyMap() : existing).set(key, nextUpdated);\n }\n\n function popCount(x) {\n x = x - ((x >> 1) & 0x55555555);\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x = x + (x >> 8);\n x = x + (x >> 16);\n return x & 0x7f;\n }\n\n function setIn(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n }\n\n function spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n }\n\n function spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n }\n\n var MAX_ARRAY_MAP_SIZE = SIZE / 4;\n var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\n var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\n createClass(List, IndexedCollection);\n\n // @pragma Construction\n\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedIterable(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function(list ) {\n list.setSize(size);\n iter.forEach(function(v, i) {return list.set(i, v)});\n });\n }\n\n List.of = function(/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function() {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function(index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function(index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function(index) {\n return !this.has(index) ? this :\n index === 0 ? this.shift() :\n index === this.size - 1 ? this.pop() :\n this.splice(index, 1);\n };\n\n List.prototype.insert = function(index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function(/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function(list ) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function() {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function(/*...values*/) {\n var values = arguments;\n return this.withMutations(function(list ) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function() {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.merge = function(/*...iters*/) {\n return mergeIntoListWith(this, undefined, arguments);\n };\n\n List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, merger, iters);\n };\n\n List.prototype.mergeDeep = function(/*...iters*/) {\n return mergeIntoListWith(this, deepMerger, arguments);\n };\n\n List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return mergeIntoListWith(this, deepMergerWith(merger), iters);\n };\n\n List.prototype.setSize = function(size) {\n return setListBounds(this, 0, size);\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function(begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function(type, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n return new Iterator(function() {\n var value = values();\n return value === DONE ?\n iteratorDone() :\n iteratorValue(type, index++, value);\n });\n };\n\n List.prototype.__iterate = function(fn, reverse) {\n var index = 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n return this;\n }\n return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);\n };\n\n\n function isList(maybeList) {\n return !!(maybeList && maybeList[IS_LIST_SENTINEL]);\n }\n\n List.isList = isList;\n\n var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';\n\n var ListPrototype = List.prototype;\n ListPrototype[IS_LIST_SENTINEL] = true;\n ListPrototype[DELETE] = ListPrototype.remove;\n ListPrototype.setIn = MapPrototype.setIn;\n ListPrototype.deleteIn =\n ListPrototype.removeIn = MapPrototype.removeIn;\n ListPrototype.update = MapPrototype.update;\n ListPrototype.updateIn = MapPrototype.updateIn;\n ListPrototype.mergeIn = MapPrototype.mergeIn;\n ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n ListPrototype.withMutations = MapPrototype.withMutations;\n ListPrototype.asMutable = MapPrototype.asMutable;\n ListPrototype.asImmutable = MapPrototype.asImmutable;\n ListPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n\n function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n }\n\n // TODO: seems like these methods are very similar\n\n VNode.prototype.removeBefore = function(ownerID, level, index) {\n if (index === level ? 1 << level : 0 || this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n };\n\n VNode.prototype.removeAfter = function(ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n };\n\n\n\n var DONE = {};\n\n function iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0 ?\n iterateLeaf(node, offset) :\n iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function() {\n do {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx], level - SHIFT, offset + (idx << level)\n );\n } while (true);\n };\n }\n }\n\n function makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n }\n\n var EMPTY_LIST;\n function emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n }\n\n function updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function(list ) {\n index < 0 ?\n setListBounds(list, index).set(0, value) :\n setListBounds(list, 0, index + 1).set(index, value)\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef(DID_ALTER);\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n }\n\n function updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n SetRef(didAlter);\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n }\n\n function editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n }\n\n function listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n }\n\n function setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n end = end | 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail = newTailOffset < oldTailOffset ?\n listNodeFor(list, newCapacity - 1) :\n newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;\n\n // Merge Tail into tree.\n if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n }\n\n function mergeIntoListWith(list, merger, iterables) {\n var iters = [];\n var maxSize = 0;\n for (var ii = 0; ii < iterables.length; ii++) {\n var value = iterables[ii];\n var iter = IndexedIterable(value);\n if (iter.size > maxSize) {\n maxSize = iter.size;\n }\n if (!isIterable(value)) {\n iter = iter.map(function(v ) {return fromJS(v)});\n }\n iters.push(iter);\n }\n if (maxSize > list.size) {\n list = list.setSize(maxSize);\n }\n return mergeIntoCollectionWith(list, merger, iters);\n }\n\n function getTailOffset(size) {\n return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);\n }\n\n createClass(OrderedMap, Map);\n\n // @pragma Construction\n\n function OrderedMap(value) {\n return value === null || value === undefined ? emptyOrderedMap() :\n isOrderedMap(value) ? value :\n emptyOrderedMap().withMutations(function(map ) {\n var iter = KeyedIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v, k) {return map.set(k, v)});\n });\n }\n\n OrderedMap.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function() {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function(k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function(k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function(k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.wasAltered = function() {\n return this._map.wasAltered() || this._list.wasAltered();\n };\n\n OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._list.__iterate(\n function(entry ) {return entry && fn(entry[1], entry[0], this$0)},\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function(type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n\n function isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n }\n\n OrderedMap.isOrderedMap = isOrderedMap;\n\n OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;\n OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\n\n\n function makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n return omap;\n }\n\n var EMPTY_ORDERED_MAP;\n function emptyOrderedMap() {\n return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));\n }\n\n function updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) { // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx});\n newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else {\n if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n }\n\n createClass(ToKeyedSequence, KeyedSeq);\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n ToKeyedSequence.prototype.get = function(key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function(key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function() {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function() {var this$0 = this;\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()};\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this;\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)};\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var ii;\n return this._iter.__iterate(\n this._useKeys ?\n function(v, k) {return fn(v, k, this$0)} :\n ((ii = reverse ? resolveSize(this) : 0),\n function(v ) {return fn(v, reverse ? --ii : ii++, this$0)}),\n reverse\n );\n };\n\n ToKeyedSequence.prototype.__iterator = function(type, reverse) {\n if (this._useKeys) {\n return this._iter.__iterator(type, reverse);\n }\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var ii = reverse ? resolveSize(this) : 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, reverse ? --ii : ii++, step.value, step);\n });\n };\n\n ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n createClass(ToIndexedSequence, IndexedSeq);\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToIndexedSequence.prototype.includes = function(value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n return this._iter.__iterate(function(v ) {return fn(v, iterations++, this$0)}, reverse);\n };\n\n ToIndexedSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, iterations++, step.value, step)\n });\n };\n\n\n\n createClass(ToSetSequence, SetSeq);\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n ToSetSequence.prototype.has = function(key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n return step.done ? step :\n iteratorValue(type, step.value, step.value, step);\n });\n };\n\n\n\n createClass(FromEntriesSequence, KeyedSeq);\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n FromEntriesSequence.prototype.entrySeq = function() {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._iter.__iterate(function(entry ) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return fn(\n indexedIterable ? entry.get(1) : entry[1],\n indexedIterable ? entry.get(0) : entry[0],\n this$0\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function(type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedIterable = isIterable(entry);\n return iteratorValue(\n type,\n indexedIterable ? entry.get(0) : entry[0],\n indexedIterable ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n\n ToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\n\n function flipFactory(iterable) {\n var flipSequence = makeSequence(iterable);\n flipSequence._iter = iterable;\n flipSequence.size = iterable.size;\n flipSequence.flip = function() {return iterable};\n flipSequence.reverse = function () {\n var reversedSequence = iterable.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function() {return iterable.reverse()};\n return reversedSequence;\n };\n flipSequence.has = function(key ) {return iterable.includes(key)};\n flipSequence.includes = function(key ) {return iterable.has(key)};\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse);\n }\n flipSequence.__iteratorUncached = function(type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = iterable.__iterator(type, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return iterable.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n }\n return flipSequence;\n }\n\n\n function mapFactory(iterable, mapper, context) {\n var mappedSequence = makeSequence(iterable);\n mappedSequence.size = iterable.size;\n mappedSequence.has = function(key ) {return iterable.has(key)};\n mappedSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v === NOT_SET ?\n notSetValue :\n mapper.call(context, v, key, iterable);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(\n function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false},\n reverse\n );\n }\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function() {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, iterable),\n step\n );\n });\n }\n return mappedSequence;\n }\n\n\n function reverseFactory(iterable, useKeys) {\n var reversedSequence = makeSequence(iterable);\n reversedSequence._iter = iterable;\n reversedSequence.size = iterable.size;\n reversedSequence.reverse = function() {return iterable};\n if (iterable.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(iterable);\n flipSequence.reverse = function() {return iterable.flip()};\n return flipSequence;\n };\n }\n reversedSequence.get = function(key, notSetValue) \n {return iterable.get(useKeys ? key : -1 - key, notSetValue)};\n reversedSequence.has = function(key )\n {return iterable.has(useKeys ? key : -1 - key)};\n reversedSequence.includes = function(value ) {return iterable.includes(value)};\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {var this$0 = this;\n return iterable.__iterate(function(v, k) {return fn(v, k, this$0)}, !reverse);\n };\n reversedSequence.__iterator =\n function(type, reverse) {return iterable.__iterator(type, !reverse)};\n return reversedSequence;\n }\n\n\n function filterFactory(iterable, predicate, context, useKeys) {\n var filterSequence = makeSequence(iterable);\n if (useKeys) {\n filterSequence.has = function(key ) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, iterable);\n };\n filterSequence.get = function(key, notSetValue) {\n var v = iterable.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, iterable) ?\n v : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function() {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, iterable)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n }\n return filterSequence;\n }\n\n\n function countByFactory(iterable, grouper, context) {\n var groups = Map().asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n 0,\n function(a ) {return a + 1}\n );\n });\n return groups.asImmutable();\n }\n\n\n function groupByFactory(iterable, grouper, context) {\n var isKeyedIter = isKeyed(iterable);\n var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable();\n iterable.__iterate(function(v, k) {\n groups.update(\n grouper.call(context, v, k, iterable),\n function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)}\n );\n });\n var coerce = iterableClass(iterable);\n return groups.map(function(arr ) {return reify(iterable, coerce(arr))});\n }\n\n\n function sliceFactory(iterable, begin, end, useKeys) {\n var originalSize = iterable.size;\n\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin = begin | 0;\n }\n if (end !== undefined) {\n if (end === Infinity) {\n end = originalSize;\n } else {\n end = end | 0;\n }\n }\n\n if (wholeSlice(begin, end, originalSize)) {\n return iterable;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this iterable's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(iterable);\n\n // If iterable.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined;\n\n if (!useKeys && isSeq(iterable) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize ?\n iterable.get(index + resolvedBegin, notSetValue) :\n notSetValue;\n }\n }\n\n sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0) !== false &&\n iterations !== sliceSize;\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function(type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function() {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n } else {\n return iteratorValue(type, iterations - 1, step.value[1], step);\n }\n });\n }\n\n return sliceSeq;\n }\n\n\n function takeWhileFactory(iterable, predicate, context) {\n var takeSequence = makeSequence(iterable);\n takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n iterable.__iterate(function(v, k, c) \n {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)}\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function() {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$0)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n }\n\n\n function skipWhileFactory(iterable, predicate, context, useKeys) {\n var skipSequence = makeSequence(iterable);\n skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n iterable.__iterate(function(v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$0);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this;\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function() {\n var step, k, v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n } else if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n } else {\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$0));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step :\n iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n }\n\n\n function concatFactory(iterable, values) {\n var isKeyedIterable = isKeyed(iterable);\n var iters = [iterable].concat(values).map(function(v ) {\n if (!isIterable(v)) {\n v = isKeyedIterable ?\n keyedSeqFromValue(v) :\n indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedIterable) {\n v = KeyedIterable(v);\n }\n return v;\n }).filter(function(v ) {return v.size !== 0});\n\n if (iters.length === 0) {\n return iterable;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (singleton === iterable ||\n isKeyedIterable && isKeyed(singleton) ||\n isIndexed(iterable) && isIndexed(singleton)) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedIterable) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(iterable)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(\n function(sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n },\n 0\n );\n return concatSeq;\n }\n\n\n function flattenFactory(iterable, depth, useKeys) {\n var flatSequence = makeSequence(iterable);\n flatSequence.__iterateUncached = function(fn, reverse) {\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {var this$0 = this;\n iter.__iterate(function(v, k) {\n if ((!depth || currentDepth < depth) && isIterable(v)) {\n flatDeep(v, currentDepth + 1);\n } else if (fn(v, useKeys ? k : iterations++, this$0) === false) {\n stopped = true;\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(iterable, 0);\n return iterations;\n }\n flatSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function() {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isIterable(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n }\n return flatSequence;\n }\n\n\n function flatMapFactory(iterable, mapper, context) {\n var coerce = iterableClass(iterable);\n return iterable.toSeq().map(\n function(v, k) {return coerce(mapper.call(context, v, k, iterable))}\n ).flatten(true);\n }\n\n\n function interposeFactory(iterable, separator) {\n var interposedSequence = makeSequence(iterable);\n interposedSequence.size = iterable.size && iterable.size * 2 -1;\n interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this;\n var iterations = 0;\n iterable.__iterate(function(v, k) \n {return (!iterations || fn(separator, iterations++, this$0) !== false) &&\n fn(v, iterations++, this$0) !== false},\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function(type, reverse) {\n var iterator = iterable.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function() {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2 ?\n iteratorValue(type, iterations++, separator) :\n iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n }\n\n\n function sortFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedIterable = isKeyed(iterable);\n var index = 0;\n var entries = iterable.toSeq().map(\n function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]}\n ).toArray();\n entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach(\n isKeyedIterable ?\n function(v, i) { entries[i].length = 2; } :\n function(v, i) { entries[i] = v[1]; }\n );\n return isKeyedIterable ? KeyedSeq(entries) :\n isIndexed(iterable) ? IndexedSeq(entries) :\n SetSeq(entries);\n }\n\n\n function maxFactory(iterable, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = iterable.toSeq()\n .map(function(v, k) {return [v, mapper(v, k, iterable)]})\n .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a});\n return entry && entry[0];\n } else {\n return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a});\n }\n }\n\n function maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;\n }\n\n\n function zipWithFactory(keyIter, zipper, iters) {\n var zipSequence = makeSequence(keyIter);\n zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function(fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function(type, reverse) {\n var iterators = iters.map(function(i )\n {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))}\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function() {\n var steps;\n if (!isDone) {\n steps = iterators.map(function(i ) {return i.next()});\n isDone = steps.some(function(s ) {return s.done});\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(null, steps.map(function(s ) {return s.value}))\n );\n });\n };\n return zipSequence\n }\n\n\n // #pragma Helper Functions\n\n function reify(iter, seq) {\n return isSeq(iter) ? seq : iter.constructor(seq);\n }\n\n function validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n }\n\n function resolveSize(iter) {\n assertNotInfinite(iter.size);\n return ensureSize(iter);\n }\n\n function iterableClass(iterable) {\n return isKeyed(iterable) ? KeyedIterable :\n isIndexed(iterable) ? IndexedIterable :\n SetIterable;\n }\n\n function makeSequence(iterable) {\n return Object.create(\n (\n isKeyed(iterable) ? KeyedSeq :\n isIndexed(iterable) ? IndexedSeq :\n SetSeq\n ).prototype\n );\n }\n\n function cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n } else {\n return Seq.prototype.cacheResult.call(this);\n }\n }\n\n function defaultComparator(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n function forceIterator(keyPath) {\n var iter = getIterator(keyPath);\n if (!iter) {\n // Array might not be iterable in this environment, so we need a fallback\n // to our wrapped type.\n if (!isArrayLike(keyPath)) {\n throw new TypeError('Expected iterable or array-like: ' + keyPath);\n }\n iter = getIterator(Iterable(keyPath));\n }\n return iter;\n }\n\n createClass(Record, KeyedCollection);\n\n function Record(defaultValues, name) {\n var hasInitialized;\n\n var RecordType = function Record(values) {\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n setProps(RecordTypePrototype, keys);\n RecordTypePrototype.size = keys.length;\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n }\n this._map = Map(values);\n };\n\n var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);\n RecordTypePrototype.constructor = RecordType;\n\n return RecordType;\n }\n\n Record.prototype.toString = function() {\n return this.__toString(recordName(this) + ' {', '}');\n };\n\n // @pragma Access\n\n Record.prototype.has = function(k) {\n return this._defaultValues.hasOwnProperty(k);\n };\n\n Record.prototype.get = function(k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var defaultVal = this._defaultValues[k];\n return this._map ? this._map.get(k, defaultVal) : defaultVal;\n };\n\n // @pragma Modification\n\n Record.prototype.clear = function() {\n if (this.__ownerID) {\n this._map && this._map.clear();\n return this;\n }\n var RecordType = this.constructor;\n return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap()));\n };\n\n Record.prototype.set = function(k, v) {\n if (!this.has(k)) {\n throw new Error('Cannot set unknown key \"' + k + '\" on ' + recordName(this));\n }\n if (this._map && !this._map.has(k)) {\n var defaultVal = this._defaultValues[k];\n if (v === defaultVal) {\n return this;\n }\n }\n var newMap = this._map && this._map.set(k, v);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.remove = function(k) {\n if (!this.has(k)) {\n return this;\n }\n var newMap = this._map && this._map.remove(k);\n if (this.__ownerID || newMap === this._map) {\n return this;\n }\n return makeRecord(this, newMap);\n };\n\n Record.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Record.prototype.__iterator = function(type, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse);\n };\n\n Record.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse);\n };\n\n Record.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map && this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return makeRecord(this, newMap, ownerID);\n };\n\n\n var RecordPrototype = Record.prototype;\n RecordPrototype[DELETE] = RecordPrototype.remove;\n RecordPrototype.deleteIn =\n RecordPrototype.removeIn = MapPrototype.removeIn;\n RecordPrototype.merge = MapPrototype.merge;\n RecordPrototype.mergeWith = MapPrototype.mergeWith;\n RecordPrototype.mergeIn = MapPrototype.mergeIn;\n RecordPrototype.mergeDeep = MapPrototype.mergeDeep;\n RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;\n RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;\n RecordPrototype.setIn = MapPrototype.setIn;\n RecordPrototype.update = MapPrototype.update;\n RecordPrototype.updateIn = MapPrototype.updateIn;\n RecordPrototype.withMutations = MapPrototype.withMutations;\n RecordPrototype.asMutable = MapPrototype.asMutable;\n RecordPrototype.asImmutable = MapPrototype.asImmutable;\n\n\n function makeRecord(likeRecord, map, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._map = map;\n record.__ownerID = ownerID;\n return record;\n }\n\n function recordName(record) {\n return record._name || record.constructor.name || 'Record';\n }\n\n function setProps(prototype, names) {\n try {\n names.forEach(setProp.bind(undefined, prototype));\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n }\n\n function setProp(prototype, name) {\n Object.defineProperty(prototype, name, {\n get: function() {\n return this.get(name);\n },\n set: function(value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n }\n });\n }\n\n createClass(Set, SetCollection);\n\n // @pragma Construction\n\n function Set(value) {\n return value === null || value === undefined ? emptySet() :\n isSet(value) && !isOrdered(value) ? value :\n emptySet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n Set.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n Set.prototype.toString = function() {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function(value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function(value) {\n return updateSet(this, this._map.set(value, true));\n };\n\n Set.prototype.remove = function(value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function() {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0);\n iters = iters.filter(function(x ) {return x.size !== 0});\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function(set ) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)});\n }\n });\n };\n\n Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (!iters.every(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0);\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function(iter ) {return SetIterable(iter)});\n var originalSet = this;\n return this.withMutations(function(set ) {\n originalSet.forEach(function(value ) {\n if (iters.some(function(iter ) {return iter.includes(value)})) {\n set.remove(value);\n }\n });\n });\n };\n\n Set.prototype.merge = function() {\n return this.union.apply(this, arguments);\n };\n\n Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1);\n return this.union.apply(this, iters);\n };\n\n Set.prototype.sort = function(comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function(mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function() {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function(fn, reverse) {var this$0 = this;\n return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse);\n };\n\n Set.prototype.__iterator = function(type, reverse) {\n return this._map.map(function(_, k) {return k}).__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n\n function isSet(maybeSet) {\n return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);\n }\n\n Set.isSet = isSet;\n\n var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';\n\n var SetPrototype = Set.prototype;\n SetPrototype[IS_SET_SENTINEL] = true;\n SetPrototype[DELETE] = SetPrototype.remove;\n SetPrototype.mergeDeep = SetPrototype.merge;\n SetPrototype.mergeDeepWith = SetPrototype.mergeWith;\n SetPrototype.withMutations = MapPrototype.withMutations;\n SetPrototype.asMutable = MapPrototype.asMutable;\n SetPrototype.asImmutable = MapPrototype.asImmutable;\n\n SetPrototype.__empty = emptySet;\n SetPrototype.__make = makeSet;\n\n function updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map ? set :\n newMap.size === 0 ? set.__empty() :\n set.__make(newMap);\n }\n\n function makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_SET;\n function emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n }\n\n createClass(OrderedSet, Set);\n\n // @pragma Construction\n\n function OrderedSet(value) {\n return value === null || value === undefined ? emptyOrderedSet() :\n isOrderedSet(value) ? value :\n emptyOrderedSet().withMutations(function(set ) {\n var iter = SetIterable(value);\n assertNotInfinite(iter.size);\n iter.forEach(function(v ) {return set.add(v)});\n });\n }\n\n OrderedSet.of = function(/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function(value) {\n return this(KeyedIterable(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function() {\n return this.__toString('OrderedSet {', '}');\n };\n\n\n function isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n }\n\n OrderedSet.isOrderedSet = isOrderedSet;\n\n var OrderedSetPrototype = OrderedSet.prototype;\n OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;\n\n OrderedSetPrototype.__empty = emptyOrderedSet;\n OrderedSetPrototype.__make = makeOrderedSet;\n\n function makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n }\n\n var EMPTY_ORDERED_SET;\n function emptyOrderedSet() {\n return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));\n }\n\n createClass(Stack, IndexedCollection);\n\n // @pragma Construction\n\n function Stack(value) {\n return value === null || value === undefined ? emptyStack() :\n isStack(value) ? value :\n emptyStack().unshiftAll(value);\n }\n\n Stack.of = function(/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function() {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function(index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function() {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function(/*...values*/) {\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments[ii],\n next: head\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function(iter) {\n iter = IndexedIterable(iter);\n if (iter.size === 0) {\n return this;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.reverse().forEach(function(value ) {\n newSize++;\n head = {\n value: value,\n next: head\n };\n });\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function() {\n return this.slice(1);\n };\n\n Stack.prototype.unshift = function(/*...values*/) {\n return this.push.apply(this, arguments);\n };\n\n Stack.prototype.unshiftAll = function(iter) {\n return this.pushAll(iter);\n };\n\n Stack.prototype.shift = function() {\n return this.pop.apply(this, arguments);\n };\n\n Stack.prototype.clear = function() {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function(begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function(ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function(fn, reverse) {\n if (reverse) {\n return this.reverse().__iterate(fn);\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function(type, reverse) {\n if (reverse) {\n return this.reverse().__iterator(type);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function() {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n\n function isStack(maybeStack) {\n return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);\n }\n\n Stack.isStack = isStack;\n\n var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';\n\n var StackPrototype = Stack.prototype;\n StackPrototype[IS_STACK_SENTINEL] = true;\n StackPrototype.withMutations = MapPrototype.withMutations;\n StackPrototype.asMutable = MapPrototype.asMutable;\n StackPrototype.asImmutable = MapPrototype.asImmutable;\n StackPrototype.wasAltered = MapPrototype.wasAltered;\n\n\n function makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n }\n\n var EMPTY_STACK;\n function emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n }\n\n /**\n * Contributes additional methods to a constructor\n */\n function mixin(ctor, methods) {\n var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n }\n\n Iterable.Iterator = Iterator;\n\n mixin(Iterable, {\n\n // ### Conversion to other types\n\n toArray: function() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n this.valueSeq().__iterate(function(v, i) { array[i] = v; });\n return array;\n },\n\n toIndexedSeq: function() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJS === 'function' ? value.toJS() : value}\n ).__toJS();\n },\n\n toJSON: function() {\n return this.toSeq().map(\n function(value ) {return value && typeof value.toJSON === 'function' ? value.toJSON() : value}\n ).__toJS();\n },\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: function() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function(v, k) { object[k] = v; });\n return object;\n },\n\n toOrderedMap: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function() {\n return new ToSetSequence(this);\n },\n\n toSeq: function() {\n return isIndexed(this) ? this.toIndexedSeq() :\n isKeyed(this) ? this.toKeyedSeq() :\n this.toSetSeq();\n },\n\n toStack: function() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n\n // ### Common JavaScript methods and properties\n\n toString: function() {\n return '[Iterable]';\n },\n\n __toString: function(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function() {var values = SLICE$0.call(arguments, 0);\n return reify(this, concatFactory(this, values));\n },\n\n includes: function(searchValue) {\n return this.some(function(value ) {return is(value, searchValue)});\n },\n\n entries: function() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function(v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n forEach: function(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function(v ) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function(reducer, initialReduction, context) {\n assertNotInfinite(this.size);\n var reduction;\n var useFirst;\n if (arguments.length < 2) {\n useFirst = true;\n } else {\n reduction = initialReduction;\n }\n this.__iterate(function(v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n });\n return reduction;\n },\n\n reduceRight: function(reducer, initialReduction, context) {\n var reversed = this.toKeyedSeq().reverse();\n return reversed.reduce.apply(reversed, arguments);\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n\n // ### More sequential methods\n\n butLast: function() {\n return this.slice(0, -1);\n },\n\n isEmpty: function() {\n return this.size !== undefined ? this.size === 0 : !this.some(function() {return true});\n },\n\n count: function(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function() {\n var iterable = this;\n if (iterable._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(iterable._cache);\n }\n var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function() {return iterable.toSeq()};\n return entriesSequence;\n },\n\n filterNot: function(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findEntry: function(predicate, context, notSetValue) {\n var found = notSetValue;\n this.__iterate(function(v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findKey: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLast: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n findLastEntry: function(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);\n },\n\n findLastKey: function(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n\n first: function() {\n return this.find(returnTrue);\n },\n\n flatMap: function(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function() {\n return new FromEntriesSequence(this);\n },\n\n get: function(searchKey, notSetValue) {\n return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue);\n },\n\n getIn: function(searchKeyPath, notSetValue) {\n var nested = this;\n // Note: in an ES6 environment, we would prefer:\n // for (var key of searchKeyPath) {\n var iter = forceIterator(searchKeyPath);\n var step;\n while (!(step = iter.next()).done) {\n var key = step.value;\n nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;\n if (nested === NOT_SET) {\n return notSetValue;\n }\n }\n return nested;\n },\n\n groupBy: function(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: function(searchKeyPath) {\n return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;\n },\n\n isSubset: function(iter) {\n iter = typeof iter.includes === 'function' ? iter : Iterable(iter);\n return this.every(function(value ) {return iter.includes(value)});\n },\n\n isSuperset: function(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter);\n return iter.isSubset(this);\n },\n\n keyOf: function(searchValue) {\n return this.findKey(function(value ) {return is(value, searchValue)});\n },\n\n keySeq: function() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function() {\n return this.toSeq().reverse().first();\n },\n\n lastKeyOf: function(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n\n max: function(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function(comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);\n },\n\n minBy: function(mapper, comparator) {\n return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);\n },\n\n rest: function() {\n return this.slice(1);\n },\n\n skip: function(amount) {\n return this.slice(Math.max(0, amount));\n },\n\n skipLast: function(amount) {\n return reify(this, this.toSeq().reverse().skip(amount).reverse());\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function(amount) {\n return reify(this, this.toSeq().reverse().take(amount).reverse());\n },\n\n takeWhile: function(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n valueSeq: function() {\n return this.toIndexedSeq();\n },\n\n\n // ### Hashable Object\n\n hashCode: function() {\n return this.__hash || (this.__hash = hashIterable(this));\n }\n\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n });\n\n // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';\n // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';\n // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';\n // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';\n\n var IterablePrototype = Iterable.prototype;\n IterablePrototype[IS_ITERABLE_SENTINEL] = true;\n IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;\n IterablePrototype.__toJS = IterablePrototype.toArray;\n IterablePrototype.__toStringMapper = quoteString;\n IterablePrototype.inspect =\n IterablePrototype.toSource = function() { return this.toString(); };\n IterablePrototype.chain = IterablePrototype.flatMap;\n IterablePrototype.contains = IterablePrototype.includes;\n\n mixin(KeyedIterable, {\n\n // ### More sequential methods\n\n flip: function() {\n return reify(this, flipFactory(this));\n },\n\n mapEntries: function(mapper, context) {var this$0 = this;\n var iterations = 0;\n return reify(this,\n this.toSeq().map(\n function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)}\n ).fromEntrySeq()\n );\n },\n\n mapKeys: function(mapper, context) {var this$0 = this;\n return reify(this,\n this.toSeq().flip().map(\n function(k, v) {return mapper.call(context, k, v, this$0)}\n ).flip()\n );\n }\n\n });\n\n var KeyedIterablePrototype = KeyedIterable.prototype;\n KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;\n KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;\n KeyedIterablePrototype.__toJS = IterablePrototype.toObject;\n KeyedIterablePrototype.__toStringMapper = function(v, k) {return JSON.stringify(k) + ': ' + quoteString(v)};\n\n\n\n mixin(IndexedIterable, {\n\n // ### Conversion to other types\n\n toKeyedSeq: function() {\n return new ToKeyedSequence(this, false);\n },\n\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n reverse: function() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum | 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1 ?\n spliced :\n spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n\n // ### More collection methods\n\n findLastIndex: function(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n first: function() {\n return this.get(0);\n },\n\n flatten: function(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function(index, notSetValue) {\n index = wrapIndex(this, index);\n return (index < 0 || (this.size === Infinity ||\n (this.size !== undefined && index > this.size))) ?\n notSetValue :\n this.find(function(_, key) {return key === index}, undefined, notSetValue);\n },\n\n has: function(index) {\n index = wrapIndex(this, index);\n return index >= 0 && (this.size !== undefined ?\n this.size === Infinity || index < this.size :\n this.indexOf(index) !== -1\n );\n },\n\n interpose: function(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function(/*...iterables*/) {\n var iterables = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * iterables.length;\n }\n return reify(this, interleaved);\n },\n\n keySeq: function() {\n return Range(0, this.size);\n },\n\n last: function() {\n return this.get(-1);\n },\n\n skipWhile: function(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function(/*, ...iterables */) {\n var iterables = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, iterables));\n },\n\n zipWith: function(zipper/*, ...iterables */) {\n var iterables = arrCopy(arguments);\n iterables[0] = this;\n return reify(this, zipWithFactory(this, zipper, iterables));\n }\n\n });\n\n IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;\n IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;\n\n\n\n mixin(SetIterable, {\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function(value) {\n return this.has(value);\n },\n\n\n // ### More sequential methods\n\n keySeq: function() {\n return this.valueSeq();\n }\n\n });\n\n SetIterable.prototype.has = IterablePrototype.includes;\n SetIterable.prototype.contains = SetIterable.prototype.includes;\n\n\n // Mixin subclasses\n\n mixin(KeyedSeq, KeyedIterable.prototype);\n mixin(IndexedSeq, IndexedIterable.prototype);\n mixin(SetSeq, SetIterable.prototype);\n\n mixin(KeyedCollection, KeyedIterable.prototype);\n mixin(IndexedCollection, IndexedIterable.prototype);\n mixin(SetCollection, SetIterable.prototype);\n\n\n // #pragma Helper functions\n\n function keyMapper(v, k) {\n return k;\n }\n\n function entryMapper(v, k) {\n return [k, v];\n }\n\n function not(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n }\n }\n\n function neg(predicate) {\n return function() {\n return -predicate.apply(this, arguments);\n }\n }\n\n function quoteString(value) {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n }\n\n function defaultZipper() {\n return arrCopy(arguments);\n }\n\n function defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n }\n\n function hashIterable(iterable) {\n if (iterable.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(iterable);\n var keyed = isKeyed(iterable);\n var h = ordered ? 1 : 0;\n var size = iterable.__iterate(\n keyed ?\n ordered ?\n function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } :\n function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } :\n ordered ?\n function(v ) { h = 31 * h + hash(v) | 0; } :\n function(v ) { h = h + hash(v) | 0; }\n );\n return murmurHashOfSize(size, h);\n }\n\n function murmurHashOfSize(size, h) {\n h = imul(h, 0xCC9E2D51);\n h = imul(h << 15 | h >>> -15, 0x1B873593);\n h = imul(h << 13 | h >>> -13, 5);\n h = (h + 0xE6546B64 | 0) ^ size;\n h = imul(h ^ h >>> 16, 0x85EBCA6B);\n h = imul(h ^ h >>> 13, 0xC2B2AE35);\n h = smi(h ^ h >>> 16);\n return h;\n }\n\n function hashMerge(a, b) {\n return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int\n }\n\n var Immutable = {\n\n Iterable: Iterable,\n\n Seq: Seq,\n Collection: Collection,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS\n\n };\n\n return Immutable;\n\n}));","/*!\n * isobject
\n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nmodule.exports = function isObject(val) {\n return val != null && typeof val === 'object' && Array.isArray(val) === false;\n};\n","/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\n'use strict';\n\nvar isObject = require('isobject');\n\nfunction isObjectObject(o) {\n return isObject(o) === true\n && Object.prototype.toString.call(o) === '[object Object]';\n}\n\nmodule.exports = function isPlainObject(o) {\n var ctor,prot;\n\n if (isObjectObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (typeof ctor !== 'function') return false;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObjectObject(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","var isProduction = process.env.NODE_ENV === 'production';\nvar index = (function (condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n console.warn(message);\n }\n});\n\nexport default index;\n","\"use strict\";\n\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\nfunction setup(env) {\n createDebug.debug = createDebug;\n createDebug.default = createDebug;\n createDebug.coerce = coerce;\n createDebug.disable = disable;\n createDebug.enable = enable;\n createDebug.enabled = enabled;\n createDebug.humanize = require('ms');\n Object.keys(env).forEach(function (key) {\n createDebug[key] = env[key];\n });\n /**\n * Active `debug` instances.\n */\n\n createDebug.instances = [];\n /**\n * The currently active debug mode names, and names to skip.\n */\n\n createDebug.names = [];\n createDebug.skips = [];\n /**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n */\n\n createDebug.formatters = {};\n /**\n * Selects a color for a debug namespace\n * @param {String} namespace The namespace string for the for the debug instance to be colored\n * @return {Number|String} An ANSI color code for the given namespace\n * @api private\n */\n\n function selectColor(namespace) {\n var hash = 0;\n\n for (var i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i);\n hash |= 0; // Convert to 32bit integer\n }\n\n return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n }\n\n createDebug.selectColor = selectColor;\n /**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\n function createDebug(namespace) {\n var prevTime;\n\n function debug() {\n // Disabled?\n if (!debug.enabled) {\n return;\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var self = debug; // Set `diff` timestamp\n\n var curr = Number(new Date());\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n args[0] = createDebug.coerce(args[0]);\n\n if (typeof args[0] !== 'string') {\n // Anything else let's inspect with %O\n args.unshift('%O');\n } // Apply any `formatters` transformations\n\n\n var index = 0;\n args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {\n // If we encounter an escaped % then don't increase the array index\n if (match === '%%') {\n return match;\n }\n\n index++;\n var formatter = createDebug.formatters[format];\n\n if (typeof formatter === 'function') {\n var val = args[index];\n match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`\n\n args.splice(index, 1);\n index--;\n }\n\n return match;\n }); // Apply env-specific formatting (colors, etc.)\n\n createDebug.formatArgs.call(self, args);\n var logFn = self.log || createDebug.log;\n logFn.apply(self, args);\n }\n\n debug.namespace = namespace;\n debug.enabled = createDebug.enabled(namespace);\n debug.useColors = createDebug.useColors();\n debug.color = selectColor(namespace);\n debug.destroy = destroy;\n debug.extend = extend; // Debug.formatArgs = formatArgs;\n // debug.rawLog = rawLog;\n // env-specific initialization logic for debug instances\n\n if (typeof createDebug.init === 'function') {\n createDebug.init(debug);\n }\n\n createDebug.instances.push(debug);\n return debug;\n }\n\n function destroy() {\n var index = createDebug.instances.indexOf(this);\n\n if (index !== -1) {\n createDebug.instances.splice(index, 1);\n return true;\n }\n\n return false;\n }\n\n function extend(namespace, delimiter) {\n return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n }\n /**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\n\n function enable(namespaces) {\n createDebug.save(namespaces);\n createDebug.names = [];\n createDebug.skips = [];\n var i;\n var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n var len = split.length;\n\n for (i = 0; i < len; i++) {\n if (!split[i]) {\n // ignore empty strings\n continue;\n }\n\n namespaces = split[i].replace(/\\*/g, '.*?');\n\n if (namespaces[0] === '-') {\n createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n createDebug.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n\n for (i = 0; i < createDebug.instances.length; i++) {\n var instance = createDebug.instances[i];\n instance.enabled = createDebug.enabled(instance.namespace);\n }\n }\n /**\n * Disable debug output.\n *\n * @api public\n */\n\n\n function disable() {\n createDebug.enable('');\n }\n /**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\n\n function enabled(name) {\n if (name[name.length - 1] === '*') {\n return true;\n }\n\n var i;\n var len;\n\n for (i = 0, len = createDebug.skips.length; i < len; i++) {\n if (createDebug.skips[i].test(name)) {\n return false;\n }\n }\n\n for (i = 0, len = createDebug.names.length; i < len; i++) {\n if (createDebug.names[i].test(name)) {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\n\n function coerce(val) {\n if (val instanceof Error) {\n return val.stack || val.message;\n }\n\n return val;\n }\n\n createDebug.enable(createDebug.load());\n return createDebug;\n}\n\nmodule.exports = setup;\n\n","\"use strict\";\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\n/**\n * Colors.\n */\n\nexports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n// eslint-disable-next-line complexity\n\nfunction useColors() {\n // NB: In an Electron preload script, document will be defined but not fully\n // initialized. Since we know we're in Chrome, we'll just detect this case\n // explicitly\n if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n return true;\n } // Internet Explorer and Edge do not support colors.\n\n\n if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n return false;\n } // Is webkit? http://stackoverflow.com/a/16459606/376773\n // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\n\n return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker\n typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n}\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\n\nfunction formatArgs(args) {\n args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);\n\n if (!this.useColors) {\n return;\n }\n\n var c = 'color: ' + this.color;\n args.splice(1, 0, c, 'color: inherit'); // The final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-zA-Z%]/g, function (match) {\n if (match === '%%') {\n return;\n }\n\n index++;\n\n if (match === '%c') {\n // We only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n args.splice(lastC, 0, c);\n}\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\n\nfunction log() {\n var _console;\n\n // This hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return (typeof console === \"undefined\" ? \"undefined\" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);\n}\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\n\nfunction save(namespaces) {\n try {\n if (namespaces) {\n exports.storage.setItem('debug', namespaces);\n } else {\n exports.storage.removeItem('debug');\n }\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\n\nfunction load() {\n var r;\n\n try {\n r = exports.storage.getItem('debug');\n } catch (error) {} // Swallow\n // XXX (@Qix-) should we be logging these?\n // If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\n\n if (!r && typeof process !== 'undefined' && 'env' in process) {\n r = process.env.DEBUG;\n }\n\n return r;\n}\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\n\nfunction localstorage() {\n try {\n // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n // The Browser also has localStorage in the global context.\n return localStorage;\n } catch (error) {// Swallow\n // XXX (@Qix-) should we be logging these?\n }\n}\n\nmodule.exports = require('./common')(exports);\nvar formatters = module.exports.formatters;\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n try {\n return JSON.stringify(v);\n } catch (error) {\n return '[UnexpectedJSONParseError]: ' + error.message;\n }\n};\n\n","/*! https://mths.be/esrever v0.2.0 by @mathias */\n;(function(root) {\n\n\t// Detect free variables `exports`\n\tvar freeExports = typeof exports == 'object' && exports;\n\n\t// Detect free variable `module`\n\tvar freeModule = typeof module == 'object' && module &&\n\t\tmodule.exports == freeExports && module;\n\n\t// Detect free variable `global`, from Node.js or Browserified code,\n\t// and use it as `root`\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {\n\t\troot = freeGlobal;\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar regexSymbolWithCombiningMarks = /([\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])([\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F]+)/g;\n\tvar regexSurrogatePair = /([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])/g;\n\n\tvar reverse = function(string) {\n\t\t// Step 1: deal with combining marks and astral symbols (surrogate pairs)\n\t\tstring = string\n\t\t\t// Swap symbols with their combining marks so the combining marks go first\n\t\t\t.replace(regexSymbolWithCombiningMarks, function($0, $1, $2) {\n\t\t\t\t// Reverse the combining marks so they will end up in the same order\n\t\t\t\t// later on (after another round of reversing)\n\t\t\t\treturn reverse($2) + $1;\n\t\t\t})\n\t\t\t// Swap high and low surrogates so the low surrogates go first\n\t\t\t.replace(regexSurrogatePair, '$2$1');\n\t\t// Step 2: reverse the code units in the string\n\t\tvar result = '';\n\t\tvar index = string.length;\n\t\twhile (index--) {\n\t\t\tresult += string.charAt(index);\n\t\t}\n\t\treturn result;\n\t};\n\n\t/*--------------------------------------------------------------------------*/\n\n\tvar esrever = {\n\t\t'version': '0.2.0',\n\t\t'reverse': reverse\n\t};\n\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine(function() {\n\t\t\treturn esrever;\n\t\t});\n\t}\telse if (freeExports && !freeExports.nodeType) {\n\t\tif (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = esrever;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (var key in esrever) {\n\t\t\t\tesrever.hasOwnProperty(key) && (freeExports[key] = esrever[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.esrever = esrever;\n\t}\n\n}(this));\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\nmodule.exports = isArray;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_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\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\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 * 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.toString;\n\n/** Built-in value references. */\nvar symToStringTag = 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.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = 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.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\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_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\nmodule.exports = baseGetTag;\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\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[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(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var isArray = require('./isArray'),\n isSymbol = require('./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(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\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(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[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(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 || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_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\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.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.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_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 = Function.prototype,\n objectProto = 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 = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).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(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\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\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_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\nmodule.exports = getNative;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_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\nmodule.exports = hashClear;\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\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\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 * 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 ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\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 * 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.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__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 : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_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\nmodule.exports = Hash;\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\nmodule.exports = listCacheClear;\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\nmodule.exports = eq;\n","var eq = require('./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(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_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\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\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\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\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\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\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\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_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\nmodule.exports = ListCache;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\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\nmodule.exports = mapCacheClear;\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\nmodule.exports = isKeyable;\n","var isKeyable = require('./_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\nmodule.exports = getMapData;\n","var getMapData = require('./_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\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\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\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\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\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\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\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_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\nmodule.exports = MapCache;\n","var MapCache = require('./_MapCache');\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\nmodule.exports = memoize;\n","var memoize = require('./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(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\nmodule.exports = memoizeCapped;\n","var memoizeCapped = require('./_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\nmodule.exports = stringToPath;\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\nmodule.exports = arrayMap;\n","var Symbol = require('./_Symbol'),\n arrayMap = require('./_arrayMap'),\n isArray = require('./isArray'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.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(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n","var baseToString = require('./_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\nmodule.exports = toString;\n","var isArray = require('./isArray'),\n isKey = require('./_isKey'),\n stringToPath = require('./_stringToPath'),\n toString = require('./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(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n","var isSymbol = require('./isSymbol');\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(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n","var castPath = require('./_castPath'),\n toKey = require('./_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\nmodule.exports = baseGet;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\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) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\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 `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.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\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\nmodule.exports = isIndex;\n","var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseGet = require('./_baseGet'),\n baseSet = require('./_baseSet'),\n castPath = require('./_castPath');\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nmodule.exports = basePickBy;\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\nmodule.exports = baseHasIn;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[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(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\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/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.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(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 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;\n}\n\nmodule.exports = isLength;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\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(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_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\nmodule.exports = hasIn;\n","var basePickBy = require('./_basePickBy'),\n hasIn = require('./hasIn');\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nmodule.exports = basePick;\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\nmodule.exports = arrayPush;\n","var Symbol = require('./_Symbol'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray');\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(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n","var arrayPush = require('./_arrayPush'),\n isFlattenable = require('./_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\nmodule.exports = baseFlatten;\n","var baseFlatten = require('./_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\nmodule.exports = flatten;\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\nmodule.exports = apply;\n","var apply = require('./_apply');\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\nmodule.exports = overRest;\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\nmodule.exports = constant;\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\nmodule.exports = identity;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\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 ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\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\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_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\nmodule.exports = setToString;\n","var flatten = require('./flatten'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\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), func + '');\n}\n\nmodule.exports = flatRest;\n","var basePick = require('./_basePick'),\n flatRest = require('./_flatRest');\n\n/**\n * Creates an object composed of the picked `object` properties.\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 pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nmodule.exports = pick;\n","var ListCache = require('./_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\nmodule.exports = stackClear;\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\nmodule.exports = stackDelete;\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\nmodule.exports = stackGet;\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\nmodule.exports = stackHas;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_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\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_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\nmodule.exports = Stack;\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\nmodule.exports = arrayEach;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\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\nmodule.exports = copyObject;\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\nmodule.exports = baseTimes;\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\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == '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;\n\nmodule.exports = isBuffer;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\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 mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\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 of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = 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(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\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\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == '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","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\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\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\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 * 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(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(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.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\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = 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;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\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\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\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 * 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.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./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(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\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(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\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(source), object);\n}\n\nmodule.exports = baseAssign;\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\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\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 * 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(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.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\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(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\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(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == '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 * 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\nmodule.exports = copyArray;\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\nmodule.exports = arrayFilter;\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\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\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 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 ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\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\nmodule.exports = copySymbols;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\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 : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_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\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\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(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./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, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\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, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[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) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\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 * 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.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_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\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\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\nmodule.exports = cloneDataView;\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\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\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\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_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\nmodule.exports = cloneTypedArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\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/**\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:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var isObject = require('./isObject');\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(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\nmodule.exports = baseCreate;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_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\nmodule.exports = initCloneObject;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[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(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\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\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[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(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\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\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys');\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/** `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,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\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(value)) {\n return value;\n }\n var isArr = isArray(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(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(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(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 : keys);\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\nmodule.exports = baseClone;\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\nmodule.exports = last;\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\nmodule.exports = baseSlice;\n","var baseGet = require('./_baseGet'),\n baseSlice = require('./_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\nmodule.exports = parent;\n","var castPath = require('./_castPath'),\n last = require('./last'),\n parent = require('./_parent'),\n toKey = require('./_toKey');\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(path))];\n}\n\nmodule.exports = baseUnset;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = 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 = objectProto.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(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","var isPlainObject = require('./isPlainObject');\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(value) ? undefined : value;\n}\n\nmodule.exports = customOmitClone;\n","var arrayMap = require('./_arrayMap'),\n baseClone = require('./_baseClone'),\n baseUnset = require('./_baseUnset'),\n castPath = require('./_castPath'),\n copyObject = require('./_copyObject'),\n customOmitClone = require('./_customOmitClone'),\n flatRest = require('./_flatRest'),\n getAllKeysIn = require('./_getAllKeysIn');\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\nmodule.exports = omit;\n","'use strict';\n\nvar GROUP_LEFT_TO_RIGHT,\n GROUP_RIGHT_TO_LEFT,\n EXPRESSION_LEFT_TO_RIGHT,\n EXPRESSION_RIGHT_TO_LEFT;\n\n/*\n * Character ranges of left-to-right characters.\n */\n\nGROUP_LEFT_TO_RIGHT = 'A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6' +\n '\\u00F8-\\u02B8\\u0300-\\u0590\\u0800-\\u1FFF\\u200E\\u2C00-\\uFB1C' +\n '\\uFE00-\\uFE6F\\uFEFD-\\uFFFF';\n\n/*\n * Character ranges of right-to-left characters.\n */\n\nGROUP_RIGHT_TO_LEFT = '\\u0591-\\u07FF\\uFB1D-\\uFDFD\\uFE70-\\uFEFC';\n\n/*\n * Expression to match a left-to-right string.\n *\n * Matches the start of a string, followed by zero or\n * more non-right-to-left characters, followed by a\n * left-to-right character.\n */\n\nEXPRESSION_LEFT_TO_RIGHT = new RegExp(\n '^[^' + GROUP_RIGHT_TO_LEFT + ']*[' + GROUP_LEFT_TO_RIGHT + ']'\n);\n\n/*\n * Expression to match a right-to-left string.\n *\n * Matches the start of a string, followed by zero or\n * more non-left-to-right characters, followed by a\n * right-to-left character.\n */\n\nEXPRESSION_RIGHT_TO_LEFT = new RegExp(\n '^[^' + GROUP_LEFT_TO_RIGHT + ']*[' + GROUP_RIGHT_TO_LEFT + ']'\n);\n\n/**\n * Detect the direction of text.\n *\n * @param {string} value - value to stringify and check.\n * @return {string} - One of `\"rtl\"`, `\"ltr\"`, or\n * `\"neutral\"`.\n */\nfunction direction(value) {\n value = value.toString();\n\n if (EXPRESSION_RIGHT_TO_LEFT.test(value)) {\n return 'rtl';\n }\n\n if (EXPRESSION_LEFT_TO_RIGHT.test(value)) {\n return 'ltr';\n }\n\n return 'neutral';\n}\n\n/*\n * Expose `direction`.\n */\n\nmodule.exports = direction;\n","import \"@babel/polyfill\"\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport * as Sentry from '@sentry/browser'\nimport { bindAllSettledToPromise } from '~/utils/promise'\nimport { version } from '~/../package.json';\n\nimport Application from '~/Application/index';\n\n\nfunction renderApp() {\n\n\tif(process.env.SENTRY_DSN){\n\t\tSentry.init({\n\t\t\tdsn: process.env.SENTRY_DSN,\n\t\t\tenvironment: process.env.ENVIRONMENT,\n\t\t\trelease: version,\n\t\t\tintegrations: [\n\t\t\t\tnew Sentry.Integrations.Breadcrumbs({})\n\t\t\t],\n\t\t})\n\t}\n\n\t// const Application = require(\"~/Application/index\").default\n\tReactDOM.render(, document.getElementById(\"editor\"))\n}\n\n// implement Promise.allSettled if not supported by browser\nbindAllSettledToPromise()\n\nrenderApp()\n\nif (module.hot) {\n\tmodule.hot.accept(renderApp)\n}\n","/**\n * An auto-incrementing index for generating keys.\n *\n * @type {Number}\n */\n\nlet n\n\n/**\n * The global key generating function.\n *\n * @type {Function}\n */\n\nlet generate\n\n/**\n * Create a key, using a provided key if available.\n *\n * @param {String|Void} key\n * @return {String}\n */\n\nfunction create(key) {\n if (key == null) {\n return generate()\n }\n\n if (typeof key === 'string') {\n return key\n }\n\n throw new Error(`Keys must be strings, but you passed: ${key}`)\n}\n\n/**\n * Set a different unique ID generating `function`.\n *\n * @param {Function} func\n */\n\nfunction setGenerator(func) {\n generate = func\n}\n\n/**\n * Reset the key generating function to its initial state.\n */\n\nfunction resetGenerator() {\n n = 0\n generate = () => `${n++}`\n}\n\n/**\n * Set the initial state.\n */\n\nresetGenerator()\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n create,\n setGenerator,\n resetGenerator,\n}\n","import { List } from 'immutable'\n\n/**\n * Compare paths `path` and `target` to see which is before or after.\n *\n * @param {List} path\n * @param {List} target\n * @return {Number|Null}\n */\n\nfunction compare(path, target) {\n const m = min(path, target)\n\n for (let i = 0; i < m; i++) {\n const pv = path.get(i)\n const tv = target.get(i)\n\n // If the path's value is ever less than the target's, it's before.\n if (pv < tv) return -1\n\n // If the target's value is ever less than the path's, it's after.\n if (pv > tv) return 1\n }\n\n // Paths should now be equal, otherwise something is wrong\n return path.size === target.size ? 0 : null\n}\n\n/**\n * Create a path from `attrs`.\n *\n * @param {Array|List} attrs\n * @return {List}\n */\n\nfunction create(attrs) {\n if (attrs == null) {\n return null\n }\n\n if (List.isList(attrs)) {\n return attrs\n }\n\n if (Array.isArray(attrs)) {\n return List(attrs)\n }\n\n throw new Error(\n `Paths can only be created from arrays or lists, but you passed: ${attrs}`\n )\n}\n\n/**\n * Crop paths `a` and `b` to an equal size, defaulting to the shortest.\n *\n * @param {List} a\n * @param {List} b\n */\n\nfunction crop(a, b, size = min(a, b)) {\n const ca = a.slice(0, size)\n const cb = b.slice(0, size)\n return [ca, cb]\n}\n\n/**\n * Decrement a `path` by `n` at `index`, defaulting to the last index.\n *\n * @param {List} path\n * @param {Number} n\n * @param {Number} index\n */\n\nfunction decrement(path, n = 1, index = path.size - 1) {\n return increment(path, 0 - n, index)\n}\n\n/**\n * Get all ancestor paths of th given path.\n *\n * @param {List} path\n * @returns {List}\n */\n\nfunction getAncestors(path) {\n const ancestors = List().withMutations(list => {\n for (let i = 0; i < path.size; i++) {\n list.push(path.slice(0, i))\n }\n })\n\n return ancestors\n}\n\n/**\n * Increment a `path` by `n` at `index`, defaulting to the last index.\n *\n * @param {List} path\n * @param {Number} n\n * @param {Number} index\n */\n\nfunction increment(path, n = 1, index = path.size - 1) {\n const value = path.get(index)\n const newValue = value + n\n const newPath = path.set(index, newValue)\n return newPath\n}\n\n/**\n * Is a `path` above another `target` path?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isAbove(path, target) {\n const [p, t] = crop(path, target)\n return path.size < target.size && compare(p, t) === 0\n}\n\n/**\n * Is a `path` after another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isAfter(path, target) {\n const [p, t] = crop(path, target)\n return compare(p, t) === 1\n}\n\n/**\n * Is a `path` before another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isBefore(path, target) {\n const [p, t] = crop(path, target)\n return compare(p, t) === -1\n}\n\n/**\n * Is a `path` equal to another `target` path in a document?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isEqual(path, target) {\n return path.equals(target)\n}\n\n/**\n * Is a `path` older than a `target` path? Meaning that it ends as an older\n * sibling of one of the indexes in the target.\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isOlder(path, target) {\n const index = path.size - 1\n const [p, t] = crop(path, target, index)\n const pl = path.get(index)\n const tl = target.get(index)\n return isEqual(p, t) && pl > tl\n}\n\n/**\n * Is an `any` object a path?\n *\n * @param {Mixed} any\n * @return {Boolean}\n */\n\nfunction isPath(any) {\n return (\n (List.isList(any) || Array.isArray(any)) &&\n any.every(n => typeof n === 'number')\n )\n}\n\n/**\n * Is a `path` a sibling of a `target` path?\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isSibling(path, target) {\n if (path.size !== target.size) return false\n const p = path.butLast()\n const t = target.butLast()\n return p.equals(t)\n}\n\n/**\n * Is a `path` younger than a `target` path? Meaning that it ends as a younger\n * sibling of one of the indexes in the target.\n *\n * @param {List} path\n * @param {List} target\n * @return {Boolean}\n */\n\nfunction isYounger(path, target) {\n const index = path.size - 1\n const [p, t] = crop(path, target, index)\n const pl = path.get(index)\n const tl = target.get(index)\n return isEqual(p, t) && pl < tl\n}\n\n/**\n * Lift a `path` to refer to its `n`th ancestor.\n *\n * @param {List} path\n * @return {List}\n */\n\nfunction lift(path, n = 1) {\n const ancestor = path.slice(0, -1 * n)\n return ancestor\n}\n\n/**\n * Drop a `path`, returning a relative path from a depth of `n`.\n *\n * @param {List} path\n * @param {Number} n\n * @return {List}\n */\n\nfunction drop(path, n = 1) {\n const relative = path.slice(n)\n return relative\n}\n\n/**\n * Get the maximum length of paths `a` and `b`.\n *\n * @param {List} path\n * @param {List} path\n * @return {Number}\n */\n\nfunction max(a, b) {\n const n = Math.max(a.size, b.size)\n return n\n}\n\n/**\n * Get the minimum length of paths `a` and `b`.\n *\n * @param {List} path\n * @param {List} path\n * @return {Number}\n */\n\nfunction min(a, b) {\n const n = Math.min(a.size, b.size)\n return n\n}\n\n/**\n * Get the common ancestor path of path `a` and path `b`.\n *\n * @param {List} a\n * @param {List} b\n * @return {List}\n */\n\nfunction relate(a, b) {\n const array = []\n\n for (let i = 0; i < a.size && i < b.size; i++) {\n const av = a.get(i)\n const bv = b.get(i)\n\n // If the values aren't equal, they've diverged and don't share an ancestor.\n if (av !== bv) break\n\n // Otherwise, the current value is still a common ancestor.\n array.push(av)\n }\n\n const path = create(array)\n return path\n}\n\n/**\n * Transform a `path` by an `operation`, adjusting it to stay current.\n *\n * @param {List} path\n * @param {Operation} operation\n * @return {List}\n */\n\nfunction transform(path, operation) {\n const { type, position, path: p } = operation\n\n if (\n type === 'add_mark' ||\n type === 'insert_text' ||\n type === 'remove_mark' ||\n type === 'remove_text' ||\n type === 'set_mark' ||\n type === 'set_node' ||\n type === 'set_selection' ||\n type === 'set_value' ||\n type === 'add_annotation' ||\n type === 'remove_annotation' ||\n type === 'set_annotation' ||\n path.size === 0\n ) {\n return List([path])\n }\n\n const pIndex = p.size - 1\n const pEqual = isEqual(p, path)\n const pYounger = isYounger(p, path)\n const pAbove = isAbove(p, path)\n\n if (type === 'insert_node') {\n if (pEqual || pYounger || pAbove) {\n path = increment(path, 1, pIndex)\n }\n }\n\n if (type === 'remove_node') {\n if (pYounger) {\n path = decrement(path, 1, pIndex)\n } else if (pEqual || pAbove) {\n path = []\n }\n }\n\n if (type === 'merge_node') {\n if (pEqual || pYounger) {\n path = decrement(path, 1, pIndex)\n } else if (pAbove) {\n path = decrement(path, 1, pIndex)\n path = increment(path, position, pIndex + 1)\n }\n }\n\n if (type === 'split_node') {\n if (pEqual) {\n path = [path, increment(path)]\n } else if (pYounger) {\n path = increment(path, 1, pIndex)\n } else if (pAbove) {\n if (path.get(pIndex + 1) >= position) {\n path = increment(path, 1, pIndex)\n path = decrement(path, position, pIndex + 1)\n }\n }\n }\n\n if (type === 'move_node') {\n const { newPath: np } = operation\n\n if (isEqual(p, np)) {\n return List([path])\n }\n\n if (pAbove || pEqual) {\n // We are comparing something that was moved\n // The new path is unaffected unless the old path was the left-sibling of an ancestor\n if (isYounger(p, np) && p.size < np.size) {\n path = decrement(np, 1, min(np, p) - 1).concat(path.slice(p.size))\n } else {\n path = np.concat(path.slice(p.size))\n }\n } else {\n // This is equivalent logic to remove_node for path\n if (pYounger) {\n path = decrement(path, 1, pIndex)\n }\n\n // This is the equivalent logic to insert_node for newPath\n if (isYounger(np, path) || isEqual(np, path) || isAbove(np, path)) {\n path = increment(path, 1, np.size - 1)\n }\n }\n }\n\n const paths = Array.isArray(path) ? path : [path]\n return List(paths)\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default {\n compare,\n create,\n crop,\n decrement,\n getAncestors,\n increment,\n isAbove,\n isAfter,\n isBefore,\n isEqual,\n isOlder,\n isPath,\n isSibling,\n isYounger,\n lift,\n drop,\n max,\n min,\n relate,\n transform,\n}\n","import isPlainObject from 'is-plain-object'\nimport warning from 'tiny-warning'\nimport { Record } from 'immutable'\n\nimport KeyUtils from '../utils/key-utils'\nimport PathUtils from '../utils/path-utils'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n key: undefined,\n offset: undefined,\n path: undefined,\n}\n\n/**\n * Point.\n *\n * @type {Point}\n */\n\nclass Point extends Record(DEFAULTS) {\n /**\n * Create a new `Point` with `attrs`.\n *\n * @param {Object|Point} attrs\n * @return {Point}\n */\n\n static create(attrs = {}) {\n if (Point.isPoint(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Point.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Point.create\\` only accepts objects or points, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a dictionary of settable point properties from `attrs`.\n *\n * @param {Object|Point} attrs\n * @return {Object}\n */\n\n static createProperties(a = {}) {\n if (Point.isPoint(a)) {\n return {\n key: a.key,\n offset: a.offset,\n path: a.path,\n }\n }\n\n if (isPlainObject(a)) {\n const p = {}\n if ('key' in a) p.key = a.key\n if ('offset' in a) p.offset = a.offset\n if ('path' in a) p.path = PathUtils.create(a.path)\n\n // If only a path is set, or only a key is set, ensure that the other is\n // set to null so that it can be normalized back to the right value.\n // Otherwise we won't realize that the path and key don't match anymore.\n if ('path' in a && !('key' in a)) p.key = null\n if ('key' in a && !('path' in a)) p.path = null\n\n return p\n }\n\n throw new Error(\n `\\`Point.createProperties\\` only accepts objects or points, but you passed it: ${a}`\n )\n }\n\n /**\n * Create a `Point` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Point}\n */\n\n static fromJSON(object) {\n const { key = null, offset = null, path = null } = object\n\n const point = new Point({\n key,\n offset,\n path: PathUtils.create(path),\n })\n\n return point\n }\n\n /**\n * Check whether all properties of the point are set.\n *\n * @return {Boolean}\n */\n\n get isSet() {\n return this.key != null && this.offset != null && this.path != null\n }\n\n /**\n * Check whether any property of the point is not set.\n *\n * @return {Boolean}\n */\n\n get isUnset() {\n return !this.isSet\n }\n\n /**\n * Check whether the point is after another `point`.\n *\n * @return {Boolean}\n */\n\n isAfterPoint(point) {\n if (this.isUnset) return false\n const is =\n (this.key === point.key && this.offset > point.offset) ||\n PathUtils.compare(this.path, point.path) === 1\n return is\n }\n\n /**\n * Check whether the point is after a `range`.\n *\n * @return {Boolean}\n */\n\n isAfterRange(range) {\n if (this.isUnset) return false\n const is = this.isAfterPoint(range.end)\n return is\n }\n\n /**\n * Check whether the point is at the end of a `range`.\n *\n * @return {Boolean}\n */\n\n isAtEndOfRange(range) {\n if (this.isUnset) return false\n const is = this.equals(range.end)\n return is\n }\n\n /**\n * Check whether the point is at the start of a `range`.\n *\n * @return {Boolean}\n */\n\n isAtStartOfRange(range) {\n if (this.isUnset) return false\n const is = this.equals(range.start)\n return is\n }\n\n /**\n * Check whether the point is before another `point`.\n *\n * @return {Boolean}\n */\n\n isBeforePoint(point) {\n if (this.isUnset) return false\n const is =\n (this.key === point.key && this.offset < point.offset) ||\n PathUtils.compare(this.path, point.path) === -1\n return is\n }\n\n /**\n * Check whether the point is before a `range`.\n *\n * @return {Boolean}\n */\n\n isBeforeRange(range) {\n if (this.isUnset) return false\n const is = this.isBeforePoint(range.start)\n return is\n }\n\n /**\n * Check whether the point is inside a `range`.\n *\n * @return {Boolean}\n */\n\n isInRange(range) {\n if (this.isUnset) return false\n const is =\n this.equals(range.start) ||\n this.equals(range.end) ||\n (this.isAfterPoint(range.start) && this.isBeforePoint(range.end))\n return is\n }\n\n /**\n * Check whether the point is at the end of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtEndOfNode(node) {\n if (this.isUnset) return false\n const last = node.getLastText()\n const is = this.key === last.key && this.offset === last.text.length\n return is\n }\n\n /**\n * Check whether the point is at the start of a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isAtStartOfNode(node) {\n if (this.isUnset) return false\n\n // PERF: Do a check for a `0` offset first since it's quickest.\n if (this.offset !== 0) return false\n\n const first = node.getFirstText()\n const is = this.key === first.key\n return is\n }\n\n /**\n * Check whether the point is in a `node`.\n *\n * @param {Node} node\n * @return {Boolean}\n */\n\n isInNode(node) {\n if (this.isUnset) return false\n if (node.object === 'text' && node.key === this.key) return true\n if (node.hasNode(this.key)) return true\n return false\n }\n\n /**\n * Move the point's offset backward `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Point}\n */\n\n moveBackward(n = 1) {\n if (n === 0) return this\n if (n < 0) return this.moveForward(-n)\n const point = this.setOffset(this.offset - n)\n return point\n }\n\n /**\n * Move the point's offset forward `n` characters.\n *\n * @param {Number} n (optional)\n * @return {Point}\n */\n\n moveForward(n = 1) {\n if (n === 0) return this\n if (n < 0) return this.moveBackward(-n)\n const point = this.setOffset(this.offset + n)\n return point\n }\n\n /**\n * Move the point's anchor point to a new `path` and `offset`.\n *\n * Optionally, the `path` can be a key string, or omitted entirely in which\n * case it would be the offset number.\n *\n * @param {List|String|Number} path\n * @param {Number} offset\n * @return {Point}\n */\n\n moveTo(path, offset = 0) {\n let key = this.key\n\n if (typeof path === 'number') {\n offset = path\n path = this.path\n } else if (typeof path === 'string') {\n key = path\n path = key === this.key ? this.path : null\n } else {\n key = path.equals(this.path) ? this.key : null\n }\n\n const point = this.merge({ key, path, offset })\n return point\n }\n\n /**\n * Move the point's anchor point to the start of a `node`.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n moveToStartOfNode(node) {\n const first = node.getFirstText()\n const point = this.moveTo(first.key, 0)\n return point\n }\n\n /**\n * Move the point's anchor point to the end of a `node`.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n moveToEndOfNode(node) {\n const last = node.getLastText()\n const point = this.moveTo(last.key, last.text.length)\n return point\n }\n\n /**\n * Normalize the point relative to a `node`, ensuring that its key and path\n * reference a text node, or that it gets unset.\n *\n * @param {Node} node\n * @return {Point}\n */\n\n normalize(node) {\n // If both the key and path are null, there's no reference to a node, so\n // make sure it is entirely unset.\n if (this.key == null && this.path == null) {\n return this.setOffset(null)\n }\n\n const { key, offset, path } = this\n\n // PERF: this function gets called a lot.\n // to avoid creating the key -> path lookup table, we attempt to look up by path first.\n let target = path && node.getNode(path)\n\n if (!target) {\n target = node.getNode(key)\n\n if (target) {\n // There is a misalignment of path and key\n const point = this.merge({\n path: node.getPath(key),\n })\n\n return point\n }\n }\n\n if (!target) {\n warning(false, \"A point's `path` or `key` invalid and was reset!\")\n\n const text = node.getFirstText()\n if (!text) return Point.create()\n\n const point = this.merge({\n key: text.key,\n offset: 0,\n path: node.getPath(text.key),\n })\n\n return point\n }\n\n if (target.object !== 'text') {\n warning(false, 'A point should not reference a non-text node!')\n\n const text = target.getTextAtOffset(offset)\n const before = target.getOffset(text.key)\n const point = this.merge({\n offset: offset - before,\n key: text.key,\n path: node.getPath(text.key),\n })\n\n return point\n }\n\n if (target && path && key && key !== target.key) {\n warning(false, \"A point's `key` did not match its `path`!\")\n\n // TODO: if we look up by path above and it differs by key, do we want to reset it to looking up by key?\n }\n\n let point = this.merge({\n key: target.key,\n path: path == null ? node.getPath(target.key) : path,\n offset: offset == null ? 0 : Math.min(offset, target.text.length),\n })\n\n // COMPAT: There is an ambiguity, since a point can exist at the end of a\n // text node, or at the start of the following one. To eliminate it we\n // enforce that if there is a following text node, we always move it there.\n if (point.offset === target.text.length) {\n const block = node.getClosestBlock(point.path)\n // TODO: this next line is broken because `getNextText` takes a path\n const next = block.getNextText()\n\n if (next) {\n point = point.merge({\n key: next.key,\n path: node.getPath(next.key),\n offset: 0,\n })\n }\n }\n\n return point\n }\n\n /**\n * Set the point's key to a new `key`.\n *\n * @param {String} key\n * @return {Point}\n */\n\n setKey(key) {\n if (key != null) {\n key = KeyUtils.create(key)\n }\n\n const point = this.set('key', key)\n return point\n }\n\n /**\n * Set the point's offset to a new `offset`.\n *\n * @param {Number} offset\n * @return {Point}\n */\n\n setOffset(offset) {\n const point = this.set('offset', offset)\n return point\n }\n\n /**\n * Set the point's path to a new `path`.\n *\n * @param {List|Array} path\n * @return {Point}\n */\n\n setPath(path) {\n if (path != null) {\n path = PathUtils.create(path)\n }\n\n const point = this.set('path', path)\n return point\n }\n\n /**\n * Return a JSON representation of the point.\n *\n * @param {Object} options\n * @return {Object}\n */\n\n toJSON(options = {}) {\n const object = {\n object: this.object,\n key: this.key,\n offset: this.offset,\n path: this.path && this.path.toArray(),\n }\n\n if (!options.preserveKeys) {\n delete object.key\n }\n\n return object\n }\n\n /**\n * Unset the point.\n *\n * @return {Point}\n */\n\n unset() {\n return this.merge({\n key: null,\n offset: null,\n path: null,\n })\n }\n}\n\n/**\n * Export.\n *\n * @type {Point}\n */\n\nexport default Point\n","import isPlainObject from 'is-plain-object'\nimport { Map } from 'immutable'\n\n/**\n * Data.\n *\n * This isn't an immutable record, it's just a thin wrapper around `Map` so that\n * we can allow for more convenient creation.\n *\n * @type {Object}\n */\n\nclass Data {\n /**\n * Create a new `Data` with `attrs`.\n *\n * @param {Object|Data|Map} attrs\n * @return {Data} data\n */\n\n static create(attrs = {}) {\n if (Map.isMap(attrs)) {\n return attrs\n }\n\n if (isPlainObject(attrs)) {\n return Data.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Data.create\\` only accepts objects or maps, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a `Data` from a JSON `object`.\n *\n * @param {Object} object\n * @return {Data}\n */\n\n static fromJSON(object) {\n return new Map(object)\n }\n\n /**\n * Alias `fromJS`.\n */\n\n static fromJS = Data.fromJSON\n}\n\n/**\n * Export.\n *\n * @type {Object}\n */\n\nexport default Data\n","import isPlainObject from 'is-plain-object'\nimport { Map, Record, Set } from 'immutable'\n\nimport Data from './data'\n\n/**\n * Default properties.\n *\n * @type {Object}\n */\n\nconst DEFAULTS = {\n data: undefined,\n type: undefined,\n}\n\n/**\n * Mark.\n *\n * @type {Mark}\n */\n\nclass Mark extends Record(DEFAULTS) {\n /**\n * Create a new `Mark` with `attrs`.\n *\n * @param {Object|Mark} attrs\n * @return {Mark}\n */\n\n static create(attrs = {}) {\n if (Mark.isMark(attrs)) {\n return attrs\n }\n\n if (typeof attrs === 'string') {\n attrs = { type: attrs }\n }\n\n if (isPlainObject(attrs)) {\n return Mark.fromJSON(attrs)\n }\n\n throw new Error(\n `\\`Mark.create\\` only accepts objects, strings or marks, but you passed it: ${attrs}`\n )\n }\n\n /**\n * Create a set of marks.\n *\n * @param {Array