PluginProbe
Gutenberg / 23.3.1
Gutenberg v23.3.1
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / scripts / blocks / index.js

index.js in Gutenberg 23.3.1, at build/scripts/blocks/index.js

10,459 lines 380.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 "use strict";
2 var wp;
3 (wp ||= {}).blocks = (() => {
4 var __create = Object.create;
5 var __defProp = Object.defineProperty;
6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7 var __getOwnPropNames = Object.getOwnPropertyNames;
8 var __getProtoOf = Object.getPrototypeOf;
9 var __hasOwnProp = Object.prototype.hasOwnProperty;
10 var __commonJS = (cb, mod) => function __require() {
11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12 };
13 var __export = (target, all) => {
14 for (var name in all)
15 __defProp(target, name, { get: all[name], enumerable: true });
16 };
17 var __copyProps = (to, from, except, desc) => {
18 if (from && typeof from === "object" || typeof from === "function") {
19 for (let key of __getOwnPropNames(from))
20 if (!__hasOwnProp.call(to, key) && key !== except)
21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22 }
23 return to;
24 };
25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26 // If the importer is in node compatibility mode or this is not an ESM
27 // file that has been converted to a CommonJS file using a Babel-
28 // compatible transform (i.e. "__esModule" has not been set), then set
29 // "default" to the CommonJS "module.exports" for node compatibility.
30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31 mod
32 ));
33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
35 // package-external:@wordpress/data
36 var require_data = __commonJS({
37 "package-external:@wordpress/data"(exports, module) {
38 module.exports = window.wp.data;
39 }
40 });
41
42 // package-external:@wordpress/i18n
43 var require_i18n = __commonJS({
44 "package-external:@wordpress/i18n"(exports, module) {
45 module.exports = window.wp.i18n;
46 }
47 });
48
49 // package-external:@wordpress/element
50 var require_element = __commonJS({
51 "package-external:@wordpress/element"(exports, module) {
52 module.exports = window.wp.element;
53 }
54 });
55
56 // package-external:@wordpress/dom
57 var require_dom = __commonJS({
58 "package-external:@wordpress/dom"(exports, module) {
59 module.exports = window.wp.dom;
60 }
61 });
62
63 // package-external:@wordpress/rich-text
64 var require_rich_text = __commonJS({
65 "package-external:@wordpress/rich-text"(exports, module) {
66 module.exports = window.wp.richText;
67 }
68 });
69
70 // package-external:@wordpress/deprecated
71 var require_deprecated = __commonJS({
72 "package-external:@wordpress/deprecated"(exports, module) {
73 module.exports = window.wp.deprecated;
74 }
75 });
76
77 // package-external:@wordpress/warning
78 var require_warning = __commonJS({
79 "package-external:@wordpress/warning"(exports, module) {
80 module.exports = window.wp.warning;
81 }
82 });
83
84 // package-external:@wordpress/private-apis
85 var require_private_apis = __commonJS({
86 "package-external:@wordpress/private-apis"(exports, module) {
87 module.exports = window.wp.privateApis;
88 }
89 });
90
91 // node_modules/remove-accents/index.js
92 var require_remove_accents = __commonJS({
93 "node_modules/remove-accents/index.js"(exports, module) {
94 var characterMap = {
95 "\xC0": "A",
96 "\xC1": "A",
97 "\xC2": "A",
98 "\xC3": "A",
99 "\xC4": "A",
100 "\xC5": "A",
101 "\u1EA4": "A",
102 "\u1EAE": "A",
103 "\u1EB2": "A",
104 "\u1EB4": "A",
105 "\u1EB6": "A",
106 "\xC6": "AE",
107 "\u1EA6": "A",
108 "\u1EB0": "A",
109 "\u0202": "A",
110 "\u1EA2": "A",
111 "\u1EA0": "A",
112 "\u1EA8": "A",
113 "\u1EAA": "A",
114 "\u1EAC": "A",
115 "\xC7": "C",
116 "\u1E08": "C",
117 "\xC8": "E",
118 "\xC9": "E",
119 "\xCA": "E",
120 "\xCB": "E",
121 "\u1EBE": "E",
122 "\u1E16": "E",
123 "\u1EC0": "E",
124 "\u1E14": "E",
125 "\u1E1C": "E",
126 "\u0206": "E",
127 "\u1EBA": "E",
128 "\u1EBC": "E",
129 "\u1EB8": "E",
130 "\u1EC2": "E",
131 "\u1EC4": "E",
132 "\u1EC6": "E",
133 "\xCC": "I",
134 "\xCD": "I",
135 "\xCE": "I",
136 "\xCF": "I",
137 "\u1E2E": "I",
138 "\u020A": "I",
139 "\u1EC8": "I",
140 "\u1ECA": "I",
141 "\xD0": "D",
142 "\xD1": "N",
143 "\xD2": "O",
144 "\xD3": "O",
145 "\xD4": "O",
146 "\xD5": "O",
147 "\xD6": "O",
148 "\xD8": "O",
149 "\u1ED0": "O",
150 "\u1E4C": "O",
151 "\u1E52": "O",
152 "\u020E": "O",
153 "\u1ECE": "O",
154 "\u1ECC": "O",
155 "\u1ED4": "O",
156 "\u1ED6": "O",
157 "\u1ED8": "O",
158 "\u1EDC": "O",
159 "\u1EDE": "O",
160 "\u1EE0": "O",
161 "\u1EDA": "O",
162 "\u1EE2": "O",
163 "\xD9": "U",
164 "\xDA": "U",
165 "\xDB": "U",
166 "\xDC": "U",
167 "\u1EE6": "U",
168 "\u1EE4": "U",
169 "\u1EEC": "U",
170 "\u1EEE": "U",
171 "\u1EF0": "U",
172 "\xDD": "Y",
173 "\xE0": "a",
174 "\xE1": "a",
175 "\xE2": "a",
176 "\xE3": "a",
177 "\xE4": "a",
178 "\xE5": "a",
179 "\u1EA5": "a",
180 "\u1EAF": "a",
181 "\u1EB3": "a",
182 "\u1EB5": "a",
183 "\u1EB7": "a",
184 "\xE6": "ae",
185 "\u1EA7": "a",
186 "\u1EB1": "a",
187 "\u0203": "a",
188 "\u1EA3": "a",
189 "\u1EA1": "a",
190 "\u1EA9": "a",
191 "\u1EAB": "a",
192 "\u1EAD": "a",
193 "\xE7": "c",
194 "\u1E09": "c",
195 "\xE8": "e",
196 "\xE9": "e",
197 "\xEA": "e",
198 "\xEB": "e",
199 "\u1EBF": "e",
200 "\u1E17": "e",
201 "\u1EC1": "e",
202 "\u1E15": "e",
203 "\u1E1D": "e",
204 "\u0207": "e",
205 "\u1EBB": "e",
206 "\u1EBD": "e",
207 "\u1EB9": "e",
208 "\u1EC3": "e",
209 "\u1EC5": "e",
210 "\u1EC7": "e",
211 "\xEC": "i",
212 "\xED": "i",
213 "\xEE": "i",
214 "\xEF": "i",
215 "\u1E2F": "i",
216 "\u020B": "i",
217 "\u1EC9": "i",
218 "\u1ECB": "i",
219 "\xF0": "d",
220 "\xF1": "n",
221 "\xF2": "o",
222 "\xF3": "o",
223 "\xF4": "o",
224 "\xF5": "o",
225 "\xF6": "o",
226 "\xF8": "o",
227 "\u1ED1": "o",
228 "\u1E4D": "o",
229 "\u1E53": "o",
230 "\u020F": "o",
231 "\u1ECF": "o",
232 "\u1ECD": "o",
233 "\u1ED5": "o",
234 "\u1ED7": "o",
235 "\u1ED9": "o",
236 "\u1EDD": "o",
237 "\u1EDF": "o",
238 "\u1EE1": "o",
239 "\u1EDB": "o",
240 "\u1EE3": "o",
241 "\xF9": "u",
242 "\xFA": "u",
243 "\xFB": "u",
244 "\xFC": "u",
245 "\u1EE7": "u",
246 "\u1EE5": "u",
247 "\u1EED": "u",
248 "\u1EEF": "u",
249 "\u1EF1": "u",
250 "\xFD": "y",
251 "\xFF": "y",
252 "\u0100": "A",
253 "\u0101": "a",
254 "\u0102": "A",
255 "\u0103": "a",
256 "\u0104": "A",
257 "\u0105": "a",
258 "\u0106": "C",
259 "\u0107": "c",
260 "\u0108": "C",
261 "\u0109": "c",
262 "\u010A": "C",
263 "\u010B": "c",
264 "\u010C": "C",
265 "\u010D": "c",
266 "C\u0306": "C",
267 "c\u0306": "c",
268 "\u010E": "D",
269 "\u010F": "d",
270 "\u0110": "D",
271 "\u0111": "d",
272 "\u0112": "E",
273 "\u0113": "e",
274 "\u0114": "E",
275 "\u0115": "e",
276 "\u0116": "E",
277 "\u0117": "e",
278 "\u0118": "E",
279 "\u0119": "e",
280 "\u011A": "E",
281 "\u011B": "e",
282 "\u011C": "G",
283 "\u01F4": "G",
284 "\u011D": "g",
285 "\u01F5": "g",
286 "\u011E": "G",
287 "\u011F": "g",
288 "\u0120": "G",
289 "\u0121": "g",
290 "\u0122": "G",
291 "\u0123": "g",
292 "\u0124": "H",
293 "\u0125": "h",
294 "\u0126": "H",
295 "\u0127": "h",
296 "\u1E2A": "H",
297 "\u1E2B": "h",
298 "\u0128": "I",
299 "\u0129": "i",
300 "\u012A": "I",
301 "\u012B": "i",
302 "\u012C": "I",
303 "\u012D": "i",
304 "\u012E": "I",
305 "\u012F": "i",
306 "\u0130": "I",
307 "\u0131": "i",
308 "\u0132": "IJ",
309 "\u0133": "ij",
310 "\u0134": "J",
311 "\u0135": "j",
312 "\u0136": "K",
313 "\u0137": "k",
314 "\u1E30": "K",
315 "\u1E31": "k",
316 "K\u0306": "K",
317 "k\u0306": "k",
318 "\u0139": "L",
319 "\u013A": "l",
320 "\u013B": "L",
321 "\u013C": "l",
322 "\u013D": "L",
323 "\u013E": "l",
324 "\u013F": "L",
325 "\u0140": "l",
326 "\u0141": "l",
327 "\u0142": "l",
328 "\u1E3E": "M",
329 "\u1E3F": "m",
330 "M\u0306": "M",
331 "m\u0306": "m",
332 "\u0143": "N",
333 "\u0144": "n",
334 "\u0145": "N",
335 "\u0146": "n",
336 "\u0147": "N",
337 "\u0148": "n",
338 "\u0149": "n",
339 "N\u0306": "N",
340 "n\u0306": "n",
341 "\u014C": "O",
342 "\u014D": "o",
343 "\u014E": "O",
344 "\u014F": "o",
345 "\u0150": "O",
346 "\u0151": "o",
347 "\u0152": "OE",
348 "\u0153": "oe",
349 "P\u0306": "P",
350 "p\u0306": "p",
351 "\u0154": "R",
352 "\u0155": "r",
353 "\u0156": "R",
354 "\u0157": "r",
355 "\u0158": "R",
356 "\u0159": "r",
357 "R\u0306": "R",
358 "r\u0306": "r",
359 "\u0212": "R",
360 "\u0213": "r",
361 "\u015A": "S",
362 "\u015B": "s",
363 "\u015C": "S",
364 "\u015D": "s",
365 "\u015E": "S",
366 "\u0218": "S",
367 "\u0219": "s",
368 "\u015F": "s",
369 "\u0160": "S",
370 "\u0161": "s",
371 "\u0162": "T",
372 "\u0163": "t",
373 "\u021B": "t",
374 "\u021A": "T",
375 "\u0164": "T",
376 "\u0165": "t",
377 "\u0166": "T",
378 "\u0167": "t",
379 "T\u0306": "T",
380 "t\u0306": "t",
381 "\u0168": "U",
382 "\u0169": "u",
383 "\u016A": "U",
384 "\u016B": "u",
385 "\u016C": "U",
386 "\u016D": "u",
387 "\u016E": "U",
388 "\u016F": "u",
389 "\u0170": "U",
390 "\u0171": "u",
391 "\u0172": "U",
392 "\u0173": "u",
393 "\u0216": "U",
394 "\u0217": "u",
395 "V\u0306": "V",
396 "v\u0306": "v",
397 "\u0174": "W",
398 "\u0175": "w",
399 "\u1E82": "W",
400 "\u1E83": "w",
401 "X\u0306": "X",
402 "x\u0306": "x",
403 "\u0176": "Y",
404 "\u0177": "y",
405 "\u0178": "Y",
406 "Y\u0306": "Y",
407 "y\u0306": "y",
408 "\u0179": "Z",
409 "\u017A": "z",
410 "\u017B": "Z",
411 "\u017C": "z",
412 "\u017D": "Z",
413 "\u017E": "z",
414 "\u017F": "s",
415 "\u0192": "f",
416 "\u01A0": "O",
417 "\u01A1": "o",
418 "\u01AF": "U",
419 "\u01B0": "u",
420 "\u01CD": "A",
421 "\u01CE": "a",
422 "\u01CF": "I",
423 "\u01D0": "i",
424 "\u01D1": "O",
425 "\u01D2": "o",
426 "\u01D3": "U",
427 "\u01D4": "u",
428 "\u01D5": "U",
429 "\u01D6": "u",
430 "\u01D7": "U",
431 "\u01D8": "u",
432 "\u01D9": "U",
433 "\u01DA": "u",
434 "\u01DB": "U",
435 "\u01DC": "u",
436 "\u1EE8": "U",
437 "\u1EE9": "u",
438 "\u1E78": "U",
439 "\u1E79": "u",
440 "\u01FA": "A",
441 "\u01FB": "a",
442 "\u01FC": "AE",
443 "\u01FD": "ae",
444 "\u01FE": "O",
445 "\u01FF": "o",
446 "\xDE": "TH",
447 "\xFE": "th",
448 "\u1E54": "P",
449 "\u1E55": "p",
450 "\u1E64": "S",
451 "\u1E65": "s",
452 "X\u0301": "X",
453 "x\u0301": "x",
454 "\u0403": "\u0413",
455 "\u0453": "\u0433",
456 "\u040C": "\u041A",
457 "\u045C": "\u043A",
458 "A\u030B": "A",
459 "a\u030B": "a",
460 "E\u030B": "E",
461 "e\u030B": "e",
462 "I\u030B": "I",
463 "i\u030B": "i",
464 "\u01F8": "N",
465 "\u01F9": "n",
466 "\u1ED2": "O",
467 "\u1ED3": "o",
468 "\u1E50": "O",
469 "\u1E51": "o",
470 "\u1EEA": "U",
471 "\u1EEB": "u",
472 "\u1E80": "W",
473 "\u1E81": "w",
474 "\u1EF2": "Y",
475 "\u1EF3": "y",
476 "\u0200": "A",
477 "\u0201": "a",
478 "\u0204": "E",
479 "\u0205": "e",
480 "\u0208": "I",
481 "\u0209": "i",
482 "\u020C": "O",
483 "\u020D": "o",
484 "\u0210": "R",
485 "\u0211": "r",
486 "\u0214": "U",
487 "\u0215": "u",
488 "B\u030C": "B",
489 "b\u030C": "b",
490 "\u010C\u0323": "C",
491 "\u010D\u0323": "c",
492 "\xCA\u030C": "E",
493 "\xEA\u030C": "e",
494 "F\u030C": "F",
495 "f\u030C": "f",
496 "\u01E6": "G",
497 "\u01E7": "g",
498 "\u021E": "H",
499 "\u021F": "h",
500 "J\u030C": "J",
501 "\u01F0": "j",
502 "\u01E8": "K",
503 "\u01E9": "k",
504 "M\u030C": "M",
505 "m\u030C": "m",
506 "P\u030C": "P",
507 "p\u030C": "p",
508 "Q\u030C": "Q",
509 "q\u030C": "q",
510 "\u0158\u0329": "R",
511 "\u0159\u0329": "r",
512 "\u1E66": "S",
513 "\u1E67": "s",
514 "V\u030C": "V",
515 "v\u030C": "v",
516 "W\u030C": "W",
517 "w\u030C": "w",
518 "X\u030C": "X",
519 "x\u030C": "x",
520 "Y\u030C": "Y",
521 "y\u030C": "y",
522 "A\u0327": "A",
523 "a\u0327": "a",
524 "B\u0327": "B",
525 "b\u0327": "b",
526 "\u1E10": "D",
527 "\u1E11": "d",
528 "\u0228": "E",
529 "\u0229": "e",
530 "\u0190\u0327": "E",
531 "\u025B\u0327": "e",
532 "\u1E28": "H",
533 "\u1E29": "h",
534 "I\u0327": "I",
535 "i\u0327": "i",
536 "\u0197\u0327": "I",
537 "\u0268\u0327": "i",
538 "M\u0327": "M",
539 "m\u0327": "m",
540 "O\u0327": "O",
541 "o\u0327": "o",
542 "Q\u0327": "Q",
543 "q\u0327": "q",
544 "U\u0327": "U",
545 "u\u0327": "u",
546 "X\u0327": "X",
547 "x\u0327": "x",
548 "Z\u0327": "Z",
549 "z\u0327": "z",
550 "\u0439": "\u0438",
551 "\u0419": "\u0418",
552 "\u0451": "\u0435",
553 "\u0401": "\u0415"
554 };
555 var chars = Object.keys(characterMap).join("|");
556 var allAccents = new RegExp(chars, "g");
557 var firstAccent = new RegExp(chars, "");
558 function matcher3(match) {
559 return characterMap[match];
560 }
561 var removeAccents2 = function(string) {
562 return string.replace(allAccents, matcher3);
563 };
564 var hasAccents = function(string) {
565 return !!string.match(firstAccent);
566 };
567 module.exports = removeAccents2;
568 module.exports.has = hasAccents;
569 module.exports.remove = removeAccents2;
570 }
571 });
572
573 // packages/blocks/node_modules/react-is/cjs/react-is.development.js
574 var require_react_is_development = __commonJS({
575 "packages/blocks/node_modules/react-is/cjs/react-is.development.js"(exports) {
576 "use strict";
577 (function() {
578 function typeOf(object) {
579 if ("object" === typeof object && null !== object) {
580 var $$typeof = object.$$typeof;
581 switch ($$typeof) {
582 case REACT_ELEMENT_TYPE:
583 switch (object = object.type, object) {
584 case REACT_FRAGMENT_TYPE:
585 case REACT_PROFILER_TYPE:
586 case REACT_STRICT_MODE_TYPE:
587 case REACT_SUSPENSE_TYPE:
588 case REACT_SUSPENSE_LIST_TYPE:
589 return object;
590 default:
591 switch (object = object && object.$$typeof, object) {
592 case REACT_CONTEXT_TYPE:
593 case REACT_FORWARD_REF_TYPE:
594 case REACT_LAZY_TYPE:
595 case REACT_MEMO_TYPE:
596 return object;
597 case REACT_CONSUMER_TYPE:
598 return object;
599 default:
600 return $$typeof;
601 }
602 }
603 case REACT_PORTAL_TYPE:
604 return $$typeof;
605 }
606 }
607 }
608 var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler");
609 /* @__PURE__ */ Symbol.for("react.provider");
610 var REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference");
611 exports.ContextConsumer = REACT_CONSUMER_TYPE;
612 exports.ContextProvider = REACT_CONTEXT_TYPE;
613 exports.Element = REACT_ELEMENT_TYPE;
614 exports.ForwardRef = REACT_FORWARD_REF_TYPE;
615 exports.Fragment = REACT_FRAGMENT_TYPE;
616 exports.Lazy = REACT_LAZY_TYPE;
617 exports.Memo = REACT_MEMO_TYPE;
618 exports.Portal = REACT_PORTAL_TYPE;
619 exports.Profiler = REACT_PROFILER_TYPE;
620 exports.StrictMode = REACT_STRICT_MODE_TYPE;
621 exports.Suspense = REACT_SUSPENSE_TYPE;
622 exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
623 exports.isContextConsumer = function(object) {
624 return typeOf(object) === REACT_CONSUMER_TYPE;
625 };
626 exports.isContextProvider = function(object) {
627 return typeOf(object) === REACT_CONTEXT_TYPE;
628 };
629 exports.isElement = function(object) {
630 return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
631 };
632 exports.isForwardRef = function(object) {
633 return typeOf(object) === REACT_FORWARD_REF_TYPE;
634 };
635 exports.isFragment = function(object) {
636 return typeOf(object) === REACT_FRAGMENT_TYPE;
637 };
638 exports.isLazy = function(object) {
639 return typeOf(object) === REACT_LAZY_TYPE;
640 };
641 exports.isMemo = function(object) {
642 return typeOf(object) === REACT_MEMO_TYPE;
643 };
644 exports.isPortal = function(object) {
645 return typeOf(object) === REACT_PORTAL_TYPE;
646 };
647 exports.isProfiler = function(object) {
648 return typeOf(object) === REACT_PROFILER_TYPE;
649 };
650 exports.isStrictMode = function(object) {
651 return typeOf(object) === REACT_STRICT_MODE_TYPE;
652 };
653 exports.isSuspense = function(object) {
654 return typeOf(object) === REACT_SUSPENSE_TYPE;
655 };
656 exports.isSuspenseList = function(object) {
657 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
658 };
659 exports.isValidElementType = function(type) {
660 return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_OFFSCREEN_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
661 };
662 exports.typeOf = typeOf;
663 })();
664 }
665 });
666
667 // packages/blocks/node_modules/react-is/index.js
668 var require_react_is = __commonJS({
669 "packages/blocks/node_modules/react-is/index.js"(exports, module) {
670 "use strict";
671 if (false) {
672 module.exports = null;
673 } else {
674 module.exports = require_react_is_development();
675 }
676 }
677 });
678
679 // package-external:@wordpress/hooks
680 var require_hooks = __commonJS({
681 "package-external:@wordpress/hooks"(exports, module) {
682 module.exports = window.wp.hooks;
683 }
684 });
685
686 // package-external:@wordpress/block-serialization-default-parser
687 var require_block_serialization_default_parser = __commonJS({
688 "package-external:@wordpress/block-serialization-default-parser"(exports, module) {
689 module.exports = window.wp.blockSerializationDefaultParser;
690 }
691 });
692
693 // package-external:@wordpress/autop
694 var require_autop = __commonJS({
695 "package-external:@wordpress/autop"(exports, module) {
696 module.exports = window.wp.autop;
697 }
698 });
699
700 // package-external:@wordpress/is-shallow-equal
701 var require_is_shallow_equal = __commonJS({
702 "package-external:@wordpress/is-shallow-equal"(exports, module) {
703 module.exports = window.wp.isShallowEqual;
704 }
705 });
706
707 // vendor-external:react/jsx-runtime
708 var require_jsx_runtime = __commonJS({
709 "vendor-external:react/jsx-runtime"(exports, module) {
710 module.exports = window.ReactJSXRuntime;
711 }
712 });
713
714 // node_modules/fast-deep-equal/es6/index.js
715 var require_es6 = __commonJS({
716 "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
717 "use strict";
718 module.exports = function equal(a2, b2) {
719 if (a2 === b2) return true;
720 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
721 if (a2.constructor !== b2.constructor) return false;
722 var length, i2, keys;
723 if (Array.isArray(a2)) {
724 length = a2.length;
725 if (length != b2.length) return false;
726 for (i2 = length; i2-- !== 0; )
727 if (!equal(a2[i2], b2[i2])) return false;
728 return true;
729 }
730 if (a2 instanceof Map && b2 instanceof Map) {
731 if (a2.size !== b2.size) return false;
732 for (i2 of a2.entries())
733 if (!b2.has(i2[0])) return false;
734 for (i2 of a2.entries())
735 if (!equal(i2[1], b2.get(i2[0]))) return false;
736 return true;
737 }
738 if (a2 instanceof Set && b2 instanceof Set) {
739 if (a2.size !== b2.size) return false;
740 for (i2 of a2.entries())
741 if (!b2.has(i2[0])) return false;
742 return true;
743 }
744 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
745 length = a2.length;
746 if (length != b2.length) return false;
747 for (i2 = length; i2-- !== 0; )
748 if (a2[i2] !== b2[i2]) return false;
749 return true;
750 }
751 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
752 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
753 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
754 keys = Object.keys(a2);
755 length = keys.length;
756 if (length !== Object.keys(b2).length) return false;
757 for (i2 = length; i2-- !== 0; )
758 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
759 for (i2 = length; i2-- !== 0; ) {
760 var key = keys[i2];
761 if (!equal(a2[key], b2[key])) return false;
762 }
763 return true;
764 }
765 return a2 !== a2 && b2 !== b2;
766 };
767 }
768 });
769
770 // package-external:@wordpress/html-entities
771 var require_html_entities = __commonJS({
772 "package-external:@wordpress/html-entities"(exports, module) {
773 module.exports = window.wp.htmlEntities;
774 }
775 });
776
777 // package-external:@wordpress/shortcode
778 var require_shortcode = __commonJS({
779 "package-external:@wordpress/shortcode"(exports, module) {
780 module.exports = window.wp.shortcode;
781 }
782 });
783
784 // package-external:@wordpress/blob
785 var require_blob = __commonJS({
786 "package-external:@wordpress/blob"(exports, module) {
787 module.exports = window.wp.blob;
788 }
789 });
790
791 // node_modules/showdown/dist/showdown.js
792 var require_showdown = __commonJS({
793 "node_modules/showdown/dist/showdown.js"(exports, module) {
794 (function() {
795 function getDefaultOpts(simple) {
796 "use strict";
797 var defaultOptions = {
798 omitExtraWLInCodeBlocks: {
799 defaultValue: false,
800 describe: "Omit the default extra whiteline added to code blocks",
801 type: "boolean"
802 },
803 noHeaderId: {
804 defaultValue: false,
805 describe: "Turn on/off generated header id",
806 type: "boolean"
807 },
808 prefixHeaderId: {
809 defaultValue: false,
810 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",
811 type: "string"
812 },
813 rawPrefixHeaderId: {
814 defaultValue: false,
815 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)',
816 type: "boolean"
817 },
818 ghCompatibleHeaderId: {
819 defaultValue: false,
820 describe: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",
821 type: "boolean"
822 },
823 rawHeaderId: {
824 defaultValue: false,
825 describe: `Remove only spaces, ' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids`,
826 type: "boolean"
827 },
828 headerLevelStart: {
829 defaultValue: false,
830 describe: "The header blocks level start",
831 type: "integer"
832 },
833 parseImgDimensions: {
834 defaultValue: false,
835 describe: "Turn on/off image dimension parsing",
836 type: "boolean"
837 },
838 simplifiedAutoLink: {
839 defaultValue: false,
840 describe: "Turn on/off GFM autolink style",
841 type: "boolean"
842 },
843 excludeTrailingPunctuationFromURLs: {
844 defaultValue: false,
845 describe: "Excludes trailing punctuation from links generated with autoLinking",
846 type: "boolean"
847 },
848 literalMidWordUnderscores: {
849 defaultValue: false,
850 describe: "Parse midword underscores as literal underscores",
851 type: "boolean"
852 },
853 literalMidWordAsterisks: {
854 defaultValue: false,
855 describe: "Parse midword asterisks as literal asterisks",
856 type: "boolean"
857 },
858 strikethrough: {
859 defaultValue: false,
860 describe: "Turn on/off strikethrough support",
861 type: "boolean"
862 },
863 tables: {
864 defaultValue: false,
865 describe: "Turn on/off tables support",
866 type: "boolean"
867 },
868 tablesHeaderId: {
869 defaultValue: false,
870 describe: "Add an id to table headers",
871 type: "boolean"
872 },
873 ghCodeBlocks: {
874 defaultValue: true,
875 describe: "Turn on/off GFM fenced code blocks support",
876 type: "boolean"
877 },
878 tasklists: {
879 defaultValue: false,
880 describe: "Turn on/off GFM tasklist support",
881 type: "boolean"
882 },
883 smoothLivePreview: {
884 defaultValue: false,
885 describe: "Prevents weird effects in live previews due to incomplete input",
886 type: "boolean"
887 },
888 smartIndentationFix: {
889 defaultValue: false,
890 description: "Tries to smartly fix indentation in es6 strings",
891 type: "boolean"
892 },
893 disableForced4SpacesIndentedSublists: {
894 defaultValue: false,
895 description: "Disables the requirement of indenting nested sublists by 4 spaces",
896 type: "boolean"
897 },
898 simpleLineBreaks: {
899 defaultValue: false,
900 description: "Parses simple line breaks as <br> (GFM Style)",
901 type: "boolean"
902 },
903 requireSpaceBeforeHeadingText: {
904 defaultValue: false,
905 description: "Makes adding a space between `#` and the header text mandatory (GFM Style)",
906 type: "boolean"
907 },
908 ghMentions: {
909 defaultValue: false,
910 description: "Enables github @mentions",
911 type: "boolean"
912 },
913 ghMentionsLink: {
914 defaultValue: "https://github.com/{u}",
915 description: "Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",
916 type: "string"
917 },
918 encodeEmails: {
919 defaultValue: true,
920 description: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",
921 type: "boolean"
922 },
923 openLinksInNewWindow: {
924 defaultValue: false,
925 description: "Open all links in new windows",
926 type: "boolean"
927 },
928 backslashEscapesHTMLTags: {
929 defaultValue: false,
930 description: "Support for HTML Tag escaping. ex: <div>foo</div>",
931 type: "boolean"
932 },
933 emoji: {
934 defaultValue: false,
935 description: "Enable emoji support. Ex: `this is a :smile: emoji`",
936 type: "boolean"
937 },
938 underline: {
939 defaultValue: false,
940 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>`",
941 type: "boolean"
942 },
943 completeHTMLDocument: {
944 defaultValue: false,
945 description: "Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",
946 type: "boolean"
947 },
948 metadata: {
949 defaultValue: false,
950 description: "Enable support for document metadata (defined at the top of the document between `\xAB\xAB\xAB` and `\xBB\xBB\xBB` or between `---` and `---`).",
951 type: "boolean"
952 },
953 splitAdjacentBlockquotes: {
954 defaultValue: false,
955 description: "Split adjacent blockquote blocks",
956 type: "boolean"
957 }
958 };
959 if (simple === false) {
960 return JSON.parse(JSON.stringify(defaultOptions));
961 }
962 var ret = {};
963 for (var opt in defaultOptions) {
964 if (defaultOptions.hasOwnProperty(opt)) {
965 ret[opt] = defaultOptions[opt].defaultValue;
966 }
967 }
968 return ret;
969 }
970 function allOptionsOn() {
971 "use strict";
972 var options = getDefaultOpts(true), ret = {};
973 for (var opt in options) {
974 if (options.hasOwnProperty(opt)) {
975 ret[opt] = true;
976 }
977 }
978 return ret;
979 }
980 var showdown2 = {}, parsers = {}, extensions = {}, globalOptions = getDefaultOpts(true), setFlavor = "vanilla", flavor = {
981 github: {
982 omitExtraWLInCodeBlocks: true,
983 simplifiedAutoLink: true,
984 excludeTrailingPunctuationFromURLs: true,
985 literalMidWordUnderscores: true,
986 strikethrough: true,
987 tables: true,
988 tablesHeaderId: true,
989 ghCodeBlocks: true,
990 tasklists: true,
991 disableForced4SpacesIndentedSublists: true,
992 simpleLineBreaks: true,
993 requireSpaceBeforeHeadingText: true,
994 ghCompatibleHeaderId: true,
995 ghMentions: true,
996 backslashEscapesHTMLTags: true,
997 emoji: true,
998 splitAdjacentBlockquotes: true
999 },
1000 original: {
1001 noHeaderId: true,
1002 ghCodeBlocks: false
1003 },
1004 ghost: {
1005 omitExtraWLInCodeBlocks: true,
1006 parseImgDimensions: true,
1007 simplifiedAutoLink: true,
1008 excludeTrailingPunctuationFromURLs: true,
1009 literalMidWordUnderscores: true,
1010 strikethrough: true,
1011 tables: true,
1012 tablesHeaderId: true,
1013 ghCodeBlocks: true,
1014 tasklists: true,
1015 smoothLivePreview: true,
1016 simpleLineBreaks: true,
1017 requireSpaceBeforeHeadingText: true,
1018 ghMentions: false,
1019 encodeEmails: true
1020 },
1021 vanilla: getDefaultOpts(true),
1022 allOn: allOptionsOn()
1023 };
1024 showdown2.helper = {};
1025 showdown2.extensions = {};
1026 showdown2.setOption = function(key, value) {
1027 "use strict";
1028 globalOptions[key] = value;
1029 return this;
1030 };
1031 showdown2.getOption = function(key) {
1032 "use strict";
1033 return globalOptions[key];
1034 };
1035 showdown2.getOptions = function() {
1036 "use strict";
1037 return globalOptions;
1038 };
1039 showdown2.resetOptions = function() {
1040 "use strict";
1041 globalOptions = getDefaultOpts(true);
1042 };
1043 showdown2.setFlavor = function(name) {
1044 "use strict";
1045 if (!flavor.hasOwnProperty(name)) {
1046 throw Error(name + " flavor was not found");
1047 }
1048 showdown2.resetOptions();
1049 var preset = flavor[name];
1050 setFlavor = name;
1051 for (var option in preset) {
1052 if (preset.hasOwnProperty(option)) {
1053 globalOptions[option] = preset[option];
1054 }
1055 }
1056 };
1057 showdown2.getFlavor = function() {
1058 "use strict";
1059 return setFlavor;
1060 };
1061 showdown2.getFlavorOptions = function(name) {
1062 "use strict";
1063 if (flavor.hasOwnProperty(name)) {
1064 return flavor[name];
1065 }
1066 };
1067 showdown2.getDefaultOptions = function(simple) {
1068 "use strict";
1069 return getDefaultOpts(simple);
1070 };
1071 showdown2.subParser = function(name, func) {
1072 "use strict";
1073 if (showdown2.helper.isString(name)) {
1074 if (typeof func !== "undefined") {
1075 parsers[name] = func;
1076 } else {
1077 if (parsers.hasOwnProperty(name)) {
1078 return parsers[name];
1079 } else {
1080 throw Error("SubParser named " + name + " not registered!");
1081 }
1082 }
1083 }
1084 };
1085 showdown2.extension = function(name, ext) {
1086 "use strict";
1087 if (!showdown2.helper.isString(name)) {
1088 throw Error("Extension 'name' must be a string");
1089 }
1090 name = showdown2.helper.stdExtName(name);
1091 if (showdown2.helper.isUndefined(ext)) {
1092 if (!extensions.hasOwnProperty(name)) {
1093 throw Error("Extension named " + name + " is not registered!");
1094 }
1095 return extensions[name];
1096 } else {
1097 if (typeof ext === "function") {
1098 ext = ext();
1099 }
1100 if (!showdown2.helper.isArray(ext)) {
1101 ext = [ext];
1102 }
1103 var validExtension = validate(ext, name);
1104 if (validExtension.valid) {
1105 extensions[name] = ext;
1106 } else {
1107 throw Error(validExtension.error);
1108 }
1109 }
1110 };
1111 showdown2.getAllExtensions = function() {
1112 "use strict";
1113 return extensions;
1114 };
1115 showdown2.removeExtension = function(name) {
1116 "use strict";
1117 delete extensions[name];
1118 };
1119 showdown2.resetExtensions = function() {
1120 "use strict";
1121 extensions = {};
1122 };
1123 function validate(extension, name) {
1124 "use strict";
1125 var errMsg = name ? "Error in " + name + " extension->" : "Error in unnamed extension", ret = {
1126 valid: true,
1127 error: ""
1128 };
1129 if (!showdown2.helper.isArray(extension)) {
1130 extension = [extension];
1131 }
1132 for (var i2 = 0; i2 < extension.length; ++i2) {
1133 var baseMsg = errMsg + " sub-extension " + i2 + ": ", ext = extension[i2];
1134 if (typeof ext !== "object") {
1135 ret.valid = false;
1136 ret.error = baseMsg + "must be an object, but " + typeof ext + " given";
1137 return ret;
1138 }
1139 if (!showdown2.helper.isString(ext.type)) {
1140 ret.valid = false;
1141 ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + " given";
1142 return ret;
1143 }
1144 var type = ext.type = ext.type.toLowerCase();
1145 if (type === "language") {
1146 type = ext.type = "lang";
1147 }
1148 if (type === "html") {
1149 type = ext.type = "output";
1150 }
1151 if (type !== "lang" && type !== "output" && type !== "listener") {
1152 ret.valid = false;
1153 ret.error = baseMsg + "type " + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
1154 return ret;
1155 }
1156 if (type === "listener") {
1157 if (showdown2.helper.isUndefined(ext.listeners)) {
1158 ret.valid = false;
1159 ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
1160 return ret;
1161 }
1162 } else {
1163 if (showdown2.helper.isUndefined(ext.filter) && showdown2.helper.isUndefined(ext.regex)) {
1164 ret.valid = false;
1165 ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
1166 return ret;
1167 }
1168 }
1169 if (ext.listeners) {
1170 if (typeof ext.listeners !== "object") {
1171 ret.valid = false;
1172 ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + " given";
1173 return ret;
1174 }
1175 for (var ln in ext.listeners) {
1176 if (ext.listeners.hasOwnProperty(ln)) {
1177 if (typeof ext.listeners[ln] !== "function") {
1178 ret.valid = false;
1179 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";
1180 return ret;
1181 }
1182 }
1183 }
1184 }
1185 if (ext.filter) {
1186 if (typeof ext.filter !== "function") {
1187 ret.valid = false;
1188 ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + " given";
1189 return ret;
1190 }
1191 } else if (ext.regex) {
1192 if (showdown2.helper.isString(ext.regex)) {
1193 ext.regex = new RegExp(ext.regex, "g");
1194 }
1195 if (!(ext.regex instanceof RegExp)) {
1196 ret.valid = false;
1197 ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + " given";
1198 return ret;
1199 }
1200 if (showdown2.helper.isUndefined(ext.replace)) {
1201 ret.valid = false;
1202 ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
1203 return ret;
1204 }
1205 }
1206 }
1207 return ret;
1208 }
1209 showdown2.validateExtension = function(ext) {
1210 "use strict";
1211 var validateExtension = validate(ext, null);
1212 if (!validateExtension.valid) {
1213 console.warn(validateExtension.error);
1214 return false;
1215 }
1216 return true;
1217 };
1218 if (!showdown2.hasOwnProperty("helper")) {
1219 showdown2.helper = {};
1220 }
1221 showdown2.helper.isString = function(a2) {
1222 "use strict";
1223 return typeof a2 === "string" || a2 instanceof String;
1224 };
1225 showdown2.helper.isFunction = function(a2) {
1226 "use strict";
1227 var getType = {};
1228 return a2 && getType.toString.call(a2) === "[object Function]";
1229 };
1230 showdown2.helper.isArray = function(a2) {
1231 "use strict";
1232 return Array.isArray(a2);
1233 };
1234 showdown2.helper.isUndefined = function(value) {
1235 "use strict";
1236 return typeof value === "undefined";
1237 };
1238 showdown2.helper.forEach = function(obj, callback) {
1239 "use strict";
1240 if (showdown2.helper.isUndefined(obj)) {
1241 throw new Error("obj param is required");
1242 }
1243 if (showdown2.helper.isUndefined(callback)) {
1244 throw new Error("callback param is required");
1245 }
1246 if (!showdown2.helper.isFunction(callback)) {
1247 throw new Error("callback param must be a function/closure");
1248 }
1249 if (typeof obj.forEach === "function") {
1250 obj.forEach(callback);
1251 } else if (showdown2.helper.isArray(obj)) {
1252 for (var i2 = 0; i2 < obj.length; i2++) {
1253 callback(obj[i2], i2, obj);
1254 }
1255 } else if (typeof obj === "object") {
1256 for (var prop2 in obj) {
1257 if (obj.hasOwnProperty(prop2)) {
1258 callback(obj[prop2], prop2, obj);
1259 }
1260 }
1261 } else {
1262 throw new Error("obj does not seem to be an array or an iterable object");
1263 }
1264 };
1265 showdown2.helper.stdExtName = function(s2) {
1266 "use strict";
1267 return s2.replace(/[_?*+\/\\.^-]/g, "").replace(/\s/g, "").toLowerCase();
1268 };
1269 function escapeCharactersCallback(wholeMatch, m1) {
1270 "use strict";
1271 var charCodeToEscape = m1.charCodeAt(0);
1272 return "\xA8E" + charCodeToEscape + "E";
1273 }
1274 showdown2.helper.escapeCharactersCallback = escapeCharactersCallback;
1275 showdown2.helper.escapeCharacters = function(text2, charsToEscape, afterBackslash) {
1276 "use strict";
1277 var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g, "\\$1") + "])";
1278 if (afterBackslash) {
1279 regexString = "\\\\" + regexString;
1280 }
1281 var regex = new RegExp(regexString, "g");
1282 text2 = text2.replace(regex, escapeCharactersCallback);
1283 return text2;
1284 };
1285 showdown2.helper.unescapeHTMLEntities = function(txt) {
1286 "use strict";
1287 return txt.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
1288 };
1289 var rgxFindMatchPos = function(str, left, right, flags) {
1290 "use strict";
1291 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;
1292 do {
1293 t3 = 0;
1294 while (m2 = x2.exec(str)) {
1295 if (l2.test(m2[0])) {
1296 if (!t3++) {
1297 s2 = x2.lastIndex;
1298 start = s2 - m2[0].length;
1299 }
1300 } else if (t3) {
1301 if (!--t3) {
1302 end = m2.index + m2[0].length;
1303 var obj = {
1304 left: { start, end: s2 },
1305 match: { start: s2, end: m2.index },
1306 right: { start: m2.index, end },
1307 wholeMatch: { start, end }
1308 };
1309 pos.push(obj);
1310 if (!g2) {
1311 return pos;
1312 }
1313 }
1314 }
1315 }
1316 } while (t3 && (x2.lastIndex = s2));
1317 return pos;
1318 };
1319 showdown2.helper.matchRecursiveRegExp = function(str, left, right, flags) {
1320 "use strict";
1321 var matchPos = rgxFindMatchPos(str, left, right, flags), results = [];
1322 for (var i2 = 0; i2 < matchPos.length; ++i2) {
1323 results.push([
1324 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end),
1325 str.slice(matchPos[i2].match.start, matchPos[i2].match.end),
1326 str.slice(matchPos[i2].left.start, matchPos[i2].left.end),
1327 str.slice(matchPos[i2].right.start, matchPos[i2].right.end)
1328 ]);
1329 }
1330 return results;
1331 };
1332 showdown2.helper.replaceRecursiveRegExp = function(str, replacement, left, right, flags) {
1333 "use strict";
1334 if (!showdown2.helper.isFunction(replacement)) {
1335 var repStr = replacement;
1336 replacement = function() {
1337 return repStr;
1338 };
1339 }
1340 var matchPos = rgxFindMatchPos(str, left, right, flags), finalStr = str, lng = matchPos.length;
1341 if (lng > 0) {
1342 var bits = [];
1343 if (matchPos[0].wholeMatch.start !== 0) {
1344 bits.push(str.slice(0, matchPos[0].wholeMatch.start));
1345 }
1346 for (var i2 = 0; i2 < lng; ++i2) {
1347 bits.push(
1348 replacement(
1349 str.slice(matchPos[i2].wholeMatch.start, matchPos[i2].wholeMatch.end),
1350 str.slice(matchPos[i2].match.start, matchPos[i2].match.end),
1351 str.slice(matchPos[i2].left.start, matchPos[i2].left.end),
1352 str.slice(matchPos[i2].right.start, matchPos[i2].right.end)
1353 )
1354 );
1355 if (i2 < lng - 1) {
1356 bits.push(str.slice(matchPos[i2].wholeMatch.end, matchPos[i2 + 1].wholeMatch.start));
1357 }
1358 }
1359 if (matchPos[lng - 1].wholeMatch.end < str.length) {
1360 bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
1361 }
1362 finalStr = bits.join("");
1363 }
1364 return finalStr;
1365 };
1366 showdown2.helper.regexIndexOf = function(str, regex, fromIndex) {
1367 "use strict";
1368 if (!showdown2.helper.isString(str)) {
1369 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
1370 }
1371 if (regex instanceof RegExp === false) {
1372 throw "InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";
1373 }
1374 var indexOf = str.substring(fromIndex || 0).search(regex);
1375 return indexOf >= 0 ? indexOf + (fromIndex || 0) : indexOf;
1376 };
1377 showdown2.helper.splitAtIndex = function(str, index) {
1378 "use strict";
1379 if (!showdown2.helper.isString(str)) {
1380 throw "InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";
1381 }
1382 return [str.substring(0, index), str.substring(index)];
1383 };
1384 showdown2.helper.encodeEmailAddress = function(mail) {
1385 "use strict";
1386 var encode = [
1387 function(ch) {
1388 return "&#" + ch.charCodeAt(0) + ";";
1389 },
1390 function(ch) {
1391 return "&#x" + ch.charCodeAt(0).toString(16) + ";";
1392 },
1393 function(ch) {
1394 return ch;
1395 }
1396 ];
1397 mail = mail.replace(/./g, function(ch) {
1398 if (ch === "@") {
1399 ch = encode[Math.floor(Math.random() * 2)](ch);
1400 } else {
1401 var r2 = Math.random();
1402 ch = r2 > 0.9 ? encode[2](ch) : r2 > 0.45 ? encode[1](ch) : encode[0](ch);
1403 }
1404 return ch;
1405 });
1406 return mail;
1407 };
1408 showdown2.helper.padEnd = function padEnd(str, targetLength, padString) {
1409 "use strict";
1410 targetLength = targetLength >> 0;
1411 padString = String(padString || " ");
1412 if (str.length > targetLength) {
1413 return String(str);
1414 } else {
1415 targetLength = targetLength - str.length;
1416 if (targetLength > padString.length) {
1417 padString += padString.repeat(targetLength / padString.length);
1418 }
1419 return String(str) + padString.slice(0, targetLength);
1420 }
1421 };
1422 if (typeof console === "undefined") {
1423 console = {
1424 warn: function(msg) {
1425 "use strict";
1426 alert(msg);
1427 },
1428 log: function(msg) {
1429 "use strict";
1430 alert(msg);
1431 },
1432 error: function(msg) {
1433 "use strict";
1434 throw msg;
1435 }
1436 };
1437 }
1438 showdown2.helper.regexes = {
1439 asteriskDashAndColon: /([*_:~])/g
1440 };
1441 showdown2.helper.emojis = {
1442 "+1": "\u{1F44D}",
1443 "-1": "\u{1F44E}",
1444 "100": "\u{1F4AF}",
1445 "1234": "\u{1F522}",
1446 "1st_place_medal": "\u{1F947}",
1447 "2nd_place_medal": "\u{1F948}",
1448 "3rd_place_medal": "\u{1F949}",
1449 "8ball": "\u{1F3B1}",
1450 "a": "\u{1F170}\uFE0F",
1451 "ab": "\u{1F18E}",
1452 "abc": "\u{1F524}",
1453 "abcd": "\u{1F521}",
1454 "accept": "\u{1F251}",
1455 "aerial_tramway": "\u{1F6A1}",
1456 "airplane": "\u2708\uFE0F",
1457 "alarm_clock": "\u23F0",
1458 "alembic": "\u2697\uFE0F",
1459 "alien": "\u{1F47D}",
1460 "ambulance": "\u{1F691}",
1461 "amphora": "\u{1F3FA}",
1462 "anchor": "\u2693\uFE0F",
1463 "angel": "\u{1F47C}",
1464 "anger": "\u{1F4A2}",
1465 "angry": "\u{1F620}",
1466 "anguished": "\u{1F627}",
1467 "ant": "\u{1F41C}",
1468 "apple": "\u{1F34E}",
1469 "aquarius": "\u2652\uFE0F",
1470 "aries": "\u2648\uFE0F",
1471 "arrow_backward": "\u25C0\uFE0F",
1472 "arrow_double_down": "\u23EC",
1473 "arrow_double_up": "\u23EB",
1474 "arrow_down": "\u2B07\uFE0F",
1475 "arrow_down_small": "\u{1F53D}",
1476 "arrow_forward": "\u25B6\uFE0F",
1477 "arrow_heading_down": "\u2935\uFE0F",
1478 "arrow_heading_up": "\u2934\uFE0F",
1479 "arrow_left": "\u2B05\uFE0F",
1480 "arrow_lower_left": "\u2199\uFE0F",
1481 "arrow_lower_right": "\u2198\uFE0F",
1482 "arrow_right": "\u27A1\uFE0F",
1483 "arrow_right_hook": "\u21AA\uFE0F",
1484 "arrow_up": "\u2B06\uFE0F",
1485 "arrow_up_down": "\u2195\uFE0F",
1486 "arrow_up_small": "\u{1F53C}",
1487 "arrow_upper_left": "\u2196\uFE0F",
1488 "arrow_upper_right": "\u2197\uFE0F",
1489 "arrows_clockwise": "\u{1F503}",
1490 "arrows_counterclockwise": "\u{1F504}",
1491 "art": "\u{1F3A8}",
1492 "articulated_lorry": "\u{1F69B}",
1493 "artificial_satellite": "\u{1F6F0}",
1494 "astonished": "\u{1F632}",
1495 "athletic_shoe": "\u{1F45F}",
1496 "atm": "\u{1F3E7}",
1497 "atom_symbol": "\u269B\uFE0F",
1498 "avocado": "\u{1F951}",
1499 "b": "\u{1F171}\uFE0F",
1500 "baby": "\u{1F476}",
1501 "baby_bottle": "\u{1F37C}",
1502 "baby_chick": "\u{1F424}",
1503 "baby_symbol": "\u{1F6BC}",
1504 "back": "\u{1F519}",
1505 "bacon": "\u{1F953}",
1506 "badminton": "\u{1F3F8}",
1507 "baggage_claim": "\u{1F6C4}",
1508 "baguette_bread": "\u{1F956}",
1509 "balance_scale": "\u2696\uFE0F",
1510 "balloon": "\u{1F388}",
1511 "ballot_box": "\u{1F5F3}",
1512 "ballot_box_with_check": "\u2611\uFE0F",
1513 "bamboo": "\u{1F38D}",
1514 "banana": "\u{1F34C}",
1515 "bangbang": "\u203C\uFE0F",
1516 "bank": "\u{1F3E6}",
1517 "bar_chart": "\u{1F4CA}",
1518 "barber": "\u{1F488}",
1519 "baseball": "\u26BE\uFE0F",
1520 "basketball": "\u{1F3C0}",
1521 "basketball_man": "\u26F9\uFE0F",
1522 "basketball_woman": "\u26F9\uFE0F&zwj;\u2640\uFE0F",
1523 "bat": "\u{1F987}",
1524 "bath": "\u{1F6C0}",
1525 "bathtub": "\u{1F6C1}",
1526 "battery": "\u{1F50B}",
1527 "beach_umbrella": "\u{1F3D6}",
1528 "bear": "\u{1F43B}",
1529 "bed": "\u{1F6CF}",
1530 "bee": "\u{1F41D}",
1531 "beer": "\u{1F37A}",
1532 "beers": "\u{1F37B}",
1533 "beetle": "\u{1F41E}",
1534 "beginner": "\u{1F530}",
1535 "bell": "\u{1F514}",
1536 "bellhop_bell": "\u{1F6CE}",
1537 "bento": "\u{1F371}",
1538 "biking_man": "\u{1F6B4}",
1539 "bike": "\u{1F6B2}",
1540 "biking_woman": "\u{1F6B4}&zwj;\u2640\uFE0F",
1541 "bikini": "\u{1F459}",
1542 "biohazard": "\u2623\uFE0F",
1543 "bird": "\u{1F426}",
1544 "birthday": "\u{1F382}",
1545 "black_circle": "\u26AB\uFE0F",
1546 "black_flag": "\u{1F3F4}",
1547 "black_heart": "\u{1F5A4}",
1548 "black_joker": "\u{1F0CF}",
1549 "black_large_square": "\u2B1B\uFE0F",
1550 "black_medium_small_square": "\u25FE\uFE0F",
1551 "black_medium_square": "\u25FC\uFE0F",
1552 "black_nib": "\u2712\uFE0F",
1553 "black_small_square": "\u25AA\uFE0F",
1554 "black_square_button": "\u{1F532}",
1555 "blonde_man": "\u{1F471}",
1556 "blonde_woman": "\u{1F471}&zwj;\u2640\uFE0F",
1557 "blossom": "\u{1F33C}",
1558 "blowfish": "\u{1F421}",
1559 "blue_book": "\u{1F4D8}",
1560 "blue_car": "\u{1F699}",
1561 "blue_heart": "\u{1F499}",
1562 "blush": "\u{1F60A}",
1563 "boar": "\u{1F417}",
1564 "boat": "\u26F5\uFE0F",
1565 "bomb": "\u{1F4A3}",
1566 "book": "\u{1F4D6}",
1567 "bookmark": "\u{1F516}",
1568 "bookmark_tabs": "\u{1F4D1}",
1569 "books": "\u{1F4DA}",
1570 "boom": "\u{1F4A5}",
1571 "boot": "\u{1F462}",
1572 "bouquet": "\u{1F490}",
1573 "bowing_man": "\u{1F647}",
1574 "bow_and_arrow": "\u{1F3F9}",
1575 "bowing_woman": "\u{1F647}&zwj;\u2640\uFE0F",
1576 "bowling": "\u{1F3B3}",
1577 "boxing_glove": "\u{1F94A}",
1578 "boy": "\u{1F466}",
1579 "bread": "\u{1F35E}",
1580 "bride_with_veil": "\u{1F470}",
1581 "bridge_at_night": "\u{1F309}",
1582 "briefcase": "\u{1F4BC}",
1583 "broken_heart": "\u{1F494}",
1584 "bug": "\u{1F41B}",
1585 "building_construction": "\u{1F3D7}",
1586 "bulb": "\u{1F4A1}",
1587 "bullettrain_front": "\u{1F685}",
1588 "bullettrain_side": "\u{1F684}",
1589 "burrito": "\u{1F32F}",
1590 "bus": "\u{1F68C}",
1591 "business_suit_levitating": "\u{1F574}",
1592 "busstop": "\u{1F68F}",
1593 "bust_in_silhouette": "\u{1F464}",
1594 "busts_in_silhouette": "\u{1F465}",
1595 "butterfly": "\u{1F98B}",
1596 "cactus": "\u{1F335}",
1597 "cake": "\u{1F370}",
1598 "calendar": "\u{1F4C6}",
1599 "call_me_hand": "\u{1F919}",
1600 "calling": "\u{1F4F2}",
1601 "camel": "\u{1F42B}",
1602 "camera": "\u{1F4F7}",
1603 "camera_flash": "\u{1F4F8}",
1604 "camping": "\u{1F3D5}",
1605 "cancer": "\u264B\uFE0F",
1606 "candle": "\u{1F56F}",
1607 "candy": "\u{1F36C}",
1608 "canoe": "\u{1F6F6}",
1609 "capital_abcd": "\u{1F520}",
1610 "capricorn": "\u2651\uFE0F",
1611 "car": "\u{1F697}",
1612 "card_file_box": "\u{1F5C3}",
1613 "card_index": "\u{1F4C7}",
1614 "card_index_dividers": "\u{1F5C2}",
1615 "carousel_horse": "\u{1F3A0}",
1616 "carrot": "\u{1F955}",
1617 "cat": "\u{1F431}",
1618 "cat2": "\u{1F408}",
1619 "cd": "\u{1F4BF}",
1620 "chains": "\u26D3",
1621 "champagne": "\u{1F37E}",
1622 "chart": "\u{1F4B9}",
1623 "chart_with_downwards_trend": "\u{1F4C9}",
1624 "chart_with_upwards_trend": "\u{1F4C8}",
1625 "checkered_flag": "\u{1F3C1}",
1626 "cheese": "\u{1F9C0}",
1627 "cherries": "\u{1F352}",
1628 "cherry_blossom": "\u{1F338}",
1629 "chestnut": "\u{1F330}",
1630 "chicken": "\u{1F414}",
1631 "children_crossing": "\u{1F6B8}",
1632 "chipmunk": "\u{1F43F}",
1633 "chocolate_bar": "\u{1F36B}",
1634 "christmas_tree": "\u{1F384}",
1635 "church": "\u26EA\uFE0F",
1636 "cinema": "\u{1F3A6}",
1637 "circus_tent": "\u{1F3AA}",
1638 "city_sunrise": "\u{1F307}",
1639 "city_sunset": "\u{1F306}",
1640 "cityscape": "\u{1F3D9}",
1641 "cl": "\u{1F191}",
1642 "clamp": "\u{1F5DC}",
1643 "clap": "\u{1F44F}",
1644 "clapper": "\u{1F3AC}",
1645 "classical_building": "\u{1F3DB}",
1646 "clinking_glasses": "\u{1F942}",
1647 "clipboard": "\u{1F4CB}",
1648 "clock1": "\u{1F550}",
1649 "clock10": "\u{1F559}",
1650 "clock1030": "\u{1F565}",
1651 "clock11": "\u{1F55A}",
1652 "clock1130": "\u{1F566}",
1653 "clock12": "\u{1F55B}",
1654 "clock1230": "\u{1F567}",
1655 "clock130": "\u{1F55C}",
1656 "clock2": "\u{1F551}",
1657 "clock230": "\u{1F55D}",
1658 "clock3": "\u{1F552}",
1659 "clock330": "\u{1F55E}",
1660 "clock4": "\u{1F553}",
1661 "clock430": "\u{1F55F}",
1662 "clock5": "\u{1F554}",
1663 "clock530": "\u{1F560}",
1664 "clock6": "\u{1F555}",
1665 "clock630": "\u{1F561}",
1666 "clock7": "\u{1F556}",
1667 "clock730": "\u{1F562}",
1668 "clock8": "\u{1F557}",
1669 "clock830": "\u{1F563}",
1670 "clock9": "\u{1F558}",
1671 "clock930": "\u{1F564}",
1672 "closed_book": "\u{1F4D5}",
1673 "closed_lock_with_key": "\u{1F510}",
1674 "closed_umbrella": "\u{1F302}",
1675 "cloud": "\u2601\uFE0F",
1676 "cloud_with_lightning": "\u{1F329}",
1677 "cloud_with_lightning_and_rain": "\u26C8",
1678 "cloud_with_rain": "\u{1F327}",
1679 "cloud_with_snow": "\u{1F328}",
1680 "clown_face": "\u{1F921}",
1681 "clubs": "\u2663\uFE0F",
1682 "cocktail": "\u{1F378}",
1683 "coffee": "\u2615\uFE0F",
1684 "coffin": "\u26B0\uFE0F",
1685 "cold_sweat": "\u{1F630}",
1686 "comet": "\u2604\uFE0F",
1687 "computer": "\u{1F4BB}",
1688 "computer_mouse": "\u{1F5B1}",
1689 "confetti_ball": "\u{1F38A}",
1690 "confounded": "\u{1F616}",
1691 "confused": "\u{1F615}",
1692 "congratulations": "\u3297\uFE0F",
1693 "construction": "\u{1F6A7}",
1694 "construction_worker_man": "\u{1F477}",
1695 "construction_worker_woman": "\u{1F477}&zwj;\u2640\uFE0F",
1696 "control_knobs": "\u{1F39B}",
1697 "convenience_store": "\u{1F3EA}",
1698 "cookie": "\u{1F36A}",
1699 "cool": "\u{1F192}",
1700 "policeman": "\u{1F46E}",
1701 "copyright": "\xA9\uFE0F",
1702 "corn": "\u{1F33D}",
1703 "couch_and_lamp": "\u{1F6CB}",
1704 "couple": "\u{1F46B}",
1705 "couple_with_heart_woman_man": "\u{1F491}",
1706 "couple_with_heart_man_man": "\u{1F468}&zwj;\u2764\uFE0F&zwj;\u{1F468}",
1707 "couple_with_heart_woman_woman": "\u{1F469}&zwj;\u2764\uFE0F&zwj;\u{1F469}",
1708 "couplekiss_man_man": "\u{1F468}&zwj;\u2764\uFE0F&zwj;\u{1F48B}&zwj;\u{1F468}",
1709 "couplekiss_man_woman": "\u{1F48F}",
1710 "couplekiss_woman_woman": "\u{1F469}&zwj;\u2764\uFE0F&zwj;\u{1F48B}&zwj;\u{1F469}",
1711 "cow": "\u{1F42E}",
1712 "cow2": "\u{1F404}",
1713 "cowboy_hat_face": "\u{1F920}",
1714 "crab": "\u{1F980}",
1715 "crayon": "\u{1F58D}",
1716 "credit_card": "\u{1F4B3}",
1717 "crescent_moon": "\u{1F319}",
1718 "cricket": "\u{1F3CF}",
1719 "crocodile": "\u{1F40A}",
1720 "croissant": "\u{1F950}",
1721 "crossed_fingers": "\u{1F91E}",
1722 "crossed_flags": "\u{1F38C}",
1723 "crossed_swords": "\u2694\uFE0F",
1724 "crown": "\u{1F451}",
1725 "cry": "\u{1F622}",
1726 "crying_cat_face": "\u{1F63F}",
1727 "crystal_ball": "\u{1F52E}",
1728 "cucumber": "\u{1F952}",
1729 "cupid": "\u{1F498}",
1730 "curly_loop": "\u27B0",
1731 "currency_exchange": "\u{1F4B1}",
1732 "curry": "\u{1F35B}",
1733 "custard": "\u{1F36E}",
1734 "customs": "\u{1F6C3}",
1735 "cyclone": "\u{1F300}",
1736 "dagger": "\u{1F5E1}",
1737 "dancer": "\u{1F483}",
1738 "dancing_women": "\u{1F46F}",
1739 "dancing_men": "\u{1F46F}&zwj;\u2642\uFE0F",
1740 "dango": "\u{1F361}",
1741 "dark_sunglasses": "\u{1F576}",
1742 "dart": "\u{1F3AF}",
1743 "dash": "\u{1F4A8}",
1744 "date": "\u{1F4C5}",
1745 "deciduous_tree": "\u{1F333}",
1746 "deer": "\u{1F98C}",
1747 "department_store": "\u{1F3EC}",
1748 "derelict_house": "\u{1F3DA}",
1749 "desert": "\u{1F3DC}",
1750 "desert_island": "\u{1F3DD}",
1751 "desktop_computer": "\u{1F5A5}",
1752 "male_detective": "\u{1F575}\uFE0F",
1753 "diamond_shape_with_a_dot_inside": "\u{1F4A0}",
1754 "diamonds": "\u2666\uFE0F",
1755 "disappointed": "\u{1F61E}",
1756 "disappointed_relieved": "\u{1F625}",
1757 "dizzy": "\u{1F4AB}",
1758 "dizzy_face": "\u{1F635}",
1759 "do_not_litter": "\u{1F6AF}",
1760 "dog": "\u{1F436}",
1761 "dog2": "\u{1F415}",
1762 "dollar": "\u{1F4B5}",
1763 "dolls": "\u{1F38E}",
1764 "dolphin": "\u{1F42C}",
1765 "door": "\u{1F6AA}",
1766 "doughnut": "\u{1F369}",
1767 "dove": "\u{1F54A}",
1768 "dragon": "\u{1F409}",
1769 "dragon_face": "\u{1F432}",
1770 "dress": "\u{1F457}",
1771 "dromedary_camel": "\u{1F42A}",
1772 "drooling_face": "\u{1F924}",
1773 "droplet": "\u{1F4A7}",
1774 "drum": "\u{1F941}",
1775 "duck": "\u{1F986}",
1776 "dvd": "\u{1F4C0}",
1777 "e-mail": "\u{1F4E7}",
1778 "eagle": "\u{1F985}",
1779 "ear": "\u{1F442}",
1780 "ear_of_rice": "\u{1F33E}",
1781 "earth_africa": "\u{1F30D}",
1782 "earth_americas": "\u{1F30E}",
1783 "earth_asia": "\u{1F30F}",
1784 "egg": "\u{1F95A}",
1785 "eggplant": "\u{1F346}",
1786 "eight_pointed_black_star": "\u2734\uFE0F",
1787 "eight_spoked_asterisk": "\u2733\uFE0F",
1788 "electric_plug": "\u{1F50C}",
1789 "elephant": "\u{1F418}",
1790 "email": "\u2709\uFE0F",
1791 "end": "\u{1F51A}",
1792 "envelope_with_arrow": "\u{1F4E9}",
1793 "euro": "\u{1F4B6}",
1794 "european_castle": "\u{1F3F0}",
1795 "european_post_office": "\u{1F3E4}",
1796 "evergreen_tree": "\u{1F332}",
1797 "exclamation": "\u2757\uFE0F",
1798 "expressionless": "\u{1F611}",
1799 "eye": "\u{1F441}",
1800 "eye_speech_bubble": "\u{1F441}&zwj;\u{1F5E8}",
1801 "eyeglasses": "\u{1F453}",
1802 "eyes": "\u{1F440}",
1803 "face_with_head_bandage": "\u{1F915}",
1804 "face_with_thermometer": "\u{1F912}",
1805 "fist_oncoming": "\u{1F44A}",
1806 "factory": "\u{1F3ED}",
1807 "fallen_leaf": "\u{1F342}",
1808 "family_man_woman_boy": "\u{1F46A}",
1809 "family_man_boy": "\u{1F468}&zwj;\u{1F466}",
1810 "family_man_boy_boy": "\u{1F468}&zwj;\u{1F466}&zwj;\u{1F466}",
1811 "family_man_girl": "\u{1F468}&zwj;\u{1F467}",
1812 "family_man_girl_boy": "\u{1F468}&zwj;\u{1F467}&zwj;\u{1F466}",
1813 "family_man_girl_girl": "\u{1F468}&zwj;\u{1F467}&zwj;\u{1F467}",
1814 "family_man_man_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F466}",
1815 "family_man_man_boy_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F466}&zwj;\u{1F466}",
1816 "family_man_man_girl": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}",
1817 "family_man_man_girl_boy": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}&zwj;\u{1F466}",
1818 "family_man_man_girl_girl": "\u{1F468}&zwj;\u{1F468}&zwj;\u{1F467}&zwj;\u{1F467}",
1819 "family_man_woman_boy_boy": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1820 "family_man_woman_girl": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}",
1821 "family_man_woman_girl_boy": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1822 "family_man_woman_girl_girl": "\u{1F468}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1823 "family_woman_boy": "\u{1F469}&zwj;\u{1F466}",
1824 "family_woman_boy_boy": "\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1825 "family_woman_girl": "\u{1F469}&zwj;\u{1F467}",
1826 "family_woman_girl_boy": "\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1827 "family_woman_girl_girl": "\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1828 "family_woman_woman_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F466}",
1829 "family_woman_woman_boy_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F466}&zwj;\u{1F466}",
1830 "family_woman_woman_girl": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}",
1831 "family_woman_woman_girl_boy": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F466}",
1832 "family_woman_woman_girl_girl": "\u{1F469}&zwj;\u{1F469}&zwj;\u{1F467}&zwj;\u{1F467}",
1833 "fast_forward": "\u23E9",
1834 "fax": "\u{1F4E0}",
1835 "fearful": "\u{1F628}",
1836 "feet": "\u{1F43E}",
1837 "female_detective": "\u{1F575}\uFE0F&zwj;\u2640\uFE0F",
1838 "ferris_wheel": "\u{1F3A1}",
1839 "ferry": "\u26F4",
1840 "field_hockey": "\u{1F3D1}",
1841 "file_cabinet": "\u{1F5C4}",
1842 "file_folder": "\u{1F4C1}",
1843 "film_projector": "\u{1F4FD}",
1844 "film_strip": "\u{1F39E}",
1845 "fire": "\u{1F525}",
1846 "fire_engine": "\u{1F692}",
1847 "fireworks": "\u{1F386}",
1848 "first_quarter_moon": "\u{1F313}",
1849 "first_quarter_moon_with_face": "\u{1F31B}",
1850 "fish": "\u{1F41F}",
1851 "fish_cake": "\u{1F365}",
1852 "fishing_pole_and_fish": "\u{1F3A3}",
1853 "fist_raised": "\u270A",
1854 "fist_left": "\u{1F91B}",
1855 "fist_right": "\u{1F91C}",
1856 "flags": "\u{1F38F}",
1857 "flashlight": "\u{1F526}",
1858 "fleur_de_lis": "\u269C\uFE0F",
1859 "flight_arrival": "\u{1F6EC}",
1860 "flight_departure": "\u{1F6EB}",
1861 "floppy_disk": "\u{1F4BE}",
1862 "flower_playing_cards": "\u{1F3B4}",
1863 "flushed": "\u{1F633}",
1864 "fog": "\u{1F32B}",
1865 "foggy": "\u{1F301}",
1866 "football": "\u{1F3C8}",
1867 "footprints": "\u{1F463}",
1868 "fork_and_knife": "\u{1F374}",
1869 "fountain": "\u26F2\uFE0F",
1870 "fountain_pen": "\u{1F58B}",
1871 "four_leaf_clover": "\u{1F340}",
1872 "fox_face": "\u{1F98A}",
1873 "framed_picture": "\u{1F5BC}",
1874 "free": "\u{1F193}",
1875 "fried_egg": "\u{1F373}",
1876 "fried_shrimp": "\u{1F364}",
1877 "fries": "\u{1F35F}",
1878 "frog": "\u{1F438}",
1879 "frowning": "\u{1F626}",
1880 "frowning_face": "\u2639\uFE0F",
1881 "frowning_man": "\u{1F64D}&zwj;\u2642\uFE0F",
1882 "frowning_woman": "\u{1F64D}",
1883 "middle_finger": "\u{1F595}",
1884 "fuelpump": "\u26FD\uFE0F",
1885 "full_moon": "\u{1F315}",
1886 "full_moon_with_face": "\u{1F31D}",
1887 "funeral_urn": "\u26B1\uFE0F",
1888 "game_die": "\u{1F3B2}",
1889 "gear": "\u2699\uFE0F",
1890 "gem": "\u{1F48E}",
1891 "gemini": "\u264A\uFE0F",
1892 "ghost": "\u{1F47B}",
1893 "gift": "\u{1F381}",
1894 "gift_heart": "\u{1F49D}",
1895 "girl": "\u{1F467}",
1896 "globe_with_meridians": "\u{1F310}",
1897 "goal_net": "\u{1F945}",
1898 "goat": "\u{1F410}",
1899 "golf": "\u26F3\uFE0F",
1900 "golfing_man": "\u{1F3CC}\uFE0F",
1901 "golfing_woman": "\u{1F3CC}\uFE0F&zwj;\u2640\uFE0F",
1902 "gorilla": "\u{1F98D}",
1903 "grapes": "\u{1F347}",
1904 "green_apple": "\u{1F34F}",
1905 "green_book": "\u{1F4D7}",
1906 "green_heart": "\u{1F49A}",
1907 "green_salad": "\u{1F957}",
1908 "grey_exclamation": "\u2755",
1909 "grey_question": "\u2754",
1910 "grimacing": "\u{1F62C}",
1911 "grin": "\u{1F601}",
1912 "grinning": "\u{1F600}",
1913 "guardsman": "\u{1F482}",
1914 "guardswoman": "\u{1F482}&zwj;\u2640\uFE0F",
1915 "guitar": "\u{1F3B8}",
1916 "gun": "\u{1F52B}",
1917 "haircut_woman": "\u{1F487}",
1918 "haircut_man": "\u{1F487}&zwj;\u2642\uFE0F",
1919 "hamburger": "\u{1F354}",
1920 "hammer": "\u{1F528}",
1921 "hammer_and_pick": "\u2692",
1922 "hammer_and_wrench": "\u{1F6E0}",
1923 "hamster": "\u{1F439}",
1924 "hand": "\u270B",
1925 "handbag": "\u{1F45C}",
1926 "handshake": "\u{1F91D}",
1927 "hankey": "\u{1F4A9}",
1928 "hatched_chick": "\u{1F425}",
1929 "hatching_chick": "\u{1F423}",
1930 "headphones": "\u{1F3A7}",
1931 "hear_no_evil": "\u{1F649}",
1932 "heart": "\u2764\uFE0F",
1933 "heart_decoration": "\u{1F49F}",
1934 "heart_eyes": "\u{1F60D}",
1935 "heart_eyes_cat": "\u{1F63B}",
1936 "heartbeat": "\u{1F493}",
1937 "heartpulse": "\u{1F497}",
1938 "hearts": "\u2665\uFE0F",
1939 "heavy_check_mark": "\u2714\uFE0F",
1940 "heavy_division_sign": "\u2797",
1941 "heavy_dollar_sign": "\u{1F4B2}",
1942 "heavy_heart_exclamation": "\u2763\uFE0F",
1943 "heavy_minus_sign": "\u2796",
1944 "heavy_multiplication_x": "\u2716\uFE0F",
1945 "heavy_plus_sign": "\u2795",
1946 "helicopter": "\u{1F681}",
1947 "herb": "\u{1F33F}",
1948 "hibiscus": "\u{1F33A}",
1949 "high_brightness": "\u{1F506}",
1950 "high_heel": "\u{1F460}",
1951 "hocho": "\u{1F52A}",
1952 "hole": "\u{1F573}",
1953 "honey_pot": "\u{1F36F}",
1954 "horse": "\u{1F434}",
1955 "horse_racing": "\u{1F3C7}",
1956 "hospital": "\u{1F3E5}",
1957 "hot_pepper": "\u{1F336}",
1958 "hotdog": "\u{1F32D}",
1959 "hotel": "\u{1F3E8}",
1960 "hotsprings": "\u2668\uFE0F",
1961 "hourglass": "\u231B\uFE0F",
1962 "hourglass_flowing_sand": "\u23F3",
1963 "house": "\u{1F3E0}",
1964 "house_with_garden": "\u{1F3E1}",
1965 "houses": "\u{1F3D8}",
1966 "hugs": "\u{1F917}",
1967 "hushed": "\u{1F62F}",
1968 "ice_cream": "\u{1F368}",
1969 "ice_hockey": "\u{1F3D2}",
1970 "ice_skate": "\u26F8",
1971 "icecream": "\u{1F366}",
1972 "id": "\u{1F194}",
1973 "ideograph_advantage": "\u{1F250}",
1974 "imp": "\u{1F47F}",
1975 "inbox_tray": "\u{1F4E5}",
1976 "incoming_envelope": "\u{1F4E8}",
1977 "tipping_hand_woman": "\u{1F481}",
1978 "information_source": "\u2139\uFE0F",
1979 "innocent": "\u{1F607}",
1980 "interrobang": "\u2049\uFE0F",
1981 "iphone": "\u{1F4F1}",
1982 "izakaya_lantern": "\u{1F3EE}",
1983 "jack_o_lantern": "\u{1F383}",
1984 "japan": "\u{1F5FE}",
1985 "japanese_castle": "\u{1F3EF}",
1986 "japanese_goblin": "\u{1F47A}",
1987 "japanese_ogre": "\u{1F479}",
1988 "jeans": "\u{1F456}",
1989 "joy": "\u{1F602}",
1990 "joy_cat": "\u{1F639}",
1991 "joystick": "\u{1F579}",
1992 "kaaba": "\u{1F54B}",
1993 "key": "\u{1F511}",
1994 "keyboard": "\u2328\uFE0F",
1995 "keycap_ten": "\u{1F51F}",
1996 "kick_scooter": "\u{1F6F4}",
1997 "kimono": "\u{1F458}",
1998 "kiss": "\u{1F48B}",
1999 "kissing": "\u{1F617}",
2000 "kissing_cat": "\u{1F63D}",
2001 "kissing_closed_eyes": "\u{1F61A}",
2002 "kissing_heart": "\u{1F618}",
2003 "kissing_smiling_eyes": "\u{1F619}",
2004 "kiwi_fruit": "\u{1F95D}",
2005 "koala": "\u{1F428}",
2006 "koko": "\u{1F201}",
2007 "label": "\u{1F3F7}",
2008 "large_blue_circle": "\u{1F535}",
2009 "large_blue_diamond": "\u{1F537}",
2010 "large_orange_diamond": "\u{1F536}",
2011 "last_quarter_moon": "\u{1F317}",
2012 "last_quarter_moon_with_face": "\u{1F31C}",
2013 "latin_cross": "\u271D\uFE0F",
2014 "laughing": "\u{1F606}",
2015 "leaves": "\u{1F343}",
2016 "ledger": "\u{1F4D2}",
2017 "left_luggage": "\u{1F6C5}",
2018 "left_right_arrow": "\u2194\uFE0F",
2019 "leftwards_arrow_with_hook": "\u21A9\uFE0F",
2020 "lemon": "\u{1F34B}",
2021 "leo": "\u264C\uFE0F",
2022 "leopard": "\u{1F406}",
2023 "level_slider": "\u{1F39A}",
2024 "libra": "\u264E\uFE0F",
2025 "light_rail": "\u{1F688}",
2026 "link": "\u{1F517}",
2027 "lion": "\u{1F981}",
2028 "lips": "\u{1F444}",
2029 "lipstick": "\u{1F484}",
2030 "lizard": "\u{1F98E}",
2031 "lock": "\u{1F512}",
2032 "lock_with_ink_pen": "\u{1F50F}",
2033 "lollipop": "\u{1F36D}",
2034 "loop": "\u27BF",
2035 "loud_sound": "\u{1F50A}",
2036 "loudspeaker": "\u{1F4E2}",
2037 "love_hotel": "\u{1F3E9}",
2038 "love_letter": "\u{1F48C}",
2039 "low_brightness": "\u{1F505}",
2040 "lying_face": "\u{1F925}",
2041 "m": "\u24C2\uFE0F",
2042 "mag": "\u{1F50D}",
2043 "mag_right": "\u{1F50E}",
2044 "mahjong": "\u{1F004}\uFE0F",
2045 "mailbox": "\u{1F4EB}",
2046 "mailbox_closed": "\u{1F4EA}",
2047 "mailbox_with_mail": "\u{1F4EC}",
2048 "mailbox_with_no_mail": "\u{1F4ED}",
2049 "man": "\u{1F468}",
2050 "man_artist": "\u{1F468}&zwj;\u{1F3A8}",
2051 "man_astronaut": "\u{1F468}&zwj;\u{1F680}",
2052 "man_cartwheeling": "\u{1F938}&zwj;\u2642\uFE0F",
2053 "man_cook": "\u{1F468}&zwj;\u{1F373}",
2054 "man_dancing": "\u{1F57A}",
2055 "man_facepalming": "\u{1F926}&zwj;\u2642\uFE0F",
2056 "man_factory_worker": "\u{1F468}&zwj;\u{1F3ED}",
2057 "man_farmer": "\u{1F468}&zwj;\u{1F33E}",
2058 "man_firefighter": "\u{1F468}&zwj;\u{1F692}",
2059 "man_health_worker": "\u{1F468}&zwj;\u2695\uFE0F",
2060 "man_in_tuxedo": "\u{1F935}",
2061 "man_judge": "\u{1F468}&zwj;\u2696\uFE0F",
2062 "man_juggling": "\u{1F939}&zwj;\u2642\uFE0F",
2063 "man_mechanic": "\u{1F468}&zwj;\u{1F527}",
2064 "man_office_worker": "\u{1F468}&zwj;\u{1F4BC}",
2065 "man_pilot": "\u{1F468}&zwj;\u2708\uFE0F",
2066 "man_playing_handball": "\u{1F93E}&zwj;\u2642\uFE0F",
2067 "man_playing_water_polo": "\u{1F93D}&zwj;\u2642\uFE0F",
2068 "man_scientist": "\u{1F468}&zwj;\u{1F52C}",
2069 "man_shrugging": "\u{1F937}&zwj;\u2642\uFE0F",
2070 "man_singer": "\u{1F468}&zwj;\u{1F3A4}",
2071 "man_student": "\u{1F468}&zwj;\u{1F393}",
2072 "man_teacher": "\u{1F468}&zwj;\u{1F3EB}",
2073 "man_technologist": "\u{1F468}&zwj;\u{1F4BB}",
2074 "man_with_gua_pi_mao": "\u{1F472}",
2075 "man_with_turban": "\u{1F473}",
2076 "tangerine": "\u{1F34A}",
2077 "mans_shoe": "\u{1F45E}",
2078 "mantelpiece_clock": "\u{1F570}",
2079 "maple_leaf": "\u{1F341}",
2080 "martial_arts_uniform": "\u{1F94B}",
2081 "mask": "\u{1F637}",
2082 "massage_woman": "\u{1F486}",
2083 "massage_man": "\u{1F486}&zwj;\u2642\uFE0F",
2084 "meat_on_bone": "\u{1F356}",
2085 "medal_military": "\u{1F396}",
2086 "medal_sports": "\u{1F3C5}",
2087 "mega": "\u{1F4E3}",
2088 "melon": "\u{1F348}",
2089 "memo": "\u{1F4DD}",
2090 "men_wrestling": "\u{1F93C}&zwj;\u2642\uFE0F",
2091 "menorah": "\u{1F54E}",
2092 "mens": "\u{1F6B9}",
2093 "metal": "\u{1F918}",
2094 "metro": "\u{1F687}",
2095 "microphone": "\u{1F3A4}",
2096 "microscope": "\u{1F52C}",
2097 "milk_glass": "\u{1F95B}",
2098 "milky_way": "\u{1F30C}",
2099 "minibus": "\u{1F690}",
2100 "minidisc": "\u{1F4BD}",
2101 "mobile_phone_off": "\u{1F4F4}",
2102 "money_mouth_face": "\u{1F911}",
2103 "money_with_wings": "\u{1F4B8}",
2104 "moneybag": "\u{1F4B0}",
2105 "monkey": "\u{1F412}",
2106 "monkey_face": "\u{1F435}",
2107 "monorail": "\u{1F69D}",
2108 "moon": "\u{1F314}",
2109 "mortar_board": "\u{1F393}",
2110 "mosque": "\u{1F54C}",
2111 "motor_boat": "\u{1F6E5}",
2112 "motor_scooter": "\u{1F6F5}",
2113 "motorcycle": "\u{1F3CD}",
2114 "motorway": "\u{1F6E3}",
2115 "mount_fuji": "\u{1F5FB}",
2116 "mountain": "\u26F0",
2117 "mountain_biking_man": "\u{1F6B5}",
2118 "mountain_biking_woman": "\u{1F6B5}&zwj;\u2640\uFE0F",
2119 "mountain_cableway": "\u{1F6A0}",
2120 "mountain_railway": "\u{1F69E}",
2121 "mountain_snow": "\u{1F3D4}",
2122 "mouse": "\u{1F42D}",
2123 "mouse2": "\u{1F401}",
2124 "movie_camera": "\u{1F3A5}",
2125 "moyai": "\u{1F5FF}",
2126 "mrs_claus": "\u{1F936}",
2127 "muscle": "\u{1F4AA}",
2128 "mushroom": "\u{1F344}",
2129 "musical_keyboard": "\u{1F3B9}",
2130 "musical_note": "\u{1F3B5}",
2131 "musical_score": "\u{1F3BC}",
2132 "mute": "\u{1F507}",
2133 "nail_care": "\u{1F485}",
2134 "name_badge": "\u{1F4DB}",
2135 "national_park": "\u{1F3DE}",
2136 "nauseated_face": "\u{1F922}",
2137 "necktie": "\u{1F454}",
2138 "negative_squared_cross_mark": "\u274E",
2139 "nerd_face": "\u{1F913}",
2140 "neutral_face": "\u{1F610}",
2141 "new": "\u{1F195}",
2142 "new_moon": "\u{1F311}",
2143 "new_moon_with_face": "\u{1F31A}",
2144 "newspaper": "\u{1F4F0}",
2145 "newspaper_roll": "\u{1F5DE}",
2146 "next_track_button": "\u23ED",
2147 "ng": "\u{1F196}",
2148 "no_good_man": "\u{1F645}&zwj;\u2642\uFE0F",
2149 "no_good_woman": "\u{1F645}",
2150 "night_with_stars": "\u{1F303}",
2151 "no_bell": "\u{1F515}",
2152 "no_bicycles": "\u{1F6B3}",
2153 "no_entry": "\u26D4\uFE0F",
2154 "no_entry_sign": "\u{1F6AB}",
2155 "no_mobile_phones": "\u{1F4F5}",
2156 "no_mouth": "\u{1F636}",
2157 "no_pedestrians": "\u{1F6B7}",
2158 "no_smoking": "\u{1F6AD}",
2159 "non-potable_water": "\u{1F6B1}",
2160 "nose": "\u{1F443}",
2161 "notebook": "\u{1F4D3}",
2162 "notebook_with_decorative_cover": "\u{1F4D4}",
2163 "notes": "\u{1F3B6}",
2164 "nut_and_bolt": "\u{1F529}",
2165 "o": "\u2B55\uFE0F",
2166 "o2": "\u{1F17E}\uFE0F",
2167 "ocean": "\u{1F30A}",
2168 "octopus": "\u{1F419}",
2169 "oden": "\u{1F362}",
2170 "office": "\u{1F3E2}",
2171 "oil_drum": "\u{1F6E2}",
2172 "ok": "\u{1F197}",
2173 "ok_hand": "\u{1F44C}",
2174 "ok_man": "\u{1F646}&zwj;\u2642\uFE0F",
2175 "ok_woman": "\u{1F646}",
2176 "old_key": "\u{1F5DD}",
2177 "older_man": "\u{1F474}",
2178 "older_woman": "\u{1F475}",
2179 "om": "\u{1F549}",
2180 "on": "\u{1F51B}",
2181 "oncoming_automobile": "\u{1F698}",
2182 "oncoming_bus": "\u{1F68D}",
2183 "oncoming_police_car": "\u{1F694}",
2184 "oncoming_taxi": "\u{1F696}",
2185 "open_file_folder": "\u{1F4C2}",
2186 "open_hands": "\u{1F450}",
2187 "open_mouth": "\u{1F62E}",
2188 "open_umbrella": "\u2602\uFE0F",
2189 "ophiuchus": "\u26CE",
2190 "orange_book": "\u{1F4D9}",
2191 "orthodox_cross": "\u2626\uFE0F",
2192 "outbox_tray": "\u{1F4E4}",
2193 "owl": "\u{1F989}",
2194 "ox": "\u{1F402}",
2195 "package": "\u{1F4E6}",
2196 "page_facing_up": "\u{1F4C4}",
2197 "page_with_curl": "\u{1F4C3}",
2198 "pager": "\u{1F4DF}",
2199 "paintbrush": "\u{1F58C}",
2200 "palm_tree": "\u{1F334}",
2201 "pancakes": "\u{1F95E}",
2202 "panda_face": "\u{1F43C}",
2203 "paperclip": "\u{1F4CE}",
2204 "paperclips": "\u{1F587}",
2205 "parasol_on_ground": "\u26F1",
2206 "parking": "\u{1F17F}\uFE0F",
2207 "part_alternation_mark": "\u303D\uFE0F",
2208 "partly_sunny": "\u26C5\uFE0F",
2209 "passenger_ship": "\u{1F6F3}",
2210 "passport_control": "\u{1F6C2}",
2211 "pause_button": "\u23F8",
2212 "peace_symbol": "\u262E\uFE0F",
2213 "peach": "\u{1F351}",
2214 "peanuts": "\u{1F95C}",
2215 "pear": "\u{1F350}",
2216 "pen": "\u{1F58A}",
2217 "pencil2": "\u270F\uFE0F",
2218 "penguin": "\u{1F427}",
2219 "pensive": "\u{1F614}",
2220 "performing_arts": "\u{1F3AD}",
2221 "persevere": "\u{1F623}",
2222 "person_fencing": "\u{1F93A}",
2223 "pouting_woman": "\u{1F64E}",
2224 "phone": "\u260E\uFE0F",
2225 "pick": "\u26CF",
2226 "pig": "\u{1F437}",
2227 "pig2": "\u{1F416}",
2228 "pig_nose": "\u{1F43D}",
2229 "pill": "\u{1F48A}",
2230 "pineapple": "\u{1F34D}",
2231 "ping_pong": "\u{1F3D3}",
2232 "pisces": "\u2653\uFE0F",
2233 "pizza": "\u{1F355}",
2234 "place_of_worship": "\u{1F6D0}",
2235 "plate_with_cutlery": "\u{1F37D}",
2236 "play_or_pause_button": "\u23EF",
2237 "point_down": "\u{1F447}",
2238 "point_left": "\u{1F448}",
2239 "point_right": "\u{1F449}",
2240 "point_up": "\u261D\uFE0F",
2241 "point_up_2": "\u{1F446}",
2242 "police_car": "\u{1F693}",
2243 "policewoman": "\u{1F46E}&zwj;\u2640\uFE0F",
2244 "poodle": "\u{1F429}",
2245 "popcorn": "\u{1F37F}",
2246 "post_office": "\u{1F3E3}",
2247 "postal_horn": "\u{1F4EF}",
2248 "postbox": "\u{1F4EE}",
2249 "potable_water": "\u{1F6B0}",
2250 "potato": "\u{1F954}",
2251 "pouch": "\u{1F45D}",
2252 "poultry_leg": "\u{1F357}",
2253 "pound": "\u{1F4B7}",
2254 "rage": "\u{1F621}",
2255 "pouting_cat": "\u{1F63E}",
2256 "pouting_man": "\u{1F64E}&zwj;\u2642\uFE0F",
2257 "pray": "\u{1F64F}",
2258 "prayer_beads": "\u{1F4FF}",
2259 "pregnant_woman": "\u{1F930}",
2260 "previous_track_button": "\u23EE",
2261 "prince": "\u{1F934}",
2262 "princess": "\u{1F478}",
2263 "printer": "\u{1F5A8}",
2264 "purple_heart": "\u{1F49C}",
2265 "purse": "\u{1F45B}",
2266 "pushpin": "\u{1F4CC}",
2267 "put_litter_in_its_place": "\u{1F6AE}",
2268 "question": "\u2753",
2269 "rabbit": "\u{1F430}",
2270 "rabbit2": "\u{1F407}",
2271 "racehorse": "\u{1F40E}",
2272 "racing_car": "\u{1F3CE}",
2273 "radio": "\u{1F4FB}",
2274 "radio_button": "\u{1F518}",
2275 "radioactive": "\u2622\uFE0F",
2276 "railway_car": "\u{1F683}",
2277 "railway_track": "\u{1F6E4}",
2278 "rainbow": "\u{1F308}",
2279 "rainbow_flag": "\u{1F3F3}\uFE0F&zwj;\u{1F308}",
2280 "raised_back_of_hand": "\u{1F91A}",
2281 "raised_hand_with_fingers_splayed": "\u{1F590}",
2282 "raised_hands": "\u{1F64C}",
2283 "raising_hand_woman": "\u{1F64B}",
2284 "raising_hand_man": "\u{1F64B}&zwj;\u2642\uFE0F",
2285 "ram": "\u{1F40F}",
2286 "ramen": "\u{1F35C}",
2287 "rat": "\u{1F400}",
2288 "record_button": "\u23FA",
2289 "recycle": "\u267B\uFE0F",
2290 "red_circle": "\u{1F534}",
2291 "registered": "\xAE\uFE0F",
2292 "relaxed": "\u263A\uFE0F",
2293 "relieved": "\u{1F60C}",
2294 "reminder_ribbon": "\u{1F397}",
2295 "repeat": "\u{1F501}",
2296 "repeat_one": "\u{1F502}",
2297 "rescue_worker_helmet": "\u26D1",
2298 "restroom": "\u{1F6BB}",
2299 "revolving_hearts": "\u{1F49E}",
2300 "rewind": "\u23EA",
2301 "rhinoceros": "\u{1F98F}",
2302 "ribbon": "\u{1F380}",
2303 "rice": "\u{1F35A}",
2304 "rice_ball": "\u{1F359}",
2305 "rice_cracker": "\u{1F358}",
2306 "rice_scene": "\u{1F391}",
2307 "right_anger_bubble": "\u{1F5EF}",
2308 "ring": "\u{1F48D}",
2309 "robot": "\u{1F916}",
2310 "rocket": "\u{1F680}",
2311 "rofl": "\u{1F923}",
2312 "roll_eyes": "\u{1F644}",
2313 "roller_coaster": "\u{1F3A2}",
2314 "rooster": "\u{1F413}",
2315 "rose": "\u{1F339}",
2316 "rosette": "\u{1F3F5}",
2317 "rotating_light": "\u{1F6A8}",
2318 "round_pushpin": "\u{1F4CD}",
2319 "rowing_man": "\u{1F6A3}",
2320 "rowing_woman": "\u{1F6A3}&zwj;\u2640\uFE0F",
2321 "rugby_football": "\u{1F3C9}",
2322 "running_man": "\u{1F3C3}",
2323 "running_shirt_with_sash": "\u{1F3BD}",
2324 "running_woman": "\u{1F3C3}&zwj;\u2640\uFE0F",
2325 "sa": "\u{1F202}\uFE0F",
2326 "sagittarius": "\u2650\uFE0F",
2327 "sake": "\u{1F376}",
2328 "sandal": "\u{1F461}",
2329 "santa": "\u{1F385}",
2330 "satellite": "\u{1F4E1}",
2331 "saxophone": "\u{1F3B7}",
2332 "school": "\u{1F3EB}",
2333 "school_satchel": "\u{1F392}",
2334 "scissors": "\u2702\uFE0F",
2335 "scorpion": "\u{1F982}",
2336 "scorpius": "\u264F\uFE0F",
2337 "scream": "\u{1F631}",
2338 "scream_cat": "\u{1F640}",
2339 "scroll": "\u{1F4DC}",
2340 "seat": "\u{1F4BA}",
2341 "secret": "\u3299\uFE0F",
2342 "see_no_evil": "\u{1F648}",
2343 "seedling": "\u{1F331}",
2344 "selfie": "\u{1F933}",
2345 "shallow_pan_of_food": "\u{1F958}",
2346 "shamrock": "\u2618\uFE0F",
2347 "shark": "\u{1F988}",
2348 "shaved_ice": "\u{1F367}",
2349 "sheep": "\u{1F411}",
2350 "shell": "\u{1F41A}",
2351 "shield": "\u{1F6E1}",
2352 "shinto_shrine": "\u26E9",
2353 "ship": "\u{1F6A2}",
2354 "shirt": "\u{1F455}",
2355 "shopping": "\u{1F6CD}",
2356 "shopping_cart": "\u{1F6D2}",
2357 "shower": "\u{1F6BF}",
2358 "shrimp": "\u{1F990}",
2359 "signal_strength": "\u{1F4F6}",
2360 "six_pointed_star": "\u{1F52F}",
2361 "ski": "\u{1F3BF}",
2362 "skier": "\u26F7",
2363 "skull": "\u{1F480}",
2364 "skull_and_crossbones": "\u2620\uFE0F",
2365 "sleeping": "\u{1F634}",
2366 "sleeping_bed": "\u{1F6CC}",
2367 "sleepy": "\u{1F62A}",
2368 "slightly_frowning_face": "\u{1F641}",
2369 "slightly_smiling_face": "\u{1F642}",
2370 "slot_machine": "\u{1F3B0}",
2371 "small_airplane": "\u{1F6E9}",
2372 "small_blue_diamond": "\u{1F539}",
2373 "small_orange_diamond": "\u{1F538}",
2374 "small_red_triangle": "\u{1F53A}",
2375 "small_red_triangle_down": "\u{1F53B}",
2376 "smile": "\u{1F604}",
2377 "smile_cat": "\u{1F638}",
2378 "smiley": "\u{1F603}",
2379 "smiley_cat": "\u{1F63A}",
2380 "smiling_imp": "\u{1F608}",
2381 "smirk": "\u{1F60F}",
2382 "smirk_cat": "\u{1F63C}",
2383 "smoking": "\u{1F6AC}",
2384 "snail": "\u{1F40C}",
2385 "snake": "\u{1F40D}",
2386 "sneezing_face": "\u{1F927}",
2387 "snowboarder": "\u{1F3C2}",
2388 "snowflake": "\u2744\uFE0F",
2389 "snowman": "\u26C4\uFE0F",
2390 "snowman_with_snow": "\u2603\uFE0F",
2391 "sob": "\u{1F62D}",
2392 "soccer": "\u26BD\uFE0F",
2393 "soon": "\u{1F51C}",
2394 "sos": "\u{1F198}",
2395 "sound": "\u{1F509}",
2396 "space_invader": "\u{1F47E}",
2397 "spades": "\u2660\uFE0F",
2398 "spaghetti": "\u{1F35D}",
2399 "sparkle": "\u2747\uFE0F",
2400 "sparkler": "\u{1F387}",
2401 "sparkles": "\u2728",
2402 "sparkling_heart": "\u{1F496}",
2403 "speak_no_evil": "\u{1F64A}",
2404 "speaker": "\u{1F508}",
2405 "speaking_head": "\u{1F5E3}",
2406 "speech_balloon": "\u{1F4AC}",
2407 "speedboat": "\u{1F6A4}",
2408 "spider": "\u{1F577}",
2409 "spider_web": "\u{1F578}",
2410 "spiral_calendar": "\u{1F5D3}",
2411 "spiral_notepad": "\u{1F5D2}",
2412 "spoon": "\u{1F944}",
2413 "squid": "\u{1F991}",
2414 "stadium": "\u{1F3DF}",
2415 "star": "\u2B50\uFE0F",
2416 "star2": "\u{1F31F}",
2417 "star_and_crescent": "\u262A\uFE0F",
2418 "star_of_david": "\u2721\uFE0F",
2419 "stars": "\u{1F320}",
2420 "station": "\u{1F689}",
2421 "statue_of_liberty": "\u{1F5FD}",
2422 "steam_locomotive": "\u{1F682}",
2423 "stew": "\u{1F372}",
2424 "stop_button": "\u23F9",
2425 "stop_sign": "\u{1F6D1}",
2426 "stopwatch": "\u23F1",
2427 "straight_ruler": "\u{1F4CF}",
2428 "strawberry": "\u{1F353}",
2429 "stuck_out_tongue": "\u{1F61B}",
2430 "stuck_out_tongue_closed_eyes": "\u{1F61D}",
2431 "stuck_out_tongue_winking_eye": "\u{1F61C}",
2432 "studio_microphone": "\u{1F399}",
2433 "stuffed_flatbread": "\u{1F959}",
2434 "sun_behind_large_cloud": "\u{1F325}",
2435 "sun_behind_rain_cloud": "\u{1F326}",
2436 "sun_behind_small_cloud": "\u{1F324}",
2437 "sun_with_face": "\u{1F31E}",
2438 "sunflower": "\u{1F33B}",
2439 "sunglasses": "\u{1F60E}",
2440 "sunny": "\u2600\uFE0F",
2441 "sunrise": "\u{1F305}",
2442 "sunrise_over_mountains": "\u{1F304}",
2443 "surfing_man": "\u{1F3C4}",
2444 "surfing_woman": "\u{1F3C4}&zwj;\u2640\uFE0F",
2445 "sushi": "\u{1F363}",
2446 "suspension_railway": "\u{1F69F}",
2447 "sweat": "\u{1F613}",
2448 "sweat_drops": "\u{1F4A6}",
2449 "sweat_smile": "\u{1F605}",
2450 "sweet_potato": "\u{1F360}",
2451 "swimming_man": "\u{1F3CA}",
2452 "swimming_woman": "\u{1F3CA}&zwj;\u2640\uFE0F",
2453 "symbols": "\u{1F523}",
2454 "synagogue": "\u{1F54D}",
2455 "syringe": "\u{1F489}",
2456 "taco": "\u{1F32E}",
2457 "tada": "\u{1F389}",
2458 "tanabata_tree": "\u{1F38B}",
2459 "taurus": "\u2649\uFE0F",
2460 "taxi": "\u{1F695}",
2461 "tea": "\u{1F375}",
2462 "telephone_receiver": "\u{1F4DE}",
2463 "telescope": "\u{1F52D}",
2464 "tennis": "\u{1F3BE}",
2465 "tent": "\u26FA\uFE0F",
2466 "thermometer": "\u{1F321}",
2467 "thinking": "\u{1F914}",
2468 "thought_balloon": "\u{1F4AD}",
2469 "ticket": "\u{1F3AB}",
2470 "tickets": "\u{1F39F}",
2471 "tiger": "\u{1F42F}",
2472 "tiger2": "\u{1F405}",
2473 "timer_clock": "\u23F2",
2474 "tipping_hand_man": "\u{1F481}&zwj;\u2642\uFE0F",
2475 "tired_face": "\u{1F62B}",
2476 "tm": "\u2122\uFE0F",
2477 "toilet": "\u{1F6BD}",
2478 "tokyo_tower": "\u{1F5FC}",
2479 "tomato": "\u{1F345}",
2480 "tongue": "\u{1F445}",
2481 "top": "\u{1F51D}",
2482 "tophat": "\u{1F3A9}",
2483 "tornado": "\u{1F32A}",
2484 "trackball": "\u{1F5B2}",
2485 "tractor": "\u{1F69C}",
2486 "traffic_light": "\u{1F6A5}",
2487 "train": "\u{1F68B}",
2488 "train2": "\u{1F686}",
2489 "tram": "\u{1F68A}",
2490 "triangular_flag_on_post": "\u{1F6A9}",
2491 "triangular_ruler": "\u{1F4D0}",
2492 "trident": "\u{1F531}",
2493 "triumph": "\u{1F624}",
2494 "trolleybus": "\u{1F68E}",
2495 "trophy": "\u{1F3C6}",
2496 "tropical_drink": "\u{1F379}",
2497 "tropical_fish": "\u{1F420}",
2498 "truck": "\u{1F69A}",
2499 "trumpet": "\u{1F3BA}",
2500 "tulip": "\u{1F337}",
2501 "tumbler_glass": "\u{1F943}",
2502 "turkey": "\u{1F983}",
2503 "turtle": "\u{1F422}",
2504 "tv": "\u{1F4FA}",
2505 "twisted_rightwards_arrows": "\u{1F500}",
2506 "two_hearts": "\u{1F495}",
2507 "two_men_holding_hands": "\u{1F46C}",
2508 "two_women_holding_hands": "\u{1F46D}",
2509 "u5272": "\u{1F239}",
2510 "u5408": "\u{1F234}",
2511 "u55b6": "\u{1F23A}",
2512 "u6307": "\u{1F22F}\uFE0F",
2513 "u6708": "\u{1F237}\uFE0F",
2514 "u6709": "\u{1F236}",
2515 "u6e80": "\u{1F235}",
2516 "u7121": "\u{1F21A}\uFE0F",
2517 "u7533": "\u{1F238}",
2518 "u7981": "\u{1F232}",
2519 "u7a7a": "\u{1F233}",
2520 "umbrella": "\u2614\uFE0F",
2521 "unamused": "\u{1F612}",
2522 "underage": "\u{1F51E}",
2523 "unicorn": "\u{1F984}",
2524 "unlock": "\u{1F513}",
2525 "up": "\u{1F199}",
2526 "upside_down_face": "\u{1F643}",
2527 "v": "\u270C\uFE0F",
2528 "vertical_traffic_light": "\u{1F6A6}",
2529 "vhs": "\u{1F4FC}",
2530 "vibration_mode": "\u{1F4F3}",
2531 "video_camera": "\u{1F4F9}",
2532 "video_game": "\u{1F3AE}",
2533 "violin": "\u{1F3BB}",
2534 "virgo": "\u264D\uFE0F",
2535 "volcano": "\u{1F30B}",
2536 "volleyball": "\u{1F3D0}",
2537 "vs": "\u{1F19A}",
2538 "vulcan_salute": "\u{1F596}",
2539 "walking_man": "\u{1F6B6}",
2540 "walking_woman": "\u{1F6B6}&zwj;\u2640\uFE0F",
2541 "waning_crescent_moon": "\u{1F318}",
2542 "waning_gibbous_moon": "\u{1F316}",
2543 "warning": "\u26A0\uFE0F",
2544 "wastebasket": "\u{1F5D1}",
2545 "watch": "\u231A\uFE0F",
2546 "water_buffalo": "\u{1F403}",
2547 "watermelon": "\u{1F349}",
2548 "wave": "\u{1F44B}",
2549 "wavy_dash": "\u3030\uFE0F",
2550 "waxing_crescent_moon": "\u{1F312}",
2551 "wc": "\u{1F6BE}",
2552 "weary": "\u{1F629}",
2553 "wedding": "\u{1F492}",
2554 "weight_lifting_man": "\u{1F3CB}\uFE0F",
2555 "weight_lifting_woman": "\u{1F3CB}\uFE0F&zwj;\u2640\uFE0F",
2556 "whale": "\u{1F433}",
2557 "whale2": "\u{1F40B}",
2558 "wheel_of_dharma": "\u2638\uFE0F",
2559 "wheelchair": "\u267F\uFE0F",
2560 "white_check_mark": "\u2705",
2561 "white_circle": "\u26AA\uFE0F",
2562 "white_flag": "\u{1F3F3}\uFE0F",
2563 "white_flower": "\u{1F4AE}",
2564 "white_large_square": "\u2B1C\uFE0F",
2565 "white_medium_small_square": "\u25FD\uFE0F",
2566 "white_medium_square": "\u25FB\uFE0F",
2567 "white_small_square": "\u25AB\uFE0F",
2568 "white_square_button": "\u{1F533}",
2569 "wilted_flower": "\u{1F940}",
2570 "wind_chime": "\u{1F390}",
2571 "wind_face": "\u{1F32C}",
2572 "wine_glass": "\u{1F377}",
2573 "wink": "\u{1F609}",
2574 "wolf": "\u{1F43A}",
2575 "woman": "\u{1F469}",
2576 "woman_artist": "\u{1F469}&zwj;\u{1F3A8}",
2577 "woman_astronaut": "\u{1F469}&zwj;\u{1F680}",
2578 "woman_cartwheeling": "\u{1F938}&zwj;\u2640\uFE0F",
2579 "woman_cook": "\u{1F469}&zwj;\u{1F373}",
2580 "woman_facepalming": "\u{1F926}&zwj;\u2640\uFE0F",
2581 "woman_factory_worker": "\u{1F469}&zwj;\u{1F3ED}",
2582 "woman_farmer": "\u{1F469}&zwj;\u{1F33E}",
2583 "woman_firefighter": "\u{1F469}&zwj;\u{1F692}",
2584 "woman_health_worker": "\u{1F469}&zwj;\u2695\uFE0F",
2585 "woman_judge": "\u{1F469}&zwj;\u2696\uFE0F",
2586 "woman_juggling": "\u{1F939}&zwj;\u2640\uFE0F",
2587 "woman_mechanic": "\u{1F469}&zwj;\u{1F527}",
2588 "woman_office_worker": "\u{1F469}&zwj;\u{1F4BC}",
2589 "woman_pilot": "\u{1F469}&zwj;\u2708\uFE0F",
2590 "woman_playing_handball": "\u{1F93E}&zwj;\u2640\uFE0F",
2591 "woman_playing_water_polo": "\u{1F93D}&zwj;\u2640\uFE0F",
2592 "woman_scientist": "\u{1F469}&zwj;\u{1F52C}",
2593 "woman_shrugging": "\u{1F937}&zwj;\u2640\uFE0F",
2594 "woman_singer": "\u{1F469}&zwj;\u{1F3A4}",
2595 "woman_student": "\u{1F469}&zwj;\u{1F393}",
2596 "woman_teacher": "\u{1F469}&zwj;\u{1F3EB}",
2597 "woman_technologist": "\u{1F469}&zwj;\u{1F4BB}",
2598 "woman_with_turban": "\u{1F473}&zwj;\u2640\uFE0F",
2599 "womans_clothes": "\u{1F45A}",
2600 "womans_hat": "\u{1F452}",
2601 "women_wrestling": "\u{1F93C}&zwj;\u2640\uFE0F",
2602 "womens": "\u{1F6BA}",
2603 "world_map": "\u{1F5FA}",
2604 "worried": "\u{1F61F}",
2605 "wrench": "\u{1F527}",
2606 "writing_hand": "\u270D\uFE0F",
2607 "x": "\u274C",
2608 "yellow_heart": "\u{1F49B}",
2609 "yen": "\u{1F4B4}",
2610 "yin_yang": "\u262F\uFE0F",
2611 "yum": "\u{1F60B}",
2612 "zap": "\u26A1\uFE0F",
2613 "zipper_mouth_face": "\u{1F910}",
2614 "zzz": "\u{1F4A4}",
2615 /* special emojis :P */
2616 "octocat": '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
2617 "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>`
2618 };
2619 showdown2.Converter = function(converterOptions) {
2620 "use strict";
2621 var options = {}, langExtensions = [], outputModifiers = [], listeners = {}, setConvFlavor = setFlavor, metadata = {
2622 parsed: {},
2623 raw: "",
2624 format: ""
2625 };
2626 _constructor();
2627 function _constructor() {
2628 converterOptions = converterOptions || {};
2629 for (var gOpt in globalOptions) {
2630 if (globalOptions.hasOwnProperty(gOpt)) {
2631 options[gOpt] = globalOptions[gOpt];
2632 }
2633 }
2634 if (typeof converterOptions === "object") {
2635 for (var opt in converterOptions) {
2636 if (converterOptions.hasOwnProperty(opt)) {
2637 options[opt] = converterOptions[opt];
2638 }
2639 }
2640 } else {
2641 throw Error("Converter expects the passed parameter to be an object, but " + typeof converterOptions + " was passed instead.");
2642 }
2643 if (options.extensions) {
2644 showdown2.helper.forEach(options.extensions, _parseExtension);
2645 }
2646 }
2647 function _parseExtension(ext, name) {
2648 name = name || null;
2649 if (showdown2.helper.isString(ext)) {
2650 ext = showdown2.helper.stdExtName(ext);
2651 name = ext;
2652 if (showdown2.extensions[ext]) {
2653 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!");
2654 legacyExtensionLoading(showdown2.extensions[ext], ext);
2655 return;
2656 } else if (!showdown2.helper.isUndefined(extensions[ext])) {
2657 ext = extensions[ext];
2658 } else {
2659 throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
2660 }
2661 }
2662 if (typeof ext === "function") {
2663 ext = ext();
2664 }
2665 if (!showdown2.helper.isArray(ext)) {
2666 ext = [ext];
2667 }
2668 var validExt = validate(ext, name);
2669 if (!validExt.valid) {
2670 throw Error(validExt.error);
2671 }
2672 for (var i2 = 0; i2 < ext.length; ++i2) {
2673 switch (ext[i2].type) {
2674 case "lang":
2675 langExtensions.push(ext[i2]);
2676 break;
2677 case "output":
2678 outputModifiers.push(ext[i2]);
2679 break;
2680 }
2681 if (ext[i2].hasOwnProperty("listeners")) {
2682 for (var ln in ext[i2].listeners) {
2683 if (ext[i2].listeners.hasOwnProperty(ln)) {
2684 listen(ln, ext[i2].listeners[ln]);
2685 }
2686 }
2687 }
2688 }
2689 }
2690 function legacyExtensionLoading(ext, name) {
2691 if (typeof ext === "function") {
2692 ext = ext(new showdown2.Converter());
2693 }
2694 if (!showdown2.helper.isArray(ext)) {
2695 ext = [ext];
2696 }
2697 var valid = validate(ext, name);
2698 if (!valid.valid) {
2699 throw Error(valid.error);
2700 }
2701 for (var i2 = 0; i2 < ext.length; ++i2) {
2702 switch (ext[i2].type) {
2703 case "lang":
2704 langExtensions.push(ext[i2]);
2705 break;
2706 case "output":
2707 outputModifiers.push(ext[i2]);
2708 break;
2709 default:
2710 throw Error("Extension loader error: Type unrecognized!!!");
2711 }
2712 }
2713 }
2714 function listen(name, callback) {
2715 if (!showdown2.helper.isString(name)) {
2716 throw Error("Invalid argument in converter.listen() method: name must be a string, but " + typeof name + " given");
2717 }
2718 if (typeof callback !== "function") {
2719 throw Error("Invalid argument in converter.listen() method: callback must be a function, but " + typeof callback + " given");
2720 }
2721 if (!listeners.hasOwnProperty(name)) {
2722 listeners[name] = [];
2723 }
2724 listeners[name].push(callback);
2725 }
2726 function rTrimInputText(text2) {
2727 var rsp = text2.match(/^\s*/)[0].length, rgx = new RegExp("^\\s{0," + rsp + "}", "gm");
2728 return text2.replace(rgx, "");
2729 }
2730 this._dispatch = function dispatch3(evtName, text2, options2, globals) {
2731 if (listeners.hasOwnProperty(evtName)) {
2732 for (var ei = 0; ei < listeners[evtName].length; ++ei) {
2733 var nText = listeners[evtName][ei](evtName, text2, this, options2, globals);
2734 if (nText && typeof nText !== "undefined") {
2735 text2 = nText;
2736 }
2737 }
2738 }
2739 return text2;
2740 };
2741 this.listen = function(name, callback) {
2742 listen(name, callback);
2743 return this;
2744 };
2745 this.makeHtml = function(text2) {
2746 if (!text2) {
2747 return text2;
2748 }
2749 var globals = {
2750 gHtmlBlocks: [],
2751 gHtmlMdBlocks: [],
2752 gHtmlSpans: [],
2753 gUrls: {},
2754 gTitles: {},
2755 gDimensions: {},
2756 gListLevel: 0,
2757 hashLinkCounts: {},
2758 langExtensions,
2759 outputModifiers,
2760 converter: this,
2761 ghCodeBlocks: [],
2762 metadata: {
2763 parsed: {},
2764 raw: "",
2765 format: ""
2766 }
2767 };
2768 text2 = text2.replace(/¨/g, "\xA8T");
2769 text2 = text2.replace(/\$/g, "\xA8D");
2770 text2 = text2.replace(/\r\n/g, "\n");
2771 text2 = text2.replace(/\r/g, "\n");
2772 text2 = text2.replace(/\u00A0/g, "&nbsp;");
2773 if (options.smartIndentationFix) {
2774 text2 = rTrimInputText(text2);
2775 }
2776 text2 = "\n\n" + text2 + "\n\n";
2777 text2 = showdown2.subParser("detab")(text2, options, globals);
2778 text2 = text2.replace(/^[ \t]+$/mg, "");
2779 showdown2.helper.forEach(langExtensions, function(ext) {
2780 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals);
2781 });
2782 text2 = showdown2.subParser("metadata")(text2, options, globals);
2783 text2 = showdown2.subParser("hashPreCodeTags")(text2, options, globals);
2784 text2 = showdown2.subParser("githubCodeBlocks")(text2, options, globals);
2785 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals);
2786 text2 = showdown2.subParser("hashCodeTags")(text2, options, globals);
2787 text2 = showdown2.subParser("stripLinkDefinitions")(text2, options, globals);
2788 text2 = showdown2.subParser("blockGamut")(text2, options, globals);
2789 text2 = showdown2.subParser("unhashHTMLSpans")(text2, options, globals);
2790 text2 = showdown2.subParser("unescapeSpecialChars")(text2, options, globals);
2791 text2 = text2.replace(/¨D/g, "$$");
2792 text2 = text2.replace(/¨T/g, "\xA8");
2793 text2 = showdown2.subParser("completeHTMLDocument")(text2, options, globals);
2794 showdown2.helper.forEach(outputModifiers, function(ext) {
2795 text2 = showdown2.subParser("runExtension")(ext, text2, options, globals);
2796 });
2797 metadata = globals.metadata;
2798 return text2;
2799 };
2800 this.makeMarkdown = this.makeMd = function(src, HTMLParser) {
2801 src = src.replace(/\r\n/g, "\n");
2802 src = src.replace(/\r/g, "\n");
2803 src = src.replace(/>[ \t]+</, ">\xA8NBSP;<");
2804 if (!HTMLParser) {
2805 if (window && window.document) {
2806 HTMLParser = window.document;
2807 } else {
2808 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");
2809 }
2810 }
2811 var doc = HTMLParser.createElement("div");
2812 doc.innerHTML = src;
2813 var globals = {
2814 preList: substitutePreCodeTags(doc)
2815 };
2816 clean(doc);
2817 var nodes = doc.childNodes, mdDoc = "";
2818 for (var i2 = 0; i2 < nodes.length; i2++) {
2819 mdDoc += showdown2.subParser("makeMarkdown.node")(nodes[i2], globals);
2820 }
2821 function clean(node) {
2822 for (var n2 = 0; n2 < node.childNodes.length; ++n2) {
2823 var child = node.childNodes[n2];
2824 if (child.nodeType === 3) {
2825 if (!/\S/.test(child.nodeValue)) {
2826 node.removeChild(child);
2827 --n2;
2828 } else {
2829 child.nodeValue = child.nodeValue.split("\n").join(" ");
2830 child.nodeValue = child.nodeValue.replace(/(\s)+/g, "$1");
2831 }
2832 } else if (child.nodeType === 1) {
2833 clean(child);
2834 }
2835 }
2836 }
2837 function substitutePreCodeTags(doc2) {
2838 var pres = doc2.querySelectorAll("pre"), presPH = [];
2839 for (var i3 = 0; i3 < pres.length; ++i3) {
2840 if (pres[i3].childElementCount === 1 && pres[i3].firstChild.tagName.toLowerCase() === "code") {
2841 var content = pres[i3].firstChild.innerHTML.trim(), language = pres[i3].firstChild.getAttribute("data-language") || "";
2842 if (language === "") {
2843 var classes = pres[i3].firstChild.className.split(" ");
2844 for (var c2 = 0; c2 < classes.length; ++c2) {
2845 var matches = classes[c2].match(/^language-(.+)$/);
2846 if (matches !== null) {
2847 language = matches[1];
2848 break;
2849 }
2850 }
2851 }
2852 content = showdown2.helper.unescapeHTMLEntities(content);
2853 presPH.push(content);
2854 pres[i3].outerHTML = '<precode language="' + language + '" precodenum="' + i3.toString() + '"></precode>';
2855 } else {
2856 presPH.push(pres[i3].innerHTML);
2857 pres[i3].innerHTML = "";
2858 pres[i3].setAttribute("prenum", i3.toString());
2859 }
2860 }
2861 return presPH;
2862 }
2863 return mdDoc;
2864 };
2865 this.setOption = function(key, value) {
2866 options[key] = value;
2867 };
2868 this.getOption = function(key) {
2869 return options[key];
2870 };
2871 this.getOptions = function() {
2872 return options;
2873 };
2874 this.addExtension = function(extension, name) {
2875 name = name || null;
2876 _parseExtension(extension, name);
2877 };
2878 this.useExtension = function(extensionName) {
2879 _parseExtension(extensionName);
2880 };
2881 this.setFlavor = function(name) {
2882 if (!flavor.hasOwnProperty(name)) {
2883 throw Error(name + " flavor was not found");
2884 }
2885 var preset = flavor[name];
2886 setConvFlavor = name;
2887 for (var option in preset) {
2888 if (preset.hasOwnProperty(option)) {
2889 options[option] = preset[option];
2890 }
2891 }
2892 };
2893 this.getFlavor = function() {
2894 return setConvFlavor;
2895 };
2896 this.removeExtension = function(extension) {
2897 if (!showdown2.helper.isArray(extension)) {
2898 extension = [extension];
2899 }
2900 for (var a2 = 0; a2 < extension.length; ++a2) {
2901 var ext = extension[a2];
2902 for (var i2 = 0; i2 < langExtensions.length; ++i2) {
2903 if (langExtensions[i2] === ext) {
2904 langExtensions[i2].splice(i2, 1);
2905 }
2906 }
2907 for (var ii = 0; ii < outputModifiers.length; ++i2) {
2908 if (outputModifiers[ii] === ext) {
2909 outputModifiers[ii].splice(i2, 1);
2910 }
2911 }
2912 }
2913 };
2914 this.getAllExtensions = function() {
2915 return {
2916 language: langExtensions,
2917 output: outputModifiers
2918 };
2919 };
2920 this.getMetadata = function(raw) {
2921 if (raw) {
2922 return metadata.raw;
2923 } else {
2924 return metadata.parsed;
2925 }
2926 };
2927 this.getMetadataFormat = function() {
2928 return metadata.format;
2929 };
2930 this._setMetadataPair = function(key, value) {
2931 metadata.parsed[key] = value;
2932 };
2933 this._setMetadataFormat = function(format) {
2934 metadata.format = format;
2935 };
2936 this._setMetadataRaw = function(raw) {
2937 metadata.raw = raw;
2938 };
2939 };
2940 showdown2.subParser("anchors", function(text2, options, globals) {
2941 "use strict";
2942 text2 = globals.converter._dispatch("anchors.before", text2, options, globals);
2943 var writeAnchorTag = function(wholeMatch, linkText, linkId, url, m5, m6, title) {
2944 if (showdown2.helper.isUndefined(title)) {
2945 title = "";
2946 }
2947 linkId = linkId.toLowerCase();
2948 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
2949 url = "";
2950 } else if (!url) {
2951 if (!linkId) {
2952 linkId = linkText.toLowerCase().replace(/ ?\n/g, " ");
2953 }
2954 url = "#" + linkId;
2955 if (!showdown2.helper.isUndefined(globals.gUrls[linkId])) {
2956 url = globals.gUrls[linkId];
2957 if (!showdown2.helper.isUndefined(globals.gTitles[linkId])) {
2958 title = globals.gTitles[linkId];
2959 }
2960 } else {
2961 return wholeMatch;
2962 }
2963 }
2964 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
2965 var result = '<a href="' + url + '"';
2966 if (title !== "" && title !== null) {
2967 title = title.replace(/"/g, "&quot;");
2968 title = title.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
2969 result += ' title="' + title + '"';
2970 }
2971 if (options.openLinksInNewWindow && !/^#/.test(url)) {
2972 result += ' rel="noopener noreferrer" target="\xA8E95Eblank"';
2973 }
2974 result += ">" + linkText + "</a>";
2975 return result;
2976 };
2977 text2 = text2.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
2978 text2 = text2.replace(
2979 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
2980 writeAnchorTag
2981 );
2982 text2 = text2.replace(
2983 /\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
2984 writeAnchorTag
2985 );
2986 text2 = text2.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
2987 if (options.ghMentions) {
2988 text2 = text2.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function(wm, st, escape, mentions, username) {
2989 if (escape === "\\") {
2990 return st + mentions;
2991 }
2992 if (!showdown2.helper.isString(options.ghMentionsLink)) {
2993 throw new Error("ghMentionsLink option must be a string");
2994 }
2995 var lnk = options.ghMentionsLink.replace(/\{u}/g, username), target = "";
2996 if (options.openLinksInNewWindow) {
2997 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"';
2998 }
2999 return st + '<a href="' + lnk + '"' + target + ">" + mentions + "</a>";
3000 });
3001 }
3002 text2 = globals.converter._dispatch("anchors.after", text2, options, globals);
3003 return text2;
3004 });
3005 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) {
3006 "use strict";
3007 return function(wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
3008 link = link.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3009 var lnkTxt = link, append = "", target = "", lmc = leadingMagicChars || "", tmc = trailingMagicChars || "";
3010 if (/^www\./i.test(link)) {
3011 link = link.replace(/^www\./i, "http://www.");
3012 }
3013 if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
3014 append = trailingPunctuation;
3015 }
3016 if (options.openLinksInNewWindow) {
3017 target = ' rel="noopener noreferrer" target="\xA8E95Eblank"';
3018 }
3019 return lmc + '<a href="' + link + '"' + target + ">" + lnkTxt + "</a>" + append + tmc;
3020 };
3021 }, replaceMail = function(options, globals) {
3022 "use strict";
3023 return function(wholeMatch, b2, mail) {
3024 var href = "mailto:";
3025 b2 = b2 || "";
3026 mail = showdown2.subParser("unescapeSpecialChars")(mail, options, globals);
3027 if (options.encodeEmails) {
3028 href = showdown2.helper.encodeEmailAddress(href + mail);
3029 mail = showdown2.helper.encodeEmailAddress(mail);
3030 } else {
3031 href = href + mail;
3032 }
3033 return b2 + '<a href="' + href + '">' + mail + "</a>";
3034 };
3035 };
3036 showdown2.subParser("autoLinks", function(text2, options, globals) {
3037 "use strict";
3038 text2 = globals.converter._dispatch("autoLinks.before", text2, options, globals);
3039 text2 = text2.replace(delimUrlRegex, replaceLink(options));
3040 text2 = text2.replace(delimMailRegex, replaceMail(options, globals));
3041 text2 = globals.converter._dispatch("autoLinks.after", text2, options, globals);
3042 return text2;
3043 });
3044 showdown2.subParser("simplifiedAutoLinks", function(text2, options, globals) {
3045 "use strict";
3046 if (!options.simplifiedAutoLink) {
3047 return text2;
3048 }
3049 text2 = globals.converter._dispatch("simplifiedAutoLinks.before", text2, options, globals);
3050 if (options.excludeTrailingPunctuationFromURLs) {
3051 text2 = text2.replace(simpleURLRegex2, replaceLink(options));
3052 } else {
3053 text2 = text2.replace(simpleURLRegex, replaceLink(options));
3054 }
3055 text2 = text2.replace(simpleMailRegex, replaceMail(options, globals));
3056 text2 = globals.converter._dispatch("simplifiedAutoLinks.after", text2, options, globals);
3057 return text2;
3058 });
3059 showdown2.subParser("blockGamut", function(text2, options, globals) {
3060 "use strict";
3061 text2 = globals.converter._dispatch("blockGamut.before", text2, options, globals);
3062 text2 = showdown2.subParser("blockQuotes")(text2, options, globals);
3063 text2 = showdown2.subParser("headers")(text2, options, globals);
3064 text2 = showdown2.subParser("horizontalRule")(text2, options, globals);
3065 text2 = showdown2.subParser("lists")(text2, options, globals);
3066 text2 = showdown2.subParser("codeBlocks")(text2, options, globals);
3067 text2 = showdown2.subParser("tables")(text2, options, globals);
3068 text2 = showdown2.subParser("hashHTMLBlocks")(text2, options, globals);
3069 text2 = showdown2.subParser("paragraphs")(text2, options, globals);
3070 text2 = globals.converter._dispatch("blockGamut.after", text2, options, globals);
3071 return text2;
3072 });
3073 showdown2.subParser("blockQuotes", function(text2, options, globals) {
3074 "use strict";
3075 text2 = globals.converter._dispatch("blockQuotes.before", text2, options, globals);
3076 text2 = text2 + "\n\n";
3077 var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
3078 if (options.splitAdjacentBlockquotes) {
3079 rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
3080 }
3081 text2 = text2.replace(rgx, function(bq) {
3082 bq = bq.replace(/^[ \t]*>[ \t]?/gm, "");
3083 bq = bq.replace(/¨0/g, "");
3084 bq = bq.replace(/^[ \t]+$/gm, "");
3085 bq = showdown2.subParser("githubCodeBlocks")(bq, options, globals);
3086 bq = showdown2.subParser("blockGamut")(bq, options, globals);
3087 bq = bq.replace(/(^|\n)/g, "$1 ");
3088 bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function(wholeMatch, m1) {
3089 var pre = m1;
3090 pre = pre.replace(/^ /mg, "\xA80");
3091 pre = pre.replace(/¨0/g, "");
3092 return pre;
3093 });
3094 return showdown2.subParser("hashBlock")("<blockquote>\n" + bq + "\n</blockquote>", options, globals);
3095 });
3096 text2 = globals.converter._dispatch("blockQuotes.after", text2, options, globals);
3097 return text2;
3098 });
3099 showdown2.subParser("codeBlocks", function(text2, options, globals) {
3100 "use strict";
3101 text2 = globals.converter._dispatch("codeBlocks.before", text2, options, globals);
3102 text2 += "\xA80";
3103 var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
3104 text2 = text2.replace(pattern, function(wholeMatch, m1, m2) {
3105 var codeblock = m1, nextChar = m2, end = "\n";
3106 codeblock = showdown2.subParser("outdent")(codeblock, options, globals);
3107 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals);
3108 codeblock = showdown2.subParser("detab")(codeblock, options, globals);
3109 codeblock = codeblock.replace(/^\n+/g, "");
3110 codeblock = codeblock.replace(/\n+$/g, "");
3111 if (options.omitExtraWLInCodeBlocks) {
3112 end = "";
3113 }
3114 codeblock = "<pre><code>" + codeblock + end + "</code></pre>";
3115 return showdown2.subParser("hashBlock")(codeblock, options, globals) + nextChar;
3116 });
3117 text2 = text2.replace(/¨0/, "");
3118 text2 = globals.converter._dispatch("codeBlocks.after", text2, options, globals);
3119 return text2;
3120 });
3121 showdown2.subParser("codeSpans", function(text2, options, globals) {
3122 "use strict";
3123 text2 = globals.converter._dispatch("codeSpans.before", text2, options, globals);
3124 if (typeof text2 === "undefined") {
3125 text2 = "";
3126 }
3127 text2 = text2.replace(
3128 /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
3129 function(wholeMatch, m1, m2, m3) {
3130 var c2 = m3;
3131 c2 = c2.replace(/^([ \t]*)/g, "");
3132 c2 = c2.replace(/[ \t]*$/g, "");
3133 c2 = showdown2.subParser("encodeCode")(c2, options, globals);
3134 c2 = m1 + "<code>" + c2 + "</code>";
3135 c2 = showdown2.subParser("hashHTMLSpans")(c2, options, globals);
3136 return c2;
3137 }
3138 );
3139 text2 = globals.converter._dispatch("codeSpans.after", text2, options, globals);
3140 return text2;
3141 });
3142 showdown2.subParser("completeHTMLDocument", function(text2, options, globals) {
3143 "use strict";
3144 if (!options.completeHTMLDocument) {
3145 return text2;
3146 }
3147 text2 = globals.converter._dispatch("completeHTMLDocument.before", text2, options, globals);
3148 var doctype = "html", doctypeParsed = "<!DOCTYPE HTML>\n", title = "", charset = '<meta charset="utf-8">\n', lang = "", metadata = "";
3149 if (typeof globals.metadata.parsed.doctype !== "undefined") {
3150 doctypeParsed = "<!DOCTYPE " + globals.metadata.parsed.doctype + ">\n";
3151 doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
3152 if (doctype === "html" || doctype === "html5") {
3153 charset = '<meta charset="utf-8">';
3154 }
3155 }
3156 for (var meta in globals.metadata.parsed) {
3157 if (globals.metadata.parsed.hasOwnProperty(meta)) {
3158 switch (meta.toLowerCase()) {
3159 case "doctype":
3160 break;
3161 case "title":
3162 title = "<title>" + globals.metadata.parsed.title + "</title>\n";
3163 break;
3164 case "charset":
3165 if (doctype === "html" || doctype === "html5") {
3166 charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
3167 } else {
3168 charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
3169 }
3170 break;
3171 case "language":
3172 case "lang":
3173 lang = ' lang="' + globals.metadata.parsed[meta] + '"';
3174 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3175 break;
3176 default:
3177 metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
3178 }
3179 }
3180 }
3181 text2 = doctypeParsed + "<html" + lang + ">\n<head>\n" + title + charset + metadata + "</head>\n<body>\n" + text2.trim() + "\n</body>\n</html>";
3182 text2 = globals.converter._dispatch("completeHTMLDocument.after", text2, options, globals);
3183 return text2;
3184 });
3185 showdown2.subParser("detab", function(text2, options, globals) {
3186 "use strict";
3187 text2 = globals.converter._dispatch("detab.before", text2, options, globals);
3188 text2 = text2.replace(/\t(?=\t)/g, " ");
3189 text2 = text2.replace(/\t/g, "\xA8A\xA8B");
3190 text2 = text2.replace(/¨B(.+?)¨A/g, function(wholeMatch, m1) {
3191 var leadingText = m1, numSpaces = 4 - leadingText.length % 4;
3192 for (var i2 = 0; i2 < numSpaces; i2++) {
3193 leadingText += " ";
3194 }
3195 return leadingText;
3196 });
3197 text2 = text2.replace(/¨A/g, " ");
3198 text2 = text2.replace(/¨B/g, "");
3199 text2 = globals.converter._dispatch("detab.after", text2, options, globals);
3200 return text2;
3201 });
3202 showdown2.subParser("ellipsis", function(text2, options, globals) {
3203 "use strict";
3204 text2 = globals.converter._dispatch("ellipsis.before", text2, options, globals);
3205 text2 = text2.replace(/\.\.\./g, "\u2026");
3206 text2 = globals.converter._dispatch("ellipsis.after", text2, options, globals);
3207 return text2;
3208 });
3209 showdown2.subParser("emoji", function(text2, options, globals) {
3210 "use strict";
3211 if (!options.emoji) {
3212 return text2;
3213 }
3214 text2 = globals.converter._dispatch("emoji.before", text2, options, globals);
3215 var emojiRgx = /:([\S]+?):/g;
3216 text2 = text2.replace(emojiRgx, function(wm, emojiCode) {
3217 if (showdown2.helper.emojis.hasOwnProperty(emojiCode)) {
3218 return showdown2.helper.emojis[emojiCode];
3219 }
3220 return wm;
3221 });
3222 text2 = globals.converter._dispatch("emoji.after", text2, options, globals);
3223 return text2;
3224 });
3225 showdown2.subParser("encodeAmpsAndAngles", function(text2, options, globals) {
3226 "use strict";
3227 text2 = globals.converter._dispatch("encodeAmpsAndAngles.before", text2, options, globals);
3228 text2 = text2.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&amp;");
3229 text2 = text2.replace(/<(?![a-z\/?$!])/gi, "&lt;");
3230 text2 = text2.replace(/</g, "&lt;");
3231 text2 = text2.replace(/>/g, "&gt;");
3232 text2 = globals.converter._dispatch("encodeAmpsAndAngles.after", text2, options, globals);
3233 return text2;
3234 });
3235 showdown2.subParser("encodeBackslashEscapes", function(text2, options, globals) {
3236 "use strict";
3237 text2 = globals.converter._dispatch("encodeBackslashEscapes.before", text2, options, globals);
3238 text2 = text2.replace(/\\(\\)/g, showdown2.helper.escapeCharactersCallback);
3239 text2 = text2.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown2.helper.escapeCharactersCallback);
3240 text2 = globals.converter._dispatch("encodeBackslashEscapes.after", text2, options, globals);
3241 return text2;
3242 });
3243 showdown2.subParser("encodeCode", function(text2, options, globals) {
3244 "use strict";
3245 text2 = globals.converter._dispatch("encodeCode.before", text2, options, globals);
3246 text2 = text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/([*_{}\[\]\\=~-])/g, showdown2.helper.escapeCharactersCallback);
3247 text2 = globals.converter._dispatch("encodeCode.after", text2, options, globals);
3248 return text2;
3249 });
3250 showdown2.subParser("escapeSpecialCharsWithinTagAttributes", function(text2, options, globals) {
3251 "use strict";
3252 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before", text2, options, globals);
3253 var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi, comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
3254 text2 = text2.replace(tags, function(wholeMatch) {
3255 return wholeMatch.replace(/(.)<\/?code>(?=.)/g, "$1`").replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback);
3256 });
3257 text2 = text2.replace(comments, function(wholeMatch) {
3258 return wholeMatch.replace(/([\\`*_~=|])/g, showdown2.helper.escapeCharactersCallback);
3259 });
3260 text2 = globals.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after", text2, options, globals);
3261 return text2;
3262 });
3263 showdown2.subParser("githubCodeBlocks", function(text2, options, globals) {
3264 "use strict";
3265 if (!options.ghCodeBlocks) {
3266 return text2;
3267 }
3268 text2 = globals.converter._dispatch("githubCodeBlocks.before", text2, options, globals);
3269 text2 += "\xA80";
3270 text2 = text2.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function(wholeMatch, delim, language, codeblock) {
3271 var end = options.omitExtraWLInCodeBlocks ? "" : "\n";
3272 codeblock = showdown2.subParser("encodeCode")(codeblock, options, globals);
3273 codeblock = showdown2.subParser("detab")(codeblock, options, globals);
3274 codeblock = codeblock.replace(/^\n+/g, "");
3275 codeblock = codeblock.replace(/\n+$/g, "");
3276 codeblock = "<pre><code" + (language ? ' class="' + language + " language-" + language + '"' : "") + ">" + codeblock + end + "</code></pre>";
3277 codeblock = showdown2.subParser("hashBlock")(codeblock, options, globals);
3278 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n";
3279 });
3280 text2 = text2.replace(/¨0/, "");
3281 return globals.converter._dispatch("githubCodeBlocks.after", text2, options, globals);
3282 });
3283 showdown2.subParser("hashBlock", function(text2, options, globals) {
3284 "use strict";
3285 text2 = globals.converter._dispatch("hashBlock.before", text2, options, globals);
3286 text2 = text2.replace(/(^\n+|\n+$)/g, "");
3287 text2 = "\n\n\xA8K" + (globals.gHtmlBlocks.push(text2) - 1) + "K\n\n";
3288 text2 = globals.converter._dispatch("hashBlock.after", text2, options, globals);
3289 return text2;
3290 });
3291 showdown2.subParser("hashCodeTags", function(text2, options, globals) {
3292 "use strict";
3293 text2 = globals.converter._dispatch("hashCodeTags.before", text2, options, globals);
3294 var repFunc = function(wholeMatch, match, left, right) {
3295 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right;
3296 return "\xA8C" + (globals.gHtmlSpans.push(codeblock) - 1) + "C";
3297 };
3298 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "<code\\b[^>]*>", "</code>", "gim");
3299 text2 = globals.converter._dispatch("hashCodeTags.after", text2, options, globals);
3300 return text2;
3301 });
3302 showdown2.subParser("hashElement", function(text2, options, globals) {
3303 "use strict";
3304 return function(wholeMatch, m1) {
3305 var blockText = m1;
3306 blockText = blockText.replace(/\n\n/g, "\n");
3307 blockText = blockText.replace(/^\n/, "");
3308 blockText = blockText.replace(/\n+$/g, "");
3309 blockText = "\n\n\xA8K" + (globals.gHtmlBlocks.push(blockText) - 1) + "K\n\n";
3310 return blockText;
3311 };
3312 });
3313 showdown2.subParser("hashHTMLBlocks", function(text2, options, globals) {
3314 "use strict";
3315 text2 = globals.converter._dispatch("hashHTMLBlocks.before", text2, options, globals);
3316 var blockTags = [
3317 "pre",
3318 "div",
3319 "h1",
3320 "h2",
3321 "h3",
3322 "h4",
3323 "h5",
3324 "h6",
3325 "blockquote",
3326 "table",
3327 "dl",
3328 "ol",
3329 "ul",
3330 "script",
3331 "noscript",
3332 "form",
3333 "fieldset",
3334 "iframe",
3335 "math",
3336 "style",
3337 "section",
3338 "header",
3339 "footer",
3340 "nav",
3341 "article",
3342 "aside",
3343 "address",
3344 "audio",
3345 "canvas",
3346 "figure",
3347 "hgroup",
3348 "output",
3349 "video",
3350 "p"
3351 ], repFunc = function(wholeMatch, match, left, right) {
3352 var txt = wholeMatch;
3353 if (left.search(/\bmarkdown\b/) !== -1) {
3354 txt = left + globals.converter.makeHtml(match) + right;
3355 }
3356 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n";
3357 };
3358 if (options.backslashEscapesHTMLTags) {
3359 text2 = text2.replace(/\\<(\/?[^>]+?)>/g, function(wm, inside) {
3360 return "&lt;" + inside + "&gt;";
3361 });
3362 }
3363 for (var i2 = 0; i2 < blockTags.length; ++i2) {
3364 var opTagPos, rgx1 = new RegExp("^ {0,3}(<" + blockTags[i2] + "\\b[^>]*>)", "im"), patLeft = "<" + blockTags[i2] + "\\b[^>]*>", patRight = "</" + blockTags[i2] + ">";
3365 while ((opTagPos = showdown2.helper.regexIndexOf(text2, rgx1)) !== -1) {
3366 var subTexts = showdown2.helper.splitAtIndex(text2, opTagPos), newSubText1 = showdown2.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, "im");
3367 if (newSubText1 === subTexts[1]) {
3368 break;
3369 }
3370 text2 = subTexts[0].concat(newSubText1);
3371 }
3372 }
3373 text2 = text2.replace(
3374 /(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
3375 showdown2.subParser("hashElement")(text2, options, globals)
3376 );
3377 text2 = showdown2.helper.replaceRecursiveRegExp(text2, function(txt) {
3378 return "\n\n\xA8K" + (globals.gHtmlBlocks.push(txt) - 1) + "K\n\n";
3379 }, "^ {0,3}<!--", "-->", "gm");
3380 text2 = text2.replace(
3381 /(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
3382 showdown2.subParser("hashElement")(text2, options, globals)
3383 );
3384 text2 = globals.converter._dispatch("hashHTMLBlocks.after", text2, options, globals);
3385 return text2;
3386 });
3387 showdown2.subParser("hashHTMLSpans", function(text2, options, globals) {
3388 "use strict";
3389 text2 = globals.converter._dispatch("hashHTMLSpans.before", text2, options, globals);
3390 function hashHTMLSpan(html2) {
3391 return "\xA8C" + (globals.gHtmlSpans.push(html2) - 1) + "C";
3392 }
3393 text2 = text2.replace(/<[^>]+?\/>/gi, function(wm) {
3394 return hashHTMLSpan(wm);
3395 });
3396 text2 = text2.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function(wm) {
3397 return hashHTMLSpan(wm);
3398 });
3399 text2 = text2.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function(wm) {
3400 return hashHTMLSpan(wm);
3401 });
3402 text2 = text2.replace(/<[^>]+?>/gi, function(wm) {
3403 return hashHTMLSpan(wm);
3404 });
3405 text2 = globals.converter._dispatch("hashHTMLSpans.after", text2, options, globals);
3406 return text2;
3407 });
3408 showdown2.subParser("unhashHTMLSpans", function(text2, options, globals) {
3409 "use strict";
3410 text2 = globals.converter._dispatch("unhashHTMLSpans.before", text2, options, globals);
3411 for (var i2 = 0; i2 < globals.gHtmlSpans.length; ++i2) {
3412 var repText = globals.gHtmlSpans[i2], limit = 0;
3413 while (/¨C(\d+)C/.test(repText)) {
3414 var num = RegExp.$1;
3415 repText = repText.replace("\xA8C" + num + "C", globals.gHtmlSpans[num]);
3416 if (limit === 10) {
3417 console.error("maximum nesting of 10 spans reached!!!");
3418 break;
3419 }
3420 ++limit;
3421 }
3422 text2 = text2.replace("\xA8C" + i2 + "C", repText);
3423 }
3424 text2 = globals.converter._dispatch("unhashHTMLSpans.after", text2, options, globals);
3425 return text2;
3426 });
3427 showdown2.subParser("hashPreCodeTags", function(text2, options, globals) {
3428 "use strict";
3429 text2 = globals.converter._dispatch("hashPreCodeTags.before", text2, options, globals);
3430 var repFunc = function(wholeMatch, match, left, right) {
3431 var codeblock = left + showdown2.subParser("encodeCode")(match, options, globals) + right;
3432 return "\n\n\xA8G" + (globals.ghCodeBlocks.push({ text: wholeMatch, codeblock }) - 1) + "G\n\n";
3433 };
3434 text2 = showdown2.helper.replaceRecursiveRegExp(text2, repFunc, "^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>", "^ {0,3}</code>\\s*</pre>", "gim");
3435 text2 = globals.converter._dispatch("hashPreCodeTags.after", text2, options, globals);
3436 return text2;
3437 });
3438 showdown2.subParser("headers", function(text2, options, globals) {
3439 "use strict";
3440 text2 = globals.converter._dispatch("headers.before", text2, options, globals);
3441 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;
3442 text2 = text2.replace(setextRegexH1, function(wholeMatch, m1) {
3443 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">";
3444 return showdown2.subParser("hashBlock")(hashBlock, options, globals);
3445 });
3446 text2 = text2.replace(setextRegexH2, function(matchFound, m1) {
3447 var spanGamut = showdown2.subParser("spanGamut")(m1, options, globals), hID = options.noHeaderId ? "" : ' id="' + headerId(m1) + '"', hLevel = headerLevelStart + 1, hashBlock = "<h" + hLevel + hID + ">" + spanGamut + "</h" + hLevel + ">";
3448 return showdown2.subParser("hashBlock")(hashBlock, options, globals);
3449 });
3450 var atxStyle = options.requireSpaceBeforeHeadingText ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
3451 text2 = text2.replace(atxStyle, function(wholeMatch, m1, m2) {
3452 var hText = m2;
3453 if (options.customizedHeaderId) {
3454 hText = m2.replace(/\s?\{([^{]+?)}\s*$/, "");
3455 }
3456 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 + ">";
3457 return showdown2.subParser("hashBlock")(header, options, globals);
3458 });
3459 function headerId(m2) {
3460 var title, prefix;
3461 if (options.customizedHeaderId) {
3462 var match = m2.match(/\{([^{]+?)}\s*$/);
3463 if (match && match[1]) {
3464 m2 = match[1];
3465 }
3466 }
3467 title = m2;
3468 if (showdown2.helper.isString(options.prefixHeaderId)) {
3469 prefix = options.prefixHeaderId;
3470 } else if (options.prefixHeaderId === true) {
3471 prefix = "section-";
3472 } else {
3473 prefix = "";
3474 }
3475 if (!options.rawPrefixHeaderId) {
3476 title = prefix + title;
3477 }
3478 if (options.ghCompatibleHeaderId) {
3479 title = title.replace(/ /g, "-").replace(/&amp;/g, "").replace(/¨T/g, "").replace(/¨D/g, "").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, "").toLowerCase();
3480 } else if (options.rawHeaderId) {
3481 title = title.replace(/ /g, "-").replace(/&amp;/g, "&").replace(/¨T/g, "\xA8").replace(/¨D/g, "$").replace(/["']/g, "-").toLowerCase();
3482 } else {
3483 title = title.replace(/[^\w]/g, "").toLowerCase();
3484 }
3485 if (options.rawPrefixHeaderId) {
3486 title = prefix + title;
3487 }
3488 if (globals.hashLinkCounts[title]) {
3489 title = title + "-" + globals.hashLinkCounts[title]++;
3490 } else {
3491 globals.hashLinkCounts[title] = 1;
3492 }
3493 return title;
3494 }
3495 text2 = globals.converter._dispatch("headers.after", text2, options, globals);
3496 return text2;
3497 });
3498 showdown2.subParser("horizontalRule", function(text2, options, globals) {
3499 "use strict";
3500 text2 = globals.converter._dispatch("horizontalRule.before", text2, options, globals);
3501 var key = showdown2.subParser("hashBlock")("<hr />", options, globals);
3502 text2 = text2.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
3503 text2 = text2.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
3504 text2 = text2.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
3505 text2 = globals.converter._dispatch("horizontalRule.after", text2, options, globals);
3506 return text2;
3507 });
3508 showdown2.subParser("images", function(text2, options, globals) {
3509 "use strict";
3510 text2 = globals.converter._dispatch("images.before", text2, options, globals);
3511 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;
3512 function writeImageTagBase64(wholeMatch, altText, linkId, url, width, height, m5, title) {
3513 url = url.replace(/\s/g, "");
3514 return writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title);
3515 }
3516 function writeImageTag(wholeMatch, altText, linkId, url, width, height, m5, title) {
3517 var gUrls = globals.gUrls, gTitles = globals.gTitles, gDims = globals.gDimensions;
3518 linkId = linkId.toLowerCase();
3519 if (!title) {
3520 title = "";
3521 }
3522 if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
3523 url = "";
3524 } else if (url === "" || url === null) {
3525 if (linkId === "" || linkId === null) {
3526 linkId = altText.toLowerCase().replace(/ ?\n/g, " ");
3527 }
3528 url = "#" + linkId;
3529 if (!showdown2.helper.isUndefined(gUrls[linkId])) {
3530 url = gUrls[linkId];
3531 if (!showdown2.helper.isUndefined(gTitles[linkId])) {
3532 title = gTitles[linkId];
3533 }
3534 if (!showdown2.helper.isUndefined(gDims[linkId])) {
3535 width = gDims[linkId].width;
3536 height = gDims[linkId].height;
3537 }
3538 } else {
3539 return wholeMatch;
3540 }
3541 }
3542 altText = altText.replace(/"/g, "&quot;").replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3543 url = url.replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3544 var result = '<img src="' + url + '" alt="' + altText + '"';
3545 if (title && showdown2.helper.isString(title)) {
3546 title = title.replace(/"/g, "&quot;").replace(showdown2.helper.regexes.asteriskDashAndColon, showdown2.helper.escapeCharactersCallback);
3547 result += ' title="' + title + '"';
3548 }
3549 if (width && height) {
3550 width = width === "*" ? "auto" : width;
3551 height = height === "*" ? "auto" : height;
3552 result += ' width="' + width + '"';
3553 result += ' height="' + height + '"';
3554 }
3555 result += " />";
3556 return result;
3557 }
3558 text2 = text2.replace(referenceRegExp, writeImageTag);
3559 text2 = text2.replace(base64RegExp, writeImageTagBase64);
3560 text2 = text2.replace(crazyRegExp, writeImageTag);
3561 text2 = text2.replace(inlineRegExp, writeImageTag);
3562 text2 = text2.replace(refShortcutRegExp, writeImageTag);
3563 text2 = globals.converter._dispatch("images.after", text2, options, globals);
3564 return text2;
3565 });
3566 showdown2.subParser("italicsAndBold", function(text2, options, globals) {
3567 "use strict";
3568 text2 = globals.converter._dispatch("italicsAndBold.before", text2, options, globals);
3569 function parseInside(txt, left, right) {
3570 return left + txt + right;
3571 }
3572 if (options.literalMidWordUnderscores) {
3573 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) {
3574 return parseInside(txt, "<strong><em>", "</em></strong>");
3575 });
3576 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) {
3577 return parseInside(txt, "<strong>", "</strong>");
3578 });
3579 text2 = text2.replace(/\b_(\S[\s\S]*?)_\b/g, function(wm, txt) {
3580 return parseInside(txt, "<em>", "</em>");
3581 });
3582 } else {
3583 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) {
3584 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm;
3585 });
3586 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) {
3587 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm;
3588 });
3589 text2 = text2.replace(/_([^\s_][\s\S]*?)_/g, function(wm, m2) {
3590 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm;
3591 });
3592 }
3593 if (options.literalMidWordAsterisks) {
3594 text2 = text2.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function(wm, lead, txt) {
3595 return parseInside(txt, lead + "<strong><em>", "</em></strong>");
3596 });
3597 text2 = text2.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function(wm, lead, txt) {
3598 return parseInside(txt, lead + "<strong>", "</strong>");
3599 });
3600 text2 = text2.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function(wm, lead, txt) {
3601 return parseInside(txt, lead + "<em>", "</em>");
3602 });
3603 } else {
3604 text2 = text2.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function(wm, m2) {
3605 return /\S$/.test(m2) ? parseInside(m2, "<strong><em>", "</em></strong>") : wm;
3606 });
3607 text2 = text2.replace(/\*\*(\S[\s\S]*?)\*\*/g, function(wm, m2) {
3608 return /\S$/.test(m2) ? parseInside(m2, "<strong>", "</strong>") : wm;
3609 });
3610 text2 = text2.replace(/\*([^\s*][\s\S]*?)\*/g, function(wm, m2) {
3611 return /\S$/.test(m2) ? parseInside(m2, "<em>", "</em>") : wm;
3612 });
3613 }
3614 text2 = globals.converter._dispatch("italicsAndBold.after", text2, options, globals);
3615 return text2;
3616 });
3617 showdown2.subParser("lists", function(text2, options, globals) {
3618 "use strict";
3619 function processListItems(listStr, trimTrailing) {
3620 globals.gListLevel++;
3621 listStr = listStr.replace(/\n{2,}$/, "\n");
3622 listStr += "\xA80";
3623 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);
3624 if (options.disableForced4SpacesIndentedSublists) {
3625 rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
3626 }
3627 listStr = listStr.replace(rgx, function(wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
3628 checked = checked && checked.trim() !== "";
3629 var item = showdown2.subParser("outdent")(m4, options, globals), bulletStyle = "";
3630 if (taskbtn && options.tasklists) {
3631 bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
3632 item = item.replace(/^[ \t]*\[(x|X| )?]/m, function() {
3633 var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
3634 if (checked) {
3635 otp += " checked";
3636 }
3637 otp += ">";
3638 return otp;
3639 });
3640 }
3641 item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function(wm2) {
3642 return "\xA8A" + wm2;
3643 });
3644 if (m1 || item.search(/\n{2,}/) > -1) {
3645 item = showdown2.subParser("githubCodeBlocks")(item, options, globals);
3646 item = showdown2.subParser("blockGamut")(item, options, globals);
3647 } else {
3648 item = showdown2.subParser("lists")(item, options, globals);
3649 item = item.replace(/\n$/, "");
3650 item = showdown2.subParser("hashHTMLBlocks")(item, options, globals);
3651 item = item.replace(/\n\n+/g, "\n\n");
3652 if (isParagraphed) {
3653 item = showdown2.subParser("paragraphs")(item, options, globals);
3654 } else {
3655 item = showdown2.subParser("spanGamut")(item, options, globals);
3656 }
3657 }
3658 item = item.replace("\xA8A", "");
3659 item = "<li" + bulletStyle + ">" + item + "</li>\n";
3660 return item;
3661 });
3662 listStr = listStr.replace(/¨0/g, "");
3663 globals.gListLevel--;
3664 if (trimTrailing) {
3665 listStr = listStr.replace(/\s+$/, "");
3666 }
3667 return listStr;
3668 }
3669 function styleStartNumber(list, listType) {
3670 if (listType === "ol") {
3671 var res = list.match(/^ *(\d+)\./);
3672 if (res && res[1] !== "1") {
3673 return ' start="' + res[1] + '"';
3674 }
3675 }
3676 return "";
3677 }
3678 function parseConsecutiveLists(list, listType, trimTrailing) {
3679 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 = "";
3680 if (list.search(counterRxg) !== -1) {
3681 (function parseCL(txt) {
3682 var pos = txt.search(counterRxg), style2 = styleStartNumber(list, listType);
3683 if (pos !== -1) {
3684 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt.slice(0, pos), !!trimTrailing) + "</" + listType + ">\n";
3685 listType = listType === "ul" ? "ol" : "ul";
3686 counterRxg = listType === "ul" ? olRgx : ulRgx;
3687 parseCL(txt.slice(pos));
3688 } else {
3689 result += "\n\n<" + listType + style2 + ">\n" + processListItems(txt, !!trimTrailing) + "</" + listType + ">\n";
3690 }
3691 })(list);
3692 } else {
3693 var style = styleStartNumber(list, listType);
3694 result = "\n\n<" + listType + style + ">\n" + processListItems(list, !!trimTrailing) + "</" + listType + ">\n";
3695 }
3696 return result;
3697 }
3698 text2 = globals.converter._dispatch("lists.before", text2, options, globals);
3699 text2 += "\xA80";
3700 if (globals.gListLevel) {
3701 text2 = text2.replace(
3702 /^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
3703 function(wholeMatch, list, m2) {
3704 var listType = m2.search(/[*+-]/g) > -1 ? "ul" : "ol";
3705 return parseConsecutiveLists(list, listType, true);
3706 }
3707 );
3708 } else {
3709 text2 = text2.replace(
3710 /(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
3711 function(wholeMatch, m1, list, m3) {
3712 var listType = m3.search(/[*+-]/g) > -1 ? "ul" : "ol";
3713 return parseConsecutiveLists(list, listType, false);
3714 }
3715 );
3716 }
3717 text2 = text2.replace(/¨0/, "");
3718 text2 = globals.converter._dispatch("lists.after", text2, options, globals);
3719 return text2;
3720 });
3721 showdown2.subParser("metadata", function(text2, options, globals) {
3722 "use strict";
3723 if (!options.metadata) {
3724 return text2;
3725 }
3726 text2 = globals.converter._dispatch("metadata.before", text2, options, globals);
3727 function parseMetadataContents(content) {
3728 globals.metadata.raw = content;
3729 content = content.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
3730 content = content.replace(/\n {4}/g, " ");
3731 content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function(wm, key, value) {
3732 globals.metadata.parsed[key] = value;
3733 return "";
3734 });
3735 }
3736 text2 = text2.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function(wholematch, format, content) {
3737 parseMetadataContents(content);
3738 return "\xA8M";
3739 });
3740 text2 = text2.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function(wholematch, format, content) {
3741 if (format) {
3742 globals.metadata.format = format;
3743 }
3744 parseMetadataContents(content);
3745 return "\xA8M";
3746 });
3747 text2 = text2.replace(/¨M/g, "");
3748 text2 = globals.converter._dispatch("metadata.after", text2, options, globals);
3749 return text2;
3750 });
3751 showdown2.subParser("outdent", function(text2, options, globals) {
3752 "use strict";
3753 text2 = globals.converter._dispatch("outdent.before", text2, options, globals);
3754 text2 = text2.replace(/^(\t|[ ]{1,4})/gm, "\xA80");
3755 text2 = text2.replace(/¨0/g, "");
3756 text2 = globals.converter._dispatch("outdent.after", text2, options, globals);
3757 return text2;
3758 });
3759 showdown2.subParser("paragraphs", function(text2, options, globals) {
3760 "use strict";
3761 text2 = globals.converter._dispatch("paragraphs.before", text2, options, globals);
3762 text2 = text2.replace(/^\n+/g, "");
3763 text2 = text2.replace(/\n+$/g, "");
3764 var grafs = text2.split(/\n{2,}/g), grafsOut = [], end = grafs.length;
3765 for (var i2 = 0; i2 < end; i2++) {
3766 var str = grafs[i2];
3767 if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
3768 grafsOut.push(str);
3769 } else if (str.search(/\S/) >= 0) {
3770 str = showdown2.subParser("spanGamut")(str, options, globals);
3771 str = str.replace(/^([ \t]*)/g, "<p>");
3772 str += "</p>";
3773 grafsOut.push(str);
3774 }
3775 }
3776 end = grafsOut.length;
3777 for (i2 = 0; i2 < end; i2++) {
3778 var blockText = "", grafsOutIt = grafsOut[i2], codeFlag = false;
3779 while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
3780 var delim = RegExp.$1, num = RegExp.$2;
3781 if (delim === "K") {
3782 blockText = globals.gHtmlBlocks[num];
3783 } else {
3784 if (codeFlag) {
3785 blockText = showdown2.subParser("encodeCode")(globals.ghCodeBlocks[num].text, options, globals);
3786 } else {
3787 blockText = globals.ghCodeBlocks[num].codeblock;
3788 }
3789 }
3790 blockText = blockText.replace(/\$/g, "$$$$");
3791 grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
3792 if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
3793 codeFlag = true;
3794 }
3795 }
3796 grafsOut[i2] = grafsOutIt;
3797 }
3798 text2 = grafsOut.join("\n");
3799 text2 = text2.replace(/^\n+/g, "");
3800 text2 = text2.replace(/\n+$/g, "");
3801 return globals.converter._dispatch("paragraphs.after", text2, options, globals);
3802 });
3803 showdown2.subParser("runExtension", function(ext, text2, options, globals) {
3804 "use strict";
3805 if (ext.filter) {
3806 text2 = ext.filter(text2, globals.converter, options);
3807 } else if (ext.regex) {
3808 var re = ext.regex;
3809 if (!(re instanceof RegExp)) {
3810 re = new RegExp(re, "g");
3811 }
3812 text2 = text2.replace(re, ext.replace);
3813 }
3814 return text2;
3815 });
3816 showdown2.subParser("spanGamut", function(text2, options, globals) {
3817 "use strict";
3818 text2 = globals.converter._dispatch("spanGamut.before", text2, options, globals);
3819 text2 = showdown2.subParser("codeSpans")(text2, options, globals);
3820 text2 = showdown2.subParser("escapeSpecialCharsWithinTagAttributes")(text2, options, globals);
3821 text2 = showdown2.subParser("encodeBackslashEscapes")(text2, options, globals);
3822 text2 = showdown2.subParser("images")(text2, options, globals);
3823 text2 = showdown2.subParser("anchors")(text2, options, globals);
3824 text2 = showdown2.subParser("autoLinks")(text2, options, globals);
3825 text2 = showdown2.subParser("simplifiedAutoLinks")(text2, options, globals);
3826 text2 = showdown2.subParser("emoji")(text2, options, globals);
3827 text2 = showdown2.subParser("underline")(text2, options, globals);
3828 text2 = showdown2.subParser("italicsAndBold")(text2, options, globals);
3829 text2 = showdown2.subParser("strikethrough")(text2, options, globals);
3830 text2 = showdown2.subParser("ellipsis")(text2, options, globals);
3831 text2 = showdown2.subParser("hashHTMLSpans")(text2, options, globals);
3832 text2 = showdown2.subParser("encodeAmpsAndAngles")(text2, options, globals);
3833 if (options.simpleLineBreaks) {
3834 if (!/\n\n¨K/.test(text2)) {
3835 text2 = text2.replace(/\n+/g, "<br />\n");
3836 }
3837 } else {
3838 text2 = text2.replace(/ +\n/g, "<br />\n");
3839 }
3840 text2 = globals.converter._dispatch("spanGamut.after", text2, options, globals);
3841 return text2;
3842 });
3843 showdown2.subParser("strikethrough", function(text2, options, globals) {
3844 "use strict";
3845 function parseInside(txt) {
3846 if (options.simplifiedAutoLink) {
3847 txt = showdown2.subParser("simplifiedAutoLinks")(txt, options, globals);
3848 }
3849 return "<del>" + txt + "</del>";
3850 }
3851 if (options.strikethrough) {
3852 text2 = globals.converter._dispatch("strikethrough.before", text2, options, globals);
3853 text2 = text2.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function(wm, txt) {
3854 return parseInside(txt);
3855 });
3856 text2 = globals.converter._dispatch("strikethrough.after", text2, options, globals);
3857 }
3858 return text2;
3859 });
3860 showdown2.subParser("stripLinkDefinitions", function(text2, options, globals) {
3861 "use strict";
3862 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;
3863 text2 += "\xA80";
3864 var replaceFunc = function(wholeMatch, linkId, url, width, height, blankLines, title) {
3865 linkId = linkId.toLowerCase();
3866 if (url.match(/^data:.+?\/.+?;base64,/)) {
3867 globals.gUrls[linkId] = url.replace(/\s/g, "");
3868 } else {
3869 globals.gUrls[linkId] = showdown2.subParser("encodeAmpsAndAngles")(url, options, globals);
3870 }
3871 if (blankLines) {
3872 return blankLines + title;
3873 } else {
3874 if (title) {
3875 globals.gTitles[linkId] = title.replace(/"|'/g, "&quot;");
3876 }
3877 if (options.parseImgDimensions && width && height) {
3878 globals.gDimensions[linkId] = {
3879 width,
3880 height
3881 };
3882 }
3883 }
3884 return "";
3885 };
3886 text2 = text2.replace(base64Regex, replaceFunc);
3887 text2 = text2.replace(regex, replaceFunc);
3888 text2 = text2.replace(/¨0/, "");
3889 return text2;
3890 });
3891 showdown2.subParser("tables", function(text2, options, globals) {
3892 "use strict";
3893 if (!options.tables) {
3894 return text2;
3895 }
3896 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;
3897 function parseStyles(sLine) {
3898 if (/^:[ \t]*--*$/.test(sLine)) {
3899 return ' style="text-align:left;"';
3900 } else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
3901 return ' style="text-align:right;"';
3902 } else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
3903 return ' style="text-align:center;"';
3904 } else {
3905 return "";
3906 }
3907 }
3908 function parseHeaders(header, style) {
3909 var id = "";
3910 header = header.trim();
3911 if (options.tablesHeaderId || options.tableHeaderId) {
3912 id = ' id="' + header.replace(/ /g, "_").toLowerCase() + '"';
3913 }
3914 header = showdown2.subParser("spanGamut")(header, options, globals);
3915 return "<th" + id + style + ">" + header + "</th>\n";
3916 }
3917 function parseCells(cell, style) {
3918 var subText = showdown2.subParser("spanGamut")(cell, options, globals);
3919 return "<td" + style + ">" + subText + "</td>\n";
3920 }
3921 function buildTable(headers, cells) {
3922 var tb = "<table>\n<thead>\n<tr>\n", tblLgn = headers.length;
3923 for (var i2 = 0; i2 < tblLgn; ++i2) {
3924 tb += headers[i2];
3925 }
3926 tb += "</tr>\n</thead>\n<tbody>\n";
3927 for (i2 = 0; i2 < cells.length; ++i2) {
3928 tb += "<tr>\n";
3929 for (var ii = 0; ii < tblLgn; ++ii) {
3930 tb += cells[i2][ii];
3931 }
3932 tb += "</tr>\n";
3933 }
3934 tb += "</tbody>\n</table>\n";
3935 return tb;
3936 }
3937 function parseTable(rawTable) {
3938 var i2, tableLines = rawTable.split("\n");
3939 for (i2 = 0; i2 < tableLines.length; ++i2) {
3940 if (/^ {0,3}\|/.test(tableLines[i2])) {
3941 tableLines[i2] = tableLines[i2].replace(/^ {0,3}\|/, "");
3942 }
3943 if (/\|[ \t]*$/.test(tableLines[i2])) {
3944 tableLines[i2] = tableLines[i2].replace(/\|[ \t]*$/, "");
3945 }
3946 tableLines[i2] = showdown2.subParser("codeSpans")(tableLines[i2], options, globals);
3947 }
3948 var rawHeaders = tableLines[0].split("|").map(function(s2) {
3949 return s2.trim();
3950 }), rawStyles = tableLines[1].split("|").map(function(s2) {
3951 return s2.trim();
3952 }), rawCells = [], headers = [], styles = [], cells = [];
3953 tableLines.shift();
3954 tableLines.shift();
3955 for (i2 = 0; i2 < tableLines.length; ++i2) {
3956 if (tableLines[i2].trim() === "") {
3957 continue;
3958 }
3959 rawCells.push(
3960 tableLines[i2].split("|").map(function(s2) {
3961 return s2.trim();
3962 })
3963 );
3964 }
3965 if (rawHeaders.length < rawStyles.length) {
3966 return rawTable;
3967 }
3968 for (i2 = 0; i2 < rawStyles.length; ++i2) {
3969 styles.push(parseStyles(rawStyles[i2]));
3970 }
3971 for (i2 = 0; i2 < rawHeaders.length; ++i2) {
3972 if (showdown2.helper.isUndefined(styles[i2])) {
3973 styles[i2] = "";
3974 }
3975 headers.push(parseHeaders(rawHeaders[i2], styles[i2]));
3976 }
3977 for (i2 = 0; i2 < rawCells.length; ++i2) {
3978 var row = [];
3979 for (var ii = 0; ii < headers.length; ++ii) {
3980 if (showdown2.helper.isUndefined(rawCells[i2][ii])) {
3981 }
3982 row.push(parseCells(rawCells[i2][ii], styles[ii]));
3983 }
3984 cells.push(row);
3985 }
3986 return buildTable(headers, cells);
3987 }
3988 text2 = globals.converter._dispatch("tables.before", text2, options, globals);
3989 text2 = text2.replace(/\\(\|)/g, showdown2.helper.escapeCharactersCallback);
3990 text2 = text2.replace(tableRgx, parseTable);
3991 text2 = text2.replace(singeColTblRgx, parseTable);
3992 text2 = globals.converter._dispatch("tables.after", text2, options, globals);
3993 return text2;
3994 });
3995 showdown2.subParser("underline", function(text2, options, globals) {
3996 "use strict";
3997 if (!options.underline) {
3998 return text2;
3999 }
4000 text2 = globals.converter._dispatch("underline.before", text2, options, globals);
4001 if (options.literalMidWordUnderscores) {
4002 text2 = text2.replace(/\b___(\S[\s\S]*?)___\b/g, function(wm, txt) {
4003 return "<u>" + txt + "</u>";
4004 });
4005 text2 = text2.replace(/\b__(\S[\s\S]*?)__\b/g, function(wm, txt) {
4006 return "<u>" + txt + "</u>";
4007 });
4008 } else {
4009 text2 = text2.replace(/___(\S[\s\S]*?)___/g, function(wm, m2) {
4010 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm;
4011 });
4012 text2 = text2.replace(/__(\S[\s\S]*?)__/g, function(wm, m2) {
4013 return /\S$/.test(m2) ? "<u>" + m2 + "</u>" : wm;
4014 });
4015 }
4016 text2 = text2.replace(/(_)/g, showdown2.helper.escapeCharactersCallback);
4017 text2 = globals.converter._dispatch("underline.after", text2, options, globals);
4018 return text2;
4019 });
4020 showdown2.subParser("unescapeSpecialChars", function(text2, options, globals) {
4021 "use strict";
4022 text2 = globals.converter._dispatch("unescapeSpecialChars.before", text2, options, globals);
4023 text2 = text2.replace(/¨E(\d+)E/g, function(wholeMatch, m1) {
4024 var charCodeToReplace = parseInt(m1);
4025 return String.fromCharCode(charCodeToReplace);
4026 });
4027 text2 = globals.converter._dispatch("unescapeSpecialChars.after", text2, options, globals);
4028 return text2;
4029 });
4030 showdown2.subParser("makeMarkdown.blockquote", function(node, globals) {
4031 "use strict";
4032 var txt = "";
4033 if (node.hasChildNodes()) {
4034 var children = node.childNodes, childrenLength = children.length;
4035 for (var i2 = 0; i2 < childrenLength; ++i2) {
4036 var innerTxt = showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4037 if (innerTxt === "") {
4038 continue;
4039 }
4040 txt += innerTxt;
4041 }
4042 }
4043 txt = txt.trim();
4044 txt = "> " + txt.split("\n").join("\n> ");
4045 return txt;
4046 });
4047 showdown2.subParser("makeMarkdown.codeBlock", function(node, globals) {
4048 "use strict";
4049 var lang = node.getAttribute("language"), num = node.getAttribute("precodenum");
4050 return "```" + lang + "\n" + globals.preList[num] + "\n```";
4051 });
4052 showdown2.subParser("makeMarkdown.codeSpan", function(node) {
4053 "use strict";
4054 return "`" + node.innerHTML + "`";
4055 });
4056 showdown2.subParser("makeMarkdown.emphasis", function(node, globals) {
4057 "use strict";
4058 var txt = "";
4059 if (node.hasChildNodes()) {
4060 txt += "*";
4061 var children = node.childNodes, childrenLength = children.length;
4062 for (var i2 = 0; i2 < childrenLength; ++i2) {
4063 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4064 }
4065 txt += "*";
4066 }
4067 return txt;
4068 });
4069 showdown2.subParser("makeMarkdown.header", function(node, globals, headerLevel) {
4070 "use strict";
4071 var headerMark = new Array(headerLevel + 1).join("#"), txt = "";
4072 if (node.hasChildNodes()) {
4073 txt = headerMark + " ";
4074 var children = node.childNodes, childrenLength = children.length;
4075 for (var i2 = 0; i2 < childrenLength; ++i2) {
4076 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4077 }
4078 }
4079 return txt;
4080 });
4081 showdown2.subParser("makeMarkdown.hr", function() {
4082 "use strict";
4083 return "---";
4084 });
4085 showdown2.subParser("makeMarkdown.image", function(node) {
4086 "use strict";
4087 var txt = "";
4088 if (node.hasAttribute("src")) {
4089 txt += "![" + node.getAttribute("alt") + "](";
4090 txt += "<" + node.getAttribute("src") + ">";
4091 if (node.hasAttribute("width") && node.hasAttribute("height")) {
4092 txt += " =" + node.getAttribute("width") + "x" + node.getAttribute("height");
4093 }
4094 if (node.hasAttribute("title")) {
4095 txt += ' "' + node.getAttribute("title") + '"';
4096 }
4097 txt += ")";
4098 }
4099 return txt;
4100 });
4101 showdown2.subParser("makeMarkdown.links", function(node, globals) {
4102 "use strict";
4103 var txt = "";
4104 if (node.hasChildNodes() && node.hasAttribute("href")) {
4105 var children = node.childNodes, childrenLength = children.length;
4106 txt = "[";
4107 for (var i2 = 0; i2 < childrenLength; ++i2) {
4108 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4109 }
4110 txt += "](";
4111 txt += "<" + node.getAttribute("href") + ">";
4112 if (node.hasAttribute("title")) {
4113 txt += ' "' + node.getAttribute("title") + '"';
4114 }
4115 txt += ")";
4116 }
4117 return txt;
4118 });
4119 showdown2.subParser("makeMarkdown.list", function(node, globals, type) {
4120 "use strict";
4121 var txt = "";
4122 if (!node.hasChildNodes()) {
4123 return "";
4124 }
4125 var listItems = node.childNodes, listItemsLenght = listItems.length, listNum = node.getAttribute("start") || 1;
4126 for (var i2 = 0; i2 < listItemsLenght; ++i2) {
4127 if (typeof listItems[i2].tagName === "undefined" || listItems[i2].tagName.toLowerCase() !== "li") {
4128 continue;
4129 }
4130 var bullet = "";
4131 if (type === "ol") {
4132 bullet = listNum.toString() + ". ";
4133 } else {
4134 bullet = "- ";
4135 }
4136 txt += bullet + showdown2.subParser("makeMarkdown.listItem")(listItems[i2], globals);
4137 ++listNum;
4138 }
4139 txt += "\n<!-- -->\n";
4140 return txt.trim();
4141 });
4142 showdown2.subParser("makeMarkdown.listItem", function(node, globals) {
4143 "use strict";
4144 var listItemTxt = "";
4145 var children = node.childNodes, childrenLenght = children.length;
4146 for (var i2 = 0; i2 < childrenLenght; ++i2) {
4147 listItemTxt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4148 }
4149 if (!/\n$/.test(listItemTxt)) {
4150 listItemTxt += "\n";
4151 } else {
4152 listItemTxt = listItemTxt.split("\n").join("\n ").replace(/^ {4}$/gm, "").replace(/\n\n+/g, "\n\n");
4153 }
4154 return listItemTxt;
4155 });
4156 showdown2.subParser("makeMarkdown.node", function(node, globals, spansOnly) {
4157 "use strict";
4158 spansOnly = spansOnly || false;
4159 var txt = "";
4160 if (node.nodeType === 3) {
4161 return showdown2.subParser("makeMarkdown.txt")(node, globals);
4162 }
4163 if (node.nodeType === 8) {
4164 return "<!--" + node.data + "-->\n\n";
4165 }
4166 if (node.nodeType !== 1) {
4167 return "";
4168 }
4169 var tagName = node.tagName.toLowerCase();
4170 switch (tagName) {
4171 //
4172 // BLOCKS
4173 //
4174 case "h1":
4175 if (!spansOnly) {
4176 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 1) + "\n\n";
4177 }
4178 break;
4179 case "h2":
4180 if (!spansOnly) {
4181 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 2) + "\n\n";
4182 }
4183 break;
4184 case "h3":
4185 if (!spansOnly) {
4186 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 3) + "\n\n";
4187 }
4188 break;
4189 case "h4":
4190 if (!spansOnly) {
4191 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 4) + "\n\n";
4192 }
4193 break;
4194 case "h5":
4195 if (!spansOnly) {
4196 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 5) + "\n\n";
4197 }
4198 break;
4199 case "h6":
4200 if (!spansOnly) {
4201 txt = showdown2.subParser("makeMarkdown.header")(node, globals, 6) + "\n\n";
4202 }
4203 break;
4204 case "p":
4205 if (!spansOnly) {
4206 txt = showdown2.subParser("makeMarkdown.paragraph")(node, globals) + "\n\n";
4207 }
4208 break;
4209 case "blockquote":
4210 if (!spansOnly) {
4211 txt = showdown2.subParser("makeMarkdown.blockquote")(node, globals) + "\n\n";
4212 }
4213 break;
4214 case "hr":
4215 if (!spansOnly) {
4216 txt = showdown2.subParser("makeMarkdown.hr")(node, globals) + "\n\n";
4217 }
4218 break;
4219 case "ol":
4220 if (!spansOnly) {
4221 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ol") + "\n\n";
4222 }
4223 break;
4224 case "ul":
4225 if (!spansOnly) {
4226 txt = showdown2.subParser("makeMarkdown.list")(node, globals, "ul") + "\n\n";
4227 }
4228 break;
4229 case "precode":
4230 if (!spansOnly) {
4231 txt = showdown2.subParser("makeMarkdown.codeBlock")(node, globals) + "\n\n";
4232 }
4233 break;
4234 case "pre":
4235 if (!spansOnly) {
4236 txt = showdown2.subParser("makeMarkdown.pre")(node, globals) + "\n\n";
4237 }
4238 break;
4239 case "table":
4240 if (!spansOnly) {
4241 txt = showdown2.subParser("makeMarkdown.table")(node, globals) + "\n\n";
4242 }
4243 break;
4244 //
4245 // SPANS
4246 //
4247 case "code":
4248 txt = showdown2.subParser("makeMarkdown.codeSpan")(node, globals);
4249 break;
4250 case "em":
4251 case "i":
4252 txt = showdown2.subParser("makeMarkdown.emphasis")(node, globals);
4253 break;
4254 case "strong":
4255 case "b":
4256 txt = showdown2.subParser("makeMarkdown.strong")(node, globals);
4257 break;
4258 case "del":
4259 txt = showdown2.subParser("makeMarkdown.strikethrough")(node, globals);
4260 break;
4261 case "a":
4262 txt = showdown2.subParser("makeMarkdown.links")(node, globals);
4263 break;
4264 case "img":
4265 txt = showdown2.subParser("makeMarkdown.image")(node, globals);
4266 break;
4267 default:
4268 txt = node.outerHTML + "\n\n";
4269 }
4270 return txt;
4271 });
4272 showdown2.subParser("makeMarkdown.paragraph", function(node, globals) {
4273 "use strict";
4274 var txt = "";
4275 if (node.hasChildNodes()) {
4276 var children = node.childNodes, childrenLength = children.length;
4277 for (var i2 = 0; i2 < childrenLength; ++i2) {
4278 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4279 }
4280 }
4281 txt = txt.trim();
4282 return txt;
4283 });
4284 showdown2.subParser("makeMarkdown.pre", function(node, globals) {
4285 "use strict";
4286 var num = node.getAttribute("prenum");
4287 return "<pre>" + globals.preList[num] + "</pre>";
4288 });
4289 showdown2.subParser("makeMarkdown.strikethrough", function(node, globals) {
4290 "use strict";
4291 var txt = "";
4292 if (node.hasChildNodes()) {
4293 txt += "~~";
4294 var children = node.childNodes, childrenLength = children.length;
4295 for (var i2 = 0; i2 < childrenLength; ++i2) {
4296 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4297 }
4298 txt += "~~";
4299 }
4300 return txt;
4301 });
4302 showdown2.subParser("makeMarkdown.strong", function(node, globals) {
4303 "use strict";
4304 var txt = "";
4305 if (node.hasChildNodes()) {
4306 txt += "**";
4307 var children = node.childNodes, childrenLength = children.length;
4308 for (var i2 = 0; i2 < childrenLength; ++i2) {
4309 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals);
4310 }
4311 txt += "**";
4312 }
4313 return txt;
4314 });
4315 showdown2.subParser("makeMarkdown.table", function(node, globals) {
4316 "use strict";
4317 var txt = "", tableArray = [[], []], headings = node.querySelectorAll("thead>tr>th"), rows = node.querySelectorAll("tbody>tr"), i2, ii;
4318 for (i2 = 0; i2 < headings.length; ++i2) {
4319 var headContent = showdown2.subParser("makeMarkdown.tableCell")(headings[i2], globals), allign = "---";
4320 if (headings[i2].hasAttribute("style")) {
4321 var style = headings[i2].getAttribute("style").toLowerCase().replace(/\s/g, "");
4322 switch (style) {
4323 case "text-align:left;":
4324 allign = ":---";
4325 break;
4326 case "text-align:right;":
4327 allign = "---:";
4328 break;
4329 case "text-align:center;":
4330 allign = ":---:";
4331 break;
4332 }
4333 }
4334 tableArray[0][i2] = headContent.trim();
4335 tableArray[1][i2] = allign;
4336 }
4337 for (i2 = 0; i2 < rows.length; ++i2) {
4338 var r2 = tableArray.push([]) - 1, cols = rows[i2].getElementsByTagName("td");
4339 for (ii = 0; ii < headings.length; ++ii) {
4340 var cellContent = " ";
4341 if (typeof cols[ii] !== "undefined") {
4342 cellContent = showdown2.subParser("makeMarkdown.tableCell")(cols[ii], globals);
4343 }
4344 tableArray[r2].push(cellContent);
4345 }
4346 }
4347 var cellSpacesCount = 3;
4348 for (i2 = 0; i2 < tableArray.length; ++i2) {
4349 for (ii = 0; ii < tableArray[i2].length; ++ii) {
4350 var strLen = tableArray[i2][ii].length;
4351 if (strLen > cellSpacesCount) {
4352 cellSpacesCount = strLen;
4353 }
4354 }
4355 }
4356 for (i2 = 0; i2 < tableArray.length; ++i2) {
4357 for (ii = 0; ii < tableArray[i2].length; ++ii) {
4358 if (i2 === 1) {
4359 if (tableArray[i2][ii].slice(-1) === ":") {
4360 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii].slice(-1), cellSpacesCount - 1, "-") + ":";
4361 } else {
4362 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount, "-");
4363 }
4364 } else {
4365 tableArray[i2][ii] = showdown2.helper.padEnd(tableArray[i2][ii], cellSpacesCount);
4366 }
4367 }
4368 txt += "| " + tableArray[i2].join(" | ") + " |\n";
4369 }
4370 return txt.trim();
4371 });
4372 showdown2.subParser("makeMarkdown.tableCell", function(node, globals) {
4373 "use strict";
4374 var txt = "";
4375 if (!node.hasChildNodes()) {
4376 return "";
4377 }
4378 var children = node.childNodes, childrenLength = children.length;
4379 for (var i2 = 0; i2 < childrenLength; ++i2) {
4380 txt += showdown2.subParser("makeMarkdown.node")(children[i2], globals, true);
4381 }
4382 return txt.trim();
4383 });
4384 showdown2.subParser("makeMarkdown.txt", function(node) {
4385 "use strict";
4386 var txt = node.nodeValue;
4387 txt = txt.replace(/ +/g, " ");
4388 txt = txt.replace(/¨NBSP;/g, " ");
4389 txt = showdown2.helper.unescapeHTMLEntities(txt);
4390 txt = txt.replace(/([*_~|`])/g, "\\$1");
4391 txt = txt.replace(/^(\s*)>/g, "\\$1>");
4392 txt = txt.replace(/^#/gm, "\\#");
4393 txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, "$1\\$2$3");
4394 txt = txt.replace(/^( {0,3}\d+)\./gm, "$1\\.");
4395 txt = txt.replace(/^( {0,3})([+-])/gm, "$1\\$2");
4396 txt = txt.replace(/]([\s]*)\(/g, "\\]$1\\(");
4397 txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, "\\[$1]:");
4398 return txt;
4399 });
4400 var root = this;
4401 if (typeof define === "function" && define.amd) {
4402 define(function() {
4403 "use strict";
4404 return showdown2;
4405 });
4406 } else if (typeof module !== "undefined" && module.exports) {
4407 module.exports = showdown2;
4408 } else {
4409 root.showdown = showdown2;
4410 }
4411 }).call(exports);
4412 }
4413 });
4414
4415 // packages/blocks/build-module/index.mjs
4416 var index_exports = {};
4417 __export(index_exports, {
4418 __EXPERIMENTAL_ELEMENTS: () => __EXPERIMENTAL_ELEMENTS,
4419 __EXPERIMENTAL_PATHS_WITH_OVERRIDE: () => __EXPERIMENTAL_PATHS_WITH_OVERRIDE,
4420 __EXPERIMENTAL_STYLE_PROPERTY: () => __EXPERIMENTAL_STYLE_PROPERTY,
4421 __experimentalCloneSanitizedBlock: () => __experimentalCloneSanitizedBlock,
4422 __experimentalGetAccessibleBlockLabel: () => getAccessibleBlockLabel,
4423 __experimentalGetBlockAttributesNamesByRole: () => __experimentalGetBlockAttributesNamesByRole,
4424 __experimentalGetBlockLabel: () => getBlockLabel,
4425 __experimentalSanitizeBlockAttributes: () => __experimentalSanitizeBlockAttributes,
4426 __unstableGetBlockProps: () => getBlockProps,
4427 __unstableGetInnerBlocksProps: () => getInnerBlocksProps,
4428 __unstableSerializeAndClean: () => __unstableSerializeAndClean,
4429 children: () => children_default,
4430 cloneBlock: () => cloneBlock,
4431 createBlock: () => createBlock,
4432 createBlocksFromInnerBlocksTemplate: () => createBlocksFromInnerBlocksTemplate,
4433 doBlocksMatchTemplate: () => doBlocksMatchTemplate,
4434 findTransform: () => findTransform,
4435 getBlockAttributes: () => getBlockAttributes,
4436 getBlockAttributesNamesByRole: () => getBlockAttributesNamesByRole,
4437 getBlockBindingsSource: () => getBlockBindingsSource,
4438 getBlockBindingsSources: () => getBlockBindingsSources,
4439 getBlockContent: () => getBlockInnerHTML,
4440 getBlockDefaultClassName: () => getBlockDefaultClassName,
4441 getBlockFromExample: () => getBlockFromExample,
4442 getBlockMenuDefaultClassName: () => getBlockMenuDefaultClassName,
4443 getBlockSupport: () => getBlockSupport,
4444 getBlockTransforms: () => getBlockTransforms,
4445 getBlockType: () => getBlockType,
4446 getBlockTypes: () => getBlockTypes,
4447 getBlockVariations: () => getBlockVariations,
4448 getCategories: () => getCategories2,
4449 getChildBlockNames: () => getChildBlockNames,
4450 getDefaultBlockName: () => getDefaultBlockName,
4451 getFreeformContentHandlerName: () => getFreeformContentHandlerName,
4452 getGroupingBlockName: () => getGroupingBlockName,
4453 getPhrasingContentSchema: () => deprecatedGetPhrasingContentSchema,
4454 getPossibleBlockTransformations: () => getPossibleBlockTransformations,
4455 getSaveContent: () => getSaveContent,
4456 getSaveElement: () => getSaveElement,
4457 getUnregisteredTypeHandlerName: () => getUnregisteredTypeHandlerName,
4458 hasBlockSupport: () => hasBlockSupport,
4459 hasChildBlocks: () => hasChildBlocks,
4460 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport,
4461 isReusableBlock: () => isReusableBlock,
4462 isTemplatePart: () => isTemplatePart,
4463 isUnmodifiedBlock: () => isUnmodifiedBlock,
4464 isUnmodifiedDefaultBlock: () => isUnmodifiedDefaultBlock,
4465 isValidBlockContent: () => isValidBlockContent,
4466 isValidIcon: () => isValidIcon,
4467 node: () => node_default,
4468 normalizeIconObject: () => normalizeIconObject,
4469 parse: () => parse2,
4470 parseWithAttributeSchema: () => parseWithAttributeSchema,
4471 pasteHandler: () => pasteHandler,
4472 privateApis: () => privateApis,
4473 rawHandler: () => rawHandler,
4474 registerBlockBindingsSource: () => registerBlockBindingsSource,
4475 registerBlockCollection: () => registerBlockCollection,
4476 registerBlockStyle: () => registerBlockStyle,
4477 registerBlockType: () => registerBlockType,
4478 registerBlockVariation: () => registerBlockVariation,
4479 serialize: () => serialize,
4480 serializeRawBlock: () => serializeRawBlock,
4481 setCategories: () => setCategories2,
4482 setDefaultBlockName: () => setDefaultBlockName,
4483 setFreeformContentHandlerName: () => setFreeformContentHandlerName,
4484 setGroupingBlockName: () => setGroupingBlockName,
4485 setUnregisteredTypeHandlerName: () => setUnregisteredTypeHandlerName,
4486 store: () => store,
4487 switchToBlockType: () => switchToBlockType,
4488 synchronizeBlocksWithTemplate: () => synchronizeBlocksWithTemplate,
4489 unregisterBlockBindingsSource: () => unregisterBlockBindingsSource,
4490 unregisterBlockStyle: () => unregisterBlockStyle,
4491 unregisterBlockType: () => unregisterBlockType,
4492 unregisterBlockVariation: () => unregisterBlockVariation,
4493 unstable__bootstrapServerSideBlockDefinitions: () => unstable__bootstrapServerSideBlockDefinitions,
4494 updateCategory: () => updateCategory2,
4495 validateBlock: () => validateBlock,
4496 withBlockContentContext: () => withBlockContentContext
4497 });
4498
4499 // packages/blocks/build-module/store/index.mjs
4500 var import_data5 = __toESM(require_data(), 1);
4501
4502 // node_modules/tslib/tslib.es6.mjs
4503 var __assign = function() {
4504 __assign = Object.assign || function __assign2(t3) {
4505 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
4506 s2 = arguments[i2];
4507 for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t3[p2] = s2[p2];
4508 }
4509 return t3;
4510 };
4511 return __assign.apply(this, arguments);
4512 };
4513
4514 // node_modules/lower-case/dist.es2015/index.js
4515 function lowerCase(str) {
4516 return str.toLowerCase();
4517 }
4518
4519 // node_modules/no-case/dist.es2015/index.js
4520 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
4521 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
4522 function noCase(input, options) {
4523 if (options === void 0) {
4524 options = {};
4525 }
4526 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;
4527 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
4528 var start = 0;
4529 var end = result.length;
4530 while (result.charAt(start) === "\0")
4531 start++;
4532 while (result.charAt(end - 1) === "\0")
4533 end--;
4534 return result.slice(start, end).split("\0").map(transform).join(delimiter);
4535 }
4536 function replace(input, re, value) {
4537 if (re instanceof RegExp)
4538 return input.replace(re, value);
4539 return re.reduce(function(input2, re2) {
4540 return input2.replace(re2, value);
4541 }, input);
4542 }
4543
4544 // node_modules/pascal-case/dist.es2015/index.js
4545 function pascalCaseTransform(input, index) {
4546 var firstChar = input.charAt(0);
4547 var lowerChars = input.substr(1).toLowerCase();
4548 if (index > 0 && firstChar >= "0" && firstChar <= "9") {
4549 return "_" + firstChar + lowerChars;
4550 }
4551 return "" + firstChar.toUpperCase() + lowerChars;
4552 }
4553 function pascalCase(input, options) {
4554 if (options === void 0) {
4555 options = {};
4556 }
4557 return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
4558 }
4559
4560 // node_modules/camel-case/dist.es2015/index.js
4561 function camelCaseTransform(input, index) {
4562 if (index === 0)
4563 return input.toLowerCase();
4564 return pascalCaseTransform(input, index);
4565 }
4566 function camelCase(input, options) {
4567 if (options === void 0) {
4568 options = {};
4569 }
4570 return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
4571 }
4572
4573 // packages/blocks/build-module/store/reducer.mjs
4574 var import_data2 = __toESM(require_data(), 1);
4575 var import_i18n3 = __toESM(require_i18n(), 1);
4576
4577 // node_modules/colord/index.mjs
4578 var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) };
4579 var t = function(r2) {
4580 return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2;
4581 };
4582 var n = function(r2, t3, n2) {
4583 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = Math.pow(10, t3)), Math.round(n2 * r2) / n2 + 0;
4584 };
4585 var e = function(r2, t3, n2) {
4586 return void 0 === t3 && (t3 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t3 ? r2 : t3;
4587 };
4588 var u = function(r2) {
4589 return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360;
4590 };
4591 var a = function(r2) {
4592 return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) };
4593 };
4594 var o = function(r2) {
4595 return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) };
4596 };
4597 var i = /^#([0-9a-f]{3,8})$/i;
4598 var s = function(r2) {
4599 var t3 = r2.toString(16);
4600 return t3.length < 2 ? "0" + t3 : t3;
4601 };
4602 var h = function(r2) {
4603 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;
4604 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o3 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 };
4605 };
4606 var b = function(r2) {
4607 var t3 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a;
4608 t3 = t3 / 360 * 6, n2 /= 100, e2 /= 100;
4609 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;
4610 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 };
4611 };
4612 var g = function(r2) {
4613 return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) };
4614 };
4615 var d = function(r2) {
4616 return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
4617 };
4618 var f = function(r2) {
4619 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 }));
4620 var t3, n2, e2;
4621 };
4622 var c = function(r2) {
4623 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 };
4624 var t3, n2, e2, u2;
4625 };
4626 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4627 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4628 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4629 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i;
4630 var y = { string: [[function(r2) {
4631 var t3 = i.exec(r2);
4632 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;
4633 }, "hex"], [function(r2) {
4634 var t3 = v.exec(r2) || m.exec(r2);
4635 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;
4636 }, "rgb"], [function(t3) {
4637 var n2 = l.exec(t3) || p.exec(t3);
4638 if (!n2) return null;
4639 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) });
4640 return f(a2);
4641 }, "hsl"]], object: [[function(r2) {
4642 var n2 = r2.r, e2 = r2.g, u2 = r2.b, o3 = r2.a, i2 = void 0 === o3 ? 1 : o3;
4643 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null;
4644 }, "rgb"], [function(r2) {
4645 var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o3 = void 0 === a2 ? 1 : a2;
4646 if (!t(n2) || !t(e2) || !t(u2)) return null;
4647 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o3) });
4648 return f(i2);
4649 }, "hsl"], [function(r2) {
4650 var n2 = r2.h, a2 = r2.s, o3 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2;
4651 if (!t(n2) || !t(a2) || !t(o3)) return null;
4652 var h2 = (function(r3) {
4653 return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) };
4654 })({ h: Number(n2), s: Number(a2), v: Number(o3), a: Number(s2) });
4655 return b(h2);
4656 }, "hsv"]] };
4657 var N = function(r2, t3) {
4658 for (var n2 = 0; n2 < t3.length; n2++) {
4659 var e2 = t3[n2][0](r2);
4660 if (e2) return [e2, t3[n2][1]];
4661 }
4662 return [null, void 0];
4663 };
4664 var x = function(r2) {
4665 return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0];
4666 };
4667 var M = function(r2, t3) {
4668 var n2 = c(r2);
4669 return { h: n2.h, s: e(n2.s + 100 * t3, 0, 100), l: n2.l, a: n2.a };
4670 };
4671 var H = function(r2) {
4672 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
4673 };
4674 var $ = function(r2, t3) {
4675 var n2 = c(r2);
4676 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t3, 0, 100), a: n2.a };
4677 };
4678 var j = (function() {
4679 function r2(r3) {
4680 this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
4681 }
4682 return r2.prototype.isValid = function() {
4683 return null !== this.parsed;
4684 }, r2.prototype.brightness = function() {
4685 return n(H(this.rgba), 2);
4686 }, r2.prototype.isDark = function() {
4687 return H(this.rgba) < 0.5;
4688 }, r2.prototype.isLight = function() {
4689 return H(this.rgba) >= 0.5;
4690 }, r2.prototype.toHex = function() {
4691 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;
4692 var r3, t3, e2, u2, a2, i2;
4693 }, r2.prototype.toRgb = function() {
4694 return o(this.rgba);
4695 }, r2.prototype.toRgbString = function() {
4696 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 + ")";
4697 var r3, t3, n2, e2, u2;
4698 }, r2.prototype.toHsl = function() {
4699 return d(c(this.rgba));
4700 }, r2.prototype.toHslString = function() {
4701 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 + "%)";
4702 var r3, t3, n2, e2, u2;
4703 }, r2.prototype.toHsv = function() {
4704 return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
4705 var r3;
4706 }, r2.prototype.invert = function() {
4707 return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
4708 var r3;
4709 }, r2.prototype.saturate = function(r3) {
4710 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3));
4711 }, r2.prototype.desaturate = function(r3) {
4712 return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3));
4713 }, r2.prototype.grayscale = function() {
4714 return w(M(this.rgba, -1));
4715 }, r2.prototype.lighten = function(r3) {
4716 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3));
4717 }, r2.prototype.darken = function(r3) {
4718 return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3));
4719 }, r2.prototype.rotate = function(r3) {
4720 return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3);
4721 }, r2.prototype.alpha = function(r3) {
4722 return "number" == typeof r3 ? w({ r: (t3 = this.rgba).r, g: t3.g, b: t3.b, a: r3 }) : n(this.rgba.a, 3);
4723 var t3;
4724 }, r2.prototype.hue = function(r3) {
4725 var t3 = c(this.rgba);
4726 return "number" == typeof r3 ? w({ h: r3, s: t3.s, l: t3.l, a: t3.a }) : n(t3.h);
4727 }, r2.prototype.isEqual = function(r3) {
4728 return this.toHex() === w(r3).toHex();
4729 }, r2;
4730 })();
4731 var w = function(r2) {
4732 return r2 instanceof j ? r2 : new j(r2);
4733 };
4734 var S = [];
4735 var k = function(r2) {
4736 r2.forEach(function(r3) {
4737 S.indexOf(r3) < 0 && (r3(j, y), S.push(r3));
4738 });
4739 };
4740
4741 // node_modules/colord/plugins/names.mjs
4742 function names_default(e2, f2) {
4743 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 = {};
4744 for (var d2 in a2) r2[a2[d2]] = d2;
4745 var l2 = {};
4746 e2.prototype.toName = function(f3) {
4747 if (!(this.rgba.a || this.rgba.r || this.rgba.g || this.rgba.b)) return "transparent";
4748 var d3, i2, n2 = r2[this.toHex()];
4749 if (n2) return n2;
4750 if (null == f3 ? void 0 : f3.closest) {
4751 var o3 = this.toRgb(), t3 = 1 / 0, b2 = "black";
4752 if (!l2.length) for (var c2 in a2) l2[c2] = new e2(a2[c2]).toRgb();
4753 for (var g2 in a2) {
4754 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));
4755 u2 < t3 && (t3 = u2, b2 = g2);
4756 }
4757 return b2;
4758 }
4759 };
4760 f2.string.push([function(f3) {
4761 var r3 = f3.toLowerCase(), d3 = "transparent" === r3 ? "#0000" : a2[r3];
4762 return d3 ? new e2(d3).toRgb() : null;
4763 }, "name"]);
4764 }
4765
4766 // node_modules/colord/plugins/a11y.mjs
4767 var o2 = function(o3) {
4768 var t3 = o3 / 255;
4769 return t3 < 0.04045 ? t3 / 12.92 : Math.pow((t3 + 0.055) / 1.055, 2.4);
4770 };
4771 var t2 = function(t3) {
4772 return 0.2126 * o2(t3.r) + 0.7152 * o2(t3.g) + 0.0722 * o2(t3.b);
4773 };
4774 function a11y_default(o3) {
4775 o3.prototype.luminance = function() {
4776 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;
4777 var o4, r2, n2;
4778 }, o3.prototype.contrast = function(r2) {
4779 void 0 === r2 && (r2 = "#FFF");
4780 var n2, a2, i2, e2, v2, u2, d2, c2 = r2 instanceof o3 ? r2 : new o3(r2);
4781 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;
4782 }, o3.prototype.isReadable = function(o4, t3) {
4783 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);
4784 var r2, n2, a2, i2, e2;
4785 };
4786 }
4787
4788 // packages/blocks/build-module/api/utils.mjs
4789 var import_element = __toESM(require_element(), 1);
4790 var import_i18n2 = __toESM(require_i18n(), 1);
4791 var import_dom = __toESM(require_dom(), 1);
4792 var import_rich_text = __toESM(require_rich_text(), 1);
4793 var import_deprecated = __toESM(require_deprecated(), 1);
4794
4795 // packages/blocks/build-module/api/constants.mjs
4796 var BLOCK_ICON_DEFAULT = "block-default";
4797 var DEPRECATED_ENTRY_KEYS = [
4798 "attributes",
4799 "supports",
4800 "save",
4801 "migrate",
4802 "isEligible",
4803 "apiVersion"
4804 ];
4805 var __EXPERIMENTAL_STYLE_PROPERTY = {
4806 // Kept for back-compatibility purposes.
4807 "--wp--style--color--link": {
4808 value: ["color", "link"],
4809 support: ["color", "link"]
4810 },
4811 aspectRatio: {
4812 value: ["dimensions", "aspectRatio"],
4813 support: ["dimensions", "aspectRatio"],
4814 useEngine: true
4815 },
4816 background: {
4817 value: ["color", "gradient"],
4818 support: ["color", "gradients"],
4819 useEngine: true
4820 },
4821 backgroundColor: {
4822 value: ["color", "background"],
4823 support: ["color", "background"],
4824 requiresOptOut: true,
4825 useEngine: true
4826 },
4827 backgroundImage: {
4828 value: ["background", "backgroundImage"],
4829 support: ["background", "backgroundImage"],
4830 useEngine: true
4831 },
4832 backgroundRepeat: {
4833 value: ["background", "backgroundRepeat"],
4834 support: ["background", "backgroundRepeat"],
4835 useEngine: true
4836 },
4837 backgroundSize: {
4838 value: ["background", "backgroundSize"],
4839 support: ["background", "backgroundSize"],
4840 useEngine: true
4841 },
4842 backgroundPosition: {
4843 value: ["background", "backgroundPosition"],
4844 support: ["background", "backgroundPosition"],
4845 useEngine: true
4846 },
4847 backgroundGradient: {
4848 value: ["background", "gradient"],
4849 support: ["background", "gradient"],
4850 useEngine: true
4851 },
4852 borderColor: {
4853 value: ["border", "color"],
4854 support: ["__experimentalBorder", "color"],
4855 useEngine: true
4856 },
4857 borderRadius: {
4858 value: ["border", "radius"],
4859 support: ["__experimentalBorder", "radius"],
4860 properties: {
4861 borderTopLeftRadius: "topLeft",
4862 borderTopRightRadius: "topRight",
4863 borderBottomLeftRadius: "bottomLeft",
4864 borderBottomRightRadius: "bottomRight"
4865 },
4866 useEngine: true
4867 },
4868 borderStyle: {
4869 value: ["border", "style"],
4870 support: ["__experimentalBorder", "style"],
4871 useEngine: true
4872 },
4873 borderWidth: {
4874 value: ["border", "width"],
4875 support: ["__experimentalBorder", "width"],
4876 useEngine: true
4877 },
4878 borderTopColor: {
4879 value: ["border", "top", "color"],
4880 support: ["__experimentalBorder", "color"],
4881 useEngine: true
4882 },
4883 borderTopStyle: {
4884 value: ["border", "top", "style"],
4885 support: ["__experimentalBorder", "style"],
4886 useEngine: true
4887 },
4888 borderTopWidth: {
4889 value: ["border", "top", "width"],
4890 support: ["__experimentalBorder", "width"],
4891 useEngine: true
4892 },
4893 borderRightColor: {
4894 value: ["border", "right", "color"],
4895 support: ["__experimentalBorder", "color"],
4896 useEngine: true
4897 },
4898 borderRightStyle: {
4899 value: ["border", "right", "style"],
4900 support: ["__experimentalBorder", "style"],
4901 useEngine: true
4902 },
4903 borderRightWidth: {
4904 value: ["border", "right", "width"],
4905 support: ["__experimentalBorder", "width"],
4906 useEngine: true
4907 },
4908 borderBottomColor: {
4909 value: ["border", "bottom", "color"],
4910 support: ["__experimentalBorder", "color"],
4911 useEngine: true
4912 },
4913 borderBottomStyle: {
4914 value: ["border", "bottom", "style"],
4915 support: ["__experimentalBorder", "style"],
4916 useEngine: true
4917 },
4918 borderBottomWidth: {
4919 value: ["border", "bottom", "width"],
4920 support: ["__experimentalBorder", "width"],
4921 useEngine: true
4922 },
4923 borderLeftColor: {
4924 value: ["border", "left", "color"],
4925 support: ["__experimentalBorder", "color"],
4926 useEngine: true
4927 },
4928 borderLeftStyle: {
4929 value: ["border", "left", "style"],
4930 support: ["__experimentalBorder", "style"],
4931 useEngine: true
4932 },
4933 borderLeftWidth: {
4934 value: ["border", "left", "width"],
4935 support: ["__experimentalBorder", "width"],
4936 useEngine: true
4937 },
4938 color: {
4939 value: ["color", "text"],
4940 support: ["color", "text"],
4941 requiresOptOut: true,
4942 useEngine: true
4943 },
4944 columnCount: {
4945 value: ["typography", "textColumns"],
4946 support: ["typography", "textColumns"],
4947 useEngine: true
4948 },
4949 filter: {
4950 value: ["filter", "duotone"],
4951 support: ["filter", "duotone"]
4952 },
4953 linkColor: {
4954 value: ["elements", "link", "color", "text"],
4955 support: ["color", "link"]
4956 },
4957 captionColor: {
4958 value: ["elements", "caption", "color", "text"],
4959 support: ["color", "caption"]
4960 },
4961 buttonColor: {
4962 value: ["elements", "button", "color", "text"],
4963 support: ["color", "button"]
4964 },
4965 buttonBackgroundColor: {
4966 value: ["elements", "button", "color", "background"],
4967 support: ["color", "button"]
4968 },
4969 headingColor: {
4970 value: ["elements", "heading", "color", "text"],
4971 support: ["color", "heading"]
4972 },
4973 headingBackgroundColor: {
4974 value: ["elements", "heading", "color", "background"],
4975 support: ["color", "heading"]
4976 },
4977 fontFamily: {
4978 value: ["typography", "fontFamily"],
4979 support: ["typography", "__experimentalFontFamily"],
4980 useEngine: true
4981 },
4982 fontSize: {
4983 value: ["typography", "fontSize"],
4984 support: ["typography", "fontSize"],
4985 useEngine: true
4986 },
4987 fontStyle: {
4988 value: ["typography", "fontStyle"],
4989 support: ["typography", "__experimentalFontStyle"],
4990 useEngine: true
4991 },
4992 fontWeight: {
4993 value: ["typography", "fontWeight"],
4994 support: ["typography", "__experimentalFontWeight"],
4995 useEngine: true
4996 },
4997 lineHeight: {
4998 value: ["typography", "lineHeight"],
4999 support: ["typography", "lineHeight"],
5000 useEngine: true
5001 },
5002 margin: {
5003 value: ["spacing", "margin"],
5004 support: ["spacing", "margin"],
5005 properties: {
5006 marginTop: "top",
5007 marginRight: "right",
5008 marginBottom: "bottom",
5009 marginLeft: "left"
5010 },
5011 useEngine: true
5012 },
5013 minHeight: {
5014 value: ["dimensions", "minHeight"],
5015 support: ["dimensions", "minHeight"],
5016 useEngine: true
5017 },
5018 minWidth: {
5019 value: ["dimensions", "minWidth"],
5020 support: ["dimensions", "minWidth"],
5021 useEngine: true
5022 },
5023 height: {
5024 value: ["dimensions", "height"],
5025 support: ["dimensions", "height"],
5026 useEngine: true
5027 },
5028 width: {
5029 value: ["dimensions", "width"],
5030 support: ["dimensions", "width"],
5031 useEngine: true
5032 },
5033 padding: {
5034 value: ["spacing", "padding"],
5035 support: ["spacing", "padding"],
5036 properties: {
5037 paddingTop: "top",
5038 paddingRight: "right",
5039 paddingBottom: "bottom",
5040 paddingLeft: "left"
5041 },
5042 useEngine: true
5043 },
5044 textAlign: {
5045 value: ["typography", "textAlign"],
5046 support: ["typography", "textAlign"],
5047 useEngine: false
5048 },
5049 textDecoration: {
5050 value: ["typography", "textDecoration"],
5051 support: ["typography", "__experimentalTextDecoration"],
5052 useEngine: true
5053 },
5054 textTransform: {
5055 value: ["typography", "textTransform"],
5056 support: ["typography", "__experimentalTextTransform"],
5057 useEngine: true
5058 },
5059 letterSpacing: {
5060 value: ["typography", "letterSpacing"],
5061 support: ["typography", "__experimentalLetterSpacing"],
5062 useEngine: true
5063 },
5064 textIndent: {
5065 value: ["typography", "textIndent"],
5066 support: ["typography", "textIndent"],
5067 useEngine: true
5068 },
5069 writingMode: {
5070 value: ["typography", "writingMode"],
5071 support: ["typography", "__experimentalWritingMode"],
5072 useEngine: true
5073 },
5074 "--wp--style--root--padding": {
5075 value: ["spacing", "padding"],
5076 support: ["spacing", "padding"],
5077 properties: {
5078 "--wp--style--root--padding-top": "top",
5079 "--wp--style--root--padding-right": "right",
5080 "--wp--style--root--padding-bottom": "bottom",
5081 "--wp--style--root--padding-left": "left"
5082 },
5083 rootOnly: true
5084 }
5085 };
5086 var __EXPERIMENTAL_ELEMENTS = {
5087 link: "a:where(:not(.wp-element-button))",
5088 heading: "h1, h2, h3, h4, h5, h6",
5089 h1: "h1",
5090 h2: "h2",
5091 h3: "h3",
5092 h4: "h4",
5093 h5: "h5",
5094 h6: "h6",
5095 button: ".wp-element-button, .wp-block-button__link",
5096 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",
5097 cite: "cite",
5098 select: "select",
5099 textInput: "textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=url])"
5100 };
5101 var __EXPERIMENTAL_PATHS_WITH_OVERRIDE = {
5102 "color.duotone": true,
5103 "color.gradients": true,
5104 "color.palette": true,
5105 "dimensions.aspectRatios": true,
5106 "typography.fontSizes": true,
5107 "spacing.spacingSizes": true
5108 };
5109
5110 // packages/blocks/build-module/api/registration.mjs
5111 var import_data = __toESM(require_data(), 1);
5112 var import_i18n = __toESM(require_i18n(), 1);
5113 var import_warning = __toESM(require_warning(), 1);
5114
5115 // packages/blocks/build-module/api/i18n-block.json
5116 var i18n_block_default = {
5117 title: "block title",
5118 description: "block description",
5119 keywords: ["block keyword"],
5120 styles: [
5121 {
5122 label: "block style label"
5123 }
5124 ],
5125 variations: [
5126 {
5127 title: "block variation title",
5128 description: "block variation description",
5129 keywords: ["block variation keyword"]
5130 }
5131 ]
5132 };
5133
5134 // packages/blocks/build-module/lock-unlock.mjs
5135 var import_private_apis = __toESM(require_private_apis(), 1);
5136 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
5137 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
5138 "@wordpress/blocks"
5139 );
5140
5141 // packages/blocks/build-module/api/registration.mjs
5142 function isObject(object) {
5143 return object !== null && typeof object === "object";
5144 }
5145 function unstable__bootstrapServerSideBlockDefinitions(definitions) {
5146 const { addBootstrappedBlockType: addBootstrappedBlockType2 } = unlock((0, import_data.dispatch)(store));
5147 for (const [name, blockType] of Object.entries(definitions)) {
5148 addBootstrappedBlockType2(name, blockType);
5149 }
5150 }
5151 function getBlockSettingsFromMetadata({
5152 textdomain,
5153 ...metadata
5154 }) {
5155 const allowedFields = [
5156 "apiVersion",
5157 "title",
5158 "category",
5159 "parent",
5160 "ancestor",
5161 "icon",
5162 "description",
5163 "keywords",
5164 "attributes",
5165 "providesContext",
5166 "usesContext",
5167 "selectors",
5168 "supports",
5169 "styles",
5170 "example",
5171 "variations",
5172 "blockHooks",
5173 "allowedBlocks"
5174 ];
5175 const settings = Object.fromEntries(
5176 Object.entries(metadata).filter(
5177 ([key]) => allowedFields.includes(key)
5178 )
5179 );
5180 if (textdomain) {
5181 Object.keys(i18n_block_default).forEach((key) => {
5182 if (!settings[key]) {
5183 return;
5184 }
5185 settings[key] = translateBlockSettingUsingI18nSchema(
5186 i18n_block_default[key],
5187 settings[key],
5188 textdomain
5189 );
5190 });
5191 }
5192 return settings;
5193 }
5194 function registerBlockType(blockNameOrMetadata, settings) {
5195 const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata;
5196 if (typeof name !== "string") {
5197 (0, import_warning.default)("Block names must be strings.");
5198 return;
5199 }
5200 if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
5201 (0, import_warning.default)(
5202 "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"
5203 );
5204 return;
5205 }
5206 if ((0, import_data.select)(store).getBlockType(name)) {
5207 (0, import_warning.default)('Block "' + name + '" is already registered.');
5208 return;
5209 }
5210 const { addBootstrappedBlockType: addBootstrappedBlockType2, addUnprocessedBlockType: addUnprocessedBlockType2 } = unlock(
5211 (0, import_data.dispatch)(store)
5212 );
5213 if (isObject(blockNameOrMetadata)) {
5214 const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata);
5215 addBootstrappedBlockType2(name, metadata);
5216 }
5217 addUnprocessedBlockType2(name, settings);
5218 return (0, import_data.select)(store).getBlockType(name);
5219 }
5220 function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) {
5221 if (typeof i18nSchema === "string" && typeof settingValue === "string") {
5222 return (0, import_i18n._x)(settingValue, i18nSchema, textdomain);
5223 }
5224 if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) {
5225 return settingValue.map(
5226 (value) => translateBlockSettingUsingI18nSchema(
5227 i18nSchema[0],
5228 value,
5229 textdomain
5230 )
5231 );
5232 }
5233 if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) {
5234 return Object.keys(settingValue).reduce(
5235 (accumulator, key) => {
5236 if (!i18nSchema[key]) {
5237 accumulator[key] = settingValue[key];
5238 return accumulator;
5239 }
5240 accumulator[key] = translateBlockSettingUsingI18nSchema(
5241 i18nSchema[key],
5242 settingValue[key],
5243 textdomain
5244 );
5245 return accumulator;
5246 },
5247 {}
5248 );
5249 }
5250 return settingValue;
5251 }
5252 function registerBlockCollection(namespace, { title, icon }) {
5253 (0, import_data.dispatch)(store).addBlockCollection(namespace, title, icon);
5254 }
5255 function unregisterBlockType(name) {
5256 const oldBlock = (0, import_data.select)(store).getBlockType(name);
5257 if (!oldBlock) {
5258 (0, import_warning.default)('Block "' + name + '" is not registered.');
5259 return;
5260 }
5261 (0, import_data.dispatch)(store).removeBlockTypes(name);
5262 return oldBlock;
5263 }
5264 function setFreeformContentHandlerName(blockName) {
5265 (0, import_data.dispatch)(store).setFreeformFallbackBlockName(blockName);
5266 }
5267 function getFreeformContentHandlerName() {
5268 return (0, import_data.select)(store).getFreeformFallbackBlockName();
5269 }
5270 function getGroupingBlockName() {
5271 return (0, import_data.select)(store).getGroupingBlockName();
5272 }
5273 function setUnregisteredTypeHandlerName(blockName) {
5274 (0, import_data.dispatch)(store).setUnregisteredFallbackBlockName(blockName);
5275 }
5276 function getUnregisteredTypeHandlerName() {
5277 return (0, import_data.select)(store).getUnregisteredFallbackBlockName();
5278 }
5279 function setDefaultBlockName(name) {
5280 (0, import_data.dispatch)(store).setDefaultBlockName(name);
5281 }
5282 function setGroupingBlockName(name) {
5283 (0, import_data.dispatch)(store).setGroupingBlockName(name);
5284 }
5285 function getDefaultBlockName() {
5286 return (0, import_data.select)(store).getDefaultBlockName();
5287 }
5288 function getBlockType(name) {
5289 return (0, import_data.select)(store)?.getBlockType(name);
5290 }
5291 function getBlockTypes() {
5292 return (0, import_data.select)(store).getBlockTypes();
5293 }
5294 function getBlockSupport(nameOrType, feature, defaultSupports) {
5295 return (0, import_data.select)(store).getBlockSupport(
5296 nameOrType,
5297 feature,
5298 defaultSupports
5299 );
5300 }
5301 function hasBlockSupport(nameOrType, feature, defaultSupports) {
5302 return (0, import_data.select)(store).hasBlockSupport(
5303 nameOrType,
5304 feature,
5305 defaultSupports
5306 );
5307 }
5308 function isReusableBlock(blockOrType) {
5309 return blockOrType?.name === "core/block";
5310 }
5311 function isTemplatePart(blockOrType) {
5312 return blockOrType?.name === "core/template-part";
5313 }
5314 var getChildBlockNames = (blockName) => {
5315 return (0, import_data.select)(store).getChildBlockNames(blockName);
5316 };
5317 var hasChildBlocks = (blockName) => {
5318 return (0, import_data.select)(store).hasChildBlocks(blockName);
5319 };
5320 var hasChildBlocksWithInserterSupport = (blockName) => {
5321 return (0, import_data.select)(store).hasChildBlocksWithInserterSupport(blockName);
5322 };
5323 var registerBlockStyle = (blockNames, styleVariation) => {
5324 (0, import_data.dispatch)(store).addBlockStyles(blockNames, styleVariation);
5325 };
5326 var unregisterBlockStyle = (blockName, styleVariationName) => {
5327 (0, import_data.dispatch)(store).removeBlockStyles(blockName, styleVariationName);
5328 };
5329 var getBlockVariations = (blockName, scope) => {
5330 return (0, import_data.select)(store).getBlockVariations(blockName, scope);
5331 };
5332 var registerBlockVariation = (blockName, variation) => {
5333 if (Array.isArray(variation)) {
5334 for (const v2 of variation) {
5335 if (typeof v2.name !== "string") {
5336 (0, import_warning.default)("Variation names must be unique strings.");
5337 }
5338 }
5339 } else if (typeof variation.name !== "string") {
5340 (0, import_warning.default)("Variation names must be unique strings.");
5341 }
5342 (0, import_data.dispatch)(store).addBlockVariations(blockName, variation);
5343 };
5344 var unregisterBlockVariation = (blockName, variationName) => {
5345 (0, import_data.dispatch)(store).removeBlockVariations(blockName, variationName);
5346 };
5347 var registerBlockBindingsSource = (source) => {
5348 const {
5349 name,
5350 label,
5351 usesContext,
5352 getValues,
5353 setValues,
5354 canUserEditValue,
5355 getFieldsList
5356 } = source;
5357 const existingSource = unlock(
5358 (0, import_data.select)(store)
5359 ).getBlockBindingsSource(name);
5360 const serverProps = ["label", "usesContext"];
5361 for (const prop2 in existingSource) {
5362 if (!serverProps.includes(prop2) && existingSource[prop2]) {
5363 (0, import_warning.default)(
5364 'Block bindings source "' + name + '" is already registered.'
5365 );
5366 return;
5367 }
5368 }
5369 if (!name) {
5370 (0, import_warning.default)("Block bindings source must contain a name.");
5371 return;
5372 }
5373 if (typeof name !== "string") {
5374 (0, import_warning.default)("Block bindings source name must be a string.");
5375 return;
5376 }
5377 if (/[A-Z]+/.test(name)) {
5378 (0, import_warning.default)(
5379 "Block bindings source name must not contain uppercase characters."
5380 );
5381 return;
5382 }
5383 if (!/^[a-z0-9/-]+$/.test(name)) {
5384 (0, import_warning.default)(
5385 "Block bindings source name must contain only valid characters: lowercase characters, hyphens, or digits. Example: my-plugin/my-custom-source."
5386 );
5387 return;
5388 }
5389 if (!/^[a-z0-9-]+\/[a-z0-9-]+$/.test(name)) {
5390 (0, import_warning.default)(
5391 "Block bindings source name must contain a namespace and valid characters. Example: my-plugin/my-custom-source."
5392 );
5393 return;
5394 }
5395 if (!label && !existingSource?.label) {
5396 (0, import_warning.default)("Block bindings source must contain a label.");
5397 return;
5398 }
5399 if (label && typeof label !== "string") {
5400 (0, import_warning.default)("Block bindings source label must be a string.");
5401 return;
5402 }
5403 if (label && existingSource?.label && label !== existingSource?.label) {
5404 (0, import_warning.default)('Block bindings "' + name + '" source label was overridden.');
5405 }
5406 if (usesContext && !Array.isArray(usesContext)) {
5407 (0, import_warning.default)("Block bindings source usesContext must be an array.");
5408 return;
5409 }
5410 if (getValues && typeof getValues !== "function") {
5411 (0, import_warning.default)("Block bindings source getValues must be a function.");
5412 return;
5413 }
5414 if (setValues && typeof setValues !== "function") {
5415 (0, import_warning.default)("Block bindings source setValues must be a function.");
5416 return;
5417 }
5418 if (canUserEditValue && typeof canUserEditValue !== "function") {
5419 (0, import_warning.default)("Block bindings source canUserEditValue must be a function.");
5420 return;
5421 }
5422 if (getFieldsList && typeof getFieldsList !== "function") {
5423 (0, import_warning.default)("Block bindings source getFieldsList must be a function.");
5424 return;
5425 }
5426 return unlock((0, import_data.dispatch)(store)).addBlockBindingsSource(source);
5427 };
5428 function unregisterBlockBindingsSource(name) {
5429 const oldSource = getBlockBindingsSource(name);
5430 if (!oldSource) {
5431 (0, import_warning.default)('Block bindings source "' + name + '" is not registered.');
5432 return;
5433 }
5434 unlock((0, import_data.dispatch)(store)).removeBlockBindingsSource(name);
5435 }
5436 function getBlockBindingsSource(name) {
5437 return unlock((0, import_data.select)(store)).getBlockBindingsSource(name);
5438 }
5439 function getBlockBindingsSources() {
5440 return unlock((0, import_data.select)(store)).getAllBlockBindingsSources();
5441 }
5442
5443 // packages/blocks/build-module/api/utils.mjs
5444 k([names_default, a11y_default]);
5445 var ICON_COLORS = ["#191e23", "#f8f9f9"];
5446 function isUnmodifiedBlock(block, role) {
5447 const blockAttributes = getBlockType(block.name)?.attributes ?? {};
5448 const attributesByRole = role ? Object.entries(blockAttributes).filter(([key, definition]) => {
5449 if (role === "content" && key === "metadata") {
5450 return Object.keys(
5451 block.attributes[key]?.bindings ?? {}
5452 ).length > 0;
5453 }
5454 return definition.role === role || definition.__experimentalRole === role;
5455 }) : [];
5456 const attributesToCheck = !!attributesByRole.length ? attributesByRole : Object.entries(blockAttributes);
5457 return attributesToCheck.every(([key, definition]) => {
5458 const value = block.attributes[key];
5459 if (definition.hasOwnProperty("default")) {
5460 return value === definition.default;
5461 }
5462 if (definition.type === "rich-text") {
5463 return !value?.length;
5464 }
5465 return value === void 0;
5466 });
5467 }
5468 function isUnmodifiedDefaultBlock(block, role) {
5469 return block.name === getDefaultBlockName() && isUnmodifiedBlock(block, role);
5470 }
5471 function isValidIcon(icon) {
5472 return !!icon && (typeof icon === "string" || (0, import_element.isValidElement)(icon) || typeof icon === "function" || icon instanceof import_element.Component);
5473 }
5474 function normalizeIconObject(icon) {
5475 const resolvedIcon = icon || BLOCK_ICON_DEFAULT;
5476 if (isValidIcon(resolvedIcon)) {
5477 return { src: resolvedIcon };
5478 }
5479 const iconDescriptor = resolvedIcon;
5480 if ("background" in iconDescriptor) {
5481 const colordBgColor = w(iconDescriptor.background);
5482 const getColorContrast = (iconColor) => colordBgColor.contrast(iconColor);
5483 const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast));
5484 return {
5485 ...iconDescriptor,
5486 foreground: iconDescriptor.foreground ? iconDescriptor.foreground : ICON_COLORS.find(
5487 (iconColor) => getColorContrast(iconColor) === maxContrast
5488 ),
5489 shadowColor: colordBgColor.alpha(0.3).toRgbString()
5490 };
5491 }
5492 return iconDescriptor;
5493 }
5494 function normalizeBlockType(blockTypeOrName) {
5495 if (typeof blockTypeOrName === "string") {
5496 return getBlockType(blockTypeOrName);
5497 }
5498 return blockTypeOrName;
5499 }
5500 function getBlockLabel(blockType, attributes, context = "visual") {
5501 const { __experimentalLabel: getLabel, title } = blockType;
5502 const label = getLabel && getLabel(attributes, { context });
5503 if (!label) {
5504 return title;
5505 }
5506 if (label.toPlainText) {
5507 return label.toPlainText();
5508 }
5509 return (0, import_dom.__unstableStripHTML)(label);
5510 }
5511 function getAccessibleBlockLabel(blockType, attributes, position, direction = "vertical") {
5512 const title = blockType?.title ?? "";
5513 const label = blockType ? getBlockLabel(blockType, attributes, "accessibility") : "";
5514 const hasPosition = position !== void 0;
5515 const hasLabel = label && label !== title;
5516 if (hasPosition && direction === "vertical") {
5517 if (hasLabel) {
5518 return (0, import_i18n2.sprintf)(
5519 /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
5520 (0, import_i18n2.__)("%1$s Block. Row %2$d. %3$s"),
5521 title,
5522 position,
5523 label
5524 );
5525 }
5526 return (0, import_i18n2.sprintf)(
5527 /* translators: accessibility text. 1: The block title. 2: The block row number. */
5528 (0, import_i18n2.__)("%1$s Block. Row %2$d"),
5529 title,
5530 position
5531 );
5532 } else if (hasPosition && direction === "horizontal") {
5533 if (hasLabel) {
5534 return (0, import_i18n2.sprintf)(
5535 /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
5536 (0, import_i18n2.__)("%1$s Block. Column %2$d. %3$s"),
5537 title,
5538 position,
5539 label
5540 );
5541 }
5542 return (0, import_i18n2.sprintf)(
5543 /* translators: accessibility text. 1: The block title. 2: The block column number. */
5544 (0, import_i18n2.__)("%1$s Block. Column %2$d"),
5545 title,
5546 position
5547 );
5548 }
5549 if (hasLabel) {
5550 return (0, import_i18n2.sprintf)(
5551 /* translators: accessibility text. 1: The block title. 2: The block label. */
5552 (0, import_i18n2.__)("%1$s Block. %2$s"),
5553 title,
5554 label
5555 );
5556 }
5557 return (0, import_i18n2.sprintf)(
5558 /* translators: accessibility text. %s: The block title. */
5559 (0, import_i18n2.__)("%s Block"),
5560 title
5561 );
5562 }
5563 function getDefault(attributeSchema) {
5564 if (attributeSchema.default !== void 0) {
5565 return attributeSchema.default;
5566 }
5567 if (attributeSchema.type === "rich-text") {
5568 return new import_rich_text.RichTextData();
5569 }
5570 return void 0;
5571 }
5572 function isBlockRegistered(name) {
5573 return getBlockType(name) !== void 0;
5574 }
5575 function __experimentalSanitizeBlockAttributes(name, attributes) {
5576 const blockType = getBlockType(name);
5577 if (void 0 === blockType) {
5578 throw new Error(`Block type '${name}' is not registered.`);
5579 }
5580 return Object.entries(blockType.attributes).reduce(
5581 (accumulator, [key, schema]) => {
5582 const value = attributes[key];
5583 if (void 0 !== value) {
5584 if (schema.type === "rich-text") {
5585 if (value instanceof import_rich_text.RichTextData) {
5586 accumulator[key] = value;
5587 } else if (typeof value === "string") {
5588 accumulator[key] = import_rich_text.RichTextData.fromHTMLString(value);
5589 }
5590 } else if (schema.type === "string" && value instanceof import_rich_text.RichTextData) {
5591 accumulator[key] = value.toHTMLString();
5592 } else {
5593 accumulator[key] = value;
5594 }
5595 } else {
5596 const _default = getDefault(schema);
5597 if (void 0 !== _default) {
5598 accumulator[key] = _default;
5599 }
5600 }
5601 if (["node", "children"].indexOf(schema.source ?? "") !== -1) {
5602 if (typeof accumulator[key] === "string") {
5603 accumulator[key] = [accumulator[key]];
5604 } else if (!Array.isArray(accumulator[key])) {
5605 accumulator[key] = [];
5606 }
5607 }
5608 return accumulator;
5609 },
5610 {}
5611 );
5612 }
5613 function getBlockAttributesNamesByRole(name, role) {
5614 const attributes = getBlockType(name)?.attributes;
5615 if (!attributes) {
5616 return [];
5617 }
5618 const attributesNames = Object.keys(attributes);
5619 if (!role) {
5620 return attributesNames;
5621 }
5622 return attributesNames.filter((attributeName) => {
5623 const attribute = attributes[attributeName];
5624 if (attribute?.role === role) {
5625 return true;
5626 }
5627 if (attribute?.__experimentalRole === role) {
5628 (0, import_deprecated.default)("__experimentalRole attribute", {
5629 since: "6.7",
5630 version: "6.8",
5631 alternative: "role attribute",
5632 hint: `Check the block.json of the ${name} block.`
5633 });
5634 return true;
5635 }
5636 return false;
5637 });
5638 }
5639 var __experimentalGetBlockAttributesNamesByRole = (...args) => {
5640 (0, import_deprecated.default)("__experimentalGetBlockAttributesNamesByRole", {
5641 since: "6.7",
5642 version: "6.8",
5643 alternative: "getBlockAttributesNamesByRole"
5644 });
5645 return getBlockAttributesNamesByRole(...args);
5646 };
5647 function isContentBlock(name) {
5648 const blockType = getBlockType(name);
5649 const attributes = blockType?.attributes;
5650 const supportsContentRole = blockType?.supports?.contentRole;
5651 if (supportsContentRole) {
5652 return true;
5653 }
5654 if (!attributes) {
5655 return false;
5656 }
5657 return !!Object.keys(attributes)?.some((attributeKey) => {
5658 const attribute = attributes[attributeKey];
5659 return attribute?.role === "content" || attribute?.__experimentalRole === "content";
5660 });
5661 }
5662 function omit(object, keys) {
5663 const keysArray = Array.isArray(keys) ? keys : [keys];
5664 return Object.fromEntries(
5665 Object.entries(object).filter(
5666 ([key]) => !keysArray.includes(key)
5667 )
5668 );
5669 }
5670
5671 // packages/blocks/build-module/store/reducer.mjs
5672 var DEFAULT_CATEGORIES = [
5673 { slug: "text", title: (0, import_i18n3.__)("Text") },
5674 { slug: "media", title: (0, import_i18n3.__)("Media") },
5675 { slug: "design", title: (0, import_i18n3.__)("Design") },
5676 { slug: "widgets", title: (0, import_i18n3.__)("Widgets") },
5677 { slug: "theme", title: (0, import_i18n3.__)("Theme") },
5678 { slug: "embed", title: (0, import_i18n3.__)("Embeds") },
5679 { slug: "reusable", title: (0, import_i18n3.__)("Reusable blocks") }
5680 ];
5681 function keyBlockTypesByName(types) {
5682 return types.reduce(
5683 (newBlockTypes, block) => ({
5684 ...newBlockTypes,
5685 [block.name]: block
5686 }),
5687 {}
5688 );
5689 }
5690 function getUniqueItemsByName(items) {
5691 return items.reduce((acc, currentItem) => {
5692 if (!acc.some((item) => item.name === currentItem.name)) {
5693 acc.push(currentItem);
5694 }
5695 return acc;
5696 }, []);
5697 }
5698 function bootstrappedBlockTypes(state = {}, action) {
5699 switch (action.type) {
5700 case "ADD_BOOTSTRAPPED_BLOCK_TYPE":
5701 const { name, blockType } = action;
5702 const serverDefinition = state[name];
5703 if (serverDefinition) {
5704 return state;
5705 }
5706 const newDefinition = Object.fromEntries(
5707 Object.entries(blockType).filter(
5708 ([, value]) => value !== null && value !== void 0
5709 ).map(([key, value]) => [camelCase(key), value])
5710 );
5711 newDefinition.name = name;
5712 return {
5713 ...state,
5714 [name]: newDefinition
5715 };
5716 case "REMOVE_BLOCK_TYPES":
5717 return omit(state, action.names);
5718 }
5719 return state;
5720 }
5721 function unprocessedBlockTypes(state = {}, action) {
5722 switch (action.type) {
5723 case "ADD_UNPROCESSED_BLOCK_TYPE":
5724 return {
5725 ...state,
5726 [action.name]: action.blockType
5727 };
5728 case "REMOVE_BLOCK_TYPES":
5729 return omit(state, action.names);
5730 }
5731 return state;
5732 }
5733 function blockTypes(state = {}, action) {
5734 switch (action.type) {
5735 case "ADD_BLOCK_TYPES":
5736 return {
5737 ...state,
5738 ...keyBlockTypesByName(action.blockTypes)
5739 };
5740 case "REMOVE_BLOCK_TYPES":
5741 return omit(state, action.names);
5742 }
5743 return state;
5744 }
5745 function blockStyles(state = {}, action) {
5746 switch (action.type) {
5747 case "ADD_BLOCK_TYPES":
5748 return {
5749 ...state,
5750 ...Object.fromEntries(
5751 Object.entries(
5752 keyBlockTypesByName(action.blockTypes)
5753 ).map(([name, blockType]) => [
5754 name,
5755 getUniqueItemsByName([
5756 ...(blockType.styles ?? []).map((style) => ({
5757 ...style,
5758 source: "block"
5759 })),
5760 ...(state[blockType.name] ?? []).filter(
5761 ({ source }) => "block" !== source
5762 )
5763 ])
5764 ])
5765 )
5766 };
5767 case "ADD_BLOCK_STYLES":
5768 const updatedStyles = {};
5769 action.blockNames.forEach((blockName) => {
5770 updatedStyles[blockName] = getUniqueItemsByName([
5771 ...state[blockName] ?? [],
5772 ...action.styles
5773 ]);
5774 });
5775 return { ...state, ...updatedStyles };
5776 case "REMOVE_BLOCK_STYLES":
5777 return {
5778 ...state,
5779 [action.blockName]: (state[action.blockName] ?? []).filter(
5780 (style) => action.styleNames.indexOf(style.name) === -1
5781 )
5782 };
5783 }
5784 return state;
5785 }
5786 function blockVariations(state = {}, action) {
5787 switch (action.type) {
5788 case "ADD_BLOCK_TYPES":
5789 return {
5790 ...state,
5791 ...Object.fromEntries(
5792 Object.entries(
5793 keyBlockTypesByName(action.blockTypes)
5794 ).map(([name, blockType]) => {
5795 return [
5796 name,
5797 getUniqueItemsByName([
5798 ...(blockType.variations ?? []).map(
5799 (variation) => ({
5800 ...variation,
5801 source: "block"
5802 })
5803 ),
5804 ...(state[blockType.name] ?? []).filter(
5805 ({ source }) => "block" !== source
5806 )
5807 ])
5808 ];
5809 })
5810 )
5811 };
5812 case "ADD_BLOCK_VARIATIONS":
5813 return {
5814 ...state,
5815 [action.blockName]: getUniqueItemsByName([
5816 ...state[action.blockName] ?? [],
5817 ...action.variations
5818 ])
5819 };
5820 case "REMOVE_BLOCK_VARIATIONS":
5821 return {
5822 ...state,
5823 [action.blockName]: (state[action.blockName] ?? []).filter(
5824 (variation) => action.variationNames.indexOf(variation.name) === -1
5825 )
5826 };
5827 }
5828 return state;
5829 }
5830 function createBlockNameSetterReducer(setActionType) {
5831 return (state = null, action) => {
5832 switch (action.type) {
5833 case "REMOVE_BLOCK_TYPES":
5834 if (action.names.indexOf(state) !== -1) {
5835 return null;
5836 }
5837 return state;
5838 case setActionType:
5839 return action.name || null;
5840 }
5841 return state;
5842 };
5843 }
5844 var defaultBlockName = createBlockNameSetterReducer(
5845 "SET_DEFAULT_BLOCK_NAME"
5846 );
5847 var freeformFallbackBlockName = createBlockNameSetterReducer(
5848 "SET_FREEFORM_FALLBACK_BLOCK_NAME"
5849 );
5850 var unregisteredFallbackBlockName = createBlockNameSetterReducer(
5851 "SET_UNREGISTERED_FALLBACK_BLOCK_NAME"
5852 );
5853 var groupingBlockName = createBlockNameSetterReducer(
5854 "SET_GROUPING_BLOCK_NAME"
5855 );
5856 function categories(state = DEFAULT_CATEGORIES, action) {
5857 switch (action.type) {
5858 case "SET_CATEGORIES":
5859 const uniqueCategories = /* @__PURE__ */ new Map();
5860 (action.categories || []).forEach((category) => {
5861 uniqueCategories.set(category.slug, category);
5862 });
5863 return [...uniqueCategories.values()];
5864 case "UPDATE_CATEGORY": {
5865 if (!action.category || !Object.keys(action.category).length) {
5866 return state;
5867 }
5868 const categoryToChange = state.find(
5869 ({ slug }) => slug === action.slug
5870 );
5871 if (categoryToChange) {
5872 return state.map((category) => {
5873 if (category.slug === action.slug) {
5874 return {
5875 ...category,
5876 ...action.category
5877 };
5878 }
5879 return category;
5880 });
5881 }
5882 }
5883 }
5884 return state;
5885 }
5886 function collections(state = {}, action) {
5887 switch (action.type) {
5888 case "ADD_BLOCK_COLLECTION":
5889 return {
5890 ...state,
5891 [action.namespace]: {
5892 title: action.title,
5893 icon: action.icon
5894 }
5895 };
5896 case "REMOVE_BLOCK_COLLECTION":
5897 return omit(state, action.namespace);
5898 }
5899 return state;
5900 }
5901 function getMergedUsesContext(existingUsesContext = [], newUsesContext = []) {
5902 const mergedArrays = Array.from(
5903 new Set(existingUsesContext.concat(newUsesContext))
5904 );
5905 return mergedArrays.length > 0 ? mergedArrays : void 0;
5906 }
5907 function blockBindingsSources(state = {}, action) {
5908 switch (action.type) {
5909 case "ADD_BLOCK_BINDINGS_SOURCE":
5910 return {
5911 ...state,
5912 [action.name]: {
5913 label: action.label || state[action.name]?.label,
5914 usesContext: getMergedUsesContext(
5915 state[action.name]?.usesContext,
5916 action.usesContext
5917 ),
5918 getValues: action.getValues,
5919 setValues: action.setValues,
5920 // Only set `canUserEditValue` if `setValues` is also defined.
5921 canUserEditValue: action.setValues && action.canUserEditValue,
5922 getFieldsList: action.getFieldsList
5923 }
5924 };
5925 case "REMOVE_BLOCK_BINDINGS_SOURCE":
5926 return omit(state, action.name);
5927 }
5928 return state;
5929 }
5930 var reducer_default = (0, import_data2.combineReducers)({
5931 bootstrappedBlockTypes,
5932 unprocessedBlockTypes,
5933 blockTypes,
5934 blockStyles,
5935 blockVariations,
5936 defaultBlockName,
5937 freeformFallbackBlockName,
5938 unregisteredFallbackBlockName,
5939 groupingBlockName,
5940 categories,
5941 collections,
5942 blockBindingsSources
5943 });
5944
5945 // packages/blocks/build-module/store/selectors.mjs
5946 var selectors_exports = {};
5947 __export(selectors_exports, {
5948 __experimentalHasContentRoleAttribute: () => __experimentalHasContentRoleAttribute,
5949 getActiveBlockVariation: () => getActiveBlockVariation,
5950 getBlockStyles: () => getBlockStyles,
5951 getBlockSupport: () => getBlockSupport2,
5952 getBlockType: () => getBlockType2,
5953 getBlockTypes: () => getBlockTypes2,
5954 getBlockVariations: () => getBlockVariations2,
5955 getCategories: () => getCategories,
5956 getChildBlockNames: () => getChildBlockNames2,
5957 getCollections: () => getCollections,
5958 getDefaultBlockName: () => getDefaultBlockName2,
5959 getDefaultBlockVariation: () => getDefaultBlockVariation,
5960 getFreeformFallbackBlockName: () => getFreeformFallbackBlockName,
5961 getGroupingBlockName: () => getGroupingBlockName2,
5962 getUnregisteredFallbackBlockName: () => getUnregisteredFallbackBlockName,
5963 hasBlockSupport: () => hasBlockSupport2,
5964 hasChildBlocks: () => hasChildBlocks2,
5965 hasChildBlocksWithInserterSupport: () => hasChildBlocksWithInserterSupport2,
5966 isMatchingSearchTerm: () => isMatchingSearchTerm
5967 });
5968 var import_remove_accents = __toESM(require_remove_accents(), 1);
5969 var import_data4 = __toESM(require_data(), 1);
5970 var import_rich_text2 = __toESM(require_rich_text(), 1);
5971 var import_deprecated3 = __toESM(require_deprecated(), 1);
5972
5973 // packages/blocks/build-module/store/utils.mjs
5974 var getValueFromObjectPath = (object, path, defaultValue) => {
5975 const normalizedPath = Array.isArray(path) ? path : path.split(".");
5976 let value = object;
5977 normalizedPath.forEach((fieldName) => {
5978 value = value?.[fieldName];
5979 });
5980 return value ?? defaultValue;
5981 };
5982 function isObject2(candidate) {
5983 return typeof candidate === "object" && candidate !== null && candidate.constructor === Object;
5984 }
5985 function matchesAttributes(blockAttributes, variationAttributes) {
5986 if (isObject2(blockAttributes) && isObject2(variationAttributes)) {
5987 return Object.entries(variationAttributes).every(
5988 ([key, value]) => matchesAttributes(blockAttributes?.[key], value)
5989 );
5990 }
5991 return blockAttributes === variationAttributes;
5992 }
5993
5994 // packages/blocks/build-module/store/private-selectors.mjs
5995 var private_selectors_exports = {};
5996 __export(private_selectors_exports, {
5997 getAllBlockBindingsSources: () => getAllBlockBindingsSources,
5998 getBlockBindingsSource: () => getBlockBindingsSource2,
5999 getBlockBindingsSourceFieldsList: () => getBlockBindingsSourceFieldsList,
6000 getBootstrappedBlockType: () => getBootstrappedBlockType,
6001 getSupportedStyles: () => getSupportedStyles,
6002 getUnprocessedBlockTypes: () => getUnprocessedBlockTypes,
6003 hasContentRoleAttribute: () => hasContentRoleAttribute
6004 });
6005 var import_data3 = __toESM(require_data(), 1);
6006 var import_deprecated2 = __toESM(require_deprecated(), 1);
6007 var ROOT_BLOCK_SUPPORTS = [
6008 "background",
6009 "backgroundColor",
6010 "color",
6011 "linkColor",
6012 "captionColor",
6013 "buttonColor",
6014 "headingColor",
6015 "fontFamily",
6016 "fontSize",
6017 "fontStyle",
6018 "fontWeight",
6019 "lineHeight",
6020 "padding",
6021 "contentSize",
6022 "wideSize",
6023 "blockGap",
6024 "textAlign",
6025 "textDecoration",
6026 "textIndent",
6027 "textTransform",
6028 "letterSpacing"
6029 ];
6030 function filterElementBlockSupports(blockSupports, name, element) {
6031 return blockSupports.filter((support) => {
6032 if (support === "fontSize" && element === "heading") {
6033 return false;
6034 }
6035 if (support === "textDecoration" && !name && element !== "link") {
6036 return false;
6037 }
6038 if (support === "textTransform" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes(
6039 element
6040 ) || element === "button" || element === "caption" || element === "text")) {
6041 return false;
6042 }
6043 if (support === "letterSpacing" && !name && !(["heading", "h1", "h2", "h3", "h4", "h5", "h6"].includes(
6044 element
6045 ) || element === "button" || element === "caption" || element === "text")) {
6046 return false;
6047 }
6048 if (support === "textIndent" && !name) {
6049 return false;
6050 }
6051 if (support === "textColumns" && !name) {
6052 return false;
6053 }
6054 return true;
6055 });
6056 }
6057 var getSupportedStyles = (0, import_data3.createSelector)(
6058 (state, name, element) => {
6059 if (!name) {
6060 return filterElementBlockSupports(
6061 ROOT_BLOCK_SUPPORTS,
6062 name,
6063 element
6064 );
6065 }
6066 const blockType = getBlockType2(state, name);
6067 if (!blockType) {
6068 return [];
6069 }
6070 const supportKeys = [];
6071 const supports = blockType?.supports;
6072 if (supports?.spacing?.blockGap) {
6073 supportKeys.push("blockGap");
6074 }
6075 if (supports?.shadow) {
6076 supportKeys.push("shadow");
6077 }
6078 const stylePropertyMap = __EXPERIMENTAL_STYLE_PROPERTY;
6079 Object.keys(stylePropertyMap).forEach((styleName) => {
6080 if (!stylePropertyMap[styleName].support) {
6081 return;
6082 }
6083 if (stylePropertyMap[styleName].requiresOptOut) {
6084 if (supports && stylePropertyMap[styleName].support[0] in supports && getValueFromObjectPath(
6085 supports,
6086 stylePropertyMap[styleName].support
6087 ) !== false) {
6088 supportKeys.push(styleName);
6089 return;
6090 }
6091 }
6092 if (supports && getValueFromObjectPath(
6093 supports,
6094 stylePropertyMap[styleName].support,
6095 false
6096 )) {
6097 supportKeys.push(styleName);
6098 }
6099 });
6100 return filterElementBlockSupports(supportKeys, name, element);
6101 },
6102 (state, name) => [
6103 state.blockTypes[name]
6104 ]
6105 );
6106 function getBootstrappedBlockType(state, name) {
6107 return state.bootstrappedBlockTypes[name];
6108 }
6109 function getUnprocessedBlockTypes(state) {
6110 return state.unprocessedBlockTypes;
6111 }
6112 function getAllBlockBindingsSources(state) {
6113 return state.blockBindingsSources;
6114 }
6115 function getBlockBindingsSource2(state, sourceName) {
6116 return state.blockBindingsSources[sourceName];
6117 }
6118 var getBlockBindingsSourceFieldsList = (0, import_data3.createRegistrySelector)(
6119 (select3) => (0, import_data3.createSelector)(
6120 (state, source, blockContext) => {
6121 if (!source.getFieldsList) {
6122 return [];
6123 }
6124 const context = {};
6125 if (source?.usesContext?.length) {
6126 for (const key of source.usesContext) {
6127 context[key] = blockContext[key];
6128 }
6129 }
6130 return source.getFieldsList({ select: select3, context });
6131 },
6132 (state, source, blockContext) => [source.getFieldsList, source.usesContext, blockContext]
6133 )
6134 );
6135 var hasContentRoleAttribute = (state, blockTypeName) => {
6136 const blockType = getBlockType2(state, blockTypeName);
6137 if (!blockType) {
6138 return false;
6139 }
6140 return Object.values(blockType.attributes).some(
6141 ({ role, __experimentalRole }) => {
6142 if (role === "content") {
6143 return true;
6144 }
6145 if (__experimentalRole === "content") {
6146 (0, import_deprecated2.default)("__experimentalRole attribute", {
6147 since: "6.7",
6148 version: "6.8",
6149 alternative: "role attribute",
6150 hint: `Check the block.json of the ${blockTypeName} block.`
6151 });
6152 return true;
6153 }
6154 return false;
6155 }
6156 );
6157 };
6158
6159 // packages/blocks/build-module/store/selectors.mjs
6160 var getNormalizedBlockType = (state, nameOrType) => "string" === typeof nameOrType ? getBlockType2(state, nameOrType) : nameOrType;
6161 var getBlockTypes2 = (0, import_data4.createSelector)(
6162 (state) => Object.values(state.blockTypes),
6163 (state) => [state.blockTypes]
6164 );
6165 function getBlockType2(state, name) {
6166 return state.blockTypes[name];
6167 }
6168 function getBlockStyles(state, name) {
6169 return state.blockStyles[name];
6170 }
6171 var getBlockVariations2 = (0, import_data4.createSelector)(
6172 (state, blockName, scope) => {
6173 const variations = state.blockVariations[blockName];
6174 if (!variations || !scope) {
6175 return variations;
6176 }
6177 return variations.filter((variation) => {
6178 return (variation.scope || ["block", "inserter"]).includes(
6179 scope
6180 );
6181 });
6182 },
6183 (state, blockName) => [
6184 state.blockVariations[blockName]
6185 ]
6186 );
6187 function getActiveBlockVariation(state, blockName, attributes, scope) {
6188 const variations = getBlockVariations2(state, blockName, scope);
6189 if (!variations) {
6190 return variations;
6191 }
6192 const blockType = getBlockType2(state, blockName);
6193 const attributeKeys = Object.keys(blockType?.attributes || {});
6194 let match;
6195 let maxMatchedAttributes = 0;
6196 for (const variation of variations) {
6197 if (Array.isArray(variation.isActive)) {
6198 const definedAttributes = variation.isActive.filter(
6199 (attribute) => {
6200 const topLevelAttribute = attribute.split(".")[0];
6201 return attributeKeys.includes(topLevelAttribute);
6202 }
6203 );
6204 const definedAttributesLength = definedAttributes.length;
6205 if (definedAttributesLength === 0) {
6206 continue;
6207 }
6208 const isMatch = definedAttributes.every((attribute) => {
6209 const variationAttributeValue = getValueFromObjectPath(
6210 variation.attributes,
6211 attribute
6212 );
6213 if (variationAttributeValue === void 0) {
6214 return false;
6215 }
6216 let blockAttributeValue = getValueFromObjectPath(
6217 attributes,
6218 attribute
6219 );
6220 if (blockAttributeValue instanceof import_rich_text2.RichTextData) {
6221 blockAttributeValue = blockAttributeValue.toHTMLString();
6222 }
6223 return matchesAttributes(
6224 blockAttributeValue,
6225 variationAttributeValue
6226 );
6227 });
6228 if (isMatch && definedAttributesLength > maxMatchedAttributes) {
6229 match = variation;
6230 maxMatchedAttributes = definedAttributesLength;
6231 }
6232 } else if (variation.isActive?.(
6233 attributes,
6234 variation.attributes
6235 )) {
6236 return match || variation;
6237 }
6238 }
6239 if (!match && ["block", "transform"].includes(scope)) {
6240 match = variations.find(
6241 (variation) => variation?.isDefault && !Object.hasOwn(variation, "isActive")
6242 );
6243 }
6244 return match;
6245 }
6246 function getDefaultBlockVariation(state, blockName, scope) {
6247 const variations = getBlockVariations2(state, blockName, scope);
6248 const defaultVariation = [...variations || []].reverse().find(({ isDefault }) => !!isDefault);
6249 return defaultVariation || variations?.[0];
6250 }
6251 function getCategories(state) {
6252 return state.categories;
6253 }
6254 function getCollections(state) {
6255 return state.collections;
6256 }
6257 function getDefaultBlockName2(state) {
6258 return state.defaultBlockName;
6259 }
6260 function getFreeformFallbackBlockName(state) {
6261 return state.freeformFallbackBlockName;
6262 }
6263 function getUnregisteredFallbackBlockName(state) {
6264 return state.unregisteredFallbackBlockName;
6265 }
6266 function getGroupingBlockName2(state) {
6267 return state.groupingBlockName;
6268 }
6269 var getChildBlockNames2 = (0, import_data4.createSelector)(
6270 (state, blockName) => {
6271 return getBlockTypes2(state).filter((blockType) => {
6272 return blockType.parent?.includes(blockName);
6273 }).map(({ name }) => name);
6274 },
6275 (state) => [state.blockTypes]
6276 );
6277 var getBlockSupport2 = (state, nameOrType, feature, defaultSupports) => {
6278 const blockType = getNormalizedBlockType(state, nameOrType);
6279 if (!blockType?.supports) {
6280 return defaultSupports;
6281 }
6282 return getValueFromObjectPath(
6283 blockType.supports,
6284 feature,
6285 defaultSupports
6286 );
6287 };
6288 function hasBlockSupport2(state, nameOrType, feature, defaultSupports) {
6289 return !!getBlockSupport2(state, nameOrType, feature, defaultSupports);
6290 }
6291 function getNormalizedSearchTerm(term) {
6292 return (0, import_remove_accents.default)(term ?? "").toLowerCase().trim();
6293 }
6294 function isMatchingSearchTerm(state, nameOrType, searchTerm = "") {
6295 const blockType = getNormalizedBlockType(state, nameOrType);
6296 const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
6297 const isSearchMatch = (candidate) => getNormalizedSearchTerm(candidate).includes(normalizedSearchTerm);
6298 return isSearchMatch(blockType?.title) || blockType?.keywords?.some(isSearchMatch) || isSearchMatch(blockType?.category) || typeof blockType?.description === "string" && isSearchMatch(blockType.description);
6299 }
6300 var hasChildBlocks2 = (state, blockName) => {
6301 return getChildBlockNames2(state, blockName).length > 0;
6302 };
6303 var hasChildBlocksWithInserterSupport2 = (state, blockName) => {
6304 return getChildBlockNames2(state, blockName).some((childBlockName) => {
6305 return hasBlockSupport2(state, childBlockName, "inserter", true);
6306 });
6307 };
6308 var __experimentalHasContentRoleAttribute = (...args) => {
6309 (0, import_deprecated3.default)("__experimentalHasContentRoleAttribute", {
6310 since: "6.7",
6311 version: "6.8",
6312 hint: "This is a private selector."
6313 });
6314 return hasContentRoleAttribute(...args);
6315 };
6316
6317 // packages/blocks/build-module/store/actions.mjs
6318 var actions_exports = {};
6319 __export(actions_exports, {
6320 __experimentalReapplyBlockFilters: () => __experimentalReapplyBlockFilters,
6321 addBlockCollection: () => addBlockCollection,
6322 addBlockStyles: () => addBlockStyles,
6323 addBlockTypes: () => addBlockTypes,
6324 addBlockVariations: () => addBlockVariations,
6325 reapplyBlockTypeFilters: () => reapplyBlockTypeFilters,
6326 removeBlockCollection: () => removeBlockCollection,
6327 removeBlockStyles: () => removeBlockStyles,
6328 removeBlockTypes: () => removeBlockTypes,
6329 removeBlockVariations: () => removeBlockVariations,
6330 setCategories: () => setCategories,
6331 setDefaultBlockName: () => setDefaultBlockName2,
6332 setFreeformFallbackBlockName: () => setFreeformFallbackBlockName,
6333 setGroupingBlockName: () => setGroupingBlockName2,
6334 setUnregisteredFallbackBlockName: () => setUnregisteredFallbackBlockName,
6335 updateCategory: () => updateCategory
6336 });
6337 var import_deprecated5 = __toESM(require_deprecated(), 1);
6338
6339 // node_modules/is-plain-object/dist/is-plain-object.mjs
6340 function isObject3(o3) {
6341 return Object.prototype.toString.call(o3) === "[object Object]";
6342 }
6343 function isPlainObject(o3) {
6344 var ctor, prot;
6345 if (isObject3(o3) === false) return false;
6346 ctor = o3.constructor;
6347 if (ctor === void 0) return true;
6348 prot = ctor.prototype;
6349 if (isObject3(prot) === false) return false;
6350 if (prot.hasOwnProperty("isPrototypeOf") === false) {
6351 return false;
6352 }
6353 return true;
6354 }
6355
6356 // packages/blocks/build-module/store/process-block-type.mjs
6357 var import_react_is = __toESM(require_react_is(), 1);
6358 var import_deprecated4 = __toESM(require_deprecated(), 1);
6359 var import_hooks = __toESM(require_hooks(), 1);
6360 var import_warning2 = __toESM(require_warning(), 1);
6361 var LEGACY_CATEGORY_MAPPING = {
6362 common: "text",
6363 formatting: "text",
6364 layout: "design"
6365 };
6366 function mergeBlockVariations(bootstrappedVariations = [], clientVariations = []) {
6367 const result = [...bootstrappedVariations];
6368 clientVariations.forEach((clientVariation) => {
6369 const index = result.findIndex(
6370 (bootstrappedVariation) => bootstrappedVariation.name === clientVariation.name
6371 );
6372 if (index !== -1) {
6373 result[index] = { ...result[index], ...clientVariation };
6374 } else {
6375 result.push(clientVariation);
6376 }
6377 });
6378 return result;
6379 }
6380 var processBlockType = (name, blockSettings) => ({
6381 select: select3
6382 }) => {
6383 const bootstrappedBlockType = select3.getBootstrappedBlockType(name);
6384 const blockType = {
6385 apiVersion: 1,
6386 name,
6387 icon: BLOCK_ICON_DEFAULT,
6388 keywords: [],
6389 attributes: {},
6390 providesContext: {},
6391 usesContext: [],
6392 selectors: {},
6393 supports: {},
6394 styles: [],
6395 blockHooks: {},
6396 save: () => null,
6397 ...bootstrappedBlockType,
6398 ...blockSettings,
6399 // blockType.variations can be defined as a filePath.
6400 variations: mergeBlockVariations(
6401 Array.isArray(bootstrappedBlockType?.variations) ? bootstrappedBlockType.variations : [],
6402 Array.isArray(blockSettings?.variations) ? blockSettings.variations : []
6403 )
6404 };
6405 if (!blockType.attributes || typeof blockType.attributes !== "object") {
6406 (0, import_warning2.default)(
6407 'The block "' + name + '" is registering attributes as `null` or `undefined`. Use an empty object (`attributes: {}`) or exclude the `attributes` key.'
6408 );
6409 blockType.attributes = {};
6410 }
6411 const settings = (0, import_hooks.applyFilters)(
6412 "blocks.registerBlockType",
6413 blockType,
6414 name,
6415 null
6416 );
6417 if (settings.apiVersion <= 2) {
6418 (0, import_deprecated4.default)("Block with API version 2 or lower", {
6419 since: "6.9",
6420 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.`,
6421 link: "https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/"
6422 });
6423 }
6424 if (settings.description && typeof settings.description !== "string") {
6425 (0, import_deprecated4.default)("Declaring non-string block descriptions", {
6426 since: "6.2"
6427 });
6428 }
6429 if (settings.deprecated) {
6430 settings.deprecated = settings.deprecated.map(
6431 (deprecation) => Object.fromEntries(
6432 Object.entries(
6433 // Only keep valid deprecation keys.
6434 (0, import_hooks.applyFilters)(
6435 "blocks.registerBlockType",
6436 // Merge deprecation keys with pre-filter settings
6437 // so that filters that depend on specific keys being
6438 // present don't fail.
6439 {
6440 // Omit deprecation keys here so that deprecations
6441 // can opt out of specific keys like "supports".
6442 ...omit(blockType, DEPRECATED_ENTRY_KEYS),
6443 ...deprecation
6444 },
6445 blockType.name,
6446 deprecation
6447 )
6448 ).filter(
6449 ([key]) => DEPRECATED_ENTRY_KEYS.includes(key)
6450 )
6451 )
6452 );
6453 }
6454 if (!isPlainObject(settings)) {
6455 (0, import_warning2.default)("Block settings must be a valid object.");
6456 return;
6457 }
6458 if (typeof settings.save !== "function") {
6459 (0, import_warning2.default)('The "save" property must be a valid function.');
6460 return;
6461 }
6462 if ("edit" in settings && !(0, import_react_is.isValidElementType)(settings.edit)) {
6463 (0, import_warning2.default)('The "edit" property must be a valid component.');
6464 return;
6465 }
6466 if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
6467 settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
6468 }
6469 if ("category" in settings && !select3.getCategories().some(
6470 ({ slug }) => slug === settings.category
6471 )) {
6472 (0, import_warning2.default)(
6473 'The block "' + name + '" is registered with an invalid category "' + settings.category + '".'
6474 );
6475 delete settings.category;
6476 }
6477 if (!("title" in settings) || settings.title === "") {
6478 (0, import_warning2.default)('The block "' + name + '" must have a title.');
6479 return;
6480 }
6481 if (typeof settings.title !== "string") {
6482 (0, import_warning2.default)("Block titles must be strings.");
6483 return;
6484 }
6485 settings.icon = normalizeIconObject(settings.icon);
6486 if (!isValidIcon(settings.icon.src)) {
6487 (0, import_warning2.default)(
6488 "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"
6489 );
6490 return;
6491 }
6492 if (typeof settings?.parent === "string" || settings?.parent instanceof String) {
6493 settings.parent = [settings.parent];
6494 (0, import_warning2.default)(
6495 "Parent must be undefined or an array of strings (block types), but it is a string."
6496 );
6497 }
6498 if (!Array.isArray(settings?.parent) && settings?.parent !== void 0) {
6499 (0, import_warning2.default)(
6500 "Parent must be undefined or an array of block types, but it is " + settings.parent
6501 );
6502 return;
6503 }
6504 if (1 === settings?.parent?.length && name === settings.parent[0]) {
6505 (0, import_warning2.default)(
6506 'Block "' + name + '" cannot be a parent of itself. Please remove the block name from the parent list.'
6507 );
6508 return;
6509 }
6510 return settings;
6511 };
6512
6513 // packages/blocks/build-module/store/actions.mjs
6514 function addBlockTypes(blockTypes2) {
6515 return {
6516 type: "ADD_BLOCK_TYPES",
6517 blockTypes: Array.isArray(blockTypes2) ? blockTypes2 : [blockTypes2]
6518 };
6519 }
6520 function reapplyBlockTypeFilters() {
6521 return ({ dispatch: dispatch3, select: select3 }) => {
6522 const processedBlockTypes = [];
6523 for (const [name, settings] of Object.entries(
6524 select3.getUnprocessedBlockTypes()
6525 )) {
6526 const result = dispatch3(processBlockType(name, settings));
6527 if (result) {
6528 processedBlockTypes.push(result);
6529 }
6530 }
6531 if (!processedBlockTypes.length) {
6532 return;
6533 }
6534 dispatch3.addBlockTypes(processedBlockTypes);
6535 };
6536 }
6537 function __experimentalReapplyBlockFilters() {
6538 (0, import_deprecated5.default)(
6539 'wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters',
6540 {
6541 since: "6.4",
6542 alternative: "reapplyBlockFilters"
6543 }
6544 );
6545 return reapplyBlockTypeFilters();
6546 }
6547 function removeBlockTypes(names) {
6548 return {
6549 type: "REMOVE_BLOCK_TYPES",
6550 names: Array.isArray(names) ? names : [names]
6551 };
6552 }
6553 function addBlockStyles(blockNames, styles) {
6554 return {
6555 type: "ADD_BLOCK_STYLES",
6556 styles: Array.isArray(styles) ? styles : [styles],
6557 blockNames: Array.isArray(blockNames) ? blockNames : [blockNames]
6558 };
6559 }
6560 function removeBlockStyles(blockName, styleNames) {
6561 return {
6562 type: "REMOVE_BLOCK_STYLES",
6563 styleNames: Array.isArray(styleNames) ? styleNames : [styleNames],
6564 blockName
6565 };
6566 }
6567 function addBlockVariations(blockName, variations) {
6568 return {
6569 type: "ADD_BLOCK_VARIATIONS",
6570 variations: Array.isArray(variations) ? variations : [variations],
6571 blockName
6572 };
6573 }
6574 function removeBlockVariations(blockName, variationNames) {
6575 return {
6576 type: "REMOVE_BLOCK_VARIATIONS",
6577 variationNames: Array.isArray(variationNames) ? variationNames : [variationNames],
6578 blockName
6579 };
6580 }
6581 function setDefaultBlockName2(name) {
6582 return {
6583 type: "SET_DEFAULT_BLOCK_NAME",
6584 name
6585 };
6586 }
6587 function setFreeformFallbackBlockName(name) {
6588 return {
6589 type: "SET_FREEFORM_FALLBACK_BLOCK_NAME",
6590 name
6591 };
6592 }
6593 function setUnregisteredFallbackBlockName(name) {
6594 return {
6595 type: "SET_UNREGISTERED_FALLBACK_BLOCK_NAME",
6596 name
6597 };
6598 }
6599 function setGroupingBlockName2(name) {
6600 return {
6601 type: "SET_GROUPING_BLOCK_NAME",
6602 name
6603 };
6604 }
6605 function setCategories(categories2) {
6606 return {
6607 type: "SET_CATEGORIES",
6608 categories: categories2
6609 };
6610 }
6611 function updateCategory(slug, category) {
6612 return {
6613 type: "UPDATE_CATEGORY",
6614 slug,
6615 category
6616 };
6617 }
6618 function addBlockCollection(namespace, title, icon) {
6619 return {
6620 type: "ADD_BLOCK_COLLECTION",
6621 namespace,
6622 title,
6623 icon
6624 };
6625 }
6626 function removeBlockCollection(namespace) {
6627 return {
6628 type: "REMOVE_BLOCK_COLLECTION",
6629 namespace
6630 };
6631 }
6632
6633 // packages/blocks/build-module/store/private-actions.mjs
6634 var private_actions_exports = {};
6635 __export(private_actions_exports, {
6636 addBlockBindingsSource: () => addBlockBindingsSource,
6637 addBootstrappedBlockType: () => addBootstrappedBlockType,
6638 addUnprocessedBlockType: () => addUnprocessedBlockType,
6639 removeBlockBindingsSource: () => removeBlockBindingsSource
6640 });
6641 function addBootstrappedBlockType(name, blockType) {
6642 return {
6643 type: "ADD_BOOTSTRAPPED_BLOCK_TYPE",
6644 name,
6645 blockType
6646 };
6647 }
6648 function addUnprocessedBlockType(name, blockType) {
6649 return ({ dispatch: dispatch3 }) => {
6650 dispatch3({ type: "ADD_UNPROCESSED_BLOCK_TYPE", name, blockType });
6651 const processedBlockType = dispatch3(
6652 processBlockType(name, blockType)
6653 );
6654 if (!processedBlockType) {
6655 return;
6656 }
6657 dispatch3.addBlockTypes(processedBlockType);
6658 };
6659 }
6660 function addBlockBindingsSource(source) {
6661 return {
6662 type: "ADD_BLOCK_BINDINGS_SOURCE",
6663 name: source.name,
6664 label: source.label,
6665 usesContext: source.usesContext,
6666 getValues: source.getValues,
6667 setValues: source.setValues,
6668 canUserEditValue: source.canUserEditValue,
6669 getFieldsList: source.getFieldsList
6670 };
6671 }
6672 function removeBlockBindingsSource(name) {
6673 return {
6674 type: "REMOVE_BLOCK_BINDINGS_SOURCE",
6675 name
6676 };
6677 }
6678
6679 // packages/blocks/build-module/store/constants.mjs
6680 var STORE_NAME = "core/blocks";
6681
6682 // packages/blocks/build-module/store/index.mjs
6683 var store = (0, import_data5.createReduxStore)(STORE_NAME, {
6684 reducer: reducer_default,
6685 selectors: selectors_exports,
6686 actions: actions_exports
6687 });
6688 (0, import_data5.register)(store);
6689 unlock(store).registerPrivateSelectors(private_selectors_exports);
6690 unlock(store).registerPrivateActions(private_actions_exports);
6691
6692 // node_modules/uuid/dist/stringify.js
6693 var byteToHex = [];
6694 for (let i2 = 0; i2 < 256; ++i2) {
6695 byteToHex.push((i2 + 256).toString(16).slice(1));
6696 }
6697 function unsafeStringify(arr, offset = 0) {
6698 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]]).toLowerCase();
6699 }
6700
6701 // node_modules/uuid/dist/rng.js
6702 var rnds8 = new Uint8Array(16);
6703 function rng() {
6704 return crypto.getRandomValues(rnds8);
6705 }
6706
6707 // node_modules/uuid/dist/v4.js
6708 function v4(options, buf, offset) {
6709 if (!buf && !options && crypto.randomUUID) {
6710 return crypto.randomUUID();
6711 }
6712 return _v4(options, buf, offset);
6713 }
6714 function _v4(options, buf, offset) {
6715 options = options || {};
6716 const rnds = options.random ?? options.rng?.() ?? rng();
6717 if (rnds.length < 16) {
6718 throw new Error("Random bytes length must be >= 16");
6719 }
6720 rnds[6] = rnds[6] & 15 | 64;
6721 rnds[8] = rnds[8] & 63 | 128;
6722 if (buf) {
6723 offset = offset || 0;
6724 if (offset < 0 || offset + 16 > buf.length) {
6725 throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
6726 }
6727 for (let i2 = 0; i2 < 16; ++i2) {
6728 buf[offset + i2] = rnds[i2];
6729 }
6730 return buf;
6731 }
6732 return unsafeStringify(rnds);
6733 }
6734 var v4_default = v4;
6735
6736 // packages/blocks/build-module/api/factory.mjs
6737 var import_hooks2 = __toESM(require_hooks(), 1);
6738 function createBlock(name, attributes = {}, innerBlocks = []) {
6739 if (!isBlockRegistered(name)) {
6740 return createBlock("core/missing", {
6741 originalName: name,
6742 originalContent: "",
6743 originalUndelimitedContent: ""
6744 });
6745 }
6746 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(
6747 name,
6748 attributes
6749 );
6750 const clientId = v4_default();
6751 return {
6752 clientId,
6753 name,
6754 isValid: true,
6755 attributes: sanitizedAttributes,
6756 innerBlocks
6757 };
6758 }
6759 function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) {
6760 return innerBlocksOrTemplate.map((innerBlock) => {
6761 const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [
6762 innerBlock.name,
6763 innerBlock.attributes,
6764 innerBlock.innerBlocks
6765 ];
6766 const [name, attributes, innerBlocks = []] = innerBlockTemplate;
6767 return createBlock(
6768 name,
6769 attributes,
6770 createBlocksFromInnerBlocksTemplate(
6771 innerBlocks
6772 )
6773 );
6774 });
6775 }
6776 function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) {
6777 const { name } = block;
6778 if (!isBlockRegistered(name)) {
6779 return createBlock("core/missing", {
6780 originalName: name,
6781 originalContent: "",
6782 originalUndelimitedContent: ""
6783 });
6784 }
6785 const clientId = v4_default();
6786 const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, {
6787 ...block.attributes,
6788 ...mergeAttributes
6789 });
6790 return {
6791 ...block,
6792 clientId,
6793 attributes: sanitizedAttributes,
6794 innerBlocks: newInnerBlocks || block.innerBlocks.map(
6795 (innerBlock) => __experimentalCloneSanitizedBlock(innerBlock)
6796 )
6797 };
6798 }
6799 function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) {
6800 const clientId = v4_default();
6801 return {
6802 ...block,
6803 clientId,
6804 attributes: {
6805 ...block.attributes,
6806 ...mergeAttributes
6807 },
6808 innerBlocks: newInnerBlocks || block.innerBlocks.map((innerBlock) => cloneBlock(innerBlock))
6809 };
6810 }
6811 var isPossibleTransformForSource = (transform, direction, blocks) => {
6812 if (!blocks.length) {
6813 return false;
6814 }
6815 const isMultiBlock = blocks.length > 1;
6816 const firstBlockName = blocks[0].name;
6817 const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
6818 if (!isValidForMultiBlocks) {
6819 return false;
6820 }
6821 if (!isWildcardBlockTransform(transform) && !blocks.every((block) => block.name === firstBlockName)) {
6822 return false;
6823 }
6824 const isBlockType = transform.type === "block";
6825 if (!isBlockType) {
6826 return false;
6827 }
6828 const sourceBlock = blocks[0];
6829 const hasMatchingName = direction !== "from" || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
6830 if (!hasMatchingName) {
6831 return false;
6832 }
6833 if (!isMultiBlock && direction === "from" && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) {
6834 return false;
6835 }
6836 if (!maybeCheckTransformIsMatch(transform, blocks)) {
6837 return false;
6838 }
6839 return true;
6840 };
6841 var getBlockTypesForPossibleFromTransforms = (blocks) => {
6842 if (!blocks.length) {
6843 return [];
6844 }
6845 const allBlockTypes = getBlockTypes();
6846 const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(
6847 (blockType) => {
6848 const fromTransforms = getBlockTransforms("from", blockType.name);
6849 return !!findTransform(fromTransforms, (transform) => {
6850 return isPossibleTransformForSource(
6851 transform,
6852 "from",
6853 blocks
6854 );
6855 });
6856 }
6857 );
6858 return blockTypesWithPossibleFromTransforms;
6859 };
6860 var getBlockTypesForPossibleToTransforms = (blocks) => {
6861 if (!blocks.length) {
6862 return [];
6863 }
6864 const sourceBlock = blocks[0];
6865 const blockType = getBlockType(sourceBlock.name);
6866 const transformsTo = blockType ? getBlockTransforms("to", blockType.name) : [];
6867 const possibleTransforms = transformsTo.filter((transform) => {
6868 return transform && isPossibleTransformForSource(transform, "to", blocks);
6869 });
6870 const blockNames = possibleTransforms.map((transformation) => transformation.blocks).flat();
6871 return blockNames.filter((name) => !!name).map(getBlockType).filter((bt) => !!bt);
6872 };
6873 var isWildcardBlockTransform = (t3) => !!t3 && t3.type === "block" && Array.isArray(t3.blocks) && t3.blocks.includes("*");
6874 var isContainerGroupBlock = (name) => name === getGroupingBlockName();
6875 function getPossibleBlockTransformations(blocks) {
6876 if (!blocks.length) {
6877 return [];
6878 }
6879 const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks);
6880 const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks);
6881 return [
6882 .../* @__PURE__ */ new Set([
6883 ...blockTypesForFromTransforms,
6884 ...blockTypesForToTransforms
6885 ])
6886 ];
6887 }
6888 function findTransform(transforms, predicate) {
6889 const hooks = (0, import_hooks2.createHooks)();
6890 for (let i2 = 0; i2 < transforms.length; i2++) {
6891 const candidate = transforms[i2];
6892 if (predicate(candidate)) {
6893 hooks.addFilter(
6894 "transform",
6895 "transform/" + i2.toString(),
6896 (result) => result ? result : candidate,
6897 candidate.priority
6898 );
6899 }
6900 }
6901 return hooks.applyFilters("transform", null);
6902 }
6903 function getBlockTransforms(direction, blockTypeOrName) {
6904 if (blockTypeOrName === void 0) {
6905 return getBlockTypes().map(({ name }) => getBlockTransforms(direction, name)).flat();
6906 }
6907 const blockType = normalizeBlockType(blockTypeOrName);
6908 const { name: blockName, transforms } = blockType || {};
6909 const directionTransforms = transforms?.[direction];
6910 if (!transforms || !Array.isArray(directionTransforms)) {
6911 return [];
6912 }
6913 const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms);
6914 const filteredTransforms = usingMobileTransformations ? directionTransforms.filter((t3) => {
6915 if (t3.type === "raw") {
6916 return true;
6917 }
6918 if (t3.type === "prefix") {
6919 return true;
6920 }
6921 if (!t3.blocks || !t3.blocks.length) {
6922 return false;
6923 }
6924 if (isWildcardBlockTransform(t3)) {
6925 return true;
6926 }
6927 return t3.blocks.every(
6928 (transformBlockName) => transforms.supportedMobileTransforms.includes(
6929 transformBlockName
6930 )
6931 );
6932 }) : directionTransforms;
6933 return filteredTransforms.map((transform) => ({
6934 ...transform,
6935 blockName,
6936 usingMobileTransformations
6937 }));
6938 }
6939 function maybeCheckTransformIsMatch(transform, blocks) {
6940 if (typeof transform.isMatch !== "function") {
6941 return true;
6942 }
6943 const sourceBlock = blocks[0];
6944 const attributes = transform.isMultiBlock ? blocks.map((block2) => block2.attributes) : sourceBlock.attributes;
6945 const block = transform.isMultiBlock ? blocks : sourceBlock;
6946 return transform.isMatch(attributes, block);
6947 }
6948 function switchToBlockType(blocks, name) {
6949 const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
6950 const isMultiBlock = blocksArray.length > 1;
6951 const firstBlock = blocksArray[0];
6952 const sourceName = firstBlock.name;
6953 const transformationsFrom = getBlockTransforms("from", name);
6954 const transformationsTo = getBlockTransforms("to", sourceName);
6955 const transformation = findTransform(
6956 transformationsTo,
6957 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(name) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray)
6958 ) || findTransform(
6959 transformationsFrom,
6960 (t3) => t3.type === "block" && (isWildcardBlockTransform(t3) || t3.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || !!t3.isMultiBlock) && maybeCheckTransformIsMatch(t3, blocksArray)
6961 );
6962 if (!transformation) {
6963 return null;
6964 }
6965 let transformationResults;
6966 if (transformation.isMultiBlock) {
6967 if ("__experimentalConvert" in transformation) {
6968 transformationResults = transformation.__experimentalConvert(blocksArray);
6969 } else {
6970 transformationResults = transformation.transform(
6971 blocksArray.map((currentBlock) => currentBlock.attributes),
6972 blocksArray.map((currentBlock) => currentBlock.innerBlocks)
6973 );
6974 }
6975 } else if ("__experimentalConvert" in transformation) {
6976 transformationResults = transformation.__experimentalConvert(firstBlock);
6977 } else {
6978 transformationResults = transformation.transform(
6979 firstBlock.attributes,
6980 firstBlock.innerBlocks
6981 );
6982 }
6983 if (transformationResults === null || typeof transformationResults !== "object") {
6984 return null;
6985 }
6986 transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults];
6987 if (transformationResults.some(
6988 (result) => !getBlockType(result.name)
6989 )) {
6990 return null;
6991 }
6992 const hasSwitchedBlock = transformationResults.some(
6993 (result) => result.name === name
6994 );
6995 if (!hasSwitchedBlock) {
6996 return null;
6997 }
6998 const ret = transformationResults.map((result, index, results) => {
6999 return (0, import_hooks2.applyFilters)(
7000 "blocks.switchToBlockType.transformedBlock",
7001 result,
7002 blocks,
7003 index,
7004 results
7005 );
7006 });
7007 return ret;
7008 }
7009 var getBlockFromExample = (name, example) => createBlock(
7010 name,
7011 example.attributes,
7012 (example.innerBlocks ?? []).map(
7013 (innerBlock) => getBlockFromExample(innerBlock.name, innerBlock)
7014 )
7015 );
7016
7017 // packages/blocks/build-module/api/parser/index.mjs
7018 var import_block_serialization_default_parser = __toESM(require_block_serialization_default_parser(), 1);
7019 var import_autop2 = __toESM(require_autop(), 1);
7020
7021 // packages/blocks/build-module/api/serializer.mjs
7022 var import_element2 = __toESM(require_element(), 1);
7023 var import_hooks3 = __toESM(require_hooks(), 1);
7024 var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1);
7025 var import_autop = __toESM(require_autop(), 1);
7026 var import_deprecated6 = __toESM(require_deprecated(), 1);
7027
7028 // packages/blocks/build-module/api/parser/serialize-raw-block.mjs
7029 function serializeRawBlock(rawBlock, options = {}) {
7030 const { isCommentDelimited = true } = options;
7031 const {
7032 blockName,
7033 attrs = {},
7034 innerBlocks = [],
7035 innerContent = []
7036 } = rawBlock;
7037 let childIndex = 0;
7038 const content = innerContent.map(
7039 (item) => (
7040 // `null` denotes a nested block, otherwise we have an HTML fragment.
7041 item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)
7042 )
7043 ).join("\n").replace(/\n+/g, "\n").trim();
7044 return isCommentDelimited ? getCommentDelimitedContent(blockName ?? void 0, attrs, content) : content;
7045 }
7046
7047 // packages/blocks/build-module/api/serializer.mjs
7048 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
7049 function getBlockDefaultClassName(blockName) {
7050 const className = "wp-block-" + blockName.replace(/\//, "-").replace(/^core-/, "");
7051 return (0, import_hooks3.applyFilters)(
7052 "blocks.getBlockDefaultClassName",
7053 className,
7054 blockName
7055 );
7056 }
7057 function getBlockMenuDefaultClassName(blockName) {
7058 const className = "editor-block-list-item-" + blockName.replace(/\//, "-").replace(/^core-/, "");
7059 return (0, import_hooks3.applyFilters)(
7060 "blocks.getBlockMenuDefaultClassName",
7061 className,
7062 blockName
7063 );
7064 }
7065 var blockPropsProvider = {};
7066 var innerBlocksPropsProvider = {};
7067 function getBlockProps(props = {}) {
7068 const { blockType, attributes } = blockPropsProvider;
7069 return getBlockProps.skipFilters ? props : (0, import_hooks3.applyFilters)(
7070 "blocks.getSaveContent.extraProps",
7071 { ...props },
7072 blockType,
7073 attributes
7074 );
7075 }
7076 function getInnerBlocksProps(props = {}) {
7077 const { innerBlocks } = innerBlocksPropsProvider;
7078 if (!Array.isArray(innerBlocks)) {
7079 return { ...props, children: innerBlocks };
7080 }
7081 const html2 = serialize(innerBlocks, { isInnerBlocks: true });
7082 const children = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element2.RawHTML, { children: html2 });
7083 return { ...props, children };
7084 }
7085 function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) {
7086 const blockType = normalizeBlockType(blockTypeOrName);
7087 if (!blockType?.save) {
7088 return null;
7089 }
7090 let save = blockType.save;
7091 if (save.prototype instanceof import_element2.Component) {
7092 const SaveClass = save;
7093 const instance = new SaveClass({ attributes });
7094 save = instance.render.bind(instance);
7095 }
7096 blockPropsProvider.blockType = blockType;
7097 blockPropsProvider.attributes = attributes;
7098 innerBlocksPropsProvider.innerBlocks = innerBlocks;
7099 let element = save({
7100 attributes,
7101 innerBlocks
7102 });
7103 if (element !== null && typeof element === "object" && (0, import_hooks3.hasFilter)("blocks.getSaveContent.extraProps") && !((blockType.apiVersion ?? 0) > 1)) {
7104 const props = (0, import_hooks3.applyFilters)(
7105 "blocks.getSaveContent.extraProps",
7106 { ...element.props },
7107 blockType,
7108 attributes
7109 );
7110 if (!(0, import_is_shallow_equal.isShallowEqual)(props, element.props)) {
7111 element = (0, import_element2.cloneElement)(
7112 element,
7113 props
7114 );
7115 }
7116 }
7117 return (0, import_hooks3.applyFilters)(
7118 "blocks.getSaveElement",
7119 element,
7120 blockType,
7121 attributes
7122 );
7123 }
7124 function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
7125 const blockType = normalizeBlockType(
7126 blockTypeOrName
7127 );
7128 if (!blockType) {
7129 return "";
7130 }
7131 return (0, import_element2.renderToString)(
7132 getSaveElement(blockType, attributes, innerBlocks)
7133 );
7134 }
7135 function getCommentAttributes(blockType, attributes) {
7136 return Object.entries(blockType.attributes ?? {}).reduce(
7137 (accumulator, [key, attributeSchema]) => {
7138 const value = attributes[key];
7139 if (void 0 === value) {
7140 return accumulator;
7141 }
7142 if (attributeSchema.source !== void 0) {
7143 return accumulator;
7144 }
7145 if (attributeSchema.role === "local") {
7146 return accumulator;
7147 }
7148 if (attributeSchema.__experimentalRole === "local") {
7149 (0, import_deprecated6.default)("__experimentalRole attribute", {
7150 since: "6.7",
7151 version: "6.8",
7152 alternative: "role attribute",
7153 hint: `Check the block.json of the ${blockType?.name} block.`
7154 });
7155 return accumulator;
7156 }
7157 if ("default" in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) {
7158 return accumulator;
7159 }
7160 accumulator[key] = value;
7161 return accumulator;
7162 },
7163 {}
7164 );
7165 }
7166 function serializeAttributes(attributes) {
7167 return JSON.stringify(attributes).replaceAll("\\\\", "\\u005c").replaceAll("--", "\\u002d\\u002d").replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("&", "\\u0026").replaceAll('\\"', "\\u0022");
7168 }
7169 function getBlockInnerHTML(block) {
7170 let saveContent = block.originalContent ?? "";
7171 if (block.isValid || block.innerBlocks.length) {
7172 try {
7173 saveContent = getSaveContent(
7174 block.name,
7175 block.attributes,
7176 block.innerBlocks
7177 );
7178 } catch {
7179 }
7180 }
7181 return saveContent;
7182 }
7183 function getCommentDelimitedContent(rawBlockName, attributes, content) {
7184 const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + " " : "";
7185 const blockName = rawBlockName?.startsWith("core/") ? rawBlockName.slice(5) : rawBlockName;
7186 if (!content) {
7187 return `<!-- wp:${blockName} ${serializedAttributes}/-->`;
7188 }
7189 return `<!-- wp:${blockName} ${serializedAttributes}-->
7190 ` + content + `
7191 <!-- /wp:${blockName} -->`;
7192 }
7193 function serializeBlock(block, { isInnerBlocks = false } = {}) {
7194 if (!block.isValid && block.__unstableBlockSource) {
7195 return serializeRawBlock(block.__unstableBlockSource);
7196 }
7197 const blockName = block.name;
7198 const saveContent = getBlockInnerHTML(block);
7199 if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
7200 return saveContent;
7201 }
7202 const blockType = getBlockType(blockName);
7203 if (!blockType) {
7204 return saveContent;
7205 }
7206 const saveAttributes = getCommentAttributes(blockType, block.attributes);
7207 return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
7208 }
7209 var __unstableSerializeAndClean = /* @__PURE__ */ (() => {
7210 const cache = /* @__PURE__ */ new WeakMap();
7211 return (blocks) => {
7212 const cached = cache.get(blocks);
7213 if (cached !== void 0) {
7214 return cached;
7215 }
7216 let effectiveBlocks = blocks;
7217 if (effectiveBlocks.length === 1 && isUnmodifiedDefaultBlock(effectiveBlocks[0])) {
7218 effectiveBlocks = [];
7219 }
7220 let content = serialize(effectiveBlocks);
7221 if (effectiveBlocks.length === 1 && effectiveBlocks[0].name === getFreeformContentHandlerName() && effectiveBlocks[0].name === "core/freeform") {
7222 content = (0, import_autop.removep)(content);
7223 }
7224 cache.set(blocks, content);
7225 return content;
7226 };
7227 })();
7228 function serialize(blocks, options) {
7229 const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
7230 return blocksArray.map((block) => serializeBlock(block, options)).join("\n\n");
7231 }
7232
7233 // node_modules/simple-html-tokenizer/dist/es6/index.js
7234 var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
7235 var CHARCODE = /^#([0-9]+)$/;
7236 var NAMED = /^([A-Za-z0-9]+)$/;
7237 var EntityParser = (
7238 /** @class */
7239 (function() {
7240 function EntityParser2(named) {
7241 this.named = named;
7242 }
7243 EntityParser2.prototype.parse = function(entity) {
7244 if (!entity) {
7245 return;
7246 }
7247 var matches = entity.match(HEXCHARCODE);
7248 if (matches) {
7249 return String.fromCharCode(parseInt(matches[1], 16));
7250 }
7251 matches = entity.match(CHARCODE);
7252 if (matches) {
7253 return String.fromCharCode(parseInt(matches[1], 10));
7254 }
7255 matches = entity.match(NAMED);
7256 if (matches) {
7257 return this.named[matches[1]];
7258 }
7259 };
7260 return EntityParser2;
7261 })()
7262 );
7263 var WSP = /[\t\n\f ]/;
7264 var ALPHA = /[A-Za-z]/;
7265 var CRLF = /\r\n?/g;
7266 function isSpace(char) {
7267 return WSP.test(char);
7268 }
7269 function isAlpha(char) {
7270 return ALPHA.test(char);
7271 }
7272 function preprocessInput(input) {
7273 return input.replace(CRLF, "\n");
7274 }
7275 var EventedTokenizer = (
7276 /** @class */
7277 (function() {
7278 function EventedTokenizer2(delegate, entityParser) {
7279 this.delegate = delegate;
7280 this.entityParser = entityParser;
7281 this.state = "beforeData";
7282 this.line = -1;
7283 this.column = -1;
7284 this.input = "";
7285 this.index = -1;
7286 this.tagNameBuffer = "";
7287 this.states = {
7288 beforeData: function() {
7289 var char = this.peek();
7290 if (char === "<") {
7291 this.transitionTo(
7292 "tagOpen"
7293 /* tagOpen */
7294 );
7295 this.markTagStart();
7296 this.consume();
7297 } else {
7298 if (char === "\n") {
7299 var tag = this.tagNameBuffer.toLowerCase();
7300 if (tag === "pre" || tag === "textarea") {
7301 this.consume();
7302 }
7303 }
7304 this.transitionTo(
7305 "data"
7306 /* data */
7307 );
7308 this.delegate.beginData();
7309 }
7310 },
7311 data: function() {
7312 var char = this.peek();
7313 if (char === "<") {
7314 this.delegate.finishData();
7315 this.transitionTo(
7316 "tagOpen"
7317 /* tagOpen */
7318 );
7319 this.markTagStart();
7320 this.consume();
7321 } else if (char === "&") {
7322 this.consume();
7323 this.delegate.appendToData(this.consumeCharRef() || "&");
7324 } else {
7325 this.consume();
7326 this.delegate.appendToData(char);
7327 }
7328 },
7329 tagOpen: function() {
7330 var char = this.consume();
7331 if (char === "!") {
7332 this.transitionTo(
7333 "markupDeclarationOpen"
7334 /* markupDeclarationOpen */
7335 );
7336 } else if (char === "/") {
7337 this.transitionTo(
7338 "endTagOpen"
7339 /* endTagOpen */
7340 );
7341 } else if (char === "@" || char === ":" || isAlpha(char)) {
7342 this.transitionTo(
7343 "tagName"
7344 /* tagName */
7345 );
7346 this.tagNameBuffer = "";
7347 this.delegate.beginStartTag();
7348 this.appendToTagName(char);
7349 }
7350 },
7351 markupDeclarationOpen: function() {
7352 var char = this.consume();
7353 if (char === "-" && this.input.charAt(this.index) === "-") {
7354 this.consume();
7355 this.transitionTo(
7356 "commentStart"
7357 /* commentStart */
7358 );
7359 this.delegate.beginComment();
7360 }
7361 },
7362 commentStart: function() {
7363 var char = this.consume();
7364 if (char === "-") {
7365 this.transitionTo(
7366 "commentStartDash"
7367 /* commentStartDash */
7368 );
7369 } else if (char === ">") {
7370 this.delegate.finishComment();
7371 this.transitionTo(
7372 "beforeData"
7373 /* beforeData */
7374 );
7375 } else {
7376 this.delegate.appendToCommentData(char);
7377 this.transitionTo(
7378 "comment"
7379 /* comment */
7380 );
7381 }
7382 },
7383 commentStartDash: function() {
7384 var char = this.consume();
7385 if (char === "-") {
7386 this.transitionTo(
7387 "commentEnd"
7388 /* commentEnd */
7389 );
7390 } else if (char === ">") {
7391 this.delegate.finishComment();
7392 this.transitionTo(
7393 "beforeData"
7394 /* beforeData */
7395 );
7396 } else {
7397 this.delegate.appendToCommentData("-");
7398 this.transitionTo(
7399 "comment"
7400 /* comment */
7401 );
7402 }
7403 },
7404 comment: function() {
7405 var char = this.consume();
7406 if (char === "-") {
7407 this.transitionTo(
7408 "commentEndDash"
7409 /* commentEndDash */
7410 );
7411 } else {
7412 this.delegate.appendToCommentData(char);
7413 }
7414 },
7415 commentEndDash: function() {
7416 var char = this.consume();
7417 if (char === "-") {
7418 this.transitionTo(
7419 "commentEnd"
7420 /* commentEnd */
7421 );
7422 } else {
7423 this.delegate.appendToCommentData("-" + char);
7424 this.transitionTo(
7425 "comment"
7426 /* comment */
7427 );
7428 }
7429 },
7430 commentEnd: function() {
7431 var char = this.consume();
7432 if (char === ">") {
7433 this.delegate.finishComment();
7434 this.transitionTo(
7435 "beforeData"
7436 /* beforeData */
7437 );
7438 } else {
7439 this.delegate.appendToCommentData("--" + char);
7440 this.transitionTo(
7441 "comment"
7442 /* comment */
7443 );
7444 }
7445 },
7446 tagName: function() {
7447 var char = this.consume();
7448 if (isSpace(char)) {
7449 this.transitionTo(
7450 "beforeAttributeName"
7451 /* beforeAttributeName */
7452 );
7453 } else if (char === "/") {
7454 this.transitionTo(
7455 "selfClosingStartTag"
7456 /* selfClosingStartTag */
7457 );
7458 } else if (char === ">") {
7459 this.delegate.finishTag();
7460 this.transitionTo(
7461 "beforeData"
7462 /* beforeData */
7463 );
7464 } else {
7465 this.appendToTagName(char);
7466 }
7467 },
7468 beforeAttributeName: function() {
7469 var char = this.peek();
7470 if (isSpace(char)) {
7471 this.consume();
7472 return;
7473 } else if (char === "/") {
7474 this.transitionTo(
7475 "selfClosingStartTag"
7476 /* selfClosingStartTag */
7477 );
7478 this.consume();
7479 } else if (char === ">") {
7480 this.consume();
7481 this.delegate.finishTag();
7482 this.transitionTo(
7483 "beforeData"
7484 /* beforeData */
7485 );
7486 } else if (char === "=") {
7487 this.delegate.reportSyntaxError("attribute name cannot start with equals sign");
7488 this.transitionTo(
7489 "attributeName"
7490 /* attributeName */
7491 );
7492 this.delegate.beginAttribute();
7493 this.consume();
7494 this.delegate.appendToAttributeName(char);
7495 } else {
7496 this.transitionTo(
7497 "attributeName"
7498 /* attributeName */
7499 );
7500 this.delegate.beginAttribute();
7501 }
7502 },
7503 attributeName: function() {
7504 var char = this.peek();
7505 if (isSpace(char)) {
7506 this.transitionTo(
7507 "afterAttributeName"
7508 /* afterAttributeName */
7509 );
7510 this.consume();
7511 } else if (char === "/") {
7512 this.delegate.beginAttributeValue(false);
7513 this.delegate.finishAttributeValue();
7514 this.consume();
7515 this.transitionTo(
7516 "selfClosingStartTag"
7517 /* selfClosingStartTag */
7518 );
7519 } else if (char === "=") {
7520 this.transitionTo(
7521 "beforeAttributeValue"
7522 /* beforeAttributeValue */
7523 );
7524 this.consume();
7525 } else if (char === ">") {
7526 this.delegate.beginAttributeValue(false);
7527 this.delegate.finishAttributeValue();
7528 this.consume();
7529 this.delegate.finishTag();
7530 this.transitionTo(
7531 "beforeData"
7532 /* beforeData */
7533 );
7534 } else if (char === '"' || char === "'" || char === "<") {
7535 this.delegate.reportSyntaxError(char + " is not a valid character within attribute names");
7536 this.consume();
7537 this.delegate.appendToAttributeName(char);
7538 } else {
7539 this.consume();
7540 this.delegate.appendToAttributeName(char);
7541 }
7542 },
7543 afterAttributeName: function() {
7544 var char = this.peek();
7545 if (isSpace(char)) {
7546 this.consume();
7547 return;
7548 } else if (char === "/") {
7549 this.delegate.beginAttributeValue(false);
7550 this.delegate.finishAttributeValue();
7551 this.consume();
7552 this.transitionTo(
7553 "selfClosingStartTag"
7554 /* selfClosingStartTag */
7555 );
7556 } else if (char === "=") {
7557 this.consume();
7558 this.transitionTo(
7559 "beforeAttributeValue"
7560 /* beforeAttributeValue */
7561 );
7562 } else if (char === ">") {
7563 this.delegate.beginAttributeValue(false);
7564 this.delegate.finishAttributeValue();
7565 this.consume();
7566 this.delegate.finishTag();
7567 this.transitionTo(
7568 "beforeData"
7569 /* beforeData */
7570 );
7571 } else {
7572 this.delegate.beginAttributeValue(false);
7573 this.delegate.finishAttributeValue();
7574 this.transitionTo(
7575 "attributeName"
7576 /* attributeName */
7577 );
7578 this.delegate.beginAttribute();
7579 this.consume();
7580 this.delegate.appendToAttributeName(char);
7581 }
7582 },
7583 beforeAttributeValue: function() {
7584 var char = this.peek();
7585 if (isSpace(char)) {
7586 this.consume();
7587 } else if (char === '"') {
7588 this.transitionTo(
7589 "attributeValueDoubleQuoted"
7590 /* attributeValueDoubleQuoted */
7591 );
7592 this.delegate.beginAttributeValue(true);
7593 this.consume();
7594 } else if (char === "'") {
7595 this.transitionTo(
7596 "attributeValueSingleQuoted"
7597 /* attributeValueSingleQuoted */
7598 );
7599 this.delegate.beginAttributeValue(true);
7600 this.consume();
7601 } else if (char === ">") {
7602 this.delegate.beginAttributeValue(false);
7603 this.delegate.finishAttributeValue();
7604 this.consume();
7605 this.delegate.finishTag();
7606 this.transitionTo(
7607 "beforeData"
7608 /* beforeData */
7609 );
7610 } else {
7611 this.transitionTo(
7612 "attributeValueUnquoted"
7613 /* attributeValueUnquoted */
7614 );
7615 this.delegate.beginAttributeValue(false);
7616 this.consume();
7617 this.delegate.appendToAttributeValue(char);
7618 }
7619 },
7620 attributeValueDoubleQuoted: function() {
7621 var char = this.consume();
7622 if (char === '"') {
7623 this.delegate.finishAttributeValue();
7624 this.transitionTo(
7625 "afterAttributeValueQuoted"
7626 /* afterAttributeValueQuoted */
7627 );
7628 } else if (char === "&") {
7629 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7630 } else {
7631 this.delegate.appendToAttributeValue(char);
7632 }
7633 },
7634 attributeValueSingleQuoted: function() {
7635 var char = this.consume();
7636 if (char === "'") {
7637 this.delegate.finishAttributeValue();
7638 this.transitionTo(
7639 "afterAttributeValueQuoted"
7640 /* afterAttributeValueQuoted */
7641 );
7642 } else if (char === "&") {
7643 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7644 } else {
7645 this.delegate.appendToAttributeValue(char);
7646 }
7647 },
7648 attributeValueUnquoted: function() {
7649 var char = this.peek();
7650 if (isSpace(char)) {
7651 this.delegate.finishAttributeValue();
7652 this.consume();
7653 this.transitionTo(
7654 "beforeAttributeName"
7655 /* beforeAttributeName */
7656 );
7657 } else if (char === "/") {
7658 this.delegate.finishAttributeValue();
7659 this.consume();
7660 this.transitionTo(
7661 "selfClosingStartTag"
7662 /* selfClosingStartTag */
7663 );
7664 } else if (char === "&") {
7665 this.consume();
7666 this.delegate.appendToAttributeValue(this.consumeCharRef() || "&");
7667 } else if (char === ">") {
7668 this.delegate.finishAttributeValue();
7669 this.consume();
7670 this.delegate.finishTag();
7671 this.transitionTo(
7672 "beforeData"
7673 /* beforeData */
7674 );
7675 } else {
7676 this.consume();
7677 this.delegate.appendToAttributeValue(char);
7678 }
7679 },
7680 afterAttributeValueQuoted: function() {
7681 var char = this.peek();
7682 if (isSpace(char)) {
7683 this.consume();
7684 this.transitionTo(
7685 "beforeAttributeName"
7686 /* beforeAttributeName */
7687 );
7688 } else if (char === "/") {
7689 this.consume();
7690 this.transitionTo(
7691 "selfClosingStartTag"
7692 /* selfClosingStartTag */
7693 );
7694 } else if (char === ">") {
7695 this.consume();
7696 this.delegate.finishTag();
7697 this.transitionTo(
7698 "beforeData"
7699 /* beforeData */
7700 );
7701 } else {
7702 this.transitionTo(
7703 "beforeAttributeName"
7704 /* beforeAttributeName */
7705 );
7706 }
7707 },
7708 selfClosingStartTag: function() {
7709 var char = this.peek();
7710 if (char === ">") {
7711 this.consume();
7712 this.delegate.markTagAsSelfClosing();
7713 this.delegate.finishTag();
7714 this.transitionTo(
7715 "beforeData"
7716 /* beforeData */
7717 );
7718 } else {
7719 this.transitionTo(
7720 "beforeAttributeName"
7721 /* beforeAttributeName */
7722 );
7723 }
7724 },
7725 endTagOpen: function() {
7726 var char = this.consume();
7727 if (char === "@" || char === ":" || isAlpha(char)) {
7728 this.transitionTo(
7729 "tagName"
7730 /* tagName */
7731 );
7732 this.tagNameBuffer = "";
7733 this.delegate.beginEndTag();
7734 this.appendToTagName(char);
7735 }
7736 }
7737 };
7738 this.reset();
7739 }
7740 EventedTokenizer2.prototype.reset = function() {
7741 this.transitionTo(
7742 "beforeData"
7743 /* beforeData */
7744 );
7745 this.input = "";
7746 this.index = 0;
7747 this.line = 1;
7748 this.column = 0;
7749 this.delegate.reset();
7750 };
7751 EventedTokenizer2.prototype.transitionTo = function(state) {
7752 this.state = state;
7753 };
7754 EventedTokenizer2.prototype.tokenize = function(input) {
7755 this.reset();
7756 this.tokenizePart(input);
7757 this.tokenizeEOF();
7758 };
7759 EventedTokenizer2.prototype.tokenizePart = function(input) {
7760 this.input += preprocessInput(input);
7761 while (this.index < this.input.length) {
7762 var handler = this.states[this.state];
7763 if (handler !== void 0) {
7764 handler.call(this);
7765 } else {
7766 throw new Error("unhandled state " + this.state);
7767 }
7768 }
7769 };
7770 EventedTokenizer2.prototype.tokenizeEOF = function() {
7771 this.flushData();
7772 };
7773 EventedTokenizer2.prototype.flushData = function() {
7774 if (this.state === "data") {
7775 this.delegate.finishData();
7776 this.transitionTo(
7777 "beforeData"
7778 /* beforeData */
7779 );
7780 }
7781 };
7782 EventedTokenizer2.prototype.peek = function() {
7783 return this.input.charAt(this.index);
7784 };
7785 EventedTokenizer2.prototype.consume = function() {
7786 var char = this.peek();
7787 this.index++;
7788 if (char === "\n") {
7789 this.line++;
7790 this.column = 0;
7791 } else {
7792 this.column++;
7793 }
7794 return char;
7795 };
7796 EventedTokenizer2.prototype.consumeCharRef = function() {
7797 var endIndex = this.input.indexOf(";", this.index);
7798 if (endIndex === -1) {
7799 return;
7800 }
7801 var entity = this.input.slice(this.index, endIndex);
7802 var chars = this.entityParser.parse(entity);
7803 if (chars) {
7804 var count = entity.length;
7805 while (count) {
7806 this.consume();
7807 count--;
7808 }
7809 this.consume();
7810 return chars;
7811 }
7812 };
7813 EventedTokenizer2.prototype.markTagStart = function() {
7814 this.delegate.tagOpen();
7815 };
7816 EventedTokenizer2.prototype.appendToTagName = function(char) {
7817 this.tagNameBuffer += char;
7818 this.delegate.appendToTagName(char);
7819 };
7820 return EventedTokenizer2;
7821 })()
7822 );
7823 var Tokenizer = (
7824 /** @class */
7825 (function() {
7826 function Tokenizer2(entityParser, options) {
7827 if (options === void 0) {
7828 options = {};
7829 }
7830 this.options = options;
7831 this.token = null;
7832 this.startLine = 1;
7833 this.startColumn = 0;
7834 this.tokens = [];
7835 this.tokenizer = new EventedTokenizer(this, entityParser);
7836 this._currentAttribute = void 0;
7837 }
7838 Tokenizer2.prototype.tokenize = function(input) {
7839 this.tokens = [];
7840 this.tokenizer.tokenize(input);
7841 return this.tokens;
7842 };
7843 Tokenizer2.prototype.tokenizePart = function(input) {
7844 this.tokens = [];
7845 this.tokenizer.tokenizePart(input);
7846 return this.tokens;
7847 };
7848 Tokenizer2.prototype.tokenizeEOF = function() {
7849 this.tokens = [];
7850 this.tokenizer.tokenizeEOF();
7851 return this.tokens[0];
7852 };
7853 Tokenizer2.prototype.reset = function() {
7854 this.token = null;
7855 this.startLine = 1;
7856 this.startColumn = 0;
7857 };
7858 Tokenizer2.prototype.current = function() {
7859 var token = this.token;
7860 if (token === null) {
7861 throw new Error("token was unexpectedly null");
7862 }
7863 if (arguments.length === 0) {
7864 return token;
7865 }
7866 for (var i2 = 0; i2 < arguments.length; i2++) {
7867 if (token.type === arguments[i2]) {
7868 return token;
7869 }
7870 }
7871 throw new Error("token type was unexpectedly " + token.type);
7872 };
7873 Tokenizer2.prototype.push = function(token) {
7874 this.token = token;
7875 this.tokens.push(token);
7876 };
7877 Tokenizer2.prototype.currentAttribute = function() {
7878 return this._currentAttribute;
7879 };
7880 Tokenizer2.prototype.addLocInfo = function() {
7881 if (this.options.loc) {
7882 this.current().loc = {
7883 start: {
7884 line: this.startLine,
7885 column: this.startColumn
7886 },
7887 end: {
7888 line: this.tokenizer.line,
7889 column: this.tokenizer.column
7890 }
7891 };
7892 }
7893 this.startLine = this.tokenizer.line;
7894 this.startColumn = this.tokenizer.column;
7895 };
7896 Tokenizer2.prototype.beginData = function() {
7897 this.push({
7898 type: "Chars",
7899 chars: ""
7900 });
7901 };
7902 Tokenizer2.prototype.appendToData = function(char) {
7903 this.current(
7904 "Chars"
7905 /* Chars */
7906 ).chars += char;
7907 };
7908 Tokenizer2.prototype.finishData = function() {
7909 this.addLocInfo();
7910 };
7911 Tokenizer2.prototype.beginComment = function() {
7912 this.push({
7913 type: "Comment",
7914 chars: ""
7915 });
7916 };
7917 Tokenizer2.prototype.appendToCommentData = function(char) {
7918 this.current(
7919 "Comment"
7920 /* Comment */
7921 ).chars += char;
7922 };
7923 Tokenizer2.prototype.finishComment = function() {
7924 this.addLocInfo();
7925 };
7926 Tokenizer2.prototype.tagOpen = function() {
7927 };
7928 Tokenizer2.prototype.beginStartTag = function() {
7929 this.push({
7930 type: "StartTag",
7931 tagName: "",
7932 attributes: [],
7933 selfClosing: false
7934 });
7935 };
7936 Tokenizer2.prototype.beginEndTag = function() {
7937 this.push({
7938 type: "EndTag",
7939 tagName: ""
7940 });
7941 };
7942 Tokenizer2.prototype.finishTag = function() {
7943 this.addLocInfo();
7944 };
7945 Tokenizer2.prototype.markTagAsSelfClosing = function() {
7946 this.current(
7947 "StartTag"
7948 /* StartTag */
7949 ).selfClosing = true;
7950 };
7951 Tokenizer2.prototype.appendToTagName = function(char) {
7952 this.current(
7953 "StartTag",
7954 "EndTag"
7955 /* EndTag */
7956 ).tagName += char;
7957 };
7958 Tokenizer2.prototype.beginAttribute = function() {
7959 this._currentAttribute = ["", "", false];
7960 };
7961 Tokenizer2.prototype.appendToAttributeName = function(char) {
7962 this.currentAttribute()[0] += char;
7963 };
7964 Tokenizer2.prototype.beginAttributeValue = function(isQuoted) {
7965 this.currentAttribute()[2] = isQuoted;
7966 };
7967 Tokenizer2.prototype.appendToAttributeValue = function(char) {
7968 this.currentAttribute()[1] += char;
7969 };
7970 Tokenizer2.prototype.finishAttributeValue = function() {
7971 this.current(
7972 "StartTag"
7973 /* StartTag */
7974 ).attributes.push(this._currentAttribute);
7975 };
7976 Tokenizer2.prototype.reportSyntaxError = function(message) {
7977 this.current().syntaxError = message;
7978 };
7979 return Tokenizer2;
7980 })()
7981 );
7982
7983 // packages/blocks/build-module/api/validation/index.mjs
7984 var import_es6 = __toESM(require_es6(), 1);
7985 var import_deprecated7 = __toESM(require_deprecated(), 1);
7986 var import_html_entities = __toESM(require_html_entities(), 1);
7987
7988 // packages/blocks/build-module/api/validation/logger.mjs
7989 function createLogger() {
7990 function createLogHandler(logger) {
7991 return (message, ...args) => logger("Block validation: " + message, ...args);
7992 }
7993 return {
7994 // eslint-disable-next-line no-console
7995 error: createLogHandler(console.error),
7996 // eslint-disable-next-line no-console
7997 warning: createLogHandler(console.warn),
7998 getItems() {
7999 return [];
8000 }
8001 };
8002 }
8003 function createQueuedLogger() {
8004 const queue = [];
8005 const logger = createLogger();
8006 return {
8007 error(...args) {
8008 queue.push({ log: logger.error, args });
8009 },
8010 warning(...args) {
8011 queue.push({ log: logger.warning, args });
8012 },
8013 getItems() {
8014 return queue;
8015 }
8016 };
8017 }
8018
8019 // packages/blocks/build-module/api/validation/index.mjs
8020 var identity = (x2) => x2;
8021 var REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
8022 var REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
8023 var REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/;
8024 var BOOLEAN_ATTRIBUTES = [
8025 "allowfullscreen",
8026 "allowpaymentrequest",
8027 "allowusermedia",
8028 "async",
8029 "autofocus",
8030 "autoplay",
8031 "checked",
8032 "controls",
8033 "default",
8034 "defer",
8035 "disabled",
8036 "download",
8037 "formnovalidate",
8038 "hidden",
8039 "ismap",
8040 "itemscope",
8041 "loop",
8042 "multiple",
8043 "muted",
8044 "nomodule",
8045 "novalidate",
8046 "open",
8047 "playsinline",
8048 "readonly",
8049 "required",
8050 "reversed",
8051 "selected",
8052 "typemustmatch"
8053 ];
8054 var ENUMERATED_ATTRIBUTES = [
8055 "autocapitalize",
8056 "autocomplete",
8057 "charset",
8058 "contenteditable",
8059 "crossorigin",
8060 "decoding",
8061 "dir",
8062 "draggable",
8063 "enctype",
8064 "formenctype",
8065 "formmethod",
8066 "http-equiv",
8067 "inputmode",
8068 "kind",
8069 "method",
8070 "preload",
8071 "scope",
8072 "shape",
8073 "spellcheck",
8074 "translate",
8075 "type",
8076 "wrap"
8077 ];
8078 var MEANINGFUL_ATTRIBUTES = [
8079 ...BOOLEAN_ATTRIBUTES,
8080 ...ENUMERATED_ATTRIBUTES
8081 ];
8082 var TEXT_NORMALIZATIONS = [
8083 identity,
8084 getTextWithCollapsedWhitespace
8085 ];
8086 var REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i;
8087 var REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/;
8088 var REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i;
8089 function isValidCharacterReference(text2) {
8090 return REGEXP_NAMED_CHARACTER_REFERENCE.test(text2) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text2) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text2);
8091 }
8092 var DecodeEntityParser = class {
8093 /**
8094 * Returns a substitute string for an entity string sequence between `&`
8095 * and `;`, or undefined if no substitution should occur.
8096 *
8097 * @param entity Entity fragment discovered in HTML.
8098 *
8099 * @return Entity substitute value.
8100 */
8101 parse(entity) {
8102 if (isValidCharacterReference(entity)) {
8103 return (0, import_html_entities.decodeEntities)("&" + entity + ";");
8104 }
8105 return void 0;
8106 }
8107 };
8108 function getTextPiecesSplitOnWhitespace(text2) {
8109 return text2.trim().split(REGEXP_WHITESPACE);
8110 }
8111 function getTextWithCollapsedWhitespace(text2) {
8112 return getTextPiecesSplitOnWhitespace(text2).join(" ");
8113 }
8114 function getMeaningfulAttributePairs(token) {
8115 return (token.attributes ?? []).filter((pair) => {
8116 const [key, value] = pair;
8117 return value || key.indexOf("data-") === 0 || MEANINGFUL_ATTRIBUTES.includes(key);
8118 });
8119 }
8120 function isEquivalentTextTokens(actual, expected, logger = createLogger()) {
8121 let actualChars = actual.chars;
8122 let expectedChars = expected.chars;
8123 for (let i2 = 0; i2 < TEXT_NORMALIZATIONS.length; i2++) {
8124 const normalize = TEXT_NORMALIZATIONS[i2];
8125 actualChars = normalize(actualChars);
8126 expectedChars = normalize(expectedChars);
8127 if (actualChars === expectedChars) {
8128 return true;
8129 }
8130 }
8131 logger.warning(
8132 "Expected text `%s`, saw `%s`.",
8133 expected.chars,
8134 actual.chars
8135 );
8136 return false;
8137 }
8138 function getNormalizedLength(value) {
8139 if (0 === parseFloat(value)) {
8140 return "0";
8141 }
8142 if (value.indexOf(".") === 0) {
8143 return "0" + value;
8144 }
8145 return value;
8146 }
8147 function getNormalizedStyleValue(value) {
8148 const textPieces = getTextPiecesSplitOnWhitespace(value);
8149 const normalizedPieces = textPieces.map(getNormalizedLength);
8150 const result = normalizedPieces.join(" ");
8151 return result.replace(REGEXP_STYLE_URL_TYPE, "url($1)");
8152 }
8153 function getStyleProperties(text2) {
8154 const pairs = text2.replace(/;?\s*$/, "").split(";").map((style) => {
8155 const [key, ...valueParts] = style.split(":");
8156 const value = valueParts.join(":");
8157 return [key.trim(), getNormalizedStyleValue(value.trim())];
8158 });
8159 return Object.fromEntries(pairs);
8160 }
8161 var isEqualAttributesOfName = {
8162 class: (actual, expected) => {
8163 const [actualPieces, expectedPieces] = [actual, expected].map(
8164 getTextPiecesSplitOnWhitespace
8165 );
8166 const actualDiff = actualPieces.filter(
8167 (c2) => !expectedPieces.includes(c2)
8168 );
8169 const expectedDiff = expectedPieces.filter(
8170 (c2) => !actualPieces.includes(c2)
8171 );
8172 return actualDiff.length === 0 && expectedDiff.length === 0;
8173 },
8174 style: (actual, expected) => {
8175 return (0, import_es6.default)(
8176 ...[actual, expected].map(getStyleProperties)
8177 );
8178 },
8179 // For each boolean attribute, mere presence of attribute in both is enough
8180 // to assume equivalence.
8181 ...Object.fromEntries(
8182 BOOLEAN_ATTRIBUTES.map((attribute) => [attribute, () => true])
8183 )
8184 };
8185 function isEqualTagAttributePairs(actual, expected, logger = createLogger()) {
8186 if (actual.length !== expected.length) {
8187 logger.warning(
8188 "Expected attributes %o, instead saw %o.",
8189 expected,
8190 actual
8191 );
8192 return false;
8193 }
8194 const expectedAttributes = {};
8195 for (let i2 = 0; i2 < expected.length; i2++) {
8196 expectedAttributes[expected[i2][0].toLowerCase()] = expected[i2][1];
8197 }
8198 for (let i2 = 0; i2 < actual.length; i2++) {
8199 const [name, actualValue] = actual[i2];
8200 const nameLower = name.toLowerCase();
8201 if (!expectedAttributes.hasOwnProperty(nameLower)) {
8202 logger.warning("Encountered unexpected attribute `%s`.", name);
8203 return false;
8204 }
8205 const expectedValue = expectedAttributes[nameLower];
8206 const isEqualAttributes = isEqualAttributesOfName[nameLower];
8207 if (isEqualAttributes) {
8208 if (!isEqualAttributes(actualValue, expectedValue)) {
8209 logger.warning(
8210 "Expected attribute `%s` of value `%s`, saw `%s`.",
8211 name,
8212 expectedValue,
8213 actualValue
8214 );
8215 return false;
8216 }
8217 } else if (actualValue !== expectedValue) {
8218 logger.warning(
8219 "Expected attribute `%s` of value `%s`, saw `%s`.",
8220 name,
8221 expectedValue,
8222 actualValue
8223 );
8224 return false;
8225 }
8226 }
8227 return true;
8228 }
8229 var isEqualTokensOfType = {
8230 StartTag: (actual, expected, logger = createLogger()) => {
8231 if (actual.tagName !== expected.tagName && // Optimization: Use short-circuit evaluation to defer case-
8232 // insensitive check on the assumption that the majority case will
8233 // have exactly equal tag names.
8234 actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) {
8235 logger.warning(
8236 "Expected tag name `%s`, instead saw `%s`.",
8237 expected.tagName,
8238 actual.tagName
8239 );
8240 return false;
8241 }
8242 return isEqualTagAttributePairs(
8243 ...[actual, expected].map(getMeaningfulAttributePairs),
8244 logger
8245 );
8246 },
8247 Chars: isEquivalentTextTokens,
8248 Comment: isEquivalentTextTokens
8249 };
8250 function getNextNonWhitespaceToken(tokens) {
8251 let token;
8252 while (token = tokens.shift()) {
8253 if (token.type !== "Chars") {
8254 return token;
8255 }
8256 if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) {
8257 return token;
8258 }
8259 }
8260 return void 0;
8261 }
8262 function getHTMLTokens(html2, logger = createLogger()) {
8263 try {
8264 return new Tokenizer(new DecodeEntityParser()).tokenize(
8265 html2
8266 );
8267 } catch {
8268 logger.warning("Malformed HTML detected: %s", html2);
8269 }
8270 return null;
8271 }
8272 function isClosedByToken(currentToken, nextToken) {
8273 if (!currentToken.selfClosing) {
8274 return false;
8275 }
8276 if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === "EndTag") {
8277 return true;
8278 }
8279 return false;
8280 }
8281 function isEquivalentHTML(actual, expected, logger = createLogger()) {
8282 if (actual === expected) {
8283 return true;
8284 }
8285 const [actualTokens, expectedTokens] = [actual, expected].map(
8286 (html2) => getHTMLTokens(html2, logger)
8287 );
8288 if (!actualTokens || !expectedTokens) {
8289 return false;
8290 }
8291 let actualToken, expectedToken;
8292 while (actualToken = getNextNonWhitespaceToken(actualTokens)) {
8293 expectedToken = getNextNonWhitespaceToken(expectedTokens);
8294 if (!expectedToken) {
8295 logger.warning(
8296 "Expected end of content, instead saw %o.",
8297 actualToken
8298 );
8299 return false;
8300 }
8301 if (actualToken.type !== expectedToken.type) {
8302 logger.warning(
8303 "Expected token of type `%s` (%o), instead saw `%s` (%o).",
8304 expectedToken.type,
8305 expectedToken,
8306 actualToken.type,
8307 actualToken
8308 );
8309 return false;
8310 }
8311 const isEqualTokens = isEqualTokensOfType[actualToken.type];
8312 if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
8313 return false;
8314 }
8315 if (isClosedByToken(actualToken, expectedTokens[0])) {
8316 getNextNonWhitespaceToken(expectedTokens);
8317 } else if (isClosedByToken(expectedToken, actualTokens[0])) {
8318 getNextNonWhitespaceToken(actualTokens);
8319 }
8320 }
8321 if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
8322 logger.warning(
8323 "Expected %o, instead saw end of content.",
8324 expectedToken
8325 );
8326 return false;
8327 }
8328 return true;
8329 }
8330 function validateBlock(block, blockTypeOrName = block.name) {
8331 const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName();
8332 if (isFallbackBlock) {
8333 return [true, []];
8334 }
8335 const logger = createQueuedLogger();
8336 const blockType = normalizeBlockType(blockTypeOrName);
8337 let generatedBlockContent;
8338 try {
8339 generatedBlockContent = getSaveContent(blockType, block.attributes);
8340 } catch (error) {
8341 logger.error(
8342 "Block validation failed because an error occurred while generating block content:\n\n%s",
8343 error.toString()
8344 );
8345 return [false, logger.getItems()];
8346 }
8347 const isValid = isEquivalentHTML(
8348 block.originalContent,
8349 generatedBlockContent,
8350 logger
8351 );
8352 if (!isValid) {
8353 logger.error(
8354 "Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",
8355 blockType.name,
8356 blockType,
8357 generatedBlockContent,
8358 block.originalContent
8359 );
8360 }
8361 return [isValid, logger.getItems()];
8362 }
8363 function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
8364 (0, import_deprecated7.default)("isValidBlockContent introduces opportunity for data loss", {
8365 since: "12.6",
8366 plugin: "Gutenberg",
8367 alternative: "validateBlock"
8368 });
8369 const blockType = normalizeBlockType(blockTypeOrName);
8370 const block = {
8371 clientId: "",
8372 name: blockType.name,
8373 isValid: true,
8374 attributes,
8375 innerBlocks: [],
8376 originalContent: originalBlockContent
8377 };
8378 const [isValid] = validateBlock(block, blockType);
8379 return isValid;
8380 }
8381
8382 // packages/blocks/build-module/api/parser/convert-legacy-block.mjs
8383 function convertLegacyBlockNameAndAttributes(name, attributes) {
8384 const newAttributes = { ...attributes };
8385 if ("core/cover-image" === name) {
8386 name = "core/cover";
8387 }
8388 if ("core/text" === name || "core/cover-text" === name) {
8389 name = "core/paragraph";
8390 }
8391 if (name && name.indexOf("core/social-link-") === 0) {
8392 newAttributes.service = name.substring(17);
8393 name = "core/social-link";
8394 }
8395 if (name && name.indexOf("core-embed/") === 0) {
8396 const providerSlug = name.substring(11);
8397 const deprecated12 = {
8398 speaker: "speaker-deck",
8399 polldaddy: "crowdsignal"
8400 };
8401 newAttributes.providerNameSlug = providerSlug in deprecated12 ? deprecated12[providerSlug] : providerSlug;
8402 if (!["amazon-kindle", "wordpress"].includes(providerSlug)) {
8403 newAttributes.responsive = true;
8404 }
8405 name = "core/embed";
8406 }
8407 if (name === "core/post-comment-author") {
8408 name = "core/comment-author-name";
8409 }
8410 if (name === "core/post-comment-content") {
8411 name = "core/comment-content";
8412 }
8413 if (name === "core/post-comment-date") {
8414 name = "core/comment-date";
8415 }
8416 if (name === "core/comments-query-loop") {
8417 name = "core/comments";
8418 const className = newAttributes.className ?? "";
8419 if (!className.includes("wp-block-comments-query-loop")) {
8420 newAttributes.className = [
8421 "wp-block-comments-query-loop",
8422 className
8423 ].join(" ");
8424 }
8425 }
8426 if (name === "core/post-comments") {
8427 name = "core/comments";
8428 newAttributes.legacy = true;
8429 }
8430 const layout = attributes.layout;
8431 if (layout?.type === "grid" && typeof layout?.columnCount === "string") {
8432 newAttributes.layout = {
8433 ...newAttributes.layout,
8434 columnCount: parseInt(layout.columnCount, 10)
8435 };
8436 }
8437 const style = attributes.style;
8438 const styleLayout = style?.layout;
8439 if (typeof styleLayout?.columnSpan === "string") {
8440 const columnSpanNumber = parseInt(styleLayout.columnSpan, 10);
8441 newAttributes.style = {
8442 ...newAttributes.style,
8443 layout: {
8444 ...newAttributes.style?.layout,
8445 columnSpan: isNaN(columnSpanNumber) ? void 0 : columnSpanNumber
8446 }
8447 };
8448 }
8449 if (typeof styleLayout?.rowSpan === "string") {
8450 const rowSpanNumber = parseInt(styleLayout.rowSpan, 10);
8451 newAttributes.style = {
8452 ...newAttributes.style,
8453 layout: {
8454 ...newAttributes.style?.layout,
8455 rowSpan: isNaN(rowSpanNumber) ? void 0 : rowSpanNumber
8456 }
8457 };
8458 }
8459 return [name, newAttributes];
8460 }
8461
8462 // node_modules/hpq/es/get-path.js
8463 function getPath(object, path) {
8464 var segments = path.split(".");
8465 var segment;
8466 while (segment = segments.shift()) {
8467 if (!(segment in object)) {
8468 return;
8469 }
8470 object = object[segment];
8471 }
8472 return object;
8473 }
8474
8475 // node_modules/hpq/es/index.js
8476 var getDocument = /* @__PURE__ */ (function() {
8477 var doc;
8478 return function() {
8479 if (!doc) {
8480 doc = document.implementation.createHTMLDocument("");
8481 }
8482 return doc;
8483 };
8484 })();
8485 function parse(source, matchers) {
8486 if (!matchers) {
8487 return;
8488 }
8489 if ("string" === typeof source) {
8490 var doc = getDocument();
8491 doc.body.innerHTML = source;
8492 source = doc.body;
8493 }
8494 if ("function" === typeof matchers) {
8495 return matchers(source);
8496 }
8497 if (Object !== matchers.constructor) {
8498 return;
8499 }
8500 return Object.keys(matchers).reduce(function(memo, key) {
8501 memo[key] = parse(source, matchers[key]);
8502 return memo;
8503 }, {});
8504 }
8505 function prop(selector, name) {
8506 if (1 === arguments.length) {
8507 name = selector;
8508 selector = void 0;
8509 }
8510 return function(node) {
8511 var match = node;
8512 if (selector) {
8513 match = node.querySelector(selector);
8514 }
8515 if (match) {
8516 return getPath(match, name);
8517 }
8518 };
8519 }
8520 function attr(selector, name) {
8521 if (1 === arguments.length) {
8522 name = selector;
8523 selector = void 0;
8524 }
8525 return function(node) {
8526 var attributes = prop(selector, "attributes")(node);
8527 if (attributes && attributes.hasOwnProperty(name)) {
8528 return attributes[name].value;
8529 }
8530 };
8531 }
8532 function text(selector) {
8533 return prop(selector, "textContent");
8534 }
8535 function query(selector, matchers) {
8536 return function(node) {
8537 var matches = node.querySelectorAll(selector);
8538 return [].map.call(matches, function(match) {
8539 return parse(match, matchers);
8540 });
8541 };
8542 }
8543
8544 // node_modules/memize/dist/index.js
8545 function memize(fn, options) {
8546 var size = 0;
8547 var head;
8548 var tail;
8549 options = options || {};
8550 function memoized() {
8551 var node = head, len = arguments.length, args, i2;
8552 searchCache: while (node) {
8553 if (node.args.length !== arguments.length) {
8554 node = node.next;
8555 continue;
8556 }
8557 for (i2 = 0; i2 < len; i2++) {
8558 if (node.args[i2] !== arguments[i2]) {
8559 node = node.next;
8560 continue searchCache;
8561 }
8562 }
8563 if (node !== head) {
8564 if (node === tail) {
8565 tail = node.prev;
8566 }
8567 node.prev.next = node.next;
8568 if (node.next) {
8569 node.next.prev = node.prev;
8570 }
8571 node.next = head;
8572 node.prev = null;
8573 head.prev = node;
8574 head = node;
8575 }
8576 return node.val;
8577 }
8578 args = new Array(len);
8579 for (i2 = 0; i2 < len; i2++) {
8580 args[i2] = arguments[i2];
8581 }
8582 node = {
8583 args,
8584 // Generate the result from original function
8585 val: fn.apply(null, args)
8586 };
8587 if (head) {
8588 head.prev = node;
8589 node.next = head;
8590 } else {
8591 tail = node;
8592 }
8593 if (size === /** @type {MemizeOptions} */
8594 options.maxSize) {
8595 tail = /** @type {MemizeCacheNode} */
8596 tail.prev;
8597 tail.next = null;
8598 } else {
8599 size++;
8600 }
8601 head = node;
8602 return node.val;
8603 }
8604 memoized.clear = function() {
8605 head = null;
8606 tail = null;
8607 size = 0;
8608 };
8609 return memoized;
8610 }
8611
8612 // packages/blocks/build-module/api/parser/get-block-attributes.mjs
8613 var import_hooks4 = __toESM(require_hooks(), 1);
8614 var import_rich_text4 = __toESM(require_rich_text(), 1);
8615
8616 // packages/blocks/build-module/api/matchers.mjs
8617 var import_rich_text3 = __toESM(require_rich_text(), 1);
8618
8619 // packages/blocks/build-module/api/node.mjs
8620 var import_deprecated9 = __toESM(require_deprecated(), 1);
8621
8622 // packages/blocks/build-module/api/children.mjs
8623 var import_element3 = __toESM(require_element(), 1);
8624 var import_deprecated8 = __toESM(require_deprecated(), 1);
8625 function getSerializeCapableElement(children) {
8626 return children;
8627 }
8628 function getChildrenArray(children) {
8629 (0, import_deprecated8.default)("wp.blocks.children.getChildrenArray", {
8630 since: "6.1",
8631 version: "6.3",
8632 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8633 });
8634 return children;
8635 }
8636 function concat(...blockNodes) {
8637 (0, import_deprecated8.default)("wp.blocks.children.concat", {
8638 since: "6.1",
8639 version: "6.3",
8640 alternative: "wp.richText.concat",
8641 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8642 });
8643 const result = [];
8644 for (let i2 = 0; i2 < blockNodes.length; i2++) {
8645 const blockNode = Array.isArray(blockNodes[i2]) ? blockNodes[i2] : [blockNodes[i2]];
8646 for (let j2 = 0; j2 < blockNode.length; j2++) {
8647 const child = blockNode[j2];
8648 const canConcatToPreviousString = typeof child === "string" && typeof result[result.length - 1] === "string";
8649 if (canConcatToPreviousString) {
8650 result[result.length - 1] += child;
8651 } else {
8652 result.push(child);
8653 }
8654 }
8655 }
8656 return result;
8657 }
8658 function fromDOM22(domNodes) {
8659 (0, import_deprecated8.default)("wp.blocks.children.fromDOM", {
8660 since: "6.1",
8661 version: "6.3",
8662 alternative: "wp.richText.create",
8663 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8664 });
8665 const result = [];
8666 for (let i2 = 0; i2 < domNodes.length; i2++) {
8667 try {
8668 result.push(fromDOM2(domNodes[i2]));
8669 } catch {
8670 }
8671 }
8672 return result;
8673 }
8674 function toHTML(children) {
8675 (0, import_deprecated8.default)("wp.blocks.children.toHTML", {
8676 since: "6.1",
8677 version: "6.3",
8678 alternative: "wp.richText.toHTMLString",
8679 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8680 });
8681 const element = getSerializeCapableElement(children);
8682 return (0, import_element3.renderToString)(element);
8683 }
8684 function matcher(selector) {
8685 (0, import_deprecated8.default)("wp.blocks.children.matcher", {
8686 since: "6.1",
8687 version: "6.3",
8688 alternative: "html source",
8689 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8690 });
8691 return (domNode) => {
8692 let match = domNode;
8693 if (selector) {
8694 match = domNode.querySelector(selector);
8695 }
8696 if (match) {
8697 return fromDOM22(match.childNodes);
8698 }
8699 return [];
8700 };
8701 }
8702 var children_default = {
8703 concat,
8704 getChildrenArray,
8705 fromDOM: fromDOM22,
8706 toHTML,
8707 matcher
8708 };
8709
8710 // packages/blocks/build-module/api/node.mjs
8711 function isNodeOfType(node, type) {
8712 (0, import_deprecated9.default)("wp.blocks.node.isNodeOfType", {
8713 since: "6.1",
8714 version: "6.3",
8715 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8716 });
8717 return typeof node !== "string" && node?.type === type;
8718 }
8719 function getNamedNodeMapAsObject(nodeMap) {
8720 const result = {};
8721 for (let i2 = 0; i2 < nodeMap.length; i2++) {
8722 const { name, value } = nodeMap[i2];
8723 result[name] = value;
8724 }
8725 return result;
8726 }
8727 function fromDOM2(domNode) {
8728 (0, import_deprecated9.default)("wp.blocks.node.fromDOM", {
8729 since: "6.1",
8730 version: "6.3",
8731 alternative: "wp.richText.create",
8732 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8733 });
8734 if (domNode.nodeType === domNode.TEXT_NODE) {
8735 return domNode.nodeValue;
8736 }
8737 if (domNode.nodeType !== domNode.ELEMENT_NODE) {
8738 throw new TypeError(
8739 "A block node can only be created from a node of type text or element."
8740 );
8741 }
8742 return {
8743 type: domNode.nodeName.toLowerCase(),
8744 props: {
8745 ...getNamedNodeMapAsObject(domNode.attributes),
8746 children: fromDOM22(domNode.childNodes)
8747 }
8748 };
8749 }
8750 function toHTML2(node) {
8751 (0, import_deprecated9.default)("wp.blocks.node.toHTML", {
8752 since: "6.1",
8753 version: "6.3",
8754 alternative: "wp.richText.toHTMLString",
8755 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8756 });
8757 return toHTML([node]);
8758 }
8759 function matcher2(selector) {
8760 (0, import_deprecated9.default)("wp.blocks.node.matcher", {
8761 since: "6.1",
8762 version: "6.3",
8763 alternative: "html source",
8764 link: "https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"
8765 });
8766 return (domNode) => {
8767 let match = domNode;
8768 if (selector) {
8769 match = domNode.querySelector(selector);
8770 }
8771 try {
8772 return fromDOM2(match);
8773 } catch {
8774 return null;
8775 }
8776 };
8777 }
8778 var node_default = {
8779 isNodeOfType,
8780 fromDOM: fromDOM2,
8781 toHTML: toHTML2,
8782 matcher: matcher2
8783 };
8784
8785 // packages/blocks/build-module/api/matchers.mjs
8786 function html(selector, multilineTag) {
8787 return (domNode) => {
8788 let match = domNode;
8789 if (selector) {
8790 match = domNode.querySelector(selector);
8791 }
8792 if (!match) {
8793 return "";
8794 }
8795 if (multilineTag) {
8796 let value = "";
8797 const length = match.children.length;
8798 for (let index = 0; index < length; index++) {
8799 const child = match.children[index];
8800 if (child.nodeName.toLowerCase() !== multilineTag) {
8801 continue;
8802 }
8803 value += child.outerHTML;
8804 }
8805 return value;
8806 }
8807 return match.innerHTML;
8808 };
8809 }
8810 var richText = (selector, preserveWhiteSpace) => (el) => {
8811 const target = selector ? el.querySelector(selector) : el;
8812 return target ? import_rich_text3.RichTextData.fromHTMLElement(target, {
8813 preserveWhiteSpace
8814 }) : import_rich_text3.RichTextData.empty();
8815 };
8816
8817 // packages/blocks/build-module/api/parser/get-block-attributes.mjs
8818 var toBooleanAttributeMatcher = (matcher3) => (value) => matcher3(value) !== void 0;
8819 function isOfType(value, type) {
8820 switch (type) {
8821 case "rich-text":
8822 return value instanceof import_rich_text4.RichTextData;
8823 case "string":
8824 return typeof value === "string";
8825 case "boolean":
8826 return typeof value === "boolean";
8827 case "object":
8828 return !!value && value.constructor === Object;
8829 case "null":
8830 return value === null;
8831 case "array":
8832 return Array.isArray(value);
8833 case "integer":
8834 case "number":
8835 return typeof value === "number";
8836 }
8837 return true;
8838 }
8839 function isOfTypes(value, types) {
8840 return types.some((type) => isOfType(value, type));
8841 }
8842 function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) {
8843 let value;
8844 switch (attributeSchema.source) {
8845 // An undefined source means that it's an attribute serialized to the
8846 // block's "comment".
8847 case void 0:
8848 value = commentAttributes ? commentAttributes[attributeKey] : void 0;
8849 break;
8850 // raw source means that it's the original raw block content.
8851 case "raw":
8852 value = innerHTML;
8853 break;
8854 case "attribute":
8855 case "property":
8856 case "html":
8857 case "text":
8858 case "rich-text":
8859 case "children":
8860 case "node":
8861 case "query":
8862 case "tag":
8863 value = parseWithAttributeSchema(innerDOM, attributeSchema);
8864 break;
8865 }
8866 if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) {
8867 value = void 0;
8868 }
8869 if (value === void 0) {
8870 value = getDefault(attributeSchema);
8871 }
8872 return value;
8873 }
8874 function isValidByType(value, type) {
8875 return type === void 0 || isOfTypes(value, Array.isArray(type) ? type : [type]);
8876 }
8877 function isValidByEnum(value, enumSet) {
8878 return !Array.isArray(enumSet) || enumSet.includes(value);
8879 }
8880 var matcherFromSource = memize(
8881 (sourceConfig) => {
8882 switch (sourceConfig.source) {
8883 case "attribute": {
8884 let matcher3 = attr(
8885 sourceConfig.selector,
8886 sourceConfig.attribute
8887 );
8888 if (sourceConfig.type === "boolean") {
8889 matcher3 = toBooleanAttributeMatcher(matcher3);
8890 }
8891 return matcher3;
8892 }
8893 case "html":
8894 return html(sourceConfig.selector, sourceConfig.multiline);
8895 case "text":
8896 return text(sourceConfig.selector);
8897 case "rich-text":
8898 return richText(
8899 sourceConfig.selector,
8900 sourceConfig.__unstablePreserveWhiteSpace
8901 );
8902 case "children":
8903 return matcher(sourceConfig.selector);
8904 case "node":
8905 return matcher2(sourceConfig.selector);
8906 case "query":
8907 const subMatchers = Object.fromEntries(
8908 Object.entries(sourceConfig.query).map(
8909 ([key, subSourceConfig]) => [
8910 key,
8911 matcherFromSource(subSourceConfig)
8912 ]
8913 )
8914 );
8915 return query(sourceConfig.selector, subMatchers);
8916 case "tag": {
8917 const matcher3 = prop(sourceConfig.selector, "nodeName");
8918 return (domNode) => matcher3(domNode)?.toLowerCase();
8919 }
8920 default:
8921 console.error(
8922 `Unknown source type "${sourceConfig.source}"`
8923 );
8924 return void 0;
8925 }
8926 }
8927 );
8928 function parseHtml(innerHTML) {
8929 return parse(innerHTML, (h2) => h2);
8930 }
8931 function parseWithAttributeSchema(innerHTML, attributeSchema) {
8932 return matcherFromSource(attributeSchema)(
8933 parseHtml(innerHTML)
8934 );
8935 }
8936 function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) {
8937 const doc = parseHtml(innerHTML);
8938 const blockType = normalizeBlockType(blockTypeOrName);
8939 const blockAttributes = Object.fromEntries(
8940 Object.entries(blockType?.attributes ?? {}).map(
8941 ([key, schema]) => [
8942 key,
8943 getBlockAttribute(key, schema, doc, attributes, innerHTML)
8944 ]
8945 )
8946 );
8947 return (0, import_hooks4.applyFilters)(
8948 "blocks.getBlockAttributes",
8949 blockAttributes,
8950 blockType,
8951 innerHTML,
8952 attributes
8953 );
8954 }
8955
8956 // packages/blocks/build-module/api/parser/fix-custom-classname.mjs
8957 var CLASS_ATTR_SCHEMA = {
8958 type: "string",
8959 source: "attribute",
8960 selector: "[data-custom-class-name] > *",
8961 attribute: "class"
8962 };
8963 function getHTMLRootElementClasses(innerHTML) {
8964 const parsed = parseWithAttributeSchema(
8965 `<div data-custom-class-name>${innerHTML}</div>`,
8966 CLASS_ATTR_SCHEMA
8967 );
8968 return parsed ? parsed.trim().split(/\s+/) : [];
8969 }
8970 function fixCustomClassname(blockAttributes, blockType, innerHTML) {
8971 if (!hasBlockSupport(blockType, "customClassName", true)) {
8972 return blockAttributes;
8973 }
8974 const modifiedBlockAttributes = { ...blockAttributes };
8975 const { className: omittedClassName, ...attributesSansClassName } = modifiedBlockAttributes;
8976 const serialized = getSaveContent(blockType, attributesSansClassName);
8977 const defaultClasses = getHTMLRootElementClasses(serialized);
8978 const actualClasses = getHTMLRootElementClasses(innerHTML);
8979 const customClasses = actualClasses.filter(
8980 (className) => !defaultClasses.includes(className)
8981 );
8982 if (customClasses.length) {
8983 modifiedBlockAttributes.className = customClasses.join(" ");
8984 } else if (serialized) {
8985 delete modifiedBlockAttributes.className;
8986 }
8987 return modifiedBlockAttributes;
8988 }
8989
8990 // packages/blocks/build-module/api/parser/fix-global-attribute.mjs
8991 function getHTMLRootElement(innerHTML, dataAttribute, attributeSchema) {
8992 const parsed = parseWithAttributeSchema(
8993 `<div ${dataAttribute}>${innerHTML}</div>`,
8994 attributeSchema
8995 );
8996 return parsed;
8997 }
8998 function fixGlobalAttribute(blockAttributes, blockType, innerHTML, supportKey, dataAttribute, attributeSchema) {
8999 if (!hasBlockSupport(blockType, supportKey, false)) {
9000 return blockAttributes;
9001 }
9002 const modifiedBlockAttributes = { ...blockAttributes };
9003 const attributeValue = getHTMLRootElement(
9004 innerHTML,
9005 dataAttribute,
9006 attributeSchema
9007 );
9008 if (attributeValue) {
9009 modifiedBlockAttributes[supportKey] = attributeValue;
9010 }
9011 return modifiedBlockAttributes;
9012 }
9013
9014 // packages/blocks/build-module/api/parser/apply-built-in-validation-fixes.mjs
9015 var ARIA_LABEL_ATTR_SCHEMA = {
9016 type: "string",
9017 source: "attribute",
9018 selector: "[data-aria-label] > *",
9019 attribute: "aria-label"
9020 };
9021 var ANCHOR_ATTR_SCHEMA = {
9022 type: "string",
9023 source: "attribute",
9024 selector: "[data-anchor] > *",
9025 attribute: "id"
9026 };
9027 function applyBuiltInValidationFixes(block, blockType) {
9028 const { attributes, originalContent } = block;
9029 let updatedBlockAttributes = attributes;
9030 updatedBlockAttributes = fixCustomClassname(
9031 attributes,
9032 blockType,
9033 originalContent ?? ""
9034 );
9035 updatedBlockAttributes = fixGlobalAttribute(
9036 updatedBlockAttributes,
9037 blockType,
9038 originalContent ?? "",
9039 "ariaLabel",
9040 "data-aria-label",
9041 ARIA_LABEL_ATTR_SCHEMA
9042 );
9043 updatedBlockAttributes = fixGlobalAttribute(
9044 updatedBlockAttributes,
9045 blockType,
9046 originalContent ?? "",
9047 "anchor",
9048 "data-anchor",
9049 ANCHOR_ATTR_SCHEMA
9050 );
9051 return {
9052 ...block,
9053 attributes: updatedBlockAttributes
9054 };
9055 }
9056
9057 // packages/blocks/build-module/api/parser/apply-block-deprecated-versions.mjs
9058 function stubFalse() {
9059 return false;
9060 }
9061 function applyBlockDeprecatedVersions(block, rawBlock, blockType) {
9062 const parsedAttributes = rawBlock.attrs ?? {};
9063 const { deprecated: deprecatedDefinitions } = blockType;
9064 if (!deprecatedDefinitions || !deprecatedDefinitions.length) {
9065 return block;
9066 }
9067 for (let i2 = 0; i2 < deprecatedDefinitions.length; i2++) {
9068 const { isEligible = stubFalse } = deprecatedDefinitions[i2];
9069 if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, {
9070 blockNode: rawBlock,
9071 block
9072 })) {
9073 continue;
9074 }
9075 const deprecatedBlockType = Object.assign(
9076 omit(
9077 blockType,
9078 DEPRECATED_ENTRY_KEYS
9079 ),
9080 deprecatedDefinitions[i2]
9081 );
9082 let migratedBlock = {
9083 ...block,
9084 attributes: getBlockAttributes(
9085 deprecatedBlockType,
9086 block.originalContent ?? "",
9087 parsedAttributes
9088 )
9089 };
9090 let [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
9091 if (!isValid) {
9092 migratedBlock = applyBuiltInValidationFixes(
9093 migratedBlock,
9094 deprecatedBlockType
9095 );
9096 [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
9097 }
9098 if (!isValid) {
9099 continue;
9100 }
9101 let migratedInnerBlocks = migratedBlock.innerBlocks;
9102 let migratedAttributes = migratedBlock.attributes;
9103 const { migrate } = deprecatedBlockType;
9104 if (migrate) {
9105 let migrated = migrate(migratedAttributes, block.innerBlocks);
9106 if (!Array.isArray(migrated)) {
9107 migrated = [migrated];
9108 }
9109 [
9110 migratedAttributes = parsedAttributes,
9111 migratedInnerBlocks = block.innerBlocks
9112 ] = migrated;
9113 }
9114 block = {
9115 ...block,
9116 attributes: migratedAttributes,
9117 innerBlocks: migratedInnerBlocks,
9118 isValid: true,
9119 validationIssues: []
9120 };
9121 }
9122 return block;
9123 }
9124
9125 // packages/blocks/build-module/api/parser/index.mjs
9126 function convertLegacyBlocks(rawBlock) {
9127 const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(
9128 rawBlock.blockName,
9129 rawBlock.attrs ?? {}
9130 );
9131 return {
9132 ...rawBlock,
9133 blockName: correctName,
9134 attrs: correctedAttributes
9135 };
9136 }
9137 function normalizeRawBlock(rawBlock, options) {
9138 const fallbackBlockName = getFreeformContentHandlerName();
9139 const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName();
9140 const rawAttributes = rawBlock.attrs || {};
9141 const rawInnerBlocks = rawBlock.innerBlocks || [];
9142 let rawInnerHTML = rawBlock.innerHTML.trim();
9143 if (rawBlockName === fallbackBlockName && rawBlockName === "core/freeform" && !options?.__unstableSkipAutop) {
9144 rawInnerHTML = (0, import_autop2.autop)(rawInnerHTML).trim();
9145 }
9146 return {
9147 ...rawBlock,
9148 blockName: rawBlockName,
9149 attrs: rawAttributes,
9150 innerHTML: rawInnerHTML,
9151 innerBlocks: rawInnerBlocks
9152 };
9153 }
9154 function createMissingBlockType(rawBlock) {
9155 const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName();
9156 const originalUndelimitedContent = serializeRawBlock(rawBlock, {
9157 isCommentDelimited: false
9158 });
9159 const originalContent = serializeRawBlock(rawBlock, {
9160 isCommentDelimited: true
9161 });
9162 return {
9163 blockName: unregisteredFallbackBlock,
9164 attrs: {
9165 originalName: rawBlock.blockName,
9166 originalContent,
9167 originalUndelimitedContent
9168 },
9169 innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML,
9170 innerBlocks: rawBlock.innerBlocks,
9171 innerContent: rawBlock.innerContent
9172 };
9173 }
9174 function applyBlockValidation(unvalidatedBlock, blockType) {
9175 const [isValid] = validateBlock(unvalidatedBlock, blockType);
9176 if (isValid) {
9177 return { ...unvalidatedBlock, isValid, validationIssues: [] };
9178 }
9179 const fixedBlock = applyBuiltInValidationFixes(
9180 unvalidatedBlock,
9181 blockType
9182 );
9183 const [isFixedValid, validationIssues] = validateBlock(
9184 fixedBlock,
9185 blockType
9186 );
9187 return { ...fixedBlock, isValid: isFixedValid, validationIssues };
9188 }
9189 function parseRawBlock(rawBlock, options) {
9190 let normalizedBlock = normalizeRawBlock(rawBlock, options);
9191 normalizedBlock = convertLegacyBlocks(normalizedBlock);
9192 let blockType = getBlockType(normalizedBlock.blockName);
9193 if (!blockType) {
9194 normalizedBlock = createMissingBlockType(normalizedBlock);
9195 blockType = getBlockType(normalizedBlock.blockName);
9196 }
9197 const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName();
9198 if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) {
9199 return;
9200 }
9201 const parsedInnerBlocks = normalizedBlock.innerBlocks.map((innerBlock) => parseRawBlock(innerBlock, options)).filter((innerBlock) => !!innerBlock);
9202 const parsedBlock = createBlock(
9203 normalizedBlock.blockName,
9204 getBlockAttributes(
9205 blockType,
9206 normalizedBlock.innerHTML,
9207 normalizedBlock.attrs
9208 ),
9209 parsedInnerBlocks
9210 );
9211 parsedBlock.originalContent = normalizedBlock.innerHTML;
9212 const validatedBlock = applyBlockValidation(parsedBlock, blockType);
9213 const { validationIssues } = validatedBlock;
9214 const updatedBlock = applyBlockDeprecatedVersions(
9215 validatedBlock,
9216 normalizedBlock,
9217 blockType
9218 );
9219 if (!updatedBlock.isValid) {
9220 updatedBlock.__unstableBlockSource = rawBlock;
9221 }
9222 if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) {
9223 console.groupCollapsed("Updated Block: %s", blockType.name);
9224 console.info(
9225 "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",
9226 blockType.name,
9227 blockType,
9228 getSaveContent(blockType, updatedBlock.attributes),
9229 updatedBlock.originalContent
9230 );
9231 console.groupEnd();
9232 } else if (!validatedBlock.isValid && !updatedBlock.isValid) {
9233 validationIssues.forEach(({ log: log2, args }) => log2(...args));
9234 }
9235 return updatedBlock;
9236 }
9237 function parse2(content, options) {
9238 return (0, import_block_serialization_default_parser.parse)(content).reduce(
9239 (accumulator, rawBlock) => {
9240 const block = parseRawBlock(
9241 rawBlock,
9242 options
9243 );
9244 if (block) {
9245 accumulator.push(block);
9246 }
9247 return accumulator;
9248 },
9249 []
9250 );
9251 }
9252
9253 // packages/blocks/build-module/api/raw-handling/index.mjs
9254 var import_deprecated10 = __toESM(require_deprecated(), 1);
9255 var import_dom12 = __toESM(require_dom(), 1);
9256
9257 // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs
9258 var import_element4 = __toESM(require_element(), 1);
9259
9260 // packages/blocks/build-module/api/raw-handling/get-raw-transforms.mjs
9261 function getRawTransforms() {
9262 return getBlockTransforms("from").filter(({ type }) => type === "raw").map((transform) => {
9263 return transform.isMatch ? transform : {
9264 ...transform,
9265 isMatch: (node) => transform.selector && node.matches(transform.selector)
9266 };
9267 });
9268 }
9269
9270 // packages/blocks/build-module/api/raw-handling/html-to-blocks.mjs
9271 function htmlToBlocks(html2, handler) {
9272 const doc = document.implementation.createHTMLDocument("");
9273 doc.body.innerHTML = html2;
9274 return Array.from(doc.body.children).flatMap((node) => {
9275 const transforms = getRawTransforms();
9276 const rawTransform = findTransform(
9277 transforms,
9278 ((t3) => {
9279 const transform2 = t3;
9280 return transform2.isMatch(node);
9281 })
9282 );
9283 if (!rawTransform) {
9284 if (import_element4.Platform.isNative) {
9285 return parse2(
9286 `<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->`
9287 );
9288 }
9289 return createBlock(
9290 // Should not be hardcoded.
9291 "core/html",
9292 getBlockAttributes("core/html", node.outerHTML)
9293 );
9294 }
9295 const { transform, blockName } = rawTransform;
9296 if (transform) {
9297 const block = transform(node, handler);
9298 if (node.hasAttribute("class")) {
9299 block.attributes.className = node.getAttribute("class");
9300 }
9301 return block;
9302 }
9303 return createBlock(
9304 blockName,
9305 getBlockAttributes(blockName, node.outerHTML)
9306 );
9307 });
9308 }
9309
9310 // packages/blocks/build-module/api/raw-handling/normalise-blocks.mjs
9311 var import_dom2 = __toESM(require_dom(), 1);
9312 function normaliseBlocks(HTML, options = {}) {
9313 const decuDoc = document.implementation.createHTMLDocument("");
9314 const accuDoc = document.implementation.createHTMLDocument("");
9315 const decu = decuDoc.body;
9316 const accu = accuDoc.body;
9317 decu.innerHTML = HTML;
9318 while (decu.firstChild) {
9319 const node = decu.firstChild;
9320 if (node.nodeType === node.TEXT_NODE) {
9321 if ((0, import_dom2.isEmpty)(node)) {
9322 decu.removeChild(node);
9323 } else {
9324 if (!accu.lastChild || accu.lastChild.nodeName !== "P") {
9325 accu.appendChild(accuDoc.createElement("P"));
9326 }
9327 accu.lastChild.appendChild(node);
9328 }
9329 } else if (node.nodeType === node.ELEMENT_NODE) {
9330 if (node.nodeName === "BR") {
9331 if (node.nextSibling && node.nextSibling.nodeName === "BR") {
9332 accu.appendChild(accuDoc.createElement("P"));
9333 decu.removeChild(node.nextSibling);
9334 }
9335 if (accu.lastChild && accu.lastChild.nodeName === "P" && accu.lastChild.hasChildNodes()) {
9336 accu.lastChild.appendChild(node);
9337 } else {
9338 decu.removeChild(node);
9339 }
9340 } else if (node.nodeName === "P") {
9341 if ((0, import_dom2.isEmpty)(node) && !options.raw) {
9342 decu.removeChild(node);
9343 } else {
9344 accu.appendChild(node);
9345 }
9346 } else if ((0, import_dom2.isPhrasingContent)(node)) {
9347 if (!accu.lastChild || accu.lastChild.nodeName !== "P") {
9348 accu.appendChild(accuDoc.createElement("P"));
9349 }
9350 accu.lastChild.appendChild(node);
9351 } else {
9352 accu.appendChild(node);
9353 }
9354 } else {
9355 decu.removeChild(node);
9356 }
9357 }
9358 return accu.innerHTML;
9359 }
9360
9361 // packages/blocks/build-module/api/raw-handling/special-comment-converter.mjs
9362 var import_dom3 = __toESM(require_dom(), 1);
9363 function specialCommentConverter(node, doc) {
9364 if (node.nodeType !== node.COMMENT_NODE) {
9365 return;
9366 }
9367 if (node.nodeValue !== "nextpage" && node.nodeValue.indexOf("more") !== 0) {
9368 return;
9369 }
9370 const block = createBlock2(node, doc);
9371 if (!node.parentNode || node.parentNode.nodeName !== "P") {
9372 (0, import_dom3.replace)(node, block);
9373 } else {
9374 const childNodes = Array.from(node.parentNode.childNodes);
9375 const nodeIndex = childNodes.indexOf(node);
9376 const wrapperNode = node.parentNode.parentNode || doc.body;
9377 const paragraphBuilder = (acc, child) => {
9378 if (!acc) {
9379 acc = doc.createElement("p");
9380 }
9381 acc.appendChild(child);
9382 return acc;
9383 };
9384 [
9385 childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null),
9386 block,
9387 childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null)
9388 ].forEach(
9389 (element) => element && wrapperNode.insertBefore(element, node.parentNode)
9390 );
9391 (0, import_dom3.remove)(node.parentNode);
9392 }
9393 }
9394 function createBlock2(commentNode, doc) {
9395 if (commentNode.nodeValue === "nextpage") {
9396 return createNextpage(doc);
9397 }
9398 const customText = commentNode.nodeValue.slice(4).trim();
9399 let sibling = commentNode;
9400 let noTeaser = false;
9401 while (sibling = sibling.nextSibling) {
9402 if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === "noteaser") {
9403 noTeaser = true;
9404 (0, import_dom3.remove)(sibling);
9405 break;
9406 }
9407 }
9408 return createMore(customText, noTeaser, doc);
9409 }
9410 function createMore(customText, noTeaser, doc) {
9411 const node = doc.createElement("wp-block");
9412 node.dataset.block = "core/more";
9413 if (customText) {
9414 node.dataset.customText = customText;
9415 }
9416 if (noTeaser) {
9417 node.dataset.noTeaser = "";
9418 }
9419 return node;
9420 }
9421 function createNextpage(doc) {
9422 const node = doc.createElement("wp-block");
9423 node.dataset.block = "core/nextpage";
9424 return node;
9425 }
9426
9427 // packages/blocks/build-module/api/raw-handling/list-reducer.mjs
9428 var import_dom4 = __toESM(require_dom(), 1);
9429 function isList(node) {
9430 return node.nodeName === "OL" || node.nodeName === "UL";
9431 }
9432 function shallowTextContent(element) {
9433 return Array.from(element.childNodes).map(({ nodeValue = "" }) => nodeValue).join("");
9434 }
9435 function listReducer(node) {
9436 if (!isList(node)) {
9437 return;
9438 }
9439 const list = node;
9440 const prevElement = list.previousElementSibling;
9441 if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) {
9442 while (list.firstChild) {
9443 prevElement.appendChild(list.firstChild);
9444 }
9445 list.parentNode.removeChild(list);
9446 }
9447 const parentElement = node.parentNode;
9448 if (parentElement && parentElement.nodeName === "LI" && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) {
9449 const parentListItem = parentElement;
9450 const prevListItem = parentListItem.previousElementSibling;
9451 const parentList = parentListItem.parentNode;
9452 if (prevListItem) {
9453 prevListItem.appendChild(list);
9454 parentList.removeChild(parentListItem);
9455 }
9456 }
9457 if (parentElement && isList(parentElement)) {
9458 const prevListItem = list.previousElementSibling;
9459 if (prevListItem) {
9460 prevListItem.appendChild(node);
9461 } else {
9462 (0, import_dom4.unwrap)(node);
9463 }
9464 }
9465 }
9466
9467 // packages/blocks/build-module/api/raw-handling/blockquote-normaliser.mjs
9468 function blockquoteNormaliser(options = {}) {
9469 return (bq) => {
9470 if (bq.nodeName !== "BLOCKQUOTE") {
9471 return;
9472 }
9473 const node = bq;
9474 node.innerHTML = normaliseBlocks(node.innerHTML, options);
9475 };
9476 }
9477
9478 // packages/blocks/build-module/api/raw-handling/figure-content-reducer.mjs
9479 var import_dom5 = __toESM(require_dom(), 1);
9480 function isFigureContent(node, schema) {
9481 const tag = node.nodeName.toLowerCase();
9482 if (tag === "figcaption" || (0, import_dom5.isTextContent)(node)) {
9483 return false;
9484 }
9485 return tag in (schema?.figure?.children ?? {});
9486 }
9487 function canHaveAnchor(node, schema) {
9488 const tag = node.nodeName.toLowerCase();
9489 return tag in (schema?.figure?.children?.a?.children ?? {});
9490 }
9491 function wrapFigureContent(element, beforeElement = element) {
9492 const figure = element.ownerDocument.createElement("figure");
9493 beforeElement.parentNode.insertBefore(figure, beforeElement);
9494 figure.appendChild(element);
9495 }
9496 function figureContentReducer(node, doc, schema) {
9497 if (!schema || !isFigureContent(node, schema)) {
9498 return;
9499 }
9500 let nodeToInsert = node;
9501 const parentNode = node.parentNode;
9502 if (canHaveAnchor(node, schema) && parentNode.nodeName === "A" && parentNode.childNodes.length === 1) {
9503 nodeToInsert = node.parentNode;
9504 }
9505 const wrapper = nodeToInsert.closest("p,div");
9506 if (wrapper) {
9507 const element = node;
9508 if (!element.classList) {
9509 wrapFigureContent(nodeToInsert, wrapper);
9510 } else if (element.classList.contains("alignright") || element.classList.contains("alignleft") || element.classList.contains("aligncenter") || !wrapper.textContent.trim()) {
9511 wrapFigureContent(nodeToInsert, wrapper);
9512 }
9513 } else {
9514 wrapFigureContent(nodeToInsert);
9515 }
9516 }
9517
9518 // packages/blocks/build-module/api/raw-handling/shortcode-converter.mjs
9519 var import_shortcode = __toESM(require_shortcode(), 1);
9520 var castArray = (maybeArray) => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
9521 var beforeLineRegexp = /(\n|<p>|<br\s*\/?>)\s*$/;
9522 var afterLineRegexp = /^\s*(\n|<\/p>|<br\s*\/?>)/;
9523 function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) {
9524 const transformsFrom = getBlockTransforms(
9525 "from"
9526 );
9527 const transformation = findTransform(
9528 transformsFrom,
9529 ((transform) => {
9530 const t3 = transform;
9531 return excludedBlockNames.indexOf(t3.blockName) === -1 && t3.type === "shortcode" && castArray(t3.tag).some(
9532 (tag) => (0, import_shortcode.regexp)(tag).test(HTML)
9533 );
9534 })
9535 );
9536 if (!transformation) {
9537 return [HTML];
9538 }
9539 const transformTags = castArray(transformation.tag);
9540 const transformTag = transformTags.find(
9541 (tag) => (0, import_shortcode.regexp)(tag).test(HTML)
9542 );
9543 let match;
9544 const previousIndex = lastIndex;
9545 if (match = (0, import_shortcode.next)(transformTag, HTML, lastIndex)) {
9546 lastIndex = match.index + match.content.length;
9547 const beforeHTML = HTML.substr(0, match.index);
9548 const afterHTML = HTML.substr(lastIndex);
9549 if (!match.shortcode.content?.includes("<") && !(beforeLineRegexp.test(beforeHTML) && afterLineRegexp.test(afterHTML))) {
9550 return segmentHTMLToShortcodeBlock(HTML, lastIndex);
9551 }
9552 if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) {
9553 return segmentHTMLToShortcodeBlock(HTML, previousIndex, [
9554 ...excludedBlockNames,
9555 transformation.blockName
9556 ]);
9557 }
9558 let blocks = [];
9559 if (typeof transformation.transform === "function") {
9560 blocks = [].concat(
9561 transformation.transform(match.shortcode.attrs, match)
9562 );
9563 blocks = blocks.map((block) => {
9564 block.originalContent = match.shortcode.content;
9565 return applyBuiltInValidationFixes(
9566 block,
9567 getBlockType(block.name)
9568 );
9569 });
9570 } else {
9571 const attributes = Object.fromEntries(
9572 Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode).map(([key, schema]) => [
9573 key,
9574 schema.shortcode(match.shortcode.attrs, match)
9575 ])
9576 );
9577 const blockType = getBlockType(transformation.blockName);
9578 if (!blockType) {
9579 return [HTML];
9580 }
9581 const transformationBlockType = {
9582 ...blockType,
9583 attributes: transformation.attributes
9584 };
9585 let block = createBlock(
9586 transformation.blockName,
9587 getBlockAttributes(
9588 transformationBlockType,
9589 match.shortcode.content,
9590 attributes
9591 )
9592 );
9593 block.originalContent = match.shortcode.content;
9594 block = applyBuiltInValidationFixes(
9595 block,
9596 transformationBlockType
9597 );
9598 blocks = [block];
9599 }
9600 return [
9601 ...segmentHTMLToShortcodeBlock(
9602 beforeHTML.replace(beforeLineRegexp, "")
9603 ),
9604 ...blocks,
9605 ...segmentHTMLToShortcodeBlock(
9606 afterHTML.replace(afterLineRegexp, "")
9607 )
9608 ];
9609 }
9610 return [HTML];
9611 }
9612 var shortcode_converter_default = segmentHTMLToShortcodeBlock;
9613
9614 // packages/blocks/build-module/api/raw-handling/utils.mjs
9615 var import_dom6 = __toESM(require_dom(), 1);
9616 function getBlockContentSchemaFromTransforms(transforms, context) {
9617 const phrasingContentSchema = (0, import_dom6.getPhrasingContentSchema)(context);
9618 const schemaArgs = { phrasingContentSchema, isPaste: context === "paste" };
9619 const schemas = transforms.map(({ isMatch, blockName, schema }) => {
9620 const hasAnchorSupport = hasBlockSupport(blockName, "anchor");
9621 schema = typeof schema === "function" ? schema(schemaArgs) : schema;
9622 if (!hasAnchorSupport && !isMatch) {
9623 return schema;
9624 }
9625 if (!schema) {
9626 return {};
9627 }
9628 return Object.fromEntries(
9629 Object.entries(schema).map(([key, value]) => {
9630 let attributes = value.attributes || [];
9631 if (hasAnchorSupport) {
9632 attributes = [...attributes, "id"];
9633 }
9634 return [
9635 key,
9636 {
9637 ...value,
9638 attributes,
9639 isMatch: isMatch ? isMatch : void 0
9640 }
9641 ];
9642 })
9643 );
9644 });
9645 function mergeTagNameSchemaProperties(objValue, srcValue, key) {
9646 switch (key) {
9647 case "children": {
9648 if (objValue === "*" || srcValue === "*") {
9649 return "*";
9650 }
9651 return mergeSchemas(
9652 { ...objValue || {} },
9653 srcValue || {}
9654 );
9655 }
9656 case "attributes":
9657 case "require": {
9658 return Array.from(
9659 /* @__PURE__ */ new Set([...objValue || [], ...srcValue || []])
9660 );
9661 }
9662 case "isMatch": {
9663 if (!objValue || !srcValue) {
9664 return void 0;
9665 }
9666 return (...args) => {
9667 return objValue(...args) || srcValue(...args);
9668 };
9669 }
9670 case "classes": {
9671 if ((objValue || []).includes("*") || (srcValue || []).includes("*")) {
9672 return ["*"];
9673 }
9674 return [...objValue || [], ...srcValue || []];
9675 }
9676 }
9677 }
9678 function mergeTagNameSchemas(a2, b2) {
9679 if (a2 === b2) {
9680 return a2;
9681 }
9682 for (const key in b2) {
9683 if (a2[key]) {
9684 a2[key] = mergeTagNameSchemaProperties(
9685 a2[key],
9686 b2[key],
9687 key
9688 );
9689 } else if (Array.isArray(b2[key])) {
9690 a2[key] = b2[key].slice();
9691 } else {
9692 a2[key] = { ...b2[key] };
9693 }
9694 }
9695 return a2;
9696 }
9697 function mergeSchemas(a2, b2) {
9698 if (a2 === b2) {
9699 return a2;
9700 }
9701 for (const key in b2) {
9702 if (a2[key]) {
9703 a2[key] = mergeTagNameSchemas(a2[key], b2[key]);
9704 } else if (Array.isArray(b2[key])) {
9705 a2[key] = b2[key].slice();
9706 } else {
9707 a2[key] = { ...b2[key] };
9708 }
9709 }
9710 return a2;
9711 }
9712 return schemas.reduce(mergeSchemas, {});
9713 }
9714 function getBlockContentSchema(context) {
9715 return getBlockContentSchemaFromTransforms(getRawTransforms(), context);
9716 }
9717 function isPlain(HTML) {
9718 if (!/<(?!br[ />])/i.test(HTML)) {
9719 return true;
9720 }
9721 const doc = document.implementation.createHTMLDocument("");
9722 doc.body.innerHTML = HTML;
9723 if (doc.body.children.length !== 1) {
9724 return false;
9725 }
9726 const wrapper = doc.body.children.item(0);
9727 const descendants = wrapper.getElementsByTagName("*");
9728 for (let i2 = 0; i2 < descendants.length; i2++) {
9729 if (descendants.item(i2).tagName !== "BR") {
9730 return false;
9731 }
9732 }
9733 if (wrapper.tagName !== "SPAN") {
9734 return false;
9735 }
9736 return true;
9737 }
9738 function deepFilterNodeList(nodeList, filters, doc, schema) {
9739 Array.from(nodeList).forEach((node) => {
9740 deepFilterNodeList(node.childNodes, filters, doc, schema);
9741 filters.forEach((item) => {
9742 if (!doc.contains(node)) {
9743 return;
9744 }
9745 item(node, doc, schema);
9746 });
9747 });
9748 }
9749 function deepFilterHTML(HTML, filters = [], schema) {
9750 const doc = document.implementation.createHTMLDocument("");
9751 doc.body.innerHTML = HTML;
9752 deepFilterNodeList(doc.body.childNodes, filters, doc, schema);
9753 return doc.body.innerHTML;
9754 }
9755 function getSibling(node, which) {
9756 const sibling = node[`${which}Sibling`];
9757 if (sibling && (0, import_dom6.isPhrasingContent)(sibling)) {
9758 return sibling;
9759 }
9760 const { parentNode } = node;
9761 if (!parentNode || !(0, import_dom6.isPhrasingContent)(parentNode)) {
9762 return;
9763 }
9764 return getSibling(parentNode, which);
9765 }
9766
9767 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs
9768 var import_dom11 = __toESM(require_dom(), 1);
9769
9770 // packages/blocks/build-module/api/raw-handling/comment-remover.mjs
9771 var import_dom7 = __toESM(require_dom(), 1);
9772 function commentRemover(node) {
9773 if (node.nodeType === node.COMMENT_NODE) {
9774 (0, import_dom7.remove)(node);
9775 }
9776 }
9777
9778 // packages/blocks/build-module/api/raw-handling/is-inline-content.mjs
9779 var import_dom8 = __toESM(require_dom(), 1);
9780 function isInline(node, contextTag) {
9781 if ((0, import_dom8.isTextContent)(node)) {
9782 return true;
9783 }
9784 if (!contextTag) {
9785 return false;
9786 }
9787 const tag = node.nodeName.toLowerCase();
9788 const inlineAllowedTagGroups = [
9789 ["ul", "li", "ol"],
9790 ["h1", "h2", "h3", "h4", "h5", "h6"]
9791 ];
9792 return inlineAllowedTagGroups.some(
9793 (tagGroup) => [tag, contextTag].filter((t3) => !tagGroup.includes(t3)).length === 0
9794 );
9795 }
9796 function deepCheck(nodes, contextTag) {
9797 return nodes.every(
9798 (node) => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag)
9799 );
9800 }
9801 function isDoubleBR(node) {
9802 return node.nodeName === "BR" && !!node.previousSibling && node.previousSibling.nodeName === "BR";
9803 }
9804 function isInlineContent(HTML, contextTag) {
9805 const doc = document.implementation.createHTMLDocument("");
9806 doc.body.innerHTML = HTML;
9807 const nodes = Array.from(doc.body.children);
9808 return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
9809 }
9810
9811 // packages/blocks/build-module/api/raw-handling/phrasing-content-reducer.mjs
9812 var import_dom9 = __toESM(require_dom(), 1);
9813 function phrasingContentReducer(node, doc) {
9814 if (node.nodeName === "SPAN" && node.style) {
9815 const {
9816 fontWeight,
9817 fontStyle,
9818 textDecorationLine,
9819 textDecoration,
9820 verticalAlign
9821 } = node.style;
9822 const element = node;
9823 if (fontWeight === "bold" || fontWeight === "700") {
9824 (0, import_dom9.wrap)(doc.createElement("strong"), element);
9825 }
9826 if (fontStyle === "italic") {
9827 (0, import_dom9.wrap)(doc.createElement("em"), element);
9828 }
9829 if (textDecorationLine === "line-through" || textDecoration.includes("line-through")) {
9830 (0, import_dom9.wrap)(doc.createElement("s"), element);
9831 }
9832 if (verticalAlign === "super") {
9833 (0, import_dom9.wrap)(doc.createElement("sup"), element);
9834 } else if (verticalAlign === "sub") {
9835 (0, import_dom9.wrap)(doc.createElement("sub"), element);
9836 }
9837 } else if (node.nodeName === "B") {
9838 (0, import_dom9.replaceTag)(node, "strong");
9839 } else if (node.nodeName === "I") {
9840 (0, import_dom9.replaceTag)(node, "em");
9841 } else if (node.nodeName === "A") {
9842 const anchor = node;
9843 if (anchor.target && anchor.target.toLowerCase() === "_blank") {
9844 anchor.rel = "noopener";
9845 } else {
9846 anchor.removeAttribute("target");
9847 anchor.removeAttribute("rel");
9848 }
9849 if (anchor.name && !anchor.id) {
9850 anchor.id = anchor.name;
9851 }
9852 if (anchor.id && !anchor.ownerDocument.querySelector(`[href="#${anchor.id}"]`)) {
9853 anchor.removeAttribute("id");
9854 }
9855 }
9856 }
9857
9858 // packages/blocks/build-module/api/raw-handling/head-remover.mjs
9859 function headRemover(node) {
9860 if (node.nodeName !== "SCRIPT" && node.nodeName !== "NOSCRIPT" && node.nodeName !== "TEMPLATE" && node.nodeName !== "STYLE") {
9861 return;
9862 }
9863 node.parentNode.removeChild(node);
9864 }
9865
9866 // packages/blocks/build-module/api/raw-handling/ms-list-ignore.mjs
9867 function msListIgnore(node) {
9868 if (node.nodeType !== node.ELEMENT_NODE) {
9869 return;
9870 }
9871 const el = node;
9872 const style = el.getAttribute("style");
9873 if (!style || !style.includes("mso-list")) {
9874 return;
9875 }
9876 const rules = style.split(";").reduce(
9877 (acc, rule) => {
9878 const [key, value] = rule.split(":");
9879 if (key && value) {
9880 acc[key.trim().toLowerCase()] = value.trim().toLowerCase();
9881 }
9882 return acc;
9883 },
9884 {}
9885 );
9886 if (rules["mso-list"] === "ignore") {
9887 el.remove();
9888 }
9889 }
9890
9891 // packages/blocks/build-module/api/raw-handling/ms-list-converter.mjs
9892 function isList2(node) {
9893 return node.nodeName === "OL" || node.nodeName === "UL";
9894 }
9895 function msListConverter(node, doc) {
9896 if (node.nodeName !== "P") {
9897 return;
9898 }
9899 const element = node;
9900 const style = element.getAttribute("style");
9901 if (!style || !style.includes("mso-list")) {
9902 return;
9903 }
9904 const prevNode = element.previousElementSibling;
9905 if (!prevNode || !isList2(prevNode)) {
9906 const type = element.textContent.trim().slice(0, 1);
9907 const isNumeric = /[1iIaA]/.test(type);
9908 const newListNode = doc.createElement(isNumeric ? "ol" : "ul");
9909 if (isNumeric) {
9910 newListNode.setAttribute("type", type);
9911 }
9912 element.parentNode.insertBefore(newListNode, element);
9913 }
9914 const listNode = element.previousElementSibling;
9915 const listType = listNode.nodeName;
9916 const listItem = doc.createElement("li");
9917 let receivingNode = listNode;
9918 listItem.innerHTML = deepFilterHTML(element.innerHTML, [msListIgnore]);
9919 const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
9920 let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0;
9921 while (level--) {
9922 receivingNode = receivingNode.lastChild || receivingNode;
9923 if (isList2(receivingNode)) {
9924 receivingNode = receivingNode.lastChild || receivingNode;
9925 }
9926 }
9927 if (!isList2(receivingNode)) {
9928 receivingNode = receivingNode.appendChild(
9929 doc.createElement(listType)
9930 );
9931 }
9932 receivingNode.appendChild(listItem);
9933 element.parentNode.removeChild(element);
9934 }
9935
9936 // packages/blocks/build-module/api/raw-handling/image-corrector.mjs
9937 var import_blob = __toESM(require_blob(), 1);
9938 function imageCorrector(img) {
9939 if (img.nodeName !== "IMG") {
9940 return;
9941 }
9942 const node = img;
9943 if (node.src.indexOf("file:") === 0) {
9944 node.src = "";
9945 }
9946 if (node.src.indexOf("data:") === 0) {
9947 const [properties, data] = node.src.split(",");
9948 const [type] = properties.slice(5).split(";");
9949 if (!data || !type) {
9950 node.src = "";
9951 return;
9952 }
9953 let decoded;
9954 try {
9955 decoded = atob(data);
9956 } catch {
9957 node.src = "";
9958 return;
9959 }
9960 const uint8Array = new Uint8Array(decoded.length);
9961 for (let i2 = 0; i2 < uint8Array.length; i2++) {
9962 uint8Array[i2] = decoded.charCodeAt(i2);
9963 }
9964 const name = type.replace("/", ".");
9965 const file = new window.File([uint8Array], name, { type });
9966 node.src = (0, import_blob.createBlobURL)(file);
9967 }
9968 if (node.height === 1 || node.width === 1) {
9969 node.parentNode.removeChild(node);
9970 }
9971 }
9972
9973 // packages/blocks/build-module/api/raw-handling/div-normaliser.mjs
9974 function divNormaliser(div) {
9975 if (div.nodeName !== "DIV") {
9976 return;
9977 }
9978 const node = div;
9979 node.innerHTML = normaliseBlocks(node.innerHTML);
9980 }
9981
9982 // packages/blocks/build-module/api/raw-handling/markdown-converter.mjs
9983 var import_showdown = __toESM(require_showdown(), 1);
9984 var converter = new import_showdown.default.Converter({
9985 noHeaderId: true,
9986 tables: true,
9987 literalMidWordUnderscores: true,
9988 omitExtraWLInCodeBlocks: true,
9989 simpleLineBreaks: true,
9990 strikethrough: true
9991 });
9992 function slackMarkdownVariantCorrector(text2) {
9993 return text2.replace(
9994 /((?:^|\n)```)([^\n`]+)(```(?:$|\n))/,
9995 (match, p1, p2, p3) => `${p1}
9996 ${p2}
9997 ${p3}`
9998 );
9999 }
10000 function bulletsToAsterisks(text2) {
10001 return text2.replace(/(^|\n)•( +)/g, "$1*$2");
10002 }
10003 function escapeSingleLineOrderedListMarker(text2) {
10004 if (text2.includes("\n")) {
10005 return text2;
10006 }
10007 return text2.replace(/^(\d+)\.(\s)/, "$1\\.$2");
10008 }
10009 var correctors = [
10010 escapeSingleLineOrderedListMarker,
10011 bulletsToAsterisks,
10012 slackMarkdownVariantCorrector
10013 ];
10014 function markdownConverter(text2) {
10015 return converter.makeHtml(
10016 correctors.reduce(
10017 (current, corrector) => corrector(current),
10018 text2
10019 )
10020 );
10021 }
10022
10023 // packages/blocks/build-module/api/raw-handling/iframe-remover.mjs
10024 function iframeRemover(iframe) {
10025 if (iframe.nodeName === "IFRAME") {
10026 const node = iframe;
10027 const text2 = node.ownerDocument.createTextNode(node.src);
10028 node.parentNode.replaceChild(text2, node);
10029 }
10030 }
10031
10032 // packages/blocks/build-module/api/raw-handling/google-docs-uid-remover.mjs
10033 var import_dom10 = __toESM(require_dom(), 1);
10034 function googleDocsUIdRemover(node) {
10035 const el = node;
10036 if (!el.id || el.id.indexOf("docs-internal-guid-") !== 0) {
10037 return;
10038 }
10039 if (el.tagName === "B") {
10040 (0, import_dom10.unwrap)(node);
10041 } else {
10042 el.removeAttribute("id");
10043 }
10044 }
10045
10046 // packages/blocks/build-module/api/raw-handling/html-formatting-remover.mjs
10047 function isFormattingSpace(character) {
10048 return character === " " || character === "\r" || character === "\n" || character === " ";
10049 }
10050 function htmlFormattingRemover(node) {
10051 if (node.nodeType !== node.TEXT_NODE) {
10052 return;
10053 }
10054 let parent = node;
10055 while (parent = parent.parentNode) {
10056 if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === "PRE") {
10057 return;
10058 }
10059 }
10060 const textNode = node;
10061 let newData = textNode.data.replace(/[ \r\n\t]+/g, " ");
10062 if (newData[0] === " ") {
10063 const previousSibling = getSibling(node, "previous");
10064 if (!previousSibling || previousSibling.nodeName === "BR" || previousSibling.textContent.slice(-1) === " ") {
10065 newData = newData.slice(1);
10066 }
10067 }
10068 if (newData[newData.length - 1] === " ") {
10069 const nextSibling = getSibling(node, "next");
10070 if (!nextSibling || nextSibling.nodeName === "BR" || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) {
10071 newData = newData.slice(0, -1);
10072 }
10073 }
10074 if (!newData) {
10075 node.parentNode.removeChild(node);
10076 } else {
10077 textNode.data = newData;
10078 }
10079 }
10080
10081 // packages/blocks/build-module/api/raw-handling/br-remover.mjs
10082 function brRemover(node) {
10083 if (node.nodeName !== "BR") {
10084 return;
10085 }
10086 if (getSibling(node, "next")) {
10087 return;
10088 }
10089 node.parentNode.removeChild(node);
10090 }
10091
10092 // packages/blocks/build-module/api/raw-handling/empty-paragraph-remover.mjs
10093 function emptyParagraphRemover(node) {
10094 if (node.nodeName !== "P") {
10095 return;
10096 }
10097 if (node.hasChildNodes()) {
10098 return;
10099 }
10100 node.parentNode.removeChild(node);
10101 }
10102
10103 // packages/blocks/build-module/api/raw-handling/slack-paragraph-corrector.mjs
10104 function slackParagraphCorrector(node) {
10105 if (node.nodeName !== "SPAN") {
10106 return;
10107 }
10108 if (node.getAttribute("data-stringify-type") !== "paragraph-break") {
10109 return;
10110 }
10111 const parentNode = node.parentNode;
10112 parentNode.insertBefore(node.ownerDocument.createElement("br"), node);
10113 parentNode.insertBefore(node.ownerDocument.createElement("br"), node);
10114 parentNode.removeChild(node);
10115 }
10116
10117 // packages/blocks/build-module/api/raw-handling/latex-to-math.mjs
10118 function isLatexMathMode(text2) {
10119 const lettersRegex = /[\p{L}\s]+/gu;
10120 let match;
10121 while (match = lettersRegex.exec(text2)) {
10122 if (text2[match.index - 1] === "{") {
10123 continue;
10124 }
10125 let sequence = match[0];
10126 if (text2[match.index - 1] === "\\") {
10127 sequence = sequence.replace(/^[a-zA-Z]+/, "");
10128 }
10129 if (sequence.length < 6) {
10130 continue;
10131 }
10132 return false;
10133 }
10134 if (/\\[a-zA-Z]+\s*\{/g.test(text2)) {
10135 return true;
10136 }
10137 const softClues = [
10138 (t3) => t3.includes("^") && !t3.startsWith("^"),
10139 (t3) => ["=", "+", "-", "/", "*"].some(
10140 (operator) => t3.includes(operator)
10141 ),
10142 (t3) => /\\[a-zA-Z]+/g.test(t3)
10143 ];
10144 if (softClues.filter((clue) => clue(text2)).length >= 2) {
10145 return true;
10146 }
10147 return false;
10148 }
10149
10150 // packages/blocks/build-module/api/raw-handling/heading-transformer.mjs
10151 function headingTransformer(node) {
10152 if (node.nodeType !== node.ELEMENT_NODE) {
10153 return;
10154 }
10155 const element = node;
10156 if (element.tagName === "P" && element.getAttribute("role") === "heading" && element.hasAttribute("aria-level")) {
10157 const level = parseInt(element.getAttribute("aria-level"), 10);
10158 if (level >= 1 && level <= 6) {
10159 const headingTag = `H${level}`;
10160 const newHeading = element.ownerDocument.createElement(headingTag);
10161 Array.from(element.attributes).forEach((attr2) => {
10162 if (attr2.name !== "role" && attr2.name !== "aria-level") {
10163 newHeading.setAttribute(attr2.name, attr2.value);
10164 }
10165 });
10166 while (element.firstChild) {
10167 newHeading.appendChild(element.firstChild);
10168 }
10169 element.parentNode.replaceChild(newHeading, element);
10170 }
10171 }
10172 }
10173
10174 // packages/blocks/build-module/api/raw-handling/paste-handler.mjs
10175 var log = (...args) => window?.console?.log?.(...args);
10176 function filterInlineHTML(HTML) {
10177 HTML = deepFilterHTML(HTML, [
10178 headRemover,
10179 googleDocsUIdRemover,
10180 msListIgnore,
10181 phrasingContentReducer,
10182 commentRemover
10183 ]);
10184 HTML = (0, import_dom11.removeInvalidHTML)(
10185 HTML,
10186 (0, import_dom11.getPhrasingContentSchema)("paste"),
10187 true
10188 );
10189 HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]);
10190 log("Processed inline HTML:\n\n", HTML);
10191 return HTML;
10192 }
10193 function pasteHandler({
10194 HTML = "",
10195 plainText = "",
10196 mode = "AUTO",
10197 tagName
10198 }) {
10199 log("Received HTML (pasteHandler):\n\n", HTML);
10200 log("Received plain text (pasteHandler):\n\n", plainText);
10201 HTML = HTML.replace(/<meta[^>]+>/g, "");
10202 HTML = HTML.replace(
10203 /^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,
10204 ""
10205 );
10206 HTML = HTML.replace(
10207 /(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,
10208 ""
10209 );
10210 if (mode !== "INLINE") {
10211 const content = HTML ? HTML : plainText;
10212 if (content.indexOf("<!-- wp:") !== -1) {
10213 const parseResult = parse2(content);
10214 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform";
10215 if (!isSingleFreeFormBlock) {
10216 return parseResult;
10217 }
10218 }
10219 }
10220 HTML = HTML.normalize();
10221 HTML = deepFilterHTML(HTML, [slackParagraphCorrector]);
10222 const isPlainText = plainText && (!HTML || isPlain(HTML));
10223 if (isPlainText && isLatexMathMode(plainText)) {
10224 return [createBlock("core/math", { latex: plainText })];
10225 }
10226 if (isPlainText) {
10227 HTML = plainText;
10228 if (!/^\s+$/.test(plainText)) {
10229 HTML = markdownConverter(HTML);
10230 }
10231 }
10232 const pieces = shortcode_converter_default(HTML);
10233 const hasShortcodes = pieces.length > 1;
10234 if (isPlainText && !hasShortcodes) {
10235 if (mode === "AUTO" && plainText.indexOf("\n") === -1 && plainText.indexOf("<p>") !== 0 && HTML.indexOf("<p>") === 0) {
10236 mode = "INLINE";
10237 }
10238 }
10239 if (mode === "INLINE") {
10240 return filterInlineHTML(HTML);
10241 }
10242 if (mode === "AUTO" && !hasShortcodes && isInlineContent(HTML, tagName)) {
10243 return filterInlineHTML(HTML);
10244 }
10245 const phrasingContentSchema = (0, import_dom11.getPhrasingContentSchema)("paste");
10246 const blockContentSchema = getBlockContentSchema("paste");
10247 const blocks = pieces.map((piece) => {
10248 if (typeof piece !== "string") {
10249 return piece;
10250 }
10251 const filters = [
10252 googleDocsUIdRemover,
10253 msListConverter,
10254 headRemover,
10255 listReducer,
10256 imageCorrector,
10257 phrasingContentReducer,
10258 specialCommentConverter,
10259 commentRemover,
10260 iframeRemover,
10261 figureContentReducer,
10262 blockquoteNormaliser(),
10263 divNormaliser,
10264 headingTransformer
10265 ];
10266 const schema = {
10267 ...blockContentSchema,
10268 // Keep top-level phrasing content, normalised by `normaliseBlocks`.
10269 ...phrasingContentSchema
10270 };
10271 piece = deepFilterHTML(piece, filters, blockContentSchema);
10272 piece = (0, import_dom11.removeInvalidHTML)(piece, schema, false);
10273 piece = normaliseBlocks(piece);
10274 piece = deepFilterHTML(
10275 piece,
10276 [htmlFormattingRemover, brRemover, emptyParagraphRemover],
10277 blockContentSchema
10278 );
10279 log("Processed HTML piece:\n\n", piece);
10280 return htmlToBlocks(piece, pasteHandler);
10281 }).flat().filter(Boolean);
10282 if (mode === "AUTO" && blocks.length === 1 && hasBlockSupport(blocks[0].name, "__unstablePasteTextInline", false)) {
10283 const trimRegex = /^[\n]+|[\n]+$/g;
10284 const trimmedPlainText = plainText.replace(trimRegex, "");
10285 if (trimmedPlainText !== "" && trimmedPlainText.indexOf("\n") === -1) {
10286 return (0, import_dom11.removeInvalidHTML)(
10287 getBlockInnerHTML(blocks[0]),
10288 phrasingContentSchema,
10289 false
10290 ).replace(trimRegex, "");
10291 }
10292 }
10293 return blocks;
10294 }
10295
10296 // packages/blocks/build-module/api/raw-handling/index.mjs
10297 function deprecatedGetPhrasingContentSchema(context) {
10298 (0, import_deprecated10.default)("wp.blocks.getPhrasingContentSchema", {
10299 since: "5.6",
10300 alternative: "wp.dom.getPhrasingContentSchema"
10301 });
10302 return (0, import_dom12.getPhrasingContentSchema)(context);
10303 }
10304 function rawHandler({ HTML = "" }) {
10305 if (HTML.indexOf("<!-- wp:") !== -1) {
10306 const parseResult = parse2(HTML);
10307 const isSingleFreeFormBlock = parseResult.length === 1 && parseResult[0].name === "core/freeform";
10308 if (!isSingleFreeFormBlock) {
10309 return parseResult;
10310 }
10311 }
10312 const pieces = shortcode_converter_default(HTML);
10313 const blockContentSchema = getBlockContentSchema();
10314 return pieces.map((piece) => {
10315 if (typeof piece !== "string") {
10316 return piece;
10317 }
10318 const filters = [
10319 // Needed to adjust invalid lists.
10320 listReducer,
10321 // Needed to create more and nextpage blocks.
10322 specialCommentConverter,
10323 // Needed to create media blocks.
10324 figureContentReducer,
10325 // Needed to create the quote block, which cannot handle text
10326 // without wrapper paragraphs.
10327 blockquoteNormaliser({ raw: true })
10328 ];
10329 piece = deepFilterHTML(piece, filters, blockContentSchema);
10330 piece = normaliseBlocks(piece, { raw: true });
10331 return htmlToBlocks(piece, rawHandler);
10332 }).flat().filter(Boolean);
10333 }
10334
10335 // packages/blocks/build-module/api/categories.mjs
10336 var import_data6 = __toESM(require_data(), 1);
10337 function getCategories2() {
10338 return (0, import_data6.select)(store).getCategories();
10339 }
10340 function setCategories2(categories2) {
10341 (0, import_data6.dispatch)(store).setCategories(categories2);
10342 }
10343 function updateCategory2(slug, category) {
10344 (0, import_data6.dispatch)(store).updateCategory(slug, category);
10345 }
10346
10347 // packages/blocks/build-module/api/templates.mjs
10348 var import_element5 = __toESM(require_element(), 1);
10349 function doBlocksMatchTemplate(blocks = [], template = []) {
10350 return blocks.length === template.length && template.every(([name, , innerBlocksTemplate], index) => {
10351 const block = blocks[index];
10352 return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate);
10353 });
10354 }
10355 var isHTMLAttribute = (attributeDefinition) => attributeDefinition?.source === "html";
10356 var isQueryAttribute = (attributeDefinition) => attributeDefinition?.source === "query";
10357 function normalizeAttributes(schema, values) {
10358 if (!values) {
10359 return {};
10360 }
10361 return Object.fromEntries(
10362 Object.entries(values).map(([key, value]) => [
10363 key,
10364 normalizeAttribute(schema[key], value)
10365 ])
10366 );
10367 }
10368 function normalizeAttribute(definition, value) {
10369 if (isHTMLAttribute(definition) && Array.isArray(value)) {
10370 return (0, import_element5.renderToString)(value);
10371 }
10372 if (isQueryAttribute(definition) && value) {
10373 return value.map(
10374 (subValues) => {
10375 return normalizeAttributes(definition.query, subValues);
10376 }
10377 );
10378 }
10379 return value;
10380 }
10381 function synchronizeBlocksWithTemplate(blocks = [], template) {
10382 if (!template) {
10383 return blocks;
10384 }
10385 return template.map(
10386 ([name, attributes, innerBlocksTemplate], index) => {
10387 const block = blocks[index];
10388 if (block && block.name === name) {
10389 const innerBlocks = synchronizeBlocksWithTemplate(
10390 block.innerBlocks,
10391 innerBlocksTemplate
10392 );
10393 return { ...block, innerBlocks };
10394 }
10395 const blockType = getBlockType(name);
10396 const normalizedAttributes = normalizeAttributes(
10397 blockType?.attributes ?? {},
10398 attributes
10399 );
10400 const [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(
10401 name,
10402 normalizedAttributes
10403 );
10404 return createBlock(
10405 blockName,
10406 blockAttributes,
10407 synchronizeBlocksWithTemplate([], innerBlocksTemplate)
10408 );
10409 }
10410 );
10411 }
10412
10413 // packages/blocks/build-module/api/index.mjs
10414 var fieldsKey = /* @__PURE__ */ Symbol("fields");
10415 var formKey = /* @__PURE__ */ Symbol("form");
10416 var privateApis = {};
10417 lock(privateApis, {
10418 isContentBlock,
10419 fieldsKey,
10420 formKey,
10421 parseRawBlock
10422 });
10423
10424 // packages/blocks/build-module/deprecated.mjs
10425 var import_deprecated11 = __toESM(require_deprecated(), 1);
10426 function withBlockContentContext(OriginalComponent) {
10427 (0, import_deprecated11.default)("wp.blocks.withBlockContentContext", {
10428 since: "6.1"
10429 });
10430 return OriginalComponent;
10431 }
10432 return __toCommonJS(index_exports);
10433 })();
10434 /*! Bundled license information:
10435
10436 react-is/cjs/react-is.development.js:
10437 (**
10438 * @license React
10439 * react-is.development.js
10440 *
10441 * Copyright (c) Meta Platforms, Inc. and affiliates.
10442 *
10443 * This source code is licensed under the MIT license found in the
10444 * LICENSE file in the root directory of this source tree.
10445 *)
10446
10447 showdown/dist/showdown.js:
10448 (*! showdown v 1.9.1 - 02-11-2019 *)
10449
10450 is-plain-object/dist/is-plain-object.mjs:
10451 (*!
10452 * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
10453 *
10454 * Copyright (c) 2014-2017, Jon Schlinkert.
10455 * Released under the MIT License.
10456 *)
10457 */
10458 //# sourceMappingURL=index.js.map
10459