text: (function webpackUniversalModuleDefinition(root, factory) {
  	if(typeof exports === 'object' && typeof module === 'object')
  		module.exports = factory();
  	else if(typeof define === 'function' && define.amd)
  		define([], factory);
  	else if(typeof exports === 'object')
  		exports["Parchment"] = factory();
  	else
  		root["Parchment"] = factory();
  })(typeof self !== 'undefined' ? self : this, function() {
  return /******/ (function(modules) { // webpackBootstrap
  /******/ 	// The module cache
  /******/ 	var installedModules = {};
  /******/
  /******/ 	// The require function
  /******/ 	function __webpack_require__(moduleId) {
  /******/
  /******/ 		// Check if module is in cache
  /******/ 		if(installedModules[moduleId]) {
  /******/ 			return installedModules[moduleId].exports;
  /******/ 		}
  /******/ 		// Create a new module (and put it into the cache)
  /******/ 		var module = installedModules[moduleId] = {
  /******/ 			i: moduleId,
  /******/ 			l: false,
  /******/ 			exports: {}
  /******/ 		};
  /******/
  /******/ 		// Execute the module function
  /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  /******/
  /******/ 		// Flag the module as loaded
  /******/ 		module.l = true;
  /******/
  /******/ 		// Return the exports of the module
  /******/ 		return module.exports;
  /******/ 	}
  /******/
  /******/
  /******/ 	// expose the modules object (__webpack_modules__)
  /******/ 	__webpack_require__.m = modules;
  /******/
  /******/ 	// expose the module cache
  /******/ 	__webpack_require__.c = installedModules;
  /******/
  /******/ 	// define getter function for harmony exports
  /******/ 	__webpack_require__.d = function(exports, name, getter) {
  /******/ 		if(!__webpack_require__.o(exports, name)) {
  /******/ 			Object.defineProperty(exports, name, {
  /******/ 				configurable: false,
  /******/ 				enumerable: true,
  /******/ 				get: getter
  /******/ 			});
  /******/ 		}
  /******/ 	};
  /******/
  /******/ 	// getDefaultExport function for compatibility with non-harmony modules
  /******/ 	__webpack_require__.n = function(module) {
  /******/ 		var getter = module && module.__esModule ?
  /******/ 			function getDefault() { return module['default']; } :
  /******/ 			function getModuleExports() { return module; };
  /******/ 		__webpack_require__.d(getter, 'a', getter);
  /******/ 		return getter;
  /******/ 	};
  /******/
  /******/ 	// Object.prototype.hasOwnProperty.call
  /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  /******/
  /******/ 	// __webpack_public_path__
  /******/ 	__webpack_require__.p = "";
  /******/
  /******/ 	// Load entry module and return exports
  /******/ 	return __webpack_require__(__webpack_require__.s = 11);
  /******/ })
  /************************************************************************/
  /******/ ([
  /* 0 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var Scope;
  (function (Scope) {
      Scope[Scope["TYPE"] = 3] = "TYPE";
      Scope[Scope["LEVEL"] = 12] = "LEVEL";
      Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
      Scope[Scope["BLOT"] = 14] = "BLOT";
      Scope[Scope["INLINE"] = 7] = "INLINE";
      Scope[Scope["BLOCK"] = 11] = "BLOCK";
      Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
      Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
      Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
      Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
      Scope[Scope["ANY"] = 15] = "ANY";
  })(Scope || (Scope = {}));
  exports.default = Scope;
  
  
  /***/ }),
  /* 1 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var scope_1 = __webpack_require__(0);
  var Attributor = /** @class */ (function () {
      function Attributor(attrName, keyName, options) {
          if (options === void 0) { options = {}; }
          this.attrName = attrName;
          this.keyName = keyName;
          var attributeBit = scope_1.default.TYPE & scope_1.default.ATTRIBUTE;
          if (options.scope != null) {
              // Ignore type bits, force attribute bit
              this.scope = (options.scope & scope_1.default.LEVEL) | attributeBit;
          }
          else {
              this.scope = scope_1.default.ATTRIBUTE;
          }
          if (options.whitelist != null)
              this.whitelist = options.whitelist;
      }
      Attributor.keys = function (node) {
          return [].map.call(node.attributes, function (item) {
              return item.name;
          });
      };
      Attributor.prototype.add = function (node, value) {
          if (!this.canAdd(node, value))
              return false;
          node.setAttribute(this.keyName, value);
          return true;
      };
      Attributor.prototype.canAdd = function (node, value) {
          if (this.whitelist == null)
              return true;
          if (typeof value === 'string') {
              return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
          }
          else {
              return this.whitelist.indexOf(value) > -1;
          }
      };
      Attributor.prototype.remove = function (node) {
          node.removeAttribute(this.keyName);
      };
      Attributor.prototype.value = function (node) {
          var value = node.getAttribute(this.keyName);
          if (this.canAdd(node, value) && value) {
              return value;
          }
          return '';
      };
      return Attributor;
  }());
  exports.default = Attributor;
  
  
  /***/ }),
  /* 2 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var error_1 = __webpack_require__(4);
  var scope_1 = __webpack_require__(0);
  exports.BLOT_LINK_KEY = '__blot';
  var Registry = /** @class */ (function () {
      function Registry() {
          this.attributes = {};
          this.classes = {};
          this.tags = {};
          this.types = {};
      }
      Registry.find = function (node, bubble) {
          if (bubble === void 0) { bubble = false; }
          if (node == null)
              return null;
          // @ts-ignore
          if (node[exports.BLOT_LINK_KEY] != null)
              return node[exports.BLOT_LINK_KEY].blot;
          if (bubble)
              return this.find(node.parentNode, bubble);
          return null;
      };
      Registry.prototype.create = function (scroll, input, value) {
          var match = this.query(input);
          if (match == null) {
              throw new error_1.default("Unable to create " + input + " blot");
          }
          var BlotClass = match;
          var node = 
          // @ts-ignore
          input instanceof Node || input['nodeType'] === Node.TEXT_NODE
              ? input
              : BlotClass.create(value);
          return new BlotClass(scroll, node, value);
      };
      Registry.prototype.find = function (node, bubble) {
          if (bubble === void 0) { bubble = false; }
          return Registry.find(node, bubble);
      };
      Registry.prototype.query = function (query, scope) {
          if (scope === void 0) { scope = scope_1.default.ANY; }
          var match;
          if (typeof query === 'string') {
              match = this.types[query] || this.attributes[query];
              // @ts-ignore
          }
          else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
              match = this.types['text'];
          }
          else if (typeof query === 'number') {
              if (query & scope_1.default.LEVEL & scope_1.default.BLOCK) {
                  match = this.types['block'];
              }
              else if (query & scope_1.default.LEVEL & scope_1.default.INLINE) {
                  match = this.types['inline'];
              }
          }
          else if (query instanceof HTMLElement) {
              var names = (query.getAttribute('class') || '').split(/\s+/);
              for (var i in names) {
                  match = this.classes[names[i]];
                  if (match)
                      break;
              }
              match = match || this.tags[query.tagName];
          }
          if (match == null)
              return null;
          // @ts-ignore
          if (scope & scope_1.default.LEVEL & match.scope && scope & scope_1.default.TYPE & match.scope)
              return match;
          return null;
      };
      Registry.prototype.register = function () {
          var _this = this;
          var Definitions = [];
          for (var _i = 0; _i < arguments.length; _i++) {
              Definitions[_i] = arguments[_i];
          }
          if (Definitions.length > 1) {
              return Definitions.map(function (d) {
                  return _this.register(d);
              });
          }
          var Definition = Definitions[0];
          if (typeof Definition.blotName !== 'string' &&
              typeof Definition.attrName !== 'string') {
              throw new error_1.default('Invalid definition');
          }
          else if (Definition.blotName === 'abstract') {
              throw new error_1.default('Cannot register abstract class');
          }
          this.types[Definition.blotName || Definition.attrName] = Definition;
          if (typeof Definition.keyName === 'string') {
              this.attributes[Definition.keyName] = Definition;
          }
          else {
              if (Definition.className != null) {
                  this.classes[Definition.className] = Definition;
              }
              if (Definition.tagName != null) {
                  if (Array.isArray(Definition.tagName)) {
                      Definition.tagName = Definition.tagName.map(function (tagName) {
                          return tagName.toUpperCase();
                      });
                  }
                  else {
                      Definition.tagName = Definition.tagName.toUpperCase();
                  }
                  var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
                  tagNames.forEach(function (tag) {
                      if (_this.tags[tag] == null || Definition.className == null) {
                          _this.tags[tag] = Definition;
                      }
                  });
              }
          }
          return Definition;
      };
      return Registry;
  }());
  exports.default = Registry;
  
  
  /***/ }),
  /* 3 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var linked_list_1 = __webpack_require__(13);
  var shadow_1 = __webpack_require__(7);
  var error_1 = __webpack_require__(4);
  var scope_1 = __webpack_require__(0);
  var ContainerBlot = /** @class */ (function (_super) {
      __extends(ContainerBlot, _super);
      function ContainerBlot(scroll, domNode) {
          var _this = _super.call(this, scroll, domNode) || this;
          _this.build();
          return _this;
      }
      ContainerBlot.prototype.appendChild = function (other) {
          this.insertBefore(other);
      };
      ContainerBlot.prototype.attach = function () {
          _super.prototype.attach.call(this);
          this.children.forEach(function (child) {
              child.attach();
          });
      };
      ContainerBlot.prototype.build = function () {
          var _this = this;
          this.children = new linked_list_1.default();
          // Need to be reversed for if DOM nodes already in order
          [].slice
              .call(this.domNode.childNodes)
              .reverse()
              .forEach(function (node) {
              try {
                  var child = makeBlot(node, _this.scroll);
                  _this.insertBefore(child, _this.children.head || undefined);
              }
              catch (err) {
                  if (err instanceof error_1.default)
                      return;
                  else
                      throw err;
              }
          });
      };
      ContainerBlot.prototype.deleteAt = function (index, length) {
          if (index === 0 && length === this.length()) {
              return this.remove();
          }
          this.children.forEachAt(index, length, function (child, offset, length) {
              child.deleteAt(offset, length);
          });
      };
      ContainerBlot.prototype.descendant = function (criteria, index) {
          var _a = this.children.find(index), child = _a[0], offset = _a[1];
          if ((criteria.blotName == null && criteria(child)) ||
              (criteria.blotName != null && child instanceof criteria)) {
              return [child, offset];
          }
          else if (child instanceof ContainerBlot) {
              return child.descendant(criteria, offset);
          }
          else {
              return [null, -1];
          }
      };
      ContainerBlot.prototype.descendants = function (criteria, index, length) {
          if (index === void 0) { index = 0; }
          if (length === void 0) { length = Number.MAX_VALUE; }
          var descendants = [];
          var lengthLeft = length;
          this.children.forEachAt(index, length, function (child, index, length) {
              if ((criteria.blotName == null && criteria(child)) ||
                  (criteria.blotName != null && child instanceof criteria)) {
                  descendants.push(child);
              }
              if (child instanceof ContainerBlot) {
                  descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
              }
              lengthLeft -= length;
          });
          return descendants;
      };
      ContainerBlot.prototype.detach = function () {
          this.children.forEach(function (child) {
              child.detach();
          });
          _super.prototype.detach.call(this);
      };
      ContainerBlot.prototype.formatAt = function (index, length, name, value) {
          this.children.forEachAt(index, length, function (child, offset, length) {
              child.formatAt(offset, length, name, value);
          });
      };
      ContainerBlot.prototype.insertAt = function (index, value, def) {
          var _a = this.children.find(index), child = _a[0], offset = _a[1];
          if (child) {
              child.insertAt(offset, value, def);
          }
          else {
              var blot = def == null ? this.scroll.create('text', value) : this.scroll.create(value, def);
              this.appendChild(blot);
          }
      };
      ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
          if (this.statics.allowedChildren != null &&
              !this.statics.allowedChildren.some(function (child) {
                  return childBlot instanceof child;
              })) {
              throw new error_1.default("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
          }
          childBlot.insertInto(this, refBlot);
      };
      ContainerBlot.prototype.length = function () {
          return this.children.reduce(function (memo, child) {
              return memo + child.length();
          }, 0);
      };
      ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
          this.children.forEach(function (child) {
              targetParent.insertBefore(child, refNode);
          });
      };
      ContainerBlot.prototype.optimize = function (context) {
          _super.prototype.optimize.call(this, context);
          if (this.children.length === 0) {
              if (this.statics.defaultChild != null) {
                  var child = this.scroll.create(this.statics.defaultChild);
                  this.appendChild(child);
                  child.optimize(context);
              }
              else {
                  this.remove();
              }
          }
      };
      ContainerBlot.prototype.path = function (index, inclusive) {
          if (inclusive === void 0) { inclusive = false; }
          var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
          var position = [[this, index]];
          if (child instanceof ContainerBlot) {
              return position.concat(child.path(offset, inclusive));
          }
          else if (child != null) {
              position.push([child, offset]);
          }
          return position;
      };
      ContainerBlot.prototype.removeChild = function (child) {
          this.children.remove(child);
      };
      ContainerBlot.prototype.replace = function (target) {
          if (target instanceof ContainerBlot) {
              target.moveChildren(this);
          }
          _super.prototype.replace.call(this, target);
      };
      ContainerBlot.prototype.split = function (index, force) {
          if (force === void 0) { force = false; }
          if (!force) {
              if (index === 0)
                  return this;
              if (index === this.length())
                  return this.next;
          }
          var after = this.clone();
          this.parent.insertBefore(after, this.next);
          this.children.forEachAt(index, this.length(), function (child, offset, length) {
              child = child.split(offset, force);
              after.appendChild(child);
          });
          return after;
      };
      ContainerBlot.prototype.unwrap = function () {
          this.moveChildren(this.parent, this.next);
          this.remove();
      };
      ContainerBlot.prototype.update = function (mutations, context) {
          var _this = this;
          var addedNodes = [];
          var removedNodes = [];
          var charactedDataWorkaroundRequired = /Macintosh/.test(navigator.userAgent);
          mutations.forEach(function (mutation) {
              if (mutation.target === _this.domNode && mutation.type === 'childList') {
                  addedNodes.push.apply(addedNodes, mutation.addedNodes);
                  removedNodes.push.apply(removedNodes, mutation.removedNodes);
              }
              if (charactedDataWorkaroundRequired &&
                  mutation.type === 'characterData' &&
                  mutation.target.parentNode === _this.domNode &&
                  mutation.oldValue === '' &&
                  mutation.target.nodeValue &&
                  mutation.target.nodeValue.length > 0 &&
                  _this.scroll.find(mutation.target) == null) {
                  addedNodes.push.apply(addedNodes, [mutation.target]);
              }
          });
          removedNodes.forEach(function (node) {
              // Check node has actually been removed
              // One exception is Chrome does not immediately remove IFRAMEs
              // from DOM but MutationRecord is correct in its reported removal
              if (node.parentNode != null &&
                  // @ts-ignore
                  node.tagName !== 'IFRAME' &&
                  document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
                  return;
              }
              var blot = _this.scroll.find(node);
              if (blot == null)
                  return;
              if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
                  blot.detach();
              }
          });
          addedNodes
              .filter(function (node) {
              return node.parentNode == _this.domNode;
          })
              .sort(function (a, b) {
              if (a === b)
                  return 0;
              if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
                  return 1;
              }
              return -1;
          })
              .forEach(function (node) {
              var refBlot = null;
              if (node.nextSibling != null) {
                  refBlot = _this.scroll.find(node.nextSibling);
              }
              var blot = makeBlot(node, _this.scroll);
              if (blot.next != refBlot || blot.next == null) {
                  if (blot.parent != null) {
                      blot.parent.removeChild(_this);
                  }
                  _this.insertBefore(blot, refBlot || undefined);
              }
          });
      };
      return ContainerBlot;
  }(shadow_1.default));
  function makeBlot(node, scroll) {
      var blot = scroll.find(node);
      if (blot == null) {
          try {
              blot = scroll.create(node);
          }
          catch (e) {
              blot = scroll.create(scope_1.default.INLINE);
              [].slice.call(node.childNodes).forEach(function (child) {
                  // @ts-ignore
                  blot.domNode.appendChild(child);
              });
              if (node.parentNode) {
                  node.parentNode.replaceChild(blot.domNode, node);
              }
              blot.attach();
          }
      }
      return blot;
  }
  exports.default = ContainerBlot;
  
  
  /***/ }),
  /* 4 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var ParchmentError = /** @class */ (function (_super) {
      __extends(ParchmentError, _super);
      function ParchmentError(message) {
          var _this = this;
          message = '[Parchment] ' + message;
          _this = _super.call(this, message) || this;
          _this.message = message;
          _this.name = _this.constructor.name;
          return _this;
      }
      return ParchmentError;
  }(Error));
  exports.default = ParchmentError;
  
  
  /***/ }),
  /* 5 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var attributor_1 = __webpack_require__(1);
  var store_1 = __webpack_require__(8);
  var container_1 = __webpack_require__(3);
  var FormatBlot = /** @class */ (function (_super) {
      __extends(FormatBlot, _super);
      function FormatBlot(scroll, domNode) {
          var _this = _super.call(this, scroll, domNode) || this;
          _this.attributes = new store_1.default(_this.domNode);
          return _this;
      }
      FormatBlot.formats = function (domNode, scroll) {
          if (typeof this.tagName === 'string') {
              return true;
          }
          else if (Array.isArray(this.tagName)) {
              return domNode.tagName.toLowerCase();
          }
          return undefined;
      };
      FormatBlot.prototype.format = function (name, value) {
          var format = this.scroll.query(name);
          if (format instanceof attributor_1.default) {
              this.attributes.attribute(format, value);
          }
          else if (value) {
              if (name !== this.statics.blotName || this.formats()[name] !== value) {
                  this.replaceWith(name, value);
              }
          }
      };
      FormatBlot.prototype.formats = function () {
          var formats = this.attributes.values();
          var format = this.statics.formats(this.domNode, this.scroll);
          if (format != null) {
              formats[this.statics.blotName] = format;
          }
          return formats;
      };
      FormatBlot.prototype.replaceWith = function (name, value) {
          var replacement = _super.prototype.replaceWith.call(this, name, value);
          this.attributes.copy(replacement);
          return replacement;
      };
      FormatBlot.prototype.update = function (mutations, context) {
          var _this = this;
          _super.prototype.update.call(this, mutations, context);
          if (mutations.some(function (mutation) {
              return mutation.target === _this.domNode && mutation.type === 'attributes';
          })) {
              this.attributes.build();
          }
      };
      FormatBlot.prototype.wrap = function (name, value) {
          var wrapper = _super.prototype.wrap.call(this, name, value);
          if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
              this.attributes.move(wrapper);
          }
          return wrapper;
      };
      return FormatBlot;
  }(container_1.default));
  exports.default = FormatBlot;
  
  
  /***/ }),
  /* 6 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var shadow_1 = __webpack_require__(7);
  var scope_1 = __webpack_require__(0);
  var LeafBlot = /** @class */ (function (_super) {
      __extends(LeafBlot, _super);
      function LeafBlot() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      LeafBlot.value = function (domNode) {
          return true;
      };
      LeafBlot.prototype.index = function (node, offset) {
          if (this.domNode === node ||
              this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
              return Math.min(offset, 1);
          }
          return -1;
      };
      LeafBlot.prototype.position = function (index, inclusive) {
          var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
          if (index > 0)
              offset += 1;
          return [this.parent.domNode, offset];
      };
      LeafBlot.prototype.value = function () {
          var _a;
          return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
      };
      LeafBlot.scope = scope_1.default.INLINE_BLOT;
      return LeafBlot;
  }(shadow_1.default));
  exports.default = LeafBlot;
  
  
  /***/ }),
  /* 7 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var error_1 = __webpack_require__(4);
  var scope_1 = __webpack_require__(0);
  var registry_1 = __webpack_require__(2);
  var ShadowBlot = /** @class */ (function () {
      function ShadowBlot(scroll, domNode) {
          this.scroll = scroll;
          this.domNode = domNode;
          // @ts-ignore
          this.domNode[registry_1.BLOT_LINK_KEY] = { blot: this };
      }
      Object.defineProperty(ShadowBlot.prototype, "statics", {
          // Hack for accessing inherited static methods
          get: function () {
              return this.constructor;
          },
          enumerable: true,
          configurable: true
      });
      ShadowBlot.create = function (value) {
          if (this.tagName == null) {
              throw new error_1.default('Blot definition missing tagName');
          }
          var node;
          if (Array.isArray(this.tagName)) {
              if (typeof value === 'string') {
                  value = value.toUpperCase();
                  if (parseInt(value).toString() === value) {
                      value = parseInt(value);
                  }
              }
              if (typeof value === 'number') {
                  node = document.createElement(this.tagName[value - 1]);
              }
              else if (this.tagName.indexOf(value) > -1) {
                  node = document.createElement(value);
              }
              else {
                  node = document.createElement(this.tagName[0]);
              }
          }
          else {
              node = document.createElement(this.tagName);
          }
          if (this.className) {
              node.classList.add(this.className);
          }
          return node;
      };
      ShadowBlot.prototype.attach = function () {
          // Nothing to do
      };
      ShadowBlot.prototype.clone = function () {
          var domNode = this.domNode.cloneNode(false);
          return this.scroll.create(domNode);
      };
      ShadowBlot.prototype.detach = function () {
          if (this.parent != null)
              this.parent.removeChild(this);
          // @ts-ignore
          delete this.domNode[registry_1.BLOT_LINK_KEY];
      };
      ShadowBlot.prototype.deleteAt = function (index, length) {
          var blot = this.isolate(index, length);
          blot.remove();
      };
      ShadowBlot.prototype.formatAt = function (index, length, name, value) {
          var blot = this.isolate(index, length);
          if (this.scroll.query(name, scope_1.default.BLOT) != null && value) {
              blot.wrap(name, value);
          }
          else if (this.scroll.query(name, scope_1.default.ATTRIBUTE) != null) {
              var parent_1 = this.scroll.create(this.statics.scope);
              blot.wrap(parent_1);
              parent_1.format(name, value);
          }
      };
      ShadowBlot.prototype.insertAt = function (index, value, def) {
          var blot = def == null ? this.scroll.create('text', value) : this.scroll.create(value, def);
          var ref = this.split(index);
          this.parent.insertBefore(blot, ref);
      };
      ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
          if (refBlot === void 0) { refBlot = null; }
          if (this.parent != null) {
              this.parent.children.remove(this);
          }
          var refDomNode = null;
          parentBlot.children.insertBefore(this, refBlot);
          if (refBlot != null) {
              refDomNode = refBlot.domNode;
          }
          if (this.domNode.parentNode != parentBlot.domNode ||
              this.domNode.nextSibling != refDomNode) {
              parentBlot.domNode.insertBefore(this.domNode, refDomNode);
          }
          this.parent = parentBlot;
          this.attach();
      };
      ShadowBlot.prototype.isolate = function (index, length) {
          var target = this.split(index);
          target.split(length);
          return target;
      };
      ShadowBlot.prototype.length = function () {
          return 1;
      };
      ShadowBlot.prototype.offset = function (root) {
          if (root === void 0) { root = this.parent; }
          if (this.parent == null || this == root)
              return 0;
          return this.parent.children.offset(this) + this.parent.offset(root);
      };
      ShadowBlot.prototype.optimize = function (context) {
          // TODO clean up once we use WeakMap
          // @ts-ignore
          if (this.domNode[registry_1.BLOT_LINK_KEY] != null) {
              // @ts-ignore
              delete this.domNode[registry_1.BLOT_LINK_KEY].mutations;
          }
      };
      ShadowBlot.prototype.remove = function () {
          if (this.domNode.parentNode != null) {
              this.domNode.parentNode.removeChild(this.domNode);
          }
          this.detach();
      };
      ShadowBlot.prototype.replace = function (target) {
          if (target.parent == null)
              return;
          target.parent.insertBefore(this, target.next);
          target.remove();
      };
      ShadowBlot.prototype.replaceWith = function (name, value) {
          var replacement = typeof name === 'string' ? this.scroll.create(name, value) : name;
          replacement.replace(this);
          return replacement;
      };
      ShadowBlot.prototype.split = function (index, force) {
          return index === 0 ? this : this.next;
      };
      ShadowBlot.prototype.update = function (mutations, context) {
          // Nothing to do by default
      };
      ShadowBlot.prototype.wrap = function (name, value) {
          var wrapper = typeof name === 'string' ? this.scroll.create(name, value) : name;
          if (this.parent != null) {
              this.parent.insertBefore(wrapper, this.next);
          }
          wrapper.appendChild(this);
          return wrapper;
      };
      ShadowBlot.blotName = 'abstract';
      return ShadowBlot;
  }());
  exports.default = ShadowBlot;
  
  
  /***/ }),
  /* 8 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var attributor_1 = __webpack_require__(1);
  var class_1 = __webpack_require__(9);
  var style_1 = __webpack_require__(10);
  var registry_1 = __webpack_require__(2);
  var scope_1 = __webpack_require__(0);
  var AttributorStore = /** @class */ (function () {
      function AttributorStore(domNode) {
          this.attributes = {};
          this.domNode = domNode;
          this.build();
      }
      AttributorStore.prototype.attribute = function (attribute, value) {
          // verb
          if (value) {
              if (attribute.add(this.domNode, value)) {
                  if (attribute.value(this.domNode) != null) {
                      this.attributes[attribute.attrName] = attribute;
                  }
                  else {
                      delete this.attributes[attribute.attrName];
                  }
              }
          }
          else {
              attribute.remove(this.domNode);
              delete this.attributes[attribute.attrName];
          }
      };
      AttributorStore.prototype.build = function () {
          var _this = this;
          this.attributes = {};
          var blot = registry_1.default.find(this.domNode);
          if (blot == null)
              return;
          var attributes = attributor_1.default.keys(this.domNode);
          var classes = class_1.default.keys(this.domNode);
          var styles = style_1.default.keys(this.domNode);
          attributes
              .concat(classes)
              .concat(styles)
              .forEach(function (name) {
              var attr = blot.scroll.query(name, scope_1.default.ATTRIBUTE);
              if (attr instanceof attributor_1.default) {
                  _this.attributes[attr.attrName] = attr;
              }
          });
      };
      AttributorStore.prototype.copy = function (target) {
          var _this = this;
          Object.keys(this.attributes).forEach(function (key) {
              var value = _this.attributes[key].value(_this.domNode);
              target.format(key, value);
          });
      };
      AttributorStore.prototype.move = function (target) {
          var _this = this;
          this.copy(target);
          Object.keys(this.attributes).forEach(function (key) {
              _this.attributes[key].remove(_this.domNode);
          });
          this.attributes = {};
      };
      AttributorStore.prototype.values = function () {
          var _this = this;
          return Object.keys(this.attributes).reduce(function (attributes, name) {
              attributes[name] = _this.attributes[name].value(_this.domNode);
              return attributes;
          }, {});
      };
      return AttributorStore;
  }());
  exports.default = AttributorStore;
  
  
  /***/ }),
  /* 9 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var attributor_1 = __webpack_require__(1);
  function match(node, prefix) {
      var className = node.getAttribute('class') || '';
      return className.split(/\s+/).filter(function (name) {
          return name.indexOf(prefix + "-") === 0;
      });
  }
  var ClassAttributor = /** @class */ (function (_super) {
      __extends(ClassAttributor, _super);
      function ClassAttributor() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      ClassAttributor.keys = function (node) {
          return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
              return name
                  .split('-')
                  .slice(0, -1)
                  .join('-');
          });
      };
      ClassAttributor.prototype.add = function (node, value) {
          if (!this.canAdd(node, value))
              return false;
          this.remove(node);
          node.classList.add(this.keyName + "-" + value);
          return true;
      };
      ClassAttributor.prototype.remove = function (node) {
          var matches = match(node, this.keyName);
          matches.forEach(function (name) {
              node.classList.remove(name);
          });
          if (node.classList.length === 0) {
              node.removeAttribute('class');
          }
      };
      ClassAttributor.prototype.value = function (node) {
          var result = match(node, this.keyName)[0] || '';
          var value = result.slice(this.keyName.length + 1); // +1 for hyphen
          return this.canAdd(node, value) ? value : '';
      };
      return ClassAttributor;
  }(attributor_1.default));
  exports.default = ClassAttributor;
  
  
  /***/ }),
  /* 10 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var attributor_1 = __webpack_require__(1);
  function camelize(name) {
      var parts = name.split('-');
      var rest = parts
          .slice(1)
          .map(function (part) {
          return part[0].toUpperCase() + part.slice(1);
      })
          .join('');
      return parts[0] + rest;
  }
  var StyleAttributor = /** @class */ (function (_super) {
      __extends(StyleAttributor, _super);
      function StyleAttributor() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      StyleAttributor.keys = function (node) {
          return (node.getAttribute('style') || '').split(';').map(function (value) {
              var arr = value.split(':');
              return arr[0].trim();
          });
      };
      StyleAttributor.prototype.add = function (node, value) {
          if (!this.canAdd(node, value))
              return false;
          // @ts-ignore
          node.style[camelize(this.keyName)] = value;
          return true;
      };
      StyleAttributor.prototype.remove = function (node) {
          // @ts-ignore
          node.style[camelize(this.keyName)] = '';
          if (!node.getAttribute('style')) {
              node.removeAttribute('style');
          }
      };
      StyleAttributor.prototype.value = function (node) {
          // @ts-ignore
          var value = node.style[camelize(this.keyName)];
          return this.canAdd(node, value) ? value : '';
      };
      return StyleAttributor;
  }(attributor_1.default));
  exports.default = StyleAttributor;
  
  
  /***/ }),
  /* 11 */
  /***/ (function(module, exports, __webpack_require__) {
  
  module.exports = __webpack_require__(12);
  
  
  /***/ }),
  /* 12 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var container_1 = __webpack_require__(3);
  var format_1 = __webpack_require__(5);
  var leaf_1 = __webpack_require__(6);
  var scroll_1 = __webpack_require__(14);
  var inline_1 = __webpack_require__(15);
  var block_1 = __webpack_require__(16);
  var embed_1 = __webpack_require__(17);
  var text_1 = __webpack_require__(18);
  var attributor_1 = __webpack_require__(1);
  var class_1 = __webpack_require__(9);
  var style_1 = __webpack_require__(10);
  var store_1 = __webpack_require__(8);
  var registry_1 = __webpack_require__(2);
  var scope_1 = __webpack_require__(0);
  var Parchment = {
      Registry: registry_1.default,
      Scope: scope_1.default,
      Container: container_1.default,
      Format: format_1.default,
      Leaf: leaf_1.default,
      Embed: embed_1.default,
      Scroll: scroll_1.default,
      Block: block_1.default,
      Inline: inline_1.default,
      Text: text_1.default,
      Attributor: {
          Attribute: attributor_1.default,
          Class: class_1.default,
          Style: style_1.default,
          Store: store_1.default,
      },
  };
  exports.default = Parchment;
  
  
  /***/ }),
  /* 13 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  Object.defineProperty(exports, "__esModule", { value: true });
  var LinkedList = /** @class */ (function () {
      function LinkedList() {
          this.head = this.tail = null;
          this.length = 0;
      }
      LinkedList.prototype.append = function () {
          var nodes = [];
          for (var _i = 0; _i < arguments.length; _i++) {
              nodes[_i] = arguments[_i];
          }
          this.insertBefore(nodes[0], null);
          if (nodes.length > 1) {
              this.append.apply(this, nodes.slice(1));
          }
      };
      LinkedList.prototype.contains = function (node) {
          var cur, next = this.iterator();
          while ((cur = next())) {
              if (cur === node)
                  return true;
          }
          return false;
      };
      LinkedList.prototype.insertBefore = function (node, refNode) {
          if (!node)
              return;
          node.next = refNode;
          if (refNode != null) {
              node.prev = refNode.prev;
              if (refNode.prev != null) {
                  refNode.prev.next = node;
              }
              refNode.prev = node;
              if (refNode === this.head) {
                  this.head = node;
              }
          }
          else if (this.tail != null) {
              this.tail.next = node;
              node.prev = this.tail;
              this.tail = node;
          }
          else {
              node.prev = null;
              this.head = this.tail = node;
          }
          this.length += 1;
      };
      LinkedList.prototype.offset = function (target) {
          var index = 0, cur = this.head;
          while (cur != null) {
              if (cur === target)
                  return index;
              index += cur.length();
              cur = cur.next;
          }
          return -1;
      };
      LinkedList.prototype.remove = function (node) {
          if (!this.contains(node))
              return;
          if (node.prev != null)
              node.prev.next = node.next;
          if (node.next != null)
              node.next.prev = node.prev;
          if (node === this.head)
              this.head = node.next;
          if (node === this.tail)
              this.tail = node.prev;
          this.length -= 1;
      };
      LinkedList.prototype.iterator = function (curNode) {
          if (curNode === void 0) { curNode = this.head; }
          // TODO use yield when we can
          return function () {
              var ret = curNode;
              if (curNode != null)
                  curNode = curNode.next;
              return ret;
          };
      };
      LinkedList.prototype.find = function (index, inclusive) {
          if (inclusive === void 0) { inclusive = false; }
          var cur, next = this.iterator();
          while ((cur = next())) {
              var length_1 = cur.length();
              if (index < length_1 ||
                  (inclusive && index === length_1 && (cur.next == null || cur.next.length() !== 0))) {
                  return [cur, index];
              }
              index -= length_1;
          }
          return [null, 0];
      };
      LinkedList.prototype.forEach = function (callback) {
          var cur, next = this.iterator();
          while ((cur = next())) {
              callback(cur);
          }
      };
      LinkedList.prototype.forEachAt = function (index, length, callback) {
          if (length <= 0)
              return;
          var _a = this.find(index), startNode = _a[0], offset = _a[1];
          var cur, curIndex = index - offset, next = this.iterator(startNode);
          while ((cur = next()) && curIndex < index + length) {
              var curLength = cur.length();
              if (index > curIndex) {
                  callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
              }
              else {
                  callback(cur, 0, Math.min(curLength, index + length - curIndex));
              }
              curIndex += curLength;
          }
      };
      LinkedList.prototype.map = function (callback) {
          return this.reduce(function (memo, cur) {
              memo.push(callback(cur));
              return memo;
          }, []);
      };
      LinkedList.prototype.reduce = function (callback, memo) {
          var cur, next = this.iterator();
          while ((cur = next())) {
              memo = callback(memo, cur);
          }
          return memo;
      };
      return LinkedList;
  }());
  exports.default = LinkedList;
  
  
  /***/ }),
  /* 14 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var container_1 = __webpack_require__(3);
  var registry_1 = __webpack_require__(2);
  var scope_1 = __webpack_require__(0);
  var OBSERVER_CONFIG = {
      attributes: true,
      characterData: true,
      characterDataOldValue: true,
      childList: true,
      subtree: true,
  };
  var MAX_OPTIMIZE_ITERATIONS = 100;
  var ScrollBlot = /** @class */ (function (_super) {
      __extends(ScrollBlot, _super);
      function ScrollBlot(registry, node) {
          var _this = 
          // @ts-ignore
          _super.call(this, null, node) || this;
          _this.registry = registry;
          _this.scroll = _this;
          _this.build();
          _this.observer = new MutationObserver(function (mutations) {
              _this.update(mutations);
          });
          _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
          _this.attach();
          return _this;
      }
      ScrollBlot.prototype.create = function (input, value) {
          return this.registry.create(this, input, value);
      };
      ScrollBlot.prototype.find = function (node, bubble) {
          if (bubble === void 0) { bubble = false; }
          return this.registry.find(node, bubble);
      };
      ScrollBlot.prototype.query = function (query, scope) {
          if (scope === void 0) { scope = scope_1.default.ANY; }
          return this.registry.query(query, scope);
      };
      ScrollBlot.prototype.register = function () {
          var Definitions = [];
          for (var _i = 0; _i < arguments.length; _i++) {
              Definitions[_i] = arguments[_i];
          }
          var _a;
          return (_a = this.registry).register.apply(_a, Definitions);
      };
      ScrollBlot.prototype.build = function () {
          if (this.scroll == null)
              return;
          _super.prototype.build.call(this);
      };
      ScrollBlot.prototype.detach = function () {
          _super.prototype.detach.call(this);
          this.observer.disconnect();
      };
      ScrollBlot.prototype.deleteAt = function (index, length) {
          this.update();
          if (index === 0 && length === this.length()) {
              this.children.forEach(function (child) {
                  child.remove();
              });
          }
          else {
              _super.prototype.deleteAt.call(this, index, length);
          }
      };
      ScrollBlot.prototype.formatAt = function (index, length, name, value) {
          this.update();
          _super.prototype.formatAt.call(this, index, length, name, value);
      };
      ScrollBlot.prototype.insertAt = function (index, value, def) {
          this.update();
          _super.prototype.insertAt.call(this, index, value, def);
      };
      ScrollBlot.prototype.optimize = function (mutations, context) {
          var _this = this;
          if (mutations === void 0) { mutations = []; }
          if (context === void 0) { context = {}; }
          _super.prototype.optimize.call(this, context);
          // We must modify mutations directly, cannot make copy and then modify
          var records = [].slice.call(this.observer.takeRecords());
          // Array.push currently seems to be implemented by a non-tail recursive function
          // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
          while (records.length > 0)
              mutations.push(records.pop());
          // TODO use WeakMap
          var mark = function (blot, markParent) {
              if (markParent === void 0) { markParent = true; }
              if (blot == null || blot === _this)
                  return;
              if (blot.domNode.parentNode == null)
                  return;
              // @ts-ignore
              if (blot.domNode[registry_1.BLOT_LINK_KEY].mutations == null) {
                  // @ts-ignore
                  blot.domNode[registry_1.BLOT_LINK_KEY].mutations = [];
              }
              if (markParent)
                  mark(blot.parent);
          };
          var optimize = function (blot) {
              // Post-order traversal
              if (
              // @ts-ignore
              blot.domNode[registry_1.BLOT_LINK_KEY] == null ||
                  // @ts-ignore
                  blot.domNode[registry_1.BLOT_LINK_KEY].mutations == null) {
                  return;
              }
              if (blot instanceof container_1.default) {
                  blot.children.forEach(optimize);
              }
              blot.optimize(context);
          };
          var remaining = mutations;
          for (var i = 0; remaining.length > 0; i += 1) {
              if (i >= MAX_OPTIMIZE_ITERATIONS) {
                  throw new Error('[Parchment] Maximum optimize iterations reached');
              }
              remaining.forEach(function (mutation) {
                  var blot = _this.find(mutation.target, true);
                  if (blot == null)
                      return;
                  if (blot.domNode === mutation.target) {
                      if (mutation.type === 'childList') {
                          mark(_this.find(mutation.previousSibling, false));
                          [].forEach.call(mutation.addedNodes, function (node) {
                              var child = _this.find(node, false);
                              mark(child, false);
                              if (child instanceof container_1.default) {
                                  child.children.forEach(function (grandChild) {
                                      mark(grandChild, false);
                                  });
                              }
                          });
                      }
                      else if (mutation.type === 'attributes') {
                          mark(blot.prev);
                      }
                  }
                  mark(blot);
              });
              this.children.forEach(optimize);
              remaining = [].slice.call(this.observer.takeRecords());
              records = remaining.slice();
              while (records.length > 0)
                  mutations.push(records.pop());
          }
      };
      ScrollBlot.prototype.update = function (mutations, context) {
          var _this = this;
          if (context === void 0) { context = {}; }
          mutations = mutations || this.observer.takeRecords();
          // TODO use WeakMap
          mutations
              .map(function (mutation) {
              var blot = registry_1.default.find(mutation.target, true);
              if (blot == null)
                  return null;
              // @ts-ignore
              if (blot.domNode[registry_1.BLOT_LINK_KEY].mutations == null) {
                  // @ts-ignore
                  blot.domNode[registry_1.BLOT_LINK_KEY].mutations = [mutation];
                  return blot;
              }
              else {
                  // @ts-ignore
                  blot.domNode[registry_1.BLOT_LINK_KEY].mutations.push(mutation);
                  return null;
              }
          })
              .forEach(function (blot) {
              if (blot == null ||
                  blot === _this ||
                  //@ts-ignore
                  blot.domNode[registry_1.BLOT_LINK_KEY] == null)
                  return;
              // @ts-ignore
              blot.update(blot.domNode[registry_1.BLOT_LINK_KEY].mutations || [], context);
          });
          // @ts-ignore
          if (this.domNode[registry_1.BLOT_LINK_KEY].mutations != null) {
              // @ts-ignore
              _super.prototype.update.call(this, this.domNode[registry_1.BLOT_LINK_KEY].mutations, context);
          }
          this.optimize(mutations, context);
      };
      ScrollBlot.blotName = 'scroll';
      ScrollBlot.defaultChild = 'block';
      ScrollBlot.scope = scope_1.default.BLOCK_BLOT;
      ScrollBlot.tagName = 'DIV';
      return ScrollBlot;
  }(container_1.default));
  exports.default = ScrollBlot;
  
  
  /***/ }),
  /* 15 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var format_1 = __webpack_require__(5);
  var scope_1 = __webpack_require__(0);
  // Shallow object comparison
  function isEqual(obj1, obj2) {
      if (Object.keys(obj1).length !== Object.keys(obj2).length)
          return false;
      // @ts-ignore
      for (var prop in obj1) {
          // @ts-ignore
          if (obj1[prop] !== obj2[prop])
              return false;
      }
      return true;
  }
  var InlineBlot = /** @class */ (function (_super) {
      __extends(InlineBlot, _super);
      function InlineBlot() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      InlineBlot.formats = function (domNode, scroll) {
          if (domNode.tagName === InlineBlot.tagName)
              return undefined;
          var match = scroll.query(InlineBlot.blotName);
          if (match != null && domNode.tagName === match.tagName) {
              return undefined;
          }
          return _super.formats.call(this, domNode, scroll);
      };
      InlineBlot.prototype.format = function (name, value) {
          var _this = this;
          if (name === this.statics.blotName && !value) {
              this.children.forEach(function (child) {
                  if (!(child instanceof format_1.default)) {
                      child = child.wrap(InlineBlot.blotName, true);
                  }
                  _this.attributes.copy(child);
              });
              this.unwrap();
          }
          else {
              var format = this.scroll.query(name, scope_1.default.INLINE);
              if (format == null)
                  return;
              _super.prototype.format.call(this, name, value);
          }
      };
      InlineBlot.prototype.formatAt = function (index, length, name, value) {
          if (this.formats()[name] != null || this.scroll.query(name, scope_1.default.ATTRIBUTE)) {
              var blot = this.isolate(index, length);
              blot.format(name, value);
          }
          else {
              _super.prototype.formatAt.call(this, index, length, name, value);
          }
      };
      InlineBlot.prototype.optimize = function (context) {
          _super.prototype.optimize.call(this, context);
          var formats = this.formats();
          if (Object.keys(formats).length === 0) {
              return this.unwrap(); // unformatted span
          }
          var next = this.next;
          if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
              next.moveChildren(this);
              next.remove();
          }
      };
      InlineBlot.blotName = 'inline';
      InlineBlot.scope = scope_1.default.INLINE_BLOT;
      InlineBlot.tagName = 'SPAN';
      return InlineBlot;
  }(format_1.default));
  exports.default = InlineBlot;
  
  
  /***/ }),
  /* 16 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var format_1 = __webpack_require__(5);
  var scope_1 = __webpack_require__(0);
  var BlockBlot = /** @class */ (function (_super) {
      __extends(BlockBlot, _super);
      function BlockBlot() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      BlockBlot.formats = function (domNode, scroll) {
          var match = scroll.query(BlockBlot.blotName);
          if (match != null && domNode.tagName === match.tagName) {
              return undefined;
          }
          return _super.formats.call(this, domNode, scroll);
      };
      BlockBlot.prototype.format = function (name, value) {
          var format = this.scroll.query(name, scope_1.default.BLOCK);
          if (format == null) {
              return;
          }
          else if (name === this.statics.blotName && !value) {
              this.replaceWith(BlockBlot.blotName);
          }
          else {
              _super.prototype.format.call(this, name, value);
          }
      };
      BlockBlot.prototype.formatAt = function (index, length, name, value) {
          if (this.scroll.query(name, scope_1.default.BLOCK) != null) {
              this.format(name, value);
          }
          else {
              _super.prototype.formatAt.call(this, index, length, name, value);
          }
      };
      BlockBlot.prototype.insertAt = function (index, value, def) {
          if (def == null || this.scroll.query(value, scope_1.default.INLINE) != null) {
              // Insert text or inline
              _super.prototype.insertAt.call(this, index, value, def);
          }
          else {
              var after = this.split(index);
              var blot = this.scroll.create(value, def);
              after.parent.insertBefore(blot, after);
          }
      };
      BlockBlot.prototype.update = function (mutations, context) {
          if (navigator.userAgent.match(/Trident/)) {
              this.build();
          }
          else {
              _super.prototype.update.call(this, mutations, context);
          }
      };
      BlockBlot.blotName = 'block';
      BlockBlot.scope = scope_1.default.BLOCK_BLOT;
      BlockBlot.tagName = 'P';
      return BlockBlot;
  }(format_1.default));
  exports.default = BlockBlot;
  
  
  /***/ }),
  /* 17 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var leaf_1 = __webpack_require__(6);
  var EmbedBlot = /** @class */ (function (_super) {
      __extends(EmbedBlot, _super);
      function EmbedBlot() {
          return _super !== null && _super.apply(this, arguments) || this;
      }
      EmbedBlot.formats = function (domNode, scroll) {
          return undefined;
      };
      EmbedBlot.prototype.format = function (name, value) {
          // super.formatAt wraps, which is what we want in general,
          // but this allows subclasses to overwrite for formats
          // that just apply to particular embeds
          _super.prototype.formatAt.call(this, 0, this.length(), name, value);
      };
      EmbedBlot.prototype.formatAt = function (index, length, name, value) {
          if (index === 0 && length === this.length()) {
              this.format(name, value);
          }
          else {
              _super.prototype.formatAt.call(this, index, length, name, value);
          }
      };
      EmbedBlot.prototype.formats = function () {
          return this.statics.formats(this.domNode, this.scroll);
      };
      return EmbedBlot;
  }(leaf_1.default));
  exports.default = EmbedBlot;
  
  
  /***/ }),
  /* 18 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  var __extends = (this && this.__extends) || (function () {
      var extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return function (d, b) {
          extendStatics(d, b);
          function __() { this.constructor = d; }
          d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
  })();
  Object.defineProperty(exports, "__esModule", { value: true });
  var leaf_1 = __webpack_require__(6);
  var scope_1 = __webpack_require__(0);
  var TextBlot = /** @class */ (function (_super) {
      __extends(TextBlot, _super);
      function TextBlot(scroll, node) {
          var _this = _super.call(this, scroll, node) || this;
          _this.text = _this.statics.value(_this.domNode);
          return _this;
      }
      TextBlot.create = function (value) {
          return document.createTextNode(value);
      };
      TextBlot.value = function (domNode) {
          var text = domNode.data;
          // @ts-ignore
          if (text['normalize'])
              text = text['normalize']();
          return text;
      };
      TextBlot.prototype.deleteAt = function (index, length) {
          this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
      };
      TextBlot.prototype.index = function (node, offset) {
          if (this.domNode === node) {
              return offset;
          }
          return -1;
      };
      TextBlot.prototype.insertAt = function (index, value, def) {
          if (def == null) {
              this.text = this.text.slice(0, index) + value + this.text.slice(index);
              this.domNode.data = this.text;
          }
          else {
              _super.prototype.insertAt.call(this, index, value, def);
          }
      };
      TextBlot.prototype.length = function () {
          return this.text.length;
      };
      TextBlot.prototype.optimize = function (context) {
          _super.prototype.optimize.call(this, context);
          this.text = this.statics.value(this.domNode);
          if (this.text.length === 0) {
              this.remove();
          }
          else if (this.next instanceof TextBlot && this.next.prev === this) {
              this.insertAt(this.length(), this.next.value());
              this.next.remove();
          }
      };
      TextBlot.prototype.position = function (index, inclusive) {
          if (inclusive === void 0) { inclusive = false; }
          return [this.domNode, index];
      };
      TextBlot.prototype.split = function (index, force) {
          if (force === void 0) { force = false; }
          if (!force) {
              if (index === 0)
                  return this;
              if (index === this.length())
                  return this.next;
          }
          var after = this.scroll.create(this.domNode.splitText(index));
          this.parent.insertBefore(after, this.next);
          this.text = this.statics.value(this.domNode);
          return after;
      };
      TextBlot.prototype.update = function (mutations, context) {
          var _this = this;
          if (mutations.some(function (mutation) {
              return mutation.type === 'characterData' && mutation.target === _this.domNode;
          })) {
              this.text = this.statics.value(this.domNode);
          }
      };
      TextBlot.prototype.value = function () {
          return this.text;
      };
      TextBlot.blotName = 'text';
      TextBlot.scope = scope_1.default.INLINE_BLOT;
      return TextBlot;
  }(leaf_1.default));
  exports.default = TextBlot;
  
  
  /***/ })
  /******/ ]);
  });
  //# sourceMappingURL=parchment.js.map