[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> blocks.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["blocks"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  37  /******/     // define getter function for harmony exports
  38  /******/     __webpack_require__.d = function(exports, name, getter) {
  39  /******/         if(!__webpack_require__.o(exports, name)) {
  40  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41  /******/         }
  42  /******/     };
  43  /******/
  44  /******/     // define __esModule on exports
  45  /******/     __webpack_require__.r = function(exports) {
  46  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48  /******/         }
  49  /******/         Object.defineProperty(exports, '__esModule', { value: true });
  50  /******/     };
  51  /******/
  52  /******/     // create a fake namespace object
  53  /******/     // mode & 1: value is a module id, require it
  54  /******/     // mode & 2: merge all properties of value into the ns
  55  /******/     // mode & 4: return value when already ns object
  56  /******/     // mode & 8|1: behave like require
  57  /******/     __webpack_require__.t = function(value, mode) {
  58  /******/         if(mode & 1) value = __webpack_require__(value);
  59  /******/         if(mode & 8) return value;
  60  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61  /******/         var ns = Object.create(null);
  62  /******/         __webpack_require__.r(ns);
  63  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65  /******/         return ns;
  66  /******/     };
  67  /******/
  68  /******/     // getDefaultExport function for compatibility with non-harmony modules
  69  /******/     __webpack_require__.n = function(module) {
  70  /******/         var getter = module && module.__esModule ?
  71  /******/ 			function getDefault() { return module['default']; } :
  72  /******/ 			function getModuleExports() { return module; };
  73  /******/         __webpack_require__.d(getter, 'a', getter);
  74  /******/         return getter;
  75  /******/     };
  76  /******/
  77  /******/     // Object.prototype.hasOwnProperty.call
  78  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79  /******/
  80  /******/     // __webpack_public_path__
  81  /******/     __webpack_require__.p = "";
  82  /******/
  83  /******/
  84  /******/     // Load entry module and return exports
  85  /******/     return __webpack_require__(__webpack_require__.s = 460);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = window["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 1:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = window["wp"]["i18n"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 11:
 105  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 106  
 107  "use strict";
 108  
 109  // EXPORTS
 110  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
 111  
 112  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 113  var arrayWithHoles = __webpack_require__(38);
 114  
 115  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 116  function _iterableToArrayLimit(arr, i) {
 117    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 118    var _arr = [];
 119    var _n = true;
 120    var _d = false;
 121    var _e = undefined;
 122  
 123    try {
 124      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 125        _arr.push(_s.value);
 126  
 127        if (i && _arr.length === i) break;
 128      }
 129    } catch (err) {
 130      _d = true;
 131      _e = err;
 132    } finally {
 133      try {
 134        if (!_n && _i["return"] != null) _i["return"]();
 135      } finally {
 136        if (_d) throw _e;
 137      }
 138    }
 139  
 140    return _arr;
 141  }
 142  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 143  var unsupportedIterableToArray = __webpack_require__(31);
 144  
 145  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 146  var nonIterableRest = __webpack_require__(39);
 147  
 148  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 149  
 150  
 151  
 152  
 153  function _slicedToArray(arr, i) {
 154    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 155  }
 156  
 157  /***/ }),
 158  
 159  /***/ 115:
 160  /***/ (function(module, exports) {
 161  
 162  (function() { module.exports = window["wp"]["autop"]; }());
 163  
 164  /***/ }),
 165  
 166  /***/ 12:
 167  /***/ (function(module, exports) {
 168  
 169  (function() { module.exports = window["wp"]["compose"]; }());
 170  
 171  /***/ }),
 172  
 173  /***/ 129:
 174  /***/ (function(module, exports) {
 175  
 176  (function() { module.exports = window["wp"]["shortcode"]; }());
 177  
 178  /***/ }),
 179  
 180  /***/ 147:
 181  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 182  
 183  "use strict";
 184  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toArray; });
 185  /* harmony import */ var _babel_runtime_helpers_esm_arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38);
 186  /* harmony import */ var _babel_runtime_helpers_esm_iterableToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(37);
 187  /* harmony import */ var _babel_runtime_helpers_esm_unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(31);
 188  /* harmony import */ var _babel_runtime_helpers_esm_nonIterableRest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(39);
 189  
 190  
 191  
 192  
 193  function _toArray(arr) {
 194    return Object(_babel_runtime_helpers_esm_arrayWithHoles__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(arr) || Object(_babel_runtime_helpers_esm_iterableToArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(arr) || Object(_babel_runtime_helpers_esm_unsupportedIterableToArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(arr) || Object(_babel_runtime_helpers_esm_nonIterableRest__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])();
 195  }
 196  
 197  /***/ }),
 198  
 199  /***/ 15:
 200  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 201  
 202  "use strict";
 203  
 204  // EXPORTS
 205  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 206  
 207  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 208  var arrayLikeToArray = __webpack_require__(24);
 209  
 210  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 211  
 212  function _arrayWithoutHoles(arr) {
 213    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 214  }
 215  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 216  var iterableToArray = __webpack_require__(37);
 217  
 218  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 219  var unsupportedIterableToArray = __webpack_require__(31);
 220  
 221  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 222  function _nonIterableSpread() {
 223    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 224  }
 225  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 226  
 227  
 228  
 229  
 230  function _toConsumableArray(arr) {
 231    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 232  }
 233  
 234  /***/ }),
 235  
 236  /***/ 2:
 237  /***/ (function(module, exports) {
 238  
 239  (function() { module.exports = window["lodash"]; }());
 240  
 241  /***/ }),
 242  
 243  /***/ 204:
 244  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 245  
 246  "use strict";
 247  
 248  // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
 249  // Unique ID creation requires a high quality random # generator. In the browser we therefore
 250  // require the crypto API and do not support built-in fallback to lower quality random number
 251  // generators (like Math.random()).
 252  var getRandomValues;
 253  var rnds8 = new Uint8Array(16);
 254  function rng() {
 255    // lazy load so that environments that need to polyfill have a chance to do so
 256    if (!getRandomValues) {
 257      // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
 258      // find the complete implementation of crypto (msCrypto) on IE11.
 259      getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
 260  
 261      if (!getRandomValues) {
 262        throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
 263      }
 264    }
 265  
 266    return getRandomValues(rnds8);
 267  }
 268  // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js
 269  /* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
 270  // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js
 271  
 272  
 273  function validate(uuid) {
 274    return typeof uuid === 'string' && regex.test(uuid);
 275  }
 276  
 277  /* harmony default export */ var esm_browser_validate = (validate);
 278  // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
 279  
 280  /**
 281   * Convert array of 16 byte values to UUID string format of the form:
 282   * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 283   */
 284  
 285  var byteToHex = [];
 286  
 287  for (var stringify_i = 0; stringify_i < 256; ++stringify_i) {
 288    byteToHex.push((stringify_i + 0x100).toString(16).substr(1));
 289  }
 290  
 291  function stringify(arr) {
 292    var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
 293    // Note: Be careful editing this code!  It's been tuned for performance
 294    // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
 295    var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID.  If this throws, it's likely due to one
 296    // of the following:
 297    // - One or more input array values don't map to a hex octet (leading to
 298    // "undefined" in the uuid)
 299    // - Invalid input values for the RFC `version` or `variant` fields
 300  
 301    if (!esm_browser_validate(uuid)) {
 302      throw TypeError('Stringified UUID is invalid');
 303    }
 304  
 305    return uuid;
 306  }
 307  
 308  /* harmony default export */ var esm_browser_stringify = (stringify);
 309  // CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
 310  
 311  
 312  
 313  function v4(options, buf, offset) {
 314    options = options || {};
 315    var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
 316  
 317    rnds[6] = rnds[6] & 0x0f | 0x40;
 318    rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
 319  
 320    if (buf) {
 321      offset = offset || 0;
 322  
 323      for (var i = 0; i < 16; ++i) {
 324        buf[offset + i] = rnds[i];
 325      }
 326  
 327      return buf;
 328    }
 329  
 330    return esm_browser_stringify(rnds);
 331  }
 332  
 333  /* harmony default export */ var esm_browser_v4 = __webpack_exports__["a"] = (v4);
 334  
 335  /***/ }),
 336  
 337  /***/ 215:
 338  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 339  
 340  "use strict";
 341  /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
 342  /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
 343  /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
 344  /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
 345  
 346  
 347  /**
 348   * WordPress dependencies
 349   */
 350  
 351  var blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
 352    xmlns: "http://www.w3.org/2000/svg",
 353    viewBox: "0 0 24 24"
 354  }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
 355    d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
 356  }));
 357  /* harmony default export */ __webpack_exports__["a"] = (blockDefault);
 358  
 359  
 360  /***/ }),
 361  
 362  /***/ 24:
 363  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 364  
 365  "use strict";
 366  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 367  function _arrayLikeToArray(arr, len) {
 368    if (len == null || len > arr.length) len = arr.length;
 369  
 370    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 371      arr2[i] = arr[i];
 372    }
 373  
 374    return arr2;
 375  }
 376  
 377  /***/ }),
 378  
 379  /***/ 25:
 380  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 381  
 382  "use strict";
 383  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 384  function _classCallCheck(instance, Constructor) {
 385    if (!(instance instanceof Constructor)) {
 386      throw new TypeError("Cannot call a class as a function");
 387    }
 388  }
 389  
 390  /***/ }),
 391  
 392  /***/ 26:
 393  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 394  
 395  "use strict";
 396  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
 397  function _defineProperties(target, props) {
 398    for (var i = 0; i < props.length; i++) {
 399      var descriptor = props[i];
 400      descriptor.enumerable = descriptor.enumerable || false;
 401      descriptor.configurable = true;
 402      if ("value" in descriptor) descriptor.writable = true;
 403      Object.defineProperty(target, descriptor.key, descriptor);
 404    }
 405  }
 406  
 407  function _createClass(Constructor, protoProps, staticProps) {
 408    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 409    if (staticProps) _defineProperties(Constructor, staticProps);
 410    return Constructor;
 411  }
 412  
 413  /***/ }),
 414  
 415  /***/ 27:
 416  /***/ (function(module, exports) {
 417  
 418  (function() { module.exports = window["wp"]["dom"]; }());
 419  
 420  /***/ }),
 421  
 422  /***/ 284:
 423  /***/ (function(module, exports) {
 424  
 425  (function() { module.exports = window["wp"]["blockSerializationDefaultParser"]; }());
 426  
 427  /***/ }),
 428  
 429  /***/ 285:
 430  /***/ (function(module, exports, __webpack_require__) {
 431  
 432  var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */
 433  (function(){
 434  /**
 435   * Created by Tivie on 13-07-2015.
 436   */
 437  
 438  function getDefaultOpts (simple) {
 439    'use strict';
 440  
 441    var defaultOptions = {
 442      omitExtraWLInCodeBlocks: {
 443        defaultValue: false,
 444        describe: 'Omit the default extra whiteline added to code blocks',
 445        type: 'boolean'
 446      },
 447      noHeaderId: {
 448        defaultValue: false,
 449        describe: 'Turn on/off generated header id',
 450        type: 'boolean'
 451      },
 452      prefixHeaderId: {
 453        defaultValue: false,
 454        describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
 455        type: 'string'
 456      },
 457      rawPrefixHeaderId: {
 458        defaultValue: false,
 459        describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
 460        type: 'boolean'
 461      },
 462      ghCompatibleHeaderId: {
 463        defaultValue: false,
 464        describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
 465        type: 'boolean'
 466      },
 467      rawHeaderId: {
 468        defaultValue: false,
 469        describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
 470        type: 'boolean'
 471      },
 472      headerLevelStart: {
 473        defaultValue: false,
 474        describe: 'The header blocks level start',
 475        type: 'integer'
 476      },
 477      parseImgDimensions: {
 478        defaultValue: false,
 479        describe: 'Turn on/off image dimension parsing',
 480        type: 'boolean'
 481      },
 482      simplifiedAutoLink: {
 483        defaultValue: false,
 484        describe: 'Turn on/off GFM autolink style',
 485        type: 'boolean'
 486      },
 487      excludeTrailingPunctuationFromURLs: {
 488        defaultValue: false,
 489        describe: 'Excludes trailing punctuation from links generated with autoLinking',
 490        type: 'boolean'
 491      },
 492      literalMidWordUnderscores: {
 493        defaultValue: false,
 494        describe: 'Parse midword underscores as literal underscores',
 495        type: 'boolean'
 496      },
 497      literalMidWordAsterisks: {
 498        defaultValue: false,
 499        describe: 'Parse midword asterisks as literal asterisks',
 500        type: 'boolean'
 501      },
 502      strikethrough: {
 503        defaultValue: false,
 504        describe: 'Turn on/off strikethrough support',
 505        type: 'boolean'
 506      },
 507      tables: {
 508        defaultValue: false,
 509        describe: 'Turn on/off tables support',
 510        type: 'boolean'
 511      },
 512      tablesHeaderId: {
 513        defaultValue: false,
 514        describe: 'Add an id to table headers',
 515        type: 'boolean'
 516      },
 517      ghCodeBlocks: {
 518        defaultValue: true,
 519        describe: 'Turn on/off GFM fenced code blocks support',
 520        type: 'boolean'
 521      },
 522      tasklists: {
 523        defaultValue: false,
 524        describe: 'Turn on/off GFM tasklist support',
 525        type: 'boolean'
 526      },
 527      smoothLivePreview: {
 528        defaultValue: false,
 529        describe: 'Prevents weird effects in live previews due to incomplete input',
 530        type: 'boolean'
 531      },
 532      smartIndentationFix: {
 533        defaultValue: false,
 534        description: 'Tries to smartly fix indentation in es6 strings',
 535        type: 'boolean'
 536      },
 537      disableForced4SpacesIndentedSublists: {
 538        defaultValue: false,
 539        description: 'Disables the requirement of indenting nested sublists by 4 spaces',
 540        type: 'boolean'
 541      },
 542      simpleLineBreaks: {
 543        defaultValue: false,
 544        description: 'Parses simple line breaks as <br> (GFM Style)',
 545        type: 'boolean'
 546      },
 547      requireSpaceBeforeHeadingText: {
 548        defaultValue: false,
 549        description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
 550        type: 'boolean'
 551      },
 552      ghMentions: {
 553        defaultValue: false,
 554        description: 'Enables github @mentions',
 555        type: 'boolean'
 556      },
 557      ghMentionsLink: {
 558        defaultValue: 'https://github.com/{u}',
 559        description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
 560        type: 'string'
 561      },
 562      encodeEmails: {
 563        defaultValue: true,
 564        description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
 565        type: 'boolean'
 566      },
 567      openLinksInNewWindow: {
 568        defaultValue: false,
 569        description: 'Open all links in new windows',
 570        type: 'boolean'
 571      },
 572      backslashEscapesHTMLTags: {
 573        defaultValue: false,
 574        description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
 575        type: 'boolean'
 576      },
 577      emoji: {
 578        defaultValue: false,
 579        description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
 580        type: 'boolean'
 581      },
 582      underline: {
 583        defaultValue: false,
 584        description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
 585        type: 'boolean'
 586      },
 587      completeHTMLDocument: {
 588        defaultValue: false,
 589        description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
 590        type: 'boolean'
 591      },
 592      metadata: {
 593        defaultValue: false,
 594        description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
 595        type: 'boolean'
 596      },
 597      splitAdjacentBlockquotes: {
 598        defaultValue: false,
 599        description: 'Split adjacent blockquote blocks',
 600        type: 'boolean'
 601      }
 602    };
 603    if (simple === false) {
 604      return JSON.parse(JSON.stringify(defaultOptions));
 605    }
 606    var ret = {};
 607    for (var opt in defaultOptions) {
 608      if (defaultOptions.hasOwnProperty(opt)) {
 609        ret[opt] = defaultOptions[opt].defaultValue;
 610      }
 611    }
 612    return ret;
 613  }
 614  
 615  function allOptionsOn () {
 616    'use strict';
 617    var options = getDefaultOpts(true),
 618        ret = {};
 619    for (var opt in options) {
 620      if (options.hasOwnProperty(opt)) {
 621        ret[opt] = true;
 622      }
 623    }
 624    return ret;
 625  }
 626  
 627  /**
 628   * Created by Tivie on 06-01-2015.
 629   */
 630  
 631  // Private properties
 632  var showdown = {},
 633      parsers = {},
 634      extensions = {},
 635      globalOptions = getDefaultOpts(true),
 636      setFlavor = 'vanilla',
 637      flavor = {
 638        github: {
 639          omitExtraWLInCodeBlocks:              true,
 640          simplifiedAutoLink:                   true,
 641          excludeTrailingPunctuationFromURLs:   true,
 642          literalMidWordUnderscores:            true,
 643          strikethrough:                        true,
 644          tables:                               true,
 645          tablesHeaderId:                       true,
 646          ghCodeBlocks:                         true,
 647          tasklists:                            true,
 648          disableForced4SpacesIndentedSublists: true,
 649          simpleLineBreaks:                     true,
 650          requireSpaceBeforeHeadingText:        true,
 651          ghCompatibleHeaderId:                 true,
 652          ghMentions:                           true,
 653          backslashEscapesHTMLTags:             true,
 654          emoji:                                true,
 655          splitAdjacentBlockquotes:             true
 656        },
 657        original: {
 658          noHeaderId:                           true,
 659          ghCodeBlocks:                         false
 660        },
 661        ghost: {
 662          omitExtraWLInCodeBlocks:              true,
 663          parseImgDimensions:                   true,
 664          simplifiedAutoLink:                   true,
 665          excludeTrailingPunctuationFromURLs:   true,
 666          literalMidWordUnderscores:            true,
 667          strikethrough:                        true,
 668          tables:                               true,
 669          tablesHeaderId:                       true,
 670          ghCodeBlocks:                         true,
 671          tasklists:                            true,
 672          smoothLivePreview:                    true,
 673          simpleLineBreaks:                     true,
 674          requireSpaceBeforeHeadingText:        true,
 675          ghMentions:                           false,
 676          encodeEmails:                         true
 677        },
 678        vanilla: getDefaultOpts(true),
 679        allOn: allOptionsOn()
 680      };
 681  
 682  /**
 683   * helper namespace
 684   * @type {{}}
 685   */
 686  showdown.helper = {};
 687  
 688  /**
 689   * TODO LEGACY SUPPORT CODE
 690   * @type {{}}
 691   */
 692  showdown.extensions = {};
 693  
 694  /**
 695   * Set a global option
 696   * @static
 697   * @param {string} key
 698   * @param {*} value
 699   * @returns {showdown}
 700   */
 701  showdown.setOption = function (key, value) {
 702    'use strict';
 703    globalOptions[key] = value;
 704    return this;
 705  };
 706  
 707  /**
 708   * Get a global option
 709   * @static
 710   * @param {string} key
 711   * @returns {*}
 712   */
 713  showdown.getOption = function (key) {
 714    'use strict';
 715    return globalOptions[key];
 716  };
 717  
 718  /**
 719   * Get the global options
 720   * @static
 721   * @returns {{}}
 722   */
 723  showdown.getOptions = function () {
 724    'use strict';
 725    return globalOptions;
 726  };
 727  
 728  /**
 729   * Reset global options to the default values
 730   * @static
 731   */
 732  showdown.resetOptions = function () {
 733    'use strict';
 734    globalOptions = getDefaultOpts(true);
 735  };
 736  
 737  /**
 738   * Set the flavor showdown should use as default
 739   * @param {string} name
 740   */
 741  showdown.setFlavor = function (name) {
 742    'use strict';
 743    if (!flavor.hasOwnProperty(name)) {
 744      throw Error(name + ' flavor was not found');
 745    }
 746    showdown.resetOptions();
 747    var preset = flavor[name];
 748    setFlavor = name;
 749    for (var option in preset) {
 750      if (preset.hasOwnProperty(option)) {
 751        globalOptions[option] = preset[option];
 752      }
 753    }
 754  };
 755  
 756  /**
 757   * Get the currently set flavor
 758   * @returns {string}
 759   */
 760  showdown.getFlavor = function () {
 761    'use strict';
 762    return setFlavor;
 763  };
 764  
 765  /**
 766   * Get the options of a specified flavor. Returns undefined if the flavor was not found
 767   * @param {string} name Name of the flavor
 768   * @returns {{}|undefined}
 769   */
 770  showdown.getFlavorOptions = function (name) {
 771    'use strict';
 772    if (flavor.hasOwnProperty(name)) {
 773      return flavor[name];
 774    }
 775  };
 776  
 777  /**
 778   * Get the default options
 779   * @static
 780   * @param {boolean} [simple=true]
 781   * @returns {{}}
 782   */
 783  showdown.getDefaultOptions = function (simple) {
 784    'use strict';
 785    return getDefaultOpts(simple);
 786  };
 787  
 788  /**
 789   * Get or set a subParser
 790   *
 791   * subParser(name)       - Get a registered subParser
 792   * subParser(name, func) - Register a subParser
 793   * @static
 794   * @param {string} name
 795   * @param {function} [func]
 796   * @returns {*}
 797   */
 798  showdown.subParser = function (name, func) {
 799    'use strict';
 800    if (showdown.helper.isString(name)) {
 801      if (typeof func !== 'undefined') {
 802        parsers[name] = func;
 803      } else {
 804        if (parsers.hasOwnProperty(name)) {
 805          return parsers[name];
 806        } else {
 807          throw Error('SubParser named ' + name + ' not registered!');
 808        }
 809      }
 810    }
 811  };
 812  
 813  /**
 814   * Gets or registers an extension
 815   * @static
 816   * @param {string} name
 817   * @param {object|function=} ext
 818   * @returns {*}
 819   */
 820  showdown.extension = function (name, ext) {
 821    'use strict';
 822  
 823    if (!showdown.helper.isString(name)) {
 824      throw Error('Extension \'name\' must be a string');
 825    }
 826  
 827    name = showdown.helper.stdExtName(name);
 828  
 829    // Getter
 830    if (showdown.helper.isUndefined(ext)) {
 831      if (!extensions.hasOwnProperty(name)) {
 832        throw Error('Extension named ' + name + ' is not registered!');
 833      }
 834      return extensions[name];
 835  
 836      // Setter
 837    } else {
 838      // Expand extension if it's wrapped in a function
 839      if (typeof ext === 'function') {
 840        ext = ext();
 841      }
 842  
 843      // Ensure extension is an array
 844      if (!showdown.helper.isArray(ext)) {
 845        ext = [ext];
 846      }
 847  
 848      var validExtension = validate(ext, name);
 849  
 850      if (validExtension.valid) {
 851        extensions[name] = ext;
 852      } else {
 853        throw Error(validExtension.error);
 854      }
 855    }
 856  };
 857  
 858  /**
 859   * Gets all extensions registered
 860   * @returns {{}}
 861   */
 862  showdown.getAllExtensions = function () {
 863    'use strict';
 864    return extensions;
 865  };
 866  
 867  /**
 868   * Remove an extension
 869   * @param {string} name
 870   */
 871  showdown.removeExtension = function (name) {
 872    'use strict';
 873    delete extensions[name];
 874  };
 875  
 876  /**
 877   * Removes all extensions
 878   */
 879  showdown.resetExtensions = function () {
 880    'use strict';
 881    extensions = {};
 882  };
 883  
 884  /**
 885   * Validate extension
 886   * @param {array} extension
 887   * @param {string} name
 888   * @returns {{valid: boolean, error: string}}
 889   */
 890  function validate (extension, name) {
 891    'use strict';
 892  
 893    var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
 894        ret = {
 895          valid: true,
 896          error: ''
 897        };
 898  
 899    if (!showdown.helper.isArray(extension)) {
 900      extension = [extension];
 901    }
 902  
 903    for (var i = 0; i < extension.length; ++i) {
 904      var baseMsg = errMsg + ' sub-extension ' + i + ': ',
 905          ext = extension[i];
 906      if (typeof ext !== 'object') {
 907        ret.valid = false;
 908        ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
 909        return ret;
 910      }
 911  
 912      if (!showdown.helper.isString(ext.type)) {
 913        ret.valid = false;
 914        ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
 915        return ret;
 916      }
 917  
 918      var type = ext.type = ext.type.toLowerCase();
 919  
 920      // normalize extension type
 921      if (type === 'language') {
 922        type = ext.type = 'lang';
 923      }
 924  
 925      if (type === 'html') {
 926        type = ext.type = 'output';
 927      }
 928  
 929      if (type !== 'lang' && type !== 'output' && type !== 'listener') {
 930        ret.valid = false;
 931        ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
 932        return ret;
 933      }
 934  
 935      if (type === 'listener') {
 936        if (showdown.helper.isUndefined(ext.listeners)) {
 937          ret.valid = false;
 938          ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
 939          return ret;
 940        }
 941      } else {
 942        if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
 943          ret.valid = false;
 944          ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
 945          return ret;
 946        }
 947      }
 948  
 949      if (ext.listeners) {
 950        if (typeof ext.listeners !== 'object') {
 951          ret.valid = false;
 952          ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
 953          return ret;
 954        }
 955        for (var ln in ext.listeners) {
 956          if (ext.listeners.hasOwnProperty(ln)) {
 957            if (typeof ext.listeners[ln] !== 'function') {
 958              ret.valid = false;
 959              ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
 960                ' must be a function but ' + typeof ext.listeners[ln] + ' given';
 961              return ret;
 962            }
 963          }
 964        }
 965      }
 966  
 967      if (ext.filter) {
 968        if (typeof ext.filter !== 'function') {
 969          ret.valid = false;
 970          ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
 971          return ret;
 972        }
 973      } else if (ext.regex) {
 974        if (showdown.helper.isString(ext.regex)) {
 975          ext.regex = new RegExp(ext.regex, 'g');
 976        }
 977        if (!(ext.regex instanceof RegExp)) {
 978          ret.valid = false;
 979          ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
 980          return ret;
 981        }
 982        if (showdown.helper.isUndefined(ext.replace)) {
 983          ret.valid = false;
 984          ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
 985          return ret;
 986        }
 987      }
 988    }
 989    return ret;
 990  }
 991  
 992  /**
 993   * Validate extension
 994   * @param {object} ext
 995   * @returns {boolean}
 996   */
 997  showdown.validateExtension = function (ext) {
 998    'use strict';
 999  
1000    var validateExtension = validate(ext, null);
1001    if (!validateExtension.valid) {
1002      console.warn(validateExtension.error);
1003      return false;
1004    }
1005    return true;
1006  };
1007  
1008  /**
1009   * showdownjs helper functions
1010   */
1011  
1012  if (!showdown.hasOwnProperty('helper')) {
1013    showdown.helper = {};
1014  }
1015  
1016  /**
1017   * Check if var is string
1018   * @static
1019   * @param {string} a
1020   * @returns {boolean}
1021   */
1022  showdown.helper.isString = function (a) {
1023    'use strict';
1024    return (typeof a === 'string' || a instanceof String);
1025  };
1026  
1027  /**
1028   * Check if var is a function
1029   * @static
1030   * @param {*} a
1031   * @returns {boolean}
1032   */
1033  showdown.helper.isFunction = function (a) {
1034    'use strict';
1035    var getType = {};
1036    return a && getType.toString.call(a) === '[object Function]';
1037  };
1038  
1039  /**
1040   * isArray helper function
1041   * @static
1042   * @param {*} a
1043   * @returns {boolean}
1044   */
1045  showdown.helper.isArray = function (a) {
1046    'use strict';
1047    return Array.isArray(a);
1048  };
1049  
1050  /**
1051   * Check if value is undefined
1052   * @static
1053   * @param {*} value The value to check.
1054   * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
1055   */
1056  showdown.helper.isUndefined = function (value) {
1057    'use strict';
1058    return typeof value === 'undefined';
1059  };
1060  
1061  /**
1062   * ForEach helper function
1063   * Iterates over Arrays and Objects (own properties only)
1064   * @static
1065   * @param {*} obj
1066   * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
1067   */
1068  showdown.helper.forEach = function (obj, callback) {
1069    'use strict';
1070    // check if obj is defined
1071    if (showdown.helper.isUndefined(obj)) {
1072      throw new Error('obj param is required');
1073    }
1074  
1075    if (showdown.helper.isUndefined(callback)) {
1076      throw new Error('callback param is required');
1077    }
1078  
1079    if (!showdown.helper.isFunction(callback)) {
1080      throw new Error('callback param must be a function/closure');
1081    }
1082  
1083    if (typeof obj.forEach === 'function') {
1084      obj.forEach(callback);
1085    } else if (showdown.helper.isArray(obj)) {
1086      for (var i = 0; i < obj.length; i++) {
1087        callback(obj[i], i, obj);
1088      }
1089    } else if (typeof (obj) === 'object') {
1090      for (var prop in obj) {
1091        if (obj.hasOwnProperty(prop)) {
1092          callback(obj[prop], prop, obj);
1093        }
1094      }
1095    } else {
1096      throw new Error('obj does not seem to be an array or an iterable object');
1097    }
1098  };
1099  
1100  /**
1101   * Standardidize extension name
1102   * @static
1103   * @param {string} s extension name
1104   * @returns {string}
1105   */
1106  showdown.helper.stdExtName = function (s) {
1107    'use strict';
1108    return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
1109  };
1110  
1111  function escapeCharactersCallback (wholeMatch, m1) {
1112    'use strict';
1113    var charCodeToEscape = m1.charCodeAt(0);
1114    return '¨E' + charCodeToEscape + 'E';
1115  }
1116  
1117  /**
1118   * Callback used to escape characters when passing through String.replace
1119   * @static
1120   * @param {string} wholeMatch
1121   * @param {string} m1
1122   * @returns {string}
1123   */
1124  showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
1125  
1126  /**
1127   * Escape characters in a string
1128   * @static
1129   * @param {string} text
1130   * @param {string} charsToEscape
1131   * @param {boolean} afterBackslash
1132   * @returns {XML|string|void|*}
1133   */
1134  showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
1135    'use strict';
1136    // First we have to escape the escape characters so that
1137    // we can build a character class out of them
1138    var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
1139  
1140    if (afterBackslash) {
1141      regexString = '\\\\' + regexString;
1142    }
1143  
1144    var regex = new RegExp(regexString, 'g');
1145    text = text.replace(regex, escapeCharactersCallback);
1146  
1147    return text;
1148  };
1149  
1150  /**
1151   * Unescape HTML entities
1152   * @param txt
1153   * @returns {string}
1154   */
1155  showdown.helper.unescapeHTMLEntities = function (txt) {
1156    'use strict';
1157  
1158    return txt
1159      .replace(/&quot;/g, '"')
1160      .replace(/&lt;/g, '<')
1161      .replace(/&gt;/g, '>')
1162      .replace(/&amp;/g, '&');
1163  };
1164  
1165  var rgxFindMatchPos = function (str, left, right, flags) {
1166    'use strict';
1167    var f = flags || '',
1168        g = f.indexOf('g') > -1,
1169        x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
1170        l = new RegExp(left, f.replace(/g/g, '')),
1171        pos = [],
1172        t, s, m, start, end;
1173  
1174    do {
1175      t = 0;
1176      while ((m = x.exec(str))) {
1177        if (l.test(m[0])) {
1178          if (!(t++)) {
1179            s = x.lastIndex;
1180            start = s - m[0].length;
1181          }
1182        } else if (t) {
1183          if (!--t) {
1184            end = m.index + m[0].length;
1185            var obj = {
1186              left: {start: start, end: s},
1187              match: {start: s, end: m.index},
1188              right: {start: m.index, end: end},
1189              wholeMatch: {start: start, end: end}
1190            };
1191            pos.push(obj);
1192            if (!g) {
1193              return pos;
1194            }
1195          }
1196        }
1197      }
1198    } while (t && (x.lastIndex = s));
1199  
1200    return pos;
1201  };
1202  
1203  /**
1204   * matchRecursiveRegExp
1205   *
1206   * (c) 2007 Steven Levithan <stevenlevithan.com>
1207   * MIT License
1208   *
1209   * Accepts a string to search, a left and right format delimiter
1210   * as regex patterns, and optional regex flags. Returns an array
1211   * of matches, allowing nested instances of left/right delimiters.
1212   * Use the "g" flag to return all matches, otherwise only the
1213   * first is returned. Be careful to ensure that the left and
1214   * right format delimiters produce mutually exclusive matches.
1215   * Backreferences are not supported within the right delimiter
1216   * due to how it is internally combined with the left delimiter.
1217   * When matching strings whose format delimiters are unbalanced
1218   * to the left or right, the output is intentionally as a
1219   * conventional regex library with recursion support would
1220   * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
1221   * "<" and ">" as the delimiters (both strings contain a single,
1222   * balanced instance of "<x>").
1223   *
1224   * examples:
1225   * matchRecursiveRegExp("test", "\\(", "\\)")
1226   * returns: []
1227   * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
1228   * returns: ["t<<e>><s>", ""]
1229   * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
1230   * returns: ["test"]
1231   */
1232  showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
1233    'use strict';
1234  
1235    var matchPos = rgxFindMatchPos (str, left, right, flags),
1236        results = [];
1237  
1238    for (var i = 0; i < matchPos.length; ++i) {
1239      results.push([
1240        str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
1241        str.slice(matchPos[i].match.start, matchPos[i].match.end),
1242        str.slice(matchPos[i].left.start, matchPos[i].left.end),
1243        str.slice(matchPos[i].right.start, matchPos[i].right.end)
1244      ]);
1245    }
1246    return results;
1247  };
1248  
1249  /**
1250   *
1251   * @param {string} str
1252   * @param {string|function} replacement
1253   * @param {string} left
1254   * @param {string} right
1255   * @param {string} flags
1256   * @returns {string}
1257   */
1258  showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
1259    'use strict';
1260  
1261    if (!showdown.helper.isFunction(replacement)) {
1262      var repStr = replacement;
1263      replacement = function () {
1264        return repStr;
1265      };
1266    }
1267  
1268    var matchPos = rgxFindMatchPos(str, left, right, flags),
1269        finalStr = str,
1270        lng = matchPos.length;
1271  
1272    if (lng > 0) {
1273      var bits = [];
1274      if (matchPos[0].wholeMatch.start !== 0) {
1275        bits.push(str.slice(0, matchPos[0].wholeMatch.start));
1276      }
1277      for (var i = 0; i < lng; ++i) {
1278        bits.push(
1279          replacement(
1280            str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
1281            str.slice(matchPos[i].match.start, matchPos[i].match.end),
1282            str.slice(matchPos[i].left.start, matchPos[i].left.end),
1283            str.slice(matchPos[i].right.start, matchPos[i].right.end)
1284          )
1285        );
1286        if (i < lng - 1) {
1287          bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
1288        }
1289      }
1290      if (matchPos[lng - 1].wholeMatch.end < str.length) {
1291        bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
1292      }
1293      finalStr = bits.join('');
1294    }
1295    return finalStr;
1296  };
1297  
1298  /**
1299   * Returns the index within the passed String object of the first occurrence of the specified regex,
1300   * starting the search at fromIndex. Returns -1 if the value is not found.
1301   *
1302   * @param {string} str string to search
1303   * @param {RegExp} regex Regular expression to search
1304   * @param {int} [fromIndex = 0] Index to start the search
1305   * @returns {Number}
1306   * @throws InvalidArgumentError
1307   */
1308  showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
1309    'use strict';
1310    if (!showdown.helper.isString(str)) {
1311      throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
1312    }
1313    if (regex instanceof RegExp === false) {
1314      throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
1315    }
1316    var indexOf = str.substring(fromIndex || 0).search(regex);
1317    return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
1318  };
1319  
1320  /**
1321   * Splits the passed string object at the defined index, and returns an array composed of the two substrings
1322   * @param {string} str string to split
1323   * @param {int} index index to split string at
1324   * @returns {[string,string]}
1325   * @throws InvalidArgumentError
1326   */
1327  showdown.helper.splitAtIndex = function (str, index) {
1328    'use strict';
1329    if (!showdown.helper.isString(str)) {
1330      throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
1331    }
1332    return [str.substring(0, index), str.substring(index)];
1333  };
1334  
1335  /**
1336   * Obfuscate an e-mail address through the use of Character Entities,
1337   * transforming ASCII characters into their equivalent decimal or hex entities.
1338   *
1339   * Since it has a random component, subsequent calls to this function produce different results
1340   *
1341   * @param {string} mail
1342   * @returns {string}
1343   */
1344  showdown.helper.encodeEmailAddress = function (mail) {
1345    'use strict';
1346    var encode = [
1347      function (ch) {
1348        return '&#' + ch.charCodeAt(0) + ';';
1349      },
1350      function (ch) {
1351        return '&#x' + ch.charCodeAt(0).toString(16) + ';';
1352      },
1353      function (ch) {
1354        return ch;
1355      }
1356    ];
1357  
1358    mail = mail.replace(/./g, function (ch) {
1359      if (ch === '@') {
1360        // this *must* be encoded. I insist.
1361        ch = encode[Math.floor(Math.random() * 2)](ch);
1362      } else {
1363        var r = Math.random();
1364        // roughly 10% raw, 45% hex, 45% dec
1365        ch = (
1366          r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
1367        );
1368      }
1369      return ch;
1370    });
1371  
1372    return mail;
1373  };
1374  
1375  /**
1376   *
1377   * @param str
1378   * @param targetLength
1379   * @param padString
1380   * @returns {string}
1381   */
1382  showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
1383    'use strict';
1384    /*jshint bitwise: false*/
1385    // eslint-disable-next-line space-infix-ops
1386    targetLength = targetLength>>0; //floor if number or convert non-number to 0;
1387    /*jshint bitwise: true*/
1388    padString = String(padString || ' ');
1389    if (str.length > targetLength) {
1390      return String(str);
1391    } else {
1392      targetLength = targetLength - str.length;
1393      if (targetLength > padString.length) {
1394        padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
1395      }
1396      return String(str) + padString.slice(0,targetLength);
1397    }
1398  };
1399  
1400  /**
1401   * POLYFILLS
1402   */
1403  // use this instead of builtin is undefined for IE8 compatibility
1404  if (typeof console === 'undefined') {
1405    console = {
1406      warn: function (msg) {
1407        'use strict';
1408        alert(msg);
1409      },
1410      log: function (msg) {
1411        'use strict';
1412        alert(msg);
1413      },
1414      error: function (msg) {
1415        'use strict';
1416        throw msg;
1417      }
1418    };
1419  }
1420  
1421  /**
1422   * Common regexes.
1423   * We declare some common regexes to improve performance
1424   */
1425  showdown.helper.regexes = {
1426    asteriskDashAndColon: /([*_:~])/g
1427  };
1428  
1429  /**
1430   * EMOJIS LIST
1431   */
1432  showdown.helper.emojis = {
1433    '+1':'\ud83d\udc4d',
1434    '-1':'\ud83d\udc4e',
1435    '100':'\ud83d\udcaf',
1436    '1234':'\ud83d\udd22',
1437    '1st_place_medal':'\ud83e\udd47',
1438    '2nd_place_medal':'\ud83e\udd48',
1439    '3rd_place_medal':'\ud83e\udd49',
1440    '8ball':'\ud83c\udfb1',
1441    'a':'\ud83c\udd70\ufe0f',
1442    'ab':'\ud83c\udd8e',
1443    'abc':'\ud83d\udd24',
1444    'abcd':'\ud83d\udd21',
1445    'accept':'\ud83c\ude51',
1446    'aerial_tramway':'\ud83d\udea1',
1447    'airplane':'\u2708\ufe0f',
1448    'alarm_clock':'\u23f0',
1449    'alembic':'\u2697\ufe0f',
1450    'alien':'\ud83d\udc7d',
1451    'ambulance':'\ud83d\ude91',
1452    'amphora':'\ud83c\udffa',
1453    'anchor':'\u2693\ufe0f',
1454    'angel':'\ud83d\udc7c',
1455    'anger':'\ud83d\udca2',
1456    'angry':'\ud83d\ude20',
1457    'anguished':'\ud83d\ude27',
1458    'ant':'\ud83d\udc1c',
1459    'apple':'\ud83c\udf4e',
1460    'aquarius':'\u2652\ufe0f',
1461    'aries':'\u2648\ufe0f',
1462    'arrow_backward':'\u25c0\ufe0f',
1463    'arrow_double_down':'\u23ec',
1464    'arrow_double_up':'\u23eb',
1465    'arrow_down':'\u2b07\ufe0f',
1466    'arrow_down_small':'\ud83d\udd3d',
1467    'arrow_forward':'\u25b6\ufe0f',
1468    'arrow_heading_down':'\u2935\ufe0f',
1469    'arrow_heading_up':'\u2934\ufe0f',
1470    'arrow_left':'\u2b05\ufe0f',
1471    'arrow_lower_left':'\u2199\ufe0f',
1472    'arrow_lower_right':'\u2198\ufe0f',
1473    'arrow_right':'\u27a1\ufe0f',
1474    'arrow_right_hook':'\u21aa\ufe0f',
1475    'arrow_up':'\u2b06\ufe0f',
1476    'arrow_up_down':'\u2195\ufe0f',
1477    'arrow_up_small':'\ud83d\udd3c',
1478    'arrow_upper_left':'\u2196\ufe0f',
1479    'arrow_upper_right':'\u2197\ufe0f',
1480    'arrows_clockwise':'\ud83d\udd03',
1481    'arrows_counterclockwise':'\ud83d\udd04',
1482    'art':'\ud83c\udfa8',
1483    'articulated_lorry':'\ud83d\ude9b',
1484    'artificial_satellite':'\ud83d\udef0',
1485    'astonished':'\ud83d\ude32',
1486    'athletic_shoe':'\ud83d\udc5f',
1487    'atm':'\ud83c\udfe7',
1488    'atom_symbol':'\u269b\ufe0f',
1489    'avocado':'\ud83e\udd51',
1490    'b':'\ud83c\udd71\ufe0f',
1491    'baby':'\ud83d\udc76',
1492    'baby_bottle':'\ud83c\udf7c',
1493    'baby_chick':'\ud83d\udc24',
1494    'baby_symbol':'\ud83d\udebc',
1495    'back':'\ud83d\udd19',
1496    'bacon':'\ud83e\udd53',
1497    'badminton':'\ud83c\udff8',
1498    'baggage_claim':'\ud83d\udec4',
1499    'baguette_bread':'\ud83e\udd56',
1500    'balance_scale':'\u2696\ufe0f',
1501    'balloon':'\ud83c\udf88',
1502    'ballot_box':'\ud83d\uddf3',
1503    'ballot_box_with_check':'\u2611\ufe0f',
1504    'bamboo':'\ud83c\udf8d',
1505    'banana':'\ud83c\udf4c',
1506    'bangbang':'\u203c\ufe0f',
1507    'bank':'\ud83c\udfe6',
1508    'bar_chart':'\ud83d\udcca',
1509    'barber':'\ud83d\udc88',
1510    'baseball':'\u26be\ufe0f',
1511    'basketball':'\ud83c\udfc0',
1512    'basketball_man':'\u26f9\ufe0f',
1513    'basketball_woman':'\u26f9\ufe0f&zwj;\u2640\ufe0f',
1514    'bat':'\ud83e\udd87',
1515    'bath':'\ud83d\udec0',
1516    'bathtub':'\ud83d\udec1',
1517    'battery':'\ud83d\udd0b',
1518    'beach_umbrella':'\ud83c\udfd6',
1519    'bear':'\ud83d\udc3b',
1520    'bed':'\ud83d\udecf',
1521    'bee':'\ud83d\udc1d',
1522    'beer':'\ud83c\udf7a',
1523    'beers':'\ud83c\udf7b',
1524    'beetle':'\ud83d\udc1e',
1525    'beginner':'\ud83d\udd30',
1526    'bell':'\ud83d\udd14',
1527    'bellhop_bell':'\ud83d\udece',
1528    'bento':'\ud83c\udf71',
1529    'biking_man':'\ud83d\udeb4',
1530    'bike':'\ud83d\udeb2',
1531    'biking_woman':'\ud83d\udeb4&zwj;\u2640\ufe0f',
1532    'bikini':'\ud83d\udc59',
1533    'biohazard':'\u2623\ufe0f',
1534    'bird':'\ud83d\udc26',
1535    'birthday':'\ud83c\udf82',
1536    'black_circle':'\u26ab\ufe0f',
1537    'black_flag':'\ud83c\udff4',
1538    'black_heart':'\ud83d\udda4',
1539    'black_joker':'\ud83c\udccf',
1540    'black_large_square':'\u2b1b\ufe0f',
1541    'black_medium_small_square':'\u25fe\ufe0f',
1542    'black_medium_square':'\u25fc\ufe0f',
1543    'black_nib':'\u2712\ufe0f',
1544    'black_small_square':'\u25aa\ufe0f',
1545    'black_square_button':'\ud83d\udd32',
1546    'blonde_man':'\ud83d\udc71',
1547    'blonde_woman':'\ud83d\udc71&zwj;\u2640\ufe0f',
1548    'blossom':'\ud83c\udf3c',
1549    'blowfish':'\ud83d\udc21',
1550    'blue_book':'\ud83d\udcd8',
1551    'blue_car':'\ud83d\ude99',
1552    'blue_heart':'\ud83d\udc99',
1553    'blush':'\ud83d\ude0a',
1554    'boar':'\ud83d\udc17',
1555    'boat':'\u26f5\ufe0f',
1556    'bomb':'\ud83d\udca3',
1557    'book':'\ud83d\udcd6',
1558    'bookmark':'\ud83d\udd16',
1559    'bookmark_tabs':'\ud83d\udcd1',
1560    'books':'\ud83d\udcda',
1561    'boom':'\ud83d\udca5',
1562    'boot':'\ud83d\udc62',
1563    'bouquet':'\ud83d\udc90',
1564    'bowing_man':'\ud83d\ude47',
1565    'bow_and_arrow':'\ud83c\udff9',
1566    'bowing_woman':'\ud83d\ude47&zwj;\u2640\ufe0f',
1567    'bowling':'\ud83c\udfb3',
1568    'boxing_glove':'\ud83e\udd4a',
1569    'boy':'\ud83d\udc66',
1570    'bread':'\ud83c\udf5e',
1571    'bride_with_veil':'\ud83d\udc70',
1572    'bridge_at_night':'\ud83c\udf09',
1573    'briefcase':'\ud83d\udcbc',
1574    'broken_heart':'\ud83d\udc94',
1575    'bug':'\ud83d\udc1b',
1576    'building_construction':'\ud83c\udfd7',
1577    'bulb':'\ud83d\udca1',
1578    'bullettrain_front':'\ud83d\ude85',
1579    'bullettrain_side':'\ud83d\ude84',
1580    'burrito':'\ud83c\udf2f',
1581    'bus':'\ud83d\ude8c',
1582    'business_suit_levitating':'\ud83d\udd74',
1583    'busstop':'\ud83d\ude8f',
1584    'bust_in_silhouette':'\ud83d\udc64',
1585    'busts_in_silhouette':'\ud83d\udc65',
1586    'butterfly':'\ud83e\udd8b',
1587    'cactus':'\ud83c\udf35',
1588    'cake':'\ud83c\udf70',
1589    'calendar':'\ud83d\udcc6',
1590    'call_me_hand':'\ud83e\udd19',
1591    'calling':'\ud83d\udcf2',
1592    'camel':'\ud83d\udc2b',
1593    'camera':'\ud83d\udcf7',
1594    'camera_flash':'\ud83d\udcf8',
1595    'camping':'\ud83c\udfd5',
1596    'cancer':'\u264b\ufe0f',
1597    'candle':'\ud83d\udd6f',
1598    'candy':'\ud83c\udf6c',
1599    'canoe':'\ud83d\udef6',
1600    'capital_abcd':'\ud83d\udd20',
1601    'capricorn':'\u2651\ufe0f',
1602    'car':'\ud83d\ude97',
1603    'card_file_box':'\ud83d\uddc3',
1604    'card_index':'\ud83d\udcc7',
1605    'card_index_dividers':'\ud83d\uddc2',
1606    'carousel_horse':'\ud83c\udfa0',
1607    'carrot':'\ud83e\udd55',
1608    'cat':'\ud83d\udc31',
1609    'cat2':'\ud83d\udc08',
1610    'cd':'\ud83d\udcbf',
1611    'chains':'\u26d3',
1612    'champagne':'\ud83c\udf7e',
1613    'chart':'\ud83d\udcb9',
1614    'chart_with_downwards_trend':'\ud83d\udcc9',
1615    'chart_with_upwards_trend':'\ud83d\udcc8',
1616    'checkered_flag':'\ud83c\udfc1',
1617    'cheese':'\ud83e\uddc0',
1618    'cherries':'\ud83c\udf52',
1619    'cherry_blossom':'\ud83c\udf38',
1620    'chestnut':'\ud83c\udf30',
1621    'chicken':'\ud83d\udc14',
1622    'children_crossing':'\ud83d\udeb8',
1623    'chipmunk':'\ud83d\udc3f',
1624    'chocolate_bar':'\ud83c\udf6b',
1625    'christmas_tree':'\ud83c\udf84',
1626    'church':'\u26ea\ufe0f',
1627    'cinema':'\ud83c\udfa6',
1628    'circus_tent':'\ud83c\udfaa',
1629    'city_sunrise':'\ud83c\udf07',
1630    'city_sunset':'\ud83c\udf06',
1631    'cityscape':'\ud83c\udfd9',
1632    'cl':'\ud83c\udd91',
1633    'clamp':'\ud83d\udddc',
1634    'clap':'\ud83d\udc4f',
1635    'clapper':'\ud83c\udfac',
1636    'classical_building':'\ud83c\udfdb',
1637    'clinking_glasses':'\ud83e\udd42',
1638    'clipboard':'\ud83d\udccb',
1639    'clock1':'\ud83d\udd50',
1640    'clock10':'\ud83d\udd59',
1641    'clock1030':'\ud83d\udd65',
1642    'clock11':'\ud83d\udd5a',
1643    'clock1130':'\ud83d\udd66',
1644    'clock12':'\ud83d\udd5b',
1645    'clock1230':'\ud83d\udd67',
1646    'clock130':'\ud83d\udd5c',
1647    'clock2':'\ud83d\udd51',
1648    'clock230':'\ud83d\udd5d',
1649    'clock3':'\ud83d\udd52',
1650    'clock330':'\ud83d\udd5e',
1651    'clock4':'\ud83d\udd53',
1652    'clock430':'\ud83d\udd5f',
1653    'clock5':'\ud83d\udd54',
1654    'clock530':'\ud83d\udd60',
1655    'clock6':'\ud83d\udd55',
1656    'clock630':'\ud83d\udd61',
1657    'clock7':'\ud83d\udd56',
1658    'clock730':'\ud83d\udd62',
1659    'clock8':'\ud83d\udd57',
1660    'clock830':'\ud83d\udd63',
1661    'clock9':'\ud83d\udd58',
1662    'clock930':'\ud83d\udd64',
1663    'closed_book':'\ud83d\udcd5',
1664    'closed_lock_with_key':'\ud83d\udd10',
1665    'closed_umbrella':'\ud83c\udf02',
1666    'cloud':'\u2601\ufe0f',
1667    'cloud_with_lightning':'\ud83c\udf29',
1668    'cloud_with_lightning_and_rain':'\u26c8',
1669    'cloud_with_rain':'\ud83c\udf27',
1670    'cloud_with_snow':'\ud83c\udf28',
1671    'clown_face':'\ud83e\udd21',
1672    'clubs':'\u2663\ufe0f',
1673    'cocktail':'\ud83c\udf78',
1674    'coffee':'\u2615\ufe0f',
1675    'coffin':'\u26b0\ufe0f',
1676    'cold_sweat':'\ud83d\ude30',
1677    'comet':'\u2604\ufe0f',
1678    'computer':'\ud83d\udcbb',
1679    'computer_mouse':'\ud83d\uddb1',
1680    'confetti_ball':'\ud83c\udf8a',
1681    'confounded':'\ud83d\ude16',
1682    'confused':'\ud83d\ude15',
1683    'congratulations':'\u3297\ufe0f',
1684    'construction':'\ud83d\udea7',
1685    'construction_worker_man':'\ud83d\udc77',
1686    'construction_worker_woman':'\ud83d\udc77&zwj;\u2640\ufe0f',
1687    'control_knobs':'\ud83c\udf9b',
1688    'convenience_store':'\ud83c\udfea',
1689    'cookie':'\ud83c\udf6a',
1690    'cool':'\ud83c\udd92',
1691    'policeman':'\ud83d\udc6e',
1692    'copyright':'\u00a9\ufe0f',
1693    'corn':'\ud83c\udf3d',
1694    'couch_and_lamp':'\ud83d\udecb',
1695    'couple':'\ud83d\udc6b',
1696    'couple_with_heart_woman_man':'\ud83d\udc91',
1697    'couple_with_heart_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc68',
1698    'couple_with_heart_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc69',
1699    'couplekiss_man_man':'\ud83d\udc68&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc68',
1700    'couplekiss_man_woman':'\ud83d\udc8f',
1701    'couplekiss_woman_woman':'\ud83d\udc69&zwj;\u2764\ufe0f&zwj;\ud83d\udc8b&zwj;\ud83d\udc69',
1702    'cow':'\ud83d\udc2e',
1703    'cow2':'\ud83d\udc04',
1704    'cowboy_hat_face':'\ud83e\udd20',
1705    'crab':'\ud83e\udd80',
1706    'crayon':'\ud83d\udd8d',
1707    'credit_card':'\ud83d\udcb3',
1708    'crescent_moon':'\ud83c\udf19',
1709    'cricket':'\ud83c\udfcf',
1710    'crocodile':'\ud83d\udc0a',
1711    'croissant':'\ud83e\udd50',
1712    'crossed_fingers':'\ud83e\udd1e',
1713    'crossed_flags':'\ud83c\udf8c',
1714    'crossed_swords':'\u2694\ufe0f',
1715    'crown':'\ud83d\udc51',
1716    'cry':'\ud83d\ude22',
1717    'crying_cat_face':'\ud83d\ude3f',
1718    'crystal_ball':'\ud83d\udd2e',
1719    'cucumber':'\ud83e\udd52',
1720    'cupid':'\ud83d\udc98',
1721    'curly_loop':'\u27b0',
1722    'currency_exchange':'\ud83d\udcb1',
1723    'curry':'\ud83c\udf5b',
1724    'custard':'\ud83c\udf6e',
1725    'customs':'\ud83d\udec3',
1726    'cyclone':'\ud83c\udf00',
1727    'dagger':'\ud83d\udde1',
1728    'dancer':'\ud83d\udc83',
1729    'dancing_women':'\ud83d\udc6f',
1730    'dancing_men':'\ud83d\udc6f&zwj;\u2642\ufe0f',
1731    'dango':'\ud83c\udf61',
1732    'dark_sunglasses':'\ud83d\udd76',
1733    'dart':'\ud83c\udfaf',
1734    'dash':'\ud83d\udca8',
1735    'date':'\ud83d\udcc5',
1736    'deciduous_tree':'\ud83c\udf33',
1737    'deer':'\ud83e\udd8c',
1738    'department_store':'\ud83c\udfec',
1739    'derelict_house':'\ud83c\udfda',
1740    'desert':'\ud83c\udfdc',
1741    'desert_island':'\ud83c\udfdd',
1742    'desktop_computer':'\ud83d\udda5',
1743    'male_detective':'\ud83d\udd75\ufe0f',
1744    'diamond_shape_with_a_dot_inside':'\ud83d\udca0',
1745    'diamonds':'\u2666\ufe0f',
1746    'disappointed':'\ud83d\ude1e',
1747    'disappointed_relieved':'\ud83d\ude25',
1748    'dizzy':'\ud83d\udcab',
1749    'dizzy_face':'\ud83d\ude35',
1750    'do_not_litter':'\ud83d\udeaf',
1751    'dog':'\ud83d\udc36',
1752    'dog2':'\ud83d\udc15',
1753    'dollar':'\ud83d\udcb5',
1754    'dolls':'\ud83c\udf8e',
1755    'dolphin':'\ud83d\udc2c',
1756    'door':'\ud83d\udeaa',
1757    'doughnut':'\ud83c\udf69',
1758    'dove':'\ud83d\udd4a',
1759    'dragon':'\ud83d\udc09',
1760    'dragon_face':'\ud83d\udc32',
1761    'dress':'\ud83d\udc57',
1762    'dromedary_camel':'\ud83d\udc2a',
1763    'drooling_face':'\ud83e\udd24',
1764    'droplet':'\ud83d\udca7',
1765    'drum':'\ud83e\udd41',
1766    'duck':'\ud83e\udd86',
1767    'dvd':'\ud83d\udcc0',
1768    'e-mail':'\ud83d\udce7',
1769    'eagle':'\ud83e\udd85',
1770    'ear':'\ud83d\udc42',
1771    'ear_of_rice':'\ud83c\udf3e',
1772    'earth_africa':'\ud83c\udf0d',
1773    'earth_americas':'\ud83c\udf0e',
1774    'earth_asia':'\ud83c\udf0f',
1775    'egg':'\ud83e\udd5a',
1776    'eggplant':'\ud83c\udf46',
1777    'eight_pointed_black_star':'\u2734\ufe0f',
1778    'eight_spoked_asterisk':'\u2733\ufe0f',
1779    'electric_plug':'\ud83d\udd0c',
1780    'elephant':'\ud83d\udc18',
1781    'email':'\u2709\ufe0f',
1782    'end':'\ud83d\udd1a',
1783    'envelope_with_arrow':'\ud83d\udce9',
1784    'euro':'\ud83d\udcb6',
1785    'european_castle':'\ud83c\udff0',
1786    'european_post_office':'\ud83c\udfe4',
1787    'evergreen_tree':'\ud83c\udf32',
1788    'exclamation':'\u2757\ufe0f',
1789    'expressionless':'\ud83d\ude11',
1790    'eye':'\ud83d\udc41',
1791    'eye_speech_bubble':'\ud83d\udc41&zwj;\ud83d\udde8',
1792    'eyeglasses':'\ud83d\udc53',
1793    'eyes':'\ud83d\udc40',
1794    'face_with_head_bandage':'\ud83e\udd15',
1795    'face_with_thermometer':'\ud83e\udd12',
1796    'fist_oncoming':'\ud83d\udc4a',
1797    'factory':'\ud83c\udfed',
1798    'fallen_leaf':'\ud83c\udf42',
1799    'family_man_woman_boy':'\ud83d\udc6a',
1800    'family_man_boy':'\ud83d\udc68&zwj;\ud83d\udc66',
1801    'family_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
1802    'family_man_girl':'\ud83d\udc68&zwj;\ud83d\udc67',
1803    'family_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
1804    'family_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
1805    'family_man_man_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66',
1806    'family_man_man_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
1807    'family_man_man_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67',
1808    'family_man_man_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
1809    'family_man_man_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc68&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
1810    'family_man_woman_boy_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
1811    'family_man_woman_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
1812    'family_man_woman_girl_boy':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
1813    'family_man_woman_girl_girl':'\ud83d\udc68&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
1814    'family_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc66',
1815    'family_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
1816    'family_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc67',
1817    'family_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
1818    'family_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
1819    'family_woman_woman_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66',
1820    'family_woman_woman_boy_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc66&zwj;\ud83d\udc66',
1821    'family_woman_woman_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67',
1822    'family_woman_woman_girl_boy':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc66',
1823    'family_woman_woman_girl_girl':'\ud83d\udc69&zwj;\ud83d\udc69&zwj;\ud83d\udc67&zwj;\ud83d\udc67',
1824    'fast_forward':'\u23e9',
1825    'fax':'\ud83d\udce0',
1826    'fearful':'\ud83d\ude28',
1827    'feet':'\ud83d\udc3e',
1828    'female_detective':'\ud83d\udd75\ufe0f&zwj;\u2640\ufe0f',
1829    'ferris_wheel':'\ud83c\udfa1',
1830    'ferry':'\u26f4',
1831    'field_hockey':'\ud83c\udfd1',
1832    'file_cabinet':'\ud83d\uddc4',
1833    'file_folder':'\ud83d\udcc1',
1834    'film_projector':'\ud83d\udcfd',
1835    'film_strip':'\ud83c\udf9e',
1836    'fire':'\ud83d\udd25',
1837    'fire_engine':'\ud83d\ude92',
1838    'fireworks':'\ud83c\udf86',
1839    'first_quarter_moon':'\ud83c\udf13',
1840    'first_quarter_moon_with_face':'\ud83c\udf1b',
1841    'fish':'\ud83d\udc1f',
1842    'fish_cake':'\ud83c\udf65',
1843    'fishing_pole_and_fish':'\ud83c\udfa3',
1844    'fist_raised':'\u270a',
1845    'fist_left':'\ud83e\udd1b',
1846    'fist_right':'\ud83e\udd1c',
1847    'flags':'\ud83c\udf8f',
1848    'flashlight':'\ud83d\udd26',
1849    'fleur_de_lis':'\u269c\ufe0f',
1850    'flight_arrival':'\ud83d\udeec',
1851    'flight_departure':'\ud83d\udeeb',
1852    'floppy_disk':'\ud83d\udcbe',
1853    'flower_playing_cards':'\ud83c\udfb4',
1854    'flushed':'\ud83d\ude33',
1855    'fog':'\ud83c\udf2b',
1856    'foggy':'\ud83c\udf01',
1857    'football':'\ud83c\udfc8',
1858    'footprints':'\ud83d\udc63',
1859    'fork_and_knife':'\ud83c\udf74',
1860    'fountain':'\u26f2\ufe0f',
1861    'fountain_pen':'\ud83d\udd8b',
1862    'four_leaf_clover':'\ud83c\udf40',
1863    'fox_face':'\ud83e\udd8a',
1864    'framed_picture':'\ud83d\uddbc',
1865    'free':'\ud83c\udd93',
1866    'fried_egg':'\ud83c\udf73',
1867    'fried_shrimp':'\ud83c\udf64',
1868    'fries':'\ud83c\udf5f',
1869    'frog':'\ud83d\udc38',
1870    'frowning':'\ud83d\ude26',
1871    'frowning_face':'\u2639\ufe0f',
1872    'frowning_man':'\ud83d\ude4d&zwj;\u2642\ufe0f',
1873    'frowning_woman':'\ud83d\ude4d',
1874    'middle_finger':'\ud83d\udd95',
1875    'fuelpump':'\u26fd\ufe0f',
1876    'full_moon':'\ud83c\udf15',
1877    'full_moon_with_face':'\ud83c\udf1d',
1878    'funeral_urn':'\u26b1\ufe0f',
1879    'game_die':'\ud83c\udfb2',
1880    'gear':'\u2699\ufe0f',
1881    'gem':'\ud83d\udc8e',
1882    'gemini':'\u264a\ufe0f',
1883    'ghost':'\ud83d\udc7b',
1884    'gift':'\ud83c\udf81',
1885    'gift_heart':'\ud83d\udc9d',
1886    'girl':'\ud83d\udc67',
1887    'globe_with_meridians':'\ud83c\udf10',
1888    'goal_net':'\ud83e\udd45',
1889    'goat':'\ud83d\udc10',
1890    'golf':'\u26f3\ufe0f',
1891    'golfing_man':'\ud83c\udfcc\ufe0f',
1892    'golfing_woman':'\ud83c\udfcc\ufe0f&zwj;\u2640\ufe0f',
1893    'gorilla':'\ud83e\udd8d',
1894    'grapes':'\ud83c\udf47',
1895    'green_apple':'\ud83c\udf4f',
1896    'green_book':'\ud83d\udcd7',
1897    'green_heart':'\ud83d\udc9a',
1898    'green_salad':'\ud83e\udd57',
1899    'grey_exclamation':'\u2755',
1900    'grey_question':'\u2754',
1901    'grimacing':'\ud83d\ude2c',
1902    'grin':'\ud83d\ude01',
1903    'grinning':'\ud83d\ude00',
1904    'guardsman':'\ud83d\udc82',
1905    'guardswoman':'\ud83d\udc82&zwj;\u2640\ufe0f',
1906    'guitar':'\ud83c\udfb8',
1907    'gun':'\ud83d\udd2b',
1908    'haircut_woman':'\ud83d\udc87',
1909    'haircut_man':'\ud83d\udc87&zwj;\u2642\ufe0f',
1910    'hamburger':'\ud83c\udf54',
1911    'hammer':'\ud83d\udd28',
1912    'hammer_and_pick':'\u2692',
1913    'hammer_and_wrench':'\ud83d\udee0',
1914    'hamster':'\ud83d\udc39',
1915    'hand':'\u270b',
1916    'handbag':'\ud83d\udc5c',
1917    'handshake':'\ud83e\udd1d',
1918    'hankey':'\ud83d\udca9',
1919    'hatched_chick':'\ud83d\udc25',
1920    'hatching_chick':'\ud83d\udc23',
1921    'headphones':'\ud83c\udfa7',
1922    'hear_no_evil':'\ud83d\ude49',
1923    'heart':'\u2764\ufe0f',
1924    'heart_decoration':'\ud83d\udc9f',
1925    'heart_eyes':'\ud83d\ude0d',
1926    'heart_eyes_cat':'\ud83d\ude3b',
1927    'heartbeat':'\ud83d\udc93',
1928    'heartpulse':'\ud83d\udc97',
1929    'hearts':'\u2665\ufe0f',
1930    'heavy_check_mark':'\u2714\ufe0f',
1931    'heavy_division_sign':'\u2797',
1932    'heavy_dollar_sign':'\ud83d\udcb2',
1933    'heavy_heart_exclamation':'\u2763\ufe0f',
1934    'heavy_minus_sign':'\u2796',
1935    'heavy_multiplication_x':'\u2716\ufe0f',
1936    'heavy_plus_sign':'\u2795',
1937    'helicopter':'\ud83d\ude81',
1938    'herb':'\ud83c\udf3f',
1939    'hibiscus':'\ud83c\udf3a',
1940    'high_brightness':'\ud83d\udd06',
1941    'high_heel':'\ud83d\udc60',
1942    'hocho':'\ud83d\udd2a',
1943    'hole':'\ud83d\udd73',
1944    'honey_pot':'\ud83c\udf6f',
1945    'horse':'\ud83d\udc34',
1946    'horse_racing':'\ud83c\udfc7',
1947    'hospital':'\ud83c\udfe5',
1948    'hot_pepper':'\ud83c\udf36',
1949    'hotdog':'\ud83c\udf2d',
1950    'hotel':'\ud83c\udfe8',
1951    'hotsprings':'\u2668\ufe0f',
1952    'hourglass':'\u231b\ufe0f',
1953    'hourglass_flowing_sand':'\u23f3',
1954    'house':'\ud83c\udfe0',
1955    'house_with_garden':'\ud83c\udfe1',
1956    'houses':'\ud83c\udfd8',
1957    'hugs':'\ud83e\udd17',
1958    'hushed':'\ud83d\ude2f',
1959    'ice_cream':'\ud83c\udf68',
1960    'ice_hockey':'\ud83c\udfd2',
1961    'ice_skate':'\u26f8',
1962    'icecream':'\ud83c\udf66',
1963    'id':'\ud83c\udd94',
1964    'ideograph_advantage':'\ud83c\ude50',
1965    'imp':'\ud83d\udc7f',
1966    'inbox_tray':'\ud83d\udce5',
1967    'incoming_envelope':'\ud83d\udce8',
1968    'tipping_hand_woman':'\ud83d\udc81',
1969    'information_source':'\u2139\ufe0f',
1970    'innocent':'\ud83d\ude07',
1971    'interrobang':'\u2049\ufe0f',
1972    'iphone':'\ud83d\udcf1',
1973    'izakaya_lantern':'\ud83c\udfee',
1974    'jack_o_lantern':'\ud83c\udf83',
1975    'japan':'\ud83d\uddfe',
1976    'japanese_castle':'\ud83c\udfef',
1977    'japanese_goblin':'\ud83d\udc7a',
1978    'japanese_ogre':'\ud83d\udc79',
1979    'jeans':'\ud83d\udc56',
1980    'joy':'\ud83d\ude02',
1981    'joy_cat':'\ud83d\ude39',
1982    'joystick':'\ud83d\udd79',
1983    'kaaba':'\ud83d\udd4b',
1984    'key':'\ud83d\udd11',
1985    'keyboard':'\u2328\ufe0f',
1986    'keycap_ten':'\ud83d\udd1f',
1987    'kick_scooter':'\ud83d\udef4',
1988    'kimono':'\ud83d\udc58',
1989    'kiss':'\ud83d\udc8b',
1990    'kissing':'\ud83d\ude17',
1991    'kissing_cat':'\ud83d\ude3d',
1992    'kissing_closed_eyes':'\ud83d\ude1a',
1993    'kissing_heart':'\ud83d\ude18',
1994    'kissing_smiling_eyes':'\ud83d\ude19',
1995    'kiwi_fruit':'\ud83e\udd5d',
1996    'koala':'\ud83d\udc28',
1997    'koko':'\ud83c\ude01',
1998    'label':'\ud83c\udff7',
1999    'large_blue_circle':'\ud83d\udd35',
2000    'large_blue_diamond':'\ud83d\udd37',
2001    'large_orange_diamond':'\ud83d\udd36',
2002    'last_quarter_moon':'\ud83c\udf17',
2003    'last_quarter_moon_with_face':'\ud83c\udf1c',
2004    'latin_cross':'\u271d\ufe0f',
2005    'laughing':'\ud83d\ude06',
2006    'leaves':'\ud83c\udf43',
2007    'ledger':'\ud83d\udcd2',
2008    'left_luggage':'\ud83d\udec5',
2009    'left_right_arrow':'\u2194\ufe0f',
2010    'leftwards_arrow_with_hook':'\u21a9\ufe0f',
2011    'lemon':'\ud83c\udf4b',
2012    'leo':'\u264c\ufe0f',
2013    'leopard':'\ud83d\udc06',
2014    'level_slider':'\ud83c\udf9a',
2015    'libra':'\u264e\ufe0f',
2016    'light_rail':'\ud83d\ude88',
2017    'link':'\ud83d\udd17',
2018    'lion':'\ud83e\udd81',
2019    'lips':'\ud83d\udc44',
2020    'lipstick':'\ud83d\udc84',
2021    'lizard':'\ud83e\udd8e',
2022    'lock':'\ud83d\udd12',
2023    'lock_with_ink_pen':'\ud83d\udd0f',
2024    'lollipop':'\ud83c\udf6d',
2025    'loop':'\u27bf',
2026    'loud_sound':'\ud83d\udd0a',
2027    'loudspeaker':'\ud83d\udce2',
2028    'love_hotel':'\ud83c\udfe9',
2029    'love_letter':'\ud83d\udc8c',
2030    'low_brightness':'\ud83d\udd05',
2031    'lying_face':'\ud83e\udd25',
2032    'm':'\u24c2\ufe0f',
2033    'mag':'\ud83d\udd0d',
2034    'mag_right':'\ud83d\udd0e',
2035    'mahjong':'\ud83c\udc04\ufe0f',
2036    'mailbox':'\ud83d\udceb',
2037    'mailbox_closed':'\ud83d\udcea',
2038    'mailbox_with_mail':'\ud83d\udcec',
2039    'mailbox_with_no_mail':'\ud83d\udced',
2040    'man':'\ud83d\udc68',
2041    'man_artist':'\ud83d\udc68&zwj;\ud83c\udfa8',
2042    'man_astronaut':'\ud83d\udc68&zwj;\ud83d\ude80',
2043    'man_cartwheeling':'\ud83e\udd38&zwj;\u2642\ufe0f',
2044    'man_cook':'\ud83d\udc68&zwj;\ud83c\udf73',
2045    'man_dancing':'\ud83d\udd7a',
2046    'man_facepalming':'\ud83e\udd26&zwj;\u2642\ufe0f',
2047    'man_factory_worker':'\ud83d\udc68&zwj;\ud83c\udfed',
2048    'man_farmer':'\ud83d\udc68&zwj;\ud83c\udf3e',
2049    'man_firefighter':'\ud83d\udc68&zwj;\ud83d\ude92',
2050    'man_health_worker':'\ud83d\udc68&zwj;\u2695\ufe0f',
2051    'man_in_tuxedo':'\ud83e\udd35',
2052    'man_judge':'\ud83d\udc68&zwj;\u2696\ufe0f',
2053    'man_juggling':'\ud83e\udd39&zwj;\u2642\ufe0f',
2054    'man_mechanic':'\ud83d\udc68&zwj;\ud83d\udd27',
2055    'man_office_worker':'\ud83d\udc68&zwj;\ud83d\udcbc',
2056    'man_pilot':'\ud83d\udc68&zwj;\u2708\ufe0f',
2057    'man_playing_handball':'\ud83e\udd3e&zwj;\u2642\ufe0f',
2058    'man_playing_water_polo':'\ud83e\udd3d&zwj;\u2642\ufe0f',
2059    'man_scientist':'\ud83d\udc68&zwj;\ud83d\udd2c',
2060    'man_shrugging':'\ud83e\udd37&zwj;\u2642\ufe0f',
2061    'man_singer':'\ud83d\udc68&zwj;\ud83c\udfa4',
2062    'man_student':'\ud83d\udc68&zwj;\ud83c\udf93',
2063    'man_teacher':'\ud83d\udc68&zwj;\ud83c\udfeb',
2064    'man_technologist':'\ud83d\udc68&zwj;\ud83d\udcbb',
2065    'man_with_gua_pi_mao':'\ud83d\udc72',
2066    'man_with_turban':'\ud83d\udc73',
2067    'tangerine':'\ud83c\udf4a',
2068    'mans_shoe':'\ud83d\udc5e',
2069    'mantelpiece_clock':'\ud83d\udd70',
2070    'maple_leaf':'\ud83c\udf41',
2071    'martial_arts_uniform':'\ud83e\udd4b',
2072    'mask':'\ud83d\ude37',
2073    'massage_woman':'\ud83d\udc86',
2074    'massage_man':'\ud83d\udc86&zwj;\u2642\ufe0f',
2075    'meat_on_bone':'\ud83c\udf56',
2076    'medal_military':'\ud83c\udf96',
2077    'medal_sports':'\ud83c\udfc5',
2078    'mega':'\ud83d\udce3',
2079    'melon':'\ud83c\udf48',
2080    'memo':'\ud83d\udcdd',
2081    'men_wrestling':'\ud83e\udd3c&zwj;\u2642\ufe0f',
2082    'menorah':'\ud83d\udd4e',
2083    'mens':'\ud83d\udeb9',
2084    'metal':'\ud83e\udd18',
2085    'metro':'\ud83d\ude87',
2086    'microphone':'\ud83c\udfa4',
2087    'microscope':'\ud83d\udd2c',
2088    'milk_glass':'\ud83e\udd5b',
2089    'milky_way':'\ud83c\udf0c',
2090    'minibus':'\ud83d\ude90',
2091    'minidisc':'\ud83d\udcbd',
2092    'mobile_phone_off':'\ud83d\udcf4',
2093    'money_mouth_face':'\ud83e\udd11',
2094    'money_with_wings':'\ud83d\udcb8',
2095    'moneybag':'\ud83d\udcb0',
2096    'monkey':'\ud83d\udc12',
2097    'monkey_face':'\ud83d\udc35',
2098    'monorail':'\ud83d\ude9d',
2099    'moon':'\ud83c\udf14',
2100    'mortar_board':'\ud83c\udf93',
2101    'mosque':'\ud83d\udd4c',
2102    'motor_boat':'\ud83d\udee5',
2103    'motor_scooter':'\ud83d\udef5',
2104    'motorcycle':'\ud83c\udfcd',
2105    'motorway':'\ud83d\udee3',
2106    'mount_fuji':'\ud83d\uddfb',
2107    'mountain':'\u26f0',
2108    'mountain_biking_man':'\ud83d\udeb5',
2109    'mountain_biking_woman':'\ud83d\udeb5&zwj;\u2640\ufe0f',
2110    'mountain_cableway':'\ud83d\udea0',
2111    'mountain_railway':'\ud83d\ude9e',
2112    'mountain_snow':'\ud83c\udfd4',
2113    'mouse':'\ud83d\udc2d',
2114    'mouse2':'\ud83d\udc01',
2115    'movie_camera':'\ud83c\udfa5',
2116    'moyai':'\ud83d\uddff',
2117    'mrs_claus':'\ud83e\udd36',
2118    'muscle':'\ud83d\udcaa',
2119    'mushroom':'\ud83c\udf44',
2120    'musical_keyboard':'\ud83c\udfb9',
2121    'musical_note':'\ud83c\udfb5',
2122    'musical_score':'\ud83c\udfbc',
2123    'mute':'\ud83d\udd07',
2124    'nail_care':'\ud83d\udc85',
2125    'name_badge':'\ud83d\udcdb',
2126    'national_park':'\ud83c\udfde',
2127    'nauseated_face':'\ud83e\udd22',
2128    'necktie':'\ud83d\udc54',
2129    'negative_squared_cross_mark':'\u274e',
2130    'nerd_face':'\ud83e\udd13',
2131    'neutral_face':'\ud83d\ude10',
2132    'new':'\ud83c\udd95',
2133    'new_moon':'\ud83c\udf11',
2134    'new_moon_with_face':'\ud83c\udf1a',
2135    'newspaper':'\ud83d\udcf0',
2136    'newspaper_roll':'\ud83d\uddde',
2137    'next_track_button':'\u23ed',
2138    'ng':'\ud83c\udd96',
2139    'no_good_man':'\ud83d\ude45&zwj;\u2642\ufe0f',
2140    'no_good_woman':'\ud83d\ude45',
2141    'night_with_stars':'\ud83c\udf03',
2142    'no_bell':'\ud83d\udd15',
2143    'no_bicycles':'\ud83d\udeb3',
2144    'no_entry':'\u26d4\ufe0f',
2145    'no_entry_sign':'\ud83d\udeab',
2146    'no_mobile_phones':'\ud83d\udcf5',
2147    'no_mouth':'\ud83d\ude36',
2148    'no_pedestrians':'\ud83d\udeb7',
2149    'no_smoking':'\ud83d\udead',
2150    'non-potable_water':'\ud83d\udeb1',
2151    'nose':'\ud83d\udc43',
2152    'notebook':'\ud83d\udcd3',
2153    'notebook_with_decorative_cover':'\ud83d\udcd4',
2154    'notes':'\ud83c\udfb6',
2155    'nut_and_bolt':'\ud83d\udd29',
2156    'o':'\u2b55\ufe0f',
2157    'o2':'\ud83c\udd7e\ufe0f',
2158    'ocean':'\ud83c\udf0a',
2159    'octopus':'\ud83d\udc19',
2160    'oden':'\ud83c\udf62',
2161    'office':'\ud83c\udfe2',
2162    'oil_drum':'\ud83d\udee2',
2163    'ok':'\ud83c\udd97',
2164    'ok_hand':'\ud83d\udc4c',
2165    'ok_man':'\ud83d\ude46&zwj;\u2642\ufe0f',
2166    'ok_woman':'\ud83d\ude46',
2167    'old_key':'\ud83d\udddd',
2168    'older_man':'\ud83d\udc74',
2169    'older_woman':'\ud83d\udc75',
2170    'om':'\ud83d\udd49',
2171    'on':'\ud83d\udd1b',
2172    'oncoming_automobile':'\ud83d\ude98',
2173    'oncoming_bus':'\ud83d\ude8d',
2174    'oncoming_police_car':'\ud83d\ude94',
2175    'oncoming_taxi':'\ud83d\ude96',
2176    'open_file_folder':'\ud83d\udcc2',
2177    'open_hands':'\ud83d\udc50',
2178    'open_mouth':'\ud83d\ude2e',
2179    'open_umbrella':'\u2602\ufe0f',
2180    'ophiuchus':'\u26ce',
2181    'orange_book':'\ud83d\udcd9',
2182    'orthodox_cross':'\u2626\ufe0f',
2183    'outbox_tray':'\ud83d\udce4',
2184    'owl':'\ud83e\udd89',
2185    'ox':'\ud83d\udc02',
2186    'package':'\ud83d\udce6',
2187    'page_facing_up':'\ud83d\udcc4',
2188    'page_with_curl':'\ud83d\udcc3',
2189    'pager':'\ud83d\udcdf',
2190    'paintbrush':'\ud83d\udd8c',
2191    'palm_tree':'\ud83c\udf34',
2192    'pancakes':'\ud83e\udd5e',
2193    'panda_face':'\ud83d\udc3c',
2194    'paperclip':'\ud83d\udcce',
2195    'paperclips':'\ud83d\udd87',
2196    'parasol_on_ground':'\u26f1',
2197    'parking':'\ud83c\udd7f\ufe0f',
2198    'part_alternation_mark':'\u303d\ufe0f',
2199    'partly_sunny':'\u26c5\ufe0f',
2200    'passenger_ship':'\ud83d\udef3',
2201    'passport_control':'\ud83d\udec2',
2202    'pause_button':'\u23f8',
2203    'peace_symbol':'\u262e\ufe0f',
2204    'peach':'\ud83c\udf51',
2205    'peanuts':'\ud83e\udd5c',
2206    'pear':'\ud83c\udf50',
2207    'pen':'\ud83d\udd8a',
2208    'pencil2':'\u270f\ufe0f',
2209    'penguin':'\ud83d\udc27',
2210    'pensive':'\ud83d\ude14',
2211    'performing_arts':'\ud83c\udfad',
2212    'persevere':'\ud83d\ude23',
2213    'person_fencing':'\ud83e\udd3a',
2214    'pouting_woman':'\ud83d\ude4e',
2215    'phone':'\u260e\ufe0f',
2216    'pick':'\u26cf',
2217    'pig':'\ud83d\udc37',
2218    'pig2':'\ud83d\udc16',
2219    'pig_nose':'\ud83d\udc3d',
2220    'pill':'\ud83d\udc8a',
2221    'pineapple':'\ud83c\udf4d',
2222    'ping_pong':'\ud83c\udfd3',
2223    'pisces':'\u2653\ufe0f',
2224    'pizza':'\ud83c\udf55',
2225    'place_of_worship':'\ud83d\uded0',
2226    'plate_with_cutlery':'\ud83c\udf7d',
2227    'play_or_pause_button':'\u23ef',
2228    'point_down':'\ud83d\udc47',
2229    'point_left':'\ud83d\udc48',
2230    'point_right':'\ud83d\udc49',
2231    'point_up':'\u261d\ufe0f',
2232    'point_up_2':'\ud83d\udc46',
2233    'police_car':'\ud83d\ude93',
2234    'policewoman':'\ud83d\udc6e&zwj;\u2640\ufe0f',
2235    'poodle':'\ud83d\udc29',
2236    'popcorn':'\ud83c\udf7f',
2237    'post_office':'\ud83c\udfe3',
2238    'postal_horn':'\ud83d\udcef',
2239    'postbox':'\ud83d\udcee',
2240    'potable_water':'\ud83d\udeb0',
2241    'potato':'\ud83e\udd54',
2242    'pouch':'\ud83d\udc5d',
2243    'poultry_leg':'\ud83c\udf57',
2244    'pound':'\ud83d\udcb7',
2245    'rage':'\ud83d\ude21',
2246    'pouting_cat':'\ud83d\ude3e',
2247    'pouting_man':'\ud83d\ude4e&zwj;\u2642\ufe0f',
2248    'pray':'\ud83d\ude4f',
2249    'prayer_beads':'\ud83d\udcff',
2250    'pregnant_woman':'\ud83e\udd30',
2251    'previous_track_button':'\u23ee',
2252    'prince':'\ud83e\udd34',
2253    'princess':'\ud83d\udc78',
2254    'printer':'\ud83d\udda8',
2255    'purple_heart':'\ud83d\udc9c',
2256    'purse':'\ud83d\udc5b',
2257    'pushpin':'\ud83d\udccc',
2258    'put_litter_in_its_place':'\ud83d\udeae',
2259    'question':'\u2753',
2260    'rabbit':'\ud83d\udc30',
2261    'rabbit2':'\ud83d\udc07',
2262    'racehorse':'\ud83d\udc0e',
2263    'racing_car':'\ud83c\udfce',
2264    'radio':'\ud83d\udcfb',
2265    'radio_button':'\ud83d\udd18',
2266    'radioactive':'\u2622\ufe0f',
2267    'railway_car':'\ud83d\ude83',
2268    'railway_track':'\ud83d\udee4',
2269    'rainbow':'\ud83c\udf08',
2270    'rainbow_flag':'\ud83c\udff3\ufe0f&zwj;\ud83c\udf08',
2271    'raised_back_of_hand':'\ud83e\udd1a',
2272    'raised_hand_with_fingers_splayed':'\ud83d\udd90',
2273    'raised_hands':'\ud83d\ude4c',
2274    'raising_hand_woman':'\ud83d\ude4b',
2275    'raising_hand_man':'\ud83d\ude4b&zwj;\u2642\ufe0f',
2276    'ram':'\ud83d\udc0f',
2277    'ramen':'\ud83c\udf5c',
2278    'rat':'\ud83d\udc00',
2279    'record_button':'\u23fa',
2280    'recycle':'\u267b\ufe0f',
2281    'red_circle':'\ud83d\udd34',
2282    'registered':'\u00ae\ufe0f',
2283    'relaxed':'\u263a\ufe0f',
2284    'relieved':'\ud83d\ude0c',
2285    'reminder_ribbon':'\ud83c\udf97',
2286    'repeat':'\ud83d\udd01',
2287    'repeat_one':'\ud83d\udd02',
2288    'rescue_worker_helmet':'\u26d1',
2289    'restroom':'\ud83d\udebb',
2290    'revolving_hearts':'\ud83d\udc9e',
2291    'rewind':'\u23ea',
2292    'rhinoceros':'\ud83e\udd8f',
2293    'ribbon':'\ud83c\udf80',
2294    'rice':'\ud83c\udf5a',
2295    'rice_ball':'\ud83c\udf59',
2296    'rice_cracker':'\ud83c\udf58',
2297    'rice_scene':'\ud83c\udf91',
2298    'right_anger_bubble':'\ud83d\uddef',
2299    'ring':'\ud83d\udc8d',
2300    'robot':'\ud83e\udd16',
2301    'rocket':'\ud83d\ude80',
2302    'rofl':'\ud83e\udd23',
2303    'roll_eyes':'\ud83d\ude44',
2304    'roller_coaster':'\ud83c\udfa2',
2305    'rooster':'\ud83d\udc13',
2306    'rose':'\ud83c\udf39',
2307    'rosette':'\ud83c\udff5',
2308    'rotating_light':'\ud83d\udea8',
2309    'round_pushpin':'\ud83d\udccd',
2310    'rowing_man':'\ud83d\udea3',
2311    'rowing_woman':'\ud83d\udea3&zwj;\u2640\ufe0f',
2312    'rugby_football':'\ud83c\udfc9',
2313    'running_man':'\ud83c\udfc3',
2314    'running_shirt_with_sash':'\ud83c\udfbd',
2315    'running_woman':'\ud83c\udfc3&zwj;\u2640\ufe0f',
2316    'sa':'\ud83c\ude02\ufe0f',
2317    'sagittarius':'\u2650\ufe0f',
2318    'sake':'\ud83c\udf76',
2319    'sandal':'\ud83d\udc61',
2320    'santa':'\ud83c\udf85',
2321    'satellite':'\ud83d\udce1',
2322    'saxophone':'\ud83c\udfb7',
2323    'school':'\ud83c\udfeb',
2324    'school_satchel':'\ud83c\udf92',
2325    'scissors':'\u2702\ufe0f',
2326    'scorpion':'\ud83e\udd82',
2327    'scorpius':'\u264f\ufe0f',
2328    'scream':'\ud83d\ude31',
2329    'scream_cat':'\ud83d\ude40',
2330    'scroll':'\ud83d\udcdc',
2331    'seat':'\ud83d\udcba',
2332    'secret':'\u3299\ufe0f',
2333    'see_no_evil':'\ud83d\ude48',
2334    'seedling':'\ud83c\udf31',
2335    'selfie':'\ud83e\udd33',
2336    'shallow_pan_of_food':'\ud83e\udd58',
2337    'shamrock':'\u2618\ufe0f',
2338    'shark':'\ud83e\udd88',
2339    'shaved_ice':'\ud83c\udf67',
2340    'sheep':'\ud83d\udc11',
2341    'shell':'\ud83d\udc1a',
2342    'shield':'\ud83d\udee1',
2343    'shinto_shrine':'\u26e9',
2344    'ship':'\ud83d\udea2',
2345    'shirt':'\ud83d\udc55',
2346    'shopping':'\ud83d\udecd',
2347    'shopping_cart':'\ud83d\uded2',
2348    'shower':'\ud83d\udebf',
2349    'shrimp':'\ud83e\udd90',
2350    'signal_strength':'\ud83d\udcf6',
2351    'six_pointed_star':'\ud83d\udd2f',
2352    'ski':'\ud83c\udfbf',
2353    'skier':'\u26f7',
2354    'skull':'\ud83d\udc80',
2355    'skull_and_crossbones':'\u2620\ufe0f',
2356    'sleeping':'\ud83d\ude34',
2357    'sleeping_bed':'\ud83d\udecc',
2358    'sleepy':'\ud83d\ude2a',
2359    'slightly_frowning_face':'\ud83d\ude41',
2360    'slightly_smiling_face':'\ud83d\ude42',
2361    'slot_machine':'\ud83c\udfb0',
2362    'small_airplane':'\ud83d\udee9',
2363    'small_blue_diamond':'\ud83d\udd39',
2364    'small_orange_diamond':'\ud83d\udd38',
2365    'small_red_triangle':'\ud83d\udd3a',
2366    'small_red_triangle_down':'\ud83d\udd3b',
2367    'smile':'\ud83d\ude04',
2368    'smile_cat':'\ud83d\ude38',
2369    'smiley':'\ud83d\ude03',
2370    'smiley_cat':'\ud83d\ude3a',
2371    'smiling_imp':'\ud83d\ude08',
2372    'smirk':'\ud83d\ude0f',
2373    'smirk_cat':'\ud83d\ude3c',
2374    'smoking':'\ud83d\udeac',
2375    'snail':'\ud83d\udc0c',
2376    'snake':'\ud83d\udc0d',
2377    'sneezing_face':'\ud83e\udd27',
2378    'snowboarder':'\ud83c\udfc2',
2379    'snowflake':'\u2744\ufe0f',
2380    'snowman':'\u26c4\ufe0f',
2381    'snowman_with_snow':'\u2603\ufe0f',
2382    'sob':'\ud83d\ude2d',
2383    'soccer':'\u26bd\ufe0f',
2384    'soon':'\ud83d\udd1c',
2385    'sos':'\ud83c\udd98',
2386    'sound':'\ud83d\udd09',
2387    'space_invader':'\ud83d\udc7e',
2388    'spades':'\u2660\ufe0f',
2389    'spaghetti':'\ud83c\udf5d',
2390    'sparkle':'\u2747\ufe0f',
2391    'sparkler':'\ud83c\udf87',
2392    'sparkles':'\u2728',
2393    'sparkling_heart':'\ud83d\udc96',
2394    'speak_no_evil':'\ud83d\ude4a',
2395    'speaker':'\ud83d\udd08',
2396    'speaking_head':'\ud83d\udde3',
2397    'speech_balloon':'\ud83d\udcac',
2398    'speedboat':'\ud83d\udea4',
2399    'spider':'\ud83d\udd77',
2400    'spider_web':'\ud83d\udd78',
2401    'spiral_calendar':'\ud83d\uddd3',
2402    'spiral_notepad':'\ud83d\uddd2',
2403    'spoon':'\ud83e\udd44',
2404    'squid':'\ud83e\udd91',
2405    'stadium':'\ud83c\udfdf',
2406    'star':'\u2b50\ufe0f',
2407    'star2':'\ud83c\udf1f',
2408    'star_and_crescent':'\u262a\ufe0f',
2409    'star_of_david':'\u2721\ufe0f',
2410    'stars':'\ud83c\udf20',
2411    'station':'\ud83d\ude89',
2412    'statue_of_liberty':'\ud83d\uddfd',
2413    'steam_locomotive':'\ud83d\ude82',
2414    'stew':'\ud83c\udf72',
2415    'stop_button':'\u23f9',
2416    'stop_sign':'\ud83d\uded1',
2417    'stopwatch':'\u23f1',
2418    'straight_ruler':'\ud83d\udccf',
2419    'strawberry':'\ud83c\udf53',
2420    'stuck_out_tongue':'\ud83d\ude1b',
2421    'stuck_out_tongue_closed_eyes':'\ud83d\ude1d',
2422    'stuck_out_tongue_winking_eye':'\ud83d\ude1c',
2423    'studio_microphone':'\ud83c\udf99',
2424    'stuffed_flatbread':'\ud83e\udd59',
2425    'sun_behind_large_cloud':'\ud83c\udf25',
2426    'sun_behind_rain_cloud':'\ud83c\udf26',
2427    'sun_behind_small_cloud':'\ud83c\udf24',
2428    'sun_with_face':'\ud83c\udf1e',
2429    'sunflower':'\ud83c\udf3b',
2430    'sunglasses':'\ud83d\ude0e',
2431    'sunny':'\u2600\ufe0f',
2432    'sunrise':'\ud83c\udf05',
2433    'sunrise_over_mountains':'\ud83c\udf04',
2434    'surfing_man':'\ud83c\udfc4',
2435    'surfing_woman':'\ud83c\udfc4&zwj;\u2640\ufe0f',
2436    'sushi':'\ud83c\udf63',
2437    'suspension_railway':'\ud83d\ude9f',
2438    'sweat':'\ud83d\ude13',
2439    'sweat_drops':'\ud83d\udca6',
2440    'sweat_smile':'\ud83d\ude05',
2441    'sweet_potato':'\ud83c\udf60',
2442    'swimming_man':'\ud83c\udfca',
2443    'swimming_woman':'\ud83c\udfca&zwj;\u2640\ufe0f',
2444    'symbols':'\ud83d\udd23',
2445    'synagogue':'\ud83d\udd4d',
2446    'syringe':'\ud83d\udc89',
2447    'taco':'\ud83c\udf2e',
2448    'tada':'\ud83c\udf89',
2449    'tanabata_tree':'\ud83c\udf8b',
2450    'taurus':'\u2649\ufe0f',
2451    'taxi':'\ud83d\ude95',
2452    'tea':'\ud83c\udf75',
2453    'telephone_receiver':'\ud83d\udcde',
2454    'telescope':'\ud83d\udd2d',
2455    'tennis':'\ud83c\udfbe',
2456    'tent':'\u26fa\ufe0f',
2457    'thermometer':'\ud83c\udf21',
2458    'thinking':'\ud83e\udd14',
2459    'thought_balloon':'\ud83d\udcad',
2460    'ticket':'\ud83c\udfab',
2461    'tickets':'\ud83c\udf9f',
2462    'tiger':'\ud83d\udc2f',
2463    'tiger2':'\ud83d\udc05',
2464    'timer_clock':'\u23f2',
2465    'tipping_hand_man':'\ud83d\udc81&zwj;\u2642\ufe0f',
2466    'tired_face':'\ud83d\ude2b',
2467    'tm':'\u2122\ufe0f',
2468    'toilet':'\ud83d\udebd',
2469    'tokyo_tower':'\ud83d\uddfc',
2470    'tomato':'\ud83c\udf45',
2471    'tongue':'\ud83d\udc45',
2472    'top':'\ud83d\udd1d',
2473    'tophat':'\ud83c\udfa9',
2474    'tornado':'\ud83c\udf2a',
2475    'trackball':'\ud83d\uddb2',
2476    'tractor':'\ud83d\ude9c',
2477    'traffic_light':'\ud83d\udea5',
2478    'train':'\ud83d\ude8b',
2479    'train2':'\ud83d\ude86',
2480    'tram':'\ud83d\ude8a',
2481    'triangular_flag_on_post':'\ud83d\udea9',
2482    'triangular_ruler':'\ud83d\udcd0',
2483    'trident':'\ud83d\udd31',
2484    'triumph':'\ud83d\ude24',
2485    'trolleybus':'\ud83d\ude8e',
2486    'trophy':'\ud83c\udfc6',
2487    'tropical_drink':'\ud83c\udf79',
2488    'tropical_fish':'\ud83d\udc20',
2489    'truck':'\ud83d\ude9a',
2490    'trumpet':'\ud83c\udfba',
2491    'tulip':'\ud83c\udf37',
2492    'tumbler_glass':'\ud83e\udd43',
2493    'turkey':'\ud83e\udd83',
2494    'turtle':'\ud83d\udc22',
2495    'tv':'\ud83d\udcfa',
2496    'twisted_rightwards_arrows':'\ud83d\udd00',
2497    'two_hearts':'\ud83d\udc95',
2498    'two_men_holding_hands':'\ud83d\udc6c',
2499    'two_women_holding_hands':'\ud83d\udc6d',
2500    'u5272':'\ud83c\ude39',
2501    'u5408':'\ud83c\ude34',
2502    'u55b6':'\ud83c\ude3a',
2503    'u6307':'\ud83c\ude2f\ufe0f',
2504    'u6708':'\ud83c\ude37\ufe0f',
2505    'u6709':'\ud83c\ude36',
2506    'u6e80':'\ud83c\ude35',
2507    'u7121':'\ud83c\ude1a\ufe0f',
2508    'u7533':'\ud83c\ude38',
2509    'u7981':'\ud83c\ude32',
2510    'u7a7a':'\ud83c\ude33',
2511    'umbrella':'\u2614\ufe0f',
2512    'unamused':'\ud83d\ude12',
2513    'underage':'\ud83d\udd1e',
2514    'unicorn':'\ud83e\udd84',
2515    'unlock':'\ud83d\udd13',
2516    'up':'\ud83c\udd99',
2517    'upside_down_face':'\ud83d\ude43',
2518    'v':'\u270c\ufe0f',
2519    'vertical_traffic_light':'\ud83d\udea6',
2520    'vhs':'\ud83d\udcfc',
2521    'vibration_mode':'\ud83d\udcf3',
2522    'video_camera':'\ud83d\udcf9',
2523    'video_game':'\ud83c\udfae',
2524    'violin':'\ud83c\udfbb',
2525    'virgo':'\u264d\ufe0f',
2526    'volcano':'\ud83c\udf0b',
2527    'volleyball':'\ud83c\udfd0',
2528    'vs':'\ud83c\udd9a',
2529    'vulcan_salute':'\ud83d\udd96',
2530    'walking_man':'\ud83d\udeb6',
2531    'walking_woman':'\ud83d\udeb6&zwj;\u2640\ufe0f',
2532    'waning_crescent_moon':'\ud83c\udf18',
2533    'waning_gibbous_moon':'\ud83c\udf16',
2534    'warning':'\u26a0\ufe0f',
2535    'wastebasket':'\ud83d\uddd1',
2536    'watch':'\u231a\ufe0f',
2537    'water_buffalo':'\ud83d\udc03',
2538    'watermelon':'\ud83c\udf49',
2539    'wave':'\ud83d\udc4b',
2540    'wavy_dash':'\u3030\ufe0f',
2541    'waxing_crescent_moon':'\ud83c\udf12',
2542    'wc':'\ud83d\udebe',
2543    'weary':'\ud83d\ude29',
2544    'wedding':'\ud83d\udc92',
2545    'weight_lifting_man':'\ud83c\udfcb\ufe0f',
2546    'weight_lifting_woman':'\ud83c\udfcb\ufe0f&zwj;\u2640\ufe0f',
2547    'whale':'\ud83d\udc33',
2548    'whale2':'\ud83d\udc0b',
2549    'wheel_of_dharma':'\u2638\ufe0f',
2550    'wheelchair':'\u267f\ufe0f',
2551    'white_check_mark':'\u2705',
2552    'white_circle':'\u26aa\ufe0f',
2553    'white_flag':'\ud83c\udff3\ufe0f',
2554    'white_flower':'\ud83d\udcae',
2555    'white_large_square':'\u2b1c\ufe0f',
2556    'white_medium_small_square':'\u25fd\ufe0f',
2557    'white_medium_square':'\u25fb\ufe0f',
2558    'white_small_square':'\u25ab\ufe0f',
2559    'white_square_button':'\ud83d\udd33',
2560    'wilted_flower':'\ud83e\udd40',
2561    'wind_chime':'\ud83c\udf90',
2562    'wind_face':'\ud83c\udf2c',
2563    'wine_glass':'\ud83c\udf77',
2564    'wink':'\ud83d\ude09',
2565    'wolf':'\ud83d\udc3a',
2566    'woman':'\ud83d\udc69',
2567    'woman_artist':'\ud83d\udc69&zwj;\ud83c\udfa8',
2568    'woman_astronaut':'\ud83d\udc69&zwj;\ud83d\ude80',
2569    'woman_cartwheeling':'\ud83e\udd38&zwj;\u2640\ufe0f',
2570    'woman_cook':'\ud83d\udc69&zwj;\ud83c\udf73',
2571    'woman_facepalming':'\ud83e\udd26&zwj;\u2640\ufe0f',
2572    'woman_factory_worker':'\ud83d\udc69&zwj;\ud83c\udfed',
2573    'woman_farmer':'\ud83d\udc69&zwj;\ud83c\udf3e',
2574    'woman_firefighter':'\ud83d\udc69&zwj;\ud83d\ude92',
2575    'woman_health_worker':'\ud83d\udc69&zwj;\u2695\ufe0f',
2576    'woman_judge':'\ud83d\udc69&zwj;\u2696\ufe0f',
2577    'woman_juggling':'\ud83e\udd39&zwj;\u2640\ufe0f',
2578    'woman_mechanic':'\ud83d\udc69&zwj;\ud83d\udd27',
2579    'woman_office_worker':'\ud83d\udc69&zwj;\ud83d\udcbc',
2580    'woman_pilot':'\ud83d\udc69&zwj;\u2708\ufe0f',
2581    'woman_playing_handball':'\ud83e\udd3e&zwj;\u2640\ufe0f',
2582    'woman_playing_water_polo':'\ud83e\udd3d&zwj;\u2640\ufe0f',
2583    'woman_scientist':'\ud83d\udc69&zwj;\ud83d\udd2c',
2584    'woman_shrugging':'\ud83e\udd37&zwj;\u2640\ufe0f',
2585    'woman_singer':'\ud83d\udc69&zwj;\ud83c\udfa4',
2586    'woman_student':'\ud83d\udc69&zwj;\ud83c\udf93',
2587    'woman_teacher':'\ud83d\udc69&zwj;\ud83c\udfeb',
2588    'woman_technologist':'\ud83d\udc69&zwj;\ud83d\udcbb',
2589    'woman_with_turban':'\ud83d\udc73&zwj;\u2640\ufe0f',
2590    'womans_clothes':'\ud83d\udc5a',
2591    'womans_hat':'\ud83d\udc52',
2592    'women_wrestling':'\ud83e\udd3c&zwj;\u2640\ufe0f',
2593    'womens':'\ud83d\udeba',
2594    'world_map':'\ud83d\uddfa',
2595    'worried':'\ud83d\ude1f',
2596    'wrench':'\ud83d\udd27',
2597    'writing_hand':'\u270d\ufe0f',
2598    'x':'\u274c',
2599    'yellow_heart':'\ud83d\udc9b',
2600    'yen':'\ud83d\udcb4',
2601    'yin_yang':'\u262f\ufe0f',
2602    'yum':'\ud83d\ude0b',
2603    'zap':'\u26a1\ufe0f',
2604    'zipper_mouth_face':'\ud83e\udd10',
2605    'zzz':'\ud83d\udca4',
2606  
2607    /* special emojis :P */
2608    'octocat':  '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
2609    'showdown': '<span style="font-family: \'Anonymous Pro\', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>'
2610  };
2611  
2612  /**
2613   * Created by Estevao on 31-05-2015.
2614   */
2615  
2616  /**
2617   * Showdown Converter class
2618   * @class
2619   * @param {object} [converterOptions]
2620   * @returns {Converter}
2621   */
2622  showdown.Converter = function (converterOptions) {
2623    'use strict';
2624  
2625    var
2626        /**
2627         * Options used by this converter
2628         * @private
2629         * @type {{}}
2630         */
2631        options = {},
2632  
2633        /**
2634         * Language extensions used by this converter
2635         * @private
2636         * @type {Array}
2637         */
2638        langExtensions = [],
2639  
2640        /**
2641         * Output modifiers extensions used by this converter
2642         * @private
2643         * @type {Array}
2644         */
2645        outputModifiers = [],
2646  
2647        /**
2648         * Event listeners
2649         * @private
2650         * @type {{}}
2651         */
2652        listeners = {},
2653  
2654        /**
2655         * The flavor set in this converter
2656         */
2657        setConvFlavor = setFlavor,
2658  
2659        /**
2660         * Metadata of the document
2661         * @type {{parsed: {}, raw: string, format: string}}
2662         */
2663        metadata = {
2664          parsed: {},
2665          raw: '',
2666          format: ''
2667        };
2668  
2669    _constructor();
2670  
2671    /**
2672     * Converter constructor
2673     * @private
2674     */
2675    function _constructor () {
2676      converterOptions = converterOptions || {};
2677  
2678      for (var gOpt in globalOptions) {
2679        if (globalOptions.hasOwnProperty(gOpt)) {
2680          options[gOpt] = globalOptions[gOpt];
2681        }
2682      }
2683  
2684      // Merge options
2685      if (typeof converterOptions === 'object') {
2686        for (var opt in converterOptions) {
2687          if (converterOptions.hasOwnProperty(opt)) {
2688            options[opt] = converterOptions[opt];
2689          }
2690        }
2691      } else {
2692        throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
2693        ' was passed instead.');
2694      }
2695  
2696      if (options.extensions) {
2697        showdown.helper.forEach(options.extensions, _parseExtension);
2698      }
2699    }
2700  
2701    /**
2702     * Parse extension
2703     * @param {*} ext
2704     * @param {string} [name='']
2705     * @private
2706     */
2707    function _parseExtension (ext, name) {
2708  
2709      name = name || null;
2710      // If it's a string, the extension was previously loaded
2711      if (showdown.helper.isString(ext)) {
2712        ext = showdown.helper.stdExtName(ext);
2713        name = ext;
2714  
2715        // LEGACY_SUPPORT CODE
2716        if (showdown.extensions[ext]) {
2717          console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
2718            'Please inform the developer that the extension should be updated!');
2719          legacyExtensionLoading(showdown.extensions[ext], ext);
2720          return;
2721          // END LEGACY SUPPORT CODE
2722  
2723        } else if (!showdown.helper.isUndefined(extensions[ext])) {
2724          ext = extensions[ext];
2725  
2726        } else {
2727          throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
2728        }
2729      }
2730  
2731      if (typeof ext === 'function') {
2732        ext = ext();
2733      }
2734  
2735      if (!showdown.helper.isArray(ext)) {
2736        ext = [ext];
2737      }
2738  
2739      var validExt = validate(ext, name);
2740      if (!validExt.valid) {
2741        throw Error(validExt.error);
2742      }
2743  
2744      for (var i = 0; i < ext.length; ++i) {
2745        switch (ext[i].type) {
2746  
2747          case 'lang':
2748            langExtensions.push(ext[i]);
2749            break;
2750  
2751          case 'output':
2752            outputModifiers.push(ext[i]);
2753            break;
2754        }
2755        if (ext[i].hasOwnProperty('listeners')) {
2756          for (var ln in ext[i].listeners) {
2757            if (ext[i].listeners.hasOwnProperty(ln)) {
2758              listen(ln, ext[i].listeners[ln]);
2759            }
2760          }
2761        }
2762      }
2763  
2764    }
2765  
2766    /**
2767     * LEGACY_SUPPORT
2768     * @param {*} ext
2769     * @param {string} name
2770     */
2771    function legacyExtensionLoading (ext, name) {
2772      if (typeof ext === 'function') {
2773        ext = ext(new showdown.Converter());
2774      }
2775      if (!showdown.helper.isArray(ext)) {
2776        ext = [ext];
2777      }
2778      var valid = validate(ext, name);
2779  
2780      if (!valid.valid) {
2781        throw Error(valid.error);
2782      }
2783  
2784      for (var i = 0; i < ext.length; ++i) {
2785        switch (ext[i].type) {
2786          case 'lang':
2787            langExtensions.push(ext[i]);
2788            break;
2789          case 'output':
2790            outputModifiers.push(ext[i]);
2791            break;
2792          default:// should never reach here
2793            throw Error('Extension loader error: Type unrecognized!!!');
2794        }
2795      }
2796    }
2797  
2798    /**
2799     * Listen to an event
2800     * @param {string} name
2801     * @param {function} callback
2802     */
2803    function listen (name, callback) {
2804      if (!showdown.helper.isString(name)) {
2805        throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
2806      }
2807  
2808      if (typeof callback !== 'function') {
2809        throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
2810      }
2811  
2812      if (!listeners.hasOwnProperty(name)) {
2813        listeners[name] = [];
2814      }
2815      listeners[name].push(callback);
2816    }
2817  
2818    function rTrimInputText (text) {
2819      var rsp = text.match(/^\s*/)[0].length,
2820          rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
2821      return text.replace(rgx, '');
2822    }
2823  
2824    /**
2825     * Dispatch an event
2826     * @private
2827     * @param {string} evtName Event name
2828     * @param {string} text Text
2829     * @param {{}} options Converter Options
2830     * @param {{}} globals
2831     * @returns {string}
2832     */
2833    this._dispatch = function dispatch (evtName, text, options, globals) {
2834      if (listeners.hasOwnProperty(evtName)) {
2835        for (var ei = 0; ei < listeners[evtName].length; ++ei) {
2836          var nText = listeners[evtName][ei](evtName, text, this, options, globals);
2837          if (nText && typeof nText !== 'undefined') {
2838            text = nText;
2839          }
2840        }
2841      }
2842      return text;
2843    };
2844  
2845    /**
2846     * Listen to an event
2847     * @param {string} name
2848     * @param {function} callback
2849     * @returns {showdown.Converter}
2850     */
2851    this.listen = function (name, callback) {
2852      listen(name, callback);
2853      return this;
2854    };
2855  
2856    /**
2857     * Converts a markdown string into HTML
2858     * @param {string} text
2859     * @returns {*}
2860     */
2861    this.makeHtml = function (text) {
2862      //check if text is not falsy
2863      if (!text) {
2864        return text;
2865      }
2866  
2867      var globals = {
2868        gHtmlBlocks:     [],
2869        gHtmlMdBlocks:   [],
2870        gHtmlSpans:      [],
2871        gUrls:           {},
2872        gTitles:         {},
2873        gDimensions:     {},
2874        gListLevel:      0,
2875        hashLinkCounts:  {},
2876        langExtensions:  langExtensions,
2877        outputModifiers: outputModifiers,
2878        converter:       this,
2879        ghCodeBlocks:    [],
2880        metadata: {
2881          parsed: {},
2882          raw: '',
2883          format: ''
2884        }
2885      };
2886  
2887      // This lets us use ¨ trema as an escape char to avoid md5 hashes
2888      // The choice of character is arbitrary; anything that isn't
2889      // magic in Markdown will work.
2890      text = text.replace(/¨/g, '¨T');
2891  
2892      // Replace $ with ¨D
2893      // RegExp interprets $ as a special character
2894      // when it's in a replacement string
2895      text = text.replace(/\$/g, '¨D');
2896  
2897      // Standardize line endings
2898      text = text.replace(/\r\n/g, '\n'); // DOS to Unix
2899      text = text.replace(/\r/g, '\n'); // Mac to Unix
2900  
2901      // Stardardize line spaces
2902      text = text.replace(/\u00A0/g, '&nbsp;');
2903  
2904      if (options.smartIndentationFix) {
2905        text = rTrimInputText(text);
2906      }
2907  
2908      // Make sure text begins and ends with a couple of newlines:
2909      text = '\n\n' + text + '\n\n';
2910  
2911      // detab
2912      text = showdown.subParser('detab')(text, options, globals);
2913  
2914      /**
2915       * Strip any lines consisting only of spaces and tabs.
2916       * This makes subsequent regexs easier to write, because we can
2917       * match consecutive blank lines with /\n+/ instead of something
2918       * contorted like /[ \t]*\n+/
2919       */
2920      text = text.replace(/^[ \t]+$/mg, '');
2921  
2922      //run languageExtensions
2923      showdown.helper.forEach(langExtensions, function (ext) {
2924        text = showdown.subParser('runExtension')(ext, text, options, globals);
2925      });
2926  
2927      // run the sub parsers
2928      text = showdown.subParser('metadata')(text, options, globals);
2929      text = showdown.subParser('hashPreCodeTags')(text, options, globals);
2930      text = showdown.subParser('githubCodeBlocks')(text, options, globals);
2931      text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
2932      text = showdown.subParser('hashCodeTags')(text, options, globals);
2933      text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
2934      text = showdown.subParser('blockGamut')(text, options, globals);
2935      text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
2936      text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
2937  
2938      // attacklab: Restore dollar signs
2939      text = text.replace(/¨D/g, '$$');
2940  
2941      // attacklab: Restore tremas
2942      text = text.replace(/¨T/g, '¨');
2943  
2944      // render a complete html document instead of a partial if the option is enabled
2945      text = showdown.subParser('completeHTMLDocument')(text, options, globals);
2946  
2947      // Run output modifiers
2948      showdown.helper.forEach(outputModifiers, function (ext) {
2949        text = showdown.subParser('runExtension')(ext, text, options, globals);
2950      });
2951  
2952      // update metadata
2953      metadata = globals.metadata;
2954      return text;
2955    };
2956  
2957    /**
2958     * Converts an HTML string into a markdown string
2959     * @param src
2960     * @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
2961     * @returns {string}
2962     */
2963    this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
2964  
2965      // replace \r\n with \n
2966      src = src.replace(/\r\n/g, '\n');
2967      src = src.replace(/\r/g, '\n'); // old macs
2968  
2969      // due to an edge case, we need to find this: > <
2970      // to prevent removing of non silent white spaces
2971      // ex: <em>this is</em> <strong>sparta</strong>
2972      src = src.replace(/>[ \t]+</, '>¨NBSP;<');
2973  
2974      if (!HTMLParser) {
2975        if (window && window.document) {
2976          HTMLParser = window.document;
2977        } else {
2978          throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM');
2979        }
2980      }
2981  
2982      var doc = HTMLParser.createElement('div');
2983      doc.innerHTML = src;
2984  
2985      var globals = {
2986        preList: substitutePreCodeTags(doc)
2987      };
2988  
2989      // remove all newlines and collapse spaces
2990      clean(doc);
2991  
2992      // some stuff, like accidental reference links must now be escaped
2993      // TODO
2994      // doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
2995  
2996      var nodes = doc.childNodes,
2997          mdDoc = '';
2998  
2999      for (var i = 0; i < nodes.length; i++) {
3000        mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
3001      }
3002  
3003      function clean (node) {
3004        for (var n = 0; n < node.childNodes.length; ++n) {
3005          var child = node.childNodes[n];
3006          if (child.nodeType === 3) {
3007            if (!/\S/.test(child.nodeValue)) {
3008              node.removeChild(child);
3009              --n;
3010            } else {
3011              child.nodeValue = child.nodeValue.split('\n').join(' ');
3012              child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
3013            }
3014          } else if (child.nodeType === 1) {
3015            clean(child);
3016          }
3017        }
3018      }
3019  
3020      // find all pre tags and replace contents with placeholder
3021      // we need this so that we can remove all indentation from html
3022      // to ease up parsing
3023      function substitutePreCodeTags (doc) {
3024  
3025        var pres = doc.querySelectorAll('pre'),
3026            presPH = [];
3027  
3028        for (var i = 0; i < pres.length; ++i) {
3029  
3030          if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
3031            var content = pres[i].firstChild.innerHTML.trim(),
3032                language = pres[i].firstChild.getAttribute('data-language') || '';
3033  
3034            // if data-language attribute is not defined, then we look for class language-*
3035            if (language === '') {
3036              var classes = pres[i].firstChild.className.split(' ');
3037              for (var c = 0; c < classes.length; ++c) {
3038                var matches = classes[c].match(/^language-(.+)$/);
3039                if (matches !== null) {
3040                  language = matches[1];
3041                  break;
3042                }
3043              }
3044            }
3045  
3046            // unescape html entities in content
3047            content = showdown.helper.unescapeHTMLEntities(content);
3048  
3049            presPH.push(content);
3050            pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
3051          } else {
3052            presPH.push(pres[i].innerHTML);
3053            pres[i].innerHTML = '';
3054            pres[i].setAttribute('prenum', i.toString());
3055          }
3056        }
3057        return presPH;
3058      }
3059  
3060      return mdDoc;
3061    };
3062  
3063    /**
3064     * Set an option of this Converter instance
3065     * @param {string} key
3066     * @param {*} value
3067     */
3068    this.setOption = function (key, value) {
3069      options[key] = value;
3070    };
3071  
3072    /**
3073     * Get the option of this Converter instance
3074     * @param {string} key
3075     * @returns {*}
3076     */
3077    this.getOption = function (key) {
3078      return options[key];
3079    };
3080  
3081    /**
3082     * Get the options of this Converter instance
3083     * @returns {{}}
3084     */
3085    this.getOptions = function () {
3086      return options;
3087    };
3088  
3089    /**
3090     * Add extension to THIS converter
3091     * @param {{}} extension
3092     * @param {string} [name=null]
3093     */
3094    this.addExtension = function (extension, name) {
3095      name = name || null;
3096      _parseExtension(extension, name);
3097    };
3098  
3099    /**
3100     * Use a global registered extension with THIS converter
3101     * @param {string} extensionName Name of the previously registered extension
3102     */
3103    this.useExtension = function (extensionName) {
3104      _parseExtension(extensionName);
3105    };
3106  
3107    /**
3108     * Set the flavor THIS converter should use
3109     * @param {string} name
3110     */
3111    this.setFlavor = function (name) {
3112      if (!flavor.hasOwnProperty(name)) {
3113        throw Error(name + ' flavor was not found');
3114      }
3115      var preset = flavor[name];
3116      setConvFlavor = name;
3117      for (var option in preset) {
3118        if (preset.hasOwnProperty(option)) {
3119          options[option] = preset[option];
3120        }
3121      }
3122    };
3123  
3124    /**
3125     * Get the currently set flavor of this converter
3126     * @returns {string}
3127     */
3128    this.getFlavor = function () {
3129      return setConvFlavor;
3130    };
3131  
3132    /**
3133     * Remove an extension from THIS converter.
3134     * Note: This is a costly operation. It's better to initialize a new converter
3135     * and specify the extensions you wish to use
3136     * @param {Array} extension
3137     */
3138    this.removeExtension = function (extension) {
3139      if (!showdown.helper.isArray(extension)) {
3140        extension = [extension];
3141      }
3142      for (var a = 0; a < extension.length; ++a) {
3143        var ext = extension[a];
3144        for (var i = 0; i < langExtensions.length; ++i) {
3145          if (langExtensions[i] === ext) {
3146            langExtensions[i].splice(i, 1);
3147          }
3148        }
3149        for (var ii = 0; ii < outputModifiers.length; ++i) {
3150          if (outputModifiers[ii] === ext) {
3151            outputModifiers[ii].splice(i, 1);
3152          }
3153        }
3154      }
3155    };
3156  
3157    /**
3158     * Get all extension of THIS converter
3159     * @returns {{language: Array, output: Array}}
3160     */
3161    this.getAllExtensions = function () {
3162      return {
3163        language: langExtensions,
3164        output: outputModifiers
3165      };
3166    };
3167  
3168    /**
3169     * Get the metadata of the previously parsed document
3170     * @param raw
3171     * @returns {string|{}}
3172     */
3173    this.getMetadata = function (raw) {
3174      if (raw) {
3175        return metadata.raw;
3176      } else {
3177        return metadata.parsed;
3178      }
3179    };
3180  
3181    /**
3182     * Get the metadata format of the previously parsed document
3183     * @returns {string}
3184     */
3185    this.getMetadataFormat = function () {
3186      return metadata.format;
3187    };
3188  
3189    /**
3190     * Private: set a single key, value metadata pair
3191     * @param {string} key
3192     * @param {string} value
3193     */
3194    this._setMetadataPair = function (key, value) {
3195      metadata.parsed[key] = value;
3196    };
3197  
3198    /**
3199     * Private: set metadata format
3200     * @param {string} format
3201     */
3202    this._setMetadataFormat = function (format) {
3203      metadata.format = format;
3204    };
3205  
3206    /**
3207     * Private: set metadata raw text
3208     * @param {string} raw
3209     */
3210    this._setMetadataRaw = function (raw) {
3211      metadata.raw = raw;
3212    };
3213  };
3214  
3215  /**
3216   * Turn Markdown link shortcuts into XHTML <a> tags.
3217   */
3218  showdown.subParser('anchors', function (text, options, globals) {
3219    'use strict';
3220  
3221    text = globals.converter._dispatch('anchors.before', text, options, globals);
3222  
3223    var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
3224      if (showdown.helper.isUndefined(title)) {
3225        title = '';
3226      }
3227      linkId = linkId.toLowerCase();
3228  
3229      // Special case for explicit empty url
3230      if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
3231        url = '';
3232      } else if (!url) {
3233        if (!linkId) {
3234          // lower-case and turn embedded newlines into spaces
3235          linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
3236        }
3237        url = '#' + linkId;
3238  
3239        if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
3240          url = globals.gUrls[linkId];
3241          if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
3242            title = globals.gTitles[linkId];
3243          }
3244        } else {
3245          return wholeMatch;
3246        }
3247      }
3248  
3249      //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
3250      url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
3251  
3252      var result = '<a href="' + url + '"';
3253  
3254      if (title !== '' && title !== null) {
3255        title = title.replace(/"/g, '&quot;');
3256        //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
3257        title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
3258        result += ' title="' + title + '"';
3259      }
3260  
3261      // optionLinksInNewWindow only applies
3262      // to external links. Hash links (#) open in same page
3263      if (options.openLinksInNewWindow && !/^#/.test(url)) {
3264        // escaped _
3265        result += ' rel="noopener noreferrer" target="¨E95Eblank"';
3266      }
3267  
3268      result += '>' + linkText + '</a>';
3269  
3270      return result;
3271    };
3272  
3273    // First, handle reference-style links: [link text] [id]
3274    text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
3275  
3276    // Next, inline-style links: [link text](url "optional title")
3277    // cases with crazy urls like ./image/cat1).png
3278    text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
3279      writeAnchorTag);
3280  
3281    // normal cases
3282    text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
3283      writeAnchorTag);
3284  
3285    // handle reference-style shortcuts: [link text]
3286    // These must come last in case you've also got [link test][1]
3287    // or [link test](/foo)
3288    text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
3289  
3290    // Lastly handle GithubMentions if option is enabled
3291    if (options.ghMentions) {
3292      text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
3293        if (escape === '\\') {
3294          return st + mentions;
3295        }
3296  
3297        //check if options.ghMentionsLink is a string
3298        if (!showdown.helper.isString(options.ghMentionsLink)) {
3299          throw new Error('ghMentionsLink option must be a string');
3300        }
3301        var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
3302            target = '';
3303        if (options.openLinksInNewWindow) {
3304          target = ' rel="noopener noreferrer" target="¨E95Eblank"';
3305        }
3306        return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
3307      });
3308    }
3309  
3310    text = globals.converter._dispatch('anchors.after', text, options, globals);
3311    return text;
3312  });
3313  
3314  // url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
3315  
3316  var simpleURLRegex  = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
3317      simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
3318      delimUrlRegex   = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
3319      simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
3320      delimMailRegex  = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
3321  
3322      replaceLink = function (options) {
3323        'use strict';
3324        return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
3325          link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
3326          var lnkTxt = link,
3327              append = '',
3328              target = '',
3329              lmc    = leadingMagicChars || '',
3330              tmc    = trailingMagicChars || '';
3331          if (/^www\./i.test(link)) {
3332            link = link.replace(/^www\./i, 'http://www.');
3333          }
3334          if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
3335            append = trailingPunctuation;
3336          }
3337          if (options.openLinksInNewWindow) {
3338            target = ' rel="noopener noreferrer" target="¨E95Eblank"';
3339          }
3340          return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
3341        };
3342      },
3343  
3344      replaceMail = function (options, globals) {
3345        'use strict';
3346        return function (wholeMatch, b, mail) {
3347          var href = 'mailto:';
3348          b = b || '';
3349          mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
3350          if (options.encodeEmails) {
3351            href = showdown.helper.encodeEmailAddress(href + mail);
3352            mail = showdown.helper.encodeEmailAddress(mail);
3353          } else {
3354            href = href + mail;
3355          }
3356          return b + '<a href="' + href + '">' + mail + '</a>';
3357        };
3358      };
3359  
3360  showdown.subParser('autoLinks', function (text, options, globals) {
3361    'use strict';
3362  
3363    text = globals.converter._dispatch('autoLinks.before', text, options, globals);
3364  
3365    text = text.replace(delimUrlRegex, replaceLink(options));
3366    text = text.replace(delimMailRegex, replaceMail(options, globals));
3367  
3368    text = globals.converter._dispatch('autoLinks.after', text, options, globals);
3369  
3370    return text;
3371  });
3372  
3373  showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
3374    'use strict';
3375  
3376    if (!options.simplifiedAutoLink) {
3377      return text;
3378    }
3379  
3380    text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
3381  
3382    if (options.excludeTrailingPunctuationFromURLs) {
3383      text = text.replace(simpleURLRegex2, replaceLink(options));
3384    } else {
3385      text = text.replace(simpleURLRegex, replaceLink(options));
3386    }
3387    text = text.replace(simpleMailRegex, replaceMail(options, globals));
3388  
3389    text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
3390  
3391    return text;
3392  });
3393  
3394  /**
3395   * These are all the transformations that form block-level
3396   * tags like paragraphs, headers, and list items.
3397   */
3398  showdown.subParser('blockGamut', function (text, options, globals) {
3399    'use strict';
3400  
3401    text = globals.converter._dispatch('blockGamut.before', text, options, globals);
3402  
3403    // we parse blockquotes first so that we can have headings and hrs
3404    // inside blockquotes
3405    text = showdown.subParser('blockQuotes')(text, options, globals);
3406    text = showdown.subParser('headers')(text, options, globals);
3407  
3408    // Do Horizontal Rules:
3409    text = showdown.subParser('horizontalRule')(text, options, globals);
3410  
3411    text = showdown.subParser('lists')(text, options, globals);
3412    text = showdown.subParser('codeBlocks')(text, options, globals);
3413    text = showdown.subParser('tables')(text, options, globals);
3414  
3415    // We already ran _HashHTMLBlocks() before, in Markdown(), but that
3416    // was to escape raw HTML in the original Markdown source. This time,
3417    // we're escaping the markup we've just created, so that we don't wrap
3418    // <p> tags around block-level tags.
3419    text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
3420    text = showdown.subParser('paragraphs')(text, options, globals);
3421  
3422    text = globals.converter._dispatch('blockGamut.after', text, options, globals);
3423  
3424    return text;
3425  });
3426  
3427  showdown.subParser('blockQuotes', function (text, options, globals) {
3428    'use strict';
3429  
3430    text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
3431  
3432    // add a couple extra lines after the text and endtext mark
3433    text = text + '\n\n';
3434  
3435    var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
3436  
3437    if (options.splitAdjacentBlockquotes) {
3438      rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
3439    }
3440  
3441    text = text.replace(rgx, function (bq) {
3442      // attacklab: hack around Konqueror 3.5.4 bug:
3443      // "----------bug".replace(/^-/g,"") == "bug"
3444      bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
3445  
3446      // attacklab: clean up hack
3447      bq = bq.replace(/¨0/g, '');
3448  
3449      bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
3450      bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
3451      bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
3452  
3453      bq = bq.replace(/(^|\n)/g, '$1  ');
3454      // These leading spaces screw with <pre> content, so we need to fix that:
3455      bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
3456        var pre = m1;
3457        // attacklab: hack around Konqueror 3.5.4 bug:
3458        pre = pre.replace(/^  /mg, '¨0');
3459        pre = pre.replace(/¨0/g, '');
3460        return pre;
3461      });
3462  
3463      return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
3464    });
3465  
3466    text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
3467    return text;
3468  });
3469  
3470  /**
3471   * Process Markdown `<pre><code>` blocks.
3472   */
3473  showdown.subParser('codeBlocks', function (text, options, globals) {
3474    'use strict';
3475  
3476    text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
3477  
3478    // sentinel workarounds for lack of \A and \Z, safari\khtml bug
3479    text += '¨0';
3480  
3481    var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
3482    text = text.replace(pattern, function (wholeMatch, m1, m2) {
3483      var codeblock = m1,
3484          nextChar = m2,
3485          end = '\n';
3486  
3487      codeblock = showdown.subParser('outdent')(codeblock, options, globals);
3488      codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
3489      codeblock = showdown.subParser('detab')(codeblock, options, globals);
3490      codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
3491      codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
3492  
3493      if (options.omitExtraWLInCodeBlocks) {
3494        end = '';
3495      }
3496  
3497      codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
3498  
3499      return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
3500    });
3501  
3502    // strip sentinel
3503    text = text.replace(/¨0/, '');
3504  
3505    text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
3506    return text;
3507  });
3508  
3509  /**
3510   *
3511   *   *  Backtick quotes are used for <code></code> spans.
3512   *
3513   *   *  You can use multiple backticks as the delimiters if you want to
3514   *     include literal backticks in the code span. So, this input:
3515   *
3516   *         Just type ``foo `bar` baz`` at the prompt.
3517   *
3518   *       Will translate to:
3519   *
3520   *         <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
3521   *
3522   *    There's no arbitrary limit to the number of backticks you
3523   *    can use as delimters. If you need three consecutive backticks
3524   *    in your code, use four for delimiters, etc.
3525   *
3526   *  *  You can use spaces to get literal backticks at the edges:
3527   *
3528   *         ... type `` `bar` `` ...
3529   *
3530   *       Turns to:
3531   *
3532   *         ... type <code>`bar`</code> ...
3533   */
3534  showdown.subParser('codeSpans', function (text, options, globals) {
3535    'use strict';
3536  
3537    text = globals.converter._dispatch('codeSpans.before', text, options, globals);
3538  
3539    if (typeof text === 'undefined') {
3540      text = '';
3541    }
3542    text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
3543      function (wholeMatch, m1, m2, m3) {
3544        var c = m3;
3545        c = c.replace(/^([ \t]*)/g, '');    // leading whitespace
3546        c = c.replace(/[ \t]*$/g, '');    // trailing whitespace
3547        c = showdown.subParser('encodeCode')(c, options, globals);
3548        c = m1 + '<code>' + c + '</code>';
3549        c = showdown.subParser('hashHTMLSpans')(c, options, globals);
3550        return c;
3551      }
3552    );
3553  
3554    text = globals.converter._dispatch('codeSpans.after', text, options, globals);
3555    return text;
3556  });
3557  
3558  /**
3559   * Create a full HTML document from the processed markdown
3560   */
3561  showdown.subParser('completeHTMLDocument', function (text, options, globals) {
3562    'use strict';
3563  
3564    if (!options.completeHTMLDocument) {
3565      return text;
3566    }
3567  
3568    text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals);
3569  
3570    var doctype = 'html',
3571        doctypeParsed = '<!DOCTYPE HTML>\n',
3572        title = '',
3573        charset = '<meta charset="utf-8">\n',
3574        lang = '',
3575        metadata = '';
3576  
3577    if (typeof globals.metadata.parsed.doctype !== 'undefined') {
3578      doctypeParsed = '<!DOCTYPE ' +  globals.metadata.parsed.doctype + '>\n';
3579      doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
3580      if (doctype === 'html' || doctype === 'html5') {
3581        charset = '<meta charset="utf-8">';
3582      }
3583    }
3584  
3585    for (var meta in globals.metadata.parsed) {
3586      if (globals.metadata.parsed.hasOwnProperty(meta)) {
3587        switch (meta.toLowerCase()) {
3588          case 'doctype':
3589            break;
3590  
3591          case 'title':
3592            title = '<title>' +  globals.metadata.parsed.title + '</title>\n';
3593            break;
3594  
3595          case 'charset':
3596            if (doctype === 'html' || doctype === 'html5') {
3597              charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
3598            } else {
3599              charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
3600            }
3601            break;
3602  
3603          case 'language':
3604          case 'lang':
3605            lang = ' lang="' + globals.metadata.parsed[meta] + '"';
3606            metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3607            break;
3608  
3609          default:
3610            metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3611        }
3612      }
3613    }
3614  
3615    text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
3616  
3617    text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals);
3618    return text;
3619  });
3620  
3621  /**
3622   * Convert all tabs to spaces
3623   */
3624  showdown.subParser('detab', function (text, options, globals) {
3625    'use strict';
3626    text = globals.converter._dispatch('detab.before', text, options, globals);
3627  
3628    // expand first n-1 tabs
3629    text = text.replace(/\t(?=\t)/g, '    '); // g_tab_width
3630  
3631    // replace the nth with two sentinels
3632    text = text.replace(/\t/g, '¨A¨B');
3633  
3634    // use the sentinel to anchor our regex so it doesn't explode
3635    text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
3636      var leadingText = m1,
3637          numSpaces = 4 - leadingText.length % 4;  // g_tab_width
3638  
3639      // there *must* be a better way to do this:
3640      for (var i = 0; i < numSpaces; i++) {
3641        leadingText += ' ';
3642      }
3643  
3644      return leadingText;
3645    });
3646  
3647    // clean up sentinels
3648    text = text.replace(/¨A/g, '    ');  // g_tab_width
3649    text = text.replace(/¨B/g, '');
3650  
3651    text = globals.converter._dispatch('detab.after', text, options, globals);
3652    return text;
3653  });
3654  
3655  showdown.subParser('ellipsis', function (text, options, globals) {
3656    'use strict';
3657  
3658    text = globals.converter._dispatch('ellipsis.before', text, options, globals);
3659  
3660    text = text.replace(/\.\.\./g, '…');
3661  
3662    text = globals.converter._dispatch('ellipsis.after', text, options, globals);
3663  
3664    return text;
3665  });
3666  
3667  /**
3668   * Turn emoji codes into emojis
3669   *
3670   * List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
3671   */
3672  showdown.subParser('emoji', function (text, options, globals) {
3673    'use strict';
3674  
3675    if (!options.emoji) {
3676      return text;
3677    }
3678  
3679    text = globals.converter._dispatch('emoji.before', text, options, globals);
3680  
3681    var emojiRgx = /:([\S]+?):/g;
3682  
3683    text = text.replace(emojiRgx, function (wm, emojiCode) {
3684      if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
3685        return showdown.helper.emojis[emojiCode];
3686      }
3687      return wm;
3688    });
3689  
3690    text = globals.converter._dispatch('emoji.after', text, options, globals);
3691  
3692    return text;
3693  });
3694  
3695  /**
3696   * Smart processing for ampersands and angle brackets that need to be encoded.
3697   */
3698  showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
3699    'use strict';
3700    text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals);
3701  
3702    // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
3703    // http://bumppo.net/projects/amputator/
3704    text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&amp;');
3705  
3706    // Encode naked <'s
3707    text = text.replace(/<(?![a-z\/?$!])/gi, '&lt;');
3708  
3709    // Encode <
3710    text = text.replace(/</g, '&lt;');
3711  
3712    // Encode >
3713    text = text.replace(/>/g, '&gt;');
3714  
3715    text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
3716    return text;
3717  });
3718  
3719  /**
3720   * Returns the string, with after processing the following backslash escape sequences.
3721   *
3722   * attacklab: The polite way to do this is with the new escapeCharacters() function:
3723   *
3724   *    text = escapeCharacters(text,"\\",true);
3725   *    text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
3726   *
3727   * ...but we're sidestepping its use of the (slow) RegExp constructor
3728   * as an optimization for Firefox.  This function gets called a LOT.
3729   */
3730  showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
3731    'use strict';
3732    text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
3733  
3734    text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
3735    text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
3736  
3737    text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
3738    return text;
3739  });
3740  
3741  /**
3742   * Encode/escape certain characters inside Markdown code runs.
3743   * The point is that in code, these characters are literals,
3744   * and lose their special Markdown meanings.
3745   */
3746  showdown.subParser('encodeCode', function (text, options, globals) {
3747    'use strict';
3748  
3749    text = globals.converter._dispatch('encodeCode.before', text, options, globals);
3750  
3751    // Encode all ampersands; HTML entities are not
3752    // entities within a Markdown code span.
3753    text = text
3754      .replace(/&/g, '&amp;')
3755    // Do the angle bracket song and dance:
3756      .replace(/</g, '&lt;')
3757      .replace(/>/g, '&gt;')
3758    // Now, escape characters that are magic in Markdown:
3759      .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
3760  
3761    text = globals.converter._dispatch('encodeCode.after', text, options, globals);
3762    return text;
3763  });
3764  
3765  /**
3766   * Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
3767   * don't conflict with their use in Markdown for code, italics and strong.
3768   */
3769  showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
3770    'use strict';
3771    text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
3772  
3773    // Build a regex to find HTML tags.
3774    var tags     = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
3775        comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
3776  
3777    text = text.replace(tags, function (wholeMatch) {
3778      return wholeMatch
3779        .replace(/(.)<\/?code>(?=.)/g, '$1`')
3780        .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
3781    });
3782  
3783    text = text.replace(comments, function (wholeMatch) {
3784      return wholeMatch
3785        .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
3786    });
3787  
3788    text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
3789    return text;
3790  });
3791  
3792  /**
3793   * Handle github codeblocks prior to running HashHTML so that
3794   * HTML contained within the codeblock gets escaped properly
3795   * Example:
3796   * ```ruby
3797   *     def hello_world(x)
3798   *       puts "Hello, #{x}"
3799   *     end
3800   * ```
3801   */
3802  showdown.subParser('githubCodeBlocks', function (text, options, globals) {
3803    'use strict';
3804  
3805    // early exit if option is not enabled
3806    if (!options.ghCodeBlocks) {
3807      return text;
3808    }
3809  
3810    text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
3811  
3812    text += '¨0';
3813  
3814    text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
3815      var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
3816  
3817      // First parse the github code block
3818      codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
3819      codeblock = showdown.subParser('detab')(codeblock, options, globals);
3820      codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
3821      codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
3822  
3823      codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
3824  
3825      codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
3826  
3827      // Since GHCodeblocks can be false positives, we need to
3828      // store the primitive text and the parsed text in a global var,
3829      // and then return a token
3830      return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
3831    });
3832  
3833    // attacklab: strip sentinel
3834    text = text.replace(/¨0/, '');
3835  
3836    return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
3837  });
3838  
3839  showdown.subParser('hashBlock', function (text, options, globals) {
3840    'use strict';
3841    text = globals.converter._dispatch('hashBlock.before', text, options, globals);
3842    text = text.replace(/(^\n+|\n+$)/g, '');
3843    text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
3844    text = globals.converter._dispatch('hashBlock.after', text, options, globals);
3845    return text;
3846  });
3847  
3848  /**
3849   * Hash and escape <code> elements that should not be parsed as markdown
3850   */
3851  showdown.subParser('hashCodeTags', function (text, options, globals) {
3852    'use strict';
3853    text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
3854  
3855    var repFunc = function (wholeMatch, match, left, right) {
3856      var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
3857      return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
3858    };
3859  
3860    // Hash naked <code>
3861    text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
3862  
3863    text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
3864    return text;
3865  });
3866  
3867  showdown.subParser('hashElement', function (text, options, globals) {
3868    'use strict';
3869  
3870    return function (wholeMatch, m1) {
3871      var blockText = m1;
3872  
3873      // Undo double lines
3874      blockText = blockText.replace(/\n\n/g, '\n');
3875      blockText = blockText.replace(/^\n/, '');
3876  
3877      // strip trailing blank lines
3878      blockText = blockText.replace(/\n+$/g, '');
3879  
3880      // Replace the element text with a marker ("¨KxK" where x is its key)
3881      blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
3882  
3883      return blockText;
3884    };
3885  });
3886  
3887  showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
3888    'use strict';
3889    text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
3890  
3891    var blockTags = [
3892          'pre',
3893          'div',
3894          'h1',
3895          'h2',
3896          'h3',
3897          'h4',
3898          'h5',
3899          'h6',
3900          'blockquote',
3901          'table',
3902          'dl',
3903          'ol',
3904          'ul',
3905          'script',
3906          'noscript',
3907          'form',
3908          'fieldset',
3909          'iframe',
3910          'math',
3911          'style',
3912          'section',
3913          'header',
3914          'footer',
3915          'nav',
3916          'article',
3917          'aside',
3918          'address',
3919          'audio',
3920          'canvas',
3921          'figure',
3922          'hgroup',
3923          'output',
3924          'video',
3925          'p'
3926        ],
3927        repFunc = function (wholeMatch, match, left, right) {
3928          var txt = wholeMatch;
3929          // check if this html element is marked as markdown
3930          // if so, it's contents should be parsed as markdown
3931          if (left.search(/\bmarkdown\b/) !== -1) {
3932            txt = left + globals.converter.makeHtml(match) + right;
3933          }
3934          return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
3935        };
3936  
3937    if (options.backslashEscapesHTMLTags) {
3938      // encode backslash escaped HTML tags
3939      text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
3940        return '&lt;' + inside + '&gt;';
3941      });
3942    }
3943  
3944    // hash HTML Blocks
3945    for (var i = 0; i < blockTags.length; ++i) {
3946  
3947      var opTagPos,
3948          rgx1     = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
3949          patLeft  = '<' + blockTags[i] + '\\b[^>]*>',
3950          patRight = '</' + blockTags[i] + '>';
3951      // 1. Look for the first position of the first opening HTML tag in the text
3952      while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
3953  
3954        // if the HTML tag is \ escaped, we need to escape it and break
3955  
3956  
3957        //2. Split the text in that position
3958        var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
3959            //3. Match recursively
3960            newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
3961  
3962        // prevent an infinite loop
3963        if (newSubText1 === subTexts[1]) {
3964          break;
3965        }
3966        text = subTexts[0].concat(newSubText1);
3967      }
3968    }
3969    // HR SPECIAL CASE
3970    text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
3971      showdown.subParser('hashElement')(text, options, globals));
3972  
3973    // Special case for standalone HTML comments
3974    text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
3975      return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
3976    }, '^ {0,3}<!--', '-->', 'gm');
3977  
3978    // PHP and ASP-style processor instructions (<?...?> and <%...%>)
3979    text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
3980      showdown.subParser('hashElement')(text, options, globals));
3981  
3982    text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals);
3983    return text;
3984  });
3985  
3986  /**
3987   * Hash span elements that should not be parsed as markdown
3988   */
3989  showdown.subParser('hashHTMLSpans', function (text, options, globals) {
3990    'use strict';
3991    text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals);
3992  
3993    function hashHTMLSpan (html) {
3994      return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
3995    }
3996  
3997    // Hash Self Closing tags
3998    text = text.replace(/<[^>]+?\/>/gi, function (wm) {
3999      return hashHTMLSpan(wm);
4000    });
4001  
4002    // Hash tags without properties
4003    text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
4004      return hashHTMLSpan(wm);
4005    });
4006  
4007    // Hash tags with properties
4008    text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
4009      return hashHTMLSpan(wm);
4010    });
4011  
4012    // Hash self closing tags without />
4013    text = text.replace(/<[^>]+?>/gi, function (wm) {
4014      return hashHTMLSpan(wm);
4015    });
4016  
4017    /*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
4018  
4019    text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals);
4020    return text;
4021  });
4022  
4023  /**
4024   * Unhash HTML spans
4025   */
4026  showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
4027    'use strict';
4028    text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);
4029  
4030    for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
4031      var repText = globals.gHtmlSpans[i],
4032          // limiter to prevent infinite loop (assume 10 as limit for recurse)
4033          limit = 0;
4034  
4035      while (/¨C(\d+)C/.test(repText)) {
4036        var num = RegExp.$1;
4037        repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
4038        if (limit === 10) {
4039          console.error('maximum nesting of 10 spans reached!!!');
4040          break;
4041        }
4042        ++limit;
4043      }
4044      text = text.replace('¨C' + i + 'C', repText);
4045    }
4046  
4047    text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals);
4048    return text;
4049  });
4050  
4051  /**
4052   * Hash and escape <pre><code> elements that should not be parsed as markdown
4053   */
4054  showdown.subParser('hashPreCodeTags', function (text, options, globals) {
4055    'use strict';
4056    text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals);
4057  
4058    var repFunc = function (wholeMatch, match, left, right) {
4059      // encode html entities
4060      var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
4061      return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
4062    };
4063  
4064    // Hash <pre><code>
4065    text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
4066  
4067    text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
4068    return text;
4069  });
4070  
4071  showdown.subParser('headers', function (text, options, globals) {
4072    'use strict';
4073  
4074    text = globals.converter._dispatch('headers.before', text, options, globals);
4075  
4076    var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
4077  
4078        // Set text-style headers:
4079        //    Header 1
4080        //    ========
4081        //
4082        //    Header 2
4083        //    --------
4084        //
4085        setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
4086        setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
4087  
4088    text = text.replace(setextRegexH1, function (wholeMatch, m1) {
4089  
4090      var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
4091          hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
4092          hLevel = headerLevelStart,
4093          hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
4094      return showdown.subParser('hashBlock')(hashBlock, options, globals);
4095    });
4096  
4097    text = text.replace(setextRegexH2, function (matchFound, m1) {
4098      var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
4099          hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
4100          hLevel = headerLevelStart + 1,
4101          hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
4102      return showdown.subParser('hashBlock')(hashBlock, options, globals);
4103    });
4104  
4105    // atx-style headers:
4106    //  # Header 1
4107    //  ## Header 2
4108    //  ## Header 2 with closing hashes ##
4109    //  ...
4110    //  ###### Header 6
4111    //
4112    var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
4113  
4114    text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
4115      var hText = m2;
4116      if (options.customizedHeaderId) {
4117        hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
4118      }
4119  
4120      var span = showdown.subParser('spanGamut')(hText, options, globals),
4121          hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
4122          hLevel = headerLevelStart - 1 + m1.length,
4123          header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
4124  
4125      return showdown.subParser('hashBlock')(header, options, globals);
4126    });
4127  
4128    function headerId (m) {
4129      var title,
4130          prefix;
4131  
4132      // It is separate from other options to allow combining prefix and customized
4133      if (options.customizedHeaderId) {
4134        var match = m.match(/\{([^{]+?)}\s*$/);
4135        if (match && match[1]) {
4136          m = match[1];
4137        }
4138      }
4139  
4140      title = m;
4141  
4142      // Prefix id to prevent causing inadvertent pre-existing style matches.
4143      if (showdown.helper.isString(options.prefixHeaderId)) {
4144        prefix = options.prefixHeaderId;
4145      } else if (options.prefixHeaderId === true) {
4146        prefix = 'section-';
4147      } else {
4148        prefix = '';
4149      }
4150  
4151      if (!options.rawPrefixHeaderId) {
4152        title = prefix + title;
4153      }
4154  
4155      if (options.ghCompatibleHeaderId) {
4156        title = title
4157          .replace(/ /g, '-')
4158          // replace previously escaped chars (&, ¨ and $)
4159          .replace(/&amp;/g, '')
4160          .replace(/¨T/g, '')
4161          .replace(/¨D/g, '')
4162          // replace rest of the chars (&~$ are repeated as they might have been escaped)
4163          // borrowed from github's redcarpet (some they should produce similar results)
4164          .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
4165          .toLowerCase();
4166      } else if (options.rawHeaderId) {
4167        title = title
4168          .replace(/ /g, '-')
4169          // replace previously escaped chars (&, ¨ and $)
4170          .replace(/&amp;/g, '&')
4171          .replace(/¨T/g, '¨')
4172          .replace(/¨D/g, '$')
4173          // replace " and '
4174          .replace(/["']/g, '-')
4175          .toLowerCase();
4176      } else {
4177        title = title
4178          .replace(/[^\w]/g, '')
4179          .toLowerCase();
4180      }
4181  
4182      if (options.rawPrefixHeaderId) {
4183        title = prefix + title;
4184      }
4185  
4186      if (globals.hashLinkCounts[title]) {
4187        title = title + '-' + (globals.hashLinkCounts[title]++);
4188      } else {
4189        globals.hashLinkCounts[title] = 1;
4190      }
4191      return title;
4192    }
4193  
4194    text = globals.converter._dispatch('headers.after', text, options, globals);
4195    return text;
4196  });
4197  
4198  /**
4199   * Turn Markdown link shortcuts into XHTML <a> tags.
4200   */
4201  showdown.subParser('horizontalRule', function (text, options, globals) {
4202    'use strict';
4203    text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
4204  
4205    var key = showdown.subParser('hashBlock')('<hr />', options, globals);
4206    text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
4207    text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
4208    text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
4209  
4210    text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
4211    return text;
4212  });
4213  
4214  /**
4215   * Turn Markdown image shortcuts into <img> tags.
4216   */
4217  showdown.subParser('images', function (text, options, globals) {
4218    'use strict';
4219  
4220    text = globals.converter._dispatch('images.before', text, options, globals);
4221  
4222    var inlineRegExp      = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
4223        crazyRegExp       = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
4224        base64RegExp      = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
4225        referenceRegExp   = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
4226        refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
4227  
4228    function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
4229      url = url.replace(/\s/g, '');
4230      return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
4231    }
4232  
4233    function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
4234  
4235      var gUrls   = globals.gUrls,
4236          gTitles = globals.gTitles,
4237          gDims   = globals.gDimensions;
4238  
4239      linkId = linkId.toLowerCase();
4240  
4241      if (!title) {
4242        title = '';
4243      }
4244      // Special case for explicit empty url
4245      if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
4246        url = '';
4247  
4248      } else if (url === '' || url === null) {
4249        if (linkId === '' || linkId === null) {
4250          // lower-case and turn embedded newlines into spaces
4251          linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
4252        }
4253        url = '#' + linkId;
4254  
4255        if (!showdown.helper.isUndefined(gUrls[linkId])) {
4256          url = gUrls[linkId];
4257          if (!showdown.helper.isUndefined(gTitles[linkId])) {
4258            title = gTitles[linkId];
4259          }
4260          if (!showdown.helper.isUndefined(gDims[linkId])) {
4261            width = gDims[linkId].width;
4262            height = gDims[linkId].height;
4263          }
4264        } else {
4265          return wholeMatch;
4266        }
4267      }
4268  
4269      altText = altText
4270        .replace(/"/g, '&quot;')
4271      //altText = showdown.helper.escapeCharacters(altText, '*_', false);
4272        .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
4273      //url = showdown.helper.escapeCharacters(url, '*_', false);
4274      url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
4275      var result = '<img src="' + url + '" alt="' + altText + '"';
4276  
4277      if (title && showdown.helper.isString(title)) {
4278        title = title
4279          .replace(/"/g, '&quot;')
4280        //title = showdown.helper.escapeCharacters(title, '*_', false);
4281          .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
4282        result += ' title="' + title + '"';
4283      }
4284  
4285      if (width && height) {
4286        width  = (width === '*') ? 'auto' : width;
4287        height = (height === '*') ? 'auto' : height;
4288  
4289        result += ' width="' + width + '"';
4290        result += ' height="' + height + '"';
4291      }
4292  
4293      result += ' />';
4294  
4295      return result;
4296    }
4297  
4298    // First, handle reference-style labeled images: ![alt text][id]
4299    text = text.replace(referenceRegExp, writeImageTag);
4300  
4301    // Next, handle inline images:  ![alt text](url =<width>x<height> "optional title")
4302  
4303    // base64 encoded images
4304    text = text.replace(base64RegExp, writeImageTagBase64);
4305  
4306    // cases with crazy urls like ./image/cat1).png
4307    text = text.replace(crazyRegExp, writeImageTag);
4308  
4309    // normal cases
4310    text = text.replace(inlineRegExp, writeImageTag);
4311  
4312    // handle reference-style shortcuts: ![img text]
4313    text = text.replace(refShortcutRegExp, writeImageTag);
4314  
4315    text = globals.converter._dispatch('images.after', text, options, globals);
4316    return text;
4317  });
4318  
4319  showdown.subParser('italicsAndBold', function (text, options, globals) {
4320    'use strict';
4321  
4322    text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
4323  
4324    // it's faster to have 3 separate regexes for each case than have just one
4325    // because of backtracing, in some cases, it could lead to an exponential effect
4326    // called "catastrophic backtrace". Ominous!
4327  
4328    function parseInside (txt, left, right) {
4329      /*
4330      if (options.simplifiedAutoLink) {
4331        txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
4332      }
4333      */
4334      return left + txt + right;
4335    }
4336  
4337    // Parse underscores
4338    if (options.literalMidWordUnderscores) {
4339      text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
4340        return parseInside (txt, '<strong><em>', '</em></strong>');
4341      });
4342      text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
4343        return parseInside (txt, '<strong>', '</strong>');
4344      });
4345      text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
4346        return parseInside (txt, '<em>', '</em>');
4347      });
4348    } else {
4349      text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
4350        return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
4351      });
4352      text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
4353        return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
4354      });
4355      text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
4356        // !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
4357        return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
4358      });
4359    }
4360  
4361    // Now parse asterisks
4362    if (options.literalMidWordAsterisks) {
4363      text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
4364        return parseInside (txt, lead + '<strong><em>', '</em></strong>');
4365      });
4366      text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
4367        return parseInside (txt, lead + '<strong>', '</strong>');
4368      });
4369      text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
4370        return parseInside (txt, lead + '<em>', '</em>');
4371      });
4372    } else {
4373      text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
4374        return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
4375      });
4376      text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
4377        return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
4378      });
4379      text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
4380        // !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
4381        return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
4382      });
4383    }
4384  
4385  
4386    text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
4387    return text;
4388  });
4389  
4390  /**
4391   * Form HTML ordered (numbered) and unordered (bulleted) lists.
4392   */
4393  showdown.subParser('lists', function (text, options, globals) {
4394    'use strict';
4395  
4396    /**
4397     * Process the contents of a single ordered or unordered list, splitting it
4398     * into individual list items.
4399     * @param {string} listStr
4400     * @param {boolean} trimTrailing
4401     * @returns {string}
4402     */
4403    function processListItems (listStr, trimTrailing) {
4404      // The $g_list_level global keeps track of when we're inside a list.
4405      // Each time we enter a list, we increment it; when we leave a list,
4406      // we decrement. If it's zero, we're not in a list anymore.
4407      //
4408      // We do this because when we're not inside a list, we want to treat
4409      // something like this:
4410      //
4411      //    I recommend upgrading to version
4412      //    8. Oops, now this line is treated
4413      //    as a sub-list.
4414      //
4415      // As a single paragraph, despite the fact that the second line starts
4416      // with a digit-period-space sequence.
4417      //
4418      // Whereas when we're inside a list (or sub-list), that line will be
4419      // treated as the start of a sub-list. What a kludge, huh? This is
4420      // an aspect of Markdown's syntax that's hard to parse perfectly
4421      // without resorting to mind-reading. Perhaps the solution is to
4422      // change the syntax rules such that sub-lists must start with a
4423      // starting cardinal number; e.g. "1." or "a.".
4424      globals.gListLevel++;
4425  
4426      // trim trailing blank lines:
4427      listStr = listStr.replace(/\n{2,}$/, '\n');
4428  
4429      // attacklab: add sentinel to emulate \z
4430      listStr += '¨0';
4431  
4432      var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
4433          isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
4434  
4435      // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
4436      // which is a syntax breaking change
4437      // activating this option reverts to old behavior
4438      if (options.disableForced4SpacesIndentedSublists) {
4439        rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
4440      }
4441  
4442      listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
4443        checked = (checked && checked.trim() !== '');
4444  
4445        var item = showdown.subParser('outdent')(m4, options, globals),
4446            bulletStyle = '';
4447  
4448        // Support for github tasklists
4449        if (taskbtn && options.tasklists) {
4450          bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
4451          item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
4452            var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
4453            if (checked) {
4454              otp += ' checked';
4455            }
4456            otp += '>';
4457            return otp;
4458          });
4459        }
4460  
4461        // ISSUE #312
4462        // This input: - - - a
4463        // causes trouble to the parser, since it interprets it as:
4464        // <ul><li><li><li>a</li></li></li></ul>
4465        // instead of:
4466        // <ul><li>- - a</li></ul>
4467        // So, to prevent it, we will put a marker (¨A)in the beginning of the line
4468        // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
4469        item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
4470          return '¨A' + wm2;
4471        });
4472  
4473        // m1 - Leading line or
4474        // Has a double return (multi paragraph) or
4475        // Has sublist
4476        if (m1 || (item.search(/\n{2,}/) > -1)) {
4477          item = showdown.subParser('githubCodeBlocks')(item, options, globals);
4478          item = showdown.subParser('blockGamut')(item, options, globals);
4479        } else {
4480          // Recursion for sub-lists:
4481          item = showdown.subParser('lists')(item, options, globals);
4482          item = item.replace(/\n$/, ''); // chomp(item)
4483          item = showdown.subParser('hashHTMLBlocks')(item, options, globals);
4484  
4485          // Colapse double linebreaks
4486          item = item.replace(/\n\n+/g, '\n\n');
4487          if (isParagraphed) {
4488            item = showdown.subParser('paragraphs')(item, options, globals);
4489          } else {
4490            item = showdown.subParser('spanGamut')(item, options, globals);
4491          }
4492        }
4493  
4494        // now we need to remove the marker (¨A)
4495        item = item.replace('¨A', '');
4496        // we can finally wrap the line in list item tags
4497        item =  '<li' + bulletStyle + '>' + item + '</li>\n';
4498  
4499        return item;
4500      });
4501  
4502      // attacklab: strip sentinel
4503      listStr = listStr.replace(/¨0/g, '');
4504  
4505      globals.gListLevel--;
4506  
4507      if (trimTrailing) {
4508        listStr = listStr.replace(/\s+$/, '');
4509      }
4510  
4511      return listStr;
4512    }
4513  
4514    function styleStartNumber (list, listType) {
4515      // check if ol and starts by a number different than 1
4516      if (listType === 'ol') {
4517        var res = list.match(/^ *(\d+)\./);
4518        if (res && res[1] !== '1') {
4519          return ' start="' + res[1] + '"';
4520        }
4521      }
4522      return '';
4523    }
4524  
4525    /**
4526     * Check and parse consecutive lists (better fix for issue #142)
4527     * @param {string} list
4528     * @param {string} listType
4529     * @param {boolean} trimTrailing
4530     * @returns {string}
4531     */
4532    function parseConsecutiveLists (list, listType, trimTrailing) {
4533      // check if we caught 2 or more consecutive lists by mistake
4534      // we use the counterRgx, meaning if listType is UL we look for OL and vice versa
4535      var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
4536          ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
4537          counterRxg = (listType === 'ul') ? olRgx : ulRgx,
4538          result = '';
4539  
4540      if (list.search(counterRxg) !== -1) {
4541        (function parseCL (txt) {
4542          var pos = txt.search(counterRxg),
4543              style = styleStartNumber(list, listType);
4544          if (pos !== -1) {
4545            // slice
4546            result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
4547  
4548            // invert counterType and listType
4549            listType = (listType === 'ul') ? 'ol' : 'ul';
4550            counterRxg = (listType === 'ul') ? olRgx : ulRgx;
4551  
4552            //recurse
4553            parseCL(txt.slice(pos));
4554          } else {
4555            result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
4556          }
4557        })(list);
4558      } else {
4559        var style = styleStartNumber(list, listType);
4560        result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
4561      }
4562  
4563      return result;
4564    }
4565  
4566    /** Start of list parsing **/
4567    text = globals.converter._dispatch('lists.before', text, options, globals);
4568    // add sentinel to hack around khtml/safari bug:
4569    // http://bugs.webkit.org/show_bug.cgi?id=11231
4570    text += '¨0';
4571  
4572    if (globals.gListLevel) {
4573      text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
4574        function (wholeMatch, list, m2) {
4575          var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
4576          return parseConsecutiveLists(list, listType, true);
4577        }
4578      );
4579    } else {
4580      text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
4581        function (wholeMatch, m1, list, m3) {
4582          var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
4583          return parseConsecutiveLists(list, listType, false);
4584        }
4585      );
4586    }
4587  
4588    // strip sentinel
4589    text = text.replace(/¨0/, '');
4590    text = globals.converter._dispatch('lists.after', text, options, globals);
4591    return text;
4592  });
4593  
4594  /**
4595   * Parse metadata at the top of the document
4596   */
4597  showdown.subParser('metadata', function (text, options, globals) {
4598    'use strict';
4599  
4600    if (!options.metadata) {
4601      return text;
4602    }
4603  
4604    text = globals.converter._dispatch('metadata.before', text, options, globals);
4605  
4606    function parseMetadataContents (content) {
4607      // raw is raw so it's not changed in any way
4608      globals.metadata.raw = content;
4609  
4610      // escape chars forbidden in html attributes
4611      // double quotes
4612      content = content
4613        // ampersand first
4614        .replace(/&/g, '&amp;')
4615        // double quotes
4616        .replace(/"/g, '&quot;');
4617  
4618      content = content.replace(/\n {4}/g, ' ');
4619      content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
4620        globals.metadata.parsed[key] = value;
4621        return '';
4622      });
4623    }
4624  
4625    text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
4626      parseMetadataContents(content);
4627      return '¨M';
4628    });
4629  
4630    text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
4631      if (format) {
4632        globals.metadata.format = format;
4633      }
4634      parseMetadataContents(content);
4635      return '¨M';
4636    });
4637  
4638    text = text.replace(/¨M/g, '');
4639  
4640    text = globals.converter._dispatch('metadata.after', text, options, globals);
4641    return text;
4642  });
4643  
4644  /**
4645   * Remove one level of line-leading tabs or spaces
4646   */
4647  showdown.subParser('outdent', function (text, options, globals) {
4648    'use strict';
4649    text = globals.converter._dispatch('outdent.before', text, options, globals);
4650  
4651    // attacklab: hack around Konqueror 3.5.4 bug:
4652    // "----------bug".replace(/^-/g,"") == "bug"
4653    text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width
4654  
4655    // attacklab: clean up hack
4656    text = text.replace(/¨0/g, '');
4657  
4658    text = globals.converter._dispatch('outdent.after', text, options, globals);
4659    return text;
4660  });
4661  
4662  /**
4663   *
4664   */
4665  showdown.subParser('paragraphs', function (text, options, globals) {
4666    'use strict';
4667  
4668    text = globals.converter._dispatch('paragraphs.before', text, options, globals);
4669    // Strip leading and trailing lines:
4670    text = text.replace(/^\n+/g, '');
4671    text = text.replace(/\n+$/g, '');
4672  
4673    var grafs = text.split(/\n{2,}/g),
4674        grafsOut = [],
4675        end = grafs.length; // Wrap <p> tags
4676  
4677    for (var i = 0; i < end; i++) {
4678      var str = grafs[i];
4679      // if this is an HTML marker, copy it
4680      if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
4681        grafsOut.push(str);
4682  
4683      // test for presence of characters to prevent empty lines being parsed
4684      // as paragraphs (resulting in undesired extra empty paragraphs)
4685      } else if (str.search(/\S/) >= 0) {
4686        str = showdown.subParser('spanGamut')(str, options, globals);
4687        str = str.replace(/^([ \t]*)/g, '<p>');
4688        str += '</p>';
4689        grafsOut.push(str);
4690      }
4691    }
4692  
4693    /** Unhashify HTML blocks */
4694    end = grafsOut.length;
4695    for (i = 0; i < end; i++) {
4696      var blockText = '',
4697          grafsOutIt = grafsOut[i],
4698          codeFlag = false;
4699      // if this is a marker for an html block...
4700      // use RegExp.test instead of string.search because of QML bug
4701      while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
4702        var delim = RegExp.$1,
4703            num   = RegExp.$2;
4704  
4705        if (delim === 'K') {
4706          blockText = globals.gHtmlBlocks[num];
4707        } else {
4708          // we need to check if ghBlock is a false positive
4709          if (codeFlag) {
4710            // use encoded version of all text
4711            blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text, options, globals);
4712          } else {
4713            blockText = globals.ghCodeBlocks[num].codeblock;
4714          }
4715        }
4716        blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
4717  
4718        grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
4719        // Check if grafsOutIt is a pre->code
4720        if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
4721          codeFlag = true;
4722        }
4723      }
4724      grafsOut[i] = grafsOutIt;
4725    }
4726    text = grafsOut.join('\n');
4727    // Strip leading and trailing lines:
4728    text = text.replace(/^\n+/g, '');
4729    text = text.replace(/\n+$/g, '');
4730    return globals.converter._dispatch('paragraphs.after', text, options, globals);
4731  });
4732  
4733  /**
4734   * Run extension
4735   */
4736  showdown.subParser('runExtension', function (ext, text, options, globals) {
4737    'use strict';
4738  
4739    if (ext.filter) {
4740      text = ext.filter(text, globals.converter, options);
4741  
4742    } else if (ext.regex) {
4743      // TODO remove this when old extension loading mechanism is deprecated
4744      var re = ext.regex;
4745      if (!(re instanceof RegExp)) {
4746        re = new RegExp(re, 'g');
4747      }
4748      text = text.replace(re, ext.replace);
4749    }
4750  
4751    return text;
4752  });
4753  
4754  /**
4755   * These are all the transformations that occur *within* block-level
4756   * tags like paragraphs, headers, and list items.
4757   */
4758  showdown.subParser('spanGamut', function (text, options, globals) {
4759    'use strict';
4760  
4761    text = globals.converter._dispatch('spanGamut.before', text, options, globals);
4762    text = showdown.subParser('codeSpans')(text, options, globals);
4763    text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
4764    text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
4765  
4766    // Process anchor and image tags. Images must come first,
4767    // because ![foo][f] looks like an anchor.
4768    text = showdown.subParser('images')(text, options, globals);
4769    text = showdown.subParser('anchors')(text, options, globals);
4770  
4771    // Make links out of things like `<http://example.com/>`
4772    // Must come after anchors, because you can use < and >
4773    // delimiters in inline links like [this](<url>).
4774    text = showdown.subParser('autoLinks')(text, options, globals);
4775    text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
4776    text = showdown.subParser('emoji')(text, options, globals);
4777    text = showdown.subParser('underline')(text, options, globals);
4778    text = showdown.subParser('italicsAndBold')(text, options, globals);
4779    text = showdown.subParser('strikethrough')(text, options, globals);
4780    text = showdown.subParser('ellipsis')(text, options, globals);
4781  
4782    // we need to hash HTML tags inside spans
4783    text = showdown.subParser('hashHTMLSpans')(text, options, globals);
4784  
4785    // now we encode amps and angles
4786    text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
4787  
4788    // Do hard breaks
4789    if (options.simpleLineBreaks) {
4790      // GFM style hard breaks
4791      // only add line breaks if the text does not contain a block (special case for lists)
4792      if (!/\n\n¨K/.test(text)) {
4793        text = text.replace(/\n+/g, '<br />\n');
4794      }
4795    } else {
4796      // Vanilla hard breaks
4797      text = text.replace(/  +\n/g, '<br />\n');
4798    }
4799  
4800    text = globals.converter._dispatch('spanGamut.after', text, options, globals);
4801    return text;
4802  });
4803  
4804  showdown.subParser('strikethrough', function (text, options, globals) {
4805    'use strict';
4806  
4807    function parseInside (txt) {
4808      if (options.simplifiedAutoLink) {
4809        txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
4810      }
4811      return '<del>' + txt + '</del>';
4812    }
4813  
4814    if (options.strikethrough) {
4815      text = globals.converter._dispatch('strikethrough.before', text, options, globals);
4816      text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
4817      text = globals.converter._dispatch('strikethrough.after', text, options, globals);
4818    }
4819  
4820    return text;
4821  });
4822  
4823  /**
4824   * Strips link definitions from text, stores the URLs and titles in
4825   * hash references.
4826   * Link defs are in the form: ^[id]: url "optional title"
4827   */
4828  showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
4829    'use strict';
4830  
4831    var regex       = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
4832        base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
4833  
4834    // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
4835    text += '¨0';
4836  
4837    var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
4838      linkId = linkId.toLowerCase();
4839      if (url.match(/^data:.+?\/.+?;base64,/)) {
4840        // remove newlines
4841        globals.gUrls[linkId] = url.replace(/\s/g, '');
4842      } else {
4843        globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url, options, globals);  // Link IDs are case-insensitive
4844      }
4845  
4846      if (blankLines) {
4847        // Oops, found blank lines, so it's not a title.
4848        // Put back the parenthetical statement we stole.
4849        return blankLines + title;
4850  
4851      } else {
4852        if (title) {
4853          globals.gTitles[linkId] = title.replace(/"|'/g, '&quot;');
4854        }
4855        if (options.parseImgDimensions && width && height) {
4856          globals.gDimensions[linkId] = {
4857            width:  width,
4858            height: height
4859          };
4860        }
4861      }
4862      // Completely remove the definition from the text
4863      return '';
4864    };
4865  
4866    // first we try to find base64 link references
4867    text = text.replace(base64Regex, replaceFunc);
4868  
4869    text = text.replace(regex, replaceFunc);
4870  
4871    // attacklab: strip sentinel
4872    text = text.replace(/¨0/, '');
4873  
4874    return text;
4875  });
4876  
4877  showdown.subParser('tables', function (text, options, globals) {
4878    'use strict';
4879  
4880    if (!options.tables) {
4881      return text;
4882    }
4883  
4884    var tableRgx       = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
4885        //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
4886        singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
4887  
4888    function parseStyles (sLine) {
4889      if (/^:[ \t]*--*$/.test(sLine)) {
4890        return ' style="text-align:left;"';
4891      } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
4892        return ' style="text-align:right;"';
4893      } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
4894        return ' style="text-align:center;"';
4895      } else {
4896        return '';
4897      }
4898    }
4899  
4900    function parseHeaders (header, style) {
4901      var id = '';
4902      header = header.trim();
4903      // support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility
4904      if (options.tablesHeaderId || options.tableHeaderId) {
4905        id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
4906      }
4907      header = showdown.subParser('spanGamut')(header, options, globals);
4908  
4909      return '<th' + id + style + '>' + header + '</th>\n';
4910    }
4911  
4912    function parseCells (cell, style) {
4913      var subText = showdown.subParser('spanGamut')(cell, options, globals);
4914      return '<td' + style + '>' + subText + '</td>\n';
4915    }
4916  
4917    function buildTable (headers, cells) {
4918      var tb = '<table>\n<thead>\n<tr>\n',
4919          tblLgn = headers.length;
4920  
4921      for (var i = 0; i < tblLgn; ++i) {
4922        tb += headers[i];
4923      }
4924      tb += '</tr>\n</thead>\n<tbody>\n';
4925  
4926      for (i = 0; i < cells.length; ++i) {
4927        tb += '<tr>\n';
4928        for (var ii = 0; ii < tblLgn; ++ii) {
4929          tb += cells[i][ii];
4930        }
4931        tb += '</tr>\n';
4932      }
4933      tb += '</tbody>\n</table>\n';
4934      return tb;
4935    }
4936  
4937    function parseTable (rawTable) {
4938      var i, tableLines = rawTable.split('\n');
4939  
4940      for (i = 0; i < tableLines.length; ++i) {
4941        // strip wrong first and last column if wrapped tables are used
4942        if (/^ {0,3}\|/.test(tableLines[i])) {
4943          tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
4944        }
4945        if (/\|[ \t]*$/.test(tableLines[i])) {
4946          tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
4947        }
4948        // parse code spans first, but we only support one line code spans
4949        tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals);
4950      }
4951  
4952      var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
4953          rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
4954          rawCells = [],
4955          headers = [],
4956          styles = [],
4957          cells = [];
4958  
4959      tableLines.shift();
4960      tableLines.shift();
4961  
4962      for (i = 0; i < tableLines.length; ++i) {
4963        if (tableLines[i].trim() === '') {
4964          continue;
4965        }
4966        rawCells.push(
4967          tableLines[i]
4968            .split('|')
4969            .map(function (s) {
4970              return s.trim();
4971            })
4972        );
4973      }
4974  
4975      if (rawHeaders.length < rawStyles.length) {
4976        return rawTable;
4977      }
4978  
4979      for (i = 0; i < rawStyles.length; ++i) {
4980        styles.push(parseStyles(rawStyles[i]));
4981      }
4982  
4983      for (i = 0; i < rawHeaders.length; ++i) {
4984        if (showdown.helper.isUndefined(styles[i])) {
4985          styles[i] = '';
4986        }
4987        headers.push(parseHeaders(rawHeaders[i], styles[i]));
4988      }
4989  
4990      for (i = 0; i < rawCells.length; ++i) {
4991        var row = [];
4992        for (var ii = 0; ii < headers.length; ++ii) {
4993          if (showdown.helper.isUndefined(rawCells[i][ii])) {
4994  
4995          }
4996          row.push(parseCells(rawCells[i][ii], styles[ii]));
4997        }
4998        cells.push(row);
4999      }
5000  
5001      return buildTable(headers, cells);
5002    }
5003  
5004    text = globals.converter._dispatch('tables.before', text, options, globals);
5005  
5006    // find escaped pipe characters
5007    text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
5008  
5009    // parse multi column tables
5010    text = text.replace(tableRgx, parseTable);
5011  
5012    // parse one column tables
5013    text = text.replace(singeColTblRgx, parseTable);
5014  
5015    text = globals.converter._dispatch('tables.after', text, options, globals);
5016  
5017    return text;
5018  });
5019  
5020  showdown.subParser('underline', function (text, options, globals) {
5021    'use strict';
5022  
5023    if (!options.underline) {
5024      return text;
5025    }
5026  
5027    text = globals.converter._dispatch('underline.before', text, options, globals);
5028  
5029    if (options.literalMidWordUnderscores) {
5030      text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
5031        return '<u>' + txt + '</u>';
5032      });
5033      text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
5034        return '<u>' + txt + '</u>';
5035      });
5036    } else {
5037      text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
5038        return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
5039      });
5040      text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
5041        return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
5042      });
5043    }
5044  
5045    // escape remaining underscores to prevent them being parsed by italic and bold
5046    text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
5047  
5048    text = globals.converter._dispatch('underline.after', text, options, globals);
5049  
5050    return text;
5051  });
5052  
5053  /**
5054   * Swap back in all the special characters we've hidden.
5055   */
5056  showdown.subParser('unescapeSpecialChars', function (text, options, globals) {
5057    'use strict';
5058    text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals);
5059  
5060    text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
5061      var charCodeToReplace = parseInt(m1);
5062      return String.fromCharCode(charCodeToReplace);
5063    });
5064  
5065    text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
5066    return text;
5067  });
5068  
5069  showdown.subParser('makeMarkdown.blockquote', function (node, globals) {
5070    'use strict';
5071  
5072    var txt = '';
5073    if (node.hasChildNodes()) {
5074      var children = node.childNodes,
5075          childrenLength = children.length;
5076  
5077      for (var i = 0; i < childrenLength; ++i) {
5078        var innerTxt = showdown.subParser('makeMarkdown.node')(children[i], globals);
5079  
5080        if (innerTxt === '') {
5081          continue;
5082        }
5083        txt += innerTxt;
5084      }
5085    }
5086    // cleanup
5087    txt = txt.trim();
5088    txt = '> ' + txt.split('\n').join('\n> ');
5089    return txt;
5090  });
5091  
5092  showdown.subParser('makeMarkdown.codeBlock', function (node, globals) {
5093    'use strict';
5094  
5095    var lang = node.getAttribute('language'),
5096        num  = node.getAttribute('precodenum');
5097    return '```' + lang + '\n' + globals.preList[num] + '\n```';
5098  });
5099  
5100  showdown.subParser('makeMarkdown.codeSpan', function (node) {
5101    'use strict';
5102  
5103    return '`' + node.innerHTML + '`';
5104  });
5105  
5106  showdown.subParser('makeMarkdown.emphasis', function (node, globals) {
5107    'use strict';
5108  
5109    var txt = '';
5110    if (node.hasChildNodes()) {
5111      txt += '*';
5112      var children = node.childNodes,
5113          childrenLength = children.length;
5114      for (var i = 0; i < childrenLength; ++i) {
5115        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5116      }
5117      txt += '*';
5118    }
5119    return txt;
5120  });
5121  
5122  showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) {
5123    'use strict';
5124  
5125    var headerMark = new Array(headerLevel + 1).join('#'),
5126        txt = '';
5127  
5128    if (node.hasChildNodes()) {
5129      txt = headerMark + ' ';
5130      var children = node.childNodes,
5131          childrenLength = children.length;
5132  
5133      for (var i = 0; i < childrenLength; ++i) {
5134        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5135      }
5136    }
5137    return txt;
5138  });
5139  
5140  showdown.subParser('makeMarkdown.hr', function () {
5141    'use strict';
5142  
5143    return '---';
5144  });
5145  
5146  showdown.subParser('makeMarkdown.image', function (node) {
5147    'use strict';
5148  
5149    var txt = '';
5150    if (node.hasAttribute('src')) {
5151      txt += '![' + node.getAttribute('alt') + '](';
5152      txt += '<' + node.getAttribute('src') + '>';
5153      if (node.hasAttribute('width') && node.hasAttribute('height')) {
5154        txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
5155      }
5156  
5157      if (node.hasAttribute('title')) {
5158        txt += ' "' + node.getAttribute('title') + '"';
5159      }
5160      txt += ')';
5161    }
5162    return txt;
5163  });
5164  
5165  showdown.subParser('makeMarkdown.links', function (node, globals) {
5166    'use strict';
5167  
5168    var txt = '';
5169    if (node.hasChildNodes() && node.hasAttribute('href')) {
5170      var children = node.childNodes,
5171          childrenLength = children.length;
5172      txt = '[';
5173      for (var i = 0; i < childrenLength; ++i) {
5174        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5175      }
5176      txt += '](';
5177      txt += '<' + node.getAttribute('href') + '>';
5178      if (node.hasAttribute('title')) {
5179        txt += ' "' + node.getAttribute('title') + '"';
5180      }
5181      txt += ')';
5182    }
5183    return txt;
5184  });
5185  
5186  showdown.subParser('makeMarkdown.list', function (node, globals, type) {
5187    'use strict';
5188  
5189    var txt = '';
5190    if (!node.hasChildNodes()) {
5191      return '';
5192    }
5193    var listItems       = node.childNodes,
5194        listItemsLenght = listItems.length,
5195        listNum = node.getAttribute('start') || 1;
5196  
5197    for (var i = 0; i < listItemsLenght; ++i) {
5198      if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') {
5199        continue;
5200      }
5201  
5202      // define the bullet to use in list
5203      var bullet = '';
5204      if (type === 'ol') {
5205        bullet = listNum.toString() + '. ';
5206      } else {
5207        bullet = '- ';
5208      }
5209  
5210      // parse list item
5211      txt += bullet + showdown.subParser('makeMarkdown.listItem')(listItems[i], globals);
5212      ++listNum;
5213    }
5214  
5215    // add comment at the end to prevent consecutive lists to be parsed as one
5216    txt += '\n<!-- -->\n';
5217    return txt.trim();
5218  });
5219  
5220  showdown.subParser('makeMarkdown.listItem', function (node, globals) {
5221    'use strict';
5222  
5223    var listItemTxt = '';
5224  
5225    var children = node.childNodes,
5226        childrenLenght = children.length;
5227  
5228    for (var i = 0; i < childrenLenght; ++i) {
5229      listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5230    }
5231    // if it's only one liner, we need to add a newline at the end
5232    if (!/\n$/.test(listItemTxt)) {
5233      listItemTxt += '\n';
5234    } else {
5235      // it's multiparagraph, so we need to indent
5236      listItemTxt = listItemTxt
5237        .split('\n')
5238        .join('\n    ')
5239        .replace(/^ {4}$/gm, '')
5240        .replace(/\n\n+/g, '\n\n');
5241    }
5242  
5243    return listItemTxt;
5244  });
5245  
5246  
5247  
5248  showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
5249    'use strict';
5250  
5251    spansOnly = spansOnly || false;
5252  
5253    var txt = '';
5254  
5255    // edge case of text without wrapper paragraph
5256    if (node.nodeType === 3) {
5257      return showdown.subParser('makeMarkdown.txt')(node, globals);
5258    }
5259  
5260    // HTML comment
5261    if (node.nodeType === 8) {
5262      return '<!--' + node.data + '-->\n\n';
5263    }
5264  
5265    // process only node elements
5266    if (node.nodeType !== 1) {
5267      return '';
5268    }
5269  
5270    var tagName = node.tagName.toLowerCase();
5271  
5272    switch (tagName) {
5273  
5274      //
5275      // BLOCKS
5276      //
5277      case 'h1':
5278        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 1) + '\n\n'; }
5279        break;
5280      case 'h2':
5281        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 2) + '\n\n'; }
5282        break;
5283      case 'h3':
5284        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 3) + '\n\n'; }
5285        break;
5286      case 'h4':
5287        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 4) + '\n\n'; }
5288        break;
5289      case 'h5':
5290        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 5) + '\n\n'; }
5291        break;
5292      case 'h6':
5293        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 6) + '\n\n'; }
5294        break;
5295  
5296      case 'p':
5297        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.paragraph')(node, globals) + '\n\n'; }
5298        break;
5299  
5300      case 'blockquote':
5301        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.blockquote')(node, globals) + '\n\n'; }
5302        break;
5303  
5304      case 'hr':
5305        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.hr')(node, globals) + '\n\n'; }
5306        break;
5307  
5308      case 'ol':
5309        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ol') + '\n\n'; }
5310        break;
5311  
5312      case 'ul':
5313        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ul') + '\n\n'; }
5314        break;
5315  
5316      case 'precode':
5317        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.codeBlock')(node, globals) + '\n\n'; }
5318        break;
5319  
5320      case 'pre':
5321        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.pre')(node, globals) + '\n\n'; }
5322        break;
5323  
5324      case 'table':
5325        if (!spansOnly) { txt = showdown.subParser('makeMarkdown.table')(node, globals) + '\n\n'; }
5326        break;
5327  
5328      //
5329      // SPANS
5330      //
5331      case 'code':
5332        txt = showdown.subParser('makeMarkdown.codeSpan')(node, globals);
5333        break;
5334  
5335      case 'em':
5336      case 'i':
5337        txt = showdown.subParser('makeMarkdown.emphasis')(node, globals);
5338        break;
5339  
5340      case 'strong':
5341      case 'b':
5342        txt = showdown.subParser('makeMarkdown.strong')(node, globals);
5343        break;
5344  
5345      case 'del':
5346        txt = showdown.subParser('makeMarkdown.strikethrough')(node, globals);
5347        break;
5348  
5349      case 'a':
5350        txt = showdown.subParser('makeMarkdown.links')(node, globals);
5351        break;
5352  
5353      case 'img':
5354        txt = showdown.subParser('makeMarkdown.image')(node, globals);
5355        break;
5356  
5357      default:
5358        txt = node.outerHTML + '\n\n';
5359    }
5360  
5361    // common normalization
5362    // TODO eventually
5363  
5364    return txt;
5365  });
5366  
5367  showdown.subParser('makeMarkdown.paragraph', function (node, globals) {
5368    'use strict';
5369  
5370    var txt = '';
5371    if (node.hasChildNodes()) {
5372      var children = node.childNodes,
5373          childrenLength = children.length;
5374      for (var i = 0; i < childrenLength; ++i) {
5375        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5376      }
5377    }
5378  
5379    // some text normalization
5380    txt = txt.trim();
5381  
5382    return txt;
5383  });
5384  
5385  showdown.subParser('makeMarkdown.pre', function (node, globals) {
5386    'use strict';
5387  
5388    var num  = node.getAttribute('prenum');
5389    return '<pre>' + globals.preList[num] + '</pre>';
5390  });
5391  
5392  showdown.subParser('makeMarkdown.strikethrough', function (node, globals) {
5393    'use strict';
5394  
5395    var txt = '';
5396    if (node.hasChildNodes()) {
5397      txt += '~~';
5398      var children = node.childNodes,
5399          childrenLength = children.length;
5400      for (var i = 0; i < childrenLength; ++i) {
5401        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5402      }
5403      txt += '~~';
5404    }
5405    return txt;
5406  });
5407  
5408  showdown.subParser('makeMarkdown.strong', function (node, globals) {
5409    'use strict';
5410  
5411    var txt = '';
5412    if (node.hasChildNodes()) {
5413      txt += '**';
5414      var children = node.childNodes,
5415          childrenLength = children.length;
5416      for (var i = 0; i < childrenLength; ++i) {
5417        txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
5418      }
5419      txt += '**';
5420    }
5421    return txt;
5422  });
5423  
5424  showdown.subParser('makeMarkdown.table', function (node, globals) {
5425    'use strict';
5426  
5427    var txt = '',
5428        tableArray = [[], []],
5429        headings   = node.querySelectorAll('thead>tr>th'),
5430        rows       = node.querySelectorAll('tbody>tr'),
5431        i, ii;
5432    for (i = 0; i < headings.length; ++i) {
5433      var headContent = showdown.subParser('makeMarkdown.tableCell')(headings[i], globals),
5434          allign = '---';
5435  
5436      if (headings[i].hasAttribute('style')) {
5437        var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, '');
5438        switch (style) {
5439          case 'text-align:left;':
5440            allign = ':---';
5441            break;
5442          case 'text-align:right;':
5443            allign = '---:';
5444            break;
5445          case 'text-align:center;':
5446            allign = ':---:';
5447            break;
5448        }
5449      }
5450      tableArray[0][i] = headContent.trim();
5451      tableArray[1][i] = allign;
5452    }
5453  
5454    for (i = 0; i < rows.length; ++i) {
5455      var r = tableArray.push([]) - 1,
5456          cols = rows[i].getElementsByTagName('td');
5457  
5458      for (ii = 0; ii < headings.length; ++ii) {
5459        var cellContent = ' ';
5460        if (typeof cols[ii] !== 'undefined') {
5461          cellContent = showdown.subParser('makeMarkdown.tableCell')(cols[ii], globals);
5462        }
5463        tableArray[r].push(cellContent);
5464      }
5465    }
5466  
5467    var cellSpacesCount = 3;
5468    for (i = 0; i < tableArray.length; ++i) {
5469      for (ii = 0; ii < tableArray[i].length; ++ii) {
5470        var strLen = tableArray[i][ii].length;
5471        if (strLen > cellSpacesCount) {
5472          cellSpacesCount = strLen;
5473        }
5474      }
5475    }
5476  
5477    for (i = 0; i < tableArray.length; ++i) {
5478      for (ii = 0; ii < tableArray[i].length; ++ii) {
5479        if (i === 1) {
5480          if (tableArray[i][ii].slice(-1) === ':') {
5481            tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
5482          } else {
5483            tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
5484          }
5485        } else {
5486          tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount);
5487        }
5488      }
5489      txt += '| ' + tableArray[i].join(' | ') + ' |\n';
5490    }
5491  
5492    return txt.trim();
5493  });
5494  
5495  showdown.subParser('makeMarkdown.tableCell', function (node, globals) {
5496    'use strict';
5497  
5498    var txt = '';
5499    if (!node.hasChildNodes()) {
5500      return '';
5501    }
5502    var children = node.childNodes,
5503        childrenLength = children.length;
5504  
5505    for (var i = 0; i < childrenLength; ++i) {
5506      txt += showdown.subParser('makeMarkdown.node')(children[i], globals, true);
5507    }
5508    return txt.trim();
5509  });
5510  
5511  showdown.subParser('makeMarkdown.txt', function (node) {
5512    'use strict';
5513  
5514    var txt = node.nodeValue;
5515  
5516    // multiple spaces are collapsed
5517    txt = txt.replace(/ +/g, ' ');
5518  
5519    // replace the custom ¨NBSP; with a space
5520    txt = txt.replace(/¨NBSP;/g, ' ');
5521  
5522    // ", <, > and & should replace escaped html entities
5523    txt = showdown.helper.unescapeHTMLEntities(txt);
5524  
5525    // escape markdown magic characters
5526    // emphasis, strong and strikethrough - can appear everywhere
5527    // we also escape pipe (|) because of tables
5528    // and escape ` because of code blocks and spans
5529    txt = txt.replace(/([*_~|`])/g, '\\$1');
5530  
5531    // escape > because of blockquotes
5532    txt = txt.replace(/^(\s*)>/g, '\\$1>');
5533  
5534    // hash character, only troublesome at the beginning of a line because of headers
5535    txt = txt.replace(/^#/gm, '\\#');
5536  
5537    // horizontal rules
5538    txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3');
5539  
5540    // dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer
5541    txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.');
5542  
5543    // +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped)
5544    txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2');
5545  
5546    // images and links, ] followed by ( is problematic, so we escape it
5547    txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\(');
5548  
5549    // reference URIs must also be escaped
5550    txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:');
5551  
5552    return txt;
5553  });
5554  
5555  var root = this;
5556  
5557  // AMD Loader
5558  if (true) {
5559    !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
5560      'use strict';
5561      return showdown;
5562    }).call(exports, __webpack_require__, exports, module),
5563                  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
5564  
5565  // CommonJS/nodeJS Loader
5566  } else {}
5567  }).call(this);
5568  
5569  
5570  
5571  
5572  /***/ }),
5573  
5574  /***/ 31:
5575  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5576  
5577  "use strict";
5578  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
5579  /* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24);
5580  
5581  function _unsupportedIterableToArray(o, minLen) {
5582    if (!o) return;
5583    if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
5584    var n = Object.prototype.toString.call(o).slice(8, -1);
5585    if (n === "Object" && o.constructor) n = o.constructor.name;
5586    if (n === "Map" || n === "Set") return Array.from(o);
5587    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
5588  }
5589  
5590  /***/ }),
5591  
5592  /***/ 33:
5593  /***/ (function(module, exports) {
5594  
5595  (function() { module.exports = window["wp"]["hooks"]; }());
5596  
5597  /***/ }),
5598  
5599  /***/ 35:
5600  /***/ (function(module, exports) {
5601  
5602  (function() { module.exports = window["wp"]["deprecated"]; }());
5603  
5604  /***/ }),
5605  
5606  /***/ 37:
5607  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5608  
5609  "use strict";
5610  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
5611  function _iterableToArray(iter) {
5612    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
5613  }
5614  
5615  /***/ }),
5616  
5617  /***/ 38:
5618  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5619  
5620  "use strict";
5621  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
5622  function _arrayWithHoles(arr) {
5623    if (Array.isArray(arr)) return arr;
5624  }
5625  
5626  /***/ }),
5627  
5628  /***/ 39:
5629  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5630  
5631  "use strict";
5632  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
5633  function _nonIterableRest() {
5634    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5635  }
5636  
5637  /***/ }),
5638  
5639  /***/ 4:
5640  /***/ (function(module, exports) {
5641  
5642  (function() { module.exports = window["wp"]["data"]; }());
5643  
5644  /***/ }),
5645  
5646  /***/ 41:
5647  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5648  
5649  "use strict";
5650  
5651  
5652  var LEAF_KEY, hasWeakMap;
5653  
5654  /**
5655   * Arbitrary value used as key for referencing cache object in WeakMap tree.
5656   *
5657   * @type {Object}
5658   */
5659  LEAF_KEY = {};
5660  
5661  /**
5662   * Whether environment supports WeakMap.
5663   *
5664   * @type {boolean}
5665   */
5666  hasWeakMap = typeof WeakMap !== 'undefined';
5667  
5668  /**
5669   * Returns the first argument as the sole entry in an array.
5670   *
5671   * @param {*} value Value to return.
5672   *
5673   * @return {Array} Value returned as entry in array.
5674   */
5675  function arrayOf( value ) {
5676      return [ value ];
5677  }
5678  
5679  /**
5680   * Returns true if the value passed is object-like, or false otherwise. A value
5681   * is object-like if it can support property assignment, e.g. object or array.
5682   *
5683   * @param {*} value Value to test.
5684   *
5685   * @return {boolean} Whether value is object-like.
5686   */
5687  function isObjectLike( value ) {
5688      return !! value && 'object' === typeof value;
5689  }
5690  
5691  /**
5692   * Creates and returns a new cache object.
5693   *
5694   * @return {Object} Cache object.
5695   */
5696  function createCache() {
5697      var cache = {
5698          clear: function() {
5699              cache.head = null;
5700          },
5701      };
5702  
5703      return cache;
5704  }
5705  
5706  /**
5707   * Returns true if entries within the two arrays are strictly equal by
5708   * reference from a starting index.
5709   *
5710   * @param {Array}  a         First array.
5711   * @param {Array}  b         Second array.
5712   * @param {number} fromIndex Index from which to start comparison.
5713   *
5714   * @return {boolean} Whether arrays are shallowly equal.
5715   */
5716  function isShallowEqual( a, b, fromIndex ) {
5717      var i;
5718  
5719      if ( a.length !== b.length ) {
5720          return false;
5721      }
5722  
5723      for ( i = fromIndex; i < a.length; i++ ) {
5724          if ( a[ i ] !== b[ i ] ) {
5725              return false;
5726          }
5727      }
5728  
5729      return true;
5730  }
5731  
5732  /**
5733   * Returns a memoized selector function. The getDependants function argument is
5734   * called before the memoized selector and is expected to return an immutable
5735   * reference or array of references on which the selector depends for computing
5736   * its own return value. The memoize cache is preserved only as long as those
5737   * dependant references remain the same. If getDependants returns a different
5738   * reference(s), the cache is cleared and the selector value regenerated.
5739   *
5740   * @param {Function} selector      Selector function.
5741   * @param {Function} getDependants Dependant getter returning an immutable
5742   *                                 reference or array of reference used in
5743   *                                 cache bust consideration.
5744   *
5745   * @return {Function} Memoized selector.
5746   */
5747  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
5748      var rootCache, getCache;
5749  
5750      // Use object source as dependant if getter not provided
5751      if ( ! getDependants ) {
5752          getDependants = arrayOf;
5753      }
5754  
5755      /**
5756       * Returns the root cache. If WeakMap is supported, this is assigned to the
5757       * root WeakMap cache set, otherwise it is a shared instance of the default
5758       * cache object.
5759       *
5760       * @return {(WeakMap|Object)} Root cache object.
5761       */
5762  	function getRootCache() {
5763          return rootCache;
5764      }
5765  
5766      /**
5767       * Returns the cache for a given dependants array. When possible, a WeakMap
5768       * will be used to create a unique cache for each set of dependants. This
5769       * is feasible due to the nature of WeakMap in allowing garbage collection
5770       * to occur on entries where the key object is no longer referenced. Since
5771       * WeakMap requires the key to be an object, this is only possible when the
5772       * dependant is object-like. The root cache is created as a hierarchy where
5773       * each top-level key is the first entry in a dependants set, the value a
5774       * WeakMap where each key is the next dependant, and so on. This continues
5775       * so long as the dependants are object-like. If no dependants are object-
5776       * like, then the cache is shared across all invocations.
5777       *
5778       * @see isObjectLike
5779       *
5780       * @param {Array} dependants Selector dependants.
5781       *
5782       * @return {Object} Cache object.
5783       */
5784  	function getWeakMapCache( dependants ) {
5785          var caches = rootCache,
5786              isUniqueByDependants = true,
5787              i, dependant, map, cache;
5788  
5789          for ( i = 0; i < dependants.length; i++ ) {
5790              dependant = dependants[ i ];
5791  
5792              // Can only compose WeakMap from object-like key.
5793              if ( ! isObjectLike( dependant ) ) {
5794                  isUniqueByDependants = false;
5795                  break;
5796              }
5797  
5798              // Does current segment of cache already have a WeakMap?
5799              if ( caches.has( dependant ) ) {
5800                  // Traverse into nested WeakMap.
5801                  caches = caches.get( dependant );
5802              } else {
5803                  // Create, set, and traverse into a new one.
5804                  map = new WeakMap();
5805                  caches.set( dependant, map );
5806                  caches = map;
5807              }
5808          }
5809  
5810          // We use an arbitrary (but consistent) object as key for the last item
5811          // in the WeakMap to serve as our running cache.
5812          if ( ! caches.has( LEAF_KEY ) ) {
5813              cache = createCache();
5814              cache.isUniqueByDependants = isUniqueByDependants;
5815              caches.set( LEAF_KEY, cache );
5816          }
5817  
5818          return caches.get( LEAF_KEY );
5819      }
5820  
5821      // Assign cache handler by availability of WeakMap
5822      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
5823  
5824      /**
5825       * Resets root memoization cache.
5826       */
5827  	function clear() {
5828          rootCache = hasWeakMap ? new WeakMap() : createCache();
5829      }
5830  
5831      // eslint-disable-next-line jsdoc/check-param-names
5832      /**
5833       * The augmented selector call, considering first whether dependants have
5834       * changed before passing it to underlying memoize function.
5835       *
5836       * @param {Object} source    Source object for derivation.
5837       * @param {...*}   extraArgs Additional arguments to pass to selector.
5838       *
5839       * @return {*} Selector result.
5840       */
5841  	function callSelector( /* source, ...extraArgs */ ) {
5842          var len = arguments.length,
5843              cache, node, i, args, dependants;
5844  
5845          // Create copy of arguments (avoid leaking deoptimization).
5846          args = new Array( len );
5847          for ( i = 0; i < len; i++ ) {
5848              args[ i ] = arguments[ i ];
5849          }
5850  
5851          dependants = getDependants.apply( null, args );
5852          cache = getCache( dependants );
5853  
5854          // If not guaranteed uniqueness by dependants (primitive type or lack
5855          // of WeakMap support), shallow compare against last dependants and, if
5856          // references have changed, destroy cache to recalculate result.
5857          if ( ! cache.isUniqueByDependants ) {
5858              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
5859                  cache.clear();
5860              }
5861  
5862              cache.lastDependants = dependants;
5863          }
5864  
5865          node = cache.head;
5866          while ( node ) {
5867              // Check whether node arguments match arguments
5868              if ( ! isShallowEqual( node.args, args, 1 ) ) {
5869                  node = node.next;
5870                  continue;
5871              }
5872  
5873              // At this point we can assume we've found a match
5874  
5875              // Surface matched node to head if not already
5876              if ( node !== cache.head ) {
5877                  // Adjust siblings to point to each other.
5878                  node.prev.next = node.next;
5879                  if ( node.next ) {
5880                      node.next.prev = node.prev;
5881                  }
5882  
5883                  node.next = cache.head;
5884                  node.prev = null;
5885                  cache.head.prev = node;
5886                  cache.head = node;
5887              }
5888  
5889              // Return immediately
5890              return node.val;
5891          }
5892  
5893          // No cached value found. Continue to insertion phase:
5894  
5895          node = {
5896              // Generate the result from original function
5897              val: selector.apply( null, args ),
5898          };
5899  
5900          // Avoid including the source object in the cache.
5901          args[ 0 ] = null;
5902          node.args = args;
5903  
5904          // Don't need to check whether node is already head, since it would
5905          // have been returned above already if it was
5906  
5907          // Shift existing head down list
5908          if ( cache.head ) {
5909              cache.head.prev = node;
5910              node.next = cache.head;
5911          }
5912  
5913          cache.head = node;
5914  
5915          return node.val;
5916      }
5917  
5918      callSelector.getDependants = getDependants;
5919      callSelector.clear = clear;
5920      clear();
5921  
5922      return callSelector;
5923  });
5924  
5925  
5926  /***/ }),
5927  
5928  /***/ 43:
5929  /***/ (function(module, exports) {
5930  
5931  (function() { module.exports = window["wp"]["blob"]; }());
5932  
5933  /***/ }),
5934  
5935  /***/ 460:
5936  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5937  
5938  "use strict";
5939  // ESM COMPAT FLAG
5940  __webpack_require__.r(__webpack_exports__);
5941  
5942  // EXPORTS
5943  __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
5944  __webpack_require__.d(__webpack_exports__, "createBlock", function() { return /* reexport */ createBlock; });
5945  __webpack_require__.d(__webpack_exports__, "createBlocksFromInnerBlocksTemplate", function() { return /* reexport */ createBlocksFromInnerBlocksTemplate; });
5946  __webpack_require__.d(__webpack_exports__, "cloneBlock", function() { return /* reexport */ cloneBlock; });
5947  __webpack_require__.d(__webpack_exports__, "__experimentalCloneSanitizedBlock", function() { return /* reexport */ __experimentalCloneSanitizedBlock; });
5948  __webpack_require__.d(__webpack_exports__, "getPossibleBlockTransformations", function() { return /* reexport */ getPossibleBlockTransformations; });
5949  __webpack_require__.d(__webpack_exports__, "switchToBlockType", function() { return /* reexport */ switchToBlockType; });
5950  __webpack_require__.d(__webpack_exports__, "getBlockTransforms", function() { return /* reexport */ getBlockTransforms; });
5951  __webpack_require__.d(__webpack_exports__, "findTransform", function() { return /* reexport */ findTransform; });
5952  __webpack_require__.d(__webpack_exports__, "getBlockFromExample", function() { return /* reexport */ factory_getBlockFromExample; });
5953  __webpack_require__.d(__webpack_exports__, "parse", function() { return /* reexport */ parser; });
5954  __webpack_require__.d(__webpack_exports__, "getBlockAttributes", function() { return /* reexport */ getBlockAttributes; });
5955  __webpack_require__.d(__webpack_exports__, "parseWithAttributeSchema", function() { return /* reexport */ parseWithAttributeSchema; });
5956  __webpack_require__.d(__webpack_exports__, "pasteHandler", function() { return /* reexport */ pasteHandler; });
5957  __webpack_require__.d(__webpack_exports__, "rawHandler", function() { return /* reexport */ rawHandler; });
5958  __webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ deprecatedGetPhrasingContentSchema; });
5959  __webpack_require__.d(__webpack_exports__, "serialize", function() { return /* reexport */ serialize; });
5960  __webpack_require__.d(__webpack_exports__, "getBlockContent", function() { return /* reexport */ getBlockContent; });
5961  __webpack_require__.d(__webpack_exports__, "getBlockDefaultClassName", function() { return /* reexport */ getBlockDefaultClassName; });
5962  __webpack_require__.d(__webpack_exports__, "getBlockMenuDefaultClassName", function() { return /* reexport */ getBlockMenuDefaultClassName; });
5963  __webpack_require__.d(__webpack_exports__, "getSaveElement", function() { return /* reexport */ getSaveElement; });
5964  __webpack_require__.d(__webpack_exports__, "getSaveContent", function() { return /* reexport */ getSaveContent; });
5965  __webpack_require__.d(__webpack_exports__, "__unstableGetBlockProps", function() { return /* reexport */ getBlockProps; });
5966  __webpack_require__.d(__webpack_exports__, "__unstableSerializeAndClean", function() { return /* reexport */ __unstableSerializeAndClean; });
5967  __webpack_require__.d(__webpack_exports__, "isValidBlockContent", function() { return /* reexport */ isValidBlockContent; });
5968  __webpack_require__.d(__webpack_exports__, "getCategories", function() { return /* reexport */ categories_getCategories; });
5969  __webpack_require__.d(__webpack_exports__, "setCategories", function() { return /* reexport */ categories_setCategories; });
5970  __webpack_require__.d(__webpack_exports__, "updateCategory", function() { return /* reexport */ categories_updateCategory; });
5971  __webpack_require__.d(__webpack_exports__, "registerBlockType", function() { return /* reexport */ registerBlockType; });
5972  __webpack_require__.d(__webpack_exports__, "registerBlockCollection", function() { return /* reexport */ registerBlockCollection; });
5973  __webpack_require__.d(__webpack_exports__, "unregisterBlockType", function() { return /* reexport */ unregisterBlockType; });
5974  __webpack_require__.d(__webpack_exports__, "setFreeformContentHandlerName", function() { return /* reexport */ setFreeformContentHandlerName; });
5975  __webpack_require__.d(__webpack_exports__, "getFreeformContentHandlerName", function() { return /* reexport */ getFreeformContentHandlerName; });
5976  __webpack_require__.d(__webpack_exports__, "setUnregisteredTypeHandlerName", function() { return /* reexport */ setUnregisteredTypeHandlerName; });
5977  __webpack_require__.d(__webpack_exports__, "getUnregisteredTypeHandlerName", function() { return /* reexport */ getUnregisteredTypeHandlerName; });
5978  __webpack_require__.d(__webpack_exports__, "setDefaultBlockName", function() { return /* reexport */ registration_setDefaultBlockName; });
5979  __webpack_require__.d(__webpack_exports__, "getDefaultBlockName", function() { return /* reexport */ registration_getDefaultBlockName; });
5980  __webpack_require__.d(__webpack_exports__, "setGroupingBlockName", function() { return /* reexport */ registration_setGroupingBlockName; });
5981  __webpack_require__.d(__webpack_exports__, "getGroupingBlockName", function() { return /* reexport */ registration_getGroupingBlockName; });
5982  __webpack_require__.d(__webpack_exports__, "getBlockType", function() { return /* reexport */ registration_getBlockType; });
5983  __webpack_require__.d(__webpack_exports__, "getBlockTypes", function() { return /* reexport */ registration_getBlockTypes; });
5984  __webpack_require__.d(__webpack_exports__, "getBlockSupport", function() { return /* reexport */ registration_getBlockSupport; });
5985  __webpack_require__.d(__webpack_exports__, "hasBlockSupport", function() { return /* reexport */ registration_hasBlockSupport; });
5986  __webpack_require__.d(__webpack_exports__, "getBlockVariations", function() { return /* reexport */ registration_getBlockVariations; });
5987  __webpack_require__.d(__webpack_exports__, "isReusableBlock", function() { return /* reexport */ isReusableBlock; });
5988  __webpack_require__.d(__webpack_exports__, "getChildBlockNames", function() { return /* reexport */ registration_getChildBlockNames; });
5989  __webpack_require__.d(__webpack_exports__, "hasChildBlocks", function() { return /* reexport */ registration_hasChildBlocks; });
5990  __webpack_require__.d(__webpack_exports__, "hasChildBlocksWithInserterSupport", function() { return /* reexport */ registration_hasChildBlocksWithInserterSupport; });
5991  __webpack_require__.d(__webpack_exports__, "unstable__bootstrapServerSideBlockDefinitions", function() { return /* reexport */ unstable__bootstrapServerSideBlockDefinitions; });
5992  __webpack_require__.d(__webpack_exports__, "registerBlockStyle", function() { return /* reexport */ registration_registerBlockStyle; });
5993  __webpack_require__.d(__webpack_exports__, "unregisterBlockStyle", function() { return /* reexport */ registration_unregisterBlockStyle; });
5994  __webpack_require__.d(__webpack_exports__, "registerBlockVariation", function() { return /* reexport */ registration_registerBlockVariation; });
5995  __webpack_require__.d(__webpack_exports__, "unregisterBlockVariation", function() { return /* reexport */ registration_unregisterBlockVariation; });
5996  __webpack_require__.d(__webpack_exports__, "isUnmodifiedDefaultBlock", function() { return /* reexport */ isUnmodifiedDefaultBlock; });
5997  __webpack_require__.d(__webpack_exports__, "normalizeIconObject", function() { return /* reexport */ normalizeIconObject; });
5998  __webpack_require__.d(__webpack_exports__, "isValidIcon", function() { return /* reexport */ isValidIcon; });
5999  __webpack_require__.d(__webpack_exports__, "__experimentalGetBlockLabel", function() { return /* reexport */ getBlockLabel; });
6000  __webpack_require__.d(__webpack_exports__, "__experimentalGetAccessibleBlockLabel", function() { return /* reexport */ getAccessibleBlockLabel; });
6001  __webpack_require__.d(__webpack_exports__, "doBlocksMatchTemplate", function() { return /* reexport */ doBlocksMatchTemplate; });
6002  __webpack_require__.d(__webpack_exports__, "synchronizeBlocksWithTemplate", function() { return /* reexport */ synchronizeBlocksWithTemplate; });
6003  __webpack_require__.d(__webpack_exports__, "children", function() { return /* reexport */ api_children; });
6004  __webpack_require__.d(__webpack_exports__, "node", function() { return /* reexport */ api_node; });
6005  __webpack_require__.d(__webpack_exports__, "__EXPERIMENTAL_STYLE_PROPERTY", function() { return /* reexport */ __EXPERIMENTAL_STYLE_PROPERTY; });
6006  __webpack_require__.d(__webpack_exports__, "withBlockContentContext", function() { return /* reexport */ withBlockContentContext; });
6007  
6008  // NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
6009  var selectors_namespaceObject = {};
6010  __webpack_require__.r(selectors_namespaceObject);
6011  __webpack_require__.d(selectors_namespaceObject, "getBlockTypes", function() { return getBlockTypes; });
6012  __webpack_require__.d(selectors_namespaceObject, "getBlockType", function() { return getBlockType; });
6013  __webpack_require__.d(selectors_namespaceObject, "getBlockStyles", function() { return getBlockStyles; });
6014  __webpack_require__.d(selectors_namespaceObject, "getBlockVariations", function() { return selectors_getBlockVariations; });
6015  __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockVariation", function() { return getDefaultBlockVariation; });
6016  __webpack_require__.d(selectors_namespaceObject, "getCategories", function() { return getCategories; });
6017  __webpack_require__.d(selectors_namespaceObject, "getCollections", function() { return getCollections; });
6018  __webpack_require__.d(selectors_namespaceObject, "getDefaultBlockName", function() { return getDefaultBlockName; });
6019  __webpack_require__.d(selectors_namespaceObject, "getFreeformFallbackBlockName", function() { return getFreeformFallbackBlockName; });
6020  __webpack_require__.d(selectors_namespaceObject, "getUnregisteredFallbackBlockName", function() { return getUnregisteredFallbackBlockName; });
6021  __webpack_require__.d(selectors_namespaceObject, "getGroupingBlockName", function() { return getGroupingBlockName; });
6022  __webpack_require__.d(selectors_namespaceObject, "getChildBlockNames", function() { return selectors_getChildBlockNames; });
6023  __webpack_require__.d(selectors_namespaceObject, "getBlockSupport", function() { return selectors_getBlockSupport; });
6024  __webpack_require__.d(selectors_namespaceObject, "hasBlockSupport", function() { return hasBlockSupport; });
6025  __webpack_require__.d(selectors_namespaceObject, "isMatchingSearchTerm", function() { return isMatchingSearchTerm; });
6026  __webpack_require__.d(selectors_namespaceObject, "hasChildBlocks", function() { return selectors_hasChildBlocks; });
6027  __webpack_require__.d(selectors_namespaceObject, "hasChildBlocksWithInserterSupport", function() { return selectors_hasChildBlocksWithInserterSupport; });
6028  
6029  // NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/actions.js
6030  var actions_namespaceObject = {};
6031  __webpack_require__.r(actions_namespaceObject);
6032  __webpack_require__.d(actions_namespaceObject, "addBlockTypes", function() { return addBlockTypes; });
6033  __webpack_require__.d(actions_namespaceObject, "removeBlockTypes", function() { return removeBlockTypes; });
6034  __webpack_require__.d(actions_namespaceObject, "addBlockStyles", function() { return addBlockStyles; });
6035  __webpack_require__.d(actions_namespaceObject, "removeBlockStyles", function() { return removeBlockStyles; });
6036  __webpack_require__.d(actions_namespaceObject, "addBlockVariations", function() { return addBlockVariations; });
6037  __webpack_require__.d(actions_namespaceObject, "removeBlockVariations", function() { return removeBlockVariations; });
6038  __webpack_require__.d(actions_namespaceObject, "setDefaultBlockName", function() { return setDefaultBlockName; });
6039  __webpack_require__.d(actions_namespaceObject, "setFreeformFallbackBlockName", function() { return setFreeformFallbackBlockName; });
6040  __webpack_require__.d(actions_namespaceObject, "setUnregisteredFallbackBlockName", function() { return setUnregisteredFallbackBlockName; });
6041  __webpack_require__.d(actions_namespaceObject, "setGroupingBlockName", function() { return setGroupingBlockName; });
6042  __webpack_require__.d(actions_namespaceObject, "setCategories", function() { return setCategories; });
6043  __webpack_require__.d(actions_namespaceObject, "updateCategory", function() { return updateCategory; });
6044  __webpack_require__.d(actions_namespaceObject, "addBlockCollection", function() { return addBlockCollection; });
6045  __webpack_require__.d(actions_namespaceObject, "removeBlockCollection", function() { return removeBlockCollection; });
6046  
6047  // EXTERNAL MODULE: external ["wp","data"]
6048  var external_wp_data_ = __webpack_require__(4);
6049  
6050  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
6051  var toConsumableArray = __webpack_require__(15);
6052  
6053  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
6054  var defineProperty = __webpack_require__(5);
6055  
6056  // EXTERNAL MODULE: external "lodash"
6057  var external_lodash_ = __webpack_require__(2);
6058  
6059  // EXTERNAL MODULE: external ["wp","i18n"]
6060  var external_wp_i18n_ = __webpack_require__(1);
6061  
6062  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js
6063  
6064  
6065  
6066  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; }
6067  
6068  function _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) { Object(defineProperty["a" /* default */])(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; }
6069  
6070  /**
6071   * External dependencies
6072   */
6073  
6074  /**
6075   * WordPress dependencies
6076   */
6077  
6078  
6079  
6080  /**
6081   * @typedef {Object} WPBlockCategory
6082   *
6083   * @property {string} slug  Unique category slug.
6084   * @property {string} title Category label, for display in user interface.
6085   */
6086  
6087  /**
6088   * Default set of categories.
6089   *
6090   * @type {WPBlockCategory[]}
6091   */
6092  
6093  var DEFAULT_CATEGORIES = [{
6094    slug: 'text',
6095    title: Object(external_wp_i18n_["__"])('Text')
6096  }, {
6097    slug: 'media',
6098    title: Object(external_wp_i18n_["__"])('Media')
6099  }, {
6100    slug: 'design',
6101    title: Object(external_wp_i18n_["__"])('Design')
6102  }, {
6103    slug: 'widgets',
6104    title: Object(external_wp_i18n_["__"])('Widgets')
6105  }, {
6106    slug: 'embed',
6107    title: Object(external_wp_i18n_["__"])('Embeds')
6108  }, {
6109    slug: 'reusable',
6110    title: Object(external_wp_i18n_["__"])('Reusable blocks')
6111  }];
6112  /**
6113   * Reducer managing the block types
6114   *
6115   * @param {Object} state  Current state.
6116   * @param {Object} action Dispatched action.
6117   *
6118   * @return {Object} Updated state.
6119   */
6120  
6121  function reducer_blockTypes() {
6122    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6123    var action = arguments.length > 1 ? arguments[1] : undefined;
6124  
6125    switch (action.type) {
6126      case 'ADD_BLOCK_TYPES':
6127        return _objectSpread(_objectSpread({}, state), Object(external_lodash_["keyBy"])(Object(external_lodash_["map"])(action.blockTypes, function (blockType) {
6128          return Object(external_lodash_["omit"])(blockType, 'styles ');
6129        }), 'name'));
6130  
6131      case 'REMOVE_BLOCK_TYPES':
6132        return Object(external_lodash_["omit"])(state, action.names);
6133    }
6134  
6135    return state;
6136  }
6137  /**
6138   * Reducer managing the block style variations.
6139   *
6140   * @param {Object} state  Current state.
6141   * @param {Object} action Dispatched action.
6142   *
6143   * @return {Object} Updated state.
6144   */
6145  
6146  function blockStyles() {
6147    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6148    var action = arguments.length > 1 ? arguments[1] : undefined;
6149  
6150    switch (action.type) {
6151      case 'ADD_BLOCK_TYPES':
6152        return _objectSpread(_objectSpread({}, state), Object(external_lodash_["mapValues"])(Object(external_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
6153          return Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(blockType, ['styles'], [])), Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [blockType.name], []))), function (style) {
6154            return style.name;
6155          });
6156        }));
6157  
6158      case 'ADD_BLOCK_STYLES':
6159        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.styles)), function (style) {
6160          return style.name;
6161        })));
6162  
6163      case 'REMOVE_BLOCK_STYLES':
6164        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["filter"])(Object(external_lodash_["get"])(state, [action.blockName], []), function (style) {
6165          return action.styleNames.indexOf(style.name) === -1;
6166        })));
6167    }
6168  
6169    return state;
6170  }
6171  /**
6172   * Reducer managing the block variations.
6173   *
6174   * @param {Object} state  Current state.
6175   * @param {Object} action Dispatched action.
6176   *
6177   * @return {Object} Updated state.
6178   */
6179  
6180  function blockVariations() {
6181    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6182    var action = arguments.length > 1 ? arguments[1] : undefined;
6183  
6184    switch (action.type) {
6185      case 'ADD_BLOCK_TYPES':
6186        return _objectSpread(_objectSpread({}, state), Object(external_lodash_["mapValues"])(Object(external_lodash_["keyBy"])(action.blockTypes, 'name'), function (blockType) {
6187          return Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(blockType, ['variations'], [])), Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [blockType.name], []))), function (variation) {
6188            return variation.name;
6189          });
6190        }));
6191  
6192      case 'ADD_BLOCK_VARIATIONS':
6193        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["uniqBy"])([].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["get"])(state, [action.blockName], [])), Object(toConsumableArray["a" /* default */])(action.variations)), function (variation) {
6194          return variation.name;
6195        })));
6196  
6197      case 'REMOVE_BLOCK_VARIATIONS':
6198        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.blockName, Object(external_lodash_["filter"])(Object(external_lodash_["get"])(state, [action.blockName], []), function (variation) {
6199          return action.variationNames.indexOf(variation.name) === -1;
6200        })));
6201    }
6202  
6203    return state;
6204  }
6205  /**
6206   * Higher-order Reducer creating a reducer keeping track of given block name.
6207   *
6208   * @param {string} setActionType  Action type.
6209   *
6210   * @return {Function} Reducer.
6211   */
6212  
6213  function createBlockNameSetterReducer(setActionType) {
6214    return function () {
6215      var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
6216      var action = arguments.length > 1 ? arguments[1] : undefined;
6217  
6218      switch (action.type) {
6219        case 'REMOVE_BLOCK_TYPES':
6220          if (action.names.indexOf(state) !== -1) {
6221            return null;
6222          }
6223  
6224          return state;
6225  
6226        case setActionType:
6227          return action.name || null;
6228      }
6229  
6230      return state;
6231    };
6232  }
6233  var reducer_defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
6234  var freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
6235  var unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
6236  var groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
6237  /**
6238   * Reducer managing the categories
6239   *
6240   * @param {WPBlockCategory[]} state  Current state.
6241   * @param {Object}            action Dispatched action.
6242   *
6243   * @return {WPBlockCategory[]} Updated state.
6244   */
6245  
6246  function reducer_categories() {
6247    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CATEGORIES;
6248    var action = arguments.length > 1 ? arguments[1] : undefined;
6249  
6250    switch (action.type) {
6251      case 'SET_CATEGORIES':
6252        return action.categories || [];
6253  
6254      case 'UPDATE_CATEGORY':
6255        {
6256          if (!action.category || Object(external_lodash_["isEmpty"])(action.category)) {
6257            return state;
6258          }
6259  
6260          var categoryToChange = Object(external_lodash_["find"])(state, ['slug', action.slug]);
6261  
6262          if (categoryToChange) {
6263            return Object(external_lodash_["map"])(state, function (category) {
6264              if (category.slug === action.slug) {
6265                return _objectSpread(_objectSpread({}, category), action.category);
6266              }
6267  
6268              return category;
6269            });
6270          }
6271        }
6272    }
6273  
6274    return state;
6275  }
6276  function collections() {
6277    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6278    var action = arguments.length > 1 ? arguments[1] : undefined;
6279  
6280    switch (action.type) {
6281      case 'ADD_BLOCK_COLLECTION':
6282        return _objectSpread(_objectSpread({}, state), {}, Object(defineProperty["a" /* default */])({}, action.namespace, {
6283          title: action.title,
6284          icon: action.icon
6285        }));
6286  
6287      case 'REMOVE_BLOCK_COLLECTION':
6288        return Object(external_lodash_["omit"])(state, action.namespace);
6289    }
6290  
6291    return state;
6292  }
6293  /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
6294    blockTypes: reducer_blockTypes,
6295    blockStyles: blockStyles,
6296    blockVariations: blockVariations,
6297    defaultBlockName: reducer_defaultBlockName,
6298    freeformFallbackBlockName: freeformFallbackBlockName,
6299    unregisteredFallbackBlockName: unregisteredFallbackBlockName,
6300    groupingBlockName: groupingBlockName,
6301    categories: reducer_categories,
6302    collections: collections
6303  }));
6304  
6305  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
6306  var rememo = __webpack_require__(41);
6307  
6308  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
6309  
6310  
6311  
6312  function selectors_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; }
6313  
6314  function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6315  
6316  /**
6317   * External dependencies
6318   */
6319  
6320  
6321  /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
6322  
6323  /** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
6324  
6325  /** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
6326  
6327  /**
6328   * Given a block name or block type object, returns the corresponding
6329   * normalized block type object.
6330   *
6331   * @param {Object}          state      Blocks state.
6332   * @param {(string|Object)} nameOrType Block name or type object
6333   *
6334   * @return {Object} Block type object.
6335   */
6336  
6337  var getNormalizedBlockType = function getNormalizedBlockType(state, nameOrType) {
6338    return 'string' === typeof nameOrType ? getBlockType(state, nameOrType) : nameOrType;
6339  };
6340  /**
6341   * Returns all the available block types.
6342   *
6343   * @param {Object} state Data state.
6344   *
6345   * @return {Array} Block Types.
6346   */
6347  
6348  
6349  var getBlockTypes = Object(rememo["a" /* default */])(function (state) {
6350    return Object.values(state.blockTypes).map(function (blockType) {
6351      return selectors_objectSpread(selectors_objectSpread({}, blockType), {}, {
6352        variations: selectors_getBlockVariations(state, blockType.name)
6353      });
6354    });
6355  }, function (state) {
6356    return [state.blockTypes, state.blockVariations];
6357  });
6358  /**
6359   * Returns a block type by name.
6360   *
6361   * @param {Object} state Data state.
6362   * @param {string} name Block type name.
6363   *
6364   * @return {Object?} Block Type.
6365   */
6366  
6367  function getBlockType(state, name) {
6368    return state.blockTypes[name];
6369  }
6370  /**
6371   * Returns block styles by block name.
6372   *
6373   * @param {Object} state Data state.
6374   * @param {string} name  Block type name.
6375   *
6376   * @return {Array?} Block Styles.
6377   */
6378  
6379  function getBlockStyles(state, name) {
6380    return state.blockStyles[name];
6381  }
6382  /**
6383   * Returns block variations by block name.
6384   *
6385   * @param {Object}                state     Data state.
6386   * @param {string}                blockName Block type name.
6387   * @param {WPBlockVariationScope} [scope]   Block variation scope name.
6388   *
6389   * @return {(WPBlockVariation[]|void)} Block variations.
6390   */
6391  
6392  function selectors_getBlockVariations(state, blockName, scope) {
6393    var variations = state.blockVariations[blockName];
6394  
6395    if (!variations || !scope) {
6396      return variations;
6397    }
6398  
6399    return variations.filter(function (variation) {
6400      // For backward compatibility reasons, variation's scope defaults to `block` and `inserter` when not set.
6401      return (variation.scope || ['block', 'inserter']).includes(scope);
6402    });
6403  }
6404  /**
6405   * Returns the default block variation for the given block type.
6406   * When there are multiple variations annotated as the default one,
6407   * the last added item is picked. This simplifies registering overrides.
6408   * When there is no default variation set, it returns the first item.
6409   *
6410   * @param {Object}                state     Data state.
6411   * @param {string}                blockName Block type name.
6412   * @param {WPBlockVariationScope} [scope]   Block variation scope name.
6413   *
6414   * @return {?WPBlockVariation} The default block variation.
6415   */
6416  
6417  function getDefaultBlockVariation(state, blockName, scope) {
6418    var variations = selectors_getBlockVariations(state, blockName, scope);
6419    return Object(external_lodash_["findLast"])(variations, 'isDefault') || Object(external_lodash_["first"])(variations);
6420  }
6421  /**
6422   * Returns all the available categories.
6423   *
6424   * @param {Object} state Data state.
6425   *
6426   * @return {WPBlockCategory[]} Categories list.
6427   */
6428  
6429  function getCategories(state) {
6430    return state.categories;
6431  }
6432  /**
6433   * Returns all the available collections.
6434   *
6435   * @param {Object} state Data state.
6436   *
6437   * @return {Object} Collections list.
6438   */
6439  
6440  function getCollections(state) {
6441    return state.collections;
6442  }
6443  /**
6444   * Returns the name of the default block name.
6445   *
6446   * @param {Object} state Data state.
6447   *
6448   * @return {string?} Default block name.
6449   */
6450  
6451  function getDefaultBlockName(state) {
6452    return state.defaultBlockName;
6453  }
6454  /**
6455   * Returns the name of the block for handling non-block content.
6456   *
6457   * @param {Object} state Data state.
6458   *
6459   * @return {string?} Name of the block for handling non-block content.
6460   */
6461  
6462  function getFreeformFallbackBlockName(state) {
6463    return state.freeformFallbackBlockName;
6464  }
6465  /**
6466   * Returns the name of the block for handling unregistered blocks.
6467   *
6468   * @param {Object} state Data state.
6469   *
6470   * @return {string?} Name of the block for handling unregistered blocks.
6471   */
6472  
6473  function getUnregisteredFallbackBlockName(state) {
6474    return state.unregisteredFallbackBlockName;
6475  }
6476  /**
6477   * Returns the name of the block for handling unregistered blocks.
6478   *
6479   * @param {Object} state Data state.
6480   *
6481   * @return {string?} Name of the block for handling unregistered blocks.
6482   */
6483  
6484  function getGroupingBlockName(state) {
6485    return state.groupingBlockName;
6486  }
6487  /**
6488   * Returns an array with the child blocks of a given block.
6489   *
6490   * @param {Object} state     Data state.
6491   * @param {string} blockName Block type name.
6492   *
6493   * @return {Array} Array of child block names.
6494   */
6495  
6496  var selectors_getChildBlockNames = Object(rememo["a" /* default */])(function (state, blockName) {
6497    return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(state.blockTypes, function (blockType) {
6498      return Object(external_lodash_["includes"])(blockType.parent, blockName);
6499    }), function (_ref) {
6500      var name = _ref.name;
6501      return name;
6502    });
6503  }, function (state) {
6504    return [state.blockTypes];
6505  });
6506  /**
6507   * Returns the block support value for a feature, if defined.
6508   *
6509   * @param  {Object}          state           Data state.
6510   * @param  {(string|Object)} nameOrType      Block name or type object
6511   * @param  {string}          feature         Feature to retrieve
6512   * @param  {*}               defaultSupports Default value to return if not
6513   *                                           explicitly defined
6514   *
6515   * @return {?*} Block support value
6516   */
6517  
6518  var selectors_getBlockSupport = function getBlockSupport(state, nameOrType, feature, defaultSupports) {
6519    var blockType = getNormalizedBlockType(state, nameOrType);
6520    return Object(external_lodash_["get"])(blockType, ['supports'].concat(Object(toConsumableArray["a" /* default */])(feature.split('.'))), defaultSupports);
6521  };
6522  /**
6523   * Returns true if the block defines support for a feature, or false otherwise.
6524   *
6525   * @param  {Object}         state           Data state.
6526   * @param {(string|Object)} nameOrType      Block name or type object.
6527   * @param {string}          feature         Feature to test.
6528   * @param {boolean}         defaultSupports Whether feature is supported by
6529   *                                          default if not explicitly defined.
6530   *
6531   * @return {boolean} Whether block supports feature.
6532   */
6533  
6534  function hasBlockSupport(state, nameOrType, feature, defaultSupports) {
6535    return !!selectors_getBlockSupport(state, nameOrType, feature, defaultSupports);
6536  }
6537  /**
6538   * Returns true if the block type by the given name or object value matches a
6539   * search term, or false otherwise.
6540   *
6541   * @param {Object}          state      Blocks state.
6542   * @param {(string|Object)} nameOrType Block name or type object.
6543   * @param {string}          searchTerm Search term by which to filter.
6544   *
6545   * @return {Object[]} Whether block type matches search term.
6546   */
6547  
6548  function isMatchingSearchTerm(state, nameOrType, searchTerm) {
6549    var blockType = getNormalizedBlockType(state, nameOrType);
6550    var getNormalizedSearchTerm = Object(external_lodash_["flow"])([// Disregard diacritics.
6551    //  Input: "média"
6552    external_lodash_["deburr"], // Lowercase.
6553    //  Input: "MEDIA"
6554    function (term) {
6555      return term.toLowerCase();
6556    }, // Strip leading and trailing whitespace.
6557    //  Input: " media "
6558    function (term) {
6559      return term.trim();
6560    }]);
6561    var normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
6562    var isSearchMatch = Object(external_lodash_["flow"])([getNormalizedSearchTerm, function (normalizedCandidate) {
6563      return Object(external_lodash_["includes"])(normalizedCandidate, normalizedSearchTerm);
6564    }]);
6565    return isSearchMatch(blockType.title) || Object(external_lodash_["some"])(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category);
6566  }
6567  /**
6568   * Returns a boolean indicating if a block has child blocks or not.
6569   *
6570   * @param {Object} state     Data state.
6571   * @param {string} blockName Block type name.
6572   *
6573   * @return {boolean} True if a block contains child blocks and false otherwise.
6574   */
6575  
6576  var selectors_hasChildBlocks = function hasChildBlocks(state, blockName) {
6577    return selectors_getChildBlockNames(state, blockName).length > 0;
6578  };
6579  /**
6580   * Returns a boolean indicating if a block has at least one child block with inserter support.
6581   *
6582   * @param {Object} state     Data state.
6583   * @param {string} blockName Block type name.
6584   *
6585   * @return {boolean} True if a block contains at least one child blocks with inserter support
6586   *                   and false otherwise.
6587   */
6588  
6589  var selectors_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(state, blockName) {
6590    return Object(external_lodash_["some"])(selectors_getChildBlockNames(state, blockName), function (childBlockName) {
6591      return hasBlockSupport(state, childBlockName, 'inserter', true);
6592    });
6593  };
6594  
6595  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js
6596  /**
6597   * External dependencies
6598   */
6599  
6600  /** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
6601  
6602  /**
6603   * Returns an action object used in signalling that block types have been added.
6604   *
6605   * @param {Array|Object} blockTypes Block types received.
6606   *
6607   * @return {Object} Action object.
6608   */
6609  
6610  function addBlockTypes(blockTypes) {
6611    return {
6612      type: 'ADD_BLOCK_TYPES',
6613      blockTypes: Object(external_lodash_["castArray"])(blockTypes)
6614    };
6615  }
6616  /**
6617   * Returns an action object used to remove a registered block type.
6618   *
6619   * @param {string|Array} names Block name.
6620   *
6621   * @return {Object} Action object.
6622   */
6623  
6624  function removeBlockTypes(names) {
6625    return {
6626      type: 'REMOVE_BLOCK_TYPES',
6627      names: Object(external_lodash_["castArray"])(names)
6628    };
6629  }
6630  /**
6631   * Returns an action object used in signalling that new block styles have been added.
6632   *
6633   * @param {string}       blockName  Block name.
6634   * @param {Array|Object} styles     Block styles.
6635   *
6636   * @return {Object} Action object.
6637   */
6638  
6639  function addBlockStyles(blockName, styles) {
6640    return {
6641      type: 'ADD_BLOCK_STYLES',
6642      styles: Object(external_lodash_["castArray"])(styles),
6643      blockName: blockName
6644    };
6645  }
6646  /**
6647   * Returns an action object used in signalling that block styles have been removed.
6648   *
6649   * @param {string}       blockName  Block name.
6650   * @param {Array|string} styleNames Block style names.
6651   *
6652   * @return {Object} Action object.
6653   */
6654  
6655  function removeBlockStyles(blockName, styleNames) {
6656    return {
6657      type: 'REMOVE_BLOCK_STYLES',
6658      styleNames: Object(external_lodash_["castArray"])(styleNames),
6659      blockName: blockName
6660    };
6661  }
6662  /**
6663   * Returns an action object used in signalling that new block variations have been added.
6664   *
6665   * @param {string}                              blockName  Block name.
6666   * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations.
6667   *
6668   * @return {Object} Action object.
6669   */
6670  
6671  function addBlockVariations(blockName, variations) {
6672    return {
6673      type: 'ADD_BLOCK_VARIATIONS',
6674      variations: Object(external_lodash_["castArray"])(variations),
6675      blockName: blockName
6676    };
6677  }
6678  /**
6679   * Returns an action object used in signalling that block variations have been removed.
6680   *
6681   * @param {string}          blockName      Block name.
6682   * @param {string|string[]} variationNames Block variation names.
6683   *
6684   * @return {Object} Action object.
6685   */
6686  
6687  function removeBlockVariations(blockName, variationNames) {
6688    return {
6689      type: 'REMOVE_BLOCK_VARIATIONS',
6690      variationNames: Object(external_lodash_["castArray"])(variationNames),
6691      blockName: blockName
6692    };
6693  }
6694  /**
6695   * Returns an action object used to set the default block name.
6696   *
6697   * @param {string} name Block name.
6698   *
6699   * @return {Object} Action object.
6700   */
6701  
6702  function setDefaultBlockName(name) {
6703    return {
6704      type: 'SET_DEFAULT_BLOCK_NAME',
6705      name: name
6706    };
6707  }
6708  /**
6709   * Returns an action object used to set the name of the block used as a fallback
6710   * for non-block content.
6711   *
6712   * @param {string} name Block name.
6713   *
6714   * @return {Object} Action object.
6715   */
6716  
6717  function setFreeformFallbackBlockName(name) {
6718    return {
6719      type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME',
6720      name: name
6721    };
6722  }
6723  /**
6724   * Returns an action object used to set the name of the block used as a fallback
6725   * for unregistered blocks.
6726   *
6727   * @param {string} name Block name.
6728   *
6729   * @return {Object} Action object.
6730   */
6731  
6732  function setUnregisteredFallbackBlockName(name) {
6733    return {
6734      type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME',
6735      name: name
6736    };
6737  }
6738  /**
6739   * Returns an action object used to set the name of the block used
6740   * when grouping other blocks
6741   * eg: in "Group/Ungroup" interactions
6742   *
6743   * @param {string} name Block name.
6744   *
6745   * @return {Object} Action object.
6746   */
6747  
6748  function setGroupingBlockName(name) {
6749    return {
6750      type: 'SET_GROUPING_BLOCK_NAME',
6751      name: name
6752    };
6753  }
6754  /**
6755   * Returns an action object used to set block categories.
6756   *
6757   * @param {Object[]} categories Block categories.
6758   *
6759   * @return {Object} Action object.
6760   */
6761  
6762  function setCategories(categories) {
6763    return {
6764      type: 'SET_CATEGORIES',
6765      categories: categories
6766    };
6767  }
6768  /**
6769   * Returns an action object used to update a category.
6770   *
6771   * @param {string} slug     Block category slug.
6772   * @param {Object} category Object containing the category properties that should be updated.
6773   *
6774   * @return {Object} Action object.
6775   */
6776  
6777  function updateCategory(slug, category) {
6778    return {
6779      type: 'UPDATE_CATEGORY',
6780      slug: slug,
6781      category: category
6782    };
6783  }
6784  /**
6785   * Returns an action object used to add block collections
6786   *
6787   * @param {string} namespace       The namespace of the blocks to put in the collection
6788   * @param {string} title           The title to display in the block inserter
6789   * @param {Object} icon (optional) The icon to display in the block inserter
6790   *
6791   * @return {Object} Action object.
6792   */
6793  
6794  function addBlockCollection(namespace, title, icon) {
6795    return {
6796      type: 'ADD_BLOCK_COLLECTION',
6797      namespace: namespace,
6798      title: title,
6799      icon: icon
6800    };
6801  }
6802  /**
6803   * Returns an action object used to remove block collections
6804   *
6805   * @param {string} namespace       The namespace of the blocks to put in the collection
6806   *
6807   * @return {Object} Action object.
6808   */
6809  
6810  function removeBlockCollection(namespace) {
6811    return {
6812      type: 'REMOVE_BLOCK_COLLECTION',
6813      namespace: namespace
6814    };
6815  }
6816  
6817  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/constants.js
6818  var STORE_NAME = 'core/blocks';
6819  
6820  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
6821  /**
6822   * WordPress dependencies
6823   */
6824  
6825  /**
6826   * Internal dependencies
6827   */
6828  
6829  
6830  
6831  
6832  
6833  /**
6834   * Store definition for the blocks namespace.
6835   *
6836   * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
6837   *
6838   * @type {Object}
6839   */
6840  
6841  var store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
6842    reducer: reducer,
6843    selectors: selectors_namespaceObject,
6844    actions: actions_namespaceObject
6845  });
6846  Object(external_wp_data_["register"])(store);
6847  
6848  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
6849  var slicedToArray = __webpack_require__(11);
6850  
6851  // EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
6852  var v4 = __webpack_require__(204);
6853  
6854  // EXTERNAL MODULE: external ["wp","hooks"]
6855  var external_wp_hooks_ = __webpack_require__(33);
6856  
6857  // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
6858  var block_default = __webpack_require__(215);
6859  
6860  // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
6861  var tinycolor = __webpack_require__(60);
6862  var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
6863  
6864  // EXTERNAL MODULE: external ["wp","element"]
6865  var external_wp_element_ = __webpack_require__(0);
6866  
6867  // EXTERNAL MODULE: external ["wp","dom"]
6868  var external_wp_dom_ = __webpack_require__(27);
6869  
6870  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js
6871  
6872  
6873  function utils_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; }
6874  
6875  function utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { utils_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6876  
6877  /**
6878   * External dependencies
6879   */
6880  
6881  
6882  /**
6883   * WordPress dependencies
6884   */
6885  
6886  
6887  
6888  
6889  
6890  /**
6891   * Internal dependencies
6892   */
6893  
6894  
6895  
6896  /**
6897   * Array of icon colors containing a color to be used if the icon color
6898   * was not explicitly set but the icon background color was.
6899   *
6900   * @type {Object}
6901   */
6902  
6903  var ICON_COLORS = ['#191e23', '#f8f9f9'];
6904  /**
6905   * Determines whether the block is a default block
6906   * and its attributes are equal to the default attributes
6907   * which means the block is unmodified.
6908   *
6909   * @param  {WPBlock} block Block Object
6910   *
6911   * @return {boolean}       Whether the block is an unmodified default block
6912   */
6913  
6914  function isUnmodifiedDefaultBlock(block) {
6915    var defaultBlockName = registration_getDefaultBlockName();
6916  
6917    if (block.name !== defaultBlockName) {
6918      return false;
6919    } // Cache a created default block if no cache exists or the default block
6920    // name changed.
6921  
6922  
6923    if (!isUnmodifiedDefaultBlock.block || isUnmodifiedDefaultBlock.block.name !== defaultBlockName) {
6924      isUnmodifiedDefaultBlock.block = createBlock(defaultBlockName);
6925    }
6926  
6927    var newDefaultBlock = isUnmodifiedDefaultBlock.block;
6928    var blockType = registration_getBlockType(defaultBlockName);
6929    return Object(external_lodash_["every"])(blockType.attributes, function (value, key) {
6930      return newDefaultBlock.attributes[key] === block.attributes[key];
6931    });
6932  }
6933  /**
6934   * Function that checks if the parameter is a valid icon.
6935   *
6936   * @param {*} icon  Parameter to be checked.
6937   *
6938   * @return {boolean} True if the parameter is a valid icon and false otherwise.
6939   */
6940  
6941  function isValidIcon(icon) {
6942    return !!icon && (Object(external_lodash_["isString"])(icon) || Object(external_wp_element_["isValidElement"])(icon) || Object(external_lodash_["isFunction"])(icon) || icon instanceof external_wp_element_["Component"]);
6943  }
6944  /**
6945   * Function that receives an icon as set by the blocks during the registration
6946   * and returns a new icon object that is normalized so we can rely on just on possible icon structure
6947   * in the codebase.
6948   *
6949   * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
6950   *                                     one of a Dashicon slug, an element, or a
6951   *                                     component.
6952   *
6953   * @return {WPBlockTypeIconDescriptor} Object describing the icon.
6954   */
6955  
6956  function normalizeIconObject(icon) {
6957    if (isValidIcon(icon)) {
6958      return {
6959        src: icon
6960      };
6961    }
6962  
6963    if (Object(external_lodash_["has"])(icon, ['background'])) {
6964      var tinyBgColor = tinycolor_default()(icon.background);
6965      return utils_objectSpread(utils_objectSpread({}, icon), {}, {
6966        foreground: icon.foreground ? icon.foreground : Object(tinycolor["mostReadable"])(tinyBgColor, ICON_COLORS, {
6967          includeFallbackColors: true,
6968          level: 'AA',
6969          size: 'large'
6970        }).toHexString(),
6971        shadowColor: tinyBgColor.setAlpha(0.3).toRgbString()
6972      });
6973    }
6974  
6975    return icon;
6976  }
6977  /**
6978   * Normalizes block type passed as param. When string is passed then
6979   * it converts it to the matching block type object.
6980   * It passes the original object otherwise.
6981   *
6982   * @param {string|Object} blockTypeOrName  Block type or name.
6983   *
6984   * @return {?Object} Block type.
6985   */
6986  
6987  function normalizeBlockType(blockTypeOrName) {
6988    if (Object(external_lodash_["isString"])(blockTypeOrName)) {
6989      return registration_getBlockType(blockTypeOrName);
6990    }
6991  
6992    return blockTypeOrName;
6993  }
6994  /**
6995   * Get the label for the block, usually this is either the block title,
6996   * or the value of the block's `label` function when that's specified.
6997   *
6998   * @param {Object} blockType  The block type.
6999   * @param {Object} attributes The values of the block's attributes.
7000   * @param {Object} context    The intended use for the label.
7001   *
7002   * @return {string} The block label.
7003   */
7004  
7005  function getBlockLabel(blockType, attributes) {
7006    var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'visual';
7007  
7008    // Attempt to find entity title if block is a template part.
7009    // Require slug to request, otherwise entity is uncreated and will throw 404.
7010    if ('core/template-part' === blockType.name && attributes.slug) {
7011      var entity = Object(external_wp_data_["select"])('core').getEntityRecord('postType', 'wp_template_part', attributes.theme + '//' + attributes.slug);
7012  
7013      if (entity) {
7014        var _entity$title;
7015  
7016        return Object(external_lodash_["startCase"])(((_entity$title = entity.title) === null || _entity$title === void 0 ? void 0 : _entity$title.rendered) || entity.slug);
7017      }
7018    }
7019  
7020    var getLabel = blockType.__experimentalLabel,
7021        title = blockType.title;
7022    var label = getLabel && getLabel(attributes, {
7023      context: context
7024    });
7025  
7026    if (!label) {
7027      return title;
7028    } // Strip any HTML (i.e. RichText formatting) before returning.
7029  
7030  
7031    return Object(external_wp_dom_["__unstableStripHTML"])(label);
7032  }
7033  /**
7034   * Get a label for the block for use by screenreaders, this is more descriptive
7035   * than the visual label and includes the block title and the value of the
7036   * `getLabel` function if it's specified.
7037   *
7038   * @param {Object}  blockType              The block type.
7039   * @param {Object}  attributes             The values of the block's attributes.
7040   * @param {?number} position               The position of the block in the block list.
7041   * @param {string}  [direction='vertical'] The direction of the block layout.
7042   *
7043   * @return {string} The block label.
7044   */
7045  
7046  function getAccessibleBlockLabel(blockType, attributes, position) {
7047    var direction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vertical';
7048    // `title` is already localized, `label` is a user-supplied value.
7049    var title = blockType.title;
7050    var label = getBlockLabel(blockType, attributes, 'accessibility');
7051    var hasPosition = position !== undefined; // getBlockLabel returns the block title as a fallback when there's no label,
7052    // if it did return the title, this function needs to avoid adding the
7053    // title twice within the accessible label. Use this `hasLabel` boolean to
7054    // handle that.
7055  
7056    var hasLabel = label && label !== title;
7057  
7058    if (hasPosition && direction === 'vertical') {
7059      if (hasLabel) {
7060        return Object(external_wp_i18n_["sprintf"])(
7061        /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
7062        Object(external_wp_i18n_["__"])('%1$s Block. Row %2$d. %3$s'), title, position, label);
7063      }
7064  
7065      return Object(external_wp_i18n_["sprintf"])(
7066      /* translators: accessibility text. 1: The block title. 2: The block row number. */
7067      Object(external_wp_i18n_["__"])('%1$s Block. Row %2$d'), title, position);
7068    } else if (hasPosition && direction === 'horizontal') {
7069      if (hasLabel) {
7070        return Object(external_wp_i18n_["sprintf"])(
7071        /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
7072        Object(external_wp_i18n_["__"])('%1$s Block. Column %2$d. %3$s'), title, position, label);
7073      }
7074  
7075      return Object(external_wp_i18n_["sprintf"])(
7076      /* translators: accessibility text. 1: The block title. 2: The block column number. */
7077      Object(external_wp_i18n_["__"])('%1$s Block. Column %2$d'), title, position);
7078    }
7079  
7080    if (hasLabel) {
7081      return Object(external_wp_i18n_["sprintf"])(
7082      /* translators: accessibility text. %1: The block title. %2: The block label. */
7083      Object(external_wp_i18n_["__"])('%1$s Block. %2$s'), title, label);
7084    }
7085  
7086    return Object(external_wp_i18n_["sprintf"])(
7087    /* translators: accessibility text. %s: The block title. */
7088    Object(external_wp_i18n_["__"])('%s Block'), title);
7089  }
7090  /**
7091   * Ensure attributes contains only values defined by block type, and merge
7092   * default values for missing attributes.
7093   *
7094   * @param {string} name       The block's name.
7095   * @param {Object} attributes The block's attributes.
7096   * @return {Object} The sanitized attributes.
7097   */
7098  
7099  function sanitizeBlockAttributes(name, attributes) {
7100    // Get the type definition associated with a registered block.
7101    var blockType = registration_getBlockType(name);
7102  
7103    if (undefined === blockType) {
7104      throw new Error("Block type '".concat(name, "' is not registered."));
7105    }
7106  
7107    return Object(external_lodash_["reduce"])(blockType.attributes, function (accumulator, schema, key) {
7108      var value = attributes[key];
7109  
7110      if (undefined !== value) {
7111        accumulator[key] = value;
7112      } else if (schema.hasOwnProperty('default')) {
7113        accumulator[key] = schema.default;
7114      }
7115  
7116      if (['node', 'children'].indexOf(schema.source) !== -1) {
7117        // Ensure value passed is always an array, which we're expecting in
7118        // the RichText component to handle the deprecated value.
7119        if (typeof accumulator[key] === 'string') {
7120          accumulator[key] = [accumulator[key]];
7121        } else if (!Array.isArray(accumulator[key])) {
7122          accumulator[key] = [];
7123        }
7124      }
7125  
7126      return accumulator;
7127    }, {});
7128  }
7129  
7130  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js
7131  /**
7132   * Array of valid keys in a block type settings deprecation object.
7133   *
7134   * @type {string[]}
7135   */
7136  var DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible', 'apiVersion'];
7137  var __EXPERIMENTAL_STYLE_PROPERTY = {
7138    '--wp--style--color--link': {
7139      value: ['color', 'link'],
7140      support: ['color', 'link']
7141    },
7142    background: {
7143      value: ['color', 'gradient'],
7144      support: ['color', 'gradients']
7145    },
7146    backgroundColor: {
7147      value: ['color', 'background'],
7148      support: ['color']
7149    },
7150    borderRadius: {
7151      value: ['border', 'radius'],
7152      support: ['__experimentalBorder', 'radius']
7153    },
7154    color: {
7155      value: ['color', 'text'],
7156      support: ['color']
7157    },
7158    fontFamily: {
7159      value: ['typography', 'fontFamily'],
7160      support: ['__experimentalFontFamily']
7161    },
7162    fontSize: {
7163      value: ['typography', 'fontSize'],
7164      support: ['fontSize']
7165    },
7166    fontStyle: {
7167      value: ['typography', 'fontStyle'],
7168      support: ['__experimentalFontStyle']
7169    },
7170    fontWeight: {
7171      value: ['typography', 'fontWeight'],
7172      support: ['__experimentalFontWeight']
7173    },
7174    lineHeight: {
7175      value: ['typography', 'lineHeight'],
7176      support: ['lineHeight']
7177    },
7178    padding: {
7179      value: ['spacing', 'padding'],
7180      support: ['spacing', 'padding'],
7181      properties: ['top', 'right', 'bottom', 'left']
7182    },
7183    textDecoration: {
7184      value: ['typography', 'textDecoration'],
7185      support: ['__experimentalTextDecoration']
7186    },
7187    textTransform: {
7188      value: ['typography', 'textTransform'],
7189      support: ['__experimentalTextTransform']
7190    }
7191  };
7192  
7193  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js
7194  
7195  
7196  function registration_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; }
7197  
7198  function registration_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { registration_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { registration_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7199  
7200  /* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
7201  
7202  /**
7203   * External dependencies
7204   */
7205  
7206  /**
7207   * WordPress dependencies
7208   */
7209  
7210  
7211  
7212  
7213  /**
7214   * Internal dependencies
7215   */
7216  
7217  
7218  
7219  
7220  /**
7221   * An icon type definition. One of a Dashicon slug, an element,
7222   * or a component.
7223   *
7224   * @typedef {(string|WPElement|WPComponent)} WPIcon
7225   *
7226   * @see https://developer.wordpress.org/resource/dashicons/
7227   */
7228  
7229  /**
7230   * Render behavior of a block type icon; one of a Dashicon slug, an element,
7231   * or a component.
7232   *
7233   * @typedef {WPIcon} WPBlockTypeIconRender
7234   */
7235  
7236  /**
7237   * An object describing a normalized block type icon.
7238   *
7239   * @typedef {Object} WPBlockTypeIconDescriptor
7240   *
7241   * @property {WPBlockTypeIconRender} src         Render behavior of the icon,
7242   *                                               one of a Dashicon slug, an
7243   *                                               element, or a component.
7244   * @property {string}                background  Optimal background hex string
7245   *                                               color when displaying icon.
7246   * @property {string}                foreground  Optimal foreground hex string
7247   *                                               color when displaying icon.
7248   * @property {string}                shadowColor Optimal shadow hex string
7249   *                                               color when displaying icon.
7250   */
7251  
7252  /**
7253   * Value to use to render the icon for a block type in an editor interface,
7254   * either a Dashicon slug, an element, a component, or an object describing
7255   * the icon.
7256   *
7257   * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon
7258   */
7259  
7260  /**
7261   * Named block variation scopes.
7262   *
7263   * @typedef {'block'|'inserter'|'transform'} WPBlockVariationScope
7264   */
7265  
7266  /**
7267   * An object describing a variation defined for the block type.
7268   *
7269   * @typedef {Object} WPBlockVariation
7270   *
7271   * @property {string}   name                   The unique and machine-readable name.
7272   * @property {string}   title                  A human-readable variation title.
7273   * @property {string}   [description]          A detailed variation description.
7274   * @property {string}   [category]             Block type category classification,
7275   *                                             used in search interfaces to arrange
7276   *                                             block types by category.
7277   * @property {WPIcon}   [icon]                 An icon helping to visualize the variation.
7278   * @property {boolean}  [isDefault]            Indicates whether the current variation is
7279   *                                             the default one. Defaults to `false`.
7280   * @property {Object}   [attributes]           Values which override block attributes.
7281   * @property {Array[]}  [innerBlocks]          Initial configuration of nested blocks.
7282   * @property {Object}   [example]              Example provides structured data for
7283   *                                             the block preview. You can set to
7284   *                                             `undefined` to disable the preview shown
7285   *                                             for the block type.
7286   * @property {WPBlockVariationScope[]} [scope] The list of scopes where the variation
7287   *                                             is applicable. When not provided, it
7288   *                                             assumes all available scopes.
7289   * @property {string[]} [keywords]             An array of terms (which can be translated)
7290   *                                             that help users discover the variation
7291   *                                             while searching.
7292   * @property {Function} [isActive]             A function that accepts a block's attributes
7293   *                                             and the variation's attributes and determines
7294   *                                             if a variation is active. This function doesn't
7295   *                                             try to find a match dynamically based on all
7296   *                                             block's attributes, as in many cases some
7297   *                                             attributes are irrelevant. An example would
7298   *                                             be for `embed` block where we only care about
7299   *                                             `providerNameSlug` attribute's value.
7300   */
7301  
7302  /**
7303   * Defined behavior of a block type.
7304   *
7305   * @typedef {Object} WPBlock
7306   *
7307   * @property {string}             name          Block type's namespaced name.
7308   * @property {string}             title         Human-readable block type label.
7309   * @property {string}             [description] A detailed block type description.
7310   * @property {string}             [category]    Block type category classification,
7311   *                                              used in search interfaces to arrange
7312   *                                              block types by category.
7313   * @property {WPBlockTypeIcon}    [icon]        Block type icon.
7314   * @property {string[]}           [keywords]    Additional keywords to produce block
7315   *                                              type as result in search interfaces.
7316   * @property {Object}             [attributes]  Block type attributes.
7317   * @property {WPComponent}        [save]        Optional component describing
7318   *                                              serialized markup structure of a
7319   *                                              block type.
7320   * @property {WPComponent}        edit          Component rendering an element to
7321   *                                              manipulate the attributes of a block
7322   *                                              in the context of an editor.
7323   * @property {WPBlockVariation[]} [variations]  The list of block variations.
7324   * @property {Object}             [example]     Example provides structured data for
7325   *                                              the block preview. When not defined
7326   *                                              then no preview is shown.
7327   */
7328  
7329  /**
7330   * Mapping of legacy category slugs to their latest normal values, used to
7331   * accommodate updates of the default set of block categories.
7332   *
7333   * @type {Record<string,string>}
7334   */
7335  
7336  var LEGACY_CATEGORY_MAPPING = {
7337    common: 'text',
7338    formatting: 'text',
7339    layout: 'design'
7340  };
7341  var serverSideBlockDefinitions = {};
7342  /**
7343   * Sets the server side block definition of blocks.
7344   *
7345   * @param {Object} definitions Server-side block definitions
7346   */
7347  // eslint-disable-next-line camelcase
7348  
7349  function unstable__bootstrapServerSideBlockDefinitions(definitions) {
7350    for (var _i = 0, _Object$keys = Object.keys(definitions); _i < _Object$keys.length; _i++) {
7351      var blockName = _Object$keys[_i];
7352  
7353      // Don't overwrite if already set. It covers the case when metadata
7354      // was initialized from the server.
7355      if (serverSideBlockDefinitions[blockName]) {
7356        continue;
7357      }
7358  
7359      serverSideBlockDefinitions[blockName] = Object(external_lodash_["mapKeys"])(Object(external_lodash_["pickBy"])(definitions[blockName], function (value) {
7360        return !Object(external_lodash_["isNil"])(value);
7361      }), function (value, key) {
7362        return Object(external_lodash_["camelCase"])(key);
7363      });
7364    }
7365  }
7366  /**
7367   * Registers a new block provided a unique name and an object defining its
7368   * behavior. Once registered, the block is made available as an option to any
7369   * editor interface where blocks are implemented.
7370   *
7371   * @param {string} name     Block name.
7372   * @param {Object} settings Block settings.
7373   *
7374   * @return {?WPBlock} The block, if it has been successfully registered;
7375   *                    otherwise `undefined`.
7376   */
7377  
7378  function registerBlockType(name, settings) {
7379    settings = registration_objectSpread(registration_objectSpread({
7380      name: name,
7381      icon: block_default["a" /* default */],
7382      keywords: [],
7383      attributes: {},
7384      providesContext: {},
7385      usesContext: [],
7386      supports: {},
7387      styles: [],
7388      save: function save() {
7389        return null;
7390      }
7391    }, serverSideBlockDefinitions === null || serverSideBlockDefinitions === void 0 ? void 0 : serverSideBlockDefinitions[name]), settings);
7392  
7393    if (typeof name !== 'string') {
7394      console.error('Block names must be strings.');
7395      return;
7396    }
7397  
7398    if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
7399      console.error('Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block');
7400      return;
7401    }
7402  
7403    if (Object(external_wp_data_["select"])(store).getBlockType(name)) {
7404      console.error('Block "' + name + '" is already registered.');
7405      return;
7406    }
7407  
7408    var preFilterSettings = registration_objectSpread({}, settings);
7409  
7410    settings = Object(external_wp_hooks_["applyFilters"])('blocks.registerBlockType', settings, name);
7411  
7412    if (settings.deprecated) {
7413      settings.deprecated = settings.deprecated.map(function (deprecation) {
7414        return Object(external_lodash_["pick"])( // Only keep valid deprecation keys.
7415        Object(external_wp_hooks_["applyFilters"])('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings
7416        // so that filters that depend on specific keys being
7417        // present don't fail.
7418        registration_objectSpread(registration_objectSpread({}, Object(external_lodash_["omit"])(preFilterSettings, DEPRECATED_ENTRY_KEYS)), deprecation), name), DEPRECATED_ENTRY_KEYS);
7419      });
7420    }
7421  
7422    if (!Object(external_lodash_["isPlainObject"])(settings)) {
7423      console.error('Block settings must be a valid object.');
7424      return;
7425    }
7426  
7427    if (!Object(external_lodash_["isFunction"])(settings.save)) {
7428      console.error('The "save" property must be a valid function.');
7429      return;
7430    }
7431  
7432    if ('edit' in settings && !Object(external_lodash_["isFunction"])(settings.edit)) {
7433      console.error('The "edit" property must be a valid function.');
7434      return;
7435    } // Canonicalize legacy categories to equivalent fallback.
7436  
7437  
7438    if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
7439      settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
7440    }
7441  
7442    if ('category' in settings && !Object(external_lodash_["some"])(Object(external_wp_data_["select"])(store).getCategories(), {
7443      slug: settings.category
7444    })) {
7445      console.warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".');
7446      delete settings.category;
7447    }
7448  
7449    if (!('title' in settings) || settings.title === '') {
7450      console.error('The block "' + name + '" must have a title.');
7451      return;
7452    }
7453  
7454    if (typeof settings.title !== 'string') {
7455      console.error('Block titles must be strings.');
7456      return;
7457    }
7458  
7459    settings.icon = normalizeIconObject(settings.icon);
7460  
7461    if (!isValidIcon(settings.icon.src)) {
7462      console.error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional');
7463      return;
7464    }
7465  
7466    Object(external_wp_data_["dispatch"])(store).addBlockTypes(settings);
7467    return settings;
7468  }
7469  /**
7470   * Registers a new block collection to group blocks in the same namespace in the inserter.
7471   *
7472   * @param {string} namespace       The namespace to group blocks by in the inserter; corresponds to the block namespace.
7473   * @param {Object} settings        The block collection settings.
7474   * @param {string} settings.title  The title to display in the block inserter.
7475   * @param {Object} [settings.icon] The icon to display in the block inserter.
7476   */
7477  
7478  function registerBlockCollection(namespace, _ref) {
7479    var title = _ref.title,
7480        icon = _ref.icon;
7481    Object(external_wp_data_["dispatch"])(store).addBlockCollection(namespace, title, icon);
7482  }
7483  /**
7484   * Unregisters a block collection
7485   *
7486   * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
7487   *
7488   */
7489  
7490  function unregisterBlockCollection(namespace) {
7491    Object(external_wp_data_["dispatch"])(store).removeBlockCollection(namespace);
7492  }
7493  /**
7494   * Unregisters a block.
7495   *
7496   * @param {string} name Block name.
7497   *
7498   * @return {?WPBlock} The previous block value, if it has been successfully
7499   *                    unregistered; otherwise `undefined`.
7500   */
7501  
7502  function unregisterBlockType(name) {
7503    var oldBlock = Object(external_wp_data_["select"])(store).getBlockType(name);
7504  
7505    if (!oldBlock) {
7506      console.error('Block "' + name + '" is not registered.');
7507      return;
7508    }
7509  
7510    Object(external_wp_data_["dispatch"])(store).removeBlockTypes(name);
7511    return oldBlock;
7512  }
7513  /**
7514   * Assigns name of block for handling non-block content.
7515   *
7516   * @param {string} blockName Block name.
7517   */
7518  
7519  function setFreeformContentHandlerName(blockName) {
7520    Object(external_wp_data_["dispatch"])(store).setFreeformFallbackBlockName(blockName);
7521  }
7522  /**
7523   * Retrieves name of block handling non-block content, or undefined if no
7524   * handler has been defined.
7525   *
7526   * @return {?string} Block name.
7527   */
7528  
7529  function getFreeformContentHandlerName() {
7530    return Object(external_wp_data_["select"])(store).getFreeformFallbackBlockName();
7531  }
7532  /**
7533   * Retrieves name of block used for handling grouping interactions.
7534   *
7535   * @return {?string} Block name.
7536   */
7537  
7538  function registration_getGroupingBlockName() {
7539    return Object(external_wp_data_["select"])(store).getGroupingBlockName();
7540  }
7541  /**
7542   * Assigns name of block handling unregistered block types.
7543   *
7544   * @param {string} blockName Block name.
7545   */
7546  
7547  function setUnregisteredTypeHandlerName(blockName) {
7548    Object(external_wp_data_["dispatch"])(store).setUnregisteredFallbackBlockName(blockName);
7549  }
7550  /**
7551   * Retrieves name of block handling unregistered block types, or undefined if no
7552   * handler has been defined.
7553   *
7554   * @return {?string} Block name.
7555   */
7556  
7557  function getUnregisteredTypeHandlerName() {
7558    return Object(external_wp_data_["select"])(store).getUnregisteredFallbackBlockName();
7559  }
7560  /**
7561   * Assigns the default block name.
7562   *
7563   * @param {string} name Block name.
7564   */
7565  
7566  function registration_setDefaultBlockName(name) {
7567    Object(external_wp_data_["dispatch"])(store).setDefaultBlockName(name);
7568  }
7569  /**
7570   * Assigns name of block for handling block grouping interactions.
7571   *
7572   * @param {string} name Block name.
7573   */
7574  
7575  function registration_setGroupingBlockName(name) {
7576    Object(external_wp_data_["dispatch"])(store).setGroupingBlockName(name);
7577  }
7578  /**
7579   * Retrieves the default block name.
7580   *
7581   * @return {?string} Block name.
7582   */
7583  
7584  function registration_getDefaultBlockName() {
7585    return Object(external_wp_data_["select"])(store).getDefaultBlockName();
7586  }
7587  /**
7588   * Returns a registered block type.
7589   *
7590   * @param {string} name Block name.
7591   *
7592   * @return {?Object} Block type.
7593   */
7594  
7595  function registration_getBlockType(name) {
7596    return Object(external_wp_data_["select"])(store).getBlockType(name);
7597  }
7598  /**
7599   * Returns all registered blocks.
7600   *
7601   * @return {Array} Block settings.
7602   */
7603  
7604  function registration_getBlockTypes() {
7605    return Object(external_wp_data_["select"])(store).getBlockTypes();
7606  }
7607  /**
7608   * Returns the block support value for a feature, if defined.
7609   *
7610   * @param  {(string|Object)} nameOrType      Block name or type object
7611   * @param  {string}          feature         Feature to retrieve
7612   * @param  {*}               defaultSupports Default value to return if not
7613   *                                           explicitly defined
7614   *
7615   * @return {?*} Block support value
7616   */
7617  
7618  function registration_getBlockSupport(nameOrType, feature, defaultSupports) {
7619    return Object(external_wp_data_["select"])(store).getBlockSupport(nameOrType, feature, defaultSupports);
7620  }
7621  /**
7622   * Returns true if the block defines support for a feature, or false otherwise.
7623   *
7624   * @param {(string|Object)} nameOrType      Block name or type object.
7625   * @param {string}          feature         Feature to test.
7626   * @param {boolean}         defaultSupports Whether feature is supported by
7627   *                                          default if not explicitly defined.
7628   *
7629   * @return {boolean} Whether block supports feature.
7630   */
7631  
7632  function registration_hasBlockSupport(nameOrType, feature, defaultSupports) {
7633    return Object(external_wp_data_["select"])(store).hasBlockSupport(nameOrType, feature, defaultSupports);
7634  }
7635  /**
7636   * Determines whether or not the given block is a reusable block. This is a
7637   * special block type that is used to point to a global block stored via the
7638   * API.
7639   *
7640   * @param {Object} blockOrType Block or Block Type to test.
7641   *
7642   * @return {boolean} Whether the given block is a reusable block.
7643   */
7644  
7645  function isReusableBlock(blockOrType) {
7646    return blockOrType.name === 'core/block';
7647  }
7648  /**
7649   * Returns an array with the child blocks of a given block.
7650   *
7651   * @param {string} blockName Name of block (example: “latest-posts”).
7652   *
7653   * @return {Array} Array of child block names.
7654   */
7655  
7656  var registration_getChildBlockNames = function getChildBlockNames(blockName) {
7657    return Object(external_wp_data_["select"])(store).getChildBlockNames(blockName);
7658  };
7659  /**
7660   * Returns a boolean indicating if a block has child blocks or not.
7661   *
7662   * @param {string} blockName Name of block (example: “latest-posts”).
7663   *
7664   * @return {boolean} True if a block contains child blocks and false otherwise.
7665   */
7666  
7667  var registration_hasChildBlocks = function hasChildBlocks(blockName) {
7668    return Object(external_wp_data_["select"])(store).hasChildBlocks(blockName);
7669  };
7670  /**
7671   * Returns a boolean indicating if a block has at least one child block with inserter support.
7672   *
7673   * @param {string} blockName Block type name.
7674   *
7675   * @return {boolean} True if a block contains at least one child blocks with inserter support
7676   *                   and false otherwise.
7677   */
7678  
7679  var registration_hasChildBlocksWithInserterSupport = function hasChildBlocksWithInserterSupport(blockName) {
7680    return Object(external_wp_data_["select"])(store).hasChildBlocksWithInserterSupport(blockName);
7681  };
7682  /**
7683   * Registers a new block style variation for the given block.
7684   *
7685   * @param {string} blockName      Name of block (example: “core/latest-posts”).
7686   * @param {Object} styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user.
7687   */
7688  
7689  var registration_registerBlockStyle = function registerBlockStyle(blockName, styleVariation) {
7690    Object(external_wp_data_["dispatch"])(store).addBlockStyles(blockName, styleVariation);
7691  };
7692  /**
7693   * Unregisters a block style variation for the given block.
7694   *
7695   * @param {string} blockName          Name of block (example: “core/latest-posts”).
7696   * @param {string} styleVariationName Name of class applied to the block.
7697   */
7698  
7699  var registration_unregisterBlockStyle = function unregisterBlockStyle(blockName, styleVariationName) {
7700    Object(external_wp_data_["dispatch"])(store).removeBlockStyles(blockName, styleVariationName);
7701  };
7702  /**
7703   * Returns an array with the variations of a given block type.
7704   *
7705   * @param {string}                blockName Name of block (example: “core/columns”).
7706   * @param {WPBlockVariationScope} [scope]   Block variation scope name.
7707   *
7708   * @return {(WPBlockVariation[]|void)} Block variations.
7709   */
7710  
7711  var registration_getBlockVariations = function getBlockVariations(blockName, scope) {
7712    return Object(external_wp_data_["select"])(store).getBlockVariations(blockName, scope);
7713  };
7714  /**
7715   * Registers a new block variation for the given block type.
7716   *
7717   * @param {string}           blockName Name of the block (example: “core/columns”).
7718   * @param {WPBlockVariation} variation Object describing a block variation.
7719   */
7720  
7721  var registration_registerBlockVariation = function registerBlockVariation(blockName, variation) {
7722    Object(external_wp_data_["dispatch"])(store).addBlockVariations(blockName, variation);
7723  };
7724  /**
7725   * Unregisters a block variation defined for the given block type.
7726   *
7727   * @param {string} blockName     Name of the block (example: “core/columns”).
7728   * @param {string} variationName Name of the variation defined for the block.
7729   */
7730  
7731  var registration_unregisterBlockVariation = function unregisterBlockVariation(blockName, variationName) {
7732    Object(external_wp_data_["dispatch"])(store).removeBlockVariations(blockName, variationName);
7733  };
7734  
7735  // CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
7736  
7737  
7738  
7739  
7740  function factory_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; }
7741  
7742  function factory_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { factory_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { factory_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7743  
7744  /**
7745   * External dependencies
7746   */
7747  
7748  
7749  /**
7750   * WordPress dependencies
7751   */
7752  
7753  
7754  /**
7755   * Internal dependencies
7756   */
7757  
7758  
7759  
7760  /**
7761   * Returns a block object given its type and attributes.
7762   *
7763   * @param {string} name        Block name.
7764   * @param {Object} attributes  Block attributes.
7765   * @param {?Array} innerBlocks Nested blocks.
7766   *
7767   * @return {Object} Block object.
7768   */
7769  
7770  function createBlock(name) {
7771    var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7772    var innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
7773    var sanitizedAttributes = sanitizeBlockAttributes(name, attributes);
7774    var clientId = Object(v4["a" /* default */])(); // Blocks are stored with a unique ID, the assigned type name, the block
7775    // attributes, and their inner blocks.
7776  
7777    return {
7778      clientId: clientId,
7779      name: name,
7780      isValid: true,
7781      attributes: sanitizedAttributes,
7782      innerBlocks: innerBlocks
7783    };
7784  }
7785  /**
7786   * Given an array of InnerBlocks templates or Block Objects,
7787   * returns an array of created Blocks from them.
7788   * It handles the case of having InnerBlocks as Blocks by
7789   * converting them to the proper format to continue recursively.
7790   *
7791   * @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates.
7792   *
7793   * @return {Object[]} Array of Block objects.
7794   */
7795  
7796  function createBlocksFromInnerBlocksTemplate() {
7797    var innerBlocksOrTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7798    return innerBlocksOrTemplate.map(function (innerBlock) {
7799      var innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks];
7800  
7801      var _innerBlockTemplate = Object(slicedToArray["a" /* default */])(innerBlockTemplate, 3),
7802          name = _innerBlockTemplate[0],
7803          attributes = _innerBlockTemplate[1],
7804          _innerBlockTemplate$ = _innerBlockTemplate[2],
7805          innerBlocks = _innerBlockTemplate$ === void 0 ? [] : _innerBlockTemplate$;
7806  
7807      return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks));
7808    });
7809  }
7810  /**
7811   * Given a block object, returns a copy of the block object while sanitizing its attributes,
7812   * optionally merging new attributes and/or replacing its inner blocks.
7813   *
7814   * @param {Object} block              Block instance.
7815   * @param {Object} mergeAttributes    Block attributes.
7816   * @param {?Array} newInnerBlocks     Nested blocks.
7817   *
7818   * @return {Object} A cloned block.
7819   */
7820  
7821  function __experimentalCloneSanitizedBlock(block) {
7822    var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7823    var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
7824    var clientId = Object(v4["a" /* default */])();
7825    var sanitizedAttributes = sanitizeBlockAttributes(block.name, factory_objectSpread(factory_objectSpread({}, block.attributes), mergeAttributes));
7826    return factory_objectSpread(factory_objectSpread({}, block), {}, {
7827      clientId: clientId,
7828      attributes: sanitizedAttributes,
7829      innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
7830        return __experimentalCloneSanitizedBlock(innerBlock);
7831      })
7832    });
7833  }
7834  /**
7835   * Given a block object, returns a copy of the block object,
7836   * optionally merging new attributes and/or replacing its inner blocks.
7837   *
7838   * @param {Object} block              Block instance.
7839   * @param {Object} mergeAttributes    Block attributes.
7840   * @param {?Array} newInnerBlocks     Nested blocks.
7841   *
7842   * @return {Object} A cloned block.
7843   */
7844  
7845  function cloneBlock(block) {
7846    var mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7847    var newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined;
7848    var clientId = Object(v4["a" /* default */])();
7849    return factory_objectSpread(factory_objectSpread({}, block), {}, {
7850      clientId: clientId,
7851      attributes: factory_objectSpread(factory_objectSpread({}, block.attributes), mergeAttributes),
7852      innerBlocks: newInnerBlocks || block.innerBlocks.map(function (innerBlock) {
7853        return cloneBlock(innerBlock);
7854      })
7855    });
7856  }
7857  /**
7858   * Returns a boolean indicating whether a transform is possible based on
7859   * various bits of context.
7860   *
7861   * @param {Object} transform The transform object to validate.
7862   * @param {string} direction Is this a 'from' or 'to' transform.
7863   * @param {Array} blocks The blocks to transform from.
7864   *
7865   * @return {boolean} Is the transform possible?
7866   */
7867  
7868  var factory_isPossibleTransformForSource = function isPossibleTransformForSource(transform, direction, blocks) {
7869    if (Object(external_lodash_["isEmpty"])(blocks)) {
7870      return false;
7871    } // If multiple blocks are selected, only multi block transforms
7872    // or wildcard transforms are allowed.
7873  
7874  
7875    var isMultiBlock = blocks.length > 1;
7876    var firstBlockName = Object(external_lodash_["first"])(blocks).name;
7877    var isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
7878  
7879    if (!isValidForMultiBlocks) {
7880      return false;
7881    } // Check non-wildcard transforms to ensure that transform is valid
7882    // for a block selection of multiple blocks of different types
7883  
7884  
7885    if (!isWildcardBlockTransform(transform) && !Object(external_lodash_["every"])(blocks, {
7886      name: firstBlockName
7887    })) {
7888      return false;
7889    } // Only consider 'block' type transforms as valid.
7890  
7891  
7892    var isBlockType = transform.type === 'block';
7893  
7894    if (!isBlockType) {
7895      return false;
7896    } // Check if the transform's block name matches the source block (or is a wildcard)
7897    // only if this is a transform 'from'.
7898  
7899  
7900    var sourceBlock = Object(external_lodash_["first"])(blocks);
7901    var hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
7902  
7903    if (!hasMatchingName) {
7904      return false;
7905    } // Don't allow single Grouping blocks to be transformed into
7906    // a Grouping block.
7907  
7908  
7909    if (!isMultiBlock && factory_isContainerGroupBlock(sourceBlock.name) && factory_isContainerGroupBlock(transform.blockName)) {
7910      return false;
7911    } // If the transform has a `isMatch` function specified, check that it returns true.
7912  
7913  
7914    if (Object(external_lodash_["isFunction"])(transform.isMatch)) {
7915      var attributes = transform.isMultiBlock ? blocks.map(function (block) {
7916        return block.attributes;
7917      }) : sourceBlock.attributes;
7918  
7919      if (!transform.isMatch(attributes)) {
7920        return false;
7921      }
7922    }
7923  
7924    return true;
7925  };
7926  /**
7927   * Returns block types that the 'blocks' can be transformed into, based on
7928   * 'from' transforms on other blocks.
7929   *
7930   * @param {Array}  blocks  The blocks to transform from.
7931   *
7932   * @return {Array} Block types that the blocks can be transformed into.
7933   */
7934  
7935  
7936  var factory_getBlockTypesForPossibleFromTransforms = function getBlockTypesForPossibleFromTransforms(blocks) {
7937    if (Object(external_lodash_["isEmpty"])(blocks)) {
7938      return [];
7939    }
7940  
7941    var allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform.
7942  
7943    var blockTypesWithPossibleFromTransforms = Object(external_lodash_["filter"])(allBlockTypes, function (blockType) {
7944      var fromTransforms = getBlockTransforms('from', blockType.name);
7945      return !!findTransform(fromTransforms, function (transform) {
7946        return factory_isPossibleTransformForSource(transform, 'from', blocks);
7947      });
7948    });
7949    return blockTypesWithPossibleFromTransforms;
7950  };
7951  /**
7952   * Returns block types that the 'blocks' can be transformed into, based on
7953   * the source block's own 'to' transforms.
7954   *
7955   * @param {Array} blocks The blocks to transform from.
7956   *
7957   * @return {Array} Block types that the source can be transformed into.
7958   */
7959  
7960  
7961  var factory_getBlockTypesForPossibleToTransforms = function getBlockTypesForPossibleToTransforms(blocks) {
7962    if (Object(external_lodash_["isEmpty"])(blocks)) {
7963      return [];
7964    }
7965  
7966    var sourceBlock = Object(external_lodash_["first"])(blocks);
7967    var blockType = registration_getBlockType(sourceBlock.name);
7968    var transformsTo = getBlockTransforms('to', blockType.name); // filter all 'to' transforms to find those that are possible.
7969  
7970    var possibleTransforms = Object(external_lodash_["filter"])(transformsTo, function (transform) {
7971      return transform && factory_isPossibleTransformForSource(transform, 'to', blocks);
7972    }); // Build a list of block names using the possible 'to' transforms.
7973  
7974    var blockNames = Object(external_lodash_["flatMap"])(possibleTransforms, function (transformation) {
7975      return transformation.blocks;
7976    }); // Map block names to block types.
7977  
7978    return blockNames.map(function (name) {
7979      return registration_getBlockType(name);
7980    });
7981  };
7982  /**
7983   * Determines whether transform is a "block" type
7984   * and if so whether it is a "wildcard" transform
7985   * ie: targets "any" block type
7986   *
7987   * @param {Object} t the Block transform object
7988   *
7989   * @return {boolean} whether transform is a wildcard transform
7990   */
7991  
7992  
7993  var isWildcardBlockTransform = function isWildcardBlockTransform(t) {
7994    return t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*');
7995  };
7996  /**
7997   * Determines whether the given Block is the core Block which
7998   * acts as a container Block for other Blocks as part of the
7999   * Grouping mechanics
8000   *
8001   * @param  {string} name the name of the Block to test against
8002   *
8003   * @return {boolean} whether or not the Block is the container Block type
8004   */
8005  
8006  var factory_isContainerGroupBlock = function isContainerGroupBlock(name) {
8007    return name === registration_getGroupingBlockName();
8008  };
8009  /**
8010   * Returns an array of block types that the set of blocks received as argument
8011   * can be transformed into.
8012   *
8013   * @param {Array} blocks Blocks array.
8014   *
8015   * @return {Array} Block types that the blocks argument can be transformed to.
8016   */
8017  
8018  function getPossibleBlockTransformations(blocks) {
8019    if (Object(external_lodash_["isEmpty"])(blocks)) {
8020      return [];
8021    }
8022  
8023    var blockTypesForFromTransforms = factory_getBlockTypesForPossibleFromTransforms(blocks);
8024    var blockTypesForToTransforms = factory_getBlockTypesForPossibleToTransforms(blocks);
8025    return Object(external_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(blockTypesForFromTransforms), Object(toConsumableArray["a" /* default */])(blockTypesForToTransforms)));
8026  }
8027  /**
8028   * Given an array of transforms, returns the highest-priority transform where
8029   * the predicate function returns a truthy value. A higher-priority transform
8030   * is one with a lower priority value (i.e. first in priority order). Returns
8031   * null if the transforms set is empty or the predicate function returns a
8032   * falsey value for all entries.
8033   *
8034   * @param {Object[]} transforms Transforms to search.
8035   * @param {Function} predicate  Function returning true on matching transform.
8036   *
8037   * @return {?Object} Highest-priority transform candidate.
8038   */
8039  
8040  function findTransform(transforms, predicate) {
8041    // The hooks library already has built-in mechanisms for managing priority
8042    // queue, so leverage via locally-defined instance.
8043    var hooks = Object(external_wp_hooks_["createHooks"])();
8044  
8045    var _loop = function _loop(i) {
8046      var candidate = transforms[i];
8047  
8048      if (predicate(candidate)) {
8049        hooks.addFilter('transform', 'transform/' + i.toString(), function (result) {
8050          return result ? result : candidate;
8051        }, candidate.priority);
8052      }
8053    };
8054  
8055    for (var i = 0; i < transforms.length; i++) {
8056      _loop(i);
8057    } // Filter name is arbitrarily chosen but consistent with above aggregation.
8058  
8059  
8060    return hooks.applyFilters('transform', null);
8061  }
8062  /**
8063   * Returns normal block transforms for a given transform direction, optionally
8064   * for a specific block by name, or an empty array if there are no transforms.
8065   * If no block name is provided, returns transforms for all blocks. A normal
8066   * transform object includes `blockName` as a property.
8067   *
8068   * @param {string}  direction Transform direction ("to", "from").
8069   * @param {string|Object} blockTypeOrName  Block type or name.
8070   *
8071   * @return {Array} Block transforms for direction.
8072   */
8073  
8074  function getBlockTransforms(direction, blockTypeOrName) {
8075    // When retrieving transforms for all block types, recurse into self.
8076    if (blockTypeOrName === undefined) {
8077      return Object(external_lodash_["flatMap"])(registration_getBlockTypes(), function (_ref) {
8078        var name = _ref.name;
8079        return getBlockTransforms(direction, name);
8080      });
8081    } // Validate that block type exists and has array of direction.
8082  
8083  
8084    var blockType = normalizeBlockType(blockTypeOrName);
8085  
8086    var _ref2 = blockType || {},
8087        blockName = _ref2.name,
8088        transforms = _ref2.transforms;
8089  
8090    if (!transforms || !Array.isArray(transforms[direction])) {
8091      return [];
8092    } // Map transforms to normal form.
8093  
8094  
8095    return transforms[direction].map(function (transform) {
8096      return factory_objectSpread(factory_objectSpread({}, transform), {}, {
8097        blockName: blockName
8098      });
8099    });
8100  }
8101  /**
8102   * Switch one or more blocks into one or more blocks of the new block type.
8103   *
8104   * @param {Array|Object} blocks Blocks array or block object.
8105   * @param {string}       name   Block name.
8106   *
8107   * @return {?Array} Array of blocks or null.
8108   */
8109  
8110  function switchToBlockType(blocks, name) {
8111    var blocksArray = Object(external_lodash_["castArray"])(blocks);
8112    var isMultiBlock = blocksArray.length > 1;
8113    var firstBlock = blocksArray[0];
8114    var sourceName = firstBlock.name; // Find the right transformation by giving priority to the "to"
8115    // transformation.
8116  
8117    var transformationsFrom = getBlockTransforms('from', name);
8118    var transformationsTo = getBlockTransforms('to', sourceName);
8119    var transformation = findTransform(transformationsTo, function (t) {
8120      return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock);
8121    }) || findTransform(transformationsFrom, function (t) {
8122      return t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock);
8123    }); // Stop if there is no valid transformation.
8124  
8125    if (!transformation) {
8126      return null;
8127    }
8128  
8129    var transformationResults;
8130  
8131    if (transformation.isMultiBlock) {
8132      if (Object(external_lodash_["has"])(transformation, '__experimentalConvert')) {
8133        transformationResults = transformation.__experimentalConvert(blocksArray);
8134      } else {
8135        transformationResults = transformation.transform(blocksArray.map(function (currentBlock) {
8136          return currentBlock.attributes;
8137        }), blocksArray.map(function (currentBlock) {
8138          return currentBlock.innerBlocks;
8139        }));
8140      }
8141    } else if (Object(external_lodash_["has"])(transformation, '__experimentalConvert')) {
8142      transformationResults = transformation.__experimentalConvert(firstBlock);
8143    } else {
8144      transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks);
8145    } // Ensure that the transformation function returned an object or an array
8146    // of objects.
8147  
8148  
8149    if (!Object(external_lodash_["isObjectLike"])(transformationResults)) {
8150      return null;
8151    } // If the transformation function returned a single object, we want to work
8152    // with an array instead.
8153  
8154  
8155    transformationResults = Object(external_lodash_["castArray"])(transformationResults); // Ensure that every block object returned by the transformation has a
8156    // valid block type.
8157  
8158    if (transformationResults.some(function (result) {
8159      return !registration_getBlockType(result.name);
8160    })) {
8161      return null;
8162    }
8163  
8164    var firstSwitchedBlock = Object(external_lodash_["findIndex"])(transformationResults, function (result) {
8165      return result.name === name;
8166    }); // Ensure that at least one block object returned by the transformation has
8167    // the expected "destination" block type.
8168  
8169    if (firstSwitchedBlock < 0) {
8170      return null;
8171    }
8172  
8173    return transformationResults.map(function (result, index) {
8174      var transformedBlock = factory_objectSpread(factory_objectSpread({}, result), {}, {
8175        // The first transformed block whose type matches the "destination"
8176        // type gets to keep the existing client ID of the first block.
8177        clientId: index === firstSwitchedBlock ? firstBlock.clientId : result.clientId
8178      });
8179      /**
8180       * Filters an individual transform result from block transformation.
8181       * All of the original blocks are passed, since transformations are
8182       * many-to-many, not one-to-one.
8183       *
8184       * @param {Object}   transformedBlock The transformed block.
8185       * @param {Object[]} blocks           Original blocks transformed.
8186       */
8187  
8188  
8189      return Object(external_wp_hooks_["applyFilters"])('blocks.switchToBlockType.transformedBlock', transformedBlock, blocks);
8190    });
8191  }
8192  /**
8193   * Create a block object from the example API.
8194   *
8195   * @param {string} name
8196   * @param {Object} example
8197   *
8198   * @return {Object} block.
8199   */
8200  
8201  var factory_getBlockFromExample = function getBlockFromExample(name, example) {
8202    return createBlock(name, example.attributes, Object(external_lodash_["map"])(example.innerBlocks, function (innerBlock) {
8203      return getBlockFromExample(innerBlock.name, innerBlock);
8204    }));
8205  };
8206  
8207  // CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js
8208  /**
8209   * Given object and string of dot-delimited path segments, returns value at
8210   * path or undefined if path cannot be resolved.
8211   *
8212   * @param  {Object} object Lookup object
8213   * @param  {string} path   Path to resolve
8214   * @return {?*}            Resolved value
8215   */
8216  function getPath(object, path) {
8217    var segments = path.split('.');
8218    var segment;
8219  
8220    while (segment = segments.shift()) {
8221      if (!(segment in object)) {
8222        return;
8223      }
8224  
8225      object = object[segment];
8226    }
8227  
8228    return object;
8229  }
8230  // CONCATENATED MODULE: ./node_modules/hpq/es/index.js
8231  /**
8232   * Internal dependencies
8233   */
8234  
8235  /**
8236   * Function returning a DOM document created by `createHTMLDocument`. The same
8237   * document is returned between invocations.
8238   *
8239   * @return {Document} DOM document.
8240   */
8241  
8242  var getDocument = function () {
8243    var doc;
8244    return function () {
8245      if (!doc) {
8246        doc = document.implementation.createHTMLDocument('');
8247      }
8248  
8249      return doc;
8250    };
8251  }();
8252  /**
8253   * Given a markup string or DOM element, creates an object aligning with the
8254   * shape of the matchers object, or the value returned by the matcher.
8255   *
8256   * @param  {(string|Element)}  source   Source content
8257   * @param  {(Object|Function)} matchers Matcher function or object of matchers
8258   * @return {(Object|*)}                 Matched value(s), shaped by object
8259   */
8260  
8261  
8262  function es_parse(source, matchers) {
8263    if (!matchers) {
8264      return;
8265    } // Coerce to element
8266  
8267  
8268    if ('string' === typeof source) {
8269      var doc = getDocument();
8270      doc.body.innerHTML = source;
8271      source = doc.body;
8272    } // Return singular value
8273  
8274  
8275    if ('function' === typeof matchers) {
8276      return matchers(source);
8277    } // Bail if we can't handle matchers
8278  
8279  
8280    if (Object !== matchers.constructor) {
8281      return;
8282    } // Shape result by matcher object
8283  
8284  
8285    return Object.keys(matchers).reduce(function (memo, key) {
8286      memo[key] = es_parse(source, matchers[key]);
8287      return memo;
8288    }, {});
8289  }
8290  /**
8291   * Generates a function which matches node of type selector, returning an
8292   * attribute by property if the attribute exists. If no selector is passed,
8293   * returns property of the query element.
8294   *
8295   * @param  {?string} selector Optional selector
8296   * @param  {string}  name     Property name
8297   * @return {*}                Property value
8298   */
8299  
8300  function prop(selector, name) {
8301    if (1 === arguments.length) {
8302      name = selector;
8303      selector = undefined;
8304    }
8305  
8306    return function (node) {
8307      var match = node;
8308  
8309      if (selector) {
8310        match = node.querySelector(selector);
8311      }
8312  
8313      if (match) {
8314        return getPath(match, name);
8315      }
8316    };
8317  }
8318  /**
8319   * Generates a function which matches node of type selector, returning an
8320   * attribute by name if the attribute exists. If no selector is passed,
8321   * returns attribute of the query element.
8322   *
8323   * @param  {?string} selector Optional selector
8324   * @param  {string}  name     Attribute name
8325   * @return {?string}          Attribute value
8326   */
8327  
8328  function attr(selector, name) {
8329    if (1 === arguments.length) {
8330      name = selector;
8331      selector = undefined;
8332    }
8333  
8334    return function (node) {
8335      var attributes = prop(selector, 'attributes')(node);
8336  
8337      if (attributes && attributes.hasOwnProperty(name)) {
8338        return attributes[name].value;
8339      }
8340    };
8341  }
8342  /**
8343   * Convenience for `prop( selector, 'innerHTML' )`.
8344   *
8345   * @see prop()
8346   *
8347   * @param  {?string} selector Optional selector
8348   * @return {string}           Inner HTML
8349   */
8350  
8351  function es_html(selector) {
8352    return prop(selector, 'innerHTML');
8353  }
8354  /**
8355   * Convenience for `prop( selector, 'textContent' )`.
8356   *
8357   * @see prop()
8358   *
8359   * @param  {?string} selector Optional selector
8360   * @return {string}           Text content
8361   */
8362  
8363  function es_text(selector) {
8364    return prop(selector, 'textContent');
8365  }
8366  /**
8367   * Creates a new matching context by first finding elements matching selector
8368   * using querySelectorAll before then running another `parse` on `matchers`
8369   * scoped to the matched elements.
8370   *
8371   * @see parse()
8372   *
8373   * @param  {string}            selector Selector to match
8374   * @param  {(Object|Function)} matchers Matcher function or object of matchers
8375   * @return {Array.<*,Object>}           Array of matched value(s)
8376   */
8377  
8378  function query(selector, matchers) {
8379    return function (node) {
8380      var matches = node.querySelectorAll(selector);
8381      return [].map.call(matches, function (match) {
8382        return es_parse(match, matchers);
8383      });
8384    };
8385  }
8386  // EXTERNAL MODULE: external ["wp","autop"]
8387  var external_wp_autop_ = __webpack_require__(115);
8388  
8389  // EXTERNAL MODULE: external ["wp","blockSerializationDefaultParser"]
8390  var external_wp_blockSerializationDefaultParser_ = __webpack_require__(284);
8391  
8392  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toArray.js
8393  var toArray = __webpack_require__(147);
8394  
8395  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
8396  var classCallCheck = __webpack_require__(25);
8397  
8398  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
8399  var createClass = __webpack_require__(26);
8400  
8401  // CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js
8402  /**
8403   * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
8404   * do not edit
8405   */
8406  var namedCharRefs = {
8407      Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "​", NegativeThickSpace: "​", NegativeThinSpace: "​", NegativeVeryThinSpace: "​", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: "  ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "​", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
8408  };
8409  
8410  var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
8411  var CHARCODE = /^#([0-9]+)$/;
8412  var NAMED = /^([A-Za-z0-9]+)$/;
8413  var EntityParser = /** @class */ (function () {
8414      function EntityParser(named) {
8415          this.named = named;
8416      }
8417      EntityParser.prototype.parse = function (entity) {
8418          if (!entity) {
8419              return;
8420          }
8421          var matches = entity.match(HEXCHARCODE);
8422          if (matches) {
8423              return String.fromCharCode(parseInt(matches[1], 16));
8424          }
8425          matches = entity.match(CHARCODE);
8426          if (matches) {
8427              return String.fromCharCode(parseInt(matches[1], 10));
8428          }
8429          matches = entity.match(NAMED);
8430          if (matches) {
8431              return this.named[matches[1]];
8432          }
8433      };
8434      return EntityParser;
8435  }());
8436  
8437  var WSP = /[\t\n\f ]/;
8438  var ALPHA = /[A-Za-z]/;
8439  var CRLF = /\r\n?/g;
8440  function isSpace(char) {
8441      return WSP.