| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var wp; 2 (wp ||= {}).blocks = (() => { 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __commonJS = (cb, mod) => function __require() { 10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 11 }; 12 var __export = (target, all) => { 13 for (var name in all) 14 __defProp(target, name, { get: all[name], enumerable: true }); 15 }; 16 var __copyProps = (to, from, except, desc) => { 17 if (from && typeof from === "object" || typeof from === "function") { 18 for (let key of __getOwnPropNames(from)) 19 if (!__hasOwnProp.call(to, key) && key !== except) 20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 21 } 22 return to; 23 }; 24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 25 // If the importer is in node compatibility mode or this is not an ESM 26 // file that has been converted to a CommonJS file using a Babel- 27 // compatible transform (i.e. "__esModule" has not been set), then set 28 // "default" to the CommonJS "module.exports" for node compatibility. 29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 30 mod 31 )); 32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 33 34 // package-external:@wordpress/data 35 var require_data = __commonJS({ 36 "package-external:@wordpress/data"(exports, module) { 37 module.exports = window.wp.data; 38 } 39 }); 40 41 // package-external:@wordpress/i18n 42 var require_i18n = __commonJS({ 43 "package-external:@wordpress/i18n"(exports, module) { 44 module.exports = window.wp.i18n; 45 } 46 }); 47 48 // package-external:@wordpress/element 49 var require_element = __commonJS({ 50 "package-external:@wordpress/element"(exports, module) { 51 module.exports = window.wp.element; 52 } 53 }); 54 55 // package-external:@wordpress/dom 56 var require_dom = __commonJS({ 57 "package-external:@wordpress/dom"(exports, module) { 58 module.exports = window.wp.dom; 59 } 60 }); 61 62 // package-external:@wordpress/rich-text 63 var require_rich_text = __commonJS({ 64 "package-external:@wordpress/rich-text"(exports, module) { 65 module.exports = window.wp.richText; 66 } 67 }); 68 69 // package-external:@wordpress/deprecated 70 var require_deprecated = __commonJS({ 71 "package-external:@wordpress/deprecated"(exports, module) { 72 module.exports = window.wp.deprecated; 73 } 74 }); 75 76 // package-external:@wordpress/warning 77 var require_warning = __commonJS({ 78 "package-external:@wordpress/warning"(exports, module) { 79 module.exports = window.wp.warning; 80 } 81 }); 82 83 // package-external:@wordpress/private-apis 84 var require_private_apis = __commonJS({ 85 "package-external:@wordpress/private-apis"(exports, module) { 86 module.exports = window.wp.privateApis; 87 } 88 }); 89 90 // node_modules/remove-accents/index.js 91 var require_remove_accents = __commonJS({ 92 "node_modules/remove-accents/index.js"(exports, module) { 93 var characterMap = { 94 "\xC0": "A", 95 "\xC1": "A", 96 "\xC2": "A", 97 "\xC3": "A", 98 "\xC4": "A", 99 "\xC5": "A", 100 "\u1EA4": "A", 101 "\u1EAE": "A", 102 "\u1EB2": "A", 103 "\u1EB4": "A", 104 "\u1EB6": "A", 105 "\xC6": "AE", 106 "\u1EA6": "A", 107 "\u1EB0": "A", 108 "\u0202": "A", 109 "\u1EA2": "A", 110 "\u1EA0": "A", 111 "\u1EA8": "A", 112 "\u1EAA": "A", 113 "\u1EAC": "A", 114 "\xC7": "C", 115 "\u1E08": "C", 116 "\xC8": "E", 117 "\xC9": "E", 118 "\xCA": "E", 119 "\xCB": "E", 120 "\u1EBE": "E", 121 "\u1E16": "E", 122 "\u1EC0": "E", 123 "\u1E14": "E", 124 "\u1E1C": "E", 125 "\u0206": "E", 126 "\u1EBA": "E", 127 "\u1EBC": "E", 128 "\u1EB8": "E", 129 "\u1EC2": "E", 130 "\u1EC4": "E", 131 "\u1EC6": "E", 132 "\xCC": "I", 133 "\xCD": "I", 134 "\xCE": "I", 135 "\xCF": "I", 136 "\u1E2E": "I", 137 "\u020A": "I", 138 "\u1EC8": "I", 139 "\u1ECA": "I", 140 "\xD0": "D", 141 "\xD1": "N", 142 "\xD2": "O", 143 "\xD3": "O", 144 "\xD4": "O", 145 "\xD5": "O", 146 "\xD6": "O", 147 "\xD8": "O", 148 "\u1ED0": "O", 149 "\u1E4C": "O", 150 "\u1E52": "O", 151 "\u020E": "O", 152 "\u1ECE": "O", 153 "\u1ECC": "O", 154 "\u1ED4": "O", 155 "\u1ED6": "O", 156 "\u1ED8": "O", 157 "\u1EDC": "O", 158 "\u1EDE": "O", 159 "\u1EE0": "O", 160 "\u1EDA": "O", 161 "\u1EE2": "O", 162 "\xD9": "U", 163 "\xDA": "U", 164 "\xDB": "U", 165 "\xDC": "U", 166 "\u1EE6": "U", 167 "\u1EE4": "U", 168 "\u1EEC": "U", 169 "\u1EEE": "U", 170 "\u1EF0": "U", 171 "\xDD": "Y", 172 "\xE0": "a", 173 "\xE1": "a", 174 "\xE2": "a", 175 "\xE3": "a", 176 "\xE4": "a", 177 "\xE5": "a", 178 "\u1EA5": "a", 179 "\u1EAF": "a", 180 "\u1EB3": "a", 181 "\u1EB5": "a", 182 "\u1EB7": "a", 183 "\xE6": "ae", 184 "\u1EA7": "a", 185 "\u1EB1": "a", 186 "\u0203": "a", 187 "\u1EA3": "a", 188 "\u1EA1": "a", 189 "\u1EA9": "a", 190 "\u1EAB": "a", 191 "\u1EAD": "a", 192 "\xE7": "c", 193 "\u1E09": "c", 194 "\xE8": "e", 195 "\xE9": "e", 196 "\xEA": "e", 197 "\xEB": "e", 198 "\u1EBF": "e", 199 "\u1E17": "e", 200 "\u1EC1": "e", 201 "\u1E15": "e", 202 "\u1E1D": "e", 203 "\u0207": "e", 204 "\u1EBB": "e", 205 "\u1EBD": "e", 206 "\u1EB9": "e", 207 "\u1EC3": "e", 208 "\u1EC5": "e", 209 "\u1EC7": "e", 210 "\xEC": "i", 211 "\xED": "i", 212 "\xEE": "i", 213 "\xEF": "i", 214 "\u1E2F": "i", 215 "\u020B": "i", 216 "\u1EC9": "i", 217 "\u1ECB": "i", 218 "\xF0": "d", 219 "\xF1": "n", 220 "\xF2": "o", 221 "\xF3": "o", 222 "\xF4": "o", 223 "\xF5": "o", 224 "\xF6": "o", 225 "\xF8": "o", 226 "\u1ED1": "o", 227 "\u1E4D": "o", 228 "\u1E53": "o", 229 "\u020F": "o", 230 "\u1ECF": "o", 231 "\u1ECD": "o", 232 "\u1ED5": "o", 233 "\u1ED7": "o", 234 "\u1ED9": "o", 235 "\u1EDD": "o", 236 "\u1EDF": "o", 237 "\u1EE1": "o", 238 "\u1EDB": "o", 239 "\u1EE3": "o", 240 "\xF9": "u", 241 "\xFA": "u", 242 "\xFB": "u", 243 "\xFC": "u", 244 "\u1EE7": "u", 245 "\u1EE5": "u", 246 "\u1EED": "u", 247 "\u1EEF": "u", 248 "\u1EF1": "u", 249 "\xFD": "y", 250 "\xFF": "y", 251 "\u0100": "A", 252 "\u0101": "a", 253 "\u0102": "A", 254 "\u0103": "a", 255 "\u0104": "A", 256 "\u0105": "a", 257 "\u0106": "C", 258 "\u0107": "c", 259 "\u0108": "C", 260 "\u0109": "c", 261 "\u010A": "C", 262 "\u010B": "c", 263 "\u010C": "C", 264 "\u010D": "c", 265 "C\u0306": "C", 266 "c\u0306": "c", 267 "\u010E": "D", 268 "\u010F": "d", 269 "\u0110": "D", 270 "\u0111": "d", 271 "\u0112": "E", 272 "\u0113": "e", 273 "\u0114": "E", 274 "\u0115": "e", 275 "\u0116": "E", 276 "\u0117": "e", 277 "\u0118": "E", 278 "\u0119": "e", 279 "\u011A": "E", 280 "\u011B": "e", 281 "\u011C": "G", 282 "\u01F4": "G", 283 "\u011D": "g", 284 "\u01F5": "g", 285 "\u011E": "G", 286 "\u011F": "g", 287 "\u0120": "G", 288 "\u0121": "g", 289 "\u0122": "G", 290 "\u0123": "g", 291 "\u0124": "H", 292 "\u0125": "h", 293 "\u0126": "H", 294 "\u0127": "h", 295 "\u1E2A": "H", 296 "\u1E2B": "h", 297 "\u0128": "I", 298 "\u0129": "i", 299 "\u012A": "I", 300 "\u012B": "i", 301 "\u012C": "I", 302 "\u012D": "i", 303 "\u012E": "I", 304 "\u012F": "i", 305 "\u0130": "I", 306 "\u0131": "i", 307 "\u0132": "IJ", 308 "\u0133": "ij", 309 "\u0134": "J", 310 "\u0135": "j", 311 "\u0136": "K", 312 "\u0137": "k", 313 "\u1E30": "K", 314 "\u1E31": "k", 315 "K\u0306": "K", 316 "k\u0306": "k", 317 "\u0139": "L", 318 "\u013A": "l", 319 "\u013B": "L", 320 "\u013C": "l", 321 "\u013D": "L", 322 "\u013E": "l", 323 "\u013F": "L", 324 "\u0140": "l", 325 "\u0141": "l", 326 "\u0142": "l", 327 "\u1E3E": "M", 328 "\u1E3F": "m", 329 "M\u0306": "M", 330 "m\u0306": "m", 331 "\u0143": "N", 332 "\u0144": "n", 333 "\u0145": "N", 334 "\u0146": "n", 335 "\u0147": "N", 336 "\u0148": "n", 337 "\u0149": "n", 338 "N\u0306": "N", 339 "n\u0306": "n", 340 "\u014C": "O", 341 "\u014D": "o", 342 "\u014E": "O", 343 "\u014F": "o", 344 "\u0150": "O", 345 "\u0151": "o", 346 "\u0152": "OE", 347 "\u0153": "oe", 348 "P\u0306": "P", 349 "p\u0306": "p", 350 "\u0154": "R", 351 "\u0155": "r", 352 "\u0156": "R", 353 "\u0157": "r", 354 "\u0158": "R", 355 "\u0159": "r", 356 "R\u0306": "R", 357 "r\u0306": "r", 358 "\u0212": "R", 359 "\u0213": "r", 360 "\u015A": "S", 361 "\u015B": "s", 362 "\u015C": "S", 363 "\u015D": "s", 364 "\u015E": "S", 365 "\u0218": "S", 366 "\u0219": "s", 367 "\u015F": "s", 368 "\u0160": "S", 369 "\u0161": "s", 370 "\u0162": "T", 371 "\u0163": "t", 372 "\u021B": "t", 373 "\u021A": "T", 374 "\u0164": "T", 375 "\u0165": "t", 376 "\u0166": "T", 377 "\u0167": "t", 378 "T\u0306": "T", 379 "t\u0306": "t", 380 "\u0168": "U", 381 "\u0169": "u", 382 "\u016A": "U", 383 "\u016B": "u", 384 "\u016C": "U", 385 "\u016D": "u", 386 "\u016E": "U", 387 "\u016F": "u", 388 "\u0170": "U", 389 "\u0171": "u", 390 "\u0172": "U", 391 "\u0173": "u", 392 "\u0216": "U", 393 "\u0217": "u", 394 "V\u0306": "V", 395 "v\u0306": "v", 396 "\u0174": "W", 397 "\u0175": "w", 398 "\u1E82": "W", 399 "\u1E83": "w", 400 "X\u0306": "X", 401 "x\u0306": "x", 402 "\u0176": "Y", 403 "\u0177": "y", 404 "\u0178": "Y", 405 "Y\u0306": "Y", 406 "y\u0306": "y", 407 "\u0179": "Z", 408 "\u017A": "z", 409 "\u017B": "Z", 410 "\u017C": "z", 411 "\u017D": "Z", 412 "\u017E": "z", 413 "\u017F": "s", 414 "\u0192": "f", 415 "\u01A0": "O", 416 "\u01A1": "o", 417 "\u01AF": "U", 418 "\u01B0": "u", 419 "\u01CD": "A", 420 "\u01CE": "a", 421 "\u01CF": "I", 422 "\u01D0": "i", 423 "\u01D1": "O", 424 "\u01D2": "o", 425 "\u01D3": "U", 426 "\u01D4": "u", 427 "\u01D5": "U", 428 "\u01D6": "u", 429 "\u01D7": "U", 430 "\u01D8": "u", 431 "\u01D9": "U", 432 "\u01DA": "u", 433 "\u01DB": "U", 434 "\u01DC": "u", 435 "\u1EE8": "U", 436 "\u1EE9": "u", 437 "\u1E78": "U", 438 "\u1E79": "u", 439 "\u01FA": "A", 440 "\u01FB": "a", 441 "\u01FC": "AE", 442 "\u01FD": "ae", 443 "\u01FE": "O", 444 "\u01FF": "o", 445 "\xDE": "TH", 446 "\xFE": "th", 447 "\u1E54": "P", 448 "\u1E55": "p", 449 "\u1E64": "S", 450 "\u1E65": "s", 451 "X\u0301": "X", 452 "x\u0301": "x", 453 "\u0403": "\u0413", 454 "\u0453": "\u0433", 455 "\u040C": "\u041A", 456 "\u045C": "\u043A", 457 "A\u030B": "A", 458 "a\u030B": "a", 459 "E\u030B": "E", 460 "e\u030B": "e", 461 "I\u030B": "I", 462 "i\u030B": "i", 463 "\u01F8": "N", 464 "\u01F9": "n", 465 "\u1ED2": "O", 466 "\u1ED3": "o", 467 "\u1E50": "O", 468 "\u1E51": "o", 469 "\u1EEA": "U", 470 "\u1EEB": "u", 471 "\u1E80": "W", 472 "\u1E81": "w", 473 "\u1EF2": "Y", 474 "\u1EF3": "y", 475 "\u0200": "A", 476 "\u0201": "a", 477 "\u0204": "E", 478 "\u0205": "e", 479 "\u0208": "I", 480 "\u0209": "i", 481 "\u020C": "O", 482 "\u020D": "o", 483 "\u0210": "R", 484 "\u0211": "r", 485 "\u0214": "U", 486 "\u0215": "u", 487 "B\u030C": "B", 488 "b\u030C": "b", 489 "\u010C\u0323": "C", 490 "\u010D\u0323": "c", 491 "\xCA\u030C": "E", 492 "\xEA\u030C": "e", 493 "F\u030C": "F", 494 "f\u030C": "f", 495 "\u01E6": "G", 496 "\u01E7": "g", 497 "\u021E": "H", 498 "\u021F": "h", 499 "J\u030C": "J", 500 "\u01F0": "j", 501 "\u01E8": "K", 502 "\u01E9": "k", 503 "M\u030C": "M", 504 "m\u030C": "m", 505 "P\u030C": "P", 506 "p\u030C": "p", 507 "Q\u030C": "Q", 508 "q\u030C": "q", 509 "\u0158\u0329": "R", 510 "\u0159\u0329": "r", 511 "\u1E66": "S", 512 "\u1E67": "s", 513 "V\u030C": "V", 514 "v\u030C": "v", 515 "W\u030C": "W", 516 "w\u030C": "w", 517 "X\u030C": "X", 518 "x\u030C": "x", 519 "Y\u030C": "Y", 520 "y\u030C": "y", 521 "A\u0327": "A", 522 "a\u0327": "a", 523 "B\u0327": "B", 524 "b\u0327": "b", 525 "\u1E10": "D", 526 "\u1E11": "d", 527 "\u0228": "E", 528 "\u0229": "e", 529 "\u0190\u0327": "E", 530 "\u025B\u0327": "e", 531 "\u1E28": "H", 532 "\u1E29": "h", 533 "I\u0327": "I", 534 "i\u0327": "i", 535 "\u0197\u0327": "I", 536 "\u0268\u0327": "i", 537 "M\u0327": "M", 538 "m\u0327": "m", 539 "O\u0327": "O", 540 "o\u0327": "o", 541 "Q\u0327": "Q", 542 "q\u0327": "q", 543 "U\u0327": "U", 544 "u\u0327": "u", 545 "X\u0327": "X", 546 "x\u0327": "x", 547 "Z\u0327": "Z", 548 "z\u0327": "z", 549 "\u0439": "\u0438", 550 "\u0419": "\u0418", 551 "\u0451": "\u0435", 552 "\u0401": "\u0415" 553 }; 554 var chars = Object.keys(characterMap).join("|"); 555 var allAccents = new RegExp(chars, "g"); 556 var firstAccent = new RegExp(chars, ""); 557 function matcher3(match) { 558 return characterMap[match]; 559 } 560 var removeAccents2 = function(string) { 561 return string.replace(allAccents, matcher3); 562 }; 563 var hasAccents = function(string) { 564 return !!string.match(firstAccent); 565 }; 566 module.exports = removeAccents2; 567 module.exports.has = hasAccents; 568 module.exports.remove = removeAccents2; 569 } 570 }); 571 572 // packages/blocks/node_modules/react-is/cjs/react-is.development.js 573 var require_react_is_development = __commonJS({ 574 "packages/blocks/node_modules/react-is/cjs/react-is.development.js"(exports) { 575 "use strict"; 576 if (true) { 577 (function() { 578 "use strict"; 579 var REACT_ELEMENT_TYPE = Symbol.for("react.element"); 580 var REACT_PORTAL_TYPE = Symbol.for("react.portal"); 581 var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"); 582 var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"); 583 var REACT_PROFILER_TYPE = Symbol.for("react.profiler"); 584 var REACT_PROVIDER_TYPE = Symbol.for("react.provider"); 585 var REACT_CONTEXT_TYPE = Symbol.for("react.context"); 586 var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context"); 587 var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"); 588 var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"); 589 var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"); 590 var REACT_MEMO_TYPE = Symbol.for("react.memo"); 591 var REACT_LAZY_TYPE = Symbol.for("react.lazy"); 592 var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"); 593 var enableScopeAPI = false; 594 var enableCacheElement = false; 595 var enableTransitionTracing = false; 596 var enableLegacyHidden = false; 597 var enableDebugTracing = false; 598 var REACT_MODULE_REFERENCE; 599 { 600 REACT_MODULE_REFERENCE = Symbol.for("react.module.reference"); 601 } 602 function isValidElementType2(type) { 603 if (typeof type === "string" || typeof type === "function") { 604 return true; 605 } 606 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) { 607 return true; 608 } 609 if (typeof type === "object" && type !== null) { 610 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object 611 // types supported by any Flight configuration anywhere since 612 // we don't know which Flight build this will end up being used 613 // with. 614 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) { 615 return true; 616 } 617 } 618 return false; 619 } 620 function typeOf(object) { 621 if (typeof object === "object" && object !== null) { 622 var $$typeof = object.$$typeof; 623 switch ($$typeof) { 624 case REACT_ELEMENT_TYPE: 625 var type = object.type; 626 switch (type) { 627 case REACT_FRAGMENT_TYPE: 628 case REACT_PROFILER_TYPE: 629 case REACT_STRICT_MODE_TYPE: 630 case REACT_SUSPENSE_TYPE: 631 case REACT_SUSPENSE_LIST_TYPE: 632 return type; 633 default: 634 var $$typeofType = type && type.$$typeof; 635 switch ($$typeofType) { 636 case REACT_SERVER_CONTEXT_TYPE: 637 case REACT_CONTEXT_TYPE: 638 case REACT_FORWARD_REF_TYPE: 639 case REACT_LAZY_TYPE: 640 case REACT_MEMO_TYPE: 641 case REACT_PROVIDER_TYPE: 642 return $$typeofType; 643 default: 644 return $$typeof; 645 } 646 } 647 case REACT_PORTAL_TYPE: 648 return $$typeof; 649 } 650 } 651 return void 0; 652 } 653 var ContextConsumer = REACT_CONTEXT_TYPE; 654 var ContextProvider = REACT_PROVIDER_TYPE; 655 var Element = REACT_ELEMENT_TYPE; 656 var ForwardRef = REACT_FORWARD_REF_TYPE; 657 var Fragment = REACT_FRAGMENT_TYPE; 658 var Lazy = REACT_LAZY_TYPE; 659 var Memo = REACT_MEMO_TYPE; 660 var Portal = REACT_PORTAL_TYPE; 661 var Profiler = REACT_PROFILER_TYPE; 662 var StrictMode = REACT_STRICT_MODE_TYPE; 663 var Suspense = REACT_SUSPENSE_TYPE; 664 var SuspenseList = REACT_SUSPENSE_LIST_TYPE; 665 var hasWarnedAboutDeprecatedIsAsyncMode = false; 666 var hasWarnedAboutDeprecatedIsConcurrentMode = false; 667 function isAsyncMode(object) { 668 { 669 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 670 hasWarnedAboutDeprecatedIsAsyncMode = true; 671 console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+."); 672 } 673 } 674 return false; 675 } 676 function isConcurrentMode(object) { 677 { 678 if (!hasWarnedAboutDeprecatedIsConcurrentMode) { 679 hasWarnedAboutDeprecatedIsConcurrentMode = true; 680 console["warn"]("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+."); 681 } 682 } 683 return false; 684 } 685 function isContextConsumer(object) { 686 return typeOf(object) === REACT_CONTEXT_TYPE; 687 } 688 function isContextProvider(object) { 689 return typeOf(object) === REACT_PROVIDER_TYPE; 690 } 691 function isElement(object) { 692 return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 693 } 694 function isForwardRef(object) { 695 return typeOf(object) === REACT_FORWARD_REF_TYPE; 696 } 697 function isFragment(object) { 698 return typeOf(object) === REACT_FRAGMENT_TYPE; 699 } 700 function isLazy(object) { 701 return typeOf(object) === REACT_LAZY_TYPE; 702 } 703 function isMemo(object) { 704 return typeOf(object) === REACT_MEMO_TYPE; 705 } 706 function isPortal(object) { 707 return typeOf(object) === REACT_PORTAL_TYPE; 708 } 709 function isProfiler(object) { 710 return typeOf(object) === REACT_PROFILER_TYPE; 711 } 712 function isStrictMode(object) { 713 return typeOf(object) === REACT_STRICT_MODE_TYPE; 714 } 715 function isSuspense(object) { 716 return typeOf(object) === REACT_SUSPENSE_TYPE; 717 } 718 function isSuspenseList(object) { 719 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; 720 } 721 exports.ContextConsumer = ContextConsumer; 722 exports.ContextProvider = ContextProvider; 723 exports.Element = Element; 724 exports.ForwardRef = ForwardRef; 725 exports.Fragment = Fragment; 726 exports.Lazy = Lazy; 727 exports.Memo = Memo; 728 exports.Portal = Portal; 729 exports.Profiler = Profiler; 730 exports.StrictMode = StrictMode; 731 exports.Suspense = Suspense; 732 exports.SuspenseList = SuspenseList; 733 exports.isAsyncMode = isAsyncMode; 734 exports.isConcurrentMode = isConcurrentMode; 735 exports.isContextConsumer = isContextConsumer; 736 exports.isContextProvider = isContextProvider; 737 exports.isElement = isElement; 738 exports.isForwardRef = isForwardRef; 739 exports.isFragment = isFragment; 740 exports.isLazy = isLazy; 741 exports.isMemo = isMemo; 742 exports.isPortal = isPortal; 743 exports.isProfiler = isProfiler; 744 exports.isStrictMode = isStrictMode; 745 exports.isSuspense = isSuspense; 746 exports.isSuspenseList = isSuspenseList; 747 exports.isValidElementType = isValidElementType2; 748 exports.typeOf = typeOf; 749 })(); 750 } 751 } 752 }); 753 754 // packages/blocks/node_modules/react-is/index.js 755 var require_react_is = __commonJS({ 756 "packages/blocks/node_modules/react-is/index.js"(exports, module) { 757 "use strict"; 758 if (false) { 759 module.exports = null; 760 } else { 761 module.exports = require_react_is_development(); 762 } 763 } 764 }); 765 766 // package-external:@wordpress/hooks 767 var require_hooks = __commonJS({ 768 "package-external:@wordpress/hooks"(exports, module) { 769 module.exports = window.wp.hooks; 770 } 771 }); 772 773 // package-external:@wordpress/block-serialization-default-parser 774 var require_block_serialization_default_parser = __commonJS({ 775 "package-external:@wordpress/block-serialization-default-parser"(exports, module) { 776 module.exports = window.wp.blockSerializationDefaultParser; 777 } 778 }); 779 780 // package-external:@wordpress/autop 781 var require_autop = __commonJS({ 782 "package-external:@wordpress/autop"(exports, module) { 783 module.exports = window.wp.autop; 784 } 785 }); 786 787 // package-external:@wordpress/is-shallow-equal 788 var require_is_shallow_equal = __commonJS({ 789 "package-external:@wordpress/is-shallow-equal"(exports, module) { 790 module.exports = window.wp.isShallowEqual; 791 } 792 }); 793 794 // vendor-external:react/jsx-runtime 795 var require_jsx_runtime = __commonJS({ 796 "vendor-external:react/jsx-runtime"(exports, module) { 797 module.exports = window.ReactJSXRuntime; 798 } 799 }); 800 801 // node_modules/fast-deep-equal/es6/index.js 802 var require_es6 = __commonJS({ 803 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 804 "use strict"; 805 module.exports = function equal(a2, b2) { 806 if (a2 === b2) return true; 807 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 808 if (a2.constructor !== b2.constructor) return false; 809 var length, i2, keys; 810 if (Array.isArray(a2)) { 811 length = a2.length; 812 if (length != b2.length) return false; 813 for (i2 = length; i2-- !== 0; ) 814 if (!equal(a2[i2], b2[i2])) return false; 815 return true; 816 } 817 if (a2 instanceof Map && b2 instanceof Map) { 818 if (a2.size !== b2.size) return false; 819 for (i2 of a2.entries()) 820 if (!b2.has(i2[0])) return false; 821 for (i2 of a2.entries()) 822 if (!equal(i2[1], b2.get(i2[0]))) return false; 823 return true; 824 } 825 if (a2 instanceof Set && b2 instanceof Set) { 826 if (a2.size !== b2.size) return false; 827 for (i2 of a2.entries()) 828 if (!b2.has(i2[0])) return false; 829 return true; 830 } 831 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 832 length = a2.length; 833 if (length != b2.length) return false; 834 for (i2 = length; i2-- !== 0; ) 835 if (a2[i2] !== b2[i2]) return false; 836 return true; 837 } 838 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 839 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); 840 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); 841 keys = Object.keys(a2); 842 length = keys.length; 843 if (length !== Object.keys(b2).length) return false; 844 for (i2 = length; i2-- !== 0; ) 845 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; 846 for (i2 = length; i2-- !== 0; ) { 847 var key = keys[i2]; 848 if (!equal(a2[key], b2[key])) return false; 849 } 850 return true; 851 } 852 return a2 !== a2 && b2 !== b2; 853 }; 854 } 855 }); 856 857 // package-external:@wordpress/html-entities 858 var require_html_entities = __commonJS({ 859 "package-external:@wordpress/html-entities"(exports, module) { 860 module.exports = window.wp.htmlEntities; 861 } 862 }); 863 864 // package-external:@wordpress/shortcode 865 var require_shortcode = __commonJS({ 866 "package-external:@wordpress/shortcode"(exports, module) { 867 module.exports = window.wp.shortcode; 868 } 869 }); 870 871 // package-external:@wordpress/blob 872 var require_blob = __commonJS({ 873 "package-external:@wordpress/blob"(exports, module) { 874 module.exports = window.wp.blob; 875 } 876 }); 877 878 // node_modules/showdown/dist/showdown.js 879 var require_showdown = __commonJS({ 880 "node_modules/showdown/dist/showdown.js"(exports, module) { 881 (function() { 882 function getDefaultOpts(simple) { 883 "use strict"; 884 var defaultOptions = { 885 omitExtraWLInCodeBlocks: { 886 defaultValue: false, 887 describe: "Omit the default extra whiteline added to code blocks", 888 type: "boolean" 889 }, 890 noHeaderId: { 891 defaultValue: false, 892 describe: "Turn on/off generated header id", 893 type: "boolean" 894 }, 895 prefixHeaderId: { 896 defaultValue: false, 897 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", 898 type: "string" 899 }, 900 rawPrefixHeaderId: { 901 defaultValue: false, 902 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)', 903 type: "boolean" 904 }, 905 ghCompatibleHeaderId: { 906 defaultValue: false, 907 describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)", 908 type: "boolean" 909 }, 910 rawHeaderId: { 911 defaultValue: false, 912 describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`, 913 type: "boolean" 914 }, 915 headerLevelStart: { 916 defaultValue: false, 917 describe: "The header blocks level start", 918 type: "integer" 919 }, 920 parseImgDimensions: { 921 defaultValue: false, 922 describe: "Turn on/off image dimension parsing", 923 type: "boolean" 924 }, 925 simplifiedAutoLink: { 926 defaultValue: false, 927 describe: "Turn on/off GFM autolink style", 928 type: "boolean" 929 }, 930 excludeTrailingPunctuationFromURLs: { 931 defaultValue: false, 932 describe: "Excludes trailing punctuation from links generated with autoLinking", 933 type: "boolean" 934 }, 935 literalMidWordUnderscores: { 936 defaultValue: false, 937 describe: "Parse midword underscores as literal underscores", 938 type: "boolean" 939 }, 940 literalMidWordAsterisks: { 941 defaultValue: false, 942 describe: "Parse midword asterisks as literal asterisks", 943 type: "boolean" 944 }, 945 strikethrough: { 946 defaultValue: false, 947 describe: "Turn on/off strikethrough support", 948 type: "boolean" 949 }, 950 tables: { 951 defaultValue: false, 952 describe: "Turn on/off tables support", 953 type: "boolean" 954 }, 955 tablesHeaderId: { 956 defaultValue: false, 957 describe: "Add an id to table headers", 958 type: "boolean" 959 }, 960 ghCodeBlocks: { 961 defaultValue: true, 962 describe: "Turn on/off GFM fenced code blocks support", 963 type: "boolean" 964 }, 965 tasklists: { 966 defaultValue: false, 967 describe: "Turn on/off GFM tasklist support", 968 type: "boolean" 969 }, 970 smoothLivePreview: { 971 defaultValue: false, 972 describe: "Prevents weird effects in live previews due to incomplete input", 973 type: "boolean" 974 }, 975 smartIndentationFix: { 976 defaultValue: false, 977 description: "Tries to smartly fix indentation in es6 strings", 978 type: "boolean" 979 }, 980 disableForced4SpacesIndentedSublists: { 981 defaultValue: false, 982 description: "Disables the requirement of indenting nested sublists by 4 spaces", 983 type: "boolean" 984 }, 985 simpleLineBreaks: { 986 defaultValue: false, 987 description: "Parses simple line breaks as <br> (GFM Style)", 988 type: "boolean" 989 }, 990 requireSpaceBeforeHeadingText: { 991 defaultValue: false, 992 description: "Makes adding a space between `#` and the header text mandatory (GFM Style)", 993 type: "boolean" 994 }, 995 ghMentions: { 996 defaultValue: false, 997 description: "Enables github @mentions", 998 type: "boolean" 999 }, 1000 ghMentionsLink: { 1001 defaultValue: "https://github.com/{u}", 1002 description: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.", 1003 type: "string" 1004 }, 1005 encodeEmails: { 1006 defaultValue: true, 1007 description: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities", 1008 type: "boolean" 1009 }, 1010 openLinksInNewWindow: { 1011 defaultValue: false, 1012 description: "Open all links in new windows", 1013 type: "boolean" 1014 }, 1015 backslashEscapesHTMLTags: { 1016 defaultValue: false, 1017 description: "Support for HTML Tag escaping. ex: <div>foo</div>", 1018 type: "boolean" 1019 }, 1020 emoji: { 1021 defaultValue: false, 1022 description: "Enable emoji support. Ex: `this is a :smile: emoji`", 1023 type: "boolean" 1024 }, 1025 underline: { 1026 defaultValue: false, 1027 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>`", 1028 type: "boolean" 1029 }, 1030 completeHTMLDocument: { 1031 defaultValue: false, 1032 description: "Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags", 1033 type: "boolean" 1034 }, 1035 metadata: { 1036 defaultValue: false, 1037 description: "Enable support for document metadata (defined at the top of the document between `\xAB\xAB\xAB` and `\xBB\xBB\xBB` or between `---` and `---`).", 1038 type: "boolean" 1039 }, 1040 splitAdjacentBlockquotes: { 1041 defaultValue: false, 1042 description: "Split adjacent blockquote blocks", 1043 type: "boolean" 1044 } 1045 }; 1046 if (simple === false) { 1047 return JSON.parse(JSON.stringify(defaultOptions)); 1048 } 1049 var ret = {}; 1050 for (var opt in defaultOptions) { 1051 if (defaultOptions.hasOwnProperty(opt)) { 1052 ret[opt] = defaultOptions[opt].defaultValue; 1053 } 1054 } 1055 return ret; 1056 } 1057 function allOptionsOn() { 1058 "use strict"; 1059 var options = getDefaultOpts(true), ret = {}; 1060 for (var opt in options) { 1061 if (options.hasOwnProperty(opt)) { 1062 ret[opt] = true; 1063 } 1064 } 1065 return ret; 1066 } 1067 var showdown2 = {}, parsers = {}, extensions = {}, globalOptions = getDefaultOpts(true), setFlavor = "vanilla", flavor = { 1068 github: { 1069 omitExtraWLInCodeBlocks: true, 1070 simplifiedAutoLink: true, 1071 excludeTrailingPunctuationFromURLs: true, 1072 literalMidWordUnderscores: true, 1073 strikethrough: true, 1074 tables: true, 1075 tablesHeaderId: true, 1076 ghCodeBlocks: true, 1077 tasklists: true, 1078 disableForced4SpacesIndentedSublists: true, 1079 simpleLineBreaks: true, 1080 requireSpaceBeforeHeadingText: true, 1081 ghCompatibleHeaderId: true, 1082 ghMentions: true, 1083 backslashEscapesHTMLTags: true, 1084 emoji: true, 1085 splitAdjacentBlockquotes: true 1086 }, 1087 original: { 1088 noHeaderId: true, 1089 ghCodeBlocks: false 1090 }, 1091 ghost: { 1092 omitExtraWLInCodeBlocks: true, 1093 parseImgDimensions: true, 1094 simplifiedAutoLink: true, 1095 excludeTrailingPunctuationFromURLs: true, 1096 literalMidWordUnderscores: true, 1097 strikethrough: true, 1098 tables: true, 1099 tablesHeaderId: true, 1100 ghCodeBlocks: true, 1101 tasklists: true, 1102 smoothLivePreview: true, 1103 simpleLineBreaks: true, 1104 requireSpaceBeforeHeadingText: true, 1105 ghMentions: false, 1106 encodeEmails: true 1107 }, 1108 vanilla: getDefaultOpts(true), 1109 allOn: allOptionsOn() 1110 }; 1111 showdown2.helper = {}; 1112 showdown2.extensions = {}; 1113 showdown2.setOption = function(key, value) { 1114 "use strict"; 1115 globalOptions[key] = value; 1116 return this; 1117 }; 1118 showdown2.getOption = function(key) { 1119 "use strict"; 1120 return globalOptions[key]; 1121 }; 1122 showdown2.getOptions = function() { 1123 "use strict"; 1124 return globalOptions; 1125 }; 1126 showdown2.resetOptions = function() { 1127 "use strict"; 1128 globalOptions = getDefaultOpts(true); 1129 }; 1130 showdown2.setFlavor = function(name) { 1131 "use strict"; 1132 if (!flavor.hasOwnProperty(name)) { 1133 throw Error(name + " flavor was not found"); 1134 } 1135 showdown2.resetOptions(); 1136 var preset = flavor[name]; 1137 setFlavor = name; 1138 for (var option in preset) { 1139 if (preset.hasOwnProperty(option)) { 1140 globalOptions[option] = preset[option]; 1141 } 1142 } 1143 }; 1144 showdown2.getFlavor = function() { 1145 "use strict"; 1146 return setFlavor; 1147 }; 1148 showdown2.getFlavorOptions = function(name) { 1149 "use strict"; 1150 if (flavor.hasOwnProperty(name)) { 1151 return flavor[name]; 1152 } 1153 }; 1154 showdown2.getDefaultOptions = function(simple) { 1155 "use strict"; 1156 return getDefaultOpts(simple); 1157 }; 1158 showdown2.subParser = function(name, func) { 1159 "use strict"; 1160 if (showdown2.helper.isString(name)) { 1161 if (typeof func !== "undefined") { 1162 parsers[name] = func; 1163 } else { 1164 if (parsers.hasOwnProperty(name)) { 1165 return parsers[name]; 1166 } else { 1167 throw Error("SubParser named " + name + " not registered!"); 1168 } 1169 } 1170 } 1171 }; 1172 showdown2.extension = function(name, ext) { 1173 "use strict"; 1174 if (!showdown2.helper.isString(name)) { 1175 throw Error("Extension 'name' must be a string"); 1176 } 1177 name = showdown2.helper.stdExtName(name); 1178 if (showdown2.helper.isUndefined(ext)) { 1179 if (!extensions.hasOwnProperty(name)) { 1180 throw Error("Extension named " + name + " is not registered!"); 1181 } 1182 return extensions[name]; 1183 } else { 1184 if (typeof ext === "function") { 1185 ext = ext(); 1186 } 1187 if (!showdown2.helper.isArray(ext)) { 1188 ext = [ext]; 1189 } 1190 var validExtension = validate(ext, name); 1191 if (validExtension.valid) { 1192 extensions[name] = ext; 1193 } else { 1194 throw Error(validExtension.error); 1195 } 1196 } 1197 }; 1198 showdown2.getAllExtensions = function() { 1199 "use strict"; 1200 return extensions; 1201 }; 1202 showdown2.removeExtension = function(name) { 1203 "use strict"; 1204 delete extensions[name]; 1205 }; 1206 showdown2.resetExtensions = function() { 1207 "use strict"; 1208 extensions = {}; 1209 }; 1210 function validate(extension, name) { 1211 "use strict"; 1212 var errMsg = name ? "Error in " + name + " extension->" : "Error in unnamed extension", ret = { 1213 valid: true, 1214 error: "" 1215 }; 1216 if (!showdown2.helper.isArray(extension)) { 1217 extension = [extension]; 1218 } 1219 for (var i2 = 0; i2 < extension.length; ++i2) { 1220 var baseMsg = errMsg + " sub-extension " + i2 + ": ", ext = extension[i2]; 1221 if (typeof ext !== "object") { 1222 ret.valid = false; 1223 ret.error = baseMsg + "must be an object, but " + typeof ext + " given"; 1224 return ret; 1225 } 1226 if (!showdown2.helper.isString(ext.type)) { 1227 ret.valid = false; 1228 ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + " given"; 1229 return ret; 1230 } 1231 var type = ext.type = ext.type.toLowerCase(); 1232 if (type === "language") { 1233 type = ext.type = "lang"; 1234 } 1235 if (type === "html") { 1236 type = ext.type = "output"; 1237 } 1238 if (type !== "lang" && type !== "output" && type !== "listener") { 1239 ret.valid = false; 1240 ret.error = baseMsg + "type " + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"'; 1241 return ret; 1242 } 1243 if (type === "listener") { 1244 if (showdown2.helper.isUndefined(ext.listeners)) { 1245 ret.valid = false; 1246 ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"'; 1247 return ret; 1248 } 1249 } else { 1250 if (showdown2.helper.isUndefined(ext.filter) && showdown2.helper.isUndefined(ext.regex)) { 1251 ret.valid = false; 1252 ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method'; 1253 return ret; 1254 } 1255 } 1256 if (ext.listeners) { 1257 if (typeof ext.listeners !== "object") { 1258 ret.valid = false; 1259 ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + " given"; 1260 return ret; 1261 } 1262 for (var ln in ext.listeners) { 1263 if (ext.listeners.hasOwnProperty(ln)) { 1264 if (typeof ext.listeners[ln] !== "function") { 1265 ret.valid = false; 1266 ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln + " must be a function but " + typeof ext.listeners[ln] + " given"; 1267 return ret; 1268 } 1269 } 1270 } 1271 } 1272 if (ext.filter) { 1273 if (typeof ext.filter !== "function") { 1274 ret.valid = false; 1275 ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + " given"; 1276 return ret; 1277 } 1278 } else if (ext.regex) { 1279 if (showdown2.helper.isString(ext.regex)) { 1280 ext.regex = new RegExp(ext.regex, "g"); 1281 } 1282 if (!(ext.regex instanceof RegExp)) { 1283 ret.valid = false; 1284 ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + " given"; 1285 return ret; 1286 } 1287 if (showdown2.helper.isUndefined(ext.replace)) { 1288 ret.valid = false; 1289 ret.error = baseMsg + '"regex" extensions must implement a replace string or function'; 1290 return ret; 1291 } 1292 } 1293 } 1294 return ret; 1295 } 1296 showdown2.validateExtension = function(ext) { 1297 "use strict"; 1298 var validateExtension = validate(ext, null); 1299 if (!validateExtension.valid) { 1300 console.warn(validateExtension.error); 1301 return false; 1302 } 1303 return true; 1304 }; 1305 if (!showdown2.hasOwnProperty("helper")) { 1306 showdown2.helper = {}; 1307 } 1308 showdown2.helper.isString = function(a2) { 1309 "use strict"; 1310 return typeof a2 === "string" || a2 instanceof String; 1311 }; 1312 showdown2.helper.isFunction = function(a2) { 1313 "use strict"; 1314 var getType = {}; 1315 return a2 && getType.toString.call(a2) === "[object Function]"; 1316 }; 1317 showdown2.helper.isArray = function(a2) { 1318 "use strict"; 1319 return Array.isArray(a2); 1320 }; 1321 showdown2.helper.isUndefined = function(value) { 1322 "use strict"; 1323 return typeof value === "undefined"; 1324 }; 1325 showdown2.helper.forEach = function(obj, callback) { 1326 "use strict"; 1327 if (showdown2.helper.isUndefined(obj)) { 1328 throw new Error("obj param is required"); 1329 } 1330 if (showdown2.helper.isUndefined(callback)) { 1331 throw new Error("callback param is required"); 1332 } 1333 if (!showdown2.helper.isFunction(callback)) { 1334 throw new Error("callback param must be a function/closure"); 1335 } 1336 if (typeof obj.forEach === "function") { 1337 obj.forEach(callback); 1338 } else if (showdown2.helper.isArray(obj)) { 1339 for (var i2 = 0; i2 < obj.length; i2++) { 1340 callback(obj[i2], i2, obj); 1341 } 1342 } else if (typeof obj === "object") { 1343 for (var prop2 in obj) { 1344 if (obj.hasOwnProperty(prop2)) { 1345 callback(obj[prop2], prop2, obj); 1346 } 1347 } 1348 } else { 1349 throw new Error("obj does not seem to be an array or an iterable object"); 1350 } 1351 }; 1352 showdown2.helper.stdExtName = function(s2) { 1353 "use strict"; 1354 return s2.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase(); 1355 }; 1356 function escapeCharactersCallback(wholeMatch, m1) { 1357 "use strict"; 1358 var charCodeToEscape = m1.charCodeAt(0); 1359 return "\xA8E" + charCodeToEscape + "E"; 1360 } 1361 showdown2.helper.escapeCharactersCallback = escapeCharactersCallback; 1362 showdown2.helper.escapeCharacters = function(text2, charsToEscape, afterBackslash) { 1363 "use strict"; 1364 var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])"; 1365 if (afterBackslash) { 1366 regexString = "\\\\" + regexString; 1367 } 1368 var regex = new RegExp(regexString, "g"); 1369 text2 = text2.replace(regex, escapeCharactersCallback); 1370 return text2; 1371 }; 1372 showdown2.helper.unescapeHTMLEntities = function(txt) { 1373 "use strict"; 1374 return txt.replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&"); 1375 }; 1376 var rgxFindMatchPos = function(str, left, right, flags) { 1377 "use strict"; 1378 var f2 = flags || "", g2 = f2.indexOf("g") > -1, x2 = new RegExp(left + "|" + right, "g" + f2.replace(/g/g, "")), l2 = new RegExp(left, f2.replace(/g/g, "")), pos = [], t3, s2, m2, start, end; 1379 do { 1380 t3 = 0; 1381 while (m2 = x2.exec(str)) { 1382 if (l2.test(m2[0])) { 1383 if (!t3++) { 1384 s2 = x2.lastIndex; 1385 start = s2 - m2[0].length; 1386 } 1387 } else if (t3) { 1388 if (!--t3) { 1389 end = m2.index + m2[0].length; 1390 var obj = { 1391 left: { start, end: s2 }, 1392 match: { start: s2, end: m2.index }, 1393 right: { start: m2.index, end }, 1394 wholeMatch: { start, end } 1395 }; 1396 pos.push(obj); 1397 if (!g2) { 1398 return pos; 1399 } 1400 } 1401 } 1402 } 1403 } while (t3 && (x2.lastIndex = s2)); 1404 return pos; 1405 }; 1406 showdown2.helper.matchRecursiveRegExp = function(str, left, right, flags) { 1407 "use strict"; 1408 var matchPos = rgxFindMatchPos(str, left, right, flags), results = []; 1409 for (var i2 = 0; i2 < matchPos.length; ++i2) { 1410 results.push([ 1411 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end), 1412 str.slice(matchPos[i2].match.start, matchPos[i2].match.end), 1413 str.slice(matchPos[i2].left.start, matchPos[i2].left.end), 1414 str.slice(matchPos[i2].right.start, matchPos[i2].right.end) 1415 ]); 1416 } 1417 return results; 1418 }; 1419 showdown2.helper.replaceRecursiveRegExp = function(str, replacement, left, right, flags) { 1420 "use strict"; 1421 if (!showdown2.helper.isFunction(replacement)) { 1422 var repStr = replacement; 1423 replacement = function() { 1424 return repStr; 1425 }; 1426 } 1427 var matchPos = rgxFindMatchPos(str, left, right, flags), finalStr = str, lng = matchPos.length; 1428 if (lng > 0) { 1429 var bits = []; 1430 if (matchPos[0].wholeMatch.start !== 0) { 1431 bits.push(str.slice(0, matchPos[0].wholeMatch.start)); 1432 } 1433 for (var i2 = 0; i2 < lng; ++i2) { 1434 bits.push( 1435 replacement( 1436 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end), 1437 str.slice(matchPos[i2].match.start, matchPos[i2].match.end), 1438 str.slice(matchPos[i2].left.start, matchPos[i2].left.end), 1439 str.slice(matchPos[i2].right.start, matchPos[i2].right.end) 1440 ) 1441 ); 1442 if (i2 < lng - 1) { 1443 bits.push(str.slice(matchPos[i2].wholeMatch.end, matchPos[i2 + 1].wholeMatch.start)); 1444 } 1445 } 1446 if (matchPos[lng - 1].wholeMatch.end < str.length) { 1447 bits.push(str.slice(matchPos[lng - 1].wholeMatch.end)); 1448 } 1449 finalStr = bits.join(""); 1450 } 1451 return finalStr; 1452 }; 1453 showdown2.helper.regexIndexOf = function(str, regex, fromIndex) { 1454 "use strict"; 1455 if (!showdown2.helper.isString(str)) { 1456 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; 1457 } 1458 if (regex instanceof RegExp === false) { 1459 throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp"; 1460 } 1461 var indexOf = str.substring(fromIndex || 0).search(regex); 1462 return indexOf >= 0 ? indexOf + (fromIndex || 0) : indexOf; 1463 }; 1464 showdown2.helper.splitAtIndex = function(str, index) { 1465 "use strict"; 1466 if (!showdown2.helper.isString(str)) { 1467 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string"; 1468 } 1469 return [str.substring(0, index), str.substring(index)]; 1470 }; 1471 showdown2.helper.encodeEmailAddress = function(mail) { 1472 "use strict"; 1473 var encode = [ 1474 function(ch) { 1475 return "&#" + ch.charCodeAt(0) + ";"; 1476 }, 1477 function(ch) { 1478 return "&#x" + ch.charCodeAt(0).toString(16) + ";"; 1479 }, 1480 function(ch) { 1481 return ch; 1482 } 1483 ]; 1484 mail = mail.replace(/./g, function(ch) { 1485 if (ch === "@") { 1486 ch = encode[Math.floor(Math.random() * 2)](ch); 1487 } else { 1488 var r2 = Math.random(); 1489 ch = r2 > 0.9 ? encode[2](ch) : r2 > 0.45 ? encode[1](ch) : encode[0](ch); 1490 } 1491 return ch; 1492 }); 1493 return mail; 1494 }; 1495 showdown2.helper.padEnd = function padEnd(str, targetLength, padString) { 1496 "use strict"; 1497 targetLength = targetLength >> 0; 1498 padString = String(padString || " "); 1499 if (str.length > targetLength) { 1500 return String(str); 1501 } else { 1502 targetLength = targetLength - str.length; 1503 if (targetLength > padString.length) { 1504 padString += padString.repeat(targetLength / padString.length); 1505 } 1506 return String(str) + padString.slice(0, targetLength); 1507 } 1508 }; 1509 if (typeof console === "undefined") { 1510 console = { 1511 warn: function(msg) { 1512 "use strict"; 1513 alert(msg); 1514 }, 1515 log: function(msg) { 1516 "use strict"; 1517 alert(msg); 1518 }, 1519 error: function(msg) { 1520 "use strict"; 1521 throw msg; 1522 } 1523 }; 1524 } 1525 showdown2.helper.regexes = { 1526 asteriskDashAndColon: /([*_:~])/g 1527 }; 1528 showdown2.helper.emojis = { 1529 "+1": "\u{1F44D}", 1530 "-1": "\u{1F44E}", 1531 "100": "\u{1F4AF}", 1532 "1234": "\u{1F522}", 1533 "1st_place_medal": "\u{1F947}", 1534 "2nd_place_medal": "\u{1F948}", 1535 "3rd_place_medal": "\u{1F949}", 1536 "8ball": "\u{1F3B1}", 1537 "a": "\u{1F170}\uFE0F", 1538 "ab": "\u{1F18E}", 1539 "abc": "\u{1F524}", 1540 "abcd": "\u{1F521}", 1541 "accept": "\u{1F251}", 1542 "aerial_tramway": "\u{1F6A1}", 1543 "airplane": "\u2708\uFE0F", 1544 "alarm_clock": "\u23F0", 1545 "alembic": "\u2697\uFE0F", 1546 "alien": "\u{1F47D}", 1547 "ambulance": "\u{1F691}", 1548 "amphora": "\u{1F3FA}", 1549 "anchor": "\u2693\uFE0F", 1550 "angel": "\u{1F47C}", 1551 "anger": "\u{1F4A2}", 1552 "angry": "\u{1F620}", 1553 "anguished": "\u{1F627}", 1554 "ant": "\u{1F41C}", 1555 "apple": "\u{1F34E}", 1556 "aquarius": "\u2652\uFE0F", 1557 "aries": "\u2648\uFE0F", 1558 "arrow_backward": "\u25C0\uFE0F", 1559 "arrow_double_down": "\u23EC", 1560 "arrow_double_up": "\u23EB", 1561 "arrow_down": "\u2B07\uFE0F", 1562 "arrow_down_small": "\u{1F53D}", 1563 "arrow_forward": "\u25B6\uFE0F", 1564 "arrow_heading_down": "\u2935\uFE0F", 1565 "arrow_heading_up": "\u2934\uFE0F", 1566 "arrow_left": "\u2B05\uFE0F", 1567 "arrow_lower_left": "\u2199\uFE0F", 1568 "arrow_lower_right": "\u2198\uFE0F", 1569 "arrow_right": "\u27A1\uFE0F", 1570 "arrow_right_hook": "\u21AA\uFE0F", 1571 "arrow_up": "\u2B06\uFE0F", 1572 "arrow_up_down": "\u2195\uFE0F", 1573 "arrow_up_small": "\u{1F53C}", 1574 "arrow_upper_left": "\u2196\uFE0F", 1575 "arrow_upper_right": "\u2197\uFE0F", 1576 "arrows_clockwise": "\u{1F503}", 1577 "arrows_counterclockwise": "\u{1F504}", 1578 "art": "\u{1F3A8}", 1579 "articulated_lorry": "\u{1F69B}", 1580 "artificial_satellite": "\u{1F6F0}", 1581 "astonished": "\u{1F632}", 1582 "athletic_shoe": "\u{1F45F}", 1583 "atm": "\u{1F3E7}", 1584 "atom_symbol": "\u269B\uFE0F", 1585 "avocado": "\u{1F951}", 1586 "b": "\u{1F171}\uFE0F", 1587 "baby": "\u{1F476}", 1588 "baby_bottle": "\u{1F37C}", 1589 "baby_chick": "\u{1F424}", 1590 "baby_symbol": "\u{1F6BC}", 1591 "back": "\u{1F519}", 1592 "bacon": "\u{1F953}", 1593 "badminton": "\u{1F3F8}", 1594 "baggage_claim": "\u{1F6C4}", 1595 "baguette_bread": "\u{1F956}", 1596 "balance_scale": "\u2696\uFE0F", 1597 "balloon": "\u{1F388}", 1598 "ballot_box": "\u{1F5F3}", 1599 "ballot_box_with_check": "\u2611\uFE0F", 1600 "bamboo": "\u{1F38D}", 1601 "banana": "\u{1F34C}", 1602 "bangbang": "\u203C\uFE0F", 1603 "bank": "\u{1F3E6}", 1604 "bar_chart": "\u{1F4CA}", 1605 "barber": "\u{1F488}", 1606 "baseball": "\u26BE\uFE0F", 1607 "basketball": "\u{1F3C0}", 1608 "basketball_man": "\u26F9\uFE0F", 1609 "basketball_woman": "\u26F9\uFE0F‍\u2640\uFE0F", 1610 "bat": "\u{1F987}", 1611 "bath": "\u{1F6C0}", 1612 "bathtub": "\u{1F6C1}", 1613 "battery": "\u{1F50B}", 1614 "beach_umbrella": "\u{1F3D6}", 1615 "bear": "\u{1F43B}", 1616 "bed": "\u{1F6CF}", 1617 "bee": "\u{1F41D}", 1618 "beer": "\u{1F37A}", 1619 "beers": "\u{1F37B}", 1620 "beetle": "\u{1F41E}", 1621 "beginner": "\u{1F530}", 1622 "bell": "\u{1F514}", 1623 "bellhop_bell": "\u{1F6CE}", 1624 "bento": "\u{1F371}", 1625 "biking_man": "\u{1F6B4}", 1626 "bike": "\u{1F6B2}", 1627 "biking_woman": "\u{1F6B4}‍\u2640\uFE0F", 1628 "bikini": "\u{1F459}", 1629 "biohazard": "\u2623\uFE0F", 1630 "bird": "\u{1F426}", 1631 "birthday": "\u{1F382}", 1632 "black_circle": "\u26AB\uFE0F", 1633 "black_flag": "\u{1F3F4}", 1634 "black_heart": "\u{1F5A4}", 1635 "black_joker": "\u{1F0CF}", 1636 "black_large_square": "\u2B1B\uFE0F", 1637 "black_medium_small_square": "\u25FE\uFE0F", 1638 "black_medium_square": "\u25FC\uFE0F", 1639 "black_nib": "\u2712\uFE0F", 1640 "black_small_square": "\u25AA\uFE0F", 1641 "black_square_button": "\u{1F532}", 1642 "blonde_man": "\u{1F471}", 1643 "blonde_woman": "\u{1F471}‍\u2640\uFE0F", 1644 "blossom": "\u{1F33C}", 1645 "blowfish": "\u{1F421}", 1646 "blue_book": "\u{1F4D8}", 1647 "blue_car": "\u{1F699}", 1648 "blue_heart": "\u{1F499}", 1649 "blush": "\u{1F60A}", 1650 "boar": "\u{1F417}", 1651 "boat": "\u26F5\uFE0F", 1652 "bomb": "\u{1F4A3}", 1653 "book": "\u{1F4D6}", 1654 "bookmark": "\u{1F516}", 1655 "bookmark_tabs": "\u{1F4D1}", 1656 "books": "\u{1F4DA}", 1657 "boom": "\u{1F4A5}", 1658 "boot": "\u{1F462}", 1659 "bouquet": "\u{1F490}", 1660 "bowing_man": "\u{1F647}", 1661 "bow_and_arrow": "\u{1F3F9}", 1662 "bowing_woman": "\u{1F647}‍\u2640\uFE0F", 1663 "bowling": "\u{1F3B3}", 1664 "boxing_glove": "\u{1F94A}", 1665 "boy": "\u{1F466}", 1666 "bread": "\u{1F35E}", 1667 "bride_with_veil": "\u{1F470}", 1668 "bridge_at_night": "\u{1F309}", 1669 "briefcase": "\u{1F4BC}", 1670 "broken_heart": "\u{1F494}", 1671 "bug": "\u{1F41B}", 1672 "building_construction": "\u{1F3D7}", 1673 "bulb": "\u{1F4A1}", 1674 "bullettrain_front": "\u{1F685}", 1675 "bullettrain_side": "\u{1F684}", 1676 "burrito": "\u{1F32F}", 1677 "bus": "\u{1F68C}", 1678 "business_suit_levitating": "\u{1F574}", 1679 "busstop": "\u{1F68F}", 1680 "bust_in_silhouette": "\u{1F464}", 1681 "busts_in_silhouette": "\u{1F465}", 1682 "butterfly": "\u{1F98B}", 1683 "cactus": "\u{1F335}", 1684 "cake": "\u{1F370}", 1685 "calendar": "\u{1F4C6}", 1686 "call_me_hand": "\u{1F919}", 1687 "calling": "\u{1F4F2}", 1688 "camel": "\u{1F42B}", 1689 "camera": "\u{1F4F7}", 1690 "camera_flash": "\u{1F4F8}", 1691 "camping": "\u{1F3D5}", 1692 "cancer": "\u264B\uFE0F", 1693 "candle": "\u{1F56F}", 1694 "candy": "\u{1F36C}", 1695 "canoe": "\u{1F6F6}", 1696 "capital_abcd": "\u{1F520}", 1697 "capricorn": "\u2651\uFE0F", 1698 "car": "\u{1F697}", 1699 "card_file_box": "\u{1F5C3}", 1700 "card_index": "\u{1F4C7}", 1701 "card_index_dividers": "\u{1F5C2}", 1702 "carousel_horse": "\u{1F3A0}", 1703 "carrot": "\u{1F955}", 1704 "cat": "\u{1F431}", 1705 "cat2": "\u{1F408}", 1706 "cd": "\u{1F4BF}", 1707 "chains": "\u26D3", 1708 "champagne": "\u{1F37E}", 1709 "chart": "\u{1F4B9}", 1710 "chart_with_downwards_trend": "\u{1F4C9}", 1711 "chart_with_upwards_trend": "\u{1F4C8}", 1712 "checkered_flag": "\u{1F3C1}", 1713 "cheese": "\u{1F9C0}", 1714 "cherries": "\u{1F352}", 1715 "cherry_blossom": "\u{1F338}", 1716 "chestnut": "\u{1F330}", 1717 "chicken": "\u{1F414}", 1718 "children_crossing": "\u{1F6B8}", 1719 "chipmunk": "\u{1F43F}", 1720 "chocolate_bar": "\u{1F36B}", 1721 "christmas_tree": "\u{1F384}", 1722 "church": "\u26EA\uFE0F", 1723 "cinema": "\u{1F3A6}", 1724 "circus_tent": "\u{1F3AA}", 1725 "city_sunrise": "\u{1F307}", 1726 "city_sunset": "\u{1F306}", 1727 "cityscape": "\u{1F3D9}", 1728 "cl": "\u{1F191}", 1729 "clamp": "\u{1F5DC}", 1730 "clap": "\u{1F44F}", 1731 "clapper": "\u{1F3AC}", 1732 "classical_building": "\u{1F3DB}", 1733 "clinking_glasses": "\u{1F942}", 1734 "clipboard": "\u{1F4CB}", 1735 "clock1": "\u{1F550}", 1736 "clock10": "\u{1F559}", 1737 "clock1030": "\u{1F565}", 1738 "clock11": "\u{1F55A}", 1739 "clock1130": "\u{1F566}", 1740 "clock12": "\u{1F55B}", 1741 "clock1230": "\u{1F567}", 1742 "clock130": "\u{1F55C}", 1743 "clock2": "\u{1F551}", 1744 "clock230": "\u{1F55D}", 1745 "clock3": "\u{1F552}", 1746 "clock330": "\u{1F55E}", 1747 "clock4": "\u{1F553}", 1748 "clock430": "\u{1F55F}", 1749 "clock5": "\u{1F554}", 1750 "clock530": "\u{1F560}", 1751 "clock6": "\u{1F555}", 1752 "clock630": "\u{1F561}", 1753 "clock7": "\u{1F556}", 1754 "clock730": "\u{1F562}", 1755 "clock8": "\u{1F557}", 1756 "clock830": "\u{1F563}", 1757 "clock9": "\u{1F558}", 1758 "clock930": "\u{1F564}", 1759 "closed_book": "\u{1F4D5}", 1760 "closed_lock_with_key": "\u{1F510}", 1761 "closed_umbrella": "\u{1F302}", 1762 "cloud": "\u2601\uFE0F", 1763 "cloud_with_lightning": "\u{1F329}", 1764 "cloud_with_lightning_and_rain": "\u26C8", 1765 "cloud_with_rain": "\u{1F327}", 1766 "cloud_with_snow": "\u{1F328}", 1767 "clown_face": "\u{1F921}", 1768 "clubs": "\u2663\uFE0F", 1769 "cocktail": "\u{1F378}", 1770 "coffee": "\u2615\uFE0F", 1771 "coffin": "\u26B0\uFE0F", 1772 "cold_sweat": "\u{1F630}", 1773 "comet": "\u2604\uFE0F", 1774 "computer": "\u{1F4BB}", 1775 "computer_mouse": "\u{1F5B1}", 1776 "confetti_ball": "\u{1F38A}", 1777 "confounded": "\u{1F616}", 1778 "confused": "\u{1F615}", 1779 "congratulations": "\u3297\uFE0F", 1780 "construction": "\u{1F6A7}", 1781 "construction_worker_man": "\u{1F477}", 1782 "construction_worker_woman": "\u{1F477}‍\u2640\uFE0F", 1783 "control_knobs": "\u{1F39B}", 1784 "convenience_store": "\u{1F3EA}", 1785 "cookie": "\u{1F36A}", 1786 "cool": "\u{1F192}", 1787 "policeman": "\u{1F46E}", 1788 "copyright": "\xA9\uFE0F", 1789 "corn": "\u{1F33D}", 1790 "couch_and_lamp": "\u{1F6CB}", 1791 "couple": "\u{1F46B}", 1792 "couple_with_heart_woman_man": "\u{1F491}", 1793 "couple_with_heart_man_man": "\u{1F468}‍\u2764\uFE0F‍\u{1F468}", 1794 "couple_with_heart_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F469}", 1795 "couplekiss_man_man": "\u{1F468}‍\u2764\uFE0F‍\u{1F48B}‍\u{1F468}", 1796 "couplekiss_man_woman": "\u{1F48F}", 1797 "couplekiss_woman_woman": "\u{1F469}‍\u2764\uFE0F‍\u{1F48B}‍\u{1F469}", 1798 "cow": "\u{1F42E}", 1799 "cow2": "\u{1F404}", 1800 "cowboy_hat_face": "\u{1F920}", 1801 "crab": "\u{1F980}", 1802 "crayon": "\u{1F58D}", 1803 "credit_card": "\u{1F4B3}", 1804 "crescent_moon": "\u{1F319}", 1805 "cricket": "\u{1F3CF}", 1806 "crocodile": "\u{1F40A}", 1807 "croissant": "\u{1F950}", 1808 "crossed_fingers": "\u{1F91E}", 1809 "crossed_flags": "\u{1F38C}", 1810 "crossed_swords": "\u2694\uFE0F", 1811 "crown": "\u{1F451}", 1812 "cry": "\u{1F622}", 1813 "crying_cat_face": "\u{1F63F}", 1814 "crystal_ball": "\u{1F52E}", 1815 "cucumber": "\u{1F952}", 1816 "cupid": "\u{1F498}", 1817 "curly_loop": "\u27B0", 1818 "currency_exchange": "\u{1F4B1}", 1819 "curry": "\u{1F35B}", 1820 "custard": "\u{1F36E}", 1821 "customs": "\u{1F6C3}", 1822 "cyclone": "\u{1F300}", 1823 "dagger": "\u{1F5E1}", 1824 "dancer": "\u{1F483}", 1825 "dancing_women": "\u{1F46F}", 1826 "dancing_men": "\u{1F46F}‍\u2642\uFE0F", 1827 "dango": "\u{1F361}", 1828 "dark_sunglasses": "\u{1F576}", 1829 "dart": "\u{1F3AF}", 1830 "dash": "\u{1F4A8}", 1831 "date": "\u{1F4C5}", 1832 "deciduous_tree": "\u{1F333}", 1833 "deer": "\u{1F98C}", 1834 "department_store": "\u{1F3EC}", 1835 "derelict_house": "\u{1F3DA}", 1836 "desert": "\u{1F3DC}", 1837 "desert_island": "\u{1F3DD}", 1838 "desktop_computer": "\u{1F5A5}", 1839 "male_detective": "\u{1F575}\uFE0F", 1840 "diamond_shape_with_a_dot_inside": "\u{1F4A0}", 1841 "diamonds": "\u2666\uFE0F", 1842 "disappointed": "\u{1F61E}", 1843 "disappointed_relieved": "\u{1F625}", 1844 "dizzy": "\u{1F4AB}", 1845 "dizzy_face": "\u{1F635}", 1846 "do_not_litter": "\u{1F6AF}", 1847 "dog": "\u{1F436}", 1848 "dog2": "\u{1F415}", 1849 "dollar": "\u{1F4B5}", 1850 "dolls": "\u{1F38E}", 1851 "dolphin": "\u{1F42C}", 1852 "door": "\u{1F6AA}", 1853 "doughnut": "\u{1F369}", 1854 "dove": "\u{1F54A}", 1855 "dragon": "\u{1F409}", 1856 "dragon_face": "\u{1F432}", 1857 "dress": "\u{1F457}", 1858 "dromedary_camel": "\u{1F42A}", 1859 "drooling_face": "\u{1F924}", 1860 "droplet": "\u{1F4A7}", 1861 "drum": "\u{1F941}", 1862 "duck": "\u{1F986}", 1863 "dvd": "\u{1F4C0}", 1864 "e-mail": "\u{1F4E7}", 1865 "eagle": "\u{1F985}", 1866 "ear": "\u{1F442}", 1867 "ear_of_rice": "\u{1F33E}", 1868 "earth_africa": "\u{1F30D}", 1869 "earth_americas": "\u{1F30E}", 1870 "earth_asia": "\u{1F30F}", 1871 "egg": "\u{1F95A}", 1872 "eggplant": "\u{1F346}", 1873 "eight_pointed_black_star": "\u2734\uFE0F", 1874 "eight_spoked_asterisk": "\u2733\uFE0F", 1875 "electric_plug": "\u{1F50C}", 1876 "elephant": "\u{1F418}", 1877 "email": "\u2709\uFE0F", 1878 "end": "\u{1F51A}", 1879 "envelope_with_arrow": "\u{1F4E9}", 1880 "euro": "\u{1F4B6}", 1881 "european_castle": "\u{1F3F0}", 1882 "european_post_office": "\u{1F3E4}", 1883 "evergreen_tree": "\u{1F332}", 1884 "exclamation": "\u2757\uFE0F", 1885 "expressionless": "\u{1F611}", 1886 "eye": "\u{1F441}", 1887 "eye_speech_bubble": "\u{1F441}‍\u{1F5E8}", 1888 "eyeglasses": "\u{1F453}", 1889 "eyes": "\u{1F440}", 1890 "face_with_head_bandage": "\u{1F915}", 1891 "face_with_thermometer": "\u{1F912}", 1892 "fist_oncoming": "\u{1F44A}", 1893 "factory": "\u{1F3ED}", 1894 "fallen_leaf": "\u{1F342}", 1895 "family_man_woman_boy": "\u{1F46A}", 1896 "family_man_boy": "\u{1F468}‍\u{1F466}", 1897 "family_man_boy_boy": "\u{1F468}‍\u{1F466}‍\u{1F466}", 1898 "family_man_girl": "\u{1F468}‍\u{1F467}", 1899 "family_man_girl_boy": "\u{1F468}‍\u{1F467}‍\u{1F466}", 1900 "family_man_girl_girl": "\u{1F468}‍\u{1F467}‍\u{1F467}", 1901 "family_man_man_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}", 1902 "family_man_man_boy_boy": "\u{1F468}‍\u{1F468}‍\u{1F466}‍\u{1F466}", 1903 "family_man_man_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}", 1904 "family_man_man_girl_boy": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F466}", 1905 "family_man_man_girl_girl": "\u{1F468}‍\u{1F468}‍\u{1F467}‍\u{1F467}", 1906 "family_man_woman_boy_boy": "\u{1F468}‍\u{1F469}‍\u{1F466}‍\u{1F466}", 1907 "family_man_woman_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}", 1908 "family_man_woman_girl_boy": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F466}", 1909 "family_man_woman_girl_girl": "\u{1F468}‍\u{1F469}‍\u{1F467}‍\u{1F467}", 1910 "family_woman_boy": "\u{1F469}‍\u{1F466}", 1911 "family_woman_boy_boy": "\u{1F469}‍\u{1F466}‍\u{1F466}", 1912 "family_woman_girl": "\u{1F469}‍\u{1F467}", 1913 "family_woman_girl_boy": "\u{1F469}‍\u{1F467}‍\u{1F466}", 1914 "family_woman_girl_girl": "\u{1F469}‍\u{1F467}‍\u{1F467}", 1915 "family_woman_woman_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}", 1916 "family_woman_woman_boy_boy": "\u{1F469}‍\u{1F469}‍\u{1F466}‍\u{1F466}", 1917 "family_woman_woman_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}", 1918 "family_woman_woman_girl_boy": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F466}", 1919 "family_woman_woman_girl_girl": "\u{1F469}‍\u{1F469}‍\u{1F467}‍\u{1F467}", 1920 "fast_forward": "\u23E9", 1921 "fax": "\u{1F4E0}", 1922 "fearful": "\u{1F628}", 1923 "feet": "\u{1F43E}", 1924 "female_detective": "\u{1F575}\uFE0F‍\u2640\uFE0F", 1925 "ferris_wheel": "\u{1F3A1}", 1926 "ferry": "\u26F4", 1927 "field_hockey": "\u{1F3D1}", 1928 "file_cabinet": "\u{1F5C4}", 1929 "file_folder": "\u{1F4C1}", 1930 "film_projector": "\u{1F4FD}", 1931 "film_strip": "\u{1F39E}", 1932 "fire": "\u{1F525}", 1933 "fire_engine": "\u{1F692}", 1934 "fireworks": "\u{1F386}", 1935 "first_quarter_moon": "\u{1F313}", 1936 "first_quarter_moon_with_face": "\u{1F31B}", 1937 "fish": "\u{1F41F}", 1938 "fish_cake": "\u{1F365}", 1939 "fishing_pole_and_fish": "\u{1F3A3}", 1940 "fist_raised": "\u270A", 1941 "fist_left": "\u{1F91B}", 1942 "fist_right": "\u{1F91C}", 1943 "flags": "\u{1F38F}", 1944 "flashlight": "\u{1F526}", 1945 "fleur_de_lis": "\u269C\uFE0F", 1946 "flight_arrival": "\u{1F6EC}", 1947 "flight_departure": "\u{1F6EB}", 1948 "floppy_disk": "\u{1F4BE}", 1949 "flower_playing_cards": "\u{1F3B4}", 1950 "flushed": "\u{1F633}", 1951 "fog": "\u{1F32B}", 1952 "foggy": "\u{1F301}", 1953 "football": "\u{1F3C8}", 1954 "footprints": "\u{1F463}", 1955 "fork_and_knife": "\u{1F374}", 1956 "fountain": "\u26F2\uFE0F", 1957 "fountain_pen": "\u{1F58B}", 1958 "four_leaf_clover": "\u{1F340}", 1959 "fox_face": "\u{1F98A}", 1960 "framed_picture": "\u{1F5BC}", 1961 "free": "\u{1F193}", 1962 "fried_egg": "\u{1F373}", 1963 "fried_shrimp": "\u{1F364}", 1964 "fries": "\u{1F35F}", 1965 "frog": "\u{1F438}", 1966 "frowning": "\u{1F626}", 1967 "frowning_face": "\u2639\uFE0F", 1968 "frowning_man": "\u{1F64D}‍\u2642\uFE0F", 1969 "frowning_woman": "\u{1F64D}", 1970 "middle_finger": "\u{1F595}", 1971 "fuelpump": "\u26FD\uFE0F", 1972 "full_moon": "\u{1F315}", 1973 "full_moon_with_face": "\u{1F31D}", 1974 "funeral_urn": "\u26B1\uFE0F", 1975 "game_die": "\u{1F3B2}", 1976 "gear": "\u2699\uFE0F", 1977 "gem": "\u{1F48E}", 1978 "gemini": "\u264A\uFE0F", 1979 "ghost": "\u{1F47B}", 1980 "gift": "\u{1F381}", 1981 "gift_heart": "\u{1F49D}", 1982 "girl": "\u{1F467}", 1983 "globe_with_meridians": "\u{1F310}", 1984 "goal_net": "\u{1F945}", 1985 "goat": "\u{1F410}", 1986 "golf": "\u26F3\uFE0F", 1987 "golfing_man": "\u{1F3CC}\uFE0F", 1988 "golfing_woman": "\u{1F3CC}\uFE0F‍\u2640\uFE0F", 1989 "gorilla": "\u{1F98D}", 1990 "grapes": "\u{1F347}", 1991 "green_apple": "\u{1F34F}", 1992 "green_book": "\u{1F4D7}", 1993 "green_heart": "\u{1F49A}", 1994 "green_salad": "\u{1F957}", 1995 "grey_exclamation": "\u2755", 1996 "grey_question": "\u2754", 1997 "grimacing": "\u{1F62C}", 1998 "grin": "\u{1F601}", 1999 "grinning": "\u{1F600}", 2000 "guardsman": "\u{1F482}", 2001 "guardswoman": "\u{1F482}‍\u2640\uFE0F", 2002 "guitar": "\u{1F3B8}", 2003 "gun": "\u{1F52B}", 2004 "haircut_woman": "\u{1F487}", 2005 "haircut_man": "\u{1F487}‍\u2642\uFE0F", 2006 "hamburger": "\u{1F354}", 2007 "hammer": "\u{1F528}", 2008 "hammer_and_pick": "\u2692", 2009 "hammer_and_wrench": "\u{1F6E0}", 2010 "hamster": "\u{1F439}", 2011 "hand": "\u270B", 2012 "handbag": "\u{1F45C}", 2013 "handshake": "\u{1F91D}", 2014 "hankey": "\u{1F4A9}", 2015 "hatched_chick": "\u{1F425}", 2016 "hatching_chick": "\u{1F423}", 2017 "headphones": "\u{1F3A7}", 2018 "hear_no_evil": "\u{1F649}", 2019 "heart": "\u2764\uFE0F", 2020 "heart_decoration": "\u{1F49F}", 2021 "heart_eyes": "\u{1F60D}", 2022 "heart_eyes_cat": "\u{1F63B}", 2023 "heartbeat": "\u{1F493}", 2024 "heartpulse": "\u{1F497}", 2025 "hearts": "\u2665\uFE0F", 2026 "heavy_check_mark": "\u2714\uFE0F", 2027 "heavy_division_sign": "\u2797", 2028 "heavy_dollar_sign": "\u{1F4B2}", 2029 "heavy_heart_exclamation": "\u2763\uFE0F", 2030 "heavy_minus_sign": "\u2796", 2031 "heavy_multiplication_x": "\u2716\uFE0F", 2032 "heavy_plus_sign": "\u2795", 2033 "helicopter": "\u{1F681}", 2034 "herb": "\u{1F33F}", 2035 "hibiscus": "\u{1F33A}", 2036 "high_brightness": "\u{1F506}", 2037 "high_heel": "\u{1F460}", 2038 "hocho": "\u{1F52A}", 2039 "hole": "\u{1F573}", 2040 "honey_pot": "\u{1F36F}", 2041 "horse": "\u{1F434}", 2042 "horse_racing": "\u{1F3C7}", 2043 "hospital": "\u{1F3E5}", 2044 "hot_pepper": "\u{1F336}", 2045 "hotdog": "\u{1F32D}", 2046 "hotel": "\u{1F3E8}", 2047 "hotsprings": "\u2668\uFE0F", 2048 "hourglass": "\u231B\uFE0F", 2049 "hourglass_flowing_sand": "\u23F3", 2050 "house": "\u{1F3E0}", 2051 "house_with_garden": "\u{1F3E1}", 2052 "houses": "\u{1F3D8}", 2053 "hugs": "\u{1F917}", 2054 "hushed": "\u{1F62F}", 2055 "ice_cream": "\u{1F368}", 2056 "ice_hockey": "\u{1F3D2}", 2057 "ice_skate": "\u26F8", 2058 "icecream": "\u{1F366}", 2059 "id": "\u{1F194}", 2060 "ideograph_advantage": "\u{1F250}", 2061 "imp": "\u{1F47F}", 2062 "inbox_tray": "\u{1F4E5}", 2063 "incoming_envelope": "\u{1F4E8}", 2064 "tipping_hand_woman": "\u{1F481}", 2065 "information_source": "\u2139\uFE0F", 2066 "innocent": "\u{1F607}", 2067 "interrobang": "\u2049\uFE0F", 2068 "iphone": "\u{1F4F1}", 2069 "izakaya_lantern": "\u{1F3EE}", 2070 "jack_o_lantern": "\u{1F383}", 2071 "japan": "\u{1F5FE}", 2072 "japanese_castle": "\u{1F3EF}", 2073 "japanese_goblin": "\u{1F47A}", 2074 "japanese_ogre": "\u{1F479}", 2075 "jeans": "\u{1F456}", 2076 "joy": "\u{1F602}", 2077 "joy_cat": "\u{1F639}", 2078 "joystick": "\u{1F579}", 2079 "kaaba": "\u{1F54B}", 2080 "key": "\u{1F511}", 2081 "keyboard": "\u2328\uFE0F", 2082 "keycap_ten": "\u{1F51F}", 2083 "kick_scooter": "\u{1F6F4}", 2084 "kimono": "\u{1F458}", 2085 "kiss": "\u{1F48B}", 2086 "kissing": "\u{1F617}", 2087 "kissing_cat": "\u{1F63D}", 2088 "kissing_closed_eyes": "\u{1F61A}", 2089 "kissing_heart": "\u{1F618}", 2090 "kissing_smiling_eyes": "\u{1F619}", 2091 "kiwi_fruit": "\u{1F95D}", 2092 "koala": "\u{1F428}", 2093 "koko": "\u{1F201}", 2094 "label": "\u{1F3F7}", 2095 "large_blue_circle": "\u{1F535}", 2096 "large_blue_diamond": "\u{1F537}", 2097 "large_orange_diamond": "\u{1F536}", 2098 "last_quarter_moon": "\u{1F317}", 2099 "last_quarter_moon_with_face": "\u{1F31C}", 2100 "latin_cross": "\u271D\uFE0F", 2101 "laughing": "\u{1F606}", 2102 "leaves": "\u{1F343}", 2103 "ledger": "\u{1F4D2}", 2104 "left_luggage": "\u{1F6C5}", 2105 "left_right_arrow": "\u2194\uFE0F", 2106 "leftwards_arrow_with_hook": "\u21A9\uFE0F", 2107 "lemon": "\u{1F34B}", 2108 "leo": "\u264C\uFE0F", 2109 "leopard": "\u{1F406}", 2110 "level_slider": "\u{1F39A}", 2111 "libra": "\u264E\uFE0F", 2112 "light_rail": "\u{1F688}", 2113 "link": "\u{1F517}", 2114 "lion": "\u{1F981}", 2115 "lips": "\u{1F444}", 2116 "lipstick": "\u{1F484}", 2117 "lizard": "\u{1F98E}", 2118 "lock": "\u{1F512}", 2119 "lock_with_ink_pen": "\u{1F50F}", 2120 "lollipop": "\u{1F36D}", 2121 "loop": "\u27BF", 2122 "loud_sound": "\u{1F50A}", 2123 "loudspeaker": "\u{1F4E2}", 2124 "love_hotel": "\u{1F3E9}", 2125 "love_letter": "\u{1F48C}", 2126 "low_brightness": "\u{1F505}", 2127 "lying_face": "\u{1F925}", 2128 "m": "\u24C2\uFE0F", 2129 "mag": "\u{1F50D}", 2130 "mag_right": "\u{1F50E}", 2131 "mahjong": "\u{1F004}\uFE0F", 2132 "mailbox": "\u{1F4EB}", 2133 "mailbox_closed": "\u{1F4EA}", 2134 "mailbox_with_mail": "\u{1F4EC}", 2135 "mailbox_with_no_mail": "\u{1F4ED}", 2136 "man": "\u{1F468}", 2137 "man_artist": "\u{1F468}‍\u{1F3A8}", 2138 "man_astronaut": "\u{1F468}‍\u{1F680}", 2139 "man_cartwheeling": "\u{1F938}‍\u2642\uFE0F", 2140 "man_cook": "\u{1F468}‍\u{1F373}", 2141 "man_dancing": "\u{1F57A}", 2142 "man_facepalming": "\u{1F926}‍\u2642\uFE0F", 2143 "man_factory_worker": "\u{1F468}‍\u{1F3ED}", 2144 "man_farmer": "\u{1F468}‍\u{1F33E}", 2145 "man_firefighter": "\u{1F468}‍\u{1F692}", 2146 "man_health_worker": "\u{1F468}‍\u2695\uFE0F", 2147 "man_in_tuxedo": "\u{1F935}", 2148 "man_judge": "\u{1F468}‍\u2696\uFE0F", 2149 "man_juggling": "\u{1F939}‍\u2642\uFE0F", 2150 "man_mechanic": "\u{1F468}‍\u{1F527}", 2151 "man_office_worker": "\u{1F468}‍\u{1F4BC}", 2152 "man_pilot": "\u{1F468}‍\u2708\uFE0F", 2153 "man_playing_handball": "\u{1F93E}‍\u2642\uFE0F", 2154 "man_playing_water_polo": "\u{1F93D}‍\u2642\uFE0F", 2155 "man_scientist": "\u{1F468}‍\u{1F52C}", 2156 "man_shrugging": "\u{1F937}‍\u2642\uFE0F", 2157 "man_singer": "\u{1F468}‍\u{1F3A4}", 2158 "man_student": "\u{1F468}‍\u{1F393}", 2159 "man_teacher": "\u{1F468}‍\u{1F3EB}", 2160 "man_technologist": "\u{1F468}‍\u{1F4BB}", 2161 "man_with_gua_pi_mao": "\u{1F472}", 2162 "man_with_turban": "\u{1F473}", 2163 "tangerine": "\u{1F34A}", 2164 "mans_shoe": "\u{1F45E}", 2165 "mantelpiece_clock": "\u{1F570}", 2166 "maple_leaf": "\u{1F341}", 2167 "martial_arts_uniform": "\u{1F94B}", 2168 "mask": "\u{1F637}", 2169 "massage_woman": "\u{1F486}", 2170 "massage_man": "\u{1F486}‍\u2642\uFE0F", 2171 "meat_on_bone": "\u{1F356}", 2172 "medal_military": "\u{1F396}", 2173 "medal_sports": "\u{1F3C5}", 2174 "mega": "\u{1F4E3}", 2175 "melon": "\u{1F348}", 2176 "memo": "\u{1F4DD}", 2177 "men_wrestling": "\u{1F93C}‍\u2642\uFE0F", 2178 "menorah": "\u{1F54E}", 2179 "mens": "\u{1F6B9}", 2180 "metal": "\u{1F918}", 2181 "metro": "\u{1F687}", 2182 "microphone": "\u{1F3A4}", 2183 "microscope": "\u{1F52C}", 2184 "milk_glass": "\u{1F95B}", 2185 "milky_way": "\u{1F30C}", 2186 "minibus": "\u{1F690}", 2187 "minidisc": "\u{1F4BD}", 2188 "mobile_phone_off": "\u{1F4F4}", 2189 "money_mouth_face": "\u{1F911}", 2190 "money_with_wings": "\u{1F4B8}", 2191 "moneybag": "\u{1F4B0}", 2192 "monkey": "\u{1F412}", 2193 "monkey_face": "\u{1F435}", 2194 "monorail": "\u{1F69D}", 2195 "moon": "\u{1F314}", 2196 "mortar_board": "\u{1F393}", 2197 "mosque": "\u{1F54C}", 2198 "motor_boat": "\u{1F6E5}", 2199 "motor_scooter": "\u{1F6F5}", 2200 "motorcycle": "\u{1F3CD}", 2201 "motorway": "\u{1F6E3}", 2202 "mount_fuji": "\u{1F5FB}", 2203 "mountain": "\u26F0", 2204 "mountain_biking_man": "\u{1F6B5}", 2205 "mountain_biking_woman": "\u{1F6B5}‍\u2640\uFE0F", 2206 "mountain_cableway": "\u{1F6A0}", 2207 "mountain_railway": "\u{1F69E}", 2208 "mountain_snow": "\u{1F3D4}", 2209 "mouse": "\u{1F42D}", 2210 "mouse2": "\u{1F401}", 2211 "movie_camera": "\u{1F3A5}", 2212 "moyai": "\u{1F5FF}", 2213 "mrs_claus": "\u{1F936}", 2214 "muscle": "\u{1F4AA}", 2215 "mushroom": "\u{1F344}", 2216 "musical_keyboard": "\u{1F3B9}", 2217 "musical_note": "\u{1F3B5}", 2218 "musical_score": "\u{1F3BC}", 2219 "mute": "\u{1F507}", 2220 "nail_care": "\u{1F485}", 2221 "name_badge": "\u{1F4DB}", 2222 "national_park": "\u{1F3DE}", 2223 "nauseated_face": "\u{1F922}", 2224 "necktie": "\u{1F454}", 2225 "negative_squared_cross_mark": "\u274E", 2226 "nerd_face": "\u{1F913}", 2227 "neutral_face": "\u{1F610}", 2228 "new": "\u{1F195}", 2229 "new_moon": "\u{1F311}", 2230 "new_moon_with_face": "\u{1F31A}", 2231 "newspaper": "\u{1F4F0}", 2232 "newspaper_roll": "\u{1F5DE}", 2233 "next_track_button": "\u23ED", 2234 "ng": "\u{1F196}", 2235 "no_good_man": "\u{1F645}‍\u2642\uFE0F", 2236 "no_good_woman": "\u{1F645}", 2237 "night_with_stars": "\u{1F303}", 2238 "no_bell": "\u{1F515}", 2239 "no_bicycles": "\u{1F6B3}", 2240 "no_entry": "\u26D4\uFE0F", 2241 "no_entry_sign": "\u{1F6AB}", 2242 "no_mobile_phones": "\u{1F4F5}", 2243 "no_mouth": "\u{1F636}", 2244 "no_pedestrians": "\u{1F6B7}", 2245 "no_smoking": "\u{1F6AD}", 2246 "non-potable_water": "\u{1F6B1}", 2247 "nose": "\u{1F443}", 2248 "notebook": "\u{1F4D3}", 2249 "notebook_with_decorative_cover": "\u{1F4D4}", 2250 "notes": "\u{1F3B6}", 2251 "nut_and_bolt": "\u{1F529}", 2252 "o": "\u2B55\uFE0F", 2253 "o2": "\u{1F17E}\uFE0F", 2254 "ocean": "\u{1F30A}", 2255 "octopus": "\u{1F419}", 2256 "oden": "\u{1F362}", 2257 "office": "\u{1F3E2}", 2258 "oil_drum": "\u{1F6E2}", 2259 "ok": "\u{1F197}", 2260 "ok_hand": "\u{1F44C}", 2261 "ok_man": "\u{1F646}‍\u2642\uFE0F", 2262 "ok_woman": "\u{1F646}", 2263 "old_key": "\u{1F5DD}", 2264 "older_man": "\u{1F474}", 2265 "older_woman": "\u{1F475}", 2266 "om": "\u{1F549}", 2267 "on": "\u{1F51B}", 2268 "oncoming_automobile": "\u{1F698}", 2269 "oncoming_bus": "\u{1F68D}", 2270 "oncoming_police_car": "\u{1F694}", 2271 "oncoming_taxi": "\u{1F696}", 2272 "open_file_folder": "\u{1F4C2}", 2273 "open_hands": "\u{1F450}", 2274 "open_mouth": "\u{1F62E}", 2275 "open_umbrella": "\u2602\uFE0F", 2276 "ophiuchus": "\u26CE", 2277 "orange_book": "\u{1F4D9}", 2278 "orthodox_cross": "\u2626\uFE0F", 2279 "outbox_tray": "\u{1F4E4}", 2280 "owl": "\u{1F989}", 2281 "ox": "\u{1F402}", 2282 "package": "\u{1F4E6}", 2283 "page_facing_up": "\u{1F4C4}", 2284 "page_with_curl": "\u{1F4C3}", 2285 "pager": "\u{1F4DF}", 2286 "paintbrush": "\u{1F58C}", 2287 "palm_tree": "\u{1F334}", 2288 "pancakes": "\u{1F95E}", 2289 "panda_face": "\u{1F43C}", 2290 "paperclip": "\u{1F4CE}", 2291 "paperclips": "\u{1F587}", 2292 "parasol_on_ground": "\u26F1", 2293 "parking": "\u{1F17F}\uFE0F", 2294 "part_alternation_mark": "\u303D\uFE0F", 2295 "partly_sunny": "\u26C5\uFE0F", 2296 "passenger_ship": "\u{1F6F3}", 2297 "passport_control": "\u{1F6C2}", 2298 "pause_button": "\u23F8", 2299 "peace_symbol": "\u262E\uFE0F", 2300 "peach": "\u{1F351}", 2301 "peanuts": "\u{1F95C}", 2302 "pear": "\u{1F350}", 2303 "pen": "\u{1F58A}", 2304 "pencil2": "\u270F\uFE0F", 2305 "penguin": "\u{1F427}", 2306 "pensive": "\u{1F614}", 2307 "performing_arts": "\u{1F3AD}", 2308 "persevere": "\u{1F623}", 2309 "person_fencing": "\u{1F93A}", 2310 "pouting_woman": "\u{1F64E}", 2311 "phone": "\u260E\uFE0F", 2312 "pick": "\u26CF", 2313 "pig": "\u{1F437}", 2314 "pig2": "\u{1F416}", 2315 "pig_nose": "\u{1F43D}", 2316 "pill": "\u{1F48A}", 2317 "pineapple": "\u{1F34D}", 2318 "ping_pong": "\u{1F3D3}", 2319 "pisces": "\u2653\uFE0F", 2320 "pizza": "\u{1F355}", 2321 "place_of_worship": "\u{1F6D0}", 2322 "plate_with_cutlery": "\u{1F37D}", 2323 "play_or_pause_button": "\u23EF", 2324 "point_down": "\u{1F447}", 2325 "point_left": "\u{1F448}", 2326 "point_right": "\u{1F449}", 2327 "point_up": "\u261D\uFE0F", 2328 "point_up_2": "\u{1F446}", 2329 "police_car": "\u{1F693}", 2330 "policewoman": "\u{1F46E}‍\u2640\uFE0F", 2331 "poodle": "\u{1F429}", 2332 "popcorn": "\u{1F37F}", 2333 "post_office": "\u{1F3E3}", 2334 "postal_horn": "\u{1F4EF}", 2335 "postbox": "\u{1F4EE}", 2336 "potable_water": "\u{1F6B0}", 2337 "potato": "\u{1F954}", 2338 "pouch": "\u{1F45D}", 2339 "poultry_leg": "\u{1F357}", 2340 "pound": "\u{1F4B7}", 2341 "rage": "\u{1F621}", 2342 "pouting_cat": "\u{1F63E}", 2343 "pouting_man": "\u{1F64E}‍\u2642\uFE0F", 2344 "pray": "\u{1F64F}", 2345 "prayer_beads": "\u{1F4FF}", 2346 "pregnant_woman": "\u{1F930}", 2347 "previous_track_button": "\u23EE", 2348 "prince": "\u{1F934}", 2349 "princess": "\u{1F478}", 2350 "printer": "\u{1F5A8}", 2351 "purple_heart": "\u{1F49C}", 2352 "purse": "\u{1F45B}", 2353 "pushpin": "\u{1F4CC}", 2354 "put_litter_in_its_place": "\u{1F6AE}", 2355 "question": "\u2753", 2356 "rabbit": "\u{1F430}", 2357 "rabbit2": "\u{1F407}", 2358 "racehorse": "\u{1F40E}", 2359 "racing_car": "\u{1F3CE}", 2360 "radio": "\u{1F4FB}", 2361 "radio_button": "\u{1F518}", 2362 "radioactive": "\u2622\uFE0F", 2363 "railway_car": "\u{1F683}", 2364 "railway_track": "\u{1F6E4}", 2365 "rainbow": "\u{1F308}", 2366 "rainbow_flag": "\u{1F3F3}\uFE0F‍\u{1F308}", 2367 "raised_back_of_hand": "\u{1F91A}", 2368 "raised_hand_with_fingers_splayed": "\u{1F590}", 2369 "raised_hands": "\u{1F64C}", 2370 "raising_hand_woman": "\u{1F64B}", 2371 "raising_hand_man": "\u{1F64B}‍\u2642\uFE0F", 2372 "ram": "\u{1F40F}", 2373 "ramen": "\u{1F35C}", 2374 "rat": "\u{1F400}", 2375 "record_button": "\u23FA", 2376 "recycle": "\u267B\uFE0F", 2377 "red_circle": "\u{1F534}", 2378 "registered": "\xAE\uFE0F", 2379 "relaxed": "\u263A\uFE0F", 2380 "relieved": "\u{1F60C}", 2381 "reminder_ribbon": "\u{1F397}", 2382 "repeat": "\u{1F501}", 2383 "repeat_one": "\u{1F502}", 2384 "rescue_worker_helmet": "\u26D1", 2385 "restroom": "\u{1F6BB}", 2386 "revolving_hearts": "\u{1F49E}", 2387 "rewind": "\u23EA", 2388 "rhinoceros": "\u{1F98F}", 2389 "ribbon": "\u{1F380}", 2390 "rice": "\u{1F35A}", 2391 "rice_ball": "\u{1F359}", 2392 "rice_cracker": "\u{1F358}", 2393 "rice_scene": "\u{1F391}", 2394 "right_anger_bubble": "\u{1F5EF}", 2395 "ring": "\u{1F48D}", 2396 "robot": "\u{1F916}", 2397 "rocket": "\u{1F680}", 2398 "rofl": "\u{1F923}", 2399 "roll_eyes": "\u{1F644}", 2400 "roller_coaster": "\u{1F3A2}", 2401 "rooster": "\u{1F413}", 2402 "rose": "\u{1F339}", 2403 "rosette": "\u{1F3F5}", 2404 "rotating_light": "\u{1F6A8}", 2405 "round_pushpin": "\u{1F4CD}", 2406 "rowing_man": "\u{1F6A3}", 2407 "rowing_woman": "\u{1F6A3}‍\u2640\uFE0F", 2408 "rugby_football": "\u{1F3C9}", 2409 "running_man": "\u{1F3C3}", 2410 "running_shirt_with_sash": "\u{1F3BD}", 2411 "running_woman": "\u{1F3C3}‍\u2640\uFE0F", 2412 "sa": "\u{1F202}\uFE0F", 2413 "sagittarius": "\u2650\uFE0F", 2414 "sake": "\u{1F376}", 2415 "sandal": "\u{1F461}", 2416 "santa": "\u{1F385}", 2417 "satellite": "\u{1F4E1}", 2418 "saxophone": "\u{1F3B7}", 2419 "school": "\u{1F3EB}", 2420 "school_satchel": "\u{1F392}", 2421 "scissors": "\u2702\uFE0F", 2422 "scorpion": "\u{1F982}", 2423 "scorpius": "\u264F\uFE0F", 2424 "scream": "\u{1F631}", 2425 "scream_cat": "\u{1F640}", 2426 "scroll": "\u{1F4DC}", 2427 "seat": "\u{1F4BA}", 2428 "secret": "\u3299\uFE0F", 2429 "see_no_evil": "\u{1F648}", 2430 "seedling": "\u{1F331}", 2431 "selfie": "\u{1F933}", 2432 "shallow_pan_of_food": "\u{1F958}", 2433 "shamrock": "\u2618\uFE0F", 2434 "shark": "\u{1F988}", 2435 "shaved_ice": "\u{1F367}", 2436 "sheep": "\u{1F411}", 2437 "shell": "\u{1F41A}", 2438 "shield": "\u{1F6E1}", 2439 "shinto_shrine": "\u26E9", 2440 "ship": "\u{1F6A2}", 2441 "shirt": "\u{1F455}", 2442 "shopping": "\u{1F6CD}", 2443 "shopping_cart": "\u{1F6D2}", 2444 "shower": "\u{1F6BF}", 2445 "shrimp": "\u{1F990}", 2446 "signal_strength": "\u{1F4F6}", 2447 "six_pointed_star": "\u{1F52F}", 2448 "ski": "\u{1F3BF}", 2449 "skier": "\u26F7", 2450 "skull": "\u{1F480}", 2451 "skull_and_crossbones": "\u2620\uFE0F", 2452 "sleeping": "\u{1F634}", 2453 "sleeping_bed": "\u{1F6CC}", 2454 "sleepy": "\u{1F62A}", 2455 "slightly_frowning_face": "\u{1F641}", 2456 "slightly_smiling_face": "\u{1F642}", 2457 "slot_machine": "\u{1F3B0}", 2458 "small_airplane": "\u{1F6E9}", 2459 "small_blue_diamond": "\u{1F539}", 2460 "small_orange_diamond": "\u{1F538}", 2461 "small_red_triangle": "\u{1F53A}", 2462 "small_red_triangle_down": "\u{1F53B}", 2463 "smile": "\u{1F604}", 2464 "smile_cat": "\u{1F638}", 2465 "smiley": "\u{1F603}", 2466 "smiley_cat": "\u{1F63A}", 2467 "smiling_imp": "\u{1F608}", 2468 "smirk": "\u{1F60F}", 2469 "smirk_cat": "\u{1F63C}", 2470 "smoking": "\u{1F6AC}", 2471 "snail": "\u{1F40C}", 2472 "snake": "\u{1F40D}", 2473 "sneezing_face": "\u{1F927}", 2474 "snowboarder": "\u{1F3C2}", 2475 "snowflake": "\u2744\uFE0F", 2476 "snowman": "\u26C4\uFE0F", 2477 "snowman_with_snow": "\u2603\uFE0F", 2478 "sob": "\u{1F62D}", 2479 "soccer": "\u26BD\uFE0F", 2480 "soon": "\u{1F51C}", 2481 "sos": "\u{1F198}", 2482 "sound": "\u{1F509}", 2483 "space_invader": "\u{1F47E}", 2484 "spades": "\u2660\uFE0F", 2485 "spaghetti": "\u{1F35D}", 2486 "sparkle": "\u2747\uFE0F", 2487 "sparkler": "\u{1F387}", 2488 "sparkles": "\u2728", 2489 "sparkling_heart": "\u{1F496}", 2490 "speak_no_evil": "\u{1F64A}", 2491 "speaker": "\u{1F508}", 2492 "speaking_head": "\u{1F5E3}", 2493 "speech_balloon": "\u{1F4AC}", 2494 "speedboat": "\u{1F6A4}", 2495 "spider": "\u{1F577}", 2496 "spider_web": "\u{1F578}", 2497 "spiral_calendar": "\u{1F5D3}", 2498 "spiral_notepad": "\u{1F5D2}", 2499 "spoon": "\u{1F944}", 2500 "squid": "\u{1F991}", 2501 "stadium": "\u{1F3DF}", 2502 "star": "\u2B50\uFE0F", 2503 "star2": "\u{1F31F}", 2504 "star_and_crescent": "\u262A\uFE0F", 2505 "star_of_david": "\u2721\uFE0F", 2506 "stars": "\u{1F320}", 2507 "station": "\u{1F689}", 2508 "statue_of_liberty": "\u{1F5FD}", 2509 "steam_locomotive": "\u{1F682}", 2510 "stew": "\u{1F372}", 2511 "stop_button": "\u23F9", 2512 "stop_sign": "\u{1F6D1}", 2513 "stopwatch": "\u23F1", 2514 "straight_ruler": "\u{1F4CF}", 2515 "strawberry": "\u{1F353}", 2516 "stuck_out_tongue": "\u{1F61B}", 2517 "stuck_out_tongue_closed_eyes": "\u{1F61D}", 2518 "stuck_out_tongue_winking_eye": "\u{1F61C}", 2519 "studio_microphone": "\u{1F399}", 2520 "stuffed_flatbread": "\u{1F959}", 2521 "sun_behind_large_cloud": "\u{1F325}", 2522 "sun_behind_rain_cloud": "\u{1F326}", 2523 "sun_behind_small_cloud": "\u{1F324}", 2524 "sun_with_face": "\u{1F31E}", 2525 "sunflower": "\u{1F33B}", 2526 "sunglasses": "\u{1F60E}", 2527 "sunny": "\u2600\uFE0F", 2528 "sunrise": "\u{1F305}", 2529 "sunrise_over_mountains": "\u{1F304}", 2530 "surfing_man": "\u{1F3C4}", 2531 "surfing_woman": "\u{1F3C4}‍\u2640\uFE0F", 2532 "sushi": "\u{1F363}", 2533 "suspension_railway": "\u{1F69F}", 2534 "sweat": "\u{1F613}", 2535 "sweat_drops": "\u{1F4A6}", 2536 "sweat_smile": "\u{1F605}", 2537 "sweet_potato": "\u{1F360}", 2538 "swimming_man": "\u{1F3CA}", 2539 "swimming_woman": "\u{1F3CA}‍\u2640\uFE0F", 2540 "symbols": "\u{1F523}", 2541 "synagogue": "\u{1F54D}", 2542 "syringe": "\u{1F489}", 2543 "taco": "\u{1F32E}", 2544 "tada": "\u{1F389}", 2545 "tanabata_tree": "\u{1F38B}", 2546 "taurus": "\u2649\uFE0F", 2547 "taxi": "\u{1F695}", 2548 "tea": "\u{1F375}", 2549 "telephone_receiver": "\u{1F4DE}", 2550 "telescope": "\u{1F52D}", 2551 "tennis": "\u{1F3BE}", 2552 "tent": "\u26FA\uFE0F", 2553 "thermometer": "\u{1F321}", 2554 "thinking": "\u{1F914}", 2555 "thought_balloon": "\u{1F4AD}", 2556 "ticket": "\u{1F3AB}", 2557 "tickets": "\u{1F39F}", 2558 "tiger": "\u{1F42F}", 2559 "tiger2": "\u{1F405}", 2560 "timer_clock": "\u23F2", 2561 "tipping_hand_man": "\u{1F481}‍\u2642\uFE0F", 2562 "tired_face": "\u{1F62B}", 2563 "tm": "\u2122\uFE0F", 2564 "toilet": "\u{1F6BD}", 2565 "tokyo_tower": "\u{1F5FC}", 2566 "tomato": "\u{1F345}", 2567 "tongue": "\u{1F445}", 2568 "top": "\u{1F51D}", 2569 "tophat": "\u{1F3A9}", 2570 "tornado": "\u{1F32A}", 2571 "trackball": "\u{1F5B2}", 2572 "tractor": "\u{1F69C}", 2573 "traffic_light": "\u{1F6A5}", 2574 "train": "\u{1F68B}", 2575 "train2": "\u{1F686}", 2576 "tram": "\u{1F68A}", 2577 "triangular_flag_on_post": "\u{1F6A9}", 2578 "triangular_ruler": "\u{1F4D0}", 2579 "trident": "\u{1F531}", 2580 "triumph": "\u{1F624}", 2581 "trolleybus": "\u{1F68E}", 2582 "trophy": "\u{1F3C6}", 2583 "tropical_drink": "\u{1F379}", 2584 "tropical_fish": "\u{1F420}", 2585 "truck": "\u{1F69A}", 2586 "trumpet": "\u{1F3BA}", 2587 "tulip": "\u{1F337}", 2588 "tumbler_glass": "\u{1F943}", 2589 "turkey": "\u{1F983}", 2590 "turtle": "\u{1F422}", 2591 "tv": "\u{1F4FA}", 2592 "twisted_rightwards_arrows": "\u{1F500}", 2593 "two_hearts": "\u{1F495}", 2594 "two_men_holding_hands": "\u{1F46C}", 2595 "two_women_holding_hands": "\u{1F46D}", 2596 "u5272": "\u{1F239}", 2597 "u5408": "\u{1F234}", 2598 "u55b6": "\u{1F23A}", 2599 "u6307": "\u{1F22F}\uFE0F", 2600 "u6708": "\u{1F237}\uFE0F", 2601 "u6709": "\u{1F236}", 2602 "u6e80": "\u{1F235}", 2603 "u7121": "\u{1F21A}\uFE0F", 2604 "u7533": "\u{1F238}", 2605 "u7981": "\u{1F232}", 2606 "u7a7a": "\u{1F233}", 2607 "umbrella": "\u2614\uFE0F", 2608 "unamused": "\u{1F612}", 2609 "underage": "\u{1F51E}", 2610 "unicorn": "\u{1F984}", 2611 "unlock": "\u{1F513}", 2612 "up": "\u{1F199}", 2613 "upside_down_face": "\u{1F643}", 2614 "v": "\u270C\uFE0F", 2615 "vertical_traffic_light": "\u{1F6A6}", 2616 "vhs": "\u{1F4FC}", 2617 "vibration_mode": "\u{1F4F3}", 2618 "video_camera": "\u{1F4F9}", 2619 "video_game": "\u{1F3AE}", 2620 "violin": "\u{1F3BB}", 2621 "virgo": "\u264D\uFE0F", 2622 "volcano": "\u{1F30B}", 2623 "volleyball": "\u{1F3D0}", 2624 "vs": "\u{1F19A}", 2625 "vulcan_salute": "\u{1F596}", 2626 "walking_man": "\u{1F6B6}", 2627 "walking_woman": "\u{1F6B6}‍\u2640\uFE0F", 2628 "waning_crescent_moon": "\u{1F318}", 2629 "waning_gibbous_moon": "\u{1F316}", 2630 "warning": "\u26A0\uFE0F", 2631 "wastebasket": "\u{1F5D1}", 2632 "watch": "\u231A\uFE0F", 2633 "water_buffalo": "\u{1F403}", 2634 "watermelon": "\u{1F349}", 2635 "wave": "\u{1F44B}", 2636 "wavy_dash": "\u3030\uFE0F", 2637 "waxing_crescent_moon": "\u{1F312}", 2638 "wc": "\u{1F6BE}", 2639 "weary": "\u{1F629}", 2640 "wedding": "\u{1F492}", 2641 "weight_lifting_man": "\u{1F3CB}\uFE0F", 2642 "weight_lifting_woman": "\u{1F3CB}\uFE0F‍\u2640\uFE0F", 2643 "whale": "\u{1F433}", 2644 "whale2": "\u{1F40B}", 2645 "wheel_of_dharma": "\u2638\uFE0F", 2646 "wheelchair": "\u267F\uFE0F", 2647 "white_check_mark": "\u2705", 2648 "white_circle": "\u26AA\uFE0F", 2649 "white_flag": "\u{1F3F3}\uFE0F", 2650 "white_flower": "\u{1F4AE}", 2651 "white_large_square": "\u2B1C\uFE0F", 2652 "white_medium_small_square": "\u25FD\uFE0F", 2653 "white_medium_square": "\u25FB\uFE0F", 2654 "white_small_square": "\u25AB\uFE0F", 2655 "white_square_button": "\u{1F533}", 2656 "wilted_flower": "\u{1F940}", 2657 "wind_chime": "\u{1F390}", 2658 "wind_face": "\u{1F32C}", 2659 "wine_glass": "\u{1F377}", 2660 "wink": "\u{1F609}", 2661 "wolf": "\u{1F43A}", 2662 "woman": "\u{1F469}", 2663 "woman_artist": "\u{1F469}‍\u{1F3A8}", 2664 "woman_astronaut": "\u{1F469}‍\u{1F680}", 2665 "woman_cartwheeling": "\u{1F938}‍\u2640\uFE0F", 2666 "woman_cook": "\u{1F469}‍\u{1F373}", 2667 "woman_facepalming": "\u{1F926}‍\u2640\uFE0F", 2668 "woman_factory_worker": "\u{1F469}‍\u{1F3ED}", 2669 "woman_farmer": "\u{1F469}‍\u{1F33E}", 2670 "woman_firefighter": "\u{1F469}‍\u{1F692}", 2671 "woman_health_worker": "\u{1F469}‍\u2695\uFE0F", 2672 "woman_judge": "\u{1F469}‍\u2696\uFE0F", 2673 "woman_juggling": "\u{1F939}‍\u2640\uFE0F", 2674 "woman_mechanic": "\u{1F469}‍\u{1F527}", 2675 "woman_office_worker": "\u{1F469}‍\u{1F4BC}", 2676 "woman_pilot": "\u{1F469}‍\u2708\uFE0F", 2677 "woman_playing_handball": "\u{1F93E}‍\u2640\uFE0F", 2678 "woman_playing_water_polo": "\u{1F93D}‍\u2640\uFE0F", 2679 "woman_scientist": "\u{1F469}‍\u{1F52C}", 2680 "woman_shrugging": "\u{1F937}‍\u2640\uFE0F", 2681 "woman_singer": "\u{1F469}‍\u{1F3A4}", 2682 "woman_student": "\u{1F469}‍\u{1F393}", 2683 "woman_teacher": "\u{1F469}‍\u{1F3EB}", 2684 "woman_technologist": "\u{1F469}‍\u{1F4BB}", 2685 "woman_with_turban": "\u{1F473}‍\u2640\uFE0F", 2686 "womans_clothes": "\u{1F45A}", 2687 "womans_hat": "\u{1F452}", 2688 "women_wrestling": "\u{1F93C}‍\u2640\uFE0F", 2689 "womens": "\u{1F6BA}", 2690 "world_map": "\u{1F5FA}", 2691 "worried": "\u{1F61F}", 2692 "wrench": "\u{1F527}", 2693 "writing_hand": "\u270D\uFE0F", 2694 "x": "\u274C", 2695 "yellow_heart": "\u{1F49B}", 2696 "yen": "\u{1F4B4}", 2697 "yin_yang": "\u262F\uFE0F", 2698 "yum": "\u{1F60B}", 2699 "zap": "\u26A1\uFE0F", 2700 "zipper_mouth_face": "\u{1F910}", 2701 "zzz": "\u{1F4A4}", 2702 /* special emojis :P */ 2703 "octocat": '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">', 2704 "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>` 2705 }; 2706 showdown2.Converter = function(converterOptions) { 2707 "use strict"; 2708 var options = {}, langExtensions = [], outputModifiers = [], listeners = {}, setConvFlavor = setFlavor, metadata = { 2709 parsed: {}, 2710 raw: "", 2711 format: "" 2712 }; 2713 _constructor(); 2714 function _constructor() { 2715 converterOptions = converterOptions || {}; 2716 for (var gOpt in globalOptions) { 2717 if (globalOptions.hasOwnProperty(gOpt)) { 2718 options[gOpt] = globalOptions[gOpt]; 2719 } 2720 } 2721 if (typeof converterOptions === "object") { 2722 for (var opt in converterOptions) { 2723 if (converterOptions.hasOwnProperty(opt)) { 2724 options[opt] = converterOptions[opt]; 2725 } 2726 } 2727 } else { 2728 throw Error("Converter expects the passed parameter to be an object, but " + typeof converterOptions + " was passed instead."); 2729 } 2730 if (options.extensions) { 2731 showdown2.helper.forEach(options.extensions, _parseExtension); 2732 } 2733 } 2734 function _parseExtension(ext, name) { 2735 name = name || null; 2736 if (showdown2.helper.isString(ext)) { 2737 ext = showdown2.helper.stdExtName(ext); 2738 name = ext; 2739 if (showdown2.extensions[ext]) { 2740 console.warn("DEPRECATION WARNING: " + ext + " is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"); 2741 legacyExtensionLoading(showdown2.extensions[ext], ext); 2742 return; 2743 } else if (!showdown2.helper.isUndefined(extensions[ext])) { 2744 ext = extensions[ext]; 2745 } else { 2746 throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.'); 2747 } 2748 } 2749 if (typeof ext === "function") { 2750 ext = ext(); 2751 } 2752 if (!showdown2.helper.isArray(ext)) { 2753 ext = [ext]; 2754 } 2755 var validExt = validate(ext, name); 2756 if (!validExt.valid) { 2757 throw Error(validExt.error); 2758 } 2759 for (var i2 = 0; i2 < ext.length; ++i2) { 2760 switch (ext[i2].type) { 2761 case "lang": 2762 langExtensions.push(ext[i2]); 2763 break; 2764 case "output": 2765 outputModifiers.push(ext[i2]); 2766 break; 2767 } 2768 if (ext[i2].hasOwnProperty("listeners")) { 2769 for (var ln in ext[i2].listeners) { 2770 if (ext[i2].listeners.hasOwnProperty(ln)) { 2771 listen(ln, ext[i2].listeners[ln]); 2772 } 2773 } 2774 } 2775 } 2776 } 2777 function legacyExtensionLoading(ext, name) { 2778 if (typeof ext === "function") { 2779 ext = ext(new showdown2.Converter()); 2780 } 2781 if (!showdown2.helper.isArray(ext)) { 2782 ext = [ext]; 2783 } 2784 var valid = validate(ext, name); 2785 if (!valid.valid) { 2786 throw Error(valid.error); 2787 } 2788 for (var i2 = 0; i2 < ext.length; ++i2) { 2789 switch (ext[i2].type) { 2790 case "lang": 2791 langExtensions.push(ext[i2]); 2792 break; 2793 case "output": 2794 outputModifiers.push(ext[i2]); 2795 break; 2796 default: 2797 throw Error("Extension loader error: Type unrecognized!!!"); 2798 } 2799 } 2800 } 2801 function listen(name, callback) { 2802 if (!showdown2.helper.isString(name)) { 2803 throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof name + " given"); 2804 } 2805 if (typeof callback !== "function") { 2806 throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof callback + " given"); 2807 } 2808 if (!listeners.hasOwnProperty(name)) { 2809 listeners[name] = []; 2810 } 2811 listeners[name].push(callback); 2812 } 2813 function rTrimInputText(text2) { 2814 var rsp = text2.match(/^\s*/)[0].length, rgx = new RegExp("^\\s{0," + rsp + "}", "gm"); 2815 return text2.replace(rgx, ""); 2816 } 2817 this._dispatch = function dispatch3(evtName, text2, options2, globals) { 2818 if (listeners.hasOwnProperty(evtName)) { 2819 for (var ei = 0; ei < listeners[evtName].length; ++ei) { 2820 var nText = listeners[evtName][ei](evtName, text2, this, options2, globals); 2821 if (nText && typeof nText !== "undefined") { 2822 text2 = nText; 2823 } 2824 } 2825 } 2826 return text2; 2827 }; 2828 this.listen = function(name, callback) { 2829 listen(name, callback); 2830 return this; 2831 }; 2832 this.makeHtml = function(text2) { 2833 if (!text2) { 2834 return text2; 2835 } 2836 var globals = { 2837 gHtmlBlocks: [], 2838 gHtmlMdBlocks: [], 2839 gHtmlSpans: [], 2840 gUrls: {}, 2841 gTitles: {}, 2842 gDimensions: {}, 2843 gListLevel: 0, 2844 hashLinkCounts: {}, 2845 langExtensions, 2846 outputModifiers, 2847 converter: this, 2848 ghCodeBlocks: [], 2849 metadata: { 2850 parsed: {}, 2851 raw: "", 2852 format: "" 2853 } 2854 }; 2855 text2 = text2.replace(/¨/g, "\xA8T"); 2856 text2 = text2.replace(/\$/g, "\xA8D"); 2857 text2 = text2.replace(/\r\n/g, "\n"); 2858 text2 = text2.replace(/\r/g, "\n"); 2859 text2 = text2.replace(/\u00A0/g, " "); 2860 if (options.smartIndentationFix) { 2861 text2 = rTrimInputText(text2); 2862 } 2863 text2 = "\n\n" + text2 + "\n\n"; 2864 text2 = showdown2.subParser("detab")(text2, options, globals); 2865 text2 = text2.replace(/^[ \t]+$/mg, ""); 2866 showdown2.helper.forEach(langExtensions, function(ext) { 2867 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals); 2868 }); 2869 text2 = showdown2.subParser("metadata")(text2, options, globals); 2870 text2 = showdown2.subParser("hashPreCodeTags")(text2, options, globals); 2871 text2 = showdown2.subParser("githubCodeBlocks")(text2, options, globals); 2872 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals); 2873 text2 = showdown2.subParser("hashCodeTags")(text2, options, globals); 2874 text2 = showdown2.subParser("stripLinkDefinitions")(text2, options, globals); 2875 text2 = showdown2.subParser("blockGamut")(text2, options, globals); 2876 text2 = showdown2.subParser("unhashHTMLSpans")(text2, options, globals); 2877 text2 = showdown2.subParser("unescapeSpecialChars")(text2, options, globals); 2878 text2 = text2.replace(/¨D/g, "$$"); 2879 text2 = text2.replace(/¨T/g, "\xA8"); 2880 text2 = showdown2.subParser("completeHTMLDocument")(text2, options, globals); 2881 showdown2.helper.forEach(outputModifiers, function(ext) { 2882 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals); 2883 }); 2884 metadata = globals.metadata; 2885 return text2; 2886 }; 2887 this.makeMarkdown = this.makeMd = function(src, HTMLParser) { 2888 src = src.replace(/\r\n/g, "\n"); 2889 src = src.replace(/\r/g, "\n"); 2890 src = src.replace(/>[ \t]+</, ">\xA8NBSP;<"); 2891 if (!HTMLParser) { 2892 if (window && window.document) { 2893 HTMLParser = window.document; 2894 } else { 2895 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"); 2896 } 2897 } 2898 var doc = HTMLParser.createElement("div"); 2899 doc.innerHTML = src; 2900 var globals = { 2901 preList: substitutePreCodeTags(doc) 2902 }; 2903 clean(doc); 2904 var nodes = doc.childNodes, mdDoc = ""; 2905 for (var i2 = 0; i2 < nodes.length; i2++) { 2906 mdDoc += showdown2.subParser("makeMarkdown.node")(nodes[i2], globals); 2907 } 2908 function clean(node) { 2909 for (var n2 = 0; n2 < node.childNodes.length; ++n2) { 2910 var child = node.childNodes[n2]; 2911 if (child.nodeType === 3) { 2912 if (!/\S/.test(child.nodeValue)) { 2913 node.removeChild(child); 2914 --n2; 2915 } else { 2916 child.nodeValue = child.nodeValue.split("\n").join(" "); 2917 child.nodeValue = child.nodeValue.replace(/(\s)+/g, "$1"); 2918 } 2919 } else if (child.nodeType === 1) { 2920 clean(child); 2921 } 2922 } 2923 } 2924 function substitutePreCodeTags(doc2) { 2925 var pres = doc2.querySelectorAll("pre"), presPH = []; 2926 for (var i3 = 0; i3 < pres.length; ++i3) { 2927 if (pres[i3].childElementCount === 1 && pres[i3].firstChild.tagName.toLowerCase() === "code") { 2928 var content = pres[i3].firstChild.innerHTML.trim(), language = pres[i3].firstChild.getAttribute("data-language") || ""; 2929 if (language === "") { 2930 var classes = pres[i3].firstChild.className.split(" "); 2931 for (var c2 = 0; c2 < classes.length; ++c2) { 2932 var matches = classes[c2].match(/^language-(.+)$/); 2933 if (matches !== null) { 2934 language = matches[1]; 2935 break; 2936 } 2937 } 2938 } 2939 content = showdown2.helper.unescapeHTMLEntities(content); 2940 presPH.push(content); 2941 pres[i3].outerHTML = '<precode language="' + language + '" precodenum="' + i3.toString() + '"></precode>'; 2942 } else { 2943 presPH.push(pres[i3].innerHTML); 2944 pres[i3].innerHTML = ""; 2945 pres[i3].setAttribute("prenum", i3.toString()); 2946 } 2947 } 2948 return presPH; 2949 } 2950 return mdDoc; 2951 }; 2952 this.setOption = function(key, value) { 2953 options[key] = value; 2954 }; 2955 this.getOption = function(key) { 2956 return options[key]; 2957 }; 2958 this.getOptions = function() { 2959 return options; 2960 }; 2961 this.addExtension = function(extension, name) { 2962 name = name || null; 2963 _parseExtension(extension, name); 2964 }; 2965 this.useExtension = function(extensionName) { 2966 _parseExtension(extensionName); 2967 }; 2968 this.setFlavor = function(name) { 2969 if (!flavor.hasOwnProperty(name)) { 2970 throw Error(name + " flavor was not found"); 2971 } 2972 var preset = flavor[name]; 2973 setConvFlavor = name; 2974 for (var option in preset) { 2975 if (preset.hasOwnProperty(option)) { 2976 options[option] = preset[option]; 2977 } 2978 } 2979 }; 2980 this.getFlavor = function() { 2981 return setConvFlavor; 2982 }; 2983 this.removeExtension = function(extension) { 2984 if (!showdown2.helper.isArray(extension)) { 2985 extension = [extension]; 2986 } 2987 for (var a2 = 0; a2 < extension.length; ++a2) { 2988 var ext = extension[a2]; 2989 for (var i2 = 0; i2 < langExtensions.length; ++i2) { 2990 if (langExtensions[i2] === ext) { 2991 langExtensions[i2].splice(i2, 1); 2992 } 2993 } 2994 for (var ii = 0; ii < outputModifiers.length; ++i2) { 2995 if (outputModifiers[ii] === ext) { 2996 outputModifiers[ii].splice(i2, 1); 2997 } 2998 } 2999 } 3000 }; 3001 this.getAllExtensions = function() { 3002 return { 3003 language: langExtensions, 3004 output: outputModifiers 3005 }; 3006 }; 3007 this.getMetadata = function(raw) { 3008 if (raw) { 3009 return metadata.raw; 3010 } else { 3011 return metadata.parsed; 3012 } 3013 }; 3014 this.getMetadataFormat = function() { 3015 return metadata.format; 3016 }; 3017 this._setMetadataPair = function(key, value) { 3018 metadata.parsed[key] = value; 3019 }; 3020 this._setMetadataFormat = function(format) { 3021 metadata.format = format; 3022 }; 3023 this._setMetadataRaw = function(raw) { 3024 metadata.raw = raw; 3025 }; 3026 }; 3027 showdown2.subParser("anchors", function(text2, options, globals) { 3028 "use strict"; 3029 text2 = globals.converter._dispatch("anchors.before", text2, options, globals); 3030 var writeAnchorTag = function(wholeMatch, linkText, linkId, url, m5, m6, title) { 3031 if (showdown2.helper.isUndefined(title)) { 3032 title = ""; 3033 } 3034 linkId = linkId.toLowerCase(); 3035 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { 3036 url = ""; 3037 } else if (!url) { 3038 if (!linkId) { 3039 linkId = linkText.toLowerCase().replace(/ ?\n/g, " "); 3040 } 3041 url = "#" + linkId; 3042 if (!showdown2.helper.isUndefined(globals.gUrls[linkId])) { 3043 url = globals.gUrls[linkId]; 3044 if (!showdown2.helper.isUndefined(globals.gTitles[linkId])) { 3045 title = globals.gTitles[linkId]; 3046 } 3047 } else { 3048 return wholeMatch; 3049 } 3050 } 3051 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3052 var result = '<a href="' + url + '"'; 3053 if (title !== "" && title !== null) { 3054 title = title.replace(/"/g, """); 3055 title = title.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3056 result += ' title="' + title + '"'; 3057 } 3058 if (options.openLinksInNewWindow && !/^#/.test(url)) { 3059 result += ' rel="noopener noreferrer" target="\xA8E95Eblank"'; 3060 } 3061 result += ">" + linkText + "</a>"; 3062 return result; 3063 }; 3064 text2 = text2.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag); 3065 text2 = text2.replace( 3066 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, 3067 writeAnchorTag 3068 ); 3069 text2 = text2.replace( 3070 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g, 3071 writeAnchorTag 3072 ); 3073 text2 = text2.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag); 3074 if (options.ghMentions) { 3075 text2 = text2.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(wm, st, escape, mentions, username) { 3076 if (escape === "\\") { 3077 return st + mentions; 3078 } 3079 if (!showdown2.helper.isString(options.ghMentionsLink)) { 3080 throw new Error("ghMentionsLink option must be a string"); 3081 } 3082 var lnk = options.ghMentionsLink.replace(/\{u}/g, username), target = ""; 3083 if (options.openLinksInNewWindow) { 3084 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"'; 3085 } 3086 return st + '<a href="' + lnk + '"' + target + ">" + mentions + "</a>"; 3087 }); 3088 } 3089 text2 = globals.converter._dispatch("anchors.after", text2, options, globals); 3090 return text2; 3091 }); 3092 var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi, simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi, delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi, simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi, delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, replaceLink = function(options) { 3093 "use strict"; 3094 return function(wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) { 3095 link = link.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3096 var lnkTxt = link, append = "", target = "", lmc = leadingMagicChars || "", tmc = trailingMagicChars || ""; 3097 if (/^www\./i.test(link)) { 3098 link = link.replace(/^www\./i, "http://www."); 3099 } 3100 if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) { 3101 append = trailingPunctuation; 3102 } 3103 if (options.openLinksInNewWindow) { 3104 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"'; 3105 } 3106 return lmc + '<a href="' + link + '"' + target + ">" + lnkTxt + "</a>" + append + tmc; 3107 }; 3108 }, replaceMail = function(options, globals) { 3109 "use strict"; 3110 return function(wholeMatch, b2, mail) { 3111 var href = "mailto:"; 3112 b2 = b2 || ""; 3113 mail = showdown2.subParser("unescapeSpecialChars")(mail, options, globals); 3114 if (options.encodeEmails) { 3115 href = showdown2.helper.encodeEmailAddress(href + mail); 3116 mail = showdown2.helper.encodeEmailAddress(mail); 3117 } else { 3118 href = href + mail; 3119 } 3120 return b2 + '<a href="' + href + '">' + mail + "</a>"; 3121 }; 3122 }; 3123 showdown2.subParser("autoLinks", function(text2, options, globals) { 3124 "use strict"; 3125 text2 = globals.converter._dispatch("autoLinks.before", text2, options, globals); 3126 text2 = text2.replace(delimUrlRegex, replaceLink(options)); 3127 text2 = text2.replace(delimMailRegex, replaceMail(options, globals)); 3128 text2 = globals.converter._dispatch("autoLinks.after", text2, options, globals); 3129 return text2; 3130 }); 3131 showdown2.subParser("simplifiedAutoLinks", function(text2, options, globals) { 3132 "use strict"; 3133 if (!options.simplifiedAutoLink) { 3134 return text2; 3135 } 3136 text2 = globals.converter._dispatch("simplifiedAutoLinks.before", text2, options, globals); 3137 if (options.excludeTrailingPunctuationFromURLs) { 3138 text2 = text2.replace(simpleURLRegex2, replaceLink(options)); 3139 } else { 3140 text2 = text2.replace(simpleURLRegex, replaceLink(options)); 3141 } 3142 text2 = text2.replace(simpleMailRegex, replaceMail(options, globals)); 3143 text2 = globals.converter._dispatch("simplifiedAutoLinks.after", text2, options, globals); 3144 return text2; 3145 }); 3146 showdown2.subParser("blockGamut", function(text2, options, globals) { 3147 "use strict"; 3148 text2 = globals.converter._dispatch("blockGamut.before", text2, options, globals); 3149 text2 = showdown2.subParser("blockQuotes")(text2, options, globals); 3150 text2 = showdown2.subParser("headers")(text2, options, globals); 3151 text2 = showdown2.subParser("horizontalRule")(text2, options, globals); 3152 text2 = showdown2.subParser("lists")(text2, options, globals); 3153 text2 = showdown2.subParser("codeBlocks")(text2, options, globals); 3154 text2 = showdown2.subParser("tables")(text2, options, globals); 3155 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals); 3156 text2 = showdown2.subParser("paragraphs")(text2, options, globals); 3157 text2 = globals.converter._dispatch("blockGamut.after", text2, options, globals); 3158 return text2; 3159 }); 3160 showdown2.subParser("blockQuotes", function(text2, options, globals) { 3161 "use strict"; 3162 text2 = globals.converter._dispatch("blockQuotes.before", text2, options, globals); 3163 text2 = text2 + "\n\n"; 3164 var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm; 3165 if (options.splitAdjacentBlockquotes) { 3166 rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm; 3167 } 3168 text2 = text2.replace(rgx, function(bq) { 3169 bq = bq.replace(/^[ \t]*>[ \t]?/gm, ""); 3170 bq = bq.replace(/¨0/g, ""); 3171 bq = bq.replace(/^[ \t]+$/gm, ""); 3172 bq = showdown2.subParser("githubCodeBlocks")(bq, options, globals); 3173 bq = showdown2.subParser("blockGamut")(bq, options, globals); 3174 bq = bq.replace(/(^|\n)/g, "$1 "); 3175 bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function(wholeMatch, m1) { 3176 var pre = m1; 3177 pre = pre.replace(/^ /mg, "\xA80"); 3178 pre = pre.replace(/¨0/g, ""); 3179 return pre; 3180 }); 3181 return showdown2.subParser("hashBlock")("<blockquote>\n" + bq + "\n</blockquote>", options, globals); 3182 }); 3183 text2 = globals.converter._dispatch("blockQuotes.after", text2, options, globals); 3184 return text2; 3185 }); 3186 showdown2.subParser("codeBlocks", function(text2, options, globals) { 3187 "use strict"; 3188 text2 = globals.converter._dispatch("codeBlocks.before", text2, options, globals); 3189 text2 += "\xA80"; 3190 var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g; 3191 text2 = text2.replace(pattern, function(wholeMatch, m1, m2) { 3192 var codeblock = m1, nextChar = m2, end = "\n"; 3193 codeblock = showdown2.subParser("outdent")(codeblock, options, globals); 3194 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals); 3195 codeblock = showdown2.subParser("detab")(codeblock, options, globals); 3196 codeblock = codeblock.replace(/^\n+/g, ""); 3197 codeblock = codeblock.replace(/\n+$/g, ""); 3198 if (options.omitExtraWLInCodeBlocks) { 3199 end = ""; 3200 } 3201 codeblock = "<pre><code>" + codeblock + end + "</code></pre>"; 3202 return showdown2.subParser("hashBlock")(codeblock, options, globals) + nextChar; 3203 }); 3204 text2 = text2.replace(/¨0/, ""); 3205 text2 = globals.converter._dispatch("codeBlocks.after", text2, options, globals); 3206 return text2; 3207 }); 3208 showdown2.subParser("codeSpans", function(text2, options, globals) { 3209 "use strict"; 3210 text2 = globals.converter._dispatch("codeSpans.before", text2, options, globals); 3211 if (typeof text2 === "undefined") { 3212 text2 = ""; 3213 } 3214 text2 = text2.replace( 3215 /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, 3216 function(wholeMatch, m1, m2, m3) { 3217 var c2 = m3; 3218 c2 = c2.replace(/^([ \t]*)/g, ""); 3219 c2 = c2.replace(/[ \t]*$/g, ""); 3220 c2 = showdown2.subParser("encodeCode")(c2, options, globals); 3221 c2 = m1 + "<code>" + c2 + "</code>"; 3222 c2 = showdown2.subParser("hashHTMLSpans")(c2, options, globals); 3223 return c2; 3224 } 3225 ); 3226 text2 = globals.converter._dispatch("codeSpans.after", text2, options, globals); 3227 return text2; 3228 }); 3229 showdown2.subParser("completeHTMLDocument", function(text2, options, globals) { 3230 "use strict"; 3231 if (!options.completeHTMLDocument) { 3232 return text2; 3233 } 3234 text2 = globals.converter._dispatch("completeHTMLDocument.before", text2, options, globals); 3235 var doctype = "html", doctypeParsed = "<!DOCTYPE HTML>\n", title = "", charset = '<meta charset="utf-8">\n', lang = "", metadata = ""; 3236 if (typeof globals.metadata.parsed.doctype !== "undefined") { 3237 doctypeParsed = "<!DOCTYPE " + globals.metadata.parsed.doctype + ">\n"; 3238 doctype = globals.metadata.parsed.doctype.toString().toLowerCase(); 3239 if (doctype === "html" || doctype === "html5") { 3240 charset = '<meta charset="utf-8">'; 3241 } 3242 } 3243 for (var meta in globals.metadata.parsed) { 3244 if (globals.metadata.parsed.hasOwnProperty(meta)) { 3245 switch (meta.toLowerCase()) { 3246 case "doctype": 3247 break; 3248 case "title": 3249 title = "<title>" + globals.metadata.parsed.title + "</title>\n"; 3250 break; 3251 case "charset": 3252 if (doctype === "html" || doctype === "html5") { 3253 charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n'; 3254 } else { 3255 charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n'; 3256 } 3257 break; 3258 case "language": 3259 case "lang": 3260 lang = ' lang="' + globals.metadata.parsed[meta] + '"'; 3261 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; 3262 break; 3263 default: 3264 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n'; 3265 } 3266 } 3267 } 3268 text2 = doctypeParsed + "<html" + lang + ">\n<head>\n" + title + charset + metadata + "</head>\n<body>\n" + text2.trim() + "\n</body>\n</html>"; 3269 text2 = globals.converter._dispatch("completeHTMLDocument.after", text2, options, globals); 3270 return text2; 3271 }); 3272 showdown2.subParser("detab", function(text2, options, globals) { 3273 "use strict"; 3274 text2 = globals.converter._dispatch("detab.before", text2, options, globals); 3275 text2 = text2.replace(/\t(?=\t)/g, " "); 3276 text2 = text2.replace(/\t/g, "\xA8A\xA8B"); 3277 text2 = text2.replace(/¨B(.+?)¨A/g, function(wholeMatch, m1) { 3278 var leadingText = m1, numSpaces = 4 - leadingText.length % 4; 3279 for (var i2 = 0; i2 < numSpaces; i2++) { 3280 leadingText += " "; 3281 } 3282 return leadingText; 3283 }); 3284 text2 = text2.replace(/¨A/g, " "); 3285 text2 = text2.replace(/¨B/g, ""); 3286 text2 = globals.converter._dispatch("detab.after", text2, options, globals); 3287 return text2; 3288 }); 3289 showdown2.subParser("ellipsis", function(text2, options, globals) { 3290 "use strict"; 3291 text2 = globals.converter._dispatch("ellipsis.before", text2, options, globals); 3292 text2 = text2.replace(/\.\.\./g, "\u2026"); 3293 text2 = globals.converter._dispatch("ellipsis.after", text2, options, globals); 3294 return text2; 3295 }); 3296 showdown2.subParser("emoji", function(text2, options, globals) { 3297 "use strict"; 3298 if (!options.emoji) { 3299 return text2; 3300 } 3301 text2 = globals.converter._dispatch("emoji.before", text2, options, globals); 3302 var emojiRgx = /:([\S]+?):/g; 3303 text2 = text2.replace(emojiRgx, function(wm, emojiCode) { 3304 if (showdown2.helper.emojis.hasOwnProperty(emojiCode)) { 3305 return showdown2.helper.emojis[emojiCode]; 3306 } 3307 return wm; 3308 }); 3309 text2 = globals.converter._dispatch("emoji.after", text2, options, globals); 3310 return text2; 3311 }); 3312 showdown2.subParser("encodeAmpsAndAngles", function(text2, options, globals) { 3313 "use strict"; 3314 text2 = globals.converter._dispatch("encodeAmpsAndAngles.before", text2, options, globals); 3315 text2 = text2.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"); 3316 text2 = text2.replace(/<(?![a-z\/?$!])/gi, "<"); 3317 text2 = text2.replace(/</g, "<"); 3318 text2 = text2.replace(/>/g, ">"); 3319 text2 = globals.converter._dispatch("encodeAmpsAndAngles.after", text2, options, globals); 3320 return text2; 3321 }); 3322 showdown2.subParser("encodeBackslashEscapes", function(text2, options, globals) { 3323 "use strict"; 3324 text2 = globals.converter._dispatch("encodeBackslashEscapes.before", text2, options, globals); 3325 text2 = text2.replace(/\\(\\)/g, showdown2.helper.escapeCharactersCallback); 3326 text2 = text2.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown2.helper.escapeCharactersCallback); 3327 text2 = globals.converter._dispatch("encodeBackslashEscapes.after", text2, options, globals); 3328 return text2; 3329 }); 3330 showdown2.subParser("encodeCode", function(text2, options, globals) { 3331 "use strict"; 3332 text2 = globals.converter._dispatch("encodeCode.before", text2, options, globals); 3333 text2 = text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/([*_{}\[\]\\=~-])/g, showdown2.helper.escapeCharactersCallback); 3334 text2 = globals.converter._dispatch("encodeCode.after", text2, options, globals); 3335 return text2; 3336 }); 3337 showdown2.subParser("escapeSpecialCharsWithinTagAttributes", function(text2, options, globals) { 3338 "use strict"; 3339 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", text2, options, globals); 3340 var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; 3341 text2 = text2.replace(tags, function(wholeMatch) { 3342 return wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback); 3343 }); 3344 text2 = text2.replace(comments, function(wholeMatch) { 3345 return wholeMatch.replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback); 3346 }); 3347 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", text2, options, globals); 3348 return text2; 3349 }); 3350 showdown2.subParser("githubCodeBlocks", function(text2, options, globals) { 3351 "use strict"; 3352 if (!options.ghCodeBlocks) { 3353 return text2; 3354 } 3355 text2 = globals.converter._dispatch("githubCodeBlocks.before", text2, options, globals); 3356 text2 += "\xA80"; 3357 text2 = text2.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(wholeMatch, delim, language, codeblock) { 3358 var end = options.omitExtraWLInCodeBlocks ? "" : "\n"; 3359 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals); 3360 codeblock = showdown2.subParser("detab")(codeblock, options, globals); 3361 codeblock = codeblock.replace(/^\n+/g, ""); 3362 codeblock = codeblock.replace(/\n+$/g, ""); 3363 codeblock = "<pre><code" + (language ? ' class="' + language + " language-" + language + '"' : "") + ">" + codeblock + end + "</code></pre>"; 3364 codeblock = showdown2.subParser("hashBlock")(codeblock, options, globals); 3365 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n"; 3366 }); 3367 text2 = text2.replace(/¨0/, ""); 3368 return globals.converter._dispatch("githubCodeBlocks.after", text2, options, globals); 3369 }); 3370 showdown2.subParser("hashBlock", function(text2, options, globals) { 3371 "use strict"; 3372 text2 = globals.converter._dispatch("hashBlock.before", text2, options, globals); 3373 text2 = text2.replace(/(^\n+|\n+$)/g, ""); 3374 text2 = "\n\n\xA8K" + (globals.gHtmlBlocks.push(text2) - 1) + "K\n\n"; 3375 text2 = globals.converter._dispatch("hashBlock.after", text2, options, globals); 3376 return text2; 3377 }); 3378 showdown2.subParser("hashCodeTags", function(text2, options, globals) { 3379 "use strict"; 3380 text2 = globals.converter._dispatch("hashCodeTags.before", text2, options, globals); 3381 var repFunc = function(wholeMatch, match, left, right) { 3382 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right; 3383 return "\xA8C" + (globals.gHtmlSpans.push(codeblock) - 1) + "C"; 3384 }; 3385 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "<code\\b[^>]*>", "</code>", "gim"); 3386 text2 = globals.converter._dispatch("hashCodeTags.after", text2, options, globals); 3387 return text2; 3388 }); 3389 showdown2.subParser("hashElement", function(text2, options, globals) { 3390 "use strict"; 3391 return function(wholeMatch, m1) { 3392 var blockText = m1; 3393 blockText = blockText.replace(/\n\n/g, "\n"); 3394 blockText = blockText.replace(/^\n/, ""); 3395 blockText = blockText.replace(/\n+$/g, ""); 3396 blockText = "\n\n\xA8K" + (globals.gHtmlBlocks.push(blockText) - 1) + "K\n\n"; 3397 return blockText; 3398 }; 3399 }); 3400 showdown2.subParser("hashHTMLBlocks", function(text2, options, globals) { 3401 "use strict"; 3402 text2 = globals.converter._dispatch("hashHTMLBlocks.before", text2, options, globals); 3403 var blockTags = [ 3404 "pre", 3405 "div", 3406 "h1", 3407 "h2", 3408 "h3", 3409 "h4", 3410 "h5", 3411 "h6", 3412 "blockquote", 3413 "table", 3414 "dl", 3415 "ol", 3416 "ul", 3417 "script", 3418 "noscript", 3419 "form", 3420 "fieldset", 3421 "iframe", 3422 "math", 3423 "style", 3424 "section", 3425 "header", 3426 "footer", 3427 "nav", 3428 "article", 3429 "aside", 3430 "address", 3431 "audio", 3432 "canvas", 3433 "figure", 3434 "hgroup", 3435 "output", 3436 "video", 3437 "p" 3438 ], repFunc = function(wholeMatch, match, left, right) { 3439 var txt = wholeMatch; 3440 if (left.search(/\bmarkdown\b/) !== -1) { 3441 txt = left + globals.converter.makeHtml(match) + right; 3442 } 3443 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n"; 3444 }; 3445 if (options.backslashEscapesHTMLTags) { 3446 text2 = text2.replace(/\\<(\/?[^>]+?)>/g, function(wm, inside) { 3447 return "<" + inside + ">"; 3448 }); 3449 } 3450 for (var i2 = 0; i2 < blockTags.length; ++i2) { 3451 var opTagPos, rgx1 = new RegExp("^ {0,3}(<" + blockTags[i2] + "\\b[^>]*>)", "im"), patLeft = "<" + blockTags[i2] + "\\b[^>]*>", patRight = "</" + blockTags[i2] + ">"; 3452 while ((opTagPos = showdown2.helper.regexIndexOf(text2, rgx1)) !== -1) { 3453 var subTexts = showdown2.helper.splitAtIndex(text2, opTagPos), newSubText1 = showdown2.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, "im"); 3454 if (newSubText1 === subTexts[1]) { 3455 break; 3456 } 3457 text2 = subTexts[0].concat(newSubText1); 3458 } 3459 } 3460 text2 = text2.replace( 3461 /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, 3462 showdown2.subParser("hashElement")(text2, options, globals) 3463 ); 3464 text2 = showdown2.helper.replaceRecursiveRegExp(text2, function(txt) { 3465 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n"; 3466 }, "^ {0,3}<!--", "-->", "gm"); 3467 text2 = text2.replace( 3468 /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, 3469 showdown2.subParser("hashElement")(text2, options, globals) 3470 ); 3471 text2 = globals.converter._dispatch("hashHTMLBlocks.after", text2, options, globals); 3472 return text2; 3473 }); 3474 showdown2.subParser("hashHTMLSpans", function(text2, options, globals) { 3475 "use strict"; 3476 text2 = globals.converter._dispatch("hashHTMLSpans.before", text2, options, globals); 3477 function hashHTMLSpan(html2) { 3478 return "\xA8C" + (globals.gHtmlSpans.push(html2) - 1) + "C"; 3479 } 3480 text2 = text2.replace(/<[^>]+?\/>/gi, function(wm) { 3481 return hashHTMLSpan(wm); 3482 }); 3483 text2 = text2.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(wm) { 3484 return hashHTMLSpan(wm); 3485 }); 3486 text2 = text2.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(wm) { 3487 return hashHTMLSpan(wm); 3488 }); 3489 text2 = text2.replace(/<[^>]+?>/gi, function(wm) { 3490 return hashHTMLSpan(wm); 3491 }); 3492 text2 = globals.converter._dispatch("hashHTMLSpans.after", text2, options, globals); 3493 return text2; 3494 }); 3495 showdown2.subParser("unhashHTMLSpans", function(text2, options, globals) { 3496 "use strict"; 3497 text2 = globals.converter._dispatch("unhashHTMLSpans.before", text2, options, globals); 3498 for (var i2 = 0; i2 < globals.gHtmlSpans.length; ++i2) { 3499 var repText = globals.gHtmlSpans[i2], limit = 0; 3500 while (/¨C(\d+)C/.test(repText)) { 3501 var num = RegExp.$1; 3502 repText = repText.replace("\xA8C" + num + "C", globals.gHtmlSpans[num]); 3503 if (limit === 10) { 3504 console.error("maximum nesting of 10 spans reached!!!"); 3505 break; 3506 } 3507 ++limit; 3508 } 3509 text2 = text2.replace("\xA8C" + i2 + "C", repText); 3510 } 3511 text2 = globals.converter._dispatch("unhashHTMLSpans.after", text2, options, globals); 3512 return text2; 3513 }); 3514 showdown2.subParser("hashPreCodeTags", function(text2, options, globals) { 3515 "use strict"; 3516 text2 = globals.converter._dispatch("hashPreCodeTags.before", text2, options, globals); 3517 var repFunc = function(wholeMatch, match, left, right) { 3518 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right; 3519 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n"; 3520 }; 3521 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>", "^ {0,3}</code>\\s*</pre>", "gim"); 3522 text2 = globals.converter._dispatch("hashPreCodeTags.after", text2, options, globals); 3523 return text2; 3524 }); 3525 showdown2.subParser("headers", function(text2, options, globals) { 3526 "use strict"; 3527 text2 = globals.converter._dispatch("headers.before", text2, options, globals); 3528 var headerLevelStart = isNaN(parseInt(options.headerLevelStart)) ? 1 : parseInt(options.headerLevelStart), setextRegexH1 = options.smoothLivePreview ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm, setextRegexH2 = options.smoothLivePreview ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm; 3529 text2 = text2.replace(setextRegexH1, function(wholeMatch, m1) { 3530 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">"; 3531 return showdown2.subParser("hashBlock")(hashBlock, options, globals); 3532 }); 3533 text2 = text2.replace(setextRegexH2, function(matchFound, m1) { 3534 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart + 1, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">"; 3535 return showdown2.subParser("hashBlock")(hashBlock, options, globals); 3536 }); 3537 var atxStyle = options.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm; 3538 text2 = text2.replace(atxStyle, function(wholeMatch, m1, m2) { 3539 var hText = m2; 3540 if (options.customizedHeaderId) { 3541 hText = m2.replace(/\s?\{([^{]+?)}\s*$/, ""); 3542 } 3543 var span = showdown2.subParser("spanGamut")(hText, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m2) + '"', hLevel = headerLevelStart - 1 + m1.length, header = "<h" + hLevel + hID + ">" + span + "</h" + hLevel + ">"; 3544 return showdown2.subParser("hashBlock")(header, options, globals); 3545 }); 3546 function headerId(m2) { 3547 var title, prefix; 3548 if (options.customizedHeaderId) { 3549 var match = m2.match(/\{([^{]+?)}\s*$/); 3550 if (match && match[1]) { 3551 m2 = match[1]; 3552 } 3553 } 3554 title = m2; 3555 if (showdown2.helper.isString(options.prefixHeaderId)) { 3556 prefix = options.prefixHeaderId; 3557 } else if (options.prefixHeaderId === true) { 3558 prefix = "section-"; 3559 } else { 3560 prefix = ""; 3561 } 3562 if (!options.rawPrefixHeaderId) { 3563 title = prefix + title; 3564 } 3565 if (options.ghCompatibleHeaderId) { 3566 title = title.replace(/ /g, "-").replace(/&/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase(); 3567 } else if (options.rawHeaderId) { 3568 title = title.replace(/ /g, "-").replace(/&/g, "&").replace(/¨T/g, "\xA8").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase(); 3569 } else { 3570 title = title.replace(/[^\w]/g, "").toLowerCase(); 3571 } 3572 if (options.rawPrefixHeaderId) { 3573 title = prefix + title; 3574 } 3575 if (globals.hashLinkCounts[title]) { 3576 title = title + "-" + globals.hashLinkCounts[title]++; 3577 } else { 3578 globals.hashLinkCounts[title] = 1; 3579 } 3580 return title; 3581 } 3582 text2 = globals.converter._dispatch("headers.after", text2, options, globals); 3583 return text2; 3584 }); 3585 showdown2.subParser("horizontalRule", function(text2, options, globals) { 3586 "use strict"; 3587 text2 = globals.converter._dispatch("horizontalRule.before", text2, options, globals); 3588 var key = showdown2.subParser("hashBlock")("<hr />", options, globals); 3589 text2 = text2.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key); 3590 text2 = text2.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key); 3591 text2 = text2.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key); 3592 text2 = globals.converter._dispatch("horizontalRule.after", text2, options, globals); 3593 return text2; 3594 }); 3595 showdown2.subParser("images", function(text2, options, globals) { 3596 "use strict"; 3597 text2 = globals.converter._dispatch("images.before", text2, options, globals); 3598 var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g, crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g, 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, referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g, refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g; 3599 function writeImageTagBase64(wholeMatch, altText, linkId, url, width, height, m5, title) { 3600 url = url.replace(/\s/g, ""); 3601 return writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title); 3602 } 3603 function writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title) { 3604 var gUrls = globals.gUrls, gTitles = globals.gTitles, gDims = globals.gDimensions; 3605 linkId = linkId.toLowerCase(); 3606 if (!title) { 3607 title = ""; 3608 } 3609 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) { 3610 url = ""; 3611 } else if (url === "" || url === null) { 3612 if (linkId === "" || linkId === null) { 3613 linkId = altText.toLowerCase().replace(/ ?\n/g, " "); 3614 } 3615 url = "#" + linkId; 3616 if (!showdown2.helper.isUndefined(gUrls[linkId])) { 3617 url = gUrls[linkId]; 3618 if (!showdown2.helper.isUndefined(gTitles[linkId])) { 3619 title = gTitles[linkId]; 3620 } 3621 if (!showdown2.helper.isUndefined(gDims[linkId])) { 3622 width = gDims[linkId].width; 3623 height = gDims[linkId].height; 3624 } 3625 } else { 3626 return wholeMatch; 3627 } 3628 } 3629 altText = altText.replace(/"/g, """).replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3630 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3631 var result = '<img src="' + url + '" alt="' + altText + '"'; 3632 if (title && showdown2.helper.isString(title)) { 3633 title = title.replace(/"/g, """).replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback); 3634 result += ' title="' + title + '"'; 3635 } 3636 if (width && height) { 3637 width = width === "*" ? "auto" : width; 3638 height = height === "*" ? "auto" : height; 3639 result += ' width="' + width + '"'; 3640 result += ' height="' + height + '"'; 3641 } 3642 result += " />"; 3643 return result; 3644 } 3645 text2 = text2.replace(referenceRegExp, writeImageTag); 3646 text2 = text2.replace(base64RegExp, writeImageTagBase64); 3647 text2 = text2.replace(crazyRegExp, writeImageTag); 3648 text2 = text2.replace(inlineRegExp, writeImageTag); 3649 text2 = text2.replace(refShortcutRegExp, writeImageTag); 3650 text2 = globals.converter._dispatch("images.after", text2, options, globals); 3651 return text2; 3652 }); 3653 showdown2.subParser("italicsAndBold", function(text2, options, globals) { 3654 "use strict"; 3655 text2 = globals.converter._dispatch("italicsAndBold.before", text2, options, globals); 3656 function parseInside(txt, left, right) { 3657 return left + txt + right; 3658 } 3659 if (options.literalMidWordUnderscores) { 3660 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) { 3661 return parseInside(txt, "<strong><em>", "</em></strong>"); 3662 }); 3663 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) { 3664 return parseInside(txt, "<strong>", "</strong>"); 3665 }); 3666 text2 = text2.replace(/\b_(\S[\s\S]*?)_\b/g, function(wm, txt) { 3667 return parseInside(txt, "<em>", "</em>"); 3668 }); 3669 } else { 3670 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) { 3671 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm; 3672 }); 3673 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) { 3674 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm; 3675 }); 3676 text2 = text2.replace(/_([^\s_][\s\S]*?)_/g, function(wm, m2) { 3677 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm; 3678 }); 3679 } 3680 if (options.literalMidWordAsterisks) { 3681 text2 = text2.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(wm, lead, txt) { 3682 return parseInside(txt, lead + "<strong><em>", "</em></strong>"); 3683 }); 3684 text2 = text2.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(wm, lead, txt) { 3685 return parseInside(txt, lead + "<strong>", "</strong>"); 3686 }); 3687 text2 = text2.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(wm, lead, txt) { 3688 return parseInside(txt, lead + "<em>", "</em>"); 3689 }); 3690 } else { 3691 text2 = text2.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(wm, m2) { 3692 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm; 3693 }); 3694 text2 = text2.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(wm, m2) { 3695 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm; 3696 }); 3697 text2 = text2.replace(/\*([^\s*][\s\S]*?)\*/g, function(wm, m2) { 3698 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm; 3699 }); 3700 } 3701 text2 = globals.converter._dispatch("italicsAndBold.after", text2, options, globals); 3702 return text2; 3703 }); 3704 showdown2.subParser("lists", function(text2, options, globals) { 3705 "use strict"; 3706 function processListItems(listStr, trimTrailing) { 3707 globals.gListLevel++; 3708 listStr = listStr.replace(/\n{2,}$/, "\n"); 3709 listStr += "\xA80"; 3710 var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm, isParagraphed = /\n[ \t]*\n(?!¨0)/.test(listStr); 3711 if (options.disableForced4SpacesIndentedSublists) { 3712 rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm; 3713 } 3714 listStr = listStr.replace(rgx, function(wholeMatch, m1, m2, m3, m4, taskbtn, checked) { 3715 checked = checked && checked.trim() !== ""; 3716 var item = showdown2.subParser("outdent")(m4, options, globals), bulletStyle = ""; 3717 if (taskbtn && options.tasklists) { 3718 bulletStyle = ' class="task-list-item" style="list-style-type: none;"'; 3719 item = item.replace(/^[ \t]*\[(x|X| )?]/m, function() { 3720 var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"'; 3721 if (checked) { 3722 otp += " checked"; 3723 } 3724 otp += ">"; 3725 return otp; 3726 }); 3727 } 3728 item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function(wm2) { 3729 return "\xA8A" + wm2; 3730 }); 3731 if (m1 || item.search(/\n{2,}/) > -1) { 3732 item = showdown2.subParser("githubCodeBlocks")(item, options, globals); 3733 item = showdown2.subParser("blockGamut")(item, options, globals); 3734 } else { 3735 item = showdown2.subParser("lists")(item, options, globals); 3736 item = item.replace(/\n$/, ""); 3737 item = showdown2.subParser("hashHTMLBlocks")(item, options, globals); 3738 item = item.replace(/\n\n+/g, "\n\n"); 3739 if (isParagraphed) { 3740 item = showdown2.subParser("paragraphs")(item, options, globals); 3741 } else { 3742 item = showdown2.subParser("spanGamut")(item, options, globals); 3743 } 3744 } 3745 item = item.replace("\xA8A", ""); 3746 item = "<li" + bulletStyle + ">" + item + "</li>\n"; 3747 return item; 3748 }); 3749 listStr = listStr.replace(/¨0/g, ""); 3750 globals.gListLevel--; 3751 if (trimTrailing) { 3752 listStr = listStr.replace(/\s+$/, ""); 3753 } 3754 return listStr; 3755 } 3756 function styleStartNumber(list, listType) { 3757 if (listType === "ol") { 3758 var res = list.match(/^ *(\d+)\./); 3759 if (res && res[1] !== "1") { 3760 return ' start="' + res[1] + '"'; 3761 } 3762 } 3763 return ""; 3764 } 3765 function parseConsecutiveLists(list, listType, trimTrailing) { 3766 var olRgx = options.disableForced4SpacesIndentedSublists ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm, ulRgx = options.disableForced4SpacesIndentedSublists ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm, counterRxg = listType === "ul" ? olRgx : ulRgx, result = ""; 3767 if (list.search(counterRxg) !== -1) { 3768 (function parseCL(txt) { 3769 var pos = txt.search(counterRxg), style2 = styleStartNumber(list, listType); 3770 if (pos !== -1) { 3771 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt.slice(0, pos), !!trimTrailing) + "</" + listType + ">\n"; 3772 listType = listType === "ul" ? "ol" : "ul"; 3773 counterRxg = listType === "ul" ? olRgx : ulRgx; 3774 parseCL(txt.slice(pos)); 3775 } else { 3776 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt, !!trimTrailing) + "</" + listType + ">\n"; 3777 } 3778 })(list); 3779 } else { 3780 var style = styleStartNumber(list, listType); 3781 result = "\n\n<" + listType + style + ">\n" + processListItems(list, !!trimTrailing) + "</" + listType + ">\n"; 3782 } 3783 return result; 3784 } 3785 text2 = globals.converter._dispatch("lists.before", text2, options, globals); 3786 text2 += "\xA80"; 3787 if (globals.gListLevel) { 3788 text2 = text2.replace( 3789 /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, 3790 function(wholeMatch, list, m2) { 3791 var listType = m2.search(/[*+-]/g) > -1 ? "ul" : "ol"; 3792 return parseConsecutiveLists(list, listType, true); 3793 } 3794 ); 3795 } else { 3796 text2 = text2.replace( 3797 /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm, 3798 function(wholeMatch, m1, list, m3) { 3799 var listType = m3.search(/[*+-]/g) > -1 ? "ul" : "ol"; 3800 return parseConsecutiveLists(list, listType, false); 3801 } 3802 ); 3803 } 3804 text2 = text2.replace(/¨0/, ""); 3805 text2 = globals.converter._dispatch("lists.after", text2, options, globals); 3806 return text2; 3807 }); 3808 showdown2.subParser("metadata", function(text2, options, globals) { 3809 "use strict"; 3810 if (!options.metadata) { 3811 return text2; 3812 } 3813 text2 = globals.converter._dispatch("metadata.before", text2, options, globals); 3814 function parseMetadataContents(content) { 3815 globals.metadata.raw = content; 3816 content = content.replace(/&/g, "&").replace(/"/g, """); 3817 content = content.replace(/\n {4}/g, " "); 3818 content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(wm, key, value) { 3819 globals.metadata.parsed[key] = value; 3820 return ""; 3821 }); 3822 } 3823 text2 = text2.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(wholematch, format, content) { 3824 parseMetadataContents(content); 3825 return "\xA8M"; 3826 }); 3827 text2 = text2.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(wholematch, format, content) { 3828 if (format) { 3829 globals.metadata.format = format; 3830 } 3831 parseMetadataContents(content); 3832 return "\xA8M"; 3833 }); 3834 text2 = text2.replace(/¨M/g, ""); 3835 text2 = globals.converter._dispatch("metadata.after", text2, options, globals); 3836 return text2; 3837 }); 3838 showdown2.subParser("outdent", function(text2, options, globals) { 3839 "use strict"; 3840 text2 = globals.converter._dispatch("outdent.before", text2, options, globals); 3841 text2 = text2.replace(/^(\t|[ ]{1,4})/gm, "\xA80"); 3842 text2 = text2.replace(/¨0/g, ""); 3843 text2 = globals.converter._dispatch("outdent.after", text2, options, globals); 3844 return text2; 3845 }); 3846 showdown2.subParser("paragraphs", function(text2, options, globals) { 3847 "use strict"; 3848 text2 = globals.converter._dispatch("paragraphs.before", text2, options, globals); 3849 text2 = text2.replace(/^\n+/g, ""); 3850 text2 = text2.replace(/\n+$/g, ""); 3851 var grafs = text2.split(/\n{2,}/g), grafsOut = [], end = grafs.length; 3852 for (var i2 = 0; i2 < end; i2++) { 3853 var str = grafs[i2]; 3854 if (str.search(/¨(K|G)(\d+)\1/g) >= 0) { 3855 grafsOut.push(str); 3856 } else if (str.search(/\S/) >= 0) { 3857 str = showdown2.subParser("spanGamut")(str, options, globals); 3858 str = str.replace(/^([ \t]*)/g, "<p>"); 3859 str += "</p>"; 3860 grafsOut.push(str); 3861 } 3862 } 3863 end = grafsOut.length; 3864 for (i2 = 0; i2 < end; i2++) { 3865 var blockText = "", grafsOutIt = grafsOut[i2], codeFlag = false; 3866 while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) { 3867 var delim = RegExp.$1, num = RegExp.$2; 3868 if (delim === "K") { 3869 blockText = globals.gHtmlBlocks[num]; 3870 } else { 3871 if (codeFlag) { 3872 blockText = showdown2.subParser("encodeCode")(globals.ghCodeBlocks[num].text, options, globals); 3873 } else { 3874 blockText = globals.ghCodeBlocks[num].codeblock; 3875 } 3876 } 3877 blockText = blockText.replace(/\$/g, "$$$$"); 3878 grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText); 3879 if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) { 3880 codeFlag = true; 3881 } 3882 } 3883 grafsOut[i2] = grafsOutIt; 3884 } 3885 text2 = grafsOut.join("\n"); 3886 text2 = text2.replace(/^\n+/g, ""); 3887 text2 = text2.replace(/\n+$/g, ""); 3888 return globals.converter._dispatch("paragraphs.after", text2, options, globals); 3889 }); 3890 showdown2.subParser("runExtension", function(ext, text2, options, globals) { 3891 "use strict"; 3892 if (ext.filter) { 3893 text2 = ext.filter(text2, globals.converter, options); 3894 } else if (ext.regex) { 3895 var re = ext.regex; 3896 if (!(re instanceof RegExp)) { 3897 re = new RegExp(re, "g"); 3898 } 3899 text2 = text2.replace(re, ext.replace); 3900 } 3901 return text2; 3902 }); 3903 showdown2.subParser("spanGamut", function(text2, options, globals) { 3904 "use strict"; 3905 text2 = globals.converter._dispatch("spanGamut.before", text2, options, globals); 3906 text2 = showdown2.subParser("codeSpans")(text2, options, globals); 3907 text2 = showdown2.subParser("escapeSpecialCharsWithinTagAttributes")(text2, options, globals); 3908 text2 = showdown2.subParser("encodeBackslashEscapes")(text2, options, globals); 3909 text2 = showdown2.subParser("images")(text2, options, globals); 3910 text2 = showdown2.subParser("anchors")(text2, options, globals); 3911 text2 = showdown2.subParser("autoLinks")(text2, options, globals); 3912 text2 = showdown2.subParser("simplifiedAutoLinks")(text2, options, globals); 3913 text2 = showdown2.subParser("emoji")(text2, options, globals); 3914 text2 = showdown2.subParser("underline")(text2, options, globals); 3915 text2 = showdown2.subParser("italicsAndBold")(text2, options, globals); 3916 text2 = showdown2.subParser("strikethrough")(text2, options, globals); 3917 text2 = showdown2.subParser("ellipsis")(text2, options, globals); 3918 text2 = showdown2.subParser("hashHTMLSpans")(text2, options, globals); 3919 text2 = showdown2.subParser("encodeAmpsAndAngles")(text2, options, globals); 3920 if (options.simpleLineBreaks) { 3921 if (!/\n\n¨K/.test(text2)) { 3922 text2 = text2.replace(/\n+/g, "<br />\n"); 3923 } 3924 } else { 3925 text2 = text2.replace(/ +\n/g, "<br />\n"); 3926 } 3927 text2 = globals.converter._dispatch("spanGamut.after", text2, options, globals); 3928 return text2; 3929 }); 3930 showdown2.subParser("strikethrough", function(text2, options, globals) { 3931 "use strict"; 3932 function parseInside(txt) { 3933 if (options.simplifiedAutoLink) { 3934 txt = showdown2.subParser("simplifiedAutoLinks")(txt, options, globals); 3935 } 3936 return "<del>" + txt + "</del>"; 3937 } 3938 if (options.strikethrough) { 3939 text2 = globals.converter._dispatch("strikethrough.before", text2, options, globals); 3940 text2 = text2.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(wm, txt) { 3941 return parseInside(txt); 3942 }); 3943 text2 = globals.converter._dispatch("strikethrough.after", text2, options, globals); 3944 } 3945 return text2; 3946 }); 3947 showdown2.subParser("stripLinkDefinitions", function(text2, options, globals) { 3948 "use strict"; 3949 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, 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; 3950 text2 += "\xA80"; 3951 var replaceFunc = function(wholeMatch, linkId, url, width, height, blankLines, title) { 3952 linkId = linkId.toLowerCase(); 3953 if (url.match(/^data:.+?\/.+?;base64,/)) { 3954 globals.gUrls[linkId] = url.replace(/\s/g, ""); 3955 } else { 3956 globals.gUrls[linkId] = showdown2.subParser("encodeAmpsAndAngles")(url, options, globals); 3957 } 3958 if (blankLines) { 3959 return blankLines + title; 3960 } else { 3961 if (title) { 3962 globals.gTitles[linkId] = title.replace(/"|'/g, """); 3963 } 3964 if (options.parseImgDimensions && width && height) { 3965 globals.gDimensions[linkId] = { 3966 width, 3967 height 3968 }; 3969 } 3970 } 3971 return ""; 3972 }; 3973 text2 = text2.replace(base64Regex, replaceFunc); 3974 text2 = text2.replace(regex, replaceFunc); 3975 text2 = text2.replace(/¨0/, ""); 3976 return text2; 3977 }); 3978 showdown2.subParser("tables", function(text2, options, globals) { 3979 "use strict"; 3980 if (!options.tables) { 3981 return text2; 3982 } 3983 var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm, singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm; 3984 function parseStyles(sLine) { 3985 if (/^:[ \t]*--*$/.test(sLine)) { 3986 return ' style="text-align:left;"'; 3987 } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) { 3988 return ' style="text-align:right;"'; 3989 } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) { 3990 return ' style="text-align:center;"'; 3991 } else { 3992 return ""; 3993 } 3994 } 3995 function parseHeaders(header, style) { 3996 var id = ""; 3997 header = header.trim(); 3998 if (options.tablesHeaderId || options.tableHeaderId) { 3999 id = ' id="' + header.replace(/ /g, "_").toLowerCase() + '"'; 4000 } 4001 header = showdown2.subParser("spanGamut")(header, options, globals); 4002 return "<th" + id + style + ">" + header + "</th>\n"; 4003 } 4004 function parseCells(cell, style) { 4005 var subText = showdown2.subParser("spanGamut")(cell, options, globals); 4006 return "<td" + style + ">" + subText + "</td>\n"; 4007 } 4008 function buildTable(headers, cells) { 4009 var tb = "<table>\n<thead>\n<tr>\n", tblLgn = headers.length; 4010 for (var i2 = 0; i2 < tblLgn; ++i2) { 4011 tb += headers[i2]; 4012 } 4013 tb += "</tr>\n</thead>\n<tbody>\n"; 4014 for (i2 = 0; i2 < cells.length; ++i2) { 4015 tb += "<tr>\n"; 4016 for (var ii = 0; ii < tblLgn; ++ii) { 4017 tb += cells[i2][ii]; 4018 } 4019 tb += "</tr>\n"; 4020 } 4021 tb += "</tbody>\n</table>\n"; 4022 return tb; 4023 } 4024 function parseTable(rawTable) { 4025 var i2, tableLines = rawTable.split("\n"); 4026 for (i2 = 0; i2 < tableLines.length; ++i2) { 4027 if (/^ {0,3}\|/.test(tableLines[i2])) { 4028 tableLines[i2] = tableLines[i2].replace(/^ {0,3}\|/, ""); 4029 } 4030 if (/\|[ \t]*$/.test(tableLines[i2])) { 4031 tableLines[i2] = tableLines[i2].replace(/\|[ \t]*$/, ""); 4032 } 4033 tableLines[i2] = showdown2.subParser("codeSpans")(tableLines[i2], options, globals); 4034 } 4035 var rawHeaders = tableLines[0].split("|").map(function(s2) { 4036 return s2.trim(); 4037 }), rawStyles = tableLines[1].split("|").map(function(s2) { 4038 return s2.trim(); 4039 }), rawCells = [], headers = [], styles = [], cells = []; 4040 tableLines.shift(); 4041 tableLines.shift(); 4042 for (i2 = 0; i2 < tableLines.length; ++i2) { 4043 if (tableLines[i2].trim() === "") { 4044 continue; 4045 } 4046 rawCells.push( 4047 tableLines[i2].split("|").map(function(s2) { 4048 return s2.trim(); 4049 }) 4050 ); 4051 } 4052 if (rawHeaders.length < rawStyles.length) { 4053 return rawTable; 4054 } 4055 for (i2 = 0; i2 < rawStyles.length; ++i2) { 4056 styles.push(parseStyles(rawStyles[i2])); 4057 } 4058 for (i2 = 0; i2 < rawHeaders.length; ++i2) { 4059 if (showdown2.helper.isUndefined(styles[i2])) { 4060 styles[i2] = ""; 4061 } 4062 headers.push(parseHeaders(rawHeaders[i2], styles[i2])); 4063 } 4064 for (i2 = 0; i2 < rawCells.length; ++i2) { 4065 var row = []; 4066 for (var ii = 0; ii < headers.length; ++ii) { 4067 if (showdown2.helper.isUndefined(rawCells[i2][ii])) { 4068 } 4069 row.push(parseCells(rawCells[i2][ii], styles[ii])); 4070 } 4071 cells.push(row); 4072 } 4073 return buildTable(headers, cells); 4074 } 4075 text2 = globals.converter._dispatch("tables.before", text2, options, globals); 4076 text2 = text2.replace(/\\(\|)/g, showdown2.helper.escapeCharactersCallback); 4077 text2 = text2.replace(tableRgx, parseTable); 4078 text2 = text2.replace(singeColTblRgx, parseTable); 4079 text2 = globals.converter._dispatch("tables.after", text2, options, globals); 4080 return text2; 4081 }); 4082 showdown2.subParser("underline", function(text2, options, globals) { 4083 "use strict"; 4084 if (!options.underline) { 4085 return text2; 4086 } 4087 text2 = globals.converter._dispatch("underline.before", text2, options, globals); 4088 if (options.literalMidWordUnderscores) { 4089 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) { 4090 return "<u>" + txt + "</u>"; 4091 }); 4092 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) { 4093 return "<u>" + txt + "</u>"; 4094 }); 4095 } else { 4096 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) { 4097 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm; 4098 }); 4099 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) { 4100 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm; 4101 }); 4102 } 4103 text2 = text2.replace(/(_)/g, showdown2.helper.escapeCharactersCallback); 4104 text2 = globals.converter._dispatch("underline.after", text2, options, globals); 4105 return text2; 4106 }); 4107 showdown2.subParser("unescapeSpecialChars", function(text2, options, globals) { 4108 "use strict"; 4109 text2 = globals.converter._dispatch("unescapeSpecialChars.before", text2, options, globals); 4110 text2 = text2.replace(/¨E(\d+)E/g, function(wholeMatch, m1) { 4111 var charCodeToReplace = parseInt(m1); 4112 return String.fromCharCode(charCodeToReplace); 4113 }); 4114 text2 = globals.converter._dispatch("unescapeSpecialChars.after", text2, options, globals); 4115 return text2; 4116 }); 4117 showdown2.subParser("makeMarkdown.blockquote", function(node, globals) { 4118 "use strict"; 4119 var txt = ""; 4120 if (node.hasChildNodes()) { 4121 var children = node.childNodes, childrenLength = children.length; 4122 for (var i2 = 0; i2 < childrenLength; ++i2) { 4123 var innerTxt = showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4124 if (innerTxt === "") { 4125 continue; 4126 } 4127 txt += innerTxt; 4128 } 4129 } 4130 txt = txt.trim(); 4131 txt = "> " + txt.split("\n").join("\n> "); 4132 return txt; 4133 }); 4134 showdown2.subParser("makeMarkdown.codeBlock", function(node, globals) { 4135 "use strict"; 4136 var lang = node.getAttribute("language"), num = node.getAttribute("precodenum"); 4137 return "```" + lang + "\n" + globals.preList[num] + "\n```"; 4138 }); 4139 showdown2.subParser("makeMarkdown.codeSpan", function(node) { 4140 "use strict"; 4141 return "`" + node.innerHTML + "`"; 4142 }); 4143 showdown2.subParser("makeMarkdown.emphasis", function(node, globals) { 4144 "use strict"; 4145 var txt = ""; 4146 if (node.hasChildNodes()) { 4147 txt += "*"; 4148 var children = node.childNodes, childrenLength = children.length; 4149 for (var i2 = 0; i2 < childrenLength; ++i2) { 4150 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4151 } 4152 txt += "*"; 4153 } 4154 return txt; 4155 }); 4156 showdown2.subParser("makeMarkdown.header", function(node, globals, headerLevel) { 4157 "use strict"; 4158 var headerMark = new Array(headerLevel + 1).join("#"), txt = ""; 4159 if (node.hasChildNodes()) { 4160 txt = headerMark + " "; 4161 var children = node.childNodes, childrenLength = children.length; 4162 for (var i2 = 0; i2 < childrenLength; ++i2) { 4163 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4164 } 4165 } 4166 return txt; 4167 }); 4168 showdown2.subParser("makeMarkdown.hr", function() { 4169 "use strict"; 4170 return "---"; 4171 }); 4172 showdown2.subParser("makeMarkdown.image", function(node) { 4173 "use strict"; 4174 var txt = ""; 4175 if (node.hasAttribute("src")) { 4176 txt += " + ">"; 4178 if (node.hasAttribute("width") && node.hasAttribute("height")) { 4179 txt += " =" + node.getAttribute("width") + "x" + node.getAttribute("height"); 4180 } 4181 if (node.hasAttribute("title")) { 4182 txt += ' "' + node.getAttribute("title") + '"'; 4183 } 4184 txt += ")"; 4185 } 4186 return txt; 4187 }); 4188 showdown2.subParser("makeMarkdown.links", function(node, globals) { 4189 "use strict"; 4190 var txt = ""; 4191 if (node.hasChildNodes() && node.hasAttribute("href")) { 4192 var children = node.childNodes, childrenLength = children.length; 4193 txt = "["; 4194 for (var i2 = 0; i2 < childrenLength; ++i2) { 4195 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4196 } 4197 txt += "]("; 4198 txt += "<" + node.getAttribute("href") + ">"; 4199 if (node.hasAttribute("title")) { 4200 txt += ' "' + node.getAttribute("title") + '"'; 4201 } 4202 txt += ")"; 4203 } 4204 return txt; 4205 }); 4206 showdown2.subParser("makeMarkdown.list", function(node, globals, type) { 4207 "use strict"; 4208 var txt = ""; 4209 if (!node.hasChildNodes()) { 4210 return ""; 4211 } 4212 var listItems = node.childNodes, listItemsLenght = listItems.length, listNum = node.getAttribute("start") || 1; 4213 for (var i2 = 0; i2 < listItemsLenght; ++i2) { 4214 if (typeof listItems[i2].tagName === "undefined" || listItems[i2].tagName.toLowerCase() !== "li") { 4215 continue; 4216 } 4217 var bullet = ""; 4218 if (type === "ol") { 4219 bullet = listNum.toString() + ". "; 4220 } else { 4221 bullet = "- "; 4222 } 4223 txt += bullet + showdown2.subParser("makeMarkdown.listItem")(listItems[i2], globals); 4224 ++listNum; 4225 } 4226 txt += "\n<!-- -->\n"; 4227 return txt.trim(); 4228 }); 4229 showdown2.subParser("makeMarkdown.listItem", function(node, globals) { 4230 "use strict"; 4231 var listItemTxt = ""; 4232 var children = node.childNodes, childrenLenght = children.length; 4233 for (var i2 = 0; i2 < childrenLenght; ++i2) { 4234 listItemTxt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4235 } 4236 if (!/\n$/.test(listItemTxt)) { 4237 listItemTxt += "\n"; 4238 } else { 4239 listItemTxt = listItemTxt.split("\n").join("\n ").replace(/^ {4}$/gm, "").replace(/\n\n+/g, "\n\n"); 4240 } 4241 return listItemTxt; 4242 }); 4243 showdown2.subParser("makeMarkdown.node", function(node, globals, spansOnly) { 4244 "use strict"; 4245 spansOnly = spansOnly || false; 4246 var txt = ""; 4247 if (node.nodeType === 3) { 4248 return showdown2.subParser("makeMarkdown.txt")(node, globals); 4249 } 4250 if (node.nodeType === 8) { 4251 return "<!--" + node.data + "-->\n\n"; 4252 } 4253 if (node.nodeType !== 1) { 4254 return ""; 4255 } 4256 var tagName = node.tagName.toLowerCase(); 4257 switch (tagName) { 4258 // 4259 // BLOCKS 4260 // 4261 case "h1": 4262 if (!spansOnly) { 4263 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 1) + "\n\n"; 4264 } 4265 break; 4266 case "h2": 4267 if (!spansOnly) { 4268 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 2) + "\n\n"; 4269 } 4270 break; 4271 case "h3": 4272 if (!spansOnly) { 4273 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 3) + "\n\n"; 4274 } 4275 break; 4276 case "h4": 4277 if (!spansOnly) { 4278 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 4) + "\n\n"; 4279 } 4280 break; 4281 case "h5": 4282 if (!spansOnly) { 4283 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 5) + "\n\n"; 4284 } 4285 break; 4286 case "h6": 4287 if (!spansOnly) { 4288 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 6) + "\n\n"; 4289 } 4290 break; 4291 case "p": 4292 if (!spansOnly) { 4293 txt = showdown2.subParser("makeMarkdown.paragraph")(node, globals) + "\n\n"; 4294 } 4295 break; 4296 case "blockquote": 4297 if (!spansOnly) { 4298 txt = showdown2.subParser("makeMarkdown.blockquote")(node, globals) + "\n\n"; 4299 } 4300 break; 4301 case "hr": 4302 if (!spansOnly) { 4303 txt = showdown2.subParser("makeMarkdown.hr")(node, globals) + "\n\n"; 4304 } 4305 break; 4306 case "ol": 4307 if (!spansOnly) { 4308 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ol") + "\n\n"; 4309 } 4310 break; 4311 case "ul": 4312 if (!spansOnly) { 4313 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ul") + "\n\n"; 4314 } 4315 break; 4316 case "precode": 4317 if (!spansOnly) { 4318 txt = showdown2.subParser("makeMarkdown.codeBlock")(node, globals) + "\n\n"; 4319 } 4320 break; 4321 case "pre": 4322 if (!spansOnly) { 4323 txt = showdown2.subParser("makeMarkdown.pre")(node, globals) + "\n\n"; 4324 } 4325 break; 4326 case "table": 4327 if (!spansOnly) { 4328 txt = showdown2.subParser("makeMarkdown.table")(node, globals) + "\n\n"; 4329 } 4330 break; 4331 // 4332 // SPANS 4333 // 4334 case "code": 4335 txt = showdown2.subParser("makeMarkdown.codeSpan")(node, globals); 4336 break; 4337 case "em": 4338 case "i": 4339 txt = showdown2.subParser("makeMarkdown.emphasis")(node, globals); 4340 break; 4341 case "strong": 4342 case "b": 4343 txt = showdown2.subParser("makeMarkdown.strong")(node, globals); 4344 break; 4345 case "del": 4346 txt = showdown2.subParser("makeMarkdown.strikethrough")(node, globals); 4347 break; 4348 case "a": 4349 txt = showdown2.subParser("makeMarkdown.links")(node, globals); 4350 break; 4351 case "img": 4352 txt = showdown2.subParser("makeMarkdown.image")(node, globals); 4353 break; 4354 default: 4355 txt = node.outerHTML + "\n\n"; 4356 } 4357 return txt; 4358 }); 4359 showdown2.subParser("makeMarkdown.paragraph", function(node, globals) { 4360 "use strict"; 4361 var txt = ""; 4362 if (node.hasChildNodes()) { 4363 var children = node.childNodes, childrenLength = children.length; 4364 for (var i2 = 0; i2 < childrenLength; ++i2) { 4365 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4366 } 4367 } 4368 txt = txt.trim(); 4369 return txt; 4370 }); 4371 showdown2.subParser("makeMarkdown.pre", function(node, globals) { 4372 "use strict"; 4373 var num = node.getAttribute("prenum"); 4374 return "<pre>" + globals.preList[num] + "</pre>"; 4375 }); 4376 showdown2.subParser("makeMarkdown.strikethrough", function(node, globals) { 4377 "use strict"; 4378 var txt = ""; 4379 if (node.hasChildNodes()) { 4380 txt += "~~"; 4381 var children = node.childNodes, childrenLength = children.length; 4382 for (var i2 = 0; i2 < childrenLength; ++i2) { 4383 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4384 } 4385 txt += "~~"; 4386 } 4387 return txt; 4388 }); 4389 showdown2.subParser("makeMarkdown.strong", function(node, globals) { 4390 "use strict"; 4391 var txt = ""; 4392 if (node.hasChildNodes()) { 4393 txt += "**"; 4394 var children = node.childNodes, childrenLength = children.length; 4395 for (var i2 = 0; i2 < childrenLength; ++i2) { 4396 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals); 4397 } 4398 txt += "**"; 4399 } 4400 return txt; 4401 }); 4402 showdown2.subParser("makeMarkdown.table", function(node, globals) { 4403 "use strict"; 4404 var txt = "", tableArray = [[], []], headings = node.querySelectorAll("thead>tr>th"), rows = node.querySelectorAll("tbody>tr"), i2, ii; 4405 for (i2 = 0; i2 < headings.length; ++i2) { 4406 var headContent = showdown2.subParser("makeMarkdown.tableCell")(headings[i2], globals), allign = "---"; 4407 if (headings[i2].hasAttribute("style")) { 4408 var style = headings[i2].getAttribute("style").toLowerCase().replace(/\s/g, ""); 4409 switch (style) { 4410 case "text-align:left;": 4411 allign = ":---"; 4412 break; 4413 case "text-align:right;": 4414 allign = "---:"; 4415 break; 4416 case "text-align:center;": 4417 allign = ":---:"; 4418 break; 4419 } 4420 } 4421 tableArray[0][i2] = headContent.trim(); 4422 tableArray[1][i2] = allign; 4423 } 4424 for (i2 = 0; i2 < rows.length; ++i2) { 4425 var r2 = tableArray.push([]) - 1, cols = rows[i2].getElementsByTagName("td"); 4426 for (ii = 0; ii < headings.length; ++ii) { 4427 var cellContent = " "; 4428 if (typeof cols[ii] !== "undefined") { 4429 cellContent = showdown2.subParser("makeMarkdown.tableCell")(cols[ii], globals); 4430 } 4431 tableArray[r2].push(cellContent); 4432 } 4433 } 4434 var cellSpacesCount = 3; 4435 for (i2 = 0; i2 < tableArray.length; ++i2) { 4436 for (ii = 0; ii < tableArray[i2].length; ++ii) { 4437 var strLen = tableArray[i2][ii].length; 4438 if (strLen > cellSpacesCount) { 4439 cellSpacesCount = strLen; 4440 } 4441 } 4442 } 4443 for (i2 = 0; i2 < tableArray.length; ++i2) { 4444 for (ii = 0; ii < tableArray[i2].length; ++ii) { 4445 if (i2 === 1) { 4446 if (tableArray[i2][ii].slice(-1) === ":") { 4447 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii].slice(-1), cellSpacesCount - 1, "-") + ":"; 4448 } else { 4449 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount, "-"); 4450 } 4451 } else { 4452 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount); 4453 } 4454 } 4455 txt += "| " + tableArray[i2].join(" | ") + " |\n"; 4456 } 4457 return txt.trim(); 4458 }); 4459 showdown2.subParser("makeMarkdown.tableCell", function(node, globals) { 4460 "use strict"; 4461 var txt = ""; 4462 if (!node.hasChildNodes()) { 4463 return ""; 4464 } 4465 var children = node.childNodes, childrenLength = children.length; 4466 for (var i2 = 0; i2 < childrenLength; ++i2) { 4467 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals, true); 4468 } 4469 return txt.trim(); 4470 }); 4471 showdown2.subParser("makeMarkdown.txt", function(node) { 4472 "use strict"; 4473 var txt = node.nodeValue; 4474 txt = txt.replace(/ +/g, " "); 4475 txt = txt.replace(/¨NBSP;/g, " "); 4476 txt = showdown2.helper.unescapeHTMLEntities(txt); 4477 txt = txt.replace(/([*_~|`])/g, "\\$1"); 4478 txt = txt.replace(/^(\s*)>/g, "\\$1>"); 4479 txt = txt.replace(/^#/gm, "\\#"); 4480 txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3"); 4481 txt = txt.replace(/^( {0,3}\d+)\./gm, "$1\\."); 4482 txt = txt.replace(/^( {0,3})([+-])/gm, "$1\\$2"); 4483 txt = txt.replace(/]([\s]*)\(/g, "\\]$1\\("); 4484 txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:"); 4485 return txt; 4486 }); 4487 var root = this; 4488 if (typeof define === "function" && define.amd) { 4489 define(function() { 4490 "use strict"; 4491 return showdown2; 4492 }); 4493 } else if (typeof module !== "undefined" && module.exports) { 4494 module.exports = showdown2; 4495 } else { 4496 root.showdown = showdown2; 4497 } 4498 }).call(exports); 4499 } 4500 }); 4501 4502 // packages/blocks/build-module/index.js 4503 var index_exports = {}; 4504 __export(index_exports, { 4505 __EXPERIMENTAL_ELEMENTS: () => __EXPERIMENTAL_ELEMENTS, 4506 __EXPERIMENTAL_PATHS_WITH_OVERRIDE: () => __EXPERIMENTAL_PATHS_WITH_OVERRIDE, 4507 __EXPERIMENTAL_STYLE_PROPERTY: () => __EXPERIMENTAL_STYLE_PROPERTY, 4508 __experimentalCloneSanitizedBlock: () => __experimentalCloneSanitizedBlock, 4509 __experimentalGetAccessibleBlockLabel: () => getAccessibleBlockLabel, 4510 __experimentalGetBlockAttributesNamesByRole: () => __experimentalGetBlockAttributesNamesByRole, 4511 __experimentalGetBlockLabel: () => getBlockLabel, 4512 __experimentalSanitizeBlockAttributes: () => __experimentalSanitizeBlockAttributes, 4513 __unstableGetBlockProps: () => getBlockProps, 4514 __unstableGetInnerBlocksProps: () => getInnerBlocksProps, 4515 __unstableSerializeAndClean: () => __unstableSerializeAndClean, 4516 children: () => children_default, 4517 cloneBlock: () => cloneBlock, 4518 createBlock: () => createBlock, 4519 createBlocksFromInnerBlocksTemplate: () => createBlocksFromInnerBlocksTemplate, 4520 doBlocksMatchTemplate: () => doBlocksMatchTemplate, 4521 findTransform: () => findTransform, 4522 getBlockAttributes: () => getBlockAttributes, 4523 getBlockAttributesNamesByRole: () => getBlockAttributesNamesByRole, 4524 getBlockBindingsSource: () => getBlockBindingsSource, 4525 getBlockBindingsSources: () => getBlockBindingsSources, 4526 getBlockContent: () => getBlockInnerHTML, 4527 getBlockDefaultClassName: () => getBlockDefaultClassName, 4528 getBlockFromExample: () => getBlockFromExample, 4529 getBlockMenuDefaultClassName: () => getBlockMenuDefaultClassName, 4530 getBlockSupport: () => getBlockSupport, 4531 getBlockTransforms: () => getBlockTransforms, 4532 getBlockType: () => getBlockType, 4533 getBlockTypes: () => getBlockTypes, 4534 getBlockVariations: () => getBlockVariations, 4535 getCategories: () => getCategories2, 4536 getChildBlockNames: () => getChildBlockNames, 4537 getDefaultBlockName: () => getDefaultBlockName, 4538 getFreeformContentHandlerName: () => getFreeformContentHandlerName, 4539 getGroupingBlockName: () => getGroupingBlockName, 4540 getPhrasingContentSchema: () => deprecatedGetPhrasingContentSchema, 4541 getPossibleBlockTransformations: () => getPossibleBlockTransformations, 4542 getSaveContent: () => getSaveContent, 4543 getSaveElement: () => getSaveElement, 4544 getUnregisteredTypeHandlerName: () => getUnregisteredTypeHandlerName, 4545 hasBlockSupport: () => hasBlockSupport, 4546 hasChildBlocks: () => hasChildBlocks, 4547 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport, 4548 isReusableBlock: () => isReusableBlock, 4549 isTemplatePart: () => isTemplatePart, 4550 isUnmodifiedBlock: () => isUnmodifiedBlock, 4551 isUnmodifiedDefaultBlock: () => isUnmodifiedDefaultBlock, 4552 isValidBlockContent: () => isValidBlockContent, 4553 isValidIcon: () => isValidIcon, 4554 node: () => node_default, 4555 normalizeIconObject: () => normalizeIconObject, 4556 parse: () => parse2, 4557 parseWithAttributeSchema: () => parseWithAttributeSchema, 4558 pasteHandler: () => pasteHandler, 4559 privateApis: () => privateApis, 4560 rawHandler: () => rawHandler, 4561 registerBlockBindingsSource: () => registerBlockBindingsSource, 4562 registerBlockCollection: () => registerBlockCollection, 4563 registerBlockStyle: () => registerBlockStyle, 4564 registerBlockType: () => registerBlockType, 4565 registerBlockVariation: () => registerBlockVariation, 4566 serialize: () => serialize, 4567 serializeRawBlock: () => serializeRawBlock, 4568 setCategories: () => setCategories2, 4569 setDefaultBlockName: () => setDefaultBlockName, 4570 setFreeformContentHandlerName: () => setFreeformContentHandlerName, 4571 setGroupingBlockName: () => setGroupingBlockName, 4572 setUnregisteredTypeHandlerName: () => setUnregisteredTypeHandlerName, 4573 store: () => store, 4574 switchToBlockType: () => switchToBlockType, 4575 synchronizeBlocksWithTemplate: () => synchronizeBlocksWithTemplate, 4576 unregisterBlockBindingsSource: () => unregisterBlockBindingsSource, 4577 unregisterBlockStyle: () => unregisterBlockStyle, 4578 unregisterBlockType: () => unregisterBlockType, 4579 unregisterBlockVariation: () => unregisterBlockVariation, 4580 unstable__bootstrapServerSideBlockDefinitions: () => unstable__bootstrapServerSideBlockDefinitions, 4581 updateCategory: () => updateCategory2, 4582 validateBlock: () => validateBlock, 4583 withBlockContentContext: () => withBlockContentContext 4584 }); 4585 4586 // packages/blocks/build-module/store/index.js 4587 var import_data5 = __toESM(require_data()); 4588 4589 // node_modules/tslib/tslib.es6.mjs 4590 var __assign = function() { 4591 __assign = Object.assign || function __assign2(t3) { 4592 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { 4593 s2 = arguments[i2]; 4594 for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t3[p2] = s2[p2]; 4595 } 4596 return t3; 4597 }; 4598 return __assign.apply(this, arguments); 4599 }; 4600 4601 // node_modules/lower-case/dist.es2015/index.js 4602 function lowerCase(str) { 4603 return str.toLowerCase(); 4604 } 4605 4606 // node_modules/no-case/dist.es2015/index.js 4607 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 4608 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 4609 function noCase(input, options) { 4610 if (options === void 0) { 4611 options = {}; 4612 } 4613 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 4614 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 4615 var start = 0; 4616 var end = result.length; 4617 while (result.charAt(start) === "\0") 4618 start++; 4619 while (result.charAt(end - 1) === "\0") 4620 end--; 4621 return result.slice(start, end).split("\0").map(transform).join(delimiter); 4622 } 4623 function replace(input, re, value) { 4624 if (re instanceof RegExp) 4625 return input.replace(re, value); 4626 return re.reduce(function(input2, re2) { 4627 return input2.replace(re2, value); 4628 }, input); 4629 } 4630 4631 // node_modules/pascal-case/dist.es2015/index.js 4632 function pascalCaseTransform(input, index) { 4633 var firstChar = input.charAt(0); 4634 var lowerChars = input.substr(1).toLowerCase(); 4635 if (index > 0 && firstChar >= "0" && firstChar <= "9") { 4636 return "_" + firstChar + lowerChars; 4637 } 4638 return "" + firstChar.toUpperCase() + lowerChars; 4639 } 4640 function pascalCase(input, options) { 4641 if (options === void 0) { 4642 options = {}; 4643 } 4644 return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options)); 4645 } 4646 4647 // node_modules/camel-case/dist.es2015/index.js 4648 function camelCaseTransform(input, index) { 4649 if (index === 0) 4650 return input.toLowerCase(); 4651 return pascalCaseTransform(input, index); 4652 } 4653 function camelCase(input, options) { 4654 if (options === void 0) { 4655 options = {}; 4656 } 4657 return pascalCase(input, __assign({ transform: camelCaseTransform }, options)); 4658 } 4659 4660 // packages/blocks/build-module/store/reducer.js 4661 var import_data2 = __toESM(require_data()); 4662 var import_i18n3 = __toESM(require_i18n()); 4663 4664 // node_modules/colord/index.mjs 4665 var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 4666 var t = function(r2) { 4667 return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2; 4668 }; 4669 var n = function(r2, t3, n2) { 4670 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r2) / n2 + 0; 4671 }; 4672 var e = function(r2, t3, n2) { 4673 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t3 ? r2 : t3; 4674 }; 4675 var u = function(r2) { 4676 return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360; 4677 }; 4678 var a = function(r2) { 4679 return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) }; 4680 }; 4681 var o = function(r2) { 4682 return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) }; 4683 }; 4684 var i = /^#([0-9a-f]{3,8})$/i; 4685 var s = function(r2) { 4686 var t3 = r2.toString(16); 4687 return t3.length < 2 ? "0" + t3 : t3; 4688 }; 4689 var h = function(r2) { 4690 var t3 = r2.r, n2 = r2.g, e2 = r2.b, u2 = r2.a, a2 = Math.max(t3, n2, e2), o3 = a2 - Math.min(t3, n2, e2), i2 = o3 ? a2 === t3 ? (n2 - e2) / o3 : a2 === n2 ? 2 + (e2 - t3) / o3 : 4 + (t3 - n2) / o3 : 0; 4691 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; 4692 }; 4693 var b = function(r2) { 4694 var t3 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a; 4695 t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100; 4696 var a2 = Math.floor(t3), o3 = e2 * (1 - n2), i2 = e2 * (1 - (t3 - a2) * n2), s2 = e2 * (1 - (1 - t3 + a2) * n2), h2 = a2 % 6; 4697 return { r: 255 * [e2, i2, o3, o3, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o3, o3][h2], b: 255 * [o3, o3, s2, e2, e2, i2][h2], a: u2 }; 4698 }; 4699 var g = function(r2) { 4700 return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) }; 4701 }; 4702 var d = function(r2) { 4703 return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) }; 4704 }; 4705 var f = function(r2) { 4706 return b((n2 = (t3 = r2).s, { h: t3.h, s: (n2 *= ((e2 = t3.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t3.a })); 4707 var t3, n2, e2; 4708 }; 4709 var c = function(r2) { 4710 return { h: (t3 = h(r2)).h, s: (u2 = (200 - (n2 = t3.s)) * (e2 = t3.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t3.a }; 4711 var t3, n2, e2, u2; 4712 }; 4713 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4714 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4715 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4716 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 4717 var y = { string: [[function(r2) { 4718 var t3 = i.exec(r2); 4719 return t3 ? (r2 = t3[1]).length <= 4 ? { r: parseInt(r2[0] + r2[0], 16), g: parseInt(r2[1] + r2[1], 16), b: parseInt(r2[2] + r2[2], 16), a: 4 === r2.length ? n(parseInt(r2[3] + r2[3], 16) / 255, 2) : 1 } : 6 === r2.length || 8 === r2.length ? { r: parseInt(r2.substr(0, 2), 16), g: parseInt(r2.substr(2, 2), 16), b: parseInt(r2.substr(4, 2), 16), a: 8 === r2.length ? n(parseInt(r2.substr(6, 2), 16) / 255, 2) : 1 } : null : null; 4720 }, "hex"], [function(r2) { 4721 var t3 = v.exec(r2) || m.exec(r2); 4722 return t3 ? t3[2] !== t3[4] || t3[4] !== t3[6] ? null : a({ r: Number(t3[1]) / (t3[2] ? 100 / 255 : 1), g: Number(t3[3]) / (t3[4] ? 100 / 255 : 1), b: Number(t3[5]) / (t3[6] ? 100 / 255 : 1), a: void 0 === t3[7] ? 1 : Number(t3[7]) / (t3[8] ? 100 : 1) }) : null; 4723 }, "rgb"], [function(t3) { 4724 var n2 = l.exec(t3) || p.exec(t3); 4725 if (!n2) return null; 4726 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) }); 4727 return f(a2); 4728 }, "hsl"]], object: [[function(r2) { 4729 var n2 = r2.r, e2 = r2.g, u2 = r2.b, o3 = r2.a, i2 = void 0 === o3 ? 1 : o3; 4730 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; 4731 }, "rgb"], [function(r2) { 4732 var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o3 = void 0 === a2 ? 1 : a2; 4733 if (!t(n2) || !t(e2) || !t(u2)) return null; 4734 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) }); 4735 return f(i2); 4736 }, "hsl"], [function(r2) { 4737 var n2 = r2.h, a2 = r2.s, o3 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2; 4738 if (!t(n2) || !t(a2) || !t(o3)) return null; 4739 var h2 = (function(r3) { 4740 return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) }; 4741 })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) }); 4742 return b(h2); 4743 }, "hsv"]] }; 4744 var N = function(r2, t3) { 4745 for (var n2 = 0; n2 < t3.length; n2++) { 4746 var e2 = t3[n2][0](r2); 4747 if (e2) return [e2, t3[n2][1]]; 4748 } 4749 return [null, void 0]; 4750 }; 4751 var x = function(r2) { 4752 return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0]; 4753 }; 4754 var M = function(r2, t3) { 4755 var n2 = c(r2); 4756 return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a }; 4757 }; 4758 var H = function(r2) { 4759 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255; 4760 }; 4761 var $ = function(r2, t3) { 4762 var n2 = c(r2); 4763 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a }; 4764 }; 4765 var j = (function() { 4766 function r2(r3) { 4767 this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 4768 } 4769 return r2.prototype.isValid = function() { 4770 return null !== this.parsed; 4771 }, r2.prototype.brightness = function() { 4772 return n(H(this.rgba), 2); 4773 }, r2.prototype.isDark = function() { 4774 return H(this.rgba) < 0.5; 4775 }, r2.prototype.isLight = function() { 4776 return H(this.rgba) >= 0.5; 4777 }, r2.prototype.toHex = function() { 4778 return r3 = o(this.rgba), t3 = r3.r, e2 = r3.g, u2 = r3.b, i2 = (a2 = r3.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t3) + s(e2) + s(u2) + i2; 4779 var r3, t3, e2, u2, a2, i2; 4780 }, r2.prototype.toRgb = function() { 4781 return o(this.rgba); 4782 }, r2.prototype.toRgbString = function() { 4783 return r3 = o(this.rgba), t3 = r3.r, n2 = r3.g, e2 = r3.b, (u2 = r3.a) < 1 ? "rgba(" + t3 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t3 + ", " + n2 + ", " + e2 + ")"; 4784 var r3, t3, n2, e2, u2; 4785 }, r2.prototype.toHsl = function() { 4786 return d(c(this.rgba)); 4787 }, r2.prototype.toHslString = function() { 4788 return r3 = d(c(this.rgba)), t3 = r3.h, n2 = r3.s, e2 = r3.l, (u2 = r3.a) < 1 ? "hsla(" + t3 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t3 + ", " + n2 + "%, " + e2 + "%)"; 4789 var r3, t3, n2, e2, u2; 4790 }, r2.prototype.toHsv = function() { 4791 return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) }; 4792 var r3; 4793 }, r2.prototype.invert = function() { 4794 return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a }); 4795 var r3; 4796 }, r2.prototype.saturate = function(r3) { 4797 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3)); 4798 }, r2.prototype.desaturate = function(r3) { 4799 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3)); 4800 }, r2.prototype.grayscale = function() { 4801 return w(M(this.rgba, -1)); 4802 }, r2.prototype.lighten = function(r3) { 4803 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3)); 4804 }, r2.prototype.darken = function(r3) { 4805 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3)); 4806 }, r2.prototype.rotate = function(r3) { 4807 return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3); 4808 }, r2.prototype.alpha = function(r3) { 4809 return "number" == typeof r3 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r3 }) : n(this.rgba.a, 3); 4810 var t3; 4811 }, r2.prototype.hue = function(r3) { 4812 var t3 = c(this.rgba); 4813 return "number" == typeof r3 ? w({ h: r3, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h); 4814 }, r2.prototype.isEqual = function(r3) { 4815 return this.toHex() === w(r3).toHex(); 4816 }, r2; 4817 })(); 4818 var w = function(r2) { 4819 return r2 instanceof j ? r2 : new j(r2); 4820 }; 4821 var S = []; 4822 var k = function(r2) { 4823 r2.forEach(function(r3) { 4824 S.indexOf(r3) < 0 && (r3(j, y), S.push(r3)); 4825 }); 4826 }; 4827 4828 // node_modules/colord/plugins/names.mjs 4829 function names_default(e2, f2) { 4830 var a2 = { 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" }, r2 = {}; 4831 for (var d2 in a2) r2[a2[d2]] = d2; 4832 var l2 = {}; 4833 e2.prototype.toName = function(f3) { 4834 if (!(this.rgba.a || this.rgba.r || this.rgba.g || this.rgba.b)) return "transparent"; 4835 var d3, i2, n2 = r2[this.toHex()]; 4836 if (n2) return n2; 4837 if (null == f3 ? void 0 : f3.closest) { 4838 var o3 = this.toRgb(), t3 = 1 / 0, b2 = "black"; 4839 if (!l2.length) for (var c2 in a2) l2[c2] = new e2(a2[c2]).toRgb(); 4840 for (var g2 in a2) { 4841 var u2 = (d3 = o3, i2 = l2[g2], Math.pow(d3.r - i2.r, 2) + Math.pow(d3.g - i2.g, 2) + Math.pow(d3.b - i2.b, 2)); 4842 u2 < t3 && (t3 = u2, b2 = g2); 4843 } 4844 return b2; 4845 } 4846 }; 4847 f2.string.push([function(f3) { 4848 var r3 = f3.toLowerCase(), d3 = "transparent" === r3 ? "#0000" : a2[r3]; 4849 return d3 ? new e2(d3).toRgb() : null; 4850 }, "name"]); 4851 } 4852 4853 // node_modules/colord/plugins/a11y.mjs 4854 var o2 = function(o3) { 4855 var t3 = o3 / 255; 4856 return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4); 4857 }; 4858 var t2 = function(t3) { 4859 return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b); 4860 }; 4861 function a11y_default(o3) { 4862 o3.prototype.luminance = function() { 4863 return o4 = t2(this.rgba), void 0 === (r2 = 2) && (r2 = 0), void 0 === n2 && (n2 = Math.pow(10, r2)), Math.round(n2 * o4) / n2 + 0; 4864 var o4, r2, n2; 4865 }, o3.prototype.contrast = function(r2) { 4866 void 0 === r2 && (r2 = "#FFF"); 4867 var n2, a2, i2, e2, v2, u2, d2, c2 = r2 instanceof o3 ? r2 : new o3(r2); 4868 return e2 = this.rgba, v2 = c2.toRgb(), u2 = t2(e2), d2 = t2(v2), n2 = u2 > d2 ? (u2 + 0.05) / (d2 + 0.05) : (d2 + 0.05) / (u2 + 0.05), void 0 === (a2 = 2) && (a2 = 0), void 0 === i2 && (i2 = Math.pow(10, a2)), Math.floor(i2 * n2) / i2 + 0; 4869 }, o3.prototype.isReadable = function(o4, t3) { 4870 return void 0 === o4 && (o4 = "#FFF"), void 0 === t3 && (t3 = {}), this.contrast(o4) >= (e2 = void 0 === (i2 = (r2 = t3).size) ? "normal" : i2, "AAA" === (a2 = void 0 === (n2 = r2.level) ? "AA" : n2) && "normal" === e2 ? 7 : "AA" === a2 && "large" === e2 ? 3 : 4.5); 4871 var r2, n2, a2, i2, e2; 4872 }; 4873 } 4874 4875 // packages/blocks/build-module/api/utils.js 4876 var import_element = __toESM(require_element()); 4877 var import_i18n2 = __toESM(require_i18n()); 4878 var import_dom = __toESM(require_dom()); 4879 var import_rich_text = __toESM(require_rich_text()); 4880 var import_deprecated = __toESM(require_deprecated()); 4881 4882 // packages/blocks/build-module/api/constants.js 4883 var BLOCK_ICON_DEFAULT = "block-default"; 4884 var DEPRECATED_ENTRY_KEYS = [ 4885 "attributes", 4886 "supports", 4887 "save", 4888 "migrate", 4889 "isEligible", 4890 "apiVersion" 4891 ]; 4892 var __EXPERIMENTAL_STYLE_PROPERTY = { 4893 // Kept for back-compatibility purposes. 4894 "--wp--style--color--link": { 4895 value: ["color", "link"], 4896 support: ["color", "link"] 4897 }, 4898 aspectRatio: { 4899 value: ["dimensions", "aspectRatio"], 4900 support: ["dimensions", "aspectRatio"], 4901 useEngine: true 4902 }, 4903 background: { 4904 value: ["color", "gradient"], 4905 support: ["color", "gradients"], 4906 useEngine: true 4907 }, 4908 backgroundColor: { 4909 value: ["color", "background"], 4910 support: ["color", "background"], 4911 requiresOptOut: true, 4912 useEngine: true 4913 }, 4914 backgroundImage: { 4915 value: ["background", "backgroundImage"], 4916 support: ["background", "backgroundImage"], 4917 useEngine: true 4918 }, 4919 backgroundRepeat: { 4920 value: ["background", "backgroundRepeat"], 4921 support: ["background", "backgroundRepeat"], 4922 useEngine: true 4923 }, 4924 backgroundSize: { 4925 value: ["background", "backgroundSize"], 4926 support: ["background", "backgroundSize"], 4927 useEngine: true 4928 }, 4929 backgroundPosition: { 4930 value: ["background", "backgroundPosition"], 4931 support: ["background", "backgroundPosition"], 4932 useEngine: true 4933 }, 4934 borderColor: { 4935 value: ["border", "color"], 4936 support: ["__experimentalBorder", "color"], 4937 useEngine: true 4938 }, 4939 borderRadius: { 4940 value: ["border", "radius"], 4941 support: ["__experimentalBorder", "radius"], 4942 properties: { 4943 borderTopLeftRadius: "topLeft", 4944 borderTopRightRadius: "topRight", 4945 borderBottomLeftRadius: "bottomLeft", 4946 borderBottomRightRadius: "bottomRight" 4947 }, 4948 useEngine: true 4949 }, 4950 borderStyle: { 4951 value: ["border", "style"], 4952 support: ["__experimentalBorder", "style"], 4953 useEngine: true 4954 }, 4955 borderWidth: { 4956 value: ["border", "width"], 4957 support: ["__experimentalBorder", "width"], 4958 useEngine: true 4959 }, 4960 borderTopColor: { 4961 value: ["border", "top", "color"], 4962 support: ["__experimentalBorder", "color"], 4963 useEngine: true 4964 }, 4965 borderTopStyle: { 4966 value: ["border", "top", "style"], 4967 support: ["__experimentalBorder", "style"], 4968 useEngine: true 4969 }, 4970 borderTopWidth: { 4971 value: ["border", "top", "width"], 4972 support: ["__experimentalBorder", "width"], 4973 useEngine: true 4974 }, 4975 borderRightColor: { 4976 value: ["border", "right", "color"], 4977 support: ["__experimentalBorder", "color"], 4978 useEngine: true 4979 }, 4980 borderRightStyle: { 4981 value: ["border", "right", "style"], 4982 support: ["__experimentalBorder", "style"], 4983 useEngine: true 4984 }, 4985 borderRightWidth: { 4986 value: ["border", "right", "width"], 4987 support: ["__experimentalBorder", "width"], 4988 useEngine: true 4989 }, 4990 borderBottomColor: { 4991 value: ["border", "bottom", "color"], 4992 support: ["__experimentalBorder", "color"], 4993 useEngine: true 4994 }, 4995 borderBottomStyle: { 4996 value: ["border", "bottom", "style"], 4997 support: ["__experimentalBorder", "style"], 4998 useEngine: true 4999 }, 5000 borderBottomWidth: { 5001 value: ["border", "bottom", "width"], 5002 support: ["__experimentalBorder", "width"], 5003 useEngine: true 5004 }, 5005 borderLeftColor: { 5006 value: ["border", "left", "color"], 5007 support: ["__experimentalBorder", "color"], 5008 useEngine: true 5009 }, 5010 borderLeftStyle: { 5011 value: ["border", "left", "style"], 5012 support: ["__experimentalBorder", "style"], 5013 useEngine: true 5014 }, 5015 borderLeftWidth: { 5016 value: ["border", "left", "width"], 5017 support: ["__experimentalBorder", "width"], 5018 useEngine: true 5019 }, 5020 color: { 5021 value: ["color", "text"], 5022 support: ["color", "text"], 5023 requiresOptOut: true, 5024 useEngine: true 5025 }, 5026 columnCount: { 5027 value: ["typography", "textColumns"], 5028 support: ["typography", "textColumns"], 5029 useEngine: true 5030 }, 5031 filter: { 5032 value: ["filter", "duotone"], 5033 support: ["filter", "duotone"] 5034 }, 5035 linkColor: { 5036 value: ["elements", "link", "color", "text"], 5037 support: ["color", "link"] 5038 }, 5039 captionColor: { 5040 value: ["elements", "caption", "color", "text"], 5041 support: ["color", "caption"] 5042 }, 5043 buttonColor: { 5044 value: ["elements", "button", "color", "text"], 5045 support: ["color", "button"] 5046 }, 5047 buttonBackgroundColor: { 5048 value: ["elements", "button", "color", "background"], 5049 support: ["color", "button"] 5050 }, 5051 headingColor: { 5052 value: ["elements", "heading", "color", "text"], 5053 support: ["color", "heading"] 5054 }, 5055 headingBackgroundColor: { 5056 value: ["elements", "heading", "color", "background"], 5057 support: ["color", "heading"] 5058 }, 5059 fontFamily: { 5060 value: ["typography", "fontFamily"], 5061 support: ["typography", "__experimentalFontFamily"], 5062 useEngine: true 5063 }, 5064 fontSize: { 5065 value: ["typography", "fontSize"], 5066 support: ["typography", "fontSize"], 5067 useEngine: true 5068 }, 5069 fontStyle: { 5070 value: ["typography", "fontStyle"], 5071 support: ["typography", "__experimentalFontStyle"], 5072 useEngine: true 5073 }, 5074 fontWeight: { 5075 value: ["typography", "fontWeight"], 5076 support: ["typography", "__experimentalFontWeight"], 5077 useEngine: true 5078 }, 5079 lineHeight: { 5080 value: ["typography", "lineHeight"], 5081 support: ["typography", "lineHeight"], 5082 useEngine: true 5083 }, 5084 margin: { 5085 value: ["spacing", "margin"], 5086 support: ["spacing", "margin"], 5087 properties: { 5088 marginTop: "top", 5089 marginRight: "right", 5090 marginBottom: "bottom", 5091 marginLeft: "left" 5092 }, 5093 useEngine: true 5094 }, 5095 minHeight: { 5096 value: ["dimensions", "minHeight"], 5097 support: ["dimensions", "minHeight"], 5098 useEngine: true 5099 }, 5100 height: { 5101 value: ["dimensions", "height"], 5102 support: ["dimensions", "height"], 5103 useEngine: true 5104 }, 5105 width: { 5106 value: ["dimensions", "width"], 5107 support: ["dimensions", "width"], 5108 useEngine: true 5109 }, 5110 padding: { 5111 value: ["spacing", "padding"], 5112 support: ["spacing", "padding"], 5113 properties: { 5114 paddingTop: "top", 5115 paddingRight: "right", 5116 paddingBottom: "bottom", 5117 paddingLeft: "left" 5118 }, 5119 useEngine: true 5120 }, 5121 textAlign: { 5122 value: ["typography", "textAlign"], 5123 support: ["typography", "textAlign"], 5124 useEngine: false 5125 }, 5126 textDecoration: { 5127 value: ["typography", "textDecoration"], 5128 support: ["typography", "__experimentalTextDecoration"], 5129 useEngine: true 5130 }, 5131 textTransform: { 5132 value: ["typography", "textTransform"], 5133 support: ["typography", "__experimentalTextTransform"], 5134 useEngine: true 5135 }, 5136 letterSpacing: { 5137 value: ["typography", "letterSpacing"], 5138 support: ["typography", "__experimentalLetterSpacing"], 5139 useEngine: true 5140 }, 5141 writingMode: { 5142 value: ["typography", "writingMode"], 5143 support: ["typography", "__experimentalWritingMode"], 5144 useEngine: true 5145 }, 5146 "--wp--style--root--padding": { 5147 value: ["spacing", "padding"], 5148 support: ["spacing", "padding"], 5149 properties: { 5150 "--wp--style--root--padding-top": "top", 5151 "--wp--style--root--padding-right": "right", 5152 "--wp--style--root--padding-bottom": "bottom", 5153 "--wp--style--root--padding-left": "left" 5154 }, 5155 rootOnly: true 5156 } 5157 }; 5158 var __EXPERIMENTAL_ELEMENTS = { 5159 link: "a:where(:not(.wp-element-button))", 5160 heading: "h1, h2, h3, h4, h5, h6", 5161 h1: "h1", 5162 h2: "h2", 5163 h3: "h3", 5164 h4: "h4", 5165 h5: "h5", 5166 h6: "h6", 5167 button: ".wp-element-button, .wp-block-button__link", 5168 caption: ".wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption", 5169 cite: "cite", 5170 select: "select", 5171 textInput: "textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=url])" 5172 }; 5173 var __EXPERIMENTAL_PATHS_WITH_OVERRIDE = { 5174 "color.duotone": true, 5175 "color.gradients": true, 5176 "color.palette": true, 5177 "dimensions.aspectRatios": true, 5178 "typography.fontSizes": true, 5179 "spacing.spacingSizes": true 5180 }; 5181 5182 // packages/blocks/build-module/api/registration.js 5183 var import_data = __toESM(require_data()); 5184 var import_i18n = __toESM(require_i18n()); 5185 var import_warning = __toESM(require_warning()); 5186 5187 // packages/blocks/build-module/api/i18n-block.json 5188 var i18n_block_default = { 5189 title: "block title", 5190 description: "block description", 5191 keywords: ["block keyword"], 5192 styles: [ 5193 { 5194 label: "block style label" 5195 } 5196 ], 5197 variations: [ 5198 { 5199 title: "block variation title", 5200 description: "block variation description", 5201 keywords: ["block variation keyword"] 5202 } 5203 ] 5204 }; 5205 5206 // packages/blocks/build-module/lock-unlock.js 5207 var import_private_apis = __toESM(require_private_apis()); 5208 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 5209 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 5210 "@wordpress/blocks" 5211 ); 5212 5213 // packages/blocks/build-module/api/registration.js 5214 function isObject(object) { 5215 return object !== null && typeof object === "object"; 5216 } 5217 function unstable__bootstrapServerSideBlockDefinitions(definitions) { 5218 const { addBootstrappedBlockType: addBootstrappedBlockType2 } = unlock((0, import_data.dispatch)(store)); 5219 for (const [name, blockType] of Object.entries(definitions)) { 5220 addBootstrappedBlockType2(name, blockType); 5221 } 5222 } 5223 function getBlockSettingsFromMetadata({ textdomain, ...metadata }) { 5224 const allowedFields = [ 5225 "apiVersion", 5226 "title", 5227 "category", 5228 "parent", 5229 "ancestor", 5230 "icon", 5231 "description", 5232 "keywords", 5233 "attributes", 5234 "providesContext", 5235 "usesContext", 5236 "selectors", 5237 "supports", 5238 "styles", 5239 "example", 5240 "variations", 5241 "blockHooks", 5242 "allowedBlocks" 5243 ]; 5244 const settings = Object.fromEntries( 5245 Object.entries(metadata).filter( 5246 ([key]) => allowedFields.includes(key) 5247 ) 5248 ); 5249 if (textdomain) { 5250 Object.keys(i18n_block_default).forEach((key) => { 5251 if (!settings[key]) { 5252 return; 5253 } 5254 settings[key] = translateBlockSettingUsingI18nSchema( 5255 i18n_block_default[key], 5256 settings[key], 5257 textdomain 5258 ); 5259 }); 5260 } 5261 return settings; 5262 } 5263 function registerBlockType(blockNameOrMetadata, settings) { 5264 const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata; 5265 if (typeof name !== "string") { 5266 (0, import_warning.default)("Block names must be strings."); 5267 return; 5268 } 5269 if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) { 5270 (0, import_warning.default)( 5271 "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" 5272 ); 5273 return; 5274 } 5275 if ((0, import_data.select)(store).getBlockType(name)) { 5276 (0, import_warning.default)('Block "' + name + '" is already registered.'); 5277 return; 5278 } 5279 const { addBootstrappedBlockType: addBootstrappedBlockType2, addUnprocessedBlockType: addUnprocessedBlockType2 } = unlock( 5280 (0, import_data.dispatch)(store) 5281 ); 5282 if (isObject(blockNameOrMetadata)) { 5283 const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata); 5284 addBootstrappedBlockType2(name, metadata); 5285 } 5286 addUnprocessedBlockType2(name, settings); 5287 return (0, import_data.select)(store).getBlockType(name); 5288 } 5289 function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) { 5290 if (typeof i18nSchema === "string" && typeof settingValue === "string") { 5291 return (0, import_i18n._x)(settingValue, i18nSchema, textdomain); 5292 } 5293 if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) { 5294 return settingValue.map( 5295 (value) => translateBlockSettingUsingI18nSchema( 5296 i18nSchema[0], 5297 value, 5298 textdomain 5299 ) 5300 ); 5301 } 5302 if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) { 5303 return Object.keys(settingValue).reduce((accumulator, key) => { 5304 if (!i18nSchema[key]) { 5305 accumulator[key] = settingValue[key]; 5306 return accumulator; 5307 } 5308 accumulator[key] = translateBlockSettingUsingI18nSchema( 5309 i18nSchema[key], 5310 settingValue[key], 5311 textdomain 5312 ); 5313 return accumulator; 5314 }, {}); 5315 } 5316 return settingValue; 5317 } 5318 function registerBlockCollection(namespace, { title, icon }) { 5319 (0, import_data.dispatch)(store).addBlockCollection(namespace, title, icon); 5320 } 5321 function unregisterBlockType(name) { 5322 const oldBlock = (0, import_data.select)(store).getBlockType(name); 5323 if (!oldBlock) { 5324 (0, import_warning.default)('Block "' + name + '" is not registered.'); 5325 return; 5326 } 5327 (0, import_data.dispatch)(store).removeBlockTypes(name); 5328 return oldBlock; 5329 } 5330 function setFreeformContentHandlerName(blockName) { 5331 (0, import_data.dispatch)(store).setFreeformFallbackBlockName(blockName); 5332 } 5333 function getFreeformContentHandlerName() { 5334 return (0, import_data.select)(store).getFreeformFallbackBlockName(); 5335 } 5336 function getGroupingBlockName() { 5337 return (0, import_data.select)(store).getGroupingBlockName(); 5338 } 5339 function setUnregisteredTypeHandlerName(blockName) { 5340 (0, import_data.dispatch)(store).setUnregisteredFallbackBlockName(blockName); 5341 } 5342 function getUnregisteredTypeHandlerName() { 5343 return (0, import_data.select)(store).getUnregisteredFallbackBlockName(); 5344 } 5345 function setDefaultBlockName(name) { 5346 (0, import_data.dispatch)(store).setDefaultBlockName(name); 5347 } 5348 function setGroupingBlockName(name) { 5349 (0, import_data.dispatch)(store).setGroupingBlockName(name); 5350 } 5351 function getDefaultBlockName() { 5352 return (0, import_data.select)(store).getDefaultBlockName(); 5353 } 5354 function getBlockType(name) { 5355 return (0, import_data.select)(store)?.getBlockType(name); 5356 } 5357 function getBlockTypes() { 5358 return (0, import_data.select)(store).getBlockTypes(); 5359 } 5360 function getBlockSupport(nameOrType, feature, defaultSupports) { 5361 return (0, import_data.select)(store).getBlockSupport( 5362 nameOrType, 5363 feature, 5364 defaultSupports 5365 ); 5366 } 5367 function hasBlockSupport(nameOrType, feature, defaultSupports) { 5368 return (0, import_data.select)(store).hasBlockSupport( 5369 nameOrType, 5370 feature, 5371 defaultSupports 5372 ); 5373 } 5374 function isReusableBlock(blockOrType) { 5375 return blockOrType?.name === "core/block"; 5376 } 5377 function isTemplatePart(blockOrType) { 5378 return blockOrType?.name === "core/template-part"; 5379 } 5380 var getChildBlockNames = (blockName) => { 5381 return (0, import_data.select)(store).getChildBlockNames(blockName); 5382 }; 5383 var hasChildBlocks = (blockName) => { 5384 return (0, import_data.select)(store).hasChildBlocks(blockName); 5385 }; 5386 var hasChildBlocksWithInserterSupport = (blockName) => { 5387 return (0, import_data.select)(store).hasChildBlocksWithInserterSupport(blockName); 5388 }; 5389 var registerBlockStyle = (blockNames, styleVariation) => { 5390 (0, import_data.dispatch)(store).addBlockStyles(blockNames, styleVariation); 5391 }; 5392 var unregisterBlockStyle = (blockName, styleVariationName) => { 5393 (0, import_data.dispatch)(store).removeBlockStyles(blockName, styleVariationName); 5394 }; 5395 var getBlockVariations = (blockName, scope) => { 5396 return (0, import_data.select)(store).getBlockVariations(blockName, scope); 5397 }; 5398 var registerBlockVariation = (blockName, variation) => { 5399 if (typeof variation.name !== "string") { 5400 (0, import_warning.default)("Variation names must be unique strings."); 5401 } 5402 (0, import_data.dispatch)(store).addBlockVariations(blockName, variation); 5403 }; 5404 var unregisterBlockVariation = (blockName, variationName) => { 5405 (0, import_data.dispatch)(store).removeBlockVariations(blockName, variationName); 5406 }; 5407 var registerBlockBindingsSource = (source) => { 5408 const { 5409 name, 5410 label, 5411 usesContext, 5412 getValues, 5413 setValues, 5414 canUserEditValue, 5415 getFieldsList 5416 } = source; 5417 const existingSource = unlock( 5418 (0, import_data.select)(store) 5419 ).getBlockBindingsSource(name); 5420 const serverProps = ["label", "usesContext"]; 5421 for (const prop2 in existingSource) { 5422 if (!serverProps.includes(prop2) && existingSource[prop2]) { 5423 (0, import_warning.default)( 5424 'Block bindings source "' + name + '" is already registered.' 5425 ); 5426 return; 5427 } 5428 } 5429 if (!name) { 5430 (0, import_warning.default)("Block bindings source must contain a name."); 5431 return; 5432 } 5433 if (typeof name !== "string") { 5434 (0, import_warning.default)("Block bindings source name must be a string."); 5435 return; 5436 } 5437 if (/[A-Z]+/.test(name)) { 5438 (0, import_warning.default)( 5439 "Block bindings source name must not contain uppercase characters." 5440 ); 5441 return; 5442 } 5443 if (!/^[a-z0-9/-]+$/.test(name)) { 5444 (0, import_warning.default)( 5445 "Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source." 5446 ); 5447 return; 5448 } 5449 if (!/^[a-z0-9-]+\/[a-z0-9-]+$/.test(name)) { 5450 (0, import_warning.default)( 5451 "Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source." 5452 ); 5453 return; 5454 } 5455 if (!label && !existingSource?.label) { 5456 (0, import_warning.default)("Block bindings source must contain a label."); 5457 return; 5458 } 5459 if (label && typeof label !== "string") { 5460 (0, import_warning.default)("Block bindings source label must be a string."); 5461 return; 5462 } 5463 if (label && existingSource?.label && label !== existingSource?.label) { 5464 (0, import_warning.default)('Block bindings "' + name + '" source label was overridden.'); 5465 } 5466 if (usesContext && !Array.isArray(usesContext)) { 5467 (0, import_warning.default)("Block bindings source usesContext must be an array."); 5468 return; 5469 } 5470 if (getValues && typeof getValues !== "function") { 5471 (0, import_warning.default)("Block bindings source getValues must be a function."); 5472 return; 5473 } 5474 if (setValues && typeof setValues !== "function") { 5475 (0, import_warning.default)("Block bindings source setValues must be a function."); 5476 return; 5477 } 5478 if (canUserEditValue && typeof canUserEditValue !== "function") { 5479 (0, import_warning.default)("Block bindings source canUserEditValue must be a function."); 5480 return; 5481 } 5482 if (getFieldsList && typeof getFieldsList !== "function") { 5483 (0, import_warning.default)("Block bindings source getFieldsList must be a function."); 5484 return; 5485 } 5486 return unlock((0, import_data.dispatch)(store)).addBlockBindingsSource(source); 5487 }; 5488 function unregisterBlockBindingsSource(name) { 5489 const oldSource = getBlockBindingsSource(name); 5490 if (!oldSource) { 5491 (0, import_warning.default)('Block bindings source "' + name + '" is not registered.'); 5492 return; 5493 } 5494 unlock((0, import_data.dispatch)(store)).removeBlockBindingsSource(name); 5495 } 5496 function getBlockBindingsSource(name) { 5497 return unlock((0, import_data.select)(store)).getBlockBindingsSource(name); 5498 } 5499 function getBlockBindingsSources() { 5500 return unlock((0, import_data.select)(store)).getAllBlockBindingsSources(); 5501 } 5502 5503 // packages/blocks/build-module/api/utils.js 5504 k([names_default, a11y_default]); 5505 var ICON_COLORS = ["#191e23", "#f8f9f9"]; 5506 function isUnmodifiedBlock(block, role) { 5507 const blockAttributes = getBlockType(block.name)?.attributes ?? {}; 5508 const attributesByRole = role ? Object.entries(blockAttributes).filter(([key, definition]) => { 5509 if (role === "content" && key === "metadata") { 5510 return Object.keys(block.attributes[key]?.bindings ?? {}).length > 0; 5511 } 5512 return definition.role === role || definition.__experimentalRole === role; 5513 }) : []; 5514 const attributesToCheck = !!attributesByRole.length ? attributesByRole : Object.entries(blockAttributes); 5515 return attributesToCheck.every(([key, definition]) => { 5516 const value = block.attributes[key]; 5517 if (definition.hasOwnProperty("default")) { 5518 return value === definition.default; 5519 } 5520 if (definition.type === "rich-text") { 5521 return !value?.length; 5522 } 5523 return value === void 0; 5524 }); 5525 } 5526 function isUnmodifiedDefaultBlock(block, role) { 5527 return block.name === getDefaultBlockName() && isUnmodifiedBlock(block, role); 5528 } 5529 function isValidIcon(icon) { 5530 return !!icon && (typeof icon === "string" || (0, import_element.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element.Component); 5531 } 5532 function normalizeIconObject(icon) { 5533 icon = icon || BLOCK_ICON_DEFAULT; 5534 if (isValidIcon(icon)) { 5535 return { src: icon }; 5536 } 5537 if ("background" in icon) { 5538 const colordBgColor = w(icon.background); 5539 const getColorContrast = (iconColor) => colordBgColor.contrast(iconColor); 5540 const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast)); 5541 return { 5542 ...icon, 5543 foreground: icon.foreground ? icon.foreground : ICON_COLORS.find( 5544 (iconColor) => getColorContrast(iconColor) === maxContrast 5545 ), 5546 shadowColor: colordBgColor.alpha(0.3).toRgbString() 5547 }; 5548 } 5549 return icon; 5550 } 5551 function normalizeBlockType(blockTypeOrName) { 5552 if (typeof blockTypeOrName === "string") { 5553 return getBlockType(blockTypeOrName); 5554 } 5555 return blockTypeOrName; 5556 } 5557 function getBlockLabel(blockType, attributes, context = "visual") { 5558 const { __experimentalLabel: getLabel, title } = blockType; 5559 const label = getLabel && getLabel(attributes, { context }); 5560 if (!label) { 5561 return title; 5562 } 5563 if (label.toPlainText) { 5564 return label.toPlainText(); 5565 } 5566 return (0, import_dom.__unstableStripHTML)(label); 5567 } 5568 function getAccessibleBlockLabel(blockType, attributes, position, direction = "vertical") { 5569 const title = blockType?.title; 5570 const label = blockType ? getBlockLabel(blockType, attributes, "accessibility") : ""; 5571 const hasPosition = position !== void 0; 5572 const hasLabel = label && label !== title; 5573 if (hasPosition && direction === "vertical") { 5574 if (hasLabel) { 5575 return (0, import_i18n2.sprintf)( 5576 /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ 5577 (0, import_i18n2.__)("%1$s Block. Row %2$d. %3$s"), 5578 title, 5579 position, 5580 label 5581 ); 5582 } 5583 return (0, import_i18n2.sprintf)( 5584 /* translators: accessibility text. 1: The block title. 2: The block row number. */ 5585 (0, import_i18n2.__)("%1$s Block. Row %2$d"), 5586 title, 5587 position 5588 ); 5589 } else if (hasPosition && direction === "horizontal") { 5590 if (hasLabel) { 5591 return (0, import_i18n2.sprintf)( 5592 /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ 5593 (0, import_i18n2.__)("%1$s Block. Column %2$d. %3$s"), 5594 title, 5595 position, 5596 label 5597 ); 5598 } 5599 return (0, import_i18n2.sprintf)( 5600 /* translators: accessibility text. 1: The block title. 2: The block column number. */ 5601 (0, import_i18n2.__)("%1$s Block. Column %2$d"), 5602 title, 5603 position 5604 ); 5605 } 5606 if (hasLabel) { 5607 return (0, import_i18n2.sprintf)( 5608 /* translators: accessibility text. 1: The block title. 2: The block label. */ 5609 (0, import_i18n2.__)("%1$s Block. %2$s"), 5610 title, 5611 label 5612 ); 5613 } 5614 return (0, import_i18n2.sprintf)( 5615 /* translators: accessibility text. %s: The block title. */ 5616 (0, import_i18n2.__)("%s Block"), 5617 title 5618 ); 5619 } 5620 function getDefault(attributeSchema) { 5621 if (attributeSchema.default !== void 0) { 5622 return attributeSchema.default; 5623 } 5624 if (attributeSchema.type === "rich-text") { 5625 return new import_rich_text.RichTextData(); 5626 } 5627 } 5628 function isBlockRegistered(name) { 5629 return getBlockType(name) !== void 0; 5630 } 5631 function __experimentalSanitizeBlockAttributes(name, attributes) { 5632 const blockType = getBlockType(name); 5633 if (void 0 === blockType) { 5634 throw new Error(`Block type '$name}' is not registered.`); 5635 } 5636 return Object.entries(blockType.attributes).reduce( 5637 (accumulator, [key, schema]) => { 5638 const value = attributes[key]; 5639 if (void 0 !== value) { 5640 if (schema.type === "rich-text") { 5641 if (value instanceof import_rich_text.RichTextData) { 5642 accumulator[key] = value; 5643 } else if (typeof value === "string") { 5644 accumulator[key] = import_rich_text.RichTextData.fromHTMLString(value); 5645 } 5646 } else if (schema.type === "string" && value instanceof import_rich_text.RichTextData) { 5647 accumulator[key] = value.toHTMLString(); 5648 } else { 5649 accumulator[key] = value; 5650 } 5651 } else { 5652 const _default = getDefault(schema); 5653 if (void 0 !== _default) { 5654 accumulator[key] = _default; 5655 } 5656 } 5657 if (["node", "children"].indexOf(schema.source) !== -1) { 5658 if (typeof accumulator[key] === "string") { 5659 accumulator[key] = [accumulator[key]]; 5660 } else if (!Array.isArray(accumulator[key])) { 5661 accumulator[key] = []; 5662 } 5663 } 5664 return accumulator; 5665 }, 5666 {} 5667 ); 5668 } 5669 function getBlockAttributesNamesByRole(name, role) { 5670 const attributes = getBlockType(name)?.attributes; 5671 if (!attributes) { 5672 return []; 5673 } 5674 const attributesNames = Object.keys(attributes); 5675 if (!role) { 5676 return attributesNames; 5677 } 5678 return attributesNames.filter((attributeName) => { 5679 const attribute = attributes[attributeName]; 5680 if (attribute?.role === role) { 5681 return true; 5682 } 5683 if (attribute?.__experimentalRole === role) { 5684 (0, import_deprecated.default)("__experimentalRole attribute", { 5685 since: "6.7", 5686 version: "6.8", 5687 alternative: "role attribute", 5688 hint: `Check the block.json of the $name} block.` 5689 }); 5690 return true; 5691 } 5692 return false; 5693 }); 5694 } 5695 var __experimentalGetBlockAttributesNamesByRole = (...args) => { 5696 (0, import_deprecated.default)("__experimentalGetBlockAttributesNamesByRole", { 5697 since: "6.7", 5698 version: "6.8", 5699 alternative: "getBlockAttributesNamesByRole" 5700 }); 5701 return getBlockAttributesNamesByRole(...args); 5702 }; 5703 function isContentBlock(name) { 5704 const blockType = getBlockType(name); 5705 const attributes = blockType?.attributes; 5706 const supportsContentRole = blockType?.supports?.contentRole; 5707 if (supportsContentRole) { 5708 return true; 5709 } 5710 if (!attributes) { 5711 return false; 5712 } 5713 return !!Object.keys(attributes)?.some((attributeKey) => { 5714 const attribute = attributes[attributeKey]; 5715 return attribute?.role === "content" || attribute?.__experimentalRole === "content"; 5716 }); 5717 } 5718 function omit(object, keys) { 5719 return Object.fromEntries( 5720 Object.entries(object).filter(([key]) => !keys.includes(key)) 5721 ); 5722 } 5723 5724 // packages/blocks/build-module/store/reducer.js 5725 var DEFAULT_CATEGORIES = [ 5726 { slug: "text", title: (0, import_i18n3.__)("Text") }, 5727 { slug: "media", title: (0, import_i18n3.__)("Media") }, 5728 { slug: "design", title: (0, import_i18n3.__)("Design") }, 5729 { slug: "widgets", title: (0, import_i18n3.__)("Widgets") }, 5730 { slug: "theme", title: (0, import_i18n3.__)("Theme") }, 5731 { slug: "embed", title: (0, import_i18n3.__)("Embeds") }, 5732 { slug: "reusable", title: (0, import_i18n3.__)("Reusable blocks") } 5733 ]; 5734 function keyBlockTypesByName(types) { 5735 return types.reduce( 5736 (newBlockTypes, block) => ({ 5737 ...newBlockTypes, 5738 [block.name]: block 5739 }), 5740 {} 5741 ); 5742 } 5743 function getUniqueItemsByName(items) { 5744 return items.reduce((acc, currentItem) => { 5745 if (!acc.some((item) => item.name === currentItem.name)) { 5746 acc.push(currentItem); 5747 } 5748 return acc; 5749 }, []); 5750 } 5751 function bootstrappedBlockTypes(state = {}, action) { 5752 switch (action.type) { 5753 case "ADD_BOOTSTRAPPED_BLOCK_TYPE": 5754 const { name, blockType } = action; 5755 const serverDefinition = state[name]; 5756 if (serverDefinition) { 5757 return state; 5758 } 5759 const newDefinition = Object.fromEntries( 5760 Object.entries(blockType).filter( 5761 ([, value]) => value !== null && value !== void 0 5762 ).map(([key, value]) => [camelCase(key), value]) 5763 ); 5764 newDefinition.name = name; 5765 return { 5766 ...state, 5767 [name]: newDefinition 5768 }; 5769 case "REMOVE_BLOCK_TYPES": 5770 return omit(state, action.names); 5771 } 5772 return state; 5773 } 5774 function unprocessedBlockTypes(state = {}, action) { 5775 switch (action.type) { 5776 case "ADD_UNPROCESSED_BLOCK_TYPE": 5777 return { 5778 ...state, 5779 [action.name]: action.blockType 5780 }; 5781 case "REMOVE_BLOCK_TYPES": 5782 return omit(state, action.names); 5783 } 5784 return state; 5785 } 5786 function blockTypes(state = {}, action) { 5787 switch (action.type) { 5788 case "ADD_BLOCK_TYPES": 5789 return { 5790 ...state, 5791 ...keyBlockTypesByName(action.blockTypes) 5792 }; 5793 case "REMOVE_BLOCK_TYPES": 5794 return omit(state, action.names); 5795 } 5796 return state; 5797 } 5798 function blockStyles(state = {}, action) { 5799 switch (action.type) { 5800 case "ADD_BLOCK_TYPES": 5801 return { 5802 ...state, 5803 ...Object.fromEntries( 5804 Object.entries( 5805 keyBlockTypesByName(action.blockTypes) 5806 ).map(([name, blockType]) => [ 5807 name, 5808 getUniqueItemsByName([ 5809 ...(blockType.styles ?? []).map((style) => ({ 5810 ...style, 5811 source: "block" 5812 })), 5813 ...(state[blockType.name] ?? []).filter( 5814 ({ source }) => "block" !== source 5815 ) 5816 ]) 5817 ]) 5818 ) 5819 }; 5820 case "ADD_BLOCK_STYLES": 5821 const updatedStyles = {}; 5822 action.blockNames.forEach((blockName) => { 5823 updatedStyles[blockName] = getUniqueItemsByName([ 5824 ...state[blockName] ?? [], 5825 ...action.styles 5826 ]); 5827 }); 5828 return { ...state, ...updatedStyles }; 5829 case "REMOVE_BLOCK_STYLES": 5830 return { 5831 ...state, 5832 [action.blockName]: (state[action.blockName] ?? []).filter( 5833 (style) => action.styleNames.indexOf(style.name) === -1 5834 ) 5835 }; 5836 } 5837 return state; 5838 } 5839 function blockVariations(state = {}, action) { 5840 switch (action.type) { 5841 case "ADD_BLOCK_TYPES": 5842 return { 5843 ...state, 5844 ...Object.fromEntries( 5845 Object.entries( 5846 keyBlockTypesByName(action.blockTypes) 5847 ).map(([name, blockType]) => { 5848 return [ 5849 name, 5850 getUniqueItemsByName([ 5851 ...(blockType.variations ?? []).map( 5852 (variation) => ({ 5853 ...variation, 5854 source: "block" 5855 }) 5856 ), 5857 ...(state[blockType.name] ?? []).filter( 5858 ({ source }) => "block" !== source 5859 ) 5860 ]) 5861 ]; 5862 }) 5863 ) 5864 }; 5865 case "ADD_BLOCK_VARIATIONS": 5866 return { 5867 ...state, 5868 [action.blockName]: getUniqueItemsByName([ 5869 ...state[action.blockName] ?? [], 5870 ...action.variations 5871 ]) 5872 }; 5873 case "REMOVE_BLOCK_VARIATIONS": 5874 return { 5875 ...state, 5876 [action.blockName]: (state[action.blockName] ?? []).filter( 5877 (variation) => action.variationNames.indexOf(variation.name) === -1 5878 ) 5879 }; 5880 } 5881 return state; 5882 } 5883 function createBlockNameSetterReducer(setActionType) { 5884 return (state = null, action) => { 5885 switch (action.type) { 5886 case "REMOVE_BLOCK_TYPES": 5887 if (action.names.indexOf(state) !== -1) { 5888 return null; 5889 } 5890 return state; 5891 case setActionType: 5892 return action.name || null; 5893 } 5894 return state; 5895 }; 5896 } 5897 var defaultBlockName = createBlockNameSetterReducer( 5898 "SET_DEFAULT_BLOCK_NAME" 5899 ); 5900 var freeformFallbackBlockName = createBlockNameSetterReducer( 5901 "SET_FREEFORM_FALLBACK_BLOCK_NAME" 5902 ); 5903 var unregisteredFallbackBlockName = createBlockNameSetterReducer( 5904 "SET_UNREGISTERED_FALLBACK_BLOCK_NAME" 5905 ); 5906 var groupingBlockName = createBlockNameSetterReducer( 5907 "SET_GROUPING_BLOCK_NAME" 5908 ); 5909 function categories(state = DEFAULT_CATEGORIES, action) { 5910 switch (action.type) { 5911 case "SET_CATEGORIES": 5912 const uniqueCategories = /* @__PURE__ */ new Map(); 5913 (action.categories || []).forEach((category) => { 5914 uniqueCategories.set(category.slug, category); 5915 }); 5916 return [...uniqueCategories.values()]; 5917 case "UPDATE_CATEGORY": { 5918 if (!action.category || !Object.keys(action.category).length) { 5919 return state; 5920 } 5921 const categoryToChange = state.find( 5922 ({ slug }) => slug === action.slug 5923 ); 5924 if (categoryToChange) { 5925 return state.map((category) => { 5926 if (category.slug === action.slug) { 5927 return { 5928 ...category, 5929 ...action.category 5930 }; 5931 } 5932 return category; 5933 }); 5934 } 5935 } 5936 } 5937 return state; 5938 } 5939 function collections(state = {}, action) { 5940 switch (action.type) { 5941 case "ADD_BLOCK_COLLECTION": 5942 return { 5943 ...state, 5944 [action.namespace]: { 5945 title: action.title, 5946 icon: action.icon 5947 } 5948 }; 5949 case "REMOVE_BLOCK_COLLECTION": 5950 return omit(state, action.namespace); 5951 } 5952 return state; 5953 } 5954 function getMergedUsesContext(existingUsesContext = [], newUsesContext = []) { 5955 const mergedArrays = Array.from( 5956 new Set(existingUsesContext.concat(newUsesContext)) 5957 ); 5958 return mergedArrays.length > 0 ? mergedArrays : void 0; 5959 } 5960 function blockBindingsSources(state = {}, action) { 5961 switch (action.type) { 5962 case "ADD_BLOCK_BINDINGS_SOURCE": 5963 return { 5964 ...state, 5965 [action.name]: { 5966 label: action.label || state[action.name]?.label, 5967 usesContext: getMergedUsesContext( 5968 state[action.name]?.usesContext, 5969 action.usesContext 5970 ), 5971 getValues: action.getValues, 5972 setValues: action.setValues, 5973 // Only set `canUserEditValue` if `setValues` is also defined. 5974 canUserEditValue: action.setValues && action.canUserEditValue, 5975 getFieldsList: action.getFieldsList 5976 } 5977 }; 5978 case "REMOVE_BLOCK_BINDINGS_SOURCE": 5979 return omit(state, action.name); 5980 } 5981 return state; 5982 } 5983 var reducer_default = (0, import_data2.combineReducers)({ 5984 bootstrappedBlockTypes, 5985 unprocessedBlockTypes, 5986 blockTypes, 5987 blockStyles, 5988 blockVariations, 5989 defaultBlockName, 5990 freeformFallbackBlockName, 5991 unregisteredFallbackBlockName, 5992 groupingBlockName, 5993 categories, 5994 collections, 5995 blockBindingsSources 5996 }); 5997 5998 // packages/blocks/build-module/store/selectors.js 5999 var selectors_exports = {}; 6000 __export(selectors_exports, { 6001 __experimentalHasContentRoleAttribute: () => __experimentalHasContentRoleAttribute, 6002 getActiveBlockVariation: () => getActiveBlockVariation, 6003 getBlockStyles: () => getBlockStyles, 6004 getBlockSupport: () => getBlockSupport2, 6005 getBlockType: () => getBlockType2, 6006 getBlockTypes: () => getBlockTypes2, 6007 getBlockVariations: () => getBlockVariations2, 6008 getCategories: () => getCategories, 6009 getChildBlockNames: () => getChildBlockNames2, 6010 getCollections: () => getCollections, 6011 getDefaultBlockName: () => getDefaultBlockName2, 6012 getDefaultBlockVariation: () => getDefaultBlockVariation, 6013 getFreeformFallbackBlockName: () => getFreeformFallbackBlockName, 6014 getGroupingBlockName: () => getGroupingBlockName2, 6015 getUnregisteredFallbackBlockName: () => getUnregisteredFallbackBlockName, 6016 hasBlockSupport: () => hasBlockSupport2, 6017 hasChildBlocks: () => hasChildBlocks2, 6018 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport2, 6019 isMatchingSearchTerm: () => isMatchingSearchTerm 6020 }); 6021 var import_remove_accents = __toESM(require_remove_accents()); 6022 var import_data4 = __toESM(require_data()); 6023 var import_rich_text2 = __toESM(require_rich_text()); 6024 var import_deprecated3 = __toESM(require_deprecated()); 6025 6026 // packages/blocks/build-module/store/utils.js 6027 var getValueFromObjectPath = (object, path, defaultValue) => { 6028 const normalizedPath = Array.isArray(path) ? path : path.split("."); 6029 let value = object; 6030 normalizedPath.forEach((fieldName) => { 6031 value = value?.[fieldName]; 6032 }); 6033 return value ?? defaultValue; 6034 }; 6035 function isObject2(candidate) { 6036 return typeof candidate === "object" && candidate.constructor === Object && candidate !== null; 6037 } 6038 function matchesAttributes(blockAttributes, variationAttributes) { 6039 if (isObject2(blockAttributes) && isObject2(variationAttributes)) { 6040 return Object.entries(variationAttributes).every( 6041 ([key, value]) => matchesAttributes(blockAttributes?.[key], value) 6042 ); 6043 } 6044 return blockAttributes === variationAttributes; 6045 } 6046 6047 // packages/blocks/build-module/store/private-selectors.js 6048 var private_selectors_exports = {}; 6049 __export(private_selectors_exports, { 6050 getAllBlockBindingsSources: () => getAllBlockBindingsSources, 6051 getBlockBindingsSource: () => getBlockBindingsSource2, 6052 getBlockBindingsSourceFieldsList: () => getBlockBindingsSourceFieldsList, 6053 getBootstrappedBlockType: () => getBootstrappedBlockType, 6054 getSupportedStyles: () => getSupportedStyles, 6055 getUnprocessedBlockTypes: () => getUnprocessedBlockTypes, 6056 hasContentRoleAttribute: () => hasContentRoleAttribute 6057 }); 6058 var import_data3 = __toESM(require_data()); 6059 var import_deprecated2 = __toESM(require_deprecated()); 6060 var ROOT_BLOCK_SUPPORTS = [ 6061 "background", 6062 "backgroundColor", 6063 "color", 6064 "linkColor", 6065 "captionColor", 6066 "buttonColor", 6067 "headingColor", 6068 "fontFamily", 6069 "fontSize", 6070 "fontStyle", 6071 "fontWeight", 6072 "lineHeight", 6073 "padding", 6074 "contentSize", 6075 "wideSize", 6076 "blockGap", 6077 "textAlign", 6078 "textDecoration", 6079 "textTransform", 6080 "letterSpacing" 6081 ]; 6082 function filterElementBlockSupports(blockSupports, name, element) { 6083 return blockSupports.filter((support) => { 6084 if (support === "fontSize" && element === "heading") { 6085 return false; 6086 } 6087 if (support === "textDecoration" && !name && element !== "link") { 6088 return false; 6089 } 6090 if (support === "textTransform" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes( 6091 element 6092 ) || element === "button" || element === "caption" || element === "text")) { 6093 return false; 6094 } 6095 if (support === "letterSpacing" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes( 6096 element 6097 ) || element === "button" || element === "caption" || element === "text")) { 6098 return false; 6099 } 6100 if (support === "textColumns" && !name) { 6101 return false; 6102 } 6103 return true; 6104 }); 6105 } 6106 var getSupportedStyles = (0, import_data3.createSelector)( 6107 (state, name, element) => { 6108 if (!name) { 6109 return filterElementBlockSupports( 6110 ROOT_BLOCK_SUPPORTS, 6111 name, 6112 element 6113 ); 6114 } 6115 const blockType = getBlockType2(state, name); 6116 if (!blockType) { 6117 return []; 6118 } 6119 const supportKeys = []; 6120 if (blockType?.supports?.spacing?.blockGap) { 6121 supportKeys.push("blockGap"); 6122 } 6123 if (blockType?.supports?.shadow) { 6124 supportKeys.push("shadow"); 6125 } 6126 Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach((styleName) => { 6127 if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { 6128 return; 6129 } 6130 if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { 6131 if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath( 6132 blockType.supports, 6133 __EXPERIMENTAL_STYLE_PROPERTY[styleName].support 6134 ) !== false) { 6135 supportKeys.push(styleName); 6136 return; 6137 } 6138 } 6139 if (getValueFromObjectPath( 6140 blockType.supports, 6141 __EXPERIMENTAL_STYLE_PROPERTY[styleName].support, 6142 false 6143 )) { 6144 supportKeys.push(styleName); 6145 } 6146 }); 6147 return filterElementBlockSupports(supportKeys, name, element); 6148 }, 6149 (state, name) => [state.blockTypes[name]] 6150 ); 6151 function getBootstrappedBlockType(state, name) { 6152 return state.bootstrappedBlockTypes[name]; 6153 } 6154 function getUnprocessedBlockTypes(state) { 6155 return state.unprocessedBlockTypes; 6156 } 6157 function getAllBlockBindingsSources(state) { 6158 return state.blockBindingsSources; 6159 } 6160 function getBlockBindingsSource2(state, sourceName) { 6161 return state.blockBindingsSources[sourceName]; 6162 } 6163 var getBlockBindingsSourceFieldsList = (0, import_data3.createRegistrySelector)( 6164 (select3) => (0, import_data3.createSelector)( 6165 (state, source, blockContext) => { 6166 if (!source.getFieldsList) { 6167 return []; 6168 } 6169 const context = {}; 6170 if (source?.usesContext?.length) { 6171 for (const key of source.usesContext) { 6172 context[key] = blockContext[key]; 6173 } 6174 } 6175 return source.getFieldsList({ select: select3, context }); 6176 }, 6177 (state, source, blockContext) => [ 6178 source.getFieldsList, 6179 source.usesContext, 6180 blockContext 6181 ] 6182 ) 6183 ); 6184 var hasContentRoleAttribute = (state, blockTypeName) => { 6185 const blockType = getBlockType2(state, blockTypeName); 6186 if (!blockType) { 6187 return false; 6188 } 6189 return Object.values(blockType.attributes).some( 6190 ({ role, __experimentalRole }) => { 6191 if (role === "content") { 6192 return true; 6193 } 6194 if (__experimentalRole === "content") { 6195 (0, import_deprecated2.default)("__experimentalRole attribute", { 6196 since: "6.7", 6197 version: "6.8", 6198 alternative: "role attribute", 6199 hint: `Check the block.json of the $blockTypeName} block.` 6200 }); 6201 return true; 6202 } 6203 return false; 6204 } 6205 ); 6206 }; 6207 6208 // packages/blocks/build-module/store/selectors.js 6209 var getNormalizedBlockType = (state, nameOrType) => "string" === typeof nameOrType ? getBlockType2(state, nameOrType) : nameOrType; 6210 var getBlockTypes2 = (0, import_data4.createSelector)( 6211 (state) => Object.values(state.blockTypes), 6212 (state) => [state.blockTypes] 6213 ); 6214 function getBlockType2(state, name) { 6215 return state.blockTypes[name]; 6216 } 6217 function getBlockStyles(state, name) { 6218 return state.blockStyles[name]; 6219 } 6220 var getBlockVariations2 = (0, import_data4.createSelector)( 6221 (state, blockName, scope) => { 6222 const variations = state.blockVariations[blockName]; 6223 if (!variations || !scope) { 6224 return variations; 6225 } 6226 return variations.filter((variation) => { 6227 return (variation.scope || ["block", "inserter"]).includes( 6228 scope 6229 ); 6230 }); 6231 }, 6232 (state, blockName) => [state.blockVariations[blockName]] 6233 ); 6234 function getActiveBlockVariation(state, blockName, attributes, scope) { 6235 const variations = getBlockVariations2(state, blockName, scope); 6236 if (!variations) { 6237 return variations; 6238 } 6239 const blockType = getBlockType2(state, blockName); 6240 const attributeKeys = Object.keys(blockType?.attributes || {}); 6241 let match; 6242 let maxMatchedAttributes = 0; 6243 for (const variation of variations) { 6244 if (Array.isArray(variation.isActive)) { 6245 const definedAttributes = variation.isActive.filter( 6246 (attribute) => { 6247 const topLevelAttribute = attribute.split(".")[0]; 6248 return attributeKeys.includes(topLevelAttribute); 6249 } 6250 ); 6251 const definedAttributesLength = definedAttributes.length; 6252 if (definedAttributesLength === 0) { 6253 continue; 6254 } 6255 const isMatch = definedAttributes.every((attribute) => { 6256 const variationAttributeValue = getValueFromObjectPath( 6257 variation.attributes, 6258 attribute 6259 ); 6260 if (variationAttributeValue === void 0) { 6261 return false; 6262 } 6263 let blockAttributeValue = getValueFromObjectPath( 6264 attributes, 6265 attribute 6266 ); 6267 if (blockAttributeValue instanceof import_rich_text2.RichTextData) { 6268 blockAttributeValue = blockAttributeValue.toHTMLString(); 6269 } 6270 return matchesAttributes( 6271 blockAttributeValue, 6272 variationAttributeValue 6273 ); 6274 }); 6275 if (isMatch && definedAttributesLength > maxMatchedAttributes) { 6276 match = variation; 6277 maxMatchedAttributes = definedAttributesLength; 6278 } 6279 } else if (variation.isActive?.(attributes, variation.attributes)) { 6280 return match || variation; 6281 } 6282 } 6283 if (!match && ["block", "transform"].includes(scope)) { 6284 match = variations.find( 6285 (variation) => variation?.isDefault && !Object.hasOwn(variation, "isActive") 6286 ); 6287 } 6288 return match; 6289 } 6290 function getDefaultBlockVariation(state, blockName, scope) { 6291 const variations = getBlockVariations2(state, blockName, scope); 6292 const defaultVariation = [...variations].reverse().find(({ isDefault }) => !!isDefault); 6293 return defaultVariation || variations[0]; 6294 } 6295 function getCategories(state) { 6296 return state.categories; 6297 } 6298 function getCollections(state) { 6299 return state.collections; 6300 } 6301 function getDefaultBlockName2(state) { 6302 return state.defaultBlockName; 6303 } 6304 function getFreeformFallbackBlockName(state) { 6305 return state.freeformFallbackBlockName; 6306 } 6307 function getUnregisteredFallbackBlockName(state) { 6308 return state.unregisteredFallbackBlockName; 6309 } 6310 function getGroupingBlockName2(state) { 6311 return state.groupingBlockName; 6312 } 6313 var getChildBlockNames2 = (0, import_data4.createSelector)( 6314 (state, blockName) => { 6315 return getBlockTypes2(state).filter((blockType) => { 6316 return blockType.parent?.includes(blockName); 6317 }).map(({ name }) => name); 6318 }, 6319 (state) => [state.blockTypes] 6320 ); 6321 var getBlockSupport2 = (state, nameOrType, feature, defaultSupports) => { 6322 const blockType = getNormalizedBlockType(state, nameOrType); 6323 if (!blockType?.supports) { 6324 return defaultSupports; 6325 } 6326 return getValueFromObjectPath( 6327 blockType.supports, 6328 feature, 6329 defaultSupports 6330 ); 6331 }; 6332 function hasBlockSupport2(state, nameOrType, feature, defaultSupports) { 6333 return !!getBlockSupport2(state, nameOrType, feature, defaultSupports); 6334 } 6335 function getNormalizedSearchTerm(term) { 6336 return (0, import_remove_accents.default)(term ?? "").toLowerCase().trim(); 6337 } 6338 function isMatchingSearchTerm(state, nameOrType, searchTerm = "") { 6339 const blockType = getNormalizedBlockType(state, nameOrType); 6340 const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); 6341 const isSearchMatch = (candidate) => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm); 6342 return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === "string" && isSearchMatch(blockType.description); 6343 } 6344 var hasChildBlocks2 = (state, blockName) => { 6345 return getChildBlockNames2(state, blockName).length > 0; 6346 }; 6347 var hasChildBlocksWithInserterSupport2 = (state, blockName) => { 6348 return getChildBlockNames2(state, blockName).some((childBlockName) => { 6349 return hasBlockSupport2(state, childBlockName, "inserter", true); 6350 }); 6351 }; 6352 var __experimentalHasContentRoleAttribute = (...args) => { 6353 (0, import_deprecated3.default)("__experimentalHasContentRoleAttribute", { 6354 since: "6.7", 6355 version: "6.8", 6356 hint: "This is a private selector." 6357 }); 6358 return hasContentRoleAttribute(...args); 6359 }; 6360 6361 // packages/blocks/build-module/store/actions.js 6362 var actions_exports = {}; 6363 __export(actions_exports, { 6364 __experimentalReapplyBlockFilters: () => __experimentalReapplyBlockFilters, 6365 addBlockCollection: () => addBlockCollection, 6366 addBlockStyles: () => addBlockStyles, 6367 addBlockTypes: () => addBlockTypes, 6368 addBlockVariations: () => addBlockVariations, 6369 reapplyBlockTypeFilters: () => reapplyBlockTypeFilters, 6370 removeBlockCollection: () => removeBlockCollection, 6371 removeBlockStyles: () => removeBlockStyles, 6372 removeBlockTypes: () => removeBlockTypes, 6373 removeBlockVariations: () => removeBlockVariations, 6374 setCategories: () => setCategories, 6375 setDefaultBlockName: () => setDefaultBlockName2, 6376 setFreeformFallbackBlockName: () => setFreeformFallbackBlockName, 6377 setGroupingBlockName: () => setGroupingBlockName2, 6378 setUnregisteredFallbackBlockName: () => setUnregisteredFallbackBlockName, 6379 updateCategory: () => updateCategory 6380 }); 6381 var import_deprecated5 = __toESM(require_deprecated()); 6382 6383 // node_modules/is-plain-object/dist/is-plain-object.mjs 6384 function isObject3(o3) { 6385 return Object.prototype.toString.call(o3) === "[object Object]"; 6386 } 6387 function isPlainObject(o3) { 6388 var ctor, prot; 6389 if (isObject3(o3) === false) return false; 6390 ctor = o3.constructor; 6391 if (ctor === void 0) return true; 6392 prot = ctor.prototype; 6393 if (isObject3(prot) === false) return false; 6394 if (prot.hasOwnProperty("isPrototypeOf") === false) { 6395 return false; 6396 } 6397 return true; 6398 } 6399 6400 // packages/blocks/build-module/store/process-block-type.js 6401 var import_react_is = __toESM(require_react_is()); 6402 var import_deprecated4 = __toESM(require_deprecated()); 6403 var import_hooks = __toESM(require_hooks()); 6404 var import_warning2 = __toESM(require_warning()); 6405 var LEGACY_CATEGORY_MAPPING = { 6406 common: "text", 6407 formatting: "text", 6408 layout: "design" 6409 }; 6410 function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) { 6411 const result = [...bootstrappedVariations]; 6412 clientVariations.forEach((clientVariation) => { 6413 const index = result.findIndex( 6414 (bootstrappedVariation) => bootstrappedVariation.name === clientVariation.name 6415 ); 6416 if (index !== -1) { 6417 result[index] = { ...result[index], ...clientVariation }; 6418 } else { 6419 result.push(clientVariation); 6420 } 6421 }); 6422 return result; 6423 } 6424 var processBlockType = (name, blockSettings) => ({ select: select3 }) => { 6425 const bootstrappedBlockType = select3.getBootstrappedBlockType(name); 6426 const blockType = { 6427 apiVersion: 1, 6428 name, 6429 icon: BLOCK_ICON_DEFAULT, 6430 keywords: [], 6431 attributes: {}, 6432 providesContext: {}, 6433 usesContext: [], 6434 selectors: {}, 6435 supports: {}, 6436 styles: [], 6437 blockHooks: {}, 6438 save: () => null, 6439 ...bootstrappedBlockType, 6440 ...blockSettings, 6441 // blockType.variations can be defined as a filePath. 6442 variations: mergeBlockVariations( 6443 Array.isArray(bootstrappedBlockType?.variations) ? bootstrappedBlockType.variations : [], 6444 Array.isArray(blockSettings?.variations) ? blockSettings.variations : [] 6445 ) 6446 }; 6447 if (!blockType.attributes || typeof blockType.attributes !== "object") { 6448 (0, import_warning2.default)( 6449 'The block "' + name + '" is registering attributes as `null` or `undefined`. Use an empty object (`attributes: {}`) or exclude the `attributes` key.' 6450 ); 6451 blockType.attributes = {}; 6452 } 6453 const settings = (0, import_hooks.applyFilters)( 6454 "blocks.registerBlockType", 6455 blockType, 6456 name, 6457 null 6458 ); 6459 if (settings.apiVersion <= 2) { 6460 (0, import_warning2.default)( 6461 `The block "$name}" is registered with API version 2 or lower. This means that the post editor may work as a non-iframe editor. 6462 Since all editors are planned to work as iframes in the future, set the \`apiVersion\` field to 3 and test the block inside the iframe editor. 6463 See: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/#version-3-wordpress-6-3` 6464 ); 6465 } 6466 if (settings.description && typeof settings.description !== "string") { 6467 (0, import_deprecated4.default)("Declaring non-string block descriptions", { 6468 since: "6.2" 6469 }); 6470 } 6471 if (settings.deprecated) { 6472 settings.deprecated = settings.deprecated.map( 6473 (deprecation) => Object.fromEntries( 6474 Object.entries( 6475 // Only keep valid deprecation keys. 6476 (0, import_hooks.applyFilters)( 6477 "blocks.registerBlockType", 6478 // Merge deprecation keys with pre-filter settings 6479 // so that filters that depend on specific keys being 6480 // present don't fail. 6481 { 6482 // Omit deprecation keys here so that deprecations 6483 // can opt out of specific keys like "supports". 6484 ...omit(blockType, DEPRECATED_ENTRY_KEYS), 6485 ...deprecation 6486 }, 6487 blockType.name, 6488 deprecation 6489 ) 6490 ).filter( 6491 ([key]) => DEPRECATED_ENTRY_KEYS.includes(key) 6492 ) 6493 ) 6494 ); 6495 } 6496 if (!isPlainObject(settings)) { 6497 (0, import_warning2.default)("Block settings must be a valid object."); 6498 return; 6499 } 6500 if (typeof settings.save !== "function") { 6501 (0, import_warning2.default)('The "save" property must be a valid function.'); 6502 return; 6503 } 6504 if ("edit" in settings && !(0, import_react_is.isValidElementType)(settings.edit)) { 6505 (0, import_warning2.default)('The "edit" property must be a valid component.'); 6506 return; 6507 } 6508 if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { 6509 settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; 6510 } 6511 if ("category" in settings && !select3.getCategories().some(({ slug }) => slug === settings.category)) { 6512 (0, import_warning2.default)( 6513 'The block "' + name + '" is registered with an invalid category "' + settings.category + '".' 6514 ); 6515 delete settings.category; 6516 } 6517 if (!("title" in settings) || settings.title === "") { 6518 (0, import_warning2.default)('The block "' + name + '" must have a title.'); 6519 return; 6520 } 6521 if (typeof settings.title !== "string") { 6522 (0, import_warning2.default)("Block titles must be strings."); 6523 return; 6524 } 6525 settings.icon = normalizeIconObject(settings.icon); 6526 if (!isValidIcon(settings.icon.src)) { 6527 (0, import_warning2.default)( 6528 "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" 6529 ); 6530 return; 6531 } 6532 if (typeof settings?.parent === "string" || settings?.parent instanceof String) { 6533 settings.parent = [settings.parent]; 6534 (0, import_warning2.default)( 6535 "Parent must be undefined or an array of strings (block types), but it is a string." 6536 ); 6537 } 6538 if (!Array.isArray(settings?.parent) && settings?.parent !== void 0) { 6539 (0, import_warning2.default)( 6540 "Parent must be undefined or an array of block types, but it is ", 6541 settings.parent 6542 ); 6543 return; 6544 } 6545 if (1 === settings?.parent?.length && name === settings.parent[0]) { 6546 (0, import_warning2.default)( 6547 'Block "' + name + '" cannot be a parent of itself. Please remove the block name from the parent list.' 6548 ); 6549 return; 6550 } 6551 return settings; 6552 }; 6553 6554 // packages/blocks/build-module/store/actions.js 6555 function addBlockTypes(blockTypes2) { 6556 return { 6557 type: "ADD_BLOCK_TYPES", 6558 blockTypes: Array.isArray(blockTypes2) ? blockTypes2 : [blockTypes2] 6559 }; 6560 } 6561 function reapplyBlockTypeFilters() { 6562 return ({ dispatch: dispatch3, select: select3 }) => { 6563 const processedBlockTypes = []; 6564 for (const [name, settings] of Object.entries( 6565 select3.getUnprocessedBlockTypes() 6566 )) { 6567 const result = dispatch3(processBlockType(name, settings)); 6568 if (result) { 6569 processedBlockTypes.push(result); 6570 } 6571 } 6572 if (!processedBlockTypes.length) { 6573 return; 6574 } 6575 dispatch3.addBlockTypes(processedBlockTypes); 6576 }; 6577 } 6578 function __experimentalReapplyBlockFilters() { 6579 (0, import_deprecated5.default)( 6580 'wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters', 6581 { 6582 since: "6.4", 6583 alternative: "reapplyBlockFilters" 6584 } 6585 ); 6586 return reapplyBlockTypeFilters(); 6587 } 6588 function removeBlockTypes(names) { 6589 return { 6590 type: "REMOVE_BLOCK_TYPES", 6591 names: Array.isArray(names) ? names : [names] 6592 }; 6593 } 6594 function addBlockStyles(blockNames, styles) { 6595 return { 6596 type: "ADD_BLOCK_STYLES", 6597 styles: Array.isArray(styles) ? styles : [styles], 6598 blockNames: Array.isArray(blockNames) ? blockNames : [blockNames] 6599 }; 6600 } 6601 function removeBlockStyles(blockName, styleNames) { 6602 return { 6603 type: "REMOVE_BLOCK_STYLES", 6604 styleNames: Array.isArray(styleNames) ? styleNames : [styleNames], 6605 blockName 6606 }; 6607 } 6608 function addBlockVariations(blockName, variations) { 6609 return { 6610 type: "ADD_BLOCK_VARIATIONS", 6611 variations: Array.isArray(variations) ? variations : [variations], 6612 blockName 6613 }; 6614 } 6615 function removeBlockVariations(blockName, variationNames) { 6616 return { 6617 type: "REMOVE_BLOCK_VARIATIONS", 6618 variationNames: Array.isArray(variationNames) ? variationNames : [variationNames], 6619 blockName 6620 }; 6621 } 6622 function setDefaultBlockName2(name) { 6623 return { 6624 type: "SET_DEFAULT_BLOCK_NAME", 6625 name 6626 }; 6627 } 6628 function setFreeformFallbackBlockName(name) { 6629 return { 6630 type: "SET_FREEFORM_FALLBACK_BLOCK_NAME", 6631 name 6632 }; 6633 } 6634 function setUnregisteredFallbackBlockName(name) { 6635 return { 6636 type: "SET_UNREGISTERED_FALLBACK_BLOCK_NAME", 6637 name 6638 }; 6639 } 6640 function setGroupingBlockName2(name) { 6641 return { 6642 type: "SET_GROUPING_BLOCK_NAME", 6643 name 6644 }; 6645 } 6646 function setCategories(categories2) { 6647 return { 6648 type: "SET_CATEGORIES", 6649 categories: categories2 6650 }; 6651 } 6652 function updateCategory(slug, category) { 6653 return { 6654 type: "UPDATE_CATEGORY", 6655 slug, 6656 category 6657 }; 6658 } 6659 function addBlockCollection(namespace, title, icon) { 6660 return { 6661 type: "ADD_BLOCK_COLLECTION", 6662 namespace, 6663 title, 6664 icon 6665 }; 6666 } 6667 function removeBlockCollection(namespace) { 6668 return { 6669 type: "REMOVE_BLOCK_COLLECTION", 6670 namespace 6671 }; 6672 } 6673 6674 // packages/blocks/build-module/store/private-actions.js 6675 var private_actions_exports = {}; 6676 __export(private_actions_exports, { 6677 addBlockBindingsSource: () => addBlockBindingsSource, 6678 addBootstrappedBlockType: () => addBootstrappedBlockType, 6679 addUnprocessedBlockType: () => addUnprocessedBlockType, 6680 removeBlockBindingsSource: () => removeBlockBindingsSource 6681 }); 6682 function addBootstrappedBlockType(name, blockType) { 6683 return { 6684 type: "ADD_BOOTSTRAPPED_BLOCK_TYPE", 6685 name, 6686 blockType 6687 }; 6688 } 6689 function addUnprocessedBlockType(name, blockType) { 6690 return ({ dispatch: dispatch3 }) => { 6691 dispatch3({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType }); 6692 const processedBlockType = dispatch3( 6693 processBlockType(name, blockType) 6694 ); 6695 if (!processedBlockType) { 6696 return; 6697 } 6698 dispatch3.addBlockTypes(processedBlockType); 6699 }; 6700 } 6701 function addBlockBindingsSource(source) { 6702 return { 6703 type: "ADD_BLOCK_BINDINGS_SOURCE", 6704 name: source.name, 6705 label: source.label, 6706 usesContext: source.usesContext, 6707 getValues: source.getValues, 6708 setValues: source.setValues, 6709 canUserEditValue: source.canUserEditValue, 6710 getFieldsList: source.getFieldsList 6711 }; 6712 } 6713 function removeBlockBindingsSource(name) { 6714 return { 6715 type: "REMOVE_BLOCK_BINDINGS_SOURCE", 6716 name 6717 }; 6718 } 6719 6720 // packages/blocks/build-module/store/constants.js 6721 var STORE_NAME = "core/blocks"; 6722 6723 // packages/blocks/build-module/store/index.js 6724 var store = (0, import_data5.createReduxStore)(STORE_NAME, { 6725 reducer: reducer_default, 6726 selectors: selectors_exports, 6727 actions: actions_exports 6728 }); 6729 (0, import_data5.register)(store); 6730 unlock(store).registerPrivateSelectors(private_selectors_exports); 6731 unlock(store).registerPrivateActions(private_actions_exports); 6732 6733 // node_modules/uuid/dist/esm-browser/rng.js 6734 var getRandomValues; 6735 var rnds8 = new Uint8Array(16); 6736 function rng() { 6737 if (!getRandomValues) { 6738 getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); 6739 if (!getRandomValues) { 6740 throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); 6741 } 6742 } 6743 return getRandomValues(rnds8); 6744 } 6745 6746 // node_modules/uuid/dist/esm-browser/stringify.js 6747 var byteToHex = []; 6748 for (let i2 = 0; i2 < 256; ++i2) { 6749 byteToHex.push((i2 + 256).toString(16).slice(1)); 6750 } 6751 function unsafeStringify(arr, offset = 0) { 6752 return 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]]; 6753 } 6754 6755 // node_modules/uuid/dist/esm-browser/native.js 6756 var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); 6757 var native_default = { 6758 randomUUID 6759 }; 6760 6761 // node_modules/uuid/dist/esm-browser/v4.js 6762 function v4(options, buf, offset) { 6763 if (native_default.randomUUID && !buf && !options) { 6764 return native_default.randomUUID(); 6765 } 6766 options = options || {}; 6767 const rnds = options.random || (options.rng || rng)(); 6768 rnds[6] = rnds[6] & 15 | 64; 6769 rnds[8] = rnds[8] & 63 | 128; 6770 if (buf) { 6771 offset = offset || 0; 6772 for (let i2 = 0; i2 < 16; ++i2) { 6773 buf[offset + i2] = rnds[i2]; 6774 } 6775 return buf; 6776 } 6777 return unsafeStringify(rnds); 6778 } 6779 var v4_default = v4; 6780 6781 // packages/blocks/build-module/api/factory.js 6782 var import_hooks2 = __toESM(require_hooks()); 6783 function createBlock(name, attributes = {}, innerBlocks = []) { 6784 if (!isBlockRegistered(name)) { 6785 return createBlock("core/missing", { 6786 originalName: name, 6787 originalContent: "", 6788 originalUndelimitedContent: "" 6789 }); 6790 } 6791 const sanitizedAttributes = __experimentalSanitizeBlockAttributes( 6792 name, 6793 attributes 6794 ); 6795 const clientId = v4_default(); 6796 return { 6797 clientId, 6798 name, 6799 isValid: true, 6800 attributes: sanitizedAttributes, 6801 innerBlocks 6802 }; 6803 } 6804 function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) { 6805 return innerBlocksOrTemplate.map((innerBlock) => { 6806 const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [ 6807 innerBlock.name, 6808 innerBlock.attributes, 6809 innerBlock.innerBlocks 6810 ]; 6811 const [name, attributes, innerBlocks = []] = innerBlockTemplate; 6812 return createBlock( 6813 name, 6814 attributes, 6815 createBlocksFromInnerBlocksTemplate(innerBlocks) 6816 ); 6817 }); 6818 } 6819 function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { 6820 const { name } = block; 6821 if (!isBlockRegistered(name)) { 6822 return createBlock("core/missing", { 6823 originalName: name, 6824 originalContent: "", 6825 originalUndelimitedContent: "" 6826 }); 6827 } 6828 const clientId = v4_default(); 6829 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, { 6830 ...block.attributes, 6831 ...mergeAttributes 6832 }); 6833 return { 6834 ...block, 6835 clientId, 6836 attributes: sanitizedAttributes, 6837 innerBlocks: newInnerBlocks || block.innerBlocks.map( 6838 (innerBlock) => __experimentalCloneSanitizedBlock(innerBlock) 6839 ) 6840 }; 6841 } 6842 function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) { 6843 const clientId = v4_default(); 6844 return { 6845 ...block, 6846 clientId, 6847 attributes: { 6848 ...block.attributes, 6849 ...mergeAttributes 6850 }, 6851 innerBlocks: newInnerBlocks || block.innerBlocks.map((innerBlock) => cloneBlock(innerBlock)) 6852 }; 6853 } 6854 var isPossibleTransformForSource = (transform, direction, blocks) => { 6855 if (!blocks.length) { 6856 return false; 6857 } 6858 const isMultiBlock = blocks.length > 1; 6859 const firstBlockName = blocks[0].name; 6860 const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; 6861 if (!isValidForMultiBlocks) { 6862 return false; 6863 } 6864 if (!isWildcardBlockTransform(transform) && !blocks.every((block) => block.name === firstBlockName)) { 6865 return false; 6866 } 6867 const isBlockType = transform.type === "block"; 6868 if (!isBlockType) { 6869 return false; 6870 } 6871 const sourceBlock = blocks[0]; 6872 const hasMatchingName = direction !== "from" || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); 6873 if (!hasMatchingName) { 6874 return false; 6875 } 6876 if (!isMultiBlock && direction === "from" && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) { 6877 return false; 6878 } 6879 if (!maybeCheckTransformIsMatch(transform, blocks)) { 6880 return false; 6881 } 6882 return true; 6883 }; 6884 var getBlockTypesForPossibleFromTransforms = (blocks) => { 6885 if (!blocks.length) { 6886 return []; 6887 } 6888 const allBlockTypes = getBlockTypes(); 6889 const blockTypesWithPossibleFromTransforms = allBlockTypes.filter( 6890 (blockType) => { 6891 const fromTransforms = getBlockTransforms("from", blockType.name); 6892 return !!findTransform(fromTransforms, (transform) => { 6893 return isPossibleTransformForSource( 6894 transform, 6895 "from", 6896 blocks 6897 ); 6898 }); 6899 } 6900 ); 6901 return blockTypesWithPossibleFromTransforms; 6902 }; 6903 var getBlockTypesForPossibleToTransforms = (blocks) => { 6904 if (!blocks.length) { 6905 return []; 6906 } 6907 const sourceBlock = blocks[0]; 6908 const blockType = getBlockType(sourceBlock.name); 6909 const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : []; 6910 const possibleTransforms = transformsTo.filter((transform) => { 6911 return transform && isPossibleTransformForSource(transform, "to", blocks); 6912 }); 6913 const blockNames = possibleTransforms.map((transformation) => transformation.blocks).flat(); 6914 return blockNames.map(getBlockType); 6915 }; 6916 var isWildcardBlockTransform = (t3) => t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*"); 6917 var isContainerGroupBlock = (name) => name === getGroupingBlockName(); 6918 function getPossibleBlockTransformations(blocks) { 6919 if (!blocks.length) { 6920 return []; 6921 } 6922 const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); 6923 const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); 6924 return [ 6925 .../* @__PURE__ */ new Set([ 6926 ...blockTypesForFromTransforms, 6927 ...blockTypesForToTransforms 6928 ]) 6929 ]; 6930 } 6931 function findTransform(transforms, predicate) { 6932 const hooks = (0, import_hooks2.createHooks)(); 6933 for (let i2 = 0; i2 < transforms.length; i2++) { 6934 const candidate = transforms[i2]; 6935 if (predicate(candidate)) { 6936 hooks.addFilter( 6937 "transform", 6938 "transform/" + i2.toString(), 6939 (result) => result ? result : candidate, 6940 candidate.priority 6941 ); 6942 } 6943 } 6944 return hooks.applyFilters("transform", null); 6945 } 6946 function getBlockTransforms(direction, blockTypeOrName) { 6947 if (blockTypeOrName === void 0) { 6948 return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat(); 6949 } 6950 const blockType = normalizeBlockType(blockTypeOrName); 6951 const { name: blockName, transforms } = blockType || {}; 6952 if (!transforms || !Array.isArray(transforms[direction])) { 6953 return []; 6954 } 6955 const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); 6956 const filteredTransforms = usingMobileTransformations ? transforms[direction].filter((t3) => { 6957 if (t3.type === "raw") { 6958 return true; 6959 } 6960 if (t3.type === "prefix") { 6961 return true; 6962 } 6963 if (!t3.blocks || !t3.blocks.length) { 6964 return false; 6965 } 6966 if (isWildcardBlockTransform(t3)) { 6967 return true; 6968 } 6969 return t3.blocks.every( 6970 (transformBlockName) => transforms.supportedMobileTransforms.includes( 6971 transformBlockName 6972 ) 6973 ); 6974 }) : transforms[direction]; 6975 return filteredTransforms.map((transform) => ({ 6976 ...transform, 6977 blockName, 6978 usingMobileTransformations 6979 })); 6980 } 6981 function maybeCheckTransformIsMatch(transform, blocks) { 6982 if (typeof transform.isMatch !== "function") { 6983 return true; 6984 } 6985 const sourceBlock = blocks[0]; 6986 const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes; 6987 const block = transform.isMultiBlock ? blocks : sourceBlock; 6988 return transform.isMatch(attributes, block); 6989 } 6990 function switchToBlockType(blocks, name) { 6991 const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; 6992 const isMultiBlock = blocksArray.length > 1; 6993 const firstBlock = blocksArray[0]; 6994 const sourceName = firstBlock.name; 6995 const transformationsFrom = getBlockTransforms("from", name); 6996 const transformationsTo = getBlockTransforms("to", sourceName); 6997 const transformation = findTransform( 6998 transformationsTo, 6999 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) 7000 ) || findTransform( 7001 transformationsFrom, 7002 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) 7003 ); 7004 if (!transformation) { 7005 return null; 7006 } 7007 let transformationResults; 7008 if (transformation.isMultiBlock) { 7009 if ("__experimentalConvert" in transformation) { 7010 transformationResults = transformation.__experimentalConvert(blocksArray); 7011 } else { 7012 transformationResults = transformation.transform( 7013 blocksArray.map((currentBlock) => currentBlock.attributes), 7014 blocksArray.map((currentBlock) => currentBlock.innerBlocks) 7015 ); 7016 } 7017 } else if ("__experimentalConvert" in transformation) { 7018 transformationResults = transformation.__experimentalConvert(firstBlock); 7019 } else { 7020 transformationResults = transformation.transform( 7021 firstBlock.attributes, 7022 firstBlock.innerBlocks 7023 ); 7024 } 7025 if (transformationResults === null || typeof transformationResults !== "object") { 7026 return null; 7027 } 7028 transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults]; 7029 if (transformationResults.some( 7030 (result) => !getBlockType(result.name) 7031 )) { 7032 return null; 7033 } 7034 const hasSwitchedBlock = transformationResults.some( 7035 (result) => result.name === name 7036 ); 7037 if (!hasSwitchedBlock) { 7038 return null; 7039 } 7040 const ret = transformationResults.map((result, index, results) => { 7041 return (0, import_hooks2.applyFilters)( 7042 "blocks.switchToBlockType.transformedBlock", 7043 result, 7044 blocks, 7045 index, 7046 results 7047 ); 7048 }); 7049 return ret; 7050 } 7051 var getBlockFromExample = (name, example) => createBlock( 7052 name, 7053 example.attributes, 7054 (example.innerBlocks ?? []).map( 7055 (innerBlock) => getBlockFromExample(innerBlock.name, innerBlock) 7056 ) 7057 ); 7058 7059 // packages/blocks/build-module/api/parser/index.js 7060 var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser()); 7061 var import_autop2 = __toESM(require_autop()); 7062 7063 // packages/blocks/build-module/api/serializer.js 7064 var import_element2 = __toESM(require_element()); 7065 var import_hooks3 = __toESM(require_hooks()); 7066 var import_is_shallow_equal = __toESM(require_is_shallow_equal()); 7067 var import_autop = __toESM(require_autop()); 7068 var import_deprecated6 = __toESM(require_deprecated()); 7069 7070 // packages/blocks/build-module/api/parser/serialize-raw-block.js 7071 function serializeRawBlock(rawBlock, options = {}) { 7072 const { isCommentDelimited = true } = options; 7073 const { 7074 blockName, 7075 attrs = {}, 7076 innerBlocks = [], 7077 innerContent = [] 7078 } = rawBlock; 7079 let childIndex = 0; 7080 const content = innerContent.map( 7081 (item) => ( 7082 // `null` denotes a nested block, otherwise we have an HTML fragment. 7083 item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options) 7084 ) 7085 ).join("\n").replace(/\n+/g, "\n").trim(); 7086 return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; 7087 } 7088 7089 // packages/blocks/build-module/api/serializer.js 7090 var import_jsx_runtime = __toESM(require_jsx_runtime()); 7091 function getBlockDefaultClassName(blockName) { 7092 const className = "wp-block-" + blockName.replace(/\//, "-").replace(/^core-/, ""); 7093 return (0, import_hooks3.applyFilters)( 7094 "blocks.getBlockDefaultClassName", 7095 className, 7096 blockName 7097 ); 7098 } 7099 function getBlockMenuDefaultClassName(blockName) { 7100 const className = "editor-block-list-item-" + blockName.replace(/\//, "-").replace(/^core-/, ""); 7101 return (0, import_hooks3.applyFilters)( 7102 "blocks.getBlockMenuDefaultClassName", 7103 className, 7104 blockName 7105 ); 7106 } 7107 var blockPropsProvider = {}; 7108 var innerBlocksPropsProvider = {}; 7109 function getBlockProps(props = {}) { 7110 const { blockType, attributes } = blockPropsProvider; 7111 return getBlockProps.skipFilters ? props : (0, import_hooks3.applyFilters)( 7112 "blocks.getSaveContent.extraProps", 7113 { ...props }, 7114 blockType, 7115 attributes 7116 ); 7117 } 7118 function getInnerBlocksProps(props = {}) { 7119 const { innerBlocks } = innerBlocksPropsProvider; 7120 if (!Array.isArray(innerBlocks)) { 7121 return { ...props, children: innerBlocks }; 7122 } 7123 const html2 = serialize(innerBlocks, { isInnerBlocks: true }); 7124 const children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element2.RawHTML, { children: html2 }); 7125 return { ...props, children }; 7126 } 7127 function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) { 7128 const blockType = normalizeBlockType(blockTypeOrName); 7129 if (!blockType?.save) { 7130 return null; 7131 } 7132 let { save } = blockType; 7133 if (save.prototype instanceof import_element2.Component) { 7134 const instance = new save({ attributes }); 7135 save = instance.render.bind(instance); 7136 } 7137 blockPropsProvider.blockType = blockType; 7138 blockPropsProvider.attributes = attributes; 7139 innerBlocksPropsProvider.innerBlocks = innerBlocks; 7140 let element = save({ attributes, innerBlocks }); 7141 if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !(blockType.apiVersion > 1)) { 7142 const props = (0, import_hooks3.applyFilters)( 7143 "blocks.getSaveContent.extraProps", 7144 { ...element.props }, 7145 blockType, 7146 attributes 7147 ); 7148 if (!(0, import_is_shallow_equal.default)(props, element.props)) { 7149 element = (0, import_element2.cloneElement)(element, props); 7150 } 7151 } 7152 return (0, import_hooks3.applyFilters)( 7153 "blocks.getSaveElement", 7154 element, 7155 blockType, 7156 attributes 7157 ); 7158 } 7159 function getSaveContent(blockTypeOrName, attributes, innerBlocks) { 7160 const blockType = normalizeBlockType(blockTypeOrName); 7161 return (0, import_element2.renderToString)( 7162 getSaveElement(blockType, attributes, innerBlocks) 7163 ); 7164 } 7165 function getCommentAttributes(blockType, attributes) { 7166 return Object.entries(blockType.attributes ?? {}).reduce( 7167 (accumulator, [key, attributeSchema]) => { 7168 const value = attributes[key]; 7169 if (void 0 === value) { 7170 return accumulator; 7171 } 7172 if (attributeSchema.source !== void 0) { 7173 return accumulator; 7174 } 7175 if (attributeSchema.role === "local") { 7176 return accumulator; 7177 } 7178 if (attributeSchema.__experimentalRole === "local") { 7179 (0, import_deprecated6.default)("__experimentalRole attribute", { 7180 since: "6.7", 7181 version: "6.8", 7182 alternative: "role attribute", 7183 hint: `Check the block.json of the $blockType?.name} block.` 7184 }); 7185 return accumulator; 7186 } 7187 if ("default" in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) { 7188 return accumulator; 7189 } 7190 accumulator[key] = value; 7191 return accumulator; 7192 }, 7193 {} 7194 ); 7195 } 7196 function serializeAttributes(attributes) { 7197 return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022"); 7198 } 7199 function getBlockInnerHTML(block) { 7200 let saveContent = block.originalContent; 7201 if (block.isValid || block.innerBlocks.length) { 7202 try { 7203 saveContent = getSaveContent( 7204 block.name, 7205 block.attributes, 7206 block.innerBlocks 7207 ); 7208 } catch (error) { 7209 } 7210 } 7211 return saveContent; 7212 } 7213 function getCommentDelimitedContent(rawBlockName, attributes, content) { 7214 const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + " " : ""; 7215 const blockName = rawBlockName?.startsWith("core/") ? rawBlockName.slice(5) : rawBlockName; 7216 if (!content) { 7217 return `<!-- wp:$blockName} $serializedAttributes}/-->`; 7218 } 7219 return `<!-- wp:$blockName} $serializedAttributes}--> 7220 ` + content + ` 7221 <!-- /wp:$blockName} -->`; 7222 } 7223 function serializeBlock(block, { isInnerBlocks = false } = {}) { 7224 if (!block.isValid && block.__unstableBlockSource) { 7225 return serializeRawBlock(block.__unstableBlockSource); 7226 } 7227 const blockName = block.name; 7228 const saveContent = getBlockInnerHTML(block); 7229 if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { 7230 return saveContent; 7231 } 7232 const blockType = getBlockType(blockName); 7233 if (!blockType) { 7234 return saveContent; 7235 } 7236 const saveAttributes = getCommentAttributes(blockType, block.attributes); 7237 return getCommentDelimitedContent(blockName, saveAttributes, saveContent); 7238 } 7239 function __unstableSerializeAndClean(blocks) { 7240 if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) { 7241 blocks = []; 7242 } 7243 let content = serialize(blocks); 7244 if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === "core/freeform") { 7245 content = (0, import_autop.removep)(content); 7246 } 7247 return content; 7248 } 7249 function serialize(blocks, options) { 7250 const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; 7251 return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n"); 7252 } 7253 7254 // node_modules/simple-html-tokenizer/dist/es6/index.js 7255 var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; 7256 var CHARCODE = /^#([0-9]+)$/; 7257 var NAMED = /^([A-Za-z0-9]+)$/; 7258 var EntityParser = ( 7259 /** @class */ 7260 (function() { 7261 function EntityParser2(named) { 7262 this.named = named; 7263 } 7264 EntityParser2.prototype.parse = function(entity) { 7265 if (!entity) { 7266 return; 7267 } 7268 var matches = entity.match(HEXCHARCODE); 7269 if (matches) { 7270 return String.fromCharCode(parseInt(matches[1], 16)); 7271 } 7272 matches = entity.match(CHARCODE); 7273 if (matches) { 7274 return String.fromCharCode(parseInt(matches[1], 10)); 7275 } 7276 matches = entity.match(NAMED); 7277 if (matches) { 7278 return this.named[matches[1]]; 7279 } 7280 }; 7281 return EntityParser2; 7282 })() 7283 ); 7284 var WSP = /[\t\n\f ]/; 7285 var ALPHA = /[A-Za-z]/; 7286 var CRLF = /\r\n?/g; 7287 function isSpace(char) { 7288 return WSP.test(char); 7289 } 7290 function isAlpha(char) { 7291 return ALPHA.test(char); 7292 } 7293 function preprocessInput(input) { 7294 return input.replace(CRLF, "\n"); 7295 } 7296 var EventedTokenizer = ( 7297 /** @class */ 7298 (function() { 7299 function EventedTokenizer2(delegate, entityParser) { 7300 this.delegate = delegate; 7301 this.entityParser = entityParser; 7302 this.state = "beforeData"; 7303 this.line = -1; 7304 this.column = -1; 7305 this.input = ""; 7306 this.index = -1; 7307 this.tagNameBuffer = ""; 7308 this.states = { 7309 beforeData: function() { 7310 var char = this.peek(); 7311 if (char === "<") { 7312 this.transitionTo( 7313 "tagOpen" 7314 /* tagOpen */ 7315 ); 7316 this.markTagStart(); 7317 this.consume(); 7318 } else { 7319 if (char === "\n") { 7320 var tag = this.tagNameBuffer.toLowerCase(); 7321 if (tag === "pre" || tag === "textarea") { 7322 this.consume(); 7323 } 7324 } 7325 this.transitionTo( 7326 "data" 7327 /* data */ 7328 ); 7329 this.delegate.beginData(); 7330 } 7331 }, 7332 data: function() { 7333 var char = this.peek(); 7334 if (char === "<") { 7335 this.delegate.finishData(); 7336 this.transitionTo( 7337 "tagOpen" 7338 /* tagOpen */ 7339 ); 7340 this.markTagStart(); 7341 this.consume(); 7342 } else if (char === "&") { 7343 this.consume(); 7344 this.delegate.appendToData(this.consumeCharRef() || "&"); 7345 } else { 7346 this.consume(); 7347 this.delegate.appendToData(char); 7348 } 7349 }, 7350 tagOpen: function() { 7351 var char = this.consume(); 7352 if (char === "!") { 7353 this.transitionTo( 7354 "markupDeclarationOpen" 7355 /* markupDeclarationOpen */ 7356 ); 7357 } else if (char === "/") { 7358 this.transitionTo( 7359 "endTagOpen" 7360 /* endTagOpen */ 7361 ); 7362 } else if (char === "@" || char === ":" || isAlpha(char)) { 7363 this.transitionTo( 7364 "tagName" 7365 /* tagName */ 7366 ); 7367 this.tagNameBuffer = ""; 7368 this.delegate.beginStartTag(); 7369 this.appendToTagName(char); 7370 } 7371 }, 7372 markupDeclarationOpen: function() { 7373 var char = this.consume(); 7374 if (char === "-" && this.input.charAt(this.index) === "-") { 7375 this.consume(); 7376 this.transitionTo( 7377 "commentStart" 7378 /* commentStart */ 7379 ); 7380 this.delegate.beginComment(); 7381 } 7382 }, 7383 commentStart: function() { 7384 var char = this.consume(); 7385 if (char === "-") { 7386 this.transitionTo( 7387 "commentStartDash" 7388 /* commentStartDash */ 7389 ); 7390 } else if (char === ">") { 7391 this.delegate.finishComment(); 7392 this.transitionTo( 7393 "beforeData" 7394 /* beforeData */ 7395 ); 7396 } else { 7397 this.delegate.appendToCommentData(char); 7398 this.transitionTo( 7399 "comment" 7400 /* comment */ 7401 ); 7402 } 7403 }, 7404 commentStartDash: function() { 7405 var char = this.consume(); 7406 if (char === "-") { 7407 this.transitionTo( 7408 "commentEnd" 7409 /* commentEnd */ 7410 ); 7411 } else if (char === ">") { 7412 this.delegate.finishComment(); 7413 this.transitionTo( 7414 "beforeData" 7415 /* beforeData */ 7416 ); 7417 } else { 7418 this.delegate.appendToCommentData("-"); 7419 this.transitionTo( 7420 "comment" 7421 /* comment */ 7422 ); 7423 } 7424 }, 7425 comment: function() { 7426 var char = this.consume(); 7427 if (char === "-") { 7428 this.transitionTo( 7429 "commentEndDash" 7430 /* commentEndDash */ 7431 ); 7432 } else { 7433 this.delegate.appendToCommentData(char); 7434 } 7435 }, 7436 commentEndDash: function() { 7437 var char = this.consume(); 7438 if (char === "-") { 7439 this.transitionTo( 7440 "commentEnd" 7441 /* commentEnd */ 7442 ); 7443 } else { 7444 this.delegate.appendToCommentData("-" + char); 7445 this.transitionTo( 7446 "comment" 7447 /* comment */ 7448 ); 7449 } 7450 }, 7451 commentEnd: function() { 7452 var char = this.consume(); 7453 if (char === ">") { 7454 this.delegate.finishComment(); 7455 this.transitionTo( 7456 "beforeData" 7457 /* beforeData */ 7458 ); 7459 } else { 7460 this.delegate.appendToCommentData("--" + char); 7461 this.transitionTo( 7462 "comment" 7463 /* comment */ 7464 ); 7465 } 7466 }, 7467 tagName: function() { 7468 var char = this.consume(); 7469 if (isSpace(char)) { 7470 this.transitionTo( 7471 "beforeAttributeName" 7472 /* beforeAttributeName */ 7473 ); 7474 } else if (char === "/") { 7475 this.transitionTo( 7476 "selfClosingStartTag" 7477 /* selfClosingStartTag */ 7478 ); 7479 } else if (char === ">") { 7480 this.delegate.finishTag(); 7481 this.transitionTo( 7482 "beforeData" 7483 /* beforeData */ 7484 ); 7485 } else { 7486 this.appendToTagName(char); 7487 } 7488 }, 7489 beforeAttributeName: function() { 7490 var char = this.peek(); 7491 if (isSpace(char)) { 7492 this.consume(); 7493 return; 7494 } else if (char === "/") { 7495 this.transitionTo( 7496 "selfClosingStartTag" 7497 /* selfClosingStartTag */ 7498 ); 7499 this.consume(); 7500 } else if (char === ">") { 7501 this.consume(); 7502 this.delegate.finishTag(); 7503 this.transitionTo( 7504 "beforeData" 7505 /* beforeData */ 7506 ); 7507 } else if (char === "=") { 7508 this.delegate.reportSyntaxError("attribute name cannot start with equals sign"); 7509 this.transitionTo( 7510 "attributeName" 7511 /* attributeName */ 7512 ); 7513 this.delegate.beginAttribute(); 7514 this.consume(); 7515 this.delegate.appendToAttributeName(char); 7516 } else { 7517 this.transitionTo( 7518 "attributeName" 7519 /* attributeName */ 7520 ); 7521 this.delegate.beginAttribute(); 7522 } 7523 }, 7524 attributeName: function() { 7525 var char = this.peek(); 7526 if (isSpace(char)) { 7527 this.transitionTo( 7528 "afterAttributeName" 7529 /* afterAttributeName */ 7530 ); 7531 this.consume(); 7532 } else if (char === "/") { 7533 this.delegate.beginAttributeValue(false); 7534 this.delegate.finishAttributeValue(); 7535 this.consume(); 7536 this.transitionTo( 7537 "selfClosingStartTag" 7538 /* selfClosingStartTag */ 7539 ); 7540 } else if (char === "=") { 7541 this.transitionTo( 7542 "beforeAttributeValue" 7543 /* beforeAttributeValue */ 7544 ); 7545 this.consume(); 7546 } else if (char === ">") { 7547 this.delegate.beginAttributeValue(false); 7548 this.delegate.finishAttributeValue(); 7549 this.consume(); 7550 this.delegate.finishTag(); 7551 this.transitionTo( 7552 "beforeData" 7553 /* beforeData */ 7554 ); 7555 } else if (char === '"' || char === "'" || char === "<") { 7556 this.delegate.reportSyntaxError(char + " is not a valid character within attribute names"); 7557 this.consume(); 7558 this.delegate.appendToAttributeName(char); 7559 } else { 7560 this.consume(); 7561 this.delegate.appendToAttributeName(char); 7562 } 7563 }, 7564 afterAttributeName: function() { 7565 var char = this.peek(); 7566 if (isSpace(char)) { 7567 this.consume(); 7568 return; 7569 } else if (char === "/") { 7570 this.delegate.beginAttributeValue(false); 7571 this.delegate.finishAttributeValue(); 7572 this.consume(); 7573 this.transitionTo( 7574 "selfClosingStartTag" 7575 /* selfClosingStartTag */ 7576 ); 7577 } else if (char === "=") { 7578 this.consume(); 7579 this.transitionTo( 7580 "beforeAttributeValue" 7581 /* beforeAttributeValue */ 7582 ); 7583 } else if (char === ">") { 7584 this.delegate.beginAttributeValue(false); 7585 this.delegate.finishAttributeValue(); 7586 this.consume(); 7587 this.delegate.finishTag(); 7588 this.transitionTo( 7589 "beforeData" 7590 /* beforeData */ 7591 ); 7592 } else { 7593 this.delegate.beginAttributeValue(false); 7594 this.delegate.finishAttributeValue(); 7595 this.transitionTo( 7596 "attributeName" 7597 /* attributeName */ 7598 ); 7599 this.delegate.beginAttribute(); 7600 this.consume(); 7601 this.delegate.appendToAttributeName(char); 7602 } 7603 }, 7604 beforeAttributeValue: function() { 7605 var char = this.peek(); 7606 if (isSpace(char)) { 7607 this.consume(); 7608 } else if (char === '"') { 7609 this.transitionTo( 7610 "attributeValueDoubleQuoted" 7611 /* attributeValueDoubleQuoted */ 7612 ); 7613 this.delegate.beginAttributeValue(true); 7614 this.consume(); 7615 } else if (char === "'") { 7616 this.transitionTo( 7617 "attributeValueSingleQuoted" 7618 /* attributeValueSingleQuoted */ 7619 ); 7620 this.delegate.beginAttributeValue(true); 7621 this.consume(); 7622 } else if (char === ">") { 7623 this.delegate.beginAttributeValue(false); 7624 this.delegate.finishAttributeValue(); 7625 this.consume(); 7626 this.delegate.finishTag(); 7627 this.transitionTo( 7628 "beforeData" 7629 /* beforeData */ 7630 ); 7631 } else { 7632 this.transitionTo( 7633 "attributeValueUnquoted" 7634 /* attributeValueUnquoted */ 7635 ); 7636 this.delegate.beginAttributeValue(false); 7637 this.consume(); 7638 this.delegate.appendToAttributeValue(char); 7639 } 7640 }, 7641 attributeValueDoubleQuoted: function() { 7642 var char = this.consume(); 7643 if (char === '"') { 7644 this.delegate.finishAttributeValue(); 7645 this.transitionTo( 7646 "afterAttributeValueQuoted" 7647 /* afterAttributeValueQuoted */ 7648 ); 7649 } else if (char === "&") { 7650 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7651 } else { 7652 this.delegate.appendToAttributeValue(char); 7653 } 7654 }, 7655 attributeValueSingleQuoted: function() { 7656 var char = this.consume(); 7657 if (char === "'") { 7658 this.delegate.finishAttributeValue(); 7659 this.transitionTo( 7660 "afterAttributeValueQuoted" 7661 /* afterAttributeValueQuoted */ 7662 ); 7663 } else if (char === "&") { 7664 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7665 } else { 7666 this.delegate.appendToAttributeValue(char); 7667 } 7668 }, 7669 attributeValueUnquoted: function() { 7670 var char = this.peek(); 7671 if (isSpace(char)) { 7672 this.delegate.finishAttributeValue(); 7673 this.consume(); 7674 this.transitionTo( 7675 "beforeAttributeName" 7676 /* beforeAttributeName */ 7677 ); 7678 } else if (char === "/") { 7679 this.delegate.finishAttributeValue(); 7680 this.consume(); 7681 this.transitionTo( 7682 "selfClosingStartTag" 7683 /* selfClosingStartTag */ 7684 ); 7685 } else if (char === "&") { 7686 this.consume(); 7687 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); 7688 } else if (char === ">") { 7689 this.delegate.finishAttributeValue(); 7690 this.consume(); 7691 this.delegate.finishTag(); 7692 this.transitionTo( 7693 "beforeData" 7694 /* beforeData */ 7695 ); 7696 } else { 7697 this.consume(); 7698 this.delegate.appendToAttributeValue(char); 7699 } 7700 }, 7701 afterAttributeValueQuoted: function() { 7702 var char = this.peek(); 7703 if (isSpace(char)) { 7704 this.consume(); 7705 this.transitionTo( 7706 "beforeAttributeName" 7707 /* beforeAttributeName */ 7708 ); 7709 } else if (char === "/") { 7710 this.consume(); 7711 this.transitionTo( 7712 "selfClosingStartTag" 7713 /* selfClosingStartTag */ 7714 ); 7715 } else if (char === ">") { 7716 this.consume(); 7717 this.delegate.finishTag(); 7718 this.transitionTo( 7719 "beforeData" 7720 /* beforeData */ 7721 ); 7722 } else { 7723 this.transitionTo( 7724 "beforeAttributeName" 7725 /* beforeAttributeName */ 7726 ); 7727 } 7728 }, 7729 selfClosingStartTag: function() { 7730 var char = this.peek(); 7731 if (char === ">") { 7732 this.consume(); 7733 this.delegate.markTagAsSelfClosing(); 7734 this.delegate.finishTag(); 7735 this.transitionTo( 7736 "beforeData" 7737 /* beforeData */ 7738 ); 7739 } else { 7740 this.transitionTo( 7741 "beforeAttributeName" 7742 /* beforeAttributeName */ 7743 ); 7744 } 7745 }, 7746 endTagOpen: function() { 7747 var char = this.consume(); 7748 if (char === "@" || char === ":" || isAlpha(char)) { 7749 this.transitionTo( 7750 "tagName" 7751 /* tagName */ 7752 ); 7753 this.tagNameBuffer = ""; 7754 this.delegate.beginEndTag(); 7755 this.appendToTagName(char); 7756 } 7757 } 7758 }; 7759 this.reset(); 7760 } 7761 EventedTokenizer2.prototype.reset = function() { 7762 this.transitionTo( 7763 "beforeData" 7764 /* beforeData */ 7765 ); 7766 this.input = ""; 7767 this.index = 0; 7768 this.line = 1; 7769 this.column = 0; 7770 this.delegate.reset(); 7771 }; 7772 EventedTokenizer2.prototype.transitionTo = function(state) { 7773 this.state = state; 7774 }; 7775 EventedTokenizer2.prototype.tokenize = function(input) { 7776 this.reset(); 7777 this.tokenizePart(input); 7778 this.tokenizeEOF(); 7779 }; 7780 EventedTokenizer2.prototype.tokenizePart = function(input) { 7781 this.input += preprocessInput(input); 7782 while (this.index < this.input.length) { 7783 var handler = this.states[this.state]; 7784 if (handler !== void 0) { 7785 handler.call(this); 7786 } else { 7787 throw new Error("unhandled state " + this.state); 7788 } 7789 } 7790 }; 7791 EventedTokenizer2.prototype.tokenizeEOF = function() { 7792 this.flushData(); 7793 }; 7794 EventedTokenizer2.prototype.flushData = function() { 7795 if (this.state === "data") { 7796 this.delegate.finishData(); 7797 this.transitionTo( 7798 "beforeData" 7799 /* beforeData */ 7800 ); 7801 } 7802 }; 7803 EventedTokenizer2.prototype.peek = function() { 7804 return this.input.charAt(this.index); 7805 }; 7806 EventedTokenizer2.prototype.consume = function() { 7807 var char = this.peek(); 7808 this.index++; 7809 if (char === "\n") { 7810 this.line++; 7811 this.column = 0; 7812 } else { 7813 this.column++; 7814 } 7815 return char; 7816 }; 7817 EventedTokenizer2.prototype.consumeCharRef = function() { 7818 var endIndex = this.input.indexOf(";", this.index); 7819 if (endIndex === -1) { 7820 return; 7821 } 7822 var entity = this.input.slice(this.index, endIndex); 7823 var chars = this.entityParser.parse(entity); 7824 if (chars) { 7825 var count = entity.length; 7826 while (count) { 7827 this.consume(); 7828 count--; 7829 } 7830 this.consume(); 7831 return chars; 7832 } 7833 }; 7834 EventedTokenizer2.prototype.markTagStart = function() { 7835 this.delegate.tagOpen(); 7836 }; 7837 EventedTokenizer2.prototype.appendToTagName = function(char) { 7838 this.tagNameBuffer += char; 7839 this.delegate.appendToTagName(char); 7840 }; 7841 return EventedTokenizer2; 7842 })() 7843 ); 7844 var Tokenizer = ( 7845 /** @class */ 7846 (function() { 7847 function Tokenizer2(entityParser, options) { 7848 if (options === void 0) { 7849 options = {}; 7850 } 7851 this.options = options; 7852 this.token = null; 7853 this.startLine = 1; 7854 this.startColumn = 0; 7855 this.tokens = []; 7856 this.tokenizer = new EventedTokenizer(this, entityParser); 7857 this._currentAttribute = void 0; 7858 } 7859 Tokenizer2.prototype.tokenize = function(input) { 7860 this.tokens = []; 7861 this.tokenizer.tokenize(input); 7862 return this.tokens; 7863 }; 7864 Tokenizer2.prototype.tokenizePart = function(input) { 7865 this.tokens = []; 7866 this.tokenizer.tokenizePart(input); 7867 return this.tokens; 7868 }; 7869 Tokenizer2.prototype.tokenizeEOF = function() { 7870 this.tokens = []; 7871 this.tokenizer.tokenizeEOF(); 7872 return this.tokens[0]; 7873 }; 7874 Tokenizer2.prototype.reset = function() { 7875 this.token = null; 7876 this.startLine = 1; 7877 this.startColumn = 0; 7878 }; 7879 Tokenizer2.prototype.current = function() { 7880 var token = this.token; 7881 if (token === null) { 7882 throw new Error("token was unexpectedly null"); 7883 } 7884 if (arguments.length === 0) { 7885 return token; 7886 } 7887 for (var i2 = 0; i2 < arguments.length; i2++) { 7888 if (token.type === arguments[i2]) { 7889 return token; 7890 } 7891 } 7892 throw new Error("token type was unexpectedly " + token.type); 7893 }; 7894 Tokenizer2.prototype.push = function(token) { 7895 this.token = token; 7896 this.tokens.push(token); 7897 }; 7898 Tokenizer2.prototype.currentAttribute = function() { 7899 return this._currentAttribute; 7900 }; 7901 Tokenizer2.prototype.addLocInfo = function() { 7902 if (this.options.loc) { 7903 this.current().loc = { 7904 start: { 7905 line: this.startLine, 7906 column: this.startColumn 7907 }, 7908 end: { 7909 line: this.tokenizer.line, 7910 column: this.tokenizer.column 7911 } 7912 }; 7913 } 7914 this.startLine = this.tokenizer.line; 7915 this.startColumn = this.tokenizer.column; 7916 }; 7917 Tokenizer2.prototype.beginData = function() { 7918 this.push({ 7919 type: "Chars", 7920 chars: "" 7921 }); 7922 }; 7923 Tokenizer2.prototype.appendToData = function(char) { 7924 this.current( 7925 "Chars" 7926 /* Chars */ 7927 ).chars += char; 7928 }; 7929 Tokenizer2.prototype.finishData = function() { 7930 this.addLocInfo(); 7931 }; 7932 Tokenizer2.prototype.beginComment = function() { 7933 this.push({ 7934 type: "Comment", 7935 chars: "" 7936 }); 7937 }; 7938 Tokenizer2.prototype.appendToCommentData = function(char) { 7939 this.current( 7940 "Comment" 7941 /* Comment */ 7942 ).chars += char; 7943 }; 7944 Tokenizer2.prototype.finishComment = function() { 7945 this.addLocInfo(); 7946 }; 7947 Tokenizer2.prototype.tagOpen = function() { 7948 }; 7949 Tokenizer2.prototype.beginStartTag = function() { 7950 this.push({ 7951 type: "StartTag", 7952 tagName: "", 7953 attributes: [], 7954 selfClosing: false 7955 }); 7956 }; 7957 Tokenizer2.prototype.beginEndTag = function() { 7958 this.push({ 7959 type: "EndTag", 7960 tagName: "" 7961 }); 7962 }; 7963 Tokenizer2.prototype.finishTag = function() { 7964 this.addLocInfo(); 7965 }; 7966 Tokenizer2.prototype.markTagAsSelfClosing = function() { 7967 this.current( 7968 "StartTag" 7969 /* StartTag */ 7970 ).selfClosing = true; 7971 }; 7972 Tokenizer2.prototype.appendToTagName = function(char) { 7973 this.current( 7974 "StartTag", 7975 "EndTag" 7976 /* EndTag */ 7977 ).tagName += char; 7978 }; 7979 Tokenizer2.prototype.beginAttribute = function() { 7980 this._currentAttribute = ["", "", false]; 7981 }; 7982 Tokenizer2.prototype.appendToAttributeName = function(char) { 7983 this.currentAttribute()[0] += char; 7984 }; 7985 Tokenizer2.prototype.beginAttributeValue = function(isQuoted) { 7986 this.currentAttribute()[2] = isQuoted; 7987 }; 7988 Tokenizer2.prototype.appendToAttributeValue = function(char) { 7989 this.currentAttribute()[1] += char; 7990 }; 7991 Tokenizer2.prototype.finishAttributeValue = function() { 7992 this.current( 7993 "StartTag" 7994 /* StartTag */ 7995 ).attributes.push(this._currentAttribute); 7996 }; 7997 Tokenizer2.prototype.reportSyntaxError = function(message) { 7998 this.current().syntaxError = message; 7999 }; 8000 return Tokenizer2; 8001 })() 8002 ); 8003 8004 // packages/blocks/build-module/api/validation/index.js 8005 var import_es6 = __toESM(require_es6()); 8006 var import_deprecated7 = __toESM(require_deprecated()); 8007 var import_html_entities = __toESM(require_html_entities()); 8008 8009 // packages/blocks/build-module/api/validation/logger.js 8010 function createLogger() { 8011 function createLogHandler(logger) { 8012 return (message, ...args) => logger("Block validation: " + message, ...args); 8013 } 8014 return { 8015 // eslint-disable-next-line no-console 8016 error: createLogHandler(console.error), 8017 // eslint-disable-next-line no-console 8018 warning: createLogHandler(console.warn), 8019 getItems() { 8020 return []; 8021 } 8022 }; 8023 } 8024 function createQueuedLogger() { 8025 const queue = []; 8026 const logger = createLogger(); 8027 return { 8028 error(...args) { 8029 queue.push({ log: logger.error, args }); 8030 }, 8031 warning(...args) { 8032 queue.push({ log: logger.warning, args }); 8033 }, 8034 getItems() { 8035 return queue; 8036 } 8037 }; 8038 } 8039 8040 // packages/blocks/build-module/api/validation/index.js 8041 var identity = (x2) => x2; 8042 var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; 8043 var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; 8044 var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; 8045 var BOOLEAN_ATTRIBUTES = [ 8046 "allowfullscreen", 8047 "allowpaymentrequest", 8048 "allowusermedia", 8049 "async", 8050 "autofocus", 8051 "autoplay", 8052 "checked", 8053 "controls", 8054 "default", 8055 "defer", 8056 "disabled", 8057 "download", 8058 "formnovalidate", 8059 "hidden", 8060 "ismap", 8061 "itemscope", 8062 "loop", 8063 "multiple", 8064 "muted", 8065 "nomodule", 8066 "novalidate", 8067 "open", 8068 "playsinline", 8069 "readonly", 8070 "required", 8071 "reversed", 8072 "selected", 8073 "typemustmatch" 8074 ]; 8075 var ENUMERATED_ATTRIBUTES = [ 8076 "autocapitalize", 8077 "autocomplete", 8078 "charset", 8079 "contenteditable", 8080 "crossorigin", 8081 "decoding", 8082 "dir", 8083 "draggable", 8084 "enctype", 8085 "formenctype", 8086 "formmethod", 8087 "http-equiv", 8088 "inputmode", 8089 "kind", 8090 "method", 8091 "preload", 8092 "scope", 8093 "shape", 8094 "spellcheck", 8095 "translate", 8096 "type", 8097 "wrap" 8098 ]; 8099 var MEANINGFUL_ATTRIBUTES = [ 8100 ...BOOLEAN_ATTRIBUTES, 8101 ...ENUMERATED_ATTRIBUTES 8102 ]; 8103 var TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace]; 8104 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; 8105 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; 8106 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; 8107 function isValidCharacterReference(text2) { 8108 return REGEXP_NAMED_CHARACTER_REFERENCE.test(text2) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text2) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text2); 8109 } 8110 var DecodeEntityParser = class { 8111 /** 8112 * Returns a substitute string for an entity string sequence between `&` 8113 * and `;`, or undefined if no substitution should occur. 8114 * 8115 * @param {string} entity Entity fragment discovered in HTML. 8116 * 8117 * @return {string | undefined} Entity substitute value. 8118 */ 8119 parse(entity) { 8120 if (isValidCharacterReference(entity)) { 8121 return (0, import_html_entities.decodeEntities)("&" + entity + ";"); 8122 } 8123 } 8124 }; 8125 function getTextPiecesSplitOnWhitespace(text2) { 8126 return text2.trim().split(REGEXP_WHITESPACE); 8127 } 8128 function getTextWithCollapsedWhitespace(text2) { 8129 return getTextPiecesSplitOnWhitespace(text2).join(" "); 8130 } 8131 function getMeaningfulAttributePairs(token) { 8132 return token.attributes.filter((pair) => { 8133 const [key, value] = pair; 8134 return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key); 8135 }); 8136 } 8137 function isEquivalentTextTokens(actual, expected, logger = createLogger()) { 8138 let actualChars = actual.chars; 8139 let expectedChars = expected.chars; 8140 for (let i2 = 0; i2 < TEXT_NORMALIZATIONS.length; i2++) { 8141 const normalize = TEXT_NORMALIZATIONS[i2]; 8142 actualChars = normalize(actualChars); 8143 expectedChars = normalize(expectedChars); 8144 if (actualChars === expectedChars) { 8145 return true; 8146 } 8147 } 8148 logger.warning( 8149 "Expected text `%s`, saw `%s`.", 8150 expected.chars, 8151 actual.chars 8152 ); 8153 return false; 8154 } 8155 function getNormalizedLength(value) { 8156 if (0 === parseFloat(value)) { 8157 return "0"; 8158 } 8159 if (value.indexOf(".") === 0) { 8160 return "0" + value; 8161 } 8162 return value; 8163 } 8164 function getNormalizedStyleValue(value) { 8165 const textPieces = getTextPiecesSplitOnWhitespace(value); 8166 const normalizedPieces = textPieces.map(getNormalizedLength); 8167 const result = normalizedPieces.join(" "); 8168 return result.replace(REGEXP_STYLE_URL_TYPE, "url($1)"); 8169 } 8170 function getStyleProperties(text2) { 8171 const pairs = text2.replace(/;?\s*$/, "").split(";").map((style) => { 8172 const [key, ...valueParts] = style.split(":"); 8173 const value = valueParts.join(":"); 8174 return [key.trim(), getNormalizedStyleValue(value.trim())]; 8175 }); 8176 return Object.fromEntries(pairs); 8177 } 8178 var isEqualAttributesOfName = { 8179 class: (actual, expected) => { 8180 const [actualPieces, expectedPieces] = [actual, expected].map( 8181 getTextPiecesSplitOnWhitespace 8182 ); 8183 const actualDiff = actualPieces.filter( 8184 (c2) => !expectedPieces.includes(c2) 8185 ); 8186 const expectedDiff = expectedPieces.filter( 8187 (c2) => !actualPieces.includes(c2) 8188 ); 8189 return actualDiff.length === 0 && expectedDiff.length === 0; 8190 }, 8191 style: (actual, expected) => { 8192 return (0, import_es6.default)( 8193 ...[actual, expected].map(getStyleProperties) 8194 ); 8195 }, 8196 // For each boolean attribute, mere presence of attribute in both is enough 8197 // to assume equivalence. 8198 ...Object.fromEntries( 8199 BOOLEAN_ATTRIBUTES.map((attribute) => [attribute, () => true]) 8200 ) 8201 }; 8202 function isEqualTagAttributePairs(actual, expected, logger = createLogger()) { 8203 if (actual.length !== expected.length) { 8204 logger.warning( 8205 "Expected attributes %o, instead saw %o.", 8206 expected, 8207 actual 8208 ); 8209 return false; 8210 } 8211 const expectedAttributes = {}; 8212 for (let i2 = 0; i2 < expected.length; i2++) { 8213 expectedAttributes[expected[i2][0].toLowerCase()] = expected[i2][1]; 8214 } 8215 for (let i2 = 0; i2 < actual.length; i2++) { 8216 const [name, actualValue] = actual[i2]; 8217 const nameLower = name.toLowerCase(); 8218 if (!expectedAttributes.hasOwnProperty(nameLower)) { 8219 logger.warning("Encountered unexpected attribute `%s`.", name); 8220 return false; 8221 } 8222 const expectedValue = expectedAttributes[nameLower]; 8223 const isEqualAttributes = isEqualAttributesOfName[nameLower]; 8224 if (isEqualAttributes) { 8225 if (!isEqualAttributes(actualValue, expectedValue)) { 8226 logger.warning( 8227 "Expected attribute `%s` of value `%s`, saw `%s`.", 8228 name, 8229 expectedValue, 8230 actualValue 8231 ); 8232 return false; 8233 } 8234 } else if (actualValue !== expectedValue) { 8235 logger.warning( 8236 "Expected attribute `%s` of value `%s`, saw `%s`.", 8237 name, 8238 expectedValue, 8239 actualValue 8240 ); 8241 return false; 8242 } 8243 } 8244 return true; 8245 } 8246 var isEqualTokensOfType = { 8247 StartTag: (actual, expected, logger = createLogger()) => { 8248 if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- 8249 // insensitive check on the assumption that the majority case will 8250 // have exactly equal tag names. 8251 actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { 8252 logger.warning( 8253 "Expected tag name `%s`, instead saw `%s`.", 8254 expected.tagName, 8255 actual.tagName 8256 ); 8257 return false; 8258 } 8259 return isEqualTagAttributePairs( 8260 ...[actual, expected].map(getMeaningfulAttributePairs), 8261 logger 8262 ); 8263 }, 8264 Chars: isEquivalentTextTokens, 8265 Comment: isEquivalentTextTokens 8266 }; 8267 function getNextNonWhitespaceToken(tokens) { 8268 let token; 8269 while (token = tokens.shift()) { 8270 if (token.type !== "Chars") { 8271 return token; 8272 } 8273 if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { 8274 return token; 8275 } 8276 } 8277 } 8278 function getHTMLTokens(html2, logger = createLogger()) { 8279 try { 8280 return new Tokenizer(new DecodeEntityParser()).tokenize(html2); 8281 } catch (e2) { 8282 logger.warning("Malformed HTML detected: %s", html2); 8283 } 8284 return null; 8285 } 8286 function isClosedByToken(currentToken, nextToken) { 8287 if (!currentToken.selfClosing) { 8288 return false; 8289 } 8290 if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === "EndTag") { 8291 return true; 8292 } 8293 return false; 8294 } 8295 function isEquivalentHTML(actual, expected, logger = createLogger()) { 8296 if (actual === expected) { 8297 return true; 8298 } 8299 const [actualTokens, expectedTokens] = [actual, expected].map( 8300 (html2) => getHTMLTokens(html2, logger) 8301 ); 8302 if (!actualTokens || !expectedTokens) { 8303 return false; 8304 } 8305 let actualToken, expectedToken; 8306 while (actualToken = getNextNonWhitespaceToken(actualTokens)) { 8307 expectedToken = getNextNonWhitespaceToken(expectedTokens); 8308 if (!expectedToken) { 8309 logger.warning( 8310 "Expected end of content, instead saw %o.", 8311 actualToken 8312 ); 8313 return false; 8314 } 8315 if (actualToken.type !== expectedToken.type) { 8316 logger.warning( 8317 "Expected token of type `%s` (%o), instead saw `%s` (%o).", 8318 expectedToken.type, 8319 expectedToken, 8320 actualToken.type, 8321 actualToken 8322 ); 8323 return false; 8324 } 8325 const isEqualTokens = isEqualTokensOfType[actualToken.type]; 8326 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { 8327 return false; 8328 } 8329 if (isClosedByToken(actualToken, expectedTokens[0])) { 8330 getNextNonWhitespaceToken(expectedTokens); 8331 } else if (isClosedByToken(expectedToken, actualTokens[0])) { 8332 getNextNonWhitespaceToken(actualTokens); 8333 } 8334 } 8335 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { 8336 logger.warning( 8337 "Expected %o, instead saw end of content.", 8338 expectedToken 8339 ); 8340 return false; 8341 } 8342 return true; 8343 } 8344 function validateBlock(block, blockTypeOrName = block.name) { 8345 const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName(); 8346 if (isFallbackBlock) { 8347 return [true, []]; 8348 } 8349 const logger = createQueuedLogger(); 8350 const blockType = normalizeBlockType(blockTypeOrName); 8351 let generatedBlockContent; 8352 try { 8353 generatedBlockContent = getSaveContent(blockType, block.attributes); 8354 } catch (error) { 8355 logger.error( 8356 "Block validation failed because an error occurred while generating block content:\n\n%s", 8357 error.toString() 8358 ); 8359 return [false, logger.getItems()]; 8360 } 8361 const isValid = isEquivalentHTML( 8362 block.originalContent, 8363 generatedBlockContent, 8364 logger 8365 ); 8366 if (!isValid) { 8367 logger.error( 8368 "Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s", 8369 blockType.name, 8370 blockType, 8371 generatedBlockContent, 8372 block.originalContent 8373 ); 8374 } 8375 return [isValid, logger.getItems()]; 8376 } 8377 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { 8378 (0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", { 8379 since: "12.6", 8380 plugin: "Gutenberg", 8381 alternative: "validateBlock" 8382 }); 8383 const blockType = normalizeBlockType(blockTypeOrName); 8384 const block = { 8385 name: blockType.name, 8386 attributes, 8387 innerBlocks: [], 8388 originalContent: originalBlockContent 8389 }; 8390 const [isValid] = validateBlock(block, blockType); 8391 return isValid; 8392 } 8393 8394 // packages/blocks/build-module/api/parser/convert-legacy-block.js 8395 function convertLegacyBlockNameAndAttributes(name, attributes) { 8396 const newAttributes = { ...attributes }; 8397 if ("core/cover-image" === name) { 8398 name = "core/cover"; 8399 } 8400 if ("core/text" === name || "core/cover-text" === name) { 8401 name = "core/paragraph"; 8402 } 8403 if (name && name.indexOf("core/social-link-") === 0) { 8404 newAttributes.service = name.substring(17); 8405 name = "core/social-link"; 8406 } 8407 if (name && name.indexOf("core-embed/") === 0) { 8408 const providerSlug = name.substring(11); 8409 const deprecated12 = { 8410 speaker: "speaker-deck", 8411 polldaddy: "crowdsignal" 8412 }; 8413 newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug; 8414 if (!["amazon-kindle", "wordpress"].includes(providerSlug)) { 8415 newAttributes.responsive = true; 8416 } 8417 name = "core/embed"; 8418 } 8419 if (name === "core/post-comment-author") { 8420 name = "core/comment-author-name"; 8421 } 8422 if (name === "core/post-comment-content") { 8423 name = "core/comment-content"; 8424 } 8425 if (name === "core/post-comment-date") { 8426 name = "core/comment-date"; 8427 } 8428 if (name === "core/comments-query-loop") { 8429 name = "core/comments"; 8430 const { className = "" } = newAttributes; 8431 if (!className.includes("wp-block-comments-query-loop")) { 8432 newAttributes.className = [ 8433 "wp-block-comments-query-loop", 8434 className 8435 ].join(" "); 8436 } 8437 } 8438 if (name === "core/post-comments") { 8439 name = "core/comments"; 8440 newAttributes.legacy = true; 8441 } 8442 if (attributes.layout?.type === "grid" && typeof attributes.layout?.columnCount === "string") { 8443 newAttributes.layout = { 8444 ...newAttributes.layout, 8445 columnCount: parseInt(attributes.layout.columnCount, 10) 8446 }; 8447 } 8448 if (typeof attributes.style?.layout?.columnSpan === "string") { 8449 const columnSpanNumber = parseInt( 8450 attributes.style.layout.columnSpan, 8451 10 8452 ); 8453 newAttributes.style = { 8454 ...newAttributes.style, 8455 layout: { 8456 ...newAttributes.style.layout, 8457 columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber 8458 } 8459 }; 8460 } 8461 if (typeof attributes.style?.layout?.rowSpan === "string") { 8462 const rowSpanNumber = parseInt(attributes.style.layout.rowSpan, 10); 8463 newAttributes.style = { 8464 ...newAttributes.style, 8465 layout: { 8466 ...newAttributes.style.layout, 8467 rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber 8468 } 8469 }; 8470 } 8471 return [name, newAttributes]; 8472 } 8473 8474 // node_modules/hpq/es/get-path.js 8475 function getPath(object, path) { 8476 var segments = path.split("."); 8477 var segment; 8478 while (segment = segments.shift()) { 8479 if (!(segment in object)) { 8480 return; 8481 } 8482 object = object[segment]; 8483 } 8484 return object; 8485 } 8486 8487 // node_modules/hpq/es/index.js 8488 var getDocument = /* @__PURE__ */ (function() { 8489 var doc; 8490 return function() { 8491 if (!doc) { 8492 doc = document.implementation.createHTMLDocument(""); 8493 } 8494 return doc; 8495 }; 8496 })(); 8497 function parse(source, matchers) { 8498 if (!matchers) { 8499 return; 8500 } 8501 if ("string" === typeof source) { 8502 var doc = getDocument(); 8503 doc.body.innerHTML = source; 8504 source = doc.body; 8505 } 8506 if ("function" === typeof matchers) { 8507 return matchers(source); 8508 } 8509 if (Object !== matchers.constructor) { 8510 return; 8511 } 8512 return Object.keys(matchers).reduce(function(memo, key) { 8513 memo[key] = parse(source, matchers[key]); 8514 return memo; 8515 }, {}); 8516 } 8517 function prop(selector, name) { 8518 if (1 === arguments.length) { 8519 name = selector; 8520 selector = void 0; 8521 } 8522 return function(node) { 8523 var match = node; 8524 if (selector) { 8525 match = node.querySelector(selector); 8526 } 8527 if (match) { 8528 return getPath(match, name); 8529 } 8530 }; 8531 } 8532 function attr(selector, name) { 8533 if (1 === arguments.length) { 8534 name = selector; 8535 selector = void 0; 8536 } 8537 return function(node) { 8538 var attributes = prop(selector, "attributes")(node); 8539 if (attributes && attributes.hasOwnProperty(name)) { 8540 return attributes[name].value; 8541 } 8542 }; 8543 } 8544 function text(selector) { 8545 return prop(selector, "textContent"); 8546 } 8547 function query(selector, matchers) { 8548 return function(node) { 8549 var matches = node.querySelectorAll(selector); 8550 return [].map.call(matches, function(match) { 8551 return parse(match, matchers); 8552 }); 8553 }; 8554 } 8555 8556 // node_modules/memize/dist/index.js 8557 function memize(fn, options) { 8558 var size = 0; 8559 var head; 8560 var tail; 8561 options = options || {}; 8562 function memoized() { 8563 var node = head, len = arguments.length, args, i2; 8564 searchCache: while (node) { 8565 if (node.args.length !== arguments.length) { 8566 node = node.next; 8567 continue; 8568 } 8569 for (i2 = 0; i2 < len; i2++) { 8570 if (node.args[i2] !== arguments[i2]) { 8571 node = node.next; 8572 continue searchCache; 8573 } 8574 } 8575 if (node !== head) { 8576 if (node === tail) { 8577 tail = node.prev; 8578 } 8579 node.prev.next = node.next; 8580 if (node.next) { 8581 node.next.prev = node.prev; 8582 } 8583 node.next = head; 8584 node.prev = null; 8585 head.prev = node; 8586 head = node; 8587 } 8588 return node.val; 8589 } 8590 args = new Array(len); 8591 for (i2 = 0; i2 < len; i2++) { 8592 args[i2] = arguments[i2]; 8593 } 8594 node = { 8595 args, 8596 // Generate the result from original function 8597 val: fn.apply(null, args) 8598 }; 8599 if (head) { 8600 head.prev = node; 8601 node.next = head; 8602 } else { 8603 tail = node; 8604 } 8605 if (size === /** @type {MemizeOptions} */ 8606 options.maxSize) { 8607 tail = /** @type {MemizeCacheNode} */ 8608 tail.prev; 8609 tail.next = null; 8610 } else { 8611 size++; 8612 } 8613 head = node; 8614 return node.val; 8615 } 8616 memoized.clear = function() { 8617 head = null; 8618 tail = null; 8619 size = 0; 8620 }; 8621 return memoized; 8622 } 8623 8624 // packages/blocks/build-module/api/parser/get-block-attributes.js 8625 var import_hooks4 = __toESM(require_hooks()); 8626 var import_rich_text4 = __toESM(require_rich_text()); 8627 8628 // packages/blocks/build-module/api/matchers.js 8629 var import_rich_text3 = __toESM(require_rich_text()); 8630 8631 // packages/blocks/build-module/api/node.js 8632 var import_deprecated9 = __toESM(require_deprecated()); 8633 8634 // packages/blocks/build-module/api/children.js 8635 var import_element3 = __toESM(require_element()); 8636 var import_deprecated8 = __toESM(require_deprecated()); 8637 function getSerializeCapableElement(children) { 8638 return children; 8639 } 8640 function getChildrenArray(children) { 8641 (0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", { 8642 since: "6.1", 8643 version: "6.3", 8644 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8645 }); 8646 return children; 8647 } 8648 function concat(...blockNodes) { 8649 (0, import_deprecated8.default)("wp.blocks.children.concat", { 8650 since: "6.1", 8651 version: "6.3", 8652 alternative: "wp.richText.concat", 8653 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8654 }); 8655 const result = []; 8656 for (let i2 = 0; i2 < blockNodes.length; i2++) { 8657 const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]]; 8658 for (let j2 = 0; j2 < blockNode.length; j2++) { 8659 const child = blockNode[j2]; 8660 const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string"; 8661 if (canConcatToPreviousString) { 8662 result[result.length - 1] += child; 8663 } else { 8664 result.push(child); 8665 } 8666 } 8667 } 8668 return result; 8669 } 8670 function fromDOM22(domNodes) { 8671 (0, import_deprecated8.default)("wp.blocks.children.fromDOM", { 8672 since: "6.1", 8673 version: "6.3", 8674 alternative: "wp.richText.create", 8675 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8676 }); 8677 const result = []; 8678 for (let i2 = 0; i2 < domNodes.length; i2++) { 8679 try { 8680 result.push(fromDOM2(domNodes[i2])); 8681 } catch (error) { 8682 } 8683 } 8684 return result; 8685 } 8686 function toHTML(children) { 8687 (0, import_deprecated8.default)("wp.blocks.children.toHTML", { 8688 since: "6.1", 8689 version: "6.3", 8690 alternative: "wp.richText.toHTMLString", 8691 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8692 }); 8693 const element = getSerializeCapableElement(children); 8694 return (0, import_element3.renderToString)(element); 8695 } 8696 function matcher(selector) { 8697 (0, import_deprecated8.default)("wp.blocks.children.matcher", { 8698 since: "6.1", 8699 version: "6.3", 8700 alternative: "html source", 8701 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8702 }); 8703 return (domNode) => { 8704 let match = domNode; 8705 if (selector) { 8706 match = domNode.querySelector(selector); 8707 } 8708 if (match) { 8709 return fromDOM22(match.childNodes); 8710 } 8711 return []; 8712 }; 8713 } 8714 var children_default = { 8715 concat, 8716 getChildrenArray, 8717 fromDOM: fromDOM22, 8718 toHTML, 8719 matcher 8720 }; 8721 8722 // packages/blocks/build-module/api/node.js 8723 function isNodeOfType(node, type) { 8724 (0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", { 8725 since: "6.1", 8726 version: "6.3", 8727 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8728 }); 8729 return node && node.type === type; 8730 } 8731 function getNamedNodeMapAsObject(nodeMap) { 8732 const result = {}; 8733 for (let i2 = 0; i2 < nodeMap.length; i2++) { 8734 const { name, value } = nodeMap[i2]; 8735 result[name] = value; 8736 } 8737 return result; 8738 } 8739 function fromDOM2(domNode) { 8740 (0, import_deprecated9.default)("wp.blocks.node.fromDOM", { 8741 since: "6.1", 8742 version: "6.3", 8743 alternative: "wp.richText.create", 8744 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8745 }); 8746 if (domNode.nodeType === domNode.TEXT_NODE) { 8747 return domNode.nodeValue; 8748 } 8749 if (domNode.nodeType !== domNode.ELEMENT_NODE) { 8750 throw new TypeError( 8751 "A block node can only be created from a node of type text or element." 8752 ); 8753 } 8754 return { 8755 type: domNode.nodeName.toLowerCase(), 8756 props: { 8757 ...getNamedNodeMapAsObject(domNode.attributes), 8758 children: fromDOM22(domNode.childNodes) 8759 } 8760 }; 8761 } 8762 function toHTML2(node) { 8763 (0, import_deprecated9.default)("wp.blocks.node.toHTML", { 8764 since: "6.1", 8765 version: "6.3", 8766 alternative: "wp.richText.toHTMLString", 8767 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8768 }); 8769 return toHTML([node]); 8770 } 8771 function matcher2(selector) { 8772 (0, import_deprecated9.default)("wp.blocks.node.matcher", { 8773 since: "6.1", 8774 version: "6.3", 8775 alternative: "html source", 8776 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" 8777 }); 8778 return (domNode) => { 8779 let match = domNode; 8780 if (selector) { 8781 match = domNode.querySelector(selector); 8782 } 8783 try { 8784 return fromDOM2(match); 8785 } catch (error) { 8786 return null; 8787 } 8788 }; 8789 } 8790 var node_default = { 8791 isNodeOfType, 8792 fromDOM: fromDOM2, 8793 toHTML: toHTML2, 8794 matcher: matcher2 8795 }; 8796 8797 // packages/blocks/build-module/api/matchers.js 8798 function html(selector, multilineTag) { 8799 return (domNode) => { 8800 let match = domNode; 8801 if (selector) { 8802 match = domNode.querySelector(selector); 8803 } 8804 if (!match) { 8805 return ""; 8806 } 8807 if (multilineTag) { 8808 let value = ""; 8809 const length = match.children.length; 8810 for (let index = 0; index < length; index++) { 8811 const child = match.children[index]; 8812 if (child.nodeName.toLowerCase() !== multilineTag) { 8813 continue; 8814 } 8815 value += child.outerHTML; 8816 } 8817 return value; 8818 } 8819 return match.innerHTML; 8820 }; 8821 } 8822 var richText = (selector, preserveWhiteSpace) => (el) => { 8823 const target = selector ? el.querySelector(selector) : el; 8824 return target ? import_rich_text3.RichTextData.fromHTMLElement(target, { preserveWhiteSpace }) : import_rich_text3.RichTextData.empty(); 8825 }; 8826 8827 // packages/blocks/build-module/api/parser/get-block-attributes.js 8828 var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0; 8829 function isOfType(value, type) { 8830 switch (type) { 8831 case "rich-text": 8832 return value instanceof import_rich_text4.RichTextData; 8833 case "string": 8834 return typeof value === "string"; 8835 case "boolean": 8836 return typeof value === "boolean"; 8837 case "object": 8838 return !!value && value.constructor === Object; 8839 case "null": 8840 return value === null; 8841 case "array": 8842 return Array.isArray(value); 8843 case "integer": 8844 case "number": 8845 return typeof value === "number"; 8846 } 8847 return true; 8848 } 8849 function isOfTypes(value, types) { 8850 return types.some((type) => isOfType(value, type)); 8851 } 8852 function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) { 8853 let value; 8854 switch (attributeSchema.source) { 8855 // An undefined source means that it's an attribute serialized to the 8856 // block's "comment". 8857 case void 0: 8858 value = commentAttributes ? commentAttributes[attributeKey] : void 0; 8859 break; 8860 // raw source means that it's the original raw block content. 8861 case "raw": 8862 value = innerHTML; 8863 break; 8864 case "attribute": 8865 case "property": 8866 case "html": 8867 case "text": 8868 case "rich-text": 8869 case "children": 8870 case "node": 8871 case "query": 8872 case "tag": 8873 value = parseWithAttributeSchema(innerDOM, attributeSchema); 8874 break; 8875 } 8876 if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) { 8877 value = void 0; 8878 } 8879 if (value === void 0) { 8880 value = getDefault(attributeSchema); 8881 } 8882 return value; 8883 } 8884 function isValidByType(value, type) { 8885 return type === void 0 || isOfTypes(value, Array.isArray(type) ? type : [type]); 8886 } 8887 function isValidByEnum(value, enumSet) { 8888 return !Array.isArray(enumSet) || enumSet.includes(value); 8889 } 8890 var matcherFromSource = memize((sourceConfig) => { 8891 switch (sourceConfig.source) { 8892 case "attribute": { 8893 let matcher3 = attr(sourceConfig.selector, sourceConfig.attribute); 8894 if (sourceConfig.type === "boolean") { 8895 matcher3 = toBooleanAttributeMatcher(matcher3); 8896 } 8897 return matcher3; 8898 } 8899 case "html": 8900 return html(sourceConfig.selector, sourceConfig.multiline); 8901 case "text": 8902 return text(sourceConfig.selector); 8903 case "rich-text": 8904 return richText( 8905 sourceConfig.selector, 8906 sourceConfig.__unstablePreserveWhiteSpace 8907 ); 8908 case "children": 8909 return matcher(sourceConfig.selector); 8910 case "node": 8911 return matcher2(sourceConfig.selector); 8912 case "query": 8913 const subMatchers = Object.fromEntries( 8914 Object.entries(sourceConfig.query).map( 8915 ([key, subSourceConfig]) => [ 8916 key, 8917 matcherFromSource(subSourceConfig) 8918 ] 8919 ) 8920 ); 8921 return query(sourceConfig.selector, subMatchers); 8922 case "tag": { 8923 const matcher3 = prop(sourceConfig.selector, "nodeName"); 8924 return (domNode) => matcher3(domNode)?.toLowerCase(); 8925 } 8926 default: 8927 console.error(`Unknown source type "${sourceConfig.source}"`); 8928 } 8929 }); 8930 function parseHtml(innerHTML) { 8931 return parse(innerHTML, (h2) => h2); 8932 } 8933 function parseWithAttributeSchema(innerHTML, attributeSchema) { 8934 return matcherFromSource(attributeSchema)(parseHtml(innerHTML)); 8935 } 8936 function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) { 8937 const doc = parseHtml(innerHTML); 8938 const blockType = normalizeBlockType(blockTypeOrName); 8939 const blockAttributes = Object.fromEntries( 8940 Object.entries(blockType.attributes ?? {}).map( 8941 ([key, schema]) => [ 8942 key, 8943 getBlockAttribute(key, schema, doc, attributes, innerHTML) 8944 ] 8945 ) 8946 ); 8947 return (0, import_hooks4.applyFilters)( 8948 "blocks.getBlockAttributes", 8949 blockAttributes, 8950 blockType, 8951 innerHTML, 8952 attributes 8953 ); 8954 } 8955 8956 // packages/blocks/build-module/api/parser/fix-custom-classname.js 8957 var CLASS_ATTR_SCHEMA = { 8958 type: "string", 8959 source: "attribute", 8960 selector: "[data-custom-class-name] > *", 8961 attribute: "class" 8962 }; 8963 function getHTMLRootElementClasses(innerHTML) { 8964 const parsed = parseWithAttributeSchema( 8965 `<div data-custom-class-name>$innerHTML}</div>`, 8966 CLASS_ATTR_SCHEMA 8967 ); 8968 return parsed ? parsed.trim().split(/\s+/) : []; 8969 } 8970 function fixCustomClassname(blockAttributes, blockType, innerHTML) { 8971 if (!hasBlockSupport(blockType, "customClassName", true)) { 8972 return blockAttributes; 8973 } 8974 const modifiedBlockAttributes = { ...blockAttributes }; 8975 const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes; 8976 const serialized = getSaveContent(blockType, attributesSansClassName); 8977 const defaultClasses = getHTMLRootElementClasses(serialized); 8978 const actualClasses = getHTMLRootElementClasses(innerHTML); 8979 const customClasses = actualClasses.filter( 8980 (className) => !defaultClasses.includes(className) 8981 ); 8982 if (customClasses.length) { 8983 modifiedBlockAttributes.className = customClasses.join(" "); 8984 } else if (serialized) { 8985 delete modifiedBlockAttributes.className; 8986 } 8987 return modifiedBlockAttributes; 8988 } 8989 8990 // packages/blocks/build-module/api/parser/fix-global-attribute.js 8991 function getHTMLRootElement(innerHTML, dataAttribute, attributeSchema) { 8992 const parsed = parseWithAttributeSchema( 8993 `<div $dataAttribute}>$innerHTML}</div>`, 8994 attributeSchema 8995 ); 8996 return parsed; 8997 } 8998 function fixGlobalAttribute(blockAttributes, blockType, innerHTML, supportKey, dataAttribute, attributeSchema) { 8999 if (!hasBlockSupport(blockType, supportKey, false)) { 9000 return blockAttributes; 9001 } 9002 const modifiedBlockAttributes = { ...blockAttributes }; 9003 const attributeValue = getHTMLRootElement( 9004 innerHTML, 9005 dataAttribute, 9006 attributeSchema 9007 ); 9008 if (attributeValue) { 9009 modifiedBlockAttributes[supportKey] = attributeValue; 9010 } 9011 return modifiedBlockAttributes; 9012 } 9013 9014 // packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.js 9015 var ARIA_LABEL_ATTR_SCHEMA = { 9016 type: "string", 9017 source: "attribute", 9018 selector: "[data-aria-label] > *", 9019 attribute: "aria-label" 9020 }; 9021 var ANCHOR_ATTR_SCHEMA = { 9022 type: "string", 9023 source: "attribute", 9024 selector: "[data-anchor] > *", 9025 attribute: "id" 9026 }; 9027 function applyBuiltInValidationFixes(block, blockType) { 9028 const { attributes, originalContent } = block; 9029 let updatedBlockAttributes = attributes; 9030 updatedBlockAttributes = fixCustomClassname( 9031 attributes, 9032 blockType, 9033 originalContent 9034 ); 9035 updatedBlockAttributes = fixGlobalAttribute( 9036 updatedBlockAttributes, 9037 blockType, 9038 originalContent, 9039 "ariaLabel", 9040 "data-aria-label", 9041 ARIA_LABEL_ATTR_SCHEMA 9042 ); 9043 updatedBlockAttributes = fixGlobalAttribute( 9044 updatedBlockAttributes, 9045 blockType, 9046 originalContent, 9047 "anchor", 9048 "data-anchor", 9049 ANCHOR_ATTR_SCHEMA 9050 ); 9051 return { 9052 ...block, 9053 attributes: updatedBlockAttributes 9054 }; 9055 } 9056 9057 // packages/blocks/build-module/api/parser/apply-block-deprecated-versions.js 9058 function stubFalse() { 9059 return false; 9060 } 9061 function applyBlockDeprecatedVersions(block, rawBlock, blockType) { 9062 const parsedAttributes = rawBlock.attrs; 9063 const { deprecated: deprecatedDefinitions } = blockType; 9064 if (!deprecatedDefinitions || !deprecatedDefinitions.length) { 9065 return block; 9066 } 9067 for (let i2 = 0; i2 < deprecatedDefinitions.length; i2++) { 9068 const { isEligible = stubFalse } = deprecatedDefinitions[i2]; 9069 if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, { 9070 blockNode: rawBlock, 9071 block 9072 })) { 9073 continue; 9074 } 9075 const deprecatedBlockType = Object.assign( 9076 omit(blockType, DEPRECATED_ENTRY_KEYS), 9077 deprecatedDefinitions[i2] 9078 ); 9079 let migratedBlock = { 9080 ...block, 9081 attributes: getBlockAttributes( 9082 deprecatedBlockType, 9083 block.originalContent, 9084 parsedAttributes 9085 ) 9086 }; 9087 let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); 9088 if (!isValid) { 9089 migratedBlock = applyBuiltInValidationFixes( 9090 migratedBlock, 9091 deprecatedBlockType 9092 ); 9093 [isValid] = validateBlock(migratedBlock, deprecatedBlockType); 9094 } 9095 if (!isValid) { 9096 continue; 9097 } 9098 let migratedInnerBlocks = migratedBlock.innerBlocks; 9099 let migratedAttributes = migratedBlock.attributes; 9100 const { migrate } = deprecatedBlockType; 9101 if (migrate) { 9102 let migrated = migrate(migratedAttributes, block.innerBlocks); 9103 if (!Array.isArray(migrated)) { 9104 migrated = [migrated]; 9105 } 9106 [ 9107 migratedAttributes = parsedAttributes, 9108 migratedInnerBlocks = block.innerBlocks 9109 ] = migrated; 9110 } 9111 block = { 9112 ...block, 9113 attributes: migratedAttributes, 9114 innerBlocks: migratedInnerBlocks, 9115 isValid: true, 9116 validationIssues: [] 9117 }; 9118 } 9119 return block; 9120 } 9121 9122 // packages/blocks/build-module/api/parser/index.js 9123 function convertLegacyBlocks(rawBlock) { 9124 const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes( 9125 rawBlock.blockName, 9126 rawBlock.attrs 9127 ); 9128 return { 9129 ...rawBlock, 9130 blockName: correctName, 9131 attrs: correctedAttributes 9132 }; 9133 } 9134 function normalizeRawBlock(rawBlock, options) { 9135 const fallbackBlockName = getFreeformContentHandlerName(); 9136 const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName(); 9137 const rawAttributes = rawBlock.attrs || {}; 9138 const rawInnerBlocks = rawBlock.innerBlocks || []; 9139 let rawInnerHTML = rawBlock.innerHTML.trim(); 9140 if (rawBlockName === fallbackBlockName && rawBlockName === "core/freeform" && !options?.__unstableSkipAutop) { 9141 rawInnerHTML = (0, import_autop2.autop)(rawInnerHTML).trim(); 9142 } 9143 return { 9144 ...rawBlock, 9145 blockName: rawBlockName, 9146 attrs: rawAttributes, 9147 innerHTML: rawInnerHTML, 9148 innerBlocks: rawInnerBlocks 9149 }; 9150 } 9151 function createMissingBlockType(rawBlock) { 9152 const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName(); 9153 const originalUndelimitedContent = serializeRawBlock(rawBlock, { 9154 isCommentDelimited: false 9155 }); 9156 const originalContent = serializeRawBlock(rawBlock, { 9157 isCommentDelimited: true 9158 }); 9159 return { 9160 blockName: unregisteredFallbackBlock, 9161 attrs: { 9162 originalName: rawBlock.blockName, 9163 originalContent, 9164 originalUndelimitedContent 9165 }, 9166 innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML, 9167 innerBlocks: rawBlock.innerBlocks, 9168 innerContent: rawBlock.innerContent 9169 }; 9170 } 9171 function applyBlockValidation(unvalidatedBlock, blockType) { 9172 const [isValid] = validateBlock(unvalidatedBlock, blockType); 9173 if (isValid) { 9174 return { ...unvalidatedBlock, isValid, validationIssues: [] }; 9175 } 9176 const fixedBlock = applyBuiltInValidationFixes( 9177 unvalidatedBlock, 9178 blockType 9179 ); 9180 const [isFixedValid, validationIssues] = validateBlock( 9181 fixedBlock, 9182 blockType 9183 ); 9184 return { ...fixedBlock, isValid: isFixedValid, validationIssues }; 9185 } 9186 function parseRawBlock(rawBlock, options) { 9187 let normalizedBlock = normalizeRawBlock(rawBlock, options); 9188 normalizedBlock = convertLegacyBlocks(normalizedBlock); 9189 let blockType = getBlockType(normalizedBlock.blockName); 9190 if (!blockType) { 9191 normalizedBlock = createMissingBlockType(normalizedBlock); 9192 blockType = getBlockType(normalizedBlock.blockName); 9193 } 9194 const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName(); 9195 if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) { 9196 return; 9197 } 9198 const parsedInnerBlocks = normalizedBlock.innerBlocks.map((innerBlock) => parseRawBlock(innerBlock, options)).filter((innerBlock) => !!innerBlock); 9199 const parsedBlock = createBlock( 9200 normalizedBlock.blockName, 9201 getBlockAttributes( 9202 blockType, 9203 normalizedBlock.innerHTML, 9204 normalizedBlock.attrs 9205 ), 9206 parsedInnerBlocks 9207 ); 9208 parsedBlock.originalContent = normalizedBlock.innerHTML; 9209 const validatedBlock = applyBlockValidation(parsedBlock, blockType); 9210 const { validationIssues } = validatedBlock; 9211 const updatedBlock = applyBlockDeprecatedVersions( 9212 validatedBlock, 9213 normalizedBlock, 9214 blockType 9215 ); 9216 if (!updatedBlock.isValid) { 9217 updatedBlock.__unstableBlockSource = rawBlock; 9218 } 9219 if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) { 9220 console.groupCollapsed("Updated Block: %s", blockType.name); 9221 console.info( 9222 "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", 9223 blockType.name, 9224 blockType, 9225 getSaveContent(blockType, updatedBlock.attributes), 9226 updatedBlock.originalContent 9227 ); 9228 console.groupEnd(); 9229 } else if (!validatedBlock.isValid && !updatedBlock.isValid) { 9230 validationIssues.forEach(({ log: log2, args }) => log2(...args)); 9231 } 9232 return updatedBlock; 9233 } 9234 function parse2(content, options) { 9235 return (0, import_block_serialization_default_parser.parse)(content).reduce((accumulator, rawBlock) => { 9236 const block = parseRawBlock(rawBlock, options); 9237 if (block) { 9238 accumulator.push(block); 9239 } 9240 return accumulator; 9241 }, []); 9242 } 9243 9244 // packages/blocks/build-module/api/raw-handling/index.js 9245 var import_deprecated10 = __toESM(require_deprecated()); 9246 var import_dom12 = __toESM(require_dom()); 9247 9248 // packages/blocks/build-module/api/raw-handling/html-to-blocks.js 9249 var import_element4 = __toESM(require_element()); 9250 9251 // packages/blocks/build-module/api/raw-handling/get-raw-transforms.js 9252 function getRawTransforms() { 9253 return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => { 9254 return transform.isMatch ? transform : { 9255 ...transform, 9256 isMatch: (node) => transform.selector && node.matches(transform.selector) 9257 }; 9258 }); 9259 } 9260 9261 // packages/blocks/build-module/api/raw-handling/html-to-blocks.js 9262 function htmlToBlocks(html2, handler) { 9263 const doc = document.implementation.createHTMLDocument(""); 9264 doc.body.innerHTML = html2; 9265 return Array.from(doc.body.children).flatMap((node) => { 9266 const rawTransform = findTransform( 9267 getRawTransforms(), 9268 ({ isMatch }) => isMatch(node) 9269 ); 9270 if (!rawTransform) { 9271 if (import_element4.Platform.isNative) { 9272 return parse2( 9273 `<!-- wp:html -->$node.outerHTML}<!-- /wp:html -->` 9274 ); 9275 } 9276 return createBlock( 9277 // Should not be hardcoded. 9278 "core/html", 9279 getBlockAttributes("core/html", node.outerHTML) 9280 ); 9281 } 9282 const { transform, blockName } = rawTransform; 9283 if (transform) { 9284 const block = transform(node, handler); 9285 if (node.hasAttribute("class")) { 9286 block.attributes.className = node.getAttribute("class"); 9287 } 9288 return block; 9289 } 9290 return createBlock( 9291 blockName, 9292 getBlockAttributes(blockName, node.outerHTML) 9293 ); 9294 }); 9295 } 9296 9297 // packages/blocks/build-module/api/raw-handling/normalise-blocks.js 9298 var import_dom2 = __toESM(require_dom()); 9299 function normaliseBlocks(HTML, options = {}) { 9300 const decuDoc = document.implementation.createHTMLDocument(""); 9301 const accuDoc = document.implementation.createHTMLDocument(""); 9302 const decu = decuDoc.body; 9303 const accu = accuDoc.body; 9304 decu.innerHTML = HTML; 9305 while (decu.firstChild) { 9306 const node = decu.firstChild; 9307 if (node.nodeType === node.TEXT_NODE) { 9308 if ((0, import_dom2.isEmpty)(node)) { 9309 decu.removeChild(node); 9310 } else { 9311 if (!accu.lastChild || accu.lastChild.nodeName !== "P") { 9312 accu.appendChild(accuDoc.createElement("P")); 9313 } 9314 accu.lastChild.appendChild(node); 9315 } 9316 } else if (node.nodeType === node.ELEMENT_NODE) { 9317 if (node.nodeName === "BR") { 9318 if (node.nextSibling && node.nextSibling.nodeName === "BR") { 9319 accu.appendChild(accuDoc.createElement("P")); 9320 decu.removeChild(node.nextSibling); 9321 } 9322 if (accu.lastChild && accu.lastChild.nodeName === "P" && accu.lastChild.hasChildNodes()) { 9323 accu.lastChild.appendChild(node); 9324 } else { 9325 decu.removeChild(node); 9326 } 9327 } else if (node.nodeName === "P") { 9328 if ((0, import_dom2.isEmpty)(node) && !options.raw) { 9329 decu.removeChild(node); 9330 } else { 9331 accu.appendChild(node); 9332 } 9333 } else if ((0, import_dom2.isPhrasingContent)(node)) { 9334 if (!accu.lastChild || accu.lastChild.nodeName !== "P") { 9335 accu.appendChild(accuDoc.createElement("P")); 9336 } 9337 accu.lastChild.appendChild(node); 9338 } else { 9339 accu.appendChild(node); 9340 } 9341 } else { 9342 decu.removeChild(node); 9343 } 9344 } 9345 return accu.innerHTML; 9346 } 9347 9348 // packages/blocks/build-module/api/raw-handling/special-comment-converter.js 9349 var import_dom3 = __toESM(require_dom()); 9350 function specialCommentConverter(node, doc) { 9351 if (node.nodeType !== node.COMMENT_NODE) { 9352 return; 9353 } 9354 if (node.nodeValue !== "nextpage" && node.nodeValue.indexOf("more") !== 0) { 9355 return; 9356 } 9357 const block = createBlock2(node, doc); 9358 if (!node.parentNode || node.parentNode.nodeName !== "P") { 9359 (0, import_dom3.replace)(node, block); 9360 } else { 9361 const childNodes = Array.from(node.parentNode.childNodes); 9362 const nodeIndex = childNodes.indexOf(node); 9363 const wrapperNode = node.parentNode.parentNode || doc.body; 9364 const paragraphBuilder = (acc, child) => { 9365 if (!acc) { 9366 acc = doc.createElement("p"); 9367 } 9368 acc.appendChild(child); 9369 return acc; 9370 }; 9371 [ 9372 childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), 9373 block, 9374 childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null) 9375 ].forEach( 9376 (element) => element && wrapperNode.insertBefore(element, node.parentNode) 9377 ); 9378 (0, import_dom3.remove)(node.parentNode); 9379 } 9380 } 9381 function createBlock2(commentNode, doc) { 9382 if (commentNode.nodeValue === "nextpage") { 9383 return createNextpage(doc); 9384 } 9385 const customText = commentNode.nodeValue.slice(4).trim(); 9386 let sibling = commentNode; 9387 let noTeaser = false; 9388 while (sibling = sibling.nextSibling) { 9389 if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === "noteaser") { 9390 noTeaser = true; 9391 (0, import_dom3.remove)(sibling); 9392 break; 9393 } 9394 } 9395 return createMore(customText, noTeaser, doc); 9396 } 9397 function createMore(customText, noTeaser, doc) { 9398 const node = doc.createElement("wp-block"); 9399 node.dataset.block = "core/more"; 9400 if (customText) { 9401 node.dataset.customText = customText; 9402 } 9403 if (noTeaser) { 9404 node.dataset.noTeaser = ""; 9405 } 9406 return node; 9407 } 9408 function createNextpage(doc) { 9409 const node = doc.createElement("wp-block"); 9410 node.dataset.block = "core/nextpage"; 9411 return node; 9412 } 9413 9414 // packages/blocks/build-module/api/raw-handling/list-reducer.js 9415 var import_dom4 = __toESM(require_dom()); 9416 function isList(node) { 9417 return node.nodeName === "OL" || node.nodeName === "UL"; 9418 } 9419 function shallowTextContent(element) { 9420 return Array.from(element.childNodes).map(({ nodeValue = "" }) => nodeValue).join(""); 9421 } 9422 function listReducer(node) { 9423 if (!isList(node)) { 9424 return; 9425 } 9426 const list = node; 9427 const prevElement = node.previousElementSibling; 9428 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { 9429 while (list.firstChild) { 9430 prevElement.appendChild(list.firstChild); 9431 } 9432 list.parentNode.removeChild(list); 9433 } 9434 const parentElement = node.parentNode; 9435 if (parentElement && parentElement.nodeName === "LI" && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { 9436 const parentListItem = parentElement; 9437 const prevListItem = parentListItem.previousElementSibling; 9438 const parentList = parentListItem.parentNode; 9439 if (prevListItem) { 9440 prevListItem.appendChild(list); 9441 parentList.removeChild(parentListItem); 9442 } 9443 } 9444 if (parentElement && isList(parentElement)) { 9445 const prevListItem = node.previousElementSibling; 9446 if (prevListItem) { 9447 prevListItem.appendChild(node); 9448 } else { 9449 (0, import_dom4.unwrap)(node); 9450 } 9451 } 9452 } 9453 9454 // packages/blocks/build-module/api/raw-handling/blockquote-normaliser.js 9455 function blockquoteNormaliser(options) { 9456 return (node) => { 9457 if (node.nodeName !== "BLOCKQUOTE") { 9458 return; 9459 } 9460 node.innerHTML = normaliseBlocks(node.innerHTML, options); 9461 }; 9462 } 9463 9464 // packages/blocks/build-module/api/raw-handling/figure-content-reducer.js 9465 var import_dom5 = __toESM(require_dom()); 9466 function isFigureContent(node, schema) { 9467 const tag = node.nodeName.toLowerCase(); 9468 if (tag === "figcaption" || (0, import_dom5.isTextContent)(node)) { 9469 return false; 9470 } 9471 return tag in (schema?.figure?.children ?? {}); 9472 } 9473 function canHaveAnchor(node, schema) { 9474 const tag = node.nodeName.toLowerCase(); 9475 return tag in (schema?.figure?.children?.a?.children ?? {}); 9476 } 9477 function wrapFigureContent(element, beforeElement = element) { 9478 const figure = element.ownerDocument.createElement("figure"); 9479 beforeElement.parentNode.insertBefore(figure, beforeElement); 9480 figure.appendChild(element); 9481 } 9482 function figureContentReducer(node, doc, schema) { 9483 if (!isFigureContent(node, schema)) { 9484 return; 9485 } 9486 let nodeToInsert = node; 9487 const parentNode = node.parentNode; 9488 if (canHaveAnchor(node, schema) && parentNode.nodeName === "A" && parentNode.childNodes.length === 1) { 9489 nodeToInsert = node.parentNode; 9490 } 9491 const wrapper = nodeToInsert.closest("p,div"); 9492 if (wrapper) { 9493 if (!node.classList) { 9494 wrapFigureContent(nodeToInsert, wrapper); 9495 } else if (node.classList.contains("alignright") || node.classList.contains("alignleft") || node.classList.contains("aligncenter") || !wrapper.textContent.trim()) { 9496 wrapFigureContent(nodeToInsert, wrapper); 9497 } 9498 } else { 9499 wrapFigureContent(nodeToInsert); 9500 } 9501 } 9502 9503 // packages/blocks/build-module/api/raw-handling/shortcode-converter.js 9504 var import_shortcode = __toESM(require_shortcode()); 9505 var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; 9506 var beforeLineRegexp = /(\n|<p>)\s*$/; 9507 var afterLineRegexp = /^\s*(\n|<\/p>)/; 9508 function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) { 9509 const transformsFrom = getBlockTransforms("from"); 9510 const transformation = findTransform( 9511 transformsFrom, 9512 (transform) => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === "shortcode" && castArray(transform.tag).some( 9513 (tag) => (0, import_shortcode.regexp)(tag).test(HTML) 9514 ) 9515 ); 9516 if (!transformation) { 9517 return [HTML]; 9518 } 9519 const transformTags = castArray(transformation.tag); 9520 const transformTag = transformTags.find( 9521 (tag) => (0, import_shortcode.regexp)(tag).test(HTML) 9522 ); 9523 let match; 9524 const previousIndex = lastIndex; 9525 if (match = (0, import_shortcode.next)(transformTag, HTML, lastIndex)) { 9526 lastIndex = match.index + match.content.length; 9527 const beforeHTML = HTML.substr(0, match.index); 9528 const afterHTML = HTML.substr(lastIndex); 9529 if (!match.shortcode.content?.includes("<") && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) { 9530 return segmentHTMLToShortcodeBlock(HTML, lastIndex); 9531 } 9532 if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { 9533 return segmentHTMLToShortcodeBlock(HTML, previousIndex, [ 9534 ...excludedBlockNames, 9535 transformation.blockName 9536 ]); 9537 } 9538 let blocks = []; 9539 if (typeof transformation.transform === "function") { 9540 blocks = [].concat( 9541 transformation.transform(match.shortcode.attrs, match) 9542 ); 9543 blocks = blocks.map((block) => { 9544 block.originalContent = match.shortcode.content; 9545 return applyBuiltInValidationFixes( 9546 block, 9547 getBlockType(block.name) 9548 ); 9549 }); 9550 } else { 9551 const attributes = Object.fromEntries( 9552 Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode).map(([key, schema]) => [ 9553 key, 9554 schema.shortcode(match.shortcode.attrs, match) 9555 ]) 9556 ); 9557 const blockType = getBlockType(transformation.blockName); 9558 if (!blockType) { 9559 return [HTML]; 9560 } 9561 const transformationBlockType = { 9562 ...blockType, 9563 attributes: transformation.attributes 9564 }; 9565 let block = createBlock( 9566 transformation.blockName, 9567 getBlockAttributes( 9568 transformationBlockType, 9569 match.shortcode.content, 9570 attributes 9571 ) 9572 ); 9573 block.originalContent = match.shortcode.content; 9574 block = applyBuiltInValidationFixes( 9575 block, 9576 transformationBlockType 9577 ); 9578 blocks = [block]; 9579 } 9580 return [ 9581 ...segmentHTMLToShortcodeBlock( 9582 beforeHTML.replace(beforeLineRegexp, "") 9583 ), 9584 ...blocks, 9585 ...segmentHTMLToShortcodeBlock( 9586 afterHTML.replace(afterLineRegexp, "") 9587 ) 9588 ]; 9589 } 9590 return [HTML]; 9591 } 9592 var shortcode_converter_default = segmentHTMLToShortcodeBlock; 9593 9594 // packages/blocks/build-module/api/raw-handling/utils.js 9595 var import_dom6 = __toESM(require_dom()); 9596 function getBlockContentSchemaFromTransforms(transforms, context) { 9597 const phrasingContentSchema = (0, import_dom6.getPhrasingContentSchema)(context); 9598 const schemaArgs = { phrasingContentSchema, isPaste: context === "paste" }; 9599 const schemas = transforms.map(({ isMatch, blockName, schema }) => { 9600 const hasAnchorSupport = hasBlockSupport(blockName, "anchor"); 9601 schema = typeof schema === "function" ? schema(schemaArgs) : schema; 9602 if (!hasAnchorSupport && !isMatch) { 9603 return schema; 9604 } 9605 if (!schema) { 9606 return {}; 9607 } 9608 return Object.fromEntries( 9609 Object.entries(schema).map(([key, value]) => { 9610 let attributes = value.attributes || []; 9611 if (hasAnchorSupport) { 9612 attributes = [...attributes, "id"]; 9613 } 9614 return [ 9615 key, 9616 { 9617 ...value, 9618 attributes, 9619 isMatch: isMatch ? isMatch : void 0 9620 } 9621 ]; 9622 }) 9623 ); 9624 }); 9625 function mergeTagNameSchemaProperties(objValue, srcValue, key) { 9626 switch (key) { 9627 case "children": { 9628 if (objValue === "*" || srcValue === "*") { 9629 return "*"; 9630 } 9631 return { ...objValue, ...srcValue }; 9632 } 9633 case "attributes": 9634 case "require": { 9635 return [...objValue || [], ...srcValue || []]; 9636 } 9637 case "isMatch": { 9638 if (!objValue || !srcValue) { 9639 return void 0; 9640 } 9641 return (...args) => { 9642 return objValue(...args) || srcValue(...args); 9643 }; 9644 } 9645 } 9646 } 9647 function mergeTagNameSchemas(a2, b2) { 9648 for (const key in b2) { 9649 a2[key] = a2[key] ? mergeTagNameSchemaProperties(a2[key], b2[key], key) : { ...b2[key] }; 9650 } 9651 return a2; 9652 } 9653 function mergeSchemas(a2, b2) { 9654 for (const key in b2) { 9655 a2[key] = a2[key] ? mergeTagNameSchemas(a2[key], b2[key]) : { ...b2[key] }; 9656 } 9657 return a2; 9658 } 9659 return schemas.reduce(mergeSchemas, {}); 9660 } 9661 function getBlockContentSchema(context) { 9662 return getBlockContentSchemaFromTransforms(getRawTransforms(), context); 9663 } 9664 function isPlain(HTML) { 9665 if (!/<(?!br[ />])/i.test(HTML)) { 9666 return true; 9667 } 9668 const doc = document.implementation.createHTMLDocument(""); 9669 doc.body.innerHTML = HTML; 9670 if (doc.body.children.length !== 1) { 9671 return false; 9672 } 9673 const wrapper = doc.body.children.item(0); 9674 const descendants = wrapper.getElementsByTagName("*"); 9675 for (let i2 = 0; i2 < descendants.length; i2++) { 9676 if (descendants.item(i2).tagName !== "BR") { 9677 return false; 9678 } 9679 } 9680 if (wrapper.tagName !== "SPAN") { 9681 return false; 9682 } 9683 return true; 9684 } 9685 function deepFilterNodeList(nodeList, filters, doc, schema) { 9686 Array.from(nodeList).forEach((node) => { 9687 deepFilterNodeList(node.childNodes, filters, doc, schema); 9688 filters.forEach((item) => { 9689 if (!doc.contains(node)) { 9690 return; 9691 } 9692 item(node, doc, schema); 9693 }); 9694 }); 9695 } 9696 function deepFilterHTML(HTML, filters = [], schema) { 9697 const doc = document.implementation.createHTMLDocument(""); 9698 doc.body.innerHTML = HTML; 9699 deepFilterNodeList(doc.body.childNodes, filters, doc, schema); 9700 return doc.body.innerHTML; 9701 } 9702 function getSibling(node, which) { 9703 const sibling = node[`$which}Sibling`]; 9704 if (sibling && (0, import_dom6.isPhrasingContent)(sibling)) { 9705 return sibling; 9706 } 9707 const { parentNode } = node; 9708 if (!parentNode || !(0, import_dom6.isPhrasingContent)(parentNode)) { 9709 return; 9710 } 9711 return getSibling(parentNode, which); 9712 } 9713 9714 // packages/blocks/build-module/api/raw-handling/paste-handler.js 9715 var import_dom11 = __toESM(require_dom()); 9716 9717 // packages/blocks/build-module/api/raw-handling/comment-remover.js 9718 var import_dom7 = __toESM(require_dom()); 9719 function commentRemover(node) { 9720 if (node.nodeType === node.COMMENT_NODE) { 9721 (0, import_dom7.remove)(node); 9722 } 9723 } 9724 9725 // packages/blocks/build-module/api/raw-handling/is-inline-content.js 9726 var import_dom8 = __toESM(require_dom()); 9727 function isInline(node, contextTag) { 9728 if ((0, import_dom8.isTextContent)(node)) { 9729 return true; 9730 } 9731 if (!contextTag) { 9732 return false; 9733 } 9734 const tag = node.nodeName.toLowerCase(); 9735 const inlineAllowedTagGroups = [ 9736 ["ul", "li", "ol"], 9737 ["h1", "h2", "h3", "h4", "h5", "h6"] 9738 ]; 9739 return inlineAllowedTagGroups.some( 9740 (tagGroup) => [tag, contextTag].filter((t3) => !tagGroup.includes(t3)).length === 0 9741 ); 9742 } 9743 function deepCheck(nodes, contextTag) { 9744 return nodes.every( 9745 (node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag) 9746 ); 9747 } 9748 function isDoubleBR(node) { 9749 return node.nodeName === "BR" && node.previousSibling && node.previousSibling.nodeName === "BR"; 9750 } 9751 function isInlineContent(HTML, contextTag) { 9752 const doc = document.implementation.createHTMLDocument(""); 9753 doc.body.innerHTML = HTML; 9754 const nodes = Array.from(doc.body.children); 9755 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); 9756 } 9757 9758 // packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.js 9759 var import_dom9 = __toESM(require_dom()); 9760 function phrasingContentReducer(node, doc) { 9761 if (node.nodeName === "SPAN" && node.style) { 9762 const { 9763 fontWeight, 9764 fontStyle, 9765 textDecorationLine, 9766 textDecoration, 9767 verticalAlign 9768 } = node.style; 9769 if (fontWeight === "bold" || fontWeight === "700") { 9770 (0, import_dom9.wrap)(doc.createElement("strong"), node); 9771 } 9772 if (fontStyle === "italic") { 9773 (0, import_dom9.wrap)(doc.createElement("em"), node); 9774 } 9775 if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) { 9776 (0, import_dom9.wrap)(doc.createElement("s"), node); 9777 } 9778 if (verticalAlign === "super") { 9779 (0, import_dom9.wrap)(doc.createElement("sup"), node); 9780 } else if (verticalAlign === "sub") { 9781 (0, import_dom9.wrap)(doc.createElement("sub"), node); 9782 } 9783 } else if (node.nodeName === "B") { 9784 node = (0, import_dom9.replaceTag)(node, "strong"); 9785 } else if (node.nodeName === "I") { 9786 node = (0, import_dom9.replaceTag)(node, "em"); 9787 } else if (node.nodeName === "A") { 9788 if (node.target && node.target.toLowerCase() === "_blank") { 9789 node.rel = "noreferrer noopener"; 9790 } else { 9791 node.removeAttribute("target"); 9792 node.removeAttribute("rel"); 9793 } 9794 if (node.name && !node.id) { 9795 node.id = node.name; 9796 } 9797 if (node.id && !node.ownerDocument.querySelector(`[href="#$node.id}"]`)) { 9798 node.removeAttribute("id"); 9799 } 9800 } 9801 } 9802 9803 // packages/blocks/build-module/api/raw-handling/head-remover.js 9804 function headRemover(node) { 9805 if (node.nodeName !== "SCRIPT" && node.nodeName !== "NOSCRIPT" && node.nodeName !== "TEMPLATE" && node.nodeName !== "STYLE") { 9806 return; 9807 } 9808 node.parentNode.removeChild(node); 9809 } 9810 9811 // packages/blocks/build-module/api/raw-handling/ms-list-ignore.js 9812 function msListIgnore(node) { 9813 if (node.nodeType !== node.ELEMENT_NODE) { 9814 return; 9815 } 9816 const style = node.getAttribute("style"); 9817 if (!style || !style.includes("mso-list")) { 9818 return; 9819 } 9820 const rules = style.split(";").reduce((acc, rule) => { 9821 const [key, value] = rule.split(":"); 9822 if (key && value) { 9823 acc[key.trim().toLowerCase()] = value.trim().toLowerCase(); 9824 } 9825 return acc; 9826 }, {}); 9827 if (rules["mso-list"] === "ignore") { 9828 node.remove(); 9829 } 9830 } 9831 9832 // packages/blocks/build-module/api/raw-handling/ms-list-converter.js 9833 function isList2(node) { 9834 return node.nodeName === "OL" || node.nodeName === "UL"; 9835 } 9836 function msListConverter(node, doc) { 9837 if (node.nodeName !== "P") { 9838 return; 9839 } 9840 const style = node.getAttribute("style"); 9841 if (!style || !style.includes("mso-list")) { 9842 return; 9843 } 9844 const prevNode = node.previousElementSibling; 9845 if (!prevNode || !isList2(prevNode)) { 9846 const type = node.textContent.trim().slice(0, 1); 9847 const isNumeric = /[1iIaA]/.test(type); 9848 const newListNode = doc.createElement(isNumeric ? "ol" : "ul"); 9849 if (isNumeric) { 9850 newListNode.setAttribute("type", type); 9851 } 9852 node.parentNode.insertBefore(newListNode, node); 9853 } 9854 const listNode = node.previousElementSibling; 9855 const listType = listNode.nodeName; 9856 const listItem = doc.createElement("li"); 9857 let receivingNode = listNode; 9858 listItem.innerHTML = deepFilterHTML(node.innerHTML, [msListIgnore]); 9859 const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); 9860 let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0; 9861 while (level--) { 9862 receivingNode = receivingNode.lastChild || receivingNode; 9863 if (isList2(receivingNode)) { 9864 receivingNode = receivingNode.lastChild || receivingNode; 9865 } 9866 } 9867 if (!isList2(receivingNode)) { 9868 receivingNode = receivingNode.appendChild( 9869 doc.createElement(listType) 9870 ); 9871 } 9872 receivingNode.appendChild(listItem); 9873 node.parentNode.removeChild(node); 9874 } 9875 9876 // packages/blocks/build-module/api/raw-handling/image-corrector.js 9877 var import_blob = __toESM(require_blob()); 9878 function imageCorrector(node) { 9879 if (node.nodeName !== "IMG") { 9880 return; 9881 } 9882 if (node.src.indexOf("file:") === 0) { 9883 node.src = ""; 9884 } 9885 if (node.src.indexOf("data:") === 0) { 9886 const [properties, data] = node.src.split(","); 9887 const [type] = properties.slice(5).split(";"); 9888 if (!data || !type) { 9889 node.src = ""; 9890 return; 9891 } 9892 let decoded; 9893 try { 9894 decoded = atob(data); 9895 } catch (e2) { 9896 node.src = ""; 9897 return; 9898 } 9899 const uint8Array = new Uint8Array(decoded.length); 9900 for (let i2 = 0; i2 < uint8Array.length; i2++) { 9901 uint8Array[i2] = decoded.charCodeAt(i2); 9902 } 9903 const name = type.replace("/", "."); 9904 const file = new window.File([uint8Array], name, { type }); 9905 node.src = (0, import_blob.createBlobURL)(file); 9906 } 9907 if (node.height === 1 || node.width === 1) { 9908 node.parentNode.removeChild(node); 9909 } 9910 } 9911 9912 // packages/blocks/build-module/api/raw-handling/div-normaliser.js 9913 function divNormaliser(node) { 9914 if (node.nodeName !== "DIV") { 9915 return; 9916 } 9917 node.innerHTML = normaliseBlocks(node.innerHTML); 9918 } 9919 9920 // packages/blocks/build-module/api/raw-handling/markdown-converter.js 9921 var import_showdown = __toESM(require_showdown()); 9922 var converter = new import_showdown.default.Converter({ 9923 noHeaderId: true, 9924 tables: true, 9925 literalMidWordUnderscores: true, 9926 omitExtraWLInCodeBlocks: true, 9927 simpleLineBreaks: true, 9928 strikethrough: true 9929 }); 9930 function slackMarkdownVariantCorrector(text2) { 9931 return text2.replace( 9932 /((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, 9933 (match, p1, p2, p3) => `$p1} 9934 $p2} 9935 $p3}` 9936 ); 9937 } 9938 function bulletsToAsterisks(text2) { 9939 return text2.replace(/(^|\n)•( +)/g, "$1*$2"); 9940 } 9941 function markdownConverter(text2) { 9942 return converter.makeHtml( 9943 slackMarkdownVariantCorrector(bulletsToAsterisks(text2)) 9944 ); 9945 } 9946 9947 // packages/blocks/build-module/api/raw-handling/iframe-remover.js 9948 function iframeRemover(node) { 9949 if (node.nodeName === "IFRAME") { 9950 const text2 = node.ownerDocument.createTextNode(node.src); 9951 node.parentNode.replaceChild(text2, node); 9952 } 9953 } 9954 9955 // packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.js 9956 var import_dom10 = __toESM(require_dom()); 9957 function googleDocsUIdRemover(node) { 9958 if (!node.id || node.id.indexOf("docs-internal-guid-") !== 0) { 9959 return; 9960 } 9961 if (node.tagName === "B") { 9962 (0, import_dom10.unwrap)(node); 9963 } else { 9964 node.removeAttribute("id"); 9965 } 9966 } 9967 9968 // packages/blocks/build-module/api/raw-handling/html-formatting-remover.js 9969 function isFormattingSpace(character) { 9970 return character === " " || character === "\r" || character === "\n" || character === " "; 9971 } 9972 function htmlFormattingRemover(node) { 9973 if (node.nodeType !== node.TEXT_NODE) { 9974 return; 9975 } 9976 let parent = node; 9977 while (parent = parent.parentNode) { 9978 if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") { 9979 return; 9980 } 9981 } 9982 let newData = node.data.replace(/[ \r\n\t]+/g, " "); 9983 if (newData[0] === " ") { 9984 const previousSibling = getSibling(node, "previous"); 9985 if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") { 9986 newData = newData.slice(1); 9987 } 9988 } 9989 if (newData[newData.length - 1] === " ") { 9990 const nextSibling = getSibling(node, "next"); 9991 if (!nextSibling || nextSibling.nodeName === "BR" || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { 9992 newData = newData.slice(0, -1); 9993 } 9994 } 9995 if (!newData) { 9996 node.parentNode.removeChild(node); 9997 } else { 9998 node.data = newData; 9999 } 10000 } 10001 10002 // packages/blocks/build-module/api/raw-handling/br-remover.js 10003 function brRemover(node) { 10004 if (node.nodeName !== "BR") { 10005 return; 10006 } 10007 if (getSibling(node, "next")) { 10008 return; 10009 } 10010 node.parentNode.removeChild(node); 10011 } 10012 10013 // packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.js 10014 function emptyParagraphRemover(node) { 10015 if (node.nodeName !== "P") { 10016 return; 10017 } 10018 if (node.hasChildNodes()) { 10019 return; 10020 } 10021 node.parentNode.removeChild(node); 10022 } 10023 10024 // packages/blocks/build-module/api/raw-handling/slack-paragraph-corrector.js 10025 function slackParagraphCorrector(node) { 10026 if (node.nodeName !== "SPAN") { 10027 return; 10028 } 10029 if (node.getAttribute("data-stringify-type") !== "paragraph-break") { 10030 return; 10031 } 10032 const { parentNode } = node; 10033 parentNode.insertBefore(node.ownerDocument.createElement("br"), node); 10034 parentNode.insertBefore(node.ownerDocument.createElement("br"), node); 10035 parentNode.removeChild(node); 10036 } 10037 10038 // packages/blocks/build-module/api/raw-handling/latex-to-math.js 10039 function isLatexMathMode(text2) { 10040 const lettersRegex = /[\p{L}\s]+/gu; 10041 let match; 10042 while (match = lettersRegex.exec(text2)) { 10043 if (text2[match.index - 1] === "{") { 10044 continue; 10045 } 10046 let sequence = match[0]; 10047 if (text2[match.index - 1] === "\\") { 10048 sequence = sequence.replace(/^[a-zA-Z]+/, ""); 10049 } 10050 if (sequence.length < 6) { 10051 continue; 10052 } 10053 return false; 10054 } 10055 if (/\\[a-zA-Z]+\s*\{/g.test(text2)) { 10056 return true; 10057 } 10058 const softClues = [ 10059 (t3) => t3.includes("^") && !t3.startsWith("^"), 10060 (t3) => ["=", "+", "-", "/", "*"].some( 10061 (operator) => t3.includes(operator) 10062 ), 10063 (t3) => /\\[a-zA-Z]+/g.test(t3) 10064 ]; 10065 if (softClues.filter((clue) => clue(text2)).length >= 2) { 10066 return true; 10067 } 10068 return false; 10069 } 10070 10071 // packages/blocks/build-module/api/raw-handling/heading-transformer.js 10072 function headingTransformer(node) { 10073 if (node.nodeType !== node.ELEMENT_NODE) { 10074 return; 10075 } 10076 if (node.tagName === "P" && node.getAttribute("role") === "heading" && node.hasAttribute("aria-level")) { 10077 const level = parseInt(node.getAttribute("aria-level"), 10); 10078 if (level >= 1 && level <= 6) { 10079 const headingTag = `H$level}`; 10080 const newHeading = node.ownerDocument.createElement(headingTag); 10081 Array.from(node.attributes).forEach((attr2) => { 10082 if (attr2.name !== "role" && attr2.name !== "aria-level") { 10083 newHeading.setAttribute(attr2.name, attr2.value); 10084 } 10085 }); 10086 while (node.firstChild) { 10087 newHeading.appendChild(node.firstChild); 10088 } 10089 node.parentNode.replaceChild(newHeading, node); 10090 } 10091 } 10092 } 10093 10094 // packages/blocks/build-module/api/raw-handling/paste-handler.js 10095 var log = (...args) => window?.console?.log?.(...args); 10096 function filterInlineHTML(HTML) { 10097 HTML = deepFilterHTML(HTML, [ 10098 headRemover, 10099 googleDocsUIdRemover, 10100 msListIgnore, 10101 phrasingContentReducer, 10102 commentRemover 10103 ]); 10104 HTML = (0, import_dom11.removeInvalidHTML)(HTML, (0, import_dom11.getPhrasingContentSchema)("paste"), { 10105 inline: true 10106 }); 10107 HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); 10108 log("Processed inline HTML:\n\n", HTML); 10109 return HTML; 10110 } 10111 function pasteHandler({ 10112 HTML = "", 10113 plainText = "", 10114 mode = "AUTO", 10115 tagName 10116 }) { 10117 HTML = HTML.replace(/<meta[^>]+>/g, ""); 10118 HTML = HTML.replace( 10119 /^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, 10120 "" 10121 ); 10122 HTML = HTML.replace( 10123 /(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, 10124 "" 10125 ); 10126 if (mode !== "INLINE") { 10127 const content = HTML ? HTML : plainText; 10128 if (content.indexOf("<!-- wp:") !== -1) { 10129 const parseResult = parse2(content); 10130 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; 10131 if (!isSingleFreeFormBlock) { 10132 return parseResult; 10133 } 10134 } 10135 } 10136 if (String.prototype.normalize) { 10137 HTML = HTML.normalize(); 10138 } 10139 HTML = deepFilterHTML(HTML, [slackParagraphCorrector]); 10140 const isPlainText = plainText && (!HTML || isPlain(HTML)); 10141 if (isPlainText && isLatexMathMode(plainText)) { 10142 return [createBlock("core/math", { latex: plainText })]; 10143 } 10144 if (isPlainText) { 10145 HTML = plainText; 10146 if (!/^\s+$/.test(plainText)) { 10147 HTML = markdownConverter(HTML); 10148 } 10149 } 10150 const pieces = shortcode_converter_default(HTML); 10151 const hasShortcodes = pieces.length > 1; 10152 if (isPlainText && !hasShortcodes) { 10153 if (mode === "AUTO" && plainText.indexOf("\n") === -1 && plainText.indexOf("<p>") !== 0 && HTML.indexOf("<p>") === 0) { 10154 mode = "INLINE"; 10155 } 10156 } 10157 if (mode === "INLINE") { 10158 return filterInlineHTML(HTML); 10159 } 10160 if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) { 10161 return filterInlineHTML(HTML); 10162 } 10163 const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste"); 10164 const blockContentSchema = getBlockContentSchema("paste"); 10165 const blocks = pieces.map((piece) => { 10166 if (typeof piece !== "string") { 10167 return piece; 10168 } 10169 const filters = [ 10170 googleDocsUIdRemover, 10171 msListConverter, 10172 headRemover, 10173 listReducer, 10174 imageCorrector, 10175 phrasingContentReducer, 10176 specialCommentConverter, 10177 commentRemover, 10178 iframeRemover, 10179 figureContentReducer, 10180 blockquoteNormaliser(), 10181 divNormaliser, 10182 headingTransformer 10183 ]; 10184 const schema = { 10185 ...blockContentSchema, 10186 // Keep top-level phrasing content, normalised by `normaliseBlocks`. 10187 ...phrasingContentSchema 10188 }; 10189 piece = deepFilterHTML(piece, filters, blockContentSchema); 10190 piece = (0, import_dom11.removeInvalidHTML)(piece, schema); 10191 piece = normaliseBlocks(piece); 10192 piece = deepFilterHTML( 10193 piece, 10194 [htmlFormattingRemover, brRemover, emptyParagraphRemover], 10195 blockContentSchema 10196 ); 10197 log("Processed HTML piece:\n\n", piece); 10198 return htmlToBlocks(piece, pasteHandler); 10199 }).flat().filter(Boolean); 10200 if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) { 10201 const trimRegex = /^[\n]+|[\n]+$/g; 10202 const trimmedPlainText = plainText.replace(trimRegex, ""); 10203 if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) { 10204 return (0, import_dom11.removeInvalidHTML)( 10205 getBlockInnerHTML(blocks[0]), 10206 phrasingContentSchema 10207 ).replace(trimRegex, ""); 10208 } 10209 } 10210 return blocks; 10211 } 10212 10213 // packages/blocks/build-module/api/raw-handling/index.js 10214 function deprecatedGetPhrasingContentSchema(context) { 10215 (0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", { 10216 since: "5.6", 10217 alternative: "wp.dom.getPhrasingContentSchema" 10218 }); 10219 return (0, import_dom12.getPhrasingContentSchema)(context); 10220 } 10221 function rawHandler({ HTML = "" }) { 10222 if (HTML.indexOf("<!-- wp:") !== -1) { 10223 const parseResult = parse2(HTML); 10224 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; 10225 if (!isSingleFreeFormBlock) { 10226 return parseResult; 10227 } 10228 } 10229 const pieces = shortcode_converter_default(HTML); 10230 const blockContentSchema = getBlockContentSchema(); 10231 return pieces.map((piece) => { 10232 if (typeof piece !== "string") { 10233 return piece; 10234 } 10235 const filters = [ 10236 // Needed to adjust invalid lists. 10237 listReducer, 10238 // Needed to create more and nextpage blocks. 10239 specialCommentConverter, 10240 // Needed to create media blocks. 10241 figureContentReducer, 10242 // Needed to create the quote block, which cannot handle text 10243 // without wrapper paragraphs. 10244 blockquoteNormaliser({ raw: true }) 10245 ]; 10246 piece = deepFilterHTML(piece, filters, blockContentSchema); 10247 piece = normaliseBlocks(piece, { raw: true }); 10248 return htmlToBlocks(piece, rawHandler); 10249 }).flat().filter(Boolean); 10250 } 10251 10252 // packages/blocks/build-module/api/categories.js 10253 var import_data6 = __toESM(require_data()); 10254 function getCategories2() { 10255 return (0, import_data6.select)(store).getCategories(); 10256 } 10257 function setCategories2(categories2) { 10258 (0, import_data6.dispatch)(store).setCategories(categories2); 10259 } 10260 function updateCategory2(slug, category) { 10261 (0, import_data6.dispatch)(store).updateCategory(slug, category); 10262 } 10263 10264 // packages/blocks/build-module/api/templates.js 10265 var import_element5 = __toESM(require_element()); 10266 function doBlocksMatchTemplate(blocks = [], template = []) { 10267 return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => { 10268 const block = blocks[index]; 10269 return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate); 10270 }); 10271 } 10272 var isHTMLAttribute = (attributeDefinition) => attributeDefinition?.source === "html"; 10273 var isQueryAttribute = (attributeDefinition) => attributeDefinition?.source === "query"; 10274 function normalizeAttributes(schema, values) { 10275 if (!values) { 10276 return {}; 10277 } 10278 return Object.fromEntries( 10279 Object.entries(values).map(([key, value]) => [ 10280 key, 10281 normalizeAttribute(schema[key], value) 10282 ]) 10283 ); 10284 } 10285 function normalizeAttribute(definition, value) { 10286 if (isHTMLAttribute(definition) && Array.isArray(value)) { 10287 return (0, import_element5.renderToString)(value); 10288 } 10289 if (isQueryAttribute(definition) && value) { 10290 return value.map((subValues) => { 10291 return normalizeAttributes(definition.query, subValues); 10292 }); 10293 } 10294 return value; 10295 } 10296 function synchronizeBlocksWithTemplate(blocks = [], template) { 10297 if (!template) { 10298 return blocks; 10299 } 10300 return template.map( 10301 ([name, attributes, innerBlocksTemplate], index) => { 10302 const block = blocks[index]; 10303 if (block && block.name === name) { 10304 const innerBlocks = synchronizeBlocksWithTemplate( 10305 block.innerBlocks, 10306 innerBlocksTemplate 10307 ); 10308 return { ...block, innerBlocks }; 10309 } 10310 const blockType = getBlockType(name); 10311 const normalizedAttributes = normalizeAttributes( 10312 blockType?.attributes ?? {}, 10313 attributes 10314 ); 10315 const [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes( 10316 name, 10317 normalizedAttributes 10318 ); 10319 return createBlock( 10320 blockName, 10321 blockAttributes, 10322 synchronizeBlocksWithTemplate([], innerBlocksTemplate) 10323 ); 10324 } 10325 ); 10326 } 10327 10328 // packages/blocks/build-module/api/index.js 10329 var fieldsKey = Symbol("fields"); 10330 var formKey = Symbol("form"); 10331 var privateApis = {}; 10332 lock(privateApis, { isContentBlock, fieldsKey, formKey }); 10333 10334 // packages/blocks/build-module/deprecated.js 10335 var import_deprecated11 = __toESM(require_deprecated()); 10336 function withBlockContentContext(OriginalComponent) { 10337 (0, import_deprecated11.default)("wp.blocks.withBlockContentContext", { 10338 since: "6.1" 10339 }); 10340 return OriginalComponent; 10341 } 10342 return __toCommonJS(index_exports); 10343 })(); 10344 /*! Bundled license information: 10345 10346 react-is/cjs/react-is.development.js: 10347 (** 10348 * @license React 10349 * react-is.development.js 10350 * 10351 * Copyright (c) Facebook, Inc. and its affiliates. 10352 * 10353 * This source code is licensed under the MIT license found in the 10354 * LICENSE file in the root directory of this source tree. 10355 *) 10356 10357 showdown/dist/showdown.js: 10358 (*! showdown v 1.9.1 - 02-11-2019 *) 10359 10360 is-plain-object/dist/is-plain-object.mjs: 10361 (*! 10362 * is-plain-object <https://github.com/jonschlinkert/is-plain-object> 10363 * 10364 * Copyright (c) 2014-2017, Jon Schlinkert. 10365 * Released under the MIT License. 10366 *) 10367 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Apr 15 08:20:10 2026 | Cross-referenced by PHPXref |