| @@ -1,12955 +1,13 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ var __webpack_modules__ = ({ | |
| 3 | - | |
| 4 | -/***/ 3787: | |
| 5 | -/***/ (function(module, exports, __webpack_require__) { | |
| 6 | - | |
| 7 | -var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */ | |
| 8 | -(function(){ | |
| 9 | -/** | |
| 10 | - * Created by Tivie on 13-07-2015. | |
| 11 | - */ | |
| 12 | - | |
| 13 | -function getDefaultOpts (simple) { | |
| 14 | - 'use strict'; | |
| 15 | - | |
| 16 | - var defaultOptions = { | |
| 17 | - omitExtraWLInCodeBlocks: { | |
| 18 | - defaultValue: false, | |
| 19 | - describe: 'Omit the default extra whiteline added to code blocks', | |
| 20 | - type: 'boolean' | |
| 21 | - }, | |
| 22 | - noHeaderId: { | |
| 23 | - defaultValue: false, | |
| 24 | - describe: 'Turn on/off generated header id', | |
| 25 | - type: 'boolean' | |
| 26 | - }, | |
| 27 | - prefixHeaderId: { | |
| 28 | - defaultValue: false, | |
| 29 | - 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', | |
| 30 | - type: 'string' | |
| 31 | - }, | |
| 32 | - rawPrefixHeaderId: { | |
| 33 | - defaultValue: false, | |
| 34 | - 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)', | |
| 35 | - type: 'boolean' | |
| 36 | - }, | |
| 37 | - ghCompatibleHeaderId: { | |
| 38 | - defaultValue: false, | |
| 39 | - describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)', | |
| 40 | - type: 'boolean' | |
| 41 | - }, | |
| 42 | - rawHeaderId: { | |
| 43 | - defaultValue: false, | |
| 44 | - describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids', | |
| 45 | - type: 'boolean' | |
| 46 | - }, | |
| 47 | - headerLevelStart: { | |
| 48 | - defaultValue: false, | |
| 49 | - describe: 'The header blocks level start', | |
| 50 | - type: 'integer' | |
| 51 | - }, | |
| 52 | - parseImgDimensions: { | |
| 53 | - defaultValue: false, | |
| 54 | - describe: 'Turn on/off image dimension parsing', | |
| 55 | - type: 'boolean' | |
| 56 | - }, | |
| 57 | - simplifiedAutoLink: { | |
| 58 | - defaultValue: false, | |
| 59 | - describe: 'Turn on/off GFM autolink style', | |
| 60 | - type: 'boolean' | |
| 61 | - }, | |
| 62 | - excludeTrailingPunctuationFromURLs: { | |
| 63 | - defaultValue: false, | |
| 64 | - describe: 'Excludes trailing punctuation from links generated with autoLinking', | |
| 65 | - type: 'boolean' | |
| 66 | - }, | |
| 67 | - literalMidWordUnderscores: { | |
| 68 | - defaultValue: false, | |
| 69 | - describe: 'Parse midword underscores as literal underscores', | |
| 70 | - type: 'boolean' | |
| 71 | - }, | |
| 72 | - literalMidWordAsterisks: { | |
| 73 | - defaultValue: false, | |
| 74 | - describe: 'Parse midword asterisks as literal asterisks', | |
| 75 | - type: 'boolean' | |
| 76 | - }, | |
| 77 | - strikethrough: { | |
| 78 | - defaultValue: false, | |
| 79 | - describe: 'Turn on/off strikethrough support', | |
| 80 | - type: 'boolean' | |
| 81 | - }, | |
| 82 | - tables: { | |
| 83 | - defaultValue: false, | |
| 84 | - describe: 'Turn on/off tables support', | |
| 85 | - type: 'boolean' | |
| 86 | - }, | |
| 87 | - tablesHeaderId: { | |
| 88 | - defaultValue: false, | |
| 89 | - describe: 'Add an id to table headers', | |
| 90 | - type: 'boolean' | |
| 91 | - }, | |
| 92 | - ghCodeBlocks: { | |
| 93 | - defaultValue: true, | |
| 94 | - describe: 'Turn on/off GFM fenced code blocks support', | |
| 95 | - type: 'boolean' | |
| 96 | - }, | |
| 97 | - tasklists: { | |
| 98 | - defaultValue: false, | |
| 99 | - describe: 'Turn on/off GFM tasklist support', | |
| 100 | - type: 'boolean' | |
| 101 | - }, | |
| 102 | - smoothLivePreview: { | |
| 103 | - defaultValue: false, | |
| 104 | - describe: 'Prevents weird effects in live previews due to incomplete input', | |
| 105 | - type: 'boolean' | |
| 106 | - }, | |
| 107 | - smartIndentationFix: { | |
| 108 | - defaultValue: false, | |
| 109 | - description: 'Tries to smartly fix indentation in es6 strings', | |
| 110 | - type: 'boolean' | |
| 111 | - }, | |
| 112 | - disableForced4SpacesIndentedSublists: { | |
| 113 | - defaultValue: false, | |
| 114 | - description: 'Disables the requirement of indenting nested sublists by 4 spaces', | |
| 115 | - type: 'boolean' | |
| 116 | - }, | |
| 117 | - simpleLineBreaks: { | |
| 118 | - defaultValue: false, | |
| 119 | - description: 'Parses simple line breaks as <br> (GFM Style)', | |
| 120 | - type: 'boolean' | |
| 121 | - }, | |
| 122 | - requireSpaceBeforeHeadingText: { | |
| 123 | - defaultValue: false, | |
| 124 | - description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)', | |
| 125 | - type: 'boolean' | |
| 126 | - }, | |
| 127 | - ghMentions: { | |
| 128 | - defaultValue: false, | |
| 129 | - description: 'Enables github @mentions', | |
| 130 | - type: 'boolean' | |
| 131 | - }, | |
| 132 | - ghMentionsLink: { | |
| 133 | - defaultValue: 'https://github.com/{u}', | |
| 134 | - description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.', | |
| 135 | - type: 'string' | |
| 136 | - }, | |
| 137 | - encodeEmails: { | |
| 138 | - defaultValue: true, | |
| 139 | - description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities', | |
| 140 | - type: 'boolean' | |
| 141 | - }, | |
| 142 | - openLinksInNewWindow: { | |
| 143 | - defaultValue: false, | |
| 144 | - description: 'Open all links in new windows', | |
| 145 | - type: 'boolean' | |
| 146 | - }, | |
| 147 | - backslashEscapesHTMLTags: { | |
| 148 | - defaultValue: false, | |
| 149 | - description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>', | |
| 150 | - type: 'boolean' | |
| 151 | - }, | |
| 152 | - emoji: { | |
| 153 | - defaultValue: false, | |
| 154 | - description: 'Enable emoji support. Ex: `this is a :smile: emoji`', | |
| 155 | - type: 'boolean' | |
| 156 | - }, | |
| 157 | - underline: { | |
| 158 | - defaultValue: false, | |
| 159 | - 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>`', | |
| 160 | - type: 'boolean' | |
| 161 | - }, | |
| 162 | - completeHTMLDocument: { | |
| 163 | - defaultValue: false, | |
| 164 | - description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags', | |
| 165 | - type: 'boolean' | |
| 166 | - }, | |
| 167 | - metadata: { | |
| 168 | - defaultValue: false, | |
| 169 | - description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).', | |
| 170 | - type: 'boolean' | |
| 171 | - }, | |
| 172 | - splitAdjacentBlockquotes: { | |
| 173 | - defaultValue: false, | |
| 174 | - description: 'Split adjacent blockquote blocks', | |
| 175 | - type: 'boolean' | |
| 176 | - } | |
| 177 | - }; | |
| 178 | - if (simple === false) { | |
| 179 | - return JSON.parse(JSON.stringify(defaultOptions)); | |
| 180 | - } | |
| 181 | - var ret = {}; | |
| 182 | - for (var opt in defaultOptions) { | |
| 183 | - if (defaultOptions.hasOwnProperty(opt)) { | |
| 184 | - ret[opt] = defaultOptions[opt].defaultValue; | |
| 185 | - } | |
| 186 | - } | |
| 187 | - return ret; | |
| 188 | -} | |
| 189 | - | |
| 190 | -function allOptionsOn () { | |
| 191 | - 'use strict'; | |
| 192 | - var options = getDefaultOpts(true), | |
| 193 | - ret = {}; | |
| 194 | - for (var opt in options) { | |
| 195 | - if (options.hasOwnProperty(opt)) { | |
| 196 | - ret[opt] = true; | |
| 197 | - } | |
| 198 | - } | |
| 199 | - return ret; | |
| 200 | -} | |
| 201 | - | |
| 202 | -/** | |
| 203 | - * Created by Tivie on 06-01-2015. | |
| 204 | - */ | |
| 205 | - | |
| 206 | -// Private properties | |
| 207 | -var showdown = {}, | |
| 208 | - parsers = {}, | |
| 209 | - extensions = {}, | |
| 210 | - globalOptions = getDefaultOpts(true), | |
| 211 | - setFlavor = 'vanilla', | |
| 212 | - flavor = { | |
| 213 | - github: { | |
| 214 | - omitExtraWLInCodeBlocks: true, | |
| 215 | - simplifiedAutoLink: true, | |
| 216 | - excludeTrailingPunctuationFromURLs: true, | |
| 217 | - literalMidWordUnderscores: true, | |
| 218 | - strikethrough: true, | |
| 219 | - tables: true, | |
| 220 | - tablesHeaderId: true, | |
| 221 | - ghCodeBlocks: true, | |
| 222 | - tasklists: true, | |
| 223 | - disableForced4SpacesIndentedSublists: true, | |
| 224 | - simpleLineBreaks: true, | |
| 225 | - requireSpaceBeforeHeadingText: true, | |
| 226 | - ghCompatibleHeaderId: true, | |
| 227 | - ghMentions: true, | |
| 228 | - backslashEscapesHTMLTags: true, | |
| 229 | - emoji: true, | |
| 230 | - splitAdjacentBlockquotes: true | |
| 231 | - }, | |
| 232 | - original: { | |
| 233 | - noHeaderId: true, | |
| 234 | - ghCodeBlocks: false | |
| 235 | - }, | |
| 236 | - ghost: { | |
| 237 | - omitExtraWLInCodeBlocks: true, | |
| 238 | - parseImgDimensions: true, | |
| 239 | - simplifiedAutoLink: true, | |
| 240 | - excludeTrailingPunctuationFromURLs: true, | |
| 241 | - literalMidWordUnderscores: true, | |
| 242 | - strikethrough: true, | |
| 243 | - tables: true, | |
| 244 | - tablesHeaderId: true, | |
| 245 | - ghCodeBlocks: true, | |
| 246 | - tasklists: true, | |
| 247 | - smoothLivePreview: true, | |
| 248 | - simpleLineBreaks: true, | |
| 249 | - requireSpaceBeforeHeadingText: true, | |
| 250 | - ghMentions: false, | |
| 251 | - encodeEmails: true | |
| 252 | - }, | |
| 253 | - vanilla: getDefaultOpts(true), | |
| 254 | - allOn: allOptionsOn() | |
| 255 | - }; | |
| 256 | - | |
| 257 | -/** | |
| 258 | - * helper namespace | |
| 259 | - * @type {{}} | |
| 260 | - */ | |
| 261 | -showdown.helper = {}; | |
| 262 | - | |
| 263 | -/** | |
| 264 | - * TODO LEGACY SUPPORT CODE | |
| 265 | - * @type {{}} | |
| 266 | - */ | |
| 267 | -showdown.extensions = {}; | |
| 268 | - | |
| 269 | -/** | |
| 270 | - * Set a global option | |
| 271 | - * @static | |
| 272 | - * @param {string} key | |
| 273 | - * @param {*} value | |
| 274 | - * @returns {showdown} | |
| 275 | - */ | |
| 276 | -showdown.setOption = function (key, value) { | |
| 277 | - 'use strict'; | |
| 278 | - globalOptions[key] = value; | |
| 279 | - return this; | |
| 280 | -}; | |
| 281 | - | |
| 282 | -/** | |
| 283 | - * Get a global option | |
| 284 | - * @static | |
| 285 | - * @param {string} key | |
| 286 | - * @returns {*} | |
| 287 | - */ | |
| 288 | -showdown.getOption = function (key) { | |
| 289 | - 'use strict'; | |
| 290 | - return globalOptions[key]; | |
| 291 | -}; | |
| 292 | - | |
| 293 | -/** | |
| 294 | - * Get the global options | |
| 295 | - * @static | |
| 296 | - * @returns {{}} | |
| 297 | - */ | |
| 298 | -showdown.getOptions = function () { | |
| 299 | - 'use strict'; | |
| 300 | - return globalOptions; | |
| 301 | -}; | |
| 302 | - | |
| 303 | -/** | |
| 304 | - * Reset global options to the default values | |
| 305 | - * @static | |
| 306 | - */ | |
| 307 | -showdown.resetOptions = function () { | |
| 308 | - 'use strict'; | |
| 309 | - globalOptions = getDefaultOpts(true); | |
| 310 | -}; | |
| 311 | - | |
| 312 | -/** | |
| 313 | - * Set the flavor showdown should use as default | |
| 314 | - * @param {string} name | |
| 315 | - */ | |
| 316 | -showdown.setFlavor = function (name) { | |
| 317 | - 'use strict'; | |
| 318 | - if (!flavor.hasOwnProperty(name)) { | |
| 319 | - throw Error(name + ' flavor was not found'); | |
| 320 | - } | |
| 321 | - showdown.resetOptions(); | |
| 322 | - var preset = flavor[name]; | |
| 323 | - setFlavor = name; | |
| 324 | - for (var option in preset) { | |
| 325 | - if (preset.hasOwnProperty(option)) { | |
| 326 | - globalOptions[option] = preset[option]; | |
| 327 | - } | |
| 328 | - } | |
| 329 | -}; | |
| 330 | - | |
| 331 | -/** | |
| 332 | - * Get the currently set flavor | |
| 333 | - * @returns {string} | |
| 334 | - */ | |
| 335 | -showdown.getFlavor = function () { | |
| 336 | - 'use strict'; | |
| 337 | - return setFlavor; | |
| 338 | -}; | |
| 339 | - | |
| 340 | -/** | |
| 341 | - * Get the options of a specified flavor. Returns undefined if the flavor was not found | |
| 342 | - * @param {string} name Name of the flavor | |
| 343 | - * @returns {{}|undefined} | |
| 344 | - */ | |
| 345 | -showdown.getFlavorOptions = function (name) { | |
| 346 | - 'use strict'; | |
| 347 | - if (flavor.hasOwnProperty(name)) { | |
| 348 | - return flavor[name]; | |
| 349 | - } | |
| 350 | -}; | |
| 351 | - | |
| 352 | -/** | |
| 353 | - * Get the default options | |
| 354 | - * @static | |
| 355 | - * @param {boolean} [simple=true] | |
| 356 | - * @returns {{}} | |
| 357 | - */ | |
| 358 | -showdown.getDefaultOptions = function (simple) { | |
| 359 | - 'use strict'; | |
| 360 | - return getDefaultOpts(simple); | |
| 361 | -}; | |
| 362 | - | |
| 363 | -/** | |
| 364 | - * Get or set a subParser | |
| 365 | - * | |
| 366 | - * subParser(name) - Get a registered subParser | |
| 367 | - * subParser(name, func) - Register a subParser | |
| 368 | - * @static | |
| 369 | - * @param {string} name | |
| 370 | - * @param {function} [func] | |
| 371 | - * @returns {*} | |
| 372 | - */ | |
| 373 | -showdown.subParser = function (name, func) { | |
| 374 | - 'use strict'; | |
| 375 | - if (showdown.helper.isString(name)) { | |
| 376 | - if (typeof func !== 'undefined') { | |
| 377 | - parsers[name] = func; | |
| 378 | - } else { | |
| 379 | - if (parsers.hasOwnProperty(name)) { | |
| 380 | - return parsers[name]; | |
| 381 | - } else { | |
| 382 | - throw Error('SubParser named ' + name + ' not registered!'); | |
| 383 | - } | |
| 384 | - } | |
| 385 | - } | |
| 386 | -}; | |
| 387 | - | |
| 388 | -/** | |
| 389 | - * Gets or registers an extension | |
| 390 | - * @static | |
| 391 | - * @param {string} name | |
| 392 | - * @param {object|function=} ext | |
| 393 | - * @returns {*} | |
| 394 | - */ | |
| 395 | -showdown.extension = function (name, ext) { | |
| 396 | - 'use strict'; | |
| 397 | - | |
| 398 | - if (!showdown.helper.isString(name)) { | |
| 399 | - throw Error('Extension \'name\' must be a string'); | |
| 400 | - } | |
| 401 | - | |
| 402 | - name = showdown.helper.stdExtName(name); | |
| 403 | - | |
| 404 | - // Getter | |
| 405 | - if (showdown.helper.isUndefined(ext)) { | |
| 406 | - if (!extensions.hasOwnProperty(name)) { | |
| 407 | - throw Error('Extension named ' + name + ' is not registered!'); | |
| 408 | - } | |
| 409 | - return extensions[name]; | |
| 410 | - | |
| 411 | - // Setter | |
| 412 | - } else { | |
| 413 | - // Expand extension if it's wrapped in a function | |
| 414 | - if (typeof ext === 'function') { | |
| 415 | - ext = ext(); | |
| 416 | - } | |
| 417 | - | |
| 418 | - // Ensure extension is an array | |
| 419 | - if (!showdown.helper.isArray(ext)) { | |
| 420 | - ext = [ext]; | |
| 421 | - } | |
| 422 | - | |
| 423 | - var validExtension = validate(ext, name); | |
| 424 | - | |
| 425 | - if (validExtension.valid) { | |
| 426 | - extensions[name] = ext; | |
| 427 | - } else { | |
| 428 | - throw Error(validExtension.error); | |
| 429 | - } | |
| 430 | - } | |
| 431 | -}; | |
| 432 | - | |
| 433 | -/** | |
| 434 | - * Gets all extensions registered | |
| 435 | - * @returns {{}} | |
| 436 | - */ | |
| 437 | -showdown.getAllExtensions = function () { | |
| 438 | - 'use strict'; | |
| 439 | - return extensions; | |
| 440 | -}; | |
| 441 | - | |
| 442 | -/** | |
| 443 | - * Remove an extension | |
| 444 | - * @param {string} name | |
| 445 | - */ | |
| 446 | -showdown.removeExtension = function (name) { | |
| 447 | - 'use strict'; | |
| 448 | - delete extensions[name]; | |
| 449 | -}; | |
| 450 | - | |
| 451 | -/** | |
| 452 | - * Removes all extensions | |
| 453 | - */ | |
| 454 | -showdown.resetExtensions = function () { | |
| 455 | - 'use strict'; | |
| 456 | - extensions = {}; | |
| 457 | -}; | |
| 458 | - | |
| 459 | -/** | |
| 460 | - * Validate extension | |
| 461 | - * @param {array} extension | |
| 462 | - * @param {string} name | |
| 463 | - * @returns {{valid: boolean, error: string}} | |
| 464 | - */ | |
| 465 | -function validate (extension, name) { | |
| 466 | - 'use strict'; | |
| 467 | - | |
| 468 | - var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension', | |
| 469 | - ret = { | |
| 470 | - valid: true, | |
| 471 | - error: '' | |
| 472 | - }; | |
| 473 | - | |
| 474 | - if (!showdown.helper.isArray(extension)) { | |
| 475 | - extension = [extension]; | |
| 476 | - } | |
| 477 | - | |
| 478 | - for (var i = 0; i < extension.length; ++i) { | |
| 479 | - var baseMsg = errMsg + ' sub-extension ' + i + ': ', | |
| 480 | - ext = extension[i]; | |
| 481 | - if (typeof ext !== 'object') { | |
| 482 | - ret.valid = false; | |
| 483 | - ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given'; | |
| 484 | - return ret; | |
| 485 | - } | |
| 486 | - | |
| 487 | - if (!showdown.helper.isString(ext.type)) { | |
| 488 | - ret.valid = false; | |
| 489 | - ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given'; | |
| 490 | - return ret; | |
| 491 | - } | |
| 492 | - | |
| 493 | - var type = ext.type = ext.type.toLowerCase(); | |
| 494 | - | |
| 495 | - // normalize extension type | |
| 496 | - if (type === 'language') { | |
| 497 | - type = ext.type = 'lang'; | |
| 498 | - } | |
| 499 | - | |
| 500 | - if (type === 'html') { | |
| 501 | - type = ext.type = 'output'; | |
| 502 | - } | |
| 503 | - | |
| 504 | - if (type !== 'lang' && type !== 'output' && type !== 'listener') { | |
| 505 | - ret.valid = false; | |
| 506 | - ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"'; | |
| 507 | - return ret; | |
| 508 | - } | |
| 509 | - | |
| 510 | - if (type === 'listener') { | |
| 511 | - if (showdown.helper.isUndefined(ext.listeners)) { | |
| 512 | - ret.valid = false; | |
| 513 | - ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"'; | |
| 514 | - return ret; | |
| 515 | - } | |
| 516 | - } else { | |
| 517 | - if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) { | |
| 518 | - ret.valid = false; | |
| 519 | - ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method'; | |
| 520 | - return ret; | |
| 521 | - } | |
| 522 | - } | |
| 523 | - | |
| 524 | - if (ext.listeners) { | |
| 525 | - if (typeof ext.listeners !== 'object') { | |
| 526 | - ret.valid = false; | |
| 527 | - ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given'; | |
| 528 | - return ret; | |
| 529 | - } | |
| 530 | - for (var ln in ext.listeners) { | |
| 531 | - if (ext.listeners.hasOwnProperty(ln)) { | |
| 532 | - if (typeof ext.listeners[ln] !== 'function') { | |
| 533 | - ret.valid = false; | |
| 534 | - ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln + | |
| 535 | - ' must be a function but ' + typeof ext.listeners[ln] + ' given'; | |
| 536 | - return ret; | |
| 537 | - } | |
| 538 | - } | |
| 539 | - } | |
| 540 | - } | |
| 541 | - | |
| 542 | - if (ext.filter) { | |
| 543 | - if (typeof ext.filter !== 'function') { | |
| 544 | - ret.valid = false; | |
| 545 | - ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given'; | |
| 546 | - return ret; | |
| 547 | - } | |
| 548 | - } else if (ext.regex) { | |
| 549 | - if (showdown.helper.isString(ext.regex)) { | |
| 550 | - ext.regex = new RegExp(ext.regex, 'g'); | |
| 551 | - } | |
| 552 | - if (!(ext.regex instanceof RegExp)) { | |
| 553 | - ret.valid = false; | |
| 554 | - ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given'; | |
| 555 | - return ret; | |
| 556 | - } | |
| 557 | - if (showdown.helper.isUndefined(ext.replace)) { | |
| 558 | - ret.valid = false; | |
| 559 | - ret.error = baseMsg + '"regex" extensions must implement a replace string or function'; | |
| 560 | - return ret; | |
| 561 | - } | |
| 562 | - } | |
| 563 | - } | |
| 564 | - return ret; | |
| 565 | -} | |
| 566 | - | |
| 567 | -/** | |
| 568 | - * Validate extension | |
| 569 | - * @param {object} ext | |
| 570 | - * @returns {boolean} | |
| 571 | - */ | |
| 572 | -showdown.validateExtension = function (ext) { | |
| 573 | - 'use strict'; | |
| 574 | - | |
| 575 | - var validateExtension = validate(ext, null); | |
| 576 | - if (!validateExtension.valid) { | |
| 577 | - console.warn(validateExtension.error); | |
| 578 | - return false; | |
| 579 | - } | |
| 580 | - return true; | |
| 581 | -}; | |
| 582 | - | |
| 583 | -/** | |
| 584 | - * showdownjs helper functions | |
| 585 | - */ | |
| 586 | - | |
| 587 | -if (!showdown.hasOwnProperty('helper')) { | |
| 588 | - showdown.helper = {}; | |
| 589 | -} | |
| 590 | - | |
| 591 | -/** | |
| 592 | - * Check if var is string | |
| 593 | - * @static | |
| 594 | - * @param {string} a | |
| 595 | - * @returns {boolean} | |
| 596 | - */ | |
| 597 | -showdown.helper.isString = function (a) { | |
| 598 | - 'use strict'; | |
| 599 | - return (typeof a === 'string' || a instanceof String); | |
| 600 | -}; | |
| 601 | - | |
| 602 | -/** | |
| 603 | - * Check if var is a function | |
| 604 | - * @static | |
| 605 | - * @param {*} a | |
| 606 | - * @returns {boolean} | |
| 607 | - */ | |
| 608 | -showdown.helper.isFunction = function (a) { | |
| 609 | - 'use strict'; | |
| 610 | - var getType = {}; | |
| 611 | - return a && getType.toString.call(a) === '[object Function]'; | |
| 612 | -}; | |
| 613 | - | |
| 614 | -/** | |
| 615 | - * isArray helper function | |
| 616 | - * @static | |
| 617 | - * @param {*} a | |
| 618 | - * @returns {boolean} | |
| 619 | - */ | |
| 620 | -showdown.helper.isArray = function (a) { | |
| 621 | - 'use strict'; | |
| 622 | - return Array.isArray(a); | |
| 623 | -}; | |
| 624 | - | |
| 625 | -/** | |
| 626 | - * Check if value is undefined | |
| 627 | - * @static | |
| 628 | - * @param {*} value The value to check. | |
| 629 | - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. | |
| 630 | - */ | |
| 631 | -showdown.helper.isUndefined = function (value) { | |
| 632 | - 'use strict'; | |
| 633 | - return typeof value === 'undefined'; | |
| 634 | -}; | |
| 635 | - | |
| 636 | -/** | |
| 637 | - * ForEach helper function | |
| 638 | - * Iterates over Arrays and Objects (own properties only) | |
| 639 | - * @static | |
| 640 | - * @param {*} obj | |
| 641 | - * @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object | |
| 642 | - */ | |
| 643 | -showdown.helper.forEach = function (obj, callback) { | |
| 644 | - 'use strict'; | |
| 645 | - // check if obj is defined | |
| 646 | - if (showdown.helper.isUndefined(obj)) { | |
| 647 | - throw new Error('obj param is required'); | |
| 648 | - } | |
| 649 | - | |
| 650 | - if (showdown.helper.isUndefined(callback)) { | |
| 651 | - throw new Error('callback param is required'); | |
| 652 | - } | |
| 653 | - | |
| 654 | - if (!showdown.helper.isFunction(callback)) { | |
| 655 | - throw new Error('callback param must be a function/closure'); | |
| 656 | - } | |
| 657 | - | |
| 658 | - if (typeof obj.forEach === 'function') { | |
| 659 | - obj.forEach(callback); | |
| 660 | - } else if (showdown.helper.isArray(obj)) { | |
| 661 | - for (var i = 0; i < obj.length; i++) { | |
| 662 | - callback(obj[i], i, obj); | |
| 663 | - } | |
| 664 | - } else if (typeof (obj) === 'object') { | |
| 665 | - for (var prop in obj) { | |
| 666 | - if (obj.hasOwnProperty(prop)) { | |
| 667 | - callback(obj[prop], prop, obj); | |
| 668 | - } | |
| 669 | - } | |
| 670 | - } else { | |
| 671 | - throw new Error('obj does not seem to be an array or an iterable object'); | |
| 672 | - } | |
| 673 | -}; | |
| 674 | - | |
| 675 | -/** | |
| 676 | - * Standardidize extension name | |
| 677 | - * @static | |
| 678 | - * @param {string} s extension name | |
| 679 | - * @returns {string} | |
| 680 | - */ | |
| 681 | -showdown.helper.stdExtName = function (s) { | |
| 682 | - 'use strict'; | |
| 683 | - return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase(); | |
| 684 | -}; | |
| 685 | - | |
| 686 | -function escapeCharactersCallback (wholeMatch, m1) { | |
| 687 | - 'use strict'; | |
| 688 | - var charCodeToEscape = m1.charCodeAt(0); | |
| 689 | - return '¨E' + charCodeToEscape + 'E'; | |
| 690 | -} | |
| 691 | - | |
| 692 | -/** | |
| 693 | - * Callback used to escape characters when passing through String.replace | |
| 694 | - * @static | |
| 695 | - * @param {string} wholeMatch | |
| 696 | - * @param {string} m1 | |
| 697 | - * @returns {string} | |
| 698 | - */ | |
| 699 | -showdown.helper.escapeCharactersCallback = escapeCharactersCallback; | |
| 700 | - | |
| 701 | -/** | |
| 702 | - * Escape characters in a string | |
| 703 | - * @static | |
| 704 | - * @param {string} text | |
| 705 | - * @param {string} charsToEscape | |
| 706 | - * @param {boolean} afterBackslash | |
| 707 | - * @returns {XML|string|void|*} | |
| 708 | - */ | |
| 709 | -showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) { | |
| 710 | - 'use strict'; | |
| 711 | - // First we have to escape the escape characters so that | |
| 712 | - // we can build a character class out of them | |
| 713 | - var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])'; | |
| 714 | - | |
| 715 | - if (afterBackslash) { | |
| 716 | - regexString = '\\\\' + regexString; | |
| 717 | - } | |
| 718 | - | |
| 719 | - var regex = new RegExp(regexString, 'g'); | |
| 720 | - text = text.replace(regex, escapeCharactersCallback); | |
| 721 | - | |
| 722 | - return text; | |
| 723 | -}; | |
| 724 | - | |
| 725 | -/** | |
| 726 | - * Unescape HTML entities | |
| 727 | - * @param txt | |
| 728 | - * @returns {string} | |
| 729 | - */ | |
| 730 | -showdown.helper.unescapeHTMLEntities = function (txt) { | |
| 731 | - 'use strict'; | |
| 732 | - | |
| 733 | - return txt | |
| 734 | - .replace(/"/g, '"') | |
| 735 | - .replace(/</g, '<') | |
| 736 | - .replace(/>/g, '>') | |
| 737 | - .replace(/&/g, '&'); | |
| 738 | -}; | |
| 739 | - | |
| 740 | -var rgxFindMatchPos = function (str, left, right, flags) { | |
| 741 | - 'use strict'; | |
| 742 | - var f = flags || '', | |
| 743 | - g = f.indexOf('g') > -1, | |
| 744 | - x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')), | |
| 745 | - l = new RegExp(left, f.replace(/g/g, '')), | |
| 746 | - pos = [], | |
| 747 | - t, s, m, start, end; | |
| 748 | - | |
| 749 | - do { | |
| 750 | - t = 0; | |
| 751 | - while ((m = x.exec(str))) { | |
| 752 | - if (l.test(m[0])) { | |
| 753 | - if (!(t++)) { | |
| 754 | - s = x.lastIndex; | |
| 755 | - start = s - m[0].length; | |
| 756 | - } | |
| 757 | - } else if (t) { | |
| 758 | - if (!--t) { | |
| 759 | - end = m.index + m[0].length; | |
| 760 | - var obj = { | |
| 761 | - left: {start: start, end: s}, | |
| 762 | - match: {start: s, end: m.index}, | |
| 763 | - right: {start: m.index, end: end}, | |
| 764 | - wholeMatch: {start: start, end: end} | |
| 765 | - }; | |
| 766 | - pos.push(obj); | |
| 767 | - if (!g) { | |
| 768 | - return pos; | |
| 769 | - } | |
| 770 | - } | |
| 771 | - } | |
| 772 | - } | |
| 773 | - } while (t && (x.lastIndex = s)); | |
| 774 | - | |
| 775 | - return pos; | |
| 776 | -}; | |
| 777 | - | |
| 778 | -/** | |
| 779 | - * matchRecursiveRegExp | |
| 780 | - * | |
| 781 | - * (c) 2007 Steven Levithan <stevenlevithan.com> | |
| 782 | - * MIT License | |
| 783 | - * | |
| 784 | - * Accepts a string to search, a left and right format delimiter | |
| 785 | - * as regex patterns, and optional regex flags. Returns an array | |
| 786 | - * of matches, allowing nested instances of left/right delimiters. | |
| 787 | - * Use the "g" flag to return all matches, otherwise only the | |
| 788 | - * first is returned. Be careful to ensure that the left and | |
| 789 | - * right format delimiters produce mutually exclusive matches. | |
| 790 | - * Backreferences are not supported within the right delimiter | |
| 791 | - * due to how it is internally combined with the left delimiter. | |
| 792 | - * When matching strings whose format delimiters are unbalanced | |
| 793 | - * to the left or right, the output is intentionally as a | |
| 794 | - * conventional regex library with recursion support would | |
| 795 | - * produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using | |
| 796 | - * "<" and ">" as the delimiters (both strings contain a single, | |
| 797 | - * balanced instance of "<x>"). | |
| 798 | - * | |
| 799 | - * examples: | |
| 800 | - * matchRecursiveRegExp("test", "\\(", "\\)") | |
| 801 | - * returns: [] | |
| 802 | - * matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g") | |
| 803 | - * returns: ["t<<e>><s>", ""] | |
| 804 | - * matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi") | |
| 805 | - * returns: ["test"] | |
| 806 | - */ | |
| 807 | -showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) { | |
| 808 | - 'use strict'; | |
| 809 | - | |
| 810 | - var matchPos = rgxFindMatchPos (str, left, right, flags), | |
| 811 | - results = []; | |
| 812 | - | |
| 813 | - for (var i = 0; i < matchPos.length; ++i) { | |
| 814 | - results.push([ | |
| 815 | - str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end), | |
| 816 | - str.slice(matchPos[i].match.start, matchPos[i].match.end), | |
| 817 | - str.slice(matchPos[i].left.start, matchPos[i].left.end), | |
| 818 | - str.slice(matchPos[i].right.start, matchPos[i].right.end) | |
| 819 | - ]); | |
| 820 | - } | |
| 821 | - return results; | |
| 822 | -}; | |
| 823 | - | |
| 824 | -/** | |
| 825 | - * | |
| 826 | - * @param {string} str | |
| 827 | - * @param {string|function} replacement | |
| 828 | - * @param {string} left | |
| 829 | - * @param {string} right | |
| 830 | - * @param {string} flags | |
| 831 | - * @returns {string} | |
| 832 | - */ | |
| 833 | -showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) { | |
| 834 | - 'use strict'; | |
| 835 | - | |
| 836 | - if (!showdown.helper.isFunction(replacement)) { | |
| 837 | - var repStr = replacement; | |
| 838 | - replacement = function () { | |
| 839 | - return repStr; | |
| 840 | - }; | |
| 841 | - } | |
| 842 | - | |
| 843 | - var matchPos = rgxFindMatchPos(str, left, right, flags), | |
| 844 | - finalStr = str, | |
| 845 | - lng = matchPos.length; | |
| 846 | - | |
| 847 | - if (lng > 0) { | |
| 848 | - var bits = []; | |
| 849 | - if (matchPos[0].wholeMatch.start !== 0) { | |
| 850 | - bits.push(str.slice(0, matchPos[0].wholeMatch.start)); | |
| 851 | - } | |
| 852 | - for (var i = 0; i < lng; ++i) { | |
| 853 | - bits.push( | |
| 854 | - replacement( | |
| 855 | - str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end), | |
| 856 | - str.slice(matchPos[i].match.start, matchPos[i].match.end), | |
| 857 | - str.slice(matchPos[i].left.start, matchPos[i].left.end), | |
| 858 | - str.slice(matchPos[i].right.start, matchPos[i].right.end) | |
| 859 | - ) | |
| 860 | - ); | |
| 861 | - if (i < lng - 1) { | |
| 862 | - bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start)); | |
| 863 | - } | |
| 864 | - } | |
| 865 | - if (matchPos[lng - 1].wholeMatch.end < str.length) { | |
| 866 | - bits.push(str.slice(matchPos[lng - 1].wholeMatch.end)); | |
| 867 | - } | |
| 868 | - finalStr = bits.join(''); | |
| 869 | - } | |
| 870 | - return finalStr; | |
| 871 | -}; | |
| 872 | - | |
| 873 | -/** | |
| 874 | - * Returns the index within the passed String object of the first occurrence of the specified regex, | |
| 875 | - * starting the search at fromIndex. Returns -1 if the value is not found. | |
| 876 | - * | |
| 877 | - * @param {string} str string to search | |
| 878 | - * @param {RegExp} regex Regular expression to search | |
| 879 | - * @param {int} [fromIndex = 0] Index to start the search | |
| 880 | - * @returns {Number} | |
| 881 | - * @throws InvalidArgumentError | |
| 882 | - */ | |
| 883 | -showdown.helper.regexIndexOf = function (str, regex, fromIndex) { | |
| 884 | - 'use strict'; | |
| 885 | - if (!showdown.helper.isString(str)) { | |
| 886 | - throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string'; | |
| 887 | - } | |
| 888 | - if (regex instanceof RegExp === false) { | |
| 889 | - throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp'; | |
| 890 | - } | |
| 891 | - var indexOf = str.substring(fromIndex || 0).search(regex); | |
| 892 | - return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf; | |
| 893 | -}; | |
| 894 | - | |
| 895 | -/** | |
| 896 | - * Splits the passed string object at the defined index, and returns an array composed of the two substrings | |
| 897 | - * @param {string} str string to split | |
| 898 | - * @param {int} index index to split string at | |
| 899 | - * @returns {[string,string]} | |
| 900 | - * @throws InvalidArgumentError | |
| 901 | - */ | |
| 902 | -showdown.helper.splitAtIndex = function (str, index) { | |
| 903 | - 'use strict'; | |
| 904 | - if (!showdown.helper.isString(str)) { | |
| 905 | - throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string'; | |
| 906 | - } | |
| 907 | - return [str.substring(0, index), str.substring(index)]; | |
| 908 | -}; | |
| 909 | - | |
| 910 | -/** | |
| 911 | - * Obfuscate an e-mail address through the use of Character Entities, | |
| 912 | - * transforming ASCII characters into their equivalent decimal or hex entities. | |
| 913 | - * | |
| 914 | - * Since it has a random component, subsequent calls to this function produce different results | |
| 915 | - * | |
| 916 | - * @param {string} mail | |
| 917 | - * @returns {string} | |
| 918 | - */ | |
| 919 | -showdown.helper.encodeEmailAddress = function (mail) { | |
| 920 | - 'use strict'; | |
| 921 | - var encode = [ | |
| 922 | - function (ch) { | |
| 923 | - return '&#' + ch.charCodeAt(0) + ';'; | |
| 924 | - }, | |
| 925 | - function (ch) { | |
| 926 | - return '&#x' + ch.charCodeAt(0).toString(16) + ';'; | |
| 927 | - }, | |
| 928 | - function (ch) { | |
| 929 | - return ch; | |
| 930 | - } | |
| 931 | - ]; | |
| 932 | - | |
| 933 | - mail = mail.replace(/./g, function (ch) { | |
| 934 | - if (ch === '@') { | |
| 935 | - // this *must* be encoded. I insist. | |
| 936 | - ch = encode[Math.floor(Math.random() * 2)](ch); | |
| 937 | - } else { | |
| 938 | - var r = Math.random(); | |
| 939 | - // roughly 10% raw, 45% hex, 45% dec | |
| 940 | - ch = ( | |
| 941 | - r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch) | |
| 942 | - ); | |
| 943 | - } | |
| 944 | - return ch; | |
| 945 | - }); | |
| 946 | - | |
| 947 | - return mail; | |
| 948 | -}; | |
| 949 | - | |
| 950 | -/** | |
| 951 | - * | |
| 952 | - * @param str | |
| 953 | - * @param targetLength | |
| 954 | - * @param padString | |
| 955 | - * @returns {string} | |
| 956 | - */ | |
| 957 | -showdown.helper.padEnd = function padEnd (str, targetLength, padString) { | |
| 958 | - 'use strict'; | |
| 959 | - /*jshint bitwise: false*/ | |
| 960 | - // eslint-disable-next-line space-infix-ops | |
| 961 | - targetLength = targetLength>>0; //floor if number or convert non-number to 0; | |
| 962 | - /*jshint bitwise: true*/ | |
| 963 | - padString = String(padString || ' '); | |
| 964 | - if (str.length > targetLength) { | |
| 965 | - return String(str); | |
| 966 | - } else { | |
| 967 | - targetLength = targetLength - str.length; | |
| 968 | - if (targetLength > padString.length) { | |
| 969 | - padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed | |
| 970 | - } | |
| 971 | - return String(str) + padString.slice(0,targetLength); | |
| 972 | - } | |
| 973 | -}; | |
| 974 | - | |
| 975 | -/** | |
| 976 | - * POLYFILLS | |
| 977 | - */ | |
| 978 | -// use this instead of builtin is undefined for IE8 compatibility | |
| 979 | -if (typeof console === 'undefined') { | |
| 980 | - console = { | |
| 981 | - warn: function (msg) { | |
| 982 | - 'use strict'; | |
| 983 | - alert(msg); | |
| 984 | - }, | |
| 985 | - log: function (msg) { | |
| 986 | - 'use strict'; | |
| 987 | - alert(msg); | |
| 988 | - }, | |
| 989 | - error: function (msg) { | |
| 990 | - 'use strict'; | |
| 991 | - throw msg; | |
| 992 | - } | |
| 993 | - }; | |
| 994 | -} | |
| 995 | - | |
| 996 | -/** | |
| 997 | - * Common regexes. | |
| 998 | - * We declare some common regexes to improve performance | |
| 999 | - */ | |
| 1000 | -showdown.helper.regexes = { | |
| 1001 | - asteriskDashAndColon: /([*_:~])/g | |
| 1002 | -}; | |
| 1003 | - | |
| 1004 | -/** | |
| 1005 | - * EMOJIS LIST | |
| 1006 | - */ | |
| 1007 | -showdown.helper.emojis = { | |
| 1008 | - '+1':'\ud83d\udc4d', | |
| 1009 | - '-1':'\ud83d\udc4e', | |
| 1010 | - '100':'\ud83d\udcaf', | |
| 1011 | - '1234':'\ud83d\udd22', | |
| 1012 | - '1st_place_medal':'\ud83e\udd47', | |
| 1013 | - '2nd_place_medal':'\ud83e\udd48', | |
| 1014 | - '3rd_place_medal':'\ud83e\udd49', | |
| 1015 | - '8ball':'\ud83c\udfb1', | |
| 1016 | - 'a':'\ud83c\udd70\ufe0f', | |
| 1017 | - 'ab':'\ud83c\udd8e', | |
| 1018 | - 'abc':'\ud83d\udd24', | |
| 1019 | - 'abcd':'\ud83d\udd21', | |
| 1020 | - 'accept':'\ud83c\ude51', | |
| 1021 | - 'aerial_tramway':'\ud83d\udea1', | |
| 1022 | - 'airplane':'\u2708\ufe0f', | |
| 1023 | - 'alarm_clock':'\u23f0', | |
| 1024 | - 'alembic':'\u2697\ufe0f', | |
| 1025 | - 'alien':'\ud83d\udc7d', | |
| 1026 | - 'ambulance':'\ud83d\ude91', | |
| 1027 | - 'amphora':'\ud83c\udffa', | |
| 1028 | - 'anchor':'\u2693\ufe0f', | |
| 1029 | - 'angel':'\ud83d\udc7c', | |
| 1030 | - 'anger':'\ud83d\udca2', | |
| 1031 | - 'angry':'\ud83d\ude20', | |
| 1032 | - 'anguished':'\ud83d\ude27', | |
| 1033 | - 'ant':'\ud83d\udc1c', | |
| 1034 | - 'apple':'\ud83c\udf4e', | |
| 1035 | - 'aquarius':'\u2652\ufe0f', | |
| 1036 | - 'aries':'\u2648\ufe0f', | |
| 1037 | - 'arrow_backward':'\u25c0\ufe0f', | |
| 1038 | - 'arrow_double_down':'\u23ec', | |
| 1039 | - 'arrow_double_up':'\u23eb', | |
| 1040 | - 'arrow_down':'\u2b07\ufe0f', | |
| 1041 | - 'arrow_down_small':'\ud83d\udd3d', | |
| 1042 | - 'arrow_forward':'\u25b6\ufe0f', | |
| 1043 | - 'arrow_heading_down':'\u2935\ufe0f', | |
| 1044 | - 'arrow_heading_up':'\u2934\ufe0f', | |
| 1045 | - 'arrow_left':'\u2b05\ufe0f', | |
| 1046 | - 'arrow_lower_left':'\u2199\ufe0f', | |
| 1047 | - 'arrow_lower_right':'\u2198\ufe0f', | |
| 1048 | - 'arrow_right':'\u27a1\ufe0f', | |
| 1049 | - 'arrow_right_hook':'\u21aa\ufe0f', | |
| 1050 | - 'arrow_up':'\u2b06\ufe0f', | |
| 1051 | - 'arrow_up_down':'\u2195\ufe0f', | |
| 1052 | - 'arrow_up_small':'\ud83d\udd3c', | |
| 1053 | - 'arrow_upper_left':'\u2196\ufe0f', | |
| 1054 | - 'arrow_upper_right':'\u2197\ufe0f', | |
| 1055 | - 'arrows_clockwise':'\ud83d\udd03', | |
| 1056 | - 'arrows_counterclockwise':'\ud83d\udd04', | |
| 1057 | - 'art':'\ud83c\udfa8', | |
| 1058 | - 'articulated_lorry':'\ud83d\ude9b', | |
| 1059 | - 'artificial_satellite':'\ud83d\udef0', | |
| 1060 | - 'astonished':'\ud83d\ude32', | |
| 1061 | - 'athletic_shoe':'\ud83d\udc5f', | |
| 1062 | - 'atm':'\ud83c\udfe7', | |
| 1063 | - 'atom_symbol':'\u269b\ufe0f', | |
| 1064 | - 'avocado':'\ud83e\udd51', | |
| 1065 | - 'b':'\ud83c\udd71\ufe0f', | |
| 1066 | - 'baby':'\ud83d\udc76', | |
| 1067 | - 'baby_bottle':'\ud83c\udf7c', | |
| 1068 | - 'baby_chick':'\ud83d\udc24', | |
| 1069 | - 'baby_symbol':'\ud83d\udebc', | |
| 1070 | - 'back':'\ud83d\udd19', | |
| 1071 | - 'bacon':'\ud83e\udd53', | |
| 1072 | - 'badminton':'\ud83c\udff8', | |
| 1073 | - 'baggage_claim':'\ud83d\udec4', | |
| 1074 | - 'baguette_bread':'\ud83e\udd56', | |
| 1075 | - 'balance_scale':'\u2696\ufe0f', | |
| 1076 | - 'balloon':'\ud83c\udf88', | |
| 1077 | - 'ballot_box':'\ud83d\uddf3', | |
| 1078 | - 'ballot_box_with_check':'\u2611\ufe0f', | |
| 1079 | - 'bamboo':'\ud83c\udf8d', | |
| 1080 | - 'banana':'\ud83c\udf4c', | |
| 1081 | - 'bangbang':'\u203c\ufe0f', | |
| 1082 | - 'bank':'\ud83c\udfe6', | |
| 1083 | - 'bar_chart':'\ud83d\udcca', | |
| 1084 | - 'barber':'\ud83d\udc88', | |
| 1085 | - 'baseball':'\u26be\ufe0f', | |
| 1086 | - 'basketball':'\ud83c\udfc0', | |
| 1087 | - 'basketball_man':'\u26f9\ufe0f', | |
| 1088 | - 'basketball_woman':'\u26f9\ufe0f‍\u2640\ufe0f', | |
| 1089 | - 'bat':'\ud83e\udd87', | |
| 1090 | - 'bath':'\ud83d\udec0', | |
| 1091 | - 'bathtub':'\ud83d\udec1', | |
| 1092 | - 'battery':'\ud83d\udd0b', | |
| 1093 | - 'beach_umbrella':'\ud83c\udfd6', | |
| 1094 | - 'bear':'\ud83d\udc3b', | |
| 1095 | - 'bed':'\ud83d\udecf', | |
| 1096 | - 'bee':'\ud83d\udc1d', | |
| 1097 | - 'beer':'\ud83c\udf7a', | |
| 1098 | - 'beers':'\ud83c\udf7b', | |
| 1099 | - 'beetle':'\ud83d\udc1e', | |
| 1100 | - 'beginner':'\ud83d\udd30', | |
| 1101 | - 'bell':'\ud83d\udd14', | |
| 1102 | - 'bellhop_bell':'\ud83d\udece', | |
| 1103 | - 'bento':'\ud83c\udf71', | |
| 1104 | - 'biking_man':'\ud83d\udeb4', | |
| 1105 | - 'bike':'\ud83d\udeb2', | |
| 1106 | - 'biking_woman':'\ud83d\udeb4‍\u2640\ufe0f', | |
| 1107 | - 'bikini':'\ud83d\udc59', | |
| 1108 | - 'biohazard':'\u2623\ufe0f', | |
| 1109 | - 'bird':'\ud83d\udc26', | |
| 1110 | - 'birthday':'\ud83c\udf82', | |
| 1111 | - 'black_circle':'\u26ab\ufe0f', | |
| 1112 | - 'black_flag':'\ud83c\udff4', | |
| 1113 | - 'black_heart':'\ud83d\udda4', | |
| 1114 | - 'black_joker':'\ud83c\udccf', | |
| 1115 | - 'black_large_square':'\u2b1b\ufe0f', | |
| 1116 | - 'black_medium_small_square':'\u25fe\ufe0f', | |
| 1117 | - 'black_medium_square':'\u25fc\ufe0f', | |
| 1118 | - 'black_nib':'\u2712\ufe0f', | |
| 1119 | - 'black_small_square':'\u25aa\ufe0f', | |
| 1120 | - 'black_square_button':'\ud83d\udd32', | |
| 1121 | - 'blonde_man':'\ud83d\udc71', | |
| 1122 | - 'blonde_woman':'\ud83d\udc71‍\u2640\ufe0f', | |
| 1123 | - 'blossom':'\ud83c\udf3c', | |
| 1124 | - 'blowfish':'\ud83d\udc21', | |
| 1125 | - 'blue_book':'\ud83d\udcd8', | |
| 1126 | - 'blue_car':'\ud83d\ude99', | |
| 1127 | - 'blue_heart':'\ud83d\udc99', | |
| 1128 | - 'blush':'\ud83d\ude0a', | |
| 1129 | - 'boar':'\ud83d\udc17', | |
| 1130 | - 'boat':'\u26f5\ufe0f', | |
| 1131 | - 'bomb':'\ud83d\udca3', | |
| 1132 | - 'book':'\ud83d\udcd6', | |
| 1133 | - 'bookmark':'\ud83d\udd16', | |
| 1134 | - 'bookmark_tabs':'\ud83d\udcd1', | |
| 1135 | - 'books':'\ud83d\udcda', | |
| 1136 | - 'boom':'\ud83d\udca5', | |
| 1137 | - 'boot':'\ud83d\udc62', | |
| 1138 | - 'bouquet':'\ud83d\udc90', | |
| 1139 | - 'bowing_man':'\ud83d\ude47', | |
| 1140 | - 'bow_and_arrow':'\ud83c\udff9', | |
| 1141 | - 'bowing_woman':'\ud83d\ude47‍\u2640\ufe0f', | |
| 1142 | - 'bowling':'\ud83c\udfb3', | |
| 1143 | - 'boxing_glove':'\ud83e\udd4a', | |
| 1144 | - 'boy':'\ud83d\udc66', | |
| 1145 | - 'bread':'\ud83c\udf5e', | |
| 1146 | - 'bride_with_veil':'\ud83d\udc70', | |
| 1147 | - 'bridge_at_night':'\ud83c\udf09', | |
| 1148 | - 'briefcase':'\ud83d\udcbc', | |
| 1149 | - 'broken_heart':'\ud83d\udc94', | |
| 1150 | - 'bug':'\ud83d\udc1b', | |
| 1151 | - 'building_construction':'\ud83c\udfd7', | |
| 1152 | - 'bulb':'\ud83d\udca1', | |
| 1153 | - 'bullettrain_front':'\ud83d\ude85', | |
| 1154 | - 'bullettrain_side':'\ud83d\ude84', | |
| 1155 | - 'burrito':'\ud83c\udf2f', | |
| 1156 | - 'bus':'\ud83d\ude8c', | |
| 1157 | - 'business_suit_levitating':'\ud83d\udd74', | |
| 1158 | - 'busstop':'\ud83d\ude8f', | |
| 1159 | - 'bust_in_silhouette':'\ud83d\udc64', | |
| 1160 | - 'busts_in_silhouette':'\ud83d\udc65', | |
| 1161 | - 'butterfly':'\ud83e\udd8b', | |
| 1162 | - 'cactus':'\ud83c\udf35', | |
| 1163 | - 'cake':'\ud83c\udf70', | |
| 1164 | - 'calendar':'\ud83d\udcc6', | |
| 1165 | - 'call_me_hand':'\ud83e\udd19', | |
| 1166 | - 'calling':'\ud83d\udcf2', | |
| 1167 | - 'camel':'\ud83d\udc2b', | |
| 1168 | - 'camera':'\ud83d\udcf7', | |
| 1169 | - 'camera_flash':'\ud83d\udcf8', | |
| 1170 | - 'camping':'\ud83c\udfd5', | |
| 1171 | - 'cancer':'\u264b\ufe0f', | |
| 1172 | - 'candle':'\ud83d\udd6f', | |
| 1173 | - 'candy':'\ud83c\udf6c', | |
| 1174 | - 'canoe':'\ud83d\udef6', | |
| 1175 | - 'capital_abcd':'\ud83d\udd20', | |
| 1176 | - 'capricorn':'\u2651\ufe0f', | |
| 1177 | - 'car':'\ud83d\ude97', | |
| 1178 | - 'card_file_box':'\ud83d\uddc3', | |
| 1179 | - 'card_index':'\ud83d\udcc7', | |
| 1180 | - 'card_index_dividers':'\ud83d\uddc2', | |
| 1181 | - 'carousel_horse':'\ud83c\udfa0', | |
| 1182 | - 'carrot':'\ud83e\udd55', | |
| 1183 | - 'cat':'\ud83d\udc31', | |
| 1184 | - 'cat2':'\ud83d\udc08', | |
| 1185 | - 'cd':'\ud83d\udcbf', | |
| 1186 | - 'chains':'\u26d3', | |
| 1187 | - 'champagne':'\ud83c\udf7e', | |
| 1188 | - 'chart':'\ud83d\udcb9', | |
| 1189 | - 'chart_with_downwards_trend':'\ud83d\udcc9', | |
| 1190 | - 'chart_with_upwards_trend':'\ud83d\udcc8', | |
| 1191 | - 'checkered_flag':'\ud83c\udfc1', | |
| 1192 | - 'cheese':'\ud83e\uddc0', | |
| 1193 | - 'cherries':'\ud83c\udf52', | |
| 1194 | - 'cherry_blossom':'\ud83c\udf38', | |
| 1195 | - 'chestnut':'\ud83c\udf30', | |
| 1196 | - 'chicken':'\ud83d\udc14', | |
| 1197 | - 'children_crossing':'\ud83d\udeb8', | |
| 1198 | - 'chipmunk':'\ud83d\udc3f', | |
| 1199 | - 'chocolate_bar':'\ud83c\udf6b', | |
| 1200 | - 'christmas_tree':'\ud83c\udf84', | |
| 1201 | - 'church':'\u26ea\ufe0f', | |
| 1202 | - 'cinema':'\ud83c\udfa6', | |
| 1203 | - 'circus_tent':'\ud83c\udfaa', | |
| 1204 | - 'city_sunrise':'\ud83c\udf07', | |
| 1205 | - 'city_sunset':'\ud83c\udf06', | |
| 1206 | - 'cityscape':'\ud83c\udfd9', | |
| 1207 | - 'cl':'\ud83c\udd91', | |
| 1208 | - 'clamp':'\ud83d\udddc', | |
| 1209 | - 'clap':'\ud83d\udc4f', | |
| 1210 | - 'clapper':'\ud83c\udfac', | |
| 1211 | - 'classical_building':'\ud83c\udfdb', | |
| 1212 | - 'clinking_glasses':'\ud83e\udd42', | |
| 1213 | - 'clipboard':'\ud83d\udccb', | |
| 1214 | - 'clock1':'\ud83d\udd50', | |
| 1215 | - 'clock10':'\ud83d\udd59', | |
| 1216 | - 'clock1030':'\ud83d\udd65', | |
| 1217 | - 'clock11':'\ud83d\udd5a', | |
| 1218 | - 'clock1130':'\ud83d\udd66', | |
| 1219 | - 'clock12':'\ud83d\udd5b', | |
| 1220 | - 'clock1230':'\ud83d\udd67', | |
| 1221 | - 'clock130':'\ud83d\udd5c', | |
| 1222 | - 'clock2':'\ud83d\udd51', | |
| 1223 | - 'clock230':'\ud83d\udd5d', | |
| 1224 | - 'clock3':'\ud83d\udd52', | |
| 1225 | - 'clock330':'\ud83d\udd5e', | |
| 1226 | - 'clock4':'\ud83d\udd53', | |
| 1227 | - 'clock430':'\ud83d\udd5f', | |
| 1228 | - 'clock5':'\ud83d\udd54', | |
| 1229 | - 'clock530':'\ud83d\udd60', | |
| 1230 | - 'clock6':'\ud83d\udd55', | |
| 1231 | - 'clock630':'\ud83d\udd61', | |
| 1232 | - 'clock7':'\ud83d\udd56', | |
| 1233 | - 'clock730':'\ud83d\udd62', | |
| 1234 | - 'clock8':'\ud83d\udd57', | |
| 1235 | - 'clock830':'\ud83d\udd63', | |
| 1236 | - 'clock9':'\ud83d\udd58', | |
| 1237 | - 'clock930':'\ud83d\udd64', | |
| 1238 | - 'closed_book':'\ud83d\udcd5', | |
| 1239 | - 'closed_lock_with_key':'\ud83d\udd10', | |
| 1240 | - 'closed_umbrella':'\ud83c\udf02', | |
| 1241 | - 'cloud':'\u2601\ufe0f', | |
| 1242 | - 'cloud_with_lightning':'\ud83c\udf29', | |
| 1243 | - 'cloud_with_lightning_and_rain':'\u26c8', | |
| 1244 | - 'cloud_with_rain':'\ud83c\udf27', | |
| 1245 | - 'cloud_with_snow':'\ud83c\udf28', | |
| 1246 | - 'clown_face':'\ud83e\udd21', | |
| 1247 | - 'clubs':'\u2663\ufe0f', | |
| 1248 | - 'cocktail':'\ud83c\udf78', | |
| 1249 | - 'coffee':'\u2615\ufe0f', | |
| 1250 | - 'coffin':'\u26b0\ufe0f', | |
| 1251 | - 'cold_sweat':'\ud83d\ude30', | |
| 1252 | - 'comet':'\u2604\ufe0f', | |
| 1253 | - 'computer':'\ud83d\udcbb', | |
| 1254 | - 'computer_mouse':'\ud83d\uddb1', | |
| 1255 | - 'confetti_ball':'\ud83c\udf8a', | |
| 1256 | - 'confounded':'\ud83d\ude16', | |
| 1257 | - 'confused':'\ud83d\ude15', | |
| 1258 | - 'congratulations':'\u3297\ufe0f', | |
| 1259 | - 'construction':'\ud83d\udea7', | |
| 1260 | - 'construction_worker_man':'\ud83d\udc77', | |
| 1261 | - 'construction_worker_woman':'\ud83d\udc77‍\u2640\ufe0f', | |
| 1262 | - 'control_knobs':'\ud83c\udf9b', | |
| 1263 | - 'convenience_store':'\ud83c\udfea', | |
| 1264 | - 'cookie':'\ud83c\udf6a', | |
| 1265 | - 'cool':'\ud83c\udd92', | |
| 1266 | - 'policeman':'\ud83d\udc6e', | |
| 1267 | - 'copyright':'\u00a9\ufe0f', | |
| 1268 | - 'corn':'\ud83c\udf3d', | |
| 1269 | - 'couch_and_lamp':'\ud83d\udecb', | |
| 1270 | - 'couple':'\ud83d\udc6b', | |
| 1271 | - 'couple_with_heart_woman_man':'\ud83d\udc91', | |
| 1272 | - 'couple_with_heart_man_man':'\ud83d\udc68‍\u2764\ufe0f‍\ud83d\udc68', | |
| 1273 | - 'couple_with_heart_woman_woman':'\ud83d\udc69‍\u2764\ufe0f‍\ud83d\udc69', | |
| 1274 | - 'couplekiss_man_man':'\ud83d\udc68‍\u2764\ufe0f‍\ud83d\udc8b‍\ud83d\udc68', | |
| 1275 | - 'couplekiss_man_woman':'\ud83d\udc8f', | |
| 1276 | - 'couplekiss_woman_woman':'\ud83d\udc69‍\u2764\ufe0f‍\ud83d\udc8b‍\ud83d\udc69', | |
| 1277 | - 'cow':'\ud83d\udc2e', | |
| 1278 | - 'cow2':'\ud83d\udc04', | |
| 1279 | - 'cowboy_hat_face':'\ud83e\udd20', | |
| 1280 | - 'crab':'\ud83e\udd80', | |
| 1281 | - 'crayon':'\ud83d\udd8d', | |
| 1282 | - 'credit_card':'\ud83d\udcb3', | |
| 1283 | - 'crescent_moon':'\ud83c\udf19', | |
| 1284 | - 'cricket':'\ud83c\udfcf', | |
| 1285 | - 'crocodile':'\ud83d\udc0a', | |
| 1286 | - 'croissant':'\ud83e\udd50', | |
| 1287 | - 'crossed_fingers':'\ud83e\udd1e', | |
| 1288 | - 'crossed_flags':'\ud83c\udf8c', | |
| 1289 | - 'crossed_swords':'\u2694\ufe0f', | |
| 1290 | - 'crown':'\ud83d\udc51', | |
| 1291 | - 'cry':'\ud83d\ude22', | |
| 1292 | - 'crying_cat_face':'\ud83d\ude3f', | |
| 1293 | - 'crystal_ball':'\ud83d\udd2e', | |
| 1294 | - 'cucumber':'\ud83e\udd52', | |
| 1295 | - 'cupid':'\ud83d\udc98', | |
| 1296 | - 'curly_loop':'\u27b0', | |
| 1297 | - 'currency_exchange':'\ud83d\udcb1', | |
| 1298 | - 'curry':'\ud83c\udf5b', | |
| 1299 | - 'custard':'\ud83c\udf6e', | |
| 1300 | - 'customs':'\ud83d\udec3', | |
| 1301 | - 'cyclone':'\ud83c\udf00', | |
| 1302 | - 'dagger':'\ud83d\udde1', | |
| 1303 | - 'dancer':'\ud83d\udc83', | |
| 1304 | - 'dancing_women':'\ud83d\udc6f', | |
| 1305 | - 'dancing_men':'\ud83d\udc6f‍\u2642\ufe0f', | |
| 1306 | - 'dango':'\ud83c\udf61', | |
| 1307 | - 'dark_sunglasses':'\ud83d\udd76', | |
| 1308 | - 'dart':'\ud83c\udfaf', | |
| 1309 | - 'dash':'\ud83d\udca8', | |
| 1310 | - 'date':'\ud83d\udcc5', | |
| 1311 | - 'deciduous_tree':'\ud83c\udf33', | |
| 1312 | - 'deer':'\ud83e\udd8c', | |
| 1313 | - 'department_store':'\ud83c\udfec', | |
| 1314 | - 'derelict_house':'\ud83c\udfda', | |
| 1315 | - 'desert':'\ud83c\udfdc', | |
| 1316 | - 'desert_island':'\ud83c\udfdd', | |
| 1317 | - 'desktop_computer':'\ud83d\udda5', | |
| 1318 | - 'male_detective':'\ud83d\udd75\ufe0f', | |
| 1319 | - 'diamond_shape_with_a_dot_inside':'\ud83d\udca0', | |
| 1320 | - 'diamonds':'\u2666\ufe0f', | |
| 1321 | - 'disappointed':'\ud83d\ude1e', | |
| 1322 | - 'disappointed_relieved':'\ud83d\ude25', | |
| 1323 | - 'dizzy':'\ud83d\udcab', | |
| 1324 | - 'dizzy_face':'\ud83d\ude35', | |
| 1325 | - 'do_not_litter':'\ud83d\udeaf', | |
| 1326 | - 'dog':'\ud83d\udc36', | |
| 1327 | - 'dog2':'\ud83d\udc15', | |
| 1328 | - 'dollar':'\ud83d\udcb5', | |
| 1329 | - 'dolls':'\ud83c\udf8e', | |
| 1330 | - 'dolphin':'\ud83d\udc2c', | |
| 1331 | - 'door':'\ud83d\udeaa', | |
| 1332 | - 'doughnut':'\ud83c\udf69', | |
| 1333 | - 'dove':'\ud83d\udd4a', | |
| 1334 | - 'dragon':'\ud83d\udc09', | |
| 1335 | - 'dragon_face':'\ud83d\udc32', | |
| 1336 | - 'dress':'\ud83d\udc57', | |
| 1337 | - 'dromedary_camel':'\ud83d\udc2a', | |
| 1338 | - 'drooling_face':'\ud83e\udd24', | |
| 1339 | - 'droplet':'\ud83d\udca7', | |
| 1340 | - 'drum':'\ud83e\udd41', | |
| 1341 | - 'duck':'\ud83e\udd86', | |
| 1342 | - 'dvd':'\ud83d\udcc0', | |
| 1343 | - 'e-mail':'\ud83d\udce7', | |
| 1344 | - 'eagle':'\ud83e\udd85', | |
| 1345 | - 'ear':'\ud83d\udc42', | |
| 1346 | - 'ear_of_rice':'\ud83c\udf3e', | |
| 1347 | - 'earth_africa':'\ud83c\udf0d', | |
| 1348 | - 'earth_americas':'\ud83c\udf0e', | |
| 1349 | - 'earth_asia':'\ud83c\udf0f', | |
| 1350 | - 'egg':'\ud83e\udd5a', | |
| 1351 | - 'eggplant':'\ud83c\udf46', | |
| 1352 | - 'eight_pointed_black_star':'\u2734\ufe0f', | |
| 1353 | - 'eight_spoked_asterisk':'\u2733\ufe0f', | |
| 1354 | - 'electric_plug':'\ud83d\udd0c', | |
| 1355 | - 'elephant':'\ud83d\udc18', | |
| 1356 | - 'email':'\u2709\ufe0f', | |
| 1357 | - 'end':'\ud83d\udd1a', | |
| 1358 | - 'envelope_with_arrow':'\ud83d\udce9', | |
| 1359 | - 'euro':'\ud83d\udcb6', | |
| 1360 | - 'european_castle':'\ud83c\udff0', | |
| 1361 | - 'european_post_office':'\ud83c\udfe4', | |
| 1362 | - 'evergreen_tree':'\ud83c\udf32', | |
| 1363 | - 'exclamation':'\u2757\ufe0f', | |
| 1364 | - 'expressionless':'\ud83d\ude11', | |
| 1365 | - 'eye':'\ud83d\udc41', | |
| 1366 | - 'eye_speech_bubble':'\ud83d\udc41‍\ud83d\udde8', | |
| 1367 | - 'eyeglasses':'\ud83d\udc53', | |
| 1368 | - 'eyes':'\ud83d\udc40', | |
| 1369 | - 'face_with_head_bandage':'\ud83e\udd15', | |
| 1370 | - 'face_with_thermometer':'\ud83e\udd12', | |
| 1371 | - 'fist_oncoming':'\ud83d\udc4a', | |
| 1372 | - 'factory':'\ud83c\udfed', | |
| 1373 | - 'fallen_leaf':'\ud83c\udf42', | |
| 1374 | - 'family_man_woman_boy':'\ud83d\udc6a', | |
| 1375 | - 'family_man_boy':'\ud83d\udc68‍\ud83d\udc66', | |
| 1376 | - 'family_man_boy_boy':'\ud83d\udc68‍\ud83d\udc66‍\ud83d\udc66', | |
| 1377 | - 'family_man_girl':'\ud83d\udc68‍\ud83d\udc67', | |
| 1378 | - 'family_man_girl_boy':'\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc66', | |
| 1379 | - 'family_man_girl_girl':'\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc67', | |
| 1380 | - 'family_man_man_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc66', | |
| 1381 | - 'family_man_man_boy_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc66‍\ud83d\udc66', | |
| 1382 | - 'family_man_man_girl':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67', | |
| 1383 | - 'family_man_man_girl_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc66', | |
| 1384 | - 'family_man_man_girl_girl':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc67', | |
| 1385 | - 'family_man_woman_boy_boy':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66', | |
| 1386 | - 'family_man_woman_girl':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67', | |
| 1387 | - 'family_man_woman_girl_boy':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66', | |
| 1388 | - 'family_man_woman_girl_girl':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67', | |
| 1389 | - 'family_woman_boy':'\ud83d\udc69‍\ud83d\udc66', | |
| 1390 | - 'family_woman_boy_boy':'\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66', | |
| 1391 | - 'family_woman_girl':'\ud83d\udc69‍\ud83d\udc67', | |
| 1392 | - 'family_woman_girl_boy':'\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66', | |
| 1393 | - 'family_woman_girl_girl':'\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67', | |
| 1394 | - 'family_woman_woman_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc66', | |
| 1395 | - 'family_woman_woman_boy_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66', | |
| 1396 | - 'family_woman_woman_girl':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67', | |
| 1397 | - 'family_woman_woman_girl_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66', | |
| 1398 | - 'family_woman_woman_girl_girl':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67', | |
| 1399 | - 'fast_forward':'\u23e9', | |
| 1400 | - 'fax':'\ud83d\udce0', | |
| 1401 | - 'fearful':'\ud83d\ude28', | |
| 1402 | - 'feet':'\ud83d\udc3e', | |
| 1403 | - 'female_detective':'\ud83d\udd75\ufe0f‍\u2640\ufe0f', | |
| 1404 | - 'ferris_wheel':'\ud83c\udfa1', | |
| 1405 | - 'ferry':'\u26f4', | |
| 1406 | - 'field_hockey':'\ud83c\udfd1', | |
| 1407 | - 'file_cabinet':'\ud83d\uddc4', | |
| 1408 | - 'file_folder':'\ud83d\udcc1', | |
| 1409 | - 'film_projector':'\ud83d\udcfd', | |
| 1410 | - 'film_strip':'\ud83c\udf9e', | |
| 1411 | - 'fire':'\ud83d\udd25', | |
| 1412 | - 'fire_engine':'\ud83d\ude92', | |
| 1413 | - 'fireworks':'\ud83c\udf86', | |
| 1414 | - 'first_quarter_moon':'\ud83c\udf13', | |
| 1415 | - 'first_quarter_moon_with_face':'\ud83c\udf1b', | |
| 1416 | - 'fish':'\ud83d\udc1f', | |
| 1417 | - 'fish_cake':'\ud83c\udf65', | |
| 1418 | - 'fishing_pole_and_fish':'\ud83c\udfa3', | |
| 1419 | - 'fist_raised':'\u270a', | |
| 1420 | - 'fist_left':'\ud83e\udd1b', | |
| 1421 | - 'fist_right':'\ud83e\udd1c', | |
| 1422 | - 'flags':'\ud83c\udf8f', | |
| 1423 | - 'flashlight':'\ud83d\udd26', | |
| 1424 | - 'fleur_de_lis':'\u269c\ufe0f', | |
| 1425 | - 'flight_arrival':'\ud83d\udeec', | |
| 1426 | - 'flight_departure':'\ud83d\udeeb', | |
| 1427 | - 'floppy_disk':'\ud83d\udcbe', | |
| 1428 | - 'flower_playing_cards':'\ud83c\udfb4', | |
| 1429 | - 'flushed':'\ud83d\ude33', | |
| 1430 | - 'fog':'\ud83c\udf2b', | |
| 1431 | - 'foggy':'\ud83c\udf01', | |
| 1432 | - 'football':'\ud83c\udfc8', | |
| 1433 | - 'footprints':'\ud83d\udc63', | |
| 1434 | - 'fork_and_knife':'\ud83c\udf74', | |
| 1435 | - 'fountain':'\u26f2\ufe0f', | |
| 1436 | - 'fountain_pen':'\ud83d\udd8b', | |
| 1437 | - 'four_leaf_clover':'\ud83c\udf40', | |
| 1438 | - 'fox_face':'\ud83e\udd8a', | |
| 1439 | - 'framed_picture':'\ud83d\uddbc', | |
| 1440 | - 'free':'\ud83c\udd93', | |
| 1441 | - 'fried_egg':'\ud83c\udf73', | |
| 1442 | - 'fried_shrimp':'\ud83c\udf64', | |
| 1443 | - 'fries':'\ud83c\udf5f', | |
| 1444 | - 'frog':'\ud83d\udc38', | |
| 1445 | - 'frowning':'\ud83d\ude26', | |
| 1446 | - 'frowning_face':'\u2639\ufe0f', | |
| 1447 | - 'frowning_man':'\ud83d\ude4d‍\u2642\ufe0f', | |
| 1448 | - 'frowning_woman':'\ud83d\ude4d', | |
| 1449 | - 'middle_finger':'\ud83d\udd95', | |
| 1450 | - 'fuelpump':'\u26fd\ufe0f', | |
| 1451 | - 'full_moon':'\ud83c\udf15', | |
| 1452 | - 'full_moon_with_face':'\ud83c\udf1d', | |
| 1453 | - 'funeral_urn':'\u26b1\ufe0f', | |
| 1454 | - 'game_die':'\ud83c\udfb2', | |
| 1455 | - 'gear':'\u2699\ufe0f', | |
| 1456 | - 'gem':'\ud83d\udc8e', | |
| 1457 | - 'gemini':'\u264a\ufe0f', | |
| 1458 | - 'ghost':'\ud83d\udc7b', | |
| 1459 | - 'gift':'\ud83c\udf81', | |
| 1460 | - 'gift_heart':'\ud83d\udc9d', | |
| 1461 | - 'girl':'\ud83d\udc67', | |
| 1462 | - 'globe_with_meridians':'\ud83c\udf10', | |
| 1463 | - 'goal_net':'\ud83e\udd45', | |
| 1464 | - 'goat':'\ud83d\udc10', | |
| 1465 | - 'golf':'\u26f3\ufe0f', | |
| 1466 | - 'golfing_man':'\ud83c\udfcc\ufe0f', | |
| 1467 | - 'golfing_woman':'\ud83c\udfcc\ufe0f‍\u2640\ufe0f', | |
| 1468 | - 'gorilla':'\ud83e\udd8d', | |
| 1469 | - 'grapes':'\ud83c\udf47', | |
| 1470 | - 'green_apple':'\ud83c\udf4f', | |
| 1471 | - 'green_book':'\ud83d\udcd7', | |
| 1472 | - 'green_heart':'\ud83d\udc9a', | |
| 1473 | - 'green_salad':'\ud83e\udd57', | |
| 1474 | - 'grey_exclamation':'\u2755', | |
| 1475 | - 'grey_question':'\u2754', | |
| 1476 | - 'grimacing':'\ud83d\ude2c', | |
| 1477 | - 'grin':'\ud83d\ude01', | |
| 1478 | - 'grinning':'\ud83d\ude00', | |
| 1479 | - 'guardsman':'\ud83d\udc82', | |
| 1480 | - 'guardswoman':'\ud83d\udc82‍\u2640\ufe0f', | |
| 1481 | - 'guitar':'\ud83c\udfb8', | |
| 1482 | - 'gun':'\ud83d\udd2b', | |
| 1483 | - 'haircut_woman':'\ud83d\udc87', | |
| 1484 | - 'haircut_man':'\ud83d\udc87‍\u2642\ufe0f', | |
| 1485 | - 'hamburger':'\ud83c\udf54', | |
| 1486 | - 'hammer':'\ud83d\udd28', | |
| 1487 | - 'hammer_and_pick':'\u2692', | |
| 1488 | - 'hammer_and_wrench':'\ud83d\udee0', | |
| 1489 | - 'hamster':'\ud83d\udc39', | |
| 1490 | - 'hand':'\u270b', | |
| 1491 | - 'handbag':'\ud83d\udc5c', | |
| 1492 | - 'handshake':'\ud83e\udd1d', | |
| 1493 | - 'hankey':'\ud83d\udca9', | |
| 1494 | - 'hatched_chick':'\ud83d\udc25', | |
| 1495 | - 'hatching_chick':'\ud83d\udc23', | |
| 1496 | - 'headphones':'\ud83c\udfa7', | |
| 1497 | - 'hear_no_evil':'\ud83d\ude49', | |
| 1498 | - 'heart':'\u2764\ufe0f', | |
| 1499 | - 'heart_decoration':'\ud83d\udc9f', | |
| 1500 | - 'heart_eyes':'\ud83d\ude0d', | |
| 1501 | - 'heart_eyes_cat':'\ud83d\ude3b', | |
| 1502 | - 'heartbeat':'\ud83d\udc93', | |
| 1503 | - 'heartpulse':'\ud83d\udc97', | |
| 1504 | - 'hearts':'\u2665\ufe0f', | |
| 1505 | - 'heavy_check_mark':'\u2714\ufe0f', | |
| 1506 | - 'heavy_division_sign':'\u2797', | |
| 1507 | - 'heavy_dollar_sign':'\ud83d\udcb2', | |
| 1508 | - 'heavy_heart_exclamation':'\u2763\ufe0f', | |
| 1509 | - 'heavy_minus_sign':'\u2796', | |
| 1510 | - 'heavy_multiplication_x':'\u2716\ufe0f', | |
| 1511 | - 'heavy_plus_sign':'\u2795', | |
| 1512 | - 'helicopter':'\ud83d\ude81', | |
| 1513 | - 'herb':'\ud83c\udf3f', | |
| 1514 | - 'hibiscus':'\ud83c\udf3a', | |
| 1515 | - 'high_brightness':'\ud83d\udd06', | |
| 1516 | - 'high_heel':'\ud83d\udc60', | |
| 1517 | - 'hocho':'\ud83d\udd2a', | |
| 1518 | - 'hole':'\ud83d\udd73', | |
| 1519 | - 'honey_pot':'\ud83c\udf6f', | |
| 1520 | - 'horse':'\ud83d\udc34', | |
| 1521 | - 'horse_racing':'\ud83c\udfc7', | |
| 1522 | - 'hospital':'\ud83c\udfe5', | |
| 1523 | - 'hot_pepper':'\ud83c\udf36', | |
| 1524 | - 'hotdog':'\ud83c\udf2d', | |
| 1525 | - 'hotel':'\ud83c\udfe8', | |
| 1526 | - 'hotsprings':'\u2668\ufe0f', | |
| 1527 | - 'hourglass':'\u231b\ufe0f', | |
| 1528 | - 'hourglass_flowing_sand':'\u23f3', | |
| 1529 | - 'house':'\ud83c\udfe0', | |
| 1530 | - 'house_with_garden':'\ud83c\udfe1', | |
| 1531 | - 'houses':'\ud83c\udfd8', | |
| 1532 | - 'hugs':'\ud83e\udd17', | |
| 1533 | - 'hushed':'\ud83d\ude2f', | |
| 1534 | - 'ice_cream':'\ud83c\udf68', | |
| 1535 | - 'ice_hockey':'\ud83c\udfd2', | |
| 1536 | - 'ice_skate':'\u26f8', | |
| 1537 | - 'icecream':'\ud83c\udf66', | |
| 1538 | - 'id':'\ud83c\udd94', | |
| 1539 | - 'ideograph_advantage':'\ud83c\ude50', | |
| 1540 | - 'imp':'\ud83d\udc7f', | |
| 1541 | - 'inbox_tray':'\ud83d\udce5', | |
| 1542 | - 'incoming_envelope':'\ud83d\udce8', | |
| 1543 | - 'tipping_hand_woman':'\ud83d\udc81', | |
| 1544 | - 'information_source':'\u2139\ufe0f', | |
| 1545 | - 'innocent':'\ud83d\ude07', | |
| 1546 | - 'interrobang':'\u2049\ufe0f', | |
| 1547 | - 'iphone':'\ud83d\udcf1', | |
| 1548 | - 'izakaya_lantern':'\ud83c\udfee', | |
| 1549 | - 'jack_o_lantern':'\ud83c\udf83', | |
| 1550 | - 'japan':'\ud83d\uddfe', | |
| 1551 | - 'japanese_castle':'\ud83c\udfef', | |
| 1552 | - 'japanese_goblin':'\ud83d\udc7a', | |
| 1553 | - 'japanese_ogre':'\ud83d\udc79', | |
| 1554 | - 'jeans':'\ud83d\udc56', | |
| 1555 | - 'joy':'\ud83d\ude02', | |
| 1556 | - 'joy_cat':'\ud83d\ude39', | |
| 1557 | - 'joystick':'\ud83d\udd79', | |
| 1558 | - 'kaaba':'\ud83d\udd4b', | |
| 1559 | - 'key':'\ud83d\udd11', | |
| 1560 | - 'keyboard':'\u2328\ufe0f', | |
| 1561 | - 'keycap_ten':'\ud83d\udd1f', | |
| 1562 | - 'kick_scooter':'\ud83d\udef4', | |
| 1563 | - 'kimono':'\ud83d\udc58', | |
| 1564 | - 'kiss':'\ud83d\udc8b', | |
| 1565 | - 'kissing':'\ud83d\ude17', | |
| 1566 | - 'kissing_cat':'\ud83d\ude3d', | |
| 1567 | - 'kissing_closed_eyes':'\ud83d\ude1a', | |
| 1568 | - 'kissing_heart':'\ud83d\ude18', | |
| 1569 | - 'kissing_smiling_eyes':'\ud83d\ude19', | |
| 1570 | - 'kiwi_fruit':'\ud83e\udd5d', | |
| 1571 | - 'koala':'\ud83d\udc28', | |
| 1572 | - 'koko':'\ud83c\ude01', | |
| 1573 | - 'label':'\ud83c\udff7', | |
| 1574 | - 'large_blue_circle':'\ud83d\udd35', | |
| 1575 | - 'large_blue_diamond':'\ud83d\udd37', | |
| 1576 | - 'large_orange_diamond':'\ud83d\udd36', | |
| 1577 | - 'last_quarter_moon':'\ud83c\udf17', | |
| 1578 | - 'last_quarter_moon_with_face':'\ud83c\udf1c', | |
| 1579 | - 'latin_cross':'\u271d\ufe0f', | |
| 1580 | - 'laughing':'\ud83d\ude06', | |
| 1581 | - 'leaves':'\ud83c\udf43', | |
| 1582 | - 'ledger':'\ud83d\udcd2', | |
| 1583 | - 'left_luggage':'\ud83d\udec5', | |
| 1584 | - 'left_right_arrow':'\u2194\ufe0f', | |
| 1585 | - 'leftwards_arrow_with_hook':'\u21a9\ufe0f', | |
| 1586 | - 'lemon':'\ud83c\udf4b', | |
| 1587 | - 'leo':'\u264c\ufe0f', | |
| 1588 | - 'leopard':'\ud83d\udc06', | |
| 1589 | - 'level_slider':'\ud83c\udf9a', | |
| 1590 | - 'libra':'\u264e\ufe0f', | |
| 1591 | - 'light_rail':'\ud83d\ude88', | |
| 1592 | - 'link':'\ud83d\udd17', | |
| 1593 | - 'lion':'\ud83e\udd81', | |
| 1594 | - 'lips':'\ud83d\udc44', | |
| 1595 | - 'lipstick':'\ud83d\udc84', | |
| 1596 | - 'lizard':'\ud83e\udd8e', | |
| 1597 | - 'lock':'\ud83d\udd12', | |
| 1598 | - 'lock_with_ink_pen':'\ud83d\udd0f', | |
| 1599 | - 'lollipop':'\ud83c\udf6d', | |
| 1600 | - 'loop':'\u27bf', | |
| 1601 | - 'loud_sound':'\ud83d\udd0a', | |
| 1602 | - 'loudspeaker':'\ud83d\udce2', | |
| 1603 | - 'love_hotel':'\ud83c\udfe9', | |
| 1604 | - 'love_letter':'\ud83d\udc8c', | |
| 1605 | - 'low_brightness':'\ud83d\udd05', | |
| 1606 | - 'lying_face':'\ud83e\udd25', | |
| 1607 | - 'm':'\u24c2\ufe0f', | |
| 1608 | - 'mag':'\ud83d\udd0d', | |
| 1609 | - 'mag_right':'\ud83d\udd0e', | |
| 1610 | - 'mahjong':'\ud83c\udc04\ufe0f', | |
| 1611 | - 'mailbox':'\ud83d\udceb', | |
| 1612 | - 'mailbox_closed':'\ud83d\udcea', | |
| 1613 | - 'mailbox_with_mail':'\ud83d\udcec', | |
| 1614 | - 'mailbox_with_no_mail':'\ud83d\udced', | |
| 1615 | - 'man':'\ud83d\udc68', | |
| 1616 | - 'man_artist':'\ud83d\udc68‍\ud83c\udfa8', | |
| 1617 | - 'man_astronaut':'\ud83d\udc68‍\ud83d\ude80', | |
| 1618 | - 'man_cartwheeling':'\ud83e\udd38‍\u2642\ufe0f', | |
| 1619 | - 'man_cook':'\ud83d\udc68‍\ud83c\udf73', | |
| 1620 | - 'man_dancing':'\ud83d\udd7a', | |
| 1621 | - 'man_facepalming':'\ud83e\udd26‍\u2642\ufe0f', | |
| 1622 | - 'man_factory_worker':'\ud83d\udc68‍\ud83c\udfed', | |
| 1623 | - 'man_farmer':'\ud83d\udc68‍\ud83c\udf3e', | |
| 1624 | - 'man_firefighter':'\ud83d\udc68‍\ud83d\ude92', | |
| 1625 | - 'man_health_worker':'\ud83d\udc68‍\u2695\ufe0f', | |
| 1626 | - 'man_in_tuxedo':'\ud83e\udd35', | |
| 1627 | - 'man_judge':'\ud83d\udc68‍\u2696\ufe0f', | |
| 1628 | - 'man_juggling':'\ud83e\udd39‍\u2642\ufe0f', | |
| 1629 | - 'man_mechanic':'\ud83d\udc68‍\ud83d\udd27', | |
| 1630 | - 'man_office_worker':'\ud83d\udc68‍\ud83d\udcbc', | |
| 1631 | - 'man_pilot':'\ud83d\udc68‍\u2708\ufe0f', | |
| 1632 | - 'man_playing_handball':'\ud83e\udd3e‍\u2642\ufe0f', | |
| 1633 | - 'man_playing_water_polo':'\ud83e\udd3d‍\u2642\ufe0f', | |
| 1634 | - 'man_scientist':'\ud83d\udc68‍\ud83d\udd2c', | |
| 1635 | - 'man_shrugging':'\ud83e\udd37‍\u2642\ufe0f', | |
| 1636 | - 'man_singer':'\ud83d\udc68‍\ud83c\udfa4', | |
| 1637 | - 'man_student':'\ud83d\udc68‍\ud83c\udf93', | |
| 1638 | - 'man_teacher':'\ud83d\udc68‍\ud83c\udfeb', | |
| 1639 | - 'man_technologist':'\ud83d\udc68‍\ud83d\udcbb', | |
| 1640 | - 'man_with_gua_pi_mao':'\ud83d\udc72', | |
| 1641 | - 'man_with_turban':'\ud83d\udc73', | |
| 1642 | - 'tangerine':'\ud83c\udf4a', | |
| 1643 | - 'mans_shoe':'\ud83d\udc5e', | |
| 1644 | - 'mantelpiece_clock':'\ud83d\udd70', | |
| 1645 | - 'maple_leaf':'\ud83c\udf41', | |
| 1646 | - 'martial_arts_uniform':'\ud83e\udd4b', | |
| 1647 | - 'mask':'\ud83d\ude37', | |
| 1648 | - 'massage_woman':'\ud83d\udc86', | |
| 1649 | - 'massage_man':'\ud83d\udc86‍\u2642\ufe0f', | |
| 1650 | - 'meat_on_bone':'\ud83c\udf56', | |
| 1651 | - 'medal_military':'\ud83c\udf96', | |
| 1652 | - 'medal_sports':'\ud83c\udfc5', | |
| 1653 | - 'mega':'\ud83d\udce3', | |
| 1654 | - 'melon':'\ud83c\udf48', | |
| 1655 | - 'memo':'\ud83d\udcdd', | |
| 1656 | - 'men_wrestling':'\ud83e\udd3c‍\u2642\ufe0f', | |
| 1657 | - 'menorah':'\ud83d\udd4e', | |
| 1658 | - 'mens':'\ud83d\udeb9', | |
| 1659 | - 'metal':'\ud83e\udd18', | |
| 1660 | - 'metro':'\ud83d\ude87', | |
| 1661 | - 'microphone':'\ud83c\udfa4', | |
| 1662 | - 'microscope':'\ud83d\udd2c', | |
| 1663 | - 'milk_glass':'\ud83e\udd5b', | |
| 1664 | - 'milky_way':'\ud83c\udf0c', | |
| 1665 | - 'minibus':'\ud83d\ude90', | |
| 1666 | - 'minidisc':'\ud83d\udcbd', | |
| 1667 | - 'mobile_phone_off':'\ud83d\udcf4', | |
| 1668 | - 'money_mouth_face':'\ud83e\udd11', | |
| 1669 | - 'money_with_wings':'\ud83d\udcb8', | |
| 1670 | - 'moneybag':'\ud83d\udcb0', | |
| 1671 | - 'monkey':'\ud83d\udc12', | |
| 1672 | - 'monkey_face':'\ud83d\udc35', | |
| 1673 | - 'monorail':'\ud83d\ude9d', | |
| 1674 | - 'moon':'\ud83c\udf14', | |
| 1675 | - 'mortar_board':'\ud83c\udf93', | |
| 1676 | - 'mosque':'\ud83d\udd4c', | |
| 1677 | - 'motor_boat':'\ud83d\udee5', | |
| 1678 | - 'motor_scooter':'\ud83d\udef5', | |
| 1679 | - 'motorcycle':'\ud83c\udfcd', | |
| 1680 | - 'motorway':'\ud83d\udee3', | |
| 1681 | - 'mount_fuji':'\ud83d\uddfb', | |
| 1682 | - 'mountain':'\u26f0', | |
| 1683 | - 'mountain_biking_man':'\ud83d\udeb5', | |
| 1684 | - 'mountain_biking_woman':'\ud83d\udeb5‍\u2640\ufe0f', | |
| 1685 | - 'mountain_cableway':'\ud83d\udea0', | |
| 1686 | - 'mountain_railway':'\ud83d\ude9e', | |
| 1687 | - 'mountain_snow':'\ud83c\udfd4', | |
| 1688 | - 'mouse':'\ud83d\udc2d', | |
| 1689 | - 'mouse2':'\ud83d\udc01', | |
| 1690 | - 'movie_camera':'\ud83c\udfa5', | |
| 1691 | - 'moyai':'\ud83d\uddff', | |
| 1692 | - 'mrs_claus':'\ud83e\udd36', | |
| 1693 | - 'muscle':'\ud83d\udcaa', | |
| 1694 | - 'mushroom':'\ud83c\udf44', | |
| 1695 | - 'musical_keyboard':'\ud83c\udfb9', | |
| 1696 | - 'musical_note':'\ud83c\udfb5', | |
| 1697 | - 'musical_score':'\ud83c\udfbc', | |
| 1698 | - 'mute':'\ud83d\udd07', | |
| 1699 | - 'nail_care':'\ud83d\udc85', | |
| 1700 | - 'name_badge':'\ud83d\udcdb', | |
| 1701 | - 'national_park':'\ud83c\udfde', | |
| 1702 | - 'nauseated_face':'\ud83e\udd22', | |
| 1703 | - 'necktie':'\ud83d\udc54', | |
| 1704 | - 'negative_squared_cross_mark':'\u274e', | |
| 1705 | - 'nerd_face':'\ud83e\udd13', | |
| 1706 | - 'neutral_face':'\ud83d\ude10', | |
| 1707 | - 'new':'\ud83c\udd95', | |
| 1708 | - 'new_moon':'\ud83c\udf11', | |
| 1709 | - 'new_moon_with_face':'\ud83c\udf1a', | |
| 1710 | - 'newspaper':'\ud83d\udcf0', | |
| 1711 | - 'newspaper_roll':'\ud83d\uddde', | |
| 1712 | - 'next_track_button':'\u23ed', | |
| 1713 | - 'ng':'\ud83c\udd96', | |
| 1714 | - 'no_good_man':'\ud83d\ude45‍\u2642\ufe0f', | |
| 1715 | - 'no_good_woman':'\ud83d\ude45', | |
| 1716 | - 'night_with_stars':'\ud83c\udf03', | |
| 1717 | - 'no_bell':'\ud83d\udd15', | |
| 1718 | - 'no_bicycles':'\ud83d\udeb3', | |
| 1719 | - 'no_entry':'\u26d4\ufe0f', | |
| 1720 | - 'no_entry_sign':'\ud83d\udeab', | |
| 1721 | - 'no_mobile_phones':'\ud83d\udcf5', | |
| 1722 | - 'no_mouth':'\ud83d\ude36', | |
| 1723 | - 'no_pedestrians':'\ud83d\udeb7', | |
| 1724 | - 'no_smoking':'\ud83d\udead', | |
| 1725 | - 'non-potable_water':'\ud83d\udeb1', | |
| 1726 | - 'nose':'\ud83d\udc43', | |
| 1727 | - 'notebook':'\ud83d\udcd3', | |
| 1728 | - 'notebook_with_decorative_cover':'\ud83d\udcd4', | |
| 1729 | - 'notes':'\ud83c\udfb6', | |
| 1730 | - 'nut_and_bolt':'\ud83d\udd29', | |
| 1731 | - 'o':'\u2b55\ufe0f', | |
| 1732 | - 'o2':'\ud83c\udd7e\ufe0f', | |
| 1733 | - 'ocean':'\ud83c\udf0a', | |
| 1734 | - 'octopus':'\ud83d\udc19', | |
| 1735 | - 'oden':'\ud83c\udf62', | |
| 1736 | - 'office':'\ud83c\udfe2', | |
| 1737 | - 'oil_drum':'\ud83d\udee2', | |
| 1738 | - 'ok':'\ud83c\udd97', | |
| 1739 | - 'ok_hand':'\ud83d\udc4c', | |
| 1740 | - 'ok_man':'\ud83d\ude46‍\u2642\ufe0f', | |
| 1741 | - 'ok_woman':'\ud83d\ude46', | |
| 1742 | - 'old_key':'\ud83d\udddd', | |
| 1743 | - 'older_man':'\ud83d\udc74', | |
| 1744 | - 'older_woman':'\ud83d\udc75', | |
| 1745 | - 'om':'\ud83d\udd49', | |
| 1746 | - 'on':'\ud83d\udd1b', | |
| 1747 | - 'oncoming_automobile':'\ud83d\ude98', | |
| 1748 | - 'oncoming_bus':'\ud83d\ude8d', | |
| 1749 | - 'oncoming_police_car':'\ud83d\ude94', | |
| 1750 | - 'oncoming_taxi':'\ud83d\ude96', | |
| 1751 | - 'open_file_folder':'\ud83d\udcc2', | |
| 1752 | - 'open_hands':'\ud83d\udc50', | |
| 1753 | - 'open_mouth':'\ud83d\ude2e', | |
| 1754 | - 'open_umbrella':'\u2602\ufe0f', | |
| 1755 | - 'ophiuchus':'\u26ce', | |
| 1756 | - 'orange_book':'\ud83d\udcd9', | |
| 1757 | - 'orthodox_cross':'\u2626\ufe0f', | |
| 1758 | - 'outbox_tray':'\ud83d\udce4', | |
| 1759 | - 'owl':'\ud83e\udd89', | |
| 1760 | - 'ox':'\ud83d\udc02', | |
| 1761 | - 'package':'\ud83d\udce6', | |
| 1762 | - 'page_facing_up':'\ud83d\udcc4', | |
| 1763 | - 'page_with_curl':'\ud83d\udcc3', | |
| 1764 | - 'pager':'\ud83d\udcdf', | |
| 1765 | - 'paintbrush':'\ud83d\udd8c', | |
| 1766 | - 'palm_tree':'\ud83c\udf34', | |
| 1767 | - 'pancakes':'\ud83e\udd5e', | |
| 1768 | - 'panda_face':'\ud83d\udc3c', | |
| 1769 | - 'paperclip':'\ud83d\udcce', | |
| 1770 | - 'paperclips':'\ud83d\udd87', | |
| 1771 | - 'parasol_on_ground':'\u26f1', | |
| 1772 | - 'parking':'\ud83c\udd7f\ufe0f', | |
| 1773 | - 'part_alternation_mark':'\u303d\ufe0f', | |
| 1774 | - 'partly_sunny':'\u26c5\ufe0f', | |
| 1775 | - 'passenger_ship':'\ud83d\udef3', | |
| 1776 | - 'passport_control':'\ud83d\udec2', | |
| 1777 | - 'pause_button':'\u23f8', | |
| 1778 | - 'peace_symbol':'\u262e\ufe0f', | |
| 1779 | - 'peach':'\ud83c\udf51', | |
| 1780 | - 'peanuts':'\ud83e\udd5c', | |
| 1781 | - 'pear':'\ud83c\udf50', | |
| 1782 | - 'pen':'\ud83d\udd8a', | |
| 1783 | - 'pencil2':'\u270f\ufe0f', | |
| 1784 | - 'penguin':'\ud83d\udc27', | |
| 1785 | - 'pensive':'\ud83d\ude14', | |
| 1786 | - 'performing_arts':'\ud83c\udfad', | |
| 1787 | - 'persevere':'\ud83d\ude23', | |
| 1788 | - 'person_fencing':'\ud83e\udd3a', | |
| 1789 | - 'pouting_woman':'\ud83d\ude4e', | |
| 1790 | - 'phone':'\u260e\ufe0f', | |
| 1791 | - 'pick':'\u26cf', | |
| 1792 | - 'pig':'\ud83d\udc37', | |
| 1793 | - 'pig2':'\ud83d\udc16', | |
| 1794 | - 'pig_nose':'\ud83d\udc3d', | |
| 1795 | - 'pill':'\ud83d\udc8a', | |
| 1796 | - 'pineapple':'\ud83c\udf4d', | |
| 1797 | - 'ping_pong':'\ud83c\udfd3', | |
| 1798 | - 'pisces':'\u2653\ufe0f', | |
| 1799 | - 'pizza':'\ud83c\udf55', | |
| 1800 | - 'place_of_worship':'\ud83d\uded0', | |
| 1801 | - 'plate_with_cutlery':'\ud83c\udf7d', | |
| 1802 | - 'play_or_pause_button':'\u23ef', | |
| 1803 | - 'point_down':'\ud83d\udc47', | |
| 1804 | - 'point_left':'\ud83d\udc48', | |
| 1805 | - 'point_right':'\ud83d\udc49', | |
| 1806 | - 'point_up':'\u261d\ufe0f', | |
| 1807 | - 'point_up_2':'\ud83d\udc46', | |
| 1808 | - 'police_car':'\ud83d\ude93', | |
| 1809 | - 'policewoman':'\ud83d\udc6e‍\u2640\ufe0f', | |
| 1810 | - 'poodle':'\ud83d\udc29', | |
| 1811 | - 'popcorn':'\ud83c\udf7f', | |
| 1812 | - 'post_office':'\ud83c\udfe3', | |
| 1813 | - 'postal_horn':'\ud83d\udcef', | |
| 1814 | - 'postbox':'\ud83d\udcee', | |
| 1815 | - 'potable_water':'\ud83d\udeb0', | |
| 1816 | - 'potato':'\ud83e\udd54', | |
| 1817 | - 'pouch':'\ud83d\udc5d', | |
| 1818 | - 'poultry_leg':'\ud83c\udf57', | |
| 1819 | - 'pound':'\ud83d\udcb7', | |
| 1820 | - 'rage':'\ud83d\ude21', | |
| 1821 | - 'pouting_cat':'\ud83d\ude3e', | |
| 1822 | - 'pouting_man':'\ud83d\ude4e‍\u2642\ufe0f', | |
| 1823 | - 'pray':'\ud83d\ude4f', | |
| 1824 | - 'prayer_beads':'\ud83d\udcff', | |
| 1825 | - 'pregnant_woman':'\ud83e\udd30', | |
| 1826 | - 'previous_track_button':'\u23ee', | |
| 1827 | - 'prince':'\ud83e\udd34', | |
| 1828 | - 'princess':'\ud83d\udc78', | |
| 1829 | - 'printer':'\ud83d\udda8', | |
| 1830 | - 'purple_heart':'\ud83d\udc9c', | |
| 1831 | - 'purse':'\ud83d\udc5b', | |
| 1832 | - 'pushpin':'\ud83d\udccc', | |
| 1833 | - 'put_litter_in_its_place':'\ud83d\udeae', | |
| 1834 | - 'question':'\u2753', | |
| 1835 | - 'rabbit':'\ud83d\udc30', | |
| 1836 | - 'rabbit2':'\ud83d\udc07', | |
| 1837 | - 'racehorse':'\ud83d\udc0e', | |
| 1838 | - 'racing_car':'\ud83c\udfce', | |
| 1839 | - 'radio':'\ud83d\udcfb', | |
| 1840 | - 'radio_button':'\ud83d\udd18', | |
| 1841 | - 'radioactive':'\u2622\ufe0f', | |
| 1842 | - 'railway_car':'\ud83d\ude83', | |
| 1843 | - 'railway_track':'\ud83d\udee4', | |
| 1844 | - 'rainbow':'\ud83c\udf08', | |
| 1845 | - 'rainbow_flag':'\ud83c\udff3\ufe0f‍\ud83c\udf08', | |
| 1846 | - 'raised_back_of_hand':'\ud83e\udd1a', | |
| 1847 | - 'raised_hand_with_fingers_splayed':'\ud83d\udd90', | |
| 1848 | - 'raised_hands':'\ud83d\ude4c', | |
| 1849 | - 'raising_hand_woman':'\ud83d\ude4b', | |
| 1850 | - 'raising_hand_man':'\ud83d\ude4b‍\u2642\ufe0f', | |
| 1851 | - 'ram':'\ud83d\udc0f', | |
| 1852 | - 'ramen':'\ud83c\udf5c', | |
| 1853 | - 'rat':'\ud83d\udc00', | |
| 1854 | - 'record_button':'\u23fa', | |
| 1855 | - 'recycle':'\u267b\ufe0f', | |
| 1856 | - 'red_circle':'\ud83d\udd34', | |
| 1857 | - 'registered':'\u00ae\ufe0f', | |
| 1858 | - 'relaxed':'\u263a\ufe0f', | |
| 1859 | - 'relieved':'\ud83d\ude0c', | |
| 1860 | - 'reminder_ribbon':'\ud83c\udf97', | |
| 1861 | - 'repeat':'\ud83d\udd01', | |
| 1862 | - 'repeat_one':'\ud83d\udd02', | |
| 1863 | - 'rescue_worker_helmet':'\u26d1', | |
| 1864 | - 'restroom':'\ud83d\udebb', | |
| 1865 | - 'revolving_hearts':'\ud83d\udc9e', | |
| 1866 | - 'rewind':'\u23ea', | |
| 1867 | - 'rhinoceros':'\ud83e\udd8f', | |
| 1868 | - 'ribbon':'\ud83c\udf80', | |
| 1869 | - 'rice':'\ud83c\udf5a', | |
| 1870 | - 'rice_ball':'\ud83c\udf59', | |
| 1871 | - 'rice_cracker':'\ud83c\udf58', | |
| 1872 | - 'rice_scene':'\ud83c\udf91', | |
| 1873 | - 'right_anger_bubble':'\ud83d\uddef', | |
| 1874 | - 'ring':'\ud83d\udc8d', | |
| 1875 | - 'robot':'\ud83e\udd16', | |
| 1876 | - 'rocket':'\ud83d\ude80', | |
| 1877 | - 'rofl':'\ud83e\udd23', | |
| 1878 | - 'roll_eyes':'\ud83d\ude44', | |
| 1879 | - 'roller_coaster':'\ud83c\udfa2', | |
| 1880 | - 'rooster':'\ud83d\udc13', | |
| 1881 | - 'rose':'\ud83c\udf39', | |
| 1882 | - 'rosette':'\ud83c\udff5', | |
| 1883 | - 'rotating_light':'\ud83d\udea8', | |
| 1884 | - 'round_pushpin':'\ud83d\udccd', | |
| 1885 | - 'rowing_man':'\ud83d\udea3', | |
| 1886 | - 'rowing_woman':'\ud83d\udea3‍\u2640\ufe0f', | |
| 1887 | - 'rugby_football':'\ud83c\udfc9', | |
| 1888 | - 'running_man':'\ud83c\udfc3', | |
| 1889 | - 'running_shirt_with_sash':'\ud83c\udfbd', | |
| 1890 | - 'running_woman':'\ud83c\udfc3‍\u2640\ufe0f', | |
| 1891 | - 'sa':'\ud83c\ude02\ufe0f', | |
| 1892 | - 'sagittarius':'\u2650\ufe0f', | |
| 1893 | - 'sake':'\ud83c\udf76', | |
| 1894 | - 'sandal':'\ud83d\udc61', | |
| 1895 | - 'santa':'\ud83c\udf85', | |
| 1896 | - 'satellite':'\ud83d\udce1', | |
| 1897 | - 'saxophone':'\ud83c\udfb7', | |
| 1898 | - 'school':'\ud83c\udfeb', | |
| 1899 | - 'school_satchel':'\ud83c\udf92', | |
| 1900 | - 'scissors':'\u2702\ufe0f', | |
| 1901 | - 'scorpion':'\ud83e\udd82', | |
| 1902 | - 'scorpius':'\u264f\ufe0f', | |
| 1903 | - 'scream':'\ud83d\ude31', | |
| 1904 | - 'scream_cat':'\ud83d\ude40', | |
| 1905 | - 'scroll':'\ud83d\udcdc', | |
| 1906 | - 'seat':'\ud83d\udcba', | |
| 1907 | - 'secret':'\u3299\ufe0f', | |
| 1908 | - 'see_no_evil':'\ud83d\ude48', | |
| 1909 | - 'seedling':'\ud83c\udf31', | |
| 1910 | - 'selfie':'\ud83e\udd33', | |
| 1911 | - 'shallow_pan_of_food':'\ud83e\udd58', | |
| 1912 | - 'shamrock':'\u2618\ufe0f', | |
| 1913 | - 'shark':'\ud83e\udd88', | |
| 1914 | - 'shaved_ice':'\ud83c\udf67', | |
| 1915 | - 'sheep':'\ud83d\udc11', | |
| 1916 | - 'shell':'\ud83d\udc1a', | |
| 1917 | - 'shield':'\ud83d\udee1', | |
| 1918 | - 'shinto_shrine':'\u26e9', | |
| 1919 | - 'ship':'\ud83d\udea2', | |
| 1920 | - 'shirt':'\ud83d\udc55', | |
| 1921 | - 'shopping':'\ud83d\udecd', | |
| 1922 | - 'shopping_cart':'\ud83d\uded2', | |
| 1923 | - 'shower':'\ud83d\udebf', | |
| 1924 | - 'shrimp':'\ud83e\udd90', | |
| 1925 | - 'signal_strength':'\ud83d\udcf6', | |
| 1926 | - 'six_pointed_star':'\ud83d\udd2f', | |
| 1927 | - 'ski':'\ud83c\udfbf', | |
| 1928 | - 'skier':'\u26f7', | |
| 1929 | - 'skull':'\ud83d\udc80', | |
| 1930 | - 'skull_and_crossbones':'\u2620\ufe0f', | |
| 1931 | - 'sleeping':'\ud83d\ude34', | |
| 1932 | - 'sleeping_bed':'\ud83d\udecc', | |
| 1933 | - 'sleepy':'\ud83d\ude2a', | |
| 1934 | - 'slightly_frowning_face':'\ud83d\ude41', | |
| 1935 | - 'slightly_smiling_face':'\ud83d\ude42', | |
| 1936 | - 'slot_machine':'\ud83c\udfb0', | |
| 1937 | - 'small_airplane':'\ud83d\udee9', | |
| 1938 | - 'small_blue_diamond':'\ud83d\udd39', | |
| 1939 | - 'small_orange_diamond':'\ud83d\udd38', | |
| 1940 | - 'small_red_triangle':'\ud83d\udd3a', | |
| 1941 | - 'small_red_triangle_down':'\ud83d\udd3b', | |
| 1942 | - 'smile':'\ud83d\ude04', | |
| 1943 | - 'smile_cat':'\ud83d\ude38', | |
| 1944 | - 'smiley':'\ud83d\ude03', | |
| 1945 | - 'smiley_cat':'\ud83d\ude3a', | |
| 1946 | - 'smiling_imp':'\ud83d\ude08', | |
| 1947 | - 'smirk':'\ud83d\ude0f', | |
| 1948 | - 'smirk_cat':'\ud83d\ude3c', | |
| 1949 | - 'smoking':'\ud83d\udeac', | |
| 1950 | - 'snail':'\ud83d\udc0c', | |
| 1951 | - 'snake':'\ud83d\udc0d', | |
| 1952 | - 'sneezing_face':'\ud83e\udd27', | |
| 1953 | - 'snowboarder':'\ud83c\udfc2', | |
| 1954 | - 'snowflake':'\u2744\ufe0f', | |
| 1955 | - 'snowman':'\u26c4\ufe0f', | |
| 1956 | - 'snowman_with_snow':'\u2603\ufe0f', | |
| 1957 | - 'sob':'\ud83d\ude2d', | |
| 1958 | - 'soccer':'\u26bd\ufe0f', | |
| 1959 | - 'soon':'\ud83d\udd1c', | |
| 1960 | - 'sos':'\ud83c\udd98', | |
| 1961 | - 'sound':'\ud83d\udd09', | |
| 1962 | - 'space_invader':'\ud83d\udc7e', | |
| 1963 | - 'spades':'\u2660\ufe0f', | |
| 1964 | - 'spaghetti':'\ud83c\udf5d', | |
| 1965 | - 'sparkle':'\u2747\ufe0f', | |
| 1966 | - 'sparkler':'\ud83c\udf87', | |
| 1967 | - 'sparkles':'\u2728', | |
| 1968 | - 'sparkling_heart':'\ud83d\udc96', | |
| 1969 | - 'speak_no_evil':'\ud83d\ude4a', | |
| 1970 | - 'speaker':'\ud83d\udd08', | |
| 1971 | - 'speaking_head':'\ud83d\udde3', | |
| 1972 | - 'speech_balloon':'\ud83d\udcac', | |
| 1973 | - 'speedboat':'\ud83d\udea4', | |
| 1974 | - 'spider':'\ud83d\udd77', | |
| 1975 | - 'spider_web':'\ud83d\udd78', | |
| 1976 | - 'spiral_calendar':'\ud83d\uddd3', | |
| 1977 | - 'spiral_notepad':'\ud83d\uddd2', | |
| 1978 | - 'spoon':'\ud83e\udd44', | |
| 1979 | - 'squid':'\ud83e\udd91', | |
| 1980 | - 'stadium':'\ud83c\udfdf', | |
| 1981 | - 'star':'\u2b50\ufe0f', | |
| 1982 | - 'star2':'\ud83c\udf1f', | |
| 1983 | - 'star_and_crescent':'\u262a\ufe0f', | |
| 1984 | - 'star_of_david':'\u2721\ufe0f', | |
| 1985 | - 'stars':'\ud83c\udf20', | |
| 1986 | - 'station':'\ud83d\ude89', | |
| 1987 | - 'statue_of_liberty':'\ud83d\uddfd', | |
| 1988 | - 'steam_locomotive':'\ud83d\ude82', | |
| 1989 | - 'stew':'\ud83c\udf72', | |
| 1990 | - 'stop_button':'\u23f9', | |
| 1991 | - 'stop_sign':'\ud83d\uded1', | |
| 1992 | - 'stopwatch':'\u23f1', | |
| 1993 | - 'straight_ruler':'\ud83d\udccf', | |
| 1994 | - 'strawberry':'\ud83c\udf53', | |
| 1995 | - 'stuck_out_tongue':'\ud83d\ude1b', | |
| 1996 | - 'stuck_out_tongue_closed_eyes':'\ud83d\ude1d', | |
| 1997 | - 'stuck_out_tongue_winking_eye':'\ud83d\ude1c', | |
| 1998 | - 'studio_microphone':'\ud83c\udf99', | |
| 1999 | - 'stuffed_flatbread':'\ud83e\udd59', | |
| 2000 | - 'sun_behind_large_cloud':'\ud83c\udf25', | |
| 2001 | - 'sun_behind_rain_cloud':'\ud83c\udf26', | |
| 2002 | - 'sun_behind_small_cloud':'\ud83c\udf24', | |
| 2003 | - 'sun_with_face':'\ud83c\udf1e', | |
| 2004 | - 'sunflower':'\ud83c\udf3b', | |
| 2005 | - 'sunglasses':'\ud83d\ude0e', | |
| 2006 | - 'sunny':'\u2600\ufe0f', | |
| 2007 | - 'sunrise':'\ud83c\udf05', | |
| 2008 | - 'sunrise_over_mountains':'\ud83c\udf04', | |
| 2009 | - 'surfing_man':'\ud83c\udfc4', | |
| 2010 | - 'surfing_woman':'\ud83c\udfc4‍\u2640\ufe0f', | |
| 2011 | - 'sushi':'\ud83c\udf63', | |
| 2012 | - 'suspension_railway':'\ud83d\ude9f', | |
| 2013 | - 'sweat':'\ud83d\ude13', | |
| 2014 | - 'sweat_drops':'\ud83d\udca6', | |
| 2015 | - 'sweat_smile':'\ud83d\ude05', | |
| 2016 | - 'sweet_potato':'\ud83c\udf60', | |
| 2017 | - 'swimming_man':'\ud83c\udfca', | |
| 2018 | - 'swimming_woman':'\ud83c\udfca‍\u2640\ufe0f', | |
| 2019 | - 'symbols':'\ud83d\udd23', | |
| 2020 | - 'synagogue':'\ud83d\udd4d', | |
| 2021 | - 'syringe':'\ud83d\udc89', | |
| 2022 | - 'taco':'\ud83c\udf2e', | |
| 2023 | - 'tada':'\ud83c\udf89', | |
| 2024 | - 'tanabata_tree':'\ud83c\udf8b', | |
| 2025 | - 'taurus':'\u2649\ufe0f', | |
| 2026 | - 'taxi':'\ud83d\ude95', | |
| 2027 | - 'tea':'\ud83c\udf75', | |
| 2028 | - 'telephone_receiver':'\ud83d\udcde', | |
| 2029 | - 'telescope':'\ud83d\udd2d', | |
| 2030 | - 'tennis':'\ud83c\udfbe', | |
| 2031 | - 'tent':'\u26fa\ufe0f', | |
| 2032 | - 'thermometer':'\ud83c\udf21', | |
| 2033 | - 'thinking':'\ud83e\udd14', | |
| 2034 | - 'thought_balloon':'\ud83d\udcad', | |
| 2035 | - 'ticket':'\ud83c\udfab', | |
| 2036 | - 'tickets':'\ud83c\udf9f', | |
| 2037 | - 'tiger':'\ud83d\udc2f', | |
| 2038 | - 'tiger2':'\ud83d\udc05', | |
| 2039 | - 'timer_clock':'\u23f2', | |
| 2040 | - 'tipping_hand_man':'\ud83d\udc81‍\u2642\ufe0f', | |
| 2041 | - 'tired_face':'\ud83d\ude2b', | |
| 2042 | - 'tm':'\u2122\ufe0f', | |
| 2043 | - 'toilet':'\ud83d\udebd', | |
| 2044 | - 'tokyo_tower':'\ud83d\uddfc', | |
| 2045 | - 'tomato':'\ud83c\udf45', | |
| 2046 | - 'tongue':'\ud83d\udc45', | |
| 2047 | - 'top':'\ud83d\udd1d', | |
| 2048 | - 'tophat':'\ud83c\udfa9', | |
| 2049 | - 'tornado':'\ud83c\udf2a', | |
| 2050 | - 'trackball':'\ud83d\uddb2', | |
| 2051 | - 'tractor':'\ud83d\ude9c', | |
| 2052 | - 'traffic_light':'\ud83d\udea5', | |
| 2053 | - 'train':'\ud83d\ude8b', | |
| 2054 | - 'train2':'\ud83d\ude86', | |
| 2055 | - 'tram':'\ud83d\ude8a', | |
| 2056 | - 'triangular_flag_on_post':'\ud83d\udea9', | |
| 2057 | - 'triangular_ruler':'\ud83d\udcd0', | |
| 2058 | - 'trident':'\ud83d\udd31', | |
| 2059 | - 'triumph':'\ud83d\ude24', | |
| 2060 | - 'trolleybus':'\ud83d\ude8e', | |
| 2061 | - 'trophy':'\ud83c\udfc6', | |
| 2062 | - 'tropical_drink':'\ud83c\udf79', | |
| 2063 | - 'tropical_fish':'\ud83d\udc20', | |
| 2064 | - 'truck':'\ud83d\ude9a', | |
| 2065 | - 'trumpet':'\ud83c\udfba', | |
| 2066 | - 'tulip':'\ud83c\udf37', | |
| 2067 | - 'tumbler_glass':'\ud83e\udd43', | |
| 2068 | - 'turkey':'\ud83e\udd83', | |
| 2069 | - 'turtle':'\ud83d\udc22', | |
| 2070 | - 'tv':'\ud83d\udcfa', | |
| 2071 | - 'twisted_rightwards_arrows':'\ud83d\udd00', | |
| 2072 | - 'two_hearts':'\ud83d\udc95', | |
| 2073 | - 'two_men_holding_hands':'\ud83d\udc6c', | |
| 2074 | - 'two_women_holding_hands':'\ud83d\udc6d', | |
| 2075 | - 'u5272':'\ud83c\ude39', | |
| 2076 | - 'u5408':'\ud83c\ude34', | |
| 2077 | - 'u55b6':'\ud83c\ude3a', | |
| 2078 | - 'u6307':'\ud83c\ude2f\ufe0f', | |
| 2079 | - 'u6708':'\ud83c\ude37\ufe0f', | |
| 2080 | - 'u6709':'\ud83c\ude36', | |
| 2081 | - 'u6e80':'\ud83c\ude35', | |
| 2082 | - 'u7121':'\ud83c\ude1a\ufe0f', | |
| 2083 | - 'u7533':'\ud83c\ude38', | |
| 2084 | - 'u7981':'\ud83c\ude32', | |
| 2085 | - 'u7a7a':'\ud83c\ude33', | |
| 2086 | - 'umbrella':'\u2614\ufe0f', | |
| 2087 | - 'unamused':'\ud83d\ude12', | |
| 2088 | - 'underage':'\ud83d\udd1e', | |
| 2089 | - 'unicorn':'\ud83e\udd84', | |
| 2090 | - 'unlock':'\ud83d\udd13', | |
| 2091 | - 'up':'\ud83c\udd99', | |
| 2092 | - 'upside_down_face':'\ud83d\ude43', | |
| 2093 | - 'v':'\u270c\ufe0f', | |
| 2094 | - 'vertical_traffic_light':'\ud83d\udea6', | |
| 2095 | - 'vhs':'\ud83d\udcfc', | |
| 2096 | - 'vibration_mode':'\ud83d\udcf3', | |
| 2097 | - 'video_camera':'\ud83d\udcf9', | |
| 2098 | - 'video_game':'\ud83c\udfae', | |
| 2099 | - 'violin':'\ud83c\udfbb', | |
| 2100 | - 'virgo':'\u264d\ufe0f', | |
| 2101 | - 'volcano':'\ud83c\udf0b', | |
| 2102 | - 'volleyball':'\ud83c\udfd0', | |
| 2103 | - 'vs':'\ud83c\udd9a', | |
| 2104 | - 'vulcan_salute':'\ud83d\udd96', | |
| 2105 | - 'walking_man':'\ud83d\udeb6', | |
| 2106 | - 'walking_woman':'\ud83d\udeb6‍\u2640\ufe0f', | |
| 2107 | - 'waning_crescent_moon':'\ud83c\udf18', | |
| 2108 | - 'waning_gibbous_moon':'\ud83c\udf16', | |
| 2109 | - 'warning':'\u26a0\ufe0f', | |
| 2110 | - 'wastebasket':'\ud83d\uddd1', | |
| 2111 | - 'watch':'\u231a\ufe0f', | |
| 2112 | - 'water_buffalo':'\ud83d\udc03', | |
| 2113 | - 'watermelon':'\ud83c\udf49', | |
| 2114 | - 'wave':'\ud83d\udc4b', | |
| 2115 | - 'wavy_dash':'\u3030\ufe0f', | |
| 2116 | - 'waxing_crescent_moon':'\ud83c\udf12', | |
| 2117 | - 'wc':'\ud83d\udebe', | |
| 2118 | - 'weary':'\ud83d\ude29', | |
| 2119 | - 'wedding':'\ud83d\udc92', | |
| 2120 | - 'weight_lifting_man':'\ud83c\udfcb\ufe0f', | |
| 2121 | - 'weight_lifting_woman':'\ud83c\udfcb\ufe0f‍\u2640\ufe0f', | |
| 2122 | - 'whale':'\ud83d\udc33', | |
| 2123 | - 'whale2':'\ud83d\udc0b', | |
| 2124 | - 'wheel_of_dharma':'\u2638\ufe0f', | |
| 2125 | - 'wheelchair':'\u267f\ufe0f', | |
| 2126 | - 'white_check_mark':'\u2705', | |
| 2127 | - 'white_circle':'\u26aa\ufe0f', | |
| 2128 | - 'white_flag':'\ud83c\udff3\ufe0f', | |
| 2129 | - 'white_flower':'\ud83d\udcae', | |
| 2130 | - 'white_large_square':'\u2b1c\ufe0f', | |
| 2131 | - 'white_medium_small_square':'\u25fd\ufe0f', | |
| 2132 | - 'white_medium_square':'\u25fb\ufe0f', | |
| 2133 | - 'white_small_square':'\u25ab\ufe0f', | |
| 2134 | - 'white_square_button':'\ud83d\udd33', | |
| 2135 | - 'wilted_flower':'\ud83e\udd40', | |
| 2136 | - 'wind_chime':'\ud83c\udf90', | |
| 2137 | - 'wind_face':'\ud83c\udf2c', | |
| 2138 | - 'wine_glass':'\ud83c\udf77', | |
| 2139 | - 'wink':'\ud83d\ude09', | |
| 2140 | - 'wolf':'\ud83d\udc3a', | |
| 2141 | - 'woman':'\ud83d\udc69', | |
| 2142 | - 'woman_artist':'\ud83d\udc69‍\ud83c\udfa8', | |
| 2143 | - 'woman_astronaut':'\ud83d\udc69‍\ud83d\ude80', | |
| 2144 | - 'woman_cartwheeling':'\ud83e\udd38‍\u2640\ufe0f', | |
| 2145 | - 'woman_cook':'\ud83d\udc69‍\ud83c\udf73', | |
| 2146 | - 'woman_facepalming':'\ud83e\udd26‍\u2640\ufe0f', | |
| 2147 | - 'woman_factory_worker':'\ud83d\udc69‍\ud83c\udfed', | |
| 2148 | - 'woman_farmer':'\ud83d\udc69‍\ud83c\udf3e', | |
| 2149 | - 'woman_firefighter':'\ud83d\udc69‍\ud83d\ude92', | |
| 2150 | - 'woman_health_worker':'\ud83d\udc69‍\u2695\ufe0f', | |
| 2151 | - 'woman_judge':'\ud83d\udc69‍\u2696\ufe0f', | |
| 2152 | - 'woman_juggling':'\ud83e\udd39‍\u2640\ufe0f', | |
| 2153 | - 'woman_mechanic':'\ud83d\udc69‍\ud83d\udd27', | |
| 2154 | - 'woman_office_worker':'\ud83d\udc69‍\ud83d\udcbc', | |
| 2155 | - 'woman_pilot':'\ud83d\udc69‍\u2708\ufe0f', | |
| 2156 | - 'woman_playing_handball':'\ud83e\udd3e‍\u2640\ufe0f', | |
| 2157 | - 'woman_playing_water_polo':'\ud83e\udd3d‍\u2640\ufe0f', | |
| 2158 | - 'woman_scientist':'\ud83d\udc69‍\ud83d\udd2c', | |
| 2159 | - 'woman_shrugging':'\ud83e\udd37‍\u2640\ufe0f', | |
| 2160 | - 'woman_singer':'\ud83d\udc69‍\ud83c\udfa4', | |
| 2161 | - 'woman_student':'\ud83d\udc69‍\ud83c\udf93', | |
| 2162 | - 'woman_teacher':'\ud83d\udc69‍\ud83c\udfeb', | |
| 2163 | - 'woman_technologist':'\ud83d\udc69‍\ud83d\udcbb', | |
| 2164 | - 'woman_with_turban':'\ud83d\udc73‍\u2640\ufe0f', | |
| 2165 | - 'womans_clothes':'\ud83d\udc5a', | |
| 2166 | - 'womans_hat':'\ud83d\udc52', | |
| 2167 | - 'women_wrestling':'\ud83e\udd3c‍\u2640\ufe0f', | |
| 2168 | - 'womens':'\ud83d\udeba', | |
| 2169 | - 'world_map':'\ud83d\uddfa', | |
| 2170 | - 'worried':'\ud83d\ude1f', | |
| 2171 | - 'wrench':'\ud83d\udd27', | |
| 2172 | - 'writing_hand':'\u270d\ufe0f', | |
| 2173 | - 'x':'\u274c', | |
| 2174 | - 'yellow_heart':'\ud83d\udc9b', | |
| 2175 | - 'yen':'\ud83d\udcb4', | |
| 2176 | - 'yin_yang':'\u262f\ufe0f', | |
| 2177 | - 'yum':'\ud83d\ude0b', | |
| 2178 | - 'zap':'\u26a1\ufe0f', | |
| 2179 | - 'zipper_mouth_face':'\ud83e\udd10', | |
| 2180 | - 'zzz':'\ud83d\udca4', | |
| 2181 | - | |
| 2182 | - /* special emojis :P */ | |
| 2183 | - 'octocat': '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">', | |
| 2184 | - '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>' | |
| 2185 | -}; | |
| 2186 | - | |
| 2187 | -/** | |
| 2188 | - * Created by Estevao on 31-05-2015. | |
| 2189 | - */ | |
| 2190 | - | |
| 2191 | -/** | |
| 2192 | - * Showdown Converter class | |
| 2193 | - * @class | |
| 2194 | - * @param {object} [converterOptions] | |
| 2195 | - * @returns {Converter} | |
| 2196 | - */ | |
| 2197 | -showdown.Converter = function (converterOptions) { | |
| 2198 | - 'use strict'; | |
| 2199 | - | |
| 2200 | - var | |
| 2201 | - /** | |
| 2202 | - * Options used by this converter | |
| 2203 | - * @private | |
| 2204 | - * @type {{}} | |
| 2205 | - */ | |
| 2206 | - options = {}, | |
| 2207 | - | |
| 2208 | - /** | |
| 2209 | - * Language extensions used by this converter | |
| 2210 | - * @private | |
| 2211 | - * @type {Array} | |
| 2212 | - */ | |
| 2213 | - langExtensions = [], | |
| 2214 | - | |
| 2215 | - /** | |
| 2216 | - * Output modifiers extensions used by this converter | |
| 2217 | - * @private | |
| 2218 | - * @type {Array} | |
| 2219 | - */ | |
| 2220 | - outputModifiers = [], | |
| 2221 | - | |
| 2222 | - /** | |
| 2223 | - * Event listeners | |
| 2224 | - * @private | |
| 2225 | - * @type {{}} | |
| 2226 | - */ | |
| 2227 | - listeners = {}, | |
| 2228 | - | |
| 2229 | - /** | |
| 2230 | - * The flavor set in this converter | |
| 2231 | - */ | |
| 2232 | - setConvFlavor = setFlavor, | |
| 2233 | - | |
| 2234 | - /** | |
| 2235 | - * Metadata of the document | |
| 2236 | - * @type {{parsed: {}, raw: string, format: string}} | |
| 2237 | - */ | |
| 2238 | - metadata = { | |
| 2239 | - parsed: {}, | |
| 2240 | - raw: '', | |
| 2241 | - format: '' | |
| 2242 | - }; | |
| 2243 | - | |
| 2244 | - _constructor(); | |
| 2245 | - | |
| 2246 | - /** | |
| 2247 | - * Converter constructor | |
| 2248 | - * @private | |
| 2249 | - */ | |
| 2250 | - function _constructor () { | |
| 2251 | - converterOptions = converterOptions || {}; | |
| 2252 | - | |
| 2253 | - for (var gOpt in globalOptions) { | |
| 2254 | - if (globalOptions.hasOwnProperty(gOpt)) { | |
| 2255 | - options[gOpt] = globalOptions[gOpt]; | |
| 2256 | - } | |
| 2257 | - } | |
| 2258 | - | |
| 2259 | - // Merge options | |
| 2260 | - if (typeof converterOptions === 'object') { | |
| 2261 | - for (var opt in converterOptions) { | |
| 2262 | - if (converterOptions.hasOwnProperty(opt)) { | |
| 2263 | - options[opt] = converterOptions[opt]; | |
| 2264 | - } | |
| 2265 | - } | |
| 2266 | - } else { | |
| 2267 | - throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions + | |
| 2268 | - ' was passed instead.'); | |
| 2269 | - } | |
| 2270 | - | |
| 2271 | - if (options.extensions) { | |
| 2272 | - showdown.helper.forEach(options.extensions, _parseExtension); | |
| 2273 | - } | |
| 2274 | - } | |
| 2275 | - | |
| 2276 | - /** | |
| 2277 | - * Parse extension | |
| 2278 | - * @param {*} ext | |
| 2279 | - * @param {string} [name=''] | |
| 2280 | - * @private | |
| 2281 | - */ | |
| 2282 | - function _parseExtension (ext, name) { | |
| 2283 | - | |
| 2284 | - name = name || null; | |
| 2285 | - // If it's a string, the extension was previously loaded | |
| 2286 | - if (showdown.helper.isString(ext)) { | |
| 2287 | - ext = showdown.helper.stdExtName(ext); | |
| 2288 | - name = ext; | |
| 2289 | - | |
| 2290 | - // LEGACY_SUPPORT CODE | |
| 2291 | - if (showdown.extensions[ext]) { | |
| 2292 | - console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' + | |
| 2293 | - 'Please inform the developer that the extension should be updated!'); | |
| 2294 | - legacyExtensionLoading(showdown.extensions[ext], ext); | |
| 2295 | - return; | |
| 2296 | - // END LEGACY SUPPORT CODE | |
| 2297 | - | |
| 2298 | - } else if (!showdown.helper.isUndefined(extensions[ext])) { | |
| 2299 | - ext = extensions[ext]; | |
| 2300 | - | |
| 2301 | - } else { | |
| 2302 | - throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.'); | |
| 2303 | - } | |
| 2304 | - } | |
| 2305 | - | |
| 2306 | - if (typeof ext === 'function') { | |
| 2307 | - ext = ext(); | |
| 2308 | - } | |
| 2309 | - | |
| 2310 | - if (!showdown.helper.isArray(ext)) { | |
| 2311 | - ext = [ext]; | |
| 2312 | - } | |
| 2313 | - | |
| 2314 | - var validExt = validate(ext, name); | |
| 2315 | - if (!validExt.valid) { | |
| 2316 | - throw Error(validExt.error); | |
| 2317 | - } | |
| 2318 | - | |
| 2319 | - for (var i = 0; i < ext.length; ++i) { | |
| 2320 | - switch (ext[i].type) { | |
| 2321 | - | |
| 2322 | - case 'lang': | |
| 2323 | - langExtensions.push(ext[i]); | |
| 2324 | - break; | |
| 2325 | - | |
| 2326 | - case 'output': | |
| 2327 | - outputModifiers.push(ext[i]); | |
| 2328 | - break; | |
| 2329 | - } | |
| 2330 | - if (ext[i].hasOwnProperty('listeners')) { | |
| 2331 | - for (var ln in ext[i].listeners) { | |
| 2332 | - if (ext[i].listeners.hasOwnProperty(ln)) { | |
| 2333 | - listen(ln, ext[i].listeners[ln]); | |
| 2334 | - } | |
| 2335 | - } | |
| 2336 | - } | |
| 2337 | - } | |
| 2338 | - | |
| 2339 | - } | |
| 2340 | - | |
| 2341 | - /** | |
| 2342 | - * LEGACY_SUPPORT | |
| 2343 | - * @param {*} ext | |
| 2344 | - * @param {string} name | |
| 2345 | - */ | |
| 2346 | - function legacyExtensionLoading (ext, name) { | |
| 2347 | - if (typeof ext === 'function') { | |
| 2348 | - ext = ext(new showdown.Converter()); | |
| 2349 | - } | |
| 2350 | - if (!showdown.helper.isArray(ext)) { | |
| 2351 | - ext = [ext]; | |
| 2352 | - } | |
| 2353 | - var valid = validate(ext, name); | |
| 2354 | - | |
| 2355 | - if (!valid.valid) { | |
| 2356 | - throw Error(valid.error); | |
| 2357 | - } | |
| 2358 | - | |
| 2359 | - for (var i = 0; i < ext.length; ++i) { | |
| 2360 | - switch (ext[i].type) { | |
| 2361 | - case 'lang': | |
| 2362 | - langExtensions.push(ext[i]); | |
| 2363 | - break; | |
| 2364 | - case 'output': | |
| 2365 | - outputModifiers.push(ext[i]); | |
| 2366 | - break; | |
| 2367 | - default:// should never reach here | |
| 2368 | - throw Error('Extension loader error: Type unrecognized!!!'); | |
| 2369 | - } | |
| 2370 | - } | |
| 2371 | - } | |
| 2372 | - | |
| 2373 | - /** | |
| 2374 | - * Listen to an event | |
| 2375 | - * @param {string} name | |
| 2376 | - * @param {function} callback | |
| 2377 | - */ | |
| 2378 | - function listen (name, callback) { | |
| 2379 | - if (!showdown.helper.isString(name)) { | |
| 2380 | - throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given'); | |
| 2381 | - } | |
| 2382 | - | |
| 2383 | - if (typeof callback !== 'function') { | |
| 2384 | - throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given'); | |
| 2385 | - } | |
| 2386 | - | |
| 2387 | - if (!listeners.hasOwnProperty(name)) { | |
| 2388 | - listeners[name] = []; | |
| 2389 | - } | |
| 2390 | - listeners[name].push(callback); | |
| 2391 | - } | |
| 2392 | - | |
| 2393 | - function rTrimInputText (text) { | |
| 2394 | - var rsp = text.match(/^\s*/)[0].length, | |
| 2395 | - rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm'); | |
| 2396 | - return text.replace(rgx, ''); | |
| 2397 | - } | |
| 2398 | - | |
| 2399 | - /** | |
| 2400 | - * Dispatch an event | |
| 2401 | - * @private | |
| 2402 | - * @param {string} evtName Event name | |
| 2403 | - * @param {string} text Text | |
| 2404 | - * @param {{}} options Converter Options | |
| 2405 | - * @param {{}} globals | |
| 2406 | - * @returns {string} | |
| 2407 | - */ | |
| 2408 | - this._dispatch = function dispatch (evtName, text, options, globals) { | |
| 2409 | - if (listeners.hasOwnProperty(evtName)) { | |
| 2410 | - for (var ei = 0; ei < listeners[evtName].length; ++ei) { | |
| 2411 | - var nText = listeners[evtName][ei](evtName, text, this, options, globals); | |
| 2412 | - if (nText && typeof nText !== 'undefined') { | |
| 2413 | - text = nText; | |
| 2414 | - } | |
| 2415 | - } | |
| 2416 | - } | |
| 2417 | - return text; | |
| 2418 | - }; | |
| 2419 | - | |
| 2420 | - /** | |
| 2421 | - * Listen to an event | |
| 2422 | - * @param {string} name | |
| 2423 | - * @param {function} callback | |
| 2424 | - * @returns {showdown.Converter} | |
| 2425 | - */ | |
| 2426 | - this.listen = function (name, callback) { | |
| 2427 | - listen(name, callback); | |
| 2428 | - return this; | |
| 2429 | - }; | |
| 2430 | - | |
| 2431 | - /** | |
| 2432 | - * Converts a markdown string into HTML | |
| 2433 | - * @param {string} text | |
| 2434 | - * @returns {*} | |
| 2435 | - */ | |
| 2436 | - this.makeHtml = function (text) { | |
| 2437 | - //check if text is not falsy | |
| 2438 | - if (!text) { | |
| 2439 | - return text; | |
| 2440 | - } | |
| 2441 | - | |
| 2442 | - var globals = { | |
| 2443 | - gHtmlBlocks: [], | |
| 2444 | - gHtmlMdBlocks: [], | |
| 2445 | - gHtmlSpans: [], | |
| 2446 | - gUrls: {}, | |
| 2447 | - gTitles: {}, | |
| 2448 | - gDimensions: {}, | |
| 2449 | - gListLevel: 0, | |
| 2450 | - hashLinkCounts: {}, | |
| 2451 | - langExtensions: langExtensions, | |
| 2452 | - outputModifiers: outputModifiers, | |
| 2453 | - converter: this, | |
| 2454 | - ghCodeBlocks: [], | |
| 2455 | - metadata: { | |
| 2456 | - parsed: {}, | |
| 2457 | - raw: '', | |
| 2458 | - format: '' | |
| 2459 | - } | |
| 2460 | - }; | |
| 2461 | - | |
| 2462 | - // This lets us use ¨ trema as an escape char to avoid md5 hashes | |
| 2463 | - // The choice of character is arbitrary; anything that isn't | |
| 2464 | - // magic in Markdown will work. | |
| 2465 | - text = text.replace(/¨/g, '¨T'); | |
| 2466 | - | |
| 2467 | - // Replace $ with ¨D | |
| 2468 | - // RegExp interprets $ as a special character | |
| 2469 | - // when it's in a replacement string | |
| 2470 | - text = text.replace(/\$/g, '¨D'); | |
| 2471 | - | |
| 2472 | - // Standardize line endings | |
| 2473 | - text = text.replace(/\r\n/g, '\n'); // DOS to Unix | |
| 2474 | - text = text.replace(/\r/g, '\n'); // Mac to Unix | |
| 2475 | - | |
| 2476 | - // Stardardize line spaces | |
| 2477 | - text = text.replace(/\u00A0/g, ' '); | |
| 2478 | - | |
| 2479 | - if (options.smartIndentationFix) { | |
| 2480 | - text = rTrimInputText(text); | |
| 2481 | - } | |
| 2482 | - | |
| 2483 | - // Make sure text begins and ends with a couple of newlines: | |
| 2484 | - text = '\n\n' + text + '\n\n'; | |
| 2485 | - | |
| 2486 | - // detab | |
| 2487 | - text = showdown.subParser('detab')(text, options, globals); | |
| 2488 | - | |
| 2489 | - /** | |
| 2490 | - * Strip any lines consisting only of spaces and tabs. | |
| 2491 | - * This makes subsequent regexs easier to write, because we can | |
| 2492 | - * match consecutive blank lines with /\n+/ instead of something | |
| 2493 | - * contorted like /[ \t]*\n+/ | |
| 2494 | - */ | |
| 2495 | - text = text.replace(/^[ \t]+$/mg, ''); | |
| 2496 | - | |
| 2497 | - //run languageExtensions | |
| 2498 | - showdown.helper.forEach(langExtensions, function (ext) { | |
| 2499 | - text = showdown.subParser('runExtension')(ext, text, options, globals); | |
| 2500 | - }); | |
| 2501 | - | |
| 2502 | - // run the sub parsers | |
| 2503 | - text = showdown.subParser('metadata')(text, options, globals); | |
| 2504 | - text = showdown.subParser('hashPreCodeTags')(text, options, globals); | |
| 2505 | - text = showdown.subParser('githubCodeBlocks')(text, options, globals); | |
| 2506 | - text = showdown.subParser('hashHTMLBlocks')(text, options, globals); | |
| 2507 | - text = showdown.subParser('hashCodeTags')(text, options, globals); | |
| 2508 | - text = showdown.subParser('stripLinkDefinitions')(text, options, globals); | |
| 2509 | - text = showdown.subParser('blockGamut')(text, options, globals); | |
| 2510 | - text = showdown.subParser('unhashHTMLSpans')(text, options, globals); | |
| 2511 | - text = showdown.subParser('unescapeSpecialChars')(text, options, globals); | |
| 2512 | - | |
| 2513 | - // attacklab: Restore dollar signs | |
| 2514 | - text = text.replace(/¨D/g, '$$'); | |
| 2515 | - | |
| 2516 | - // attacklab: Restore tremas | |
| 2517 | - text = text.replace(/¨T/g, '¨'); | |
| 2518 | - | |
| 2519 | - // render a complete html document instead of a partial if the option is enabled | |
| 2520 | - text = showdown.subParser('completeHTMLDocument')(text, options, globals); | |
| 2521 | - | |
| 2522 | - // Run output modifiers | |
| 2523 | - showdown.helper.forEach(outputModifiers, function (ext) { | |
| 2524 | - text = showdown.subParser('runExtension')(ext, text, options, globals); | |
| 2525 | - }); | |
| 2526 | - | |
| 2527 | - // update metadata | |
| 2528 | - metadata = globals.metadata; | |
| 2529 | - return text; | |
| 2530 | - }; | |
| 2531 | - | |
| 2532 | - /** | |
| 2533 | - * Converts an HTML string into a markdown string | |
| 2534 | - * @param src | |
| 2535 | - * @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used. | |
| 2536 | - * @returns {string} | |
| 2537 | - */ | |
| 2538 | - this.makeMarkdown = this.makeMd = function (src, HTMLParser) { | |
| 2539 | - | |
| 2540 | - // replace \r\n with \n | |
| 2541 | - src = src.replace(/\r\n/g, '\n'); | |
| 2542 | - src = src.replace(/\r/g, '\n'); // old macs | |
| 2543 | - | |
| 2544 | - // due to an edge case, we need to find this: > < | |
| 2545 | - // to prevent removing of non silent white spaces | |
| 2546 | - // ex: <em>this is</em> <strong>sparta</strong> | |
| 2547 | - src = src.replace(/>[ \t]+</, '>¨NBSP;<'); | |
| 2548 | - | |
| 2549 | - if (!HTMLParser) { | |
| 2550 | - if (window && window.document) { | |
| 2551 | - HTMLParser = window.document; | |
| 2552 | - } else { | |
| 2553 | - 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'); | |
| 2554 | - } | |
| 2555 | - } | |
| 2556 | - | |
| 2557 | - var doc = HTMLParser.createElement('div'); | |
| 2558 | - doc.innerHTML = src; | |
| 2559 | - | |
| 2560 | - var globals = { | |
| 2561 | - preList: substitutePreCodeTags(doc) | |
| 2562 | - }; | |
| 2563 | - | |
| 2564 | - // remove all newlines and collapse spaces | |
| 2565 | - clean(doc); | |
| 2566 | - | |
| 2567 | - // some stuff, like accidental reference links must now be escaped | |
| 2568 | - // TODO | |
| 2569 | - // doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/); | |
| 2570 | - | |
| 2571 | - var nodes = doc.childNodes, | |
| 2572 | - mdDoc = ''; | |
| 2573 | - | |
| 2574 | - for (var i = 0; i < nodes.length; i++) { | |
| 2575 | - mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals); | |
| 2576 | - } | |
| 2577 | - | |
| 2578 | - function clean (node) { | |
| 2579 | - for (var n = 0; n < node.childNodes.length; ++n) { | |
| 2580 | - var child = node.childNodes[n]; | |
| 2581 | - if (child.nodeType === 3) { | |
| 2582 | - if (!/\S/.test(child.nodeValue)) { | |
| 2583 | - node.removeChild(child); | |
| 2584 | - --n; | |
| 2585 | - } else { | |
| 2586 | - child.nodeValue = child.nodeValue.split('\n').join(' '); | |
| 2587 | - child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1'); | |
| 2588 | - } | |
| 2589 | - } else if (child.nodeType === 1) { | |
| 2590 | - clean(child); | |
| 2591 | - } | |
| 2592 | - } | |
| 2593 | - } | |
| 2594 | - | |
| 2595 | - // find all pre tags and replace contents with placeholder | |
| 2596 | - // we need this so that we can remove all indentation from html | |
| 2597 | - // to ease up parsing | |
| 2598 | - function substitutePreCodeTags (doc) { | |
| 2599 | - | |
| 2600 | - var pres = doc.querySelectorAll('pre'), | |
| 2601 | - presPH = []; | |
| 2602 | - | |
| 2603 | - for (var i = 0; i < pres.length; ++i) { | |
| 2604 | - | |
| 2605 | - if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') { | |
| 2606 | - var content = pres[i].firstChild.innerHTML.trim(), | |
| 2607 | - language = pres[i].firstChild.getAttribute('data-language') || ''; | |
| 2608 | - | |
| 2609 | - // if data-language attribute is not defined, then we look for class language-* | |
| 2610 | - if (language === '') { | |
| 2611 | - var classes = pres[i].firstChild.className.split(' '); | |
| 2612 | - for (var c = 0; c < classes.length; ++c) { | |
| 2613 | - var matches = classes[c].match(/^language-(.+)$/); | |
| 2614 | - if (matches !== null) { | |
| 2615 | - language = matches[1]; | |
| 2616 | - break; | |
| 2617 | - } | |
| 2618 | - } | |
| 2619 | - } | |
| 2620 | - | |
| 2621 | - // unescape html entities in content | |
| 2622 | - content = showdown.helper.unescapeHTMLEntities(content); | |
| 2623 | - | |
| 2624 | - presPH.push(content); | |
| 2625 | - pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>'; | |
| 2626 | - } else { | |
| 2627 | - presPH.push(pres[i].innerHTML); | |
| 2628 | - pres[i].innerHTML = ''; | |
| 2629 | - pres[i].setAttribute('prenum', i.toString()); | |
| 2630 | - } | |
| 2631 | - } | |
| 2632 | - return presPH; | |
| 2633 | - } | |
| 2634 | - | |
| 2635 | - return mdDoc; | |
| 2636 | - }; | |
| 2637 | - | |
| 2638 | - /** | |
| 2639 | - * Set an option of this Converter instance | |
| 2640 | - * @param {string} key | |
| 2641 | - * @param {*} value | |
| 2642 | - */ | |
| 2643 | - this.setOption = function (key, value) { | |
| 2644 | - options[key] = value; | |
| 2645 | - }; | |
| 2646 | - | |
| 2647 | - /** | |
| 2648 | - * Get the option of this Converter instance | |
| 2649 | - * @param {string} key | |
| 2650 | - * @returns {*} | |
| 2651 | - */ | |
| 2652 | - this.getOption = function (key) { | |
| 2653 | - return options[key]; | |
| 2654 | - }; | |
| 2655 | - | |
| 2656 | - /** | |
| 2657 | - * Get the options of this Converter instance | |
| 2658 | - * @returns {{}} | |
| 2659 | - */ | |
| 2660 | - this.getOptions = function () { | |
| 2661 | - return options; | |
| 2662 | - }; | |
| 2663 | - | |
| 2664 | - /** | |
| 2665 | - * Add extension to THIS converter | |
| 2666 | - * @param {{}} extension | |
| 2667 | - * @param {string} [name=null] | |
| 2668 | - */ | |
| 2669 | - this.addExtension = function (extension, name) { | |
| 2670 | - name = name || null; | |
| 2671 | - _parseExtension(extension, name); | |
| 2672 | - }; | |
| 2673 | - | |
| 2674 | - /** | |
| 2675 | - * Use a global registered extension with THIS converter | |
| 2676 | - * @param {string} extensionName Name of the previously registered extension | |
| 2677 | - */ | |
| 2678 | - this.useExtension = function (extensionName) { | |
| 2679 | - _parseExtension(extensionName); | |
| 2680 | - }; | |
| 2681 | - | |
| 2682 | - /** | |
| 2683 | - * Set the flavor THIS converter should use | |
| 2684 | - * @param {string} name | |
| 2685 | - */ | |
| 2686 | - this.setFlavor = function (name) { | |
| 2687 | - if (!flavor.hasOwnProperty(name)) { | |
| 2688 | - throw Error(name + ' flavor was not found'); | |
| 2689 | - } | |
| 2690 | - var preset = flavor[name]; | |
| 2691 | - setConvFlavor = name; | |
| 2692 | - for (var option in preset) { | |
| 2693 | - if (preset.hasOwnProperty(option)) { | |
| 2694 | - options[option] = preset[option]; | |
| 2695 | - } | |
| 2696 | - } | |
| 2697 | - }; | |
| 2698 | - | |
| 2699 | - /** | |
| 2700 | - * Get the currently set flavor of this converter | |
| 2701 | - * @returns {string} | |
| 2702 | - */ | |
| 2703 | - this.getFlavor = function () { | |
| 2704 | - return setConvFlavor; | |
| 2705 | - }; | |
| 2706 | - | |
| 2707 | - /** | |
| 2708 | - * Remove an extension from THIS converter. | |
| 2709 | - * Note: This is a costly operation. It's better to initialize a new converter | |
| 2710 | - * and specify the extensions you wish to use | |
| 2711 | - * @param {Array} extension | |
| 2712 | - */ | |
| 2713 | - this.removeExtension = function (extension) { | |
| 2714 | - if (!showdown.helper.isArray(extension)) { | |
| 2715 | - extension = [extension]; | |
| 2716 | - } | |
| 2717 | - for (var a = 0; a < extension.length; ++a) { | |
| 2718 | - var ext = extension[a]; | |
| 2719 | - for (var i = 0; i < langExtensions.length; ++i) { | |
| 2720 | - if (langExtensions[i] === ext) { | |
| 2721 | - langExtensions[i].splice(i, 1); | |
| 2722 | - } | |
| 2723 | - } | |
| 2724 | - for (var ii = 0; ii < outputModifiers.length; ++i) { | |
| 2725 | - if (outputModifiers[ii] === ext) { | |
| 2726 | - outputModifiers[ii].splice(i, 1); | |
| 2727 | - } | |
| 2728 | - } | |
| 2729 | - } | |
| 2730 | - }; | |
| 2731 | - | |
| 2732 | - /** | |
| 2733 | - * Get all extension of THIS converter | |
| 2734 | - * @returns {{language: Array, output: Array}} | |
| 2735 | - */ | |
| 2736 | - this.getAllExtensions = function () { | |
| 2737 | - return { | |
| 2738 | - language: langExtensions, | |
| 2739 | - output: outputModifiers | |
| 2740 | - }; | |
| 2741 | - }; | |
| 2742 | - | |
| 2743 | - /** | |
| 2744 | - * Get the metadata of the previously parsed document | |
| 2745 | - * @param raw | |
| 2746 | - * @returns {string|{}} | |
| 2747 | - */ | |
| 2748 | - this.getMetadata = function (raw) { | |
| 2749 | - if (raw) { | |
| 2750 | - return metadata.raw; | |
| 2751 | - } else { | |
| 2752 | - return metadata.parsed; | |
| 2753 | - } | |
| 2754 | - }; | |
| 2755 | - | |
| 2756 | - /** | |
| 2757 | - * Get the metadata format of the previously parsed document | |
| 2758 | - * @returns {string} | |
| 2759 | - */ | |
| 2760 | - this.getMetadataFormat = function () { | |
| 2761 | - return metadata.format; | |
| 2762 | - }; | |
| 2763 | - | |
| 2764 | - /** | |
| 2765 | - * Private: set a single key, value metadata pair | |
| 2766 | - * @param {string} key | |
| 2767 | - * @param {string} value | |
| 2768 | - */ | |
| 2769 | - this._setMetadataPair = function (key, value) { | |
| 2770 | - metadata.parsed[key] = value; | |
| 2771 | - }; | |
| 2772 | - | |
| 2773 | - /** | |
| 2774 | - * Private: set metadata format | |
| 2775 | - * @param {string} format | |
| 2776 | - */ | |
| 2777 | - this._setMetadataFormat = function (format) { | |
| 2778 | - metadata.format = format; | |
| 2779 | - }; | |
| 2780 | - | |
| 2781 | - /** | |
| 2782 | - * Private: set metadata raw text | |
| 2783 | - * @param {string} raw | |
| 2784 | - */ | |
| 2785 | - this._setMetadataRaw = function (raw) { | |
| 2786 | - metadata.raw = raw; | |
| 2787 | - }; | |
| 2788 | -}; | |
| 2789 | - | |
| 2790 | -/** | |
| 2791 | - * Turn Markdown link shortcuts into XHTML <a> tags. | |
| 2792 | - */ | |
| 2793 | -showdown.subParser('anchors', function (text, options, globals) { | |
| 2794 | - 'use strict'; | |
| 2795 | - | |
| 2796 | - text = globals.converter._dispatch('anchors.before', text, options, globals); | |
| 2797 | - | |
| 2798 | - var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) { | |
| 2799 | - if (showdown.helper.isUndefined(title)) { | |
| 2800 | - title = ''; | |
| 2801 | - } | |
| 2802 | - linkId = linkId.toLowerCase(); | |
| 2803 | - | |
| 2804 | - // Special case for explicit empty url | |
| 2805 | - if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { | |
| 2806 | - url = ''; | |
| 2807 | - } else if (!url) { | |
| 2808 | - if (!linkId) { | |
| 2809 | - // lower-case and turn embedded newlines into spaces | |
| 2810 | - linkId = linkText.toLowerCase().replace(/ ?\n/g, ' '); | |
| 2811 | - } | |
| 2812 | - url = '#' + linkId; | |
| 2813 | - | |
| 2814 | - if (!showdown.helper.isUndefined(globals.gUrls[linkId])) { | |
| 2815 | - url = globals.gUrls[linkId]; | |
| 2816 | - if (!showdown.helper.isUndefined(globals.gTitles[linkId])) { | |
| 2817 | - title = globals.gTitles[linkId]; | |
| 2818 | - } | |
| 2819 | - } else { | |
| 2820 | - return wholeMatch; | |
| 2821 | - } | |
| 2822 | - } | |
| 2823 | - | |
| 2824 | - //url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance | |
| 2825 | - url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 2826 | - | |
| 2827 | - var result = '<a href="' + url + '"'; | |
| 2828 | - | |
| 2829 | - if (title !== '' && title !== null) { | |
| 2830 | - title = title.replace(/"/g, '"'); | |
| 2831 | - //title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance | |
| 2832 | - title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 2833 | - result += ' title="' + title + '"'; | |
| 2834 | - } | |
| 2835 | - | |
| 2836 | - // optionLinksInNewWindow only applies | |
| 2837 | - // to external links. Hash links (#) open in same page | |
| 2838 | - if (options.openLinksInNewWindow && !/^#/.test(url)) { | |
| 2839 | - // escaped _ | |
| 2840 | - result += ' rel="noopener noreferrer" target="¨E95Eblank"'; | |
| 2841 | - } | |
| 2842 | - | |
| 2843 | - result += '>' + linkText + '</a>'; | |
| 2844 | - | |
| 2845 | - return result; | |
| 2846 | - }; | |
| 2847 | - | |
| 2848 | - // First, handle reference-style links: [link text] [id] | |
| 2849 | - text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag); | |
| 2850 | - | |
| 2851 | - // Next, inline-style links: [link text](url "optional title") | |
| 2852 | - // cases with crazy urls like ./image/cat1).png | |
| 2853 | - text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, | |
| 2854 | - writeAnchorTag); | |
| 2855 | - | |
| 2856 | - // normal cases | |
| 2857 | - text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, | |
| 2858 | - writeAnchorTag); | |
| 2859 | - | |
| 2860 | - // handle reference-style shortcuts: [link text] | |
| 2861 | - // These must come last in case you've also got [link test][1] | |
| 2862 | - // or [link test](/foo) | |
| 2863 | - text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag); | |
| 2864 | - | |
| 2865 | - // Lastly handle GithubMentions if option is enabled | |
| 2866 | - if (options.ghMentions) { | |
| 2867 | - text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) { | |
| 2868 | - if (escape === '\\') { | |
| 2869 | - return st + mentions; | |
| 2870 | - } | |
| 2871 | - | |
| 2872 | - //check if options.ghMentionsLink is a string | |
| 2873 | - if (!showdown.helper.isString(options.ghMentionsLink)) { | |
| 2874 | - throw new Error('ghMentionsLink option must be a string'); | |
| 2875 | - } | |
| 2876 | - var lnk = options.ghMentionsLink.replace(/\{u}/g, username), | |
| 2877 | - target = ''; | |
| 2878 | - if (options.openLinksInNewWindow) { | |
| 2879 | - target = ' rel="noopener noreferrer" target="¨E95Eblank"'; | |
| 2880 | - } | |
| 2881 | - return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>'; | |
| 2882 | - }); | |
| 2883 | - } | |
| 2884 | - | |
| 2885 | - text = globals.converter._dispatch('anchors.after', text, options, globals); | |
| 2886 | - return text; | |
| 2887 | -}); | |
| 2888 | - | |
| 2889 | -// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-] | |
| 2890 | - | |
| 2891 | -var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, | |
| 2892 | - simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, | |
| 2893 | - delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, | |
| 2894 | - simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, | |
| 2895 | - delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, | |
| 2896 | - | |
| 2897 | - replaceLink = function (options) { | |
| 2898 | - 'use strict'; | |
| 2899 | - return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) { | |
| 2900 | - link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 2901 | - var lnkTxt = link, | |
| 2902 | - append = '', | |
| 2903 | - target = '', | |
| 2904 | - lmc = leadingMagicChars || '', | |
| 2905 | - tmc = trailingMagicChars || ''; | |
| 2906 | - if (/^www\./i.test(link)) { | |
| 2907 | - link = link.replace(/^www\./i, 'http://www.'); | |
| 2908 | - } | |
| 2909 | - if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) { | |
| 2910 | - append = trailingPunctuation; | |
| 2911 | - } | |
| 2912 | - if (options.openLinksInNewWindow) { | |
| 2913 | - target = ' rel="noopener noreferrer" target="¨E95Eblank"'; | |
| 2914 | - } | |
| 2915 | - return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc; | |
| 2916 | - }; | |
| 2917 | - }, | |
| 2918 | - | |
| 2919 | - replaceMail = function (options, globals) { | |
| 2920 | - 'use strict'; | |
| 2921 | - return function (wholeMatch, b, mail) { | |
| 2922 | - var href = 'mailto:'; | |
| 2923 | - b = b || ''; | |
| 2924 | - mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals); | |
| 2925 | - if (options.encodeEmails) { | |
| 2926 | - href = showdown.helper.encodeEmailAddress(href + mail); | |
| 2927 | - mail = showdown.helper.encodeEmailAddress(mail); | |
| 2928 | - } else { | |
| 2929 | - href = href + mail; | |
| 2930 | - } | |
| 2931 | - return b + '<a href="' + href + '">' + mail + '</a>'; | |
| 2932 | - }; | |
| 2933 | - }; | |
| 2934 | - | |
| 2935 | -showdown.subParser('autoLinks', function (text, options, globals) { | |
| 2936 | - 'use strict'; | |
| 2937 | - | |
| 2938 | - text = globals.converter._dispatch('autoLinks.before', text, options, globals); | |
| 2939 | - | |
| 2940 | - text = text.replace(delimUrlRegex, replaceLink(options)); | |
| 2941 | - text = text.replace(delimMailRegex, replaceMail(options, globals)); | |
| 2942 | - | |
| 2943 | - text = globals.converter._dispatch('autoLinks.after', text, options, globals); | |
| 2944 | - | |
| 2945 | - return text; | |
| 2946 | -}); | |
| 2947 | - | |
| 2948 | -showdown.subParser('simplifiedAutoLinks', function (text, options, globals) { | |
| 2949 | - 'use strict'; | |
| 2950 | - | |
| 2951 | - if (!options.simplifiedAutoLink) { | |
| 2952 | - return text; | |
| 2953 | - } | |
| 2954 | - | |
| 2955 | - text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals); | |
| 2956 | - | |
| 2957 | - if (options.excludeTrailingPunctuationFromURLs) { | |
| 2958 | - text = text.replace(simpleURLRegex2, replaceLink(options)); | |
| 2959 | - } else { | |
| 2960 | - text = text.replace(simpleURLRegex, replaceLink(options)); | |
| 2961 | - } | |
| 2962 | - text = text.replace(simpleMailRegex, replaceMail(options, globals)); | |
| 2963 | - | |
| 2964 | - text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals); | |
| 2965 | - | |
| 2966 | - return text; | |
| 2967 | -}); | |
| 2968 | - | |
| 2969 | -/** | |
| 2970 | - * These are all the transformations that form block-level | |
| 2971 | - * tags like paragraphs, headers, and list items. | |
| 2972 | - */ | |
| 2973 | -showdown.subParser('blockGamut', function (text, options, globals) { | |
| 2974 | - 'use strict'; | |
| 2975 | - | |
| 2976 | - text = globals.converter._dispatch('blockGamut.before', text, options, globals); | |
| 2977 | - | |
| 2978 | - // we parse blockquotes first so that we can have headings and hrs | |
| 2979 | - // inside blockquotes | |
| 2980 | - text = showdown.subParser('blockQuotes')(text, options, globals); | |
| 2981 | - text = showdown.subParser('headers')(text, options, globals); | |
| 2982 | - | |
| 2983 | - // Do Horizontal Rules: | |
| 2984 | - text = showdown.subParser('horizontalRule')(text, options, globals); | |
| 2985 | - | |
| 2986 | - text = showdown.subParser('lists')(text, options, globals); | |
| 2987 | - text = showdown.subParser('codeBlocks')(text, options, globals); | |
| 2988 | - text = showdown.subParser('tables')(text, options, globals); | |
| 2989 | - | |
| 2990 | - // We already ran _HashHTMLBlocks() before, in Markdown(), but that | |
| 2991 | - // was to escape raw HTML in the original Markdown source. This time, | |
| 2992 | - // we're escaping the markup we've just created, so that we don't wrap | |
| 2993 | - // <p> tags around block-level tags. | |
| 2994 | - text = showdown.subParser('hashHTMLBlocks')(text, options, globals); | |
| 2995 | - text = showdown.subParser('paragraphs')(text, options, globals); | |
| 2996 | - | |
| 2997 | - text = globals.converter._dispatch('blockGamut.after', text, options, globals); | |
| 2998 | - | |
| 2999 | - return text; | |
| 3000 | -}); | |
| 3001 | - | |
| 3002 | -showdown.subParser('blockQuotes', function (text, options, globals) { | |
| 3003 | - 'use strict'; | |
| 3004 | - | |
| 3005 | - text = globals.converter._dispatch('blockQuotes.before', text, options, globals); | |
| 3006 | - | |
| 3007 | - // add a couple extra lines after the text and endtext mark | |
| 3008 | - text = text + '\n\n'; | |
| 3009 | - | |
| 3010 | - var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; | |
| 3011 | - | |
| 3012 | - if (options.splitAdjacentBlockquotes) { | |
| 3013 | - rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm; | |
| 3014 | - } | |
| 3015 | - | |
| 3016 | - text = text.replace(rgx, function (bq) { | |
| 3017 | - // attacklab: hack around Konqueror 3.5.4 bug: | |
| 3018 | - // "----------bug".replace(/^-/g,"") == "bug" | |
| 3019 | - bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting | |
| 3020 | - | |
| 3021 | - // attacklab: clean up hack | |
| 3022 | - bq = bq.replace(/¨0/g, ''); | |
| 3023 | - | |
| 3024 | - bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines | |
| 3025 | - bq = showdown.subParser('githubCodeBlocks')(bq, options, globals); | |
| 3026 | - bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse | |
| 3027 | - | |
| 3028 | - bq = bq.replace(/(^|\n)/g, '$1 '); | |
| 3029 | - // These leading spaces screw with <pre> content, so we need to fix that: | |
| 3030 | - bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) { | |
| 3031 | - var pre = m1; | |
| 3032 | - // attacklab: hack around Konqueror 3.5.4 bug: | |
| 3033 | - pre = pre.replace(/^ /mg, '¨0'); | |
| 3034 | - pre = pre.replace(/¨0/g, ''); | |
| 3035 | - return pre; | |
| 3036 | - }); | |
| 3037 | - | |
| 3038 | - return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals); | |
| 3039 | - }); | |
| 3040 | - | |
| 3041 | - text = globals.converter._dispatch('blockQuotes.after', text, options, globals); | |
| 3042 | - return text; | |
| 3043 | -}); | |
| 3044 | - | |
| 3045 | -/** | |
| 3046 | - * Process Markdown `<pre><code>` blocks. | |
| 3047 | - */ | |
| 3048 | -showdown.subParser('codeBlocks', function (text, options, globals) { | |
| 3049 | - 'use strict'; | |
| 3050 | - | |
| 3051 | - text = globals.converter._dispatch('codeBlocks.before', text, options, globals); | |
| 3052 | - | |
| 3053 | - // sentinel workarounds for lack of \A and \Z, safari\khtml bug | |
| 3054 | - text += '¨0'; | |
| 3055 | - | |
| 3056 | - var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; | |
| 3057 | - text = text.replace(pattern, function (wholeMatch, m1, m2) { | |
| 3058 | - var codeblock = m1, | |
| 3059 | - nextChar = m2, | |
| 3060 | - end = '\n'; | |
| 3061 | - | |
| 3062 | - codeblock = showdown.subParser('outdent')(codeblock, options, globals); | |
| 3063 | - codeblock = showdown.subParser('encodeCode')(codeblock, options, globals); | |
| 3064 | - codeblock = showdown.subParser('detab')(codeblock, options, globals); | |
| 3065 | - codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines | |
| 3066 | - codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines | |
| 3067 | - | |
| 3068 | - if (options.omitExtraWLInCodeBlocks) { | |
| 3069 | - end = ''; | |
| 3070 | - } | |
| 3071 | - | |
| 3072 | - codeblock = '<pre><code>' + codeblock + end + '</code></pre>'; | |
| 3073 | - | |
| 3074 | - return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar; | |
| 3075 | - }); | |
| 3076 | - | |
| 3077 | - // strip sentinel | |
| 3078 | - text = text.replace(/¨0/, ''); | |
| 3079 | - | |
| 3080 | - text = globals.converter._dispatch('codeBlocks.after', text, options, globals); | |
| 3081 | - return text; | |
| 3082 | -}); | |
| 3083 | - | |
| 3084 | -/** | |
| 3085 | - * | |
| 3086 | - * * Backtick quotes are used for <code></code> spans. | |
| 3087 | - * | |
| 3088 | - * * You can use multiple backticks as the delimiters if you want to | |
| 3089 | - * include literal backticks in the code span. So, this input: | |
| 3090 | - * | |
| 3091 | - * Just type ``foo `bar` baz`` at the prompt. | |
| 3092 | - * | |
| 3093 | - * Will translate to: | |
| 3094 | - * | |
| 3095 | - * <p>Just type <code>foo `bar` baz</code> at the prompt.</p> | |
| 3096 | - * | |
| 3097 | - * There's no arbitrary limit to the number of backticks you | |
| 3098 | - * can use as delimters. If you need three consecutive backticks | |
| 3099 | - * in your code, use four for delimiters, etc. | |
| 3100 | - * | |
| 3101 | - * * You can use spaces to get literal backticks at the edges: | |
| 3102 | - * | |
| 3103 | - * ... type `` `bar` `` ... | |
| 3104 | - * | |
| 3105 | - * Turns to: | |
| 3106 | - * | |
| 3107 | - * ... type <code>`bar`</code> ... | |
| 3108 | - */ | |
| 3109 | -showdown.subParser('codeSpans', function (text, options, globals) { | |
| 3110 | - 'use strict'; | |
| 3111 | - | |
| 3112 | - text = globals.converter._dispatch('codeSpans.before', text, options, globals); | |
| 3113 | - | |
| 3114 | - if (typeof text === 'undefined') { | |
| 3115 | - text = ''; | |
| 3116 | - } | |
| 3117 | - text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, | |
| 3118 | - function (wholeMatch, m1, m2, m3) { | |
| 3119 | - var c = m3; | |
| 3120 | - c = c.replace(/^([ \t]*)/g, ''); // leading whitespace | |
| 3121 | - c = c.replace(/[ \t]*$/g, ''); // trailing whitespace | |
| 3122 | - c = showdown.subParser('encodeCode')(c, options, globals); | |
| 3123 | - c = m1 + '<code>' + c + '</code>'; | |
| 3124 | - c = showdown.subParser('hashHTMLSpans')(c, options, globals); | |
| 3125 | - return c; | |
| 3126 | - } | |
| 3127 | - ); | |
| 3128 | - | |
| 3129 | - text = globals.converter._dispatch('codeSpans.after', text, options, globals); | |
| 3130 | - return text; | |
| 3131 | -}); | |
| 3132 | - | |
| 3133 | -/** | |
| 3134 | - * Create a full HTML document from the processed markdown | |
| 3135 | - */ | |
| 3136 | -showdown.subParser('completeHTMLDocument', function (text, options, globals) { | |
| 3137 | - 'use strict'; | |
| 3138 | - | |
| 3139 | - if (!options.completeHTMLDocument) { | |
| 3140 | - return text; | |
| 3141 | - } | |
| 3142 | - | |
| 3143 | - text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals); | |
| 3144 | - | |
| 3145 | - var doctype = 'html', | |
| 3146 | - doctypeParsed = '<!DOCTYPE HTML>\n', | |
| 3147 | - title = '', | |
| 3148 | - charset = '<meta charset="utf-8">\n', | |
| 3149 | - lang = '', | |
| 3150 | - metadata = ''; | |
| 3151 | - | |
| 3152 | - if (typeof globals.metadata.parsed.doctype !== 'undefined') { | |
| 3153 | - doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n'; | |
| 3154 | - doctype = globals.metadata.parsed.doctype.toString().toLowerCase(); | |
| 3155 | - if (doctype === 'html' || doctype === 'html5') { | |
| 3156 | - charset = '<meta charset="utf-8">'; | |
| 3157 | - } | |
| 3158 | - } | |
| 3159 | - | |
| 3160 | - for (var meta in globals.metadata.parsed) { | |
| 3161 | - if (globals.metadata.parsed.hasOwnProperty(meta)) { | |
| 3162 | - switch (meta.toLowerCase()) { | |
| 3163 | - case 'doctype': | |
| 3164 | - break; | |
| 3165 | - | |
| 3166 | - case 'title': | |
| 3167 | - title = '<title>' + globals.metadata.parsed.title + '</title>\n'; | |
| 3168 | - break; | |
| 3169 | - | |
| 3170 | - case 'charset': | |
| 3171 | - if (doctype === 'html' || doctype === 'html5') { | |
| 3172 | - charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n'; | |
| 3173 | - } else { | |
| 3174 | - charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n'; | |
| 3175 | - } | |
| 3176 | - break; | |
| 3177 | - | |
| 3178 | - case 'language': | |
| 3179 | - case 'lang': | |
| 3180 | - lang = ' lang="' + globals.metadata.parsed[meta] + '"'; | |
| 3181 | - metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; | |
| 3182 | - break; | |
| 3183 | - | |
| 3184 | - default: | |
| 3185 | - metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; | |
| 3186 | - } | |
| 3187 | - } | |
| 3188 | - } | |
| 3189 | - | |
| 3190 | - text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>'; | |
| 3191 | - | |
| 3192 | - text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals); | |
| 3193 | - return text; | |
| 3194 | -}); | |
| 3195 | - | |
| 3196 | -/** | |
| 3197 | - * Convert all tabs to spaces | |
| 3198 | - */ | |
| 3199 | -showdown.subParser('detab', function (text, options, globals) { | |
| 3200 | - 'use strict'; | |
| 3201 | - text = globals.converter._dispatch('detab.before', text, options, globals); | |
| 3202 | - | |
| 3203 | - // expand first n-1 tabs | |
| 3204 | - text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width | |
| 3205 | - | |
| 3206 | - // replace the nth with two sentinels | |
| 3207 | - text = text.replace(/\t/g, '¨A¨B'); | |
| 3208 | - | |
| 3209 | - // use the sentinel to anchor our regex so it doesn't explode | |
| 3210 | - text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) { | |
| 3211 | - var leadingText = m1, | |
| 3212 | - numSpaces = 4 - leadingText.length % 4; // g_tab_width | |
| 3213 | - | |
| 3214 | - // there *must* be a better way to do this: | |
| 3215 | - for (var i = 0; i < numSpaces; i++) { | |
| 3216 | - leadingText += ' '; | |
| 3217 | - } | |
| 3218 | - | |
| 3219 | - return leadingText; | |
| 3220 | - }); | |
| 3221 | - | |
| 3222 | - // clean up sentinels | |
| 3223 | - text = text.replace(/¨A/g, ' '); // g_tab_width | |
| 3224 | - text = text.replace(/¨B/g, ''); | |
| 3225 | - | |
| 3226 | - text = globals.converter._dispatch('detab.after', text, options, globals); | |
| 3227 | - return text; | |
| 3228 | -}); | |
| 3229 | - | |
| 3230 | -showdown.subParser('ellipsis', function (text, options, globals) { | |
| 3231 | - 'use strict'; | |
| 3232 | - | |
| 3233 | - text = globals.converter._dispatch('ellipsis.before', text, options, globals); | |
| 3234 | - | |
| 3235 | - text = text.replace(/\.\.\./g, '…'); | |
| 3236 | - | |
| 3237 | - text = globals.converter._dispatch('ellipsis.after', text, options, globals); | |
| 3238 | - | |
| 3239 | - return text; | |
| 3240 | -}); | |
| 3241 | - | |
| 3242 | -/** | |
| 3243 | - * Turn emoji codes into emojis | |
| 3244 | - * | |
| 3245 | - * List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis | |
| 3246 | - */ | |
| 3247 | -showdown.subParser('emoji', function (text, options, globals) { | |
| 3248 | - 'use strict'; | |
| 3249 | - | |
| 3250 | - if (!options.emoji) { | |
| 3251 | - return text; | |
| 3252 | - } | |
| 3253 | - | |
| 3254 | - text = globals.converter._dispatch('emoji.before', text, options, globals); | |
| 3255 | - | |
| 3256 | - var emojiRgx = /:([\S]+?):/g; | |
| 3257 | - | |
| 3258 | - text = text.replace(emojiRgx, function (wm, emojiCode) { | |
| 3259 | - if (showdown.helper.emojis.hasOwnProperty(emojiCode)) { | |
| 3260 | - return showdown.helper.emojis[emojiCode]; | |
| 3261 | - } | |
| 3262 | - return wm; | |
| 3263 | - }); | |
| 3264 | - | |
| 3265 | - text = globals.converter._dispatch('emoji.after', text, options, globals); | |
| 3266 | - | |
| 3267 | - return text; | |
| 3268 | -}); | |
| 3269 | - | |
| 3270 | -/** | |
| 3271 | - * Smart processing for ampersands and angle brackets that need to be encoded. | |
| 3272 | - */ | |
| 3273 | -showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) { | |
| 3274 | - 'use strict'; | |
| 3275 | - text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals); | |
| 3276 | - | |
| 3277 | - // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: | |
| 3278 | - // http://bumppo.net/projects/amputator/ | |
| 3279 | - text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&'); | |
| 3280 | - | |
| 3281 | - // Encode naked <'s | |
| 3282 | - text = text.replace(/<(?![a-z\/?$!])/gi, '<'); | |
| 3283 | - | |
| 3284 | - // Encode < | |
| 3285 | - text = text.replace(/</g, '<'); | |
| 3286 | - | |
| 3287 | - // Encode > | |
| 3288 | - text = text.replace(/>/g, '>'); | |
| 3289 | - | |
| 3290 | - text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals); | |
| 3291 | - return text; | |
| 3292 | -}); | |
| 3293 | - | |
| 3294 | -/** | |
| 3295 | - * Returns the string, with after processing the following backslash escape sequences. | |
| 3296 | - * | |
| 3297 | - * attacklab: The polite way to do this is with the new escapeCharacters() function: | |
| 3298 | - * | |
| 3299 | - * text = escapeCharacters(text,"\\",true); | |
| 3300 | - * text = escapeCharacters(text,"`*_{}[]()>#+-.!",true); | |
| 3301 | - * | |
| 3302 | - * ...but we're sidestepping its use of the (slow) RegExp constructor | |
| 3303 | - * as an optimization for Firefox. This function gets called a LOT. | |
| 3304 | - */ | |
| 3305 | -showdown.subParser('encodeBackslashEscapes', function (text, options, globals) { | |
| 3306 | - 'use strict'; | |
| 3307 | - text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals); | |
| 3308 | - | |
| 3309 | - text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback); | |
| 3310 | - text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback); | |
| 3311 | - | |
| 3312 | - text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals); | |
| 3313 | - return text; | |
| 3314 | -}); | |
| 3315 | - | |
| 3316 | -/** | |
| 3317 | - * Encode/escape certain characters inside Markdown code runs. | |
| 3318 | - * The point is that in code, these characters are literals, | |
| 3319 | - * and lose their special Markdown meanings. | |
| 3320 | - */ | |
| 3321 | -showdown.subParser('encodeCode', function (text, options, globals) { | |
| 3322 | - 'use strict'; | |
| 3323 | - | |
| 3324 | - text = globals.converter._dispatch('encodeCode.before', text, options, globals); | |
| 3325 | - | |
| 3326 | - // Encode all ampersands; HTML entities are not | |
| 3327 | - // entities within a Markdown code span. | |
| 3328 | - text = text | |
| 3329 | - .replace(/&/g, '&') | |
| 3330 | - // Do the angle bracket song and dance: | |
| 3331 | - .replace(/</g, '<') | |
| 3332 | - .replace(/>/g, '>') | |
| 3333 | - // Now, escape characters that are magic in Markdown: | |
| 3334 | - .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback); | |
| 3335 | - | |
| 3336 | - text = globals.converter._dispatch('encodeCode.after', text, options, globals); | |
| 3337 | - return text; | |
| 3338 | -}); | |
| 3339 | - | |
| 3340 | -/** | |
| 3341 | - * Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they | |
| 3342 | - * don't conflict with their use in Markdown for code, italics and strong. | |
| 3343 | - */ | |
| 3344 | -showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) { | |
| 3345 | - 'use strict'; | |
| 3346 | - text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals); | |
| 3347 | - | |
| 3348 | - // Build a regex to find HTML tags. | |
| 3349 | - var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, | |
| 3350 | - comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; | |
| 3351 | - | |
| 3352 | - text = text.replace(tags, function (wholeMatch) { | |
| 3353 | - return wholeMatch | |
| 3354 | - .replace(/(.)<\/?code>(?=.)/g, '$1`') | |
| 3355 | - .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); | |
| 3356 | - }); | |
| 3357 | - | |
| 3358 | - text = text.replace(comments, function (wholeMatch) { | |
| 3359 | - return wholeMatch | |
| 3360 | - .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); | |
| 3361 | - }); | |
| 3362 | - | |
| 3363 | - text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals); | |
| 3364 | - return text; | |
| 3365 | -}); | |
| 3366 | - | |
| 3367 | -/** | |
| 3368 | - * Handle github codeblocks prior to running HashHTML so that | |
| 3369 | - * HTML contained within the codeblock gets escaped properly | |
| 3370 | - * Example: | |
| 3371 | - * ```ruby | |
| 3372 | - * def hello_world(x) | |
| 3373 | - * puts "Hello, #{x}" | |
| 3374 | - * end | |
| 3375 | - * ``` | |
| 3376 | - */ | |
| 3377 | -showdown.subParser('githubCodeBlocks', function (text, options, globals) { | |
| 3378 | - 'use strict'; | |
| 3379 | - | |
| 3380 | - // early exit if option is not enabled | |
| 3381 | - if (!options.ghCodeBlocks) { | |
| 3382 | - return text; | |
| 3383 | - } | |
| 3384 | - | |
| 3385 | - text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals); | |
| 3386 | - | |
| 3387 | - text += '¨0'; | |
| 3388 | - | |
| 3389 | - text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) { | |
| 3390 | - var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n'; | |
| 3391 | - | |
| 3392 | - // First parse the github code block | |
| 3393 | - codeblock = showdown.subParser('encodeCode')(codeblock, options, globals); | |
| 3394 | - codeblock = showdown.subParser('detab')(codeblock, options, globals); | |
| 3395 | - codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines | |
| 3396 | - codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace | |
| 3397 | - | |
| 3398 | - codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>'; | |
| 3399 | - | |
| 3400 | - codeblock = showdown.subParser('hashBlock')(codeblock, options, globals); | |
| 3401 | - | |
| 3402 | - // Since GHCodeblocks can be false positives, we need to | |
| 3403 | - // store the primitive text and the parsed text in a global var, | |
| 3404 | - // and then return a token | |
| 3405 | - return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; | |
| 3406 | - }); | |
| 3407 | - | |
| 3408 | - // attacklab: strip sentinel | |
| 3409 | - text = text.replace(/¨0/, ''); | |
| 3410 | - | |
| 3411 | - return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals); | |
| 3412 | -}); | |
| 3413 | - | |
| 3414 | -showdown.subParser('hashBlock', function (text, options, globals) { | |
| 3415 | - 'use strict'; | |
| 3416 | - text = globals.converter._dispatch('hashBlock.before', text, options, globals); | |
| 3417 | - text = text.replace(/(^\n+|\n+$)/g, ''); | |
| 3418 | - text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n'; | |
| 3419 | - text = globals.converter._dispatch('hashBlock.after', text, options, globals); | |
| 3420 | - return text; | |
| 3421 | -}); | |
| 3422 | - | |
| 3423 | -/** | |
| 3424 | - * Hash and escape <code> elements that should not be parsed as markdown | |
| 3425 | - */ | |
| 3426 | -showdown.subParser('hashCodeTags', function (text, options, globals) { | |
| 3427 | - 'use strict'; | |
| 3428 | - text = globals.converter._dispatch('hashCodeTags.before', text, options, globals); | |
| 3429 | - | |
| 3430 | - var repFunc = function (wholeMatch, match, left, right) { | |
| 3431 | - var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right; | |
| 3432 | - return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C'; | |
| 3433 | - }; | |
| 3434 | - | |
| 3435 | - // Hash naked <code> | |
| 3436 | - text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim'); | |
| 3437 | - | |
| 3438 | - text = globals.converter._dispatch('hashCodeTags.after', text, options, globals); | |
| 3439 | - return text; | |
| 3440 | -}); | |
| 3441 | - | |
| 3442 | -showdown.subParser('hashElement', function (text, options, globals) { | |
| 3443 | - 'use strict'; | |
| 3444 | - | |
| 3445 | - return function (wholeMatch, m1) { | |
| 3446 | - var blockText = m1; | |
| 3447 | - | |
| 3448 | - // Undo double lines | |
| 3449 | - blockText = blockText.replace(/\n\n/g, '\n'); | |
| 3450 | - blockText = blockText.replace(/^\n/, ''); | |
| 3451 | - | |
| 3452 | - // strip trailing blank lines | |
| 3453 | - blockText = blockText.replace(/\n+$/g, ''); | |
| 3454 | - | |
| 3455 | - // Replace the element text with a marker ("¨KxK" where x is its key) | |
| 3456 | - blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n'; | |
| 3457 | - | |
| 3458 | - return blockText; | |
| 3459 | - }; | |
| 3460 | -}); | |
| 3461 | - | |
| 3462 | -showdown.subParser('hashHTMLBlocks', function (text, options, globals) { | |
| 3463 | - 'use strict'; | |
| 3464 | - text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals); | |
| 3465 | - | |
| 3466 | - var blockTags = [ | |
| 3467 | - 'pre', | |
| 3468 | - 'div', | |
| 3469 | - 'h1', | |
| 3470 | - 'h2', | |
| 3471 | - 'h3', | |
| 3472 | - 'h4', | |
| 3473 | - 'h5', | |
| 3474 | - 'h6', | |
| 3475 | - 'blockquote', | |
| 3476 | - 'table', | |
| 3477 | - 'dl', | |
| 3478 | - 'ol', | |
| 3479 | - 'ul', | |
| 3480 | - 'script', | |
| 3481 | - 'noscript', | |
| 3482 | - 'form', | |
| 3483 | - 'fieldset', | |
| 3484 | - 'iframe', | |
| 3485 | - 'math', | |
| 3486 | - 'style', | |
| 3487 | - 'section', | |
| 3488 | - 'header', | |
| 3489 | - 'footer', | |
| 3490 | - 'nav', | |
| 3491 | - 'article', | |
| 3492 | - 'aside', | |
| 3493 | - 'address', | |
| 3494 | - 'audio', | |
| 3495 | - 'canvas', | |
| 3496 | - 'figure', | |
| 3497 | - 'hgroup', | |
| 3498 | - 'output', | |
| 3499 | - 'video', | |
| 3500 | - 'p' | |
| 3501 | - ], | |
| 3502 | - repFunc = function (wholeMatch, match, left, right) { | |
| 3503 | - var txt = wholeMatch; | |
| 3504 | - // check if this html element is marked as markdown | |
| 3505 | - // if so, it's contents should be parsed as markdown | |
| 3506 | - if (left.search(/\bmarkdown\b/) !== -1) { | |
| 3507 | - txt = left + globals.converter.makeHtml(match) + right; | |
| 3508 | - } | |
| 3509 | - return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; | |
| 3510 | - }; | |
| 3511 | - | |
| 3512 | - if (options.backslashEscapesHTMLTags) { | |
| 3513 | - // encode backslash escaped HTML tags | |
| 3514 | - text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) { | |
| 3515 | - return '<' + inside + '>'; | |
| 3516 | - }); | |
| 3517 | - } | |
| 3518 | - | |
| 3519 | - // hash HTML Blocks | |
| 3520 | - for (var i = 0; i < blockTags.length; ++i) { | |
| 3521 | - | |
| 3522 | - var opTagPos, | |
| 3523 | - rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'), | |
| 3524 | - patLeft = '<' + blockTags[i] + '\\b[^>]*>', | |
| 3525 | - patRight = '</' + blockTags[i] + '>'; | |
| 3526 | - // 1. Look for the first position of the first opening HTML tag in the text | |
| 3527 | - while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) { | |
| 3528 | - | |
| 3529 | - // if the HTML tag is \ escaped, we need to escape it and break | |
| 3530 | - | |
| 3531 | - | |
| 3532 | - //2. Split the text in that position | |
| 3533 | - var subTexts = showdown.helper.splitAtIndex(text, opTagPos), | |
| 3534 | - //3. Match recursively | |
| 3535 | - newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im'); | |
| 3536 | - | |
| 3537 | - // prevent an infinite loop | |
| 3538 | - if (newSubText1 === subTexts[1]) { | |
| 3539 | - break; | |
| 3540 | - } | |
| 3541 | - text = subTexts[0].concat(newSubText1); | |
| 3542 | - } | |
| 3543 | - } | |
| 3544 | - // HR SPECIAL CASE | |
| 3545 | - text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, | |
| 3546 | - showdown.subParser('hashElement')(text, options, globals)); | |
| 3547 | - | |
| 3548 | - // Special case for standalone HTML comments | |
| 3549 | - text = showdown.helper.replaceRecursiveRegExp(text, function (txt) { | |
| 3550 | - return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n'; | |
| 3551 | - }, '^ {0,3}<!--', '-->', 'gm'); | |
| 3552 | - | |
| 3553 | - // PHP and ASP-style processor instructions (<?...?> and <%...%>) | |
| 3554 | - text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, | |
| 3555 | - showdown.subParser('hashElement')(text, options, globals)); | |
| 3556 | - | |
| 3557 | - text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals); | |
| 3558 | - return text; | |
| 3559 | -}); | |
| 3560 | - | |
| 3561 | -/** | |
| 3562 | - * Hash span elements that should not be parsed as markdown | |
| 3563 | - */ | |
| 3564 | -showdown.subParser('hashHTMLSpans', function (text, options, globals) { | |
| 3565 | - 'use strict'; | |
| 3566 | - text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals); | |
| 3567 | - | |
| 3568 | - function hashHTMLSpan (html) { | |
| 3569 | - return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C'; | |
| 3570 | - } | |
| 3571 | - | |
| 3572 | - // Hash Self Closing tags | |
| 3573 | - text = text.replace(/<[^>]+?\/>/gi, function (wm) { | |
| 3574 | - return hashHTMLSpan(wm); | |
| 3575 | - }); | |
| 3576 | - | |
| 3577 | - // Hash tags without properties | |
| 3578 | - text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) { | |
| 3579 | - return hashHTMLSpan(wm); | |
| 3580 | - }); | |
| 3581 | - | |
| 3582 | - // Hash tags with properties | |
| 3583 | - text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) { | |
| 3584 | - return hashHTMLSpan(wm); | |
| 3585 | - }); | |
| 3586 | - | |
| 3587 | - // Hash self closing tags without /> | |
| 3588 | - text = text.replace(/<[^>]+?>/gi, function (wm) { | |
| 3589 | - return hashHTMLSpan(wm); | |
| 3590 | - }); | |
| 3591 | - | |
| 3592 | - /*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/ | |
| 3593 | - | |
| 3594 | - text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals); | |
| 3595 | - return text; | |
| 3596 | -}); | |
| 3597 | - | |
| 3598 | -/** | |
| 3599 | - * Unhash HTML spans | |
| 3600 | - */ | |
| 3601 | -showdown.subParser('unhashHTMLSpans', function (text, options, globals) { | |
| 3602 | - 'use strict'; | |
| 3603 | - text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals); | |
| 3604 | - | |
| 3605 | - for (var i = 0; i < globals.gHtmlSpans.length; ++i) { | |
| 3606 | - var repText = globals.gHtmlSpans[i], | |
| 3607 | - // limiter to prevent infinite loop (assume 10 as limit for recurse) | |
| 3608 | - limit = 0; | |
| 3609 | - | |
| 3610 | - while (/¨C(\d+)C/.test(repText)) { | |
| 3611 | - var num = RegExp.$1; | |
| 3612 | - repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]); | |
| 3613 | - if (limit === 10) { | |
| 3614 | - console.error('maximum nesting of 10 spans reached!!!'); | |
| 3615 | - break; | |
| 3616 | - } | |
| 3617 | - ++limit; | |
| 3618 | - } | |
| 3619 | - text = text.replace('¨C' + i + 'C', repText); | |
| 3620 | - } | |
| 3621 | - | |
| 3622 | - text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals); | |
| 3623 | - return text; | |
| 3624 | -}); | |
| 3625 | - | |
| 3626 | -/** | |
| 3627 | - * Hash and escape <pre><code> elements that should not be parsed as markdown | |
| 3628 | - */ | |
| 3629 | -showdown.subParser('hashPreCodeTags', function (text, options, globals) { | |
| 3630 | - 'use strict'; | |
| 3631 | - text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals); | |
| 3632 | - | |
| 3633 | - var repFunc = function (wholeMatch, match, left, right) { | |
| 3634 | - // encode html entities | |
| 3635 | - var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right; | |
| 3636 | - return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n'; | |
| 3637 | - }; | |
| 3638 | - | |
| 3639 | - // Hash <pre><code> | |
| 3640 | - text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim'); | |
| 3641 | - | |
| 3642 | - text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals); | |
| 3643 | - return text; | |
| 3644 | -}); | |
| 3645 | - | |
| 3646 | -showdown.subParser('headers', function (text, options, globals) { | |
| 3647 | - 'use strict'; | |
| 3648 | - | |
| 3649 | - text = globals.converter._dispatch('headers.before', text, options, globals); | |
| 3650 | - | |
| 3651 | - var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart), | |
| 3652 | - | |
| 3653 | - // Set text-style headers: | |
| 3654 | - // Header 1 | |
| 3655 | - // ======== | |
| 3656 | - // | |
| 3657 | - // Header 2 | |
| 3658 | - // -------- | |
| 3659 | - // | |
| 3660 | - setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, | |
| 3661 | - setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; | |
| 3662 | - | |
| 3663 | - text = text.replace(setextRegexH1, function (wholeMatch, m1) { | |
| 3664 | - | |
| 3665 | - var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), | |
| 3666 | - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', | |
| 3667 | - hLevel = headerLevelStart, | |
| 3668 | - hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>'; | |
| 3669 | - return showdown.subParser('hashBlock')(hashBlock, options, globals); | |
| 3670 | - }); | |
| 3671 | - | |
| 3672 | - text = text.replace(setextRegexH2, function (matchFound, m1) { | |
| 3673 | - var spanGamut = showdown.subParser('spanGamut')(m1, options, globals), | |
| 3674 | - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"', | |
| 3675 | - hLevel = headerLevelStart + 1, | |
| 3676 | - hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>'; | |
| 3677 | - return showdown.subParser('hashBlock')(hashBlock, options, globals); | |
| 3678 | - }); | |
| 3679 | - | |
| 3680 | - // atx-style headers: | |
| 3681 | - // # Header 1 | |
| 3682 | - // ## Header 2 | |
| 3683 | - // ## Header 2 with closing hashes ## | |
| 3684 | - // ... | |
| 3685 | - // ###### Header 6 | |
| 3686 | - // | |
| 3687 | - var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; | |
| 3688 | - | |
| 3689 | - text = text.replace(atxStyle, function (wholeMatch, m1, m2) { | |
| 3690 | - var hText = m2; | |
| 3691 | - if (options.customizedHeaderId) { | |
| 3692 | - hText = m2.replace(/\s?\{([^{]+?)}\s*$/, ''); | |
| 3693 | - } | |
| 3694 | - | |
| 3695 | - var span = showdown.subParser('spanGamut')(hText, options, globals), | |
| 3696 | - hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"', | |
| 3697 | - hLevel = headerLevelStart - 1 + m1.length, | |
| 3698 | - header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>'; | |
| 3699 | - | |
| 3700 | - return showdown.subParser('hashBlock')(header, options, globals); | |
| 3701 | - }); | |
| 3702 | - | |
| 3703 | - function headerId (m) { | |
| 3704 | - var title, | |
| 3705 | - prefix; | |
| 3706 | - | |
| 3707 | - // It is separate from other options to allow combining prefix and customized | |
| 3708 | - if (options.customizedHeaderId) { | |
| 3709 | - var match = m.match(/\{([^{]+?)}\s*$/); | |
| 3710 | - if (match && match[1]) { | |
| 3711 | - m = match[1]; | |
| 3712 | - } | |
| 3713 | - } | |
| 3714 | - | |
| 3715 | - title = m; | |
| 3716 | - | |
| 3717 | - // Prefix id to prevent causing inadvertent pre-existing style matches. | |
| 3718 | - if (showdown.helper.isString(options.prefixHeaderId)) { | |
| 3719 | - prefix = options.prefixHeaderId; | |
| 3720 | - } else if (options.prefixHeaderId === true) { | |
| 3721 | - prefix = 'section-'; | |
| 3722 | - } else { | |
| 3723 | - prefix = ''; | |
| 3724 | - } | |
| 3725 | - | |
| 3726 | - if (!options.rawPrefixHeaderId) { | |
| 3727 | - title = prefix + title; | |
| 3728 | - } | |
| 3729 | - | |
| 3730 | - if (options.ghCompatibleHeaderId) { | |
| 3731 | - title = title | |
| 3732 | - .replace(/ /g, '-') | |
| 3733 | - // replace previously escaped chars (&, ¨ and $) | |
| 3734 | - .replace(/&/g, '') | |
| 3735 | - .replace(/¨T/g, '') | |
| 3736 | - .replace(/¨D/g, '') | |
| 3737 | - // replace rest of the chars (&~$ are repeated as they might have been escaped) | |
| 3738 | - // borrowed from github's redcarpet (some they should produce similar results) | |
| 3739 | - .replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '') | |
| 3740 | - .toLowerCase(); | |
| 3741 | - } else if (options.rawHeaderId) { | |
| 3742 | - title = title | |
| 3743 | - .replace(/ /g, '-') | |
| 3744 | - // replace previously escaped chars (&, ¨ and $) | |
| 3745 | - .replace(/&/g, '&') | |
| 3746 | - .replace(/¨T/g, '¨') | |
| 3747 | - .replace(/¨D/g, '$') | |
| 3748 | - // replace " and ' | |
| 3749 | - .replace(/["']/g, '-') | |
| 3750 | - .toLowerCase(); | |
| 3751 | - } else { | |
| 3752 | - title = title | |
| 3753 | - .replace(/[^\w]/g, '') | |
| 3754 | - .toLowerCase(); | |
| 3755 | - } | |
| 3756 | - | |
| 3757 | - if (options.rawPrefixHeaderId) { | |
| 3758 | - title = prefix + title; | |
| 3759 | - } | |
| 3760 | - | |
| 3761 | - if (globals.hashLinkCounts[title]) { | |
| 3762 | - title = title + '-' + (globals.hashLinkCounts[title]++); | |
| 3763 | - } else { | |
| 3764 | - globals.hashLinkCounts[title] = 1; | |
| 3765 | - } | |
| 3766 | - return title; | |
| 3767 | - } | |
| 3768 | - | |
| 3769 | - text = globals.converter._dispatch('headers.after', text, options, globals); | |
| 3770 | - return text; | |
| 3771 | -}); | |
| 3772 | - | |
| 3773 | -/** | |
| 3774 | - * Turn Markdown link shortcuts into XHTML <a> tags. | |
| 3775 | - */ | |
| 3776 | -showdown.subParser('horizontalRule', function (text, options, globals) { | |
| 3777 | - 'use strict'; | |
| 3778 | - text = globals.converter._dispatch('horizontalRule.before', text, options, globals); | |
| 3779 | - | |
| 3780 | - var key = showdown.subParser('hashBlock')('<hr />', options, globals); | |
| 3781 | - text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key); | |
| 3782 | - text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key); | |
| 3783 | - text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key); | |
| 3784 | - | |
| 3785 | - text = globals.converter._dispatch('horizontalRule.after', text, options, globals); | |
| 3786 | - return text; | |
| 3787 | -}); | |
| 3788 | - | |
| 3789 | -/** | |
| 3790 | - * Turn Markdown image shortcuts into <img> tags. | |
| 3791 | - */ | |
| 3792 | -showdown.subParser('images', function (text, options, globals) { | |
| 3793 | - 'use strict'; | |
| 3794 | - | |
| 3795 | - text = globals.converter._dispatch('images.before', text, options, globals); | |
| 3796 | - | |
| 3797 | - var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, | |
| 3798 | - crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, | |
| 3799 | - 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, | |
| 3800 | - referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, | |
| 3801 | - refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g; | |
| 3802 | - | |
| 3803 | - function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) { | |
| 3804 | - url = url.replace(/\s/g, ''); | |
| 3805 | - return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title); | |
| 3806 | - } | |
| 3807 | - | |
| 3808 | - function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) { | |
| 3809 | - | |
| 3810 | - var gUrls = globals.gUrls, | |
| 3811 | - gTitles = globals.gTitles, | |
| 3812 | - gDims = globals.gDimensions; | |
| 3813 | - | |
| 3814 | - linkId = linkId.toLowerCase(); | |
| 3815 | - | |
| 3816 | - if (!title) { | |
| 3817 | - title = ''; | |
| 3818 | - } | |
| 3819 | - // Special case for explicit empty url | |
| 3820 | - if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { | |
| 3821 | - url = ''; | |
| 3822 | - | |
| 3823 | - } else if (url === '' || url === null) { | |
| 3824 | - if (linkId === '' || linkId === null) { | |
| 3825 | - // lower-case and turn embedded newlines into spaces | |
| 3826 | - linkId = altText.toLowerCase().replace(/ ?\n/g, ' '); | |
| 3827 | - } | |
| 3828 | - url = '#' + linkId; | |
| 3829 | - | |
| 3830 | - if (!showdown.helper.isUndefined(gUrls[linkId])) { | |
| 3831 | - url = gUrls[linkId]; | |
| 3832 | - if (!showdown.helper.isUndefined(gTitles[linkId])) { | |
| 3833 | - title = gTitles[linkId]; | |
| 3834 | - } | |
| 3835 | - if (!showdown.helper.isUndefined(gDims[linkId])) { | |
| 3836 | - width = gDims[linkId].width; | |
| 3837 | - height = gDims[linkId].height; | |
| 3838 | - } | |
| 3839 | - } else { | |
| 3840 | - return wholeMatch; | |
| 3841 | - } | |
| 3842 | - } | |
| 3843 | - | |
| 3844 | - altText = altText | |
| 3845 | - .replace(/"/g, '"') | |
| 3846 | - //altText = showdown.helper.escapeCharacters(altText, '*_', false); | |
| 3847 | - .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 3848 | - //url = showdown.helper.escapeCharacters(url, '*_', false); | |
| 3849 | - url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 3850 | - var result = '<img src="' + url + '" alt="' + altText + '"'; | |
| 3851 | - | |
| 3852 | - if (title && showdown.helper.isString(title)) { | |
| 3853 | - title = title | |
| 3854 | - .replace(/"/g, '"') | |
| 3855 | - //title = showdown.helper.escapeCharacters(title, '*_', false); | |
| 3856 | - .replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback); | |
| 3857 | - result += ' title="' + title + '"'; | |
| 3858 | - } | |
| 3859 | - | |
| 3860 | - if (width && height) { | |
| 3861 | - width = (width === '*') ? 'auto' : width; | |
| 3862 | - height = (height === '*') ? 'auto' : height; | |
| 3863 | - | |
| 3864 | - result += ' width="' + width + '"'; | |
| 3865 | - result += ' height="' + height + '"'; | |
| 3866 | - } | |
| 3867 | - | |
| 3868 | - result += ' />'; | |
| 3869 | - | |
| 3870 | - return result; | |
| 3871 | - } | |
| 3872 | - | |
| 3873 | - // First, handle reference-style labeled images: ![alt text][id] | |
| 3874 | - text = text.replace(referenceRegExp, writeImageTag); | |
| 3875 | - | |
| 3876 | - // Next, handle inline images:  | |
| 3877 | - | |
| 3878 | - // base64 encoded images | |
| 3879 | - text = text.replace(base64RegExp, writeImageTagBase64); | |
| 3880 | - | |
| 3881 | - // cases with crazy urls like ./image/cat1).png | |
| 3882 | - text = text.replace(crazyRegExp, writeImageTag); | |
| 3883 | - | |
| 3884 | - // normal cases | |
| 3885 | - text = text.replace(inlineRegExp, writeImageTag); | |
| 3886 | - | |
| 3887 | - // handle reference-style shortcuts: ![img text] | |
| 3888 | - text = text.replace(refShortcutRegExp, writeImageTag); | |
| 3889 | - | |
| 3890 | - text = globals.converter._dispatch('images.after', text, options, globals); | |
| 3891 | - return text; | |
| 3892 | -}); | |
| 3893 | - | |
| 3894 | -showdown.subParser('italicsAndBold', function (text, options, globals) { | |
| 3895 | - 'use strict'; | |
| 3896 | - | |
| 3897 | - text = globals.converter._dispatch('italicsAndBold.before', text, options, globals); | |
| 3898 | - | |
| 3899 | - // it's faster to have 3 separate regexes for each case than have just one | |
| 3900 | - // because of backtracing, in some cases, it could lead to an exponential effect | |
| 3901 | - // called "catastrophic backtrace". Ominous! | |
| 3902 | - | |
| 3903 | - function parseInside (txt, left, right) { | |
| 3904 | - /* | |
| 3905 | - if (options.simplifiedAutoLink) { | |
| 3906 | - txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals); | |
| 3907 | - } | |
| 3908 | - */ | |
| 3909 | - return left + txt + right; | |
| 3910 | - } | |
| 3911 | - | |
| 3912 | - // Parse underscores | |
| 3913 | - if (options.literalMidWordUnderscores) { | |
| 3914 | - text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) { | |
| 3915 | - return parseInside (txt, '<strong><em>', '</em></strong>'); | |
| 3916 | - }); | |
| 3917 | - text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) { | |
| 3918 | - return parseInside (txt, '<strong>', '</strong>'); | |
| 3919 | - }); | |
| 3920 | - text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) { | |
| 3921 | - return parseInside (txt, '<em>', '</em>'); | |
| 3922 | - }); | |
| 3923 | - } else { | |
| 3924 | - text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) { | |
| 3925 | - return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm; | |
| 3926 | - }); | |
| 3927 | - text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) { | |
| 3928 | - return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm; | |
| 3929 | - }); | |
| 3930 | - text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) { | |
| 3931 | - // !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it) | |
| 3932 | - return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm; | |
| 3933 | - }); | |
| 3934 | - } | |
| 3935 | - | |
| 3936 | - // Now parse asterisks | |
| 3937 | - if (options.literalMidWordAsterisks) { | |
| 3938 | - text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) { | |
| 3939 | - return parseInside (txt, lead + '<strong><em>', '</em></strong>'); | |
| 3940 | - }); | |
| 3941 | - text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) { | |
| 3942 | - return parseInside (txt, lead + '<strong>', '</strong>'); | |
| 3943 | - }); | |
| 3944 | - text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) { | |
| 3945 | - return parseInside (txt, lead + '<em>', '</em>'); | |
| 3946 | - }); | |
| 3947 | - } else { | |
| 3948 | - text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) { | |
| 3949 | - return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm; | |
| 3950 | - }); | |
| 3951 | - text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) { | |
| 3952 | - return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm; | |
| 3953 | - }); | |
| 3954 | - text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) { | |
| 3955 | - // !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it) | |
| 3956 | - return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm; | |
| 3957 | - }); | |
| 3958 | - } | |
| 3959 | - | |
| 3960 | - | |
| 3961 | - text = globals.converter._dispatch('italicsAndBold.after', text, options, globals); | |
| 3962 | - return text; | |
| 3963 | -}); | |
| 3964 | - | |
| 3965 | -/** | |
| 3966 | - * Form HTML ordered (numbered) and unordered (bulleted) lists. | |
| 3967 | - */ | |
| 3968 | -showdown.subParser('lists', function (text, options, globals) { | |
| 3969 | - 'use strict'; | |
| 3970 | - | |
| 3971 | - /** | |
| 3972 | - * Process the contents of a single ordered or unordered list, splitting it | |
| 3973 | - * into individual list items. | |
| 3974 | - * @param {string} listStr | |
| 3975 | - * @param {boolean} trimTrailing | |
| 3976 | - * @returns {string} | |
| 3977 | - */ | |
| 3978 | - function processListItems (listStr, trimTrailing) { | |
| 3979 | - // The $g_list_level global keeps track of when we're inside a list. | |
| 3980 | - // Each time we enter a list, we increment it; when we leave a list, | |
| 3981 | - // we decrement. If it's zero, we're not in a list anymore. | |
| 3982 | - // | |
| 3983 | - // We do this because when we're not inside a list, we want to treat | |
| 3984 | - // something like this: | |
| 3985 | - // | |
| 3986 | - // I recommend upgrading to version | |
| 3987 | - // 8. Oops, now this line is treated | |
| 3988 | - // as a sub-list. | |
| 3989 | - // | |
| 3990 | - // As a single paragraph, despite the fact that the second line starts | |
| 3991 | - // with a digit-period-space sequence. | |
| 3992 | - // | |
| 3993 | - // Whereas when we're inside a list (or sub-list), that line will be | |
| 3994 | - // treated as the start of a sub-list. What a kludge, huh? This is | |
| 3995 | - // an aspect of Markdown's syntax that's hard to parse perfectly | |
| 3996 | - // without resorting to mind-reading. Perhaps the solution is to | |
| 3997 | - // change the syntax rules such that sub-lists must start with a | |
| 3998 | - // starting cardinal number; e.g. "1." or "a.". | |
| 3999 | - globals.gListLevel++; | |
| 4000 | - | |
| 4001 | - // trim trailing blank lines: | |
| 4002 | - listStr = listStr.replace(/\n{2,}$/, '\n'); | |
| 4003 | - | |
| 4004 | - // attacklab: add sentinel to emulate \z | |
| 4005 | - listStr += '¨0'; | |
| 4006 | - | |
| 4007 | - var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, | |
| 4008 | - isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr)); | |
| 4009 | - | |
| 4010 | - // Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation, | |
| 4011 | - // which is a syntax breaking change | |
| 4012 | - // activating this option reverts to old behavior | |
| 4013 | - if (options.disableForced4SpacesIndentedSublists) { | |
| 4014 | - rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; | |
| 4015 | - } | |
| 4016 | - | |
| 4017 | - listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) { | |
| 4018 | - checked = (checked && checked.trim() !== ''); | |
| 4019 | - | |
| 4020 | - var item = showdown.subParser('outdent')(m4, options, globals), | |
| 4021 | - bulletStyle = ''; | |
| 4022 | - | |
| 4023 | - // Support for github tasklists | |
| 4024 | - if (taskbtn && options.tasklists) { | |
| 4025 | - bulletStyle = ' class="task-list-item" style="list-style-type: none;"'; | |
| 4026 | - item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () { | |
| 4027 | - var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"'; | |
| 4028 | - if (checked) { | |
| 4029 | - otp += ' checked'; | |
| 4030 | - } | |
| 4031 | - otp += '>'; | |
| 4032 | - return otp; | |
| 4033 | - }); | |
| 4034 | - } | |
| 4035 | - | |
| 4036 | - // ISSUE #312 | |
| 4037 | - // This input: - - - a | |
| 4038 | - // causes trouble to the parser, since it interprets it as: | |
| 4039 | - // <ul><li><li><li>a</li></li></li></ul> | |
| 4040 | - // instead of: | |
| 4041 | - // <ul><li>- - a</li></ul> | |
| 4042 | - // So, to prevent it, we will put a marker (¨A)in the beginning of the line | |
| 4043 | - // Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser | |
| 4044 | - item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) { | |
| 4045 | - return '¨A' + wm2; | |
| 4046 | - }); | |
| 4047 | - | |
| 4048 | - // m1 - Leading line or | |
| 4049 | - // Has a double return (multi paragraph) or | |
| 4050 | - // Has sublist | |
| 4051 | - if (m1 || (item.search(/\n{2,}/) > -1)) { | |
| 4052 | - item = showdown.subParser('githubCodeBlocks')(item, options, globals); | |
| 4053 | - item = showdown.subParser('blockGamut')(item, options, globals); | |
| 4054 | - } else { | |
| 4055 | - // Recursion for sub-lists: | |
| 4056 | - item = showdown.subParser('lists')(item, options, globals); | |
| 4057 | - item = item.replace(/\n$/, ''); // chomp(item) | |
| 4058 | - item = showdown.subParser('hashHTMLBlocks')(item, options, globals); | |
| 4059 | - | |
| 4060 | - // Colapse double linebreaks | |
| 4061 | - item = item.replace(/\n\n+/g, '\n\n'); | |
| 4062 | - if (isParagraphed) { | |
| 4063 | - item = showdown.subParser('paragraphs')(item, options, globals); | |
| 4064 | - } else { | |
| 4065 | - item = showdown.subParser('spanGamut')(item, options, globals); | |
| 4066 | - } | |
| 4067 | - } | |
| 4068 | - | |
| 4069 | - // now we need to remove the marker (¨A) | |
| 4070 | - item = item.replace('¨A', ''); | |
| 4071 | - // we can finally wrap the line in list item tags | |
| 4072 | - item = '<li' + bulletStyle + '>' + item + '</li>\n'; | |
| 4073 | - | |
| 4074 | - return item; | |
| 4075 | - }); | |
| 4076 | - | |
| 4077 | - // attacklab: strip sentinel | |
| 4078 | - listStr = listStr.replace(/¨0/g, ''); | |
| 4079 | - | |
| 4080 | - globals.gListLevel--; | |
| 4081 | - | |
| 4082 | - if (trimTrailing) { | |
| 4083 | - listStr = listStr.replace(/\s+$/, ''); | |
| 4084 | - } | |
| 4085 | - | |
| 4086 | - return listStr; | |
| 4087 | - } | |
| 4088 | - | |
| 4089 | - function styleStartNumber (list, listType) { | |
| 4090 | - // check if ol and starts by a number different than 1 | |
| 4091 | - if (listType === 'ol') { | |
| 4092 | - var res = list.match(/^ *(\d+)\./); | |
| 4093 | - if (res && res[1] !== '1') { | |
| 4094 | - return ' start="' + res[1] + '"'; | |
| 4095 | - } | |
| 4096 | - } | |
| 4097 | - return ''; | |
| 4098 | - } | |
| 4099 | - | |
| 4100 | - /** | |
| 4101 | - * Check and parse consecutive lists (better fix for issue #142) | |
| 4102 | - * @param {string} list | |
| 4103 | - * @param {string} listType | |
| 4104 | - * @param {boolean} trimTrailing | |
| 4105 | - * @returns {string} | |
| 4106 | - */ | |
| 4107 | - function parseConsecutiveLists (list, listType, trimTrailing) { | |
| 4108 | - // check if we caught 2 or more consecutive lists by mistake | |
| 4109 | - // we use the counterRgx, meaning if listType is UL we look for OL and vice versa | |
| 4110 | - var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, | |
| 4111 | - ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, | |
| 4112 | - counterRxg = (listType === 'ul') ? olRgx : ulRgx, | |
| 4113 | - result = ''; | |
| 4114 | - | |
| 4115 | - if (list.search(counterRxg) !== -1) { | |
| 4116 | - (function parseCL (txt) { | |
| 4117 | - var pos = txt.search(counterRxg), | |
| 4118 | - style = styleStartNumber(list, listType); | |
| 4119 | - if (pos !== -1) { | |
| 4120 | - // slice | |
| 4121 | - result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n'; | |
| 4122 | - | |
| 4123 | - // invert counterType and listType | |
| 4124 | - listType = (listType === 'ul') ? 'ol' : 'ul'; | |
| 4125 | - counterRxg = (listType === 'ul') ? olRgx : ulRgx; | |
| 4126 | - | |
| 4127 | - //recurse | |
| 4128 | - parseCL(txt.slice(pos)); | |
| 4129 | - } else { | |
| 4130 | - result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n'; | |
| 4131 | - } | |
| 4132 | - })(list); | |
| 4133 | - } else { | |
| 4134 | - var style = styleStartNumber(list, listType); | |
| 4135 | - result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n'; | |
| 4136 | - } | |
| 4137 | - | |
| 4138 | - return result; | |
| 4139 | - } | |
| 4140 | - | |
| 4141 | - /** Start of list parsing **/ | |
| 4142 | - text = globals.converter._dispatch('lists.before', text, options, globals); | |
| 4143 | - // add sentinel to hack around khtml/safari bug: | |
| 4144 | - // http://bugs.webkit.org/show_bug.cgi?id=11231 | |
| 4145 | - text += '¨0'; | |
| 4146 | - | |
| 4147 | - if (globals.gListLevel) { | |
| 4148 | - text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, | |
| 4149 | - function (wholeMatch, list, m2) { | |
| 4150 | - var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; | |
| 4151 | - return parseConsecutiveLists(list, listType, true); | |
| 4152 | - } | |
| 4153 | - ); | |
| 4154 | - } else { | |
| 4155 | - text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, | |
| 4156 | - function (wholeMatch, m1, list, m3) { | |
| 4157 | - var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol'; | |
| 4158 | - return parseConsecutiveLists(list, listType, false); | |
| 4159 | - } | |
| 4160 | - ); | |
| 4161 | - } | |
| 4162 | - | |
| 4163 | - // strip sentinel | |
| 4164 | - text = text.replace(/¨0/, ''); | |
| 4165 | - text = globals.converter._dispatch('lists.after', text, options, globals); | |
| 4166 | - return text; | |
| 4167 | -}); | |
| 4168 | - | |
| 4169 | -/** | |
| 4170 | - * Parse metadata at the top of the document | |
| 4171 | - */ | |
| 4172 | -showdown.subParser('metadata', function (text, options, globals) { | |
| 4173 | - 'use strict'; | |
| 4174 | - | |
| 4175 | - if (!options.metadata) { | |
| 4176 | - return text; | |
| 4177 | - } | |
| 4178 | - | |
| 4179 | - text = globals.converter._dispatch('metadata.before', text, options, globals); | |
| 4180 | - | |
| 4181 | - function parseMetadataContents (content) { | |
| 4182 | - // raw is raw so it's not changed in any way | |
| 4183 | - globals.metadata.raw = content; | |
| 4184 | - | |
| 4185 | - // escape chars forbidden in html attributes | |
| 4186 | - // double quotes | |
| 4187 | - content = content | |
| 4188 | - // ampersand first | |
| 4189 | - .replace(/&/g, '&') | |
| 4190 | - // double quotes | |
| 4191 | - .replace(/"/g, '"'); | |
| 4192 | - | |
| 4193 | - content = content.replace(/\n {4}/g, ' '); | |
| 4194 | - content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) { | |
| 4195 | - globals.metadata.parsed[key] = value; | |
| 4196 | - return ''; | |
| 4197 | - }); | |
| 4198 | - } | |
| 4199 | - | |
| 4200 | - text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) { | |
| 4201 | - parseMetadataContents(content); | |
| 4202 | - return '¨M'; | |
| 4203 | - }); | |
| 4204 | - | |
| 4205 | - text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) { | |
| 4206 | - if (format) { | |
| 4207 | - globals.metadata.format = format; | |
| 4208 | - } | |
| 4209 | - parseMetadataContents(content); | |
| 4210 | - return '¨M'; | |
| 4211 | - }); | |
| 4212 | - | |
| 4213 | - text = text.replace(/¨M/g, ''); | |
| 4214 | - | |
| 4215 | - text = globals.converter._dispatch('metadata.after', text, options, globals); | |
| 4216 | - return text; | |
| 4217 | -}); | |
| 4218 | - | |
| 4219 | -/** | |
| 4220 | - * Remove one level of line-leading tabs or spaces | |
| 4221 | - */ | |
| 4222 | -showdown.subParser('outdent', function (text, options, globals) { | |
| 4223 | - 'use strict'; | |
| 4224 | - text = globals.converter._dispatch('outdent.before', text, options, globals); | |
| 4225 | - | |
| 4226 | - // attacklab: hack around Konqueror 3.5.4 bug: | |
| 4227 | - // "----------bug".replace(/^-/g,"") == "bug" | |
| 4228 | - text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width | |
| 4229 | - | |
| 4230 | - // attacklab: clean up hack | |
| 4231 | - text = text.replace(/¨0/g, ''); | |
| 4232 | - | |
| 4233 | - text = globals.converter._dispatch('outdent.after', text, options, globals); | |
| 4234 | - return text; | |
| 4235 | -}); | |
| 4236 | - | |
| 4237 | -/** | |
| 4238 | - * | |
| 4239 | - */ | |
| 4240 | -showdown.subParser('paragraphs', function (text, options, globals) { | |
| 4241 | - 'use strict'; | |
| 4242 | - | |
| 4243 | - text = globals.converter._dispatch('paragraphs.before', text, options, globals); | |
| 4244 | - // Strip leading and trailing lines: | |
| 4245 | - text = text.replace(/^\n+/g, ''); | |
| 4246 | - text = text.replace(/\n+$/g, ''); | |
| 4247 | - | |
| 4248 | - var grafs = text.split(/\n{2,}/g), | |
| 4249 | - grafsOut = [], | |
| 4250 | - end = grafs.length; // Wrap <p> tags | |
| 4251 | - | |
| 4252 | - for (var i = 0; i < end; i++) { | |
| 4253 | - var str = grafs[i]; | |
| 4254 | - // if this is an HTML marker, copy it | |
| 4255 | - if (str.search(/¨(K|G)(\d+)\1/g) >= 0) { | |
| 4256 | - grafsOut.push(str); | |
| 4257 | - | |
| 4258 | - // test for presence of characters to prevent empty lines being parsed | |
| 4259 | - // as paragraphs (resulting in undesired extra empty paragraphs) | |
| 4260 | - } else if (str.search(/\S/) >= 0) { | |
| 4261 | - str = showdown.subParser('spanGamut')(str, options, globals); | |
| 4262 | - str = str.replace(/^([ \t]*)/g, '<p>'); | |
| 4263 | - str += '</p>'; | |
| 4264 | - grafsOut.push(str); | |
| 4265 | - } | |
| 4266 | - } | |
| 4267 | - | |
| 4268 | - /** Unhashify HTML blocks */ | |
| 4269 | - end = grafsOut.length; | |
| 4270 | - for (i = 0; i < end; i++) { | |
| 4271 | - var blockText = '', | |
| 4272 | - grafsOutIt = grafsOut[i], | |
| 4273 | - codeFlag = false; | |
| 4274 | - // if this is a marker for an html block... | |
| 4275 | - // use RegExp.test instead of string.search because of QML bug | |
| 4276 | - while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) { | |
| 4277 | - var delim = RegExp.$1, | |
| 4278 | - num = RegExp.$2; | |
| 4279 | - | |
| 4280 | - if (delim === 'K') { | |
| 4281 | - blockText = globals.gHtmlBlocks[num]; | |
| 4282 | - } else { | |
| 4283 | - // we need to check if ghBlock is a false positive | |
| 4284 | - if (codeFlag) { | |
| 4285 | - // use encoded version of all text | |
| 4286 | - blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text, options, globals); | |
| 4287 | - } else { | |
| 4288 | - blockText = globals.ghCodeBlocks[num].codeblock; | |
| 4289 | - } | |
| 4290 | - } | |
| 4291 | - blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs | |
| 4292 | - | |
| 4293 | - grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText); | |
| 4294 | - // Check if grafsOutIt is a pre->code | |
| 4295 | - if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) { | |
| 4296 | - codeFlag = true; | |
| 4297 | - } | |
| 4298 | - } | |
| 4299 | - grafsOut[i] = grafsOutIt; | |
| 4300 | - } | |
| 4301 | - text = grafsOut.join('\n'); | |
| 4302 | - // Strip leading and trailing lines: | |
| 4303 | - text = text.replace(/^\n+/g, ''); | |
| 4304 | - text = text.replace(/\n+$/g, ''); | |
| 4305 | - return globals.converter._dispatch('paragraphs.after', text, options, globals); | |
| 4306 | -}); | |
| 4307 | - | |
| 4308 | -/** | |
| 4309 | - * Run extension | |
| 4310 | - */ | |
| 4311 | -showdown.subParser('runExtension', function (ext, text, options, globals) { | |
| 4312 | - 'use strict'; | |
| 4313 | - | |
| 4314 | - if (ext.filter) { | |
| 4315 | - text = ext.filter(text, globals.converter, options); | |
| 4316 | - | |
| 4317 | - } else if (ext.regex) { | |
| 4318 | - // TODO remove this when old extension loading mechanism is deprecated | |
| 4319 | - var re = ext.regex; | |
| 4320 | - if (!(re instanceof RegExp)) { | |
| 4321 | - re = new RegExp(re, 'g'); | |
| 4322 | - } | |
| 4323 | - text = text.replace(re, ext.replace); | |
| 4324 | - } | |
| 4325 | - | |
| 4326 | - return text; | |
| 4327 | -}); | |
| 4328 | - | |
| 4329 | -/** | |
| 4330 | - * These are all the transformations that occur *within* block-level | |
| 4331 | - * tags like paragraphs, headers, and list items. | |
| 4332 | - */ | |
| 4333 | -showdown.subParser('spanGamut', function (text, options, globals) { | |
| 4334 | - 'use strict'; | |
| 4335 | - | |
| 4336 | - text = globals.converter._dispatch('spanGamut.before', text, options, globals); | |
| 4337 | - text = showdown.subParser('codeSpans')(text, options, globals); | |
| 4338 | - text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals); | |
| 4339 | - text = showdown.subParser('encodeBackslashEscapes')(text, options, globals); | |
| 4340 | - | |
| 4341 | - // Process anchor and image tags. Images must come first, | |
| 4342 | - // because ![foo][f] looks like an anchor. | |
| 4343 | - text = showdown.subParser('images')(text, options, globals); | |
| 4344 | - text = showdown.subParser('anchors')(text, options, globals); | |
| 4345 | - | |
| 4346 | - // Make links out of things like `<http://example.com/>` | |
| 4347 | - // Must come after anchors, because you can use < and > | |
| 4348 | - // delimiters in inline links like [this](<url>). | |
| 4349 | - text = showdown.subParser('autoLinks')(text, options, globals); | |
| 4350 | - text = showdown.subParser('simplifiedAutoLinks')(text, options, globals); | |
| 4351 | - text = showdown.subParser('emoji')(text, options, globals); | |
| 4352 | - text = showdown.subParser('underline')(text, options, globals); | |
| 4353 | - text = showdown.subParser('italicsAndBold')(text, options, globals); | |
| 4354 | - text = showdown.subParser('strikethrough')(text, options, globals); | |
| 4355 | - text = showdown.subParser('ellipsis')(text, options, globals); | |
| 4356 | - | |
| 4357 | - // we need to hash HTML tags inside spans | |
| 4358 | - text = showdown.subParser('hashHTMLSpans')(text, options, globals); | |
| 4359 | - | |
| 4360 | - // now we encode amps and angles | |
| 4361 | - text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals); | |
| 4362 | - | |
| 4363 | - // Do hard breaks | |
| 4364 | - if (options.simpleLineBreaks) { | |
| 4365 | - // GFM style hard breaks | |
| 4366 | - // only add line breaks if the text does not contain a block (special case for lists) | |
| 4367 | - if (!/\n\n¨K/.test(text)) { | |
| 4368 | - text = text.replace(/\n+/g, '<br />\n'); | |
| 4369 | - } | |
| 4370 | - } else { | |
| 4371 | - // Vanilla hard breaks | |
| 4372 | - text = text.replace(/ +\n/g, '<br />\n'); | |
| 4373 | - } | |
| 4374 | - | |
| 4375 | - text = globals.converter._dispatch('spanGamut.after', text, options, globals); | |
| 4376 | - return text; | |
| 4377 | -}); | |
| 4378 | - | |
| 4379 | -showdown.subParser('strikethrough', function (text, options, globals) { | |
| 4380 | - 'use strict'; | |
| 4381 | - | |
| 4382 | - function parseInside (txt) { | |
| 4383 | - if (options.simplifiedAutoLink) { | |
| 4384 | - txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals); | |
| 4385 | - } | |
| 4386 | - return '<del>' + txt + '</del>'; | |
| 4387 | - } | |
| 4388 | - | |
| 4389 | - if (options.strikethrough) { | |
| 4390 | - text = globals.converter._dispatch('strikethrough.before', text, options, globals); | |
| 4391 | - text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); }); | |
| 4392 | - text = globals.converter._dispatch('strikethrough.after', text, options, globals); | |
| 4393 | - } | |
| 4394 | - | |
| 4395 | - return text; | |
| 4396 | -}); | |
| 4397 | - | |
| 4398 | -/** | |
| 4399 | - * Strips link definitions from text, stores the URLs and titles in | |
| 4400 | - * hash references. | |
| 4401 | - * Link defs are in the form: ^[id]: url "optional title" | |
| 4402 | - */ | |
| 4403 | -showdown.subParser('stripLinkDefinitions', function (text, options, globals) { | |
| 4404 | - 'use strict'; | |
| 4405 | - | |
| 4406 | - 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, | |
| 4407 | - 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; | |
| 4408 | - | |
| 4409 | - // attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug | |
| 4410 | - text += '¨0'; | |
| 4411 | - | |
| 4412 | - var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) { | |
| 4413 | - linkId = linkId.toLowerCase(); | |
| 4414 | - if (url.match(/^data:.+?\/.+?;base64,/)) { | |
| 4415 | - // remove newlines | |
| 4416 | - globals.gUrls[linkId] = url.replace(/\s/g, ''); | |
| 4417 | - } else { | |
| 4418 | - globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url, options, globals); // Link IDs are case-insensitive | |
| 4419 | - } | |
| 4420 | - | |
| 4421 | - if (blankLines) { | |
| 4422 | - // Oops, found blank lines, so it's not a title. | |
| 4423 | - // Put back the parenthetical statement we stole. | |
| 4424 | - return blankLines + title; | |
| 4425 | - | |
| 4426 | - } else { | |
| 4427 | - if (title) { | |
| 4428 | - globals.gTitles[linkId] = title.replace(/"|'/g, '"'); | |
| 4429 | - } | |
| 4430 | - if (options.parseImgDimensions && width && height) { | |
| 4431 | - globals.gDimensions[linkId] = { | |
| 4432 | - width: width, | |
| 4433 | - height: height | |
| 4434 | - }; | |
| 4435 | - } | |
| 4436 | - } | |
| 4437 | - // Completely remove the definition from the text | |
| 4438 | - return ''; | |
| 4439 | - }; | |
| 4440 | - | |
| 4441 | - // first we try to find base64 link references | |
| 4442 | - text = text.replace(base64Regex, replaceFunc); | |
| 4443 | - | |
| 4444 | - text = text.replace(regex, replaceFunc); | |
| 4445 | - | |
| 4446 | - // attacklab: strip sentinel | |
| 4447 | - text = text.replace(/¨0/, ''); | |
| 4448 | - | |
| 4449 | - return text; | |
| 4450 | -}); | |
| 4451 | - | |
| 4452 | -showdown.subParser('tables', function (text, options, globals) { | |
| 4453 | - 'use strict'; | |
| 4454 | - | |
| 4455 | - if (!options.tables) { | |
| 4456 | - return text; | |
| 4457 | - } | |
| 4458 | - | |
| 4459 | - var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, | |
| 4460 | - //singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm; | |
| 4461 | - singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; | |
| 4462 | - | |
| 4463 | - function parseStyles (sLine) { | |
| 4464 | - if (/^:[ \t]*--*$/.test(sLine)) { | |
| 4465 | - return ' style="text-align:left;"'; | |
| 4466 | - } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) { | |
| 4467 | - return ' style="text-align:right;"'; | |
| 4468 | - } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) { | |
| 4469 | - return ' style="text-align:center;"'; | |
| 4470 | - } else { | |
| 4471 | - return ''; | |
| 4472 | - } | |
| 4473 | - } | |
| 4474 | - | |
| 4475 | - function parseHeaders (header, style) { | |
| 4476 | - var id = ''; | |
| 4477 | - header = header.trim(); | |
| 4478 | - // support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility | |
| 4479 | - if (options.tablesHeaderId || options.tableHeaderId) { | |
| 4480 | - id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"'; | |
| 4481 | - } | |
| 4482 | - header = showdown.subParser('spanGamut')(header, options, globals); | |
| 4483 | - | |
| 4484 | - return '<th' + id + style + '>' + header + '</th>\n'; | |
| 4485 | - } | |
| 4486 | - | |
| 4487 | - function parseCells (cell, style) { | |
| 4488 | - var subText = showdown.subParser('spanGamut')(cell, options, globals); | |
| 4489 | - return '<td' + style + '>' + subText + '</td>\n'; | |
| 4490 | - } | |
| 4491 | - | |
| 4492 | - function buildTable (headers, cells) { | |
| 4493 | - var tb = '<table>\n<thead>\n<tr>\n', | |
| 4494 | - tblLgn = headers.length; | |
| 4495 | - | |
| 4496 | - for (var i = 0; i < tblLgn; ++i) { | |
| 4497 | - tb += headers[i]; | |
| 4498 | - } | |
| 4499 | - tb += '</tr>\n</thead>\n<tbody>\n'; | |
| 4500 | - | |
| 4501 | - for (i = 0; i < cells.length; ++i) { | |
| 4502 | - tb += '<tr>\n'; | |
| 4503 | - for (var ii = 0; ii < tblLgn; ++ii) { | |
| 4504 | - tb += cells[i][ii]; | |
| 4505 | - } | |
| 4506 | - tb += '</tr>\n'; | |
| 4507 | - } | |
| 4508 | - tb += '</tbody>\n</table>\n'; | |
| 4509 | - return tb; | |
| 4510 | - } | |
| 4511 | - | |
| 4512 | - function parseTable (rawTable) { | |
| 4513 | - var i, tableLines = rawTable.split('\n'); | |
| 4514 | - | |
| 4515 | - for (i = 0; i < tableLines.length; ++i) { | |
| 4516 | - // strip wrong first and last column if wrapped tables are used | |
| 4517 | - if (/^ {0,3}\|/.test(tableLines[i])) { | |
| 4518 | - tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, ''); | |
| 4519 | - } | |
| 4520 | - if (/\|[ \t]*$/.test(tableLines[i])) { | |
| 4521 | - tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, ''); | |
| 4522 | - } | |
| 4523 | - // parse code spans first, but we only support one line code spans | |
| 4524 | - tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals); | |
| 4525 | - } | |
| 4526 | - | |
| 4527 | - var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}), | |
| 4528 | - rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}), | |
| 4529 | - rawCells = [], | |
| 4530 | - headers = [], | |
| 4531 | - styles = [], | |
| 4532 | - cells = []; | |
| 4533 | - | |
| 4534 | - tableLines.shift(); | |
| 4535 | - tableLines.shift(); | |
| 4536 | - | |
| 4537 | - for (i = 0; i < tableLines.length; ++i) { | |
| 4538 | - if (tableLines[i].trim() === '') { | |
| 4539 | - continue; | |
| 4540 | - } | |
| 4541 | - rawCells.push( | |
| 4542 | - tableLines[i] | |
| 4543 | - .split('|') | |
| 4544 | - .map(function (s) { | |
| 4545 | - return s.trim(); | |
| 4546 | - }) | |
| 4547 | - ); | |
| 4548 | - } | |
| 4549 | - | |
| 4550 | - if (rawHeaders.length < rawStyles.length) { | |
| 4551 | - return rawTable; | |
| 4552 | - } | |
| 4553 | - | |
| 4554 | - for (i = 0; i < rawStyles.length; ++i) { | |
| 4555 | - styles.push(parseStyles(rawStyles[i])); | |
| 4556 | - } | |
| 4557 | - | |
| 4558 | - for (i = 0; i < rawHeaders.length; ++i) { | |
| 4559 | - if (showdown.helper.isUndefined(styles[i])) { | |
| 4560 | - styles[i] = ''; | |
| 4561 | - } | |
| 4562 | - headers.push(parseHeaders(rawHeaders[i], styles[i])); | |
| 4563 | - } | |
| 4564 | - | |
| 4565 | - for (i = 0; i < rawCells.length; ++i) { | |
| 4566 | - var row = []; | |
| 4567 | - for (var ii = 0; ii < headers.length; ++ii) { | |
| 4568 | - if (showdown.helper.isUndefined(rawCells[i][ii])) { | |
| 4569 | - | |
| 4570 | - } | |
| 4571 | - row.push(parseCells(rawCells[i][ii], styles[ii])); | |
| 4572 | - } | |
| 4573 | - cells.push(row); | |
| 4574 | - } | |
| 4575 | - | |
| 4576 | - return buildTable(headers, cells); | |
| 4577 | - } | |
| 4578 | - | |
| 4579 | - text = globals.converter._dispatch('tables.before', text, options, globals); | |
| 4580 | - | |
| 4581 | - // find escaped pipe characters | |
| 4582 | - text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback); | |
| 4583 | - | |
| 4584 | - // parse multi column tables | |
| 4585 | - text = text.replace(tableRgx, parseTable); | |
| 4586 | - | |
| 4587 | - // parse one column tables | |
| 4588 | - text = text.replace(singeColTblRgx, parseTable); | |
| 4589 | - | |
| 4590 | - text = globals.converter._dispatch('tables.after', text, options, globals); | |
| 4591 | - | |
| 4592 | - return text; | |
| 4593 | -}); | |
| 4594 | - | |
| 4595 | -showdown.subParser('underline', function (text, options, globals) { | |
| 4596 | - 'use strict'; | |
| 4597 | - | |
| 4598 | - if (!options.underline) { | |
| 4599 | - return text; | |
| 4600 | - } | |
| 4601 | - | |
| 4602 | - text = globals.converter._dispatch('underline.before', text, options, globals); | |
| 4603 | - | |
| 4604 | - if (options.literalMidWordUnderscores) { | |
| 4605 | - text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) { | |
| 4606 | - return '<u>' + txt + '</u>'; | |
| 4607 | - }); | |
| 4608 | - text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) { | |
| 4609 | - return '<u>' + txt + '</u>'; | |
| 4610 | - }); | |
| 4611 | - } else { | |
| 4612 | - text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) { | |
| 4613 | - return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm; | |
| 4614 | - }); | |
| 4615 | - text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) { | |
| 4616 | - return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm; | |
| 4617 | - }); | |
| 4618 | - } | |
| 4619 | - | |
| 4620 | - // escape remaining underscores to prevent them being parsed by italic and bold | |
| 4621 | - text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback); | |
| 4622 | - | |
| 4623 | - text = globals.converter._dispatch('underline.after', text, options, globals); | |
| 4624 | - | |
| 4625 | - return text; | |
| 4626 | -}); | |
| 4627 | - | |
| 4628 | -/** | |
| 4629 | - * Swap back in all the special characters we've hidden. | |
| 4630 | - */ | |
| 4631 | -showdown.subParser('unescapeSpecialChars', function (text, options, globals) { | |
| 4632 | - 'use strict'; | |
| 4633 | - text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals); | |
| 4634 | - | |
| 4635 | - text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) { | |
| 4636 | - var charCodeToReplace = parseInt(m1); | |
| 4637 | - return String.fromCharCode(charCodeToReplace); | |
| 4638 | - }); | |
| 4639 | - | |
| 4640 | - text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals); | |
| 4641 | - return text; | |
| 4642 | -}); | |
| 4643 | - | |
| 4644 | -showdown.subParser('makeMarkdown.blockquote', function (node, globals) { | |
| 4645 | - 'use strict'; | |
| 4646 | - | |
| 4647 | - var txt = ''; | |
| 4648 | - if (node.hasChildNodes()) { | |
| 4649 | - var children = node.childNodes, | |
| 4650 | - childrenLength = children.length; | |
| 4651 | - | |
| 4652 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4653 | - var innerTxt = showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4654 | - | |
| 4655 | - if (innerTxt === '') { | |
| 4656 | - continue; | |
| 4657 | - } | |
| 4658 | - txt += innerTxt; | |
| 4659 | - } | |
| 4660 | - } | |
| 4661 | - // cleanup | |
| 4662 | - txt = txt.trim(); | |
| 4663 | - txt = '> ' + txt.split('\n').join('\n> '); | |
| 4664 | - return txt; | |
| 4665 | -}); | |
| 4666 | - | |
| 4667 | -showdown.subParser('makeMarkdown.codeBlock', function (node, globals) { | |
| 4668 | - 'use strict'; | |
| 4669 | - | |
| 4670 | - var lang = node.getAttribute('language'), | |
| 4671 | - num = node.getAttribute('precodenum'); | |
| 4672 | - return '```' + lang + '\n' + globals.preList[num] + '\n```'; | |
| 4673 | -}); | |
| 4674 | - | |
| 4675 | -showdown.subParser('makeMarkdown.codeSpan', function (node) { | |
| 4676 | - 'use strict'; | |
| 4677 | - | |
| 4678 | - return '`' + node.innerHTML + '`'; | |
| 4679 | -}); | |
| 4680 | - | |
| 4681 | -showdown.subParser('makeMarkdown.emphasis', function (node, globals) { | |
| 4682 | - 'use strict'; | |
| 4683 | - | |
| 4684 | - var txt = ''; | |
| 4685 | - if (node.hasChildNodes()) { | |
| 4686 | - txt += '*'; | |
| 4687 | - var children = node.childNodes, | |
| 4688 | - childrenLength = children.length; | |
| 4689 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4690 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4691 | - } | |
| 4692 | - txt += '*'; | |
| 4693 | - } | |
| 4694 | - return txt; | |
| 4695 | -}); | |
| 4696 | - | |
| 4697 | -showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) { | |
| 4698 | - 'use strict'; | |
| 4699 | - | |
| 4700 | - var headerMark = new Array(headerLevel + 1).join('#'), | |
| 4701 | - txt = ''; | |
| 4702 | - | |
| 4703 | - if (node.hasChildNodes()) { | |
| 4704 | - txt = headerMark + ' '; | |
| 4705 | - var children = node.childNodes, | |
| 4706 | - childrenLength = children.length; | |
| 4707 | - | |
| 4708 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4709 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4710 | - } | |
| 4711 | - } | |
| 4712 | - return txt; | |
| 4713 | -}); | |
| 4714 | - | |
| 4715 | -showdown.subParser('makeMarkdown.hr', function () { | |
| 4716 | - 'use strict'; | |
| 4717 | - | |
| 4718 | - return '---'; | |
| 4719 | -}); | |
| 4720 | - | |
| 4721 | -showdown.subParser('makeMarkdown.image', function (node) { | |
| 4722 | - 'use strict'; | |
| 4723 | - | |
| 4724 | - var txt = ''; | |
| 4725 | - if (node.hasAttribute('src')) { | |
| 4726 | - txt += ' + '>'; | |
| 4728 | - if (node.hasAttribute('width') && node.hasAttribute('height')) { | |
| 4729 | - txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height'); | |
| 4730 | - } | |
| 4731 | - | |
| 4732 | - if (node.hasAttribute('title')) { | |
| 4733 | - txt += ' "' + node.getAttribute('title') + '"'; | |
| 4734 | - } | |
| 4735 | - txt += ')'; | |
| 4736 | - } | |
| 4737 | - return txt; | |
| 4738 | -}); | |
| 4739 | - | |
| 4740 | -showdown.subParser('makeMarkdown.links', function (node, globals) { | |
| 4741 | - 'use strict'; | |
| 4742 | - | |
| 4743 | - var txt = ''; | |
| 4744 | - if (node.hasChildNodes() && node.hasAttribute('href')) { | |
| 4745 | - var children = node.childNodes, | |
| 4746 | - childrenLength = children.length; | |
| 4747 | - txt = '['; | |
| 4748 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4749 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4750 | - } | |
| 4751 | - txt += ']('; | |
| 4752 | - txt += '<' + node.getAttribute('href') + '>'; | |
| 4753 | - if (node.hasAttribute('title')) { | |
| 4754 | - txt += ' "' + node.getAttribute('title') + '"'; | |
| 4755 | - } | |
| 4756 | - txt += ')'; | |
| 4757 | - } | |
| 4758 | - return txt; | |
| 4759 | -}); | |
| 4760 | - | |
| 4761 | -showdown.subParser('makeMarkdown.list', function (node, globals, type) { | |
| 4762 | - 'use strict'; | |
| 4763 | - | |
| 4764 | - var txt = ''; | |
| 4765 | - if (!node.hasChildNodes()) { | |
| 4766 | - return ''; | |
| 4767 | - } | |
| 4768 | - var listItems = node.childNodes, | |
| 4769 | - listItemsLenght = listItems.length, | |
| 4770 | - listNum = node.getAttribute('start') || 1; | |
| 4771 | - | |
| 4772 | - for (var i = 0; i < listItemsLenght; ++i) { | |
| 4773 | - if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') { | |
| 4774 | - continue; | |
| 4775 | - } | |
| 4776 | - | |
| 4777 | - // define the bullet to use in list | |
| 4778 | - var bullet = ''; | |
| 4779 | - if (type === 'ol') { | |
| 4780 | - bullet = listNum.toString() + '. '; | |
| 4781 | - } else { | |
| 4782 | - bullet = '- '; | |
| 4783 | - } | |
| 4784 | - | |
| 4785 | - // parse list item | |
| 4786 | - txt += bullet + showdown.subParser('makeMarkdown.listItem')(listItems[i], globals); | |
| 4787 | - ++listNum; | |
| 4788 | - } | |
| 4789 | - | |
| 4790 | - // add comment at the end to prevent consecutive lists to be parsed as one | |
| 4791 | - txt += '\n<!-- -->\n'; | |
| 4792 | - return txt.trim(); | |
| 4793 | -}); | |
| 4794 | - | |
| 4795 | -showdown.subParser('makeMarkdown.listItem', function (node, globals) { | |
| 4796 | - 'use strict'; | |
| 4797 | - | |
| 4798 | - var listItemTxt = ''; | |
| 4799 | - | |
| 4800 | - var children = node.childNodes, | |
| 4801 | - childrenLenght = children.length; | |
| 4802 | - | |
| 4803 | - for (var i = 0; i < childrenLenght; ++i) { | |
| 4804 | - listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4805 | - } | |
| 4806 | - // if it's only one liner, we need to add a newline at the end | |
| 4807 | - if (!/\n$/.test(listItemTxt)) { | |
| 4808 | - listItemTxt += '\n'; | |
| 4809 | - } else { | |
| 4810 | - // it's multiparagraph, so we need to indent | |
| 4811 | - listItemTxt = listItemTxt | |
| 4812 | - .split('\n') | |
| 4813 | - .join('\n ') | |
| 4814 | - .replace(/^ {4}$/gm, '') | |
| 4815 | - .replace(/\n\n+/g, '\n\n'); | |
| 4816 | - } | |
| 4817 | - | |
| 4818 | - return listItemTxt; | |
| 4819 | -}); | |
| 4820 | - | |
| 4821 | - | |
| 4822 | - | |
| 4823 | -showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) { | |
| 4824 | - 'use strict'; | |
| 4825 | - | |
| 4826 | - spansOnly = spansOnly || false; | |
| 4827 | - | |
| 4828 | - var txt = ''; | |
| 4829 | - | |
| 4830 | - // edge case of text without wrapper paragraph | |
| 4831 | - if (node.nodeType === 3) { | |
| 4832 | - return showdown.subParser('makeMarkdown.txt')(node, globals); | |
| 4833 | - } | |
| 4834 | - | |
| 4835 | - // HTML comment | |
| 4836 | - if (node.nodeType === 8) { | |
| 4837 | - return '<!--' + node.data + '-->\n\n'; | |
| 4838 | - } | |
| 4839 | - | |
| 4840 | - // process only node elements | |
| 4841 | - if (node.nodeType !== 1) { | |
| 4842 | - return ''; | |
| 4843 | - } | |
| 4844 | - | |
| 4845 | - var tagName = node.tagName.toLowerCase(); | |
| 4846 | - | |
| 4847 | - switch (tagName) { | |
| 4848 | - | |
| 4849 | - // | |
| 4850 | - // BLOCKS | |
| 4851 | - // | |
| 4852 | - case 'h1': | |
| 4853 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 1) + '\n\n'; } | |
| 4854 | - break; | |
| 4855 | - case 'h2': | |
| 4856 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 2) + '\n\n'; } | |
| 4857 | - break; | |
| 4858 | - case 'h3': | |
| 4859 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 3) + '\n\n'; } | |
| 4860 | - break; | |
| 4861 | - case 'h4': | |
| 4862 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 4) + '\n\n'; } | |
| 4863 | - break; | |
| 4864 | - case 'h5': | |
| 4865 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 5) + '\n\n'; } | |
| 4866 | - break; | |
| 4867 | - case 'h6': | |
| 4868 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 6) + '\n\n'; } | |
| 4869 | - break; | |
| 4870 | - | |
| 4871 | - case 'p': | |
| 4872 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.paragraph')(node, globals) + '\n\n'; } | |
| 4873 | - break; | |
| 4874 | - | |
| 4875 | - case 'blockquote': | |
| 4876 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.blockquote')(node, globals) + '\n\n'; } | |
| 4877 | - break; | |
| 4878 | - | |
| 4879 | - case 'hr': | |
| 4880 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.hr')(node, globals) + '\n\n'; } | |
| 4881 | - break; | |
| 4882 | - | |
| 4883 | - case 'ol': | |
| 4884 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ol') + '\n\n'; } | |
| 4885 | - break; | |
| 4886 | - | |
| 4887 | - case 'ul': | |
| 4888 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ul') + '\n\n'; } | |
| 4889 | - break; | |
| 4890 | - | |
| 4891 | - case 'precode': | |
| 4892 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.codeBlock')(node, globals) + '\n\n'; } | |
| 4893 | - break; | |
| 4894 | - | |
| 4895 | - case 'pre': | |
| 4896 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.pre')(node, globals) + '\n\n'; } | |
| 4897 | - break; | |
| 4898 | - | |
| 4899 | - case 'table': | |
| 4900 | - if (!spansOnly) { txt = showdown.subParser('makeMarkdown.table')(node, globals) + '\n\n'; } | |
| 4901 | - break; | |
| 4902 | - | |
| 4903 | - // | |
| 4904 | - // SPANS | |
| 4905 | - // | |
| 4906 | - case 'code': | |
| 4907 | - txt = showdown.subParser('makeMarkdown.codeSpan')(node, globals); | |
| 4908 | - break; | |
| 4909 | - | |
| 4910 | - case 'em': | |
| 4911 | - case 'i': | |
| 4912 | - txt = showdown.subParser('makeMarkdown.emphasis')(node, globals); | |
| 4913 | - break; | |
| 4914 | - | |
| 4915 | - case 'strong': | |
| 4916 | - case 'b': | |
| 4917 | - txt = showdown.subParser('makeMarkdown.strong')(node, globals); | |
| 4918 | - break; | |
| 4919 | - | |
| 4920 | - case 'del': | |
| 4921 | - txt = showdown.subParser('makeMarkdown.strikethrough')(node, globals); | |
| 4922 | - break; | |
| 4923 | - | |
| 4924 | - case 'a': | |
| 4925 | - txt = showdown.subParser('makeMarkdown.links')(node, globals); | |
| 4926 | - break; | |
| 4927 | - | |
| 4928 | - case 'img': | |
| 4929 | - txt = showdown.subParser('makeMarkdown.image')(node, globals); | |
| 4930 | - break; | |
| 4931 | - | |
| 4932 | - default: | |
| 4933 | - txt = node.outerHTML + '\n\n'; | |
| 4934 | - } | |
| 4935 | - | |
| 4936 | - // common normalization | |
| 4937 | - // TODO eventually | |
| 4938 | - | |
| 4939 | - return txt; | |
| 4940 | -}); | |
| 4941 | - | |
| 4942 | -showdown.subParser('makeMarkdown.paragraph', function (node, globals) { | |
| 4943 | - 'use strict'; | |
| 4944 | - | |
| 4945 | - var txt = ''; | |
| 4946 | - if (node.hasChildNodes()) { | |
| 4947 | - var children = node.childNodes, | |
| 4948 | - childrenLength = children.length; | |
| 4949 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4950 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4951 | - } | |
| 4952 | - } | |
| 4953 | - | |
| 4954 | - // some text normalization | |
| 4955 | - txt = txt.trim(); | |
| 4956 | - | |
| 4957 | - return txt; | |
| 4958 | -}); | |
| 4959 | - | |
| 4960 | -showdown.subParser('makeMarkdown.pre', function (node, globals) { | |
| 4961 | - 'use strict'; | |
| 4962 | - | |
| 4963 | - var num = node.getAttribute('prenum'); | |
| 4964 | - return '<pre>' + globals.preList[num] + '</pre>'; | |
| 4965 | -}); | |
| 4966 | - | |
| 4967 | -showdown.subParser('makeMarkdown.strikethrough', function (node, globals) { | |
| 4968 | - 'use strict'; | |
| 4969 | - | |
| 4970 | - var txt = ''; | |
| 4971 | - if (node.hasChildNodes()) { | |
| 4972 | - txt += '~~'; | |
| 4973 | - var children = node.childNodes, | |
| 4974 | - childrenLength = children.length; | |
| 4975 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4976 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4977 | - } | |
| 4978 | - txt += '~~'; | |
| 4979 | - } | |
| 4980 | - return txt; | |
| 4981 | -}); | |
| 4982 | - | |
| 4983 | -showdown.subParser('makeMarkdown.strong', function (node, globals) { | |
| 4984 | - 'use strict'; | |
| 4985 | - | |
| 4986 | - var txt = ''; | |
| 4987 | - if (node.hasChildNodes()) { | |
| 4988 | - txt += '**'; | |
| 4989 | - var children = node.childNodes, | |
| 4990 | - childrenLength = children.length; | |
| 4991 | - for (var i = 0; i < childrenLength; ++i) { | |
| 4992 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals); | |
| 4993 | - } | |
| 4994 | - txt += '**'; | |
| 4995 | - } | |
| 4996 | - return txt; | |
| 4997 | -}); | |
| 4998 | - | |
| 4999 | -showdown.subParser('makeMarkdown.table', function (node, globals) { | |
| 5000 | - 'use strict'; | |
| 5001 | - | |
| 5002 | - var txt = '', | |
| 5003 | - tableArray = [[], []], | |
| 5004 | - headings = node.querySelectorAll('thead>tr>th'), | |
| 5005 | - rows = node.querySelectorAll('tbody>tr'), | |
| 5006 | - i, ii; | |
| 5007 | - for (i = 0; i < headings.length; ++i) { | |
| 5008 | - var headContent = showdown.subParser('makeMarkdown.tableCell')(headings[i], globals), | |
| 5009 | - allign = '---'; | |
| 5010 | - | |
| 5011 | - if (headings[i].hasAttribute('style')) { | |
| 5012 | - var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, ''); | |
| 5013 | - switch (style) { | |
| 5014 | - case 'text-align:left;': | |
| 5015 | - allign = ':---'; | |
| 5016 | - break; | |
| 5017 | - case 'text-align:right;': | |
| 5018 | - allign = '---:'; | |
| 5019 | - break; | |
| 5020 | - case 'text-align:center;': | |
| 5021 | - allign = ':---:'; | |
| 5022 | - break; | |
| 5023 | - } | |
| 5024 | - } | |
| 5025 | - tableArray[0][i] = headContent.trim(); | |
| 5026 | - tableArray[1][i] = allign; | |
| 5027 | - } | |
| 5028 | - | |
| 5029 | - for (i = 0; i < rows.length; ++i) { | |
| 5030 | - var r = tableArray.push([]) - 1, | |
| 5031 | - cols = rows[i].getElementsByTagName('td'); | |
| 5032 | - | |
| 5033 | - for (ii = 0; ii < headings.length; ++ii) { | |
| 5034 | - var cellContent = ' '; | |
| 5035 | - if (typeof cols[ii] !== 'undefined') { | |
| 5036 | - cellContent = showdown.subParser('makeMarkdown.tableCell')(cols[ii], globals); | |
| 5037 | - } | |
| 5038 | - tableArray[r].push(cellContent); | |
| 5039 | - } | |
| 5040 | - } | |
| 5041 | - | |
| 5042 | - var cellSpacesCount = 3; | |
| 5043 | - for (i = 0; i < tableArray.length; ++i) { | |
| 5044 | - for (ii = 0; ii < tableArray[i].length; ++ii) { | |
| 5045 | - var strLen = tableArray[i][ii].length; | |
| 5046 | - if (strLen > cellSpacesCount) { | |
| 5047 | - cellSpacesCount = strLen; | |
| 5048 | - } | |
| 5049 | - } | |
| 5050 | - } | |
| 5051 | - | |
| 5052 | - for (i = 0; i < tableArray.length; ++i) { | |
| 5053 | - for (ii = 0; ii < tableArray[i].length; ++ii) { | |
| 5054 | - if (i === 1) { | |
| 5055 | - if (tableArray[i][ii].slice(-1) === ':') { | |
| 5056 | - tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':'; | |
| 5057 | - } else { | |
| 5058 | - tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-'); | |
| 5059 | - } | |
| 5060 | - } else { | |
| 5061 | - tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount); | |
| 5062 | - } | |
| 5063 | - } | |
| 5064 | - txt += '| ' + tableArray[i].join(' | ') + ' |\n'; | |
| 5065 | - } | |
| 5066 | - | |
| 5067 | - return txt.trim(); | |
| 5068 | -}); | |
| 5069 | - | |
| 5070 | -showdown.subParser('makeMarkdown.tableCell', function (node, globals) { | |
| 5071 | - 'use strict'; | |
| 5072 | - | |
| 5073 | - var txt = ''; | |
| 5074 | - if (!node.hasChildNodes()) { | |
| 5075 | - return ''; | |
| 5076 | - } | |
| 5077 | - var children = node.childNodes, | |
| 5078 | - childrenLength = children.length; | |
| 5079 | - | |
| 5080 | - for (var i = 0; i < childrenLength; ++i) { | |
| 5081 | - txt += showdown.subParser('makeMarkdown.node')(children[i], globals, true); | |
| 5082 | - } | |
| 5083 | - return txt.trim(); | |
| 5084 | -}); | |
| 5085 | - | |
| 5086 | -showdown.subParser('makeMarkdown.txt', function (node) { | |
| 5087 | - 'use strict'; | |
| 5088 | - | |
| 5089 | - var txt = node.nodeValue; | |
| 5090 | - | |
| 5091 | - // multiple spaces are collapsed | |
| 5092 | - txt = txt.replace(/ +/g, ' '); | |
| 5093 | - | |
| 5094 | - // replace the custom ¨NBSP; with a space | |
| 5095 | - txt = txt.replace(/¨NBSP;/g, ' '); | |
| 5096 | - | |
| 5097 | - // ", <, > and & should replace escaped html entities | |
| 5098 | - txt = showdown.helper.unescapeHTMLEntities(txt); | |
| 5099 | - | |
| 5100 | - // escape markdown magic characters | |
| 5101 | - // emphasis, strong and strikethrough - can appear everywhere | |
| 5102 | - // we also escape pipe (|) because of tables | |
| 5103 | - // and escape ` because of code blocks and spans | |
| 5104 | - txt = txt.replace(/([*_~|`])/g, '\\$1'); | |
| 5105 | - | |
| 5106 | - // escape > because of blockquotes | |
| 5107 | - txt = txt.replace(/^(\s*)>/g, '\\$1>'); | |
| 5108 | - | |
| 5109 | - // hash character, only troublesome at the beginning of a line because of headers | |
| 5110 | - txt = txt.replace(/^#/gm, '\\#'); | |
| 5111 | - | |
| 5112 | - // horizontal rules | |
| 5113 | - txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3'); | |
| 5114 | - | |
| 5115 | - // dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer | |
| 5116 | - txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.'); | |
| 5117 | - | |
| 5118 | - // +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped) | |
| 5119 | - txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2'); | |
| 5120 | - | |
| 5121 | - // images and links, ] followed by ( is problematic, so we escape it | |
| 5122 | - txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\('); | |
| 5123 | - | |
| 5124 | - // reference URIs must also be escaped | |
| 5125 | - txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:'); | |
| 5126 | - | |
| 5127 | - return txt; | |
| 5128 | -}); | |
| 5129 | - | |
| 5130 | -var root = this; | |
| 5131 | - | |
| 5132 | -// AMD Loader | |
| 5133 | -if (true) { | |
| 5134 | - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { | |
| 5135 | - 'use strict'; | |
| 5136 | - return showdown; | |
| 5137 | - }).call(exports, __webpack_require__, exports, module), | |
| 5138 | - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
| 5139 | - | |
| 5140 | -// CommonJS/nodeJS Loader | |
| 5141 | -} else {} | |
| 5142 | -}).call(this); | |
| 5143 | - | |
| 5144 | -//# sourceMappingURL=showdown.js.map | |
| 5145 | - | |
| 5146 | - | |
| 5147 | -/***/ }) | |
| 5148 | - | |
| 5149 | -/******/ }); | |
| 5150 | -/************************************************************************/ | |
| 5151 | -/******/ // The module cache | |
| 5152 | -/******/ var __webpack_module_cache__ = {}; | |
| 5153 | -/******/ | |
| 5154 | -/******/ // The require function | |
| 5155 | -/******/ function __webpack_require__(moduleId) { | |
| 5156 | -/******/ // Check if module is in cache | |
| 5157 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 5158 | -/******/ if (cachedModule !== undefined) { | |
| 5159 | -/******/ return cachedModule.exports; | |
| 5160 | -/******/ } | |
| 5161 | -/******/ // Create a new module (and put it into the cache) | |
| 5162 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 5163 | -/******/ // no module.id needed | |
| 5164 | -/******/ // no module.loaded needed | |
| 5165 | -/******/ exports: {} | |
| 5166 | -/******/ }; | |
| 5167 | -/******/ | |
| 5168 | -/******/ // Execute the module function | |
| 5169 | -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
| 5170 | -/******/ | |
| 5171 | -/******/ // Return the exports of the module | |
| 5172 | -/******/ return module.exports; | |
| 5173 | -/******/ } | |
| 5174 | -/******/ | |
| 5175 | -/************************************************************************/ | |
| 5176 | -/******/ /* webpack/runtime/compat get default export */ | |
| 5177 | -/******/ !function() { | |
| 5178 | -/******/ // getDefaultExport function for compatibility with non-harmony modules | |
| 5179 | -/******/ __webpack_require__.n = function(module) { | |
| 5180 | -/******/ var getter = module && module.__esModule ? | |
| 5181 | -/******/ function() { return module['default']; } : | |
| 5182 | -/******/ function() { return module; }; | |
| 5183 | -/******/ __webpack_require__.d(getter, { a: getter }); | |
| 5184 | -/******/ return getter; | |
| 5185 | -/******/ }; | |
| 5186 | -/******/ }(); | |
| 5187 | -/******/ | |
| 5188 | -/******/ /* webpack/runtime/define property getters */ | |
| 5189 | -/******/ !function() { | |
| 5190 | -/******/ // define getter functions for harmony exports | |
| 5191 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 5192 | -/******/ for(var key in definition) { | |
| 5193 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 5194 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 5195 | -/******/ } | |
| 5196 | -/******/ } | |
| 5197 | -/******/ }; | |
| 5198 | -/******/ }(); | |
| 5199 | -/******/ | |
| 5200 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 5201 | -/******/ !function() { | |
| 5202 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 5203 | -/******/ }(); | |
| 5204 | -/******/ | |
| 5205 | -/******/ /* webpack/runtime/make namespace object */ | |
| 5206 | -/******/ !function() { | |
| 5207 | -/******/ // define __esModule on exports | |
| 5208 | -/******/ __webpack_require__.r = function(exports) { | |
| 5209 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 5210 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 5211 | -/******/ } | |
| 5212 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 5213 | -/******/ }; | |
| 5214 | -/******/ }(); | |
| 5215 | -/******/ | |
| 5216 | -/************************************************************************/ | |
| 5217 | -var __webpack_exports__ = {}; | |
| 5218 | -// This entry need to be wrapped in an IIFE because it need to be in strict mode. | |
| 5219 | -!function() { | |
| 5220 | -"use strict"; | |
| 5221 | -// ESM COMPAT FLAG | |
| 5222 | -__webpack_require__.r(__webpack_exports__); | |
| 5223 | - | |
| 5224 | -// EXPORTS | |
| 5225 | -__webpack_require__.d(__webpack_exports__, { | |
| 5226 | - "__EXPERIMENTAL_ELEMENTS": function() { return /* reexport */ __EXPERIMENTAL_ELEMENTS; }, | |
| 5227 | - "__EXPERIMENTAL_PATHS_WITH_MERGE": function() { return /* reexport */ __EXPERIMENTAL_PATHS_WITH_MERGE; }, | |
| 5228 | - "__EXPERIMENTAL_STYLE_PROPERTY": function() { return /* reexport */ __EXPERIMENTAL_STYLE_PROPERTY; }, | |
| 5229 | - "__experimentalCloneSanitizedBlock": function() { return /* reexport */ __experimentalCloneSanitizedBlock; }, | |
| 5230 | - "__experimentalGetAccessibleBlockLabel": function() { return /* reexport */ getAccessibleBlockLabel; }, | |
| 5231 | - "__experimentalGetBlockAttributesNamesByRole": function() { return /* reexport */ __experimentalGetBlockAttributesNamesByRole; }, | |
| 5232 | - "__experimentalGetBlockLabel": function() { return /* reexport */ getBlockLabel; }, | |
| 5233 | - "__experimentalSanitizeBlockAttributes": function() { return /* reexport */ __experimentalSanitizeBlockAttributes; }, | |
| 5234 | - "__unstableGetBlockProps": function() { return /* reexport */ getBlockProps; }, | |
| 5235 | - "__unstableGetInnerBlocksProps": function() { return /* reexport */ getInnerBlocksProps; }, | |
| 5236 | - "__unstableSerializeAndClean": function() { return /* reexport */ __unstableSerializeAndClean; }, | |
| 5237 | - "children": function() { return /* reexport */ children; }, | |
| 5238 | - "cloneBlock": function() { return /* reexport */ cloneBlock; }, | |
| 5239 | - "createBlock": function() { return /* reexport */ createBlock; }, | |
| 5240 | - "createBlocksFromInnerBlocksTemplate": function() { return /* reexport */ createBlocksFromInnerBlocksTemplate; }, | |
| 5241 | - "doBlocksMatchTemplate": function() { return /* reexport */ doBlocksMatchTemplate; }, | |
| 5242 | - "findTransform": function() { return /* reexport */ findTransform; }, | |
| 5243 | - "getBlockAttributes": function() { return /* reexport */ getBlockAttributes; }, | |
| 5244 | - "getBlockContent": function() { return /* reexport */ getBlockInnerHTML; }, | |
| 5245 | - "getBlockDefaultClassName": function() { return /* reexport */ getBlockDefaultClassName; }, | |
| 5246 | - "getBlockFromExample": function() { return /* reexport */ getBlockFromExample; }, | |
| 5247 | - "getBlockMenuDefaultClassName": function() { return /* reexport */ getBlockMenuDefaultClassName; }, | |
| 5248 | - "getBlockSupport": function() { return /* reexport */ registration_getBlockSupport; }, | |
| 5249 | - "getBlockTransforms": function() { return /* reexport */ getBlockTransforms; }, | |
| 5250 | - "getBlockType": function() { return /* reexport */ registration_getBlockType; }, | |
| 5251 | - "getBlockTypes": function() { return /* reexport */ registration_getBlockTypes; }, | |
| 5252 | - "getBlockVariations": function() { return /* reexport */ registration_getBlockVariations; }, | |
| 5253 | - "getCategories": function() { return /* reexport */ categories_getCategories; }, | |
| 5254 | - "getChildBlockNames": function() { return /* reexport */ registration_getChildBlockNames; }, | |
| 5255 | - "getDefaultBlockName": function() { return /* reexport */ registration_getDefaultBlockName; }, | |
| 5256 | - "getFreeformContentHandlerName": function() { return /* reexport */ getFreeformContentHandlerName; }, | |
| 5257 | - "getGroupingBlockName": function() { return /* reexport */ registration_getGroupingBlockName; }, | |
| 5258 | - "getPhrasingContentSchema": function() { return /* reexport */ deprecatedGetPhrasingContentSchema; }, | |
| 5259 | - "getPossibleBlockTransformations": function() { return /* reexport */ getPossibleBlockTransformations; }, | |
| 5260 | - "getSaveContent": function() { return /* reexport */ getSaveContent; }, | |
| 5261 | - "getSaveElement": function() { return /* reexport */ getSaveElement; }, | |
| 5262 | - "getUnregisteredTypeHandlerName": function() { return /* reexport */ getUnregisteredTypeHandlerName; }, | |
| 5263 | - "hasBlockSupport": function() { return /* reexport */ registration_hasBlockSupport; }, | |
| 5264 | - "hasChildBlocks": function() { return /* reexport */ registration_hasChildBlocks; }, | |
| 5265 | - "hasChildBlocksWithInserterSupport": function() { return /* reexport */ registration_hasChildBlocksWithInserterSupport; }, | |
| 5266 | - "isReusableBlock": function() { return /* reexport */ isReusableBlock; }, | |
| 5267 | - "isTemplatePart": function() { return /* reexport */ isTemplatePart; }, | |
| 5268 | - "isUnmodifiedDefaultBlock": function() { return /* reexport */ isUnmodifiedDefaultBlock; }, | |
| 5269 | - "isValidBlockContent": function() { return /* reexport */ isValidBlockContent; }, | |
| 5270 | - "isValidIcon": function() { return /* reexport */ isValidIcon; }, | |
| 5271 | - "node": function() { return /* reexport */ node; }, | |
| 5272 | - "normalizeIconObject": function() { return /* reexport */ normalizeIconObject; }, | |
| 5273 | - "parse": function() { return /* reexport */ parser_parse; }, | |
| 5274 | - "parseWithAttributeSchema": function() { return /* reexport */ parseWithAttributeSchema; }, | |
| 5275 | - "pasteHandler": function() { return /* reexport */ pasteHandler; }, | |
| 5276 | - "rawHandler": function() { return /* reexport */ rawHandler; }, | |
| 5277 | - "registerBlockCollection": function() { return /* reexport */ registerBlockCollection; }, | |
| 5278 | - "registerBlockStyle": function() { return /* reexport */ registerBlockStyle; }, | |
| 5279 | - "registerBlockType": function() { return /* reexport */ registerBlockType; }, | |
| 5280 | - "registerBlockVariation": function() { return /* reexport */ registerBlockVariation; }, | |
| 5281 | - "serialize": function() { return /* reexport */ serializer_serialize; }, | |
| 5282 | - "setCategories": function() { return /* reexport */ categories_setCategories; }, | |
| 5283 | - "setDefaultBlockName": function() { return /* reexport */ setDefaultBlockName; }, | |
| 5284 | - "setFreeformContentHandlerName": function() { return /* reexport */ setFreeformContentHandlerName; }, | |
| 5285 | - "setGroupingBlockName": function() { return /* reexport */ setGroupingBlockName; }, | |
| 5286 | - "setUnregisteredTypeHandlerName": function() { return /* reexport */ setUnregisteredTypeHandlerName; }, | |
| 5287 | - "store": function() { return /* reexport */ store; }, | |
| 5288 | - "switchToBlockType": function() { return /* reexport */ switchToBlockType; }, | |
| 5289 | - "synchronizeBlocksWithTemplate": function() { return /* reexport */ synchronizeBlocksWithTemplate; }, | |
| 5290 | - "unregisterBlockStyle": function() { return /* reexport */ unregisterBlockStyle; }, | |
| 5291 | - "unregisterBlockType": function() { return /* reexport */ unregisterBlockType; }, | |
| 5292 | - "unregisterBlockVariation": function() { return /* reexport */ unregisterBlockVariation; }, | |
| 5293 | - "unstable__bootstrapServerSideBlockDefinitions": function() { return /* reexport */ unstable__bootstrapServerSideBlockDefinitions; }, | |
| 5294 | - "updateCategory": function() { return /* reexport */ categories_updateCategory; }, | |
| 5295 | - "withBlockContentContext": function() { return /* reexport */ withBlockContentContext; } | |
| 5296 | -}); | |
| 5297 | - | |
| 5298 | -// NAMESPACE OBJECT: ./packages/blocks/build-module/store/selectors.js | |
| 5299 | -var selectors_namespaceObject = {}; | |
| 5300 | -__webpack_require__.r(selectors_namespaceObject); | |
| 5301 | -__webpack_require__.d(selectors_namespaceObject, { | |
| 5302 | - "__experimentalGetUnprocessedBlockTypes": function() { return __experimentalGetUnprocessedBlockTypes; }, | |
| 5303 | - "getActiveBlockVariation": function() { return getActiveBlockVariation; }, | |
| 5304 | - "getBlockStyles": function() { return getBlockStyles; }, | |
| 5305 | - "getBlockSupport": function() { return getBlockSupport; }, | |
| 5306 | - "getBlockType": function() { return getBlockType; }, | |
| 5307 | - "getBlockTypes": function() { return getBlockTypes; }, | |
| 5308 | - "getBlockVariations": function() { return getBlockVariations; }, | |
| 5309 | - "getCategories": function() { return getCategories; }, | |
| 5310 | - "getChildBlockNames": function() { return getChildBlockNames; }, | |
| 5311 | - "getCollections": function() { return getCollections; }, | |
| 5312 | - "getDefaultBlockName": function() { return getDefaultBlockName; }, | |
| 5313 | - "getDefaultBlockVariation": function() { return getDefaultBlockVariation; }, | |
| 5314 | - "getFreeformFallbackBlockName": function() { return getFreeformFallbackBlockName; }, | |
| 5315 | - "getGroupingBlockName": function() { return getGroupingBlockName; }, | |
| 5316 | - "getUnregisteredFallbackBlockName": function() { return getUnregisteredFallbackBlockName; }, | |
| 5317 | - "hasBlockSupport": function() { return hasBlockSupport; }, | |
| 5318 | - "hasChildBlocks": function() { return hasChildBlocks; }, | |
| 5319 | - "hasChildBlocksWithInserterSupport": function() { return hasChildBlocksWithInserterSupport; }, | |
| 5320 | - "isMatchingSearchTerm": function() { return isMatchingSearchTerm; } | |
| 5321 | -}); | |
| 5322 | - | |
| 5323 | -// NAMESPACE OBJECT: ./packages/blocks/build-module/store/actions.js | |
| 5324 | -var actions_namespaceObject = {}; | |
| 5325 | -__webpack_require__.r(actions_namespaceObject); | |
| 5326 | -__webpack_require__.d(actions_namespaceObject, { | |
| 5327 | - "__experimentalReapplyBlockTypeFilters": function() { return __experimentalReapplyBlockTypeFilters; }, | |
| 5328 | - "__experimentalRegisterBlockType": function() { return __experimentalRegisterBlockType; }, | |
| 5329 | - "addBlockCollection": function() { return addBlockCollection; }, | |
| 5330 | - "addBlockStyles": function() { return addBlockStyles; }, | |
| 5331 | - "addBlockTypes": function() { return addBlockTypes; }, | |
| 5332 | - "addBlockVariations": function() { return addBlockVariations; }, | |
| 5333 | - "removeBlockCollection": function() { return removeBlockCollection; }, | |
| 5334 | - "removeBlockStyles": function() { return removeBlockStyles; }, | |
| 5335 | - "removeBlockTypes": function() { return removeBlockTypes; }, | |
| 5336 | - "removeBlockVariations": function() { return removeBlockVariations; }, | |
| 5337 | - "setCategories": function() { return setCategories; }, | |
| 5338 | - "setDefaultBlockName": function() { return actions_setDefaultBlockName; }, | |
| 5339 | - "setFreeformFallbackBlockName": function() { return setFreeformFallbackBlockName; }, | |
| 5340 | - "setGroupingBlockName": function() { return actions_setGroupingBlockName; }, | |
| 5341 | - "setUnregisteredFallbackBlockName": function() { return setUnregisteredFallbackBlockName; }, | |
| 5342 | - "updateCategory": function() { return updateCategory; } | |
| 5343 | -}); | |
| 5344 | - | |
| 5345 | -;// CONCATENATED MODULE: external ["wp","data"] | |
| 5346 | -var external_wp_data_namespaceObject = window["wp"]["data"]; | |
| 5347 | -;// CONCATENATED MODULE: external "lodash" | |
| 5348 | -var external_lodash_namespaceObject = window["lodash"]; | |
| 5349 | -;// CONCATENATED MODULE: external ["wp","i18n"] | |
| 5350 | -var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; | |
| 5351 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/store/reducer.js | |
| 5352 | -/** | |
| 5353 | - * External dependencies | |
| 5354 | - */ | |
| 5355 | - | |
| 5356 | -/** | |
| 5357 | - * WordPress dependencies | |
| 5358 | - */ | |
| 5359 | - | |
| 5360 | - | |
| 5361 | - | |
| 5362 | -/** | |
| 5363 | - * @typedef {Object} WPBlockCategory | |
| 5364 | - * | |
| 5365 | - * @property {string} slug Unique category slug. | |
| 5366 | - * @property {string} title Category label, for display in user interface. | |
| 5367 | - */ | |
| 5368 | - | |
| 5369 | -/** | |
| 5370 | - * Default set of categories. | |
| 5371 | - * | |
| 5372 | - * @type {WPBlockCategory[]} | |
| 5373 | - */ | |
| 5374 | - | |
| 5375 | -const DEFAULT_CATEGORIES = [{ | |
| 5376 | - slug: 'text', | |
| 5377 | - title: (0,external_wp_i18n_namespaceObject.__)('Text') | |
| 5378 | -}, { | |
| 5379 | - slug: 'media', | |
| 5380 | - title: (0,external_wp_i18n_namespaceObject.__)('Media') | |
| 5381 | -}, { | |
| 5382 | - slug: 'design', | |
| 5383 | - title: (0,external_wp_i18n_namespaceObject.__)('Design') | |
| 5384 | -}, { | |
| 5385 | - slug: 'widgets', | |
| 5386 | - title: (0,external_wp_i18n_namespaceObject.__)('Widgets') | |
| 5387 | -}, { | |
| 5388 | - slug: 'theme', | |
| 5389 | - title: (0,external_wp_i18n_namespaceObject.__)('Theme') | |
| 5390 | -}, { | |
| 5391 | - slug: 'embed', | |
| 5392 | - title: (0,external_wp_i18n_namespaceObject.__)('Embeds') | |
| 5393 | -}, { | |
| 5394 | - slug: 'reusable', | |
| 5395 | - title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks') | |
| 5396 | -}]; | |
| 5397 | -/** | |
| 5398 | - * Reducer managing the unprocessed block types in a form passed when registering the by block. | |
| 5399 | - * It's for internal use only. It allows recomputing the processed block types on-demand after block type filters | |
| 5400 | - * get added or removed. | |
| 5401 | - * | |
| 5402 | - * @param {Object} state Current state. | |
| 5403 | - * @param {Object} action Dispatched action. | |
| 5404 | - * | |
| 5405 | - * @return {Object} Updated state. | |
| 5406 | - */ | |
| 5407 | - | |
| 5408 | -function unprocessedBlockTypes() { | |
| 5409 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5410 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5411 | - | |
| 5412 | - switch (action.type) { | |
| 5413 | - case 'ADD_UNPROCESSED_BLOCK_TYPE': | |
| 5414 | - return { ...state, | |
| 5415 | - [action.blockType.name]: action.blockType | |
| 5416 | - }; | |
| 5417 | - | |
| 5418 | - case 'REMOVE_BLOCK_TYPES': | |
| 5419 | - return (0,external_lodash_namespaceObject.omit)(state, action.names); | |
| 5420 | - } | |
| 5421 | - | |
| 5422 | - return state; | |
| 5423 | -} | |
| 5424 | -/** | |
| 5425 | - * Reducer managing the processed block types with all filters applied. | |
| 5426 | - * The state is derived from the `unprocessedBlockTypes` reducer. | |
| 5427 | - * | |
| 5428 | - * @param {Object} state Current state. | |
| 5429 | - * @param {Object} action Dispatched action. | |
| 5430 | - * | |
| 5431 | - * @return {Object} Updated state. | |
| 5432 | - */ | |
| 5433 | - | |
| 5434 | -function blockTypes() { | |
| 5435 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5436 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5437 | - | |
| 5438 | - switch (action.type) { | |
| 5439 | - case 'ADD_BLOCK_TYPES': | |
| 5440 | - return { ...state, | |
| 5441 | - ...(0,external_lodash_namespaceObject.keyBy)(action.blockTypes, 'name') | |
| 5442 | - }; | |
| 5443 | - | |
| 5444 | - case 'REMOVE_BLOCK_TYPES': | |
| 5445 | - return (0,external_lodash_namespaceObject.omit)(state, action.names); | |
| 5446 | - } | |
| 5447 | - | |
| 5448 | - return state; | |
| 5449 | -} | |
| 5450 | -/** | |
| 5451 | - * Reducer managing the block style variations. | |
| 5452 | - * | |
| 5453 | - * @param {Object} state Current state. | |
| 5454 | - * @param {Object} action Dispatched action. | |
| 5455 | - * | |
| 5456 | - * @return {Object} Updated state. | |
| 5457 | - */ | |
| 5458 | - | |
| 5459 | -function blockStyles() { | |
| 5460 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5461 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5462 | - | |
| 5463 | - switch (action.type) { | |
| 5464 | - case 'ADD_BLOCK_TYPES': | |
| 5465 | - return { ...state, | |
| 5466 | - ...(0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.keyBy)(action.blockTypes, 'name'), blockType => { | |
| 5467 | - return (0,external_lodash_namespaceObject.uniqBy)([...(0,external_lodash_namespaceObject.get)(blockType, ['styles'], []).map(style => ({ ...style, | |
| 5468 | - source: 'block' | |
| 5469 | - })), ...(0,external_lodash_namespaceObject.get)(state, [blockType.name], []).filter(_ref => { | |
| 5470 | - let { | |
| 5471 | - source | |
| 5472 | - } = _ref; | |
| 5473 | - return 'block' !== source; | |
| 5474 | - })], style => style.name); | |
| 5475 | - }) | |
| 5476 | - }; | |
| 5477 | - | |
| 5478 | - case 'ADD_BLOCK_STYLES': | |
| 5479 | - return { ...state, | |
| 5480 | - [action.blockName]: (0,external_lodash_namespaceObject.uniqBy)([...(0,external_lodash_namespaceObject.get)(state, [action.blockName], []), ...action.styles], style => style.name) | |
| 5481 | - }; | |
| 5482 | - | |
| 5483 | - case 'REMOVE_BLOCK_STYLES': | |
| 5484 | - return { ...state, | |
| 5485 | - [action.blockName]: (0,external_lodash_namespaceObject.filter)((0,external_lodash_namespaceObject.get)(state, [action.blockName], []), style => action.styleNames.indexOf(style.name) === -1) | |
| 5486 | - }; | |
| 5487 | - } | |
| 5488 | - | |
| 5489 | - return state; | |
| 5490 | -} | |
| 5491 | -/** | |
| 5492 | - * Reducer managing the block variations. | |
| 5493 | - * | |
| 5494 | - * @param {Object} state Current state. | |
| 5495 | - * @param {Object} action Dispatched action. | |
| 5496 | - * | |
| 5497 | - * @return {Object} Updated state. | |
| 5498 | - */ | |
| 5499 | - | |
| 5500 | -function blockVariations() { | |
| 5501 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5502 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5503 | - | |
| 5504 | - switch (action.type) { | |
| 5505 | - case 'ADD_BLOCK_TYPES': | |
| 5506 | - return { ...state, | |
| 5507 | - ...(0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.keyBy)(action.blockTypes, 'name'), blockType => { | |
| 5508 | - return (0,external_lodash_namespaceObject.uniqBy)([...(0,external_lodash_namespaceObject.get)(blockType, ['variations'], []).map(variation => ({ ...variation, | |
| 5509 | - source: 'block' | |
| 5510 | - })), ...(0,external_lodash_namespaceObject.get)(state, [blockType.name], []).filter(_ref2 => { | |
| 5511 | - let { | |
| 5512 | - source | |
| 5513 | - } = _ref2; | |
| 5514 | - return 'block' !== source; | |
| 5515 | - })], variation => variation.name); | |
| 5516 | - }) | |
| 5517 | - }; | |
| 5518 | - | |
| 5519 | - case 'ADD_BLOCK_VARIATIONS': | |
| 5520 | - return { ...state, | |
| 5521 | - [action.blockName]: (0,external_lodash_namespaceObject.uniqBy)([...(0,external_lodash_namespaceObject.get)(state, [action.blockName], []), ...action.variations], variation => variation.name) | |
| 5522 | - }; | |
| 5523 | - | |
| 5524 | - case 'REMOVE_BLOCK_VARIATIONS': | |
| 5525 | - return { ...state, | |
| 5526 | - [action.blockName]: (0,external_lodash_namespaceObject.filter)((0,external_lodash_namespaceObject.get)(state, [action.blockName], []), variation => action.variationNames.indexOf(variation.name) === -1) | |
| 5527 | - }; | |
| 5528 | - } | |
| 5529 | - | |
| 5530 | - return state; | |
| 5531 | -} | |
| 5532 | -/** | |
| 5533 | - * Higher-order Reducer creating a reducer keeping track of given block name. | |
| 5534 | - * | |
| 5535 | - * @param {string} setActionType Action type. | |
| 5536 | - * | |
| 5537 | - * @return {Function} Reducer. | |
| 5538 | - */ | |
| 5539 | - | |
| 5540 | -function createBlockNameSetterReducer(setActionType) { | |
| 5541 | - return function () { | |
| 5542 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | |
| 5543 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5544 | - | |
| 5545 | - switch (action.type) { | |
| 5546 | - case 'REMOVE_BLOCK_TYPES': | |
| 5547 | - if (action.names.indexOf(state) !== -1) { | |
| 5548 | - return null; | |
| 5549 | - } | |
| 5550 | - | |
| 5551 | - return state; | |
| 5552 | - | |
| 5553 | - case setActionType: | |
| 5554 | - return action.name || null; | |
| 5555 | - } | |
| 5556 | - | |
| 5557 | - return state; | |
| 5558 | - }; | |
| 5559 | -} | |
| 5560 | -const defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME'); | |
| 5561 | -const freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME'); | |
| 5562 | -const unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME'); | |
| 5563 | -const groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME'); | |
| 5564 | -/** | |
| 5565 | - * Reducer managing the categories | |
| 5566 | - * | |
| 5567 | - * @param {WPBlockCategory[]} state Current state. | |
| 5568 | - * @param {Object} action Dispatched action. | |
| 5569 | - * | |
| 5570 | - * @return {WPBlockCategory[]} Updated state. | |
| 5571 | - */ | |
| 5572 | - | |
| 5573 | -function categories() { | |
| 5574 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_CATEGORIES; | |
| 5575 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5576 | - | |
| 5577 | - switch (action.type) { | |
| 5578 | - case 'SET_CATEGORIES': | |
| 5579 | - return action.categories || []; | |
| 5580 | - | |
| 5581 | - case 'UPDATE_CATEGORY': | |
| 5582 | - { | |
| 5583 | - if (!action.category || (0,external_lodash_namespaceObject.isEmpty)(action.category)) { | |
| 5584 | - return state; | |
| 5585 | - } | |
| 5586 | - | |
| 5587 | - const categoryToChange = (0,external_lodash_namespaceObject.find)(state, ['slug', action.slug]); | |
| 5588 | - | |
| 5589 | - if (categoryToChange) { | |
| 5590 | - return (0,external_lodash_namespaceObject.map)(state, category => { | |
| 5591 | - if (category.slug === action.slug) { | |
| 5592 | - return { ...category, | |
| 5593 | - ...action.category | |
| 5594 | - }; | |
| 5595 | - } | |
| 5596 | - | |
| 5597 | - return category; | |
| 5598 | - }); | |
| 5599 | - } | |
| 5600 | - } | |
| 5601 | - } | |
| 5602 | - | |
| 5603 | - return state; | |
| 5604 | -} | |
| 5605 | -function collections() { | |
| 5606 | - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 5607 | - let action = arguments.length > 1 ? arguments[1] : undefined; | |
| 5608 | - | |
| 5609 | - switch (action.type) { | |
| 5610 | - case 'ADD_BLOCK_COLLECTION': | |
| 5611 | - return { ...state, | |
| 5612 | - [action.namespace]: { | |
| 5613 | - title: action.title, | |
| 5614 | - icon: action.icon | |
| 5615 | - } | |
| 5616 | - }; | |
| 5617 | - | |
| 5618 | - case 'REMOVE_BLOCK_COLLECTION': | |
| 5619 | - return (0,external_lodash_namespaceObject.omit)(state, action.namespace); | |
| 5620 | - } | |
| 5621 | - | |
| 5622 | - return state; | |
| 5623 | -} | |
| 5624 | -/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ | |
| 5625 | - unprocessedBlockTypes, | |
| 5626 | - blockTypes, | |
| 5627 | - blockStyles, | |
| 5628 | - blockVariations, | |
| 5629 | - defaultBlockName, | |
| 5630 | - freeformFallbackBlockName, | |
| 5631 | - unregisteredFallbackBlockName, | |
| 5632 | - groupingBlockName, | |
| 5633 | - categories, | |
| 5634 | - collections | |
| 5635 | -})); | |
| 5636 | -//# sourceMappingURL=reducer.js.map | |
| 5637 | -;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js | |
| 5638 | - | |
| 5639 | - | |
| 5640 | -var LEAF_KEY, hasWeakMap; | |
| 5641 | - | |
| 5642 | -/** | |
| 5643 | - * Arbitrary value used as key for referencing cache object in WeakMap tree. | |
| 5644 | - * | |
| 5645 | - * @type {Object} | |
| 5646 | - */ | |
| 5647 | -LEAF_KEY = {}; | |
| 5648 | - | |
| 5649 | -/** | |
| 5650 | - * Whether environment supports WeakMap. | |
| 5651 | - * | |
| 5652 | - * @type {boolean} | |
| 5653 | - */ | |
| 5654 | -hasWeakMap = typeof WeakMap !== 'undefined'; | |
| 5655 | - | |
| 5656 | -/** | |
| 5657 | - * Returns the first argument as the sole entry in an array. | |
| 5658 | - * | |
| 5659 | - * @param {*} value Value to return. | |
| 5660 | - * | |
| 5661 | - * @return {Array} Value returned as entry in array. | |
| 5662 | - */ | |
| 5663 | -function arrayOf( value ) { | |
| 5664 | - return [ value ]; | |
| 5665 | -} | |
| 5666 | - | |
| 5667 | -/** | |
| 5668 | - * Returns true if the value passed is object-like, or false otherwise. A value | |
| 5669 | - * is object-like if it can support property assignment, e.g. object or array. | |
| 5670 | - * | |
| 5671 | - * @param {*} value Value to test. | |
| 5672 | - * | |
| 5673 | - * @return {boolean} Whether value is object-like. | |
| 5674 | - */ | |
| 5675 | -function isObjectLike( value ) { | |
| 5676 | - return !! value && 'object' === typeof value; | |
| 5677 | -} | |
| 5678 | - | |
| 5679 | -/** | |
| 5680 | - * Creates and returns a new cache object. | |
| 5681 | - * | |
| 5682 | - * @return {Object} Cache object. | |
| 5683 | - */ | |
| 5684 | -function createCache() { | |
| 5685 | - var cache = { | |
| 5686 | - clear: function() { | |
| 5687 | - cache.head = null; | |
| 5688 | - }, | |
| 5689 | - }; | |
| 5690 | - | |
| 5691 | - return cache; | |
| 5692 | -} | |
| 5693 | - | |
| 5694 | -/** | |
| 5695 | - * Returns true if entries within the two arrays are strictly equal by | |
| 5696 | - * reference from a starting index. | |
| 5697 | - * | |
| 5698 | - * @param {Array} a First array. | |
| 5699 | - * @param {Array} b Second array. | |
| 5700 | - * @param {number} fromIndex Index from which to start comparison. | |
| 5701 | - * | |
| 5702 | - * @return {boolean} Whether arrays are shallowly equal. | |
| 5703 | - */ | |
| 5704 | -function isShallowEqual( a, b, fromIndex ) { | |
| 5705 | - var i; | |
| 5706 | - | |
| 5707 | - if ( a.length !== b.length ) { | |
| 5708 | - return false; | |
| 5709 | - } | |
| 5710 | - | |
| 5711 | - for ( i = fromIndex; i < a.length; i++ ) { | |
| 5712 | - if ( a[ i ] !== b[ i ] ) { | |
| 5713 | - return false; | |
| 5714 | - } | |
| 5715 | - } | |
| 5716 | - | |
| 5717 | - return true; | |
| 5718 | -} | |
| 5719 | - | |
| 5720 | -/** | |
| 5721 | - * Returns a memoized selector function. The getDependants function argument is | |
| 5722 | - * called before the memoized selector and is expected to return an immutable | |
| 5723 | - * reference or array of references on which the selector depends for computing | |
| 5724 | - * its own return value. The memoize cache is preserved only as long as those | |
| 5725 | - * dependant references remain the same. If getDependants returns a different | |
| 5726 | - * reference(s), the cache is cleared and the selector value regenerated. | |
| 5727 | - * | |
| 5728 | - * @param {Function} selector Selector function. | |
| 5729 | - * @param {Function} getDependants Dependant getter returning an immutable | |
| 5730 | - * reference or array of reference used in | |
| 5731 | - * cache bust consideration. | |
| 5732 | - * | |
| 5733 | - * @return {Function} Memoized selector. | |
| 5734 | - */ | |
| 5735 | -/* harmony default export */ function rememo(selector, getDependants ) { | |
| 5736 | - var rootCache, getCache; | |
| 5737 | - | |
| 5738 | - // Use object source as dependant if getter not provided | |
| 5739 | - if ( ! getDependants ) { | |
| 5740 | - getDependants = arrayOf; | |
| 5741 | - } | |
| 5742 | - | |
| 5743 | - /** | |
| 5744 | - * Returns the root cache. If WeakMap is supported, this is assigned to the | |
| 5745 | - * root WeakMap cache set, otherwise it is a shared instance of the default | |
| 5746 | - * cache object. | |
| 5747 | - * | |
| 5748 | - * @return {(WeakMap|Object)} Root cache object. | |
| 5749 | - */ | |
| 5750 | - function getRootCache() { | |
| 5751 | - return rootCache; | |
| 5752 | - } | |
| 5753 | - | |
| 5754 | - /** | |
| 5755 | - * Returns the cache for a given dependants array. When possible, a WeakMap | |
| 5756 | - * will be used to create a unique cache for each set of dependants. This | |
| 5757 | - * is feasible due to the nature of WeakMap in allowing garbage collection | |
| 5758 | - * to occur on entries where the key object is no longer referenced. Since | |
| 5759 | - * WeakMap requires the key to be an object, this is only possible when the | |
| 5760 | - * dependant is object-like. The root cache is created as a hierarchy where | |
| 5761 | - * each top-level key is the first entry in a dependants set, the value a | |
| 5762 | - * WeakMap where each key is the next dependant, and so on. This continues | |
| 5763 | - * so long as the dependants are object-like. If no dependants are object- | |
| 5764 | - * like, then the cache is shared across all invocations. | |
| 5765 | - * | |
| 5766 | - * @see isObjectLike | |
| 5767 | - * | |
| 5768 | - * @param {Array} dependants Selector dependants. | |
| 5769 | - * | |
| 5770 | - * @return {Object} Cache object. | |
| 5771 | - */ | |
| 5772 | - function getWeakMapCache( dependants ) { | |
| 5773 | - var caches = rootCache, | |
| 5774 | - isUniqueByDependants = true, | |
| 5775 | - i, dependant, map, cache; | |
| 5776 | - | |
| 5777 | - for ( i = 0; i < dependants.length; i++ ) { | |
| 5778 | - dependant = dependants[ i ]; | |
| 5779 | - | |
| 5780 | - // Can only compose WeakMap from object-like key. | |
| 5781 | - if ( ! isObjectLike( dependant ) ) { | |
| 5782 | - isUniqueByDependants = false; | |
| 5783 | - break; | |
| 5784 | - } | |
| 5785 | - | |
| 5786 | - // Does current segment of cache already have a WeakMap? | |
| 5787 | - if ( caches.has( dependant ) ) { | |
| 5788 | - // Traverse into nested WeakMap. | |
| 5789 | - caches = caches.get( dependant ); | |
| 5790 | - } else { | |
| 5791 | - // Create, set, and traverse into a new one. | |
| 5792 | - map = new WeakMap(); | |
| 5793 | - caches.set( dependant, map ); | |
| 5794 | - caches = map; | |
| 5795 | - } | |
| 5796 | - } | |
| 5797 | - | |
| 5798 | - // We use an arbitrary (but consistent) object as key for the last item | |
| 5799 | - // in the WeakMap to serve as our running cache. | |
| 5800 | - if ( ! caches.has( LEAF_KEY ) ) { | |
| 5801 | - cache = createCache(); | |
| 5802 | - cache.isUniqueByDependants = isUniqueByDependants; | |
| 5803 | - caches.set( LEAF_KEY, cache ); | |
| 5804 | - } | |
| 5805 | - | |
| 5806 | - return caches.get( LEAF_KEY ); | |
| 5807 | - } | |
| 5808 | - | |
| 5809 | - // Assign cache handler by availability of WeakMap | |
| 5810 | - getCache = hasWeakMap ? getWeakMapCache : getRootCache; | |
| 5811 | - | |
| 5812 | - /** | |
| 5813 | - * Resets root memoization cache. | |
| 5814 | - */ | |
| 5815 | - function clear() { | |
| 5816 | - rootCache = hasWeakMap ? new WeakMap() : createCache(); | |
| 5817 | - } | |
| 5818 | - | |
| 5819 | - // eslint-disable-next-line jsdoc/check-param-names | |
| 5820 | - /** | |
| 5821 | - * The augmented selector call, considering first whether dependants have | |
| 5822 | - * changed before passing it to underlying memoize function. | |
| 5823 | - * | |
| 5824 | - * @param {Object} source Source object for derivation. | |
| 5825 | - * @param {...*} extraArgs Additional arguments to pass to selector. | |
| 5826 | - * | |
| 5827 | - * @return {*} Selector result. | |
| 5828 | - */ | |
| 5829 | - function callSelector( /* source, ...extraArgs */ ) { | |
| 5830 | - var len = arguments.length, | |
| 5831 | - cache, node, i, args, dependants; | |
| 5832 | - | |
| 5833 | - // Create copy of arguments (avoid leaking deoptimization). | |
| 5834 | - args = new Array( len ); | |
| 5835 | - for ( i = 0; i < len; i++ ) { | |
| 5836 | - args[ i ] = arguments[ i ]; | |
| 5837 | - } | |
| 5838 | - | |
| 5839 | - dependants = getDependants.apply( null, args ); | |
| 5840 | - cache = getCache( dependants ); | |
| 5841 | - | |
| 5842 | - // If not guaranteed uniqueness by dependants (primitive type or lack | |
| 5843 | - // of WeakMap support), shallow compare against last dependants and, if | |
| 5844 | - // references have changed, destroy cache to recalculate result. | |
| 5845 | - if ( ! cache.isUniqueByDependants ) { | |
| 5846 | - if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { | |
| 5847 | - cache.clear(); | |
| 5848 | - } | |
| 5849 | - | |
| 5850 | - cache.lastDependants = dependants; | |
| 5851 | - } | |
| 5852 | - | |
| 5853 | - node = cache.head; | |
| 5854 | - while ( node ) { | |
| 5855 | - // Check whether node arguments match arguments | |
| 5856 | - if ( ! isShallowEqual( node.args, args, 1 ) ) { | |
| 5857 | - node = node.next; | |
| 5858 | - continue; | |
| 5859 | - } | |
| 5860 | - | |
| 5861 | - // At this point we can assume we've found a match | |
| 5862 | - | |
| 5863 | - // Surface matched node to head if not already | |
| 5864 | - if ( node !== cache.head ) { | |
| 5865 | - // Adjust siblings to point to each other. | |
| 5866 | - node.prev.next = node.next; | |
| 5867 | - if ( node.next ) { | |
| 5868 | - node.next.prev = node.prev; | |
| 5869 | - } | |
| 5870 | - | |
| 5871 | - node.next = cache.head; | |
| 5872 | - node.prev = null; | |
| 5873 | - cache.head.prev = node; | |
| 5874 | - cache.head = node; | |
| 5875 | - } | |
| 5876 | - | |
| 5877 | - // Return immediately | |
| 5878 | - return node.val; | |
| 5879 | - } | |
| 5880 | - | |
| 5881 | - // No cached value found. Continue to insertion phase: | |
| 5882 | - | |
| 5883 | - node = { | |
| 5884 | - // Generate the result from original function | |
| 5885 | - val: selector.apply( null, args ), | |
| 5886 | - }; | |
| 5887 | - | |
| 5888 | - // Avoid including the source object in the cache. | |
| 5889 | - args[ 0 ] = null; | |
| 5890 | - node.args = args; | |
| 5891 | - | |
| 5892 | - // Don't need to check whether node is already head, since it would | |
| 5893 | - // have been returned above already if it was | |
| 5894 | - | |
| 5895 | - // Shift existing head down list | |
| 5896 | - if ( cache.head ) { | |
| 5897 | - cache.head.prev = node; | |
| 5898 | - node.next = cache.head; | |
| 5899 | - } | |
| 5900 | - | |
| 5901 | - cache.head = node; | |
| 5902 | - | |
| 5903 | - return node.val; | |
| 5904 | - } | |
| 5905 | - | |
| 5906 | - callSelector.getDependants = getDependants; | |
| 5907 | - callSelector.clear = clear; | |
| 5908 | - clear(); | |
| 5909 | - | |
| 5910 | - return callSelector; | |
| 5911 | -} | |
| 5912 | - | |
| 5913 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/store/selectors.js | |
| 5914 | -/** | |
| 5915 | - * External dependencies | |
| 5916 | - */ | |
| 5917 | - | |
| 5918 | - | |
| 5919 | -/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ | |
| 5920 | - | |
| 5921 | -/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */ | |
| 5922 | - | |
| 5923 | -/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */ | |
| 5924 | - | |
| 5925 | -/** | |
| 5926 | - * Given a block name or block type object, returns the corresponding | |
| 5927 | - * normalized block type object. | |
| 5928 | - * | |
| 5929 | - * @param {Object} state Blocks state. | |
| 5930 | - * @param {(string|Object)} nameOrType Block name or type object | |
| 5931 | - * | |
| 5932 | - * @return {Object} Block type object. | |
| 5933 | - */ | |
| 5934 | - | |
| 5935 | -const getNormalizedBlockType = (state, nameOrType) => 'string' === typeof nameOrType ? getBlockType(state, nameOrType) : nameOrType; | |
| 5936 | -/** | |
| 5937 | - * Returns all the unprocessed block types as passed during the registration. | |
| 5938 | - * | |
| 5939 | - * @param {Object} state Data state. | |
| 5940 | - * | |
| 5941 | - * @return {Array} Unprocessed block types. | |
| 5942 | - */ | |
| 5943 | - | |
| 5944 | - | |
| 5945 | -function __experimentalGetUnprocessedBlockTypes(state) { | |
| 5946 | - return state.unprocessedBlockTypes; | |
| 5947 | -} | |
| 5948 | -/** | |
| 5949 | - * Returns all the available block types. | |
| 5950 | - * | |
| 5951 | - * @param {Object} state Data state. | |
| 5952 | - * | |
| 5953 | - * @return {Array} Block Types. | |
| 5954 | - */ | |
| 5955 | - | |
| 5956 | -const getBlockTypes = rememo(state => Object.values(state.blockTypes), state => [state.blockTypes]); | |
| 5957 | -/** | |
| 5958 | - * Returns a block type by name. | |
| 5959 | - * | |
| 5960 | - * @param {Object} state Data state. | |
| 5961 | - * @param {string} name Block type name. | |
| 5962 | - * | |
| 5963 | - * @return {Object?} Block Type. | |
| 5964 | - */ | |
| 5965 | - | |
| 5966 | -function getBlockType(state, name) { | |
| 5967 | - return state.blockTypes[name]; | |
| 5968 | -} | |
| 5969 | -/** | |
| 5970 | - * Returns block styles by block name. | |
| 5971 | - * | |
| 5972 | - * @param {Object} state Data state. | |
| 5973 | - * @param {string} name Block type name. | |
| 5974 | - * | |
| 5975 | - * @return {Array?} Block Styles. | |
| 5976 | - */ | |
| 5977 | - | |
| 5978 | -function getBlockStyles(state, name) { | |
| 5979 | - return state.blockStyles[name]; | |
| 5980 | -} | |
| 5981 | -/** | |
| 5982 | - * Returns block variations by block name. | |
| 5983 | - * | |
| 5984 | - * @param {Object} state Data state. | |
| 5985 | - * @param {string} blockName Block type name. | |
| 5986 | - * @param {WPBlockVariationScope} [scope] Block variation scope name. | |
| 5987 | - * | |
| 5988 | - * @return {(WPBlockVariation[]|void)} Block variations. | |
| 5989 | - */ | |
| 5990 | - | |
| 5991 | -const getBlockVariations = rememo((state, blockName, scope) => { | |
| 5992 | - const variations = state.blockVariations[blockName]; | |
| 5993 | - | |
| 5994 | - if (!variations || !scope) { | |
| 5995 | - return variations; | |
| 5996 | - } | |
| 5997 | - | |
| 5998 | - return variations.filter(variation => { | |
| 5999 | - // For backward compatibility reasons, variation's scope defaults to | |
| 6000 | - // `block` and `inserter` when not set. | |
| 6001 | - return (variation.scope || ['block', 'inserter']).includes(scope); | |
| 6002 | - }); | |
| 6003 | -}, (state, blockName) => [state.blockVariations[blockName]]); | |
| 6004 | -/** | |
| 6005 | - * Returns the active block variation for a given block based on its attributes. | |
| 6006 | - * Variations are determined by their `isActive` property. | |
| 6007 | - * Which is either an array of block attribute keys or a function. | |
| 6008 | - * | |
| 6009 | - * In case of an array of block attribute keys, the `attributes` are compared | |
| 6010 | - * to the variation's attributes using strict equality check. | |
| 6011 | - * | |
| 6012 | - * In case of function type, the function should accept a block's attributes | |
| 6013 | - * and the variation's attributes and determines if a variation is active. | |
| 6014 | - * A function that accepts a block's attributes and the variation's attributes and determines if a variation is active. | |
| 6015 | - * | |
| 6016 | - * @param {Object} state Data state. | |
| 6017 | - * @param {string} blockName Name of block (example: “core/columns”). | |
| 6018 | - * @param {Object} attributes Block attributes used to determine active variation. | |
| 6019 | - * @param {WPBlockVariationScope} [scope] Block variation scope name. | |
| 6020 | - * | |
| 6021 | - * @return {(WPBlockVariation|undefined)} Active block variation. | |
| 6022 | - */ | |
| 6023 | - | |
| 6024 | -function getActiveBlockVariation(state, blockName, attributes, scope) { | |
| 6025 | - const variations = getBlockVariations(state, blockName, scope); | |
| 6026 | - const match = variations === null || variations === void 0 ? void 0 : variations.find(variation => { | |
| 6027 | - var _variation$isActive; | |
| 6028 | - | |
| 6029 | - if (Array.isArray(variation.isActive)) { | |
| 6030 | - const blockType = getBlockType(state, blockName); | |
| 6031 | - const attributeKeys = Object.keys((blockType === null || blockType === void 0 ? void 0 : blockType.attributes) || {}); | |
| 6032 | - const definedAttributes = variation.isActive.filter(attribute => attributeKeys.includes(attribute)); | |
| 6033 | - | |
| 6034 | - if (definedAttributes.length === 0) { | |
| 6035 | - return false; | |
| 6036 | - } | |
| 6037 | - | |
| 6038 | - return definedAttributes.every(attribute => attributes[attribute] === variation.attributes[attribute]); | |
| 6039 | - } | |
| 6040 | - | |
| 6041 | - return (_variation$isActive = variation.isActive) === null || _variation$isActive === void 0 ? void 0 : _variation$isActive.call(variation, attributes, variation.attributes); | |
| 6042 | - }); | |
| 6043 | - return match; | |
| 6044 | -} | |
| 6045 | -/** | |
| 6046 | - * Returns the default block variation for the given block type. | |
| 6047 | - * When there are multiple variations annotated as the default one, | |
| 6048 | - * the last added item is picked. This simplifies registering overrides. | |
| 6049 | - * When there is no default variation set, it returns the first item. | |
| 6050 | - * | |
| 6051 | - * @param {Object} state Data state. | |
| 6052 | - * @param {string} blockName Block type name. | |
| 6053 | - * @param {WPBlockVariationScope} [scope] Block variation scope name. | |
| 6054 | - * | |
| 6055 | - * @return {?WPBlockVariation} The default block variation. | |
| 6056 | - */ | |
| 6057 | - | |
| 6058 | -function getDefaultBlockVariation(state, blockName, scope) { | |
| 6059 | - const variations = getBlockVariations(state, blockName, scope); | |
| 6060 | - return (0,external_lodash_namespaceObject.findLast)(variations, 'isDefault') || (0,external_lodash_namespaceObject.first)(variations); | |
| 6061 | -} | |
| 6062 | -/** | |
| 6063 | - * Returns all the available categories. | |
| 6064 | - * | |
| 6065 | - * @param {Object} state Data state. | |
| 6066 | - * | |
| 6067 | - * @return {WPBlockCategory[]} Categories list. | |
| 6068 | - */ | |
| 6069 | - | |
| 6070 | -function getCategories(state) { | |
| 6071 | - return state.categories; | |
| 6072 | -} | |
| 6073 | -/** | |
| 6074 | - * Returns all the available collections. | |
| 6075 | - * | |
| 6076 | - * @param {Object} state Data state. | |
| 6077 | - * | |
| 6078 | - * @return {Object} Collections list. | |
| 6079 | - */ | |
| 6080 | - | |
| 6081 | -function getCollections(state) { | |
| 6082 | - return state.collections; | |
| 6083 | -} | |
| 6084 | -/** | |
| 6085 | - * Returns the name of the default block name. | |
| 6086 | - * | |
| 6087 | - * @param {Object} state Data state. | |
| 6088 | - * | |
| 6089 | - * @return {string?} Default block name. | |
| 6090 | - */ | |
| 6091 | - | |
| 6092 | -function getDefaultBlockName(state) { | |
| 6093 | - return state.defaultBlockName; | |
| 6094 | -} | |
| 6095 | -/** | |
| 6096 | - * Returns the name of the block for handling non-block content. | |
| 6097 | - * | |
| 6098 | - * @param {Object} state Data state. | |
| 6099 | - * | |
| 6100 | - * @return {string?} Name of the block for handling non-block content. | |
| 6101 | - */ | |
| 6102 | - | |
| 6103 | -function getFreeformFallbackBlockName(state) { | |
| 6104 | - return state.freeformFallbackBlockName; | |
| 6105 | -} | |
| 6106 | -/** | |
| 6107 | - * Returns the name of the block for handling unregistered blocks. | |
| 6108 | - * | |
| 6109 | - * @param {Object} state Data state. | |
| 6110 | - * | |
| 6111 | - * @return {string?} Name of the block for handling unregistered blocks. | |
| 6112 | - */ | |
| 6113 | - | |
| 6114 | -function getUnregisteredFallbackBlockName(state) { | |
| 6115 | - return state.unregisteredFallbackBlockName; | |
| 6116 | -} | |
| 6117 | -/** | |
| 6118 | - * Returns the name of the block for handling unregistered blocks. | |
| 6119 | - * | |
| 6120 | - * @param {Object} state Data state. | |
| 6121 | - * | |
| 6122 | - * @return {string?} Name of the block for handling unregistered blocks. | |
| 6123 | - */ | |
| 6124 | - | |
| 6125 | -function getGroupingBlockName(state) { | |
| 6126 | - return state.groupingBlockName; | |
| 6127 | -} | |
| 6128 | -/** | |
| 6129 | - * Returns an array with the child blocks of a given block. | |
| 6130 | - * | |
| 6131 | - * @param {Object} state Data state. | |
| 6132 | - * @param {string} blockName Block type name. | |
| 6133 | - * | |
| 6134 | - * @return {Array} Array of child block names. | |
| 6135 | - */ | |
| 6136 | - | |
| 6137 | -const getChildBlockNames = rememo((state, blockName) => { | |
| 6138 | - return (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.filter)(state.blockTypes, blockType => { | |
| 6139 | - return (0,external_lodash_namespaceObject.includes)(blockType.parent, blockName); | |
| 6140 | - }), _ref => { | |
| 6141 | - let { | |
| 6142 | - name | |
| 6143 | - } = _ref; | |
| 6144 | - return name; | |
| 6145 | - }); | |
| 6146 | -}, state => [state.blockTypes]); | |
| 6147 | -/** | |
| 6148 | - * Returns the block support value for a feature, if defined. | |
| 6149 | - * | |
| 6150 | - * @param {Object} state Data state. | |
| 6151 | - * @param {(string|Object)} nameOrType Block name or type object | |
| 6152 | - * @param {Array|string} feature Feature to retrieve | |
| 6153 | - * @param {*} defaultSupports Default value to return if not | |
| 6154 | - * explicitly defined | |
| 6155 | - * | |
| 6156 | - * @return {?*} Block support value | |
| 6157 | - */ | |
| 6158 | - | |
| 6159 | -const getBlockSupport = (state, nameOrType, feature, defaultSupports) => { | |
| 6160 | - const blockType = getNormalizedBlockType(state, nameOrType); | |
| 6161 | - | |
| 6162 | - if (!(blockType !== null && blockType !== void 0 && blockType.supports)) { | |
| 6163 | - return defaultSupports; | |
| 6164 | - } | |
| 6165 | - | |
| 6166 | - return (0,external_lodash_namespaceObject.get)(blockType.supports, feature, defaultSupports); | |
| 6167 | -}; | |
| 6168 | -/** | |
| 6169 | - * Returns true if the block defines support for a feature, or false otherwise. | |
| 6170 | - * | |
| 6171 | - * @param {Object} state Data state. | |
| 6172 | - * @param {(string|Object)} nameOrType Block name or type object. | |
| 6173 | - * @param {string} feature Feature to test. | |
| 6174 | - * @param {boolean} defaultSupports Whether feature is supported by | |
| 6175 | - * default if not explicitly defined. | |
| 6176 | - * | |
| 6177 | - * @return {boolean} Whether block supports feature. | |
| 6178 | - */ | |
| 6179 | - | |
| 6180 | -function hasBlockSupport(state, nameOrType, feature, defaultSupports) { | |
| 6181 | - return !!getBlockSupport(state, nameOrType, feature, defaultSupports); | |
| 6182 | -} | |
| 6183 | -/** | |
| 6184 | - * Returns true if the block type by the given name or object value matches a | |
| 6185 | - * search term, or false otherwise. | |
| 6186 | - * | |
| 6187 | - * @param {Object} state Blocks state. | |
| 6188 | - * @param {(string|Object)} nameOrType Block name or type object. | |
| 6189 | - * @param {string} searchTerm Search term by which to filter. | |
| 6190 | - * | |
| 6191 | - * @return {Object[]} Whether block type matches search term. | |
| 6192 | - */ | |
| 6193 | - | |
| 6194 | -function isMatchingSearchTerm(state, nameOrType, searchTerm) { | |
| 6195 | - const blockType = getNormalizedBlockType(state, nameOrType); | |
| 6196 | - const getNormalizedSearchTerm = (0,external_lodash_namespaceObject.flow)([// Disregard diacritics. | |
| 6197 | - // Input: "média" | |
| 6198 | - external_lodash_namespaceObject.deburr, // Lowercase. | |
| 6199 | - // Input: "MEDIA" | |
| 6200 | - term => term.toLowerCase(), // Strip leading and trailing whitespace. | |
| 6201 | - // Input: " media " | |
| 6202 | - term => term.trim()]); | |
| 6203 | - const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); | |
| 6204 | - const isSearchMatch = (0,external_lodash_namespaceObject.flow)([getNormalizedSearchTerm, normalizedCandidate => (0,external_lodash_namespaceObject.includes)(normalizedCandidate, normalizedSearchTerm)]); | |
| 6205 | - return isSearchMatch(blockType.title) || (0,external_lodash_namespaceObject.some)(blockType.keywords, isSearchMatch) || isSearchMatch(blockType.category); | |
| 6206 | -} | |
| 6207 | -/** | |
| 6208 | - * Returns a boolean indicating if a block has child blocks or not. | |
| 6209 | - * | |
| 6210 | - * @param {Object} state Data state. | |
| 6211 | - * @param {string} blockName Block type name. | |
| 6212 | - * | |
| 6213 | - * @return {boolean} True if a block contains child blocks and false otherwise. | |
| 6214 | - */ | |
| 6215 | - | |
| 6216 | -const hasChildBlocks = (state, blockName) => { | |
| 6217 | - return getChildBlockNames(state, blockName).length > 0; | |
| 6218 | -}; | |
| 6219 | -/** | |
| 6220 | - * Returns a boolean indicating if a block has at least one child block with inserter support. | |
| 6221 | - * | |
| 6222 | - * @param {Object} state Data state. | |
| 6223 | - * @param {string} blockName Block type name. | |
| 6224 | - * | |
| 6225 | - * @return {boolean} True if a block contains at least one child blocks with inserter support | |
| 6226 | - * and false otherwise. | |
| 6227 | - */ | |
| 6228 | - | |
| 6229 | -const hasChildBlocksWithInserterSupport = (state, blockName) => { | |
| 6230 | - return (0,external_lodash_namespaceObject.some)(getChildBlockNames(state, blockName), childBlockName => { | |
| 6231 | - return hasBlockSupport(state, childBlockName, 'inserter', true); | |
| 6232 | - }); | |
| 6233 | -}; | |
| 6234 | -//# sourceMappingURL=selectors.js.map | |
| 6235 | -;// CONCATENATED MODULE: external ["wp","hooks"] | |
| 6236 | -var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; | |
| 6237 | -;// CONCATENATED MODULE: ./packages/blocks/node_modules/colord/index.mjs | |
| 6238 | -var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; | |
| 6239 | - | |
| 6240 | -;// CONCATENATED MODULE: ./packages/blocks/node_modules/colord/plugins/names.mjs | |
| 6241 | -/* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])} | |
| 6242 | - | |
| 6243 | -;// CONCATENATED MODULE: ./packages/blocks/node_modules/colord/plugins/a11y.mjs | |
| 6244 | -var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} | |
| 6245 | - | |
| 6246 | -;// CONCATENATED MODULE: external ["wp","element"] | |
| 6247 | -var external_wp_element_namespaceObject = window["wp"]["element"]; | |
| 6248 | -;// CONCATENATED MODULE: external ["wp","dom"] | |
| 6249 | -var external_wp_dom_namespaceObject = window["wp"]["dom"]; | |
| 6250 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/constants.js | |
| 6251 | -const BLOCK_ICON_DEFAULT = 'block-default'; | |
| 6252 | -/** | |
| 6253 | - * Array of valid keys in a block type settings deprecation object. | |
| 6254 | - * | |
| 6255 | - * @type {string[]} | |
| 6256 | - */ | |
| 6257 | - | |
| 6258 | -const DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible', 'apiVersion']; | |
| 6259 | -const __EXPERIMENTAL_STYLE_PROPERTY = { | |
| 6260 | - //kept for back-compatibility purposes. | |
| 6261 | - '--wp--style--color--link': { | |
| 6262 | - value: ['color', 'link'], | |
| 6263 | - support: ['color', 'link'] | |
| 6264 | - }, | |
| 6265 | - background: { | |
| 6266 | - value: ['color', 'gradient'], | |
| 6267 | - support: ['color', 'gradients'] | |
| 6268 | - }, | |
| 6269 | - backgroundColor: { | |
| 6270 | - value: ['color', 'background'], | |
| 6271 | - support: ['color', 'background'], | |
| 6272 | - requiresOptOut: true | |
| 6273 | - }, | |
| 6274 | - borderColor: { | |
| 6275 | - value: ['border', 'color'], | |
| 6276 | - support: ['__experimentalBorder', 'color'] | |
| 6277 | - }, | |
| 6278 | - borderRadius: { | |
| 6279 | - value: ['border', 'radius'], | |
| 6280 | - support: ['__experimentalBorder', 'radius'], | |
| 6281 | - properties: { | |
| 6282 | - borderTopLeftRadius: 'topLeft', | |
| 6283 | - borderTopRightRadius: 'topRight', | |
| 6284 | - borderBottomLeftRadius: 'bottomLeft', | |
| 6285 | - borderBottomRightRadius: 'bottomRight' | |
| 6286 | - } | |
| 6287 | - }, | |
| 6288 | - borderStyle: { | |
| 6289 | - value: ['border', 'style'], | |
| 6290 | - support: ['__experimentalBorder', 'style'] | |
| 6291 | - }, | |
| 6292 | - borderWidth: { | |
| 6293 | - value: ['border', 'width'], | |
| 6294 | - support: ['__experimentalBorder', 'width'] | |
| 6295 | - }, | |
| 6296 | - color: { | |
| 6297 | - value: ['color', 'text'], | |
| 6298 | - support: ['color', 'text'], | |
| 6299 | - requiresOptOut: true | |
| 6300 | - }, | |
| 6301 | - linkColor: { | |
| 6302 | - value: ['elements', 'link', 'color', 'text'], | |
| 6303 | - support: ['color', 'link'] | |
| 6304 | - }, | |
| 6305 | - fontFamily: { | |
| 6306 | - value: ['typography', 'fontFamily'], | |
| 6307 | - support: ['typography', '__experimentalFontFamily'] | |
| 6308 | - }, | |
| 6309 | - fontSize: { | |
| 6310 | - value: ['typography', 'fontSize'], | |
| 6311 | - support: ['typography', 'fontSize'] | |
| 6312 | - }, | |
| 6313 | - fontStyle: { | |
| 6314 | - value: ['typography', 'fontStyle'], | |
| 6315 | - support: ['typography', '__experimentalFontStyle'] | |
| 6316 | - }, | |
| 6317 | - fontWeight: { | |
| 6318 | - value: ['typography', 'fontWeight'], | |
| 6319 | - support: ['typography', '__experimentalFontWeight'] | |
| 6320 | - }, | |
| 6321 | - lineHeight: { | |
| 6322 | - value: ['typography', 'lineHeight'], | |
| 6323 | - support: ['typography', 'lineHeight'] | |
| 6324 | - }, | |
| 6325 | - margin: { | |
| 6326 | - value: ['spacing', 'margin'], | |
| 6327 | - support: ['spacing', 'margin'], | |
| 6328 | - properties: { | |
| 6329 | - marginTop: 'top', | |
| 6330 | - marginRight: 'right', | |
| 6331 | - marginBottom: 'bottom', | |
| 6332 | - marginLeft: 'left' | |
| 6333 | - } | |
| 6334 | - }, | |
| 6335 | - padding: { | |
| 6336 | - value: ['spacing', 'padding'], | |
| 6337 | - support: ['spacing', 'padding'], | |
| 6338 | - properties: { | |
| 6339 | - paddingTop: 'top', | |
| 6340 | - paddingRight: 'right', | |
| 6341 | - paddingBottom: 'bottom', | |
| 6342 | - paddingLeft: 'left' | |
| 6343 | - } | |
| 6344 | - }, | |
| 6345 | - textDecoration: { | |
| 6346 | - value: ['typography', 'textDecoration'], | |
| 6347 | - support: ['typography', '__experimentalTextDecoration'] | |
| 6348 | - }, | |
| 6349 | - textTransform: { | |
| 6350 | - value: ['typography', 'textTransform'], | |
| 6351 | - support: ['typography', '__experimentalTextTransform'] | |
| 6352 | - }, | |
| 6353 | - letterSpacing: { | |
| 6354 | - value: ['typography', 'letterSpacing'], | |
| 6355 | - support: ['typography', '__experimentalLetterSpacing'] | |
| 6356 | - }, | |
| 6357 | - '--wp--style--block-gap': { | |
| 6358 | - value: ['spacing', 'blockGap'], | |
| 6359 | - support: ['spacing', 'blockGap'] | |
| 6360 | - } | |
| 6361 | -}; | |
| 6362 | -const __EXPERIMENTAL_ELEMENTS = { | |
| 6363 | - link: 'a', | |
| 6364 | - h1: 'h1', | |
| 6365 | - h2: 'h2', | |
| 6366 | - h3: 'h3', | |
| 6367 | - h4: 'h4', | |
| 6368 | - h5: 'h5', | |
| 6369 | - h6: 'h6' | |
| 6370 | -}; | |
| 6371 | -const __EXPERIMENTAL_PATHS_WITH_MERGE = { | |
| 6372 | - 'color.duotone': true, | |
| 6373 | - 'color.gradients': true, | |
| 6374 | - 'color.palette': true, | |
| 6375 | - 'typography.fontFamilies': true, | |
| 6376 | - 'typography.fontSizes': true | |
| 6377 | -}; | |
| 6378 | -//# sourceMappingURL=constants.js.map | |
| 6379 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/registration.js | |
| 6380 | -/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */ | |
| 6381 | - | |
| 6382 | -/** | |
| 6383 | - * External dependencies | |
| 6384 | - */ | |
| 6385 | - | |
| 6386 | -/** | |
| 6387 | - * WordPress dependencies | |
| 6388 | - */ | |
| 6389 | - | |
| 6390 | - | |
| 6391 | - | |
| 6392 | -/** | |
| 6393 | - * Internal dependencies | |
| 6394 | - */ | |
| 6395 | - | |
| 6396 | -const i18nBlockSchema = { | |
| 6397 | - title: "block title", | |
| 6398 | - description: "block description", | |
| 6399 | - keywords: ["block keyword"], | |
| 6400 | - styles: [{ | |
| 6401 | - label: "block style label" | |
| 6402 | - }], | |
| 6403 | - variations: [{ | |
| 6404 | - title: "block variation title", | |
| 6405 | - description: "block variation description", | |
| 6406 | - keywords: ["block variation keyword"] | |
| 6407 | - }] | |
| 6408 | -}; | |
| 6409 | - | |
| 6410 | - | |
| 6411 | -/** | |
| 6412 | - * An icon type definition. One of a Dashicon slug, an element, | |
| 6413 | - * or a component. | |
| 6414 | - * | |
| 6415 | - * @typedef {(string|WPElement|WPComponent)} WPIcon | |
| 6416 | - * | |
| 6417 | - * @see https://developer.wordpress.org/resource/dashicons/ | |
| 6418 | - */ | |
| 6419 | - | |
| 6420 | -/** | |
| 6421 | - * Render behavior of a block type icon; one of a Dashicon slug, an element, | |
| 6422 | - * or a component. | |
| 6423 | - * | |
| 6424 | - * @typedef {WPIcon} WPBlockTypeIconRender | |
| 6425 | - */ | |
| 6426 | - | |
| 6427 | -/** | |
| 6428 | - * An object describing a normalized block type icon. | |
| 6429 | - * | |
| 6430 | - * @typedef {Object} WPBlockTypeIconDescriptor | |
| 6431 | - * | |
| 6432 | - * @property {WPBlockTypeIconRender} src Render behavior of the icon, | |
| 6433 | - * one of a Dashicon slug, an | |
| 6434 | - * element, or a component. | |
| 6435 | - * @property {string} background Optimal background hex string | |
| 6436 | - * color when displaying icon. | |
| 6437 | - * @property {string} foreground Optimal foreground hex string | |
| 6438 | - * color when displaying icon. | |
| 6439 | - * @property {string} shadowColor Optimal shadow hex string | |
| 6440 | - * color when displaying icon. | |
| 6441 | - */ | |
| 6442 | - | |
| 6443 | -/** | |
| 6444 | - * Value to use to render the icon for a block type in an editor interface, | |
| 6445 | - * either a Dashicon slug, an element, a component, or an object describing | |
| 6446 | - * the icon. | |
| 6447 | - * | |
| 6448 | - * @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon | |
| 6449 | - */ | |
| 6450 | - | |
| 6451 | -/** | |
| 6452 | - * Named block variation scopes. | |
| 6453 | - * | |
| 6454 | - * @typedef {'block'|'inserter'|'transform'} WPBlockVariationScope | |
| 6455 | - */ | |
| 6456 | - | |
| 6457 | -/** | |
| 6458 | - * An object describing a variation defined for the block type. | |
| 6459 | - * | |
| 6460 | - * @typedef {Object} WPBlockVariation | |
| 6461 | - * | |
| 6462 | - * @property {string} name The unique and machine-readable name. | |
| 6463 | - * @property {string} title A human-readable variation title. | |
| 6464 | - * @property {string} [description] A detailed variation description. | |
| 6465 | - * @property {string} [category] Block type category classification, | |
| 6466 | - * used in search interfaces to arrange | |
| 6467 | - * block types by category. | |
| 6468 | - * @property {WPIcon} [icon] An icon helping to visualize the variation. | |
| 6469 | - * @property {boolean} [isDefault] Indicates whether the current variation is | |
| 6470 | - * the default one. Defaults to `false`. | |
| 6471 | - * @property {Object} [attributes] Values which override block attributes. | |
| 6472 | - * @property {Array[]} [innerBlocks] Initial configuration of nested blocks. | |
| 6473 | - * @property {Object} [example] Example provides structured data for | |
| 6474 | - * the block preview. You can set to | |
| 6475 | - * `undefined` to disable the preview shown | |
| 6476 | - * for the block type. | |
| 6477 | - * @property {WPBlockVariationScope[]} [scope] The list of scopes where the variation | |
| 6478 | - * is applicable. When not provided, it | |
| 6479 | - * assumes all available scopes. | |
| 6480 | - * @property {string[]} [keywords] An array of terms (which can be translated) | |
| 6481 | - * that help users discover the variation | |
| 6482 | - * while searching. | |
| 6483 | - * @property {Function|string[]} [isActive] This can be a function or an array of block attributes. | |
| 6484 | - * Function that accepts a block's attributes and the | |
| 6485 | - * variation's attributes and determines if a variation is active. | |
| 6486 | - * This function doesn't try to find a match dynamically based | |
| 6487 | - * on all block's attributes, as in many cases some attributes are irrelevant. | |
| 6488 | - * An example would be for `embed` block where we only care | |
| 6489 | - * about `providerNameSlug` attribute's value. | |
| 6490 | - * We can also use a `string[]` to tell which attributes | |
| 6491 | - * should be compared as a shorthand. Each attributes will | |
| 6492 | - * be matched and the variation will be active if all of them are matching. | |
| 6493 | - */ | |
| 6494 | - | |
| 6495 | -/** | |
| 6496 | - * Defined behavior of a block type. | |
| 6497 | - * | |
| 6498 | - * @typedef {Object} WPBlockType | |
| 6499 | - * | |
| 6500 | - * @property {string} name Block type's namespaced name. | |
| 6501 | - * @property {string} title Human-readable block type label. | |
| 6502 | - * @property {string} [description] A detailed block type description. | |
| 6503 | - * @property {string} [category] Block type category classification, | |
| 6504 | - * used in search interfaces to arrange | |
| 6505 | - * block types by category. | |
| 6506 | - * @property {WPBlockTypeIcon} [icon] Block type icon. | |
| 6507 | - * @property {string[]} [keywords] Additional keywords to produce block | |
| 6508 | - * type as result in search interfaces. | |
| 6509 | - * @property {Object} [attributes] Block type attributes. | |
| 6510 | - * @property {WPComponent} [save] Optional component describing | |
| 6511 | - * serialized markup structure of a | |
| 6512 | - * block type. | |
| 6513 | - * @property {WPComponent} edit Component rendering an element to | |
| 6514 | - * manipulate the attributes of a block | |
| 6515 | - * in the context of an editor. | |
| 6516 | - * @property {WPBlockVariation[]} [variations] The list of block variations. | |
| 6517 | - * @property {Object} [example] Example provides structured data for | |
| 6518 | - * the block preview. When not defined | |
| 6519 | - * then no preview is shown. | |
| 6520 | - */ | |
| 6521 | - | |
| 6522 | -const serverSideBlockDefinitions = {}; | |
| 6523 | -/** | |
| 6524 | - * Sets the server side block definition of blocks. | |
| 6525 | - * | |
| 6526 | - * @param {Object} definitions Server-side block definitions | |
| 6527 | - */ | |
| 6528 | -// eslint-disable-next-line camelcase | |
| 6529 | - | |
| 6530 | -function unstable__bootstrapServerSideBlockDefinitions(definitions) { | |
| 6531 | - for (const blockName of Object.keys(definitions)) { | |
| 6532 | - // Don't overwrite if already set. It covers the case when metadata | |
| 6533 | - // was initialized from the server. | |
| 6534 | - if (serverSideBlockDefinitions[blockName]) { | |
| 6535 | - // We still need to polyfill `apiVersion` for WordPress version | |
| 6536 | - // lower than 5.7. If it isn't present in the definition shared | |
| 6537 | - // from the server, we try to fallback to the definition passed. | |
| 6538 | - // @see https://github.com/WordPress/gutenberg/pull/29279 | |
| 6539 | - if (serverSideBlockDefinitions[blockName].apiVersion === undefined && definitions[blockName].apiVersion) { | |
| 6540 | - serverSideBlockDefinitions[blockName].apiVersion = definitions[blockName].apiVersion; | |
| 6541 | - } | |
| 6542 | - | |
| 6543 | - continue; | |
| 6544 | - } | |
| 6545 | - | |
| 6546 | - serverSideBlockDefinitions[blockName] = (0,external_lodash_namespaceObject.mapKeys)((0,external_lodash_namespaceObject.pickBy)(definitions[blockName], value => !(0,external_lodash_namespaceObject.isNil)(value)), (value, key) => (0,external_lodash_namespaceObject.camelCase)(key)); | |
| 6547 | - } | |
| 6548 | -} | |
| 6549 | -/** | |
| 6550 | - * Gets block settings from metadata loaded from `block.json` file. | |
| 6551 | - * | |
| 6552 | - * @param {Object} metadata Block metadata loaded from `block.json`. | |
| 6553 | - * @param {string} metadata.textdomain Textdomain to use with translations. | |
| 6554 | - * | |
| 6555 | - * @return {Object} Block settings. | |
| 6556 | - */ | |
| 6557 | - | |
| 6558 | -function getBlockSettingsFromMetadata(_ref) { | |
| 6559 | - let { | |
| 6560 | - textdomain, | |
| 6561 | - ...metadata | |
| 6562 | - } = _ref; | |
| 6563 | - const allowedFields = ['apiVersion', 'title', 'category', 'parent', 'icon', 'description', 'keywords', 'attributes', 'providesContext', 'usesContext', 'supports', 'styles', 'example', 'variations']; | |
| 6564 | - const settings = (0,external_lodash_namespaceObject.pick)(metadata, allowedFields); | |
| 6565 | - | |
| 6566 | - if (textdomain) { | |
| 6567 | - Object.keys(i18nBlockSchema).forEach(key => { | |
| 6568 | - if (!settings[key]) { | |
| 6569 | - return; | |
| 6570 | - } | |
| 6571 | - | |
| 6572 | - settings[key] = translateBlockSettingUsingI18nSchema(i18nBlockSchema[key], settings[key], textdomain); | |
| 6573 | - }); | |
| 6574 | - } | |
| 6575 | - | |
| 6576 | - return settings; | |
| 6577 | -} | |
| 6578 | -/** | |
| 6579 | - * Registers a new block provided a unique name and an object defining its | |
| 6580 | - * behavior. Once registered, the block is made available as an option to any | |
| 6581 | - * editor interface where blocks are implemented. | |
| 6582 | - * | |
| 6583 | - * @param {string|Object} blockNameOrMetadata Block type name or its metadata. | |
| 6584 | - * @param {Object} settings Block settings. | |
| 6585 | - * | |
| 6586 | - * @return {?WPBlockType} The block, if it has been successfully registered; | |
| 6587 | - * otherwise `undefined`. | |
| 6588 | - */ | |
| 6589 | - | |
| 6590 | - | |
| 6591 | -function registerBlockType(blockNameOrMetadata, settings) { | |
| 6592 | - const name = (0,external_lodash_namespaceObject.isObject)(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata; | |
| 6593 | - | |
| 6594 | - if (typeof name !== 'string') { | |
| 6595 | - console.error('Block names must be strings.'); | |
| 6596 | - return; | |
| 6597 | - } | |
| 6598 | - | |
| 6599 | - if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) { | |
| 6600 | - 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'); | |
| 6601 | - return; | |
| 6602 | - } | |
| 6603 | - | |
| 6604 | - if ((0,external_wp_data_namespaceObject.select)(store).getBlockType(name)) { | |
| 6605 | - console.error('Block "' + name + '" is already registered.'); | |
| 6606 | - return; | |
| 6607 | - } | |
| 6608 | - | |
| 6609 | - if ((0,external_lodash_namespaceObject.isObject)(blockNameOrMetadata)) { | |
| 6610 | - unstable__bootstrapServerSideBlockDefinitions({ | |
| 6611 | - [name]: getBlockSettingsFromMetadata(blockNameOrMetadata) | |
| 6612 | - }); | |
| 6613 | - } | |
| 6614 | - | |
| 6615 | - const blockType = { | |
| 6616 | - name, | |
| 6617 | - icon: BLOCK_ICON_DEFAULT, | |
| 6618 | - keywords: [], | |
| 6619 | - attributes: {}, | |
| 6620 | - providesContext: {}, | |
| 6621 | - usesContext: [], | |
| 6622 | - supports: {}, | |
| 6623 | - styles: [], | |
| 6624 | - variations: [], | |
| 6625 | - save: () => null, | |
| 6626 | - ...(serverSideBlockDefinitions === null || serverSideBlockDefinitions === void 0 ? void 0 : serverSideBlockDefinitions[name]), | |
| 6627 | - ...settings | |
| 6628 | - }; | |
| 6629 | - | |
| 6630 | - (0,external_wp_data_namespaceObject.dispatch)(store).__experimentalRegisterBlockType(blockType); | |
| 6631 | - | |
| 6632 | - return (0,external_wp_data_namespaceObject.select)(store).getBlockType(name); | |
| 6633 | -} | |
| 6634 | -/** | |
| 6635 | - * Translates block settings provided with metadata using the i18n schema. | |
| 6636 | - * | |
| 6637 | - * @param {string|string[]|Object[]} i18nSchema I18n schema for the block setting. | |
| 6638 | - * @param {string|string[]|Object[]} settingValue Value for the block setting. | |
| 6639 | - * @param {string} textdomain Textdomain to use with translations. | |
| 6640 | - * | |
| 6641 | - * @return {string|string[]|Object[]} Translated setting. | |
| 6642 | - */ | |
| 6643 | - | |
| 6644 | -function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) { | |
| 6645 | - if ((0,external_lodash_namespaceObject.isString)(i18nSchema) && (0,external_lodash_namespaceObject.isString)(settingValue)) { | |
| 6646 | - // eslint-disable-next-line @wordpress/i18n-no-variables, @wordpress/i18n-text-domain | |
| 6647 | - return (0,external_wp_i18n_namespaceObject._x)(settingValue, i18nSchema, textdomain); | |
| 6648 | - } | |
| 6649 | - | |
| 6650 | - if ((0,external_lodash_namespaceObject.isArray)(i18nSchema) && !(0,external_lodash_namespaceObject.isEmpty)(i18nSchema) && (0,external_lodash_namespaceObject.isArray)(settingValue)) { | |
| 6651 | - return settingValue.map(value => translateBlockSettingUsingI18nSchema(i18nSchema[0], value, textdomain)); | |
| 6652 | - } | |
| 6653 | - | |
| 6654 | - if ((0,external_lodash_namespaceObject.isObject)(i18nSchema) && !(0,external_lodash_namespaceObject.isEmpty)(i18nSchema) && (0,external_lodash_namespaceObject.isObject)(settingValue)) { | |
| 6655 | - return Object.keys(settingValue).reduce((accumulator, key) => { | |
| 6656 | - if (!i18nSchema[key]) { | |
| 6657 | - accumulator[key] = settingValue[key]; | |
| 6658 | - return accumulator; | |
| 6659 | - } | |
| 6660 | - | |
| 6661 | - accumulator[key] = translateBlockSettingUsingI18nSchema(i18nSchema[key], settingValue[key], textdomain); | |
| 6662 | - return accumulator; | |
| 6663 | - }, {}); | |
| 6664 | - } | |
| 6665 | - | |
| 6666 | - return settingValue; | |
| 6667 | -} | |
| 6668 | -/** | |
| 6669 | - * Registers a new block collection to group blocks in the same namespace in the inserter. | |
| 6670 | - * | |
| 6671 | - * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace. | |
| 6672 | - * @param {Object} settings The block collection settings. | |
| 6673 | - * @param {string} settings.title The title to display in the block inserter. | |
| 6674 | - * @param {Object} [settings.icon] The icon to display in the block inserter. | |
| 6675 | - */ | |
| 6676 | - | |
| 6677 | - | |
| 6678 | -function registerBlockCollection(namespace, _ref2) { | |
| 6679 | - let { | |
| 6680 | - title, | |
| 6681 | - icon | |
| 6682 | - } = _ref2; | |
| 6683 | - (0,external_wp_data_namespaceObject.dispatch)(store).addBlockCollection(namespace, title, icon); | |
| 6684 | -} | |
| 6685 | -/** | |
| 6686 | - * Unregisters a block collection | |
| 6687 | - * | |
| 6688 | - * @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace | |
| 6689 | - * | |
| 6690 | - */ | |
| 6691 | - | |
| 6692 | -function unregisterBlockCollection(namespace) { | |
| 6693 | - dispatch(blocksStore).removeBlockCollection(namespace); | |
| 6694 | -} | |
| 6695 | -/** | |
| 6696 | - * Unregisters a block. | |
| 6697 | - * | |
| 6698 | - * @param {string} name Block name. | |
| 6699 | - * | |
| 6700 | - * @return {?WPBlockType} The previous block value, if it has been successfully | |
| 6701 | - * unregistered; otherwise `undefined`. | |
| 6702 | - */ | |
| 6703 | - | |
| 6704 | -function unregisterBlockType(name) { | |
| 6705 | - const oldBlock = (0,external_wp_data_namespaceObject.select)(store).getBlockType(name); | |
| 6706 | - | |
| 6707 | - if (!oldBlock) { | |
| 6708 | - console.error('Block "' + name + '" is not registered.'); | |
| 6709 | - return; | |
| 6710 | - } | |
| 6711 | - | |
| 6712 | - (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockTypes(name); | |
| 6713 | - return oldBlock; | |
| 6714 | -} | |
| 6715 | -/** | |
| 6716 | - * Assigns name of block for handling non-block content. | |
| 6717 | - * | |
| 6718 | - * @param {string} blockName Block name. | |
| 6719 | - */ | |
| 6720 | - | |
| 6721 | -function setFreeformContentHandlerName(blockName) { | |
| 6722 | - (0,external_wp_data_namespaceObject.dispatch)(store).setFreeformFallbackBlockName(blockName); | |
| 6723 | -} | |
| 6724 | -/** | |
| 6725 | - * Retrieves name of block handling non-block content, or undefined if no | |
| 6726 | - * handler has been defined. | |
| 6727 | - * | |
| 6728 | - * @return {?string} Block name. | |
| 6729 | - */ | |
| 6730 | - | |
| 6731 | -function getFreeformContentHandlerName() { | |
| 6732 | - return (0,external_wp_data_namespaceObject.select)(store).getFreeformFallbackBlockName(); | |
| 6733 | -} | |
| 6734 | -/** | |
| 6735 | - * Retrieves name of block used for handling grouping interactions. | |
| 6736 | - * | |
| 6737 | - * @return {?string} Block name. | |
| 6738 | - */ | |
| 6739 | - | |
| 6740 | -function registration_getGroupingBlockName() { | |
| 6741 | - return (0,external_wp_data_namespaceObject.select)(store).getGroupingBlockName(); | |
| 6742 | -} | |
| 6743 | -/** | |
| 6744 | - * Assigns name of block handling unregistered block types. | |
| 6745 | - * | |
| 6746 | - * @param {string} blockName Block name. | |
| 6747 | - */ | |
| 6748 | - | |
| 6749 | -function setUnregisteredTypeHandlerName(blockName) { | |
| 6750 | - (0,external_wp_data_namespaceObject.dispatch)(store).setUnregisteredFallbackBlockName(blockName); | |
| 6751 | -} | |
| 6752 | -/** | |
| 6753 | - * Retrieves name of block handling unregistered block types, or undefined if no | |
| 6754 | - * handler has been defined. | |
| 6755 | - * | |
| 6756 | - * @return {?string} Block name. | |
| 6757 | - */ | |
| 6758 | - | |
| 6759 | -function getUnregisteredTypeHandlerName() { | |
| 6760 | - return (0,external_wp_data_namespaceObject.select)(store).getUnregisteredFallbackBlockName(); | |
| 6761 | -} | |
| 6762 | -/** | |
| 6763 | - * Assigns the default block name. | |
| 6764 | - * | |
| 6765 | - * @param {string} name Block name. | |
| 6766 | - */ | |
| 6767 | - | |
| 6768 | -function setDefaultBlockName(name) { | |
| 6769 | - (0,external_wp_data_namespaceObject.dispatch)(store).setDefaultBlockName(name); | |
| 6770 | -} | |
| 6771 | -/** | |
| 6772 | - * Assigns name of block for handling block grouping interactions. | |
| 6773 | - * | |
| 6774 | - * @param {string} name Block name. | |
| 6775 | - */ | |
| 6776 | - | |
| 6777 | -function setGroupingBlockName(name) { | |
| 6778 | - (0,external_wp_data_namespaceObject.dispatch)(store).setGroupingBlockName(name); | |
| 6779 | -} | |
| 6780 | -/** | |
| 6781 | - * Retrieves the default block name. | |
| 6782 | - * | |
| 6783 | - * @return {?string} Block name. | |
| 6784 | - */ | |
| 6785 | - | |
| 6786 | -function registration_getDefaultBlockName() { | |
| 6787 | - return (0,external_wp_data_namespaceObject.select)(store).getDefaultBlockName(); | |
| 6788 | -} | |
| 6789 | -/** | |
| 6790 | - * Returns a registered block type. | |
| 6791 | - * | |
| 6792 | - * @param {string} name Block name. | |
| 6793 | - * | |
| 6794 | - * @return {?Object} Block type. | |
| 6795 | - */ | |
| 6796 | - | |
| 6797 | -function registration_getBlockType(name) { | |
| 6798 | - var _select; | |
| 6799 | - | |
| 6800 | - return (_select = (0,external_wp_data_namespaceObject.select)(store)) === null || _select === void 0 ? void 0 : _select.getBlockType(name); | |
| 6801 | -} | |
| 6802 | -/** | |
| 6803 | - * Returns all registered blocks. | |
| 6804 | - * | |
| 6805 | - * @return {Array} Block settings. | |
| 6806 | - */ | |
| 6807 | - | |
| 6808 | -function registration_getBlockTypes() { | |
| 6809 | - return (0,external_wp_data_namespaceObject.select)(store).getBlockTypes(); | |
| 6810 | -} | |
| 6811 | -/** | |
| 6812 | - * Returns the block support value for a feature, if defined. | |
| 6813 | - * | |
| 6814 | - * @param {(string|Object)} nameOrType Block name or type object | |
| 6815 | - * @param {string} feature Feature to retrieve | |
| 6816 | - * @param {*} defaultSupports Default value to return if not | |
| 6817 | - * explicitly defined | |
| 6818 | - * | |
| 6819 | - * @return {?*} Block support value | |
| 6820 | - */ | |
| 6821 | - | |
| 6822 | -function registration_getBlockSupport(nameOrType, feature, defaultSupports) { | |
| 6823 | - return (0,external_wp_data_namespaceObject.select)(store).getBlockSupport(nameOrType, feature, defaultSupports); | |
| 6824 | -} | |
| 6825 | -/** | |
| 6826 | - * Returns true if the block defines support for a feature, or false otherwise. | |
| 6827 | - * | |
| 6828 | - * @param {(string|Object)} nameOrType Block name or type object. | |
| 6829 | - * @param {string} feature Feature to test. | |
| 6830 | - * @param {boolean} defaultSupports Whether feature is supported by | |
| 6831 | - * default if not explicitly defined. | |
| 6832 | - * | |
| 6833 | - * @return {boolean} Whether block supports feature. | |
| 6834 | - */ | |
| 6835 | - | |
| 6836 | -function registration_hasBlockSupport(nameOrType, feature, defaultSupports) { | |
| 6837 | - return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports); | |
| 6838 | -} | |
| 6839 | -/** | |
| 6840 | - * Determines whether or not the given block is a reusable block. This is a | |
| 6841 | - * special block type that is used to point to a global block stored via the | |
| 6842 | - * API. | |
| 6843 | - * | |
| 6844 | - * @param {Object} blockOrType Block or Block Type to test. | |
| 6845 | - * | |
| 6846 | - * @return {boolean} Whether the given block is a reusable block. | |
| 6847 | - */ | |
| 6848 | - | |
| 6849 | -function isReusableBlock(blockOrType) { | |
| 6850 | - return (blockOrType === null || blockOrType === void 0 ? void 0 : blockOrType.name) === 'core/block'; | |
| 6851 | -} | |
| 6852 | -/** | |
| 6853 | - * Determines whether or not the given block is a template part. This is a | |
| 6854 | - * special block type that allows composing a page template out of reusable | |
| 6855 | - * design elements. | |
| 6856 | - * | |
| 6857 | - * @param {Object} blockOrType Block or Block Type to test. | |
| 6858 | - * | |
| 6859 | - * @return {boolean} Whether the given block is a template part. | |
| 6860 | - */ | |
| 6861 | - | |
| 6862 | -function isTemplatePart(blockOrType) { | |
| 6863 | - return blockOrType.name === 'core/template-part'; | |
| 6864 | -} | |
| 6865 | -/** | |
| 6866 | - * Returns an array with the child blocks of a given block. | |
| 6867 | - * | |
| 6868 | - * @param {string} blockName Name of block (example: “latest-posts”). | |
| 6869 | - * | |
| 6870 | - * @return {Array} Array of child block names. | |
| 6871 | - */ | |
| 6872 | - | |
| 6873 | -const registration_getChildBlockNames = blockName => { | |
| 6874 | - return (0,external_wp_data_namespaceObject.select)(store).getChildBlockNames(blockName); | |
| 6875 | -}; | |
| 6876 | -/** | |
| 6877 | - * Returns a boolean indicating if a block has child blocks or not. | |
| 6878 | - * | |
| 6879 | - * @param {string} blockName Name of block (example: “latest-posts”). | |
| 6880 | - * | |
| 6881 | - * @return {boolean} True if a block contains child blocks and false otherwise. | |
| 6882 | - */ | |
| 6883 | - | |
| 6884 | -const registration_hasChildBlocks = blockName => { | |
| 6885 | - return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocks(blockName); | |
| 6886 | -}; | |
| 6887 | -/** | |
| 6888 | - * Returns a boolean indicating if a block has at least one child block with inserter support. | |
| 6889 | - * | |
| 6890 | - * @param {string} blockName Block type name. | |
| 6891 | - * | |
| 6892 | - * @return {boolean} True if a block contains at least one child blocks with inserter support | |
| 6893 | - * and false otherwise. | |
| 6894 | - */ | |
| 6895 | - | |
| 6896 | -const registration_hasChildBlocksWithInserterSupport = blockName => { | |
| 6897 | - return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocksWithInserterSupport(blockName); | |
| 6898 | -}; | |
| 6899 | -/** | |
| 6900 | - * Registers a new block style variation for the given block. | |
| 6901 | - * | |
| 6902 | - * @param {string} blockName Name of block (example: “core/latest-posts”). | |
| 6903 | - * @param {Object} styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user. | |
| 6904 | - */ | |
| 6905 | - | |
| 6906 | -const registerBlockStyle = (blockName, styleVariation) => { | |
| 6907 | - (0,external_wp_data_namespaceObject.dispatch)(store).addBlockStyles(blockName, styleVariation); | |
| 6908 | -}; | |
| 6909 | -/** | |
| 6910 | - * Unregisters a block style variation for the given block. | |
| 6911 | - * | |
| 6912 | - * @param {string} blockName Name of block (example: “core/latest-posts”). | |
| 6913 | - * @param {string} styleVariationName Name of class applied to the block. | |
| 6914 | - */ | |
| 6915 | - | |
| 6916 | -const unregisterBlockStyle = (blockName, styleVariationName) => { | |
| 6917 | - (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockStyles(blockName, styleVariationName); | |
| 6918 | -}; | |
| 6919 | -/** | |
| 6920 | - * Returns an array with the variations of a given block type. | |
| 6921 | - * | |
| 6922 | - * @param {string} blockName Name of block (example: “core/columns”). | |
| 6923 | - * @param {WPBlockVariationScope} [scope] Block variation scope name. | |
| 6924 | - * | |
| 6925 | - * @return {(WPBlockVariation[]|void)} Block variations. | |
| 6926 | - */ | |
| 6927 | - | |
| 6928 | -const registration_getBlockVariations = (blockName, scope) => { | |
| 6929 | - return (0,external_wp_data_namespaceObject.select)(store).getBlockVariations(blockName, scope); | |
| 6930 | -}; | |
| 6931 | -/** | |
| 6932 | - * Registers a new block variation for the given block type. | |
| 6933 | - * | |
| 6934 | - * @param {string} blockName Name of the block (example: “core/columns”). | |
| 6935 | - * @param {WPBlockVariation} variation Object describing a block variation. | |
| 6936 | - */ | |
| 6937 | - | |
| 6938 | -const registerBlockVariation = (blockName, variation) => { | |
| 6939 | - (0,external_wp_data_namespaceObject.dispatch)(store).addBlockVariations(blockName, variation); | |
| 6940 | -}; | |
| 6941 | -/** | |
| 6942 | - * Unregisters a block variation defined for the given block type. | |
| 6943 | - * | |
| 6944 | - * @param {string} blockName Name of the block (example: “core/columns”). | |
| 6945 | - * @param {string} variationName Name of the variation defined for the block. | |
| 6946 | - */ | |
| 6947 | - | |
| 6948 | -const unregisterBlockVariation = (blockName, variationName) => { | |
| 6949 | - (0,external_wp_data_namespaceObject.dispatch)(store).removeBlockVariations(blockName, variationName); | |
| 6950 | -}; | |
| 6951 | -//# sourceMappingURL=registration.js.map | |
| 6952 | -;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js | |
| 6953 | -// Unique ID creation requires a high quality random # generator. In the browser we therefore | |
| 6954 | -// require the crypto API and do not support built-in fallback to lower quality random number | |
| 6955 | -// generators (like Math.random()). | |
| 6956 | -// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, | |
| 6957 | -// find the complete implementation of crypto (msCrypto) on IE11. | |
| 6958 | -var getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); | |
| 6959 | -var rnds8 = new Uint8Array(16); | |
| 6960 | -function rng() { | |
| 6961 | - if (!getRandomValues) { | |
| 6962 | - throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); | |
| 6963 | - } | |
| 6964 | - | |
| 6965 | - return getRandomValues(rnds8); | |
| 6966 | -} | |
| 6967 | -;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js | |
| 6968 | -/* 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); | |
| 6969 | -;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js | |
| 6970 | - | |
| 6971 | - | |
| 6972 | -function validate(uuid) { | |
| 6973 | - return typeof uuid === 'string' && regex.test(uuid); | |
| 6974 | -} | |
| 6975 | - | |
| 6976 | -/* harmony default export */ var esm_browser_validate = (validate); | |
| 6977 | -;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js | |
| 6978 | - | |
| 6979 | -/** | |
| 6980 | - * Convert array of 16 byte values to UUID string format of the form: | |
| 6981 | - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX | |
| 6982 | - */ | |
| 6983 | - | |
| 6984 | -var byteToHex = []; | |
| 6985 | - | |
| 6986 | -for (var stringify_i = 0; stringify_i < 256; ++stringify_i) { | |
| 6987 | - byteToHex.push((stringify_i + 0x100).toString(16).substr(1)); | |
| 6988 | -} | |
| 6989 | - | |
| 6990 | -function stringify(arr) { | |
| 6991 | - var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| 6992 | - // Note: Be careful editing this code! It's been tuned for performance | |
| 6993 | - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 | |
| 6994 | - 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 | |
| 6995 | - // of the following: | |
| 6996 | - // - One or more input array values don't map to a hex octet (leading to | |
| 6997 | - // "undefined" in the uuid) | |
| 6998 | - // - Invalid input values for the RFC `version` or `variant` fields | |
| 6999 | - | |
| 7000 | - if (!esm_browser_validate(uuid)) { | |
| 7001 | - throw TypeError('Stringified UUID is invalid'); | |
| 7002 | - } | |
| 7003 | - | |
| 7004 | - return uuid; | |
| 7005 | -} | |
| 7006 | - | |
| 7007 | -/* harmony default export */ var esm_browser_stringify = (stringify); | |
| 7008 | -;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js | |
| 7009 | - | |
| 7010 | - | |
| 7011 | - | |
| 7012 | -function v4(options, buf, offset) { | |
| 7013 | - options = options || {}; | |
| 7014 | - var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` | |
| 7015 | - | |
| 7016 | - rnds[6] = rnds[6] & 0x0f | 0x40; | |
| 7017 | - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided | |
| 7018 | - | |
| 7019 | - if (buf) { | |
| 7020 | - offset = offset || 0; | |
| 7021 | - | |
| 7022 | - for (var i = 0; i < 16; ++i) { | |
| 7023 | - buf[offset + i] = rnds[i]; | |
| 7024 | - } | |
| 7025 | - | |
| 7026 | - return buf; | |
| 7027 | - } | |
| 7028 | - | |
| 7029 | - return esm_browser_stringify(rnds); | |
| 7030 | -} | |
| 7031 | - | |
| 7032 | -/* harmony default export */ var esm_browser_v4 = (v4); | |
| 7033 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/factory.js | |
| 7034 | -/** | |
| 7035 | - * External dependencies | |
| 7036 | - */ | |
| 7037 | - | |
| 7038 | - | |
| 7039 | -/** | |
| 7040 | - * WordPress dependencies | |
| 7041 | - */ | |
| 7042 | - | |
| 7043 | - | |
| 7044 | -/** | |
| 7045 | - * Internal dependencies | |
| 7046 | - */ | |
| 7047 | - | |
| 7048 | - | |
| 7049 | - | |
| 7050 | -/** | |
| 7051 | - * Returns a block object given its type and attributes. | |
| 7052 | - * | |
| 7053 | - * @param {string} name Block name. | |
| 7054 | - * @param {Object} attributes Block attributes. | |
| 7055 | - * @param {?Array} innerBlocks Nested blocks. | |
| 7056 | - * | |
| 7057 | - * @return {Object} Block object. | |
| 7058 | - */ | |
| 7059 | - | |
| 7060 | -function createBlock(name) { | |
| 7061 | - let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 7062 | - let innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | |
| 7063 | - | |
| 7064 | - const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, attributes); | |
| 7065 | - | |
| 7066 | - const clientId = esm_browser_v4(); // Blocks are stored with a unique ID, the assigned type name, the block | |
| 7067 | - // attributes, and their inner blocks. | |
| 7068 | - | |
| 7069 | - return { | |
| 7070 | - clientId, | |
| 7071 | - name, | |
| 7072 | - isValid: true, | |
| 7073 | - attributes: sanitizedAttributes, | |
| 7074 | - innerBlocks | |
| 7075 | - }; | |
| 7076 | -} | |
| 7077 | -/** | |
| 7078 | - * Given an array of InnerBlocks templates or Block Objects, | |
| 7079 | - * returns an array of created Blocks from them. | |
| 7080 | - * It handles the case of having InnerBlocks as Blocks by | |
| 7081 | - * converting them to the proper format to continue recursively. | |
| 7082 | - * | |
| 7083 | - * @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates. | |
| 7084 | - * | |
| 7085 | - * @return {Object[]} Array of Block objects. | |
| 7086 | - */ | |
| 7087 | - | |
| 7088 | -function createBlocksFromInnerBlocksTemplate() { | |
| 7089 | - let innerBlocksOrTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | |
| 7090 | - return innerBlocksOrTemplate.map(innerBlock => { | |
| 7091 | - const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks]; | |
| 7092 | - const [name, attributes, innerBlocks = []] = innerBlockTemplate; | |
| 7093 | - return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks)); | |
| 7094 | - }); | |
| 7095 | -} | |
| 7096 | -/** | |
| 7097 | - * Given a block object, returns a copy of the block object while sanitizing its attributes, | |
| 7098 | - * optionally merging new attributes and/or replacing its inner blocks. | |
| 7099 | - * | |
| 7100 | - * @param {Object} block Block instance. | |
| 7101 | - * @param {Object} mergeAttributes Block attributes. | |
| 7102 | - * @param {?Array} newInnerBlocks Nested blocks. | |
| 7103 | - * | |
| 7104 | - * @return {Object} A cloned block. | |
| 7105 | - */ | |
| 7106 | - | |
| 7107 | -function __experimentalCloneSanitizedBlock(block) { | |
| 7108 | - let mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 7109 | - let newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined; | |
| 7110 | - const clientId = esm_browser_v4(); | |
| 7111 | - | |
| 7112 | - const sanitizedAttributes = __experimentalSanitizeBlockAttributes(block.name, { ...block.attributes, | |
| 7113 | - ...mergeAttributes | |
| 7114 | - }); | |
| 7115 | - | |
| 7116 | - return { ...block, | |
| 7117 | - clientId, | |
| 7118 | - attributes: sanitizedAttributes, | |
| 7119 | - innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => __experimentalCloneSanitizedBlock(innerBlock)) | |
| 7120 | - }; | |
| 7121 | -} | |
| 7122 | -/** | |
| 7123 | - * Given a block object, returns a copy of the block object, | |
| 7124 | - * optionally merging new attributes and/or replacing its inner blocks. | |
| 7125 | - * | |
| 7126 | - * @param {Object} block Block instance. | |
| 7127 | - * @param {Object} mergeAttributes Block attributes. | |
| 7128 | - * @param {?Array} newInnerBlocks Nested blocks. | |
| 7129 | - * | |
| 7130 | - * @return {Object} A cloned block. | |
| 7131 | - */ | |
| 7132 | - | |
| 7133 | -function cloneBlock(block) { | |
| 7134 | - let mergeAttributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 7135 | - let newInnerBlocks = arguments.length > 2 ? arguments[2] : undefined; | |
| 7136 | - const clientId = esm_browser_v4(); | |
| 7137 | - return { ...block, | |
| 7138 | - clientId, | |
| 7139 | - attributes: { ...block.attributes, | |
| 7140 | - ...mergeAttributes | |
| 7141 | - }, | |
| 7142 | - innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => cloneBlock(innerBlock)) | |
| 7143 | - }; | |
| 7144 | -} | |
| 7145 | -/** | |
| 7146 | - * Returns a boolean indicating whether a transform is possible based on | |
| 7147 | - * various bits of context. | |
| 7148 | - * | |
| 7149 | - * @param {Object} transform The transform object to validate. | |
| 7150 | - * @param {string} direction Is this a 'from' or 'to' transform. | |
| 7151 | - * @param {Array} blocks The blocks to transform from. | |
| 7152 | - * | |
| 7153 | - * @return {boolean} Is the transform possible? | |
| 7154 | - */ | |
| 7155 | - | |
| 7156 | -const isPossibleTransformForSource = (transform, direction, blocks) => { | |
| 7157 | - if ((0,external_lodash_namespaceObject.isEmpty)(blocks)) { | |
| 7158 | - return false; | |
| 7159 | - } // If multiple blocks are selected, only multi block transforms | |
| 7160 | - // or wildcard transforms are allowed. | |
| 7161 | - | |
| 7162 | - | |
| 7163 | - const isMultiBlock = blocks.length > 1; | |
| 7164 | - const firstBlockName = (0,external_lodash_namespaceObject.first)(blocks).name; | |
| 7165 | - const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; | |
| 7166 | - | |
| 7167 | - if (!isValidForMultiBlocks) { | |
| 7168 | - return false; | |
| 7169 | - } // Check non-wildcard transforms to ensure that transform is valid | |
| 7170 | - // for a block selection of multiple blocks of different types | |
| 7171 | - | |
| 7172 | - | |
| 7173 | - if (!isWildcardBlockTransform(transform) && !(0,external_lodash_namespaceObject.every)(blocks, { | |
| 7174 | - name: firstBlockName | |
| 7175 | - })) { | |
| 7176 | - return false; | |
| 7177 | - } // Only consider 'block' type transforms as valid. | |
| 7178 | - | |
| 7179 | - | |
| 7180 | - const isBlockType = transform.type === 'block'; | |
| 7181 | - | |
| 7182 | - if (!isBlockType) { | |
| 7183 | - return false; | |
| 7184 | - } // Check if the transform's block name matches the source block (or is a wildcard) | |
| 7185 | - // only if this is a transform 'from'. | |
| 7186 | - | |
| 7187 | - | |
| 7188 | - const sourceBlock = (0,external_lodash_namespaceObject.first)(blocks); | |
| 7189 | - const hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); | |
| 7190 | - | |
| 7191 | - if (!hasMatchingName) { | |
| 7192 | - return false; | |
| 7193 | - } // Don't allow single Grouping blocks to be transformed into | |
| 7194 | - // a Grouping block. | |
| 7195 | - | |
| 7196 | - | |
| 7197 | - if (!isMultiBlock && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) { | |
| 7198 | - return false; | |
| 7199 | - } // If the transform has a `isMatch` function specified, check that it returns true. | |
| 7200 | - | |
| 7201 | - | |
| 7202 | - if ((0,external_lodash_namespaceObject.isFunction)(transform.isMatch)) { | |
| 7203 | - const attributes = transform.isMultiBlock ? blocks.map(block => block.attributes) : sourceBlock.attributes; | |
| 7204 | - const block = transform.isMultiBlock ? blocks : sourceBlock; | |
| 7205 | - | |
| 7206 | - if (!transform.isMatch(attributes, block)) { | |
| 7207 | - return false; | |
| 7208 | - } | |
| 7209 | - } | |
| 7210 | - | |
| 7211 | - if (transform.usingMobileTransformations && isWildcardBlockTransform(transform) && !isContainerGroupBlock(sourceBlock.name)) { | |
| 7212 | - return false; | |
| 7213 | - } | |
| 7214 | - | |
| 7215 | - return true; | |
| 7216 | -}; | |
| 7217 | -/** | |
| 7218 | - * Returns block types that the 'blocks' can be transformed into, based on | |
| 7219 | - * 'from' transforms on other blocks. | |
| 7220 | - * | |
| 7221 | - * @param {Array} blocks The blocks to transform from. | |
| 7222 | - * | |
| 7223 | - * @return {Array} Block types that the blocks can be transformed into. | |
| 7224 | - */ | |
| 7225 | - | |
| 7226 | - | |
| 7227 | -const getBlockTypesForPossibleFromTransforms = blocks => { | |
| 7228 | - if ((0,external_lodash_namespaceObject.isEmpty)(blocks)) { | |
| 7229 | - return []; | |
| 7230 | - } | |
| 7231 | - | |
| 7232 | - const allBlockTypes = registration_getBlockTypes(); // filter all blocks to find those with a 'from' transform. | |
| 7233 | - | |
| 7234 | - const blockTypesWithPossibleFromTransforms = (0,external_lodash_namespaceObject.filter)(allBlockTypes, blockType => { | |
| 7235 | - const fromTransforms = getBlockTransforms('from', blockType.name); | |
| 7236 | - return !!findTransform(fromTransforms, transform => { | |
| 7237 | - return isPossibleTransformForSource(transform, 'from', blocks); | |
| 7238 | - }); | |
| 7239 | - }); | |
| 7240 | - return blockTypesWithPossibleFromTransforms; | |
| 7241 | -}; | |
| 7242 | -/** | |
| 7243 | - * Returns block types that the 'blocks' can be transformed into, based on | |
| 7244 | - * the source block's own 'to' transforms. | |
| 7245 | - * | |
| 7246 | - * @param {Array} blocks The blocks to transform from. | |
| 7247 | - * | |
| 7248 | - * @return {Array} Block types that the source can be transformed into. | |
| 7249 | - */ | |
| 7250 | - | |
| 7251 | - | |
| 7252 | -const getBlockTypesForPossibleToTransforms = blocks => { | |
| 7253 | - if ((0,external_lodash_namespaceObject.isEmpty)(blocks)) { | |
| 7254 | - return []; | |
| 7255 | - } | |
| 7256 | - | |
| 7257 | - const sourceBlock = (0,external_lodash_namespaceObject.first)(blocks); | |
| 7258 | - const blockType = registration_getBlockType(sourceBlock.name); | |
| 7259 | - const transformsTo = blockType ? getBlockTransforms('to', blockType.name) : []; // filter all 'to' transforms to find those that are possible. | |
| 7260 | - | |
| 7261 | - const possibleTransforms = (0,external_lodash_namespaceObject.filter)(transformsTo, transform => { | |
| 7262 | - return transform && isPossibleTransformForSource(transform, 'to', blocks); | |
| 7263 | - }); // Build a list of block names using the possible 'to' transforms. | |
| 7264 | - | |
| 7265 | - const blockNames = (0,external_lodash_namespaceObject.flatMap)(possibleTransforms, transformation => transformation.blocks); // Map block names to block types. | |
| 7266 | - | |
| 7267 | - return blockNames.map(name => registration_getBlockType(name)); | |
| 7268 | -}; | |
| 7269 | -/** | |
| 7270 | - * Determines whether transform is a "block" type | |
| 7271 | - * and if so whether it is a "wildcard" transform | |
| 7272 | - * ie: targets "any" block type | |
| 7273 | - * | |
| 7274 | - * @param {Object} t the Block transform object | |
| 7275 | - * | |
| 7276 | - * @return {boolean} whether transform is a wildcard transform | |
| 7277 | - */ | |
| 7278 | - | |
| 7279 | - | |
| 7280 | -const isWildcardBlockTransform = t => t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*'); | |
| 7281 | -/** | |
| 7282 | - * Determines whether the given Block is the core Block which | |
| 7283 | - * acts as a container Block for other Blocks as part of the | |
| 7284 | - * Grouping mechanics | |
| 7285 | - * | |
| 7286 | - * @param {string} name the name of the Block to test against | |
| 7287 | - * | |
| 7288 | - * @return {boolean} whether or not the Block is the container Block type | |
| 7289 | - */ | |
| 7290 | - | |
| 7291 | -const isContainerGroupBlock = name => name === registration_getGroupingBlockName(); | |
| 7292 | -/** | |
| 7293 | - * Returns an array of block types that the set of blocks received as argument | |
| 7294 | - * can be transformed into. | |
| 7295 | - * | |
| 7296 | - * @param {Array} blocks Blocks array. | |
| 7297 | - * | |
| 7298 | - * @return {Array} Block types that the blocks argument can be transformed to. | |
| 7299 | - */ | |
| 7300 | - | |
| 7301 | -function getPossibleBlockTransformations(blocks) { | |
| 7302 | - if ((0,external_lodash_namespaceObject.isEmpty)(blocks)) { | |
| 7303 | - return []; | |
| 7304 | - } | |
| 7305 | - | |
| 7306 | - const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); | |
| 7307 | - const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); | |
| 7308 | - return (0,external_lodash_namespaceObject.uniq)([...blockTypesForFromTransforms, ...blockTypesForToTransforms]); | |
| 7309 | -} | |
| 7310 | -/** | |
| 7311 | - * Given an array of transforms, returns the highest-priority transform where | |
| 7312 | - * the predicate function returns a truthy value. A higher-priority transform | |
| 7313 | - * is one with a lower priority value (i.e. first in priority order). Returns | |
| 7314 | - * null if the transforms set is empty or the predicate function returns a | |
| 7315 | - * falsey value for all entries. | |
| 7316 | - * | |
| 7317 | - * @param {Object[]} transforms Transforms to search. | |
| 7318 | - * @param {Function} predicate Function returning true on matching transform. | |
| 7319 | - * | |
| 7320 | - * @return {?Object} Highest-priority transform candidate. | |
| 7321 | - */ | |
| 7322 | - | |
| 7323 | -function findTransform(transforms, predicate) { | |
| 7324 | - // The hooks library already has built-in mechanisms for managing priority | |
| 7325 | - // queue, so leverage via locally-defined instance. | |
| 7326 | - const hooks = (0,external_wp_hooks_namespaceObject.createHooks)(); | |
| 7327 | - | |
| 7328 | - for (let i = 0; i < transforms.length; i++) { | |
| 7329 | - const candidate = transforms[i]; | |
| 7330 | - | |
| 7331 | - if (predicate(candidate)) { | |
| 7332 | - hooks.addFilter('transform', 'transform/' + i.toString(), result => result ? result : candidate, candidate.priority); | |
| 7333 | - } | |
| 7334 | - } // Filter name is arbitrarily chosen but consistent with above aggregation. | |
| 7335 | - | |
| 7336 | - | |
| 7337 | - return hooks.applyFilters('transform', null); | |
| 7338 | -} | |
| 7339 | -/** | |
| 7340 | - * Returns normal block transforms for a given transform direction, optionally | |
| 7341 | - * for a specific block by name, or an empty array if there are no transforms. | |
| 7342 | - * If no block name is provided, returns transforms for all blocks. A normal | |
| 7343 | - * transform object includes `blockName` as a property. | |
| 7344 | - * | |
| 7345 | - * @param {string} direction Transform direction ("to", "from"). | |
| 7346 | - * @param {string|Object} blockTypeOrName Block type or name. | |
| 7347 | - * | |
| 7348 | - * @return {Array} Block transforms for direction. | |
| 7349 | - */ | |
| 7350 | - | |
| 7351 | -function getBlockTransforms(direction, blockTypeOrName) { | |
| 7352 | - // When retrieving transforms for all block types, recurse into self. | |
| 7353 | - if (blockTypeOrName === undefined) { | |
| 7354 | - return (0,external_lodash_namespaceObject.flatMap)(registration_getBlockTypes(), _ref => { | |
| 7355 | - let { | |
| 7356 | - name | |
| 7357 | - } = _ref; | |
| 7358 | - return getBlockTransforms(direction, name); | |
| 7359 | - }); | |
| 7360 | - } // Validate that block type exists and has array of direction. | |
| 7361 | - | |
| 7362 | - | |
| 7363 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 7364 | - const { | |
| 7365 | - name: blockName, | |
| 7366 | - transforms | |
| 7367 | - } = blockType || {}; | |
| 7368 | - | |
| 7369 | - if (!transforms || !Array.isArray(transforms[direction])) { | |
| 7370 | - return []; | |
| 7371 | - } | |
| 7372 | - | |
| 7373 | - const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); | |
| 7374 | - const filteredTransforms = usingMobileTransformations ? (0,external_lodash_namespaceObject.filter)(transforms[direction], t => { | |
| 7375 | - if (t.type === 'raw') { | |
| 7376 | - return true; | |
| 7377 | - } | |
| 7378 | - | |
| 7379 | - if (!t.blocks || !t.blocks.length) { | |
| 7380 | - return false; | |
| 7381 | - } | |
| 7382 | - | |
| 7383 | - if (isWildcardBlockTransform(t)) { | |
| 7384 | - return true; | |
| 7385 | - } | |
| 7386 | - | |
| 7387 | - return (0,external_lodash_namespaceObject.every)(t.blocks, transformBlockName => transforms.supportedMobileTransforms.includes(transformBlockName)); | |
| 7388 | - }) : transforms[direction]; // Map transforms to normal form. | |
| 7389 | - | |
| 7390 | - return filteredTransforms.map(transform => ({ ...transform, | |
| 7391 | - blockName, | |
| 7392 | - usingMobileTransformations | |
| 7393 | - })); | |
| 7394 | -} | |
| 7395 | -/** | |
| 7396 | - * Switch one or more blocks into one or more blocks of the new block type. | |
| 7397 | - * | |
| 7398 | - * @param {Array|Object} blocks Blocks array or block object. | |
| 7399 | - * @param {string} name Block name. | |
| 7400 | - * | |
| 7401 | - * @return {?Array} Array of blocks or null. | |
| 7402 | - */ | |
| 7403 | - | |
| 7404 | -function switchToBlockType(blocks, name) { | |
| 7405 | - const blocksArray = (0,external_lodash_namespaceObject.castArray)(blocks); | |
| 7406 | - const isMultiBlock = blocksArray.length > 1; | |
| 7407 | - const firstBlock = blocksArray[0]; | |
| 7408 | - const sourceName = firstBlock.name; // Find the right transformation by giving priority to the "to" | |
| 7409 | - // transformation. | |
| 7410 | - | |
| 7411 | - const transformationsFrom = getBlockTransforms('from', name); | |
| 7412 | - const transformationsTo = getBlockTransforms('to', sourceName); | |
| 7413 | - const transformation = findTransform(transformationsTo, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock)) || findTransform(transformationsFrom, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock)); // Stop if there is no valid transformation. | |
| 7414 | - | |
| 7415 | - if (!transformation) { | |
| 7416 | - return null; | |
| 7417 | - } | |
| 7418 | - | |
| 7419 | - let transformationResults; | |
| 7420 | - | |
| 7421 | - if (transformation.isMultiBlock) { | |
| 7422 | - if ((0,external_lodash_namespaceObject.has)(transformation, '__experimentalConvert')) { | |
| 7423 | - transformationResults = transformation.__experimentalConvert(blocksArray); | |
| 7424 | - } else { | |
| 7425 | - transformationResults = transformation.transform(blocksArray.map(currentBlock => currentBlock.attributes), blocksArray.map(currentBlock => currentBlock.innerBlocks)); | |
| 7426 | - } | |
| 7427 | - } else if ((0,external_lodash_namespaceObject.has)(transformation, '__experimentalConvert')) { | |
| 7428 | - transformationResults = transformation.__experimentalConvert(firstBlock); | |
| 7429 | - } else { | |
| 7430 | - transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks); | |
| 7431 | - } // Ensure that the transformation function returned an object or an array | |
| 7432 | - // of objects. | |
| 7433 | - | |
| 7434 | - | |
| 7435 | - if (!(0,external_lodash_namespaceObject.isObjectLike)(transformationResults)) { | |
| 7436 | - return null; | |
| 7437 | - } // If the transformation function returned a single object, we want to work | |
| 7438 | - // with an array instead. | |
| 7439 | - | |
| 7440 | - | |
| 7441 | - transformationResults = (0,external_lodash_namespaceObject.castArray)(transformationResults); // Ensure that every block object returned by the transformation has a | |
| 7442 | - // valid block type. | |
| 7443 | - | |
| 7444 | - if (transformationResults.some(result => !registration_getBlockType(result.name))) { | |
| 7445 | - return null; | |
| 7446 | - } | |
| 7447 | - | |
| 7448 | - const hasSwitchedBlock = (0,external_lodash_namespaceObject.some)(transformationResults, result => result.name === name); // Ensure that at least one block object returned by the transformation has | |
| 7449 | - // the expected "destination" block type. | |
| 7450 | - | |
| 7451 | - if (!hasSwitchedBlock) { | |
| 7452 | - return null; | |
| 7453 | - } | |
| 7454 | - | |
| 7455 | - const ret = transformationResults.map((result, index, results) => { | |
| 7456 | - /** | |
| 7457 | - * Filters an individual transform result from block transformation. | |
| 7458 | - * All of the original blocks are passed, since transformations are | |
| 7459 | - * many-to-many, not one-to-one. | |
| 7460 | - * | |
| 7461 | - * @param {Object} transformedBlock The transformed block. | |
| 7462 | - * @param {Object[]} blocks Original blocks transformed. | |
| 7463 | - * @param {Object[]} index Index of the transformed block on the array of results. | |
| 7464 | - * @param {Object[]} results An array all the blocks that resulted from the transformation. | |
| 7465 | - */ | |
| 7466 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.switchToBlockType.transformedBlock', result, blocks, index, results); | |
| 7467 | - }); | |
| 7468 | - return ret; | |
| 7469 | -} | |
| 7470 | -/** | |
| 7471 | - * Create a block object from the example API. | |
| 7472 | - * | |
| 7473 | - * @param {string} name | |
| 7474 | - * @param {Object} example | |
| 7475 | - * | |
| 7476 | - * @return {Object} block. | |
| 7477 | - */ | |
| 7478 | - | |
| 7479 | -const getBlockFromExample = (name, example) => { | |
| 7480 | - return createBlock(name, example.attributes, (0,external_lodash_namespaceObject.map)(example.innerBlocks, innerBlock => getBlockFromExample(innerBlock.name, innerBlock))); | |
| 7481 | -}; | |
| 7482 | -//# sourceMappingURL=factory.js.map | |
| 7483 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/utils.js | |
| 7484 | -/** | |
| 7485 | - * External dependencies | |
| 7486 | - */ | |
| 7487 | - | |
| 7488 | - | |
| 7489 | - | |
| 7490 | - | |
| 7491 | -/** | |
| 7492 | - * WordPress dependencies | |
| 7493 | - */ | |
| 7494 | - | |
| 7495 | - | |
| 7496 | - | |
| 7497 | - | |
| 7498 | -/** | |
| 7499 | - * Internal dependencies | |
| 7500 | - */ | |
| 7501 | - | |
| 7502 | - | |
| 7503 | - | |
| 7504 | - | |
| 7505 | -k([names, a11y]); | |
| 7506 | -/** | |
| 7507 | - * Array of icon colors containing a color to be used if the icon color | |
| 7508 | - * was not explicitly set but the icon background color was. | |
| 7509 | - * | |
| 7510 | - * @type {Object} | |
| 7511 | - */ | |
| 7512 | - | |
| 7513 | -const ICON_COLORS = ['#191e23', '#f8f9f9']; | |
| 7514 | -/** | |
| 7515 | - * Determines whether the block is a default block | |
| 7516 | - * and its attributes are equal to the default attributes | |
| 7517 | - * which means the block is unmodified. | |
| 7518 | - * | |
| 7519 | - * @param {WPBlock} block Block Object | |
| 7520 | - * | |
| 7521 | - * @return {boolean} Whether the block is an unmodified default block | |
| 7522 | - */ | |
| 7523 | - | |
| 7524 | -function isUnmodifiedDefaultBlock(block) { | |
| 7525 | - const defaultBlockName = registration_getDefaultBlockName(); | |
| 7526 | - | |
| 7527 | - if (block.name !== defaultBlockName) { | |
| 7528 | - return false; | |
| 7529 | - } // Cache a created default block if no cache exists or the default block | |
| 7530 | - // name changed. | |
| 7531 | - | |
| 7532 | - | |
| 7533 | - if (!isUnmodifiedDefaultBlock.block || isUnmodifiedDefaultBlock.block.name !== defaultBlockName) { | |
| 7534 | - isUnmodifiedDefaultBlock.block = createBlock(defaultBlockName); | |
| 7535 | - } | |
| 7536 | - | |
| 7537 | - const newDefaultBlock = isUnmodifiedDefaultBlock.block; | |
| 7538 | - const blockType = registration_getBlockType(defaultBlockName); | |
| 7539 | - return (0,external_lodash_namespaceObject.every)(blockType === null || blockType === void 0 ? void 0 : blockType.attributes, (value, key) => newDefaultBlock.attributes[key] === block.attributes[key]); | |
| 7540 | -} | |
| 7541 | -/** | |
| 7542 | - * Function that checks if the parameter is a valid icon. | |
| 7543 | - * | |
| 7544 | - * @param {*} icon Parameter to be checked. | |
| 7545 | - * | |
| 7546 | - * @return {boolean} True if the parameter is a valid icon and false otherwise. | |
| 7547 | - */ | |
| 7548 | - | |
| 7549 | -function isValidIcon(icon) { | |
| 7550 | - return !!icon && ((0,external_lodash_namespaceObject.isString)(icon) || (0,external_wp_element_namespaceObject.isValidElement)(icon) || (0,external_lodash_namespaceObject.isFunction)(icon) || icon instanceof external_wp_element_namespaceObject.Component); | |
| 7551 | -} | |
| 7552 | -/** | |
| 7553 | - * Function that receives an icon as set by the blocks during the registration | |
| 7554 | - * and returns a new icon object that is normalized so we can rely on just on possible icon structure | |
| 7555 | - * in the codebase. | |
| 7556 | - * | |
| 7557 | - * @param {WPBlockTypeIconRender} icon Render behavior of a block type icon; | |
| 7558 | - * one of a Dashicon slug, an element, or a | |
| 7559 | - * component. | |
| 7560 | - * | |
| 7561 | - * @return {WPBlockTypeIconDescriptor} Object describing the icon. | |
| 7562 | - */ | |
| 7563 | - | |
| 7564 | -function normalizeIconObject(icon) { | |
| 7565 | - icon = icon || BLOCK_ICON_DEFAULT; | |
| 7566 | - | |
| 7567 | - if (isValidIcon(icon)) { | |
| 7568 | - return { | |
| 7569 | - src: icon | |
| 7570 | - }; | |
| 7571 | - } | |
| 7572 | - | |
| 7573 | - if ((0,external_lodash_namespaceObject.has)(icon, ['background'])) { | |
| 7574 | - const colordBgColor = w(icon.background); | |
| 7575 | - return { ...icon, | |
| 7576 | - foreground: icon.foreground ? icon.foreground : (0,external_lodash_namespaceObject.maxBy)(ICON_COLORS, iconColor => colordBgColor.contrast(iconColor)), | |
| 7577 | - shadowColor: colordBgColor.alpha(0.3).toRgbString() | |
| 7578 | - }; | |
| 7579 | - } | |
| 7580 | - | |
| 7581 | - return icon; | |
| 7582 | -} | |
| 7583 | -/** | |
| 7584 | - * Normalizes block type passed as param. When string is passed then | |
| 7585 | - * it converts it to the matching block type object. | |
| 7586 | - * It passes the original object otherwise. | |
| 7587 | - * | |
| 7588 | - * @param {string|Object} blockTypeOrName Block type or name. | |
| 7589 | - * | |
| 7590 | - * @return {?Object} Block type. | |
| 7591 | - */ | |
| 7592 | - | |
| 7593 | -function normalizeBlockType(blockTypeOrName) { | |
| 7594 | - if ((0,external_lodash_namespaceObject.isString)(blockTypeOrName)) { | |
| 7595 | - return registration_getBlockType(blockTypeOrName); | |
| 7596 | - } | |
| 7597 | - | |
| 7598 | - return blockTypeOrName; | |
| 7599 | -} | |
| 7600 | -/** | |
| 7601 | - * Get the label for the block, usually this is either the block title, | |
| 7602 | - * or the value of the block's `label` function when that's specified. | |
| 7603 | - * | |
| 7604 | - * @param {Object} blockType The block type. | |
| 7605 | - * @param {Object} attributes The values of the block's attributes. | |
| 7606 | - * @param {Object} context The intended use for the label. | |
| 7607 | - * | |
| 7608 | - * @return {string} The block label. | |
| 7609 | - */ | |
| 7610 | - | |
| 7611 | -function getBlockLabel(blockType, attributes) { | |
| 7612 | - let context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'visual'; | |
| 7613 | - const { | |
| 7614 | - __experimentalLabel: getLabel, | |
| 7615 | - title | |
| 7616 | - } = blockType; | |
| 7617 | - const label = getLabel && getLabel(attributes, { | |
| 7618 | - context | |
| 7619 | - }); | |
| 7620 | - | |
| 7621 | - if (!label) { | |
| 7622 | - return title; | |
| 7623 | - } // Strip any HTML (i.e. RichText formatting) before returning. | |
| 7624 | - | |
| 7625 | - | |
| 7626 | - return (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label); | |
| 7627 | -} | |
| 7628 | -/** | |
| 7629 | - * Get a label for the block for use by screenreaders, this is more descriptive | |
| 7630 | - * than the visual label and includes the block title and the value of the | |
| 7631 | - * `getLabel` function if it's specified. | |
| 7632 | - * | |
| 7633 | - * @param {Object} blockType The block type. | |
| 7634 | - * @param {Object} attributes The values of the block's attributes. | |
| 7635 | - * @param {?number} position The position of the block in the block list. | |
| 7636 | - * @param {string} [direction='vertical'] The direction of the block layout. | |
| 7637 | - * | |
| 7638 | - * @return {string} The block label. | |
| 7639 | - */ | |
| 7640 | - | |
| 7641 | -function getAccessibleBlockLabel(blockType, attributes, position) { | |
| 7642 | - let direction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vertical'; | |
| 7643 | - // `title` is already localized, `label` is a user-supplied value. | |
| 7644 | - const title = blockType === null || blockType === void 0 ? void 0 : blockType.title; | |
| 7645 | - const label = blockType ? getBlockLabel(blockType, attributes, 'accessibility') : ''; | |
| 7646 | - const hasPosition = position !== undefined; // getBlockLabel returns the block title as a fallback when there's no label, | |
| 7647 | - // if it did return the title, this function needs to avoid adding the | |
| 7648 | - // title twice within the accessible label. Use this `hasLabel` boolean to | |
| 7649 | - // handle that. | |
| 7650 | - | |
| 7651 | - const hasLabel = label && label !== title; | |
| 7652 | - | |
| 7653 | - if (hasPosition && direction === 'vertical') { | |
| 7654 | - if (hasLabel) { | |
| 7655 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7656 | - /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ | |
| 7657 | - (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d. %3$s'), title, position, label); | |
| 7658 | - } | |
| 7659 | - | |
| 7660 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7661 | - /* translators: accessibility text. 1: The block title. 2: The block row number. */ | |
| 7662 | - (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d'), title, position); | |
| 7663 | - } else if (hasPosition && direction === 'horizontal') { | |
| 7664 | - if (hasLabel) { | |
| 7665 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7666 | - /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ | |
| 7667 | - (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d. %3$s'), title, position, label); | |
| 7668 | - } | |
| 7669 | - | |
| 7670 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7671 | - /* translators: accessibility text. 1: The block title. 2: The block column number. */ | |
| 7672 | - (0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d'), title, position); | |
| 7673 | - } | |
| 7674 | - | |
| 7675 | - if (hasLabel) { | |
| 7676 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7677 | - /* translators: accessibility text. %1: The block title. %2: The block label. */ | |
| 7678 | - (0,external_wp_i18n_namespaceObject.__)('%1$s Block. %2$s'), title, label); | |
| 7679 | - } | |
| 7680 | - | |
| 7681 | - return (0,external_wp_i18n_namespaceObject.sprintf)( | |
| 7682 | - /* translators: accessibility text. %s: The block title. */ | |
| 7683 | - (0,external_wp_i18n_namespaceObject.__)('%s Block'), title); | |
| 7684 | -} | |
| 7685 | -/** | |
| 7686 | - * Ensure attributes contains only values defined by block type, and merge | |
| 7687 | - * default values for missing attributes. | |
| 7688 | - * | |
| 7689 | - * @param {string} name The block's name. | |
| 7690 | - * @param {Object} attributes The block's attributes. | |
| 7691 | - * @return {Object} The sanitized attributes. | |
| 7692 | - */ | |
| 7693 | - | |
| 7694 | -function __experimentalSanitizeBlockAttributes(name, attributes) { | |
| 7695 | - // Get the type definition associated with a registered block. | |
| 7696 | - const blockType = registration_getBlockType(name); | |
| 7697 | - | |
| 7698 | - if (undefined === blockType) { | |
| 7699 | - throw new Error(`Block type '${name}' is not registered.`); | |
| 7700 | - } | |
| 7701 | - | |
| 7702 | - return (0,external_lodash_namespaceObject.reduce)(blockType.attributes, (accumulator, schema, key) => { | |
| 7703 | - const value = attributes[key]; | |
| 7704 | - | |
| 7705 | - if (undefined !== value) { | |
| 7706 | - accumulator[key] = value; | |
| 7707 | - } else if (schema.hasOwnProperty('default')) { | |
| 7708 | - accumulator[key] = schema.default; | |
| 7709 | - } | |
| 7710 | - | |
| 7711 | - if (['node', 'children'].indexOf(schema.source) !== -1) { | |
| 7712 | - // Ensure value passed is always an array, which we're expecting in | |
| 7713 | - // the RichText component to handle the deprecated value. | |
| 7714 | - if (typeof accumulator[key] === 'string') { | |
| 7715 | - accumulator[key] = [accumulator[key]]; | |
| 7716 | - } else if (!Array.isArray(accumulator[key])) { | |
| 7717 | - accumulator[key] = []; | |
| 7718 | - } | |
| 7719 | - } | |
| 7720 | - | |
| 7721 | - return accumulator; | |
| 7722 | - }, {}); | |
| 7723 | -} | |
| 7724 | -/** | |
| 7725 | - * Filter block attributes by `role` and return their names. | |
| 7726 | - * | |
| 7727 | - * @param {string} name Block attribute's name. | |
| 7728 | - * @param {string} role The role of a block attribute. | |
| 7729 | - * | |
| 7730 | - * @return {string[]} The attribute names that have the provided role. | |
| 7731 | - */ | |
| 7732 | - | |
| 7733 | -function __experimentalGetBlockAttributesNamesByRole(name, role) { | |
| 7734 | - var _getBlockType; | |
| 7735 | - | |
| 7736 | - const attributes = (_getBlockType = registration_getBlockType(name)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.attributes; | |
| 7737 | - if (!attributes) return []; | |
| 7738 | - const attributesNames = Object.keys(attributes); | |
| 7739 | - if (!role) return attributesNames; | |
| 7740 | - return attributesNames.filter(attributeName => { | |
| 7741 | - var _attributes$attribute; | |
| 7742 | - | |
| 7743 | - return ((_attributes$attribute = attributes[attributeName]) === null || _attributes$attribute === void 0 ? void 0 : _attributes$attribute.__experimentalRole) === role; | |
| 7744 | - }); | |
| 7745 | -} | |
| 7746 | -//# sourceMappingURL=utils.js.map | |
| 7747 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/store/actions.js | |
| 7748 | -/** | |
| 7749 | - * External dependencies | |
| 7750 | - */ | |
| 7751 | - | |
| 7752 | -/** | |
| 7753 | - * WordPress dependencies | |
| 7754 | - */ | |
| 7755 | - | |
| 7756 | - | |
| 7757 | -/** | |
| 7758 | - * Internal dependencies | |
| 7759 | - */ | |
| 7760 | - | |
| 7761 | - | |
| 7762 | - | |
| 7763 | -/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */ | |
| 7764 | - | |
| 7765 | -const { | |
| 7766 | - error, | |
| 7767 | - warn | |
| 7768 | -} = window.console; | |
| 7769 | -/** | |
| 7770 | - * Mapping of legacy category slugs to their latest normal values, used to | |
| 7771 | - * accommodate updates of the default set of block categories. | |
| 7772 | - * | |
| 7773 | - * @type {Record<string,string>} | |
| 7774 | - */ | |
| 7775 | - | |
| 7776 | -const LEGACY_CATEGORY_MAPPING = { | |
| 7777 | - common: 'text', | |
| 7778 | - formatting: 'text', | |
| 7779 | - layout: 'design' | |
| 7780 | -}; | |
| 7781 | -/** | |
| 7782 | - * Takes the unprocessed block type data and applies all the existing filters for the registered block type. | |
| 7783 | - * Next, it validates all the settings and performs additional processing to the block type definition. | |
| 7784 | - * | |
| 7785 | - * @param {WPBlockType} blockType Unprocessed block type settings. | |
| 7786 | - * @param {Object} thunkArgs Argument object for the thunk middleware. | |
| 7787 | - * @param {Function} thunkArgs.select Function to select from the store. | |
| 7788 | - * | |
| 7789 | - * @return {?WPBlockType} The block, if it has been successfully registered; otherwise `undefined`. | |
| 7790 | - */ | |
| 7791 | - | |
| 7792 | -const processBlockType = (blockType, _ref) => { | |
| 7793 | - let { | |
| 7794 | - select | |
| 7795 | - } = _ref; | |
| 7796 | - const { | |
| 7797 | - name | |
| 7798 | - } = blockType; | |
| 7799 | - const settings = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', { ...blockType | |
| 7800 | - }, name); | |
| 7801 | - | |
| 7802 | - if (settings.deprecated) { | |
| 7803 | - settings.deprecated = settings.deprecated.map(deprecation => (0,external_lodash_namespaceObject.pick)( // Only keep valid deprecation keys. | |
| 7804 | - (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', // Merge deprecation keys with pre-filter settings | |
| 7805 | - // so that filters that depend on specific keys being | |
| 7806 | - // present don't fail. | |
| 7807 | - { // Omit deprecation keys here so that deprecations | |
| 7808 | - // can opt out of specific keys like "supports". | |
| 7809 | - ...(0,external_lodash_namespaceObject.omit)(blockType, DEPRECATED_ENTRY_KEYS), | |
| 7810 | - ...deprecation | |
| 7811 | - }, name), DEPRECATED_ENTRY_KEYS)); | |
| 7812 | - } | |
| 7813 | - | |
| 7814 | - if (!(0,external_lodash_namespaceObject.isPlainObject)(settings)) { | |
| 7815 | - error('Block settings must be a valid object.'); | |
| 7816 | - return; | |
| 7817 | - } | |
| 7818 | - | |
| 7819 | - if (!(0,external_lodash_namespaceObject.isFunction)(settings.save)) { | |
| 7820 | - error('The "save" property must be a valid function.'); | |
| 7821 | - return; | |
| 7822 | - } | |
| 7823 | - | |
| 7824 | - if ('edit' in settings && !(0,external_lodash_namespaceObject.isFunction)(settings.edit)) { | |
| 7825 | - error('The "edit" property must be a valid function.'); | |
| 7826 | - return; | |
| 7827 | - } // Canonicalize legacy categories to equivalent fallback. | |
| 7828 | - | |
| 7829 | - | |
| 7830 | - if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { | |
| 7831 | - settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; | |
| 7832 | - } | |
| 7833 | - | |
| 7834 | - if ('category' in settings && !(0,external_lodash_namespaceObject.some)(select.getCategories(), { | |
| 7835 | - slug: settings.category | |
| 7836 | - })) { | |
| 7837 | - warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".'); | |
| 7838 | - delete settings.category; | |
| 7839 | - } | |
| 7840 | - | |
| 7841 | - if (!('title' in settings) || settings.title === '') { | |
| 7842 | - error('The block "' + name + '" must have a title.'); | |
| 7843 | - return; | |
| 7844 | - } | |
| 7845 | - | |
| 7846 | - if (typeof settings.title !== 'string') { | |
| 7847 | - error('Block titles must be strings.'); | |
| 7848 | - return; | |
| 7849 | - } | |
| 7850 | - | |
| 7851 | - settings.icon = normalizeIconObject(settings.icon); | |
| 7852 | - | |
| 7853 | - if (!isValidIcon(settings.icon.src)) { | |
| 7854 | - 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'); | |
| 7855 | - return; | |
| 7856 | - } | |
| 7857 | - | |
| 7858 | - return settings; | |
| 7859 | -}; | |
| 7860 | -/** | |
| 7861 | - * Returns an action object used in signalling that block types have been added. | |
| 7862 | - * | |
| 7863 | - * @param {Array|Object} blockTypes Block types received. | |
| 7864 | - * | |
| 7865 | - * @return {Object} Action object. | |
| 7866 | - */ | |
| 7867 | - | |
| 7868 | - | |
| 7869 | -function addBlockTypes(blockTypes) { | |
| 7870 | - return { | |
| 7871 | - type: 'ADD_BLOCK_TYPES', | |
| 7872 | - blockTypes: (0,external_lodash_namespaceObject.castArray)(blockTypes) | |
| 7873 | - }; | |
| 7874 | -} | |
| 7875 | -/** | |
| 7876 | - * Signals that the passed block type's settings should be stored in the state. | |
| 7877 | - * | |
| 7878 | - * @param {WPBlockType} blockType Unprocessed block type settings. | |
| 7879 | - */ | |
| 7880 | - | |
| 7881 | -const __experimentalRegisterBlockType = blockType => _ref2 => { | |
| 7882 | - let { | |
| 7883 | - dispatch, | |
| 7884 | - select | |
| 7885 | - } = _ref2; | |
| 7886 | - dispatch({ | |
| 7887 | - type: 'ADD_UNPROCESSED_BLOCK_TYPE', | |
| 7888 | - blockType | |
| 7889 | - }); | |
| 7890 | - const processedBlockType = processBlockType(blockType, { | |
| 7891 | - select | |
| 7892 | - }); | |
| 7893 | - | |
| 7894 | - if (!processedBlockType) { | |
| 7895 | - return; | |
| 7896 | - } | |
| 7897 | - | |
| 7898 | - dispatch.addBlockTypes(processedBlockType); | |
| 7899 | -}; | |
| 7900 | -/** | |
| 7901 | - * Signals that all block types should be computed again. | |
| 7902 | - * It uses stored unprocessed block types and all the most recent list of registered filters. | |
| 7903 | - * | |
| 7904 | - * It addresses the issue where third party block filters get registered after third party blocks. A sample sequence: | |
| 7905 | - * 1. Filter A. | |
| 7906 | - * 2. Block B. | |
| 7907 | - * 3. Block C. | |
| 7908 | - * 4. Filter D. | |
| 7909 | - * 5. Filter E. | |
| 7910 | - * 6. Block F. | |
| 7911 | - * 7. Filter G. | |
| 7912 | - * In this scenario some filters would not get applied for all blocks because they are registered too late. | |
| 7913 | - */ | |
| 7914 | - | |
| 7915 | -const __experimentalReapplyBlockTypeFilters = () => _ref3 => { | |
| 7916 | - let { | |
| 7917 | - dispatch, | |
| 7918 | - select | |
| 7919 | - } = _ref3; | |
| 7920 | - | |
| 7921 | - const unprocessedBlockTypes = select.__experimentalGetUnprocessedBlockTypes(); | |
| 7922 | - | |
| 7923 | - const processedBlockTypes = Object.keys(unprocessedBlockTypes).reduce((accumulator, blockName) => { | |
| 7924 | - const result = processBlockType(unprocessedBlockTypes[blockName], { | |
| 7925 | - select | |
| 7926 | - }); | |
| 7927 | - | |
| 7928 | - if (result) { | |
| 7929 | - accumulator.push(result); | |
| 7930 | - } | |
| 7931 | - | |
| 7932 | - return accumulator; | |
| 7933 | - }, []); | |
| 7934 | - | |
| 7935 | - if (!processedBlockTypes.length) { | |
| 7936 | - return; | |
| 7937 | - } | |
| 7938 | - | |
| 7939 | - dispatch.addBlockTypes(processedBlockTypes); | |
| 7940 | -}; | |
| 7941 | -/** | |
| 7942 | - * Returns an action object used to remove a registered block type. | |
| 7943 | - * | |
| 7944 | - * @param {string|Array} names Block name. | |
| 7945 | - * | |
| 7946 | - * @return {Object} Action object. | |
| 7947 | - */ | |
| 7948 | - | |
| 7949 | -function removeBlockTypes(names) { | |
| 7950 | - return { | |
| 7951 | - type: 'REMOVE_BLOCK_TYPES', | |
| 7952 | - names: (0,external_lodash_namespaceObject.castArray)(names) | |
| 7953 | - }; | |
| 7954 | -} | |
| 7955 | -/** | |
| 7956 | - * Returns an action object used in signalling that new block styles have been added. | |
| 7957 | - * | |
| 7958 | - * @param {string} blockName Block name. | |
| 7959 | - * @param {Array|Object} styles Block styles. | |
| 7960 | - * | |
| 7961 | - * @return {Object} Action object. | |
| 7962 | - */ | |
| 7963 | - | |
| 7964 | -function addBlockStyles(blockName, styles) { | |
| 7965 | - return { | |
| 7966 | - type: 'ADD_BLOCK_STYLES', | |
| 7967 | - styles: (0,external_lodash_namespaceObject.castArray)(styles), | |
| 7968 | - blockName | |
| 7969 | - }; | |
| 7970 | -} | |
| 7971 | -/** | |
| 7972 | - * Returns an action object used in signalling that block styles have been removed. | |
| 7973 | - * | |
| 7974 | - * @param {string} blockName Block name. | |
| 7975 | - * @param {Array|string} styleNames Block style names. | |
| 7976 | - * | |
| 7977 | - * @return {Object} Action object. | |
| 7978 | - */ | |
| 7979 | - | |
| 7980 | -function removeBlockStyles(blockName, styleNames) { | |
| 7981 | - return { | |
| 7982 | - type: 'REMOVE_BLOCK_STYLES', | |
| 7983 | - styleNames: (0,external_lodash_namespaceObject.castArray)(styleNames), | |
| 7984 | - blockName | |
| 7985 | - }; | |
| 7986 | -} | |
| 7987 | -/** | |
| 7988 | - * Returns an action object used in signalling that new block variations have been added. | |
| 7989 | - * | |
| 7990 | - * @param {string} blockName Block name. | |
| 7991 | - * @param {WPBlockVariation|WPBlockVariation[]} variations Block variations. | |
| 7992 | - * | |
| 7993 | - * @return {Object} Action object. | |
| 7994 | - */ | |
| 7995 | - | |
| 7996 | -function addBlockVariations(blockName, variations) { | |
| 7997 | - return { | |
| 7998 | - type: 'ADD_BLOCK_VARIATIONS', | |
| 7999 | - variations: (0,external_lodash_namespaceObject.castArray)(variations), | |
| 8000 | - blockName | |
| 8001 | - }; | |
| 8002 | -} | |
| 8003 | -/** | |
| 8004 | - * Returns an action object used in signalling that block variations have been removed. | |
| 8005 | - * | |
| 8006 | - * @param {string} blockName Block name. | |
| 8007 | - * @param {string|string[]} variationNames Block variation names. | |
| 8008 | - * | |
| 8009 | - * @return {Object} Action object. | |
| 8010 | - */ | |
| 8011 | - | |
| 8012 | -function removeBlockVariations(blockName, variationNames) { | |
| 8013 | - return { | |
| 8014 | - type: 'REMOVE_BLOCK_VARIATIONS', | |
| 8015 | - variationNames: (0,external_lodash_namespaceObject.castArray)(variationNames), | |
| 8016 | - blockName | |
| 8017 | - }; | |
| 8018 | -} | |
| 8019 | -/** | |
| 8020 | - * Returns an action object used to set the default block name. | |
| 8021 | - * | |
| 8022 | - * @param {string} name Block name. | |
| 8023 | - * | |
| 8024 | - * @return {Object} Action object. | |
| 8025 | - */ | |
| 8026 | - | |
| 8027 | -function actions_setDefaultBlockName(name) { | |
| 8028 | - return { | |
| 8029 | - type: 'SET_DEFAULT_BLOCK_NAME', | |
| 8030 | - name | |
| 8031 | - }; | |
| 8032 | -} | |
| 8033 | -/** | |
| 8034 | - * Returns an action object used to set the name of the block used as a fallback | |
| 8035 | - * for non-block content. | |
| 8036 | - * | |
| 8037 | - * @param {string} name Block name. | |
| 8038 | - * | |
| 8039 | - * @return {Object} Action object. | |
| 8040 | - */ | |
| 8041 | - | |
| 8042 | -function setFreeformFallbackBlockName(name) { | |
| 8043 | - return { | |
| 8044 | - type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME', | |
| 8045 | - name | |
| 8046 | - }; | |
| 8047 | -} | |
| 8048 | -/** | |
| 8049 | - * Returns an action object used to set the name of the block used as a fallback | |
| 8050 | - * for unregistered blocks. | |
| 8051 | - * | |
| 8052 | - * @param {string} name Block name. | |
| 8053 | - * | |
| 8054 | - * @return {Object} Action object. | |
| 8055 | - */ | |
| 8056 | - | |
| 8057 | -function setUnregisteredFallbackBlockName(name) { | |
| 8058 | - return { | |
| 8059 | - type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME', | |
| 8060 | - name | |
| 8061 | - }; | |
| 8062 | -} | |
| 8063 | -/** | |
| 8064 | - * Returns an action object used to set the name of the block used | |
| 8065 | - * when grouping other blocks | |
| 8066 | - * eg: in "Group/Ungroup" interactions | |
| 8067 | - * | |
| 8068 | - * @param {string} name Block name. | |
| 8069 | - * | |
| 8070 | - * @return {Object} Action object. | |
| 8071 | - */ | |
| 8072 | - | |
| 8073 | -function actions_setGroupingBlockName(name) { | |
| 8074 | - return { | |
| 8075 | - type: 'SET_GROUPING_BLOCK_NAME', | |
| 8076 | - name | |
| 8077 | - }; | |
| 8078 | -} | |
| 8079 | -/** | |
| 8080 | - * Returns an action object used to set block categories. | |
| 8081 | - * | |
| 8082 | - * @param {Object[]} categories Block categories. | |
| 8083 | - * | |
| 8084 | - * @return {Object} Action object. | |
| 8085 | - */ | |
| 8086 | - | |
| 8087 | -function setCategories(categories) { | |
| 8088 | - return { | |
| 8089 | - type: 'SET_CATEGORIES', | |
| 8090 | - categories | |
| 8091 | - }; | |
| 8092 | -} | |
| 8093 | -/** | |
| 8094 | - * Returns an action object used to update a category. | |
| 8095 | - * | |
| 8096 | - * @param {string} slug Block category slug. | |
| 8097 | - * @param {Object} category Object containing the category properties that should be updated. | |
| 8098 | - * | |
| 8099 | - * @return {Object} Action object. | |
| 8100 | - */ | |
| 8101 | - | |
| 8102 | -function updateCategory(slug, category) { | |
| 8103 | - return { | |
| 8104 | - type: 'UPDATE_CATEGORY', | |
| 8105 | - slug, | |
| 8106 | - category | |
| 8107 | - }; | |
| 8108 | -} | |
| 8109 | -/** | |
| 8110 | - * Returns an action object used to add block collections | |
| 8111 | - * | |
| 8112 | - * @param {string} namespace The namespace of the blocks to put in the collection | |
| 8113 | - * @param {string} title The title to display in the block inserter | |
| 8114 | - * @param {Object} icon (optional) The icon to display in the block inserter | |
| 8115 | - * | |
| 8116 | - * @return {Object} Action object. | |
| 8117 | - */ | |
| 8118 | - | |
| 8119 | -function addBlockCollection(namespace, title, icon) { | |
| 8120 | - return { | |
| 8121 | - type: 'ADD_BLOCK_COLLECTION', | |
| 8122 | - namespace, | |
| 8123 | - title, | |
| 8124 | - icon | |
| 8125 | - }; | |
| 8126 | -} | |
| 8127 | -/** | |
| 8128 | - * Returns an action object used to remove block collections | |
| 8129 | - * | |
| 8130 | - * @param {string} namespace The namespace of the blocks to put in the collection | |
| 8131 | - * | |
| 8132 | - * @return {Object} Action object. | |
| 8133 | - */ | |
| 8134 | - | |
| 8135 | -function removeBlockCollection(namespace) { | |
| 8136 | - return { | |
| 8137 | - type: 'REMOVE_BLOCK_COLLECTION', | |
| 8138 | - namespace | |
| 8139 | - }; | |
| 8140 | -} | |
| 8141 | -//# sourceMappingURL=actions.js.map | |
| 8142 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/store/constants.js | |
| 8143 | -const STORE_NAME = 'core/blocks'; | |
| 8144 | -//# sourceMappingURL=constants.js.map | |
| 8145 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/store/index.js | |
| 8146 | -/** | |
| 8147 | - * WordPress dependencies | |
| 8148 | - */ | |
| 8149 | - | |
| 8150 | -/** | |
| 8151 | - * Internal dependencies | |
| 8152 | - */ | |
| 8153 | - | |
| 8154 | - | |
| 8155 | - | |
| 8156 | - | |
| 8157 | - | |
| 8158 | -/** | |
| 8159 | - * Store definition for the blocks namespace. | |
| 8160 | - * | |
| 8161 | - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore | |
| 8162 | - * | |
| 8163 | - * @type {Object} | |
| 8164 | - */ | |
| 8165 | - | |
| 8166 | -const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { | |
| 8167 | - reducer: reducer, | |
| 8168 | - selectors: selectors_namespaceObject, | |
| 8169 | - actions: actions_namespaceObject, | |
| 8170 | - __experimentalUseThunks: true | |
| 8171 | -}); | |
| 8172 | -(0,external_wp_data_namespaceObject.register)(store); | |
| 8173 | -//# sourceMappingURL=index.js.map | |
| 8174 | -;// CONCATENATED MODULE: external ["wp","blockSerializationDefaultParser"] | |
| 8175 | -var external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"]; | |
| 8176 | -;// CONCATENATED MODULE: external ["wp","autop"] | |
| 8177 | -var external_wp_autop_namespaceObject = window["wp"]["autop"]; | |
| 8178 | -;// CONCATENATED MODULE: external ["wp","isShallowEqual"] | |
| 8179 | -var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"]; | |
| 8180 | -var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject); | |
| 8181 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/serializer.js | |
| 8182 | - | |
| 8183 | - | |
| 8184 | -/** | |
| 8185 | - * External dependencies | |
| 8186 | - */ | |
| 8187 | - | |
| 8188 | -/** | |
| 8189 | - * WordPress dependencies | |
| 8190 | - */ | |
| 8191 | - | |
| 8192 | - | |
| 8193 | - | |
| 8194 | - | |
| 8195 | - | |
| 8196 | -/** | |
| 8197 | - * Internal dependencies | |
| 8198 | - */ | |
| 8199 | - | |
| 8200 | - | |
| 8201 | - | |
| 8202 | -/** | |
| 8203 | - * @typedef {Object} WPBlockSerializationOptions Serialization Options. | |
| 8204 | - * | |
| 8205 | - * @property {boolean} isInnerBlocks Whether we are serializing inner blocks. | |
| 8206 | - */ | |
| 8207 | - | |
| 8208 | -/** | |
| 8209 | - * Returns the block's default classname from its name. | |
| 8210 | - * | |
| 8211 | - * @param {string} blockName The block name. | |
| 8212 | - * | |
| 8213 | - * @return {string} The block's default class. | |
| 8214 | - */ | |
| 8215 | - | |
| 8216 | -function getBlockDefaultClassName(blockName) { | |
| 8217 | - // Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature. | |
| 8218 | - // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/'). | |
| 8219 | - const className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, ''); | |
| 8220 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockDefaultClassName', className, blockName); | |
| 8221 | -} | |
| 8222 | -/** | |
| 8223 | - * Returns the block's default menu item classname from its name. | |
| 8224 | - * | |
| 8225 | - * @param {string} blockName The block name. | |
| 8226 | - * | |
| 8227 | - * @return {string} The block's default menu item class. | |
| 8228 | - */ | |
| 8229 | - | |
| 8230 | -function getBlockMenuDefaultClassName(blockName) { | |
| 8231 | - // Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature. | |
| 8232 | - // Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/'). | |
| 8233 | - const className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, ''); | |
| 8234 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockMenuDefaultClassName', className, blockName); | |
| 8235 | -} | |
| 8236 | -const blockPropsProvider = {}; | |
| 8237 | -const innerBlocksPropsProvider = {}; | |
| 8238 | -/** | |
| 8239 | - * Call within a save function to get the props for the block wrapper. | |
| 8240 | - * | |
| 8241 | - * @param {Object} props Optional. Props to pass to the element. | |
| 8242 | - */ | |
| 8243 | - | |
| 8244 | -function getBlockProps() { | |
| 8245 | - let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 8246 | - const { | |
| 8247 | - blockType, | |
| 8248 | - attributes | |
| 8249 | - } = blockPropsProvider; | |
| 8250 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', { ...props | |
| 8251 | - }, blockType, attributes); | |
| 8252 | -} | |
| 8253 | -/** | |
| 8254 | - * Call within a save function to get the props for the inner blocks wrapper. | |
| 8255 | - * | |
| 8256 | - * @param {Object} props Optional. Props to pass to the element. | |
| 8257 | - */ | |
| 8258 | - | |
| 8259 | -function getInnerBlocksProps() { | |
| 8260 | - let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | |
| 8261 | - const { | |
| 8262 | - innerBlocks | |
| 8263 | - } = innerBlocksPropsProvider; // Value is an array of blocks, so defer to block serializer | |
| 8264 | - | |
| 8265 | - const html = serializer_serialize(innerBlocks, { | |
| 8266 | - isInnerBlocks: true | |
| 8267 | - }); // Use special-cased raw HTML tag to avoid default escaping. | |
| 8268 | - | |
| 8269 | - const children = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, html); | |
| 8270 | - return { ...props, | |
| 8271 | - children | |
| 8272 | - }; | |
| 8273 | -} | |
| 8274 | -/** | |
| 8275 | - * Given a block type containing a save render implementation and attributes, returns the | |
| 8276 | - * enhanced element to be saved or string when raw HTML expected. | |
| 8277 | - * | |
| 8278 | - * @param {string|Object} blockTypeOrName Block type or name. | |
| 8279 | - * @param {Object} attributes Block attributes. | |
| 8280 | - * @param {?Array} innerBlocks Nested blocks. | |
| 8281 | - * | |
| 8282 | - * @return {Object|string} Save element or raw HTML string. | |
| 8283 | - */ | |
| 8284 | - | |
| 8285 | -function getSaveElement(blockTypeOrName, attributes) { | |
| 8286 | - let innerBlocks = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | |
| 8287 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 8288 | - let { | |
| 8289 | - save | |
| 8290 | - } = blockType; // Component classes are unsupported for save since serialization must | |
| 8291 | - // occur synchronously. For improved interoperability with higher-order | |
| 8292 | - // components which often return component class, emulate basic support. | |
| 8293 | - | |
| 8294 | - if (save.prototype instanceof external_wp_element_namespaceObject.Component) { | |
| 8295 | - const instance = new save({ | |
| 8296 | - attributes | |
| 8297 | - }); | |
| 8298 | - save = instance.render.bind(instance); | |
| 8299 | - } | |
| 8300 | - | |
| 8301 | - blockPropsProvider.blockType = blockType; | |
| 8302 | - blockPropsProvider.attributes = attributes; | |
| 8303 | - innerBlocksPropsProvider.innerBlocks = innerBlocks; | |
| 8304 | - let element = save({ | |
| 8305 | - attributes, | |
| 8306 | - innerBlocks | |
| 8307 | - }); | |
| 8308 | - | |
| 8309 | - if ((0,external_lodash_namespaceObject.isObject)(element) && (0,external_wp_hooks_namespaceObject.hasFilter)('blocks.getSaveContent.extraProps') && !(blockType.apiVersion > 1)) { | |
| 8310 | - /** | |
| 8311 | - * Filters the props applied to the block save result element. | |
| 8312 | - * | |
| 8313 | - * @param {Object} props Props applied to save element. | |
| 8314 | - * @param {WPBlock} blockType Block type definition. | |
| 8315 | - * @param {Object} attributes Block attributes. | |
| 8316 | - */ | |
| 8317 | - const props = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', { ...element.props | |
| 8318 | - }, blockType, attributes); | |
| 8319 | - | |
| 8320 | - if (!external_wp_isShallowEqual_default()(props, element.props)) { | |
| 8321 | - element = (0,external_wp_element_namespaceObject.cloneElement)(element, props); | |
| 8322 | - } | |
| 8323 | - } | |
| 8324 | - /** | |
| 8325 | - * Filters the save result of a block during serialization. | |
| 8326 | - * | |
| 8327 | - * @param {WPElement} element Block save result. | |
| 8328 | - * @param {WPBlock} blockType Block type definition. | |
| 8329 | - * @param {Object} attributes Block attributes. | |
| 8330 | - */ | |
| 8331 | - | |
| 8332 | - | |
| 8333 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveElement', element, blockType, attributes); | |
| 8334 | -} | |
| 8335 | -/** | |
| 8336 | - * Given a block type containing a save render implementation and attributes, returns the | |
| 8337 | - * static markup to be saved. | |
| 8338 | - * | |
| 8339 | - * @param {string|Object} blockTypeOrName Block type or name. | |
| 8340 | - * @param {Object} attributes Block attributes. | |
| 8341 | - * @param {?Array} innerBlocks Nested blocks. | |
| 8342 | - * | |
| 8343 | - * @return {string} Save content. | |
| 8344 | - */ | |
| 8345 | - | |
| 8346 | -function getSaveContent(blockTypeOrName, attributes, innerBlocks) { | |
| 8347 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 8348 | - return (0,external_wp_element_namespaceObject.renderToString)(getSaveElement(blockType, attributes, innerBlocks)); | |
| 8349 | -} | |
| 8350 | -/** | |
| 8351 | - * Returns attributes which are to be saved and serialized into the block | |
| 8352 | - * comment delimiter. | |
| 8353 | - * | |
| 8354 | - * When a block exists in memory it contains as its attributes both those | |
| 8355 | - * parsed the block comment delimiter _and_ those which matched from the | |
| 8356 | - * contents of the block. | |
| 8357 | - * | |
| 8358 | - * This function returns only those attributes which are needed to persist and | |
| 8359 | - * which cannot be matched from the block content. | |
| 8360 | - * | |
| 8361 | - * @param {Object<string,*>} blockType Block type. | |
| 8362 | - * @param {Object<string,*>} attributes Attributes from in-memory block data. | |
| 8363 | - * | |
| 8364 | - * @return {Object<string,*>} Subset of attributes for comment serialization. | |
| 8365 | - */ | |
| 8366 | - | |
| 8367 | -function getCommentAttributes(blockType, attributes) { | |
| 8368 | - return (0,external_lodash_namespaceObject.reduce)(blockType.attributes, (accumulator, attributeSchema, key) => { | |
| 8369 | - const value = attributes[key]; // Ignore undefined values. | |
| 8370 | - | |
| 8371 | - if (undefined === value) { | |
| 8372 | - return accumulator; | |
| 8373 | - } // Ignore all attributes but the ones with an "undefined" source | |
| 8374 | - // "undefined" source refers to attributes saved in the block comment. | |
| 8375 | - | |
| 8376 | - | |
| 8377 | - if (attributeSchema.source !== undefined) { | |
| 8378 | - return accumulator; | |
| 8379 | - } // Ignore default value. | |
| 8380 | - | |
| 8381 | - | |
| 8382 | - if ('default' in attributeSchema && attributeSchema.default === value) { | |
| 8383 | - return accumulator; | |
| 8384 | - } // Otherwise, include in comment set. | |
| 8385 | - | |
| 8386 | - | |
| 8387 | - accumulator[key] = value; | |
| 8388 | - return accumulator; | |
| 8389 | - }, {}); | |
| 8390 | -} | |
| 8391 | -/** | |
| 8392 | - * Given an attributes object, returns a string in the serialized attributes | |
| 8393 | - * format prepared for post content. | |
| 8394 | - * | |
| 8395 | - * @param {Object} attributes Attributes object. | |
| 8396 | - * | |
| 8397 | - * @return {string} Serialized attributes. | |
| 8398 | - */ | |
| 8399 | - | |
| 8400 | -function serializeAttributes(attributes) { | |
| 8401 | - return JSON.stringify(attributes) // Don't break HTML comments. | |
| 8402 | - .replace(/--/g, '\\u002d\\u002d') // Don't break non-standard-compliant tools. | |
| 8403 | - .replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026') // Bypass server stripslashes behavior which would unescape stringify's | |
| 8404 | - // escaping of quotation mark. | |
| 8405 | - // | |
| 8406 | - // See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/ | |
| 8407 | - .replace(/\\"/g, '\\u0022'); | |
| 8408 | -} | |
| 8409 | -/** | |
| 8410 | - * Given a block object, returns the Block's Inner HTML markup. | |
| 8411 | - * | |
| 8412 | - * @param {Object} block Block instance. | |
| 8413 | - * | |
| 8414 | - * @return {string} HTML. | |
| 8415 | - */ | |
| 8416 | - | |
| 8417 | -function getBlockInnerHTML(block) { | |
| 8418 | - // If block was parsed as invalid or encounters an error while generating | |
| 8419 | - // save content, use original content instead to avoid content loss. If a | |
| 8420 | - // block contains nested content, exempt it from this condition because we | |
| 8421 | - // otherwise have no access to its original content and content loss would | |
| 8422 | - // still occur. | |
| 8423 | - let saveContent = block.originalContent; | |
| 8424 | - | |
| 8425 | - if (block.isValid || block.innerBlocks.length) { | |
| 8426 | - try { | |
| 8427 | - saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks); | |
| 8428 | - } catch (error) {} | |
| 8429 | - } | |
| 8430 | - | |
| 8431 | - return saveContent; | |
| 8432 | -} | |
| 8433 | -/** | |
| 8434 | - * Returns the content of a block, including comment delimiters. | |
| 8435 | - * | |
| 8436 | - * @param {string} rawBlockName Block name. | |
| 8437 | - * @param {Object} attributes Block attributes. | |
| 8438 | - * @param {string} content Block save content. | |
| 8439 | - * | |
| 8440 | - * @return {string} Comment-delimited block content. | |
| 8441 | - */ | |
| 8442 | - | |
| 8443 | -function getCommentDelimitedContent(rawBlockName, attributes, content) { | |
| 8444 | - const serializedAttributes = !(0,external_lodash_namespaceObject.isEmpty)(attributes) ? serializeAttributes(attributes) + ' ' : ''; // Strip core blocks of their namespace prefix. | |
| 8445 | - | |
| 8446 | - const blockName = (0,external_lodash_namespaceObject.startsWith)(rawBlockName, 'core/') ? rawBlockName.slice(5) : rawBlockName; // @todo make the `wp:` prefix potentially configurable. | |
| 8447 | - | |
| 8448 | - if (!content) { | |
| 8449 | - return `<!-- wp:${blockName} ${serializedAttributes}/-->`; | |
| 8450 | - } | |
| 8451 | - | |
| 8452 | - return `<!-- wp:${blockName} ${serializedAttributes}-->\n` + content + `\n<!-- /wp:${blockName} -->`; | |
| 8453 | -} | |
| 8454 | -/** | |
| 8455 | - * Returns the content of a block, including comment delimiters, determining | |
| 8456 | - * serialized attributes and content form from the current state of the block. | |
| 8457 | - * | |
| 8458 | - * @param {Object} block Block instance. | |
| 8459 | - * @param {WPBlockSerializationOptions} options Serialization options. | |
| 8460 | - * | |
| 8461 | - * @return {string} Serialized block. | |
| 8462 | - */ | |
| 8463 | - | |
| 8464 | -function serializeBlock(block) { | |
| 8465 | - let { | |
| 8466 | - isInnerBlocks = false | |
| 8467 | - } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 8468 | - const blockName = block.name; | |
| 8469 | - const saveContent = getBlockInnerHTML(block); | |
| 8470 | - | |
| 8471 | - if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { | |
| 8472 | - return saveContent; | |
| 8473 | - } | |
| 8474 | - | |
| 8475 | - const blockType = registration_getBlockType(blockName); | |
| 8476 | - const saveAttributes = getCommentAttributes(blockType, block.attributes); | |
| 8477 | - return getCommentDelimitedContent(blockName, saveAttributes, saveContent); | |
| 8478 | -} | |
| 8479 | -function __unstableSerializeAndClean(blocks) { | |
| 8480 | - // A single unmodified default block is assumed to | |
| 8481 | - // be equivalent to an empty post. | |
| 8482 | - if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) { | |
| 8483 | - blocks = []; | |
| 8484 | - } | |
| 8485 | - | |
| 8486 | - let content = serializer_serialize(blocks); // For compatibility, treat a post consisting of a | |
| 8487 | - // single freeform block as legacy content and apply | |
| 8488 | - // pre-block-editor removep'd content formatting. | |
| 8489 | - | |
| 8490 | - if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName()) { | |
| 8491 | - content = (0,external_wp_autop_namespaceObject.removep)(content); | |
| 8492 | - } | |
| 8493 | - | |
| 8494 | - return content; | |
| 8495 | -} | |
| 8496 | -/** | |
| 8497 | - * Takes a block or set of blocks and returns the serialized post content. | |
| 8498 | - * | |
| 8499 | - * @param {Array} blocks Block(s) to serialize. | |
| 8500 | - * @param {WPBlockSerializationOptions} options Serialization options. | |
| 8501 | - * | |
| 8502 | - * @return {string} The post content. | |
| 8503 | - */ | |
| 8504 | - | |
| 8505 | -function serializer_serialize(blocks, options) { | |
| 8506 | - return (0,external_lodash_namespaceObject.castArray)(blocks).map(block => serializeBlock(block, options)).join('\n\n'); | |
| 8507 | -} | |
| 8508 | -//# sourceMappingURL=serializer.js.map | |
| 8509 | -;// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js | |
| 8510 | -/** | |
| 8511 | - * generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json | |
| 8512 | - * do not edit | |
| 8513 | - */ | |
| 8514 | -var namedCharRefs = { | |
| 8515 | - 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" | |
| 8516 | -}; | |
| 8517 | - | |
| 8518 | -var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; | |
| 8519 | -var CHARCODE = /^#([0-9]+)$/; | |
| 8520 | -var NAMED = /^([A-Za-z0-9]+)$/; | |
| 8521 | -var EntityParser = /** @class */ (function () { | |
| 8522 | - function EntityParser(named) { | |
| 8523 | - this.named = named; | |
| 8524 | - } | |
| 8525 | - EntityParser.prototype.parse = function (entity) { | |
| 8526 | - if (!entity) { | |
| 8527 | - return; | |
| 8528 | - } | |
| 8529 | - var matches = entity.match(HEXCHARCODE); | |
| 8530 | - if (matches) { | |
| 8531 | - return String.fromCharCode(parseInt(matches[1], 16)); | |
| 8532 | - } | |
| 8533 | - matches = entity.match(CHARCODE); | |
| 8534 | - if (matches) { | |
| 8535 | - return String.fromCharCode(parseInt(matches[1], 10)); | |
| 8536 | - } | |
| 8537 | - matches = entity.match(NAMED); | |
| 8538 | - if (matches) { | |
| 8539 | - return this.named[matches[1]]; | |
| 8540 | - } | |
| 8541 | - }; | |
| 8542 | - return EntityParser; | |
| 8543 | -}()); | |
| 8544 | - | |
| 8545 | -var WSP = /[\t\n\f ]/; | |
| 8546 | -var ALPHA = /[A-Za-z]/; | |
| 8547 | -var CRLF = /\r\n?/g; | |
| 8548 | -function isSpace(char) { | |
| 8549 | - return WSP.test(char); | |
| 8550 | -} | |
| 8551 | -function isAlpha(char) { | |
| 8552 | - return ALPHA.test(char); | |
| 8553 | -} | |
| 8554 | -function preprocessInput(input) { | |
| 8555 | - return input.replace(CRLF, '\n'); | |
| 8556 | -} | |
| 8557 | - | |
| 8558 | -var EventedTokenizer = /** @class */ (function () { | |
| 8559 | - function EventedTokenizer(delegate, entityParser) { | |
| 8560 | - this.delegate = delegate; | |
| 8561 | - this.entityParser = entityParser; | |
| 8562 | - this.state = "beforeData" /* beforeData */; | |
| 8563 | - this.line = -1; | |
| 8564 | - this.column = -1; | |
| 8565 | - this.input = ''; | |
| 8566 | - this.index = -1; | |
| 8567 | - this.tagNameBuffer = ''; | |
| 8568 | - this.states = { | |
| 8569 | - beforeData: function () { | |
| 8570 | - var char = this.peek(); | |
| 8571 | - if (char === '<') { | |
| 8572 | - this.transitionTo("tagOpen" /* tagOpen */); | |
| 8573 | - this.markTagStart(); | |
| 8574 | - this.consume(); | |
| 8575 | - } | |
| 8576 | - else { | |
| 8577 | - if (char === '\n') { | |
| 8578 | - var tag = this.tagNameBuffer.toLowerCase(); | |
| 8579 | - if (tag === 'pre' || tag === 'textarea') { | |
| 8580 | - this.consume(); | |
| 8581 | - } | |
| 8582 | - } | |
| 8583 | - this.transitionTo("data" /* data */); | |
| 8584 | - this.delegate.beginData(); | |
| 8585 | - } | |
| 8586 | - }, | |
| 8587 | - data: function () { | |
| 8588 | - var char = this.peek(); | |
| 8589 | - if (char === '<') { | |
| 8590 | - this.delegate.finishData(); | |
| 8591 | - this.transitionTo("tagOpen" /* tagOpen */); | |
| 8592 | - this.markTagStart(); | |
| 8593 | - this.consume(); | |
| 8594 | - } | |
| 8595 | - else if (char === '&') { | |
| 8596 | - this.consume(); | |
| 8597 | - this.delegate.appendToData(this.consumeCharRef() || '&'); | |
| 8598 | - } | |
| 8599 | - else { | |
| 8600 | - this.consume(); | |
| 8601 | - this.delegate.appendToData(char); | |
| 8602 | - } | |
| 8603 | - }, | |
| 8604 | - tagOpen: function () { | |
| 8605 | - var char = this.consume(); | |
| 8606 | - if (char === '!') { | |
| 8607 | - this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */); | |
| 8608 | - } | |
| 8609 | - else if (char === '/') { | |
| 8610 | - this.transitionTo("endTagOpen" /* endTagOpen */); | |
| 8611 | - } | |
| 8612 | - else if (char === '@' || char === ':' || isAlpha(char)) { | |
| 8613 | - this.transitionTo("tagName" /* tagName */); | |
| 8614 | - this.tagNameBuffer = ''; | |
| 8615 | - this.delegate.beginStartTag(); | |
| 8616 | - this.appendToTagName(char); | |
| 8617 | - } | |
| 8618 | - }, | |
| 8619 | - markupDeclarationOpen: function () { | |
| 8620 | - var char = this.consume(); | |
| 8621 | - if (char === '-' && this.input.charAt(this.index) === '-') { | |
| 8622 | - this.consume(); | |
| 8623 | - this.transitionTo("commentStart" /* commentStart */); | |
| 8624 | - this.delegate.beginComment(); | |
| 8625 | - } | |
| 8626 | - }, | |
| 8627 | - commentStart: function () { | |
| 8628 | - var char = this.consume(); | |
| 8629 | - if (char === '-') { | |
| 8630 | - this.transitionTo("commentStartDash" /* commentStartDash */); | |
| 8631 | - } | |
| 8632 | - else if (char === '>') { | |
| 8633 | - this.delegate.finishComment(); | |
| 8634 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8635 | - } | |
| 8636 | - else { | |
| 8637 | - this.delegate.appendToCommentData(char); | |
| 8638 | - this.transitionTo("comment" /* comment */); | |
| 8639 | - } | |
| 8640 | - }, | |
| 8641 | - commentStartDash: function () { | |
| 8642 | - var char = this.consume(); | |
| 8643 | - if (char === '-') { | |
| 8644 | - this.transitionTo("commentEnd" /* commentEnd */); | |
| 8645 | - } | |
| 8646 | - else if (char === '>') { | |
| 8647 | - this.delegate.finishComment(); | |
| 8648 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8649 | - } | |
| 8650 | - else { | |
| 8651 | - this.delegate.appendToCommentData('-'); | |
| 8652 | - this.transitionTo("comment" /* comment */); | |
| 8653 | - } | |
| 8654 | - }, | |
| 8655 | - comment: function () { | |
| 8656 | - var char = this.consume(); | |
| 8657 | - if (char === '-') { | |
| 8658 | - this.transitionTo("commentEndDash" /* commentEndDash */); | |
| 8659 | - } | |
| 8660 | - else { | |
| 8661 | - this.delegate.appendToCommentData(char); | |
| 8662 | - } | |
| 8663 | - }, | |
| 8664 | - commentEndDash: function () { | |
| 8665 | - var char = this.consume(); | |
| 8666 | - if (char === '-') { | |
| 8667 | - this.transitionTo("commentEnd" /* commentEnd */); | |
| 8668 | - } | |
| 8669 | - else { | |
| 8670 | - this.delegate.appendToCommentData('-' + char); | |
| 8671 | - this.transitionTo("comment" /* comment */); | |
| 8672 | - } | |
| 8673 | - }, | |
| 8674 | - commentEnd: function () { | |
| 8675 | - var char = this.consume(); | |
| 8676 | - if (char === '>') { | |
| 8677 | - this.delegate.finishComment(); | |
| 8678 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8679 | - } | |
| 8680 | - else { | |
| 8681 | - this.delegate.appendToCommentData('--' + char); | |
| 8682 | - this.transitionTo("comment" /* comment */); | |
| 8683 | - } | |
| 8684 | - }, | |
| 8685 | - tagName: function () { | |
| 8686 | - var char = this.consume(); | |
| 8687 | - if (isSpace(char)) { | |
| 8688 | - this.transitionTo("beforeAttributeName" /* beforeAttributeName */); | |
| 8689 | - } | |
| 8690 | - else if (char === '/') { | |
| 8691 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8692 | - } | |
| 8693 | - else if (char === '>') { | |
| 8694 | - this.delegate.finishTag(); | |
| 8695 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8696 | - } | |
| 8697 | - else { | |
| 8698 | - this.appendToTagName(char); | |
| 8699 | - } | |
| 8700 | - }, | |
| 8701 | - beforeAttributeName: function () { | |
| 8702 | - var char = this.peek(); | |
| 8703 | - if (isSpace(char)) { | |
| 8704 | - this.consume(); | |
| 8705 | - return; | |
| 8706 | - } | |
| 8707 | - else if (char === '/') { | |
| 8708 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8709 | - this.consume(); | |
| 8710 | - } | |
| 8711 | - else if (char === '>') { | |
| 8712 | - this.consume(); | |
| 8713 | - this.delegate.finishTag(); | |
| 8714 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8715 | - } | |
| 8716 | - else if (char === '=') { | |
| 8717 | - this.delegate.reportSyntaxError('attribute name cannot start with equals sign'); | |
| 8718 | - this.transitionTo("attributeName" /* attributeName */); | |
| 8719 | - this.delegate.beginAttribute(); | |
| 8720 | - this.consume(); | |
| 8721 | - this.delegate.appendToAttributeName(char); | |
| 8722 | - } | |
| 8723 | - else { | |
| 8724 | - this.transitionTo("attributeName" /* attributeName */); | |
| 8725 | - this.delegate.beginAttribute(); | |
| 8726 | - } | |
| 8727 | - }, | |
| 8728 | - attributeName: function () { | |
| 8729 | - var char = this.peek(); | |
| 8730 | - if (isSpace(char)) { | |
| 8731 | - this.transitionTo("afterAttributeName" /* afterAttributeName */); | |
| 8732 | - this.consume(); | |
| 8733 | - } | |
| 8734 | - else if (char === '/') { | |
| 8735 | - this.delegate.beginAttributeValue(false); | |
| 8736 | - this.delegate.finishAttributeValue(); | |
| 8737 | - this.consume(); | |
| 8738 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8739 | - } | |
| 8740 | - else if (char === '=') { | |
| 8741 | - this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); | |
| 8742 | - this.consume(); | |
| 8743 | - } | |
| 8744 | - else if (char === '>') { | |
| 8745 | - this.delegate.beginAttributeValue(false); | |
| 8746 | - this.delegate.finishAttributeValue(); | |
| 8747 | - this.consume(); | |
| 8748 | - this.delegate.finishTag(); | |
| 8749 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8750 | - } | |
| 8751 | - else if (char === '"' || char === "'" || char === '<') { | |
| 8752 | - this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names'); | |
| 8753 | - this.consume(); | |
| 8754 | - this.delegate.appendToAttributeName(char); | |
| 8755 | - } | |
| 8756 | - else { | |
| 8757 | - this.consume(); | |
| 8758 | - this.delegate.appendToAttributeName(char); | |
| 8759 | - } | |
| 8760 | - }, | |
| 8761 | - afterAttributeName: function () { | |
| 8762 | - var char = this.peek(); | |
| 8763 | - if (isSpace(char)) { | |
| 8764 | - this.consume(); | |
| 8765 | - return; | |
| 8766 | - } | |
| 8767 | - else if (char === '/') { | |
| 8768 | - this.delegate.beginAttributeValue(false); | |
| 8769 | - this.delegate.finishAttributeValue(); | |
| 8770 | - this.consume(); | |
| 8771 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8772 | - } | |
| 8773 | - else if (char === '=') { | |
| 8774 | - this.consume(); | |
| 8775 | - this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */); | |
| 8776 | - } | |
| 8777 | - else if (char === '>') { | |
| 8778 | - this.delegate.beginAttributeValue(false); | |
| 8779 | - this.delegate.finishAttributeValue(); | |
| 8780 | - this.consume(); | |
| 8781 | - this.delegate.finishTag(); | |
| 8782 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8783 | - } | |
| 8784 | - else { | |
| 8785 | - this.delegate.beginAttributeValue(false); | |
| 8786 | - this.delegate.finishAttributeValue(); | |
| 8787 | - this.transitionTo("attributeName" /* attributeName */); | |
| 8788 | - this.delegate.beginAttribute(); | |
| 8789 | - this.consume(); | |
| 8790 | - this.delegate.appendToAttributeName(char); | |
| 8791 | - } | |
| 8792 | - }, | |
| 8793 | - beforeAttributeValue: function () { | |
| 8794 | - var char = this.peek(); | |
| 8795 | - if (isSpace(char)) { | |
| 8796 | - this.consume(); | |
| 8797 | - } | |
| 8798 | - else if (char === '"') { | |
| 8799 | - this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */); | |
| 8800 | - this.delegate.beginAttributeValue(true); | |
| 8801 | - this.consume(); | |
| 8802 | - } | |
| 8803 | - else if (char === "'") { | |
| 8804 | - this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */); | |
| 8805 | - this.delegate.beginAttributeValue(true); | |
| 8806 | - this.consume(); | |
| 8807 | - } | |
| 8808 | - else if (char === '>') { | |
| 8809 | - this.delegate.beginAttributeValue(false); | |
| 8810 | - this.delegate.finishAttributeValue(); | |
| 8811 | - this.consume(); | |
| 8812 | - this.delegate.finishTag(); | |
| 8813 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8814 | - } | |
| 8815 | - else { | |
| 8816 | - this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */); | |
| 8817 | - this.delegate.beginAttributeValue(false); | |
| 8818 | - this.consume(); | |
| 8819 | - this.delegate.appendToAttributeValue(char); | |
| 8820 | - } | |
| 8821 | - }, | |
| 8822 | - attributeValueDoubleQuoted: function () { | |
| 8823 | - var char = this.consume(); | |
| 8824 | - if (char === '"') { | |
| 8825 | - this.delegate.finishAttributeValue(); | |
| 8826 | - this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); | |
| 8827 | - } | |
| 8828 | - else if (char === '&') { | |
| 8829 | - this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); | |
| 8830 | - } | |
| 8831 | - else { | |
| 8832 | - this.delegate.appendToAttributeValue(char); | |
| 8833 | - } | |
| 8834 | - }, | |
| 8835 | - attributeValueSingleQuoted: function () { | |
| 8836 | - var char = this.consume(); | |
| 8837 | - if (char === "'") { | |
| 8838 | - this.delegate.finishAttributeValue(); | |
| 8839 | - this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */); | |
| 8840 | - } | |
| 8841 | - else if (char === '&') { | |
| 8842 | - this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); | |
| 8843 | - } | |
| 8844 | - else { | |
| 8845 | - this.delegate.appendToAttributeValue(char); | |
| 8846 | - } | |
| 8847 | - }, | |
| 8848 | - attributeValueUnquoted: function () { | |
| 8849 | - var char = this.peek(); | |
| 8850 | - if (isSpace(char)) { | |
| 8851 | - this.delegate.finishAttributeValue(); | |
| 8852 | - this.consume(); | |
| 8853 | - this.transitionTo("beforeAttributeName" /* beforeAttributeName */); | |
| 8854 | - } | |
| 8855 | - else if (char === '/') { | |
| 8856 | - this.delegate.finishAttributeValue(); | |
| 8857 | - this.consume(); | |
| 8858 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8859 | - } | |
| 8860 | - else if (char === '&') { | |
| 8861 | - this.consume(); | |
| 8862 | - this.delegate.appendToAttributeValue(this.consumeCharRef() || '&'); | |
| 8863 | - } | |
| 8864 | - else if (char === '>') { | |
| 8865 | - this.delegate.finishAttributeValue(); | |
| 8866 | - this.consume(); | |
| 8867 | - this.delegate.finishTag(); | |
| 8868 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8869 | - } | |
| 8870 | - else { | |
| 8871 | - this.consume(); | |
| 8872 | - this.delegate.appendToAttributeValue(char); | |
| 8873 | - } | |
| 8874 | - }, | |
| 8875 | - afterAttributeValueQuoted: function () { | |
| 8876 | - var char = this.peek(); | |
| 8877 | - if (isSpace(char)) { | |
| 8878 | - this.consume(); | |
| 8879 | - this.transitionTo("beforeAttributeName" /* beforeAttributeName */); | |
| 8880 | - } | |
| 8881 | - else if (char === '/') { | |
| 8882 | - this.consume(); | |
| 8883 | - this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */); | |
| 8884 | - } | |
| 8885 | - else if (char === '>') { | |
| 8886 | - this.consume(); | |
| 8887 | - this.delegate.finishTag(); | |
| 8888 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8889 | - } | |
| 8890 | - else { | |
| 8891 | - this.transitionTo("beforeAttributeName" /* beforeAttributeName */); | |
| 8892 | - } | |
| 8893 | - }, | |
| 8894 | - selfClosingStartTag: function () { | |
| 8895 | - var char = this.peek(); | |
| 8896 | - if (char === '>') { | |
| 8897 | - this.consume(); | |
| 8898 | - this.delegate.markTagAsSelfClosing(); | |
| 8899 | - this.delegate.finishTag(); | |
| 8900 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8901 | - } | |
| 8902 | - else { | |
| 8903 | - this.transitionTo("beforeAttributeName" /* beforeAttributeName */); | |
| 8904 | - } | |
| 8905 | - }, | |
| 8906 | - endTagOpen: function () { | |
| 8907 | - var char = this.consume(); | |
| 8908 | - if (char === '@' || char === ':' || isAlpha(char)) { | |
| 8909 | - this.transitionTo("tagName" /* tagName */); | |
| 8910 | - this.tagNameBuffer = ''; | |
| 8911 | - this.delegate.beginEndTag(); | |
| 8912 | - this.appendToTagName(char); | |
| 8913 | - } | |
| 8914 | - } | |
| 8915 | - }; | |
| 8916 | - this.reset(); | |
| 8917 | - } | |
| 8918 | - EventedTokenizer.prototype.reset = function () { | |
| 8919 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8920 | - this.input = ''; | |
| 8921 | - this.index = 0; | |
| 8922 | - this.line = 1; | |
| 8923 | - this.column = 0; | |
| 8924 | - this.delegate.reset(); | |
| 8925 | - }; | |
| 8926 | - EventedTokenizer.prototype.transitionTo = function (state) { | |
| 8927 | - this.state = state; | |
| 8928 | - }; | |
| 8929 | - EventedTokenizer.prototype.tokenize = function (input) { | |
| 8930 | - this.reset(); | |
| 8931 | - this.tokenizePart(input); | |
| 8932 | - this.tokenizeEOF(); | |
| 8933 | - }; | |
| 8934 | - EventedTokenizer.prototype.tokenizePart = function (input) { | |
| 8935 | - this.input += preprocessInput(input); | |
| 8936 | - while (this.index < this.input.length) { | |
| 8937 | - var handler = this.states[this.state]; | |
| 8938 | - if (handler !== undefined) { | |
| 8939 | - handler.call(this); | |
| 8940 | - } | |
| 8941 | - else { | |
| 8942 | - throw new Error("unhandled state " + this.state); | |
| 8943 | - } | |
| 8944 | - } | |
| 8945 | - }; | |
| 8946 | - EventedTokenizer.prototype.tokenizeEOF = function () { | |
| 8947 | - this.flushData(); | |
| 8948 | - }; | |
| 8949 | - EventedTokenizer.prototype.flushData = function () { | |
| 8950 | - if (this.state === 'data') { | |
| 8951 | - this.delegate.finishData(); | |
| 8952 | - this.transitionTo("beforeData" /* beforeData */); | |
| 8953 | - } | |
| 8954 | - }; | |
| 8955 | - EventedTokenizer.prototype.peek = function () { | |
| 8956 | - return this.input.charAt(this.index); | |
| 8957 | - }; | |
| 8958 | - EventedTokenizer.prototype.consume = function () { | |
| 8959 | - var char = this.peek(); | |
| 8960 | - this.index++; | |
| 8961 | - if (char === '\n') { | |
| 8962 | - this.line++; | |
| 8963 | - this.column = 0; | |
| 8964 | - } | |
| 8965 | - else { | |
| 8966 | - this.column++; | |
| 8967 | - } | |
| 8968 | - return char; | |
| 8969 | - }; | |
| 8970 | - EventedTokenizer.prototype.consumeCharRef = function () { | |
| 8971 | - var endIndex = this.input.indexOf(';', this.index); | |
| 8972 | - if (endIndex === -1) { | |
| 8973 | - return; | |
| 8974 | - } | |
| 8975 | - var entity = this.input.slice(this.index, endIndex); | |
| 8976 | - var chars = this.entityParser.parse(entity); | |
| 8977 | - if (chars) { | |
| 8978 | - var count = entity.length; | |
| 8979 | - // consume the entity chars | |
| 8980 | - while (count) { | |
| 8981 | - this.consume(); | |
| 8982 | - count--; | |
| 8983 | - } | |
| 8984 | - // consume the `;` | |
| 8985 | - this.consume(); | |
| 8986 | - return chars; | |
| 8987 | - } | |
| 8988 | - }; | |
| 8989 | - EventedTokenizer.prototype.markTagStart = function () { | |
| 8990 | - this.delegate.tagOpen(); | |
| 8991 | - }; | |
| 8992 | - EventedTokenizer.prototype.appendToTagName = function (char) { | |
| 8993 | - this.tagNameBuffer += char; | |
| 8994 | - this.delegate.appendToTagName(char); | |
| 8995 | - }; | |
| 8996 | - return EventedTokenizer; | |
| 8997 | -}()); | |
| 8998 | - | |
| 8999 | -var Tokenizer = /** @class */ (function () { | |
| 9000 | - function Tokenizer(entityParser, options) { | |
| 9001 | - if (options === void 0) { options = {}; } | |
| 9002 | - this.options = options; | |
| 9003 | - this.token = null; | |
| 9004 | - this.startLine = 1; | |
| 9005 | - this.startColumn = 0; | |
| 9006 | - this.tokens = []; | |
| 9007 | - this.tokenizer = new EventedTokenizer(this, entityParser); | |
| 9008 | - this._currentAttribute = undefined; | |
| 9009 | - } | |
| 9010 | - Tokenizer.prototype.tokenize = function (input) { | |
| 9011 | - this.tokens = []; | |
| 9012 | - this.tokenizer.tokenize(input); | |
| 9013 | - return this.tokens; | |
| 9014 | - }; | |
| 9015 | - Tokenizer.prototype.tokenizePart = function (input) { | |
| 9016 | - this.tokens = []; | |
| 9017 | - this.tokenizer.tokenizePart(input); | |
| 9018 | - return this.tokens; | |
| 9019 | - }; | |
| 9020 | - Tokenizer.prototype.tokenizeEOF = function () { | |
| 9021 | - this.tokens = []; | |
| 9022 | - this.tokenizer.tokenizeEOF(); | |
| 9023 | - return this.tokens[0]; | |
| 9024 | - }; | |
| 9025 | - Tokenizer.prototype.reset = function () { | |
| 9026 | - this.token = null; | |
| 9027 | - this.startLine = 1; | |
| 9028 | - this.startColumn = 0; | |
| 9029 | - }; | |
| 9030 | - Tokenizer.prototype.current = function () { | |
| 9031 | - var token = this.token; | |
| 9032 | - if (token === null) { | |
| 9033 | - throw new Error('token was unexpectedly null'); | |
| 9034 | - } | |
| 9035 | - if (arguments.length === 0) { | |
| 9036 | - return token; | |
| 9037 | - } | |
| 9038 | - for (var i = 0; i < arguments.length; i++) { | |
| 9039 | - if (token.type === arguments[i]) { | |
| 9040 | - return token; | |
| 9041 | - } | |
| 9042 | - } | |
| 9043 | - throw new Error("token type was unexpectedly " + token.type); | |
| 9044 | - }; | |
| 9045 | - Tokenizer.prototype.push = function (token) { | |
| 9046 | - this.token = token; | |
| 9047 | - this.tokens.push(token); | |
| 9048 | - }; | |
| 9049 | - Tokenizer.prototype.currentAttribute = function () { | |
| 9050 | - return this._currentAttribute; | |
| 9051 | - }; | |
| 9052 | - Tokenizer.prototype.addLocInfo = function () { | |
| 9053 | - if (this.options.loc) { | |
| 9054 | - this.current().loc = { | |
| 9055 | - start: { | |
| 9056 | - line: this.startLine, | |
| 9057 | - column: this.startColumn | |
| 9058 | - }, | |
| 9059 | - end: { | |
| 9060 | - line: this.tokenizer.line, | |
| 9061 | - column: this.tokenizer.column | |
| 9062 | - } | |
| 9063 | - }; | |
| 9064 | - } | |
| 9065 | - this.startLine = this.tokenizer.line; | |
| 9066 | - this.startColumn = this.tokenizer.column; | |
| 9067 | - }; | |
| 9068 | - // Data | |
| 9069 | - Tokenizer.prototype.beginData = function () { | |
| 9070 | - this.push({ | |
| 9071 | - type: "Chars" /* Chars */, | |
| 9072 | - chars: '' | |
| 9073 | - }); | |
| 9074 | - }; | |
| 9075 | - Tokenizer.prototype.appendToData = function (char) { | |
| 9076 | - this.current("Chars" /* Chars */).chars += char; | |
| 9077 | - }; | |
| 9078 | - Tokenizer.prototype.finishData = function () { | |
| 9079 | - this.addLocInfo(); | |
| 9080 | - }; | |
| 9081 | - // Comment | |
| 9082 | - Tokenizer.prototype.beginComment = function () { | |
| 9083 | - this.push({ | |
| 9084 | - type: "Comment" /* Comment */, | |
| 9085 | - chars: '' | |
| 9086 | - }); | |
| 9087 | - }; | |
| 9088 | - Tokenizer.prototype.appendToCommentData = function (char) { | |
| 9089 | - this.current("Comment" /* Comment */).chars += char; | |
| 9090 | - }; | |
| 9091 | - Tokenizer.prototype.finishComment = function () { | |
| 9092 | - this.addLocInfo(); | |
| 9093 | - }; | |
| 9094 | - // Tags - basic | |
| 9095 | - Tokenizer.prototype.tagOpen = function () { }; | |
| 9096 | - Tokenizer.prototype.beginStartTag = function () { | |
| 9097 | - this.push({ | |
| 9098 | - type: "StartTag" /* StartTag */, | |
| 9099 | - tagName: '', | |
| 9100 | - attributes: [], | |
| 9101 | - selfClosing: false | |
| 9102 | - }); | |
| 9103 | - }; | |
| 9104 | - Tokenizer.prototype.beginEndTag = function () { | |
| 9105 | - this.push({ | |
| 9106 | - type: "EndTag" /* EndTag */, | |
| 9107 | - tagName: '' | |
| 9108 | - }); | |
| 9109 | - }; | |
| 9110 | - Tokenizer.prototype.finishTag = function () { | |
| 9111 | - this.addLocInfo(); | |
| 9112 | - }; | |
| 9113 | - Tokenizer.prototype.markTagAsSelfClosing = function () { | |
| 9114 | - this.current("StartTag" /* StartTag */).selfClosing = true; | |
| 9115 | - }; | |
| 9116 | - // Tags - name | |
| 9117 | - Tokenizer.prototype.appendToTagName = function (char) { | |
| 9118 | - this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char; | |
| 9119 | - }; | |
| 9120 | - // Tags - attributes | |
| 9121 | - Tokenizer.prototype.beginAttribute = function () { | |
| 9122 | - this._currentAttribute = ['', '', false]; | |
| 9123 | - }; | |
| 9124 | - Tokenizer.prototype.appendToAttributeName = function (char) { | |
| 9125 | - this.currentAttribute()[0] += char; | |
| 9126 | - }; | |
| 9127 | - Tokenizer.prototype.beginAttributeValue = function (isQuoted) { | |
| 9128 | - this.currentAttribute()[2] = isQuoted; | |
| 9129 | - }; | |
| 9130 | - Tokenizer.prototype.appendToAttributeValue = function (char) { | |
| 9131 | - this.currentAttribute()[1] += char; | |
| 9132 | - }; | |
| 9133 | - Tokenizer.prototype.finishAttributeValue = function () { | |
| 9134 | - this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute); | |
| 9135 | - }; | |
| 9136 | - Tokenizer.prototype.reportSyntaxError = function (message) { | |
| 9137 | - this.current().syntaxError = message; | |
| 9138 | - }; | |
| 9139 | - return Tokenizer; | |
| 9140 | -}()); | |
| 9141 | - | |
| 9142 | -function tokenize(input, options) { | |
| 9143 | - var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options); | |
| 9144 | - return tokenizer.tokenize(input); | |
| 9145 | -} | |
| 9146 | - | |
| 9147 | - | |
| 9148 | -//# sourceMappingURL=index.js.map | |
| 9149 | -;// CONCATENATED MODULE: external ["wp","htmlEntities"] | |
| 9150 | -var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; | |
| 9151 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/validation/logger.js | |
| 9152 | -function createLogger() { | |
| 9153 | - /** | |
| 9154 | - * Creates a log handler with block validation prefix. | |
| 9155 | - * | |
| 9156 | - * @param {Function} logger Original logger function. | |
| 9157 | - * | |
| 9158 | - * @return {Function} Augmented logger function. | |
| 9159 | - */ | |
| 9160 | - function createLogHandler(logger) { | |
| 9161 | - let log = function (message) { | |
| 9162 | - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
| 9163 | - args[_key - 1] = arguments[_key]; | |
| 9164 | - } | |
| 9165 | - | |
| 9166 | - return logger('Block validation: ' + message, ...args); | |
| 9167 | - }; // In test environments, pre-process string substitutions to improve | |
| 9168 | - // readability of error messages. We'd prefer to avoid pulling in this | |
| 9169 | - // dependency in runtime environments, and it can be dropped by a combo | |
| 9170 | - // of Webpack env substitution + UglifyJS dead code elimination. | |
| 9171 | - | |
| 9172 | - | |
| 9173 | - if (false) {} | |
| 9174 | - | |
| 9175 | - return log; | |
| 9176 | - } | |
| 9177 | - | |
| 9178 | - return { | |
| 9179 | - // eslint-disable-next-line no-console | |
| 9180 | - error: createLogHandler(console.error), | |
| 9181 | - // eslint-disable-next-line no-console | |
| 9182 | - warning: createLogHandler(console.warn), | |
| 9183 | - | |
| 9184 | - getItems() { | |
| 9185 | - return []; | |
| 9186 | - } | |
| 9187 | - | |
| 9188 | - }; | |
| 9189 | -} | |
| 9190 | -function createQueuedLogger() { | |
| 9191 | - /** | |
| 9192 | - * The list of enqueued log actions to print. | |
| 9193 | - * | |
| 9194 | - * @type {Array} | |
| 9195 | - */ | |
| 9196 | - const queue = []; | |
| 9197 | - const logger = createLogger(); | |
| 9198 | - return { | |
| 9199 | - error() { | |
| 9200 | - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | |
| 9201 | - args[_key2] = arguments[_key2]; | |
| 9202 | - } | |
| 9203 | - | |
| 9204 | - queue.push({ | |
| 9205 | - log: logger.error, | |
| 9206 | - args | |
| 9207 | - }); | |
| 9208 | - }, | |
| 9209 | - | |
| 9210 | - warning() { | |
| 9211 | - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | |
| 9212 | - args[_key3] = arguments[_key3]; | |
| 9213 | - } | |
| 9214 | - | |
| 9215 | - queue.push({ | |
| 9216 | - log: logger.warning, | |
| 9217 | - args | |
| 9218 | - }); | |
| 9219 | - }, | |
| 9220 | - | |
| 9221 | - getItems() { | |
| 9222 | - return queue; | |
| 9223 | - } | |
| 9224 | - | |
| 9225 | - }; | |
| 9226 | -} | |
| 9227 | -//# sourceMappingURL=logger.js.map | |
| 9228 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/validation/index.js | |
| 9229 | -/** | |
| 9230 | - * External dependencies | |
| 9231 | - */ | |
| 9232 | - | |
| 9233 | - | |
| 9234 | -/** | |
| 9235 | - * WordPress dependencies | |
| 9236 | - */ | |
| 9237 | - | |
| 9238 | - | |
| 9239 | -/** | |
| 9240 | - * Internal dependencies | |
| 9241 | - */ | |
| 9242 | - | |
| 9243 | - | |
| 9244 | - | |
| 9245 | - | |
| 9246 | - | |
| 9247 | -/** | |
| 9248 | - * Globally matches any consecutive whitespace | |
| 9249 | - * | |
| 9250 | - * @type {RegExp} | |
| 9251 | - */ | |
| 9252 | - | |
| 9253 | -const REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; | |
| 9254 | -/** | |
| 9255 | - * Matches a string containing only whitespace | |
| 9256 | - * | |
| 9257 | - * @type {RegExp} | |
| 9258 | - */ | |
| 9259 | - | |
| 9260 | -const REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; | |
| 9261 | -/** | |
| 9262 | - * Matches a CSS URL type value | |
| 9263 | - * | |
| 9264 | - * @type {RegExp} | |
| 9265 | - */ | |
| 9266 | - | |
| 9267 | -const REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; | |
| 9268 | -/** | |
| 9269 | - * Boolean attributes are attributes whose presence as being assigned is | |
| 9270 | - * meaningful, even if only empty. | |
| 9271 | - * | |
| 9272 | - * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes | |
| 9273 | - * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 | |
| 9274 | - * | |
| 9275 | - * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) | |
| 9276 | - * .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 ) | |
| 9277 | - * .reduce( ( result, tr ) => Object.assign( result, { | |
| 9278 | - * [ tr.firstChild.textContent.trim() ]: true | |
| 9279 | - * } ), {} ) ).sort(); | |
| 9280 | - * | |
| 9281 | - * @type {Array} | |
| 9282 | - */ | |
| 9283 | - | |
| 9284 | -const BOOLEAN_ATTRIBUTES = ['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch']; | |
| 9285 | -/** | |
| 9286 | - * Enumerated attributes are attributes which must be of a specific value form. | |
| 9287 | - * Like boolean attributes, these are meaningful if specified, even if not of a | |
| 9288 | - * valid enumerated value. | |
| 9289 | - * | |
| 9290 | - * See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute | |
| 9291 | - * Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3 | |
| 9292 | - * | |
| 9293 | - * Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) ) | |
| 9294 | - * .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) ) | |
| 9295 | - * .reduce( ( result, tr ) => Object.assign( result, { | |
| 9296 | - * [ tr.firstChild.textContent.trim() ]: true | |
| 9297 | - * } ), {} ) ).sort(); | |
| 9298 | - * | |
| 9299 | - * @type {Array} | |
| 9300 | - */ | |
| 9301 | - | |
| 9302 | -const ENUMERATED_ATTRIBUTES = ['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap']; | |
| 9303 | -/** | |
| 9304 | - * Meaningful attributes are those who cannot be safely ignored when omitted in | |
| 9305 | - * one HTML markup string and not another. | |
| 9306 | - * | |
| 9307 | - * @type {Array} | |
| 9308 | - */ | |
| 9309 | - | |
| 9310 | -const MEANINGFUL_ATTRIBUTES = [...BOOLEAN_ATTRIBUTES, ...ENUMERATED_ATTRIBUTES]; | |
| 9311 | -/** | |
| 9312 | - * Array of functions which receive a text string on which to apply normalizing | |
| 9313 | - * behavior for consideration in text token equivalence, carefully ordered from | |
| 9314 | - * least-to-most expensive operations. | |
| 9315 | - * | |
| 9316 | - * @type {Array} | |
| 9317 | - */ | |
| 9318 | - | |
| 9319 | -const TEXT_NORMALIZATIONS = [external_lodash_namespaceObject.identity, getTextWithCollapsedWhitespace]; | |
| 9320 | -/** | |
| 9321 | - * Regular expression matching a named character reference. In lieu of bundling | |
| 9322 | - * a full set of references, the pattern covers the minimal necessary to test | |
| 9323 | - * positively against the full set. | |
| 9324 | - * | |
| 9325 | - * "The ampersand must be followed by one of the names given in the named | |
| 9326 | - * character references section, using the same case." | |
| 9327 | - * | |
| 9328 | - * Tested aginst "12.5 Named character references": | |
| 9329 | - * | |
| 9330 | - * ``` | |
| 9331 | - * const references = Array.from( document.querySelectorAll( | |
| 9332 | - * '#named-character-references-table tr[id^=entity-] td:first-child' | |
| 9333 | - * ) ).map( ( code ) => code.textContent ) | |
| 9334 | - * references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) ) | |
| 9335 | - * ``` | |
| 9336 | - * | |
| 9337 | - * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references | |
| 9338 | - * @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references | |
| 9339 | - * | |
| 9340 | - * @type {RegExp} | |
| 9341 | - */ | |
| 9342 | - | |
| 9343 | -const REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; | |
| 9344 | -/** | |
| 9345 | - * Regular expression matching a decimal character reference. | |
| 9346 | - * | |
| 9347 | - * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), | |
| 9348 | - * followed by one or more ASCII digits, representing a base-ten integer" | |
| 9349 | - * | |
| 9350 | - * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references | |
| 9351 | - * | |
| 9352 | - * @type {RegExp} | |
| 9353 | - */ | |
| 9354 | - | |
| 9355 | -const REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; | |
| 9356 | -/** | |
| 9357 | - * Regular expression matching a hexadecimal character reference. | |
| 9358 | - * | |
| 9359 | - * "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which | |
| 9360 | - * must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a | |
| 9361 | - * U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by | |
| 9362 | - * one or more ASCII hex digits, representing a hexadecimal integer" | |
| 9363 | - * | |
| 9364 | - * @see https://html.spec.whatwg.org/multipage/syntax.html#character-references | |
| 9365 | - * | |
| 9366 | - * @type {RegExp} | |
| 9367 | - */ | |
| 9368 | - | |
| 9369 | -const REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; | |
| 9370 | -/** | |
| 9371 | - * Returns true if the given string is a valid character reference segment, or | |
| 9372 | - * false otherwise. The text should be stripped of `&` and `;` demarcations. | |
| 9373 | - * | |
| 9374 | - * @param {string} text Text to test. | |
| 9375 | - * | |
| 9376 | - * @return {boolean} Whether text is valid character reference. | |
| 9377 | - */ | |
| 9378 | - | |
| 9379 | -function isValidCharacterReference(text) { | |
| 9380 | - return REGEXP_NAMED_CHARACTER_REFERENCE.test(text) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text); | |
| 9381 | -} | |
| 9382 | -/** | |
| 9383 | - * Subsitute EntityParser class for `simple-html-tokenizer` which uses the | |
| 9384 | - * implementation of `decodeEntities` from `html-entities`, in order to avoid | |
| 9385 | - * bundling a massive named character reference. | |
| 9386 | - * | |
| 9387 | - * @see https://github.com/tildeio/simple-html-tokenizer/tree/HEAD/src/entity-parser.ts | |
| 9388 | - */ | |
| 9389 | - | |
| 9390 | -class DecodeEntityParser { | |
| 9391 | - /** | |
| 9392 | - * Returns a substitute string for an entity string sequence between `&` | |
| 9393 | - * and `;`, or undefined if no substitution should occur. | |
| 9394 | - * | |
| 9395 | - * @param {string} entity Entity fragment discovered in HTML. | |
| 9396 | - * | |
| 9397 | - * @return {?string} Entity substitute value. | |
| 9398 | - */ | |
| 9399 | - parse(entity) { | |
| 9400 | - if (isValidCharacterReference(entity)) { | |
| 9401 | - return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)('&' + entity + ';'); | |
| 9402 | - } | |
| 9403 | - } | |
| 9404 | - | |
| 9405 | -} | |
| 9406 | -/** | |
| 9407 | - * Given a specified string, returns an array of strings split by consecutive | |
| 9408 | - * whitespace, ignoring leading or trailing whitespace. | |
| 9409 | - * | |
| 9410 | - * @param {string} text Original text. | |
| 9411 | - * | |
| 9412 | - * @return {string[]} Text pieces split on whitespace. | |
| 9413 | - */ | |
| 9414 | - | |
| 9415 | -function getTextPiecesSplitOnWhitespace(text) { | |
| 9416 | - return text.trim().split(REGEXP_WHITESPACE); | |
| 9417 | -} | |
| 9418 | -/** | |
| 9419 | - * Given a specified string, returns a new trimmed string where all consecutive | |
| 9420 | - * whitespace is collapsed to a single space. | |
| 9421 | - * | |
| 9422 | - * @param {string} text Original text. | |
| 9423 | - * | |
| 9424 | - * @return {string} Trimmed text with consecutive whitespace collapsed. | |
| 9425 | - */ | |
| 9426 | - | |
| 9427 | -function getTextWithCollapsedWhitespace(text) { | |
| 9428 | - // This is an overly simplified whitespace comparison. The specification is | |
| 9429 | - // more prescriptive of whitespace behavior in inline and block contexts. | |
| 9430 | - // | |
| 9431 | - // See: https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33 | |
| 9432 | - return getTextPiecesSplitOnWhitespace(text).join(' '); | |
| 9433 | -} | |
| 9434 | -/** | |
| 9435 | - * Returns attribute pairs of the given StartTag token, including only pairs | |
| 9436 | - * where the value is non-empty or the attribute is a boolean attribute, an | |
| 9437 | - * enumerated attribute, or a custom data- attribute. | |
| 9438 | - * | |
| 9439 | - * @see MEANINGFUL_ATTRIBUTES | |
| 9440 | - * | |
| 9441 | - * @param {Object} token StartTag token. | |
| 9442 | - * | |
| 9443 | - * @return {Array[]} Attribute pairs. | |
| 9444 | - */ | |
| 9445 | - | |
| 9446 | -function getMeaningfulAttributePairs(token) { | |
| 9447 | - return token.attributes.filter(pair => { | |
| 9448 | - const [key, value] = pair; | |
| 9449 | - return value || key.indexOf('data-') === 0 || (0,external_lodash_namespaceObject.includes)(MEANINGFUL_ATTRIBUTES, key); | |
| 9450 | - }); | |
| 9451 | -} | |
| 9452 | -/** | |
| 9453 | - * Returns true if two text tokens (with `chars` property) are equivalent, or | |
| 9454 | - * false otherwise. | |
| 9455 | - * | |
| 9456 | - * @param {Object} actual Actual token. | |
| 9457 | - * @param {Object} expected Expected token. | |
| 9458 | - * @param {Object} logger Validation logger object. | |
| 9459 | - * | |
| 9460 | - * @return {boolean} Whether two text tokens are equivalent. | |
| 9461 | - */ | |
| 9462 | - | |
| 9463 | -function isEquivalentTextTokens(actual, expected) { | |
| 9464 | - let logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); | |
| 9465 | - // This function is intentionally written as syntactically "ugly" as a hot | |
| 9466 | - // path optimization. Text is progressively normalized in order from least- | |
| 9467 | - // to-most operationally expensive, until the earliest point at which text | |
| 9468 | - // can be confidently inferred as being equal. | |
| 9469 | - let actualChars = actual.chars; | |
| 9470 | - let expectedChars = expected.chars; | |
| 9471 | - | |
| 9472 | - for (let i = 0; i < TEXT_NORMALIZATIONS.length; i++) { | |
| 9473 | - const normalize = TEXT_NORMALIZATIONS[i]; | |
| 9474 | - actualChars = normalize(actualChars); | |
| 9475 | - expectedChars = normalize(expectedChars); | |
| 9476 | - | |
| 9477 | - if (actualChars === expectedChars) { | |
| 9478 | - return true; | |
| 9479 | - } | |
| 9480 | - } | |
| 9481 | - | |
| 9482 | - logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars); | |
| 9483 | - return false; | |
| 9484 | -} | |
| 9485 | -/** | |
| 9486 | - * Given a CSS length value, returns a normalized CSS length value for strict equality | |
| 9487 | - * comparison. | |
| 9488 | - * | |
| 9489 | - * @param {string} value CSS length value. | |
| 9490 | - * | |
| 9491 | - * @return {string} Normalized CSS length value. | |
| 9492 | - */ | |
| 9493 | - | |
| 9494 | -function getNormalizedLength(value) { | |
| 9495 | - if (0 === parseFloat(value)) { | |
| 9496 | - return '0'; | |
| 9497 | - } // Normalize strings with floats to always include a leading zero. | |
| 9498 | - | |
| 9499 | - | |
| 9500 | - if (value.indexOf('.') === 0) { | |
| 9501 | - return '0' + value; | |
| 9502 | - } | |
| 9503 | - | |
| 9504 | - return value; | |
| 9505 | -} | |
| 9506 | -/** | |
| 9507 | - * Given a style value, returns a normalized style value for strict equality | |
| 9508 | - * comparison. | |
| 9509 | - * | |
| 9510 | - * @param {string} value Style value. | |
| 9511 | - * | |
| 9512 | - * @return {string} Normalized style value. | |
| 9513 | - */ | |
| 9514 | - | |
| 9515 | -function getNormalizedStyleValue(value) { | |
| 9516 | - const textPieces = getTextPiecesSplitOnWhitespace(value); | |
| 9517 | - const normalizedPieces = textPieces.map(getNormalizedLength); | |
| 9518 | - const result = normalizedPieces.join(' '); | |
| 9519 | - return result // Normalize URL type to omit whitespace or quotes | |
| 9520 | - .replace(REGEXP_STYLE_URL_TYPE, 'url($1)'); | |
| 9521 | -} | |
| 9522 | -/** | |
| 9523 | - * Given a style attribute string, returns an object of style properties. | |
| 9524 | - * | |
| 9525 | - * @param {string} text Style attribute. | |
| 9526 | - * | |
| 9527 | - * @return {Object} Style properties. | |
| 9528 | - */ | |
| 9529 | - | |
| 9530 | -function getStyleProperties(text) { | |
| 9531 | - const pairs = text // Trim ending semicolon (avoid including in split) | |
| 9532 | - .replace(/;?\s*$/, '') // Split on property assignment | |
| 9533 | - .split(';') // For each property assignment... | |
| 9534 | - .map(style => { | |
| 9535 | - // ...split further into key-value pairs | |
| 9536 | - const [key, ...valueParts] = style.split(':'); | |
| 9537 | - const value = valueParts.join(':'); | |
| 9538 | - return [key.trim(), getNormalizedStyleValue(value.trim())]; | |
| 9539 | - }); | |
| 9540 | - return (0,external_lodash_namespaceObject.fromPairs)(pairs); | |
| 9541 | -} | |
| 9542 | -/** | |
| 9543 | - * Attribute-specific equality handlers | |
| 9544 | - * | |
| 9545 | - * @type {Object} | |
| 9546 | - */ | |
| 9547 | - | |
| 9548 | -const isEqualAttributesOfName = { | |
| 9549 | - class: (actual, expected) => { | |
| 9550 | - // Class matches if members are the same, even if out of order or | |
| 9551 | - // superfluous whitespace between. | |
| 9552 | - return !(0,external_lodash_namespaceObject.xor)(...[actual, expected].map(getTextPiecesSplitOnWhitespace)).length; | |
| 9553 | - }, | |
| 9554 | - style: (actual, expected) => { | |
| 9555 | - return (0,external_lodash_namespaceObject.isEqual)(...[actual, expected].map(getStyleProperties)); | |
| 9556 | - }, | |
| 9557 | - // For each boolean attribute, mere presence of attribute in both is enough | |
| 9558 | - // to assume equivalence. | |
| 9559 | - ...(0,external_lodash_namespaceObject.fromPairs)(BOOLEAN_ATTRIBUTES.map(attribute => [attribute, external_lodash_namespaceObject.stubTrue])) | |
| 9560 | -}; | |
| 9561 | -/** | |
| 9562 | - * Given two sets of attribute tuples, returns true if the attribute sets are | |
| 9563 | - * equivalent. | |
| 9564 | - * | |
| 9565 | - * @param {Array[]} actual Actual attributes tuples. | |
| 9566 | - * @param {Array[]} expected Expected attributes tuples. | |
| 9567 | - * @param {Object} logger Validation logger object. | |
| 9568 | - * | |
| 9569 | - * @return {boolean} Whether attributes are equivalent. | |
| 9570 | - */ | |
| 9571 | - | |
| 9572 | -function isEqualTagAttributePairs(actual, expected) { | |
| 9573 | - let logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); | |
| 9574 | - | |
| 9575 | - // Attributes is tokenized as tuples. Their lengths should match. This also | |
| 9576 | - // avoids us needing to check both attributes sets, since if A has any keys | |
| 9577 | - // which do not exist in B, we know the sets to be different. | |
| 9578 | - if (actual.length !== expected.length) { | |
| 9579 | - logger.warning('Expected attributes %o, instead saw %o.', expected, actual); | |
| 9580 | - return false; | |
| 9581 | - } // Attributes are not guaranteed to occur in the same order. For validating | |
| 9582 | - // actual attributes, first convert the set of expected attribute values to | |
| 9583 | - // an object, for lookup by key. | |
| 9584 | - | |
| 9585 | - | |
| 9586 | - const expectedAttributes = {}; | |
| 9587 | - | |
| 9588 | - for (let i = 0; i < expected.length; i++) { | |
| 9589 | - expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1]; | |
| 9590 | - } | |
| 9591 | - | |
| 9592 | - for (let i = 0; i < actual.length; i++) { | |
| 9593 | - const [name, actualValue] = actual[i]; | |
| 9594 | - const nameLower = name.toLowerCase(); // As noted above, if missing member in B, assume different | |
| 9595 | - | |
| 9596 | - if (!expectedAttributes.hasOwnProperty(nameLower)) { | |
| 9597 | - logger.warning('Encountered unexpected attribute `%s`.', name); | |
| 9598 | - return false; | |
| 9599 | - } | |
| 9600 | - | |
| 9601 | - const expectedValue = expectedAttributes[nameLower]; | |
| 9602 | - const isEqualAttributes = isEqualAttributesOfName[nameLower]; | |
| 9603 | - | |
| 9604 | - if (isEqualAttributes) { | |
| 9605 | - // Defer custom attribute equality handling | |
| 9606 | - if (!isEqualAttributes(actualValue, expectedValue)) { | |
| 9607 | - logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); | |
| 9608 | - return false; | |
| 9609 | - } | |
| 9610 | - } else if (actualValue !== expectedValue) { | |
| 9611 | - // Otherwise strict inequality should bail | |
| 9612 | - logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue); | |
| 9613 | - return false; | |
| 9614 | - } | |
| 9615 | - } | |
| 9616 | - | |
| 9617 | - return true; | |
| 9618 | -} | |
| 9619 | -/** | |
| 9620 | - * Token-type-specific equality handlers | |
| 9621 | - * | |
| 9622 | - * @type {Object} | |
| 9623 | - */ | |
| 9624 | - | |
| 9625 | -const isEqualTokensOfType = { | |
| 9626 | - StartTag: function (actual, expected) { | |
| 9627 | - let logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); | |
| 9628 | - | |
| 9629 | - if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- | |
| 9630 | - // insensitive check on the assumption that the majority case will | |
| 9631 | - // have exactly equal tag names. | |
| 9632 | - actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { | |
| 9633 | - logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName); | |
| 9634 | - return false; | |
| 9635 | - } | |
| 9636 | - | |
| 9637 | - return isEqualTagAttributePairs(...[actual, expected].map(getMeaningfulAttributePairs), logger); | |
| 9638 | - }, | |
| 9639 | - Chars: isEquivalentTextTokens, | |
| 9640 | - Comment: isEquivalentTextTokens | |
| 9641 | -}; | |
| 9642 | -/** | |
| 9643 | - * Given an array of tokens, returns the first token which is not purely | |
| 9644 | - * whitespace. | |
| 9645 | - * | |
| 9646 | - * Mutates the tokens array. | |
| 9647 | - * | |
| 9648 | - * @param {Object[]} tokens Set of tokens to search. | |
| 9649 | - * | |
| 9650 | - * @return {Object} Next non-whitespace token. | |
| 9651 | - */ | |
| 9652 | - | |
| 9653 | -function getNextNonWhitespaceToken(tokens) { | |
| 9654 | - let token; | |
| 9655 | - | |
| 9656 | - while (token = tokens.shift()) { | |
| 9657 | - if (token.type !== 'Chars') { | |
| 9658 | - return token; | |
| 9659 | - } | |
| 9660 | - | |
| 9661 | - if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { | |
| 9662 | - return token; | |
| 9663 | - } | |
| 9664 | - } | |
| 9665 | -} | |
| 9666 | -/** | |
| 9667 | - * Tokenize an HTML string, gracefully handling any errors thrown during | |
| 9668 | - * underlying tokenization. | |
| 9669 | - * | |
| 9670 | - * @param {string} html HTML string to tokenize. | |
| 9671 | - * @param {Object} logger Validation logger object. | |
| 9672 | - * | |
| 9673 | - * @return {Object[]|null} Array of valid tokenized HTML elements, or null on error | |
| 9674 | - */ | |
| 9675 | - | |
| 9676 | -function getHTMLTokens(html) { | |
| 9677 | - let logger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createLogger(); | |
| 9678 | - | |
| 9679 | - try { | |
| 9680 | - return new Tokenizer(new DecodeEntityParser()).tokenize(html); | |
| 9681 | - } catch (e) { | |
| 9682 | - logger.warning('Malformed HTML detected: %s', html); | |
| 9683 | - } | |
| 9684 | - | |
| 9685 | - return null; | |
| 9686 | -} | |
| 9687 | -/** | |
| 9688 | - * Returns true if the next HTML token closes the current token. | |
| 9689 | - * | |
| 9690 | - * @param {Object} currentToken Current token to compare with. | |
| 9691 | - * @param {Object|undefined} nextToken Next token to compare against. | |
| 9692 | - * | |
| 9693 | - * @return {boolean} true if `nextToken` closes `currentToken`, false otherwise | |
| 9694 | - */ | |
| 9695 | - | |
| 9696 | - | |
| 9697 | -function isClosedByToken(currentToken, nextToken) { | |
| 9698 | - // Ensure this is a self closed token | |
| 9699 | - if (!currentToken.selfClosing) { | |
| 9700 | - return false; | |
| 9701 | - } // Check token names and determine if nextToken is the closing tag for currentToken | |
| 9702 | - | |
| 9703 | - | |
| 9704 | - if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === 'EndTag') { | |
| 9705 | - return true; | |
| 9706 | - } | |
| 9707 | - | |
| 9708 | - return false; | |
| 9709 | -} | |
| 9710 | -/** | |
| 9711 | - * Returns true if the given HTML strings are effectively equivalent, or | |
| 9712 | - * false otherwise. Invalid HTML is not considered equivalent, even if the | |
| 9713 | - * strings directly match. | |
| 9714 | - * | |
| 9715 | - * @param {string} actual Actual HTML string. | |
| 9716 | - * @param {string} expected Expected HTML string. | |
| 9717 | - * @param {Object} logger Validation logger object. | |
| 9718 | - * | |
| 9719 | - * @return {boolean} Whether HTML strings are equivalent. | |
| 9720 | - */ | |
| 9721 | - | |
| 9722 | -function isEquivalentHTML(actual, expected) { | |
| 9723 | - let logger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : createLogger(); | |
| 9724 | - | |
| 9725 | - // Short-circuit if markup is identical. | |
| 9726 | - if (actual === expected) { | |
| 9727 | - return true; | |
| 9728 | - } // Tokenize input content and reserialized save content | |
| 9729 | - | |
| 9730 | - | |
| 9731 | - const [actualTokens, expectedTokens] = [actual, expected].map(html => getHTMLTokens(html, logger)); // If either is malformed then stop comparing - the strings are not equivalent | |
| 9732 | - | |
| 9733 | - if (!actualTokens || !expectedTokens) { | |
| 9734 | - return false; | |
| 9735 | - } | |
| 9736 | - | |
| 9737 | - let actualToken, expectedToken; | |
| 9738 | - | |
| 9739 | - while (actualToken = getNextNonWhitespaceToken(actualTokens)) { | |
| 9740 | - expectedToken = getNextNonWhitespaceToken(expectedTokens); // Inequal if exhausted all expected tokens | |
| 9741 | - | |
| 9742 | - if (!expectedToken) { | |
| 9743 | - logger.warning('Expected end of content, instead saw %o.', actualToken); | |
| 9744 | - return false; | |
| 9745 | - } // Inequal if next non-whitespace token of each set are not same type | |
| 9746 | - | |
| 9747 | - | |
| 9748 | - if (actualToken.type !== expectedToken.type) { | |
| 9749 | - logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken); | |
| 9750 | - return false; | |
| 9751 | - } // Defer custom token type equality handling, otherwise continue and | |
| 9752 | - // assume as equal | |
| 9753 | - | |
| 9754 | - | |
| 9755 | - const isEqualTokens = isEqualTokensOfType[actualToken.type]; | |
| 9756 | - | |
| 9757 | - if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { | |
| 9758 | - return false; | |
| 9759 | - } // Peek at the next tokens (actual and expected) to see if they close | |
| 9760 | - // a self-closing tag | |
| 9761 | - | |
| 9762 | - | |
| 9763 | - if (isClosedByToken(actualToken, expectedTokens[0])) { | |
| 9764 | - // Consume the next expected token that closes the current actual | |
| 9765 | - // self-closing token | |
| 9766 | - getNextNonWhitespaceToken(expectedTokens); | |
| 9767 | - } else if (isClosedByToken(expectedToken, actualTokens[0])) { | |
| 9768 | - // Consume the next actual token that closes the current expected | |
| 9769 | - // self-closing token | |
| 9770 | - getNextNonWhitespaceToken(actualTokens); | |
| 9771 | - } | |
| 9772 | - } | |
| 9773 | - | |
| 9774 | - if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { | |
| 9775 | - // If any non-whitespace tokens remain in expected token set, this | |
| 9776 | - // indicates inequality | |
| 9777 | - logger.warning('Expected %o, instead saw end of content.', expectedToken); | |
| 9778 | - return false; | |
| 9779 | - } | |
| 9780 | - | |
| 9781 | - return true; | |
| 9782 | -} | |
| 9783 | -/** | |
| 9784 | - * Returns an object with `isValid` property set to `true` if the parsed block | |
| 9785 | - * is valid given the input content. A block is considered valid if, when serialized | |
| 9786 | - * with assumed attributes, the content matches the original value. If block is | |
| 9787 | - * invalid, this function returns all validations issues as well. | |
| 9788 | - * | |
| 9789 | - * @param {string|Object} blockTypeOrName Block type. | |
| 9790 | - * @param {Object} attributes Parsed block attributes. | |
| 9791 | - * @param {string} originalBlockContent Original block content. | |
| 9792 | - * @param {Object} logger Validation logger object. | |
| 9793 | - * | |
| 9794 | - * @return {Object} Whether block is valid and contains validation messages. | |
| 9795 | - */ | |
| 9796 | - | |
| 9797 | -/** | |
| 9798 | - * Returns an object with `isValid` property set to `true` if the parsed block | |
| 9799 | - * is valid given the input content. A block is considered valid if, when serialized | |
| 9800 | - * with assumed attributes, the content matches the original value. If block is | |
| 9801 | - * invalid, this function returns all validations issues as well. | |
| 9802 | - * | |
| 9803 | - * @param {import('../parser').WPBlock} block block object. | |
| 9804 | - * @param {import('../registration').WPBlockType} blockTypeOrName Block type or name. | |
| 9805 | - * | |
| 9806 | - * @return {[boolean,Object]} validation results. | |
| 9807 | - */ | |
| 9808 | - | |
| 9809 | -function validateBlock(block, blockTypeOrName) { | |
| 9810 | - const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName(); // Shortcut to avoid costly validation. | |
| 9811 | - | |
| 9812 | - if (isFallbackBlock) { | |
| 9813 | - return [true]; | |
| 9814 | - } | |
| 9815 | - | |
| 9816 | - const logger = createQueuedLogger(); | |
| 9817 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 9818 | - let generatedBlockContent; | |
| 9819 | - | |
| 9820 | - try { | |
| 9821 | - generatedBlockContent = getSaveContent(blockType, block.attributes); | |
| 9822 | - } catch (error) { | |
| 9823 | - logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString()); | |
| 9824 | - return [false, logger.getItems()]; | |
| 9825 | - } | |
| 9826 | - | |
| 9827 | - const isValid = isEquivalentHTML(block.originalContent, generatedBlockContent, logger); | |
| 9828 | - | |
| 9829 | - if (!isValid) { | |
| 9830 | - logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, block.originalContent); | |
| 9831 | - } | |
| 9832 | - | |
| 9833 | - return [isValid, logger.getItems()]; | |
| 9834 | -} | |
| 9835 | -/** | |
| 9836 | - * Returns true if the parsed block is valid given the input content. A block | |
| 9837 | - * is considered valid if, when serialized with assumed attributes, the content | |
| 9838 | - * matches the original value. | |
| 9839 | - * | |
| 9840 | - * Logs to console in development environments when invalid. | |
| 9841 | - * | |
| 9842 | - * @param {string|Object} blockTypeOrName Block type. | |
| 9843 | - * @param {Object} attributes Parsed block attributes. | |
| 9844 | - * @param {string} originalBlockContent Original block content. | |
| 9845 | - * | |
| 9846 | - * @return {boolean} Whether block is valid. | |
| 9847 | - */ | |
| 9848 | - | |
| 9849 | -function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { | |
| 9850 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 9851 | - const block = { | |
| 9852 | - name: blockType.name, | |
| 9853 | - attributes, | |
| 9854 | - innerBlocks: [], | |
| 9855 | - originalContent: originalBlockContent | |
| 9856 | - }; | |
| 9857 | - const [isValid] = validateBlock(block, blockType); | |
| 9858 | - return isValid; | |
| 9859 | -} | |
| 9860 | -//# sourceMappingURL=index.js.map | |
| 9861 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/convert-legacy-block.js | |
| 9862 | -/** | |
| 9863 | - * Convert legacy blocks to their canonical form. This function is used | |
| 9864 | - * both in the parser level for previous content and to convert such blocks | |
| 9865 | - * used in Custom Post Types templates. | |
| 9866 | - * | |
| 9867 | - * @param {string} name The block's name | |
| 9868 | - * @param {Object} attributes The block's attributes | |
| 9869 | - * | |
| 9870 | - * @return {[string, Object]} The block's name and attributes, changed accordingly if a match was found | |
| 9871 | - */ | |
| 9872 | -function convertLegacyBlockNameAndAttributes(name, attributes) { | |
| 9873 | - const newAttributes = { ...attributes | |
| 9874 | - }; // Convert 'core/cover-image' block in existing content to 'core/cover'. | |
| 9875 | - | |
| 9876 | - if ('core/cover-image' === name) { | |
| 9877 | - name = 'core/cover'; | |
| 9878 | - } // Convert 'core/text' blocks in existing content to 'core/paragraph'. | |
| 9879 | - | |
| 9880 | - | |
| 9881 | - if ('core/text' === name || 'core/cover-text' === name) { | |
| 9882 | - name = 'core/paragraph'; | |
| 9883 | - } // Convert derivative blocks such as 'core/social-link-wordpress' to the | |
| 9884 | - // canonical form 'core/social-link'. | |
| 9885 | - | |
| 9886 | - | |
| 9887 | - if (name && name.indexOf('core/social-link-') === 0) { | |
| 9888 | - // Capture `social-link-wordpress` into `{"service":"wordpress"}` | |
| 9889 | - newAttributes.service = name.substring(17); | |
| 9890 | - name = 'core/social-link'; | |
| 9891 | - } // Convert derivative blocks such as 'core-embed/instagram' to the | |
| 9892 | - // canonical form 'core/embed'. | |
| 9893 | - | |
| 9894 | - | |
| 9895 | - if (name && name.indexOf('core-embed/') === 0) { | |
| 9896 | - // Capture `core-embed/instagram` into `{"providerNameSlug":"instagram"}` | |
| 9897 | - const providerSlug = name.substring(11); | |
| 9898 | - const deprecated = { | |
| 9899 | - speaker: 'speaker-deck', | |
| 9900 | - polldaddy: 'crowdsignal' | |
| 9901 | - }; | |
| 9902 | - newAttributes.providerNameSlug = providerSlug in deprecated ? deprecated[providerSlug] : providerSlug; // this is needed as the `responsive` attribute was passed | |
| 9903 | - // in a different way before the refactoring to block variations | |
| 9904 | - | |
| 9905 | - if (!['amazon-kindle', 'wordpress'].includes(providerSlug)) { | |
| 9906 | - newAttributes.responsive = true; | |
| 9907 | - } | |
| 9908 | - | |
| 9909 | - name = 'core/embed'; | |
| 9910 | - } // Convert 'core/query-loop' blocks in existing content to 'core/post-template'. | |
| 9911 | - // TODO: Remove this check when WordPress 5.9 is released. | |
| 9912 | - | |
| 9913 | - | |
| 9914 | - if (name === 'core/query-loop') { | |
| 9915 | - name = 'core/post-template'; | |
| 9916 | - } // Convert Post Comment blocks in existing content to Comment blocks. | |
| 9917 | - // TODO: Remove these checks when WordPress 6.0 is released. | |
| 9918 | - | |
| 9919 | - | |
| 9920 | - if (name === 'core/post-comment-author') { | |
| 9921 | - name = 'core/comment-author-name'; | |
| 9922 | - } | |
| 9923 | - | |
| 9924 | - if (name === 'core/post-comment-content') { | |
| 9925 | - name = 'core/comment-content'; | |
| 9926 | - } | |
| 9927 | - | |
| 9928 | - if (name === 'core/post-comment-date') { | |
| 9929 | - name = 'core/comment-date'; | |
| 9930 | - } | |
| 9931 | - | |
| 9932 | - return [name, newAttributes]; | |
| 9933 | -} | |
| 9934 | -//# sourceMappingURL=convert-legacy-block.js.map | |
| 9935 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/serialize-raw-block.js | |
| 9936 | -/** | |
| 9937 | - * Internal dependencies | |
| 9938 | - */ | |
| 9939 | - | |
| 9940 | -/** | |
| 9941 | - * Serializes a block node into the native HTML-comment-powered block format. | |
| 9942 | - * CAVEAT: This function is intended for reserializing blocks as parsed by | |
| 9943 | - * valid parsers and skips any validation steps. This is NOT a generic | |
| 9944 | - * serialization function for in-memory blocks. For most purposes, see the | |
| 9945 | - * following functions available in the `@wordpress/blocks` package: | |
| 9946 | - * | |
| 9947 | - * @see serializeBlock | |
| 9948 | - * @see serialize | |
| 9949 | - * | |
| 9950 | - * For more on the format of block nodes as returned by valid parsers: | |
| 9951 | - * | |
| 9952 | - * @see `@wordpress/block-serialization-default-parser` package | |
| 9953 | - * @see `@wordpress/block-serialization-spec-parser` package | |
| 9954 | - * | |
| 9955 | - * @param {import(".").WPRawBlock} rawBlock A block node as returned by a valid parser. | |
| 9956 | - * @param {?Object} options Serialization options. | |
| 9957 | - * @param {?boolean} options.isCommentDelimited Whether to output HTML comments around blocks. | |
| 9958 | - * | |
| 9959 | - * @return {string} An HTML string representing a block. | |
| 9960 | - */ | |
| 9961 | - | |
| 9962 | -function serializeRawBlock(rawBlock) { | |
| 9963 | - let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | |
| 9964 | - const { | |
| 9965 | - isCommentDelimited = true | |
| 9966 | - } = options; | |
| 9967 | - const { | |
| 9968 | - blockName, | |
| 9969 | - attrs = {}, | |
| 9970 | - innerBlocks = [], | |
| 9971 | - innerContent = [] | |
| 9972 | - } = rawBlock; | |
| 9973 | - let childIndex = 0; | |
| 9974 | - const content = innerContent.map(item => // `null` denotes a nested block, otherwise we have an HTML fragment. | |
| 9975 | - item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)).join('\n').replace(/\n+/g, '\n').trim(); | |
| 9976 | - return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; | |
| 9977 | -} | |
| 9978 | -//# sourceMappingURL=serialize-raw-block.js.map | |
| 9979 | -;// CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js | |
| 9980 | -/** | |
| 9981 | - * Given object and string of dot-delimited path segments, returns value at | |
| 9982 | - * path or undefined if path cannot be resolved. | |
| 9983 | - * | |
| 9984 | - * @param {Object} object Lookup object | |
| 9985 | - * @param {string} path Path to resolve | |
| 9986 | - * @return {?*} Resolved value | |
| 9987 | - */ | |
| 9988 | -function getPath(object, path) { | |
| 9989 | - var segments = path.split('.'); | |
| 9990 | - var segment; | |
| 9991 | - | |
| 9992 | - while (segment = segments.shift()) { | |
| 9993 | - if (!(segment in object)) { | |
| 9994 | - return; | |
| 9995 | - } | |
| 9996 | - | |
| 9997 | - object = object[segment]; | |
| 9998 | - } | |
| 9999 | - | |
| 10000 | - return object; | |
| 10001 | -} | |
| 10002 | -;// CONCATENATED MODULE: ./node_modules/hpq/es/index.js | |
| 10003 | -/** | |
| 10004 | - * Internal dependencies | |
| 10005 | - */ | |
| 10006 | - | |
| 10007 | -/** | |
| 10008 | - * Function returning a DOM document created by `createHTMLDocument`. The same | |
| 10009 | - * document is returned between invocations. | |
| 10010 | - * | |
| 10011 | - * @return {Document} DOM document. | |
| 10012 | - */ | |
| 10013 | - | |
| 10014 | -var getDocument = function () { | |
| 10015 | - var doc; | |
| 10016 | - return function () { | |
| 10017 | - if (!doc) { | |
| 10018 | - doc = document.implementation.createHTMLDocument(''); | |
| 10019 | - } | |
| 10020 | - | |
| 10021 | - return doc; | |
| 10022 | - }; | |
| 10023 | -}(); | |
| 10024 | -/** | |
| 10025 | - * Given a markup string or DOM element, creates an object aligning with the | |
| 10026 | - * shape of the matchers object, or the value returned by the matcher. | |
| 10027 | - * | |
| 10028 | - * @param {(string|Element)} source Source content | |
| 10029 | - * @param {(Object|Function)} matchers Matcher function or object of matchers | |
| 10030 | - * @return {(Object|*)} Matched value(s), shaped by object | |
| 10031 | - */ | |
| 10032 | - | |
| 10033 | - | |
| 10034 | -function parse(source, matchers) { | |
| 10035 | - if (!matchers) { | |
| 10036 | - return; | |
| 10037 | - } // Coerce to element | |
| 10038 | - | |
| 10039 | - | |
| 10040 | - if ('string' === typeof source) { | |
| 10041 | - var doc = getDocument(); | |
| 10042 | - doc.body.innerHTML = source; | |
| 10043 | - source = doc.body; | |
| 10044 | - } // Return singular value | |
| 10045 | - | |
| 10046 | - | |
| 10047 | - if ('function' === typeof matchers) { | |
| 10048 | - return matchers(source); | |
| 10049 | - } // Bail if we can't handle matchers | |
| 10050 | - | |
| 10051 | - | |
| 10052 | - if (Object !== matchers.constructor) { | |
| 10053 | - return; | |
| 10054 | - } // Shape result by matcher object | |
| 10055 | - | |
| 10056 | - | |
| 10057 | - return Object.keys(matchers).reduce(function (memo, key) { | |
| 10058 | - memo[key] = parse(source, matchers[key]); | |
| 10059 | - return memo; | |
| 10060 | - }, {}); | |
| 10061 | -} | |
| 10062 | -/** | |
| 10063 | - * Generates a function which matches node of type selector, returning an | |
| 10064 | - * attribute by property if the attribute exists. If no selector is passed, | |
| 10065 | - * returns property of the query element. | |
| 10066 | - * | |
| 10067 | - * @param {?string} selector Optional selector | |
| 10068 | - * @param {string} name Property name | |
| 10069 | - * @return {*} Property value | |
| 10070 | - */ | |
| 10071 | - | |
| 10072 | -function prop(selector, name) { | |
| 10073 | - if (1 === arguments.length) { | |
| 10074 | - name = selector; | |
| 10075 | - selector = undefined; | |
| 10076 | - } | |
| 10077 | - | |
| 10078 | - return function (node) { | |
| 10079 | - var match = node; | |
| 10080 | - | |
| 10081 | - if (selector) { | |
| 10082 | - match = node.querySelector(selector); | |
| 10083 | - } | |
| 10084 | - | |
| 10085 | - if (match) { | |
| 10086 | - return getPath(match, name); | |
| 10087 | - } | |
| 10088 | - }; | |
| 10089 | -} | |
| 10090 | -/** | |
| 10091 | - * Generates a function which matches node of type selector, returning an | |
| 10092 | - * attribute by name if the attribute exists. If no selector is passed, | |
| 10093 | - * returns attribute of the query element. | |
| 10094 | - * | |
| 10095 | - * @param {?string} selector Optional selector | |
| 10096 | - * @param {string} name Attribute name | |
| 10097 | - * @return {?string} Attribute value | |
| 10098 | - */ | |
| 10099 | - | |
| 10100 | -function attr(selector, name) { | |
| 10101 | - if (1 === arguments.length) { | |
| 10102 | - name = selector; | |
| 10103 | - selector = undefined; | |
| 10104 | - } | |
| 10105 | - | |
| 10106 | - return function (node) { | |
| 10107 | - var attributes = prop(selector, 'attributes')(node); | |
| 10108 | - | |
| 10109 | - if (attributes && attributes.hasOwnProperty(name)) { | |
| 10110 | - return attributes[name].value; | |
| 10111 | - } | |
| 10112 | - }; | |
| 10113 | -} | |
| 10114 | -/** | |
| 10115 | - * Convenience for `prop( selector, 'innerHTML' )`. | |
| 10116 | - * | |
| 10117 | - * @see prop() | |
| 10118 | - * | |
| 10119 | - * @param {?string} selector Optional selector | |
| 10120 | - * @return {string} Inner HTML | |
| 10121 | - */ | |
| 10122 | - | |
| 10123 | -function html(selector) { | |
| 10124 | - return prop(selector, 'innerHTML'); | |
| 10125 | -} | |
| 10126 | -/** | |
| 10127 | - * Convenience for `prop( selector, 'textContent' )`. | |
| 10128 | - * | |
| 10129 | - * @see prop() | |
| 10130 | - * | |
| 10131 | - * @param {?string} selector Optional selector | |
| 10132 | - * @return {string} Text content | |
| 10133 | - */ | |
| 10134 | - | |
| 10135 | -function es_text(selector) { | |
| 10136 | - return prop(selector, 'textContent'); | |
| 10137 | -} | |
| 10138 | -/** | |
| 10139 | - * Creates a new matching context by first finding elements matching selector | |
| 10140 | - * using querySelectorAll before then running another `parse` on `matchers` | |
| 10141 | - * scoped to the matched elements. | |
| 10142 | - * | |
| 10143 | - * @see parse() | |
| 10144 | - * | |
| 10145 | - * @param {string} selector Selector to match | |
| 10146 | - * @param {(Object|Function)} matchers Matcher function or object of matchers | |
| 10147 | - * @return {Array.<*,Object>} Array of matched value(s) | |
| 10148 | - */ | |
| 10149 | - | |
| 10150 | -function query(selector, matchers) { | |
| 10151 | - return function (node) { | |
| 10152 | - var matches = node.querySelectorAll(selector); | |
| 10153 | - return [].map.call(matches, function (match) { | |
| 10154 | - return parse(match, matchers); | |
| 10155 | - }); | |
| 10156 | - }; | |
| 10157 | -} | |
| 10158 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/matchers.js | |
| 10159 | -/** | |
| 10160 | - * External dependencies | |
| 10161 | - */ | |
| 10162 | - | |
| 10163 | -/** | |
| 10164 | - * Internal dependencies | |
| 10165 | - */ | |
| 10166 | - | |
| 10167 | - | |
| 10168 | - | |
| 10169 | -function matchers_html(selector, multilineTag) { | |
| 10170 | - return domNode => { | |
| 10171 | - let match = domNode; | |
| 10172 | - | |
| 10173 | - if (selector) { | |
| 10174 | - match = domNode.querySelector(selector); | |
| 10175 | - } | |
| 10176 | - | |
| 10177 | - if (!match) { | |
| 10178 | - return ''; | |
| 10179 | - } | |
| 10180 | - | |
| 10181 | - if (multilineTag) { | |
| 10182 | - let value = ''; | |
| 10183 | - const length = match.children.length; | |
| 10184 | - | |
| 10185 | - for (let index = 0; index < length; index++) { | |
| 10186 | - const child = match.children[index]; | |
| 10187 | - | |
| 10188 | - if (child.nodeName.toLowerCase() !== multilineTag) { | |
| 10189 | - continue; | |
| 10190 | - } | |
| 10191 | - | |
| 10192 | - value += child.outerHTML; | |
| 10193 | - } | |
| 10194 | - | |
| 10195 | - return value; | |
| 10196 | - } | |
| 10197 | - | |
| 10198 | - return match.innerHTML; | |
| 10199 | - }; | |
| 10200 | -} | |
| 10201 | -//# sourceMappingURL=matchers.js.map | |
| 10202 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/node.js | |
| 10203 | -/** | |
| 10204 | - * Internal dependencies | |
| 10205 | - */ | |
| 10206 | - | |
| 10207 | -/** | |
| 10208 | - * A representation of a single node within a block's rich text value. If | |
| 10209 | - * representing a text node, the value is simply a string of the node value. | |
| 10210 | - * As representing an element node, it is an object of: | |
| 10211 | - * | |
| 10212 | - * 1. `type` (string): Tag name. | |
| 10213 | - * 2. `props` (object): Attributes and children array of WPBlockNode. | |
| 10214 | - * | |
| 10215 | - * @typedef {string|Object} WPBlockNode | |
| 10216 | - */ | |
| 10217 | - | |
| 10218 | -/** | |
| 10219 | - * Given a single node and a node type (e.g. `'br'`), returns true if the node | |
| 10220 | - * corresponds to that type, false otherwise. | |
| 10221 | - * | |
| 10222 | - * @param {WPBlockNode} node Block node to test | |
| 10223 | - * @param {string} type Node to type to test against. | |
| 10224 | - * | |
| 10225 | - * @return {boolean} Whether node is of intended type. | |
| 10226 | - */ | |
| 10227 | - | |
| 10228 | -function isNodeOfType(node, type) { | |
| 10229 | - return node && node.type === type; | |
| 10230 | -} | |
| 10231 | -/** | |
| 10232 | - * Given an object implementing the NamedNodeMap interface, returns a plain | |
| 10233 | - * object equivalent value of name, value key-value pairs. | |
| 10234 | - * | |
| 10235 | - * @see https://dom.spec.whatwg.org/#interface-namednodemap | |
| 10236 | - * | |
| 10237 | - * @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object. | |
| 10238 | - * | |
| 10239 | - * @return {Object} Object equivalent value of NamedNodeMap. | |
| 10240 | - */ | |
| 10241 | - | |
| 10242 | - | |
| 10243 | -function getNamedNodeMapAsObject(nodeMap) { | |
| 10244 | - const result = {}; | |
| 10245 | - | |
| 10246 | - for (let i = 0; i < nodeMap.length; i++) { | |
| 10247 | - const { | |
| 10248 | - name, | |
| 10249 | - value | |
| 10250 | - } = nodeMap[i]; | |
| 10251 | - result[name] = value; | |
| 10252 | - } | |
| 10253 | - | |
| 10254 | - return result; | |
| 10255 | -} | |
| 10256 | -/** | |
| 10257 | - * Given a DOM Element or Text node, returns an equivalent block node. Throws | |
| 10258 | - * if passed any node type other than element or text. | |
| 10259 | - * | |
| 10260 | - * @throws {TypeError} If non-element/text node is passed. | |
| 10261 | - * | |
| 10262 | - * @param {Node} domNode DOM node to convert. | |
| 10263 | - * | |
| 10264 | - * @return {WPBlockNode} Block node equivalent to DOM node. | |
| 10265 | - */ | |
| 10266 | - | |
| 10267 | -function fromDOM(domNode) { | |
| 10268 | - if (domNode.nodeType === domNode.TEXT_NODE) { | |
| 10269 | - return domNode.nodeValue; | |
| 10270 | - } | |
| 10271 | - | |
| 10272 | - if (domNode.nodeType !== domNode.ELEMENT_NODE) { | |
| 10273 | - throw new TypeError('A block node can only be created from a node of type text or ' + 'element.'); | |
| 10274 | - } | |
| 10275 | - | |
| 10276 | - return { | |
| 10277 | - type: domNode.nodeName.toLowerCase(), | |
| 10278 | - props: { ...getNamedNodeMapAsObject(domNode.attributes), | |
| 10279 | - children: children_fromDOM(domNode.childNodes) | |
| 10280 | - } | |
| 10281 | - }; | |
| 10282 | -} | |
| 10283 | -/** | |
| 10284 | - * Given a block node, returns its HTML string representation. | |
| 10285 | - * | |
| 10286 | - * @param {WPBlockNode} node Block node to convert to string. | |
| 10287 | - * | |
| 10288 | - * @return {string} String HTML representation of block node. | |
| 10289 | - */ | |
| 10290 | - | |
| 10291 | -function toHTML(node) { | |
| 10292 | - return children_toHTML([node]); | |
| 10293 | -} | |
| 10294 | -/** | |
| 10295 | - * Given a selector, returns an hpq matcher generating a WPBlockNode value | |
| 10296 | - * matching the selector result. | |
| 10297 | - * | |
| 10298 | - * @param {string} selector DOM selector. | |
| 10299 | - * | |
| 10300 | - * @return {Function} hpq matcher. | |
| 10301 | - */ | |
| 10302 | - | |
| 10303 | -function node_matcher(selector) { | |
| 10304 | - return domNode => { | |
| 10305 | - let match = domNode; | |
| 10306 | - | |
| 10307 | - if (selector) { | |
| 10308 | - match = domNode.querySelector(selector); | |
| 10309 | - } | |
| 10310 | - | |
| 10311 | - try { | |
| 10312 | - return fromDOM(match); | |
| 10313 | - } catch (error) { | |
| 10314 | - return null; | |
| 10315 | - } | |
| 10316 | - }; | |
| 10317 | -} | |
| 10318 | -/** | |
| 10319 | - * Object of utility functions used in managing block attribute values of | |
| 10320 | - * source `node`. | |
| 10321 | - * | |
| 10322 | - * @see https://github.com/WordPress/gutenberg/pull/10439 | |
| 10323 | - * | |
| 10324 | - * @deprecated since 4.0. The `node` source should not be used, and can be | |
| 10325 | - * replaced by the `html` source. | |
| 10326 | - * | |
| 10327 | - * @private | |
| 10328 | - */ | |
| 10329 | - | |
| 10330 | -/* harmony default export */ var node = ({ | |
| 10331 | - isNodeOfType, | |
| 10332 | - fromDOM, | |
| 10333 | - toHTML, | |
| 10334 | - matcher: node_matcher | |
| 10335 | -}); | |
| 10336 | -//# sourceMappingURL=node.js.map | |
| 10337 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/children.js | |
| 10338 | -/** | |
| 10339 | - * External dependencies | |
| 10340 | - */ | |
| 10341 | - | |
| 10342 | -/** | |
| 10343 | - * WordPress dependencies | |
| 10344 | - */ | |
| 10345 | - | |
| 10346 | - | |
| 10347 | -/** | |
| 10348 | - * Internal dependencies | |
| 10349 | - */ | |
| 10350 | - | |
| 10351 | - | |
| 10352 | -/** | |
| 10353 | - * A representation of a block's rich text value. | |
| 10354 | - * | |
| 10355 | - * @typedef {WPBlockNode[]} WPBlockChildren | |
| 10356 | - */ | |
| 10357 | - | |
| 10358 | -/** | |
| 10359 | - * Given block children, returns a serialize-capable WordPress element. | |
| 10360 | - * | |
| 10361 | - * @param {WPBlockChildren} children Block children object to convert. | |
| 10362 | - * | |
| 10363 | - * @return {WPElement} A serialize-capable element. | |
| 10364 | - */ | |
| 10365 | - | |
| 10366 | -function getSerializeCapableElement(children) { | |
| 10367 | - // The fact that block children are compatible with the element serializer is | |
| 10368 | - // merely an implementation detail that currently serves to be true, but | |
| 10369 | - // should not be mistaken as being a guarantee on the external API. The | |
| 10370 | - // public API only offers guarantees to work with strings (toHTML) and DOM | |
| 10371 | - // elements (fromDOM), and should provide utilities to manipulate the value | |
| 10372 | - // rather than expect consumers to inspect or construct its shape (concat). | |
| 10373 | - return children; | |
| 10374 | -} | |
| 10375 | -/** | |
| 10376 | - * Given block children, returns an array of block nodes. | |
| 10377 | - * | |
| 10378 | - * @param {WPBlockChildren} children Block children object to convert. | |
| 10379 | - * | |
| 10380 | - * @return {Array<WPBlockNode>} An array of individual block nodes. | |
| 10381 | - */ | |
| 10382 | - | |
| 10383 | -function getChildrenArray(children) { | |
| 10384 | - // The fact that block children are compatible with the element serializer | |
| 10385 | - // is merely an implementation detail that currently serves to be true, but | |
| 10386 | - // should not be mistaken as being a guarantee on the external API. | |
| 10387 | - return children; | |
| 10388 | -} | |
| 10389 | -/** | |
| 10390 | - * Given two or more block nodes, returns a new block node representing a | |
| 10391 | - * concatenation of its values. | |
| 10392 | - * | |
| 10393 | - * @param {...WPBlockChildren} blockNodes Block nodes to concatenate. | |
| 10394 | - * | |
| 10395 | - * @return {WPBlockChildren} Concatenated block node. | |
| 10396 | - */ | |
| 10397 | - | |
| 10398 | - | |
| 10399 | -function concat() { | |
| 10400 | - const result = []; | |
| 10401 | - | |
| 10402 | - for (let i = 0; i < arguments.length; i++) { | |
| 10403 | - const blockNode = (0,external_lodash_namespaceObject.castArray)(i < 0 || arguments.length <= i ? undefined : arguments[i]); | |
| 10404 | - | |
| 10405 | - for (let j = 0; j < blockNode.length; j++) { | |
| 10406 | - const child = blockNode[j]; | |
| 10407 | - const canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string'; | |
| 10408 | - | |
| 10409 | - if (canConcatToPreviousString) { | |
| 10410 | - result[result.length - 1] += child; | |
| 10411 | - } else { | |
| 10412 | - result.push(child); | |
| 10413 | - } | |
| 10414 | - } | |
| 10415 | - } | |
| 10416 | - | |
| 10417 | - return result; | |
| 10418 | -} | |
| 10419 | -/** | |
| 10420 | - * Given an iterable set of DOM nodes, returns equivalent block children. | |
| 10421 | - * Ignores any non-element/text nodes included in set. | |
| 10422 | - * | |
| 10423 | - * @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert. | |
| 10424 | - * | |
| 10425 | - * @return {WPBlockChildren} Block children equivalent to DOM nodes. | |
| 10426 | - */ | |
| 10427 | - | |
| 10428 | -function children_fromDOM(domNodes) { | |
| 10429 | - const result = []; | |
| 10430 | - | |
| 10431 | - for (let i = 0; i < domNodes.length; i++) { | |
| 10432 | - try { | |
| 10433 | - result.push(fromDOM(domNodes[i])); | |
| 10434 | - } catch (error) {// Simply ignore if DOM node could not be converted. | |
| 10435 | - } | |
| 10436 | - } | |
| 10437 | - | |
| 10438 | - return result; | |
| 10439 | -} | |
| 10440 | -/** | |
| 10441 | - * Given a block node, returns its HTML string representation. | |
| 10442 | - * | |
| 10443 | - * @param {WPBlockChildren} children Block node(s) to convert to string. | |
| 10444 | - * | |
| 10445 | - * @return {string} String HTML representation of block node. | |
| 10446 | - */ | |
| 10447 | - | |
| 10448 | -function children_toHTML(children) { | |
| 10449 | - const element = getSerializeCapableElement(children); | |
| 10450 | - return (0,external_wp_element_namespaceObject.renderToString)(element); | |
| 10451 | -} | |
| 10452 | -/** | |
| 10453 | - * Given a selector, returns an hpq matcher generating a WPBlockChildren value | |
| 10454 | - * matching the selector result. | |
| 10455 | - * | |
| 10456 | - * @param {string} selector DOM selector. | |
| 10457 | - * | |
| 10458 | - * @return {Function} hpq matcher. | |
| 10459 | - */ | |
| 10460 | - | |
| 10461 | -function children_matcher(selector) { | |
| 10462 | - return domNode => { | |
| 10463 | - let match = domNode; | |
| 10464 | - | |
| 10465 | - if (selector) { | |
| 10466 | - match = domNode.querySelector(selector); | |
| 10467 | - } | |
| 10468 | - | |
| 10469 | - if (match) { | |
| 10470 | - return children_fromDOM(match.childNodes); | |
| 10471 | - } | |
| 10472 | - | |
| 10473 | - return []; | |
| 10474 | - }; | |
| 10475 | -} | |
| 10476 | -/** | |
| 10477 | - * Object of utility functions used in managing block attribute values of | |
| 10478 | - * source `children`. | |
| 10479 | - * | |
| 10480 | - * @see https://github.com/WordPress/gutenberg/pull/10439 | |
| 10481 | - * | |
| 10482 | - * @deprecated since 4.0. The `children` source should not be used, and can be | |
| 10483 | - * replaced by the `html` source. | |
| 10484 | - * | |
| 10485 | - * @private | |
| 10486 | - */ | |
| 10487 | - | |
| 10488 | -/* harmony default export */ var children = ({ | |
| 10489 | - concat, | |
| 10490 | - getChildrenArray, | |
| 10491 | - fromDOM: children_fromDOM, | |
| 10492 | - toHTML: children_toHTML, | |
| 10493 | - matcher: children_matcher | |
| 10494 | -}); | |
| 10495 | -//# sourceMappingURL=children.js.map | |
| 10496 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/get-block-attributes.js | |
| 10497 | -/** | |
| 10498 | - * External dependencies | |
| 10499 | - */ | |
| 10500 | - | |
| 10501 | - | |
| 10502 | -/** | |
| 10503 | - * WordPress dependencies | |
| 10504 | - */ | |
| 10505 | - | |
| 10506 | - | |
| 10507 | -/** | |
| 10508 | - * Internal dependencies | |
| 10509 | - */ | |
| 10510 | - | |
| 10511 | - | |
| 10512 | - | |
| 10513 | -/** | |
| 10514 | - * Higher-order hpq matcher which enhances an attribute matcher to return true | |
| 10515 | - * or false depending on whether the original matcher returns undefined. This | |
| 10516 | - * is useful for boolean attributes (e.g. disabled) whose attribute values may | |
| 10517 | - * be technically falsey (empty string), though their mere presence should be | |
| 10518 | - * enough to infer as true. | |
| 10519 | - * | |
| 10520 | - * @param {Function} matcher Original hpq matcher. | |
| 10521 | - * | |
| 10522 | - * @return {Function} Enhanced hpq matcher. | |
| 10523 | - */ | |
| 10524 | - | |
| 10525 | -const toBooleanAttributeMatcher = matcher => (0,external_lodash_namespaceObject.flow)([matcher, // Expected values from `attr( 'disabled' )`: | |
| 10526 | -// | |
| 10527 | -// <input> | |
| 10528 | -// - Value: `undefined` | |
| 10529 | -// - Transformed: `false` | |
| 10530 | -// | |
| 10531 | -// <input disabled> | |
| 10532 | -// - Value: `''` | |
| 10533 | -// - Transformed: `true` | |
| 10534 | -// | |
| 10535 | -// <input disabled="disabled"> | |
| 10536 | -// - Value: `'disabled'` | |
| 10537 | -// - Transformed: `true` | |
| 10538 | -value => value !== undefined]); | |
| 10539 | -/** | |
| 10540 | - * Returns true if value is of the given JSON schema type, or false otherwise. | |
| 10541 | - * | |
| 10542 | - * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25 | |
| 10543 | - * | |
| 10544 | - * @param {*} value Value to test. | |
| 10545 | - * @param {string} type Type to test. | |
| 10546 | - * | |
| 10547 | - * @return {boolean} Whether value is of type. | |
| 10548 | - */ | |
| 10549 | - | |
| 10550 | -function isOfType(value, type) { | |
| 10551 | - switch (type) { | |
| 10552 | - case 'string': | |
| 10553 | - return typeof value === 'string'; | |
| 10554 | - | |
| 10555 | - case 'boolean': | |
| 10556 | - return typeof value === 'boolean'; | |
| 10557 | - | |
| 10558 | - case 'object': | |
| 10559 | - return !!value && value.constructor === Object; | |
| 10560 | - | |
| 10561 | - case 'null': | |
| 10562 | - return value === null; | |
| 10563 | - | |
| 10564 | - case 'array': | |
| 10565 | - return Array.isArray(value); | |
| 10566 | - | |
| 10567 | - case 'integer': | |
| 10568 | - case 'number': | |
| 10569 | - return typeof value === 'number'; | |
| 10570 | - } | |
| 10571 | - | |
| 10572 | - return true; | |
| 10573 | -} | |
| 10574 | -/** | |
| 10575 | - * Returns true if value is of an array of given JSON schema types, or false | |
| 10576 | - * otherwise. | |
| 10577 | - * | |
| 10578 | - * @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25 | |
| 10579 | - * | |
| 10580 | - * @param {*} value Value to test. | |
| 10581 | - * @param {string[]} types Types to test. | |
| 10582 | - * | |
| 10583 | - * @return {boolean} Whether value is of types. | |
| 10584 | - */ | |
| 10585 | - | |
| 10586 | -function isOfTypes(value, types) { | |
| 10587 | - return types.some(type => isOfType(value, type)); | |
| 10588 | -} | |
| 10589 | -/** | |
| 10590 | - * Given an attribute key, an attribute's schema, a block's raw content and the | |
| 10591 | - * commentAttributes returns the attribute value depending on its source | |
| 10592 | - * definition of the given attribute key. | |
| 10593 | - * | |
| 10594 | - * @param {string} attributeKey Attribute key. | |
| 10595 | - * @param {Object} attributeSchema Attribute's schema. | |
| 10596 | - * @param {string} innerHTML Block's raw content. | |
| 10597 | - * @param {Object} commentAttributes Block's comment attributes. | |
| 10598 | - * | |
| 10599 | - * @return {*} Attribute value. | |
| 10600 | - */ | |
| 10601 | - | |
| 10602 | -function getBlockAttribute(attributeKey, attributeSchema, innerHTML, commentAttributes) { | |
| 10603 | - const { | |
| 10604 | - type, | |
| 10605 | - enum: enumSet | |
| 10606 | - } = attributeSchema; | |
| 10607 | - let value; | |
| 10608 | - | |
| 10609 | - switch (attributeSchema.source) { | |
| 10610 | - // An undefined source means that it's an attribute serialized to the | |
| 10611 | - // block's "comment". | |
| 10612 | - case undefined: | |
| 10613 | - value = commentAttributes ? commentAttributes[attributeKey] : undefined; | |
| 10614 | - break; | |
| 10615 | - | |
| 10616 | - case 'attribute': | |
| 10617 | - case 'property': | |
| 10618 | - case 'html': | |
| 10619 | - case 'text': | |
| 10620 | - case 'children': | |
| 10621 | - case 'node': | |
| 10622 | - case 'query': | |
| 10623 | - case 'tag': | |
| 10624 | - value = parseWithAttributeSchema(innerHTML, attributeSchema); | |
| 10625 | - break; | |
| 10626 | - } | |
| 10627 | - | |
| 10628 | - if (!isValidByType(value, type) || !isValidByEnum(value, enumSet)) { | |
| 10629 | - // Reject the value if it is not valid. Reverting to the undefined | |
| 10630 | - // value ensures the default is respected, if applicable. | |
| 10631 | - value = undefined; | |
| 10632 | - } | |
| 10633 | - | |
| 10634 | - if (value === undefined) { | |
| 10635 | - return attributeSchema.default; | |
| 10636 | - } | |
| 10637 | - | |
| 10638 | - return value; | |
| 10639 | -} | |
| 10640 | -/** | |
| 10641 | - * Returns true if value is valid per the given block attribute schema type | |
| 10642 | - * definition, or false otherwise. | |
| 10643 | - * | |
| 10644 | - * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1 | |
| 10645 | - * | |
| 10646 | - * @param {*} value Value to test. | |
| 10647 | - * @param {?(Array<string>|string)} type Block attribute schema type. | |
| 10648 | - * | |
| 10649 | - * @return {boolean} Whether value is valid. | |
| 10650 | - */ | |
| 10651 | - | |
| 10652 | -function isValidByType(value, type) { | |
| 10653 | - return type === undefined || isOfTypes(value, (0,external_lodash_namespaceObject.castArray)(type)); | |
| 10654 | -} | |
| 10655 | -/** | |
| 10656 | - * Returns true if value is valid per the given block attribute schema enum | |
| 10657 | - * definition, or false otherwise. | |
| 10658 | - * | |
| 10659 | - * @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2 | |
| 10660 | - * | |
| 10661 | - * @param {*} value Value to test. | |
| 10662 | - * @param {?Array} enumSet Block attribute schema enum. | |
| 10663 | - * | |
| 10664 | - * @return {boolean} Whether value is valid. | |
| 10665 | - */ | |
| 10666 | - | |
| 10667 | -function isValidByEnum(value, enumSet) { | |
| 10668 | - return !Array.isArray(enumSet) || enumSet.includes(value); | |
| 10669 | -} | |
| 10670 | -/** | |
| 10671 | - * Returns an hpq matcher given a source object. | |
| 10672 | - * | |
| 10673 | - * @param {Object} sourceConfig Attribute Source object. | |
| 10674 | - * | |
| 10675 | - * @return {Function} A hpq Matcher. | |
| 10676 | - */ | |
| 10677 | - | |
| 10678 | -function matcherFromSource(sourceConfig) { | |
| 10679 | - switch (sourceConfig.source) { | |
| 10680 | - case 'attribute': | |
| 10681 | - let matcher = attr(sourceConfig.selector, sourceConfig.attribute); | |
| 10682 | - | |
| 10683 | - if (sourceConfig.type === 'boolean') { | |
| 10684 | - matcher = toBooleanAttributeMatcher(matcher); | |
| 10685 | - } | |
| 10686 | - | |
| 10687 | - return matcher; | |
| 10688 | - | |
| 10689 | - case 'html': | |
| 10690 | - return matchers_html(sourceConfig.selector, sourceConfig.multiline); | |
| 10691 | - | |
| 10692 | - case 'text': | |
| 10693 | - return es_text(sourceConfig.selector); | |
| 10694 | - | |
| 10695 | - case 'children': | |
| 10696 | - return children_matcher(sourceConfig.selector); | |
| 10697 | - | |
| 10698 | - case 'node': | |
| 10699 | - return node_matcher(sourceConfig.selector); | |
| 10700 | - | |
| 10701 | - case 'query': | |
| 10702 | - const subMatchers = (0,external_lodash_namespaceObject.mapValues)(sourceConfig.query, matcherFromSource); | |
| 10703 | - return query(sourceConfig.selector, subMatchers); | |
| 10704 | - | |
| 10705 | - case 'tag': | |
| 10706 | - return (0,external_lodash_namespaceObject.flow)([prop(sourceConfig.selector, 'nodeName'), nodeName => nodeName ? nodeName.toLowerCase() : undefined]); | |
| 10707 | - | |
| 10708 | - default: | |
| 10709 | - // eslint-disable-next-line no-console | |
| 10710 | - console.error(`Unknown source type "${sourceConfig.source}"`); | |
| 10711 | - } | |
| 10712 | -} | |
| 10713 | -/** | |
| 10714 | - * Given a block's raw content and an attribute's schema returns the attribute's | |
| 10715 | - * value depending on its source. | |
| 10716 | - * | |
| 10717 | - * @param {string} innerHTML Block's raw content. | |
| 10718 | - * @param {Object} attributeSchema Attribute's schema. | |
| 10719 | - * | |
| 10720 | - * @return {*} Attribute value. | |
| 10721 | - */ | |
| 10722 | - | |
| 10723 | -function parseWithAttributeSchema(innerHTML, attributeSchema) { | |
| 10724 | - return parse(innerHTML, matcherFromSource(attributeSchema)); | |
| 10725 | -} | |
| 10726 | -/** | |
| 10727 | - * Returns the block attributes of a registered block node given its type. | |
| 10728 | - * | |
| 10729 | - * @param {string|Object} blockTypeOrName Block type or name. | |
| 10730 | - * @param {string} innerHTML Raw block content. | |
| 10731 | - * @param {?Object} attributes Known block attributes (from delimiters). | |
| 10732 | - * | |
| 10733 | - * @return {Object} All block attributes. | |
| 10734 | - */ | |
| 10735 | - | |
| 10736 | -function getBlockAttributes(blockTypeOrName, innerHTML) { | |
| 10737 | - let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | |
| 10738 | - const blockType = normalizeBlockType(blockTypeOrName); | |
| 10739 | - const blockAttributes = (0,external_lodash_namespaceObject.mapValues)(blockType.attributes, (attributeSchema, attributeKey) => { | |
| 10740 | - return getBlockAttribute(attributeKey, attributeSchema, innerHTML, attributes); | |
| 10741 | - }); | |
| 10742 | - return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes); | |
| 10743 | -} | |
| 10744 | -//# sourceMappingURL=get-block-attributes.js.map | |
| 10745 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/fix-custom-classname.js | |
| 10746 | -/** | |
| 10747 | - * External dependencies | |
| 10748 | - */ | |
| 10749 | - | |
| 10750 | -/** | |
| 10751 | - * Internal dependencies | |
| 10752 | - */ | |
| 10753 | - | |
| 10754 | - | |
| 10755 | - | |
| 10756 | - | |
| 10757 | -/** | |
| 10758 | - * Given an HTML string, returns an array of class names assigned to the root | |
| 10759 | - * element in the markup. | |
| 10760 | - * | |
| 10761 | - * @param {string} innerHTML Markup string from which to extract classes. | |
| 10762 | - * | |
| 10763 | - * @return {string[]} Array of class names assigned to the root element. | |
| 10764 | - */ | |
| 10765 | - | |
| 10766 | -function getHTMLRootElementClasses(innerHTML) { | |
| 10767 | - innerHTML = `<div data-custom-class-name>${innerHTML}</div>`; | |
| 10768 | - const parsed = parseWithAttributeSchema(innerHTML, { | |
| 10769 | - type: 'string', | |
| 10770 | - source: 'attribute', | |
| 10771 | - selector: '[data-custom-class-name] > *', | |
| 10772 | - attribute: 'class' | |
| 10773 | - }); | |
| 10774 | - return parsed ? parsed.trim().split(/\s+/) : []; | |
| 10775 | -} | |
| 10776 | -/** | |
| 10777 | - * Given a parsed set of block attributes, if the block supports custom class | |
| 10778 | - * names and an unknown class (per the block's serialization behavior) is | |
| 10779 | - * found, the unknown classes are treated as custom classes. This prevents the | |
| 10780 | - * block from being considered as invalid. | |
| 10781 | - * | |
| 10782 | - * @param {Object} blockAttributes Original block attributes. | |
| 10783 | - * @param {Object} blockType Block type settings. | |
| 10784 | - * @param {string} innerHTML Original block markup. | |
| 10785 | - * | |
| 10786 | - * @return {Object} Filtered block attributes. | |
| 10787 | - */ | |
| 10788 | - | |
| 10789 | -function fixCustomClassname(blockAttributes, blockType, innerHTML) { | |
| 10790 | - if (registration_hasBlockSupport(blockType, 'customClassName', true)) { | |
| 10791 | - // To determine difference, serialize block given the known set of | |
| 10792 | - // attributes, with the exception of `className`. This will determine | |
| 10793 | - // the default set of classes. From there, any difference in innerHTML | |
| 10794 | - // can be considered as custom classes. | |
| 10795 | - const attributesSansClassName = (0,external_lodash_namespaceObject.omit)(blockAttributes, ['className']); | |
| 10796 | - const serialized = getSaveContent(blockType, attributesSansClassName); | |
| 10797 | - const defaultClasses = getHTMLRootElementClasses(serialized); | |
| 10798 | - const actualClasses = getHTMLRootElementClasses(innerHTML); | |
| 10799 | - const customClasses = (0,external_lodash_namespaceObject.difference)(actualClasses, defaultClasses); | |
| 10800 | - | |
| 10801 | - if (customClasses.length) { | |
| 10802 | - blockAttributes.className = customClasses.join(' '); | |
| 10803 | - } else if (serialized) { | |
| 10804 | - delete blockAttributes.className; | |
| 10805 | - } | |
| 10806 | - } | |
| 10807 | - | |
| 10808 | - return blockAttributes; | |
| 10809 | -} | |
| 10810 | -//# sourceMappingURL=fix-custom-classname.js.map | |
| 10811 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.js | |
| 10812 | -/** | |
| 10813 | - * Internal dependencies | |
| 10814 | - */ | |
| 10815 | - | |
| 10816 | -/** | |
| 10817 | - * Attempts to fix block invalidation by applying build-in validation fixes | |
| 10818 | - * like moving all extra classNames to the className attribute. | |
| 10819 | - * | |
| 10820 | - * @param {WPBlock} block block object. | |
| 10821 | - * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and | |
| 10822 | - * can be inferred from the block name, | |
| 10823 | - * but it's here for performance reasons. | |
| 10824 | - * | |
| 10825 | - * @return {WPBlock} Fixed block object | |
| 10826 | - */ | |
| 10827 | - | |
| 10828 | -function applyBuiltInValidationFixes(block, blockType) { | |
| 10829 | - const updatedBlockAttributes = fixCustomClassname(block.attributes, blockType, block.originalContent); | |
| 10830 | - return { ...block, | |
| 10831 | - attributes: updatedBlockAttributes | |
| 10832 | - }; | |
| 10833 | -} | |
| 10834 | -//# sourceMappingURL=apply-built-in-validation-fixes.js.map | |
| 10835 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/apply-block-deprecated-versions.js | |
| 10836 | -/** | |
| 10837 | - * External dependencies | |
| 10838 | - */ | |
| 10839 | - | |
| 10840 | -/** | |
| 10841 | - * Internal dependencies | |
| 10842 | - */ | |
| 10843 | - | |
| 10844 | - | |
| 10845 | - | |
| 10846 | - | |
| 10847 | - | |
| 10848 | -/** | |
| 10849 | - * Given a block object, returns a new copy of the block with any applicable | |
| 10850 | - * deprecated migrations applied, or the original block if it was both valid | |
| 10851 | - * and no eligible migrations exist. | |
| 10852 | - * | |
| 10853 | - * @param {import(".").WPBlock} block Parsed and invalid block object. | |
| 10854 | - * @param {import(".").WPRawBlock} rawBlock Raw block object. | |
| 10855 | - * @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and | |
| 10856 | - * can be inferred from the block name, | |
| 10857 | - * but it's here for performance reasons. | |
| 10858 | - * | |
| 10859 | - * @return {import(".").WPBlock} Migrated block object. | |
| 10860 | - */ | |
| 10861 | - | |
| 10862 | -function applyBlockDeprecatedVersions(block, rawBlock, blockType) { | |
| 10863 | - const parsedAttributes = rawBlock.attrs; | |
| 10864 | - const { | |
| 10865 | - deprecated: deprecatedDefinitions | |
| 10866 | - } = blockType; // Bail early if there are no registered deprecations to be handled. | |
| 10867 | - | |
| 10868 | - if (!deprecatedDefinitions || !deprecatedDefinitions.length) { | |
| 10869 | - return block; | |
| 10870 | - } // By design, blocks lack any sort of version tracking. Instead, to process | |
| 10871 | - // outdated content the system operates a queue out of all the defined | |
| 10872 | - // attribute shapes and tries each definition until the input produces a | |
| 10873 | - // valid result. This mechanism seeks to avoid polluting the user-space with | |
| 10874 | - // machine-specific code. An invalid block is thus a block that could not be | |
| 10875 | - // matched successfully with any of the registered deprecation definitions. | |
| 10876 | - | |
| 10877 | - | |
| 10878 | - for (let i = 0; i < deprecatedDefinitions.length; i++) { | |
| 10879 | - // A block can opt into a migration even if the block is valid by | |
| 10880 | - // defining `isEligible` on its deprecation. If the block is both valid | |
| 10881 | - // and does not opt to migrate, skip. | |
| 10882 | - const { | |
| 10883 | - isEligible = external_lodash_namespaceObject.stubFalse | |
| 10884 | - } = deprecatedDefinitions[i]; | |
| 10885 | - | |
| 10886 | - if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks)) { | |
| 10887 | - continue; | |
| 10888 | - } // Block type properties which could impact either serialization or | |
| 10889 | - // parsing are not considered in the deprecated block type by default, | |
| 10890 | - // and must be explicitly provided. | |
| 10891 | - | |
| 10892 | - | |
| 10893 | - const deprecatedBlockType = Object.assign((0,external_lodash_namespaceObject.omit)(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]); | |
| 10894 | - let migratedBlock = { ...block, | |
| 10895 | - attributes: getBlockAttributes(deprecatedBlockType, block.originalContent, parsedAttributes) | |
| 10896 | - }; // Ignore the deprecation if it produces a block which is not valid. | |
| 10897 | - | |
| 10898 | - let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); // If the migrated block is not valid initially, try the built-in fixes. | |
| 10899 | - | |
| 10900 | - if (!isValid) { | |
| 10901 | - migratedBlock = applyBuiltInValidationFixes(migratedBlock, deprecatedBlockType); | |
| 10902 | - [isValid] = validateBlock(migratedBlock, deprecatedBlockType); | |
| 10903 | - } // An invalid block does not imply incorrect HTML but the fact block | |
| 10904 | - // source information could be lost on re-serialization. | |
| 10905 | - | |
| 10906 | - | |
| 10907 | - if (!isValid) { | |
| 10908 | - continue; | |
| 10909 | - } | |
| 10910 | - | |
| 10911 | - let migratedInnerBlocks = migratedBlock.innerBlocks; | |
| 10912 | - let migratedAttributes = migratedBlock.attributes; // A block may provide custom behavior to assign new attributes and/or | |
| 10913 | - // inner blocks. | |
| 10914 | - | |
| 10915 | - const { | |
| 10916 | - migrate | |
| 10917 | - } = deprecatedBlockType; | |
| 10918 | - | |
| 10919 | - if (migrate) { | |
| 10920 | - [migratedAttributes = parsedAttributes, migratedInnerBlocks = block.innerBlocks] = (0,external_lodash_namespaceObject.castArray)(migrate(migratedAttributes, block.innerBlocks)); | |
| 10921 | - } | |
| 10922 | - | |
| 10923 | - block = { ...block, | |
| 10924 | - attributes: migratedAttributes, | |
| 10925 | - innerBlocks: migratedInnerBlocks, | |
| 10926 | - isValid: true, | |
| 10927 | - validationIssues: [] | |
| 10928 | - }; | |
| 10929 | - } | |
| 10930 | - | |
| 10931 | - return block; | |
| 10932 | -} | |
| 10933 | -//# sourceMappingURL=apply-block-deprecated-versions.js.map | |
| 10934 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/parser/index.js | |
| 10935 | -/** | |
| 10936 | - * WordPress dependencies | |
| 10937 | - */ | |
| 10938 | - | |
| 10939 | - | |
| 10940 | -/** | |
| 10941 | - * Internal dependencies | |
| 10942 | - */ | |
| 10943 | - | |
| 10944 | - | |
| 10945 | - | |
| 10946 | - | |
| 10947 | - | |
| 10948 | - | |
| 10949 | - | |
| 10950 | - | |
| 10951 | - | |
| 10952 | - | |
| 10953 | -/** | |
| 10954 | - * The raw structure of a block includes its attributes, inner | |
| 10955 | - * blocks, and inner HTML. It is important to distinguish inner blocks from | |
| 10956 | - * the HTML content of the block as only the latter is relevant for block | |
| 10957 | - * validation and edit operations. | |
| 10958 | - * | |
| 10959 | - * @typedef WPRawBlock | |
| 10960 | - * | |
| 10961 | - * @property {string=} blockName Block name | |
| 10962 | - * @property {Object=} attrs Block raw or comment attributes. | |
| 10963 | - * @property {string} innerHTML HTML content of the block. | |
| 10964 | - * @property {(string|null)[]} innerContent Content without inner blocks. | |
| 10965 | - * @property {WPRawBlock[]} innerBlocks Inner Blocks. | |
| 10966 | - */ | |
| 10967 | - | |
| 10968 | -/** | |
| 10969 | - * Fully parsed block object. | |
| 10970 | - * | |
| 10971 | - * @typedef WPBlock | |
| 10972 | - * | |
| 10973 | - * @property {string} name Block name | |
| 10974 | - * @property {Object } attributes Block raw or comment attributes. | |
| 10975 | - * @property {WPBlock[]} innerBlocks Inner Blocks. | |
| 10976 | - * @property {string} originalContent Original content of the block before validation fixes. | |
| 10977 | - * @property {boolean} isValid Whether the block is valid. | |
| 10978 | - * @property {Object[]} validationIssues Validation issues. | |
| 10979 | - */ | |
| 10980 | - | |
| 10981 | -/** | |
| 10982 | - * Convert legacy blocks to their canonical form. This function is used | |
| 10983 | - * both in the parser level for previous content and to convert such blocks | |
| 10984 | - * used in Custom Post Types templates. | |
| 10985 | - * | |
| 10986 | - * @param {WPRawBlock} rawBlock | |
| 10987 | - * | |
| 10988 | - * @return {WPRawBlock} The block's name and attributes, changed accordingly if a match was found | |
| 10989 | - */ | |
| 10990 | - | |
| 10991 | -function convertLegacyBlocks(rawBlock) { | |
| 10992 | - const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(rawBlock.blockName, rawBlock.attrs); | |
| 10993 | - return { ...rawBlock, | |
| 10994 | - blockName: correctName, | |
| 10995 | - attrs: correctedAttributes | |
| 10996 | - }; | |
| 10997 | -} | |
| 10998 | -/** | |
| 10999 | - * Normalize the raw block by applying the fallback block name if none given, | |
| 11000 | - * sanitize the parsed HTML... | |
| 11001 | - * | |
| 11002 | - * @param {WPRawBlock} rawBlock The raw block object. | |
| 11003 | - * | |
| 11004 | - * @return {WPRawBlock} The normalized block object. | |
| 11005 | - */ | |
| 11006 | - | |
| 11007 | - | |
| 11008 | -function normalizeRawBlock(rawBlock) { | |
| 11009 | - const fallbackBlockName = getFreeformContentHandlerName(); // If the grammar parsing don't produce any block name, use the freeform block. | |
| 11010 | - | |
| 11011 | - const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName(); | |
| 11012 | - const rawAttributes = rawBlock.attrs || {}; | |
| 11013 | - const rawInnerBlocks = rawBlock.innerBlocks || []; | |
| 11014 | - let rawInnerHTML = rawBlock.innerHTML.trim(); // Fallback content may be upgraded from classic content expecting implicit | |
| 11015 | - // automatic paragraphs, so preserve them. Assumes wpautop is idempotent, | |
| 11016 | - // meaning there are no negative consequences to repeated autop calls. | |
| 11017 | - | |
| 11018 | - if (rawBlockName === fallbackBlockName) { | |
| 11019 | - rawInnerHTML = (0,external_wp_autop_namespaceObject.autop)(rawInnerHTML).trim(); | |
| 11020 | - } | |
| 11021 | - | |
| 11022 | - return { ...rawBlock, | |
| 11023 | - blockName: rawBlockName, | |
| 11024 | - attrs: rawAttributes, | |
| 11025 | - innerHTML: rawInnerHTML, | |
| 11026 | - innerBlocks: rawInnerBlocks | |
| 11027 | - }; | |
| 11028 | -} | |
| 11029 | -/** | |
| 11030 | - * Uses the "unregistered blockType" to create a block object. | |
| 11031 | - * | |
| 11032 | - * @param {WPRawBlock} rawBlock block. | |
| 11033 | - * | |
| 11034 | - * @return {WPRawBlock} The unregistered block object. | |
| 11035 | - */ | |
| 11036 | - | |
| 11037 | -function createMissingBlockType(rawBlock) { | |
| 11038 | - const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName(); // Preserve undelimited content for use by the unregistered type | |
| 11039 | - // handler. A block node's `innerHTML` isn't enough, as that field only | |
| 11040 | - // carries the block's own HTML and not its nested blocks. | |
| 11041 | - | |
| 11042 | - const originalUndelimitedContent = serializeRawBlock(rawBlock, { | |
| 11043 | - isCommentDelimited: false | |
| 11044 | - }); // Preserve full block content for use by the unregistered type | |
| 11045 | - // handler, block boundaries included. | |
| 11046 | - | |
| 11047 | - const originalContent = serializeRawBlock(rawBlock, { | |
| 11048 | - isCommentDelimited: true | |
| 11049 | - }); | |
| 11050 | - return { | |
| 11051 | - blockName: unregisteredFallbackBlock, | |
| 11052 | - attrs: { | |
| 11053 | - originalName: rawBlock.blockName, | |
| 11054 | - originalContent, | |
| 11055 | - originalUndelimitedContent | |
| 11056 | - }, | |
| 11057 | - innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML, | |
| 11058 | - innerBlocks: rawBlock.innerBlocks, | |
| 11059 | - innerContent: rawBlock.innerContent | |
| 11060 | - }; | |
| 11061 | -} | |
| 11062 | -/** | |
| 11063 | - * Validates a block and wraps with validation meta. | |
| 11064 | - * | |
| 11065 | - * The name here is regrettable but `validateBlock` is already taken. | |
| 11066 | - * | |
| 11067 | - * @param {WPBlock} unvalidatedBlock | |
| 11068 | - * @param {import('../registration').WPBlockType} blockType | |
| 11069 | - * @return {WPBlock} validated block, with auto-fixes if initially invalid | |
| 11070 | - */ | |
| 11071 | - | |
| 11072 | - | |
| 11073 | -function applyBlockValidation(unvalidatedBlock, blockType) { | |
| 11074 | - // Attempt to validate the block. | |
| 11075 | - const [isValid] = validateBlock(unvalidatedBlock, blockType); | |
| 11076 | - | |
| 11077 | - if (isValid) { | |
| 11078 | - return { ...unvalidatedBlock, | |
| 11079 | - isValid, | |
| 11080 | - validationIssues: [] | |
| 11081 | - }; | |
| 11082 | - } // If the block is invalid, attempt some built-in fixes | |
| 11083 | - // like custom classNames handling. | |
| 11084 | - | |
| 11085 | - | |
| 11086 | - const fixedBlock = applyBuiltInValidationFixes(unvalidatedBlock, blockType); // Attempt to validate the block once again after the built-in fixes. | |
| 11087 | - | |
| 11088 | - const [isFixedValid, validationIssues] = validateBlock(unvalidatedBlock, blockType); | |
| 11089 | - return { ...fixedBlock, | |
| 11090 | - isValid: isFixedValid, | |
| 11091 | - validationIssues | |
| 11092 | - }; | |
| 11093 | -} | |
| 11094 | -/** | |
| 11095 | - * Given a raw block returned by grammar parsing, returns a fully parsed block. | |
| 11096 | - * | |
| 11097 | - * @param {WPRawBlock} rawBlock The raw block object. | |
| 11098 | - * | |
| 11099 | - * @return {WPBlock} Fully parsed block. | |
| 11100 | - */ | |
| 11101 | - | |
| 11102 | - | |
| 11103 | -function parseRawBlock(rawBlock) { | |
| 11104 | - let normalizedBlock = normalizeRawBlock(rawBlock); // During the lifecycle of the project, we renamed some old blocks | |
| 11105 | - // and transformed others to new blocks. To avoid breaking existing content, | |
| 11106 | - // we added this function to properly parse the old content. | |
| 11107 | - | |
| 11108 | - normalizedBlock = convertLegacyBlocks(normalizedBlock); // Try finding the type for known block name. | |
| 11109 | - | |
| 11110 | - let blockType = registration_getBlockType(normalizedBlock.blockName); // If not blockType is found for the specified name, fallback to the "unregistedBlockType". | |
| 11111 | - | |
| 11112 | - if (!blockType) { | |
| 11113 | - normalizedBlock = createMissingBlockType(normalizedBlock); | |
| 11114 | - blockType = registration_getBlockType(normalizedBlock.blockName); | |
| 11115 | - } // If it's an empty freeform block or there's no blockType (no missing block handler) | |
| 11116 | - // Then, just ignore the block. | |
| 11117 | - // It might be a good idea to throw a warning here. | |
| 11118 | - // TODO: I'm unsure about the unregisteredFallbackBlock check, | |
| 11119 | - // it might ignore some dynamic unregistered third party blocks wrongly. | |
| 11120 | - | |
| 11121 | - | |
| 11122 | - const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName(); | |
| 11123 | - | |
| 11124 | - if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) { | |
| 11125 | - return; | |
| 11126 | - } // Parse inner blocks recursively. | |
| 11127 | - | |
| 11128 | - | |
| 11129 | - const parsedInnerBlocks = normalizedBlock.innerBlocks.map(parseRawBlock) // See https://github.com/WordPress/gutenberg/pull/17164. | |
| 11130 | - .filter(innerBlock => !!innerBlock); // Get the fully parsed block. | |
| 11131 | - | |
| 11132 | - const parsedBlock = createBlock(normalizedBlock.blockName, getBlockAttributes(blockType, normalizedBlock.innerHTML, normalizedBlock.attrs), parsedInnerBlocks); | |
| 11133 | - parsedBlock.originalContent = normalizedBlock.innerHTML; | |
| 11134 | - const validatedBlock = applyBlockValidation(parsedBlock, blockType); | |
| 11135 | - const { | |
| 11136 | - validationIssues | |
| 11137 | - } = validatedBlock; // Run the block deprecation and migrations. | |
| 11138 | - // This is performed on both invalid and valid blocks because | |
| 11139 | - // migration using the `migrate` functions should run even | |
| 11140 | - // if the output is deemed valid. | |
| 11141 | - | |
| 11142 | - const updatedBlock = applyBlockDeprecatedVersions(validatedBlock, normalizedBlock, blockType); | |
| 11143 | - | |
| 11144 | - if (!validatedBlock.isValid && updatedBlock.isValid) { | |
| 11145 | - /* eslint-disable no-console */ | |
| 11146 | - console.groupCollapsed('Updated Block: %s', blockType.name); | |
| 11147 | - console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, updatedBlock.attributes), updatedBlock.originalContent); | |
| 11148 | - console.groupEnd(); | |
| 11149 | - /* eslint-enable no-console */ | |
| 11150 | - } else if (!validatedBlock.isValid && !updatedBlock.isValid) { | |
| 11151 | - validationIssues.forEach(_ref => { | |
| 11152 | - let { | |
| 11153 | - log, | |
| 11154 | - args | |
| 11155 | - } = _ref; | |
| 11156 | - return log(...args); | |
| 11157 | - }); | |
| 11158 | - } | |
| 11159 | - | |
| 11160 | - return updatedBlock; | |
| 11161 | -} | |
| 11162 | -/** | |
| 11163 | - * Utilizes an optimized token-driven parser based on the Gutenberg grammar spec | |
| 11164 | - * defined through a parsing expression grammar to take advantage of the regular | |
| 11165 | - * cadence provided by block delimiters -- composed syntactically through HTML | |
| 11166 | - * comments -- which, given a general HTML document as an input, returns a block | |
| 11167 | - * list array representation. | |
| 11168 | - * | |
| 11169 | - * This is a recursive-descent parser that scans linearly once through the input | |
| 11170 | - * document. Instead of directly recursing it utilizes a trampoline mechanism to | |
| 11171 | - * prevent stack overflow. This initial pass is mainly interested in separating | |
| 11172 | - * and isolating the blocks serialized in the document and manifestly not in the | |
| 11173 | - * content within the blocks. | |
| 11174 | - * | |
| 11175 | - * @see | |
| 11176 | - * https://developer.wordpress.org/block-editor/packages/packages-block-serialization-default-parser/ | |
| 11177 | - * | |
| 11178 | - * @param {string} content The post content. | |
| 11179 | - * | |
| 11180 | - * @return {Array} Block list. | |
| 11181 | - */ | |
| 11182 | - | |
| 11183 | -function parser_parse(content) { | |
| 11184 | - return (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(content).reduce((accumulator, rawBlock) => { | |
| 11185 | - const block = parseRawBlock(rawBlock); | |
| 11186 | - | |
| 11187 | - if (block) { | |
| 11188 | - accumulator.push(block); | |
| 11189 | - } | |
| 11190 | - | |
| 11191 | - return accumulator; | |
| 11192 | - }, []); | |
| 11193 | -} | |
| 11194 | -//# sourceMappingURL=index.js.map | |
| 11195 | -;// CONCATENATED MODULE: external ["wp","deprecated"] | |
| 11196 | -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; | |
| 11197 | -var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); | |
| 11198 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/get-raw-transforms.js | |
| 11199 | -/** | |
| 11200 | - * External dependencies | |
| 11201 | - */ | |
| 11202 | - | |
| 11203 | -/** | |
| 11204 | - * Internal dependencies | |
| 11205 | - */ | |
| 11206 | - | |
| 11207 | - | |
| 11208 | -function getRawTransforms() { | |
| 11209 | - return (0,external_lodash_namespaceObject.filter)(getBlockTransforms('from'), { | |
| 11210 | - type: 'raw' | |
| 11211 | - }).map(transform => { | |
| 11212 | - return transform.isMatch ? transform : { ...transform, | |
| 11213 | - isMatch: node => transform.selector && node.matches(transform.selector) | |
| 11214 | - }; | |
| 11215 | - }); | |
| 11216 | -} | |
| 11217 | -//# sourceMappingURL=get-raw-transforms.js.map | |
| 11218 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/html-to-blocks.js | |
| 11219 | -/** | |
| 11220 | - * Internal dependencies | |
| 11221 | - */ | |
| 11222 | - | |
| 11223 | - | |
| 11224 | - | |
| 11225 | -/** | |
| 11226 | - * Converts HTML directly to blocks. Looks for a matching transform for each | |
| 11227 | - * top-level tag. The HTML should be filtered to not have any text between | |
| 11228 | - * top-level tags and formatted in a way that blocks can handle the HTML. | |
| 11229 | - * | |
| 11230 | - * @param {string} html HTML to convert. | |
| 11231 | - * | |
| 11232 | - * @return {Array} An array of blocks. | |
| 11233 | - */ | |
| 11234 | - | |
| 11235 | -function htmlToBlocks(html) { | |
| 11236 | - const doc = document.implementation.createHTMLDocument(''); | |
| 11237 | - doc.body.innerHTML = html; | |
| 11238 | - return Array.from(doc.body.children).flatMap(node => { | |
| 11239 | - const rawTransform = findTransform(getRawTransforms(), _ref => { | |
| 11240 | - let { | |
| 11241 | - isMatch | |
| 11242 | - } = _ref; | |
| 11243 | - return isMatch(node); | |
| 11244 | - }); | |
| 11245 | - | |
| 11246 | - if (!rawTransform) { | |
| 11247 | - return createBlock( // Should not be hardcoded. | |
| 11248 | - 'core/html', getBlockAttributes('core/html', node.outerHTML)); | |
| 11249 | - } | |
| 11250 | - | |
| 11251 | - const { | |
| 11252 | - transform, | |
| 11253 | - blockName | |
| 11254 | - } = rawTransform; | |
| 11255 | - | |
| 11256 | - if (transform) { | |
| 11257 | - return transform(node); | |
| 11258 | - } | |
| 11259 | - | |
| 11260 | - return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML)); | |
| 11261 | - }); | |
| 11262 | -} | |
| 11263 | -//# sourceMappingURL=html-to-blocks.js.map | |
| 11264 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/normalise-blocks.js | |
| 11265 | -/** | |
| 11266 | - * WordPress dependencies | |
| 11267 | - */ | |
| 11268 | - | |
| 11269 | -function normaliseBlocks(HTML) { | |
| 11270 | - const decuDoc = document.implementation.createHTMLDocument(''); | |
| 11271 | - const accuDoc = document.implementation.createHTMLDocument(''); | |
| 11272 | - const decu = decuDoc.body; | |
| 11273 | - const accu = accuDoc.body; | |
| 11274 | - decu.innerHTML = HTML; | |
| 11275 | - | |
| 11276 | - while (decu.firstChild) { | |
| 11277 | - const node = decu.firstChild; // Text nodes: wrap in a paragraph, or append to previous. | |
| 11278 | - | |
| 11279 | - if (node.nodeType === node.TEXT_NODE) { | |
| 11280 | - if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) { | |
| 11281 | - decu.removeChild(node); | |
| 11282 | - } else { | |
| 11283 | - if (!accu.lastChild || accu.lastChild.nodeName !== 'P') { | |
| 11284 | - accu.appendChild(accuDoc.createElement('P')); | |
| 11285 | - } | |
| 11286 | - | |
| 11287 | - accu.lastChild.appendChild(node); | |
| 11288 | - } // Element nodes. | |
| 11289 | - | |
| 11290 | - } else if (node.nodeType === node.ELEMENT_NODE) { | |
| 11291 | - // BR nodes: create a new paragraph on double, or append to previous. | |
| 11292 | - if (node.nodeName === 'BR') { | |
| 11293 | - if (node.nextSibling && node.nextSibling.nodeName === 'BR') { | |
| 11294 | - accu.appendChild(accuDoc.createElement('P')); | |
| 11295 | - decu.removeChild(node.nextSibling); | |
| 11296 | - } // Don't append to an empty paragraph. | |
| 11297 | - | |
| 11298 | - | |
| 11299 | - if (accu.lastChild && accu.lastChild.nodeName === 'P' && accu.lastChild.hasChildNodes()) { | |
| 11300 | - accu.lastChild.appendChild(node); | |
| 11301 | - } else { | |
| 11302 | - decu.removeChild(node); | |
| 11303 | - } | |
| 11304 | - } else if (node.nodeName === 'P') { | |
| 11305 | - // Only append non-empty paragraph nodes. | |
| 11306 | - if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) { | |
| 11307 | - decu.removeChild(node); | |
| 11308 | - } else { | |
| 11309 | - accu.appendChild(node); | |
| 11310 | - } | |
| 11311 | - } else if ((0,external_wp_dom_namespaceObject.isPhrasingContent)(node)) { | |
| 11312 | - if (!accu.lastChild || accu.lastChild.nodeName !== 'P') { | |
| 11313 | - accu.appendChild(accuDoc.createElement('P')); | |
| 11314 | - } | |
| 11315 | - | |
| 11316 | - accu.lastChild.appendChild(node); | |
| 11317 | - } else { | |
| 11318 | - accu.appendChild(node); | |
| 11319 | - } | |
| 11320 | - } else { | |
| 11321 | - decu.removeChild(node); | |
| 11322 | - } | |
| 11323 | - } | |
| 11324 | - | |
| 11325 | - return accu.innerHTML; | |
| 11326 | -} | |
| 11327 | -//# sourceMappingURL=normalise-blocks.js.map | |
| 11328 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/special-comment-converter.js | |
| 11329 | -/** | |
| 11330 | - * WordPress dependencies | |
| 11331 | - */ | |
| 11332 | - | |
| 11333 | -/** | |
| 11334 | - * Looks for `<!--nextpage-->` and `<!--more-->` comments, as well as the | |
| 11335 | - * `<!--more Some text-->` variant and its `<!--noteaser-->` companion, | |
| 11336 | - * and replaces them with a custom element representing a future block. | |
| 11337 | - * | |
| 11338 | - * The custom element is a way to bypass the rest of the `raw-handling` | |
| 11339 | - * transforms, which would eliminate other kinds of node with which to carry | |
| 11340 | - * `<!--more-->`'s data: nodes with `data` attributes, empty paragraphs, etc. | |
| 11341 | - * | |
| 11342 | - * The custom element is then expected to be recognized by any registered | |
| 11343 | - * block's `raw` transform. | |
| 11344 | - * | |
| 11345 | - * @param {Node} node The node to be processed. | |
| 11346 | - * @param {Document} doc The document of the node. | |
| 11347 | - * @return {void} | |
| 11348 | - */ | |
| 11349 | - | |
| 11350 | -function specialCommentConverter(node, doc) { | |
| 11351 | - if (node.nodeType !== node.COMMENT_NODE) { | |
| 11352 | - return; | |
| 11353 | - } | |
| 11354 | - | |
| 11355 | - if (node.nodeValue === 'nextpage') { | |
| 11356 | - (0,external_wp_dom_namespaceObject.replace)(node, createNextpage(doc)); | |
| 11357 | - return; | |
| 11358 | - } | |
| 11359 | - | |
| 11360 | - if (node.nodeValue.indexOf('more') === 0) { | |
| 11361 | - // Grab any custom text in the comment. | |
| 11362 | - const customText = node.nodeValue.slice(4).trim(); | |
| 11363 | - /* | |
| 11364 | - * When a `<!--more-->` comment is found, we need to look for any | |
| 11365 | - * `<!--noteaser-->` sibling, but it may not be a direct sibling | |
| 11366 | - * (whitespace typically lies in between) | |
| 11367 | - */ | |
| 11368 | - | |
| 11369 | - let sibling = node; | |
| 11370 | - let noTeaser = false; | |
| 11371 | - | |
| 11372 | - while (sibling = sibling.nextSibling) { | |
| 11373 | - if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === 'noteaser') { | |
| 11374 | - noTeaser = true; | |
| 11375 | - (0,external_wp_dom_namespaceObject.remove)(sibling); | |
| 11376 | - break; | |
| 11377 | - } | |
| 11378 | - } | |
| 11379 | - | |
| 11380 | - (0,external_wp_dom_namespaceObject.replace)(node, createMore(customText, noTeaser, doc)); | |
| 11381 | - } | |
| 11382 | -} | |
| 11383 | - | |
| 11384 | -function createMore(customText, noTeaser, doc) { | |
| 11385 | - const node = doc.createElement('wp-block'); | |
| 11386 | - node.dataset.block = 'core/more'; | |
| 11387 | - | |
| 11388 | - if (customText) { | |
| 11389 | - node.dataset.customText = customText; | |
| 11390 | - } | |
| 11391 | - | |
| 11392 | - if (noTeaser) { | |
| 11393 | - // "Boolean" data attribute | |
| 11394 | - node.dataset.noTeaser = ''; | |
| 11395 | - } | |
| 11396 | - | |
| 11397 | - return node; | |
| 11398 | -} | |
| 11399 | - | |
| 11400 | -function createNextpage(doc) { | |
| 11401 | - const node = doc.createElement('wp-block'); | |
| 11402 | - node.dataset.block = 'core/nextpage'; | |
| 11403 | - return node; | |
| 11404 | -} | |
| 11405 | -//# sourceMappingURL=special-comment-converter.js.map | |
| 11406 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/list-reducer.js | |
| 11407 | -/** | |
| 11408 | - * WordPress dependencies | |
| 11409 | - */ | |
| 11410 | - | |
| 11411 | - | |
| 11412 | -function isList(node) { | |
| 11413 | - return node.nodeName === 'OL' || node.nodeName === 'UL'; | |
| 11414 | -} | |
| 11415 | - | |
| 11416 | -function shallowTextContent(element) { | |
| 11417 | - return Array.from(element.childNodes).map(_ref => { | |
| 11418 | - let { | |
| 11419 | - nodeValue = '' | |
| 11420 | - } = _ref; | |
| 11421 | - return nodeValue; | |
| 11422 | - }).join(''); | |
| 11423 | -} | |
| 11424 | - | |
| 11425 | -function listReducer(node) { | |
| 11426 | - if (!isList(node)) { | |
| 11427 | - return; | |
| 11428 | - } | |
| 11429 | - | |
| 11430 | - const list = node; | |
| 11431 | - const prevElement = node.previousElementSibling; // Merge with previous list if: | |
| 11432 | - // * There is a previous list of the same type. | |
| 11433 | - // * There is only one list item. | |
| 11434 | - | |
| 11435 | - if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { | |
| 11436 | - // Move all child nodes, including any text nodes, if any. | |
| 11437 | - while (list.firstChild) { | |
| 11438 | - prevElement.appendChild(list.firstChild); | |
| 11439 | - } | |
| 11440 | - | |
| 11441 | - list.parentNode.removeChild(list); | |
| 11442 | - } | |
| 11443 | - | |
| 11444 | - const parentElement = node.parentNode; // Nested list with empty parent item. | |
| 11445 | - | |
| 11446 | - if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { | |
| 11447 | - const parentListItem = parentElement; | |
| 11448 | - const prevListItem = parentListItem.previousElementSibling; | |
| 11449 | - const parentList = parentListItem.parentNode; | |
| 11450 | - | |
| 11451 | - if (prevListItem) { | |
| 11452 | - prevListItem.appendChild(list); | |
| 11453 | - parentList.removeChild(parentListItem); | |
| 11454 | - } else { | |
| 11455 | - parentList.parentNode.insertBefore(list, parentList); | |
| 11456 | - parentList.parentNode.removeChild(parentList); | |
| 11457 | - } | |
| 11458 | - } // Invalid: OL/UL > OL/UL. | |
| 11459 | - | |
| 11460 | - | |
| 11461 | - if (parentElement && isList(parentElement)) { | |
| 11462 | - const prevListItem = node.previousElementSibling; | |
| 11463 | - | |
| 11464 | - if (prevListItem) { | |
| 11465 | - prevListItem.appendChild(node); | |
| 11466 | - } else { | |
| 11467 | - (0,external_wp_dom_namespaceObject.unwrap)(node); | |
| 11468 | - } | |
| 11469 | - } | |
| 11470 | -} | |
| 11471 | -//# sourceMappingURL=list-reducer.js.map | |
| 11472 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/blockquote-normaliser.js | |
| 11473 | -/** | |
| 11474 | - * Internal dependencies | |
| 11475 | - */ | |
| 11476 | - | |
| 11477 | -function blockquoteNormaliser(node) { | |
| 11478 | - if (node.nodeName !== 'BLOCKQUOTE') { | |
| 11479 | - return; | |
| 11480 | - } | |
| 11481 | - | |
| 11482 | - node.innerHTML = normaliseBlocks(node.innerHTML); | |
| 11483 | -} | |
| 11484 | -//# sourceMappingURL=blockquote-normaliser.js.map | |
| 11485 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/figure-content-reducer.js | |
| 11486 | -/** | |
| 11487 | - * External dependencies | |
| 11488 | - */ | |
| 11489 | - | |
| 11490 | -/** | |
| 11491 | - * WordPress dependencies | |
| 11492 | - */ | |
| 11493 | - | |
| 11494 | - | |
| 11495 | -/** | |
| 11496 | - * Whether or not the given node is figure content. | |
| 11497 | - * | |
| 11498 | - * @param {Node} node The node to check. | |
| 11499 | - * @param {Object} schema The schema to use. | |
| 11500 | - * | |
| 11501 | - * @return {boolean} True if figure content, false if not. | |
| 11502 | - */ | |
| 11503 | - | |
| 11504 | -function isFigureContent(node, schema) { | |
| 11505 | - const tag = node.nodeName.toLowerCase(); // We are looking for tags that can be a child of the figure tag, excluding | |
| 11506 | - // `figcaption` and any phrasing content. | |
| 11507 | - | |
| 11508 | - if (tag === 'figcaption' || (0,external_wp_dom_namespaceObject.isTextContent)(node)) { | |
| 11509 | - return false; | |
| 11510 | - } | |
| 11511 | - | |
| 11512 | - return (0,external_lodash_namespaceObject.has)(schema, ['figure', 'children', tag]); | |
| 11513 | -} | |
| 11514 | -/** | |
| 11515 | - * Whether or not the given node can have an anchor. | |
| 11516 | - * | |
| 11517 | - * @param {Node} node The node to check. | |
| 11518 | - * @param {Object} schema The schema to use. | |
| 11519 | - * | |
| 11520 | - * @return {boolean} True if it can, false if not. | |
| 11521 | - */ | |
| 11522 | - | |
| 11523 | - | |
| 11524 | -function canHaveAnchor(node, schema) { | |
| 11525 | - const tag = node.nodeName.toLowerCase(); | |
| 11526 | - return (0,external_lodash_namespaceObject.has)(schema, ['figure', 'children', 'a', 'children', tag]); | |
| 11527 | -} | |
| 11528 | -/** | |
| 11529 | - * Wraps the given element in a figure element. | |
| 11530 | - * | |
| 11531 | - * @param {Element} element The element to wrap. | |
| 11532 | - * @param {Element} beforeElement The element before which to place the figure. | |
| 11533 | - */ | |
| 11534 | - | |
| 11535 | - | |
| 11536 | -function wrapFigureContent(element) { | |
| 11537 | - let beforeElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : element; | |
| 11538 | - const figure = element.ownerDocument.createElement('figure'); | |
| 11539 | - beforeElement.parentNode.insertBefore(figure, beforeElement); | |
| 11540 | - figure.appendChild(element); | |
| 11541 | -} | |
| 11542 | -/** | |
| 11543 | - * This filter takes figure content out of paragraphs, wraps it in a figure | |
| 11544 | - * element, and moves any anchors with it if needed. | |
| 11545 | - * | |
| 11546 | - * @param {Node} node The node to filter. | |
| 11547 | - * @param {Document} doc The document of the node. | |
| 11548 | - * @param {Object} schema The schema to use. | |
| 11549 | - * | |
| 11550 | - * @return {void} | |
| 11551 | - */ | |
| 11552 | - | |
| 11553 | - | |
| 11554 | -function figureContentReducer(node, doc, schema) { | |
| 11555 | - if (!isFigureContent(node, schema)) { | |
| 11556 | - return; | |
| 11557 | - } | |
| 11558 | - | |
| 11559 | - let nodeToInsert = node; | |
| 11560 | - const parentNode = node.parentNode; // If the figure content can have an anchor and its parent is an anchor with | |
| 11561 | - // only the figure content, take the anchor out instead of just the content. | |
| 11562 | - | |
| 11563 | - if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) { | |
| 11564 | - nodeToInsert = node.parentNode; | |
| 11565 | - } | |
| 11566 | - | |
| 11567 | - const wrapper = nodeToInsert.closest('p,div'); // If wrapped in a paragraph or div, only extract if it's aligned or if | |
| 11568 | - // there is no text content. | |
| 11569 | - // Otherwise, if directly at the root, wrap in a figure element. | |
| 11570 | - | |
| 11571 | - if (wrapper) { | |
| 11572 | - // In jsdom-jscore, 'node.classList' can be undefined. | |
| 11573 | - // In this case, default to extract as it offers a better UI experience on mobile. | |
| 11574 | - if (!node.classList) { | |
| 11575 | - wrapFigureContent(nodeToInsert, wrapper); | |
| 11576 | - } else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) { | |
| 11577 | - wrapFigureContent(nodeToInsert, wrapper); | |
| 11578 | - } | |
| 11579 | - } else if (nodeToInsert.parentNode.nodeName === 'BODY') { | |
| 11580 | - wrapFigureContent(nodeToInsert); | |
| 11581 | - } | |
| 11582 | -} | |
| 11583 | -//# sourceMappingURL=figure-content-reducer.js.map | |
| 11584 | -;// CONCATENATED MODULE: external ["wp","shortcode"] | |
| 11585 | -var external_wp_shortcode_namespaceObject = window["wp"]["shortcode"]; | |
| 11586 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/shortcode-converter.js | |
| 11587 | -/** | |
| 11588 | - * External dependencies | |
| 11589 | - */ | |
| 11590 | - | |
| 11591 | -/** | |
| 11592 | - * WordPress dependencies | |
| 11593 | - */ | |
| 11594 | - | |
| 11595 | - | |
| 11596 | -/** | |
| 11597 | - * Internal dependencies | |
| 11598 | - */ | |
| 11599 | - | |
| 11600 | - | |
| 11601 | - | |
| 11602 | - | |
| 11603 | - | |
| 11604 | - | |
| 11605 | -function segmentHTMLToShortcodeBlock(HTML) { | |
| 11606 | - let lastIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| 11607 | - let excludedBlockNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | |
| 11608 | - // Get all matches. | |
| 11609 | - const transformsFrom = getBlockTransforms('from'); | |
| 11610 | - const transformation = findTransform(transformsFrom, transform => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(transform.tag), tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML))); | |
| 11611 | - | |
| 11612 | - if (!transformation) { | |
| 11613 | - return [HTML]; | |
| 11614 | - } | |
| 11615 | - | |
| 11616 | - const transformTags = (0,external_lodash_namespaceObject.castArray)(transformation.tag); | |
| 11617 | - const transformTag = (0,external_lodash_namespaceObject.find)(transformTags, tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML)); | |
| 11618 | - let match; | |
| 11619 | - const previousIndex = lastIndex; | |
| 11620 | - | |
| 11621 | - if (match = (0,external_wp_shortcode_namespaceObject.next)(transformTag, HTML, lastIndex)) { | |
| 11622 | - lastIndex = match.index + match.content.length; | |
| 11623 | - const beforeHTML = HTML.substr(0, match.index); | |
| 11624 | - const afterHTML = HTML.substr(lastIndex); // If the shortcode content does not contain HTML and the shortcode is | |
| 11625 | - // not on a new line (or in paragraph from Markdown converter), | |
| 11626 | - // consider the shortcode as inline text, and thus skip conversion for | |
| 11627 | - // this segment. | |
| 11628 | - | |
| 11629 | - if (!(0,external_lodash_namespaceObject.includes)(match.shortcode.content || '', '<') && !(/(\n|<p>)\s*$/.test(beforeHTML) && /^\s*(\n|<\/p>)/.test(afterHTML))) { | |
| 11630 | - return segmentHTMLToShortcodeBlock(HTML, lastIndex); | |
| 11631 | - } // If a transformation's `isMatch` predicate fails for the inbound | |
| 11632 | - // shortcode, try again by excluding the current block type. | |
| 11633 | - // | |
| 11634 | - // This is the only call to `segmentHTMLToShortcodeBlock` that should | |
| 11635 | - // ever carry over `excludedBlockNames`. Other calls in the module | |
| 11636 | - // should skip that argument as a way to reset the exclusion state, so | |
| 11637 | - // that one `isMatch` fail in an HTML fragment doesn't prevent any | |
| 11638 | - // valid matches in subsequent fragments. | |
| 11639 | - | |
| 11640 | - | |
| 11641 | - if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { | |
| 11642 | - return segmentHTMLToShortcodeBlock(HTML, previousIndex, [...excludedBlockNames, transformation.blockName]); | |
| 11643 | - } | |
| 11644 | - | |
| 11645 | - const attributes = (0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.pickBy)(transformation.attributes, schema => schema.shortcode), // Passing all of `match` as second argument is intentionally broad | |
| 11646 | - // but shouldn't be too relied upon. | |
| 11647 | - // | |
| 11648 | - // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 | |
| 11649 | - schema => schema.shortcode(match.shortcode.attrs, match)); | |
| 11650 | - const transformationBlockType = { ...registration_getBlockType(transformation.blockName), | |
| 11651 | - attributes: transformation.attributes | |
| 11652 | - }; | |
| 11653 | - let block = createBlock(transformation.blockName, getBlockAttributes(transformationBlockType, match.shortcode.content, attributes)); | |
| 11654 | - block.originalContent = match.shortcode.content; // Applying the built-in fixes can enhance the attributes with missing content like "className". | |
| 11655 | - | |
| 11656 | - block = applyBuiltInValidationFixes(block, transformationBlockType); | |
| 11657 | - return [...segmentHTMLToShortcodeBlock(beforeHTML), block, ...segmentHTMLToShortcodeBlock(afterHTML)]; | |
| 11658 | - } | |
| 11659 | - | |
| 11660 | - return [HTML]; | |
| 11661 | -} | |
| 11662 | - | |
| 11663 | -/* harmony default export */ var shortcode_converter = (segmentHTMLToShortcodeBlock); | |
| 11664 | -//# sourceMappingURL=shortcode-converter.js.map | |
| 11665 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/utils.js | |
| 11666 | -/** | |
| 11667 | - * External dependencies | |
| 11668 | - */ | |
| 11669 | - | |
| 11670 | -/** | |
| 11671 | - * WordPress dependencies | |
| 11672 | - */ | |
| 11673 | - | |
| 11674 | - | |
| 11675 | -/** | |
| 11676 | - * Internal dependencies | |
| 11677 | - */ | |
| 11678 | - | |
| 11679 | - | |
| 11680 | - | |
| 11681 | -function getBlockContentSchemaFromTransforms(transforms, context) { | |
| 11682 | - const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context); | |
| 11683 | - const schemaArgs = { | |
| 11684 | - phrasingContentSchema, | |
| 11685 | - isPaste: context === 'paste' | |
| 11686 | - }; | |
| 11687 | - const schemas = transforms.map(_ref => { | |
| 11688 | - let { | |
| 11689 | - isMatch, | |
| 11690 | - blockName, | |
| 11691 | - schema | |
| 11692 | - } = _ref; | |
| 11693 | - const hasAnchorSupport = registration_hasBlockSupport(blockName, 'anchor'); | |
| 11694 | - schema = (0,external_lodash_namespaceObject.isFunction)(schema) ? schema(schemaArgs) : schema; // If the block does not has anchor support and the transform does not | |
| 11695 | - // provides an isMatch we can return the schema right away. | |
| 11696 | - | |
| 11697 | - if (!hasAnchorSupport && !isMatch) { | |
| 11698 | - return schema; | |
| 11699 | - } | |
| 11700 | - | |
| 11701 | - return (0,external_lodash_namespaceObject.mapValues)(schema, value => { | |
| 11702 | - let attributes = value.attributes || []; // If the block supports the "anchor" functionality, it needs to keep its ID attribute. | |
| 11703 | - | |
| 11704 | - if (hasAnchorSupport) { | |
| 11705 | - attributes = [...attributes, 'id']; | |
| 11706 | - } | |
| 11707 | - | |
| 11708 | - return { ...value, | |
| 11709 | - attributes, | |
| 11710 | - isMatch: isMatch ? isMatch : undefined | |
| 11711 | - }; | |
| 11712 | - }); | |
| 11713 | - }); | |
| 11714 | - return (0,external_lodash_namespaceObject.mergeWith)({}, ...schemas, (objValue, srcValue, key) => { | |
| 11715 | - switch (key) { | |
| 11716 | - case 'children': | |
| 11717 | - { | |
| 11718 | - if (objValue === '*' || srcValue === '*') { | |
| 11719 | - return '*'; | |
| 11720 | - } | |
| 11721 | - | |
| 11722 | - return { ...objValue, | |
| 11723 | - ...srcValue | |
| 11724 | - }; | |
| 11725 | - } | |
| 11726 | - | |
| 11727 | - case 'attributes': | |
| 11728 | - case 'require': | |
| 11729 | - { | |
| 11730 | - return [...(objValue || []), ...(srcValue || [])]; | |
| 11731 | - } | |
| 11732 | - | |
| 11733 | - case 'isMatch': | |
| 11734 | - { | |
| 11735 | - // If one of the values being merge is undefined (matches everything), | |
| 11736 | - // the result of the merge will be undefined. | |
| 11737 | - if (!objValue || !srcValue) { | |
| 11738 | - return undefined; | |
| 11739 | - } // When merging two isMatch functions, the result is a new function | |
| 11740 | - // that returns if one of the source functions returns true. | |
| 11741 | - | |
| 11742 | - | |
| 11743 | - return function () { | |
| 11744 | - return objValue(...arguments) || srcValue(...arguments); | |
| 11745 | - }; | |
| 11746 | - } | |
| 11747 | - } | |
| 11748 | - }); | |
| 11749 | -} | |
| 11750 | -/** | |
| 11751 | - * Gets the block content schema, which is extracted and merged from all | |
| 11752 | - * registered blocks with raw transfroms. | |
| 11753 | - * | |
| 11754 | - * @param {string} context Set to "paste" when in paste context, where the | |
| 11755 | - * schema is more strict. | |
| 11756 | - * | |
| 11757 | - * @return {Object} A complete block content schema. | |
| 11758 | - */ | |
| 11759 | - | |
| 11760 | -function getBlockContentSchema(context) { | |
| 11761 | - return getBlockContentSchemaFromTransforms(getRawTransforms(), context); | |
| 11762 | -} | |
| 11763 | -/** | |
| 11764 | - * Checks whether HTML can be considered plain text. That is, it does not contain | |
| 11765 | - * any elements that are not line breaks. | |
| 11766 | - * | |
| 11767 | - * @param {string} HTML The HTML to check. | |
| 11768 | - * | |
| 11769 | - * @return {boolean} Whether the HTML can be considered plain text. | |
| 11770 | - */ | |
| 11771 | - | |
| 11772 | -function isPlain(HTML) { | |
| 11773 | - return !/<(?!br[ />])/i.test(HTML); | |
| 11774 | -} | |
| 11775 | -/** | |
| 11776 | - * Given node filters, deeply filters and mutates a NodeList. | |
| 11777 | - * | |
| 11778 | - * @param {NodeList} nodeList The nodeList to filter. | |
| 11779 | - * @param {Array} filters An array of functions that can mutate with the provided node. | |
| 11780 | - * @param {Document} doc The document of the nodeList. | |
| 11781 | - * @param {Object} schema The schema to use. | |
| 11782 | - */ | |
| 11783 | - | |
| 11784 | -function deepFilterNodeList(nodeList, filters, doc, schema) { | |
| 11785 | - Array.from(nodeList).forEach(node => { | |
| 11786 | - deepFilterNodeList(node.childNodes, filters, doc, schema); | |
| 11787 | - filters.forEach(item => { | |
| 11788 | - // Make sure the node is still attached to the document. | |
| 11789 | - if (!doc.contains(node)) { | |
| 11790 | - return; | |
| 11791 | - } | |
| 11792 | - | |
| 11793 | - item(node, doc, schema); | |
| 11794 | - }); | |
| 11795 | - }); | |
| 11796 | -} | |
| 11797 | -/** | |
| 11798 | - * Given node filters, deeply filters HTML tags. | |
| 11799 | - * Filters from the deepest nodes to the top. | |
| 11800 | - * | |
| 11801 | - * @param {string} HTML The HTML to filter. | |
| 11802 | - * @param {Array} filters An array of functions that can mutate with the provided node. | |
| 11803 | - * @param {Object} schema The schema to use. | |
| 11804 | - * | |
| 11805 | - * @return {string} The filtered HTML. | |
| 11806 | - */ | |
| 11807 | - | |
| 11808 | -function deepFilterHTML(HTML) { | |
| 11809 | - let filters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | |
| 11810 | - let schema = arguments.length > 2 ? arguments[2] : undefined; | |
| 11811 | - const doc = document.implementation.createHTMLDocument(''); | |
| 11812 | - doc.body.innerHTML = HTML; | |
| 11813 | - deepFilterNodeList(doc.body.childNodes, filters, doc, schema); | |
| 11814 | - return doc.body.innerHTML; | |
| 11815 | -} | |
| 11816 | -/** | |
| 11817 | - * Gets a sibling within text-level context. | |
| 11818 | - * | |
| 11819 | - * @param {Element} node The subject node. | |
| 11820 | - * @param {string} which "next" or "previous". | |
| 11821 | - */ | |
| 11822 | - | |
| 11823 | -function getSibling(node, which) { | |
| 11824 | - const sibling = node[`${which}Sibling`]; | |
| 11825 | - | |
| 11826 | - if (sibling && (0,external_wp_dom_namespaceObject.isPhrasingContent)(sibling)) { | |
| 11827 | - return sibling; | |
| 11828 | - } | |
| 11829 | - | |
| 11830 | - const { | |
| 11831 | - parentNode | |
| 11832 | - } = node; | |
| 11833 | - | |
| 11834 | - if (!parentNode || !(0,external_wp_dom_namespaceObject.isPhrasingContent)(parentNode)) { | |
| 11835 | - return; | |
| 11836 | - } | |
| 11837 | - | |
| 11838 | - return getSibling(parentNode, which); | |
| 11839 | -} | |
| 11840 | -//# sourceMappingURL=utils.js.map | |
| 11841 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/index.js | |
| 11842 | -/** | |
| 11843 | - * External dependencies | |
| 11844 | - */ | |
| 11845 | - | |
| 11846 | -/** | |
| 11847 | - * WordPress dependencies | |
| 11848 | - */ | |
| 11849 | - | |
| 11850 | - | |
| 11851 | - | |
| 11852 | -/** | |
| 11853 | - * Internal dependencies | |
| 11854 | - */ | |
| 11855 | - | |
| 11856 | - | |
| 11857 | - | |
| 11858 | - | |
| 11859 | - | |
| 11860 | - | |
| 11861 | - | |
| 11862 | - | |
| 11863 | - | |
| 11864 | - | |
| 11865 | - | |
| 11866 | -function deprecatedGetPhrasingContentSchema(context) { | |
| 11867 | - external_wp_deprecated_default()('wp.blocks.getPhrasingContentSchema', { | |
| 11868 | - since: '5.6', | |
| 11869 | - alternative: 'wp.dom.getPhrasingContentSchema' | |
| 11870 | - }); | |
| 11871 | - return (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context); | |
| 11872 | -} | |
| 11873 | -/** | |
| 11874 | - * Converts an HTML string to known blocks. | |
| 11875 | - * | |
| 11876 | - * @param {Object} $1 | |
| 11877 | - * @param {string} $1.HTML The HTML to convert. | |
| 11878 | - * | |
| 11879 | - * @return {Array} A list of blocks. | |
| 11880 | - */ | |
| 11881 | - | |
| 11882 | -function rawHandler(_ref) { | |
| 11883 | - let { | |
| 11884 | - HTML = '' | |
| 11885 | - } = _ref; | |
| 11886 | - | |
| 11887 | - // If we detect block delimiters, parse entirely as blocks. | |
| 11888 | - if (HTML.indexOf('<!-- wp:') !== -1) { | |
| 11889 | - return parser_parse(HTML); | |
| 11890 | - } // An array of HTML strings and block objects. The blocks replace matched | |
| 11891 | - // shortcodes. | |
| 11892 | - | |
| 11893 | - | |
| 11894 | - const pieces = shortcode_converter(HTML); | |
| 11895 | - const blockContentSchema = getBlockContentSchema(); | |
| 11896 | - return (0,external_lodash_namespaceObject.compact)((0,external_lodash_namespaceObject.flatMap)(pieces, piece => { | |
| 11897 | - // Already a block from shortcode. | |
| 11898 | - if (typeof piece !== 'string') { | |
| 11899 | - return piece; | |
| 11900 | - } // These filters are essential for some blocks to be able to transform | |
| 11901 | - // from raw HTML. These filters move around some content or add | |
| 11902 | - // additional tags, they do not remove any content. | |
| 11903 | - | |
| 11904 | - | |
| 11905 | - const filters = [// Needed to adjust invalid lists. | |
| 11906 | - listReducer, // Needed to create more and nextpage blocks. | |
| 11907 | - specialCommentConverter, // Needed to create media blocks. | |
| 11908 | - figureContentReducer, // Needed to create the quote block, which cannot handle text | |
| 11909 | - // without wrapper paragraphs. | |
| 11910 | - blockquoteNormaliser]; | |
| 11911 | - piece = deepFilterHTML(piece, filters, blockContentSchema); | |
| 11912 | - piece = normaliseBlocks(piece); | |
| 11913 | - return htmlToBlocks(piece); | |
| 11914 | - })); | |
| 11915 | -} | |
| 11916 | -//# sourceMappingURL=index.js.map | |
| 11917 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/comment-remover.js | |
| 11918 | -/** | |
| 11919 | - * WordPress dependencies | |
| 11920 | - */ | |
| 11921 | - | |
| 11922 | -/** | |
| 11923 | - * Looks for comments, and removes them. | |
| 11924 | - * | |
| 11925 | - * @param {Node} node The node to be processed. | |
| 11926 | - * @return {void} | |
| 11927 | - */ | |
| 11928 | - | |
| 11929 | -function commentRemover(node) { | |
| 11930 | - if (node.nodeType === node.COMMENT_NODE) { | |
| 11931 | - (0,external_wp_dom_namespaceObject.remove)(node); | |
| 11932 | - } | |
| 11933 | -} | |
| 11934 | -//# sourceMappingURL=comment-remover.js.map | |
| 11935 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/is-inline-content.js | |
| 11936 | -/** | |
| 11937 | - * External dependencies | |
| 11938 | - */ | |
| 11939 | - | |
| 11940 | -/** | |
| 11941 | - * WordPress dependencies | |
| 11942 | - */ | |
| 11943 | - | |
| 11944 | - | |
| 11945 | -/** | |
| 11946 | - * Checks if the given node should be considered inline content, optionally | |
| 11947 | - * depending on a context tag. | |
| 11948 | - * | |
| 11949 | - * @param {Node} node Node name. | |
| 11950 | - * @param {string} contextTag Tag name. | |
| 11951 | - * | |
| 11952 | - * @return {boolean} True if the node is inline content, false if nohe. | |
| 11953 | - */ | |
| 11954 | - | |
| 11955 | -function isInline(node, contextTag) { | |
| 11956 | - if ((0,external_wp_dom_namespaceObject.isTextContent)(node)) { | |
| 11957 | - return true; | |
| 11958 | - } | |
| 11959 | - | |
| 11960 | - if (!contextTag) { | |
| 11961 | - return false; | |
| 11962 | - } | |
| 11963 | - | |
| 11964 | - const tag = node.nodeName.toLowerCase(); | |
| 11965 | - const inlineAllowedTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']]; | |
| 11966 | - return inlineAllowedTagGroups.some(tagGroup => (0,external_lodash_namespaceObject.difference)([tag, contextTag], tagGroup).length === 0); | |
| 11967 | -} | |
| 11968 | - | |
| 11969 | -function deepCheck(nodes, contextTag) { | |
| 11970 | - return nodes.every(node => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag)); | |
| 11971 | -} | |
| 11972 | - | |
| 11973 | -function isDoubleBR(node) { | |
| 11974 | - return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR'; | |
| 11975 | -} | |
| 11976 | - | |
| 11977 | -function isInlineContent(HTML, contextTag) { | |
| 11978 | - const doc = document.implementation.createHTMLDocument(''); | |
| 11979 | - doc.body.innerHTML = HTML; | |
| 11980 | - const nodes = Array.from(doc.body.children); | |
| 11981 | - return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); | |
| 11982 | -} | |
| 11983 | -//# sourceMappingURL=is-inline-content.js.map | |
| 11984 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.js | |
| 11985 | -/** | |
| 11986 | - * External dependencies | |
| 11987 | - */ | |
| 11988 | - | |
| 11989 | -/** | |
| 11990 | - * WordPress dependencies | |
| 11991 | - */ | |
| 11992 | - | |
| 11993 | - | |
| 11994 | -function phrasingContentReducer(node, doc) { | |
| 11995 | - // In jsdom-jscore, 'node.style' can be null. | |
| 11996 | - // TODO: Explore fixing this by patching jsdom-jscore. | |
| 11997 | - if (node.nodeName === 'SPAN' && node.style) { | |
| 11998 | - const { | |
| 11999 | - fontWeight, | |
| 12000 | - fontStyle, | |
| 12001 | - textDecorationLine, | |
| 12002 | - textDecoration, | |
| 12003 | - verticalAlign | |
| 12004 | - } = node.style; | |
| 12005 | - | |
| 12006 | - if (fontWeight === 'bold' || fontWeight === '700') { | |
| 12007 | - (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('strong'), node); | |
| 12008 | - } | |
| 12009 | - | |
| 12010 | - if (fontStyle === 'italic') { | |
| 12011 | - (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('em'), node); | |
| 12012 | - } // Some DOM implementations (Safari, JSDom) don't support | |
| 12013 | - // style.textDecorationLine, so we check style.textDecoration as a | |
| 12014 | - // fallback. | |
| 12015 | - | |
| 12016 | - | |
| 12017 | - if (textDecorationLine === 'line-through' || (0,external_lodash_namespaceObject.includes)(textDecoration, 'line-through')) { | |
| 12018 | - (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('s'), node); | |
| 12019 | - } | |
| 12020 | - | |
| 12021 | - if (verticalAlign === 'super') { | |
| 12022 | - (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sup'), node); | |
| 12023 | - } else if (verticalAlign === 'sub') { | |
| 12024 | - (0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sub'), node); | |
| 12025 | - } | |
| 12026 | - } else if (node.nodeName === 'B') { | |
| 12027 | - node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'strong'); | |
| 12028 | - } else if (node.nodeName === 'I') { | |
| 12029 | - node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'em'); | |
| 12030 | - } else if (node.nodeName === 'A') { | |
| 12031 | - // In jsdom-jscore, 'node.target' can be null. | |
| 12032 | - // TODO: Explore fixing this by patching jsdom-jscore. | |
| 12033 | - if (node.target && node.target.toLowerCase() === '_blank') { | |
| 12034 | - node.rel = 'noreferrer noopener'; | |
| 12035 | - } else { | |
| 12036 | - node.removeAttribute('target'); | |
| 12037 | - node.removeAttribute('rel'); | |
| 12038 | - } // Saves anchor elements name attribute as id | |
| 12039 | - | |
| 12040 | - | |
| 12041 | - if (node.name && !node.id) { | |
| 12042 | - node.id = node.name; | |
| 12043 | - } // Keeps id only if there is an internal link pointing to it | |
| 12044 | - | |
| 12045 | - | |
| 12046 | - if (node.id && !node.ownerDocument.querySelector(`[href="#${node.id}"]`)) { | |
| 12047 | - node.removeAttribute('id'); | |
| 12048 | - } | |
| 12049 | - } | |
| 12050 | -} | |
| 12051 | -//# sourceMappingURL=phrasing-content-reducer.js.map | |
| 12052 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/head-remover.js | |
| 12053 | -function headRemover(node) { | |
| 12054 | - if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') { | |
| 12055 | - return; | |
| 12056 | - } | |
| 12057 | - | |
| 12058 | - node.parentNode.removeChild(node); | |
| 12059 | -} | |
| 12060 | -//# sourceMappingURL=head-remover.js.map | |
| 12061 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/ms-list-converter.js | |
| 12062 | -/** | |
| 12063 | - * Browser dependencies | |
| 12064 | - */ | |
| 12065 | -const { | |
| 12066 | - parseInt: ms_list_converter_parseInt | |
| 12067 | -} = window; | |
| 12068 | - | |
| 12069 | -function ms_list_converter_isList(node) { | |
| 12070 | - return node.nodeName === 'OL' || node.nodeName === 'UL'; | |
| 12071 | -} | |
| 12072 | - | |
| 12073 | -function msListConverter(node, doc) { | |
| 12074 | - if (node.nodeName !== 'P') { | |
| 12075 | - return; | |
| 12076 | - } | |
| 12077 | - | |
| 12078 | - const style = node.getAttribute('style'); | |
| 12079 | - | |
| 12080 | - if (!style) { | |
| 12081 | - return; | |
| 12082 | - } // Quick check. | |
| 12083 | - | |
| 12084 | - | |
| 12085 | - if (style.indexOf('mso-list') === -1) { | |
| 12086 | - return; | |
| 12087 | - } | |
| 12088 | - | |
| 12089 | - const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); | |
| 12090 | - | |
| 12091 | - if (!matches) { | |
| 12092 | - return; | |
| 12093 | - } | |
| 12094 | - | |
| 12095 | - let level = ms_list_converter_parseInt(matches[1], 10) - 1 || 0; | |
| 12096 | - const prevNode = node.previousElementSibling; // Add new list if no previous. | |
| 12097 | - | |
| 12098 | - if (!prevNode || !ms_list_converter_isList(prevNode)) { | |
| 12099 | - // See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type. | |
| 12100 | - const type = node.textContent.trim().slice(0, 1); | |
| 12101 | - const isNumeric = /[1iIaA]/.test(type); | |
| 12102 | - const newListNode = doc.createElement(isNumeric ? 'ol' : 'ul'); | |
| 12103 | - | |
| 12104 | - if (isNumeric) { | |
| 12105 | - newListNode.setAttribute('type', type); | |
| 12106 | - } | |
| 12107 | - | |
| 12108 | - node.parentNode.insertBefore(newListNode, node); | |
| 12109 | - } | |
| 12110 | - | |
| 12111 | - const listNode = node.previousElementSibling; | |
| 12112 | - const listType = listNode.nodeName; | |
| 12113 | - const listItem = doc.createElement('li'); | |
| 12114 | - let receivingNode = listNode; // Remove the first span with list info. | |
| 12115 | - | |
| 12116 | - node.removeChild(node.firstChild); // Add content. | |
| 12117 | - | |
| 12118 | - while (node.firstChild) { | |
| 12119 | - listItem.appendChild(node.firstChild); | |
| 12120 | - } // Change pointer depending on indentation level. | |
| 12121 | - | |
| 12122 | - | |
| 12123 | - while (level--) { | |
| 12124 | - receivingNode = receivingNode.lastChild || receivingNode; // If it's a list, move pointer to the last item. | |
| 12125 | - | |
| 12126 | - if (ms_list_converter_isList(receivingNode)) { | |
| 12127 | - receivingNode = receivingNode.lastChild || receivingNode; | |
| 12128 | - } | |
| 12129 | - } // Make sure we append to a list. | |
| 12130 | - | |
| 12131 | - | |
| 12132 | - if (!ms_list_converter_isList(receivingNode)) { | |
| 12133 | - receivingNode = receivingNode.appendChild(doc.createElement(listType)); | |
| 12134 | - } // Append the list item to the list. | |
| 12135 | - | |
| 12136 | - | |
| 12137 | - receivingNode.appendChild(listItem); // Remove the wrapper paragraph. | |
| 12138 | - | |
| 12139 | - node.parentNode.removeChild(node); | |
| 12140 | -} | |
| 12141 | -//# sourceMappingURL=ms-list-converter.js.map | |
| 12142 | -;// CONCATENATED MODULE: external ["wp","blob"] | |
| 12143 | -var external_wp_blob_namespaceObject = window["wp"]["blob"]; | |
| 12144 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/image-corrector.js | |
| 12145 | -/** | |
| 12146 | - * WordPress dependencies | |
| 12147 | - */ | |
| 12148 | - | |
| 12149 | -/** | |
| 12150 | - * Browser dependencies | |
| 12151 | - */ | |
| 12152 | - | |
| 12153 | -const { | |
| 12154 | - atob, | |
| 12155 | - File | |
| 12156 | -} = window; | |
| 12157 | -function imageCorrector(node) { | |
| 12158 | - if (node.nodeName !== 'IMG') { | |
| 12159 | - return; | |
| 12160 | - } | |
| 12161 | - | |
| 12162 | - if (node.src.indexOf('file:') === 0) { | |
| 12163 | - node.src = ''; | |
| 12164 | - } // This piece cannot be tested outside a browser env. | |
| 12165 | - | |
| 12166 | - | |
| 12167 | - if (node.src.indexOf('data:') === 0) { | |
| 12168 | - const [properties, data] = node.src.split(','); | |
| 12169 | - const [type] = properties.slice(5).split(';'); | |
| 12170 | - | |
| 12171 | - if (!data || !type) { | |
| 12172 | - node.src = ''; | |
| 12173 | - return; | |
| 12174 | - } | |
| 12175 | - | |
| 12176 | - let decoded; // Can throw DOMException! | |
| 12177 | - | |
| 12178 | - try { | |
| 12179 | - decoded = atob(data); | |
| 12180 | - } catch (e) { | |
| 12181 | - node.src = ''; | |
| 12182 | - return; | |
| 12183 | - } | |
| 12184 | - | |
| 12185 | - const uint8Array = new Uint8Array(decoded.length); | |
| 12186 | - | |
| 12187 | - for (let i = 0; i < uint8Array.length; i++) { | |
| 12188 | - uint8Array[i] = decoded.charCodeAt(i); | |
| 12189 | - } | |
| 12190 | - | |
| 12191 | - const name = type.replace('/', '.'); | |
| 12192 | - const file = new File([uint8Array], name, { | |
| 12193 | - type | |
| 12194 | - }); | |
| 12195 | - node.src = (0,external_wp_blob_namespaceObject.createBlobURL)(file); | |
| 12196 | - } // Remove trackers and hardly visible images. | |
| 12197 | - | |
| 12198 | - | |
| 12199 | - if (node.height === 1 || node.width === 1) { | |
| 12200 | - node.parentNode.removeChild(node); | |
| 12201 | - } | |
| 12202 | -} | |
| 12203 | -//# sourceMappingURL=image-corrector.js.map | |
| 12204 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/div-normaliser.js | |
| 12205 | -/** | |
| 12206 | - * Internal dependencies | |
| 12207 | - */ | |
| 12208 | - | |
| 12209 | -function divNormaliser(node) { | |
| 12210 | - if (node.nodeName !== 'DIV') { | |
| 12211 | - return; | |
| 12212 | - } | |
| 12213 | - | |
| 12214 | - node.innerHTML = normaliseBlocks(node.innerHTML); | |
| 12215 | -} | |
| 12216 | -//# sourceMappingURL=div-normaliser.js.map | |
| 12217 | -// EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js | |
| 12218 | -var showdown = __webpack_require__(3787); | |
| 12219 | -var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown); | |
| 12220 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/markdown-converter.js | |
| 12221 | -/** | |
| 12222 | - * External dependencies | |
| 12223 | - */ | |
| 12224 | - // Reuse the same showdown converter. | |
| 12225 | - | |
| 12226 | -const converter = new (showdown_default()).Converter({ | |
| 12227 | - noHeaderId: true, | |
| 12228 | - tables: true, | |
| 12229 | - literalMidWordUnderscores: true, | |
| 12230 | - omitExtraWLInCodeBlocks: true, | |
| 12231 | - simpleLineBreaks: true, | |
| 12232 | - strikethrough: true | |
| 12233 | -}); | |
| 12234 | -/** | |
| 12235 | - * Corrects the Slack Markdown variant of the code block. | |
| 12236 | - * If uncorrected, it will be converted to inline code. | |
| 12237 | - * | |
| 12238 | - * @see https://get.slack.help/hc/en-us/articles/202288908-how-can-i-add-formatting-to-my-messages-#code-blocks | |
| 12239 | - * | |
| 12240 | - * @param {string} text The potential Markdown text to correct. | |
| 12241 | - * | |
| 12242 | - * @return {string} The corrected Markdown. | |
| 12243 | - */ | |
| 12244 | - | |
| 12245 | -function slackMarkdownVariantCorrector(text) { | |
| 12246 | - return text.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, (match, p1, p2, p3) => `${p1}\n${p2}\n${p3}`); | |
| 12247 | -} | |
| 12248 | -/** | |
| 12249 | - * Converts a piece of text into HTML based on any Markdown present. | |
| 12250 | - * Also decodes any encoded HTML. | |
| 12251 | - * | |
| 12252 | - * @param {string} text The plain text to convert. | |
| 12253 | - * | |
| 12254 | - * @return {string} HTML. | |
| 12255 | - */ | |
| 12256 | - | |
| 12257 | - | |
| 12258 | -function markdownConverter(text) { | |
| 12259 | - return converter.makeHtml(slackMarkdownVariantCorrector(text)); | |
| 12260 | -} | |
| 12261 | -//# sourceMappingURL=markdown-converter.js.map | |
| 12262 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/iframe-remover.js | |
| 12263 | -/** | |
| 12264 | - * Removes iframes. | |
| 12265 | - * | |
| 12266 | - * @param {Node} node The node to check. | |
| 12267 | - * | |
| 12268 | - * @return {void} | |
| 12269 | - */ | |
| 12270 | -function iframeRemover(node) { | |
| 12271 | - if (node.nodeName === 'IFRAME') { | |
| 12272 | - const text = node.ownerDocument.createTextNode(node.src); | |
| 12273 | - node.parentNode.replaceChild(text, node); | |
| 12274 | - } | |
| 12275 | -} | |
| 12276 | -//# sourceMappingURL=iframe-remover.js.map | |
| 12277 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.js | |
| 12278 | -/** | |
| 12279 | - * WordPress dependencies | |
| 12280 | - */ | |
| 12281 | - | |
| 12282 | -function googleDocsUIdRemover(node) { | |
| 12283 | - if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) { | |
| 12284 | - return; | |
| 12285 | - } | |
| 12286 | - | |
| 12287 | - (0,external_wp_dom_namespaceObject.unwrap)(node); | |
| 12288 | -} | |
| 12289 | -//# sourceMappingURL=google-docs-uid-remover.js.map | |
| 12290 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/html-formatting-remover.js | |
| 12291 | -/** | |
| 12292 | - * Internal dependencies | |
| 12293 | - */ | |
| 12294 | - | |
| 12295 | - | |
| 12296 | -function isFormattingSpace(character) { | |
| 12297 | - return character === ' ' || character === '\r' || character === '\n' || character === '\t'; | |
| 12298 | -} | |
| 12299 | -/** | |
| 12300 | - * Removes spacing that formats HTML. | |
| 12301 | - * | |
| 12302 | - * @see https://www.w3.org/TR/css-text-3/#white-space-processing | |
| 12303 | - * | |
| 12304 | - * @param {Node} node The node to be processed. | |
| 12305 | - * @return {void} | |
| 12306 | - */ | |
| 12307 | - | |
| 12308 | - | |
| 12309 | -function htmlFormattingRemover(node) { | |
| 12310 | - if (node.nodeType !== node.TEXT_NODE) { | |
| 12311 | - return; | |
| 12312 | - } // Ignore pre content. Note that this does not use Element#closest due to | |
| 12313 | - // a combination of (a) node may not be Element and (b) node.parentElement | |
| 12314 | - // does not have full support in all browsers (Internet Exporer). | |
| 12315 | - // | |
| 12316 | - // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility | |
| 12317 | - | |
| 12318 | - /** @type {Node?} */ | |
| 12319 | - | |
| 12320 | - | |
| 12321 | - let parent = node; | |
| 12322 | - | |
| 12323 | - while (parent = parent.parentNode) { | |
| 12324 | - if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === 'PRE') { | |
| 12325 | - return; | |
| 12326 | - } | |
| 12327 | - } // First, replace any sequence of HTML formatting space with a single space. | |
| 12328 | - | |
| 12329 | - | |
| 12330 | - let newData = node.data.replace(/[ \r\n\t]+/g, ' '); // Remove the leading space if the text element is at the start of a block, | |
| 12331 | - // is preceded by a line break element, or has a space in the previous | |
| 12332 | - // node. | |
| 12333 | - | |
| 12334 | - if (newData[0] === ' ') { | |
| 12335 | - const previousSibling = getSibling(node, 'previous'); | |
| 12336 | - | |
| 12337 | - if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') { | |
| 12338 | - newData = newData.slice(1); | |
| 12339 | - } | |
| 12340 | - } // Remove the trailing space if the text element is at the end of a block, | |
| 12341 | - // is succeded by a line break element, or has a space in the next text | |
| 12342 | - // node. | |
| 12343 | - | |
| 12344 | - | |
| 12345 | - if (newData[newData.length - 1] === ' ') { | |
| 12346 | - const nextSibling = getSibling(node, 'next'); | |
| 12347 | - | |
| 12348 | - if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { | |
| 12349 | - newData = newData.slice(0, -1); | |
| 12350 | - } | |
| 12351 | - } // If there's no data left, remove the node, so `previousSibling` stays | |
| 12352 | - // accurate. Otherwise, update the node data. | |
| 12353 | - | |
| 12354 | - | |
| 12355 | - if (!newData) { | |
| 12356 | - node.parentNode.removeChild(node); | |
| 12357 | - } else { | |
| 12358 | - node.data = newData; | |
| 12359 | - } | |
| 12360 | -} | |
| 12361 | -//# sourceMappingURL=html-formatting-remover.js.map | |
| 12362 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/br-remover.js | |
| 12363 | -/** | |
| 12364 | - * Internal dependencies | |
| 12365 | - */ | |
| 12366 | - | |
| 12367 | -/** | |
| 12368 | - * Removes trailing br elements from text-level content. | |
| 12369 | - * | |
| 12370 | - * @param {Element} node Node to check. | |
| 12371 | - */ | |
| 12372 | - | |
| 12373 | -function brRemover(node) { | |
| 12374 | - if (node.nodeName !== 'BR') { | |
| 12375 | - return; | |
| 12376 | - } | |
| 12377 | - | |
| 12378 | - if (getSibling(node, 'next')) { | |
| 12379 | - return; | |
| 12380 | - } | |
| 12381 | - | |
| 12382 | - node.parentNode.removeChild(node); | |
| 12383 | -} | |
| 12384 | -//# sourceMappingURL=br-remover.js.map | |
| 12385 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.js | |
| 12386 | -/** | |
| 12387 | - * Removes empty paragraph elements. | |
| 12388 | - * | |
| 12389 | - * @param {Element} node Node to check. | |
| 12390 | - */ | |
| 12391 | -function emptyParagraphRemover(node) { | |
| 12392 | - if (node.nodeName !== 'P') { | |
| 12393 | - return; | |
| 12394 | - } | |
| 12395 | - | |
| 12396 | - if (node.hasChildNodes()) { | |
| 12397 | - return; | |
| 12398 | - } | |
| 12399 | - | |
| 12400 | - node.parentNode.removeChild(node); | |
| 12401 | -} | |
| 12402 | -//# sourceMappingURL=empty-paragraph-remover.js.map | |
| 12403 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/raw-handling/paste-handler.js | |
| 12404 | -/** | |
| 12405 | - * External dependencies | |
| 12406 | - */ | |
| 12407 | - | |
| 12408 | -/** | |
| 12409 | - * WordPress dependencies | |
| 12410 | - */ | |
| 12411 | - | |
| 12412 | - | |
| 12413 | -/** | |
| 12414 | - * Internal dependencies | |
| 12415 | - */ | |
| 12416 | - | |
| 12417 | - | |
| 12418 | - | |
| 12419 | - | |
| 12420 | - | |
| 12421 | - | |
| 12422 | - | |
| 12423 | - | |
| 12424 | - | |
| 12425 | - | |
| 12426 | - | |
| 12427 | - | |
| 12428 | - | |
| 12429 | - | |
| 12430 | - | |
| 12431 | - | |
| 12432 | - | |
| 12433 | - | |
| 12434 | - | |
| 12435 | - | |
| 12436 | - | |
| 12437 | - | |
| 12438 | - | |
| 12439 | - | |
| 12440 | - | |
| 12441 | -/** | |
| 12442 | - * Browser dependencies | |
| 12443 | - */ | |
| 12444 | - | |
| 12445 | -const { | |
| 12446 | - console: paste_handler_console | |
| 12447 | -} = window; | |
| 12448 | -/** | |
| 12449 | - * Filters HTML to only contain phrasing content. | |
| 12450 | - * | |
| 12451 | - * @param {string} HTML The HTML to filter. | |
| 12452 | - * @param {boolean} preserveWhiteSpace Whether or not to preserve consequent white space. | |
| 12453 | - * | |
| 12454 | - * @return {string} HTML only containing phrasing content. | |
| 12455 | - */ | |
| 12456 | - | |
| 12457 | -function filterInlineHTML(HTML, preserveWhiteSpace) { | |
| 12458 | - HTML = deepFilterHTML(HTML, [googleDocsUIdRemover, phrasingContentReducer, commentRemover]); | |
| 12459 | - HTML = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(HTML, (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste'), { | |
| 12460 | - inline: true | |
| 12461 | - }); | |
| 12462 | - | |
| 12463 | - if (!preserveWhiteSpace) { | |
| 12464 | - HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); | |
| 12465 | - } // Allows us to ask for this information when we get a report. | |
| 12466 | - | |
| 12467 | - | |
| 12468 | - paste_handler_console.log('Processed inline HTML:\n\n', HTML); | |
| 12469 | - return HTML; | |
| 12470 | -} | |
| 12471 | -/** | |
| 12472 | - * Converts an HTML string to known blocks. Strips everything else. | |
| 12473 | - * | |
| 12474 | - * @param {Object} options | |
| 12475 | - * @param {string} [options.HTML] The HTML to convert. | |
| 12476 | - * @param {string} [options.plainText] Plain text version. | |
| 12477 | - * @param {string} [options.mode] Handle content as blocks or inline content. | |
| 12478 | - * * 'AUTO': Decide based on the content passed. | |
| 12479 | - * * 'INLINE': Always handle as inline content, and return string. | |
| 12480 | - * * 'BLOCKS': Always handle as blocks, and return array of blocks. | |
| 12481 | - * @param {Array} [options.tagName] The tag into which content will be inserted. | |
| 12482 | - * @param {boolean} [options.preserveWhiteSpace] Whether or not to preserve consequent white space. | |
| 12483 | - * | |
| 12484 | - * @return {Array|string} A list of blocks or a string, depending on `handlerMode`. | |
| 12485 | - */ | |
| 12486 | - | |
| 12487 | - | |
| 12488 | -function pasteHandler(_ref) { | |
| 12489 | - let { | |
| 12490 | - HTML = '', | |
| 12491 | - plainText = '', | |
| 12492 | - mode = 'AUTO', | |
| 12493 | - tagName, | |
| 12494 | - preserveWhiteSpace | |
| 12495 | - } = _ref; | |
| 12496 | - // First of all, strip any meta tags. | |
| 12497 | - HTML = HTML.replace(/<meta[^>]+>/g, ''); // Strip Windows markers. | |
| 12498 | - | |
| 12499 | - HTML = HTML.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, ''); | |
| 12500 | - HTML = HTML.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, ''); // If we detect block delimiters in HTML, parse entirely as blocks. | |
| 12501 | - | |
| 12502 | - if (mode !== 'INLINE') { | |
| 12503 | - // Check plain text if there is no HTML. | |
| 12504 | - const content = HTML ? HTML : plainText; | |
| 12505 | - | |
| 12506 | - if (content.indexOf('<!-- wp:') !== -1) { | |
| 12507 | - return parser_parse(content); | |
| 12508 | - } | |
| 12509 | - } // Normalize unicode to use composed characters. | |
| 12510 | - // This is unsupported in IE 11 but it's a nice-to-have feature, not mandatory. | |
| 12511 | - // Not normalizing the content will only affect older browsers and won't | |
| 12512 | - // entirely break the app. | |
| 12513 | - // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize | |
| 12514 | - // See: https://core.trac.wordpress.org/ticket/30130 | |
| 12515 | - // See: https://github.com/WordPress/gutenberg/pull/6983#pullrequestreview-125151075 | |
| 12516 | - | |
| 12517 | - | |
| 12518 | - if (String.prototype.normalize) { | |
| 12519 | - HTML = HTML.normalize(); | |
| 12520 | - } // Parse Markdown (and encoded HTML) if: | |
| 12521 | - // * There is a plain text version. | |
| 12522 | - // * There is no HTML version, or it has no formatting. | |
| 12523 | - | |
| 12524 | - | |
| 12525 | - if (plainText && (!HTML || isPlain(HTML))) { | |
| 12526 | - HTML = plainText; // The markdown converter (Showdown) trims whitespace. | |
| 12527 | - | |
| 12528 | - if (!/^\s+$/.test(plainText)) { | |
| 12529 | - HTML = markdownConverter(HTML); | |
| 12530 | - } // Switch to inline mode if: | |
| 12531 | - // * The current mode is AUTO. | |
| 12532 | - // * The original plain text had no line breaks. | |
| 12533 | - // * The original plain text was not an HTML paragraph. | |
| 12534 | - // * The converted text is just a paragraph. | |
| 12535 | - | |
| 12536 | - | |
| 12537 | - if (mode === 'AUTO' && plainText.indexOf('\n') === -1 && plainText.indexOf('<p>') !== 0 && HTML.indexOf('<p>') === 0) { | |
| 12538 | - mode = 'INLINE'; | |
| 12539 | - } | |
| 12540 | - } | |
| 12541 | - | |
| 12542 | - if (mode === 'INLINE') { | |
| 12543 | - return filterInlineHTML(HTML, preserveWhiteSpace); | |
| 12544 | - } // An array of HTML strings and block objects. The blocks replace matched | |
| 12545 | - // shortcodes. | |
| 12546 | - | |
| 12547 | - | |
| 12548 | - const pieces = shortcode_converter(HTML); // The call to shortcodeConverter will always return more than one element | |
| 12549 | - // if shortcodes are matched. The reason is when shortcodes are matched | |
| 12550 | - // empty HTML strings are included. | |
| 12551 | - | |
| 12552 | - const hasShortcodes = pieces.length > 1; | |
| 12553 | - | |
| 12554 | - if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) { | |
| 12555 | - return filterInlineHTML(HTML, preserveWhiteSpace); | |
| 12556 | - } | |
| 12557 | - | |
| 12558 | - const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste'); | |
| 12559 | - const blockContentSchema = getBlockContentSchema('paste'); | |
| 12560 | - const blocks = (0,external_lodash_namespaceObject.compact)((0,external_lodash_namespaceObject.flatMap)(pieces, piece => { | |
| 12561 | - // Already a block from shortcode. | |
| 12562 | - if (typeof piece !== 'string') { | |
| 12563 | - return piece; | |
| 12564 | - } | |
| 12565 | - | |
| 12566 | - const filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser, divNormaliser]; | |
| 12567 | - const schema = { ...blockContentSchema, | |
| 12568 | - // Keep top-level phrasing content, normalised by `normaliseBlocks`. | |
| 12569 | - ...phrasingContentSchema | |
| 12570 | - }; | |
| 12571 | - piece = deepFilterHTML(piece, filters, blockContentSchema); | |
| 12572 | - piece = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(piece, schema); | |
| 12573 | - piece = normaliseBlocks(piece); | |
| 12574 | - piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema); // Allows us to ask for this information when we get a report. | |
| 12575 | - | |
| 12576 | - paste_handler_console.log('Processed HTML piece:\n\n', piece); | |
| 12577 | - return htmlToBlocks(piece); | |
| 12578 | - })); // If we're allowed to return inline content, and there is only one | |
| 12579 | - // inlineable block, and the original plain text content does not have any | |
| 12580 | - // line breaks, then treat it as inline paste. | |
| 12581 | - | |
| 12582 | - if (mode === 'AUTO' && blocks.length === 1 && registration_hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) { | |
| 12583 | - // Don't catch line breaks at the start or end. | |
| 12584 | - const trimmedPlainText = plainText.replace(/^[\n]+|[\n]+$/g, ''); | |
| 12585 | - | |
| 12586 | - if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) { | |
| 12587 | - return (0,external_wp_dom_namespaceObject.removeInvalidHTML)(getBlockInnerHTML(blocks[0]), phrasingContentSchema); | |
| 12588 | - } | |
| 12589 | - } | |
| 12590 | - | |
| 12591 | - return blocks; | |
| 12592 | -} | |
| 12593 | -//# sourceMappingURL=paste-handler.js.map | |
| 12594 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/categories.js | |
| 12595 | -/** | |
| 12596 | - * WordPress dependencies | |
| 12597 | - */ | |
| 12598 | - | |
| 12599 | -/** | |
| 12600 | - * Internal dependencies | |
| 12601 | - */ | |
| 12602 | - | |
| 12603 | - | |
| 12604 | -/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */ | |
| 12605 | - | |
| 12606 | -/** | |
| 12607 | - * Returns all the block categories. | |
| 12608 | - * | |
| 12609 | - * @return {WPBlockCategory[]} Block categories. | |
| 12610 | - */ | |
| 12611 | - | |
| 12612 | -function categories_getCategories() { | |
| 12613 | - return (0,external_wp_data_namespaceObject.select)(store).getCategories(); | |
| 12614 | -} | |
| 12615 | -/** | |
| 12616 | - * Sets the block categories. | |
| 12617 | - * | |
| 12618 | - * @param {WPBlockCategory[]} categories Block categories. | |
| 12619 | - */ | |
| 12620 | - | |
| 12621 | -function categories_setCategories(categories) { | |
| 12622 | - (0,external_wp_data_namespaceObject.dispatch)(store).setCategories(categories); | |
| 12623 | -} | |
| 12624 | -/** | |
| 12625 | - * Updates a category. | |
| 12626 | - * | |
| 12627 | - * @param {string} slug Block category slug. | |
| 12628 | - * @param {WPBlockCategory} category Object containing the category properties | |
| 12629 | - * that should be updated. | |
| 12630 | - */ | |
| 12631 | - | |
| 12632 | -function categories_updateCategory(slug, category) { | |
| 12633 | - (0,external_wp_data_namespaceObject.dispatch)(store).updateCategory(slug, category); | |
| 12634 | -} | |
| 12635 | -//# sourceMappingURL=categories.js.map | |
| 12636 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/templates.js | |
| 12637 | -/** | |
| 12638 | - * External dependencies | |
| 12639 | - */ | |
| 12640 | - | |
| 12641 | -/** | |
| 12642 | - * WordPress dependencies | |
| 12643 | - */ | |
| 12644 | - | |
| 12645 | - | |
| 12646 | -/** | |
| 12647 | - * Internal dependencies | |
| 12648 | - */ | |
| 12649 | - | |
| 12650 | - | |
| 12651 | - | |
| 12652 | - | |
| 12653 | -/** | |
| 12654 | - * Checks whether a list of blocks matches a template by comparing the block names. | |
| 12655 | - * | |
| 12656 | - * @param {Array} blocks Block list. | |
| 12657 | - * @param {Array} template Block template. | |
| 12658 | - * | |
| 12659 | - * @return {boolean} Whether the list of blocks matches a templates. | |
| 12660 | - */ | |
| 12661 | - | |
| 12662 | -function doBlocksMatchTemplate() { | |
| 12663 | - let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | |
| 12664 | - let template = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | |
| 12665 | - return blocks.length === template.length && (0,external_lodash_namespaceObject.every)(template, (_ref, index) => { | |
| 12666 | - let [name,, innerBlocksTemplate] = _ref; | |
| 12667 | - const block = blocks[index]; | |
| 12668 | - return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate); | |
| 12669 | - }); | |
| 12670 | -} | |
| 12671 | -/** | |
| 12672 | - * Synchronize a block list with a block template. | |
| 12673 | - * | |
| 12674 | - * Synchronizing a block list with a block template means that we loop over the blocks | |
| 12675 | - * keep the block as is if it matches the block at the same position in the template | |
| 12676 | - * (If it has the same name) and if doesn't match, we create a new block based on the template. | |
| 12677 | - * Extra blocks not present in the template are removed. | |
| 12678 | - * | |
| 12679 | - * @param {Array} blocks Block list. | |
| 12680 | - * @param {Array} template Block template. | |
| 12681 | - * | |
| 12682 | - * @return {Array} Updated Block list. | |
| 12683 | - */ | |
| 12684 | - | |
| 12685 | -function synchronizeBlocksWithTemplate() { | |
| 12686 | - let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | |
| 12687 | - let template = arguments.length > 1 ? arguments[1] : undefined; | |
| 12688 | - | |
| 12689 | - // If no template is provided, return blocks unmodified. | |
| 12690 | - if (!template) { | |
| 12691 | - return blocks; | |
| 12692 | - } | |
| 12693 | - | |
| 12694 | - return (0,external_lodash_namespaceObject.map)(template, (_ref2, index) => { | |
| 12695 | - let [name, attributes, innerBlocksTemplate] = _ref2; | |
| 12696 | - const block = blocks[index]; | |
| 12697 | - | |
| 12698 | - if (block && block.name === name) { | |
| 12699 | - const innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate); | |
| 12700 | - return { ...block, | |
| 12701 | - innerBlocks | |
| 12702 | - }; | |
| 12703 | - } // To support old templates that were using the "children" format | |
| 12704 | - // for the attributes using "html" strings now, we normalize the template attributes | |
| 12705 | - // before creating the blocks. | |
| 12706 | - | |
| 12707 | - | |
| 12708 | - const blockType = registration_getBlockType(name); | |
| 12709 | - | |
| 12710 | - const isHTMLAttribute = attributeDefinition => (0,external_lodash_namespaceObject.get)(attributeDefinition, ['source']) === 'html'; | |
| 12711 | - | |
| 12712 | - const isQueryAttribute = attributeDefinition => (0,external_lodash_namespaceObject.get)(attributeDefinition, ['source']) === 'query'; | |
| 12713 | - | |
| 12714 | - const normalizeAttributes = (schema, values) => { | |
| 12715 | - return (0,external_lodash_namespaceObject.mapValues)(values, (value, key) => { | |
| 12716 | - return normalizeAttribute(schema[key], value); | |
| 12717 | - }); | |
| 12718 | - }; | |
| 12719 | - | |
| 12720 | - const normalizeAttribute = (definition, value) => { | |
| 12721 | - if (isHTMLAttribute(definition) && (0,external_lodash_namespaceObject.isArray)(value)) { | |
| 12722 | - // Introduce a deprecated call at this point | |
| 12723 | - // When we're confident that "children" format should be removed from the templates. | |
| 12724 | - return (0,external_wp_element_namespaceObject.renderToString)(value); | |
| 12725 | - } | |
| 12726 | - | |
| 12727 | - if (isQueryAttribute(definition) && value) { | |
| 12728 | - return value.map(subValues => { | |
| 12729 | - return normalizeAttributes(definition.query, subValues); | |
| 12730 | - }); | |
| 12731 | - } | |
| 12732 | - | |
| 12733 | - return value; | |
| 12734 | - }; | |
| 12735 | - | |
| 12736 | - const normalizedAttributes = normalizeAttributes((0,external_lodash_namespaceObject.get)(blockType, ['attributes'], {}), attributes); | |
| 12737 | - let [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(name, normalizedAttributes); // If a Block is undefined at this point, use the core/missing block as | |
| 12738 | - // a placeholder for a better user experience. | |
| 12739 | - | |
| 12740 | - if (undefined === registration_getBlockType(blockName)) { | |
| 12741 | - blockAttributes = { | |
| 12742 | - originalName: name, | |
| 12743 | - originalContent: '', | |
| 12744 | - originalUndelimitedContent: '' | |
| 12745 | - }; | |
| 12746 | - blockName = 'core/missing'; | |
| 12747 | - } | |
| 12748 | - | |
| 12749 | - return createBlock(blockName, blockAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate)); | |
| 12750 | - }); | |
| 12751 | -} | |
| 12752 | -//# sourceMappingURL=templates.js.map | |
| 12753 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/api/index.js | |
| 12754 | -// The blocktype is the most important concept within the block API. It defines | |
| 12755 | -// all aspects of the block configuration and its interfaces, including `edit` | |
| 12756 | -// and `save`. The transforms specification allows converting one blocktype to | |
| 12757 | -// another through formulas defined by either the source or the destination. | |
| 12758 | -// Switching a blocktype is to be considered a one-way operation implying a | |
| 12759 | -// transformation in the opposite way has to be handled explicitly. | |
| 12760 | - // The block tree is composed of a collection of block nodes. Blocks contained | |
| 12761 | -// within other blocks are called inner blocks. An important design | |
| 12762 | -// consideration is that inner blocks are -- conceptually -- not part of the | |
| 12763 | -// territory established by the parent block that contains them. | |
| 12764 | -// | |
| 12765 | -// This has multiple practical implications: when parsing, we can safely dispose | |
| 12766 | -// of any block boundary found within a block from the innerHTML property when | |
| 12767 | -// transfering to state. Not doing so would have a compounding effect on memory | |
| 12768 | -// and uncertainty over the source of truth. This can be illustrated in how, | |
| 12769 | -// given a tree of `n` nested blocks, the entry node would have to contain the | |
| 12770 | -// actual content of each block while each subsequent block node in the state | |
| 12771 | -// tree would replicate the entire chain `n-1`, meaning the extreme end node | |
| 12772 | -// would have been replicated `n` times as the tree is traversed and would | |
| 12773 | -// generate uncertainty as to which one is to hold the current value of the | |
| 12774 | -// block. For composition, it also means inner blocks can effectively be child | |
| 12775 | -// components whose mechanisms can be shielded from the `edit` implementation | |
| 12776 | -// and just passed along. | |
| 12777 | - | |
| 12778 | - | |
| 12779 | - // While block transformations account for a specific surface of the API, there | |
| 12780 | -// are also raw transformations which handle arbitrary sources not made out of | |
| 12781 | -// blocks but producing block basaed on various heursitics. This includes | |
| 12782 | -// pasting rich text or HTML data. | |
| 12783 | - | |
| 12784 | - // The process of serialization aims to deflate the internal memory of the block | |
| 12785 | -// editor and its state representation back into an HTML valid string. This | |
| 12786 | -// process restores the document integrity and inserts invisible delimiters | |
| 12787 | -// around each block with HTML comment boundaries which can contain any extra | |
| 12788 | -// attributes needed to operate with the block later on. | |
| 12789 | - | |
| 12790 | - // Validation is the process of comparing a block source with its output before | |
| 12791 | -// there is any user input or interaction with a block. When this operation | |
| 12792 | -// fails -- for whatever reason -- the block is to be considered invalid. As | |
| 12793 | -// part of validating a block the system will attempt to run the source against | |
| 12794 | -// any provided deprecation definitions. | |
| 12795 | -// | |
| 12796 | -// Worth emphasizing that validation is not a case of whether the markup is | |
| 12797 | -// merely HTML spec-compliant but about how the editor knows to create such | |
| 12798 | -// markup and that its inability to create an identical result can be a strong | |
| 12799 | -// indicator of potential data loss (the invalidation is then a protective | |
| 12800 | -// measure). | |
| 12801 | -// | |
| 12802 | -// The invalidation process can also be deconstructed in phases: 1) validate the | |
| 12803 | -// block exists; 2) validate the source matches the output; 3) validate the | |
| 12804 | -// source matches deprecated outputs; 4) work through the significance of | |
| 12805 | -// differences. These are stacked in a way that favors performance and optimizes | |
| 12806 | -// for the majority of cases. That is to say, the evaluation logic can become | |
| 12807 | -// more sophisticated the further down it goes in the process as the cost is | |
| 12808 | -// accounted for. The first logic checks have to be extremely efficient since | |
| 12809 | -// they will be run for all valid and invalid blocks alike. However, once a | |
| 12810 | -// block is detected as invalid -- failing the three first steps -- it is | |
| 12811 | -// adequate to spend more time determining validity before throwing a conflict. | |
| 12812 | - | |
| 12813 | - | |
| 12814 | - // Blocks are inherently indifferent about where the data they operate with ends | |
| 12815 | -// up being saved. For example, all blocks can have a static and dynamic aspect | |
| 12816 | -// to them depending on the needs. The static nature of a block is the `save()` | |
| 12817 | -// definition that is meant to be serialized into HTML and which can be left | |
| 12818 | -// void. Any block can also register a `render_callback` on the server, which | |
| 12819 | -// makes its output dynamic either in part or in its totality. | |
| 12820 | -// | |
| 12821 | -// Child blocks are defined as a relationship that builds on top of the inner | |
| 12822 | -// blocks mechanism. A child block is a block node of a particular type that can | |
| 12823 | -// only exist within the inner block boundaries of a specific parent type. This | |
| 12824 | -// allows block authors to compose specific blocks that are not meant to be used | |
| 12825 | -// outside of a specified parent block context. Thus, child blocks extend the | |
| 12826 | -// concept of inner blocks to support a more direct relationship between sets of | |
| 12827 | -// blocks. The addition of parent–child would be a subset of the inner block | |
| 12828 | -// functionality under the premise that certain blocks only make sense as | |
| 12829 | -// children of another block. | |
| 12830 | - | |
| 12831 | - | |
| 12832 | - // Templates are, in a general sense, a basic collection of block nodes with any | |
| 12833 | -// given set of predefined attributes that are supplied as the initial state of | |
| 12834 | -// an inner blocks group. These nodes can, in turn, contain any number of nested | |
| 12835 | -// blocks within their definition. Templates allow both to specify a default | |
| 12836 | -// state for an editor session or a default set of blocks for any inner block | |
| 12837 | -// implementation within a specific block. | |
| 12838 | - | |
| 12839 | - | |
| 12840 | - | |
| 12841 | - | |
| 12842 | - | |
| 12843 | -//# sourceMappingURL=index.js.map | |
| 12844 | -;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js | |
| 12845 | -function _extends() { | |
| 12846 | - _extends = Object.assign || function (target) { | |
| 12847 | - for (var i = 1; i < arguments.length; i++) { | |
| 12848 | - var source = arguments[i]; | |
| 12849 | - | |
| 12850 | - for (var key in source) { | |
| 12851 | - if (Object.prototype.hasOwnProperty.call(source, key)) { | |
| 12852 | - target[key] = source[key]; | |
| 12853 | - } | |
| 12854 | - } | |
| 12855 | - } | |
| 12856 | - | |
| 12857 | - return target; | |
| 12858 | - }; | |
| 12859 | - | |
| 12860 | - return _extends.apply(this, arguments); | |
| 12861 | -} | |
| 12862 | -;// CONCATENATED MODULE: external ["wp","compose"] | |
| 12863 | -var external_wp_compose_namespaceObject = window["wp"]["compose"]; | |
| 12864 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/block-content-provider/index.js | |
| 12865 | - | |
| 12866 | - | |
| 12867 | - | |
| 12868 | -/** | |
| 12869 | - * WordPress dependencies | |
| 12870 | - */ | |
| 12871 | - | |
| 12872 | - | |
| 12873 | -/** | |
| 12874 | - * Internal dependencies | |
| 12875 | - */ | |
| 12876 | - | |
| 12877 | - | |
| 12878 | -const { | |
| 12879 | - Consumer, | |
| 12880 | - Provider | |
| 12881 | -} = (0,external_wp_element_namespaceObject.createContext)(() => {}); | |
| 12882 | -/** | |
| 12883 | - * An internal block component used in block content serialization to inject | |
| 12884 | - * nested block content within the `save` implementation of the ancestor | |
| 12885 | - * component in which it is nested. The component provides a pre-bound | |
| 12886 | - * `BlockContent` component via context, which is used by the developer-facing | |
| 12887 | - * `InnerBlocks.Content` component to render block content. | |
| 12888 | - * | |
| 12889 | - * @example | |
| 12890 | - * | |
| 12891 | - * ```jsx | |
| 12892 | - * <BlockContentProvider innerBlocks={ innerBlocks }> | |
| 12893 | - * { blockSaveElement } | |
| 12894 | - * </BlockContentProvider> | |
| 12895 | - * ``` | |
| 12896 | - * | |
| 12897 | - * @param {Object} props Component props. | |
| 12898 | - * @param {WPElement} props.children Block save result. | |
| 12899 | - * @param {Array} props.innerBlocks Block(s) to serialize. | |
| 12900 | - * | |
| 12901 | - * @return {WPComponent} Element with BlockContent injected via context. | |
| 12902 | - */ | |
| 12903 | - | |
| 12904 | -const BlockContentProvider = _ref => { | |
| 12905 | - let { | |
| 12906 | - children, | |
| 12907 | - innerBlocks | |
| 12908 | - } = _ref; | |
| 12909 | - | |
| 12910 | - const BlockContent = () => { | |
| 12911 | - // Value is an array of blocks, so defer to block serializer | |
| 12912 | - const html = serialize(innerBlocks, { | |
| 12913 | - isInnerBlocks: true | |
| 12914 | - }); // Use special-cased raw HTML tag to avoid default escaping | |
| 12915 | - | |
| 12916 | - return createElement(RawHTML, null, html); | |
| 12917 | - }; | |
| 12918 | - | |
| 12919 | - return createElement(Provider, { | |
| 12920 | - value: BlockContent | |
| 12921 | - }, children); | |
| 12922 | -}; | |
| 12923 | -/** | |
| 12924 | - * A Higher Order Component used to inject BlockContent using context to the | |
| 12925 | - * wrapped component. | |
| 12926 | - * | |
| 12927 | - * @return {WPComponent} Enhanced component with injected BlockContent as prop. | |
| 12928 | - */ | |
| 12929 | - | |
| 12930 | - | |
| 12931 | -const withBlockContentContext = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => { | |
| 12932 | - return props => (0,external_wp_element_namespaceObject.createElement)(Consumer, null, context => (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, _extends({}, props, { | |
| 12933 | - BlockContent: context | |
| 12934 | - }))); | |
| 12935 | -}, 'withBlockContentContext'); | |
| 12936 | -/* harmony default export */ var block_content_provider = ((/* unused pure expression or super */ null && (BlockContentProvider))); | |
| 12937 | -//# sourceMappingURL=index.js.map | |
| 12938 | -;// CONCATENATED MODULE: ./packages/blocks/build-module/index.js | |
| 12939 | -// A "block" is the abstract term used to describe units of markup that, | |
| 12940 | -// when composed together, form the content or layout of a page. | |
| 12941 | -// The API for blocks is exposed via `wp.blocks`. | |
| 12942 | -// | |
| 12943 | -// Supported blocks are registered by calling `registerBlockType`. Once registered, | |
| 12944 | -// the block is made available as an option to the editor interface. | |
| 12945 | -// | |
| 12946 | -// Blocks are inferred from the HTML source of a post through a parsing mechanism | |
| 12947 | -// and then stored as objects in state, from which it is then rendered for editing. | |
| 12948 | - | |
| 12949 | - | |
| 12950 | - | |
| 12951 | -//# sourceMappingURL=index.js.map | |
| 12952 | -}(); | |
| 12953 | -(window.wp = window.wp || {}).blocks = __webpack_exports__; | |
| 12954 | -/******/ })() | |
| 12955 | -; | |
| 1 | +window.wp=window.wp||{},window.wp.blocks=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=524)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},114:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(39),a=r(42),o=r(30),i=r(40);function s(e){return Object(n.a)(e)||Object(a.a)(e)||Object(o.a)(e)||Object(i.a)()}},135:function(e,t){e.exports=window.wp.autop},14:function(e,t){e.exports=window.wp.compose},15:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(24),a=r(42),o=r(30);function i(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||Object(a.a)(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},153:function(e,t){e.exports=window.wp.shortcode},194:function(e,t,r){"use strict";var n=r(0),a=r(7),o=Object(n.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(a.Path,{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"}));t.a=o},2:function(e,t){e.exports=window.lodash},204:function(e,t,r){"use strict";var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),a=new Uint8Array(16);function o(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(a)}for(var i=/^(?:[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,s=function(e){return"string"==typeof e&&i.test(e)},c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));t.a=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!s(r))throw TypeError("Stringified UUID is invalid");return r}(n)}},24:function(e,t,r){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}r.d(t,"a",(function(){return n}))},28:function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},29:function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return a}))},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(24);function a(e,t){if(e){if("string"==typeof e)return Object(n.a)(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Object(n.a)(e,t):void 0}}},34:function(e,t){e.exports=window.wp.dom},347:function(e,t){e.exports=window.wp.blockSerializationDefaultParser},348:function(e,t,r){var n;(function(){function a(e){"use strict";var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,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",type:"string"},rawPrefixHeaderId:{defaultValue:!1,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)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,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>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}var o={},i={},s={},c=a(!0),u="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:a(!0),allOn:function(){"use strict";var e=a(!0),t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=!0);return t}()};function d(e,t){"use strict";var r=t?"Error in "+t+" extension->":"Error in unnamed extension",n={valid:!0,error:""};o.helper.isArray(e)||(e=[e]);for(var a=0;a<e.length;++a){var i=r+" sub-extension "+a+": ",s=e[a];if("object"!=typeof s)return n.valid=!1,n.error=i+"must be an object, but "+typeof s+" given",n;if(!o.helper.isString(s.type))return n.valid=!1,n.error=i+'property "type" must be a string, but '+typeof s.type+" given",n;var c=s.type=s.type.toLowerCase();if("language"===c&&(c=s.type="lang"),"html"===c&&(c=s.type="output"),"lang"!==c&&"output"!==c&&"listener"!==c)return n.valid=!1,n.error=i+"type "+c+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',n;if("listener"===c){if(o.helper.isUndefined(s.listeners))return n.valid=!1,n.error=i+'. Extensions of type "listener" must have a property called "listeners"',n}else if(o.helper.isUndefined(s.filter)&&o.helper.isUndefined(s.regex))return n.valid=!1,n.error=i+c+' extensions must define either a "regex" property or a "filter" method',n;if(s.listeners){if("object"!=typeof s.listeners)return n.valid=!1,n.error=i+'"listeners" property must be an object but '+typeof s.listeners+" given",n;for(var u in s.listeners)if(s.listeners.hasOwnProperty(u)&&"function"!=typeof s.listeners[u])return n.valid=!1,n.error=i+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+u+" must be a function but "+typeof s.listeners[u]+" given",n}if(s.filter){if("function"!=typeof s.filter)return n.valid=!1,n.error=i+'"filter" must be a function, but '+typeof s.filter+" given",n}else if(s.regex){if(o.helper.isString(s.regex)&&(s.regex=new RegExp(s.regex,"g")),!(s.regex instanceof RegExp))return n.valid=!1,n.error=i+'"regex" property must either be a string or a RegExp object, but '+typeof s.regex+" given",n;if(o.helper.isUndefined(s.replace))return n.valid=!1,n.error=i+'"regex" extensions must implement a replace string or function',n}}return n}function f(e,t){"use strict";return"¨E"+t.charCodeAt(0)+"E"}o.helper={},o.extensions={},o.setOption=function(e,t){"use strict";return c[e]=t,this},o.getOption=function(e){"use strict";return c[e]},o.getOptions=function(){"use strict";return c},o.resetOptions=function(){"use strict";c=a(!0)},o.setFlavor=function(e){"use strict";if(!l.hasOwnProperty(e))throw Error(e+" flavor was not found");o.resetOptions();var t=l[e];for(var r in u=e,t)t.hasOwnProperty(r)&&(c[r]=t[r])},o.getFlavor=function(){"use strict";return u},o.getFlavorOptions=function(e){"use strict";if(l.hasOwnProperty(e))return l[e]},o.getDefaultOptions=function(e){"use strict";return a(e)},o.subParser=function(e,t){"use strict";if(o.helper.isString(e)){if(void 0===t){if(i.hasOwnProperty(e))return i[e];throw Error("SubParser named "+e+" not registered!")}i[e]=t}},o.extension=function(e,t){"use strict";if(!o.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=o.helper.stdExtName(e),o.helper.isUndefined(t)){if(!s.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return s[e]}"function"==typeof t&&(t=t()),o.helper.isArray(t)||(t=[t]);var r=d(t,e);if(!r.valid)throw Error(r.error);s[e]=t},o.getAllExtensions=function(){"use strict";return s},o.removeExtension=function(e){"use strict";delete s[e]},o.resetExtensions=function(){"use strict";s={}},o.validateExtension=function(e){"use strict";var t=d(e,null);return!!t.valid||(console.warn(t.error),!1)},o.hasOwnProperty("helper")||(o.helper={}),o.helper.isString=function(e){"use strict";return"string"==typeof e||e instanceof String},o.helper.isFunction=function(e){"use strict";return e&&"[object Function]"==={}.toString.call(e)},o.helper.isArray=function(e){"use strict";return Array.isArray(e)},o.helper.isUndefined=function(e){"use strict";return void 0===e},o.helper.forEach=function(e,t){"use strict";if(o.helper.isUndefined(e))throw new Error("obj param is required");if(o.helper.isUndefined(t))throw new Error("callback param is required");if(!o.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(o.helper.isArray(e))for(var r=0;r<e.length;r++)t(e[r],r,e);else{if("object"!=typeof e)throw new Error("obj does not seem to be an array or an iterable object");for(var n in e)e.hasOwnProperty(n)&&t(e[n],n,e)}},o.helper.stdExtName=function(e){"use strict";return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},o.helper.escapeCharactersCallback=f,o.helper.escapeCharacters=function(e,t,r){"use strict";var n="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";r&&(n="\\\\"+n);var a=new RegExp(n,"g");return e.replace(a,f)},o.helper.unescapeHTMLEntities=function(e){"use strict";return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")};var p=function(e,t,r,n){"use strict";var a,o,i,s,c,u=n||"",l=u.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+u.replace(/g/g,"")),f=new RegExp(t,u.replace(/g/g,"")),p=[];do{for(a=0;i=d.exec(e);)if(f.test(i[0]))a++||(s=(o=d.lastIndex)-i[0].length);else if(a&&!--a){c=i.index+i[0].length;var h={left:{start:s,end:o},match:{start:o,end:i.index},right:{start:i.index,end:c},wholeMatch:{start:s,end:c}};if(p.push(h),!l)return p}}while(a&&(d.lastIndex=o));return p};o.helper.matchRecursiveRegExp=function(e,t,r,n){"use strict";for(var a=p(e,t,r,n),o=[],i=0;i<a.length;++i)o.push([e.slice(a[i].wholeMatch.start,a[i].wholeMatch.end),e.slice(a[i].match.start,a[i].match.end),e.slice(a[i].left.start,a[i].left.end),e.slice(a[i].right.start,a[i].right.end)]);return o},o.helper.replaceRecursiveRegExp=function(e,t,r,n,a){"use strict";if(!o.helper.isFunction(t)){var i=t;t=function(){return i}}var s=p(e,r,n,a),c=e,u=s.length;if(u>0){var l=[];0!==s[0].wholeMatch.start&&l.push(e.slice(0,s[0].wholeMatch.start));for(var d=0;d<u;++d)l.push(t(e.slice(s[d].wholeMatch.start,s[d].wholeMatch.end),e.slice(s[d].match.start,s[d].match.end),e.slice(s[d].left.start,s[d].left.end),e.slice(s[d].right.start,s[d].right.end))),d<u-1&&l.push(e.slice(s[d].wholeMatch.end,s[d+1].wholeMatch.start));s[u-1].wholeMatch.end<e.length&&l.push(e.slice(s[u-1].wholeMatch.end)),c=l.join("")}return c},o.helper.regexIndexOf=function(e,t,r){"use strict";if(!o.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==0)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},o.helper.splitAtIndex=function(e,t){"use strict";if(!o.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},o.helper.encodeEmailAddress=function(e){"use strict";var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,(function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e}))},o.helper.padEnd=function(e,t,r){"use strict";return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){"use strict";alert(e)},log:function(e){"use strict";alert(e)},error:function(e){"use strict";throw e}}),o.helper.regexes={asteriskDashAndColon:/([*_:~])/g},o.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',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>"},o.Converter=function(e){"use strict";var t={},r=[],n=[],a={},i=u,f={parsed:{},raw:"",format:""};function p(e,t){if(t=t||null,o.helper.isString(e)){if(t=e=o.helper.stdExtName(e),o.extensions[e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new o.Converter)),o.helper.isArray(e)||(e=[e]);var a=d(e,t);if(!a.valid)throw Error(a.error);for(var i=0;i<e.length;++i)switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(o.extensions[e],e);if(o.helper.isUndefined(s[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=s[e]}"function"==typeof e&&(e=e()),o.helper.isArray(e)||(e=[e]);var a=d(e,t);if(!a.valid)throw Error(a.error);for(var i=0;i<e.length;++i){switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i])}if(e[i].hasOwnProperty("listeners"))for(var c in e[i].listeners)e[i].listeners.hasOwnProperty(c)&&h(c,e[i].listeners[c])}}function h(e,t){if(!o.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+typeof e+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+typeof t+" given");a.hasOwnProperty(e)||(a[e]=[]),a[e].push(t)}!function(){for(var r in e=e||{},c)c.hasOwnProperty(r)&&(t[r]=c[r]);if("object"!=typeof e)throw Error("Converter expects the passed parameter to be an object, but "+typeof e+" was passed instead.");for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.extensions&&o.helper.forEach(t.extensions,p)}(),this._dispatch=function(e,t,r,n){if(a.hasOwnProperty(e))for(var o=0;o<a[e].length;++o){var i=a[e][o](e,t,this,r,n);i&&void 0!==i&&(t=i)}return t},this.listen=function(e,t){return h(e,t),this},this.makeHtml=function(e){if(!e)return e;var a={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:r,outputModifiers:n,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return e=(e=(e=(e=(e=e.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g," "),t.smartIndentationFix&&(e=function(e){var t=e.match(/^\s*/)[0].length,r=new RegExp("^\\s{0,"+t+"}","gm");return e.replace(r,"")}(e)),e="\n\n"+e+"\n\n",e=(e=o.subParser("detab")(e,t,a)).replace(/^[ \t]+$/gm,""),o.helper.forEach(r,(function(r){e=o.subParser("runExtension")(r,e,t,a)})),e=o.subParser("metadata")(e,t,a),e=o.subParser("hashPreCodeTags")(e,t,a),e=o.subParser("githubCodeBlocks")(e,t,a),e=o.subParser("hashHTMLBlocks")(e,t,a),e=o.subParser("hashCodeTags")(e,t,a),e=o.subParser("stripLinkDefinitions")(e,t,a),e=o.subParser("blockGamut")(e,t,a),e=o.subParser("unhashHTMLSpans")(e,t,a),e=(e=(e=o.subParser("unescapeSpecialChars")(e,t,a)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),e=o.subParser("completeHTMLDocument")(e,t,a),o.helper.forEach(n,(function(r){e=o.subParser("runExtension")(r,e,t,a)})),f=a.metadata,e},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)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");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n<t.length;++n)if(1===t[n].childElementCount&&"code"===t[n].firstChild.tagName.toLowerCase()){var a=t[n].firstChild.innerHTML.trim(),i=t[n].firstChild.getAttribute("data-language")||"";if(""===i)for(var s=t[n].firstChild.className.split(" "),c=0;c<s.length;++c){var u=s[c].match(/^language-(.+)$/);if(null!==u){i=u[1];break}}a=o.helper.unescapeHTMLEntities(a),r.push(a),t[n].outerHTML='<precode language="'+i+'" precodenum="'+n.toString()+'"></precode>'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes[r];3===n.nodeType?/\S/.test(n.nodeValue)?(n.nodeValue=n.nodeValue.split("\n").join(" "),n.nodeValue=n.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(n),--r):1===n.nodeType&&e(n)}}(r);for(var a=r.childNodes,i="",s=0;s<a.length;s++)i+=o.subParser("makeMarkdown.node")(a[s],n);return i},this.setOption=function(e,r){t[e]=r},this.getOption=function(e){return t[e]},this.getOptions=function(){return t},this.addExtension=function(e,t){p(e,t=t||null)},this.useExtension=function(e){p(e)},this.setFlavor=function(e){if(!l.hasOwnProperty(e))throw Error(e+" flavor was not found");var r=l[e];for(var n in i=e,r)r.hasOwnProperty(n)&&(t[n]=r[n])},this.getFlavor=function(){return i},this.removeExtension=function(e){o.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var a=e[t],i=0;i<r.length;++i)r[i]===a&&r[i].splice(i,1);for(;0<n.length;++i)n[0]===a&&n[0].splice(i,1)}},this.getAllExtensions=function(){return{language:r,output:n}},this.getMetadata=function(e){return e?f.raw:f.parsed},this.getMetadataFormat=function(){return f.format},this._setMetadataPair=function(e,t){f.parsed[e]=t},this._setMetadataFormat=function(e){f.format=e},this._setMetadataRaw=function(e){f.raw=e}},o.subParser("anchors",(function(e,t,r){"use strict";var n=function(e,n,a,i,s,c,u){if(o.helper.isUndefined(u)&&(u=""),a=a.toLowerCase(),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)i="";else if(!i){if(a||(a=n.toLowerCase().replace(/ ?\n/g," ")),i="#"+a,o.helper.isUndefined(r.gUrls[a]))return e;i=r.gUrls[a],o.helper.isUndefined(r.gTitles[a])||(u=r.gTitles[a])}var l='<a href="'+(i=i.replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback))+'"';return""!==u&&null!==u&&(l+=' title="'+(u=(u=u.replace(/"/g,""")).replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback))+'"'),t.openLinksInNewWindow&&!/^#/.test(i)&&(l+=' rel="noopener noreferrer" target="¨E95Eblank"'),l+">"+n+"</a>"};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,(function(e,r,n,a,i){if("\\"===n)return r+a;if(!o.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,i),c="";return t.openLinksInNewWindow&&(c=' rel="noopener noreferrer" target="¨E95Eblank"'),r+'<a href="'+s+'"'+c+">"+a+"</a>"}))),r.converter._dispatch("anchors.after",e,t,r)}));var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,g=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,b=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,m=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,_=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,v=function(e){"use strict";return function(t,r,n,a,i,s,c){var u=n=n.replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback),l="",d="",f=r||"",p=c||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(l=s),e.openLinksInNewWindow&&(d=' rel="noopener noreferrer" target="¨E95Eblank"'),f+'<a href="'+n+'"'+d+">"+u+"</a>"+l+p}},w=function(e,t){"use strict";return function(r,n,a){var i="mailto:";return n=n||"",a=o.subParser("unescapeSpecialChars")(a,e,t),e.encodeEmails?(i=o.helper.encodeEmailAddress(i+a),a=o.helper.encodeEmailAddress(a)):i+=a,n+'<a href="'+i+'">'+a+"</a>"}};o.subParser("autoLinks",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(b,v(t))).replace(_,w(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)})),o.subParser("simplifiedAutoLinks",(function(e,t,r){"use strict";return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(g,v(t)):e.replace(h,v(t))).replace(m,w(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e})),o.subParser("blockGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("blockGamut.before",e,t,r),e=o.subParser("blockQuotes")(e,t,r),e=o.subParser("headers")(e,t,r),e=o.subParser("horizontalRule")(e,t,r),e=o.subParser("lists")(e,t,r),e=o.subParser("codeBlocks")(e,t,r),e=o.subParser("tables")(e,t,r),e=o.subParser("hashHTMLBlocks")(e,t,r),e=o.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)})),o.subParser("blockQuotes",(function(e,t,r){"use strict";e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,(function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=o.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=o.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,(function(e,t){var r=t;return(r=r.replace(/^ /gm,"¨0")).replace(/¨0/g,"")})),o.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,r)})),r.converter._dispatch("blockQuotes.after",e,t,r)})),o.subParser("codeBlocks",(function(e,t,r){"use strict";return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,(function(e,n,a){var i=n,s=a,c="\n";return i=o.subParser("outdent")(i,t,r),i=o.subParser("encodeCode")(i,t,r),i=(i=(i=o.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(c=""),i="<pre><code>"+i+c+"</code></pre>",o.subParser("hashBlock")(i,t,r)+s}))).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)})),o.subParser("codeSpans",(function(e,t,r){"use strict";return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,(function(e,n,a,i){var s=i;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+"<code>"+(s=o.subParser("encodeCode")(s,t,r))+"</code>",o.subParser("hashHTMLSpans")(s,t,r)})),r.converter._dispatch("codeSpans.after",e,t,r)})),o.subParser("completeHTMLDocument",(function(e,t,r){"use strict";if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",a="<!DOCTYPE HTML>\n",o="",i='<meta charset="utf-8">\n',s="",c="";for(var u in void 0!==r.metadata.parsed.doctype&&(a="<!DOCTYPE "+r.metadata.parsed.doctype+">\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(i='<meta charset="utf-8">')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(u))switch(u.toLowerCase()){case"doctype":break;case"title":o="<title>"+r.metadata.parsed.title+"</title>\n";break;case"charset":i="html"===n||"html5"===n?'<meta charset="'+r.metadata.parsed.charset+'">\n':'<meta name="charset" content="'+r.metadata.parsed.charset+'">\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[u]+'"',c+='<meta name="'+u+'" content="'+r.metadata.parsed[u]+'">\n';break;default:c+='<meta name="'+u+'" content="'+r.metadata.parsed[u]+'">\n'}return e=a+"<html"+s+">\n<head>\n"+o+i+c+"</head>\n<body>\n"+e.trim()+"\n</body>\n</html>",r.converter._dispatch("completeHTMLDocument.after",e,t,r)})),o.subParser("detab",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,(function(e,t){for(var r=t,n=4-r.length%4,a=0;a<n;a++)r+=" ";return r}))).replace(/¨A/g," ")).replace(/¨B/g,""),r.converter._dispatch("detab.after",e,t,r)})),o.subParser("ellipsis",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("ellipsis.before",e,t,r)).replace(/\.\.\./g,"…"),r.converter._dispatch("ellipsis.after",e,t,r)})),o.subParser("emoji",(function(e,t,r){"use strict";return t.emoji?(e=(e=r.converter._dispatch("emoji.before",e,t,r)).replace(/:([\S]+?):/g,(function(e,t){return o.helper.emojis.hasOwnProperty(t)?o.helper.emojis[t]:e})),r.converter._dispatch("emoji.after",e,t,r)):e})),o.subParser("encodeAmpsAndAngles",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=r.converter._dispatch("encodeAmpsAndAngles.before",e,t,r)).replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&")).replace(/<(?![a-z\/?$!])/gi,"<")).replace(/</g,"<")).replace(/>/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)})),o.subParser("encodeBackslashEscapes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,o.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,o.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)})),o.subParser("encodeCode",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,o.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)})),o.subParser("escapeSpecialCharsWithinTagAttributes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,(function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,o.helper.escapeCharactersCallback)}))).replace(/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,(function(e){return e.replace(/([\\`*_~=|])/g,o.helper.escapeCharactersCallback)})),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)})),o.subParser("githubCodeBlocks",(function(e,t,r){"use strict";return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,(function(e,n,a,i){var s=t.omitExtraWLInCodeBlocks?"":"\n";return i=o.subParser("encodeCode")(i,t,r),i="<pre><code"+(a?' class="'+a+" language-"+a+'"':"")+">"+(i=(i=(i=o.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+s+"</code></pre>",i=o.subParser("hashBlock")(i,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:i})-1)+"G\n\n"}))).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e})),o.subParser("hashBlock",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)})),o.subParser("hashCodeTags",(function(e,t,r){"use strict";return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=o.helper.replaceRecursiveRegExp(e,(function(e,n,a,i){var s=a+o.subParser("encodeCode")(n,t,r)+i;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"}),"<code\\b[^>]*>","</code>","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)})),o.subParser("hashElement",(function(e,t,r){"use strict";return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}})),o.subParser("hashHTMLBlocks",(function(e,t,r){"use strict";e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,n,a){var o=e;return-1!==n.search(/\bmarkdown\b/)&&(o=n+r.converter.makeHtml(t)+a),"\n\n¨K"+(r.gHtmlBlocks.push(o)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,(function(e,t){return"<"+t+">"})));for(var i=0;i<n.length;++i)for(var s,c=new RegExp("^ {0,3}(<"+n[i]+"\\b[^>]*>)","im"),u="<"+n[i]+"\\b[^>]*>",l="</"+n[i]+">";-1!==(s=o.helper.regexIndexOf(e,c));){var d=o.helper.splitAtIndex(e,s),f=o.helper.replaceRecursiveRegExp(d[1],a,u,l,"im");if(f===d[1])break;e=d[0].concat(f)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,o.subParser("hashElement")(e,t,r)),e=(e=o.helper.replaceRecursiveRegExp(e,(function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"}),"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,o.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)})),o.subParser("hashHTMLSpans",(function(e,t,r){"use strict";function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,(function(e){return n(e)}))).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<[^>]+?>/gi,(function(e){return n(e)})),r.converter._dispatch("hashHTMLSpans.after",e,t,r)})),o.subParser("unhashHTMLSpans",(function(e,t,r){"use strict";e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n<r.gHtmlSpans.length;++n){for(var a=r.gHtmlSpans[n],o=0;/¨C(\d+)C/.test(a);){var i=RegExp.$1;if(a=a.replace("¨C"+i+"C",r.gHtmlSpans[i]),10===o){console.error("maximum nesting of 10 spans reached!!!");break}++o}e=e.replace("¨C"+n+"C",a)}return r.converter._dispatch("unhashHTMLSpans.after",e,t,r)})),o.subParser("hashPreCodeTags",(function(e,t,r){"use strict";return e=r.converter._dispatch("hashPreCodeTags.before",e,t,r),e=o.helper.replaceRecursiveRegExp(e,(function(e,n,a,i){var s=a+o.subParser("encodeCode")(n,t,r)+i;return"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:s})-1)+"G\n\n"}),"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)})),o.subParser("headers",(function(e,t,r){"use strict";e=r.converter._dispatch("headers.before",e,t,r);var n=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),a=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(a,(function(e,a){var i=o.subParser("spanGamut")(a,t,r),s=t.noHeaderId?"":' id="'+c(a)+'"',u="<h"+n+s+">"+i+"</h"+n+">";return o.subParser("hashBlock")(u,t,r)}))).replace(i,(function(e,a){var i=o.subParser("spanGamut")(a,t,r),s=t.noHeaderId?"":' id="'+c(a)+'"',u=n+1,l="<h"+u+s+">"+i+"</h"+u+">";return o.subParser("hashBlock")(l,t,r)}));var s=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;function c(e){var n,a;if(t.customizedHeaderId){var i=e.match(/\{([^{]+?)}\s*$/);i&&i[1]&&(e=i[1])}return n=e,a=o.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=a+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=a+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}return e=e.replace(s,(function(e,a,i){var s=i;t.customizedHeaderId&&(s=i.replace(/\s?\{([^{]+?)}\s*$/,""));var u=o.subParser("spanGamut")(s,t,r),l=t.noHeaderId?"":' id="'+c(i)+'"',d=n-1+a.length,f="<h"+d+l+">"+u+"</h"+d+">";return o.subParser("hashBlock")(f,t,r)})),r.converter._dispatch("headers.after",e,t,r)})),o.subParser("horizontalRule",(function(e,t,r){"use strict";e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=o.subParser("hashBlock")("<hr />",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),r.converter._dispatch("horizontalRule.after",e,t,r)})),o.subParser("images",(function(e,t,r){"use strict";function n(e,t,n,a,i,s,c,u){var l=r.gUrls,d=r.gTitles,f=r.gDimensions;if(n=n.toLowerCase(),u||(u=""),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)a="";else if(""===a||null===a){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),a="#"+n,o.helper.isUndefined(l[n]))return e;a=l[n],o.helper.isUndefined(d[n])||(u=d[n]),o.helper.isUndefined(f[n])||(i=f[n].width,s=f[n].height)}t=t.replace(/"/g,""").replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback);var p='<img src="'+(a=a.replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback))+'" alt="'+t+'"';return u&&o.helper.isString(u)&&(p+=' title="'+(u=u.replace(/"/g,""").replace(o.helper.regexes.asteriskDashAndColon,o.helper.escapeCharactersCallback))+'"'),i&&s&&(p+=' width="'+(i="*"===i?"auto":i)+'"',p+=' height="'+(s="*"===s?"auto":s)+'"'),p+" />"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \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,(function(e,t,r,a,o,i,s,c){return n(e,t,r,a=a.replace(/\s/g,""),o,i,0,c)}))).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),r.converter._dispatch("images.after",e,t,r)})),o.subParser("italicsAndBold",(function(e,t,r){"use strict";function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return n(t,"<strong><em>","</em></strong>")}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return n(t,"<strong>","</strong>")}))).replace(/\b_(\S[\s\S]*?)_\b/g,(function(e,t){return n(t,"<em>","</em>")})):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/_([^\s_][\s\S]*?)_/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong><em>","</em></strong>")}))).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong>","</strong>")}))).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<em>","</em>")})):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/\*\*(\S[\s\S]*?)\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/\*([^\s*][\s\S]*?)\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),r.converter._dispatch("italicsAndBold.after",e,t,r)})),o.subParser("lists",(function(e,t,r){"use strict";function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,i=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(a=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(a,(function(e,n,a,s,c,u,l){l=l&&""!==l.trim();var d=o.subParser("outdent")(c,t,r),f="";return u&&t.tasklists&&(f=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,(function(){var e='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return l&&(e+=" checked"),e+">"}))),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,(function(e){return"¨A"+e})),n||d.search(/\n{2,}/)>-1?(d=o.subParser("githubCodeBlocks")(d,t,r),d=o.subParser("blockGamut")(d,t,r)):(d=(d=o.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=o.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=i?o.subParser("paragraphs")(d,t,r):o.subParser("spanGamut")(d,t,r)),"<li"+f+">"+(d=d.replace("¨A",""))+"</li>\n"}))).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function a(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function i(e,r,o){var i=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,c="ul"===r?i:s,u="";if(-1!==e.search(c))!function t(l){var d=l.search(c),f=a(e,r);-1!==d?(u+="\n\n<"+r+f+">\n"+n(l.slice(0,d),!!o)+"</"+r+">\n",c="ul"==(r="ul"===r?"ol":"ul")?i:s,t(l.slice(d))):u+="\n\n<"+r+f+">\n"+n(l,!!o)+"</"+r+">\n"}(e);else{var l=a(e,r);u="\n\n<"+r+l+">\n"+n(e,!!o)+"</"+r+">\n"}return u}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r){return i(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)})):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r,n){return i(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)}))).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)})),o.subParser("metadata",(function(e,t,r){"use strict";if(!t.metadata)return e;function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,(function(e,t,n){return r.metadata.parsed[t]=n,""}))}return e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,(function(e,t,r){return n(r),"¨M"}))).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,(function(e,t,a){return t&&(r.metadata.format=t),n(a),"¨M"}))).replace(/¨M/g,""),r.converter._dispatch("metadata.after",e,t,r)})),o.subParser("outdent",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)})),o.subParser("paragraphs",(function(e,t,r){"use strict";for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),a=[],i=n.length,s=0;s<i;s++){var c=n[s];c.search(/¨(K|G)(\d+)\1/g)>=0?a.push(c):c.search(/\S/)>=0&&(c=(c=o.subParser("spanGamut")(c,t,r)).replace(/^([ \t]*)/g,"<p>"),c+="</p>",a.push(c))}for(i=a.length,s=0;s<i;s++){for(var u="",l=a[s],d=!1;/¨(K|G)(\d+)\1/.test(l);){var f=RegExp.$1,p=RegExp.$2;u=(u="K"===f?r.gHtmlBlocks[p]:d?o.subParser("encodeCode")(r.ghCodeBlocks[p].text,t,r):r.ghCodeBlocks[p].codeblock).replace(/\$/g,"$$$$"),l=l.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,u),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(l)&&(d=!0)}a[s]=l}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)})),o.subParser("runExtension",(function(e,t,r,n){"use strict";if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t})),o.subParser("spanGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("spanGamut.before",e,t,r),e=o.subParser("codeSpans")(e,t,r),e=o.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=o.subParser("encodeBackslashEscapes")(e,t,r),e=o.subParser("images")(e,t,r),e=o.subParser("anchors")(e,t,r),e=o.subParser("autoLinks")(e,t,r),e=o.subParser("simplifiedAutoLinks")(e,t,r),e=o.subParser("emoji")(e,t,r),e=o.subParser("underline")(e,t,r),e=o.subParser("italicsAndBold")(e,t,r),e=o.subParser("strikethrough")(e,t,r),e=o.subParser("ellipsis")(e,t,r),e=o.subParser("hashHTMLSpans")(e,t,r),e=o.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"<br />\n")):e=e.replace(/ +\n/g,"<br />\n"),r.converter._dispatch("spanGamut.after",e,t,r)})),o.subParser("strikethrough",(function(e,t,r){"use strict";return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,(function(e,n){return function(e){return t.simplifiedAutoLink&&(e=o.subParser("simplifiedAutoLinks")(e,t,r)),"<del>"+e+"</del>"}(n)})),e=r.converter._dispatch("strikethrough.after",e,t,r)),e})),o.subParser("stripLinkDefinitions",(function(e,t,r){"use strict";var n=function(e,n,a,i,s,c,u){return n=n.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=a.replace(/\s/g,""):r.gUrls[n]=o.subParser("encodeAmpsAndAngles")(a,t,r),c?c+u:(u&&(r.gTitles[n]=u.replace(/"|'/g,""")),t.parseImgDimensions&&i&&s&&(r.gDimensions[n]={width:i,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {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,n)).replace(/^ {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,n)).replace(/¨0/,"")})),o.subParser("tables",(function(e,t,r){"use strict";if(!t.tables)return e;function n(e,n){return"<td"+n+">"+o.subParser("spanGamut")(e,t,r)+"</td>\n"}function a(e){var a,i=e.split("\n");for(a=0;a<i.length;++a)/^ {0,3}\|/.test(i[a])&&(i[a]=i[a].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(i[a])&&(i[a]=i[a].replace(/\|[ \t]*$/,"")),i[a]=o.subParser("codeSpans")(i[a],t,r);var s,c,u,l,d=i[0].split("|").map((function(e){return e.trim()})),f=i[1].split("|").map((function(e){return e.trim()})),p=[],h=[],g=[],b=[];for(i.shift(),i.shift(),a=0;a<i.length;++a)""!==i[a].trim()&&p.push(i[a].split("|").map((function(e){return e.trim()})));if(d.length<f.length)return e;for(a=0;a<f.length;++a)g.push((s=f[a],/^:[ \t]*--*$/.test(s)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(s)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(s)?' style="text-align:center;"':""));for(a=0;a<d.length;++a)o.helper.isUndefined(g[a])&&(g[a]=""),h.push((c=d[a],u=g[a],l=void 0,l="",c=c.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(l=' id="'+c.replace(/ /g,"_").toLowerCase()+'"'),"<th"+l+u+">"+(c=o.subParser("spanGamut")(c,t,r))+"</th>\n"));for(a=0;a<p.length;++a){for(var m=[],_=0;_<h.length;++_)o.helper.isUndefined(p[a][_]),m.push(n(p[a][_],g[_]));b.push(m)}return function(e,t){for(var r="<table>\n<thead>\n<tr>\n",n=e.length,a=0;a<n;++a)r+=e[a];for(r+="</tr>\n</thead>\n<tbody>\n",a=0;a<t.length;++a){r+="<tr>\n";for(var o=0;o<n;++o)r+=t[a][o];r+="</tr>\n"}return r+"</tbody>\n</table>\n"}(h,b)}return e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,o.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,a)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,a),r.converter._dispatch("tables.after",e,t,r)})),o.subParser("underline",(function(e,t,r){"use strict";return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return"<u>"+t+"</u>"}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return"<u>"+t+"</u>"})):(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/(_)/g,o.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e})),o.subParser("unescapeSpecialChars",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,(function(e,t){var r=parseInt(t);return String.fromCharCode(r)})),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)})),o.subParser("makeMarkdown.blockquote",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,i=0;i<a;++i){var s=o.subParser("makeMarkdown.node")(n[i],t);""!==s&&(r+=s)}return"> "+(r=r.trim()).split("\n").join("\n> ")})),o.subParser("makeMarkdown.codeBlock",(function(e,t){"use strict";var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"})),o.subParser("makeMarkdown.codeSpan",(function(e){"use strict";return"`"+e.innerHTML+"`"})),o.subParser("makeMarkdown.emphasis",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);r+="*"}return r})),o.subParser("makeMarkdown.header",(function(e,t,r){"use strict";var n=new Array(r+1).join("#"),a="";if(e.hasChildNodes()){a=n+" ";for(var i=e.childNodes,s=i.length,c=0;c<s;++c)a+=o.subParser("makeMarkdown.node")(i[c],t)}return a})),o.subParser("makeMarkdown.hr",(function(){"use strict";return"---"})),o.subParser("makeMarkdown.image",(function(e){"use strict";var t="";return e.hasAttribute("src")&&(t+="+">",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t})),o.subParser("makeMarkdown.links",(function(e,t){"use strict";var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,a=n.length;r="[";for(var i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);r+="](",r+="<"+e.getAttribute("href")+">",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r})),o.subParser("makeMarkdown.list",(function(e,t,r){"use strict";var n="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,i=a.length,s=e.getAttribute("start")||1,c=0;c<i;++c)void 0!==a[c].tagName&&"li"===a[c].tagName.toLowerCase()&&(n+=("ol"===r?s.toString()+". ":"- ")+o.subParser("makeMarkdown.listItem")(a[c],t),++s);return(n+="\n\x3c!-- --\x3e\n").trim()})),o.subParser("makeMarkdown.listItem",(function(e,t){"use strict";for(var r="",n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);return/\n$/.test(r)?r=r.split("\n").join("\n ").replace(/^ {4}$/gm,"").replace(/\n\n+/g,"\n\n"):r+="\n",r})),o.subParser("makeMarkdown.node",(function(e,t,r){"use strict";r=r||!1;var n="";if(3===e.nodeType)return o.subParser("makeMarkdown.txt")(e,t);if(8===e.nodeType)return"\x3c!--"+e.data+"--\x3e\n\n";if(1!==e.nodeType)return"";switch(e.tagName.toLowerCase()){case"h1":r||(n=o.subParser("makeMarkdown.header")(e,t,1)+"\n\n");break;case"h2":r||(n=o.subParser("makeMarkdown.header")(e,t,2)+"\n\n");break;case"h3":r||(n=o.subParser("makeMarkdown.header")(e,t,3)+"\n\n");break;case"h4":r||(n=o.subParser("makeMarkdown.header")(e,t,4)+"\n\n");break;case"h5":r||(n=o.subParser("makeMarkdown.header")(e,t,5)+"\n\n");break;case"h6":r||(n=o.subParser("makeMarkdown.header")(e,t,6)+"\n\n");break;case"p":r||(n=o.subParser("makeMarkdown.paragraph")(e,t)+"\n\n");break;case"blockquote":r||(n=o.subParser("makeMarkdown.blockquote")(e,t)+"\n\n");break;case"hr":r||(n=o.subParser("makeMarkdown.hr")(e,t)+"\n\n");break;case"ol":r||(n=o.subParser("makeMarkdown.list")(e,t,"ol")+"\n\n");break;case"ul":r||(n=o.subParser("makeMarkdown.list")(e,t,"ul")+"\n\n");break;case"precode":r||(n=o.subParser("makeMarkdown.codeBlock")(e,t)+"\n\n");break;case"pre":r||(n=o.subParser("makeMarkdown.pre")(e,t)+"\n\n");break;case"table":r||(n=o.subParser("makeMarkdown.table")(e,t)+"\n\n");break;case"code":n=o.subParser("makeMarkdown.codeSpan")(e,t);break;case"em":case"i":n=o.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":n=o.subParser("makeMarkdown.strong")(e,t);break;case"del":n=o.subParser("makeMarkdown.strikethrough")(e,t);break;case"a":n=o.subParser("makeMarkdown.links")(e,t);break;case"img":n=o.subParser("makeMarkdown.image")(e,t);break;default:n=e.outerHTML+"\n\n"}return n})),o.subParser("makeMarkdown.paragraph",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);return r.trim()})),o.subParser("makeMarkdown.pre",(function(e,t){"use strict";var r=e.getAttribute("prenum");return"<pre>"+t.preList[r]+"</pre>"})),o.subParser("makeMarkdown.strikethrough",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);r+="~~"}return r})),o.subParser("makeMarkdown.strong",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="**";for(var n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t);r+="**"}return r})),o.subParser("makeMarkdown.table",(function(e,t){"use strict";var r,n,a="",i=[[],[]],s=e.querySelectorAll("thead>tr>th"),c=e.querySelectorAll("tbody>tr");for(r=0;r<s.length;++r){var u=o.subParser("makeMarkdown.tableCell")(s[r],t),l="---";if(s[r].hasAttribute("style"))switch(s[r].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":l=":---";break;case"text-align:right;":l="---:";break;case"text-align:center;":l=":---:"}i[0][r]=u.trim(),i[1][r]=l}for(r=0;r<c.length;++r){var d=i.push([])-1,f=c[r].getElementsByTagName("td");for(n=0;n<s.length;++n){var p=" ";void 0!==f[n]&&(p=o.subParser("makeMarkdown.tableCell")(f[n],t)),i[d].push(p)}}var h=3;for(r=0;r<i.length;++r)for(n=0;n<i[r].length;++n){var g=i[r][n].length;g>h&&(h=g)}for(r=0;r<i.length;++r){for(n=0;n<i[r].length;++n)1===r?":"===i[r][n].slice(-1)?i[r][n]=o.helper.padEnd(i[r][n].slice(-1),h-1,"-")+":":i[r][n]=o.helper.padEnd(i[r][n],h,"-"):i[r][n]=o.helper.padEnd(i[r][n],h);a+="| "+i[r].join(" | ")+" |\n"}return a.trim()})),o.subParser("makeMarkdown.tableCell",(function(e,t){"use strict";var r="";if(!e.hasChildNodes())return"";for(var n=e.childNodes,a=n.length,i=0;i<a;++i)r+=o.subParser("makeMarkdown.node")(n[i],t,!0);return r.trim()})),o.subParser("makeMarkdown.txt",(function(e){"use strict";var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),(t=(t=(t=(t=(t=(t=(t=(t=o.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")})),void 0===(n=function(){"use strict";return o}.call(t,r,t,e))||(e.exports=n)}).call(this)},35:function(e,t){e.exports=window.wp.hooks},38:function(e,t){e.exports=window.wp.deprecated},39:function(e,t,r){"use strict";function n(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return n}))},4:function(e,t){e.exports=window.wp.data},40:function(e,t,r){"use strict";function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,"a",(function(){return n}))},42:function(e,t,r){"use strict";function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}r.d(t,"a",(function(){return n}))},49:function(e,t,r){"use strict";var n,a;function o(e){return[e]}function i(){var e={clear:function(){e.head=null}};return e}function s(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}n={},a="undefined"!=typeof WeakMap,t.a=function(e,t){var r,c;function u(){r=a?new WeakMap:i()}function l(){var r,n,a,o,i,u=arguments.length;for(o=new Array(u),a=0;a<u;a++)o[a]=arguments[a];for(i=t.apply(null,o),(r=c(i)).isUniqueByDependants||(r.lastDependants&&!s(i,r.lastDependants,0)&&r.clear(),r.lastDependants=i),n=r.head;n;){if(s(n.args,o,1))return n!==r.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=r.head,n.prev=null,r.head.prev=n,r.head=n),n.val;n=n.next}return n={val:e.apply(null,o)},o[0]=null,n.args=o,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=o),c=a?function(e){var t,a,o,s,c,u=r,l=!0;for(t=0;t<e.length;t++){if(!(c=a=e[t])||"object"!=typeof c){l=!1;break}u.has(a)?u=u.get(a):(o=new WeakMap,u.set(a,o),u=o)}return u.has(n)||((s=i()).isUniqueByDependants=l,u.set(n,s)),u.get(n)}:function(){return r},l.getDependants=t,l.clear=u,u(),l}},5:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},52:function(e,t){e.exports=window.wp.blob},524:function(e,t,r){"use strict";r.r(t),r.d(t,"store",(function(){return ee})),r.d(t,"createBlock",(function(){return Je})),r.d(t,"createBlocksFromInnerBlocksTemplate",(function(){return et})),r.d(t,"cloneBlock",(function(){return rt})),r.d(t,"__experimentalCloneSanitizedBlock",(function(){return tt})),r.d(t,"getPossibleBlockTransformations",(function(){return it})),r.d(t,"switchToBlockType",(function(){return ut})),r.d(t,"getBlockTransforms",(function(){return ct})),r.d(t,"findTransform",(function(){return st})),r.d(t,"getBlockFromExample",(function(){return lt})),r.d(t,"parse",(function(){return Gr})),r.d(t,"getBlockAttributes",(function(){return Vr})),r.d(t,"parseWithAttributeSchema",(function(){return Hr})),r.d(t,"pasteHandler",(function(){return In})),r.d(t,"rawHandler",(function(){return $n})),r.d(t,"getPhrasingContentSchema",(function(){return Fn})),r.d(t,"serialize",(function(){return Xt})),r.d(t,"getBlockContent",(function(){return Yt})),r.d(t,"getBlockDefaultClassName",(function(){return Ft})),r.d(t,"getBlockMenuDefaultClassName",(function(){return $t})),r.d(t,"getSaveElement",(function(){return Gt})),r.d(t,"getSaveContent",(function(){return Kt})),r.d(t,"__unstableGetBlockProps",(function(){return Ut})),r.d(t,"__unstableSerializeAndClean",(function(){return Qt})),r.d(t,"isValidBlockContent",(function(){return jr})),r.d(t,"getCategories",(function(){return qn})),r.d(t,"setCategories",(function(){return Un})),r.d(t,"updateCategory",(function(){return Gn})),r.d(t,"registerBlockType",(function(){return xe})),r.d(t,"registerBlockCollection",(function(){return Pe})),r.d(t,"unregisterBlockType",(function(){return Te})),r.d(t,"setFreeformContentHandlerName",(function(){return Se})),r.d(t,"getFreeformContentHandlerName",(function(){return Ae})),r.d(t,"setUnregisteredTypeHandlerName",(function(){return Be})),r.d(t,"getUnregisteredTypeHandlerName",(function(){return Ne})),r.d(t,"setDefaultBlockName",(function(){return Le})),r.d(t,"getDefaultBlockName",(function(){return ze})),r.d(t,"setGroupingBlockName",(function(){return Me})),r.d(t,"getGroupingBlockName",(function(){return Ee})),r.d(t,"getBlockType",(function(){return De})),r.d(t,"getBlockTypes",(function(){return He})),r.d(t,"getBlockSupport",(function(){return Ie})),r.d(t,"hasBlockSupport",(function(){return Ve})),r.d(t,"getBlockVariations",(function(){return We})),r.d(t,"isReusableBlock",(function(){return Re})),r.d(t,"isTemplatePart",(function(){return Fe})),r.d(t,"getChildBlockNames",(function(){return $e})),r.d(t,"hasChildBlocks",(function(){return qe})),r.d(t,"hasChildBlocksWithInserterSupport",(function(){return Ue})),r.d(t,"unstable__bootstrapServerSideBlockDefinitions",(function(){return Ce})),r.d(t,"registerBlockStyle",(function(){return Ge})),r.d(t,"unregisterBlockStyle",(function(){return Ke})),r.d(t,"registerBlockVariation",(function(){return Ye})),r.d(t,"unregisterBlockVariation",(function(){return Ze})),r.d(t,"isUnmodifiedDefaultBlock",(function(){return fe})),r.d(t,"normalizeIconObject",(function(){return he})),r.d(t,"isValidIcon",(function(){return pe})),r.d(t,"__experimentalGetBlockLabel",(function(){return be})),r.d(t,"__experimentalGetAccessibleBlockLabel",(function(){return me})),r.d(t,"__experimentalSanitizeBlockAttributes",(function(){return _e})),r.d(t,"doBlocksMatchTemplate",(function(){return Yn})),r.d(t,"synchronizeBlocksWithTemplate",(function(){return Zn})),r.d(t,"children",(function(){return Lr})),r.d(t,"node",(function(){return Ar})),r.d(t,"__EXPERIMENTAL_STYLE_PROPERTY",(function(){return we})),r.d(t,"withBlockContentContext",(function(){return Ht}));var n={};r.r(n),r.d(n,"getBlockTypes",(function(){return O})),r.d(n,"getBlockType",(function(){return j})),r.d(n,"getBlockStyles",(function(){return C})),r.d(n,"getBlockVariations",(function(){return x})),r.d(n,"getDefaultBlockVariation",(function(){return P})),r.d(n,"getCategories",(function(){return T})),r.d(n,"getCollections",(function(){return S})),r.d(n,"getDefaultBlockName",(function(){return A})),r.d(n,"getFreeformFallbackBlockName",(function(){return E})),r.d(n,"getUnregisteredFallbackBlockName",(function(){return B})),r.d(n,"getGroupingBlockName",(function(){return N})),r.d(n,"getChildBlockNames",(function(){return L})),r.d(n,"getBlockSupport",(function(){return M})),r.d(n,"hasBlockSupport",(function(){return z})),r.d(n,"isMatchingSearchTerm",(function(){return D})),r.d(n,"hasChildBlocks",(function(){return H})),r.d(n,"hasChildBlocksWithInserterSupport",(function(){return I}));var a={};r.r(a),r.d(a,"addBlockTypes",(function(){return V})),r.d(a,"removeBlockTypes",(function(){return R})),r.d(a,"addBlockStyles",(function(){return F})),r.d(a,"removeBlockStyles",(function(){return $})),r.d(a,"addBlockVariations",(function(){return q})),r.d(a,"removeBlockVariations",(function(){return U})),r.d(a,"setDefaultBlockName",(function(){return G})),r.d(a,"setFreeformFallbackBlockName",(function(){return K})),r.d(a,"setUnregisteredFallbackBlockName",(function(){return W})),r.d(a,"setGroupingBlockName",(function(){return Y})),r.d(a,"setCategories",(function(){return Z})),r.d(a,"updateCategory",(function(){return Q})),r.d(a,"addBlockCollection",(function(){return X})),r.d(a,"removeBlockCollection",(function(){return J}));var o=r(4),i=r(15),s=r(5),c=r(2),u=r(1);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=[{slug:"text",title:Object(u.__)("Text")},{slug:"media",title:Object(u.__)("Media")},{slug:"design",title:Object(u.__)("Design")},{slug:"widgets",title:Object(u.__)("Widgets")},{slug:"embed",title:Object(u.__)("Embeds")},{slug:"reusable",title:Object(u.__)("Reusable blocks")}];function p(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case"REMOVE_BLOCK_TYPES":return-1!==r.names.indexOf(t)?null:t;case e:return r.name||null}return t}}var h=p("SET_DEFAULT_BLOCK_NAME"),g=p("SET_FREEFORM_FALLBACK_BLOCK_NAME"),b=p("SET_UNREGISTERED_FALLBACK_BLOCK_NAME"),m=p("SET_GROUPING_BLOCK_NAME"),_=Object(o.combineReducers)({blockTypes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_BLOCK_TYPES":return d(d({},e),Object(c.keyBy)(Object(c.map)(t.blockTypes,(function(e){return Object(c.omit)(e,"styles ")})),"name"));case"REMOVE_BLOCK_TYPES":return Object(c.omit)(e,t.names)}return e},blockStyles:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_BLOCK_TYPES":return d(d({},e),Object(c.mapValues)(Object(c.keyBy)(t.blockTypes,"name"),(function(t){return Object(c.uniqBy)([].concat(Object(i.a)(Object(c.get)(t,["styles"],[])),Object(i.a)(Object(c.get)(e,[t.name],[]))),(function(e){return e.name}))})));case"ADD_BLOCK_STYLES":return d(d({},e),{},Object(s.a)({},t.blockName,Object(c.uniqBy)([].concat(Object(i.a)(Object(c.get)(e,[t.blockName],[])),Object(i.a)(t.styles)),(function(e){return e.name}))));case"REMOVE_BLOCK_STYLES":return d(d({},e),{},Object(s.a)({},t.blockName,Object(c.filter)(Object(c.get)(e,[t.blockName],[]),(function(e){return-1===t.styleNames.indexOf(e.name)}))))}return e},blockVariations:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_BLOCK_TYPES":return d(d({},e),Object(c.mapValues)(Object(c.keyBy)(t.blockTypes,"name"),(function(t){return Object(c.uniqBy)([].concat(Object(i.a)(Object(c.get)(t,["variations"],[])),Object(i.a)(Object(c.get)(e,[t.name],[]))),(function(e){return e.name}))})));case"ADD_BLOCK_VARIATIONS":return d(d({},e),{},Object(s.a)({},t.blockName,Object(c.uniqBy)([].concat(Object(i.a)(Object(c.get)(e,[t.blockName],[])),Object(i.a)(t.variations)),(function(e){return e.name}))));case"REMOVE_BLOCK_VARIATIONS":return d(d({},e),{},Object(s.a)({},t.blockName,Object(c.filter)(Object(c.get)(e,[t.blockName],[]),(function(e){return-1===t.variationNames.indexOf(e.name)}))))}return e},defaultBlockName:h,freeformFallbackBlockName:g,unregisteredFallbackBlockName:b,groupingBlockName:m,categories:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_CATEGORIES":return t.categories||[];case"UPDATE_CATEGORY":if(!t.category||Object(c.isEmpty)(t.category))return e;var r=Object(c.find)(e,["slug",t.slug]);if(r)return Object(c.map)(e,(function(e){return e.slug===t.slug?d(d({},e),t.category):e}))}return e},collections:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_BLOCK_COLLECTION":return d(d({},e),{},Object(s.a)({},t.namespace,{title:t.title,icon:t.icon}));case"REMOVE_BLOCK_COLLECTION":return Object(c.omit)(e,t.namespace)}return e}}),v=r(49);function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var k=function(e,t){return"string"==typeof t?j(e,t):t},O=Object(v.a)((function(e){return Object.values(e.blockTypes).map((function(t){return y(y({},t),{},{variations:x(e,t.name)})}))}),(function(e){return[e.blockTypes,e.blockVariations]}));function j(e,t){return e.blockTypes[t]}function C(e,t){return e.blockStyles[t]}function x(e,t,r){var n=e.blockVariations[t];return n&&r?n.filter((function(e){return(e.scope||["block","inserter"]).includes(r)})):n}function P(e,t,r){var n=x(e,t,r);return Object(c.findLast)(n,"isDefault")||Object(c.first)(n)}function T(e){return e.categories}function S(e){return e.collections}function A(e){return e.defaultBlockName}function E(e){return e.freeformFallbackBlockName}function B(e){return e.unregisteredFallbackBlockName}function N(e){return e.groupingBlockName}var L=Object(v.a)((function(e,t){return Object(c.map)(Object(c.filter)(e.blockTypes,(function(e){return Object(c.includes)(e.parent,t)})),(function(e){return e.name}))}),(function(e){return[e.blockTypes]})),M=function(e,t,r,n){var a=k(e,t);return Object(c.get)(a,["supports"].concat(Object(i.a)(r.split("."))),n)};function z(e,t,r,n){return!!M(e,t,r,n)}function D(e,t,r){var n=k(e,t),a=Object(c.flow)([c.deburr,function(e){return e.toLowerCase()},function(e){return e.trim()}]),o=a(r),i=Object(c.flow)([a,function(e){return Object(c.includes)(e,o)}]);return i(n.title)||Object(c.some)(n.keywords,i)||i(n.category)}var H=function(e,t){return L(e,t).length>0},I=function(e,t){return Object(c.some)(L(e,t),(function(t){return z(e,t,"inserter",!0)}))};function V(e){return{type:"ADD_BLOCK_TYPES",blockTypes:Object(c.castArray)(e)}}function R(e){return{type:"REMOVE_BLOCK_TYPES",names:Object(c.castArray)(e)}}function F(e,t){return{type:"ADD_BLOCK_STYLES",styles:Object(c.castArray)(t),blockName:e}}function $(e,t){return{type:"REMOVE_BLOCK_STYLES",styleNames:Object(c.castArray)(t),blockName:e}}function q(e,t){return{type:"ADD_BLOCK_VARIATIONS",variations:Object(c.castArray)(t),blockName:e}}function U(e,t){return{type:"REMOVE_BLOCK_VARIATIONS",variationNames:Object(c.castArray)(t),blockName:e}}function G(e){return{type:"SET_DEFAULT_BLOCK_NAME",name:e}}function K(e){return{type:"SET_FREEFORM_FALLBACK_BLOCK_NAME",name:e}}function W(e){return{type:"SET_UNREGISTERED_FALLBACK_BLOCK_NAME",name:e}}function Y(e){return{type:"SET_GROUPING_BLOCK_NAME",name:e}}function Z(e){return{type:"SET_CATEGORIES",categories:e}}function Q(e,t){return{type:"UPDATE_CATEGORY",slug:e,category:t}}function X(e,t,r){return{type:"ADD_BLOCK_COLLECTION",namespace:e,title:t,icon:r}}function J(e){return{type:"REMOVE_BLOCK_COLLECTION",namespace:e}}var ee=Object(o.createReduxStore)("core/blocks",{reducer:_,selectors:n,actions:a});Object(o.register)(ee);var te=r(8),re=r(204),ne=r(35),ae=r(194),oe=r(62),ie=r.n(oe),se=r(0),ce=r(34);function ue(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ue(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var de=["#191e23","#f8f9f9"];function fe(e){var t=ze();if(e.name!==t)return!1;fe.block&&fe.block.name===t||(fe.block=Je(t));var r=fe.block,n=De(t);return Object(c.every)(n.attributes,(function(t,n){return r.attributes[n]===e.attributes[n]}))}function pe(e){return!!e&&(Object(c.isString)(e)||Object(se.isValidElement)(e)||Object(c.isFunction)(e)||e instanceof se.Component)}function he(e){if(pe(e))return{src:e};if(Object(c.has)(e,["background"])){var t=ie()(e.background);return le(le({},e),{},{foreground:e.foreground?e.foreground:Object(oe.mostReadable)(t,de,{includeFallbackColors:!0,level:"AA",size:"large"}).toHexString(),shadowColor:t.setAlpha(.3).toRgbString()})}return e}function ge(e){return Object(c.isString)(e)?De(e):e}function be(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"visual",n=e.__experimentalLabel,a=e.title,o=n&&n(t,{context:r});return o?Object(ce.__unstableStripHTML)(o):a}function me(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vertical",a=e.title,o=be(e,t,"accessibility"),i=void 0!==r,s=o&&o!==a;return i&&"vertical"===n?s?Object(u.sprintf)( | |
| 2 | +/* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ | |
| 3 | +Object(u.__)("%1$s Block. Row %2$d. %3$s"),a,r,o):Object(u.sprintf)( | |
| 4 | +/* translators: accessibility text. 1: The block title. 2: The block row number. */ | |
| 5 | +Object(u.__)("%1$s Block. Row %2$d"),a,r):i&&"horizontal"===n?s?Object(u.sprintf)( | |
| 6 | +/* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ | |
| 7 | +Object(u.__)("%1$s Block. Column %2$d. %3$s"),a,r,o):Object(u.sprintf)( | |
| 8 | +/* translators: accessibility text. 1: The block title. 2: The block column number. */ | |
| 9 | +Object(u.__)("%1$s Block. Column %2$d"),a,r):s?Object(u.sprintf)( | |
| 10 | +/* translators: accessibility text. %1: The block title. %2: The block label. */ | |
| 11 | +Object(u.__)("%1$s Block. %2$s"),a,o):Object(u.sprintf)( | |
| 12 | +/* translators: accessibility text. %s: The block title. */ | |
| 13 | +Object(u.__)("%s Block"),a)}function _e(e,t){var r=De(e);if(void 0===r)throw new Error("Block type '".concat(e,"' is not registered."));return Object(c.reduce)(r.attributes,(function(e,r,n){var a=t[n];return void 0!==a?e[n]=a:r.hasOwnProperty("default")&&(e[n]=r.default),-1!==["node","children"].indexOf(r.source)&&("string"==typeof e[n]?e[n]=[e[n]]:Array.isArray(e[n])||(e[n]=[])),e}),{})}var ve=["attributes","supports","save","migrate","isEligible","apiVersion"],we={"--wp--style--color--link":{value:["color","link"],support:["color","link"]},background:{value:["color","gradient"],support:["color","gradients"]},backgroundColor:{value:["color","background"],support:["color"]},borderRadius:{value:["border","radius"],support:["__experimentalBorder","radius"]},color:{value:["color","text"],support:["color"]},fontFamily:{value:["typography","fontFamily"],support:["__experimentalFontFamily"]},fontSize:{value:["typography","fontSize"],support:["fontSize"]},fontStyle:{value:["typography","fontStyle"],support:["__experimentalFontStyle"]},fontWeight:{value:["typography","fontWeight"],support:["__experimentalFontWeight"]},lineHeight:{value:["typography","lineHeight"],support:["lineHeight"]},padding:{value:["spacing","padding"],support:["spacing","padding"],properties:["top","right","bottom","left"]},textDecoration:{value:["typography","textDecoration"],support:["__experimentalTextDecoration"]},textTransform:{value:["typography","textTransform"],support:["__experimentalTextTransform"]}};function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Oe={common:"text",formatting:"text",layout:"design"},je={};function Ce(e){for(var t=0,r=Object.keys(e);t<r.length;t++){var n=r[t];je[n]=Object(c.mapKeys)(Object(c.pickBy)(e[n],(function(e){return!Object(c.isNil)(e)})),(function(e,t){return Object(c.camelCase)(t)}))}}function xe(e,t){if(t=ke(ke({name:e,icon:ae.a,keywords:[],attributes:{},providesContext:{},usesContext:[],supports:{},styles:[],save:function(){return null}},null==je?void 0:je[e]),t),"string"==typeof e)if(/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(e))if(Object(o.select)(ee).getBlockType(e))console.error('Block "'+e+'" is already registered.');else{var r=ke({},t);if((t=Object(ne.applyFilters)("blocks.registerBlockType",t,e)).deprecated&&(t.deprecated=t.deprecated.map((function(t){return Object(c.pick)(Object(ne.applyFilters)("blocks.registerBlockType",ke(ke({},Object(c.omit)(r,ve)),t),e),ve)}))),Object(c.isPlainObject)(t))if(Object(c.isFunction)(t.save))if(!("edit"in t)||Object(c.isFunction)(t.edit))if(Oe.hasOwnProperty(t.category)&&(t.category=Oe[t.category]),"category"in t&&!Object(c.some)(Object(o.select)(ee).getCategories(),{slug:t.category})&&(console.warn('The block "'+e+'" is registered with an invalid category "'+t.category+'".'),delete t.category),"title"in t&&""!==t.title)if("string"==typeof t.title){if(t.icon=he(t.icon),pe(t.icon.src))return Object(o.dispatch)(ee).addBlockTypes(t),t;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")}else console.error("Block titles must be strings.");else console.error('The block "'+e+'" must have a title.');else console.error('The "edit" property must be a valid function.');else console.error('The "save" property must be a valid function.');else console.error("Block settings must be a valid object.")}else 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");else console.error("Block names must be strings.")}function Pe(e,t){var r=t.title,n=t.icon;Object(o.dispatch)(ee).addBlockCollection(e,r,n)}function Te(e){var t=Object(o.select)(ee).getBlockType(e);if(t)return Object(o.dispatch)(ee).removeBlockTypes(e),t;console.error('Block "'+e+'" is not registered.')}function Se(e){Object(o.dispatch)(ee).setFreeformFallbackBlockName(e)}function Ae(){return Object(o.select)(ee).getFreeformFallbackBlockName()}function Ee(){return Object(o.select)(ee).getGroupingBlockName()}function Be(e){Object(o.dispatch)(ee).setUnregisteredFallbackBlockName(e)}function Ne(){return Object(o.select)(ee).getUnregisteredFallbackBlockName()}function Le(e){Object(o.dispatch)(ee).setDefaultBlockName(e)}function Me(e){Object(o.dispatch)(ee).setGroupingBlockName(e)}function ze(){return Object(o.select)(ee).getDefaultBlockName()}function De(e){return Object(o.select)(ee).getBlockType(e)}function He(){return Object(o.select)(ee).getBlockTypes()}function Ie(e,t,r){return Object(o.select)(ee).getBlockSupport(e,t,r)}function Ve(e,t,r){return Object(o.select)(ee).hasBlockSupport(e,t,r)}function Re(e){return"core/block"===e.name}function Fe(e){return"core/template-part"===e.name}var $e=function(e){return Object(o.select)(ee).getChildBlockNames(e)},qe=function(e){return Object(o.select)(ee).hasChildBlocks(e)},Ue=function(e){return Object(o.select)(ee).hasChildBlocksWithInserterSupport(e)},Ge=function(e,t){Object(o.dispatch)(ee).addBlockStyles(e,t)},Ke=function(e,t){Object(o.dispatch)(ee).removeBlockStyles(e,t)},We=function(e,t){return Object(o.select)(ee).getBlockVariations(e,t)},Ye=function(e,t){Object(o.dispatch)(ee).addBlockVariations(e,t)},Ze=function(e,t){Object(o.dispatch)(ee).removeBlockVariations(e,t)};function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Xe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Je(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=_e(e,t),a=Object(re.a)();return{clientId:a,name:e,isValid:!0,attributes:n,innerBlocks:r}}function et(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e){var t=Array.isArray(e)?e:[e.name,e.attributes,e.innerBlocks],r=Object(te.a)(t,3),n=r[0],a=r[1],o=r[2];return Je(n,a,et(void 0===o?[]:o))}))}function tt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Object(re.a)(),a=_e(e.name,Xe(Xe({},e.attributes),t));return Xe(Xe({},e),{},{clientId:n,attributes:a,innerBlocks:r||e.innerBlocks.map((function(e){return tt(e)}))})}function rt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Object(re.a)();return Xe(Xe({},e),{},{clientId:n,attributes:Xe(Xe({},e.attributes),t),innerBlocks:r||e.innerBlocks.map((function(e){return rt(e)}))})}var nt=function(e,t,r){if(Object(c.isEmpty)(r))return!1;var n=r.length>1,a=Object(c.first)(r).name;if(!at(e)&&n&&!e.isMultiBlock)return!1;if(!at(e)&&!Object(c.every)(r,{name:a}))return!1;if("block"!==e.type)return!1;var o=Object(c.first)(r);if("from"===t&&-1===e.blocks.indexOf(o.name)&&!at(e))return!1;if(!n&&ot(o.name)&&ot(e.blockName))return!1;if(Object(c.isFunction)(e.isMatch)){var i=e.isMultiBlock?r.map((function(e){return e.attributes})):o.attributes;if(!e.isMatch(i))return!1}return!0},at=function(e){return e&&"block"===e.type&&Array.isArray(e.blocks)&&e.blocks.includes("*")},ot=function(e){return e===Ee()};function it(e){if(Object(c.isEmpty)(e))return[];var t=function(e){if(Object(c.isEmpty)(e))return[];var t=He();return Object(c.filter)(t,(function(t){return!!st(ct("from",t.name),(function(t){return nt(t,"from",e)}))}))}(e),r=function(e){if(Object(c.isEmpty)(e))return[];var t=ct("to",De(Object(c.first)(e).name).name),r=Object(c.filter)(t,(function(t){return t&&nt(t,"to",e)}));return Object(c.flatMap)(r,(function(e){return e.blocks})).map((function(e){return De(e)}))}(e);return Object(c.uniq)([].concat(Object(i.a)(t),Object(i.a)(r)))}function st(e,t){for(var r=Object(ne.createHooks)(),n=function(n){var a=e[n];t(a)&&r.addFilter("transform","transform/"+n.toString(),(function(e){return e||a}),a.priority)},a=0;a<e.length;a++)n(a);return r.applyFilters("transform",null)}function ct(e,t){if(void 0===t)return Object(c.flatMap)(He(),(function(t){var r=t.name;return ct(e,r)}));var r=ge(t)||{},n=r.name,a=r.transforms;return a&&Array.isArray(a[e])?a[e].map((function(e){return Xe(Xe({},e),{},{blockName:n})})):[]}function ut(e,t){var r,n=Object(c.castArray)(e),a=n.length>1,o=n[0],i=o.name,s=ct("from",t),u=st(ct("to",i),(function(e){return"block"===e.type&&(at(e)||-1!==e.blocks.indexOf(t))&&(!a||e.isMultiBlock)}))||st(s,(function(e){return"block"===e.type&&(at(e)||-1!==e.blocks.indexOf(i))&&(!a||e.isMultiBlock)}));if(!u)return null;if(r=u.isMultiBlock?Object(c.has)(u,"__experimentalConvert")?u.__experimentalConvert(n):u.transform(n.map((function(e){return e.attributes})),n.map((function(e){return e.innerBlocks}))):Object(c.has)(u,"__experimentalConvert")?u.__experimentalConvert(o):u.transform(o.attributes,o.innerBlocks),!Object(c.isObjectLike)(r))return null;if((r=Object(c.castArray)(r)).some((function(e){return!De(e.name)})))return null;var l=Object(c.findIndex)(r,(function(e){return e.name===t}));return l<0?null:r.map((function(t,r){var n=Xe(Xe({},t),{},{clientId:r===l?o.clientId:t.clientId});return Object(ne.applyFilters)("blocks.switchToBlockType.transformedBlock",n,e)}))}var lt=function e(t,r){return Je(t,r.attributes,Object(c.map)(r.innerBlocks,(function(t){return e(t.name,t)})))};function dt(e,t){for(var r,n=t.split(".");r=n.shift();){if(!(r in e))return;e=e[r]}return e}var ft,pt=function(){return ft||(ft=document.implementation.createHTMLDocument("")),ft};function ht(e,t){if(t){if("string"==typeof e){var r=pt();r.body.innerHTML=e,e=r.body}if("function"==typeof t)return t(e);if(Object===t.constructor)return Object.keys(t).reduce((function(r,n){return r[n]=ht(e,t[n]),r}),{})}}function gt(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=r;if(e&&(n=r.querySelector(e)),n)return dt(n,t)}}var bt=r(135),mt=r(347),_t=r(114),vt=r(28),wt=r(29),yt=/[\t\n\f ]/,kt=/[A-Za-z]/,Ot=/\r\n?/g;function jt(e){return yt.test(e)}function Ct(e){return kt.test(e)}var xt=function(){function e(e,t){this.delegate=e,this.entityParser=t,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var e=this.peek();if("<"===e)this.transitionTo("tagOpen"),this.markTagStart(),this.consume();else{if("\n"===e){var t=this.tagNameBuffer.toLowerCase();"pre"!==t&&"textarea"!==t||this.consume()}this.transitionTo("data"),this.delegate.beginData()}},data:function(){var e=this.peek();"<"===e?(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume()):"&"===e?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(e))},tagOpen:function(){var e=this.consume();"!"===e?this.transitionTo("markupDeclarationOpen"):"/"===e?this.transitionTo("endTagOpen"):("@"===e||":"===e||Ct(e))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(e))},markupDeclarationOpen:function(){"-"===this.consume()&&"-"===this.input.charAt(this.index)&&(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment())},commentStart:function(){var e=this.consume();"-"===e?this.transitionTo("commentStartDash"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(e),this.transitionTo("comment"))},commentStartDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var e=this.consume();"-"===e?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(e)},commentEndDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+e),this.transitionTo("comment"))},commentEnd:function(){var e=this.consume();">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+e),this.transitionTo("comment"))},tagName:function(){var e=this.consume();jt(e)?this.transitionTo("beforeAttributeName"):"/"===e?this.transitionTo("selfClosingStartTag"):">"===e?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(e)},beforeAttributeName:function(){var e=this.peek();jt(e)?this.consume():"/"===e?(this.transitionTo("selfClosingStartTag"),this.consume()):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):"="===e?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var e=this.peek();jt(e)?(this.transitionTo("afterAttributeName"),this.consume()):"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.transitionTo("beforeAttributeValue"),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):'"'===e||"'"===e||"<"===e?(this.delegate.reportSyntaxError(e+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(e)):(this.consume(),this.delegate.appendToAttributeName(e))},afterAttributeName:function(){var e=this.peek();jt(e)?this.consume():"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.consume(),this.transitionTo("beforeAttributeValue")):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e))},beforeAttributeValue:function(){var e=this.peek();jt(e)?this.consume():'"'===e?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):"'"===e?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.transitionTo("attributeValueUnquoted"),this.delegate.beginAttributeValue(!1),this.consume(),this.delegate.appendToAttributeValue(e))},attributeValueDoubleQuoted:function(){var e=this.consume();'"'===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueSingleQuoted:function(){var e=this.consume();"'"===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueUnquoted:function(){var e=this.peek();jt(e)?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"&"===e?(this.consume(),this.delegate.appendToAttributeValue(this.consumeCharRef()||"&")):">"===e?(this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.consume(),this.delegate.appendToAttributeValue(e))},afterAttributeValueQuoted:function(){var e=this.peek();jt(e)?(this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.consume(),this.transitionTo("selfClosingStartTag")):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},selfClosingStartTag:function(){">"===this.peek()?(this.consume(),this.delegate.markTagAsSelfClosing(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},endTagOpen:function(){var e=this.consume();("@"===e||":"===e||Ct(e))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginEndTag(),this.appendToTagName(e))}},this.reset()}return e.prototype.reset=function(){this.transitionTo("beforeData"),this.input="",this.index=0,this.line=1,this.column=0,this.delegate.reset()},e.prototype.transitionTo=function(e){this.state=e},e.prototype.tokenize=function(e){this.reset(),this.tokenizePart(e),this.tokenizeEOF()},e.prototype.tokenizePart=function(e){for(this.input+=function(e){return e.replace(Ot,"\n")}(e);this.index<this.input.length;){var t=this.states[this.state];if(void 0===t)throw new Error("unhandled state "+this.state);t.call(this)}},e.prototype.tokenizeEOF=function(){this.flushData()},e.prototype.flushData=function(){"data"===this.state&&(this.delegate.finishData(),this.transitionTo("beforeData"))},e.prototype.peek=function(){return this.input.charAt(this.index)},e.prototype.consume=function(){var e=this.peek();return this.index++,"\n"===e?(this.line++,this.column=0):this.column++,e},e.prototype.consumeCharRef=function(){var e=this.input.indexOf(";",this.index);if(-1!==e){var t=this.input.slice(this.index,e),r=this.entityParser.parse(t);if(r){for(var n=t.length;n;)this.consume(),n--;return this.consume(),r}}},e.prototype.markTagStart=function(){this.delegate.tagOpen()},e.prototype.appendToTagName=function(e){this.tagNameBuffer+=e,this.delegate.appendToTagName(e)},e}(),Pt=function(){function e(e,t){void 0===t&&(t={}),this.options=t,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new xt(this,e),this._currentAttribute=void 0}return e.prototype.tokenize=function(e){return this.tokens=[],this.tokenizer.tokenize(e),this.tokens},e.prototype.tokenizePart=function(e){return this.tokens=[],this.tokenizer.tokenizePart(e),this.tokens},e.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},e.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},e.prototype.current=function(){var e=this.token;if(null===e)throw new Error("token was unexpectedly null");if(0===arguments.length)return e;for(var t=0;t<arguments.length;t++)if(e.type===arguments[t])return e;throw new Error("token type was unexpectedly "+e.type)},e.prototype.push=function(e){this.token=e,this.tokens.push(e)},e.prototype.currentAttribute=function(){return this._currentAttribute},e.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},e.prototype.beginData=function(){this.push({type:"Chars",chars:""})},e.prototype.appendToData=function(e){this.current("Chars").chars+=e},e.prototype.finishData=function(){this.addLocInfo()},e.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},e.prototype.appendToCommentData=function(e){this.current("Comment").chars+=e},e.prototype.finishComment=function(){this.addLocInfo()},e.prototype.tagOpen=function(){},e.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},e.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},e.prototype.finishTag=function(){this.addLocInfo()},e.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},e.prototype.appendToTagName=function(e){this.current("StartTag","EndTag").tagName+=e},e.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},e.prototype.appendToAttributeName=function(e){this.currentAttribute()[0]+=e},e.prototype.beginAttributeValue=function(e){this.currentAttribute()[2]=e},e.prototype.appendToAttributeValue=function(e){this.currentAttribute()[1]+=e},e.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},e.prototype.reportSyntaxError=function(e){this.current().syntaxError=e},e}(),Tt=r(71);function St(){function e(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return e.apply(void 0,["Block validation: "+t].concat(n))}}return{error:e(console.error),warning:e(console.warn),getItems:function(){return[]}}}function At(){var e=[],t=St();return{error:function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];e.push({log:t.error,args:n})},warning:function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];e.push({log:t.warning,args:n})},getItems:function(){return e}}}var Et=r(72),Bt=r.n(Et),Nt=r(10),Lt=r(14),Mt=Object(se.createContext)((function(){})),zt=Mt.Consumer,Dt=Mt.Provider,Ht=Object(Lt.createHigherOrderComponent)((function(e){return function(t){return Object(se.createElement)(zt,null,(function(r){return Object(se.createElement)(e,Object(Nt.a)({},t,{BlockContent:r}))}))}}),"withBlockContentContext"),It=function(e){var t=e.children,r=e.innerBlocks;return Object(se.createElement)(Dt,{value:function(){var e=Xt(r,{isInnerBlocks:!0});return Object(se.createElement)(se.RawHTML,null,e)}},t)};function Vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ft(e){var t="wp-block-"+e.replace(/\//,"-").replace(/^core-/,"");return Object(ne.applyFilters)("blocks.getBlockDefaultClassName",t,e)}function $t(e){var t="editor-block-list-item-"+e.replace(/\//,"-").replace(/^core-/,"");return Object(ne.applyFilters)("blocks.getBlockMenuDefaultClassName",t,e)}var qt={};function Ut(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=qt.blockType,r=qt.attributes;return Object(ne.applyFilters)("blocks.getSaveContent.extraProps",Rt({},e),t,r)}function Gt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=ge(e),a=n.save;if(a.prototype instanceof se.Component){var o=new a({attributes:t});a=o.render.bind(o)}qt.blockType=n,qt.attributes=t;var i=a({attributes:t,innerBlocks:r}),s=n.apiVersion>1||Ve(n,"lightBlockWrapper",!1);if(Object(c.isObject)(i)&&Object(ne.hasFilter)("blocks.getSaveContent.extraProps")&&!s){var u=Object(ne.applyFilters)("blocks.getSaveContent.extraProps",Rt({},i.props),n,t);Bt()(u,i.props)||(i=Object(se.cloneElement)(i,u))}return i=Object(ne.applyFilters)("blocks.getSaveElement",i,n,t),Object(se.createElement)(It,{innerBlocks:r},i)}function Kt(e,t,r){var n=ge(e);return Object(se.renderToString)(Gt(n,t,r))}function Wt(e,t){return Object(c.reduce)(e.attributes,(function(e,r,n){var a=t[n];return void 0===a||void 0!==r.source||"default"in r&&r.default===a||(e[n]=a),e}),{})}function Yt(e){var t=e.originalContent;if(e.isValid||e.innerBlocks.length)try{t=Kt(e.name,e.attributes,e.innerBlocks)}catch(e){}return t}function Zt(e,t,r){var n=Object(c.isEmpty)(t)?"":function(e){return JSON.stringify(e).replace(/--/g,"\\u002d\\u002d").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\\"/g,"\\u0022")}(t)+" ",a=Object(c.startsWith)(e,"core/")?e.slice(5):e;return r?"\x3c!-- wp:".concat(a," ").concat(n,"--\x3e\n")+r+"\n\x3c!-- /wp:".concat(a," --\x3e"):"\x3c!-- wp:".concat(a," ").concat(n,"/--\x3e")}function Qt(e){1===e.length&&fe(e[0])&&(e=[]);var t=Xt(e);return 1===e.length&&e[0].name===Ae()&&(t=Object(bt.removep)(t)),t}function Xt(e,t){return Object(c.castArray)(e).map((function(e){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.isInnerBlocks,n=void 0!==r&&r,a=e.name,o=Yt(e);if(a===Ne()||!n&&a===Ae())return o;var i=De(a),s=Wt(i,e.attributes);return Zt(a,s,o)}(e,t)})).join("\n\n")}function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var er=/[\t\n\r\v\f ]+/g,tr=/^[\t\n\r\v\f ]*$/,rr=/^url\s*\(['"\s]*(.*?)['"\s]*\)$/,nr=["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"],ar=[].concat(nr,["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"]),or=[c.identity,function(e){return lr(e).join(" ")}],ir=/^[\da-z]+$/i,sr=/^#\d+$/,cr=/^#x[\da-f]+$/i,ur=function(){function e(){Object(vt.a)(this,e)}return Object(wt.a)(e,[{key:"parse",value:function(e){if(t=e,ir.test(t)||sr.test(t)||cr.test(t))return Object(Tt.decodeEntities)("&"+e+";");var t}}]),e}();function lr(e){return e.trim().split(er)}function dr(e){return e.attributes.filter((function(e){var t=Object(te.a)(e,2),r=t[0];return t[1]||0===r.indexOf("data-")||Object(c.includes)(ar,r)}))}function fr(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St(),n=e.chars,a=t.chars,o=0;o<or.length;o++){var i=or[o];if((n=i(n))===(a=i(a)))return!0}return r.warning("Expected text `%s`, saw `%s`.",t.chars,e.chars),!1}function pr(e){return 0===parseFloat(e)?"0":e}function hr(e){return lr(e).map(pr).join(" ").replace(rr,"url($1)")}function gr(e){var t=e.replace(/;?\s*$/,"").split(";").map((function(e){var t=e.split(":"),r=Object(_t.a)(t),n=r[0],a=r.slice(1).join(":");return[n.trim(),hr(a.trim())]}));return Object(c.fromPairs)(t)}var br=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({class:function(e,t){return!c.xor.apply(void 0,Object(i.a)([e,t].map(lr))).length},style:function(e,t){return c.isEqual.apply(void 0,Object(i.a)([e,t].map(gr)))}},Object(c.fromPairs)(nr.map((function(e){return[e,c.stubTrue]}))));function mr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St();if(e.length!==t.length)return r.warning("Expected attributes %o, instead saw %o.",t,e),!1;for(var n={},a=0;a<t.length;a++)n[t[a][0].toLowerCase()]=t[a][1];for(var o=0;o<e.length;o++){var i=Object(te.a)(e[o],2),s=i[0],c=i[1],u=s.toLowerCase();if(!n.hasOwnProperty(u))return r.warning("Encountered unexpected attribute `%s`.",s),!1;var l=n[u],d=br[u];if(d){if(!d(c,l))return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",s,l,c),!1}else if(c!==l)return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",s,l,c),!1}return!0}var _r={StartTag:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St();return e.tagName!==t.tagName&&e.tagName.toLowerCase()!==t.tagName.toLowerCase()?(r.warning("Expected tag name `%s`, instead saw `%s`.",t.tagName,e.tagName),!1):mr.apply(void 0,Object(i.a)([e,t].map(dr)).concat([r]))},Chars:fr,Comment:fr};function vr(e){for(var t;t=e.shift();){if("Chars"!==t.type)return t;if(!tr.test(t.chars))return t}}function wr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:St();try{return new Pt(new ur).tokenize(e)}catch(r){t.warning("Malformed HTML detected: %s",e)}return null}function yr(e,t){return!!e.selfClosing&&!(!t||t.tagName!==e.tagName||"EndTag"!==t.type)}function kr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:St();if(e===t)return!0;var n,a,o=[e,t].map((function(e){return wr(e,r)})),i=Object(te.a)(o,2),s=i[0],c=i[1];if(!s||!c)return!1;for(;n=vr(s);){if(!(a=vr(c)))return r.warning("Expected end of content, instead saw %o.",n),!1;if(n.type!==a.type)return r.warning("Expected token of type `%s` (%o), instead saw `%s` (%o).",a.type,a,n.type,n),!1;var u=_r[n.type];if(u&&!u(n,a,r))return!1;yr(n,c[0])?vr(c):yr(a,s[0])&&vr(s)}return!(a=vr(c))||(r.warning("Expected %o, instead saw end of content.",a),!1)}function Or(e,t,r){var n,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:At(),o=ge(e);try{n=Kt(o,t)}catch(e){return a.error("Block validation failed because an error occurred while generating block content:\n\n%s",e.toString()),{isValid:!1,validationIssues:a.getItems()}}var i=kr(r,n,a);return i||a.error("Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",o.name,o,n,r),{isValid:i,validationIssues:a.getItems()}}function jr(e,t,r){return Or(e,t,r,St()).isValid}function Cr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cr(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pr(e){for(var t={},r=0;r<e.length;r++){var n=e[r],a=n.name,o=n.value;t[a]=o}return t}function Tr(e){if(e.nodeType===e.TEXT_NODE)return e.nodeValue;if(e.nodeType!==e.ELEMENT_NODE)throw new TypeError("A block node can only be created from a node of type text or element.");return{type:e.nodeName.toLowerCase(),props:xr(xr({},Pr(e.attributes)),{},{children:Er(e.childNodes)})}}function Sr(e){return function(t){var r=t;e&&(r=t.querySelector(e));try{return Tr(r)}catch(e){return null}}}var Ar={isNodeOfType:function(e,t){return e&&e.type===t},fromDOM:Tr,toHTML:function(e){return Br([e])},matcher:Sr};function Er(e){for(var t=[],r=0;r<e.length;r++)try{t.push(Tr(e[r]))}catch(e){}return t}function Br(e){var t=e;return Object(se.renderToString)(t)}function Nr(e){return function(t){var r=t;return e&&(r=t.querySelector(e)),r?Er(r.childNodes):[]}}var Lr={concat:function(){for(var e=[],t=0;t<arguments.length;t++)for(var r=Object(c.castArray)(t<0||arguments.length<=t?void 0:arguments[t]),n=0;n<r.length;n++){var a=r[n],o="string"==typeof a&&"string"==typeof e[e.length-1];o?e[e.length-1]+=a:e.push(a)}return e},getChildrenArray:function(e){return e},fromDOM:Er,toHTML:Br,matcher:Nr};function Mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mr(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dr(e){switch(e.source){case"attribute":var t=function(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=gt(e,"attributes")(r);if(n&&n.hasOwnProperty(t))return n[t].value}}(e.selector,e.attribute);return"boolean"===e.type&&(t=function(e){return Object(c.flow)([e,function(e){return void 0!==e}])}(t)),t;case"html":return n=e.selector,a=e.multiline,function(e){var t=e;if(n&&(t=e.querySelector(n)),!t)return"";if(a){for(var r="",o=t.children.length,i=0;i<o;i++){var s=t.children[i];s.nodeName.toLowerCase()===a&&(r+=s.outerHTML)}return r}return t.innerHTML};case"text":return function(e){return gt(e,"textContent")}(e.selector);case"children":return Nr(e.selector);case"node":return Sr(e.selector);case"query":var r=Object(c.mapValues)(e.query,Dr);return function(e,t){return function(r){var n=r.querySelectorAll(e);return[].map.call(n,(function(e){return ht(e,t)}))}}(e.selector,r);case"tag":return Object(c.flow)([gt(e.selector,"nodeName"),function(e){return e?e.toLowerCase():void 0}]);default:console.error('Unknown source type "'.concat(e.source,'"'))}var n,a}function Hr(e,t){return ht(e,Dr(t))}function Ir(e,t,r,n){var a,o=t.type,i=t.enum;switch(t.source){case void 0:a=n?n[e]:void 0;break;case"attribute":case"property":case"html":case"text":case"children":case"node":case"query":case"tag":a=Hr(r,t)}return function(e,t){return void 0===t||function(e,t){return t.some((function(t){return function(e,t){switch(t){case"string":return"string"==typeof e;case"boolean":return"boolean"==typeof e;case"object":return!!e&&e.constructor===Object;case"null":return null===e;case"array":return Array.isArray(e);case"integer":case"number":return"number"==typeof e}return!0}(e,t)}))}(e,Object(c.castArray)(t))}(a,o)&&function(e,t){return!Array.isArray(t)||t.includes(e)}(a,i)||(a=void 0),void 0===a?t.default:a}function Vr(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ge(e),a=Object(c.mapValues)(n.attributes,(function(e,n){return Ir(n,e,t,r)}));return Object(ne.applyFilters)("blocks.getBlockAttributes",a,n,t,r)}function Rr(e,t){var r=zr({},t);if("core/cover-image"===e&&(e="core/cover"),"core/text"!==e&&"core/cover-text"!==e||(e="core/paragraph"),e&&0===e.indexOf("core/social-link-")&&(r.service=e.substring(17),e="core/social-link"),e&&0===e.indexOf("core-embed/")){var n=e.substring(11),a={speaker:"speaker-deck",polldaddy:"crowdsignal"};r.providerNameSlug=n in a?a[n]:n,["amazon-kindle","wordpress"].includes(n)||(r.responsive=!0),e="core/embed"}return{name:e,attributes:r}}function Fr(e){var t=e.blockName,r=e.attrs,n=e.innerBlocks,a=void 0===n?[]:n,o=e.innerHTML,s=e.innerContent,u=Ae(),l=Ne()||u;r=r||{},o=o.trim();var d=t||u,f=Rr(d,r);d=f.name,r=f.attributes,d===u&&(o=Object(bt.autop)(o).trim());var p=De(d);if(!p){var h={attrs:r,blockName:t,innerBlocks:a,innerContent:s},g=$r(h,{isCommentDelimited:!1}),b=$r(h,{isCommentDelimited:!0});d&&(o=b),r={originalName:t,originalContent:b,originalUndelimitedContent:g},p=De(d=l)}a=(a=a.map(Fr)).filter((function(e){return e}));var m=d===u||d===l;if(p&&(o||!m)){var _=Je(d,Vr(p,o,r),a);if(!m){var v=Or(p,_.attributes,o),w=v.isValid,y=v.validationIssues;_.isValid=w,_.validationIssues=y}return _.originalContent=_.originalContent||o,(_=function(e,t){var r=De(e.name),n=r.deprecated;if(!n||!n.length)return e;for(var a=e,o=a.originalContent,s=a.innerBlocks,u=0;u<n.length;u++){var l=n[u].isEligible,d=void 0===l?c.stubFalse:l;if(!e.isValid||d(t,s)){var f=Object.assign(Object(c.omit)(r,ve),n[u]),p=Vr(f,o,t),h=Or(f,p,o),g=h.isValid,b=h.validationIssues;if(g){var m=s,_=f.migrate;if(_){var v=Object(c.castArray)(_(p,s)),w=Object(te.a)(v,2),y=w[0];p=void 0===y?t:y;var k=w[1];m=void 0===k?s:k}e=zr(zr({},e),{},{attributes:p,innerBlocks:m,isValid:!0})}else e=zr(zr({},e),{},{validationIssues:[].concat(Object(i.a)(Object(c.get)(e,"validationIssues",[])),Object(i.a)(b))})}}return e}(_,r)).validationIssues&&_.validationIssues.length>0&&(_.isValid?console.info("Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",p.name,p,Kt(p,_.attributes),_.originalContent):_.validationIssues.forEach((function(e){var t=e.log,r=e.args;return t.apply(void 0,Object(i.a)(r))}))),_}}function $r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.isCommentDelimited,n=void 0===r||r,a=e.blockName,o=e.attrs,i=void 0===o?{}:o,s=e.innerBlocks,c=void 0===s?[]:s,u=e.innerContent,l=void 0===u?[]:u,d=0,f=l.map((function(e){return null!==e?e:$r(c[d++],t)})).join("\n").replace(/\n+/g,"\n").trim();return n?Zt(a,i,f):f}new Set(["attribute","html","text","tag"]);var qr,Ur=(qr=mt.parse,function(e){return qr(e).reduce((function(e,t){var r=Fr(t);return r&&e.push(r),e}),[])}),Gr=Ur;function Kr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kr(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Yr(){return Object(c.filter)(ct("from"),{type:"raw"}).map((function(e){return e.isMatch?e:Wr(Wr({},e),{},{isMatch:function(t){return e.selector&&t.matches(e.selector)}})}))}function Zr(e){var t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,Array.from(t.body.children).flatMap((function(e){var t=st(Yr(),(function(t){return(0,t.isMatch)(e)}));if(!t)return Je("core/html",Vr("core/html",e.outerHTML));var r=t.transform,n=t.blockName;return r?r(e):Je(n,Vr(n,e.outerHTML))}))}function Qr(e){var t=document.implementation.createHTMLDocument(""),r=document.implementation.createHTMLDocument(""),n=t.body,a=r.body;for(n.innerHTML=e;n.firstChild;){var o=n.firstChild;o.nodeType===o.TEXT_NODE?o.nodeValue.trim()?(a.lastChild&&"P"===a.lastChild.nodeName||a.appendChild(r.createElement("P")),a.lastChild.appendChild(o)):n.removeChild(o):o.nodeType===o.ELEMENT_NODE?"BR"===o.nodeName?(o.nextSibling&&"BR"===o.nextSibling.nodeName&&(a.appendChild(r.createElement("P")),n.removeChild(o.nextSibling)),a.lastChild&&"P"===a.lastChild.nodeName&&a.lastChild.hasChildNodes()?a.lastChild.appendChild(o):n.removeChild(o)):"P"===o.nodeName?Object(ce.isEmpty)(o)?n.removeChild(o):a.appendChild(o):Object(ce.isPhrasingContent)(o)?(a.lastChild&&"P"===a.lastChild.nodeName||a.appendChild(r.createElement("P")),a.lastChild.appendChild(o)):a.appendChild(o):n.removeChild(o)}return a.innerHTML}function Xr(e,t){if(e.nodeType===e.COMMENT_NODE)if("nextpage"!==e.nodeValue){if(0===e.nodeValue.indexOf("more")){for(var r=e.nodeValue.slice(4).trim(),n=e,a=!1;n=n.nextSibling;)if(n.nodeType===n.COMMENT_NODE&&"noteaser"===n.nodeValue){a=!0,Object(ce.remove)(n);break}Object(ce.replace)(e,function(e,t,r){var n=r.createElement("wp-block");return n.dataset.block="core/more",e&&(n.dataset.customText=e),t&&(n.dataset.noTeaser=""),n}(r,a,t))}}else Object(ce.replace)(e,function(e){var t=e.createElement("wp-block");return t.dataset.block="core/nextpage",t}(t))}function Jr(e){e.nodeType===e.COMMENT_NODE&&Object(ce.remove)(e)}function en(e){return"BR"===e.nodeName&&e.previousSibling&&"BR"===e.previousSibling.nodeName}function tn(e,t){if("SPAN"===e.nodeName&&e.style){var r=e.style,n=r.fontWeight,a=r.fontStyle,o=r.textDecorationLine,i=r.textDecoration,s=r.verticalAlign;"bold"!==n&&"700"!==n||Object(ce.wrap)(t.createElement("strong"),e),"italic"===a&&Object(ce.wrap)(t.createElement("em"),e),("line-through"===o||Object(c.includes)(i,"line-through"))&&Object(ce.wrap)(t.createElement("s"),e),"super"===s?Object(ce.wrap)(t.createElement("sup"),e):"sub"===s&&Object(ce.wrap)(t.createElement("sub"),e)}else"B"===e.nodeName?e=Object(ce.replaceTag)(e,"strong"):"I"===e.nodeName?e=Object(ce.replaceTag)(e,"em"):"A"===e.nodeName&&(e.target&&"_blank"===e.target.toLowerCase()?e.rel="noreferrer noopener":(e.removeAttribute("target"),e.removeAttribute("rel")))}function rn(e){"SCRIPT"!==e.nodeName&&"NOSCRIPT"!==e.nodeName&&"TEMPLATE"!==e.nodeName&&"STYLE"!==e.nodeName||e.parentNode.removeChild(e)}var nn=window.parseInt;function an(e){return"OL"===e.nodeName||"UL"===e.nodeName}function on(e,t){if("P"===e.nodeName){var r=e.getAttribute("style");if(r&&-1!==r.indexOf("mso-list")){var n=/mso-list\s*:[^;]+level([0-9]+)/i.exec(r);if(n){var a=nn(n[1],10)-1||0,o=e.previousElementSibling;if(!o||!an(o)){var i=e.textContent.trim().slice(0,1),s=/[1iIaA]/.test(i),c=t.createElement(s?"ol":"ul");s&&c.setAttribute("type",i),e.parentNode.insertBefore(c,e)}var u=e.previousElementSibling,l=u.nodeName,d=t.createElement("li"),f=u;for(e.removeChild(e.firstElementChild);e.firstChild;)d.appendChild(e.firstChild);for(;a--;)an(f=f.lastElementChild||f)&&(f=f.lastElementChild||f);an(f)||(f=f.appendChild(t.createElement(l))),f.appendChild(d),e.parentNode.removeChild(e)}}}}function sn(e){return"OL"===e.nodeName||"UL"===e.nodeName}function cn(e){if(sn(e)){var t=e,r=e.previousElementSibling;if(r&&r.nodeName===e.nodeName&&1===t.children.length){for(;t.firstChild;)r.appendChild(t.firstChild);t.parentNode.removeChild(t)}var n,a=e.parentNode;if(a&&"LI"===a.nodeName&&1===a.children.length&&!/\S/.test((n=a,Array.from(n.childNodes).map((function(e){var t=e.nodeValue;return void 0===t?"":t})).join("")))){var o=a,i=o.previousElementSibling,s=o.parentNode;i?(i.appendChild(t),s.removeChild(o)):(s.parentNode.insertBefore(t,s),s.parentNode.removeChild(s))}if(a&&sn(a)){var c=e.previousElementSibling;c?c.appendChild(e):Object(ce.unwrap)(e)}}}var un=r(52),ln=window,dn=ln.atob,fn=ln.File;function pn(e){if("IMG"===e.nodeName){if(0===e.src.indexOf("file:")&&(e.src=""),0===e.src.indexOf("data:")){var t,r=e.src.split(","),n=Object(te.a)(r,2),a=n[0],o=n[1],i=a.slice(5).split(";"),s=Object(te.a)(i,1)[0];if(!o||!s)return void(e.src="");try{t=dn(o)}catch(t){return void(e.src="")}for(var c=new Uint8Array(t.length),u=0;u<c.length;u++)c[u]=t.charCodeAt(u);var l=s.replace("/","."),d=new fn([c],l,{type:s});e.src=Object(un.createBlobURL)(d)}1!==e.height&&1!==e.width||e.parentNode.removeChild(e)}}function hn(e){"BLOCKQUOTE"===e.nodeName&&(e.innerHTML=Qr(e.innerHTML))}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=e.ownerDocument.createElement("figure");t.parentNode.insertBefore(r,t),r.appendChild(e)}function bn(e,t,r){if(function(e,t){var r=e.nodeName.toLowerCase();return"figcaption"!==r&&!Object(ce.isTextContent)(e)&&Object(c.has)(t,["figure","children",r])}(e,r)){var n=e,a=e.parentNode;(function(e,t){var r=e.nodeName.toLowerCase();return Object(c.has)(t,["figure","children","a","children",r])})(e,r)&&"A"===a.nodeName&&1===a.childNodes.length&&(n=e.parentNode);var o=n.closest("p,div");o?e.classList?(e.classList.contains("alignright")||e.classList.contains("alignleft")||e.classList.contains("aligncenter")||!o.textContent.trim())&&gn(n,o):gn(n,o):"BODY"===n.parentNode.nodeName&&gn(n)}}var mn=r(153);function vn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vn(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var yn=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=ct("from"),o=st(a,(function(e){return-1===n.indexOf(e.blockName)&&"shortcode"===e.type&&Object(c.some)(Object(c.castArray)(e.tag),(function(e){return Object(mn.regexp)(e).test(t)}))}));if(!o)return[t];var s,u=Object(c.castArray)(o.tag),l=Object(c.find)(u,(function(e){return Object(mn.regexp)(e).test(t)})),d=r;if(s=Object(mn.next)(l,t,r)){r=s.index+s.content.length;var f=t.substr(0,s.index),p=t.substr(r);if(!(Object(c.includes)(s.shortcode.content||"","<")||/(\n|<p>)\s*$/.test(f)&&/^\s*(\n|<\/p>)/.test(p)))return e(t,r);if(o.isMatch&&!o.isMatch(s.shortcode.attrs))return e(t,d,[].concat(Object(i.a)(n),[o.blockName]));var h=Object(c.mapValues)(Object(c.pickBy)(o.attributes,(function(e){return e.shortcode})),(function(e){return e.shortcode(s.shortcode.attrs,s)})),g=Je(o.blockName,Vr(wn(wn({},De(o.blockName)),{},{attributes:o.attributes}),s.shortcode.content,h));return[].concat(Object(i.a)(e(f)),[g],Object(i.a)(e(p)))}return[t]},kn=r(348),On=new(r.n(kn).a.Converter)({noHeaderId:!0,tables:!0,literalMidWordUnderscores:!0,omitExtraWLInCodeBlocks:!0,simpleLineBreaks:!0,strikethrough:!0});function jn(e){if("IFRAME"===e.nodeName){var t=e.ownerDocument.createTextNode(e.src);e.parentNode.replaceChild(t,e)}}function Cn(e){e.id&&0===e.id.indexOf("docs-internal-guid-")&&Object(ce.unwrap)(e)}function xn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Pn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tn(e){return function(e,t){var r={phrasingContentSchema:Object(ce.getPhrasingContentSchema)(t),isPaste:"paste"===t},n=e.map((function(e){var t=e.isMatch,n=e.blockName,a=e.schema,o=Ve(n,"anchor");return a=Object(c.isFunction)(a)?a(r):a,o||t?Object(c.mapValues)(a,(function(e){var r=e.attributes||[];return o&&(r=[].concat(Object(i.a)(r),["id"])),Pn(Pn({},e),{},{attributes:r,isMatch:t||void 0})})):a}));return c.mergeWith.apply(void 0,[{}].concat(Object(i.a)(n),[function(e,t,r){switch(r){case"children":return"*"===e||"*"===t?"*":Pn(Pn({},e),t);case"attributes":case"require":return[].concat(Object(i.a)(e||[]),Object(i.a)(t||[]));case"isMatch":if(!e||!t)return;return function(){return e.apply(void 0,arguments)||t.apply(void 0,arguments)}}}]))}(Yr(),e)}function Sn(e,t,r,n){Array.from(e).forEach((function(e){Sn(e.childNodes,t,r,n),t.forEach((function(t){r.contains(e)&&t(e,r,n)}))}))}function An(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=document.implementation.createHTMLDocument("");return n.body.innerHTML=e,Sn(n.body.childNodes,t,n,r),n.body.innerHTML}function En(e,t){var r=e["".concat(t,"Sibling")];if(r&&Object(ce.isPhrasingContent)(r))return r;var n=e.parentNode;return n&&Object(ce.isPhrasingContent)(n)?En(n,t):void 0}function Bn(e){if(e.nodeType===e.TEXT_NODE){for(var t=e;t=t.parentNode;)if(t.nodeType===t.ELEMENT_NODE&&"PRE"===t.nodeName)return;var r,n=e.data.replace(/[ \r\n\t]+/g," ");if(" "===n[0]){var a=En(e,"previous");a&&"BR"!==a.nodeName&&" "!==a.textContent.slice(-1)||(n=n.slice(1))}if(" "===n[n.length-1]){var o=En(e,"next");(!o||"BR"===o.nodeName||o.nodeType===o.TEXT_NODE&&(" "===(r=o.textContent[0])||"\r"===r||"\n"===r||"\t"===r))&&(n=n.slice(0,-1))}n?e.data=n:e.parentNode.removeChild(e)}}function Nn(e){"BR"===e.nodeName&&(En(e,"next")||e.parentNode.removeChild(e))}function Ln(e){"P"===e.nodeName&&(e.hasChildNodes()||e.parentNode.removeChild(e))}function Mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mn(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Dn=window.console;function Hn(e,t){return e=An(e,[Cn,tn,Jr]),e=Object(ce.removeInvalidHTML)(e,Object(ce.getPhrasingContentSchema)("paste"),{inline:!0}),t||(e=An(e,[Bn,Nn])),Dn.log("Processed inline HTML:\n\n",e),e}function In(e){var t,r=e.HTML,n=void 0===r?"":r,a=e.plainText,o=void 0===a?"":a,i=e.mode,s=void 0===i?"AUTO":i,u=e.tagName,l=e.preserveWhiteSpace;if(n=(n=(n=n.replace(/<meta[^>]+>/g,"")).replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,"")).replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,""),"INLINE"!==s){var d=n||o;if(-1!==d.indexOf("\x3c!-- wp:"))return Ur(d)}if(String.prototype.normalize&&(n=n.normalize()),!o||n&&!function(e){return!/<(?!br[ />])/i.test(e)}(n)||(t=o,n=On.makeHtml(function(e){return e.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/,(function(e,t,r,n){return"".concat(t,"\n").concat(r,"\n").concat(n)}))}(t)),"AUTO"===s&&-1===o.indexOf("\n")&&0!==o.indexOf("<p>")&&0===n.indexOf("<p>")&&(s="INLINE")),"INLINE"===s)return Hn(n,l);var f=yn(n),p=f.length>1;if("AUTO"===s&&!p&&function(e,t){var r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;var n=Array.from(r.body.children);return!n.some(en)&&function e(t,r){return t.every((function(t){return function(e,t){if(Object(ce.isTextContent)(e))return!0;if(!t)return!1;var r=e.nodeName.toLowerCase();return[["ul","li","ol"],["h1","h2","h3","h4","h5","h6"]].some((function(e){return 0===Object(c.difference)([r,t],e).length}))}(t,r)&&e(Array.from(t.children),r)}))}(n,t)}(n,u))return Hn(n,l);var h=Object(ce.getPhrasingContentSchema)("paste"),g=Tn("paste"),b=Object(c.compact)(Object(c.flatMap)(f,(function(e){if("string"!=typeof e)return e;var t=[Cn,on,rn,cn,pn,tn,Xr,Jr,jn,bn,hn],r=zn(zn({},g),h);return e=An(e,t,g),e=An(e=Qr(e=Object(ce.removeInvalidHTML)(e,r)),[Bn,Nn,Ln],g),Dn.log("Processed HTML piece:\n\n",e),Zr(e)})));if("AUTO"===s&&1===b.length&&Ve(b[0].name,"__unstablePasteTextInline",!1)){var m=o.trim();if(""!==m&&-1===m.indexOf("\n"))return Object(ce.removeInvalidHTML)(Yt(b[0]),h)}return b}var Vn=r(38),Rn=r.n(Vn);function Fn(e){return Rn()("wp.blocks.getPhrasingContentSchema",{alternative:"wp.dom.getPhrasingContentSchema"}),Object(ce.getPhrasingContentSchema)(e)}function $n(e){var t=e.HTML,r=void 0===t?"":t;if(-1!==r.indexOf("\x3c!-- wp:"))return Ur(r);var n=yn(r),a=Tn();return Object(c.compact)(Object(c.flatMap)(n,(function(e){return"string"!=typeof e?e:Zr(e=Qr(e=An(e,[cn,Xr,bn,hn],a)))})))}function qn(){return Object(o.select)(ee).getCategories()}function Un(e){Object(o.dispatch)(ee).setCategories(e)}function Gn(e,t){Object(o.dispatch)(ee).updateCategory(e,t)}function Kn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(r),!0).forEach((function(t){Object(s.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Yn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length===t.length&&Object(c.every)(t,(function(t,r){var n=Object(te.a)(t,3),a=n[0],o=n[2],i=e[r];return a===i.name&&Yn(i.innerBlocks,o)}))}function Zn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return t?Object(c.map)(t,(function(t,r){var n=Object(te.a)(t,3),a=n[0],o=n[1],i=n[2],s=e[r];if(s&&s.name===a){var u=Zn(s.innerBlocks,i);return Wn(Wn({},s),{},{innerBlocks:u})}var l=De(a),d=function(e,t){return Object(c.mapValues)(t,(function(t,r){return f(e[r],t)}))},f=function(e,t){return r=e,"html"===Object(c.get)(r,["source"])&&Object(c.isArray)(t)?Object(se.renderToString)(t):function(e){return"query"===Object(c.get)(e,["source"])}(e)&&t?t.map((function(t){return d(e.query,t)})):t;var r},p=Rr(a,d(Object(c.get)(l,["attributes"],{}),o));return Je(p.name,p.attributes,Zn([],i))})):e}},62:function(e,t,r){var n;!function(a){var o=/^\s+/,i=/\s+$/,s=0,c=a.round,u=a.min,l=a.max,d=a.random;function f(e,t){if(t=t||{},(e=e||"")instanceof f)return e;if(!(this instanceof f))return new f(e,t);var r=function(e){var t,r,n,s={r:0,g:0,b:0},c=1,d=null,f=null,p=null,h=!1,g=!1;return"string"==typeof e&&(e=function(e){e=e.replace(o,"").replace(i,"").toLowerCase();var t,r=!1;if(A[e])e=A[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=$.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=$.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=$.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=$.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=$.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=$.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=$.hex8.exec(e))?{r:M(t[1]),g:M(t[2]),b:M(t[3]),a:I(t[4]),format:r?"name":"hex8"}:(t=$.hex6.exec(e))?{r:M(t[1]),g:M(t[2]),b:M(t[3]),format:r?"name":"hex"}:(t=$.hex4.exec(e))?{r:M(t[1]+""+t[1]),g:M(t[2]+""+t[2]),b:M(t[3]+""+t[3]),a:I(t[4]+""+t[4]),format:r?"name":"hex8"}:!!(t=$.hex3.exec(e))&&{r:M(t[1]+""+t[1]),g:M(t[2]+""+t[2]),b:M(t[3]+""+t[3]),format:r?"name":"hex"}}(e)),"object"==typeof e&&(q(e.r)&&q(e.g)&&q(e.b)?(t=e.r,r=e.g,n=e.b,s={r:255*N(t,255),g:255*N(r,255),b:255*N(n,255)},h=!0,g="%"===String(e.r).substr(-1)?"prgb":"rgb"):q(e.h)&&q(e.s)&&q(e.v)?(d=D(e.s),f=D(e.v),s=function(e,t,r){e=6*N(e,360),t=N(t,100),r=N(r,100);var n=a.floor(e),o=e-n,i=r*(1-t),s=r*(1-o*t),c=r*(1-(1-o)*t),u=n%6;return{r:255*[r,s,i,i,c,r][u],g:255*[c,r,r,s,i,i][u],b:255*[i,i,c,r,r,s][u]}}(e.h,d,f),h=!0,g="hsv"):q(e.h)&&q(e.s)&&q(e.l)&&(d=D(e.s),p=D(e.l),s=function(e,t,r){var n,a,o;function i(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=N(e,360),t=N(t,100),r=N(r,100),0===t)n=a=o=r;else{var s=r<.5?r*(1+t):r+t-r*t,c=2*r-s;n=i(c,s,e+1/3),a=i(c,s,e),o=i(c,s,e-1/3)}return{r:255*n,g:255*a,b:255*o}}(e.h,d,p),h=!0,g="hsl"),e.hasOwnProperty("a")&&(c=e.a)),c=B(c),{ok:h,format:e.format||g,r:u(255,l(s.r,0)),g:u(255,l(s.g,0)),b:u(255,l(s.b,0)),a:c}}(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=c(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=c(this._r)),this._g<1&&(this._g=c(this._g)),this._b<1&&(this._b=c(this._b)),this._ok=r.ok,this._tc_id=s++}function p(e,t,r){e=N(e,255),t=N(t,255),r=N(r,255);var n,a,o=l(e,t,r),i=u(e,t,r),s=(o+i)/2;if(o==i)n=a=0;else{var c=o-i;switch(a=s>.5?c/(2-o-i):c/(o+i),o){case e:n=(t-r)/c+(t<r?6:0);break;case t:n=(r-e)/c+2;break;case r:n=(e-t)/c+4}n/=6}return{h:n,s:a,l:s}}function h(e,t,r){e=N(e,255),t=N(t,255),r=N(r,255);var n,a,o=l(e,t,r),i=u(e,t,r),s=o,c=o-i;if(a=0===o?0:c/o,o==i)n=0;else{switch(o){case e:n=(t-r)/c+(t<r?6:0);break;case t:n=(r-e)/c+2;break;case r:n=(e-t)/c+4}n/=6}return{h:n,s:a,v:s}}function g(e,t,r,n){var a=[z(c(e).toString(16)),z(c(t).toString(16)),z(c(r).toString(16))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0):a.join("")}function b(e,t,r,n){return[z(H(n)),z(c(e).toString(16)),z(c(t).toString(16)),z(c(r).toString(16))].join("")}function m(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.s-=t/100,r.s=L(r.s),f(r)}function _(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.s+=t/100,r.s=L(r.s),f(r)}function v(e){return f(e).desaturate(100)}function w(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.l+=t/100,r.l=L(r.l),f(r)}function y(e,t){t=0===t?0:t||10;var r=f(e).toRgb();return r.r=l(0,u(255,r.r-c(-t/100*255))),r.g=l(0,u(255,r.g-c(-t/100*255))),r.b=l(0,u(255,r.b-c(-t/100*255))),f(r)}function k(e,t){t=0===t?0:t||10;var r=f(e).toHsl();return r.l-=t/100,r.l=L(r.l),f(r)}function O(e,t){var r=f(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,f(r)}function j(e){var t=f(e).toHsl();return t.h=(t.h+180)%360,f(t)}function C(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+120)%360,s:t.s,l:t.l}),f({h:(r+240)%360,s:t.s,l:t.l})]}function x(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+90)%360,s:t.s,l:t.l}),f({h:(r+180)%360,s:t.s,l:t.l}),f({h:(r+270)%360,s:t.s,l:t.l})]}function P(e){var t=f(e).toHsl(),r=t.h;return[f(e),f({h:(r+72)%360,s:t.s,l:t.l}),f({h:(r+216)%360,s:t.s,l:t.l})]}function T(e,t,r){t=t||6,r=r||30;var n=f(e).toHsl(),a=360/r,o=[f(e)];for(n.h=(n.h-(a*t>>1)+720)%360;--t;)n.h=(n.h+a)%360,o.push(f(n));return o}function S(e,t){t=t||6;for(var r=f(e).toHsv(),n=r.h,a=r.s,o=r.v,i=[],s=1/t;t--;)i.push(f({h:n,s:a,v:o})),o=(o+s)%1;return i}f.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,t=n.g/255,r=n.b/255,.2126*(e<=.03928?e/12.92:a.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:a.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:a.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=B(e),this._roundA=c(100*this._a)/100,this},toHsv:function(){var e=h(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=h(this._r,this._g,this._b),t=c(360*e.h),r=c(100*e.s),n=c(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=p(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=p(this._r,this._g,this._b),t=c(360*e.h),r=c(100*e.s),n=c(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return g(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,a){var o=[z(c(e).toString(16)),z(c(t).toString(16)),z(c(r).toString(16)),z(H(n))];return a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:c(this._r),g:c(this._g),b:c(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+c(this._r)+", "+c(this._g)+", "+c(this._b)+")":"rgba("+c(this._r)+", "+c(this._g)+", "+c(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:c(100*N(this._r,255))+"%",g:c(100*N(this._g,255))+"%",b:c(100*N(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+c(100*N(this._r,255))+"%, "+c(100*N(this._g,255))+"%, "+c(100*N(this._b,255))+"%)":"rgba("+c(100*N(this._r,255))+"%, "+c(100*N(this._g,255))+"%, "+c(100*N(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+b(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var a=f(e);r="#"+b(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return f(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(k,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(_,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(O,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(T,arguments)},complement:function(){return this._applyCombination(j,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(P,arguments)},triad:function(){return this._applyCombination(C,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},f.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:D(e[n]));e=r}return f(e,t)},f.equals=function(e,t){return!(!e||!t)&&f(e).toRgbString()==f(t).toRgbString()},f.random=function(){return f.fromRatio({r:d(),g:d(),b:d()})},f.mix=function(e,t,r){r=0===r?0:r||50;var n=f(e).toRgb(),a=f(t).toRgb(),o=r/100;return f({r:(a.r-n.r)*o+n.r,g:(a.g-n.g)*o+n.g,b:(a.b-n.b)*o+n.b,a:(a.a-n.a)*o+n.a})},f.readability=function(e,t){var r=f(e),n=f(t);return(a.max(r.getLuminance(),n.getLuminance())+.05)/(a.min(r.getLuminance(),n.getLuminance())+.05)},f.isReadable=function(e,t,r){var n,a,o,i,s,c=f.readability(e,t);switch(a=!1,(o=r,"AA"!==(i=((o=o||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==i&&(i="AA"),"small"!==(s=(o.size||"small").toLowerCase())&&"large"!==s&&(s="small"),n={level:i,size:s}).level+n.size){case"AAsmall":case"AAAlarge":a=c>=4.5;break;case"AAlarge":a=c>=3;break;case"AAAsmall":a=c>=7}return a},f.mostReadable=function(e,t,r){var n,a,o,i,s=null,c=0;a=(r=r||{}).includeFallbackColors,o=r.level,i=r.size;for(var u=0;u<t.length;u++)(n=f.readability(e,t[u]))>c&&(c=n,s=f(t[u]));return f.isReadable(e,s,{level:o,size:i})||!a?s:(r.includeFallbackColors=!1,f.mostReadable(e,["#fff","#000"],r))};var A=f.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},E=f.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(A);function B(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function N(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=u(t,l(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),a.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function L(e){return u(1,l(0,e))}function M(e){return parseInt(e,16)}function z(e){return 1==e.length?"0"+e:""+e}function D(e){return e<=1&&(e=100*e+"%"),e}function H(e){return a.round(255*parseFloat(e)).toString(16)}function I(e){return M(e)/255}var V,R,F,$=(R="[\\s|\\(]+("+(V="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+V+")[,|\\s]+("+V+")\\s*\\)?",F="[\\s|\\(]+("+V+")[,|\\s]+("+V+")[,|\\s]+("+V+")[,|\\s]+("+V+")\\s*\\)?",{CSS_UNIT:new RegExp(V),rgb:new RegExp("rgb"+R),rgba:new RegExp("rgba"+F),hsl:new RegExp("hsl"+R),hsla:new RegExp("hsla"+F),hsv:new RegExp("hsv"+R),hsva:new RegExp("hsva"+F),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function q(e){return!!$.CSS_UNIT.exec(e)}e.exports?e.exports=f:void 0===(n=function(){return f}.call(t,r,t,e))||(e.exports=n)}(Math)},7:function(e,t){e.exports=window.wp.primitives},71:function(e,t){e.exports=window.wp.htmlEntities},72:function(e,t){e.exports=window.wp.isShallowEqual},8:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(39),a=r(30),o=r(40);function i(e,t){return Object(n.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],_n=!0,n=!1,a=void 0;try{for(var o,i=e[Symbol.iterator]();!(_n=(o=i.next()).done)&&(r.push(o.value),!t||r.length!==t);_n=!0);}catch(e){n=!0,a=e}finally{try{_n||null==i.return||i.return()}finally{if(n)throw a}}return r}}(e,t)||Object(a.a)(e,t)||Object(o.a)()}}}); | |