| 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 = /* @__PURE__ */ Symbol.for("react.element"); |
| 580 |
var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"); |
| 581 |
var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"); |
| 582 |
var REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"); |
| 583 |
var REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"); |
| 584 |
var REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider"); |
| 585 |
var REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"); |
| 586 |
var REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context"); |
| 587 |
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"); |
| 588 |
var REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"); |
| 589 |
var REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"); |
| 590 |
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"); |
| 591 |
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 592 |
var REACT_OFFSCREEN_TYPE = /* @__PURE__ */ 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 = /* @__PURE__ */ 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.mjs |
| 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.mjs |
| 4587 |
var import_data5 = __toESM(require_data(), 1); |
| 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.mjs |
| 4661 |
var import_data2 = __toESM(require_data(), 1); |
| 4662 |
var import_i18n3 = __toESM(require_i18n(), 1); |
| 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.mjs |
| 4876 |
var import_element = __toESM(require_element(), 1); |
| 4877 |
var import_i18n2 = __toESM(require_i18n(), 1); |
| 4878 |
var import_dom = __toESM(require_dom(), 1); |
| 4879 |
var import_rich_text = __toESM(require_rich_text(), 1); |
| 4880 |
var import_deprecated = __toESM(require_deprecated(), 1); |
| 4881 |
|
| 4882 |
// packages/blocks/build-module/api/constants.mjs |
| 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 |
backgroundGradient: { |
| 4935 |
value: ["background", "gradient"], |
| 4936 |
support: ["background", "gradient"], |
| 4937 |
useEngine: true |
| 4938 |
}, |
| 4939 |
borderColor: { |
| 4940 |
value: ["border", "color"], |
| 4941 |
support: ["__experimentalBorder", "color"], |
| 4942 |
useEngine: true |
| 4943 |
}, |
| 4944 |
borderRadius: { |
| 4945 |
value: ["border", "radius"], |
| 4946 |
support: ["__experimentalBorder", "radius"], |
| 4947 |
properties: { |
| 4948 |
borderTopLeftRadius: "topLeft", |
| 4949 |
borderTopRightRadius: "topRight", |
| 4950 |
borderBottomLeftRadius: "bottomLeft", |
| 4951 |
borderBottomRightRadius: "bottomRight" |
| 4952 |
}, |
| 4953 |
useEngine: true |
| 4954 |
}, |
| 4955 |
borderStyle: { |
| 4956 |
value: ["border", "style"], |
| 4957 |
support: ["__experimentalBorder", "style"], |
| 4958 |
useEngine: true |
| 4959 |
}, |
| 4960 |
borderWidth: { |
| 4961 |
value: ["border", "width"], |
| 4962 |
support: ["__experimentalBorder", "width"], |
| 4963 |
useEngine: true |
| 4964 |
}, |
| 4965 |
borderTopColor: { |
| 4966 |
value: ["border", "top", "color"], |
| 4967 |
support: ["__experimentalBorder", "color"], |
| 4968 |
useEngine: true |
| 4969 |
}, |
| 4970 |
borderTopStyle: { |
| 4971 |
value: ["border", "top", "style"], |
| 4972 |
support: ["__experimentalBorder", "style"], |
| 4973 |
useEngine: true |
| 4974 |
}, |
| 4975 |
borderTopWidth: { |
| 4976 |
value: ["border", "top", "width"], |
| 4977 |
support: ["__experimentalBorder", "width"], |
| 4978 |
useEngine: true |
| 4979 |
}, |
| 4980 |
borderRightColor: { |
| 4981 |
value: ["border", "right", "color"], |
| 4982 |
support: ["__experimentalBorder", "color"], |
| 4983 |
useEngine: true |
| 4984 |
}, |
| 4985 |
borderRightStyle: { |
| 4986 |
value: ["border", "right", "style"], |
| 4987 |
support: ["__experimentalBorder", "style"], |
| 4988 |
useEngine: true |
| 4989 |
}, |
| 4990 |
borderRightWidth: { |
| 4991 |
value: ["border", "right", "width"], |
| 4992 |
support: ["__experimentalBorder", "width"], |
| 4993 |
useEngine: true |
| 4994 |
}, |
| 4995 |
borderBottomColor: { |
| 4996 |
value: ["border", "bottom", "color"], |
| 4997 |
support: ["__experimentalBorder", "color"], |
| 4998 |
useEngine: true |
| 4999 |
}, |
| 5000 |
borderBottomStyle: { |
| 5001 |
value: ["border", "bottom", "style"], |
| 5002 |
support: ["__experimentalBorder", "style"], |
| 5003 |
useEngine: true |
| 5004 |
}, |
| 5005 |
borderBottomWidth: { |
| 5006 |
value: ["border", "bottom", "width"], |
| 5007 |
support: ["__experimentalBorder", "width"], |
| 5008 |
useEngine: true |
| 5009 |
}, |
| 5010 |
borderLeftColor: { |
| 5011 |
value: ["border", "left", "color"], |
| 5012 |
support: ["__experimentalBorder", "color"], |
| 5013 |
useEngine: true |
| 5014 |
}, |
| 5015 |
borderLeftStyle: { |
| 5016 |
value: ["border", "left", "style"], |
| 5017 |
support: ["__experimentalBorder", "style"], |
| 5018 |
useEngine: true |
| 5019 |
}, |
| 5020 |
borderLeftWidth: { |
| 5021 |
value: ["border", "left", "width"], |
| 5022 |
support: ["__experimentalBorder", "width"], |
| 5023 |
useEngine: true |
| 5024 |
}, |
| 5025 |
color: { |
| 5026 |
value: ["color", "text"], |
| 5027 |
support: ["color", "text"], |
| 5028 |
requiresOptOut: true, |
| 5029 |
useEngine: true |
| 5030 |
}, |
| 5031 |
columnCount: { |
| 5032 |
value: ["typography", "textColumns"], |
| 5033 |
support: ["typography", "textColumns"], |
| 5034 |
useEngine: true |
| 5035 |
}, |
| 5036 |
filter: { |
| 5037 |
value: ["filter", "duotone"], |
| 5038 |
support: ["filter", "duotone"] |
| 5039 |
}, |
| 5040 |
linkColor: { |
| 5041 |
value: ["elements", "link", "color", "text"], |
| 5042 |
support: ["color", "link"] |
| 5043 |
}, |
| 5044 |
captionColor: { |
| 5045 |
value: ["elements", "caption", "color", "text"], |
| 5046 |
support: ["color", "caption"] |
| 5047 |
}, |
| 5048 |
buttonColor: { |
| 5049 |
value: ["elements", "button", "color", "text"], |
| 5050 |
support: ["color", "button"] |
| 5051 |
}, |
| 5052 |
buttonBackgroundColor: { |
| 5053 |
value: ["elements", "button", "color", "background"], |
| 5054 |
support: ["color", "button"] |
| 5055 |
}, |
| 5056 |
headingColor: { |
| 5057 |
value: ["elements", "heading", "color", "text"], |
| 5058 |
support: ["color", "heading"] |
| 5059 |
}, |
| 5060 |
headingBackgroundColor: { |
| 5061 |
value: ["elements", "heading", "color", "background"], |
| 5062 |
support: ["color", "heading"] |
| 5063 |
}, |
| 5064 |
fontFamily: { |
| 5065 |
value: ["typography", "fontFamily"], |
| 5066 |
support: ["typography", "__experimentalFontFamily"], |
| 5067 |
useEngine: true |
| 5068 |
}, |
| 5069 |
fontSize: { |
| 5070 |
value: ["typography", "fontSize"], |
| 5071 |
support: ["typography", "fontSize"], |
| 5072 |
useEngine: true |
| 5073 |
}, |
| 5074 |
fontStyle: { |
| 5075 |
value: ["typography", "fontStyle"], |
| 5076 |
support: ["typography", "__experimentalFontStyle"], |
| 5077 |
useEngine: true |
| 5078 |
}, |
| 5079 |
fontWeight: { |
| 5080 |
value: ["typography", "fontWeight"], |
| 5081 |
support: ["typography", "__experimentalFontWeight"], |
| 5082 |
useEngine: true |
| 5083 |
}, |
| 5084 |
lineHeight: { |
| 5085 |
value: ["typography", "lineHeight"], |
| 5086 |
support: ["typography", "lineHeight"], |
| 5087 |
useEngine: true |
| 5088 |
}, |
| 5089 |
margin: { |
| 5090 |
value: ["spacing", "margin"], |
| 5091 |
support: ["spacing", "margin"], |
| 5092 |
properties: { |
| 5093 |
marginTop: "top", |
| 5094 |
marginRight: "right", |
| 5095 |
marginBottom: "bottom", |
| 5096 |
marginLeft: "left" |
| 5097 |
}, |
| 5098 |
useEngine: true |
| 5099 |
}, |
| 5100 |
minHeight: { |
| 5101 |
value: ["dimensions", "minHeight"], |
| 5102 |
support: ["dimensions", "minHeight"], |
| 5103 |
useEngine: true |
| 5104 |
}, |
| 5105 |
height: { |
| 5106 |
value: ["dimensions", "height"], |
| 5107 |
support: ["dimensions", "height"], |
| 5108 |
useEngine: true |
| 5109 |
}, |
| 5110 |
width: { |
| 5111 |
value: ["dimensions", "width"], |
| 5112 |
support: ["dimensions", "width"], |
| 5113 |
useEngine: true |
| 5114 |
}, |
| 5115 |
padding: { |
| 5116 |
value: ["spacing", "padding"], |
| 5117 |
support: ["spacing", "padding"], |
| 5118 |
properties: { |
| 5119 |
paddingTop: "top", |
| 5120 |
paddingRight: "right", |
| 5121 |
paddingBottom: "bottom", |
| 5122 |
paddingLeft: "left" |
| 5123 |
}, |
| 5124 |
useEngine: true |
| 5125 |
}, |
| 5126 |
textAlign: { |
| 5127 |
value: ["typography", "textAlign"], |
| 5128 |
support: ["typography", "textAlign"], |
| 5129 |
useEngine: false |
| 5130 |
}, |
| 5131 |
textDecoration: { |
| 5132 |
value: ["typography", "textDecoration"], |
| 5133 |
support: ["typography", "__experimentalTextDecoration"], |
| 5134 |
useEngine: true |
| 5135 |
}, |
| 5136 |
textTransform: { |
| 5137 |
value: ["typography", "textTransform"], |
| 5138 |
support: ["typography", "__experimentalTextTransform"], |
| 5139 |
useEngine: true |
| 5140 |
}, |
| 5141 |
letterSpacing: { |
| 5142 |
value: ["typography", "letterSpacing"], |
| 5143 |
support: ["typography", "__experimentalLetterSpacing"], |
| 5144 |
useEngine: true |
| 5145 |
}, |
| 5146 |
textIndent: { |
| 5147 |
value: ["typography", "textIndent"], |
| 5148 |
support: ["typography", "textIndent"], |
| 5149 |
useEngine: true |
| 5150 |
}, |
| 5151 |
writingMode: { |
| 5152 |
value: ["typography", "writingMode"], |
| 5153 |
support: ["typography", "__experimentalWritingMode"], |
| 5154 |
useEngine: true |
| 5155 |
}, |
| 5156 |
"--wp--style--root--padding": { |
| 5157 |
value: ["spacing", "padding"], |
| 5158 |
support: ["spacing", "padding"], |
| 5159 |
properties: { |
| 5160 |
"--wp--style--root--padding-top": "top", |
| 5161 |
"--wp--style--root--padding-right": "right", |
| 5162 |
"--wp--style--root--padding-bottom": "bottom", |
| 5163 |
"--wp--style--root--padding-left": "left" |
| 5164 |
}, |
| 5165 |
rootOnly: true |
| 5166 |
} |
| 5167 |
}; |
| 5168 |
var __EXPERIMENTAL_ELEMENTS = { |
| 5169 |
link: "a:where(:not(.wp-element-button))", |
| 5170 |
heading: "h1, h2, h3, h4, h5, h6", |
| 5171 |
h1: "h1", |
| 5172 |
h2: "h2", |
| 5173 |
h3: "h3", |
| 5174 |
h4: "h4", |
| 5175 |
h5: "h5", |
| 5176 |
h6: "h6", |
| 5177 |
button: ".wp-element-button, .wp-block-button__link", |
| 5178 |
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", |
| 5179 |
cite: "cite", |
| 5180 |
select: "select", |
| 5181 |
textInput: "textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=url])" |
| 5182 |
}; |
| 5183 |
var __EXPERIMENTAL_PATHS_WITH_OVERRIDE = { |
| 5184 |
"color.duotone": true, |
| 5185 |
"color.gradients": true, |
| 5186 |
"color.palette": true, |
| 5187 |
"dimensions.aspectRatios": true, |
| 5188 |
"typography.fontSizes": true, |
| 5189 |
"spacing.spacingSizes": true |
| 5190 |
}; |
| 5191 |
|
| 5192 |
// packages/blocks/build-module/api/registration.mjs |
| 5193 |
var import_data = __toESM(require_data(), 1); |
| 5194 |
var import_i18n = __toESM(require_i18n(), 1); |
| 5195 |
var import_warning = __toESM(require_warning(), 1); |
| 5196 |
|
| 5197 |
// packages/blocks/build-module/api/i18n-block.json |
| 5198 |
var i18n_block_default = { |
| 5199 |
title: "block title", |
| 5200 |
description: "block description", |
| 5201 |
keywords: ["block keyword"], |
| 5202 |
styles: [ |
| 5203 |
{ |
| 5204 |
label: "block style label" |
| 5205 |
} |
| 5206 |
], |
| 5207 |
variations: [ |
| 5208 |
{ |
| 5209 |
title: "block variation title", |
| 5210 |
description: "block variation description", |
| 5211 |
keywords: ["block variation keyword"] |
| 5212 |
} |
| 5213 |
] |
| 5214 |
}; |
| 5215 |
|
| 5216 |
// packages/blocks/build-module/lock-unlock.mjs |
| 5217 |
var import_private_apis = __toESM(require_private_apis(), 1); |
| 5218 |
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 5219 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 5220 |
"@wordpress/blocks" |
| 5221 |
); |
| 5222 |
|
| 5223 |
// packages/blocks/build-module/api/registration.mjs |
| 5224 |
function isObject(object) { |
| 5225 |
return object !== null && typeof object === "object"; |
| 5226 |
} |
| 5227 |
function unstable__bootstrapServerSideBlockDefinitions(definitions) { |
| 5228 |
const { addBootstrappedBlockType: addBootstrappedBlockType2 } = unlock((0, import_data.dispatch)(store)); |
| 5229 |
for (const [name, blockType] of Object.entries(definitions)) { |
| 5230 |
addBootstrappedBlockType2(name, blockType); |
| 5231 |
} |
| 5232 |
} |
| 5233 |
function getBlockSettingsFromMetadata({ textdomain, ...metadata }) { |
| 5234 |
const allowedFields = [ |
| 5235 |
"apiVersion", |
| 5236 |
"title", |
| 5237 |
"category", |
| 5238 |
"parent", |
| 5239 |
"ancestor", |
| 5240 |
"icon", |
| 5241 |
"description", |
| 5242 |
"keywords", |
| 5243 |
"attributes", |
| 5244 |
"providesContext", |
| 5245 |
"usesContext", |
| 5246 |
"selectors", |
| 5247 |
"supports", |
| 5248 |
"styles", |
| 5249 |
"example", |
| 5250 |
"variations", |
| 5251 |
"blockHooks", |
| 5252 |
"allowedBlocks" |
| 5253 |
]; |
| 5254 |
const settings = Object.fromEntries( |
| 5255 |
Object.entries(metadata).filter( |
| 5256 |
([key]) => allowedFields.includes(key) |
| 5257 |
) |
| 5258 |
); |
| 5259 |
if (textdomain) { |
| 5260 |
Object.keys(i18n_block_default).forEach((key) => { |
| 5261 |
if (!settings[key]) { |
| 5262 |
return; |
| 5263 |
} |
| 5264 |
settings[key] = translateBlockSettingUsingI18nSchema( |
| 5265 |
i18n_block_default[key], |
| 5266 |
settings[key], |
| 5267 |
textdomain |
| 5268 |
); |
| 5269 |
}); |
| 5270 |
} |
| 5271 |
return settings; |
| 5272 |
} |
| 5273 |
function registerBlockType(blockNameOrMetadata, settings) { |
| 5274 |
const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata; |
| 5275 |
if (typeof name !== "string") { |
| 5276 |
(0, import_warning.default)("Block names must be strings."); |
| 5277 |
return; |
| 5278 |
} |
| 5279 |
if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) { |
| 5280 |
(0, import_warning.default)( |
| 5281 |
"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" |
| 5282 |
); |
| 5283 |
return; |
| 5284 |
} |
| 5285 |
if ((0, import_data.select)(store).getBlockType(name)) { |
| 5286 |
(0, import_warning.default)('Block "' + name + '" is already registered.'); |
| 5287 |
return; |
| 5288 |
} |
| 5289 |
const { addBootstrappedBlockType: addBootstrappedBlockType2, addUnprocessedBlockType: addUnprocessedBlockType2 } = unlock( |
| 5290 |
(0, import_data.dispatch)(store) |
| 5291 |
); |
| 5292 |
if (isObject(blockNameOrMetadata)) { |
| 5293 |
const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata); |
| 5294 |
addBootstrappedBlockType2(name, metadata); |
| 5295 |
} |
| 5296 |
addUnprocessedBlockType2(name, settings); |
| 5297 |
return (0, import_data.select)(store).getBlockType(name); |
| 5298 |
} |
| 5299 |
function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) { |
| 5300 |
if (typeof i18nSchema === "string" && typeof settingValue === "string") { |
| 5301 |
return (0, import_i18n._x)(settingValue, i18nSchema, textdomain); |
| 5302 |
} |
| 5303 |
if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) { |
| 5304 |
return settingValue.map( |
| 5305 |
(value) => translateBlockSettingUsingI18nSchema( |
| 5306 |
i18nSchema[0], |
| 5307 |
value, |
| 5308 |
textdomain |
| 5309 |
) |
| 5310 |
); |
| 5311 |
} |
| 5312 |
if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) { |
| 5313 |
return Object.keys(settingValue).reduce((accumulator, key) => { |
| 5314 |
if (!i18nSchema[key]) { |
| 5315 |
accumulator[key] = settingValue[key]; |
| 5316 |
return accumulator; |
| 5317 |
} |
| 5318 |
accumulator[key] = translateBlockSettingUsingI18nSchema( |
| 5319 |
i18nSchema[key], |
| 5320 |
settingValue[key], |
| 5321 |
textdomain |
| 5322 |
); |
| 5323 |
return accumulator; |
| 5324 |
}, {}); |
| 5325 |
} |
| 5326 |
return settingValue; |
| 5327 |
} |
| 5328 |
function registerBlockCollection(namespace, { title, icon }) { |
| 5329 |
(0, import_data.dispatch)(store).addBlockCollection(namespace, title, icon); |
| 5330 |
} |
| 5331 |
function unregisterBlockType(name) { |
| 5332 |
const oldBlock = (0, import_data.select)(store).getBlockType(name); |
| 5333 |
if (!oldBlock) { |
| 5334 |
(0, import_warning.default)('Block "' + name + '" is not registered.'); |
| 5335 |
return; |
| 5336 |
} |
| 5337 |
(0, import_data.dispatch)(store).removeBlockTypes(name); |
| 5338 |
return oldBlock; |
| 5339 |
} |
| 5340 |
function setFreeformContentHandlerName(blockName) { |
| 5341 |
(0, import_data.dispatch)(store).setFreeformFallbackBlockName(blockName); |
| 5342 |
} |
| 5343 |
function getFreeformContentHandlerName() { |
| 5344 |
return (0, import_data.select)(store).getFreeformFallbackBlockName(); |
| 5345 |
} |
| 5346 |
function getGroupingBlockName() { |
| 5347 |
return (0, import_data.select)(store).getGroupingBlockName(); |
| 5348 |
} |
| 5349 |
function setUnregisteredTypeHandlerName(blockName) { |
| 5350 |
(0, import_data.dispatch)(store).setUnregisteredFallbackBlockName(blockName); |
| 5351 |
} |
| 5352 |
function getUnregisteredTypeHandlerName() { |
| 5353 |
return (0, import_data.select)(store).getUnregisteredFallbackBlockName(); |
| 5354 |
} |
| 5355 |
function setDefaultBlockName(name) { |
| 5356 |
(0, import_data.dispatch)(store).setDefaultBlockName(name); |
| 5357 |
} |
| 5358 |
function setGroupingBlockName(name) { |
| 5359 |
(0, import_data.dispatch)(store).setGroupingBlockName(name); |
| 5360 |
} |
| 5361 |
function getDefaultBlockName() { |
| 5362 |
return (0, import_data.select)(store).getDefaultBlockName(); |
| 5363 |
} |
| 5364 |
function getBlockType(name) { |
| 5365 |
return (0, import_data.select)(store)?.getBlockType(name); |
| 5366 |
} |
| 5367 |
function getBlockTypes() { |
| 5368 |
return (0, import_data.select)(store).getBlockTypes(); |
| 5369 |
} |
| 5370 |
function getBlockSupport(nameOrType, feature, defaultSupports) { |
| 5371 |
return (0, import_data.select)(store).getBlockSupport( |
| 5372 |
nameOrType, |
| 5373 |
feature, |
| 5374 |
defaultSupports |
| 5375 |
); |
| 5376 |
} |
| 5377 |
function hasBlockSupport(nameOrType, feature, defaultSupports) { |
| 5378 |
return (0, import_data.select)(store).hasBlockSupport( |
| 5379 |
nameOrType, |
| 5380 |
feature, |
| 5381 |
defaultSupports |
| 5382 |
); |
| 5383 |
} |
| 5384 |
function isReusableBlock(blockOrType) { |
| 5385 |
return blockOrType?.name === "core/block"; |
| 5386 |
} |
| 5387 |
function isTemplatePart(blockOrType) { |
| 5388 |
return blockOrType?.name === "core/template-part"; |
| 5389 |
} |
| 5390 |
var getChildBlockNames = (blockName) => { |
| 5391 |
return (0, import_data.select)(store).getChildBlockNames(blockName); |
| 5392 |
}; |
| 5393 |
var hasChildBlocks = (blockName) => { |
| 5394 |
return (0, import_data.select)(store).hasChildBlocks(blockName); |
| 5395 |
}; |
| 5396 |
var hasChildBlocksWithInserterSupport = (blockName) => { |
| 5397 |
return (0, import_data.select)(store).hasChildBlocksWithInserterSupport(blockName); |
| 5398 |
}; |
| 5399 |
var registerBlockStyle = (blockNames, styleVariation) => { |
| 5400 |
(0, import_data.dispatch)(store).addBlockStyles(blockNames, styleVariation); |
| 5401 |
}; |
| 5402 |
var unregisterBlockStyle = (blockName, styleVariationName) => { |
| 5403 |
(0, import_data.dispatch)(store).removeBlockStyles(blockName, styleVariationName); |
| 5404 |
}; |
| 5405 |
var getBlockVariations = (blockName, scope) => { |
| 5406 |
return (0, import_data.select)(store).getBlockVariations(blockName, scope); |
| 5407 |
}; |
| 5408 |
var registerBlockVariation = (blockName, variation) => { |
| 5409 |
if (typeof variation.name !== "string") { |
| 5410 |
(0, import_warning.default)("Variation names must be unique strings."); |
| 5411 |
} |
| 5412 |
(0, import_data.dispatch)(store).addBlockVariations(blockName, variation); |
| 5413 |
}; |
| 5414 |
var unregisterBlockVariation = (blockName, variationName) => { |
| 5415 |
(0, import_data.dispatch)(store).removeBlockVariations(blockName, variationName); |
| 5416 |
}; |
| 5417 |
var registerBlockBindingsSource = (source) => { |
| 5418 |
const { |
| 5419 |
name, |
| 5420 |
label, |
| 5421 |
usesContext, |
| 5422 |
getValues, |
| 5423 |
setValues, |
| 5424 |
canUserEditValue, |
| 5425 |
getFieldsList |
| 5426 |
} = source; |
| 5427 |
const existingSource = unlock( |
| 5428 |
(0, import_data.select)(store) |
| 5429 |
).getBlockBindingsSource(name); |
| 5430 |
const serverProps = ["label", "usesContext"]; |
| 5431 |
for (const prop2 in existingSource) { |
| 5432 |
if (!serverProps.includes(prop2) && existingSource[prop2]) { |
| 5433 |
(0, import_warning.default)( |
| 5434 |
'Block bindings source "' + name + '" is already registered.' |
| 5435 |
); |
| 5436 |
return; |
| 5437 |
} |
| 5438 |
} |
| 5439 |
if (!name) { |
| 5440 |
(0, import_warning.default)("Block bindings source must contain a name."); |
| 5441 |
return; |
| 5442 |
} |
| 5443 |
if (typeof name !== "string") { |
| 5444 |
(0, import_warning.default)("Block bindings source name must be a string."); |
| 5445 |
return; |
| 5446 |
} |
| 5447 |
if (/[A-Z]+/.test(name)) { |
| 5448 |
(0, import_warning.default)( |
| 5449 |
"Block bindings source name must not contain uppercase characters." |
| 5450 |
); |
| 5451 |
return; |
| 5452 |
} |
| 5453 |
if (!/^[a-z0-9/-]+$/.test(name)) { |
| 5454 |
(0, import_warning.default)( |
| 5455 |
"Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source." |
| 5456 |
); |
| 5457 |
return; |
| 5458 |
} |
| 5459 |
if (!/^[a-z0-9-]+\/[a-z0-9-]+$/.test(name)) { |
| 5460 |
(0, import_warning.default)( |
| 5461 |
"Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source." |
| 5462 |
); |
| 5463 |
return; |
| 5464 |
} |
| 5465 |
if (!label && !existingSource?.label) { |
| 5466 |
(0, import_warning.default)("Block bindings source must contain a label."); |
| 5467 |
return; |
| 5468 |
} |
| 5469 |
if (label && typeof label !== "string") { |
| 5470 |
(0, import_warning.default)("Block bindings source label must be a string."); |
| 5471 |
return; |
| 5472 |
} |
| 5473 |
if (label && existingSource?.label && label !== existingSource?.label) { |
| 5474 |
(0, import_warning.default)('Block bindings "' + name + '" source label was overridden.'); |
| 5475 |
} |
| 5476 |
if (usesContext && !Array.isArray(usesContext)) { |
| 5477 |
(0, import_warning.default)("Block bindings source usesContext must be an array."); |
| 5478 |
return; |
| 5479 |
} |
| 5480 |
if (getValues && typeof getValues !== "function") { |
| 5481 |
(0, import_warning.default)("Block bindings source getValues must be a function."); |
| 5482 |
return; |
| 5483 |
} |
| 5484 |
if (setValues && typeof setValues !== "function") { |
| 5485 |
(0, import_warning.default)("Block bindings source setValues must be a function."); |
| 5486 |
return; |
| 5487 |
} |
| 5488 |
if (canUserEditValue && typeof canUserEditValue !== "function") { |
| 5489 |
(0, import_warning.default)("Block bindings source canUserEditValue must be a function."); |
| 5490 |
return; |
| 5491 |
} |
| 5492 |
if (getFieldsList && typeof getFieldsList !== "function") { |
| 5493 |
(0, import_warning.default)("Block bindings source getFieldsList must be a function."); |
| 5494 |
return; |
| 5495 |
} |
| 5496 |
return unlock((0, import_data.dispatch)(store)).addBlockBindingsSource(source); |
| 5497 |
}; |
| 5498 |
function unregisterBlockBindingsSource(name) { |
| 5499 |
const oldSource = getBlockBindingsSource(name); |
| 5500 |
if (!oldSource) { |
| 5501 |
(0, import_warning.default)('Block bindings source "' + name + '" is not registered.'); |
| 5502 |
return; |
| 5503 |
} |
| 5504 |
unlock((0, import_data.dispatch)(store)).removeBlockBindingsSource(name); |
| 5505 |
} |
| 5506 |
function getBlockBindingsSource(name) { |
| 5507 |
return unlock((0, import_data.select)(store)).getBlockBindingsSource(name); |
| 5508 |
} |
| 5509 |
function getBlockBindingsSources() { |
| 5510 |
return unlock((0, import_data.select)(store)).getAllBlockBindingsSources(); |
| 5511 |
} |
| 5512 |
|
| 5513 |
// packages/blocks/build-module/api/utils.mjs |
| 5514 |
k([names_default, a11y_default]); |
| 5515 |
var ICON_COLORS = ["#191e23", "#f8f9f9"]; |
| 5516 |
function isUnmodifiedBlock(block, role) { |
| 5517 |
const blockAttributes = getBlockType(block.name)?.attributes ?? {}; |
| 5518 |
const attributesByRole = role ? Object.entries(blockAttributes).filter(([key, definition]) => { |
| 5519 |
if (role === "content" && key === "metadata") { |
| 5520 |
return Object.keys(block.attributes[key]?.bindings ?? {}).length > 0; |
| 5521 |
} |
| 5522 |
return definition.role === role || definition.__experimentalRole === role; |
| 5523 |
}) : []; |
| 5524 |
const attributesToCheck = !!attributesByRole.length ? attributesByRole : Object.entries(blockAttributes); |
| 5525 |
return attributesToCheck.every(([key, definition]) => { |
| 5526 |
const value = block.attributes[key]; |
| 5527 |
if (definition.hasOwnProperty("default")) { |
| 5528 |
return value === definition.default; |
| 5529 |
} |
| 5530 |
if (definition.type === "rich-text") { |
| 5531 |
return !value?.length; |
| 5532 |
} |
| 5533 |
return value === void 0; |
| 5534 |
}); |
| 5535 |
} |
| 5536 |
function isUnmodifiedDefaultBlock(block, role) { |
| 5537 |
return block.name === getDefaultBlockName() && isUnmodifiedBlock(block, role); |
| 5538 |
} |
| 5539 |
function isValidIcon(icon) { |
| 5540 |
return !!icon && (typeof icon === "string" || (0, import_element.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element.Component); |
| 5541 |
} |
| 5542 |
function normalizeIconObject(icon) { |
| 5543 |
icon = icon || BLOCK_ICON_DEFAULT; |
| 5544 |
if (isValidIcon(icon)) { |
| 5545 |
return { src: icon }; |
| 5546 |
} |
| 5547 |
if ("background" in icon) { |
| 5548 |
const colordBgColor = w(icon.background); |
| 5549 |
const getColorContrast = (iconColor) => colordBgColor.contrast(iconColor); |
| 5550 |
const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast)); |
| 5551 |
return { |
| 5552 |
...icon, |
| 5553 |
foreground: icon.foreground ? icon.foreground : ICON_COLORS.find( |
| 5554 |
(iconColor) => getColorContrast(iconColor) === maxContrast |
| 5555 |
), |
| 5556 |
shadowColor: colordBgColor.alpha(0.3).toRgbString() |
| 5557 |
}; |
| 5558 |
} |
| 5559 |
return icon; |
| 5560 |
} |
| 5561 |
function normalizeBlockType(blockTypeOrName) { |
| 5562 |
if (typeof blockTypeOrName === "string") { |
| 5563 |
return getBlockType(blockTypeOrName); |
| 5564 |
} |
| 5565 |
return blockTypeOrName; |
| 5566 |
} |
| 5567 |
function getBlockLabel(blockType, attributes, context = "visual") { |
| 5568 |
const { __experimentalLabel: getLabel, title } = blockType; |
| 5569 |
const label = getLabel && getLabel(attributes, { context }); |
| 5570 |
if (!label) { |
| 5571 |
return title; |
| 5572 |
} |
| 5573 |
if (label.toPlainText) { |
| 5574 |
return label.toPlainText(); |
| 5575 |
} |
| 5576 |
return (0, import_dom.__unstableStripHTML)(label); |
| 5577 |
} |
| 5578 |
function getAccessibleBlockLabel(blockType, attributes, position, direction = "vertical") { |
| 5579 |
const title = blockType?.title; |
| 5580 |
const label = blockType ? getBlockLabel(blockType, attributes, "accessibility") : ""; |
| 5581 |
const hasPosition = position !== void 0; |
| 5582 |
const hasLabel = label && label !== title; |
| 5583 |
if (hasPosition && direction === "vertical") { |
| 5584 |
if (hasLabel) { |
| 5585 |
return (0, import_i18n2.sprintf)( |
| 5586 |
/* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */ |
| 5587 |
(0, import_i18n2.__)("%1$s Block. Row %2$d. %3$s"), |
| 5588 |
title, |
| 5589 |
position, |
| 5590 |
label |
| 5591 |
); |
| 5592 |
} |
| 5593 |
return (0, import_i18n2.sprintf)( |
| 5594 |
/* translators: accessibility text. 1: The block title. 2: The block row number. */ |
| 5595 |
(0, import_i18n2.__)("%1$s Block. Row %2$d"), |
| 5596 |
title, |
| 5597 |
position |
| 5598 |
); |
| 5599 |
} else if (hasPosition && direction === "horizontal") { |
| 5600 |
if (hasLabel) { |
| 5601 |
return (0, import_i18n2.sprintf)( |
| 5602 |
/* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */ |
| 5603 |
(0, import_i18n2.__)("%1$s Block. Column %2$d. %3$s"), |
| 5604 |
title, |
| 5605 |
position, |
| 5606 |
label |
| 5607 |
); |
| 5608 |
} |
| 5609 |
return (0, import_i18n2.sprintf)( |
| 5610 |
/* translators: accessibility text. 1: The block title. 2: The block column number. */ |
| 5611 |
(0, import_i18n2.__)("%1$s Block. Column %2$d"), |
| 5612 |
title, |
| 5613 |
position |
| 5614 |
); |
| 5615 |
} |
| 5616 |
if (hasLabel) { |
| 5617 |
return (0, import_i18n2.sprintf)( |
| 5618 |
/* translators: accessibility text. 1: The block title. 2: The block label. */ |
| 5619 |
(0, import_i18n2.__)("%1$s Block. %2$s"), |
| 5620 |
title, |
| 5621 |
label |
| 5622 |
); |
| 5623 |
} |
| 5624 |
return (0, import_i18n2.sprintf)( |
| 5625 |
/* translators: accessibility text. %s: The block title. */ |
| 5626 |
(0, import_i18n2.__)("%s Block"), |
| 5627 |
title |
| 5628 |
); |
| 5629 |
} |
| 5630 |
function getDefault(attributeSchema) { |
| 5631 |
if (attributeSchema.default !== void 0) { |
| 5632 |
return attributeSchema.default; |
| 5633 |
} |
| 5634 |
if (attributeSchema.type === "rich-text") { |
| 5635 |
return new import_rich_text.RichTextData(); |
| 5636 |
} |
| 5637 |
} |
| 5638 |
function isBlockRegistered(name) { |
| 5639 |
return getBlockType(name) !== void 0; |
| 5640 |
} |
| 5641 |
function __experimentalSanitizeBlockAttributes(name, attributes) { |
| 5642 |
const blockType = getBlockType(name); |
| 5643 |
if (void 0 === blockType) { |
| 5644 |
throw new Error(`Block type '${name}' is not registered.`); |
| 5645 |
} |
| 5646 |
return Object.entries(blockType.attributes).reduce( |
| 5647 |
(accumulator, [key, schema]) => { |
| 5648 |
const value = attributes[key]; |
| 5649 |
if (void 0 !== value) { |
| 5650 |
if (schema.type === "rich-text") { |
| 5651 |
if (value instanceof import_rich_text.RichTextData) { |
| 5652 |
accumulator[key] = value; |
| 5653 |
} else if (typeof value === "string") { |
| 5654 |
accumulator[key] = import_rich_text.RichTextData.fromHTMLString(value); |
| 5655 |
} |
| 5656 |
} else if (schema.type === "string" && value instanceof import_rich_text.RichTextData) { |
| 5657 |
accumulator[key] = value.toHTMLString(); |
| 5658 |
} else { |
| 5659 |
accumulator[key] = value; |
| 5660 |
} |
| 5661 |
} else { |
| 5662 |
const _default = getDefault(schema); |
| 5663 |
if (void 0 !== _default) { |
| 5664 |
accumulator[key] = _default; |
| 5665 |
} |
| 5666 |
} |
| 5667 |
if (["node", "children"].indexOf(schema.source) !== -1) { |
| 5668 |
if (typeof accumulator[key] === "string") { |
| 5669 |
accumulator[key] = [accumulator[key]]; |
| 5670 |
} else if (!Array.isArray(accumulator[key])) { |
| 5671 |
accumulator[key] = []; |
| 5672 |
} |
| 5673 |
} |
| 5674 |
return accumulator; |
| 5675 |
}, |
| 5676 |
{} |
| 5677 |
); |
| 5678 |
} |
| 5679 |
function getBlockAttributesNamesByRole(name, role) { |
| 5680 |
const attributes = getBlockType(name)?.attributes; |
| 5681 |
if (!attributes) { |
| 5682 |
return []; |
| 5683 |
} |
| 5684 |
const attributesNames = Object.keys(attributes); |
| 5685 |
if (!role) { |
| 5686 |
return attributesNames; |
| 5687 |
} |
| 5688 |
return attributesNames.filter((attributeName) => { |
| 5689 |
const attribute = attributes[attributeName]; |
| 5690 |
if (attribute?.role === role) { |
| 5691 |
return true; |
| 5692 |
} |
| 5693 |
if (attribute?.__experimentalRole === role) { |
| 5694 |
(0, import_deprecated.default)("__experimentalRole attribute", { |
| 5695 |
since: "6.7", |
| 5696 |
version: "6.8", |
| 5697 |
alternative: "role attribute", |
| 5698 |
hint: `Check the block.json of the ${name} block.` |
| 5699 |
}); |
| 5700 |
return true; |
| 5701 |
} |
| 5702 |
return false; |
| 5703 |
}); |
| 5704 |
} |
| 5705 |
var __experimentalGetBlockAttributesNamesByRole = (...args) => { |
| 5706 |
(0, import_deprecated.default)("__experimentalGetBlockAttributesNamesByRole", { |
| 5707 |
since: "6.7", |
| 5708 |
version: "6.8", |
| 5709 |
alternative: "getBlockAttributesNamesByRole" |
| 5710 |
}); |
| 5711 |
return getBlockAttributesNamesByRole(...args); |
| 5712 |
}; |
| 5713 |
function isContentBlock(name) { |
| 5714 |
const blockType = getBlockType(name); |
| 5715 |
const attributes = blockType?.attributes; |
| 5716 |
const supportsContentRole = blockType?.supports?.contentRole; |
| 5717 |
if (supportsContentRole) { |
| 5718 |
return true; |
| 5719 |
} |
| 5720 |
if (!attributes) { |
| 5721 |
return false; |
| 5722 |
} |
| 5723 |
return !!Object.keys(attributes)?.some((attributeKey) => { |
| 5724 |
const attribute = attributes[attributeKey]; |
| 5725 |
return attribute?.role === "content" || attribute?.__experimentalRole === "content"; |
| 5726 |
}); |
| 5727 |
} |
| 5728 |
function omit(object, keys) { |
| 5729 |
return Object.fromEntries( |
| 5730 |
Object.entries(object).filter(([key]) => !keys.includes(key)) |
| 5731 |
); |
| 5732 |
} |
| 5733 |
|
| 5734 |
// packages/blocks/build-module/store/reducer.mjs |
| 5735 |
var DEFAULT_CATEGORIES = [ |
| 5736 |
{ slug: "text", title: (0, import_i18n3.__)("Text") }, |
| 5737 |
{ slug: "media", title: (0, import_i18n3.__)("Media") }, |
| 5738 |
{ slug: "design", title: (0, import_i18n3.__)("Design") }, |
| 5739 |
{ slug: "widgets", title: (0, import_i18n3.__)("Widgets") }, |
| 5740 |
{ slug: "theme", title: (0, import_i18n3.__)("Theme") }, |
| 5741 |
{ slug: "embed", title: (0, import_i18n3.__)("Embeds") }, |
| 5742 |
{ slug: "reusable", title: (0, import_i18n3.__)("Reusable blocks") } |
| 5743 |
]; |
| 5744 |
function keyBlockTypesByName(types) { |
| 5745 |
return types.reduce( |
| 5746 |
(newBlockTypes, block) => ({ |
| 5747 |
...newBlockTypes, |
| 5748 |
[block.name]: block |
| 5749 |
}), |
| 5750 |
{} |
| 5751 |
); |
| 5752 |
} |
| 5753 |
function getUniqueItemsByName(items) { |
| 5754 |
return items.reduce((acc, currentItem) => { |
| 5755 |
if (!acc.some((item) => item.name === currentItem.name)) { |
| 5756 |
acc.push(currentItem); |
| 5757 |
} |
| 5758 |
return acc; |
| 5759 |
}, []); |
| 5760 |
} |
| 5761 |
function bootstrappedBlockTypes(state = {}, action) { |
| 5762 |
switch (action.type) { |
| 5763 |
case "ADD_BOOTSTRAPPED_BLOCK_TYPE": |
| 5764 |
const { name, blockType } = action; |
| 5765 |
const serverDefinition = state[name]; |
| 5766 |
if (serverDefinition) { |
| 5767 |
return state; |
| 5768 |
} |
| 5769 |
const newDefinition = Object.fromEntries( |
| 5770 |
Object.entries(blockType).filter( |
| 5771 |
([, value]) => value !== null && value !== void 0 |
| 5772 |
).map(([key, value]) => [camelCase(key), value]) |
| 5773 |
); |
| 5774 |
newDefinition.name = name; |
| 5775 |
return { |
| 5776 |
...state, |
| 5777 |
[name]: newDefinition |
| 5778 |
}; |
| 5779 |
case "REMOVE_BLOCK_TYPES": |
| 5780 |
return omit(state, action.names); |
| 5781 |
} |
| 5782 |
return state; |
| 5783 |
} |
| 5784 |
function unprocessedBlockTypes(state = {}, action) { |
| 5785 |
switch (action.type) { |
| 5786 |
case "ADD_UNPROCESSED_BLOCK_TYPE": |
| 5787 |
return { |
| 5788 |
...state, |
| 5789 |
[action.name]: action.blockType |
| 5790 |
}; |
| 5791 |
case "REMOVE_BLOCK_TYPES": |
| 5792 |
return omit(state, action.names); |
| 5793 |
} |
| 5794 |
return state; |
| 5795 |
} |
| 5796 |
function blockTypes(state = {}, action) { |
| 5797 |
switch (action.type) { |
| 5798 |
case "ADD_BLOCK_TYPES": |
| 5799 |
return { |
| 5800 |
...state, |
| 5801 |
...keyBlockTypesByName(action.blockTypes) |
| 5802 |
}; |
| 5803 |
case "REMOVE_BLOCK_TYPES": |
| 5804 |
return omit(state, action.names); |
| 5805 |
} |
| 5806 |
return state; |
| 5807 |
} |
| 5808 |
function blockStyles(state = {}, action) { |
| 5809 |
switch (action.type) { |
| 5810 |
case "ADD_BLOCK_TYPES": |
| 5811 |
return { |
| 5812 |
...state, |
| 5813 |
...Object.fromEntries( |
| 5814 |
Object.entries( |
| 5815 |
keyBlockTypesByName(action.blockTypes) |
| 5816 |
).map(([name, blockType]) => [ |
| 5817 |
name, |
| 5818 |
getUniqueItemsByName([ |
| 5819 |
...(blockType.styles ?? []).map((style) => ({ |
| 5820 |
...style, |
| 5821 |
source: "block" |
| 5822 |
})), |
| 5823 |
...(state[blockType.name] ?? []).filter( |
| 5824 |
({ source }) => "block" !== source |
| 5825 |
) |
| 5826 |
]) |
| 5827 |
]) |
| 5828 |
) |
| 5829 |
}; |
| 5830 |
case "ADD_BLOCK_STYLES": |
| 5831 |
const updatedStyles = {}; |
| 5832 |
action.blockNames.forEach((blockName) => { |
| 5833 |
updatedStyles[blockName] = getUniqueItemsByName([ |
| 5834 |
...state[blockName] ?? [], |
| 5835 |
...action.styles |
| 5836 |
]); |
| 5837 |
}); |
| 5838 |
return { ...state, ...updatedStyles }; |
| 5839 |
case "REMOVE_BLOCK_STYLES": |
| 5840 |
return { |
| 5841 |
...state, |
| 5842 |
[action.blockName]: (state[action.blockName] ?? []).filter( |
| 5843 |
(style) => action.styleNames.indexOf(style.name) === -1 |
| 5844 |
) |
| 5845 |
}; |
| 5846 |
} |
| 5847 |
return state; |
| 5848 |
} |
| 5849 |
function blockVariations(state = {}, action) { |
| 5850 |
switch (action.type) { |
| 5851 |
case "ADD_BLOCK_TYPES": |
| 5852 |
return { |
| 5853 |
...state, |
| 5854 |
...Object.fromEntries( |
| 5855 |
Object.entries( |
| 5856 |
keyBlockTypesByName(action.blockTypes) |
| 5857 |
).map(([name, blockType]) => { |
| 5858 |
return [ |
| 5859 |
name, |
| 5860 |
getUniqueItemsByName([ |
| 5861 |
...(blockType.variations ?? []).map( |
| 5862 |
(variation) => ({ |
| 5863 |
...variation, |
| 5864 |
source: "block" |
| 5865 |
}) |
| 5866 |
), |
| 5867 |
...(state[blockType.name] ?? []).filter( |
| 5868 |
({ source }) => "block" !== source |
| 5869 |
) |
| 5870 |
]) |
| 5871 |
]; |
| 5872 |
}) |
| 5873 |
) |
| 5874 |
}; |
| 5875 |
case "ADD_BLOCK_VARIATIONS": |
| 5876 |
return { |
| 5877 |
...state, |
| 5878 |
[action.blockName]: getUniqueItemsByName([ |
| 5879 |
...state[action.blockName] ?? [], |
| 5880 |
...action.variations |
| 5881 |
]) |
| 5882 |
}; |
| 5883 |
case "REMOVE_BLOCK_VARIATIONS": |
| 5884 |
return { |
| 5885 |
...state, |
| 5886 |
[action.blockName]: (state[action.blockName] ?? []).filter( |
| 5887 |
(variation) => action.variationNames.indexOf(variation.name) === -1 |
| 5888 |
) |
| 5889 |
}; |
| 5890 |
} |
| 5891 |
return state; |
| 5892 |
} |
| 5893 |
function createBlockNameSetterReducer(setActionType) { |
| 5894 |
return (state = null, action) => { |
| 5895 |
switch (action.type) { |
| 5896 |
case "REMOVE_BLOCK_TYPES": |
| 5897 |
if (action.names.indexOf(state) !== -1) { |
| 5898 |
return null; |
| 5899 |
} |
| 5900 |
return state; |
| 5901 |
case setActionType: |
| 5902 |
return action.name || null; |
| 5903 |
} |
| 5904 |
return state; |
| 5905 |
}; |
| 5906 |
} |
| 5907 |
var defaultBlockName = createBlockNameSetterReducer( |
| 5908 |
"SET_DEFAULT_BLOCK_NAME" |
| 5909 |
); |
| 5910 |
var freeformFallbackBlockName = createBlockNameSetterReducer( |
| 5911 |
"SET_FREEFORM_FALLBACK_BLOCK_NAME" |
| 5912 |
); |
| 5913 |
var unregisteredFallbackBlockName = createBlockNameSetterReducer( |
| 5914 |
"SET_UNREGISTERED_FALLBACK_BLOCK_NAME" |
| 5915 |
); |
| 5916 |
var groupingBlockName = createBlockNameSetterReducer( |
| 5917 |
"SET_GROUPING_BLOCK_NAME" |
| 5918 |
); |
| 5919 |
function categories(state = DEFAULT_CATEGORIES, action) { |
| 5920 |
switch (action.type) { |
| 5921 |
case "SET_CATEGORIES": |
| 5922 |
const uniqueCategories = /* @__PURE__ */ new Map(); |
| 5923 |
(action.categories || []).forEach((category) => { |
| 5924 |
uniqueCategories.set(category.slug, category); |
| 5925 |
}); |
| 5926 |
return [...uniqueCategories.values()]; |
| 5927 |
case "UPDATE_CATEGORY": { |
| 5928 |
if (!action.category || !Object.keys(action.category).length) { |
| 5929 |
return state; |
| 5930 |
} |
| 5931 |
const categoryToChange = state.find( |
| 5932 |
({ slug }) => slug === action.slug |
| 5933 |
); |
| 5934 |
if (categoryToChange) { |
| 5935 |
return state.map((category) => { |
| 5936 |
if (category.slug === action.slug) { |
| 5937 |
return { |
| 5938 |
...category, |
| 5939 |
...action.category |
| 5940 |
}; |
| 5941 |
} |
| 5942 |
return category; |
| 5943 |
}); |
| 5944 |
} |
| 5945 |
} |
| 5946 |
} |
| 5947 |
return state; |
| 5948 |
} |
| 5949 |
function collections(state = {}, action) { |
| 5950 |
switch (action.type) { |
| 5951 |
case "ADD_BLOCK_COLLECTION": |
| 5952 |
return { |
| 5953 |
...state, |
| 5954 |
[action.namespace]: { |
| 5955 |
title: action.title, |
| 5956 |
icon: action.icon |
| 5957 |
} |
| 5958 |
}; |
| 5959 |
case "REMOVE_BLOCK_COLLECTION": |
| 5960 |
return omit(state, action.namespace); |
| 5961 |
} |
| 5962 |
return state; |
| 5963 |
} |
| 5964 |
function getMergedUsesContext(existingUsesContext = [], newUsesContext = []) { |
| 5965 |
const mergedArrays = Array.from( |
| 5966 |
new Set(existingUsesContext.concat(newUsesContext)) |
| 5967 |
); |
| 5968 |
return mergedArrays.length > 0 ? mergedArrays : void 0; |
| 5969 |
} |
| 5970 |
function blockBindingsSources(state = {}, action) { |
| 5971 |
switch (action.type) { |
| 5972 |
case "ADD_BLOCK_BINDINGS_SOURCE": |
| 5973 |
return { |
| 5974 |
...state, |
| 5975 |
[action.name]: { |
| 5976 |
label: action.label || state[action.name]?.label, |
| 5977 |
usesContext: getMergedUsesContext( |
| 5978 |
state[action.name]?.usesContext, |
| 5979 |
action.usesContext |
| 5980 |
), |
| 5981 |
getValues: action.getValues, |
| 5982 |
setValues: action.setValues, |
| 5983 |
// Only set `canUserEditValue` if `setValues` is also defined. |
| 5984 |
canUserEditValue: action.setValues && action.canUserEditValue, |
| 5985 |
getFieldsList: action.getFieldsList |
| 5986 |
} |
| 5987 |
}; |
| 5988 |
case "REMOVE_BLOCK_BINDINGS_SOURCE": |
| 5989 |
return omit(state, action.name); |
| 5990 |
} |
| 5991 |
return state; |
| 5992 |
} |
| 5993 |
var reducer_default = (0, import_data2.combineReducers)({ |
| 5994 |
bootstrappedBlockTypes, |
| 5995 |
unprocessedBlockTypes, |
| 5996 |
blockTypes, |
| 5997 |
blockStyles, |
| 5998 |
blockVariations, |
| 5999 |
defaultBlockName, |
| 6000 |
freeformFallbackBlockName, |
| 6001 |
unregisteredFallbackBlockName, |
| 6002 |
groupingBlockName, |
| 6003 |
categories, |
| 6004 |
collections, |
| 6005 |
blockBindingsSources |
| 6006 |
}); |
| 6007 |
|
| 6008 |
// packages/blocks/build-module/store/selectors.mjs |
| 6009 |
var selectors_exports = {}; |
| 6010 |
__export(selectors_exports, { |
| 6011 |
__experimentalHasContentRoleAttribute: () => __experimentalHasContentRoleAttribute, |
| 6012 |
getActiveBlockVariation: () => getActiveBlockVariation, |
| 6013 |
getBlockStyles: () => getBlockStyles, |
| 6014 |
getBlockSupport: () => getBlockSupport2, |
| 6015 |
getBlockType: () => getBlockType2, |
| 6016 |
getBlockTypes: () => getBlockTypes2, |
| 6017 |
getBlockVariations: () => getBlockVariations2, |
| 6018 |
getCategories: () => getCategories, |
| 6019 |
getChildBlockNames: () => getChildBlockNames2, |
| 6020 |
getCollections: () => getCollections, |
| 6021 |
getDefaultBlockName: () => getDefaultBlockName2, |
| 6022 |
getDefaultBlockVariation: () => getDefaultBlockVariation, |
| 6023 |
getFreeformFallbackBlockName: () => getFreeformFallbackBlockName, |
| 6024 |
getGroupingBlockName: () => getGroupingBlockName2, |
| 6025 |
getUnregisteredFallbackBlockName: () => getUnregisteredFallbackBlockName, |
| 6026 |
hasBlockSupport: () => hasBlockSupport2, |
| 6027 |
hasChildBlocks: () => hasChildBlocks2, |
| 6028 |
hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport2, |
| 6029 |
isMatchingSearchTerm: () => isMatchingSearchTerm |
| 6030 |
}); |
| 6031 |
var import_remove_accents = __toESM(require_remove_accents(), 1); |
| 6032 |
var import_data4 = __toESM(require_data(), 1); |
| 6033 |
var import_rich_text2 = __toESM(require_rich_text(), 1); |
| 6034 |
var import_deprecated3 = __toESM(require_deprecated(), 1); |
| 6035 |
|
| 6036 |
// packages/blocks/build-module/store/utils.mjs |
| 6037 |
var getValueFromObjectPath = (object, path, defaultValue) => { |
| 6038 |
const normalizedPath = Array.isArray(path) ? path : path.split("."); |
| 6039 |
let value = object; |
| 6040 |
normalizedPath.forEach((fieldName) => { |
| 6041 |
value = value?.[fieldName]; |
| 6042 |
}); |
| 6043 |
return value ?? defaultValue; |
| 6044 |
}; |
| 6045 |
function isObject2(candidate) { |
| 6046 |
return typeof candidate === "object" && candidate.constructor === Object && candidate !== null; |
| 6047 |
} |
| 6048 |
function matchesAttributes(blockAttributes, variationAttributes) { |
| 6049 |
if (isObject2(blockAttributes) && isObject2(variationAttributes)) { |
| 6050 |
return Object.entries(variationAttributes).every( |
| 6051 |
([key, value]) => matchesAttributes(blockAttributes?.[key], value) |
| 6052 |
); |
| 6053 |
} |
| 6054 |
return blockAttributes === variationAttributes; |
| 6055 |
} |
| 6056 |
|
| 6057 |
// packages/blocks/build-module/store/private-selectors.mjs |
| 6058 |
var private_selectors_exports = {}; |
| 6059 |
__export(private_selectors_exports, { |
| 6060 |
getAllBlockBindingsSources: () => getAllBlockBindingsSources, |
| 6061 |
getBlockBindingsSource: () => getBlockBindingsSource2, |
| 6062 |
getBlockBindingsSourceFieldsList: () => getBlockBindingsSourceFieldsList, |
| 6063 |
getBootstrappedBlockType: () => getBootstrappedBlockType, |
| 6064 |
getSupportedStyles: () => getSupportedStyles, |
| 6065 |
getUnprocessedBlockTypes: () => getUnprocessedBlockTypes, |
| 6066 |
hasContentRoleAttribute: () => hasContentRoleAttribute |
| 6067 |
}); |
| 6068 |
var import_data3 = __toESM(require_data(), 1); |
| 6069 |
var import_deprecated2 = __toESM(require_deprecated(), 1); |
| 6070 |
var ROOT_BLOCK_SUPPORTS = [ |
| 6071 |
"background", |
| 6072 |
"backgroundColor", |
| 6073 |
"color", |
| 6074 |
"linkColor", |
| 6075 |
"captionColor", |
| 6076 |
"buttonColor", |
| 6077 |
"headingColor", |
| 6078 |
"fontFamily", |
| 6079 |
"fontSize", |
| 6080 |
"fontStyle", |
| 6081 |
"fontWeight", |
| 6082 |
"lineHeight", |
| 6083 |
"padding", |
| 6084 |
"contentSize", |
| 6085 |
"wideSize", |
| 6086 |
"blockGap", |
| 6087 |
"textAlign", |
| 6088 |
"textDecoration", |
| 6089 |
"textIndent", |
| 6090 |
"textTransform", |
| 6091 |
"letterSpacing" |
| 6092 |
]; |
| 6093 |
function filterElementBlockSupports(blockSupports, name, element) { |
| 6094 |
return blockSupports.filter((support) => { |
| 6095 |
if (support === "fontSize" && element === "heading") { |
| 6096 |
return false; |
| 6097 |
} |
| 6098 |
if (support === "textDecoration" && !name && element !== "link") { |
| 6099 |
return false; |
| 6100 |
} |
| 6101 |
if (support === "textTransform" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes( |
| 6102 |
element |
| 6103 |
) || element === "button" || element === "caption" || element === "text")) { |
| 6104 |
return false; |
| 6105 |
} |
| 6106 |
if (support === "letterSpacing" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes( |
| 6107 |
element |
| 6108 |
) || element === "button" || element === "caption" || element === "text")) { |
| 6109 |
return false; |
| 6110 |
} |
| 6111 |
if (support === "textIndent" && !name) { |
| 6112 |
return false; |
| 6113 |
} |
| 6114 |
if (support === "textColumns" && !name) { |
| 6115 |
return false; |
| 6116 |
} |
| 6117 |
return true; |
| 6118 |
}); |
| 6119 |
} |
| 6120 |
var getSupportedStyles = (0, import_data3.createSelector)( |
| 6121 |
(state, name, element) => { |
| 6122 |
if (!name) { |
| 6123 |
return filterElementBlockSupports( |
| 6124 |
ROOT_BLOCK_SUPPORTS, |
| 6125 |
name, |
| 6126 |
element |
| 6127 |
); |
| 6128 |
} |
| 6129 |
const blockType = getBlockType2(state, name); |
| 6130 |
if (!blockType) { |
| 6131 |
return []; |
| 6132 |
} |
| 6133 |
const supportKeys = []; |
| 6134 |
if (blockType?.supports?.spacing?.blockGap) { |
| 6135 |
supportKeys.push("blockGap"); |
| 6136 |
} |
| 6137 |
if (blockType?.supports?.shadow) { |
| 6138 |
supportKeys.push("shadow"); |
| 6139 |
} |
| 6140 |
Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach((styleName) => { |
| 6141 |
if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) { |
| 6142 |
return; |
| 6143 |
} |
| 6144 |
if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) { |
| 6145 |
if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath( |
| 6146 |
blockType.supports, |
| 6147 |
__EXPERIMENTAL_STYLE_PROPERTY[styleName].support |
| 6148 |
) !== false) { |
| 6149 |
supportKeys.push(styleName); |
| 6150 |
return; |
| 6151 |
} |
| 6152 |
} |
| 6153 |
if (getValueFromObjectPath( |
| 6154 |
blockType.supports, |
| 6155 |
__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, |
| 6156 |
false |
| 6157 |
)) { |
| 6158 |
supportKeys.push(styleName); |
| 6159 |
} |
| 6160 |
}); |
| 6161 |
return filterElementBlockSupports(supportKeys, name, element); |
| 6162 |
}, |
| 6163 |
(state, name) => [state.blockTypes[name]] |
| 6164 |
); |
| 6165 |
function getBootstrappedBlockType(state, name) { |
| 6166 |
return state.bootstrappedBlockTypes[name]; |
| 6167 |
} |
| 6168 |
function getUnprocessedBlockTypes(state) { |
| 6169 |
return state.unprocessedBlockTypes; |
| 6170 |
} |
| 6171 |
function getAllBlockBindingsSources(state) { |
| 6172 |
return state.blockBindingsSources; |
| 6173 |
} |
| 6174 |
function getBlockBindingsSource2(state, sourceName) { |
| 6175 |
return state.blockBindingsSources[sourceName]; |
| 6176 |
} |
| 6177 |
var getBlockBindingsSourceFieldsList = (0, import_data3.createRegistrySelector)( |
| 6178 |
(select3) => (0, import_data3.createSelector)( |
| 6179 |
(state, source, blockContext) => { |
| 6180 |
if (!source.getFieldsList) { |
| 6181 |
return []; |
| 6182 |
} |
| 6183 |
const context = {}; |
| 6184 |
if (source?.usesContext?.length) { |
| 6185 |
for (const key of source.usesContext) { |
| 6186 |
context[key] = blockContext[key]; |
| 6187 |
} |
| 6188 |
} |
| 6189 |
return source.getFieldsList({ select: select3, context }); |
| 6190 |
}, |
| 6191 |
(state, source, blockContext) => [ |
| 6192 |
source.getFieldsList, |
| 6193 |
source.usesContext, |
| 6194 |
blockContext |
| 6195 |
] |
| 6196 |
) |
| 6197 |
); |
| 6198 |
var hasContentRoleAttribute = (state, blockTypeName) => { |
| 6199 |
const blockType = getBlockType2(state, blockTypeName); |
| 6200 |
if (!blockType) { |
| 6201 |
return false; |
| 6202 |
} |
| 6203 |
return Object.values(blockType.attributes).some( |
| 6204 |
({ role, __experimentalRole }) => { |
| 6205 |
if (role === "content") { |
| 6206 |
return true; |
| 6207 |
} |
| 6208 |
if (__experimentalRole === "content") { |
| 6209 |
(0, import_deprecated2.default)("__experimentalRole attribute", { |
| 6210 |
since: "6.7", |
| 6211 |
version: "6.8", |
| 6212 |
alternative: "role attribute", |
| 6213 |
hint: `Check the block.json of the ${blockTypeName} block.` |
| 6214 |
}); |
| 6215 |
return true; |
| 6216 |
} |
| 6217 |
return false; |
| 6218 |
} |
| 6219 |
); |
| 6220 |
}; |
| 6221 |
|
| 6222 |
// packages/blocks/build-module/store/selectors.mjs |
| 6223 |
var getNormalizedBlockType = (state, nameOrType) => "string" === typeof nameOrType ? getBlockType2(state, nameOrType) : nameOrType; |
| 6224 |
var getBlockTypes2 = (0, import_data4.createSelector)( |
| 6225 |
(state) => Object.values(state.blockTypes), |
| 6226 |
(state) => [state.blockTypes] |
| 6227 |
); |
| 6228 |
function getBlockType2(state, name) { |
| 6229 |
return state.blockTypes[name]; |
| 6230 |
} |
| 6231 |
function getBlockStyles(state, name) { |
| 6232 |
return state.blockStyles[name]; |
| 6233 |
} |
| 6234 |
var getBlockVariations2 = (0, import_data4.createSelector)( |
| 6235 |
(state, blockName, scope) => { |
| 6236 |
const variations = state.blockVariations[blockName]; |
| 6237 |
if (!variations || !scope) { |
| 6238 |
return variations; |
| 6239 |
} |
| 6240 |
return variations.filter((variation) => { |
| 6241 |
return (variation.scope || ["block", "inserter"]).includes( |
| 6242 |
scope |
| 6243 |
); |
| 6244 |
}); |
| 6245 |
}, |
| 6246 |
(state, blockName) => [state.blockVariations[blockName]] |
| 6247 |
); |
| 6248 |
function getActiveBlockVariation(state, blockName, attributes, scope) { |
| 6249 |
const variations = getBlockVariations2(state, blockName, scope); |
| 6250 |
if (!variations) { |
| 6251 |
return variations; |
| 6252 |
} |
| 6253 |
const blockType = getBlockType2(state, blockName); |
| 6254 |
const attributeKeys = Object.keys(blockType?.attributes || {}); |
| 6255 |
let match; |
| 6256 |
let maxMatchedAttributes = 0; |
| 6257 |
for (const variation of variations) { |
| 6258 |
if (Array.isArray(variation.isActive)) { |
| 6259 |
const definedAttributes = variation.isActive.filter( |
| 6260 |
(attribute) => { |
| 6261 |
const topLevelAttribute = attribute.split(".")[0]; |
| 6262 |
return attributeKeys.includes(topLevelAttribute); |
| 6263 |
} |
| 6264 |
); |
| 6265 |
const definedAttributesLength = definedAttributes.length; |
| 6266 |
if (definedAttributesLength === 0) { |
| 6267 |
continue; |
| 6268 |
} |
| 6269 |
const isMatch = definedAttributes.every((attribute) => { |
| 6270 |
const variationAttributeValue = getValueFromObjectPath( |
| 6271 |
variation.attributes, |
| 6272 |
attribute |
| 6273 |
); |
| 6274 |
if (variationAttributeValue === void 0) { |
| 6275 |
return false; |
| 6276 |
} |
| 6277 |
let blockAttributeValue = getValueFromObjectPath( |
| 6278 |
attributes, |
| 6279 |
attribute |
| 6280 |
); |
| 6281 |
if (blockAttributeValue instanceof import_rich_text2.RichTextData) { |
| 6282 |
blockAttributeValue = blockAttributeValue.toHTMLString(); |
| 6283 |
} |
| 6284 |
return matchesAttributes( |
| 6285 |
blockAttributeValue, |
| 6286 |
variationAttributeValue |
| 6287 |
); |
| 6288 |
}); |
| 6289 |
if (isMatch && definedAttributesLength > maxMatchedAttributes) { |
| 6290 |
match = variation; |
| 6291 |
maxMatchedAttributes = definedAttributesLength; |
| 6292 |
} |
| 6293 |
} else if (variation.isActive?.(attributes, variation.attributes)) { |
| 6294 |
return match || variation; |
| 6295 |
} |
| 6296 |
} |
| 6297 |
if (!match && ["block", "transform"].includes(scope)) { |
| 6298 |
match = variations.find( |
| 6299 |
(variation) => variation?.isDefault && !Object.hasOwn(variation, "isActive") |
| 6300 |
); |
| 6301 |
} |
| 6302 |
return match; |
| 6303 |
} |
| 6304 |
function getDefaultBlockVariation(state, blockName, scope) { |
| 6305 |
const variations = getBlockVariations2(state, blockName, scope); |
| 6306 |
const defaultVariation = [...variations].reverse().find(({ isDefault }) => !!isDefault); |
| 6307 |
return defaultVariation || variations[0]; |
| 6308 |
} |
| 6309 |
function getCategories(state) { |
| 6310 |
return state.categories; |
| 6311 |
} |
| 6312 |
function getCollections(state) { |
| 6313 |
return state.collections; |
| 6314 |
} |
| 6315 |
function getDefaultBlockName2(state) { |
| 6316 |
return state.defaultBlockName; |
| 6317 |
} |
| 6318 |
function getFreeformFallbackBlockName(state) { |
| 6319 |
return state.freeformFallbackBlockName; |
| 6320 |
} |
| 6321 |
function getUnregisteredFallbackBlockName(state) { |
| 6322 |
return state.unregisteredFallbackBlockName; |
| 6323 |
} |
| 6324 |
function getGroupingBlockName2(state) { |
| 6325 |
return state.groupingBlockName; |
| 6326 |
} |
| 6327 |
var getChildBlockNames2 = (0, import_data4.createSelector)( |
| 6328 |
(state, blockName) => { |
| 6329 |
return getBlockTypes2(state).filter((blockType) => { |
| 6330 |
return blockType.parent?.includes(blockName); |
| 6331 |
}).map(({ name }) => name); |
| 6332 |
}, |
| 6333 |
(state) => [state.blockTypes] |
| 6334 |
); |
| 6335 |
var getBlockSupport2 = (state, nameOrType, feature, defaultSupports) => { |
| 6336 |
const blockType = getNormalizedBlockType(state, nameOrType); |
| 6337 |
if (!blockType?.supports) { |
| 6338 |
return defaultSupports; |
| 6339 |
} |
| 6340 |
return getValueFromObjectPath( |
| 6341 |
blockType.supports, |
| 6342 |
feature, |
| 6343 |
defaultSupports |
| 6344 |
); |
| 6345 |
}; |
| 6346 |
function hasBlockSupport2(state, nameOrType, feature, defaultSupports) { |
| 6347 |
return !!getBlockSupport2(state, nameOrType, feature, defaultSupports); |
| 6348 |
} |
| 6349 |
function getNormalizedSearchTerm(term) { |
| 6350 |
return (0, import_remove_accents.default)(term ?? "").toLowerCase().trim(); |
| 6351 |
} |
| 6352 |
function isMatchingSearchTerm(state, nameOrType, searchTerm = "") { |
| 6353 |
const blockType = getNormalizedBlockType(state, nameOrType); |
| 6354 |
const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm); |
| 6355 |
const isSearchMatch = (candidate) => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm); |
| 6356 |
return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === "string" && isSearchMatch(blockType.description); |
| 6357 |
} |
| 6358 |
var hasChildBlocks2 = (state, blockName) => { |
| 6359 |
return getChildBlockNames2(state, blockName).length > 0; |
| 6360 |
}; |
| 6361 |
var hasChildBlocksWithInserterSupport2 = (state, blockName) => { |
| 6362 |
return getChildBlockNames2(state, blockName).some((childBlockName) => { |
| 6363 |
return hasBlockSupport2(state, childBlockName, "inserter", true); |
| 6364 |
}); |
| 6365 |
}; |
| 6366 |
var __experimentalHasContentRoleAttribute = (...args) => { |
| 6367 |
(0, import_deprecated3.default)("__experimentalHasContentRoleAttribute", { |
| 6368 |
since: "6.7", |
| 6369 |
version: "6.8", |
| 6370 |
hint: "This is a private selector." |
| 6371 |
}); |
| 6372 |
return hasContentRoleAttribute(...args); |
| 6373 |
}; |
| 6374 |
|
| 6375 |
// packages/blocks/build-module/store/actions.mjs |
| 6376 |
var actions_exports = {}; |
| 6377 |
__export(actions_exports, { |
| 6378 |
__experimentalReapplyBlockFilters: () => __experimentalReapplyBlockFilters, |
| 6379 |
addBlockCollection: () => addBlockCollection, |
| 6380 |
addBlockStyles: () => addBlockStyles, |
| 6381 |
addBlockTypes: () => addBlockTypes, |
| 6382 |
addBlockVariations: () => addBlockVariations, |
| 6383 |
reapplyBlockTypeFilters: () => reapplyBlockTypeFilters, |
| 6384 |
removeBlockCollection: () => removeBlockCollection, |
| 6385 |
removeBlockStyles: () => removeBlockStyles, |
| 6386 |
removeBlockTypes: () => removeBlockTypes, |
| 6387 |
removeBlockVariations: () => removeBlockVariations, |
| 6388 |
setCategories: () => setCategories, |
| 6389 |
setDefaultBlockName: () => setDefaultBlockName2, |
| 6390 |
setFreeformFallbackBlockName: () => setFreeformFallbackBlockName, |
| 6391 |
setGroupingBlockName: () => setGroupingBlockName2, |
| 6392 |
setUnregisteredFallbackBlockName: () => setUnregisteredFallbackBlockName, |
| 6393 |
updateCategory: () => updateCategory |
| 6394 |
}); |
| 6395 |
var import_deprecated5 = __toESM(require_deprecated(), 1); |
| 6396 |
|
| 6397 |
// node_modules/is-plain-object/dist/is-plain-object.mjs |
| 6398 |
function isObject3(o3) { |
| 6399 |
return Object.prototype.toString.call(o3) === "[object Object]"; |
| 6400 |
} |
| 6401 |
function isPlainObject(o3) { |
| 6402 |
var ctor, prot; |
| 6403 |
if (isObject3(o3) === false) return false; |
| 6404 |
ctor = o3.constructor; |
| 6405 |
if (ctor === void 0) return true; |
| 6406 |
prot = ctor.prototype; |
| 6407 |
if (isObject3(prot) === false) return false; |
| 6408 |
if (prot.hasOwnProperty("isPrototypeOf") === false) { |
| 6409 |
return false; |
| 6410 |
} |
| 6411 |
return true; |
| 6412 |
} |
| 6413 |
|
| 6414 |
// packages/blocks/build-module/store/process-block-type.mjs |
| 6415 |
var import_react_is = __toESM(require_react_is(), 1); |
| 6416 |
var import_deprecated4 = __toESM(require_deprecated(), 1); |
| 6417 |
var import_hooks = __toESM(require_hooks(), 1); |
| 6418 |
var import_warning2 = __toESM(require_warning(), 1); |
| 6419 |
var LEGACY_CATEGORY_MAPPING = { |
| 6420 |
common: "text", |
| 6421 |
formatting: "text", |
| 6422 |
layout: "design" |
| 6423 |
}; |
| 6424 |
function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) { |
| 6425 |
const result = [...bootstrappedVariations]; |
| 6426 |
clientVariations.forEach((clientVariation) => { |
| 6427 |
const index = result.findIndex( |
| 6428 |
(bootstrappedVariation) => bootstrappedVariation.name === clientVariation.name |
| 6429 |
); |
| 6430 |
if (index !== -1) { |
| 6431 |
result[index] = { ...result[index], ...clientVariation }; |
| 6432 |
} else { |
| 6433 |
result.push(clientVariation); |
| 6434 |
} |
| 6435 |
}); |
| 6436 |
return result; |
| 6437 |
} |
| 6438 |
var processBlockType = (name, blockSettings) => ({ select: select3 }) => { |
| 6439 |
const bootstrappedBlockType = select3.getBootstrappedBlockType(name); |
| 6440 |
const blockType = { |
| 6441 |
apiVersion: 1, |
| 6442 |
name, |
| 6443 |
icon: BLOCK_ICON_DEFAULT, |
| 6444 |
keywords: [], |
| 6445 |
attributes: {}, |
| 6446 |
providesContext: {}, |
| 6447 |
usesContext: [], |
| 6448 |
selectors: {}, |
| 6449 |
supports: {}, |
| 6450 |
styles: [], |
| 6451 |
blockHooks: {}, |
| 6452 |
save: () => null, |
| 6453 |
...bootstrappedBlockType, |
| 6454 |
...blockSettings, |
| 6455 |
// blockType.variations can be defined as a filePath. |
| 6456 |
variations: mergeBlockVariations( |
| 6457 |
Array.isArray(bootstrappedBlockType?.variations) ? bootstrappedBlockType.variations : [], |
| 6458 |
Array.isArray(blockSettings?.variations) ? blockSettings.variations : [] |
| 6459 |
) |
| 6460 |
}; |
| 6461 |
if (!blockType.attributes || typeof blockType.attributes !== "object") { |
| 6462 |
(0, import_warning2.default)( |
| 6463 |
'The block "' + name + '" is registering attributes as `null` or `undefined`. Use an empty object (`attributes: {}`) or exclude the `attributes` key.' |
| 6464 |
); |
| 6465 |
blockType.attributes = {}; |
| 6466 |
} |
| 6467 |
const settings = (0, import_hooks.applyFilters)( |
| 6468 |
"blocks.registerBlockType", |
| 6469 |
blockType, |
| 6470 |
name, |
| 6471 |
null |
| 6472 |
); |
| 6473 |
if (settings.apiVersion <= 2) { |
| 6474 |
(0, import_deprecated4.default)("Block with API version 2 or lower", { |
| 6475 |
since: "6.9", |
| 6476 |
hint: `The block "${name}" is registered with API version ${settings.apiVersion}. This means that the post editor may work as a non-iframe editor. 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.`, |
| 6477 |
link: "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/" |
| 6478 |
}); |
| 6479 |
} |
| 6480 |
if (settings.description && typeof settings.description !== "string") { |
| 6481 |
(0, import_deprecated4.default)("Declaring non-string block descriptions", { |
| 6482 |
since: "6.2" |
| 6483 |
}); |
| 6484 |
} |
| 6485 |
if (settings.deprecated) { |
| 6486 |
settings.deprecated = settings.deprecated.map( |
| 6487 |
(deprecation) => Object.fromEntries( |
| 6488 |
Object.entries( |
| 6489 |
// Only keep valid deprecation keys. |
| 6490 |
(0, import_hooks.applyFilters)( |
| 6491 |
"blocks.registerBlockType", |
| 6492 |
// Merge deprecation keys with pre-filter settings |
| 6493 |
// so that filters that depend on specific keys being |
| 6494 |
// present don't fail. |
| 6495 |
{ |
| 6496 |
// Omit deprecation keys here so that deprecations |
| 6497 |
// can opt out of specific keys like "supports". |
| 6498 |
...omit(blockType, DEPRECATED_ENTRY_KEYS), |
| 6499 |
...deprecation |
| 6500 |
}, |
| 6501 |
blockType.name, |
| 6502 |
deprecation |
| 6503 |
) |
| 6504 |
).filter( |
| 6505 |
([key]) => DEPRECATED_ENTRY_KEYS.includes(key) |
| 6506 |
) |
| 6507 |
) |
| 6508 |
); |
| 6509 |
} |
| 6510 |
if (!isPlainObject(settings)) { |
| 6511 |
(0, import_warning2.default)("Block settings must be a valid object."); |
| 6512 |
return; |
| 6513 |
} |
| 6514 |
if (typeof settings.save !== "function") { |
| 6515 |
(0, import_warning2.default)('The "save" property must be a valid function.'); |
| 6516 |
return; |
| 6517 |
} |
| 6518 |
if ("edit" in settings && !(0, import_react_is.isValidElementType)(settings.edit)) { |
| 6519 |
(0, import_warning2.default)('The "edit" property must be a valid component.'); |
| 6520 |
return; |
| 6521 |
} |
| 6522 |
if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) { |
| 6523 |
settings.category = LEGACY_CATEGORY_MAPPING[settings.category]; |
| 6524 |
} |
| 6525 |
if ("category" in settings && !select3.getCategories().some(({ slug }) => slug === settings.category)) { |
| 6526 |
(0, import_warning2.default)( |
| 6527 |
'The block "' + name + '" is registered with an invalid category "' + settings.category + '".' |
| 6528 |
); |
| 6529 |
delete settings.category; |
| 6530 |
} |
| 6531 |
if (!("title" in settings) || settings.title === "") { |
| 6532 |
(0, import_warning2.default)('The block "' + name + '" must have a title.'); |
| 6533 |
return; |
| 6534 |
} |
| 6535 |
if (typeof settings.title !== "string") { |
| 6536 |
(0, import_warning2.default)("Block titles must be strings."); |
| 6537 |
return; |
| 6538 |
} |
| 6539 |
settings.icon = normalizeIconObject(settings.icon); |
| 6540 |
if (!isValidIcon(settings.icon.src)) { |
| 6541 |
(0, import_warning2.default)( |
| 6542 |
"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" |
| 6543 |
); |
| 6544 |
return; |
| 6545 |
} |
| 6546 |
if (typeof settings?.parent === "string" || settings?.parent instanceof String) { |
| 6547 |
settings.parent = [settings.parent]; |
| 6548 |
(0, import_warning2.default)( |
| 6549 |
"Parent must be undefined or an array of strings (block types), but it is a string." |
| 6550 |
); |
| 6551 |
} |
| 6552 |
if (!Array.isArray(settings?.parent) && settings?.parent !== void 0) { |
| 6553 |
(0, import_warning2.default)( |
| 6554 |
"Parent must be undefined or an array of block types, but it is ", |
| 6555 |
settings.parent |
| 6556 |
); |
| 6557 |
return; |
| 6558 |
} |
| 6559 |
if (1 === settings?.parent?.length && name === settings.parent[0]) { |
| 6560 |
(0, import_warning2.default)( |
| 6561 |
'Block "' + name + '" cannot be a parent of itself. Please remove the block name from the parent list.' |
| 6562 |
); |
| 6563 |
return; |
| 6564 |
} |
| 6565 |
return settings; |
| 6566 |
}; |
| 6567 |
|
| 6568 |
// packages/blocks/build-module/store/actions.mjs |
| 6569 |
function addBlockTypes(blockTypes2) { |
| 6570 |
return { |
| 6571 |
type: "ADD_BLOCK_TYPES", |
| 6572 |
blockTypes: Array.isArray(blockTypes2) ? blockTypes2 : [blockTypes2] |
| 6573 |
}; |
| 6574 |
} |
| 6575 |
function reapplyBlockTypeFilters() { |
| 6576 |
return ({ dispatch: dispatch3, select: select3 }) => { |
| 6577 |
const processedBlockTypes = []; |
| 6578 |
for (const [name, settings] of Object.entries( |
| 6579 |
select3.getUnprocessedBlockTypes() |
| 6580 |
)) { |
| 6581 |
const result = dispatch3(processBlockType(name, settings)); |
| 6582 |
if (result) { |
| 6583 |
processedBlockTypes.push(result); |
| 6584 |
} |
| 6585 |
} |
| 6586 |
if (!processedBlockTypes.length) { |
| 6587 |
return; |
| 6588 |
} |
| 6589 |
dispatch3.addBlockTypes(processedBlockTypes); |
| 6590 |
}; |
| 6591 |
} |
| 6592 |
function __experimentalReapplyBlockFilters() { |
| 6593 |
(0, import_deprecated5.default)( |
| 6594 |
'wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters', |
| 6595 |
{ |
| 6596 |
since: "6.4", |
| 6597 |
alternative: "reapplyBlockFilters" |
| 6598 |
} |
| 6599 |
); |
| 6600 |
return reapplyBlockTypeFilters(); |
| 6601 |
} |
| 6602 |
function removeBlockTypes(names) { |
| 6603 |
return { |
| 6604 |
type: "REMOVE_BLOCK_TYPES", |
| 6605 |
names: Array.isArray(names) ? names : [names] |
| 6606 |
}; |
| 6607 |
} |
| 6608 |
function addBlockStyles(blockNames, styles) { |
| 6609 |
return { |
| 6610 |
type: "ADD_BLOCK_STYLES", |
| 6611 |
styles: Array.isArray(styles) ? styles : [styles], |
| 6612 |
blockNames: Array.isArray(blockNames) ? blockNames : [blockNames] |
| 6613 |
}; |
| 6614 |
} |
| 6615 |
function removeBlockStyles(blockName, styleNames) { |
| 6616 |
return { |
| 6617 |
type: "REMOVE_BLOCK_STYLES", |
| 6618 |
styleNames: Array.isArray(styleNames) ? styleNames : [styleNames], |
| 6619 |
blockName |
| 6620 |
}; |
| 6621 |
} |
| 6622 |
function addBlockVariations(blockName, variations) { |
| 6623 |
return { |
| 6624 |
type: "ADD_BLOCK_VARIATIONS", |
| 6625 |
variations: Array.isArray(variations) ? variations : [variations], |
| 6626 |
blockName |
| 6627 |
}; |
| 6628 |
} |
| 6629 |
function removeBlockVariations(blockName, variationNames) { |
| 6630 |
return { |
| 6631 |
type: "REMOVE_BLOCK_VARIATIONS", |
| 6632 |
variationNames: Array.isArray(variationNames) ? variationNames : [variationNames], |
| 6633 |
blockName |
| 6634 |
}; |
| 6635 |
} |
| 6636 |
function setDefaultBlockName2(name) { |
| 6637 |
return { |
| 6638 |
type: "SET_DEFAULT_BLOCK_NAME", |
| 6639 |
name |
| 6640 |
}; |
| 6641 |
} |
| 6642 |
function setFreeformFallbackBlockName(name) { |
| 6643 |
return { |
| 6644 |
type: "SET_FREEFORM_FALLBACK_BLOCK_NAME", |
| 6645 |
name |
| 6646 |
}; |
| 6647 |
} |
| 6648 |
function setUnregisteredFallbackBlockName(name) { |
| 6649 |
return { |
| 6650 |
type: "SET_UNREGISTERED_FALLBACK_BLOCK_NAME", |
| 6651 |
name |
| 6652 |
}; |
| 6653 |
} |
| 6654 |
function setGroupingBlockName2(name) { |
| 6655 |
return { |
| 6656 |
type: "SET_GROUPING_BLOCK_NAME", |
| 6657 |
name |
| 6658 |
}; |
| 6659 |
} |
| 6660 |
function setCategories(categories2) { |
| 6661 |
return { |
| 6662 |
type: "SET_CATEGORIES", |
| 6663 |
categories: categories2 |
| 6664 |
}; |
| 6665 |
} |
| 6666 |
function updateCategory(slug, category) { |
| 6667 |
return { |
| 6668 |
type: "UPDATE_CATEGORY", |
| 6669 |
slug, |
| 6670 |
category |
| 6671 |
}; |
| 6672 |
} |
| 6673 |
function addBlockCollection(namespace, title, icon) { |
| 6674 |
return { |
| 6675 |
type: "ADD_BLOCK_COLLECTION", |
| 6676 |
namespace, |
| 6677 |
title, |
| 6678 |
icon |
| 6679 |
}; |
| 6680 |
} |
| 6681 |
function removeBlockCollection(namespace) { |
| 6682 |
return { |
| 6683 |
type: "REMOVE_BLOCK_COLLECTION", |
| 6684 |
namespace |
| 6685 |
}; |
| 6686 |
} |
| 6687 |
|
| 6688 |
// packages/blocks/build-module/store/private-actions.mjs |
| 6689 |
var private_actions_exports = {}; |
| 6690 |
__export(private_actions_exports, { |
| 6691 |
addBlockBindingsSource: () => addBlockBindingsSource, |
| 6692 |
addBootstrappedBlockType: () => addBootstrappedBlockType, |
| 6693 |
addUnprocessedBlockType: () => addUnprocessedBlockType, |
| 6694 |
removeBlockBindingsSource: () => removeBlockBindingsSource |
| 6695 |
}); |
| 6696 |
function addBootstrappedBlockType(name, blockType) { |
| 6697 |
return { |
| 6698 |
type: "ADD_BOOTSTRAPPED_BLOCK_TYPE", |
| 6699 |
name, |
| 6700 |
blockType |
| 6701 |
}; |
| 6702 |
} |
| 6703 |
function addUnprocessedBlockType(name, blockType) { |
| 6704 |
return ({ dispatch: dispatch3 }) => { |
| 6705 |
dispatch3({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType }); |
| 6706 |
const processedBlockType = dispatch3( |
| 6707 |
processBlockType(name, blockType) |
| 6708 |
); |
| 6709 |
if (!processedBlockType) { |
| 6710 |
return; |
| 6711 |
} |
| 6712 |
dispatch3.addBlockTypes(processedBlockType); |
| 6713 |
}; |
| 6714 |
} |
| 6715 |
function addBlockBindingsSource(source) { |
| 6716 |
return { |
| 6717 |
type: "ADD_BLOCK_BINDINGS_SOURCE", |
| 6718 |
name: source.name, |
| 6719 |
label: source.label, |
| 6720 |
usesContext: source.usesContext, |
| 6721 |
getValues: source.getValues, |
| 6722 |
setValues: source.setValues, |
| 6723 |
canUserEditValue: source.canUserEditValue, |
| 6724 |
getFieldsList: source.getFieldsList |
| 6725 |
}; |
| 6726 |
} |
| 6727 |
function removeBlockBindingsSource(name) { |
| 6728 |
return { |
| 6729 |
type: "REMOVE_BLOCK_BINDINGS_SOURCE", |
| 6730 |
name |
| 6731 |
}; |
| 6732 |
} |
| 6733 |
|
| 6734 |
// packages/blocks/build-module/store/constants.mjs |
| 6735 |
var STORE_NAME = "core/blocks"; |
| 6736 |
|
| 6737 |
// packages/blocks/build-module/store/index.mjs |
| 6738 |
var store = (0, import_data5.createReduxStore)(STORE_NAME, { |
| 6739 |
reducer: reducer_default, |
| 6740 |
selectors: selectors_exports, |
| 6741 |
actions: actions_exports |
| 6742 |
}); |
| 6743 |
(0, import_data5.register)(store); |
| 6744 |
unlock(store).registerPrivateSelectors(private_selectors_exports); |
| 6745 |
unlock(store).registerPrivateActions(private_actions_exports); |
| 6746 |
|
| 6747 |
// node_modules/uuid/dist/esm-browser/rng.js |
| 6748 |
var getRandomValues; |
| 6749 |
var rnds8 = new Uint8Array(16); |
| 6750 |
function rng() { |
| 6751 |
if (!getRandomValues) { |
| 6752 |
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); |
| 6753 |
if (!getRandomValues) { |
| 6754 |
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); |
| 6755 |
} |
| 6756 |
} |
| 6757 |
return getRandomValues(rnds8); |
| 6758 |
} |
| 6759 |
|
| 6760 |
// node_modules/uuid/dist/esm-browser/stringify.js |
| 6761 |
var byteToHex = []; |
| 6762 |
for (let i2 = 0; i2 < 256; ++i2) { |
| 6763 |
byteToHex.push((i2 + 256).toString(16).slice(1)); |
| 6764 |
} |
| 6765 |
function unsafeStringify(arr, offset = 0) { |
| 6766 |
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]]; |
| 6767 |
} |
| 6768 |
|
| 6769 |
// node_modules/uuid/dist/esm-browser/native.js |
| 6770 |
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); |
| 6771 |
var native_default = { |
| 6772 |
randomUUID |
| 6773 |
}; |
| 6774 |
|
| 6775 |
// node_modules/uuid/dist/esm-browser/v4.js |
| 6776 |
function v4(options, buf, offset) { |
| 6777 |
if (native_default.randomUUID && !buf && !options) { |
| 6778 |
return native_default.randomUUID(); |
| 6779 |
} |
| 6780 |
options = options || {}; |
| 6781 |
const rnds = options.random || (options.rng || rng)(); |
| 6782 |
rnds[6] = rnds[6] & 15 | 64; |
| 6783 |
rnds[8] = rnds[8] & 63 | 128; |
| 6784 |
if (buf) { |
| 6785 |
offset = offset || 0; |
| 6786 |
for (let i2 = 0; i2 < 16; ++i2) { |
| 6787 |
buf[offset + i2] = rnds[i2]; |
| 6788 |
} |
| 6789 |
return buf; |
| 6790 |
} |
| 6791 |
return unsafeStringify(rnds); |
| 6792 |
} |
| 6793 |
var v4_default = v4; |
| 6794 |
|
| 6795 |
// packages/blocks/build-module/api/factory.mjs |
| 6796 |
var import_hooks2 = __toESM(require_hooks(), 1); |
| 6797 |
function createBlock(name, attributes = {}, innerBlocks = []) { |
| 6798 |
if (!isBlockRegistered(name)) { |
| 6799 |
return createBlock("core/missing", { |
| 6800 |
originalName: name, |
| 6801 |
originalContent: "", |
| 6802 |
originalUndelimitedContent: "" |
| 6803 |
}); |
| 6804 |
} |
| 6805 |
const sanitizedAttributes = __experimentalSanitizeBlockAttributes( |
| 6806 |
name, |
| 6807 |
attributes |
| 6808 |
); |
| 6809 |
const clientId = v4_default(); |
| 6810 |
return { |
| 6811 |
clientId, |
| 6812 |
name, |
| 6813 |
isValid: true, |
| 6814 |
attributes: sanitizedAttributes, |
| 6815 |
innerBlocks |
| 6816 |
}; |
| 6817 |
} |
| 6818 |
function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) { |
| 6819 |
return innerBlocksOrTemplate.map((innerBlock) => { |
| 6820 |
const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [ |
| 6821 |
innerBlock.name, |
| 6822 |
innerBlock.attributes, |
| 6823 |
innerBlock.innerBlocks |
| 6824 |
]; |
| 6825 |
const [name, attributes, innerBlocks = []] = innerBlockTemplate; |
| 6826 |
return createBlock( |
| 6827 |
name, |
| 6828 |
attributes, |
| 6829 |
createBlocksFromInnerBlocksTemplate(innerBlocks) |
| 6830 |
); |
| 6831 |
}); |
| 6832 |
} |
| 6833 |
function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) { |
| 6834 |
const { name } = block; |
| 6835 |
if (!isBlockRegistered(name)) { |
| 6836 |
return createBlock("core/missing", { |
| 6837 |
originalName: name, |
| 6838 |
originalContent: "", |
| 6839 |
originalUndelimitedContent: "" |
| 6840 |
}); |
| 6841 |
} |
| 6842 |
const clientId = v4_default(); |
| 6843 |
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, { |
| 6844 |
...block.attributes, |
| 6845 |
...mergeAttributes |
| 6846 |
}); |
| 6847 |
return { |
| 6848 |
...block, |
| 6849 |
clientId, |
| 6850 |
attributes: sanitizedAttributes, |
| 6851 |
innerBlocks: newInnerBlocks || block.innerBlocks.map( |
| 6852 |
(innerBlock) => __experimentalCloneSanitizedBlock(innerBlock) |
| 6853 |
) |
| 6854 |
}; |
| 6855 |
} |
| 6856 |
function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) { |
| 6857 |
const clientId = v4_default(); |
| 6858 |
return { |
| 6859 |
...block, |
| 6860 |
clientId, |
| 6861 |
attributes: { |
| 6862 |
...block.attributes, |
| 6863 |
...mergeAttributes |
| 6864 |
}, |
| 6865 |
innerBlocks: newInnerBlocks || block.innerBlocks.map((innerBlock) => cloneBlock(innerBlock)) |
| 6866 |
}; |
| 6867 |
} |
| 6868 |
var isPossibleTransformForSource = (transform, direction, blocks) => { |
| 6869 |
if (!blocks.length) { |
| 6870 |
return false; |
| 6871 |
} |
| 6872 |
const isMultiBlock = blocks.length > 1; |
| 6873 |
const firstBlockName = blocks[0].name; |
| 6874 |
const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock; |
| 6875 |
if (!isValidForMultiBlocks) { |
| 6876 |
return false; |
| 6877 |
} |
| 6878 |
if (!isWildcardBlockTransform(transform) && !blocks.every((block) => block.name === firstBlockName)) { |
| 6879 |
return false; |
| 6880 |
} |
| 6881 |
const isBlockType = transform.type === "block"; |
| 6882 |
if (!isBlockType) { |
| 6883 |
return false; |
| 6884 |
} |
| 6885 |
const sourceBlock = blocks[0]; |
| 6886 |
const hasMatchingName = direction !== "from" || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform); |
| 6887 |
if (!hasMatchingName) { |
| 6888 |
return false; |
| 6889 |
} |
| 6890 |
if (!isMultiBlock && direction === "from" && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) { |
| 6891 |
return false; |
| 6892 |
} |
| 6893 |
if (!maybeCheckTransformIsMatch(transform, blocks)) { |
| 6894 |
return false; |
| 6895 |
} |
| 6896 |
return true; |
| 6897 |
}; |
| 6898 |
var getBlockTypesForPossibleFromTransforms = (blocks) => { |
| 6899 |
if (!blocks.length) { |
| 6900 |
return []; |
| 6901 |
} |
| 6902 |
const allBlockTypes = getBlockTypes(); |
| 6903 |
const blockTypesWithPossibleFromTransforms = allBlockTypes.filter( |
| 6904 |
(blockType) => { |
| 6905 |
const fromTransforms = getBlockTransforms("from", blockType.name); |
| 6906 |
return !!findTransform(fromTransforms, (transform) => { |
| 6907 |
return isPossibleTransformForSource( |
| 6908 |
transform, |
| 6909 |
"from", |
| 6910 |
blocks |
| 6911 |
); |
| 6912 |
}); |
| 6913 |
} |
| 6914 |
); |
| 6915 |
return blockTypesWithPossibleFromTransforms; |
| 6916 |
}; |
| 6917 |
var getBlockTypesForPossibleToTransforms = (blocks) => { |
| 6918 |
if (!blocks.length) { |
| 6919 |
return []; |
| 6920 |
} |
| 6921 |
const sourceBlock = blocks[0]; |
| 6922 |
const blockType = getBlockType(sourceBlock.name); |
| 6923 |
const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : []; |
| 6924 |
const possibleTransforms = transformsTo.filter((transform) => { |
| 6925 |
return transform && isPossibleTransformForSource(transform, "to", blocks); |
| 6926 |
}); |
| 6927 |
const blockNames = possibleTransforms.map((transformation) => transformation.blocks).flat(); |
| 6928 |
return blockNames.map(getBlockType); |
| 6929 |
}; |
| 6930 |
var isWildcardBlockTransform = (t3) => t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*"); |
| 6931 |
var isContainerGroupBlock = (name) => name === getGroupingBlockName(); |
| 6932 |
function getPossibleBlockTransformations(blocks) { |
| 6933 |
if (!blocks.length) { |
| 6934 |
return []; |
| 6935 |
} |
| 6936 |
const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks); |
| 6937 |
const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks); |
| 6938 |
return [ |
| 6939 |
.../* @__PURE__ */ new Set([ |
| 6940 |
...blockTypesForFromTransforms, |
| 6941 |
...blockTypesForToTransforms |
| 6942 |
]) |
| 6943 |
]; |
| 6944 |
} |
| 6945 |
function findTransform(transforms, predicate) { |
| 6946 |
const hooks = (0, import_hooks2.createHooks)(); |
| 6947 |
for (let i2 = 0; i2 < transforms.length; i2++) { |
| 6948 |
const candidate = transforms[i2]; |
| 6949 |
if (predicate(candidate)) { |
| 6950 |
hooks.addFilter( |
| 6951 |
"transform", |
| 6952 |
"transform/" + i2.toString(), |
| 6953 |
(result) => result ? result : candidate, |
| 6954 |
candidate.priority |
| 6955 |
); |
| 6956 |
} |
| 6957 |
} |
| 6958 |
return hooks.applyFilters("transform", null); |
| 6959 |
} |
| 6960 |
function getBlockTransforms(direction, blockTypeOrName) { |
| 6961 |
if (blockTypeOrName === void 0) { |
| 6962 |
return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat(); |
| 6963 |
} |
| 6964 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 6965 |
const { name: blockName, transforms } = blockType || {}; |
| 6966 |
if (!transforms || !Array.isArray(transforms[direction])) { |
| 6967 |
return []; |
| 6968 |
} |
| 6969 |
const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms); |
| 6970 |
const filteredTransforms = usingMobileTransformations ? transforms[direction].filter((t3) => { |
| 6971 |
if (t3.type === "raw") { |
| 6972 |
return true; |
| 6973 |
} |
| 6974 |
if (t3.type === "prefix") { |
| 6975 |
return true; |
| 6976 |
} |
| 6977 |
if (!t3.blocks || !t3.blocks.length) { |
| 6978 |
return false; |
| 6979 |
} |
| 6980 |
if (isWildcardBlockTransform(t3)) { |
| 6981 |
return true; |
| 6982 |
} |
| 6983 |
return t3.blocks.every( |
| 6984 |
(transformBlockName) => transforms.supportedMobileTransforms.includes( |
| 6985 |
transformBlockName |
| 6986 |
) |
| 6987 |
); |
| 6988 |
}) : transforms[direction]; |
| 6989 |
return filteredTransforms.map((transform) => ({ |
| 6990 |
...transform, |
| 6991 |
blockName, |
| 6992 |
usingMobileTransformations |
| 6993 |
})); |
| 6994 |
} |
| 6995 |
function maybeCheckTransformIsMatch(transform, blocks) { |
| 6996 |
if (typeof transform.isMatch !== "function") { |
| 6997 |
return true; |
| 6998 |
} |
| 6999 |
const sourceBlock = blocks[0]; |
| 7000 |
const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes; |
| 7001 |
const block = transform.isMultiBlock ? blocks : sourceBlock; |
| 7002 |
return transform.isMatch(attributes, block); |
| 7003 |
} |
| 7004 |
function switchToBlockType(blocks, name) { |
| 7005 |
const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; |
| 7006 |
const isMultiBlock = blocksArray.length > 1; |
| 7007 |
const firstBlock = blocksArray[0]; |
| 7008 |
const sourceName = firstBlock.name; |
| 7009 |
const transformationsFrom = getBlockTransforms("from", name); |
| 7010 |
const transformationsTo = getBlockTransforms("to", sourceName); |
| 7011 |
const transformation = findTransform( |
| 7012 |
transformationsTo, |
| 7013 |
(t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) |
| 7014 |
) || findTransform( |
| 7015 |
transformationsFrom, |
| 7016 |
(t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray) |
| 7017 |
); |
| 7018 |
if (!transformation) { |
| 7019 |
return null; |
| 7020 |
} |
| 7021 |
let transformationResults; |
| 7022 |
if (transformation.isMultiBlock) { |
| 7023 |
if ("__experimentalConvert" in transformation) { |
| 7024 |
transformationResults = transformation.__experimentalConvert(blocksArray); |
| 7025 |
} else { |
| 7026 |
transformationResults = transformation.transform( |
| 7027 |
blocksArray.map((currentBlock) => currentBlock.attributes), |
| 7028 |
blocksArray.map((currentBlock) => currentBlock.innerBlocks) |
| 7029 |
); |
| 7030 |
} |
| 7031 |
} else if ("__experimentalConvert" in transformation) { |
| 7032 |
transformationResults = transformation.__experimentalConvert(firstBlock); |
| 7033 |
} else { |
| 7034 |
transformationResults = transformation.transform( |
| 7035 |
firstBlock.attributes, |
| 7036 |
firstBlock.innerBlocks |
| 7037 |
); |
| 7038 |
} |
| 7039 |
if (transformationResults === null || typeof transformationResults !== "object") { |
| 7040 |
return null; |
| 7041 |
} |
| 7042 |
transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults]; |
| 7043 |
if (transformationResults.some( |
| 7044 |
(result) => !getBlockType(result.name) |
| 7045 |
)) { |
| 7046 |
return null; |
| 7047 |
} |
| 7048 |
const hasSwitchedBlock = transformationResults.some( |
| 7049 |
(result) => result.name === name |
| 7050 |
); |
| 7051 |
if (!hasSwitchedBlock) { |
| 7052 |
return null; |
| 7053 |
} |
| 7054 |
const ret = transformationResults.map((result, index, results) => { |
| 7055 |
return (0, import_hooks2.applyFilters)( |
| 7056 |
"blocks.switchToBlockType.transformedBlock", |
| 7057 |
result, |
| 7058 |
blocks, |
| 7059 |
index, |
| 7060 |
results |
| 7061 |
); |
| 7062 |
}); |
| 7063 |
return ret; |
| 7064 |
} |
| 7065 |
var getBlockFromExample = (name, example) => createBlock( |
| 7066 |
name, |
| 7067 |
example.attributes, |
| 7068 |
(example.innerBlocks ?? []).map( |
| 7069 |
(innerBlock) => getBlockFromExample(innerBlock.name, innerBlock) |
| 7070 |
) |
| 7071 |
); |
| 7072 |
|
| 7073 |
// packages/blocks/build-module/api/parser/index.mjs |
| 7074 |
var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1); |
| 7075 |
var import_autop2 = __toESM(require_autop(), 1); |
| 7076 |
|
| 7077 |
// packages/blocks/build-module/api/serializer.mjs |
| 7078 |
var import_element2 = __toESM(require_element(), 1); |
| 7079 |
var import_hooks3 = __toESM(require_hooks(), 1); |
| 7080 |
var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); |
| 7081 |
var import_autop = __toESM(require_autop(), 1); |
| 7082 |
var import_deprecated6 = __toESM(require_deprecated(), 1); |
| 7083 |
|
| 7084 |
// packages/blocks/build-module/api/parser/serialize-raw-block.mjs |
| 7085 |
function serializeRawBlock(rawBlock, options = {}) { |
| 7086 |
const { isCommentDelimited = true } = options; |
| 7087 |
const { |
| 7088 |
blockName, |
| 7089 |
attrs = {}, |
| 7090 |
innerBlocks = [], |
| 7091 |
innerContent = [] |
| 7092 |
} = rawBlock; |
| 7093 |
let childIndex = 0; |
| 7094 |
const content = innerContent.map( |
| 7095 |
(item) => ( |
| 7096 |
// `null` denotes a nested block, otherwise we have an HTML fragment. |
| 7097 |
item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options) |
| 7098 |
) |
| 7099 |
).join("\n").replace(/\n+/g, "\n").trim(); |
| 7100 |
return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content; |
| 7101 |
} |
| 7102 |
|
| 7103 |
// packages/blocks/build-module/api/serializer.mjs |
| 7104 |
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 7105 |
function getBlockDefaultClassName(blockName) { |
| 7106 |
const className = "wp-block-" + blockName.replace(/\//, "-").replace(/^core-/, ""); |
| 7107 |
return (0, import_hooks3.applyFilters)( |
| 7108 |
"blocks.getBlockDefaultClassName", |
| 7109 |
className, |
| 7110 |
blockName |
| 7111 |
); |
| 7112 |
} |
| 7113 |
function getBlockMenuDefaultClassName(blockName) { |
| 7114 |
const className = "editor-block-list-item-" + blockName.replace(/\//, "-").replace(/^core-/, ""); |
| 7115 |
return (0, import_hooks3.applyFilters)( |
| 7116 |
"blocks.getBlockMenuDefaultClassName", |
| 7117 |
className, |
| 7118 |
blockName |
| 7119 |
); |
| 7120 |
} |
| 7121 |
var blockPropsProvider = {}; |
| 7122 |
var innerBlocksPropsProvider = {}; |
| 7123 |
function getBlockProps(props = {}) { |
| 7124 |
const { blockType, attributes } = blockPropsProvider; |
| 7125 |
return getBlockProps.skipFilters ? props : (0, import_hooks3.applyFilters)( |
| 7126 |
"blocks.getSaveContent.extraProps", |
| 7127 |
{ ...props }, |
| 7128 |
blockType, |
| 7129 |
attributes |
| 7130 |
); |
| 7131 |
} |
| 7132 |
function getInnerBlocksProps(props = {}) { |
| 7133 |
const { innerBlocks } = innerBlocksPropsProvider; |
| 7134 |
if (!Array.isArray(innerBlocks)) { |
| 7135 |
return { ...props, children: innerBlocks }; |
| 7136 |
} |
| 7137 |
const html2 = serialize(innerBlocks, { isInnerBlocks: true }); |
| 7138 |
const children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element2.RawHTML, { children: html2 }); |
| 7139 |
return { ...props, children }; |
| 7140 |
} |
| 7141 |
function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) { |
| 7142 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 7143 |
if (!blockType?.save) { |
| 7144 |
return null; |
| 7145 |
} |
| 7146 |
let { save } = blockType; |
| 7147 |
if (save.prototype instanceof import_element2.Component) { |
| 7148 |
const instance = new save({ attributes }); |
| 7149 |
save = instance.render.bind(instance); |
| 7150 |
} |
| 7151 |
blockPropsProvider.blockType = blockType; |
| 7152 |
blockPropsProvider.attributes = attributes; |
| 7153 |
innerBlocksPropsProvider.innerBlocks = innerBlocks; |
| 7154 |
let element = save({ attributes, innerBlocks }); |
| 7155 |
if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !(blockType.apiVersion > 1)) { |
| 7156 |
const props = (0, import_hooks3.applyFilters)( |
| 7157 |
"blocks.getSaveContent.extraProps", |
| 7158 |
{ ...element.props }, |
| 7159 |
blockType, |
| 7160 |
attributes |
| 7161 |
); |
| 7162 |
if (!(0, import_is_shallow_equal.isShallowEqual)(props, element.props)) { |
| 7163 |
element = (0, import_element2.cloneElement)(element, props); |
| 7164 |
} |
| 7165 |
} |
| 7166 |
return (0, import_hooks3.applyFilters)( |
| 7167 |
"blocks.getSaveElement", |
| 7168 |
element, |
| 7169 |
blockType, |
| 7170 |
attributes |
| 7171 |
); |
| 7172 |
} |
| 7173 |
function getSaveContent(blockTypeOrName, attributes, innerBlocks) { |
| 7174 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 7175 |
return (0, import_element2.renderToString)( |
| 7176 |
getSaveElement(blockType, attributes, innerBlocks) |
| 7177 |
); |
| 7178 |
} |
| 7179 |
function getCommentAttributes(blockType, attributes) { |
| 7180 |
return Object.entries(blockType.attributes ?? {}).reduce( |
| 7181 |
(accumulator, [key, attributeSchema]) => { |
| 7182 |
const value = attributes[key]; |
| 7183 |
if (void 0 === value) { |
| 7184 |
return accumulator; |
| 7185 |
} |
| 7186 |
if (attributeSchema.source !== void 0) { |
| 7187 |
return accumulator; |
| 7188 |
} |
| 7189 |
if (attributeSchema.role === "local") { |
| 7190 |
return accumulator; |
| 7191 |
} |
| 7192 |
if (attributeSchema.__experimentalRole === "local") { |
| 7193 |
(0, import_deprecated6.default)("__experimentalRole attribute", { |
| 7194 |
since: "6.7", |
| 7195 |
version: "6.8", |
| 7196 |
alternative: "role attribute", |
| 7197 |
hint: `Check the block.json of the ${blockType?.name} block.` |
| 7198 |
}); |
| 7199 |
return accumulator; |
| 7200 |
} |
| 7201 |
if ("default" in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) { |
| 7202 |
return accumulator; |
| 7203 |
} |
| 7204 |
accumulator[key] = value; |
| 7205 |
return accumulator; |
| 7206 |
}, |
| 7207 |
{} |
| 7208 |
); |
| 7209 |
} |
| 7210 |
function serializeAttributes(attributes) { |
| 7211 |
return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022"); |
| 7212 |
} |
| 7213 |
function getBlockInnerHTML(block) { |
| 7214 |
let saveContent = block.originalContent; |
| 7215 |
if (block.isValid || block.innerBlocks.length) { |
| 7216 |
try { |
| 7217 |
saveContent = getSaveContent( |
| 7218 |
block.name, |
| 7219 |
block.attributes, |
| 7220 |
block.innerBlocks |
| 7221 |
); |
| 7222 |
} catch (error) { |
| 7223 |
} |
| 7224 |
} |
| 7225 |
return saveContent; |
| 7226 |
} |
| 7227 |
function getCommentDelimitedContent(rawBlockName, attributes, content) { |
| 7228 |
const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + " " : ""; |
| 7229 |
const blockName = rawBlockName?.startsWith("core/") ? rawBlockName.slice(5) : rawBlockName; |
| 7230 |
if (!content) { |
| 7231 |
return `<!-- wp:${blockName} ${serializedAttributes}/-->`; |
| 7232 |
} |
| 7233 |
return `<!-- wp:${blockName} ${serializedAttributes}--> |
| 7234 |
` + content + ` |
| 7235 |
<!-- /wp:${blockName} -->`; |
| 7236 |
} |
| 7237 |
function serializeBlock(block, { isInnerBlocks = false } = {}) { |
| 7238 |
if (!block.isValid && block.__unstableBlockSource) { |
| 7239 |
return serializeRawBlock(block.__unstableBlockSource); |
| 7240 |
} |
| 7241 |
const blockName = block.name; |
| 7242 |
const saveContent = getBlockInnerHTML(block); |
| 7243 |
if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) { |
| 7244 |
return saveContent; |
| 7245 |
} |
| 7246 |
const blockType = getBlockType(blockName); |
| 7247 |
if (!blockType) { |
| 7248 |
return saveContent; |
| 7249 |
} |
| 7250 |
const saveAttributes = getCommentAttributes(blockType, block.attributes); |
| 7251 |
return getCommentDelimitedContent(blockName, saveAttributes, saveContent); |
| 7252 |
} |
| 7253 |
var __unstableSerializeAndClean = /* @__PURE__ */ (() => { |
| 7254 |
const cache = /* @__PURE__ */ new WeakMap(); |
| 7255 |
return (blocks) => { |
| 7256 |
const cached = cache.get(blocks); |
| 7257 |
if (cached !== void 0) { |
| 7258 |
return cached; |
| 7259 |
} |
| 7260 |
let effectiveBlocks = blocks; |
| 7261 |
if (effectiveBlocks.length === 1 && isUnmodifiedDefaultBlock(effectiveBlocks[0])) { |
| 7262 |
effectiveBlocks = []; |
| 7263 |
} |
| 7264 |
let content = serialize(effectiveBlocks); |
| 7265 |
if (effectiveBlocks.length === 1 && effectiveBlocks[0].name === getFreeformContentHandlerName() && effectiveBlocks[0].name === "core/freeform") { |
| 7266 |
content = (0, import_autop.removep)(content); |
| 7267 |
} |
| 7268 |
cache.set(blocks, content); |
| 7269 |
return content; |
| 7270 |
}; |
| 7271 |
})(); |
| 7272 |
function serialize(blocks, options) { |
| 7273 |
const blocksArray = Array.isArray(blocks) ? blocks : [blocks]; |
| 7274 |
return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n"); |
| 7275 |
} |
| 7276 |
|
| 7277 |
// node_modules/simple-html-tokenizer/dist/es6/index.js |
| 7278 |
var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/; |
| 7279 |
var CHARCODE = /^#([0-9]+)$/; |
| 7280 |
var NAMED = /^([A-Za-z0-9]+)$/; |
| 7281 |
var EntityParser = ( |
| 7282 |
/** @class */ |
| 7283 |
(function() { |
| 7284 |
function EntityParser2(named) { |
| 7285 |
this.named = named; |
| 7286 |
} |
| 7287 |
EntityParser2.prototype.parse = function(entity) { |
| 7288 |
if (!entity) { |
| 7289 |
return; |
| 7290 |
} |
| 7291 |
var matches = entity.match(HEXCHARCODE); |
| 7292 |
if (matches) { |
| 7293 |
return String.fromCharCode(parseInt(matches[1], 16)); |
| 7294 |
} |
| 7295 |
matches = entity.match(CHARCODE); |
| 7296 |
if (matches) { |
| 7297 |
return String.fromCharCode(parseInt(matches[1], 10)); |
| 7298 |
} |
| 7299 |
matches = entity.match(NAMED); |
| 7300 |
if (matches) { |
| 7301 |
return this.named[matches[1]]; |
| 7302 |
} |
| 7303 |
}; |
| 7304 |
return EntityParser2; |
| 7305 |
})() |
| 7306 |
); |
| 7307 |
var WSP = /[\t\n\f ]/; |
| 7308 |
var ALPHA = /[A-Za-z]/; |
| 7309 |
var CRLF = /\r\n?/g; |
| 7310 |
function isSpace(char) { |
| 7311 |
return WSP.test(char); |
| 7312 |
} |
| 7313 |
function isAlpha(char) { |
| 7314 |
return ALPHA.test(char); |
| 7315 |
} |
| 7316 |
function preprocessInput(input) { |
| 7317 |
return input.replace(CRLF, "\n"); |
| 7318 |
} |
| 7319 |
var EventedTokenizer = ( |
| 7320 |
/** @class */ |
| 7321 |
(function() { |
| 7322 |
function EventedTokenizer2(delegate, entityParser) { |
| 7323 |
this.delegate = delegate; |
| 7324 |
this.entityParser = entityParser; |
| 7325 |
this.state = "beforeData"; |
| 7326 |
this.line = -1; |
| 7327 |
this.column = -1; |
| 7328 |
this.input = ""; |
| 7329 |
this.index = -1; |
| 7330 |
this.tagNameBuffer = ""; |
| 7331 |
this.states = { |
| 7332 |
beforeData: function() { |
| 7333 |
var char = this.peek(); |
| 7334 |
if (char === "<") { |
| 7335 |
this.transitionTo( |
| 7336 |
"tagOpen" |
| 7337 |
/* tagOpen */ |
| 7338 |
); |
| 7339 |
this.markTagStart(); |
| 7340 |
this.consume(); |
| 7341 |
} else { |
| 7342 |
if (char === "\n") { |
| 7343 |
var tag = this.tagNameBuffer.toLowerCase(); |
| 7344 |
if (tag === "pre" || tag === "textarea") { |
| 7345 |
this.consume(); |
| 7346 |
} |
| 7347 |
} |
| 7348 |
this.transitionTo( |
| 7349 |
"data" |
| 7350 |
/* data */ |
| 7351 |
); |
| 7352 |
this.delegate.beginData(); |
| 7353 |
} |
| 7354 |
}, |
| 7355 |
data: function() { |
| 7356 |
var char = this.peek(); |
| 7357 |
if (char === "<") { |
| 7358 |
this.delegate.finishData(); |
| 7359 |
this.transitionTo( |
| 7360 |
"tagOpen" |
| 7361 |
/* tagOpen */ |
| 7362 |
); |
| 7363 |
this.markTagStart(); |
| 7364 |
this.consume(); |
| 7365 |
} else if (char === "&") { |
| 7366 |
this.consume(); |
| 7367 |
this.delegate.appendToData(this.consumeCharRef() || "&"); |
| 7368 |
} else { |
| 7369 |
this.consume(); |
| 7370 |
this.delegate.appendToData(char); |
| 7371 |
} |
| 7372 |
}, |
| 7373 |
tagOpen: function() { |
| 7374 |
var char = this.consume(); |
| 7375 |
if (char === "!") { |
| 7376 |
this.transitionTo( |
| 7377 |
"markupDeclarationOpen" |
| 7378 |
/* markupDeclarationOpen */ |
| 7379 |
); |
| 7380 |
} else if (char === "/") { |
| 7381 |
this.transitionTo( |
| 7382 |
"endTagOpen" |
| 7383 |
/* endTagOpen */ |
| 7384 |
); |
| 7385 |
} else if (char === "@" || char === ":" || isAlpha(char)) { |
| 7386 |
this.transitionTo( |
| 7387 |
"tagName" |
| 7388 |
/* tagName */ |
| 7389 |
); |
| 7390 |
this.tagNameBuffer = ""; |
| 7391 |
this.delegate.beginStartTag(); |
| 7392 |
this.appendToTagName(char); |
| 7393 |
} |
| 7394 |
}, |
| 7395 |
markupDeclarationOpen: function() { |
| 7396 |
var char = this.consume(); |
| 7397 |
if (char === "-" && this.input.charAt(this.index) === "-") { |
| 7398 |
this.consume(); |
| 7399 |
this.transitionTo( |
| 7400 |
"commentStart" |
| 7401 |
/* commentStart */ |
| 7402 |
); |
| 7403 |
this.delegate.beginComment(); |
| 7404 |
} |
| 7405 |
}, |
| 7406 |
commentStart: function() { |
| 7407 |
var char = this.consume(); |
| 7408 |
if (char === "-") { |
| 7409 |
this.transitionTo( |
| 7410 |
"commentStartDash" |
| 7411 |
/* commentStartDash */ |
| 7412 |
); |
| 7413 |
} else if (char === ">") { |
| 7414 |
this.delegate.finishComment(); |
| 7415 |
this.transitionTo( |
| 7416 |
"beforeData" |
| 7417 |
/* beforeData */ |
| 7418 |
); |
| 7419 |
} else { |
| 7420 |
this.delegate.appendToCommentData(char); |
| 7421 |
this.transitionTo( |
| 7422 |
"comment" |
| 7423 |
/* comment */ |
| 7424 |
); |
| 7425 |
} |
| 7426 |
}, |
| 7427 |
commentStartDash: function() { |
| 7428 |
var char = this.consume(); |
| 7429 |
if (char === "-") { |
| 7430 |
this.transitionTo( |
| 7431 |
"commentEnd" |
| 7432 |
/* commentEnd */ |
| 7433 |
); |
| 7434 |
} else if (char === ">") { |
| 7435 |
this.delegate.finishComment(); |
| 7436 |
this.transitionTo( |
| 7437 |
"beforeData" |
| 7438 |
/* beforeData */ |
| 7439 |
); |
| 7440 |
} else { |
| 7441 |
this.delegate.appendToCommentData("-"); |
| 7442 |
this.transitionTo( |
| 7443 |
"comment" |
| 7444 |
/* comment */ |
| 7445 |
); |
| 7446 |
} |
| 7447 |
}, |
| 7448 |
comment: function() { |
| 7449 |
var char = this.consume(); |
| 7450 |
if (char === "-") { |
| 7451 |
this.transitionTo( |
| 7452 |
"commentEndDash" |
| 7453 |
/* commentEndDash */ |
| 7454 |
); |
| 7455 |
} else { |
| 7456 |
this.delegate.appendToCommentData(char); |
| 7457 |
} |
| 7458 |
}, |
| 7459 |
commentEndDash: function() { |
| 7460 |
var char = this.consume(); |
| 7461 |
if (char === "-") { |
| 7462 |
this.transitionTo( |
| 7463 |
"commentEnd" |
| 7464 |
/* commentEnd */ |
| 7465 |
); |
| 7466 |
} else { |
| 7467 |
this.delegate.appendToCommentData("-" + char); |
| 7468 |
this.transitionTo( |
| 7469 |
"comment" |
| 7470 |
/* comment */ |
| 7471 |
); |
| 7472 |
} |
| 7473 |
}, |
| 7474 |
commentEnd: function() { |
| 7475 |
var char = this.consume(); |
| 7476 |
if (char === ">") { |
| 7477 |
this.delegate.finishComment(); |
| 7478 |
this.transitionTo( |
| 7479 |
"beforeData" |
| 7480 |
/* beforeData */ |
| 7481 |
); |
| 7482 |
} else { |
| 7483 |
this.delegate.appendToCommentData("--" + char); |
| 7484 |
this.transitionTo( |
| 7485 |
"comment" |
| 7486 |
/* comment */ |
| 7487 |
); |
| 7488 |
} |
| 7489 |
}, |
| 7490 |
tagName: function() { |
| 7491 |
var char = this.consume(); |
| 7492 |
if (isSpace(char)) { |
| 7493 |
this.transitionTo( |
| 7494 |
"beforeAttributeName" |
| 7495 |
/* beforeAttributeName */ |
| 7496 |
); |
| 7497 |
} else if (char === "/") { |
| 7498 |
this.transitionTo( |
| 7499 |
"selfClosingStartTag" |
| 7500 |
/* selfClosingStartTag */ |
| 7501 |
); |
| 7502 |
} else if (char === ">") { |
| 7503 |
this.delegate.finishTag(); |
| 7504 |
this.transitionTo( |
| 7505 |
"beforeData" |
| 7506 |
/* beforeData */ |
| 7507 |
); |
| 7508 |
} else { |
| 7509 |
this.appendToTagName(char); |
| 7510 |
} |
| 7511 |
}, |
| 7512 |
beforeAttributeName: function() { |
| 7513 |
var char = this.peek(); |
| 7514 |
if (isSpace(char)) { |
| 7515 |
this.consume(); |
| 7516 |
return; |
| 7517 |
} else if (char === "/") { |
| 7518 |
this.transitionTo( |
| 7519 |
"selfClosingStartTag" |
| 7520 |
/* selfClosingStartTag */ |
| 7521 |
); |
| 7522 |
this.consume(); |
| 7523 |
} else if (char === ">") { |
| 7524 |
this.consume(); |
| 7525 |
this.delegate.finishTag(); |
| 7526 |
this.transitionTo( |
| 7527 |
"beforeData" |
| 7528 |
/* beforeData */ |
| 7529 |
); |
| 7530 |
} else if (char === "=") { |
| 7531 |
this.delegate.reportSyntaxError("attribute name cannot start with equals sign"); |
| 7532 |
this.transitionTo( |
| 7533 |
"attributeName" |
| 7534 |
/* attributeName */ |
| 7535 |
); |
| 7536 |
this.delegate.beginAttribute(); |
| 7537 |
this.consume(); |
| 7538 |
this.delegate.appendToAttributeName(char); |
| 7539 |
} else { |
| 7540 |
this.transitionTo( |
| 7541 |
"attributeName" |
| 7542 |
/* attributeName */ |
| 7543 |
); |
| 7544 |
this.delegate.beginAttribute(); |
| 7545 |
} |
| 7546 |
}, |
| 7547 |
attributeName: function() { |
| 7548 |
var char = this.peek(); |
| 7549 |
if (isSpace(char)) { |
| 7550 |
this.transitionTo( |
| 7551 |
"afterAttributeName" |
| 7552 |
/* afterAttributeName */ |
| 7553 |
); |
| 7554 |
this.consume(); |
| 7555 |
} else if (char === "/") { |
| 7556 |
this.delegate.beginAttributeValue(false); |
| 7557 |
this.delegate.finishAttributeValue(); |
| 7558 |
this.consume(); |
| 7559 |
this.transitionTo( |
| 7560 |
"selfClosingStartTag" |
| 7561 |
/* selfClosingStartTag */ |
| 7562 |
); |
| 7563 |
} else if (char === "=") { |
| 7564 |
this.transitionTo( |
| 7565 |
"beforeAttributeValue" |
| 7566 |
/* beforeAttributeValue */ |
| 7567 |
); |
| 7568 |
this.consume(); |
| 7569 |
} else if (char === ">") { |
| 7570 |
this.delegate.beginAttributeValue(false); |
| 7571 |
this.delegate.finishAttributeValue(); |
| 7572 |
this.consume(); |
| 7573 |
this.delegate.finishTag(); |
| 7574 |
this.transitionTo( |
| 7575 |
"beforeData" |
| 7576 |
/* beforeData */ |
| 7577 |
); |
| 7578 |
} else if (char === '"' || char === "'" || char === "<") { |
| 7579 |
this.delegate.reportSyntaxError(char + " is not a valid character within attribute names"); |
| 7580 |
this.consume(); |
| 7581 |
this.delegate.appendToAttributeName(char); |
| 7582 |
} else { |
| 7583 |
this.consume(); |
| 7584 |
this.delegate.appendToAttributeName(char); |
| 7585 |
} |
| 7586 |
}, |
| 7587 |
afterAttributeName: function() { |
| 7588 |
var char = this.peek(); |
| 7589 |
if (isSpace(char)) { |
| 7590 |
this.consume(); |
| 7591 |
return; |
| 7592 |
} else if (char === "/") { |
| 7593 |
this.delegate.beginAttributeValue(false); |
| 7594 |
this.delegate.finishAttributeValue(); |
| 7595 |
this.consume(); |
| 7596 |
this.transitionTo( |
| 7597 |
"selfClosingStartTag" |
| 7598 |
/* selfClosingStartTag */ |
| 7599 |
); |
| 7600 |
} else if (char === "=") { |
| 7601 |
this.consume(); |
| 7602 |
this.transitionTo( |
| 7603 |
"beforeAttributeValue" |
| 7604 |
/* beforeAttributeValue */ |
| 7605 |
); |
| 7606 |
} else if (char === ">") { |
| 7607 |
this.delegate.beginAttributeValue(false); |
| 7608 |
this.delegate.finishAttributeValue(); |
| 7609 |
this.consume(); |
| 7610 |
this.delegate.finishTag(); |
| 7611 |
this.transitionTo( |
| 7612 |
"beforeData" |
| 7613 |
/* beforeData */ |
| 7614 |
); |
| 7615 |
} else { |
| 7616 |
this.delegate.beginAttributeValue(false); |
| 7617 |
this.delegate.finishAttributeValue(); |
| 7618 |
this.transitionTo( |
| 7619 |
"attributeName" |
| 7620 |
/* attributeName */ |
| 7621 |
); |
| 7622 |
this.delegate.beginAttribute(); |
| 7623 |
this.consume(); |
| 7624 |
this.delegate.appendToAttributeName(char); |
| 7625 |
} |
| 7626 |
}, |
| 7627 |
beforeAttributeValue: function() { |
| 7628 |
var char = this.peek(); |
| 7629 |
if (isSpace(char)) { |
| 7630 |
this.consume(); |
| 7631 |
} else if (char === '"') { |
| 7632 |
this.transitionTo( |
| 7633 |
"attributeValueDoubleQuoted" |
| 7634 |
/* attributeValueDoubleQuoted */ |
| 7635 |
); |
| 7636 |
this.delegate.beginAttributeValue(true); |
| 7637 |
this.consume(); |
| 7638 |
} else if (char === "'") { |
| 7639 |
this.transitionTo( |
| 7640 |
"attributeValueSingleQuoted" |
| 7641 |
/* attributeValueSingleQuoted */ |
| 7642 |
); |
| 7643 |
this.delegate.beginAttributeValue(true); |
| 7644 |
this.consume(); |
| 7645 |
} else if (char === ">") { |
| 7646 |
this.delegate.beginAttributeValue(false); |
| 7647 |
this.delegate.finishAttributeValue(); |
| 7648 |
this.consume(); |
| 7649 |
this.delegate.finishTag(); |
| 7650 |
this.transitionTo( |
| 7651 |
"beforeData" |
| 7652 |
/* beforeData */ |
| 7653 |
); |
| 7654 |
} else { |
| 7655 |
this.transitionTo( |
| 7656 |
"attributeValueUnquoted" |
| 7657 |
/* attributeValueUnquoted */ |
| 7658 |
); |
| 7659 |
this.delegate.beginAttributeValue(false); |
| 7660 |
this.consume(); |
| 7661 |
this.delegate.appendToAttributeValue(char); |
| 7662 |
} |
| 7663 |
}, |
| 7664 |
attributeValueDoubleQuoted: function() { |
| 7665 |
var char = this.consume(); |
| 7666 |
if (char === '"') { |
| 7667 |
this.delegate.finishAttributeValue(); |
| 7668 |
this.transitionTo( |
| 7669 |
"afterAttributeValueQuoted" |
| 7670 |
/* afterAttributeValueQuoted */ |
| 7671 |
); |
| 7672 |
} else if (char === "&") { |
| 7673 |
this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); |
| 7674 |
} else { |
| 7675 |
this.delegate.appendToAttributeValue(char); |
| 7676 |
} |
| 7677 |
}, |
| 7678 |
attributeValueSingleQuoted: function() { |
| 7679 |
var char = this.consume(); |
| 7680 |
if (char === "'") { |
| 7681 |
this.delegate.finishAttributeValue(); |
| 7682 |
this.transitionTo( |
| 7683 |
"afterAttributeValueQuoted" |
| 7684 |
/* afterAttributeValueQuoted */ |
| 7685 |
); |
| 7686 |
} else if (char === "&") { |
| 7687 |
this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); |
| 7688 |
} else { |
| 7689 |
this.delegate.appendToAttributeValue(char); |
| 7690 |
} |
| 7691 |
}, |
| 7692 |
attributeValueUnquoted: function() { |
| 7693 |
var char = this.peek(); |
| 7694 |
if (isSpace(char)) { |
| 7695 |
this.delegate.finishAttributeValue(); |
| 7696 |
this.consume(); |
| 7697 |
this.transitionTo( |
| 7698 |
"beforeAttributeName" |
| 7699 |
/* beforeAttributeName */ |
| 7700 |
); |
| 7701 |
} else if (char === "/") { |
| 7702 |
this.delegate.finishAttributeValue(); |
| 7703 |
this.consume(); |
| 7704 |
this.transitionTo( |
| 7705 |
"selfClosingStartTag" |
| 7706 |
/* selfClosingStartTag */ |
| 7707 |
); |
| 7708 |
} else if (char === "&") { |
| 7709 |
this.consume(); |
| 7710 |
this.delegate.appendToAttributeValue(this.consumeCharRef() || "&"); |
| 7711 |
} else if (char === ">") { |
| 7712 |
this.delegate.finishAttributeValue(); |
| 7713 |
this.consume(); |
| 7714 |
this.delegate.finishTag(); |
| 7715 |
this.transitionTo( |
| 7716 |
"beforeData" |
| 7717 |
/* beforeData */ |
| 7718 |
); |
| 7719 |
} else { |
| 7720 |
this.consume(); |
| 7721 |
this.delegate.appendToAttributeValue(char); |
| 7722 |
} |
| 7723 |
}, |
| 7724 |
afterAttributeValueQuoted: function() { |
| 7725 |
var char = this.peek(); |
| 7726 |
if (isSpace(char)) { |
| 7727 |
this.consume(); |
| 7728 |
this.transitionTo( |
| 7729 |
"beforeAttributeName" |
| 7730 |
/* beforeAttributeName */ |
| 7731 |
); |
| 7732 |
} else if (char === "/") { |
| 7733 |
this.consume(); |
| 7734 |
this.transitionTo( |
| 7735 |
"selfClosingStartTag" |
| 7736 |
/* selfClosingStartTag */ |
| 7737 |
); |
| 7738 |
} else if (char === ">") { |
| 7739 |
this.consume(); |
| 7740 |
this.delegate.finishTag(); |
| 7741 |
this.transitionTo( |
| 7742 |
"beforeData" |
| 7743 |
/* beforeData */ |
| 7744 |
); |
| 7745 |
} else { |
| 7746 |
this.transitionTo( |
| 7747 |
"beforeAttributeName" |
| 7748 |
/* beforeAttributeName */ |
| 7749 |
); |
| 7750 |
} |
| 7751 |
}, |
| 7752 |
selfClosingStartTag: function() { |
| 7753 |
var char = this.peek(); |
| 7754 |
if (char === ">") { |
| 7755 |
this.consume(); |
| 7756 |
this.delegate.markTagAsSelfClosing(); |
| 7757 |
this.delegate.finishTag(); |
| 7758 |
this.transitionTo( |
| 7759 |
"beforeData" |
| 7760 |
/* beforeData */ |
| 7761 |
); |
| 7762 |
} else { |
| 7763 |
this.transitionTo( |
| 7764 |
"beforeAttributeName" |
| 7765 |
/* beforeAttributeName */ |
| 7766 |
); |
| 7767 |
} |
| 7768 |
}, |
| 7769 |
endTagOpen: function() { |
| 7770 |
var char = this.consume(); |
| 7771 |
if (char === "@" || char === ":" || isAlpha(char)) { |
| 7772 |
this.transitionTo( |
| 7773 |
"tagName" |
| 7774 |
/* tagName */ |
| 7775 |
); |
| 7776 |
this.tagNameBuffer = ""; |
| 7777 |
this.delegate.beginEndTag(); |
| 7778 |
this.appendToTagName(char); |
| 7779 |
} |
| 7780 |
} |
| 7781 |
}; |
| 7782 |
this.reset(); |
| 7783 |
} |
| 7784 |
EventedTokenizer2.prototype.reset = function() { |
| 7785 |
this.transitionTo( |
| 7786 |
"beforeData" |
| 7787 |
/* beforeData */ |
| 7788 |
); |
| 7789 |
this.input = ""; |
| 7790 |
this.index = 0; |
| 7791 |
this.line = 1; |
| 7792 |
this.column = 0; |
| 7793 |
this.delegate.reset(); |
| 7794 |
}; |
| 7795 |
EventedTokenizer2.prototype.transitionTo = function(state) { |
| 7796 |
this.state = state; |
| 7797 |
}; |
| 7798 |
EventedTokenizer2.prototype.tokenize = function(input) { |
| 7799 |
this.reset(); |
| 7800 |
this.tokenizePart(input); |
| 7801 |
this.tokenizeEOF(); |
| 7802 |
}; |
| 7803 |
EventedTokenizer2.prototype.tokenizePart = function(input) { |
| 7804 |
this.input += preprocessInput(input); |
| 7805 |
while (this.index < this.input.length) { |
| 7806 |
var handler = this.states[this.state]; |
| 7807 |
if (handler !== void 0) { |
| 7808 |
handler.call(this); |
| 7809 |
} else { |
| 7810 |
throw new Error("unhandled state " + this.state); |
| 7811 |
} |
| 7812 |
} |
| 7813 |
}; |
| 7814 |
EventedTokenizer2.prototype.tokenizeEOF = function() { |
| 7815 |
this.flushData(); |
| 7816 |
}; |
| 7817 |
EventedTokenizer2.prototype.flushData = function() { |
| 7818 |
if (this.state === "data") { |
| 7819 |
this.delegate.finishData(); |
| 7820 |
this.transitionTo( |
| 7821 |
"beforeData" |
| 7822 |
/* beforeData */ |
| 7823 |
); |
| 7824 |
} |
| 7825 |
}; |
| 7826 |
EventedTokenizer2.prototype.peek = function() { |
| 7827 |
return this.input.charAt(this.index); |
| 7828 |
}; |
| 7829 |
EventedTokenizer2.prototype.consume = function() { |
| 7830 |
var char = this.peek(); |
| 7831 |
this.index++; |
| 7832 |
if (char === "\n") { |
| 7833 |
this.line++; |
| 7834 |
this.column = 0; |
| 7835 |
} else { |
| 7836 |
this.column++; |
| 7837 |
} |
| 7838 |
return char; |
| 7839 |
}; |
| 7840 |
EventedTokenizer2.prototype.consumeCharRef = function() { |
| 7841 |
var endIndex = this.input.indexOf(";", this.index); |
| 7842 |
if (endIndex === -1) { |
| 7843 |
return; |
| 7844 |
} |
| 7845 |
var entity = this.input.slice(this.index, endIndex); |
| 7846 |
var chars = this.entityParser.parse(entity); |
| 7847 |
if (chars) { |
| 7848 |
var count = entity.length; |
| 7849 |
while (count) { |
| 7850 |
this.consume(); |
| 7851 |
count--; |
| 7852 |
} |
| 7853 |
this.consume(); |
| 7854 |
return chars; |
| 7855 |
} |
| 7856 |
}; |
| 7857 |
EventedTokenizer2.prototype.markTagStart = function() { |
| 7858 |
this.delegate.tagOpen(); |
| 7859 |
}; |
| 7860 |
EventedTokenizer2.prototype.appendToTagName = function(char) { |
| 7861 |
this.tagNameBuffer += char; |
| 7862 |
this.delegate.appendToTagName(char); |
| 7863 |
}; |
| 7864 |
return EventedTokenizer2; |
| 7865 |
})() |
| 7866 |
); |
| 7867 |
var Tokenizer = ( |
| 7868 |
/** @class */ |
| 7869 |
(function() { |
| 7870 |
function Tokenizer2(entityParser, options) { |
| 7871 |
if (options === void 0) { |
| 7872 |
options = {}; |
| 7873 |
} |
| 7874 |
this.options = options; |
| 7875 |
this.token = null; |
| 7876 |
this.startLine = 1; |
| 7877 |
this.startColumn = 0; |
| 7878 |
this.tokens = []; |
| 7879 |
this.tokenizer = new EventedTokenizer(this, entityParser); |
| 7880 |
this._currentAttribute = void 0; |
| 7881 |
} |
| 7882 |
Tokenizer2.prototype.tokenize = function(input) { |
| 7883 |
this.tokens = []; |
| 7884 |
this.tokenizer.tokenize(input); |
| 7885 |
return this.tokens; |
| 7886 |
}; |
| 7887 |
Tokenizer2.prototype.tokenizePart = function(input) { |
| 7888 |
this.tokens = []; |
| 7889 |
this.tokenizer.tokenizePart(input); |
| 7890 |
return this.tokens; |
| 7891 |
}; |
| 7892 |
Tokenizer2.prototype.tokenizeEOF = function() { |
| 7893 |
this.tokens = []; |
| 7894 |
this.tokenizer.tokenizeEOF(); |
| 7895 |
return this.tokens[0]; |
| 7896 |
}; |
| 7897 |
Tokenizer2.prototype.reset = function() { |
| 7898 |
this.token = null; |
| 7899 |
this.startLine = 1; |
| 7900 |
this.startColumn = 0; |
| 7901 |
}; |
| 7902 |
Tokenizer2.prototype.current = function() { |
| 7903 |
var token = this.token; |
| 7904 |
if (token === null) { |
| 7905 |
throw new Error("token was unexpectedly null"); |
| 7906 |
} |
| 7907 |
if (arguments.length === 0) { |
| 7908 |
return token; |
| 7909 |
} |
| 7910 |
for (var i2 = 0; i2 < arguments.length; i2++) { |
| 7911 |
if (token.type === arguments[i2]) { |
| 7912 |
return token; |
| 7913 |
} |
| 7914 |
} |
| 7915 |
throw new Error("token type was unexpectedly " + token.type); |
| 7916 |
}; |
| 7917 |
Tokenizer2.prototype.push = function(token) { |
| 7918 |
this.token = token; |
| 7919 |
this.tokens.push(token); |
| 7920 |
}; |
| 7921 |
Tokenizer2.prototype.currentAttribute = function() { |
| 7922 |
return this._currentAttribute; |
| 7923 |
}; |
| 7924 |
Tokenizer2.prototype.addLocInfo = function() { |
| 7925 |
if (this.options.loc) { |
| 7926 |
this.current().loc = { |
| 7927 |
start: { |
| 7928 |
line: this.startLine, |
| 7929 |
column: this.startColumn |
| 7930 |
}, |
| 7931 |
end: { |
| 7932 |
line: this.tokenizer.line, |
| 7933 |
column: this.tokenizer.column |
| 7934 |
} |
| 7935 |
}; |
| 7936 |
} |
| 7937 |
this.startLine = this.tokenizer.line; |
| 7938 |
this.startColumn = this.tokenizer.column; |
| 7939 |
}; |
| 7940 |
Tokenizer2.prototype.beginData = function() { |
| 7941 |
this.push({ |
| 7942 |
type: "Chars", |
| 7943 |
chars: "" |
| 7944 |
}); |
| 7945 |
}; |
| 7946 |
Tokenizer2.prototype.appendToData = function(char) { |
| 7947 |
this.current( |
| 7948 |
"Chars" |
| 7949 |
/* Chars */ |
| 7950 |
).chars += char; |
| 7951 |
}; |
| 7952 |
Tokenizer2.prototype.finishData = function() { |
| 7953 |
this.addLocInfo(); |
| 7954 |
}; |
| 7955 |
Tokenizer2.prototype.beginComment = function() { |
| 7956 |
this.push({ |
| 7957 |
type: "Comment", |
| 7958 |
chars: "" |
| 7959 |
}); |
| 7960 |
}; |
| 7961 |
Tokenizer2.prototype.appendToCommentData = function(char) { |
| 7962 |
this.current( |
| 7963 |
"Comment" |
| 7964 |
/* Comment */ |
| 7965 |
).chars += char; |
| 7966 |
}; |
| 7967 |
Tokenizer2.prototype.finishComment = function() { |
| 7968 |
this.addLocInfo(); |
| 7969 |
}; |
| 7970 |
Tokenizer2.prototype.tagOpen = function() { |
| 7971 |
}; |
| 7972 |
Tokenizer2.prototype.beginStartTag = function() { |
| 7973 |
this.push({ |
| 7974 |
type: "StartTag", |
| 7975 |
tagName: "", |
| 7976 |
attributes: [], |
| 7977 |
selfClosing: false |
| 7978 |
}); |
| 7979 |
}; |
| 7980 |
Tokenizer2.prototype.beginEndTag = function() { |
| 7981 |
this.push({ |
| 7982 |
type: "EndTag", |
| 7983 |
tagName: "" |
| 7984 |
}); |
| 7985 |
}; |
| 7986 |
Tokenizer2.prototype.finishTag = function() { |
| 7987 |
this.addLocInfo(); |
| 7988 |
}; |
| 7989 |
Tokenizer2.prototype.markTagAsSelfClosing = function() { |
| 7990 |
this.current( |
| 7991 |
"StartTag" |
| 7992 |
/* StartTag */ |
| 7993 |
).selfClosing = true; |
| 7994 |
}; |
| 7995 |
Tokenizer2.prototype.appendToTagName = function(char) { |
| 7996 |
this.current( |
| 7997 |
"StartTag", |
| 7998 |
"EndTag" |
| 7999 |
/* EndTag */ |
| 8000 |
).tagName += char; |
| 8001 |
}; |
| 8002 |
Tokenizer2.prototype.beginAttribute = function() { |
| 8003 |
this._currentAttribute = ["", "", false]; |
| 8004 |
}; |
| 8005 |
Tokenizer2.prototype.appendToAttributeName = function(char) { |
| 8006 |
this.currentAttribute()[0] += char; |
| 8007 |
}; |
| 8008 |
Tokenizer2.prototype.beginAttributeValue = function(isQuoted) { |
| 8009 |
this.currentAttribute()[2] = isQuoted; |
| 8010 |
}; |
| 8011 |
Tokenizer2.prototype.appendToAttributeValue = function(char) { |
| 8012 |
this.currentAttribute()[1] += char; |
| 8013 |
}; |
| 8014 |
Tokenizer2.prototype.finishAttributeValue = function() { |
| 8015 |
this.current( |
| 8016 |
"StartTag" |
| 8017 |
/* StartTag */ |
| 8018 |
).attributes.push(this._currentAttribute); |
| 8019 |
}; |
| 8020 |
Tokenizer2.prototype.reportSyntaxError = function(message) { |
| 8021 |
this.current().syntaxError = message; |
| 8022 |
}; |
| 8023 |
return Tokenizer2; |
| 8024 |
})() |
| 8025 |
); |
| 8026 |
|
| 8027 |
// packages/blocks/build-module/api/validation/index.mjs |
| 8028 |
var import_es6 = __toESM(require_es6(), 1); |
| 8029 |
var import_deprecated7 = __toESM(require_deprecated(), 1); |
| 8030 |
var import_html_entities = __toESM(require_html_entities(), 1); |
| 8031 |
|
| 8032 |
// packages/blocks/build-module/api/validation/logger.mjs |
| 8033 |
function createLogger() { |
| 8034 |
function createLogHandler(logger) { |
| 8035 |
return (message, ...args) => logger("Block validation: " + message, ...args); |
| 8036 |
} |
| 8037 |
return { |
| 8038 |
// eslint-disable-next-line no-console |
| 8039 |
error: createLogHandler(console.error), |
| 8040 |
// eslint-disable-next-line no-console |
| 8041 |
warning: createLogHandler(console.warn), |
| 8042 |
getItems() { |
| 8043 |
return []; |
| 8044 |
} |
| 8045 |
}; |
| 8046 |
} |
| 8047 |
function createQueuedLogger() { |
| 8048 |
const queue = []; |
| 8049 |
const logger = createLogger(); |
| 8050 |
return { |
| 8051 |
error(...args) { |
| 8052 |
queue.push({ log: logger.error, args }); |
| 8053 |
}, |
| 8054 |
warning(...args) { |
| 8055 |
queue.push({ log: logger.warning, args }); |
| 8056 |
}, |
| 8057 |
getItems() { |
| 8058 |
return queue; |
| 8059 |
} |
| 8060 |
}; |
| 8061 |
} |
| 8062 |
|
| 8063 |
// packages/blocks/build-module/api/validation/index.mjs |
| 8064 |
var identity = (x2) => x2; |
| 8065 |
var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g; |
| 8066 |
var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/; |
| 8067 |
var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/; |
| 8068 |
var BOOLEAN_ATTRIBUTES = [ |
| 8069 |
"allowfullscreen", |
| 8070 |
"allowpaymentrequest", |
| 8071 |
"allowusermedia", |
| 8072 |
"async", |
| 8073 |
"autofocus", |
| 8074 |
"autoplay", |
| 8075 |
"checked", |
| 8076 |
"controls", |
| 8077 |
"default", |
| 8078 |
"defer", |
| 8079 |
"disabled", |
| 8080 |
"download", |
| 8081 |
"formnovalidate", |
| 8082 |
"hidden", |
| 8083 |
"ismap", |
| 8084 |
"itemscope", |
| 8085 |
"loop", |
| 8086 |
"multiple", |
| 8087 |
"muted", |
| 8088 |
"nomodule", |
| 8089 |
"novalidate", |
| 8090 |
"open", |
| 8091 |
"playsinline", |
| 8092 |
"readonly", |
| 8093 |
"required", |
| 8094 |
"reversed", |
| 8095 |
"selected", |
| 8096 |
"typemustmatch" |
| 8097 |
]; |
| 8098 |
var ENUMERATED_ATTRIBUTES = [ |
| 8099 |
"autocapitalize", |
| 8100 |
"autocomplete", |
| 8101 |
"charset", |
| 8102 |
"contenteditable", |
| 8103 |
"crossorigin", |
| 8104 |
"decoding", |
| 8105 |
"dir", |
| 8106 |
"draggable", |
| 8107 |
"enctype", |
| 8108 |
"formenctype", |
| 8109 |
"formmethod", |
| 8110 |
"http-equiv", |
| 8111 |
"inputmode", |
| 8112 |
"kind", |
| 8113 |
"method", |
| 8114 |
"preload", |
| 8115 |
"scope", |
| 8116 |
"shape", |
| 8117 |
"spellcheck", |
| 8118 |
"translate", |
| 8119 |
"type", |
| 8120 |
"wrap" |
| 8121 |
]; |
| 8122 |
var MEANINGFUL_ATTRIBUTES = [ |
| 8123 |
...BOOLEAN_ATTRIBUTES, |
| 8124 |
...ENUMERATED_ATTRIBUTES |
| 8125 |
]; |
| 8126 |
var TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace]; |
| 8127 |
var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i; |
| 8128 |
var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/; |
| 8129 |
var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i; |
| 8130 |
function isValidCharacterReference(text2) { |
| 8131 |
return REGEXP_NAMED_CHARACTER_REFERENCE.test(text2) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text2) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text2); |
| 8132 |
} |
| 8133 |
var DecodeEntityParser = class { |
| 8134 |
/** |
| 8135 |
* Returns a substitute string for an entity string sequence between `&` |
| 8136 |
* and `;`, or undefined if no substitution should occur. |
| 8137 |
* |
| 8138 |
* @param {string} entity Entity fragment discovered in HTML. |
| 8139 |
* |
| 8140 |
* @return {string | undefined} Entity substitute value. |
| 8141 |
*/ |
| 8142 |
parse(entity) { |
| 8143 |
if (isValidCharacterReference(entity)) { |
| 8144 |
return (0, import_html_entities.decodeEntities)("&" + entity + ";"); |
| 8145 |
} |
| 8146 |
} |
| 8147 |
}; |
| 8148 |
function getTextPiecesSplitOnWhitespace(text2) { |
| 8149 |
return text2.trim().split(REGEXP_WHITESPACE); |
| 8150 |
} |
| 8151 |
function getTextWithCollapsedWhitespace(text2) { |
| 8152 |
return getTextPiecesSplitOnWhitespace(text2).join(" "); |
| 8153 |
} |
| 8154 |
function getMeaningfulAttributePairs(token) { |
| 8155 |
return token.attributes.filter((pair) => { |
| 8156 |
const [key, value] = pair; |
| 8157 |
return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key); |
| 8158 |
}); |
| 8159 |
} |
| 8160 |
function isEquivalentTextTokens(actual, expected, logger = createLogger()) { |
| 8161 |
let actualChars = actual.chars; |
| 8162 |
let expectedChars = expected.chars; |
| 8163 |
for (let i2 = 0; i2 < TEXT_NORMALIZATIONS.length; i2++) { |
| 8164 |
const normalize = TEXT_NORMALIZATIONS[i2]; |
| 8165 |
actualChars = normalize(actualChars); |
| 8166 |
expectedChars = normalize(expectedChars); |
| 8167 |
if (actualChars === expectedChars) { |
| 8168 |
return true; |
| 8169 |
} |
| 8170 |
} |
| 8171 |
logger.warning( |
| 8172 |
"Expected text `%s`, saw `%s`.", |
| 8173 |
expected.chars, |
| 8174 |
actual.chars |
| 8175 |
); |
| 8176 |
return false; |
| 8177 |
} |
| 8178 |
function getNormalizedLength(value) { |
| 8179 |
if (0 === parseFloat(value)) { |
| 8180 |
return "0"; |
| 8181 |
} |
| 8182 |
if (value.indexOf(".") === 0) { |
| 8183 |
return "0" + value; |
| 8184 |
} |
| 8185 |
return value; |
| 8186 |
} |
| 8187 |
function getNormalizedStyleValue(value) { |
| 8188 |
const textPieces = getTextPiecesSplitOnWhitespace(value); |
| 8189 |
const normalizedPieces = textPieces.map(getNormalizedLength); |
| 8190 |
const result = normalizedPieces.join(" "); |
| 8191 |
return result.replace(REGEXP_STYLE_URL_TYPE, "url($1)"); |
| 8192 |
} |
| 8193 |
function getStyleProperties(text2) { |
| 8194 |
const pairs = text2.replace(/;?\s*$/, "").split(";").map((style) => { |
| 8195 |
const [key, ...valueParts] = style.split(":"); |
| 8196 |
const value = valueParts.join(":"); |
| 8197 |
return [key.trim(), getNormalizedStyleValue(value.trim())]; |
| 8198 |
}); |
| 8199 |
return Object.fromEntries(pairs); |
| 8200 |
} |
| 8201 |
var isEqualAttributesOfName = { |
| 8202 |
class: (actual, expected) => { |
| 8203 |
const [actualPieces, expectedPieces] = [actual, expected].map( |
| 8204 |
getTextPiecesSplitOnWhitespace |
| 8205 |
); |
| 8206 |
const actualDiff = actualPieces.filter( |
| 8207 |
(c2) => !expectedPieces.includes(c2) |
| 8208 |
); |
| 8209 |
const expectedDiff = expectedPieces.filter( |
| 8210 |
(c2) => !actualPieces.includes(c2) |
| 8211 |
); |
| 8212 |
return actualDiff.length === 0 && expectedDiff.length === 0; |
| 8213 |
}, |
| 8214 |
style: (actual, expected) => { |
| 8215 |
return (0, import_es6.default)( |
| 8216 |
...[actual, expected].map(getStyleProperties) |
| 8217 |
); |
| 8218 |
}, |
| 8219 |
// For each boolean attribute, mere presence of attribute in both is enough |
| 8220 |
// to assume equivalence. |
| 8221 |
...Object.fromEntries( |
| 8222 |
BOOLEAN_ATTRIBUTES.map((attribute) => [attribute, () => true]) |
| 8223 |
) |
| 8224 |
}; |
| 8225 |
function isEqualTagAttributePairs(actual, expected, logger = createLogger()) { |
| 8226 |
if (actual.length !== expected.length) { |
| 8227 |
logger.warning( |
| 8228 |
"Expected attributes %o, instead saw %o.", |
| 8229 |
expected, |
| 8230 |
actual |
| 8231 |
); |
| 8232 |
return false; |
| 8233 |
} |
| 8234 |
const expectedAttributes = {}; |
| 8235 |
for (let i2 = 0; i2 < expected.length; i2++) { |
| 8236 |
expectedAttributes[expected[i2][0].toLowerCase()] = expected[i2][1]; |
| 8237 |
} |
| 8238 |
for (let i2 = 0; i2 < actual.length; i2++) { |
| 8239 |
const [name, actualValue] = actual[i2]; |
| 8240 |
const nameLower = name.toLowerCase(); |
| 8241 |
if (!expectedAttributes.hasOwnProperty(nameLower)) { |
| 8242 |
logger.warning("Encountered unexpected attribute `%s`.", name); |
| 8243 |
return false; |
| 8244 |
} |
| 8245 |
const expectedValue = expectedAttributes[nameLower]; |
| 8246 |
const isEqualAttributes = isEqualAttributesOfName[nameLower]; |
| 8247 |
if (isEqualAttributes) { |
| 8248 |
if (!isEqualAttributes(actualValue, expectedValue)) { |
| 8249 |
logger.warning( |
| 8250 |
"Expected attribute `%s` of value `%s`, saw `%s`.", |
| 8251 |
name, |
| 8252 |
expectedValue, |
| 8253 |
actualValue |
| 8254 |
); |
| 8255 |
return false; |
| 8256 |
} |
| 8257 |
} else if (actualValue !== expectedValue) { |
| 8258 |
logger.warning( |
| 8259 |
"Expected attribute `%s` of value `%s`, saw `%s`.", |
| 8260 |
name, |
| 8261 |
expectedValue, |
| 8262 |
actualValue |
| 8263 |
); |
| 8264 |
return false; |
| 8265 |
} |
| 8266 |
} |
| 8267 |
return true; |
| 8268 |
} |
| 8269 |
var isEqualTokensOfType = { |
| 8270 |
StartTag: (actual, expected, logger = createLogger()) => { |
| 8271 |
if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case- |
| 8272 |
// insensitive check on the assumption that the majority case will |
| 8273 |
// have exactly equal tag names. |
| 8274 |
actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) { |
| 8275 |
logger.warning( |
| 8276 |
"Expected tag name `%s`, instead saw `%s`.", |
| 8277 |
expected.tagName, |
| 8278 |
actual.tagName |
| 8279 |
); |
| 8280 |
return false; |
| 8281 |
} |
| 8282 |
return isEqualTagAttributePairs( |
| 8283 |
...[actual, expected].map(getMeaningfulAttributePairs), |
| 8284 |
logger |
| 8285 |
); |
| 8286 |
}, |
| 8287 |
Chars: isEquivalentTextTokens, |
| 8288 |
Comment: isEquivalentTextTokens |
| 8289 |
}; |
| 8290 |
function getNextNonWhitespaceToken(tokens) { |
| 8291 |
let token; |
| 8292 |
while (token = tokens.shift()) { |
| 8293 |
if (token.type !== "Chars") { |
| 8294 |
return token; |
| 8295 |
} |
| 8296 |
if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) { |
| 8297 |
return token; |
| 8298 |
} |
| 8299 |
} |
| 8300 |
} |
| 8301 |
function getHTMLTokens(html2, logger = createLogger()) { |
| 8302 |
try { |
| 8303 |
return new Tokenizer(new DecodeEntityParser()).tokenize(html2); |
| 8304 |
} catch (e2) { |
| 8305 |
logger.warning("Malformed HTML detected: %s", html2); |
| 8306 |
} |
| 8307 |
return null; |
| 8308 |
} |
| 8309 |
function isClosedByToken(currentToken, nextToken) { |
| 8310 |
if (!currentToken.selfClosing) { |
| 8311 |
return false; |
| 8312 |
} |
| 8313 |
if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === "EndTag") { |
| 8314 |
return true; |
| 8315 |
} |
| 8316 |
return false; |
| 8317 |
} |
| 8318 |
function isEquivalentHTML(actual, expected, logger = createLogger()) { |
| 8319 |
if (actual === expected) { |
| 8320 |
return true; |
| 8321 |
} |
| 8322 |
const [actualTokens, expectedTokens] = [actual, expected].map( |
| 8323 |
(html2) => getHTMLTokens(html2, logger) |
| 8324 |
); |
| 8325 |
if (!actualTokens || !expectedTokens) { |
| 8326 |
return false; |
| 8327 |
} |
| 8328 |
let actualToken, expectedToken; |
| 8329 |
while (actualToken = getNextNonWhitespaceToken(actualTokens)) { |
| 8330 |
expectedToken = getNextNonWhitespaceToken(expectedTokens); |
| 8331 |
if (!expectedToken) { |
| 8332 |
logger.warning( |
| 8333 |
"Expected end of content, instead saw %o.", |
| 8334 |
actualToken |
| 8335 |
); |
| 8336 |
return false; |
| 8337 |
} |
| 8338 |
if (actualToken.type !== expectedToken.type) { |
| 8339 |
logger.warning( |
| 8340 |
"Expected token of type `%s` (%o), instead saw `%s` (%o).", |
| 8341 |
expectedToken.type, |
| 8342 |
expectedToken, |
| 8343 |
actualToken.type, |
| 8344 |
actualToken |
| 8345 |
); |
| 8346 |
return false; |
| 8347 |
} |
| 8348 |
const isEqualTokens = isEqualTokensOfType[actualToken.type]; |
| 8349 |
if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) { |
| 8350 |
return false; |
| 8351 |
} |
| 8352 |
if (isClosedByToken(actualToken, expectedTokens[0])) { |
| 8353 |
getNextNonWhitespaceToken(expectedTokens); |
| 8354 |
} else if (isClosedByToken(expectedToken, actualTokens[0])) { |
| 8355 |
getNextNonWhitespaceToken(actualTokens); |
| 8356 |
} |
| 8357 |
} |
| 8358 |
if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) { |
| 8359 |
logger.warning( |
| 8360 |
"Expected %o, instead saw end of content.", |
| 8361 |
expectedToken |
| 8362 |
); |
| 8363 |
return false; |
| 8364 |
} |
| 8365 |
return true; |
| 8366 |
} |
| 8367 |
function validateBlock(block, blockTypeOrName = block.name) { |
| 8368 |
const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName(); |
| 8369 |
if (isFallbackBlock) { |
| 8370 |
return [true, []]; |
| 8371 |
} |
| 8372 |
const logger = createQueuedLogger(); |
| 8373 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 8374 |
let generatedBlockContent; |
| 8375 |
try { |
| 8376 |
generatedBlockContent = getSaveContent(blockType, block.attributes); |
| 8377 |
} catch (error) { |
| 8378 |
logger.error( |
| 8379 |
"Block validation failed because an error occurred while generating block content:\n\n%s", |
| 8380 |
error.toString() |
| 8381 |
); |
| 8382 |
return [false, logger.getItems()]; |
| 8383 |
} |
| 8384 |
const isValid = isEquivalentHTML( |
| 8385 |
block.originalContent, |
| 8386 |
generatedBlockContent, |
| 8387 |
logger |
| 8388 |
); |
| 8389 |
if (!isValid) { |
| 8390 |
logger.error( |
| 8391 |
"Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s", |
| 8392 |
blockType.name, |
| 8393 |
blockType, |
| 8394 |
generatedBlockContent, |
| 8395 |
block.originalContent |
| 8396 |
); |
| 8397 |
} |
| 8398 |
return [isValid, logger.getItems()]; |
| 8399 |
} |
| 8400 |
function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) { |
| 8401 |
(0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", { |
| 8402 |
since: "12.6", |
| 8403 |
plugin: "Gutenberg", |
| 8404 |
alternative: "validateBlock" |
| 8405 |
}); |
| 8406 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 8407 |
const block = { |
| 8408 |
name: blockType.name, |
| 8409 |
attributes, |
| 8410 |
innerBlocks: [], |
| 8411 |
originalContent: originalBlockContent |
| 8412 |
}; |
| 8413 |
const [isValid] = validateBlock(block, blockType); |
| 8414 |
return isValid; |
| 8415 |
} |
| 8416 |
|
| 8417 |
// packages/blocks/build-module/api/parser/convert-legacy-block.mjs |
| 8418 |
function convertLegacyBlockNameAndAttributes(name, attributes) { |
| 8419 |
const newAttributes = { ...attributes }; |
| 8420 |
if ("core/cover-image" === name) { |
| 8421 |
name = "core/cover"; |
| 8422 |
} |
| 8423 |
if ("core/text" === name || "core/cover-text" === name) { |
| 8424 |
name = "core/paragraph"; |
| 8425 |
} |
| 8426 |
if (name && name.indexOf("core/social-link-") === 0) { |
| 8427 |
newAttributes.service = name.substring(17); |
| 8428 |
name = "core/social-link"; |
| 8429 |
} |
| 8430 |
if (name && name.indexOf("core-embed/") === 0) { |
| 8431 |
const providerSlug = name.substring(11); |
| 8432 |
const deprecated12 = { |
| 8433 |
speaker: "speaker-deck", |
| 8434 |
polldaddy: "crowdsignal" |
| 8435 |
}; |
| 8436 |
newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug; |
| 8437 |
if (!["amazon-kindle", "wordpress"].includes(providerSlug)) { |
| 8438 |
newAttributes.responsive = true; |
| 8439 |
} |
| 8440 |
name = "core/embed"; |
| 8441 |
} |
| 8442 |
if (name === "core/post-comment-author") { |
| 8443 |
name = "core/comment-author-name"; |
| 8444 |
} |
| 8445 |
if (name === "core/post-comment-content") { |
| 8446 |
name = "core/comment-content"; |
| 8447 |
} |
| 8448 |
if (name === "core/post-comment-date") { |
| 8449 |
name = "core/comment-date"; |
| 8450 |
} |
| 8451 |
if (name === "core/comments-query-loop") { |
| 8452 |
name = "core/comments"; |
| 8453 |
const { className = "" } = newAttributes; |
| 8454 |
if (!className.includes("wp-block-comments-query-loop")) { |
| 8455 |
newAttributes.className = [ |
| 8456 |
"wp-block-comments-query-loop", |
| 8457 |
className |
| 8458 |
].join(" "); |
| 8459 |
} |
| 8460 |
} |
| 8461 |
if (name === "core/post-comments") { |
| 8462 |
name = "core/comments"; |
| 8463 |
newAttributes.legacy = true; |
| 8464 |
} |
| 8465 |
if (attributes.layout?.type === "grid" && typeof attributes.layout?.columnCount === "string") { |
| 8466 |
newAttributes.layout = { |
| 8467 |
...newAttributes.layout, |
| 8468 |
columnCount: parseInt(attributes.layout.columnCount, 10) |
| 8469 |
}; |
| 8470 |
} |
| 8471 |
if (typeof attributes.style?.layout?.columnSpan === "string") { |
| 8472 |
const columnSpanNumber = parseInt( |
| 8473 |
attributes.style.layout.columnSpan, |
| 8474 |
10 |
| 8475 |
); |
| 8476 |
newAttributes.style = { |
| 8477 |
...newAttributes.style, |
| 8478 |
layout: { |
| 8479 |
...newAttributes.style.layout, |
| 8480 |
columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber |
| 8481 |
} |
| 8482 |
}; |
| 8483 |
} |
| 8484 |
if (typeof attributes.style?.layout?.rowSpan === "string") { |
| 8485 |
const rowSpanNumber = parseInt(attributes.style.layout.rowSpan, 10); |
| 8486 |
newAttributes.style = { |
| 8487 |
...newAttributes.style, |
| 8488 |
layout: { |
| 8489 |
...newAttributes.style.layout, |
| 8490 |
rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber |
| 8491 |
} |
| 8492 |
}; |
| 8493 |
} |
| 8494 |
return [name, newAttributes]; |
| 8495 |
} |
| 8496 |
|
| 8497 |
// node_modules/hpq/es/get-path.js |
| 8498 |
function getPath(object, path) { |
| 8499 |
var segments = path.split("."); |
| 8500 |
var segment; |
| 8501 |
while (segment = segments.shift()) { |
| 8502 |
if (!(segment in object)) { |
| 8503 |
return; |
| 8504 |
} |
| 8505 |
object = object[segment]; |
| 8506 |
} |
| 8507 |
return object; |
| 8508 |
} |
| 8509 |
|
| 8510 |
// node_modules/hpq/es/index.js |
| 8511 |
var getDocument = /* @__PURE__ */ (function() { |
| 8512 |
var doc; |
| 8513 |
return function() { |
| 8514 |
if (!doc) { |
| 8515 |
doc = document.implementation.createHTMLDocument(""); |
| 8516 |
} |
| 8517 |
return doc; |
| 8518 |
}; |
| 8519 |
})(); |
| 8520 |
function parse(source, matchers) { |
| 8521 |
if (!matchers) { |
| 8522 |
return; |
| 8523 |
} |
| 8524 |
if ("string" === typeof source) { |
| 8525 |
var doc = getDocument(); |
| 8526 |
doc.body.innerHTML = source; |
| 8527 |
source = doc.body; |
| 8528 |
} |
| 8529 |
if ("function" === typeof matchers) { |
| 8530 |
return matchers(source); |
| 8531 |
} |
| 8532 |
if (Object !== matchers.constructor) { |
| 8533 |
return; |
| 8534 |
} |
| 8535 |
return Object.keys(matchers).reduce(function(memo, key) { |
| 8536 |
memo[key] = parse(source, matchers[key]); |
| 8537 |
return memo; |
| 8538 |
}, {}); |
| 8539 |
} |
| 8540 |
function prop(selector, name) { |
| 8541 |
if (1 === arguments.length) { |
| 8542 |
name = selector; |
| 8543 |
selector = void 0; |
| 8544 |
} |
| 8545 |
return function(node) { |
| 8546 |
var match = node; |
| 8547 |
if (selector) { |
| 8548 |
match = node.querySelector(selector); |
| 8549 |
} |
| 8550 |
if (match) { |
| 8551 |
return getPath(match, name); |
| 8552 |
} |
| 8553 |
}; |
| 8554 |
} |
| 8555 |
function attr(selector, name) { |
| 8556 |
if (1 === arguments.length) { |
| 8557 |
name = selector; |
| 8558 |
selector = void 0; |
| 8559 |
} |
| 8560 |
return function(node) { |
| 8561 |
var attributes = prop(selector, "attributes")(node); |
| 8562 |
if (attributes && attributes.hasOwnProperty(name)) { |
| 8563 |
return attributes[name].value; |
| 8564 |
} |
| 8565 |
}; |
| 8566 |
} |
| 8567 |
function text(selector) { |
| 8568 |
return prop(selector, "textContent"); |
| 8569 |
} |
| 8570 |
function query(selector, matchers) { |
| 8571 |
return function(node) { |
| 8572 |
var matches = node.querySelectorAll(selector); |
| 8573 |
return [].map.call(matches, function(match) { |
| 8574 |
return parse(match, matchers); |
| 8575 |
}); |
| 8576 |
}; |
| 8577 |
} |
| 8578 |
|
| 8579 |
// node_modules/memize/dist/index.js |
| 8580 |
function memize(fn, options) { |
| 8581 |
var size = 0; |
| 8582 |
var head; |
| 8583 |
var tail; |
| 8584 |
options = options || {}; |
| 8585 |
function memoized() { |
| 8586 |
var node = head, len = arguments.length, args, i2; |
| 8587 |
searchCache: while (node) { |
| 8588 |
if (node.args.length !== arguments.length) { |
| 8589 |
node = node.next; |
| 8590 |
continue; |
| 8591 |
} |
| 8592 |
for (i2 = 0; i2 < len; i2++) { |
| 8593 |
if (node.args[i2] !== arguments[i2]) { |
| 8594 |
node = node.next; |
| 8595 |
continue searchCache; |
| 8596 |
} |
| 8597 |
} |
| 8598 |
if (node !== head) { |
| 8599 |
if (node === tail) { |
| 8600 |
tail = node.prev; |
| 8601 |
} |
| 8602 |
node.prev.next = node.next; |
| 8603 |
if (node.next) { |
| 8604 |
node.next.prev = node.prev; |
| 8605 |
} |
| 8606 |
node.next = head; |
| 8607 |
node.prev = null; |
| 8608 |
head.prev = node; |
| 8609 |
head = node; |
| 8610 |
} |
| 8611 |
return node.val; |
| 8612 |
} |
| 8613 |
args = new Array(len); |
| 8614 |
for (i2 = 0; i2 < len; i2++) { |
| 8615 |
args[i2] = arguments[i2]; |
| 8616 |
} |
| 8617 |
node = { |
| 8618 |
args, |
| 8619 |
// Generate the result from original function |
| 8620 |
val: fn.apply(null, args) |
| 8621 |
}; |
| 8622 |
if (head) { |
| 8623 |
head.prev = node; |
| 8624 |
node.next = head; |
| 8625 |
} else { |
| 8626 |
tail = node; |
| 8627 |
} |
| 8628 |
if (size === /** @type {MemizeOptions} */ |
| 8629 |
options.maxSize) { |
| 8630 |
tail = /** @type {MemizeCacheNode} */ |
| 8631 |
tail.prev; |
| 8632 |
tail.next = null; |
| 8633 |
} else { |
| 8634 |
size++; |
| 8635 |
} |
| 8636 |
head = node; |
| 8637 |
return node.val; |
| 8638 |
} |
| 8639 |
memoized.clear = function() { |
| 8640 |
head = null; |
| 8641 |
tail = null; |
| 8642 |
size = 0; |
| 8643 |
}; |
| 8644 |
return memoized; |
| 8645 |
} |
| 8646 |
|
| 8647 |
// packages/blocks/build-module/api/parser/get-block-attributes.mjs |
| 8648 |
var import_hooks4 = __toESM(require_hooks(), 1); |
| 8649 |
var import_rich_text4 = __toESM(require_rich_text(), 1); |
| 8650 |
|
| 8651 |
// packages/blocks/build-module/api/matchers.mjs |
| 8652 |
var import_rich_text3 = __toESM(require_rich_text(), 1); |
| 8653 |
|
| 8654 |
// packages/blocks/build-module/api/node.mjs |
| 8655 |
var import_deprecated9 = __toESM(require_deprecated(), 1); |
| 8656 |
|
| 8657 |
// packages/blocks/build-module/api/children.mjs |
| 8658 |
var import_element3 = __toESM(require_element(), 1); |
| 8659 |
var import_deprecated8 = __toESM(require_deprecated(), 1); |
| 8660 |
function getSerializeCapableElement(children) { |
| 8661 |
return children; |
| 8662 |
} |
| 8663 |
function getChildrenArray(children) { |
| 8664 |
(0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", { |
| 8665 |
since: "6.1", |
| 8666 |
version: "6.3", |
| 8667 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8668 |
}); |
| 8669 |
return children; |
| 8670 |
} |
| 8671 |
function concat(...blockNodes) { |
| 8672 |
(0, import_deprecated8.default)("wp.blocks.children.concat", { |
| 8673 |
since: "6.1", |
| 8674 |
version: "6.3", |
| 8675 |
alternative: "wp.richText.concat", |
| 8676 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8677 |
}); |
| 8678 |
const result = []; |
| 8679 |
for (let i2 = 0; i2 < blockNodes.length; i2++) { |
| 8680 |
const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]]; |
| 8681 |
for (let j2 = 0; j2 < blockNode.length; j2++) { |
| 8682 |
const child = blockNode[j2]; |
| 8683 |
const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string"; |
| 8684 |
if (canConcatToPreviousString) { |
| 8685 |
result[result.length - 1] += child; |
| 8686 |
} else { |
| 8687 |
result.push(child); |
| 8688 |
} |
| 8689 |
} |
| 8690 |
} |
| 8691 |
return result; |
| 8692 |
} |
| 8693 |
function fromDOM22(domNodes) { |
| 8694 |
(0, import_deprecated8.default)("wp.blocks.children.fromDOM", { |
| 8695 |
since: "6.1", |
| 8696 |
version: "6.3", |
| 8697 |
alternative: "wp.richText.create", |
| 8698 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8699 |
}); |
| 8700 |
const result = []; |
| 8701 |
for (let i2 = 0; i2 < domNodes.length; i2++) { |
| 8702 |
try { |
| 8703 |
result.push(fromDOM2(domNodes[i2])); |
| 8704 |
} catch (error) { |
| 8705 |
} |
| 8706 |
} |
| 8707 |
return result; |
| 8708 |
} |
| 8709 |
function toHTML(children) { |
| 8710 |
(0, import_deprecated8.default)("wp.blocks.children.toHTML", { |
| 8711 |
since: "6.1", |
| 8712 |
version: "6.3", |
| 8713 |
alternative: "wp.richText.toHTMLString", |
| 8714 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8715 |
}); |
| 8716 |
const element = getSerializeCapableElement(children); |
| 8717 |
return (0, import_element3.renderToString)(element); |
| 8718 |
} |
| 8719 |
function matcher(selector) { |
| 8720 |
(0, import_deprecated8.default)("wp.blocks.children.matcher", { |
| 8721 |
since: "6.1", |
| 8722 |
version: "6.3", |
| 8723 |
alternative: "html source", |
| 8724 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8725 |
}); |
| 8726 |
return (domNode) => { |
| 8727 |
let match = domNode; |
| 8728 |
if (selector) { |
| 8729 |
match = domNode.querySelector(selector); |
| 8730 |
} |
| 8731 |
if (match) { |
| 8732 |
return fromDOM22(match.childNodes); |
| 8733 |
} |
| 8734 |
return []; |
| 8735 |
}; |
| 8736 |
} |
| 8737 |
var children_default = { |
| 8738 |
concat, |
| 8739 |
getChildrenArray, |
| 8740 |
fromDOM: fromDOM22, |
| 8741 |
toHTML, |
| 8742 |
matcher |
| 8743 |
}; |
| 8744 |
|
| 8745 |
// packages/blocks/build-module/api/node.mjs |
| 8746 |
function isNodeOfType(node, type) { |
| 8747 |
(0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", { |
| 8748 |
since: "6.1", |
| 8749 |
version: "6.3", |
| 8750 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8751 |
}); |
| 8752 |
return node && node.type === type; |
| 8753 |
} |
| 8754 |
function getNamedNodeMapAsObject(nodeMap) { |
| 8755 |
const result = {}; |
| 8756 |
for (let i2 = 0; i2 < nodeMap.length; i2++) { |
| 8757 |
const { name, value } = nodeMap[i2]; |
| 8758 |
result[name] = value; |
| 8759 |
} |
| 8760 |
return result; |
| 8761 |
} |
| 8762 |
function fromDOM2(domNode) { |
| 8763 |
(0, import_deprecated9.default)("wp.blocks.node.fromDOM", { |
| 8764 |
since: "6.1", |
| 8765 |
version: "6.3", |
| 8766 |
alternative: "wp.richText.create", |
| 8767 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8768 |
}); |
| 8769 |
if (domNode.nodeType === domNode.TEXT_NODE) { |
| 8770 |
return domNode.nodeValue; |
| 8771 |
} |
| 8772 |
if (domNode.nodeType !== domNode.ELEMENT_NODE) { |
| 8773 |
throw new TypeError( |
| 8774 |
"A block node can only be created from a node of type text or element." |
| 8775 |
); |
| 8776 |
} |
| 8777 |
return { |
| 8778 |
type: domNode.nodeName.toLowerCase(), |
| 8779 |
props: { |
| 8780 |
...getNamedNodeMapAsObject(domNode.attributes), |
| 8781 |
children: fromDOM22(domNode.childNodes) |
| 8782 |
} |
| 8783 |
}; |
| 8784 |
} |
| 8785 |
function toHTML2(node) { |
| 8786 |
(0, import_deprecated9.default)("wp.blocks.node.toHTML", { |
| 8787 |
since: "6.1", |
| 8788 |
version: "6.3", |
| 8789 |
alternative: "wp.richText.toHTMLString", |
| 8790 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8791 |
}); |
| 8792 |
return toHTML([node]); |
| 8793 |
} |
| 8794 |
function matcher2(selector) { |
| 8795 |
(0, import_deprecated9.default)("wp.blocks.node.matcher", { |
| 8796 |
since: "6.1", |
| 8797 |
version: "6.3", |
| 8798 |
alternative: "html source", |
| 8799 |
link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/" |
| 8800 |
}); |
| 8801 |
return (domNode) => { |
| 8802 |
let match = domNode; |
| 8803 |
if (selector) { |
| 8804 |
match = domNode.querySelector(selector); |
| 8805 |
} |
| 8806 |
try { |
| 8807 |
return fromDOM2(match); |
| 8808 |
} catch (error) { |
| 8809 |
return null; |
| 8810 |
} |
| 8811 |
}; |
| 8812 |
} |
| 8813 |
var node_default = { |
| 8814 |
isNodeOfType, |
| 8815 |
fromDOM: fromDOM2, |
| 8816 |
toHTML: toHTML2, |
| 8817 |
matcher: matcher2 |
| 8818 |
}; |
| 8819 |
|
| 8820 |
// packages/blocks/build-module/api/matchers.mjs |
| 8821 |
function html(selector, multilineTag) { |
| 8822 |
return (domNode) => { |
| 8823 |
let match = domNode; |
| 8824 |
if (selector) { |
| 8825 |
match = domNode.querySelector(selector); |
| 8826 |
} |
| 8827 |
if (!match) { |
| 8828 |
return ""; |
| 8829 |
} |
| 8830 |
if (multilineTag) { |
| 8831 |
let value = ""; |
| 8832 |
const length = match.children.length; |
| 8833 |
for (let index = 0; index < length; index++) { |
| 8834 |
const child = match.children[index]; |
| 8835 |
if (child.nodeName.toLowerCase() !== multilineTag) { |
| 8836 |
continue; |
| 8837 |
} |
| 8838 |
value += child.outerHTML; |
| 8839 |
} |
| 8840 |
return value; |
| 8841 |
} |
| 8842 |
return match.innerHTML; |
| 8843 |
}; |
| 8844 |
} |
| 8845 |
var richText = (selector, preserveWhiteSpace) => (el) => { |
| 8846 |
const target = selector ? el.querySelector(selector) : el; |
| 8847 |
return target ? import_rich_text3.RichTextData.fromHTMLElement(target, { preserveWhiteSpace }) : import_rich_text3.RichTextData.empty(); |
| 8848 |
}; |
| 8849 |
|
| 8850 |
// packages/blocks/build-module/api/parser/get-block-attributes.mjs |
| 8851 |
var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0; |
| 8852 |
function isOfType(value, type) { |
| 8853 |
switch (type) { |
| 8854 |
case "rich-text": |
| 8855 |
return value instanceof import_rich_text4.RichTextData; |
| 8856 |
case "string": |
| 8857 |
return typeof value === "string"; |
| 8858 |
case "boolean": |
| 8859 |
return typeof value === "boolean"; |
| 8860 |
case "object": |
| 8861 |
return !!value && value.constructor === Object; |
| 8862 |
case "null": |
| 8863 |
return value === null; |
| 8864 |
case "array": |
| 8865 |
return Array.isArray(value); |
| 8866 |
case "integer": |
| 8867 |
case "number": |
| 8868 |
return typeof value === "number"; |
| 8869 |
} |
| 8870 |
return true; |
| 8871 |
} |
| 8872 |
function isOfTypes(value, types) { |
| 8873 |
return types.some((type) => isOfType(value, type)); |
| 8874 |
} |
| 8875 |
function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) { |
| 8876 |
let value; |
| 8877 |
switch (attributeSchema.source) { |
| 8878 |
// An undefined source means that it's an attribute serialized to the |
| 8879 |
// block's "comment". |
| 8880 |
case void 0: |
| 8881 |
value = commentAttributes ? commentAttributes[attributeKey] : void 0; |
| 8882 |
break; |
| 8883 |
// raw source means that it's the original raw block content. |
| 8884 |
case "raw": |
| 8885 |
value = innerHTML; |
| 8886 |
break; |
| 8887 |
case "attribute": |
| 8888 |
case "property": |
| 8889 |
case "html": |
| 8890 |
case "text": |
| 8891 |
case "rich-text": |
| 8892 |
case "children": |
| 8893 |
case "node": |
| 8894 |
case "query": |
| 8895 |
case "tag": |
| 8896 |
value = parseWithAttributeSchema(innerDOM, attributeSchema); |
| 8897 |
break; |
| 8898 |
} |
| 8899 |
if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) { |
| 8900 |
value = void 0; |
| 8901 |
} |
| 8902 |
if (value === void 0) { |
| 8903 |
value = getDefault(attributeSchema); |
| 8904 |
} |
| 8905 |
return value; |
| 8906 |
} |
| 8907 |
function isValidByType(value, type) { |
| 8908 |
return type === void 0 || isOfTypes(value, Array.isArray(type) ? type : [type]); |
| 8909 |
} |
| 8910 |
function isValidByEnum(value, enumSet) { |
| 8911 |
return !Array.isArray(enumSet) || enumSet.includes(value); |
| 8912 |
} |
| 8913 |
var matcherFromSource = memize((sourceConfig) => { |
| 8914 |
switch (sourceConfig.source) { |
| 8915 |
case "attribute": { |
| 8916 |
let matcher3 = attr(sourceConfig.selector, sourceConfig.attribute); |
| 8917 |
if (sourceConfig.type === "boolean") { |
| 8918 |
matcher3 = toBooleanAttributeMatcher(matcher3); |
| 8919 |
} |
| 8920 |
return matcher3; |
| 8921 |
} |
| 8922 |
case "html": |
| 8923 |
return html(sourceConfig.selector, sourceConfig.multiline); |
| 8924 |
case "text": |
| 8925 |
return text(sourceConfig.selector); |
| 8926 |
case "rich-text": |
| 8927 |
return richText( |
| 8928 |
sourceConfig.selector, |
| 8929 |
sourceConfig.__unstablePreserveWhiteSpace |
| 8930 |
); |
| 8931 |
case "children": |
| 8932 |
return matcher(sourceConfig.selector); |
| 8933 |
case "node": |
| 8934 |
return matcher2(sourceConfig.selector); |
| 8935 |
case "query": |
| 8936 |
const subMatchers = Object.fromEntries( |
| 8937 |
Object.entries(sourceConfig.query).map( |
| 8938 |
([key, subSourceConfig]) => [ |
| 8939 |
key, |
| 8940 |
matcherFromSource(subSourceConfig) |
| 8941 |
] |
| 8942 |
) |
| 8943 |
); |
| 8944 |
return query(sourceConfig.selector, subMatchers); |
| 8945 |
case "tag": { |
| 8946 |
const matcher3 = prop(sourceConfig.selector, "nodeName"); |
| 8947 |
return (domNode) => matcher3(domNode)?.toLowerCase(); |
| 8948 |
} |
| 8949 |
default: |
| 8950 |
console.error(`Unknown source type "${sourceConfig.source}"`); |
| 8951 |
} |
| 8952 |
}); |
| 8953 |
function parseHtml(innerHTML) { |
| 8954 |
return parse(innerHTML, (h2) => h2); |
| 8955 |
} |
| 8956 |
function parseWithAttributeSchema(innerHTML, attributeSchema) { |
| 8957 |
return matcherFromSource(attributeSchema)(parseHtml(innerHTML)); |
| 8958 |
} |
| 8959 |
function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) { |
| 8960 |
const doc = parseHtml(innerHTML); |
| 8961 |
const blockType = normalizeBlockType(blockTypeOrName); |
| 8962 |
const blockAttributes = Object.fromEntries( |
| 8963 |
Object.entries(blockType.attributes ?? {}).map( |
| 8964 |
([key, schema]) => [ |
| 8965 |
key, |
| 8966 |
getBlockAttribute(key, schema, doc, attributes, innerHTML) |
| 8967 |
] |
| 8968 |
) |
| 8969 |
); |
| 8970 |
return (0, import_hooks4.applyFilters)( |
| 8971 |
"blocks.getBlockAttributes", |
| 8972 |
blockAttributes, |
| 8973 |
blockType, |
| 8974 |
innerHTML, |
| 8975 |
attributes |
| 8976 |
); |
| 8977 |
} |
| 8978 |
|
| 8979 |
// packages/blocks/build-module/api/parser/fix-custom-classname.mjs |
| 8980 |
var CLASS_ATTR_SCHEMA = { |
| 8981 |
type: "string", |
| 8982 |
source: "attribute", |
| 8983 |
selector: "[data-custom-class-name] > *", |
| 8984 |
attribute: "class" |
| 8985 |
}; |
| 8986 |
function getHTMLRootElementClasses(innerHTML) { |
| 8987 |
const parsed = parseWithAttributeSchema( |
| 8988 |
`<div data-custom-class-name>${innerHTML}</div>`, |
| 8989 |
CLASS_ATTR_SCHEMA |
| 8990 |
); |
| 8991 |
return parsed ? parsed.trim().split(/\s+/) : []; |
| 8992 |
} |
| 8993 |
function fixCustomClassname(blockAttributes, blockType, innerHTML) { |
| 8994 |
if (!hasBlockSupport(blockType, "customClassName", true)) { |
| 8995 |
return blockAttributes; |
| 8996 |
} |
| 8997 |
const modifiedBlockAttributes = { ...blockAttributes }; |
| 8998 |
const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes; |
| 8999 |
const serialized = getSaveContent(blockType, attributesSansClassName); |
| 9000 |
const defaultClasses = getHTMLRootElementClasses(serialized); |
| 9001 |
const actualClasses = getHTMLRootElementClasses(innerHTML); |
| 9002 |
const customClasses = actualClasses.filter( |
| 9003 |
(className) => !defaultClasses.includes(className) |
| 9004 |
); |
| 9005 |
if (customClasses.length) { |
| 9006 |
modifiedBlockAttributes.className = customClasses.join(" "); |
| 9007 |
} else if (serialized) { |
| 9008 |
delete modifiedBlockAttributes.className; |
| 9009 |
} |
| 9010 |
return modifiedBlockAttributes; |
| 9011 |
} |
| 9012 |
|
| 9013 |
// packages/blocks/build-module/api/parser/fix-global-attribute.mjs |
| 9014 |
function getHTMLRootElement(innerHTML, dataAttribute, attributeSchema) { |
| 9015 |
const parsed = parseWithAttributeSchema( |
| 9016 |
`<div ${dataAttribute}>${innerHTML}</div>`, |
| 9017 |
attributeSchema |
| 9018 |
); |
| 9019 |
return parsed; |
| 9020 |
} |
| 9021 |
function fixGlobalAttribute(blockAttributes, blockType, innerHTML, supportKey, dataAttribute, attributeSchema) { |
| 9022 |
if (!hasBlockSupport(blockType, supportKey, false)) { |
| 9023 |
return blockAttributes; |
| 9024 |
} |
| 9025 |
const modifiedBlockAttributes = { ...blockAttributes }; |
| 9026 |
const attributeValue = getHTMLRootElement( |
| 9027 |
innerHTML, |
| 9028 |
dataAttribute, |
| 9029 |
attributeSchema |
| 9030 |
); |
| 9031 |
if (attributeValue) { |
| 9032 |
modifiedBlockAttributes[supportKey] = attributeValue; |
| 9033 |
} |
| 9034 |
return modifiedBlockAttributes; |
| 9035 |
} |
| 9036 |
|
| 9037 |
// packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.mjs |
| 9038 |
var ARIA_LABEL_ATTR_SCHEMA = { |
| 9039 |
type: "string", |
| 9040 |
source: "attribute", |
| 9041 |
selector: "[data-aria-label] > *", |
| 9042 |
attribute: "aria-label" |
| 9043 |
}; |
| 9044 |
var ANCHOR_ATTR_SCHEMA = { |
| 9045 |
type: "string", |
| 9046 |
source: "attribute", |
| 9047 |
selector: "[data-anchor] > *", |
| 9048 |
attribute: "id" |
| 9049 |
}; |
| 9050 |
function applyBuiltInValidationFixes(block, blockType) { |
| 9051 |
const { attributes, originalContent } = block; |
| 9052 |
let updatedBlockAttributes = attributes; |
| 9053 |
updatedBlockAttributes = fixCustomClassname( |
| 9054 |
attributes, |
| 9055 |
blockType, |
| 9056 |
originalContent |
| 9057 |
); |
| 9058 |
updatedBlockAttributes = fixGlobalAttribute( |
| 9059 |
updatedBlockAttributes, |
| 9060 |
blockType, |
| 9061 |
originalContent, |
| 9062 |
"ariaLabel", |
| 9063 |
"data-aria-label", |
| 9064 |
ARIA_LABEL_ATTR_SCHEMA |
| 9065 |
); |
| 9066 |
updatedBlockAttributes = fixGlobalAttribute( |
| 9067 |
updatedBlockAttributes, |
| 9068 |
blockType, |
| 9069 |
originalContent, |
| 9070 |
"anchor", |
| 9071 |
"data-anchor", |
| 9072 |
ANCHOR_ATTR_SCHEMA |
| 9073 |
); |
| 9074 |
return { |
| 9075 |
...block, |
| 9076 |
attributes: updatedBlockAttributes |
| 9077 |
}; |
| 9078 |
} |
| 9079 |
|
| 9080 |
// packages/blocks/build-module/api/parser/apply-block-deprecated-versions.mjs |
| 9081 |
function stubFalse() { |
| 9082 |
return false; |
| 9083 |
} |
| 9084 |
function applyBlockDeprecatedVersions(block, rawBlock, blockType) { |
| 9085 |
const parsedAttributes = rawBlock.attrs; |
| 9086 |
const { deprecated: deprecatedDefinitions } = blockType; |
| 9087 |
if (!deprecatedDefinitions || !deprecatedDefinitions.length) { |
| 9088 |
return block; |
| 9089 |
} |
| 9090 |
for (let i2 = 0; i2 < deprecatedDefinitions.length; i2++) { |
| 9091 |
const { isEligible = stubFalse } = deprecatedDefinitions[i2]; |
| 9092 |
if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, { |
| 9093 |
blockNode: rawBlock, |
| 9094 |
block |
| 9095 |
})) { |
| 9096 |
continue; |
| 9097 |
} |
| 9098 |
const deprecatedBlockType = Object.assign( |
| 9099 |
omit(blockType, DEPRECATED_ENTRY_KEYS), |
| 9100 |
deprecatedDefinitions[i2] |
| 9101 |
); |
| 9102 |
let migratedBlock = { |
| 9103 |
...block, |
| 9104 |
attributes: getBlockAttributes( |
| 9105 |
deprecatedBlockType, |
| 9106 |
block.originalContent, |
| 9107 |
parsedAttributes |
| 9108 |
) |
| 9109 |
}; |
| 9110 |
let [isValid] = validateBlock(migratedBlock, deprecatedBlockType); |
| 9111 |
if (!isValid) { |
| 9112 |
migratedBlock = applyBuiltInValidationFixes( |
| 9113 |
migratedBlock, |
| 9114 |
deprecatedBlockType |
| 9115 |
); |
| 9116 |
[isValid] = validateBlock(migratedBlock, deprecatedBlockType); |
| 9117 |
} |
| 9118 |
if (!isValid) { |
| 9119 |
continue; |
| 9120 |
} |
| 9121 |
let migratedInnerBlocks = migratedBlock.innerBlocks; |
| 9122 |
let migratedAttributes = migratedBlock.attributes; |
| 9123 |
const { migrate } = deprecatedBlockType; |
| 9124 |
if (migrate) { |
| 9125 |
let migrated = migrate(migratedAttributes, block.innerBlocks); |
| 9126 |
if (!Array.isArray(migrated)) { |
| 9127 |
migrated = [migrated]; |
| 9128 |
} |
| 9129 |
[ |
| 9130 |
migratedAttributes = parsedAttributes, |
| 9131 |
migratedInnerBlocks = block.innerBlocks |
| 9132 |
] = migrated; |
| 9133 |
} |
| 9134 |
block = { |
| 9135 |
...block, |
| 9136 |
attributes: migratedAttributes, |
| 9137 |
innerBlocks: migratedInnerBlocks, |
| 9138 |
isValid: true, |
| 9139 |
validationIssues: [] |
| 9140 |
}; |
| 9141 |
} |
| 9142 |
return block; |
| 9143 |
} |
| 9144 |
|
| 9145 |
// packages/blocks/build-module/api/parser/index.mjs |
| 9146 |
function convertLegacyBlocks(rawBlock) { |
| 9147 |
const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes( |
| 9148 |
rawBlock.blockName, |
| 9149 |
rawBlock.attrs |
| 9150 |
); |
| 9151 |
return { |
| 9152 |
...rawBlock, |
| 9153 |
blockName: correctName, |
| 9154 |
attrs: correctedAttributes |
| 9155 |
}; |
| 9156 |
} |
| 9157 |
function normalizeRawBlock(rawBlock, options) { |
| 9158 |
const fallbackBlockName = getFreeformContentHandlerName(); |
| 9159 |
const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName(); |
| 9160 |
const rawAttributes = rawBlock.attrs || {}; |
| 9161 |
const rawInnerBlocks = rawBlock.innerBlocks || []; |
| 9162 |
let rawInnerHTML = rawBlock.innerHTML.trim(); |
| 9163 |
if (rawBlockName === fallbackBlockName && rawBlockName === "core/freeform" && !options?.__unstableSkipAutop) { |
| 9164 |
rawInnerHTML = (0, import_autop2.autop)(rawInnerHTML).trim(); |
| 9165 |
} |
| 9166 |
return { |
| 9167 |
...rawBlock, |
| 9168 |
blockName: rawBlockName, |
| 9169 |
attrs: rawAttributes, |
| 9170 |
innerHTML: rawInnerHTML, |
| 9171 |
innerBlocks: rawInnerBlocks |
| 9172 |
}; |
| 9173 |
} |
| 9174 |
function createMissingBlockType(rawBlock) { |
| 9175 |
const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName(); |
| 9176 |
const originalUndelimitedContent = serializeRawBlock(rawBlock, { |
| 9177 |
isCommentDelimited: false |
| 9178 |
}); |
| 9179 |
const originalContent = serializeRawBlock(rawBlock, { |
| 9180 |
isCommentDelimited: true |
| 9181 |
}); |
| 9182 |
return { |
| 9183 |
blockName: unregisteredFallbackBlock, |
| 9184 |
attrs: { |
| 9185 |
originalName: rawBlock.blockName, |
| 9186 |
originalContent, |
| 9187 |
originalUndelimitedContent |
| 9188 |
}, |
| 9189 |
innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML, |
| 9190 |
innerBlocks: rawBlock.innerBlocks, |
| 9191 |
innerContent: rawBlock.innerContent |
| 9192 |
}; |
| 9193 |
} |
| 9194 |
function applyBlockValidation(unvalidatedBlock, blockType) { |
| 9195 |
const [isValid] = validateBlock(unvalidatedBlock, blockType); |
| 9196 |
if (isValid) { |
| 9197 |
return { ...unvalidatedBlock, isValid, validationIssues: [] }; |
| 9198 |
} |
| 9199 |
const fixedBlock = applyBuiltInValidationFixes( |
| 9200 |
unvalidatedBlock, |
| 9201 |
blockType |
| 9202 |
); |
| 9203 |
const [isFixedValid, validationIssues] = validateBlock( |
| 9204 |
fixedBlock, |
| 9205 |
blockType |
| 9206 |
); |
| 9207 |
return { ...fixedBlock, isValid: isFixedValid, validationIssues }; |
| 9208 |
} |
| 9209 |
function parseRawBlock(rawBlock, options) { |
| 9210 |
let normalizedBlock = normalizeRawBlock(rawBlock, options); |
| 9211 |
normalizedBlock = convertLegacyBlocks(normalizedBlock); |
| 9212 |
let blockType = getBlockType(normalizedBlock.blockName); |
| 9213 |
if (!blockType) { |
| 9214 |
normalizedBlock = createMissingBlockType(normalizedBlock); |
| 9215 |
blockType = getBlockType(normalizedBlock.blockName); |
| 9216 |
} |
| 9217 |
const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName(); |
| 9218 |
if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) { |
| 9219 |
return; |
| 9220 |
} |
| 9221 |
const parsedInnerBlocks = normalizedBlock.innerBlocks.map((innerBlock) => parseRawBlock(innerBlock, options)).filter((innerBlock) => !!innerBlock); |
| 9222 |
const parsedBlock = createBlock( |
| 9223 |
normalizedBlock.blockName, |
| 9224 |
getBlockAttributes( |
| 9225 |
blockType, |
| 9226 |
normalizedBlock.innerHTML, |
| 9227 |
normalizedBlock.attrs |
| 9228 |
), |
| 9229 |
parsedInnerBlocks |
| 9230 |
); |
| 9231 |
parsedBlock.originalContent = normalizedBlock.innerHTML; |
| 9232 |
const validatedBlock = applyBlockValidation(parsedBlock, blockType); |
| 9233 |
const { validationIssues } = validatedBlock; |
| 9234 |
const updatedBlock = applyBlockDeprecatedVersions( |
| 9235 |
validatedBlock, |
| 9236 |
normalizedBlock, |
| 9237 |
blockType |
| 9238 |
); |
| 9239 |
if (!updatedBlock.isValid) { |
| 9240 |
updatedBlock.__unstableBlockSource = rawBlock; |
| 9241 |
} |
| 9242 |
if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) { |
| 9243 |
console.groupCollapsed("Updated Block: %s", blockType.name); |
| 9244 |
console.info( |
| 9245 |
"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", |
| 9246 |
blockType.name, |
| 9247 |
blockType, |
| 9248 |
getSaveContent(blockType, updatedBlock.attributes), |
| 9249 |
updatedBlock.originalContent |
| 9250 |
); |
| 9251 |
console.groupEnd(); |
| 9252 |
} else if (!validatedBlock.isValid && !updatedBlock.isValid) { |
| 9253 |
validationIssues.forEach(({ log: log2, args }) => log2(...args)); |
| 9254 |
} |
| 9255 |
return updatedBlock; |
| 9256 |
} |
| 9257 |
function parse2(content, options) { |
| 9258 |
return (0, import_block_serialization_default_parser.parse)(content).reduce((accumulator, rawBlock) => { |
| 9259 |
const block = parseRawBlock(rawBlock, options); |
| 9260 |
if (block) { |
| 9261 |
accumulator.push(block); |
| 9262 |
} |
| 9263 |
return accumulator; |
| 9264 |
}, []); |
| 9265 |
} |
| 9266 |
|
| 9267 |
// packages/blocks/build-module/api/raw-handling/index.mjs |
| 9268 |
var import_deprecated10 = __toESM(require_deprecated(), 1); |
| 9269 |
var import_dom12 = __toESM(require_dom(), 1); |
| 9270 |
|
| 9271 |
// packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs |
| 9272 |
var import_element4 = __toESM(require_element(), 1); |
| 9273 |
|
| 9274 |
// packages/blocks/build-module/api/raw-handling/get-raw-transforms.mjs |
| 9275 |
function getRawTransforms() { |
| 9276 |
return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => { |
| 9277 |
return transform.isMatch ? transform : { |
| 9278 |
...transform, |
| 9279 |
isMatch: (node) => transform.selector && node.matches(transform.selector) |
| 9280 |
}; |
| 9281 |
}); |
| 9282 |
} |
| 9283 |
|
| 9284 |
// packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs |
| 9285 |
function htmlToBlocks(html2, handler) { |
| 9286 |
const doc = document.implementation.createHTMLDocument(""); |
| 9287 |
doc.body.innerHTML = html2; |
| 9288 |
return Array.from(doc.body.children).flatMap((node) => { |
| 9289 |
const rawTransform = findTransform( |
| 9290 |
getRawTransforms(), |
| 9291 |
({ isMatch }) => isMatch(node) |
| 9292 |
); |
| 9293 |
if (!rawTransform) { |
| 9294 |
if (import_element4.Platform.isNative) { |
| 9295 |
return parse2( |
| 9296 |
`<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->` |
| 9297 |
); |
| 9298 |
} |
| 9299 |
return createBlock( |
| 9300 |
// Should not be hardcoded. |
| 9301 |
"core/html", |
| 9302 |
getBlockAttributes("core/html", node.outerHTML) |
| 9303 |
); |
| 9304 |
} |
| 9305 |
const { transform, blockName } = rawTransform; |
| 9306 |
if (transform) { |
| 9307 |
const block = transform(node, handler); |
| 9308 |
if (node.hasAttribute("class")) { |
| 9309 |
block.attributes.className = node.getAttribute("class"); |
| 9310 |
} |
| 9311 |
return block; |
| 9312 |
} |
| 9313 |
return createBlock( |
| 9314 |
blockName, |
| 9315 |
getBlockAttributes(blockName, node.outerHTML) |
| 9316 |
); |
| 9317 |
}); |
| 9318 |
} |
| 9319 |
|
| 9320 |
// packages/blocks/build-module/api/raw-handling/normalise-blocks.mjs |
| 9321 |
var import_dom2 = __toESM(require_dom(), 1); |
| 9322 |
function normaliseBlocks(HTML, options = {}) { |
| 9323 |
const decuDoc = document.implementation.createHTMLDocument(""); |
| 9324 |
const accuDoc = document.implementation.createHTMLDocument(""); |
| 9325 |
const decu = decuDoc.body; |
| 9326 |
const accu = accuDoc.body; |
| 9327 |
decu.innerHTML = HTML; |
| 9328 |
while (decu.firstChild) { |
| 9329 |
const node = decu.firstChild; |
| 9330 |
if (node.nodeType === node.TEXT_NODE) { |
| 9331 |
if ((0, import_dom2.isEmpty)(node)) { |
| 9332 |
decu.removeChild(node); |
| 9333 |
} else { |
| 9334 |
if (!accu.lastChild || accu.lastChild.nodeName !== "P") { |
| 9335 |
accu.appendChild(accuDoc.createElement("P")); |
| 9336 |
} |
| 9337 |
accu.lastChild.appendChild(node); |
| 9338 |
} |
| 9339 |
} else if (node.nodeType === node.ELEMENT_NODE) { |
| 9340 |
if (node.nodeName === "BR") { |
| 9341 |
if (node.nextSibling && node.nextSibling.nodeName === "BR") { |
| 9342 |
accu.appendChild(accuDoc.createElement("P")); |
| 9343 |
decu.removeChild(node.nextSibling); |
| 9344 |
} |
| 9345 |
if (accu.lastChild && accu.lastChild.nodeName === "P" && accu.lastChild.hasChildNodes()) { |
| 9346 |
accu.lastChild.appendChild(node); |
| 9347 |
} else { |
| 9348 |
decu.removeChild(node); |
| 9349 |
} |
| 9350 |
} else if (node.nodeName === "P") { |
| 9351 |
if ((0, import_dom2.isEmpty)(node) && !options.raw) { |
| 9352 |
decu.removeChild(node); |
| 9353 |
} else { |
| 9354 |
accu.appendChild(node); |
| 9355 |
} |
| 9356 |
} else if ((0, import_dom2.isPhrasingContent)(node)) { |
| 9357 |
if (!accu.lastChild || accu.lastChild.nodeName !== "P") { |
| 9358 |
accu.appendChild(accuDoc.createElement("P")); |
| 9359 |
} |
| 9360 |
accu.lastChild.appendChild(node); |
| 9361 |
} else { |
| 9362 |
accu.appendChild(node); |
| 9363 |
} |
| 9364 |
} else { |
| 9365 |
decu.removeChild(node); |
| 9366 |
} |
| 9367 |
} |
| 9368 |
return accu.innerHTML; |
| 9369 |
} |
| 9370 |
|
| 9371 |
// packages/blocks/build-module/api/raw-handling/special-comment-converter.mjs |
| 9372 |
var import_dom3 = __toESM(require_dom(), 1); |
| 9373 |
function specialCommentConverter(node, doc) { |
| 9374 |
if (node.nodeType !== node.COMMENT_NODE) { |
| 9375 |
return; |
| 9376 |
} |
| 9377 |
if (node.nodeValue !== "nextpage" && node.nodeValue.indexOf("more") !== 0) { |
| 9378 |
return; |
| 9379 |
} |
| 9380 |
const block = createBlock2(node, doc); |
| 9381 |
if (!node.parentNode || node.parentNode.nodeName !== "P") { |
| 9382 |
(0, import_dom3.replace)(node, block); |
| 9383 |
} else { |
| 9384 |
const childNodes = Array.from(node.parentNode.childNodes); |
| 9385 |
const nodeIndex = childNodes.indexOf(node); |
| 9386 |
const wrapperNode = node.parentNode.parentNode || doc.body; |
| 9387 |
const paragraphBuilder = (acc, child) => { |
| 9388 |
if (!acc) { |
| 9389 |
acc = doc.createElement("p"); |
| 9390 |
} |
| 9391 |
acc.appendChild(child); |
| 9392 |
return acc; |
| 9393 |
}; |
| 9394 |
[ |
| 9395 |
childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), |
| 9396 |
block, |
| 9397 |
childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null) |
| 9398 |
].forEach( |
| 9399 |
(element) => element && wrapperNode.insertBefore(element, node.parentNode) |
| 9400 |
); |
| 9401 |
(0, import_dom3.remove)(node.parentNode); |
| 9402 |
} |
| 9403 |
} |
| 9404 |
function createBlock2(commentNode, doc) { |
| 9405 |
if (commentNode.nodeValue === "nextpage") { |
| 9406 |
return createNextpage(doc); |
| 9407 |
} |
| 9408 |
const customText = commentNode.nodeValue.slice(4).trim(); |
| 9409 |
let sibling = commentNode; |
| 9410 |
let noTeaser = false; |
| 9411 |
while (sibling = sibling.nextSibling) { |
| 9412 |
if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === "noteaser") { |
| 9413 |
noTeaser = true; |
| 9414 |
(0, import_dom3.remove)(sibling); |
| 9415 |
break; |
| 9416 |
} |
| 9417 |
} |
| 9418 |
return createMore(customText, noTeaser, doc); |
| 9419 |
} |
| 9420 |
function createMore(customText, noTeaser, doc) { |
| 9421 |
const node = doc.createElement("wp-block"); |
| 9422 |
node.dataset.block = "core/more"; |
| 9423 |
if (customText) { |
| 9424 |
node.dataset.customText = customText; |
| 9425 |
} |
| 9426 |
if (noTeaser) { |
| 9427 |
node.dataset.noTeaser = ""; |
| 9428 |
} |
| 9429 |
return node; |
| 9430 |
} |
| 9431 |
function createNextpage(doc) { |
| 9432 |
const node = doc.createElement("wp-block"); |
| 9433 |
node.dataset.block = "core/nextpage"; |
| 9434 |
return node; |
| 9435 |
} |
| 9436 |
|
| 9437 |
// packages/blocks/build-module/api/raw-handling/list-reducer.mjs |
| 9438 |
var import_dom4 = __toESM(require_dom(), 1); |
| 9439 |
function isList(node) { |
| 9440 |
return node.nodeName === "OL" || node.nodeName === "UL"; |
| 9441 |
} |
| 9442 |
function shallowTextContent(element) { |
| 9443 |
return Array.from(element.childNodes).map(({ nodeValue = "" }) => nodeValue).join(""); |
| 9444 |
} |
| 9445 |
function listReducer(node) { |
| 9446 |
if (!isList(node)) { |
| 9447 |
return; |
| 9448 |
} |
| 9449 |
const list = node; |
| 9450 |
const prevElement = node.previousElementSibling; |
| 9451 |
if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) { |
| 9452 |
while (list.firstChild) { |
| 9453 |
prevElement.appendChild(list.firstChild); |
| 9454 |
} |
| 9455 |
list.parentNode.removeChild(list); |
| 9456 |
} |
| 9457 |
const parentElement = node.parentNode; |
| 9458 |
if (parentElement && parentElement.nodeName === "LI" && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) { |
| 9459 |
const parentListItem = parentElement; |
| 9460 |
const prevListItem = parentListItem.previousElementSibling; |
| 9461 |
const parentList = parentListItem.parentNode; |
| 9462 |
if (prevListItem) { |
| 9463 |
prevListItem.appendChild(list); |
| 9464 |
parentList.removeChild(parentListItem); |
| 9465 |
} |
| 9466 |
} |
| 9467 |
if (parentElement && isList(parentElement)) { |
| 9468 |
const prevListItem = node.previousElementSibling; |
| 9469 |
if (prevListItem) { |
| 9470 |
prevListItem.appendChild(node); |
| 9471 |
} else { |
| 9472 |
(0, import_dom4.unwrap)(node); |
| 9473 |
} |
| 9474 |
} |
| 9475 |
} |
| 9476 |
|
| 9477 |
// packages/blocks/build-module/api/raw-handling/blockquote-normaliser.mjs |
| 9478 |
function blockquoteNormaliser(options) { |
| 9479 |
return (node) => { |
| 9480 |
if (node.nodeName !== "BLOCKQUOTE") { |
| 9481 |
return; |
| 9482 |
} |
| 9483 |
node.innerHTML = normaliseBlocks(node.innerHTML, options); |
| 9484 |
}; |
| 9485 |
} |
| 9486 |
|
| 9487 |
// packages/blocks/build-module/api/raw-handling/figure-content-reducer.mjs |
| 9488 |
var import_dom5 = __toESM(require_dom(), 1); |
| 9489 |
function isFigureContent(node, schema) { |
| 9490 |
const tag = node.nodeName.toLowerCase(); |
| 9491 |
if (tag === "figcaption" || (0, import_dom5.isTextContent)(node)) { |
| 9492 |
return false; |
| 9493 |
} |
| 9494 |
return tag in (schema?.figure?.children ?? {}); |
| 9495 |
} |
| 9496 |
function canHaveAnchor(node, schema) { |
| 9497 |
const tag = node.nodeName.toLowerCase(); |
| 9498 |
return tag in (schema?.figure?.children?.a?.children ?? {}); |
| 9499 |
} |
| 9500 |
function wrapFigureContent(element, beforeElement = element) { |
| 9501 |
const figure = element.ownerDocument.createElement("figure"); |
| 9502 |
beforeElement.parentNode.insertBefore(figure, beforeElement); |
| 9503 |
figure.appendChild(element); |
| 9504 |
} |
| 9505 |
function figureContentReducer(node, doc, schema) { |
| 9506 |
if (!isFigureContent(node, schema)) { |
| 9507 |
return; |
| 9508 |
} |
| 9509 |
let nodeToInsert = node; |
| 9510 |
const parentNode = node.parentNode; |
| 9511 |
if (canHaveAnchor(node, schema) && parentNode.nodeName === "A" && parentNode.childNodes.length === 1) { |
| 9512 |
nodeToInsert = node.parentNode; |
| 9513 |
} |
| 9514 |
const wrapper = nodeToInsert.closest("p,div"); |
| 9515 |
if (wrapper) { |
| 9516 |
if (!node.classList) { |
| 9517 |
wrapFigureContent(nodeToInsert, wrapper); |
| 9518 |
} else if (node.classList.contains("alignright") || node.classList.contains("alignleft") || node.classList.contains("aligncenter") || !wrapper.textContent.trim()) { |
| 9519 |
wrapFigureContent(nodeToInsert, wrapper); |
| 9520 |
} |
| 9521 |
} else { |
| 9522 |
wrapFigureContent(nodeToInsert); |
| 9523 |
} |
| 9524 |
} |
| 9525 |
|
| 9526 |
// packages/blocks/build-module/api/raw-handling/shortcode-converter.mjs |
| 9527 |
var import_shortcode = __toESM(require_shortcode(), 1); |
| 9528 |
var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray]; |
| 9529 |
var beforeLineRegexp = /(\n|<p>|<br\s*\/?>)\s*$/; |
| 9530 |
var afterLineRegexp = /^\s*(\n|<\/p>|<br\s*\/?>)/; |
| 9531 |
function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) { |
| 9532 |
const transformsFrom = getBlockTransforms("from"); |
| 9533 |
const transformation = findTransform( |
| 9534 |
transformsFrom, |
| 9535 |
(transform) => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === "shortcode" && castArray(transform.tag).some( |
| 9536 |
(tag) => (0, import_shortcode.regexp)(tag).test(HTML) |
| 9537 |
) |
| 9538 |
); |
| 9539 |
if (!transformation) { |
| 9540 |
return [HTML]; |
| 9541 |
} |
| 9542 |
const transformTags = castArray(transformation.tag); |
| 9543 |
const transformTag = transformTags.find( |
| 9544 |
(tag) => (0, import_shortcode.regexp)(tag).test(HTML) |
| 9545 |
); |
| 9546 |
let match; |
| 9547 |
const previousIndex = lastIndex; |
| 9548 |
if (match = (0, import_shortcode.next)(transformTag, HTML, lastIndex)) { |
| 9549 |
lastIndex = match.index + match.content.length; |
| 9550 |
const beforeHTML = HTML.substr(0, match.index); |
| 9551 |
const afterHTML = HTML.substr(lastIndex); |
| 9552 |
if (!match.shortcode.content?.includes("<") && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) { |
| 9553 |
return segmentHTMLToShortcodeBlock(HTML, lastIndex); |
| 9554 |
} |
| 9555 |
if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) { |
| 9556 |
return segmentHTMLToShortcodeBlock(HTML, previousIndex, [ |
| 9557 |
...excludedBlockNames, |
| 9558 |
transformation.blockName |
| 9559 |
]); |
| 9560 |
} |
| 9561 |
let blocks = []; |
| 9562 |
if (typeof transformation.transform === "function") { |
| 9563 |
blocks = [].concat( |
| 9564 |
transformation.transform(match.shortcode.attrs, match) |
| 9565 |
); |
| 9566 |
blocks = blocks.map((block) => { |
| 9567 |
block.originalContent = match.shortcode.content; |
| 9568 |
return applyBuiltInValidationFixes( |
| 9569 |
block, |
| 9570 |
getBlockType(block.name) |
| 9571 |
); |
| 9572 |
}); |
| 9573 |
} else { |
| 9574 |
const attributes = Object.fromEntries( |
| 9575 |
Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode).map(([key, schema]) => [ |
| 9576 |
key, |
| 9577 |
schema.shortcode(match.shortcode.attrs, match) |
| 9578 |
]) |
| 9579 |
); |
| 9580 |
const blockType = getBlockType(transformation.blockName); |
| 9581 |
if (!blockType) { |
| 9582 |
return [HTML]; |
| 9583 |
} |
| 9584 |
const transformationBlockType = { |
| 9585 |
...blockType, |
| 9586 |
attributes: transformation.attributes |
| 9587 |
}; |
| 9588 |
let block = createBlock( |
| 9589 |
transformation.blockName, |
| 9590 |
getBlockAttributes( |
| 9591 |
transformationBlockType, |
| 9592 |
match.shortcode.content, |
| 9593 |
attributes |
| 9594 |
) |
| 9595 |
); |
| 9596 |
block.originalContent = match.shortcode.content; |
| 9597 |
block = applyBuiltInValidationFixes( |
| 9598 |
block, |
| 9599 |
transformationBlockType |
| 9600 |
); |
| 9601 |
blocks = [block]; |
| 9602 |
} |
| 9603 |
return [ |
| 9604 |
...segmentHTMLToShortcodeBlock( |
| 9605 |
beforeHTML.replace(beforeLineRegexp, "") |
| 9606 |
), |
| 9607 |
...blocks, |
| 9608 |
...segmentHTMLToShortcodeBlock( |
| 9609 |
afterHTML.replace(afterLineRegexp, "") |
| 9610 |
) |
| 9611 |
]; |
| 9612 |
} |
| 9613 |
return [HTML]; |
| 9614 |
} |
| 9615 |
var shortcode_converter_default = segmentHTMLToShortcodeBlock; |
| 9616 |
|
| 9617 |
// packages/blocks/build-module/api/raw-handling/utils.mjs |
| 9618 |
var import_dom6 = __toESM(require_dom(), 1); |
| 9619 |
function getBlockContentSchemaFromTransforms(transforms, context) { |
| 9620 |
const phrasingContentSchema = (0, import_dom6.getPhrasingContentSchema)(context); |
| 9621 |
const schemaArgs = { phrasingContentSchema, isPaste: context === "paste" }; |
| 9622 |
const schemas = transforms.map(({ isMatch, blockName, schema }) => { |
| 9623 |
const hasAnchorSupport = hasBlockSupport(blockName, "anchor"); |
| 9624 |
schema = typeof schema === "function" ? schema(schemaArgs) : schema; |
| 9625 |
if (!hasAnchorSupport && !isMatch) { |
| 9626 |
return schema; |
| 9627 |
} |
| 9628 |
if (!schema) { |
| 9629 |
return {}; |
| 9630 |
} |
| 9631 |
return Object.fromEntries( |
| 9632 |
Object.entries(schema).map(([key, value]) => { |
| 9633 |
let attributes = value.attributes || []; |
| 9634 |
if (hasAnchorSupport) { |
| 9635 |
attributes = [...attributes, "id"]; |
| 9636 |
} |
| 9637 |
return [ |
| 9638 |
key, |
| 9639 |
{ |
| 9640 |
...value, |
| 9641 |
attributes, |
| 9642 |
isMatch: isMatch ? isMatch : void 0 |
| 9643 |
} |
| 9644 |
]; |
| 9645 |
}) |
| 9646 |
); |
| 9647 |
}); |
| 9648 |
function mergeTagNameSchemaProperties(objValue, srcValue, key) { |
| 9649 |
switch (key) { |
| 9650 |
case "children": { |
| 9651 |
if (objValue === "*" || srcValue === "*") { |
| 9652 |
return "*"; |
| 9653 |
} |
| 9654 |
return { ...objValue, ...srcValue }; |
| 9655 |
} |
| 9656 |
case "attributes": |
| 9657 |
case "require": { |
| 9658 |
return [...objValue || [], ...srcValue || []]; |
| 9659 |
} |
| 9660 |
case "isMatch": { |
| 9661 |
if (!objValue || !srcValue) { |
| 9662 |
return void 0; |
| 9663 |
} |
| 9664 |
return (...args) => { |
| 9665 |
return objValue(...args) || srcValue(...args); |
| 9666 |
}; |
| 9667 |
} |
| 9668 |
} |
| 9669 |
} |
| 9670 |
function mergeTagNameSchemas(a2, b2) { |
| 9671 |
for (const key in b2) { |
| 9672 |
a2[key] = a2[key] ? mergeTagNameSchemaProperties(a2[key], b2[key], key) : { ...b2[key] }; |
| 9673 |
} |
| 9674 |
return a2; |
| 9675 |
} |
| 9676 |
function mergeSchemas(a2, b2) { |
| 9677 |
for (const key in b2) { |
| 9678 |
a2[key] = a2[key] ? mergeTagNameSchemas(a2[key], b2[key]) : { ...b2[key] }; |
| 9679 |
} |
| 9680 |
return a2; |
| 9681 |
} |
| 9682 |
return schemas.reduce(mergeSchemas, {}); |
| 9683 |
} |
| 9684 |
function getBlockContentSchema(context) { |
| 9685 |
return getBlockContentSchemaFromTransforms(getRawTransforms(), context); |
| 9686 |
} |
| 9687 |
function isPlain(HTML) { |
| 9688 |
if (!/<(?!br[ />])/i.test(HTML)) { |
| 9689 |
return true; |
| 9690 |
} |
| 9691 |
const doc = document.implementation.createHTMLDocument(""); |
| 9692 |
doc.body.innerHTML = HTML; |
| 9693 |
if (doc.body.children.length !== 1) { |
| 9694 |
return false; |
| 9695 |
} |
| 9696 |
const wrapper = doc.body.children.item(0); |
| 9697 |
const descendants = wrapper.getElementsByTagName("*"); |
| 9698 |
for (let i2 = 0; i2 < descendants.length; i2++) { |
| 9699 |
if (descendants.item(i2).tagName !== "BR") { |
| 9700 |
return false; |
| 9701 |
} |
| 9702 |
} |
| 9703 |
if (wrapper.tagName !== "SPAN") { |
| 9704 |
return false; |
| 9705 |
} |
| 9706 |
return true; |
| 9707 |
} |
| 9708 |
function deepFilterNodeList(nodeList, filters, doc, schema) { |
| 9709 |
Array.from(nodeList).forEach((node) => { |
| 9710 |
deepFilterNodeList(node.childNodes, filters, doc, schema); |
| 9711 |
filters.forEach((item) => { |
| 9712 |
if (!doc.contains(node)) { |
| 9713 |
return; |
| 9714 |
} |
| 9715 |
item(node, doc, schema); |
| 9716 |
}); |
| 9717 |
}); |
| 9718 |
} |
| 9719 |
function deepFilterHTML(HTML, filters = [], schema) { |
| 9720 |
const doc = document.implementation.createHTMLDocument(""); |
| 9721 |
doc.body.innerHTML = HTML; |
| 9722 |
deepFilterNodeList(doc.body.childNodes, filters, doc, schema); |
| 9723 |
return doc.body.innerHTML; |
| 9724 |
} |
| 9725 |
function getSibling(node, which) { |
| 9726 |
const sibling = node[`${which}Sibling`]; |
| 9727 |
if (sibling && (0, import_dom6.isPhrasingContent)(sibling)) { |
| 9728 |
return sibling; |
| 9729 |
} |
| 9730 |
const { parentNode } = node; |
| 9731 |
if (!parentNode || !(0, import_dom6.isPhrasingContent)(parentNode)) { |
| 9732 |
return; |
| 9733 |
} |
| 9734 |
return getSibling(parentNode, which); |
| 9735 |
} |
| 9736 |
|
| 9737 |
// packages/blocks/build-module/api/raw-handling/paste-handler.mjs |
| 9738 |
var import_dom11 = __toESM(require_dom(), 1); |
| 9739 |
|
| 9740 |
// packages/blocks/build-module/api/raw-handling/comment-remover.mjs |
| 9741 |
var import_dom7 = __toESM(require_dom(), 1); |
| 9742 |
function commentRemover(node) { |
| 9743 |
if (node.nodeType === node.COMMENT_NODE) { |
| 9744 |
(0, import_dom7.remove)(node); |
| 9745 |
} |
| 9746 |
} |
| 9747 |
|
| 9748 |
// packages/blocks/build-module/api/raw-handling/is-inline-content.mjs |
| 9749 |
var import_dom8 = __toESM(require_dom(), 1); |
| 9750 |
function isInline(node, contextTag) { |
| 9751 |
if ((0, import_dom8.isTextContent)(node)) { |
| 9752 |
return true; |
| 9753 |
} |
| 9754 |
if (!contextTag) { |
| 9755 |
return false; |
| 9756 |
} |
| 9757 |
const tag = node.nodeName.toLowerCase(); |
| 9758 |
const inlineAllowedTagGroups = [ |
| 9759 |
["ul", "li", "ol"], |
| 9760 |
["h1", "h2", "h3", "h4", "h5", "h6"] |
| 9761 |
]; |
| 9762 |
return inlineAllowedTagGroups.some( |
| 9763 |
(tagGroup) => [tag, contextTag].filter((t3) => !tagGroup.includes(t3)).length === 0 |
| 9764 |
); |
| 9765 |
} |
| 9766 |
function deepCheck(nodes, contextTag) { |
| 9767 |
return nodes.every( |
| 9768 |
(node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag) |
| 9769 |
); |
| 9770 |
} |
| 9771 |
function isDoubleBR(node) { |
| 9772 |
return node.nodeName === "BR" && node.previousSibling && node.previousSibling.nodeName === "BR"; |
| 9773 |
} |
| 9774 |
function isInlineContent(HTML, contextTag) { |
| 9775 |
const doc = document.implementation.createHTMLDocument(""); |
| 9776 |
doc.body.innerHTML = HTML; |
| 9777 |
const nodes = Array.from(doc.body.children); |
| 9778 |
return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag); |
| 9779 |
} |
| 9780 |
|
| 9781 |
// packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.mjs |
| 9782 |
var import_dom9 = __toESM(require_dom(), 1); |
| 9783 |
function phrasingContentReducer(node, doc) { |
| 9784 |
if (node.nodeName === "SPAN" && node.style) { |
| 9785 |
const { |
| 9786 |
fontWeight, |
| 9787 |
fontStyle, |
| 9788 |
textDecorationLine, |
| 9789 |
textDecoration, |
| 9790 |
verticalAlign |
| 9791 |
} = node.style; |
| 9792 |
if (fontWeight === "bold" || fontWeight === "700") { |
| 9793 |
(0, import_dom9.wrap)(doc.createElement("strong"), node); |
| 9794 |
} |
| 9795 |
if (fontStyle === "italic") { |
| 9796 |
(0, import_dom9.wrap)(doc.createElement("em"), node); |
| 9797 |
} |
| 9798 |
if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) { |
| 9799 |
(0, import_dom9.wrap)(doc.createElement("s"), node); |
| 9800 |
} |
| 9801 |
if (verticalAlign === "super") { |
| 9802 |
(0, import_dom9.wrap)(doc.createElement("sup"), node); |
| 9803 |
} else if (verticalAlign === "sub") { |
| 9804 |
(0, import_dom9.wrap)(doc.createElement("sub"), node); |
| 9805 |
} |
| 9806 |
} else if (node.nodeName === "B") { |
| 9807 |
node = (0, import_dom9.replaceTag)(node, "strong"); |
| 9808 |
} else if (node.nodeName === "I") { |
| 9809 |
node = (0, import_dom9.replaceTag)(node, "em"); |
| 9810 |
} else if (node.nodeName === "A") { |
| 9811 |
if (node.target && node.target.toLowerCase() === "_blank") { |
| 9812 |
node.rel = "noreferrer noopener"; |
| 9813 |
} else { |
| 9814 |
node.removeAttribute("target"); |
| 9815 |
node.removeAttribute("rel"); |
| 9816 |
} |
| 9817 |
if (node.name && !node.id) { |
| 9818 |
node.id = node.name; |
| 9819 |
} |
| 9820 |
if (node.id && !node.ownerDocument.querySelector(`[href="#${node.id}"]`)) { |
| 9821 |
node.removeAttribute("id"); |
| 9822 |
} |
| 9823 |
} |
| 9824 |
} |
| 9825 |
|
| 9826 |
// packages/blocks/build-module/api/raw-handling/head-remover.mjs |
| 9827 |
function headRemover(node) { |
| 9828 |
if (node.nodeName !== "SCRIPT" && node.nodeName !== "NOSCRIPT" && node.nodeName !== "TEMPLATE" && node.nodeName !== "STYLE") { |
| 9829 |
return; |
| 9830 |
} |
| 9831 |
node.parentNode.removeChild(node); |
| 9832 |
} |
| 9833 |
|
| 9834 |
// packages/blocks/build-module/api/raw-handling/ms-list-ignore.mjs |
| 9835 |
function msListIgnore(node) { |
| 9836 |
if (node.nodeType !== node.ELEMENT_NODE) { |
| 9837 |
return; |
| 9838 |
} |
| 9839 |
const style = node.getAttribute("style"); |
| 9840 |
if (!style || !style.includes("mso-list")) { |
| 9841 |
return; |
| 9842 |
} |
| 9843 |
const rules = style.split(";").reduce((acc, rule) => { |
| 9844 |
const [key, value] = rule.split(":"); |
| 9845 |
if (key && value) { |
| 9846 |
acc[key.trim().toLowerCase()] = value.trim().toLowerCase(); |
| 9847 |
} |
| 9848 |
return acc; |
| 9849 |
}, {}); |
| 9850 |
if (rules["mso-list"] === "ignore") { |
| 9851 |
node.remove(); |
| 9852 |
} |
| 9853 |
} |
| 9854 |
|
| 9855 |
// packages/blocks/build-module/api/raw-handling/ms-list-converter.mjs |
| 9856 |
function isList2(node) { |
| 9857 |
return node.nodeName === "OL" || node.nodeName === "UL"; |
| 9858 |
} |
| 9859 |
function msListConverter(node, doc) { |
| 9860 |
if (node.nodeName !== "P") { |
| 9861 |
return; |
| 9862 |
} |
| 9863 |
const style = node.getAttribute("style"); |
| 9864 |
if (!style || !style.includes("mso-list")) { |
| 9865 |
return; |
| 9866 |
} |
| 9867 |
const prevNode = node.previousElementSibling; |
| 9868 |
if (!prevNode || !isList2(prevNode)) { |
| 9869 |
const type = node.textContent.trim().slice(0, 1); |
| 9870 |
const isNumeric = /[1iIaA]/.test(type); |
| 9871 |
const newListNode = doc.createElement(isNumeric ? "ol" : "ul"); |
| 9872 |
if (isNumeric) { |
| 9873 |
newListNode.setAttribute("type", type); |
| 9874 |
} |
| 9875 |
node.parentNode.insertBefore(newListNode, node); |
| 9876 |
} |
| 9877 |
const listNode = node.previousElementSibling; |
| 9878 |
const listType = listNode.nodeName; |
| 9879 |
const listItem = doc.createElement("li"); |
| 9880 |
let receivingNode = listNode; |
| 9881 |
listItem.innerHTML = deepFilterHTML(node.innerHTML, [msListIgnore]); |
| 9882 |
const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style); |
| 9883 |
let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0; |
| 9884 |
while (level--) { |
| 9885 |
receivingNode = receivingNode.lastChild || receivingNode; |
| 9886 |
if (isList2(receivingNode)) { |
| 9887 |
receivingNode = receivingNode.lastChild || receivingNode; |
| 9888 |
} |
| 9889 |
} |
| 9890 |
if (!isList2(receivingNode)) { |
| 9891 |
receivingNode = receivingNode.appendChild( |
| 9892 |
doc.createElement(listType) |
| 9893 |
); |
| 9894 |
} |
| 9895 |
receivingNode.appendChild(listItem); |
| 9896 |
node.parentNode.removeChild(node); |
| 9897 |
} |
| 9898 |
|
| 9899 |
// packages/blocks/build-module/api/raw-handling/image-corrector.mjs |
| 9900 |
var import_blob = __toESM(require_blob(), 1); |
| 9901 |
function imageCorrector(node) { |
| 9902 |
if (node.nodeName !== "IMG") { |
| 9903 |
return; |
| 9904 |
} |
| 9905 |
if (node.src.indexOf("file:") === 0) { |
| 9906 |
node.src = ""; |
| 9907 |
} |
| 9908 |
if (node.src.indexOf("data:") === 0) { |
| 9909 |
const [properties, data] = node.src.split(","); |
| 9910 |
const [type] = properties.slice(5).split(";"); |
| 9911 |
if (!data || !type) { |
| 9912 |
node.src = ""; |
| 9913 |
return; |
| 9914 |
} |
| 9915 |
let decoded; |
| 9916 |
try { |
| 9917 |
decoded = atob(data); |
| 9918 |
} catch (e2) { |
| 9919 |
node.src = ""; |
| 9920 |
return; |
| 9921 |
} |
| 9922 |
const uint8Array = new Uint8Array(decoded.length); |
| 9923 |
for (let i2 = 0; i2 < uint8Array.length; i2++) { |
| 9924 |
uint8Array[i2] = decoded.charCodeAt(i2); |
| 9925 |
} |
| 9926 |
const name = type.replace("/", "."); |
| 9927 |
const file = new window.File([uint8Array], name, { type }); |
| 9928 |
node.src = (0, import_blob.createBlobURL)(file); |
| 9929 |
} |
| 9930 |
if (node.height === 1 || node.width === 1) { |
| 9931 |
node.parentNode.removeChild(node); |
| 9932 |
} |
| 9933 |
} |
| 9934 |
|
| 9935 |
// packages/blocks/build-module/api/raw-handling/div-normaliser.mjs |
| 9936 |
function divNormaliser(node) { |
| 9937 |
if (node.nodeName !== "DIV") { |
| 9938 |
return; |
| 9939 |
} |
| 9940 |
node.innerHTML = normaliseBlocks(node.innerHTML); |
| 9941 |
} |
| 9942 |
|
| 9943 |
// packages/blocks/build-module/api/raw-handling/markdown-converter.mjs |
| 9944 |
var import_showdown = __toESM(require_showdown(), 1); |
| 9945 |
var converter = new import_showdown.default.Converter({ |
| 9946 |
noHeaderId: true, |
| 9947 |
tables: true, |
| 9948 |
literalMidWordUnderscores: true, |
| 9949 |
omitExtraWLInCodeBlocks: true, |
| 9950 |
simpleLineBreaks: true, |
| 9951 |
strikethrough: true |
| 9952 |
}); |
| 9953 |
function slackMarkdownVariantCorrector(text2) { |
| 9954 |
return text2.replace( |
| 9955 |
/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, |
| 9956 |
(match, p1, p2, p3) => `${p1} |
| 9957 |
${p2} |
| 9958 |
${p3}` |
| 9959 |
); |
| 9960 |
} |
| 9961 |
function bulletsToAsterisks(text2) { |
| 9962 |
return text2.replace(/(^|\n)•( +)/g, "$1*$2"); |
| 9963 |
} |
| 9964 |
function markdownConverter(text2) { |
| 9965 |
return converter.makeHtml( |
| 9966 |
slackMarkdownVariantCorrector(bulletsToAsterisks(text2)) |
| 9967 |
); |
| 9968 |
} |
| 9969 |
|
| 9970 |
// packages/blocks/build-module/api/raw-handling/iframe-remover.mjs |
| 9971 |
function iframeRemover(node) { |
| 9972 |
if (node.nodeName === "IFRAME") { |
| 9973 |
const text2 = node.ownerDocument.createTextNode(node.src); |
| 9974 |
node.parentNode.replaceChild(text2, node); |
| 9975 |
} |
| 9976 |
} |
| 9977 |
|
| 9978 |
// packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.mjs |
| 9979 |
var import_dom10 = __toESM(require_dom(), 1); |
| 9980 |
function googleDocsUIdRemover(node) { |
| 9981 |
if (!node.id || node.id.indexOf("docs-internal-guid-") !== 0) { |
| 9982 |
return; |
| 9983 |
} |
| 9984 |
if (node.tagName === "B") { |
| 9985 |
(0, import_dom10.unwrap)(node); |
| 9986 |
} else { |
| 9987 |
node.removeAttribute("id"); |
| 9988 |
} |
| 9989 |
} |
| 9990 |
|
| 9991 |
// packages/blocks/build-module/api/raw-handling/html-formatting-remover.mjs |
| 9992 |
function isFormattingSpace(character) { |
| 9993 |
return character === " " || character === "\r" || character === "\n" || character === " "; |
| 9994 |
} |
| 9995 |
function htmlFormattingRemover(node) { |
| 9996 |
if (node.nodeType !== node.TEXT_NODE) { |
| 9997 |
return; |
| 9998 |
} |
| 9999 |
let parent = node; |
| 10000 |
while (parent = parent.parentNode) { |
| 10001 |
if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") { |
| 10002 |
return; |
| 10003 |
} |
| 10004 |
} |
| 10005 |
let newData = node.data.replace(/[ \r\n\t]+/g, " "); |
| 10006 |
if (newData[0] === " ") { |
| 10007 |
const previousSibling = getSibling(node, "previous"); |
| 10008 |
if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") { |
| 10009 |
newData = newData.slice(1); |
| 10010 |
} |
| 10011 |
} |
| 10012 |
if (newData[newData.length - 1] === " ") { |
| 10013 |
const nextSibling = getSibling(node, "next"); |
| 10014 |
if (!nextSibling || nextSibling.nodeName === "BR" || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) { |
| 10015 |
newData = newData.slice(0, -1); |
| 10016 |
} |
| 10017 |
} |
| 10018 |
if (!newData) { |
| 10019 |
node.parentNode.removeChild(node); |
| 10020 |
} else { |
| 10021 |
node.data = newData; |
| 10022 |
} |
| 10023 |
} |
| 10024 |
|
| 10025 |
// packages/blocks/build-module/api/raw-handling/br-remover.mjs |
| 10026 |
function brRemover(node) { |
| 10027 |
if (node.nodeName !== "BR") { |
| 10028 |
return; |
| 10029 |
} |
| 10030 |
if (getSibling(node, "next")) { |
| 10031 |
return; |
| 10032 |
} |
| 10033 |
node.parentNode.removeChild(node); |
| 10034 |
} |
| 10035 |
|
| 10036 |
// packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.mjs |
| 10037 |
function emptyParagraphRemover(node) { |
| 10038 |
if (node.nodeName !== "P") { |
| 10039 |
return; |
| 10040 |
} |
| 10041 |
if (node.hasChildNodes()) { |
| 10042 |
return; |
| 10043 |
} |
| 10044 |
node.parentNode.removeChild(node); |
| 10045 |
} |
| 10046 |
|
| 10047 |
// packages/blocks/build-module/api/raw-handling/slack-paragraph-corrector.mjs |
| 10048 |
function slackParagraphCorrector(node) { |
| 10049 |
if (node.nodeName !== "SPAN") { |
| 10050 |
return; |
| 10051 |
} |
| 10052 |
if (node.getAttribute("data-stringify-type") !== "paragraph-break") { |
| 10053 |
return; |
| 10054 |
} |
| 10055 |
const { parentNode } = node; |
| 10056 |
parentNode.insertBefore(node.ownerDocument.createElement("br"), node); |
| 10057 |
parentNode.insertBefore(node.ownerDocument.createElement("br"), node); |
| 10058 |
parentNode.removeChild(node); |
| 10059 |
} |
| 10060 |
|
| 10061 |
// packages/blocks/build-module/api/raw-handling/latex-to-math.mjs |
| 10062 |
function isLatexMathMode(text2) { |
| 10063 |
const lettersRegex = /[\p{L}\s]+/gu; |
| 10064 |
let match; |
| 10065 |
while (match = lettersRegex.exec(text2)) { |
| 10066 |
if (text2[match.index - 1] === "{") { |
| 10067 |
continue; |
| 10068 |
} |
| 10069 |
let sequence = match[0]; |
| 10070 |
if (text2[match.index - 1] === "\\") { |
| 10071 |
sequence = sequence.replace(/^[a-zA-Z]+/, ""); |
| 10072 |
} |
| 10073 |
if (sequence.length < 6) { |
| 10074 |
continue; |
| 10075 |
} |
| 10076 |
return false; |
| 10077 |
} |
| 10078 |
if (/\\[a-zA-Z]+\s*\{/g.test(text2)) { |
| 10079 |
return true; |
| 10080 |
} |
| 10081 |
const softClues = [ |
| 10082 |
(t3) => t3.includes("^") && !t3.startsWith("^"), |
| 10083 |
(t3) => ["=", "+", "-", "/", "*"].some( |
| 10084 |
(operator) => t3.includes(operator) |
| 10085 |
), |
| 10086 |
(t3) => /\\[a-zA-Z]+/g.test(t3) |
| 10087 |
]; |
| 10088 |
if (softClues.filter((clue) => clue(text2)).length >= 2) { |
| 10089 |
return true; |
| 10090 |
} |
| 10091 |
return false; |
| 10092 |
} |
| 10093 |
|
| 10094 |
// packages/blocks/build-module/api/raw-handling/heading-transformer.mjs |
| 10095 |
function headingTransformer(node) { |
| 10096 |
if (node.nodeType !== node.ELEMENT_NODE) { |
| 10097 |
return; |
| 10098 |
} |
| 10099 |
if (node.tagName === "P" && node.getAttribute("role") === "heading" && node.hasAttribute("aria-level")) { |
| 10100 |
const level = parseInt(node.getAttribute("aria-level"), 10); |
| 10101 |
if (level >= 1 && level <= 6) { |
| 10102 |
const headingTag = `H${level}`; |
| 10103 |
const newHeading = node.ownerDocument.createElement(headingTag); |
| 10104 |
Array.from(node.attributes).forEach((attr2) => { |
| 10105 |
if (attr2.name !== "role" && attr2.name !== "aria-level") { |
| 10106 |
newHeading.setAttribute(attr2.name, attr2.value); |
| 10107 |
} |
| 10108 |
}); |
| 10109 |
while (node.firstChild) { |
| 10110 |
newHeading.appendChild(node.firstChild); |
| 10111 |
} |
| 10112 |
node.parentNode.replaceChild(newHeading, node); |
| 10113 |
} |
| 10114 |
} |
| 10115 |
} |
| 10116 |
|
| 10117 |
// packages/blocks/build-module/api/raw-handling/paste-handler.mjs |
| 10118 |
var log = (...args) => window?.console?.log?.(...args); |
| 10119 |
function filterInlineHTML(HTML) { |
| 10120 |
HTML = deepFilterHTML(HTML, [ |
| 10121 |
headRemover, |
| 10122 |
googleDocsUIdRemover, |
| 10123 |
msListIgnore, |
| 10124 |
phrasingContentReducer, |
| 10125 |
commentRemover |
| 10126 |
]); |
| 10127 |
HTML = (0, import_dom11.removeInvalidHTML)(HTML, (0, import_dom11.getPhrasingContentSchema)("paste"), { |
| 10128 |
inline: true |
| 10129 |
}); |
| 10130 |
HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]); |
| 10131 |
log("Processed inline HTML:\n\n", HTML); |
| 10132 |
return HTML; |
| 10133 |
} |
| 10134 |
function pasteHandler({ |
| 10135 |
HTML = "", |
| 10136 |
plainText = "", |
| 10137 |
mode = "AUTO", |
| 10138 |
tagName |
| 10139 |
}) { |
| 10140 |
log("Received HTML (pasteHandler):\n\n", HTML); |
| 10141 |
log("Received plain text (pasteHandler):\n\n", plainText); |
| 10142 |
HTML = HTML.replace(/<meta[^>]+>/g, ""); |
| 10143 |
HTML = HTML.replace( |
| 10144 |
/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, |
| 10145 |
"" |
| 10146 |
); |
| 10147 |
HTML = HTML.replace( |
| 10148 |
/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, |
| 10149 |
"" |
| 10150 |
); |
| 10151 |
if (mode !== "INLINE") { |
| 10152 |
const content = HTML ? HTML : plainText; |
| 10153 |
if (content.indexOf("<!-- wp:") !== -1) { |
| 10154 |
const parseResult = parse2(content); |
| 10155 |
const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; |
| 10156 |
if (!isSingleFreeFormBlock) { |
| 10157 |
return parseResult; |
| 10158 |
} |
| 10159 |
} |
| 10160 |
} |
| 10161 |
if (String.prototype.normalize) { |
| 10162 |
HTML = HTML.normalize(); |
| 10163 |
} |
| 10164 |
HTML = deepFilterHTML(HTML, [slackParagraphCorrector]); |
| 10165 |
const isPlainText = plainText && (!HTML || isPlain(HTML)); |
| 10166 |
if (isPlainText && isLatexMathMode(plainText)) { |
| 10167 |
return [createBlock("core/math", { latex: plainText })]; |
| 10168 |
} |
| 10169 |
if (isPlainText) { |
| 10170 |
HTML = plainText; |
| 10171 |
if (!/^\s+$/.test(plainText)) { |
| 10172 |
HTML = markdownConverter(HTML); |
| 10173 |
} |
| 10174 |
} |
| 10175 |
const pieces = shortcode_converter_default(HTML); |
| 10176 |
const hasShortcodes = pieces.length > 1; |
| 10177 |
if (isPlainText && !hasShortcodes) { |
| 10178 |
if (mode === "AUTO" && plainText.indexOf("\n") === -1 && plainText.indexOf("<p>") !== 0 && HTML.indexOf("<p>") === 0) { |
| 10179 |
mode = "INLINE"; |
| 10180 |
} |
| 10181 |
} |
| 10182 |
if (mode === "INLINE") { |
| 10183 |
return filterInlineHTML(HTML); |
| 10184 |
} |
| 10185 |
if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) { |
| 10186 |
return filterInlineHTML(HTML); |
| 10187 |
} |
| 10188 |
const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste"); |
| 10189 |
const blockContentSchema = getBlockContentSchema("paste"); |
| 10190 |
const blocks = pieces.map((piece) => { |
| 10191 |
if (typeof piece !== "string") { |
| 10192 |
return piece; |
| 10193 |
} |
| 10194 |
const filters = [ |
| 10195 |
googleDocsUIdRemover, |
| 10196 |
msListConverter, |
| 10197 |
headRemover, |
| 10198 |
listReducer, |
| 10199 |
imageCorrector, |
| 10200 |
phrasingContentReducer, |
| 10201 |
specialCommentConverter, |
| 10202 |
commentRemover, |
| 10203 |
iframeRemover, |
| 10204 |
figureContentReducer, |
| 10205 |
blockquoteNormaliser(), |
| 10206 |
divNormaliser, |
| 10207 |
headingTransformer |
| 10208 |
]; |
| 10209 |
const schema = { |
| 10210 |
...blockContentSchema, |
| 10211 |
// Keep top-level phrasing content, normalised by `normaliseBlocks`. |
| 10212 |
...phrasingContentSchema |
| 10213 |
}; |
| 10214 |
piece = deepFilterHTML(piece, filters, blockContentSchema); |
| 10215 |
piece = (0, import_dom11.removeInvalidHTML)(piece, schema); |
| 10216 |
piece = normaliseBlocks(piece); |
| 10217 |
piece = deepFilterHTML( |
| 10218 |
piece, |
| 10219 |
[htmlFormattingRemover, brRemover, emptyParagraphRemover], |
| 10220 |
blockContentSchema |
| 10221 |
); |
| 10222 |
log("Processed HTML piece:\n\n", piece); |
| 10223 |
return htmlToBlocks(piece, pasteHandler); |
| 10224 |
}).flat().filter(Boolean); |
| 10225 |
if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) { |
| 10226 |
const trimRegex = /^[\n]+|[\n]+$/g; |
| 10227 |
const trimmedPlainText = plainText.replace(trimRegex, ""); |
| 10228 |
if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) { |
| 10229 |
return (0, import_dom11.removeInvalidHTML)( |
| 10230 |
getBlockInnerHTML(blocks[0]), |
| 10231 |
phrasingContentSchema |
| 10232 |
).replace(trimRegex, ""); |
| 10233 |
} |
| 10234 |
} |
| 10235 |
return blocks; |
| 10236 |
} |
| 10237 |
|
| 10238 |
// packages/blocks/build-module/api/raw-handling/index.mjs |
| 10239 |
function deprecatedGetPhrasingContentSchema(context) { |
| 10240 |
(0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", { |
| 10241 |
since: "5.6", |
| 10242 |
alternative: "wp.dom.getPhrasingContentSchema" |
| 10243 |
}); |
| 10244 |
return (0, import_dom12.getPhrasingContentSchema)(context); |
| 10245 |
} |
| 10246 |
function rawHandler({ HTML = "" }) { |
| 10247 |
if (HTML.indexOf("<!-- wp:") !== -1) { |
| 10248 |
const parseResult = parse2(HTML); |
| 10249 |
const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform"; |
| 10250 |
if (!isSingleFreeFormBlock) { |
| 10251 |
return parseResult; |
| 10252 |
} |
| 10253 |
} |
| 10254 |
const pieces = shortcode_converter_default(HTML); |
| 10255 |
const blockContentSchema = getBlockContentSchema(); |
| 10256 |
return pieces.map((piece) => { |
| 10257 |
if (typeof piece !== "string") { |
| 10258 |
return piece; |
| 10259 |
} |
| 10260 |
const filters = [ |
| 10261 |
// Needed to adjust invalid lists. |
| 10262 |
listReducer, |
| 10263 |
// Needed to create more and nextpage blocks. |
| 10264 |
specialCommentConverter, |
| 10265 |
// Needed to create media blocks. |
| 10266 |
figureContentReducer, |
| 10267 |
// Needed to create the quote block, which cannot handle text |
| 10268 |
// without wrapper paragraphs. |
| 10269 |
blockquoteNormaliser({ raw: true }) |
| 10270 |
]; |
| 10271 |
piece = deepFilterHTML(piece, filters, blockContentSchema); |
| 10272 |
piece = normaliseBlocks(piece, { raw: true }); |
| 10273 |
return htmlToBlocks(piece, rawHandler); |
| 10274 |
}).flat().filter(Boolean); |
| 10275 |
} |
| 10276 |
|
| 10277 |
// packages/blocks/build-module/api/categories.mjs |
| 10278 |
var import_data6 = __toESM(require_data(), 1); |
| 10279 |
function getCategories2() { |
| 10280 |
return (0, import_data6.select)(store).getCategories(); |
| 10281 |
} |
| 10282 |
function setCategories2(categories2) { |
| 10283 |
(0, import_data6.dispatch)(store).setCategories(categories2); |
| 10284 |
} |
| 10285 |
function updateCategory2(slug, category) { |
| 10286 |
(0, import_data6.dispatch)(store).updateCategory(slug, category); |
| 10287 |
} |
| 10288 |
|
| 10289 |
// packages/blocks/build-module/api/templates.mjs |
| 10290 |
var import_element5 = __toESM(require_element(), 1); |
| 10291 |
function doBlocksMatchTemplate(blocks = [], template = []) { |
| 10292 |
return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => { |
| 10293 |
const block = blocks[index]; |
| 10294 |
return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate); |
| 10295 |
}); |
| 10296 |
} |
| 10297 |
var isHTMLAttribute = (attributeDefinition) => attributeDefinition?.source === "html"; |
| 10298 |
var isQueryAttribute = (attributeDefinition) => attributeDefinition?.source === "query"; |
| 10299 |
function normalizeAttributes(schema, values) { |
| 10300 |
if (!values) { |
| 10301 |
return {}; |
| 10302 |
} |
| 10303 |
return Object.fromEntries( |
| 10304 |
Object.entries(values).map(([key, value]) => [ |
| 10305 |
key, |
| 10306 |
normalizeAttribute(schema[key], value) |
| 10307 |
]) |
| 10308 |
); |
| 10309 |
} |
| 10310 |
function normalizeAttribute(definition, value) { |
| 10311 |
if (isHTMLAttribute(definition) && Array.isArray(value)) { |
| 10312 |
return (0, import_element5.renderToString)(value); |
| 10313 |
} |
| 10314 |
if (isQueryAttribute(definition) && value) { |
| 10315 |
return value.map((subValues) => { |
| 10316 |
return normalizeAttributes(definition.query, subValues); |
| 10317 |
}); |
| 10318 |
} |
| 10319 |
return value; |
| 10320 |
} |
| 10321 |
function synchronizeBlocksWithTemplate(blocks = [], template) { |
| 10322 |
if (!template) { |
| 10323 |
return blocks; |
| 10324 |
} |
| 10325 |
return template.map( |
| 10326 |
([name, attributes, innerBlocksTemplate], index) => { |
| 10327 |
const block = blocks[index]; |
| 10328 |
if (block && block.name === name) { |
| 10329 |
const innerBlocks = synchronizeBlocksWithTemplate( |
| 10330 |
block.innerBlocks, |
| 10331 |
innerBlocksTemplate |
| 10332 |
); |
| 10333 |
return { ...block, innerBlocks }; |
| 10334 |
} |
| 10335 |
const blockType = getBlockType(name); |
| 10336 |
const normalizedAttributes = normalizeAttributes( |
| 10337 |
blockType?.attributes ?? {}, |
| 10338 |
attributes |
| 10339 |
); |
| 10340 |
const [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes( |
| 10341 |
name, |
| 10342 |
normalizedAttributes |
| 10343 |
); |
| 10344 |
return createBlock( |
| 10345 |
blockName, |
| 10346 |
blockAttributes, |
| 10347 |
synchronizeBlocksWithTemplate([], innerBlocksTemplate) |
| 10348 |
); |
| 10349 |
} |
| 10350 |
); |
| 10351 |
} |
| 10352 |
|
| 10353 |
// packages/blocks/build-module/api/index.mjs |
| 10354 |
var fieldsKey = /* @__PURE__ */ Symbol("fields"); |
| 10355 |
var formKey = /* @__PURE__ */ Symbol("form"); |
| 10356 |
var privateApis = {}; |
| 10357 |
lock(privateApis, { |
| 10358 |
isContentBlock, |
| 10359 |
fieldsKey, |
| 10360 |
formKey, |
| 10361 |
parseRawBlock |
| 10362 |
}); |
| 10363 |
|
| 10364 |
// packages/blocks/build-module/deprecated.mjs |
| 10365 |
var import_deprecated11 = __toESM(require_deprecated(), 1); |
| 10366 |
function withBlockContentContext(OriginalComponent) { |
| 10367 |
(0, import_deprecated11.default)("wp.blocks.withBlockContentContext", { |
| 10368 |
since: "6.1" |
| 10369 |
}); |
| 10370 |
return OriginalComponent; |
| 10371 |
} |
| 10372 |
return __toCommonJS(index_exports); |
| 10373 |
})(); |
| 10374 |
/*! Bundled license information: |
| 10375 |
|
| 10376 |
react-is/cjs/react-is.development.js: |
| 10377 |
(** |
| 10378 |
* @license React |
| 10379 |
* react-is.development.js |
| 10380 |
* |
| 10381 |
* Copyright (c) Facebook, Inc. and its affiliates. |
| 10382 |
* |
| 10383 |
* This source code is licensed under the MIT license found in the |
| 10384 |
* LICENSE file in the root directory of this source tree. |
| 10385 |
*) |
| 10386 |
|
| 10387 |
showdown/dist/showdown.js: |
| 10388 |
(*! showdown v 1.9.1 - 02-11-2019 *) |
| 10389 |
|
| 10390 |
is-plain-object/dist/is-plain-object.mjs: |
| 10391 |
(*! |
| 10392 |
* is-plain-object <https://github.com/jonschlinkert/is-plain-object> |
| 10393 |
* |
| 10394 |
* Copyright (c) 2014-2017, Jon Schlinkert. |
| 10395 |
* Released under the MIT License. |
| 10396 |
*) |
| 10397 |
*/ |
| 10398 |
//# sourceMappingURL=index.js.map |
| 10399 |
|