share-pages 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +49 -0
  2. package/dist/dist-JyXFh6I5.mjs +5444 -0
  3. package/dist/epub-BXQPqTFk-CGD2NLS1.mjs +4915 -0
  4. package/dist/index.mjs +679 -0
  5. package/dist/latex-CybgCSnr-CvP5kdPz.mjs +33421 -0
  6. package/dist/latex-DMo_3IW8-B6ogeBvw.mjs +20 -0
  7. package/dist/markdown-BWlCFeLJ-OwSvKM8l.mjs +68089 -0
  8. package/dist/node-Lh4CQjZ4.mjs +77 -0
  9. package/dist/papaparse-BJnSo-VR.mjs +1139 -0
  10. package/dist/prepare-C56DezIS-DiqwpdkG.mjs +8563 -0
  11. package/dist/resources/assets/csv-worker-Bilq-sDm.js +17 -0
  12. package/dist/resources/chunks/viewer-Bz6Cwh4W.js +9561 -0
  13. package/dist/resources/csv.js +2444 -0
  14. package/dist/resources/epub.js +16493 -0
  15. package/dist/resources/fonts/KaTeX_AMS-Regular.ttf +0 -0
  16. package/dist/resources/fonts/KaTeX_AMS-Regular.woff +0 -0
  17. package/dist/resources/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  18. package/dist/resources/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  19. package/dist/resources/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  20. package/dist/resources/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  21. package/dist/resources/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  22. package/dist/resources/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  23. package/dist/resources/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  24. package/dist/resources/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  25. package/dist/resources/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  26. package/dist/resources/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  27. package/dist/resources/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  28. package/dist/resources/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  29. package/dist/resources/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  30. package/dist/resources/fonts/KaTeX_Main-Bold.ttf +0 -0
  31. package/dist/resources/fonts/KaTeX_Main-Bold.woff +0 -0
  32. package/dist/resources/fonts/KaTeX_Main-Bold.woff2 +0 -0
  33. package/dist/resources/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  34. package/dist/resources/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  35. package/dist/resources/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  36. package/dist/resources/fonts/KaTeX_Main-Italic.ttf +0 -0
  37. package/dist/resources/fonts/KaTeX_Main-Italic.woff +0 -0
  38. package/dist/resources/fonts/KaTeX_Main-Italic.woff2 +0 -0
  39. package/dist/resources/fonts/KaTeX_Main-Regular.ttf +0 -0
  40. package/dist/resources/fonts/KaTeX_Main-Regular.woff +0 -0
  41. package/dist/resources/fonts/KaTeX_Main-Regular.woff2 +0 -0
  42. package/dist/resources/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  43. package/dist/resources/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  44. package/dist/resources/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  45. package/dist/resources/fonts/KaTeX_Math-Italic.ttf +0 -0
  46. package/dist/resources/fonts/KaTeX_Math-Italic.woff +0 -0
  47. package/dist/resources/fonts/KaTeX_Math-Italic.woff2 +0 -0
  48. package/dist/resources/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  49. package/dist/resources/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  50. package/dist/resources/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  51. package/dist/resources/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  52. package/dist/resources/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  53. package/dist/resources/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  54. package/dist/resources/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  55. package/dist/resources/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  56. package/dist/resources/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  57. package/dist/resources/fonts/KaTeX_Script-Regular.ttf +0 -0
  58. package/dist/resources/fonts/KaTeX_Script-Regular.woff +0 -0
  59. package/dist/resources/fonts/KaTeX_Script-Regular.woff2 +0 -0
  60. package/dist/resources/fonts/KaTeX_Size1-Regular.ttf +0 -0
  61. package/dist/resources/fonts/KaTeX_Size1-Regular.woff +0 -0
  62. package/dist/resources/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  63. package/dist/resources/fonts/KaTeX_Size2-Regular.ttf +0 -0
  64. package/dist/resources/fonts/KaTeX_Size2-Regular.woff +0 -0
  65. package/dist/resources/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  66. package/dist/resources/fonts/KaTeX_Size3-Regular.ttf +0 -0
  67. package/dist/resources/fonts/KaTeX_Size3-Regular.woff +0 -0
  68. package/dist/resources/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  69. package/dist/resources/fonts/KaTeX_Size4-Regular.ttf +0 -0
  70. package/dist/resources/fonts/KaTeX_Size4-Regular.woff +0 -0
  71. package/dist/resources/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  72. package/dist/resources/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  73. package/dist/resources/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  74. package/dist/resources/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  75. package/dist/resources/katex.css +1 -0
  76. package/dist/resources/latex-article.css +33 -0
  77. package/dist/resources/latex-base.css +816 -0
  78. package/dist/resources/latex-book.css +43 -0
  79. package/dist/resources/latex-fonts/KaTeX_AMS-Regular.woff +0 -0
  80. package/dist/resources/latex-fonts/KaTeX_AMS-Regular.woff2 +0 -0
  81. package/dist/resources/latex-fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  82. package/dist/resources/latex-fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  83. package/dist/resources/latex-fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  84. package/dist/resources/latex-fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  85. package/dist/resources/latex-fonts/KaTeX_Fraktur-Bold.woff +0 -0
  86. package/dist/resources/latex-fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  87. package/dist/resources/latex-fonts/KaTeX_Fraktur-Regular.woff +0 -0
  88. package/dist/resources/latex-fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  89. package/dist/resources/latex-fonts/KaTeX_Main-Bold.woff +0 -0
  90. package/dist/resources/latex-fonts/KaTeX_Main-Bold.woff2 +0 -0
  91. package/dist/resources/latex-fonts/KaTeX_Main-BoldItalic.woff +0 -0
  92. package/dist/resources/latex-fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  93. package/dist/resources/latex-fonts/KaTeX_Main-Italic.woff +0 -0
  94. package/dist/resources/latex-fonts/KaTeX_Main-Italic.woff2 +0 -0
  95. package/dist/resources/latex-fonts/KaTeX_Main-Regular.woff +0 -0
  96. package/dist/resources/latex-fonts/KaTeX_Main-Regular.woff2 +0 -0
  97. package/dist/resources/latex-fonts/KaTeX_Math-BoldItalic.woff +0 -0
  98. package/dist/resources/latex-fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  99. package/dist/resources/latex-fonts/KaTeX_Math-Italic.woff +0 -0
  100. package/dist/resources/latex-fonts/KaTeX_Math-Italic.woff2 +0 -0
  101. package/dist/resources/latex-fonts/KaTeX_SansSerif-Bold.woff +0 -0
  102. package/dist/resources/latex-fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  103. package/dist/resources/latex-fonts/KaTeX_SansSerif-Italic.woff +0 -0
  104. package/dist/resources/latex-fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  105. package/dist/resources/latex-fonts/KaTeX_SansSerif-Regular.woff +0 -0
  106. package/dist/resources/latex-fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  107. package/dist/resources/latex-fonts/KaTeX_Script-Regular.woff +0 -0
  108. package/dist/resources/latex-fonts/KaTeX_Script-Regular.woff2 +0 -0
  109. package/dist/resources/latex-fonts/KaTeX_Size1-Regular.woff +0 -0
  110. package/dist/resources/latex-fonts/KaTeX_Size1-Regular.woff2 +0 -0
  111. package/dist/resources/latex-fonts/KaTeX_Size2-Regular.woff +0 -0
  112. package/dist/resources/latex-fonts/KaTeX_Size2-Regular.woff2 +0 -0
  113. package/dist/resources/latex-fonts/KaTeX_Size3-Regular.woff +0 -0
  114. package/dist/resources/latex-fonts/KaTeX_Size3-Regular.woff2 +0 -0
  115. package/dist/resources/latex-fonts/KaTeX_Size4-Regular.woff +0 -0
  116. package/dist/resources/latex-fonts/KaTeX_Size4-Regular.woff2 +0 -0
  117. package/dist/resources/latex-fonts/KaTeX_Typewriter-Regular.woff +0 -0
  118. package/dist/resources/latex-fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  119. package/dist/resources/latex-fonts/OFL.txt +102 -0
  120. package/dist/resources/latex-fonts/Sans/cmun-sans.css +30 -0
  121. package/dist/resources/latex-fonts/Sans/cmunsi.woff +0 -0
  122. package/dist/resources/latex-fonts/Sans/cmunso.woff +0 -0
  123. package/dist/resources/latex-fonts/Sans/cmunss.woff +0 -0
  124. package/dist/resources/latex-fonts/Sans/cmunsx.woff +0 -0
  125. package/dist/resources/latex-fonts/Serif/cmun-serif.css +30 -0
  126. package/dist/resources/latex-fonts/Serif/cmunbi.woff +0 -0
  127. package/dist/resources/latex-fonts/Serif/cmunbx.woff +0 -0
  128. package/dist/resources/latex-fonts/Serif/cmunrm.woff +0 -0
  129. package/dist/resources/latex-fonts/Serif/cmunti.woff +0 -0
  130. package/dist/resources/latex-fonts/Serif Slanted/cmun-serif-slanted.css +14 -0
  131. package/dist/resources/latex-fonts/Serif Slanted/cmunbl.woff +0 -0
  132. package/dist/resources/latex-fonts/Serif Slanted/cmunsl.woff +0 -0
  133. package/dist/resources/latex-fonts/Typewriter/cmun-typewriter.css +30 -0
  134. package/dist/resources/latex-fonts/Typewriter/cmunit.woff +0 -0
  135. package/dist/resources/latex-fonts/Typewriter/cmuntb.woff +0 -0
  136. package/dist/resources/latex-fonts/Typewriter/cmuntt.woff +0 -0
  137. package/dist/resources/latex-fonts/Typewriter/cmuntx.woff +0 -0
  138. package/dist/resources/latex-fonts/Typewriter Slanted/cmun-typewriter-slanted.css +6 -0
  139. package/dist/resources/latex-fonts/Typewriter Slanted/cmunst.woff +0 -0
  140. package/dist/resources/latex-fonts/cmu.css +13 -0
  141. package/dist/resources/latex-katex.css +1079 -0
  142. package/dist/resources/licenses.txt +131 -0
  143. package/dist/resources/reader.css +244 -0
  144. package/dist/resources/viewers.css +3 -0
  145. package/dist/rolldown-runtime-B4iAMlE-.mjs +35 -0
  146. package/package.json +40 -0
@@ -0,0 +1,4915 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.mjs";
2
+ import { l as safePath, r as assert } from "./dist-JyXFh6I5.mjs";
3
+ import { c as unzipSafe, n as document, o as safeXMLText, r as encoder, s as sanitizeEPUB, t as decodeText } from "./prepare-C56DezIS-DiqwpdkG.mjs";
4
+ //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/conventions.js
5
+ var require_conventions = /* @__PURE__ */ __commonJSMin(((exports) => {
6
+ /**
7
+ * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
8
+ *
9
+ * Works with anything that has a `length` property and index access properties, including NodeList.
10
+ *
11
+ * @template {unknown} T
12
+ * @param {Array<T> | ({length:number, [number]: T})} list
13
+ * @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
14
+ * @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
15
+ * allows injecting a custom implementation in tests
16
+ * @returns {T | undefined}
17
+ *
18
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
19
+ * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
20
+ */
21
+ function find(list, predicate, ac) {
22
+ if (ac === void 0) ac = Array.prototype;
23
+ if (list && typeof ac.find === "function") return ac.find.call(list, predicate);
24
+ for (var i = 0; i < list.length; i++) if (Object.prototype.hasOwnProperty.call(list, i)) {
25
+ var item = list[i];
26
+ if (predicate.call(void 0, item, i, list)) return item;
27
+ }
28
+ }
29
+ /**
30
+ * "Shallow freezes" an object to render it immutable.
31
+ * Uses `Object.freeze` if available,
32
+ * otherwise the immutability is only in the type.
33
+ *
34
+ * Is used to create "enum like" objects.
35
+ *
36
+ * @template T
37
+ * @param {T} object the object to freeze
38
+ * @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
39
+ * allows to inject custom object constructor for tests
40
+ * @returns {Readonly<T>}
41
+ *
42
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
43
+ */
44
+ function freeze(object, oc) {
45
+ if (oc === void 0) oc = Object;
46
+ return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
47
+ }
48
+ /**
49
+ * Since we can not rely on `Object.assign` we provide a simplified version
50
+ * that is sufficient for our needs.
51
+ *
52
+ * @param {Object} target
53
+ * @param {Object | null | undefined} source
54
+ *
55
+ * @returns {Object} target
56
+ * @throws TypeError if target is not an object
57
+ *
58
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
59
+ * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign
60
+ */
61
+ function assign(target, source) {
62
+ if (target === null || typeof target !== "object") throw new TypeError("target is not an object");
63
+ for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
64
+ return target;
65
+ }
66
+ /**
67
+ * All mime types that are allowed as input to `DOMParser.parseFromString`
68
+ *
69
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
70
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
71
+ * @see DOMParser.prototype.parseFromString
72
+ */
73
+ var MIME_TYPE = freeze({
74
+ /**
75
+ * `text/html`, the only mime type that triggers treating an XML document as HTML.
76
+ *
77
+ * @see DOMParser.SupportedType.isHTML
78
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
79
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
80
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
81
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
82
+ */
83
+ HTML: "text/html",
84
+ /**
85
+ * Helper method to check a mime type if it indicates an HTML document
86
+ *
87
+ * @param {string} [value]
88
+ * @returns {boolean}
89
+ *
90
+ * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
91
+ * @see https://en.wikipedia.org/wiki/HTML Wikipedia
92
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
93
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
94
+ isHTML: function(value) {
95
+ return value === MIME_TYPE.HTML;
96
+ },
97
+ /**
98
+ * `application/xml`, the standard mime type for XML documents.
99
+ *
100
+ * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
101
+ * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
102
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
103
+ */
104
+ XML_APPLICATION: "application/xml",
105
+ /**
106
+ * `text/html`, an alias for `application/xml`.
107
+ *
108
+ * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
109
+ * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
110
+ * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
111
+ */
112
+ XML_TEXT: "text/xml",
113
+ /**
114
+ * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
115
+ * but is parsed as an XML document.
116
+ *
117
+ * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
118
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
119
+ * @see https://en.wikipedia.org/wiki/XHTML Wikipedia
120
+ */
121
+ XML_XHTML_APPLICATION: "application/xhtml+xml",
122
+ /**
123
+ * `image/svg+xml`,
124
+ *
125
+ * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
126
+ * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
127
+ * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
128
+ */
129
+ XML_SVG_IMAGE: "image/svg+xml"
130
+ });
131
+ /**
132
+ * Namespaces that are used in this code base.
133
+ *
134
+ * @see http://www.w3.org/TR/REC-xml-names
135
+ */
136
+ var NAMESPACE = freeze({
137
+ /**
138
+ * The XHTML namespace.
139
+ *
140
+ * @see http://www.w3.org/1999/xhtml
141
+ */
142
+ HTML: "http://www.w3.org/1999/xhtml",
143
+ /**
144
+ * Checks if `uri` equals `NAMESPACE.HTML`.
145
+ *
146
+ * @param {string} [uri]
147
+ *
148
+ * @see NAMESPACE.HTML
149
+ */
150
+ isHTML: function(uri) {
151
+ return uri === NAMESPACE.HTML;
152
+ },
153
+ /**
154
+ * The SVG namespace.
155
+ *
156
+ * @see http://www.w3.org/2000/svg
157
+ */
158
+ SVG: "http://www.w3.org/2000/svg",
159
+ /**
160
+ * The `xml:` namespace.
161
+ *
162
+ * @see http://www.w3.org/XML/1998/namespace
163
+ */
164
+ XML: "http://www.w3.org/XML/1998/namespace",
165
+ /**
166
+ * The `xmlns:` namespace
167
+ *
168
+ * @see https://www.w3.org/2000/xmlns/
169
+ */
170
+ XMLNS: "http://www.w3.org/2000/xmlns/"
171
+ });
172
+ var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
173
+ var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
174
+ var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
175
+ exports.assign = assign;
176
+ exports.find = find;
177
+ exports.freeze = freeze;
178
+ exports.MIME_TYPE = MIME_TYPE;
179
+ exports.NAMESPACE = NAMESPACE;
180
+ exports.nameStartChar = nameStartChar;
181
+ exports.nameChar = nameChar;
182
+ exports.tagNamePattern = tagNamePattern;
183
+ }));
184
+ //#endregion
185
+ //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/dom.js
186
+ var require_dom = /* @__PURE__ */ __commonJSMin(((exports) => {
187
+ var conventions = require_conventions();
188
+ var find = conventions.find;
189
+ var NAMESPACE = conventions.NAMESPACE;
190
+ var tagNamePattern = conventions.tagNamePattern;
191
+ /**
192
+ * A prerequisite for `[].filter`, to drop elements that are empty
193
+ * @param {string} input
194
+ * @returns {boolean}
195
+ */
196
+ function notEmptyString(input) {
197
+ return input !== "";
198
+ }
199
+ /**
200
+ * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
201
+ * @see https://infra.spec.whatwg.org/#ascii-whitespace
202
+ *
203
+ * @param {string} input
204
+ * @returns {string[]} (can be empty)
205
+ */
206
+ function splitOnASCIIWhitespace(input) {
207
+ return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
208
+ }
209
+ /**
210
+ * Adds element as a key to current if it is not already present.
211
+ *
212
+ * @param {Record<string, boolean | undefined>} current
213
+ * @param {string} element
214
+ * @returns {Record<string, boolean | undefined>}
215
+ */
216
+ function orderedSetReducer(current, element) {
217
+ if (!current.hasOwnProperty(element)) current[element] = true;
218
+ return current;
219
+ }
220
+ /**
221
+ * @see https://infra.spec.whatwg.org/#ordered-set
222
+ * @param {string} input
223
+ * @returns {string[]}
224
+ */
225
+ function toOrderedSet(input) {
226
+ if (!input) return [];
227
+ var list = splitOnASCIIWhitespace(input);
228
+ return Object.keys(list.reduce(orderedSetReducer, {}));
229
+ }
230
+ /**
231
+ * Uses `list.indexOf` to implement something like `Array.prototype.includes`,
232
+ * which we can not rely on being available.
233
+ *
234
+ * @param {any[]} list
235
+ * @returns {function(any): boolean}
236
+ */
237
+ function arrayIncludes(list) {
238
+ return function(element) {
239
+ return list && list.indexOf(element) !== -1;
240
+ };
241
+ }
242
+ function copy(src, dest) {
243
+ for (var p in src) if (Object.prototype.hasOwnProperty.call(src, p)) dest[p] = src[p];
244
+ }
245
+ /**
246
+ ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
247
+ ^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
248
+ */
249
+ function _extends(Class, Super) {
250
+ var pt = Class.prototype;
251
+ if (!(pt instanceof Super)) {
252
+ function t() {}
253
+ t.prototype = Super.prototype;
254
+ t = new t();
255
+ copy(pt, t);
256
+ Class.prototype = pt = t;
257
+ }
258
+ if (pt.constructor != Class) {
259
+ if (typeof Class != "function") console.error("unknown Class:" + Class);
260
+ pt.constructor = Class;
261
+ }
262
+ }
263
+ var NodeType = {};
264
+ var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
265
+ var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
266
+ var TEXT_NODE = NodeType.TEXT_NODE = 3;
267
+ var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
268
+ var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
269
+ var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
270
+ var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
271
+ var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
272
+ var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
273
+ var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
274
+ var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
275
+ var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
276
+ var ExceptionCode = {};
277
+ var ExceptionMessage = {};
278
+ ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
279
+ ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
280
+ var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
281
+ ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
282
+ var INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
283
+ ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
284
+ ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
285
+ var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
286
+ ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
287
+ var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
288
+ var INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
289
+ ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
290
+ ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
291
+ ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
292
+ ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
293
+ /**
294
+ * DOM Level 2
295
+ * Object DOMException
296
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
297
+ * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
298
+ */
299
+ function DOMException(code, message) {
300
+ if (message instanceof Error) var error = message;
301
+ else {
302
+ error = this;
303
+ Error.call(this, ExceptionMessage[code]);
304
+ this.message = ExceptionMessage[code];
305
+ if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException);
306
+ }
307
+ error.code = code;
308
+ if (message) this.message = this.message + ": " + message;
309
+ return error;
310
+ }
311
+ DOMException.prototype = Error.prototype;
312
+ copy(ExceptionCode, DOMException);
313
+ /**
314
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
315
+ * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
316
+ * The items in the NodeList are accessible via an integral index, starting from 0.
317
+ */
318
+ function NodeList() {}
319
+ NodeList.prototype = {
320
+ /**
321
+ * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
322
+ * @standard level1
323
+ */
324
+ length: 0,
325
+ /**
326
+ * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
327
+ * @standard level1
328
+ * @param index unsigned long
329
+ * Index into the collection.
330
+ * @return Node
331
+ * The node at the indexth position in the NodeList, or null if that is not a valid index.
332
+ */
333
+ item: function(index) {
334
+ return index >= 0 && index < this.length ? this[index] : null;
335
+ },
336
+ toString: function(isHTML, nodeFilter, options) {
337
+ var requireWellFormed = !!options && !!options.requireWellFormed;
338
+ for (var buf = [], i = 0; i < this.length; i++) serializeToString(this[i], buf, isHTML, nodeFilter, null, requireWellFormed);
339
+ return buf.join("");
340
+ },
341
+ /**
342
+ * @private
343
+ * @param {function (Node):boolean} predicate
344
+ * @returns {Node[]}
345
+ */
346
+ filter: function(predicate) {
347
+ return Array.prototype.filter.call(this, predicate);
348
+ },
349
+ /**
350
+ * @private
351
+ * @param {Node} item
352
+ * @returns {number}
353
+ */
354
+ indexOf: function(item) {
355
+ return Array.prototype.indexOf.call(this, item);
356
+ }
357
+ };
358
+ function LiveNodeList(node, refresh) {
359
+ this._node = node;
360
+ this._refresh = refresh;
361
+ _updateLiveList(this);
362
+ }
363
+ function _updateLiveList(list) {
364
+ var inc = list._node._inc || list._node.ownerDocument._inc;
365
+ if (list._inc !== inc) {
366
+ var ls = list._refresh(list._node);
367
+ __set__(list, "length", ls.length);
368
+ if (!list.$$length || ls.length < list.$$length) {
369
+ for (var i = ls.length; i in list; i++) if (Object.prototype.hasOwnProperty.call(list, i)) delete list[i];
370
+ }
371
+ copy(ls, list);
372
+ list._inc = inc;
373
+ }
374
+ }
375
+ LiveNodeList.prototype.item = function(i) {
376
+ _updateLiveList(this);
377
+ return this[i] || null;
378
+ };
379
+ _extends(LiveNodeList, NodeList);
380
+ /**
381
+ * Objects implementing the NamedNodeMap interface are used
382
+ * to represent collections of nodes that can be accessed by name.
383
+ * Note that NamedNodeMap does not inherit from NodeList;
384
+ * NamedNodeMaps are not maintained in any particular order.
385
+ * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
386
+ * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
387
+ * and does not imply that the DOM specifies an order to these Nodes.
388
+ * NamedNodeMap objects in the DOM are live.
389
+ * used for attributes or DocumentType entities
390
+ */
391
+ function NamedNodeMap() {
392
+ this._nameIndex = Object.create(null);
393
+ }
394
+ function _findNodeIndex(list, node) {
395
+ var i = list.length;
396
+ while (i--) if (list[i] === node) return i;
397
+ }
398
+ function _nnmIndexAdd(list, attr) {
399
+ list._nameIndex[attr.nodeName] = attr;
400
+ }
401
+ function _nnmIndexRemove(list, attr) {
402
+ if (list._nameIndex[attr.nodeName] === attr) delete list._nameIndex[attr.nodeName];
403
+ }
404
+ function _addNamedNode(el, list, newAttr, oldAttr) {
405
+ if (oldAttr) {
406
+ list[_findNodeIndex(list, oldAttr)] = newAttr;
407
+ _nnmIndexRemove(list, oldAttr);
408
+ } else list[list.length++] = newAttr;
409
+ _nnmIndexAdd(list, newAttr);
410
+ if (el) {
411
+ newAttr.ownerElement = el;
412
+ var doc = el.ownerDocument;
413
+ if (doc) {
414
+ oldAttr && _onRemoveAttribute(doc, el, oldAttr);
415
+ _onAddAttribute(doc, el, newAttr);
416
+ }
417
+ }
418
+ }
419
+ function _removeNamedNode(el, list, attr) {
420
+ var i = _findNodeIndex(list, attr);
421
+ if (i >= 0) {
422
+ var lastIndex = list.length - 1;
423
+ while (i < lastIndex) list[i] = list[++i];
424
+ list.length = lastIndex;
425
+ _nnmIndexRemove(list, attr);
426
+ if (el) {
427
+ var doc = el.ownerDocument;
428
+ if (doc) {
429
+ _onRemoveAttribute(doc, el, attr);
430
+ attr.ownerElement = null;
431
+ }
432
+ }
433
+ } else throw new DOMException(NOT_FOUND_ERR, /* @__PURE__ */ new Error(el.tagName + "@" + attr));
434
+ }
435
+ NamedNodeMap.prototype = {
436
+ length: 0,
437
+ item: NodeList.prototype.item,
438
+ getNamedItem: function(key) {
439
+ var i = this.length;
440
+ while (i--) {
441
+ var attr = this[i];
442
+ if (attr.nodeName == key) return attr;
443
+ }
444
+ },
445
+ setNamedItem: function(attr) {
446
+ var el = attr.ownerElement;
447
+ if (el && el != this._ownerElement) throw new DOMException(INUSE_ATTRIBUTE_ERR);
448
+ var oldAttr = this._nameIndex[attr.nodeName];
449
+ _addNamedNode(this._ownerElement, this, attr, oldAttr);
450
+ return oldAttr;
451
+ },
452
+ setNamedItemNS: function(attr) {
453
+ var el = attr.ownerElement, oldAttr;
454
+ if (el && el != this._ownerElement) throw new DOMException(INUSE_ATTRIBUTE_ERR);
455
+ oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
456
+ _addNamedNode(this._ownerElement, this, attr, oldAttr);
457
+ return oldAttr;
458
+ },
459
+ removeNamedItem: function(key) {
460
+ var attr = this.getNamedItem(key);
461
+ _removeNamedNode(this._ownerElement, this, attr);
462
+ return attr;
463
+ },
464
+ removeNamedItemNS: function(namespaceURI, localName) {
465
+ var attr = this.getNamedItemNS(namespaceURI, localName);
466
+ _removeNamedNode(this._ownerElement, this, attr);
467
+ return attr;
468
+ },
469
+ getNamedItemNS: function(namespaceURI, localName) {
470
+ var i = this.length;
471
+ while (i--) {
472
+ var node = this[i];
473
+ if (node.localName == localName && node.namespaceURI == namespaceURI) return node;
474
+ }
475
+ return null;
476
+ }
477
+ };
478
+ /**
479
+ * The DOMImplementation interface represents an object providing methods
480
+ * which are not dependent on any particular document.
481
+ * Such an object is returned by the `Document.implementation` property.
482
+ *
483
+ * __The individual methods describe the differences compared to the specs.__
484
+ *
485
+ * @constructor
486
+ *
487
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
488
+ * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
489
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
490
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
491
+ * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
492
+ */
493
+ function DOMImplementation() {}
494
+ DOMImplementation.prototype = {
495
+ /**
496
+ * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
497
+ * The different implementations fairly diverged in what kind of features were reported.
498
+ * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
499
+ *
500
+ * @deprecated It is deprecated and modern browsers return true in all cases.
501
+ *
502
+ * @param {string} feature
503
+ * @param {string} [version]
504
+ * @returns {boolean} always true
505
+ *
506
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
507
+ * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
508
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
509
+ */
510
+ hasFeature: function(feature, version) {
511
+ return true;
512
+ },
513
+ /**
514
+ * Creates an XML Document object of the specified type with its document element.
515
+ *
516
+ * __It behaves slightly different from the description in the living standard__:
517
+ * - There is no interface/class `XMLDocument`, it returns a `Document` instance.
518
+ * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
519
+ * - this implementation is not validating names or qualified names
520
+ * (when parsing XML strings, the SAX parser takes care of that)
521
+ *
522
+ * @param {string|null} namespaceURI
523
+ * @param {string} qualifiedName
524
+ * @param {DocumentType=null} doctype
525
+ * @returns {Document}
526
+ *
527
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
528
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
529
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
530
+ *
531
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
532
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
533
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
534
+ */
535
+ createDocument: function(namespaceURI, qualifiedName, doctype) {
536
+ var doc = new Document();
537
+ doc.implementation = this;
538
+ doc.childNodes = new NodeList();
539
+ doc.doctype = doctype || null;
540
+ if (doctype) doc.appendChild(doctype);
541
+ if (qualifiedName) {
542
+ var root = doc.createElementNS(namespaceURI, qualifiedName);
543
+ doc.appendChild(root);
544
+ }
545
+ return doc;
546
+ },
547
+ /**
548
+ * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
549
+ *
550
+ * __This implementation differs from the specification:__
551
+ * - this implementation is not validating names or qualified names
552
+ * (when parsing XML strings, the SAX parser takes care of that)
553
+ *
554
+ * Note: `internalSubset` can only be introduced via a direct property write to `node.internalSubset` after creation.
555
+ * Creation-time validation of `publicId`, `systemId` is not enforced.
556
+ * The serializer-level check covers all mutation vectors, including direct property writes.
557
+ * `internalSubset` is only serialized as `[ ... ]` when both `publicId` and `systemId` are
558
+ * absent (empty or `'.'`) — if either external identifier is present, `internalSubset` is
559
+ * silently omitted from the serialized output.
560
+ *
561
+ * @param {string} qualifiedName
562
+ * @param {string} [publicId]
563
+ * The external subset public identifier. Stored verbatim including surrounding quotes.
564
+ * When serialized with `requireWellFormed: true` (via the 4th-parameter options object),
565
+ * throws `DOMException` with code `INVALID_STATE_ERR` if the value is non-empty and does
566
+ * not match the XML `PubidLiteral` production (W3C DOM Parsing §3.2.1.3; XML 1.0 [12]).
567
+ * @param {string} [systemId]
568
+ * The external subset system identifier. Stored verbatim including surrounding quotes.
569
+ * When serialized with `requireWellFormed: true`, throws `DOMException` with code
570
+ * `INVALID_STATE_ERR` if the value is non-empty and does not match the XML `SystemLiteral`
571
+ * production (W3C DOM Parsing §3.2.1.3; XML 1.0 [11]).
572
+ * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
573
+ * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
574
+ *
575
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
576
+ * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
577
+ * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
578
+ *
579
+ * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
580
+ * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
581
+ * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
582
+ */
583
+ createDocumentType: function(qualifiedName, publicId, systemId) {
584
+ var node = new DocumentType();
585
+ node.name = qualifiedName;
586
+ node.nodeName = qualifiedName;
587
+ node.publicId = publicId || "";
588
+ node.systemId = systemId || "";
589
+ return node;
590
+ }
591
+ };
592
+ /**
593
+ * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247
594
+ */
595
+ function Node() {}
596
+ Node.prototype = {
597
+ firstChild: null,
598
+ lastChild: null,
599
+ previousSibling: null,
600
+ nextSibling: null,
601
+ attributes: null,
602
+ parentNode: null,
603
+ childNodes: null,
604
+ ownerDocument: null,
605
+ nodeValue: null,
606
+ namespaceURI: null,
607
+ prefix: null,
608
+ localName: null,
609
+ insertBefore: function(newChild, refChild) {
610
+ return _insertBefore(this, newChild, refChild);
611
+ },
612
+ replaceChild: function(newChild, oldChild) {
613
+ _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
614
+ if (oldChild) this.removeChild(oldChild);
615
+ },
616
+ removeChild: function(oldChild) {
617
+ return _removeChild(this, oldChild);
618
+ },
619
+ appendChild: function(newChild) {
620
+ return this.insertBefore(newChild, null);
621
+ },
622
+ hasChildNodes: function() {
623
+ return this.firstChild != null;
624
+ },
625
+ cloneNode: function(deep) {
626
+ return cloneNode(this.ownerDocument || this, this, deep);
627
+ },
628
+ /**
629
+ * Puts the specified node and all of its subtree into a "normalized" form. In a normalized
630
+ * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.
631
+ *
632
+ * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`
633
+ * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text
634
+ * nodes.
635
+ *
636
+ * This method iteratively traverses all child nodes to normalize all descendant nodes within
637
+ * the subtree.
638
+ *
639
+ * @throws {DOMException}
640
+ * May throw a DOMException if operations within removeChild or appendData (which are
641
+ * potentially invoked in this method) do not meet their specific constraints.
642
+ * @see {@link Node.removeChild}
643
+ * @see {@link CharacterData.appendData}
644
+ * @see ../docs/walk-dom.md.
645
+ */
646
+ normalize: function() {
647
+ walkDOM(this, null, { enter: function(node) {
648
+ var child = node.firstChild;
649
+ while (child) {
650
+ var next = child.nextSibling;
651
+ if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
652
+ var tail = [];
653
+ var sibling = next;
654
+ while (sibling !== null && sibling.nodeType === TEXT_NODE) {
655
+ tail.push(sibling.data);
656
+ sibling = sibling.nextSibling;
657
+ }
658
+ var removed = child.nextSibling;
659
+ while (removed !== sibling) {
660
+ var following = removed.nextSibling;
661
+ removed.parentNode = null;
662
+ removed.previousSibling = null;
663
+ removed.nextSibling = null;
664
+ removed = following;
665
+ }
666
+ child.nextSibling = sibling;
667
+ if (sibling !== null) sibling.previousSibling = child;
668
+ else node.lastChild = child;
669
+ child.appendData(tail.join(""));
670
+ _onUpdateChild(node.ownerDocument, node);
671
+ child = sibling;
672
+ } else child = next;
673
+ }
674
+ return true;
675
+ } });
676
+ },
677
+ isSupported: function(feature, version) {
678
+ return this.ownerDocument.implementation.hasFeature(feature, version);
679
+ },
680
+ hasAttributes: function() {
681
+ return this.attributes.length > 0;
682
+ },
683
+ /**
684
+ * Look up the prefix associated to the given namespace URI, starting from this node.
685
+ * **The default namespace declarations are ignored by this method.**
686
+ * See Namespace Prefix Lookup for details on the algorithm used by this method.
687
+ *
688
+ * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._
689
+ *
690
+ * @param {string | null} namespaceURI
691
+ * @returns {string | null}
692
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix
693
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo
694
+ * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix
695
+ * @see https://github.com/xmldom/xmldom/issues/322
696
+ */
697
+ lookupPrefix: function(namespaceURI) {
698
+ var el = this;
699
+ while (el) {
700
+ var map = el._nsMap;
701
+ if (map) {
702
+ for (var n in map) if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) return n;
703
+ }
704
+ el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
705
+ }
706
+ return null;
707
+ },
708
+ lookupNamespaceURI: function(prefix) {
709
+ var el = this;
710
+ while (el) {
711
+ var map = el._nsMap;
712
+ if (map) {
713
+ if (Object.prototype.hasOwnProperty.call(map, prefix)) return map[prefix];
714
+ }
715
+ el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
716
+ }
717
+ return null;
718
+ },
719
+ isDefaultNamespace: function(namespaceURI) {
720
+ return this.lookupPrefix(namespaceURI) == null;
721
+ }
722
+ };
723
+ function _xmlEncoder(c) {
724
+ return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == "\"" && "&quot;" || "&#" + c.charCodeAt() + ";";
725
+ }
726
+ copy(NodeType, Node);
727
+ copy(NodeType, Node.prototype);
728
+ /**
729
+ * @param {Node} node
730
+ * Root of the subtree to visit.
731
+ * @param {function(Node): boolean} callback
732
+ * Called for each node in depth-first pre-order. Return a truthy value to stop traversal early.
733
+ * @return {boolean} `true` if traversal was aborted by the callback, `false` otherwise.
734
+ */
735
+ function _visitNode(node, callback) {
736
+ return walkDOM(node, null, { enter: function(n) {
737
+ return callback(n) ? walkDOM.STOP : true;
738
+ } }) === walkDOM.STOP;
739
+ }
740
+ /**
741
+ * Depth-first pre/post-order DOM tree walker.
742
+ *
743
+ * Visits every node in the subtree rooted at `node`. For each node:
744
+ *
745
+ * 1. Calls `callbacks.enter(node, context)` before descending into the node's children. The
746
+ * return value becomes the `context` passed to each child's `enter` call and to the matching
747
+ * `exit` call.
748
+ * 2. If `enter` returns `null` or `undefined`, the node's children are skipped;
749
+ * sibling traversal continues normally.
750
+ * 3. If `enter` returns `walkDOM.STOP`, the entire traversal is aborted immediately — no
751
+ * further `enter` or `exit` calls are made.
752
+ * 4. `lastChild` and `previousSibling` are read **after** `enter` returns, so `enter` may
753
+ * safely modify the node's own child list before the walker descends. Modifying siblings of
754
+ * the current node or any other part of the tree produces unpredictable results: nodes already
755
+ * queued on the stack are visited regardless of DOM changes, and newly inserted nodes outside
756
+ * the current child list are never visited.
757
+ * 5. Calls `callbacks.exit(node, context)` (if provided) after all of a node's children have
758
+ * been visited, passing the same `context` that `enter`
759
+ * returned for that node.
760
+ *
761
+ * This implementation uses an explicit stack and does not recurse — it is safe on arbitrarily
762
+ * deep trees.
763
+ *
764
+ * @param {Node} node
765
+ * Root of the subtree to walk.
766
+ * @param {*} context
767
+ * Initial context value passed to the root node's `enter`.
768
+ * @param {{ enter: function(Node, *): *, exit?: function(Node, *): void }} callbacks
769
+ * @returns {void | walkDOM.STOP}
770
+ * @see ../docs/walk-dom.md.
771
+ */
772
+ function walkDOM(node, context, callbacks) {
773
+ var stack = [{
774
+ node,
775
+ context,
776
+ phase: walkDOM.ENTER
777
+ }];
778
+ while (stack.length > 0) {
779
+ var frame = stack.pop();
780
+ if (frame.phase === walkDOM.ENTER) {
781
+ var childContext = callbacks.enter(frame.node, frame.context);
782
+ if (childContext === walkDOM.STOP) return walkDOM.STOP;
783
+ stack.push({
784
+ node: frame.node,
785
+ context: childContext,
786
+ phase: walkDOM.EXIT
787
+ });
788
+ if (childContext === null || childContext === void 0) continue;
789
+ var child = frame.node.lastChild;
790
+ while (child) {
791
+ stack.push({
792
+ node: child,
793
+ context: childContext,
794
+ phase: walkDOM.ENTER
795
+ });
796
+ child = child.previousSibling;
797
+ }
798
+ } else if (callbacks.exit) callbacks.exit(frame.node, frame.context);
799
+ }
800
+ }
801
+ /**
802
+ * Sentinel value returned from a `walkDOM` `enter` callback to abort the entire traversal
803
+ * immediately.
804
+ *
805
+ * @type {symbol}
806
+ */
807
+ walkDOM.STOP = Symbol("walkDOM.STOP");
808
+ /**
809
+ * Phase constant for a stack frame that has not yet been visited.
810
+ * The `enter` callback is called and children are scheduled.
811
+ *
812
+ * @type {number}
813
+ */
814
+ walkDOM.ENTER = 0;
815
+ /**
816
+ * Phase constant for a stack frame whose subtree has been fully visited.
817
+ * The `exit` callback is called.
818
+ *
819
+ * @type {number}
820
+ */
821
+ walkDOM.EXIT = 1;
822
+ function Document() {
823
+ this.ownerDocument = this;
824
+ }
825
+ function _onAddAttribute(doc, el, newAttr) {
826
+ doc && doc._inc++;
827
+ if (newAttr.namespaceURI === NAMESPACE.XMLNS) el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
828
+ }
829
+ function _onRemoveAttribute(doc, el, newAttr, remove) {
830
+ doc && doc._inc++;
831
+ if (newAttr.namespaceURI === NAMESPACE.XMLNS) delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
832
+ }
833
+ /**
834
+ * Updates `el.childNodes`, updating the indexed items and it's `length`.
835
+ * Passing `newChild` means it will be appended.
836
+ * Otherwise it's assumed that an item has been removed,
837
+ * and `el.firstNode` and it's `.nextSibling` are used
838
+ * to walk the current list of child nodes.
839
+ *
840
+ * @param {Document} doc
841
+ * @param {Node} el
842
+ * @param {Node} [newChild]
843
+ * @private
844
+ */
845
+ function _onUpdateChild(doc, el, newChild) {
846
+ if (doc && doc._inc) {
847
+ doc._inc++;
848
+ var cs = el.childNodes;
849
+ if (newChild) cs[cs.length++] = newChild;
850
+ else {
851
+ var child = el.firstChild;
852
+ var i = 0;
853
+ while (child) {
854
+ cs[i++] = child;
855
+ child = child.nextSibling;
856
+ }
857
+ cs.length = i;
858
+ delete cs[cs.length];
859
+ }
860
+ }
861
+ }
862
+ /**
863
+ * Removes the connections between `parentNode` and `child`
864
+ * and any existing `child.previousSibling` or `child.nextSibling`.
865
+ *
866
+ * @see https://github.com/xmldom/xmldom/issues/135
867
+ * @see https://github.com/xmldom/xmldom/issues/145
868
+ *
869
+ * @param {Node} parentNode
870
+ * @param {Node} child
871
+ * @returns {Node} the child that was removed.
872
+ * @private
873
+ */
874
+ function _removeChild(parentNode, child) {
875
+ var previous = child.previousSibling;
876
+ var next = child.nextSibling;
877
+ if (previous) previous.nextSibling = next;
878
+ else parentNode.firstChild = next;
879
+ if (next) next.previousSibling = previous;
880
+ else parentNode.lastChild = previous;
881
+ child.parentNode = null;
882
+ child.previousSibling = null;
883
+ child.nextSibling = null;
884
+ _onUpdateChild(parentNode.ownerDocument, parentNode);
885
+ return child;
886
+ }
887
+ /**
888
+ * Returns `true` if `node` can be a parent for insertion.
889
+ * @param {Node} node
890
+ * @returns {boolean}
891
+ */
892
+ function hasValidParentNodeType(node) {
893
+ return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
894
+ }
895
+ /**
896
+ * Returns `true` if `node` can be inserted according to it's `nodeType`.
897
+ * @param {Node} node
898
+ * @returns {boolean}
899
+ */
900
+ function hasInsertableNodeType(node) {
901
+ return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);
902
+ }
903
+ /**
904
+ * Returns true if `node` is a DOCTYPE node
905
+ * @param {Node} node
906
+ * @returns {boolean}
907
+ */
908
+ function isDocTypeNode(node) {
909
+ return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
910
+ }
911
+ /**
912
+ * Returns true if the node is an element
913
+ * @param {Node} node
914
+ * @returns {boolean}
915
+ */
916
+ function isElementNode(node) {
917
+ return node && node.nodeType === Node.ELEMENT_NODE;
918
+ }
919
+ /**
920
+ * Returns true if `node` is a text node
921
+ * @param {Node} node
922
+ * @returns {boolean}
923
+ */
924
+ function isTextNode(node) {
925
+ return node && node.nodeType === Node.TEXT_NODE;
926
+ }
927
+ /**
928
+ * Check if en element node can be inserted before `child`, or at the end if child is falsy,
929
+ * according to the presence and position of a doctype node on the same level.
930
+ *
931
+ * @param {Document} doc The document node
932
+ * @param {Node} child the node that would become the nextSibling if the element would be inserted
933
+ * @returns {boolean} `true` if an element can be inserted before child
934
+ * @private
935
+ * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
936
+ */
937
+ function isElementInsertionPossible(doc, child) {
938
+ var parentChildNodes = doc.childNodes || [];
939
+ if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) return false;
940
+ var docTypeNode = find(parentChildNodes, isDocTypeNode);
941
+ return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
942
+ }
943
+ /**
944
+ * Check if en element node can be inserted before `child`, or at the end if child is falsy,
945
+ * according to the presence and position of a doctype node on the same level.
946
+ *
947
+ * @param {Node} doc The document node
948
+ * @param {Node} child the node that would become the nextSibling if the element would be inserted
949
+ * @returns {boolean} `true` if an element can be inserted before child
950
+ * @private
951
+ * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
952
+ */
953
+ function isElementReplacementPossible(doc, child) {
954
+ var parentChildNodes = doc.childNodes || [];
955
+ function hasElementChildThatIsNotChild(node) {
956
+ return isElementNode(node) && node !== child;
957
+ }
958
+ if (find(parentChildNodes, hasElementChildThatIsNotChild)) return false;
959
+ var docTypeNode = find(parentChildNodes, isDocTypeNode);
960
+ return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
961
+ }
962
+ /**
963
+ * @private
964
+ * Steps 1-5 of the checks before inserting and before replacing a child are the same.
965
+ *
966
+ * @param {Node} parent the parent node to insert `node` into
967
+ * @param {Node} node the node to insert
968
+ * @param {Node=} child the node that should become the `nextSibling` of `node`
969
+ * @returns {Node}
970
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
971
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
972
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
973
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
974
+ */
975
+ function assertPreInsertionValidity1to5(parent, node, child) {
976
+ if (!hasValidParentNodeType(parent)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
977
+ if (child && child.parentNode !== parent) throw new DOMException(NOT_FOUND_ERR, "child not in parent");
978
+ if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType);
979
+ }
980
+ /**
981
+ * @private
982
+ * Step 6 of the checks before inserting and before replacing a child are different.
983
+ *
984
+ * @param {Document} parent the parent node to insert `node` into
985
+ * @param {Node} node the node to insert
986
+ * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
987
+ * @returns {Node}
988
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
989
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
990
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
991
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
992
+ */
993
+ function assertPreInsertionValidityInDocument(parent, node, child) {
994
+ var parentChildNodes = parent.childNodes || [];
995
+ var nodeChildNodes = node.childNodes || [];
996
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
997
+ var nodeChildElements = nodeChildNodes.filter(isElementNode);
998
+ if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
999
+ if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
1000
+ }
1001
+ if (isElementNode(node)) {
1002
+ if (!isElementInsertionPossible(parent, child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
1003
+ }
1004
+ if (isDocTypeNode(node)) {
1005
+ if (find(parentChildNodes, isDocTypeNode)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
1006
+ var parentElementChild = find(parentChildNodes, isElementNode);
1007
+ if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
1008
+ if (!child && parentElementChild) throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
1009
+ }
1010
+ }
1011
+ /**
1012
+ * @private
1013
+ * Step 6 of the checks before inserting and before replacing a child are different.
1014
+ *
1015
+ * @param {Document} parent the parent node to insert `node` into
1016
+ * @param {Node} node the node to insert
1017
+ * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
1018
+ * @returns {Node}
1019
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
1020
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
1021
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
1022
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
1023
+ */
1024
+ function assertPreReplacementValidityInDocument(parent, node, child) {
1025
+ var parentChildNodes = parent.childNodes || [];
1026
+ var nodeChildNodes = node.childNodes || [];
1027
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
1028
+ var nodeChildElements = nodeChildNodes.filter(isElementNode);
1029
+ if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
1030
+ if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
1031
+ }
1032
+ if (isElementNode(node)) {
1033
+ if (!isElementReplacementPossible(parent, child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
1034
+ }
1035
+ if (isDocTypeNode(node)) {
1036
+ function hasDoctypeChildThatIsNotChild(node) {
1037
+ return isDocTypeNode(node) && node !== child;
1038
+ }
1039
+ if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
1040
+ var parentElementChild = find(parentChildNodes, isElementNode);
1041
+ if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
1042
+ }
1043
+ }
1044
+ /**
1045
+ * @private
1046
+ * @param {Node} parent the parent node to insert `node` into
1047
+ * @param {Node} node the node to insert
1048
+ * @param {Node=} child the node that should become the `nextSibling` of `node`
1049
+ * @returns {Node}
1050
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
1051
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
1052
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
1053
+ */
1054
+ function _insertBefore(parent, node, child, _inDocumentAssertion) {
1055
+ assertPreInsertionValidity1to5(parent, node, child);
1056
+ if (parent.nodeType === Node.DOCUMENT_NODE) (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
1057
+ var cp = node.parentNode;
1058
+ if (cp) cp.removeChild(node);
1059
+ if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
1060
+ var newFirst = node.firstChild;
1061
+ if (newFirst == null) return node;
1062
+ var newLast = node.lastChild;
1063
+ } else newFirst = newLast = node;
1064
+ var pre = child ? child.previousSibling : parent.lastChild;
1065
+ newFirst.previousSibling = pre;
1066
+ newLast.nextSibling = child;
1067
+ if (pre) pre.nextSibling = newFirst;
1068
+ else parent.firstChild = newFirst;
1069
+ if (child == null) parent.lastChild = newLast;
1070
+ else child.previousSibling = newLast;
1071
+ do {
1072
+ newFirst.parentNode = parent;
1073
+ var targetDoc = parent.ownerDocument || parent;
1074
+ _updateOwnerDocument(newFirst, targetDoc);
1075
+ } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
1076
+ _onUpdateChild(parent.ownerDocument || parent, parent);
1077
+ if (node.nodeType == DOCUMENT_FRAGMENT_NODE) node.firstChild = node.lastChild = null;
1078
+ return node;
1079
+ }
1080
+ /**
1081
+ * Recursively updates the ownerDocument property for a node and all its descendants
1082
+ * @param {Node} node
1083
+ * @param {Document} newOwnerDocument
1084
+ * @private
1085
+ */
1086
+ function _updateOwnerDocument(node, newOwnerDocument) {
1087
+ if (node.ownerDocument === newOwnerDocument) return;
1088
+ node.ownerDocument = newOwnerDocument;
1089
+ if (node.nodeType === ELEMENT_NODE && node.attributes) for (var i = 0; i < node.attributes.length; i++) {
1090
+ var attr = node.attributes.item(i);
1091
+ if (attr) attr.ownerDocument = newOwnerDocument;
1092
+ }
1093
+ var child = node.firstChild;
1094
+ while (child) {
1095
+ _updateOwnerDocument(child, newOwnerDocument);
1096
+ child = child.nextSibling;
1097
+ }
1098
+ }
1099
+ /**
1100
+ * Appends `newChild` to `parentNode`.
1101
+ * If `newChild` is already connected to a `parentNode` it is first removed from it.
1102
+ *
1103
+ * @see https://github.com/xmldom/xmldom/issues/135
1104
+ * @see https://github.com/xmldom/xmldom/issues/145
1105
+ * @param {Node} parentNode
1106
+ * @param {Node} newChild
1107
+ * @returns {Node}
1108
+ * @private
1109
+ */
1110
+ function _appendSingleChild(parentNode, newChild) {
1111
+ if (newChild.parentNode) newChild.parentNode.removeChild(newChild);
1112
+ newChild.parentNode = parentNode;
1113
+ newChild.previousSibling = parentNode.lastChild;
1114
+ newChild.nextSibling = null;
1115
+ if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;
1116
+ else parentNode.firstChild = newChild;
1117
+ parentNode.lastChild = newChild;
1118
+ _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
1119
+ _updateOwnerDocument(newChild, parentNode.ownerDocument || parentNode);
1120
+ return newChild;
1121
+ }
1122
+ Document.prototype = {
1123
+ nodeName: "#document",
1124
+ nodeType: DOCUMENT_NODE,
1125
+ /**
1126
+ * The DocumentType node of the document.
1127
+ *
1128
+ * @readonly
1129
+ * @type DocumentType
1130
+ */
1131
+ doctype: null,
1132
+ documentElement: null,
1133
+ _inc: 1,
1134
+ insertBefore: function(newChild, refChild) {
1135
+ if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
1136
+ var child = newChild.firstChild;
1137
+ while (child) {
1138
+ var next = child.nextSibling;
1139
+ this.insertBefore(child, refChild);
1140
+ child = next;
1141
+ }
1142
+ return newChild;
1143
+ }
1144
+ _insertBefore(this, newChild, refChild);
1145
+ _updateOwnerDocument(newChild, this);
1146
+ if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) this.documentElement = newChild;
1147
+ return newChild;
1148
+ },
1149
+ removeChild: function(oldChild) {
1150
+ if (this.documentElement == oldChild) this.documentElement = null;
1151
+ return _removeChild(this, oldChild);
1152
+ },
1153
+ replaceChild: function(newChild, oldChild) {
1154
+ _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
1155
+ _updateOwnerDocument(newChild, this);
1156
+ if (oldChild) this.removeChild(oldChild);
1157
+ if (isElementNode(newChild)) this.documentElement = newChild;
1158
+ },
1159
+ importNode: function(importedNode, deep) {
1160
+ return importNode(this, importedNode, deep);
1161
+ },
1162
+ getElementById: function(id) {
1163
+ var rtv = null;
1164
+ _visitNode(this.documentElement, function(node) {
1165
+ if (node.nodeType == ELEMENT_NODE) {
1166
+ if (node.getAttribute("id") == id) {
1167
+ rtv = node;
1168
+ return true;
1169
+ }
1170
+ }
1171
+ });
1172
+ return rtv;
1173
+ },
1174
+ /**
1175
+ * The `getElementsByClassName` method of `Document` interface returns an array-like object
1176
+ * of all child elements which have **all** of the given class name(s).
1177
+ *
1178
+ * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
1179
+ *
1180
+ *
1181
+ * Warning: This is a live LiveNodeList.
1182
+ * Changes in the DOM will reflect in the array as the changes occur.
1183
+ * If an element selected by this array no longer qualifies for the selector,
1184
+ * it will automatically be removed. Be aware of this for iteration purposes.
1185
+ *
1186
+ * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
1187
+ *
1188
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
1189
+ * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
1190
+ */
1191
+ getElementsByClassName: function(classNames) {
1192
+ var classNamesSet = toOrderedSet(classNames);
1193
+ return new LiveNodeList(this, function(base) {
1194
+ var ls = [];
1195
+ if (classNamesSet.length > 0) _visitNode(base.documentElement, function(node) {
1196
+ if (node !== base && node.nodeType === ELEMENT_NODE) {
1197
+ var nodeClassNames = node.getAttribute("class");
1198
+ if (nodeClassNames) {
1199
+ var matches = classNames === nodeClassNames;
1200
+ if (!matches) {
1201
+ var nodeClassNamesSet = toOrderedSet(nodeClassNames);
1202
+ matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
1203
+ }
1204
+ if (matches) ls.push(node);
1205
+ }
1206
+ }
1207
+ });
1208
+ return ls;
1209
+ });
1210
+ },
1211
+ createElement: function(tagName) {
1212
+ var node = new Element();
1213
+ node.ownerDocument = this;
1214
+ node.nodeName = tagName;
1215
+ node.tagName = tagName;
1216
+ node.localName = tagName;
1217
+ node.childNodes = new NodeList();
1218
+ var attrs = node.attributes = new NamedNodeMap();
1219
+ attrs._ownerElement = node;
1220
+ return node;
1221
+ },
1222
+ createDocumentFragment: function() {
1223
+ var node = new DocumentFragment();
1224
+ node.ownerDocument = this;
1225
+ node.childNodes = new NodeList();
1226
+ return node;
1227
+ },
1228
+ createTextNode: function(data) {
1229
+ var node = new Text();
1230
+ node.ownerDocument = this;
1231
+ node.appendData(data);
1232
+ return node;
1233
+ },
1234
+ createComment: function(data) {
1235
+ var node = new Comment();
1236
+ node.ownerDocument = this;
1237
+ node.appendData(data);
1238
+ return node;
1239
+ },
1240
+ /**
1241
+ * Returns a new CDATASection node whose data is `data`.
1242
+ *
1243
+ * __This implementation differs from the specification:__
1244
+ * - calling this method on an HTML document does not throw `NotSupportedError`.
1245
+ *
1246
+ * @param {string} data
1247
+ * @returns {CDATASection}
1248
+ * @throws DOMException with code `INVALID_CHARACTER_ERR` if `data` contains `"]]>"`.
1249
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection
1250
+ * @see https://dom.spec.whatwg.org/#dom-document-createcdatasection
1251
+ */
1252
+ createCDATASection: function(data) {
1253
+ if (data.indexOf("]]>") !== -1) throw new DOMException(INVALID_CHARACTER_ERR, "data contains \"]]>\"");
1254
+ var node = new CDATASection();
1255
+ node.ownerDocument = this;
1256
+ node.appendData(data);
1257
+ return node;
1258
+ },
1259
+ /**
1260
+ * Returns a ProcessingInstruction node whose target is target and data is data.
1261
+ *
1262
+ * __This implementation differs from the specification:__
1263
+ * - it does not do any input validation on the arguments and doesn't throw "InvalidCharacterError".
1264
+ *
1265
+ * Note: When the resulting document is serialized with `requireWellFormed: true`, the
1266
+ * serializer throws with code `INVALID_STATE_ERR` if `.target` is not a valid XML `NCName`
1267
+ * (a `Name` with no colon) or is an ASCII case-insensitive match for `"xml"`, or if `.data`
1268
+ * contains `?>` (W3C DOM Parsing §3.2.1.7). Without that option the target and data are
1269
+ * emitted verbatim.
1270
+ *
1271
+ * @param {string} target
1272
+ * @param {string} data
1273
+ * @returns {ProcessingInstruction}
1274
+ * @see https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction
1275
+ * @see https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
1276
+ * @see https://www.w3.org/TR/DOM-Parsing/#dfn-concept-serialize-xml §3.2.1.7
1277
+ */
1278
+ createProcessingInstruction: function(target, data) {
1279
+ var node = new ProcessingInstruction();
1280
+ node.ownerDocument = this;
1281
+ node.tagName = node.nodeName = node.target = target;
1282
+ node.nodeValue = node.data = data;
1283
+ return node;
1284
+ },
1285
+ createAttribute: function(name) {
1286
+ var node = new Attr();
1287
+ node.ownerDocument = this;
1288
+ node.name = name;
1289
+ node.nodeName = name;
1290
+ node.localName = name;
1291
+ node.specified = true;
1292
+ return node;
1293
+ },
1294
+ /**
1295
+ * Creates an EntityReference object, serialized as `&name;`.
1296
+ *
1297
+ * The `name` is validated against the XML `Name` production at creation time; an invalid name
1298
+ * throws a `DOMException` with code `INVALID_CHARACTER_ERR`. When the resulting node is
1299
+ * serialized with `requireWellFormed: true`, the serializer re-validates `nodeName` and throws
1300
+ * a `DOMException` with code `INVALID_STATE_ERR` if a later `nodeName` mutation made it invalid;
1301
+ * without that option the name is emitted verbatim.
1302
+ *
1303
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
1304
+ * constructs `EntityReference` nodes, so this method is the only producer.
1305
+ *
1306
+ * @param {string} name The name of the entity to reference.
1307
+ * @returns {EntityReference}
1308
+ * @throws {DOMException} With code `INVALID_CHARACTER_ERR` when `name` is not a valid XML `Name`.
1309
+ * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE
1310
+ */
1311
+ createEntityReference: function(name) {
1312
+ if (!tagNamePattern.test(name)) throw new DOMException(INVALID_CHARACTER_ERR, "not a valid xml name \"" + name + "\"");
1313
+ var node = new EntityReference();
1314
+ node.ownerDocument = this;
1315
+ node.nodeName = name;
1316
+ return node;
1317
+ },
1318
+ createElementNS: function(namespaceURI, qualifiedName) {
1319
+ var node = new Element();
1320
+ var pl = qualifiedName.split(":");
1321
+ var attrs = node.attributes = new NamedNodeMap();
1322
+ node.childNodes = new NodeList();
1323
+ node.ownerDocument = this;
1324
+ node.nodeName = qualifiedName;
1325
+ node.tagName = qualifiedName;
1326
+ node.namespaceURI = namespaceURI;
1327
+ if (pl.length == 2) {
1328
+ node.prefix = pl[0];
1329
+ node.localName = pl[1];
1330
+ } else node.localName = qualifiedName;
1331
+ attrs._ownerElement = node;
1332
+ return node;
1333
+ },
1334
+ createAttributeNS: function(namespaceURI, qualifiedName) {
1335
+ var node = new Attr();
1336
+ var pl = qualifiedName.split(":");
1337
+ node.ownerDocument = this;
1338
+ node.nodeName = qualifiedName;
1339
+ node.name = qualifiedName;
1340
+ node.namespaceURI = namespaceURI;
1341
+ node.specified = true;
1342
+ if (pl.length == 2) {
1343
+ node.prefix = pl[0];
1344
+ node.localName = pl[1];
1345
+ } else node.localName = qualifiedName;
1346
+ return node;
1347
+ }
1348
+ };
1349
+ _extends(Document, Node);
1350
+ function Element() {
1351
+ this._nsMap = {};
1352
+ }
1353
+ Element.prototype = {
1354
+ nodeType: ELEMENT_NODE,
1355
+ hasAttribute: function(name) {
1356
+ return this.getAttributeNode(name) != null;
1357
+ },
1358
+ getAttribute: function(name) {
1359
+ var attr = this.getAttributeNode(name);
1360
+ return attr && attr.value || "";
1361
+ },
1362
+ getAttributeNode: function(name) {
1363
+ return this.attributes.getNamedItem(name);
1364
+ },
1365
+ setAttribute: function(name, value) {
1366
+ var attr = this.ownerDocument.createAttribute(name);
1367
+ attr.value = attr.nodeValue = "" + value;
1368
+ this.setAttributeNode(attr);
1369
+ },
1370
+ removeAttribute: function(name) {
1371
+ var attr = this.getAttributeNode(name);
1372
+ attr && this.removeAttributeNode(attr);
1373
+ },
1374
+ appendChild: function(newChild) {
1375
+ if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) return this.insertBefore(newChild, null);
1376
+ else return _appendSingleChild(this, newChild);
1377
+ },
1378
+ setAttributeNode: function(newAttr) {
1379
+ return this.attributes.setNamedItem(newAttr);
1380
+ },
1381
+ setAttributeNodeNS: function(newAttr) {
1382
+ return this.attributes.setNamedItemNS(newAttr);
1383
+ },
1384
+ removeAttributeNode: function(oldAttr) {
1385
+ return this.attributes.removeNamedItem(oldAttr.nodeName);
1386
+ },
1387
+ removeAttributeNS: function(namespaceURI, localName) {
1388
+ var old = this.getAttributeNodeNS(namespaceURI, localName);
1389
+ old && this.removeAttributeNode(old);
1390
+ },
1391
+ hasAttributeNS: function(namespaceURI, localName) {
1392
+ return this.getAttributeNodeNS(namespaceURI, localName) != null;
1393
+ },
1394
+ getAttributeNS: function(namespaceURI, localName) {
1395
+ var attr = this.getAttributeNodeNS(namespaceURI, localName);
1396
+ return attr && attr.value || "";
1397
+ },
1398
+ setAttributeNS: function(namespaceURI, qualifiedName, value) {
1399
+ var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
1400
+ attr.value = attr.nodeValue = "" + value;
1401
+ this.setAttributeNode(attr);
1402
+ },
1403
+ getAttributeNodeNS: function(namespaceURI, localName) {
1404
+ return this.attributes.getNamedItemNS(namespaceURI, localName);
1405
+ },
1406
+ getElementsByTagName: function(tagName) {
1407
+ return new LiveNodeList(this, function(base) {
1408
+ var ls = [];
1409
+ _visitNode(base, function(node) {
1410
+ if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) ls.push(node);
1411
+ });
1412
+ return ls;
1413
+ });
1414
+ },
1415
+ getElementsByTagNameNS: function(namespaceURI, localName) {
1416
+ return new LiveNodeList(this, function(base) {
1417
+ var ls = [];
1418
+ _visitNode(base, function(node) {
1419
+ if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) ls.push(node);
1420
+ });
1421
+ return ls;
1422
+ });
1423
+ }
1424
+ };
1425
+ Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;
1426
+ Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;
1427
+ _extends(Element, Node);
1428
+ function Attr() {}
1429
+ Attr.prototype.nodeType = ATTRIBUTE_NODE;
1430
+ _extends(Attr, Node);
1431
+ function CharacterData() {}
1432
+ CharacterData.prototype = {
1433
+ data: "",
1434
+ substringData: function(offset, count) {
1435
+ return this.data.substring(offset, offset + count);
1436
+ },
1437
+ appendData: function(text) {
1438
+ text = this.data + text;
1439
+ this.nodeValue = this.data = text;
1440
+ this.length = text.length;
1441
+ },
1442
+ insertData: function(offset, text) {
1443
+ this.replaceData(offset, 0, text);
1444
+ },
1445
+ appendChild: function(newChild) {
1446
+ throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
1447
+ },
1448
+ deleteData: function(offset, count) {
1449
+ this.replaceData(offset, count, "");
1450
+ },
1451
+ replaceData: function(offset, count, text) {
1452
+ var start = this.data.substring(0, offset);
1453
+ var end = this.data.substring(offset + count);
1454
+ text = start + text + end;
1455
+ this.nodeValue = this.data = text;
1456
+ this.length = text.length;
1457
+ }
1458
+ };
1459
+ _extends(CharacterData, Node);
1460
+ function Text() {}
1461
+ Text.prototype = {
1462
+ nodeName: "#text",
1463
+ nodeType: TEXT_NODE,
1464
+ splitText: function(offset) {
1465
+ var text = this.data;
1466
+ var newText = text.substring(offset);
1467
+ text = text.substring(0, offset);
1468
+ this.data = this.nodeValue = text;
1469
+ this.length = text.length;
1470
+ var newNode = this.ownerDocument.createTextNode(newText);
1471
+ if (this.parentNode) this.parentNode.insertBefore(newNode, this.nextSibling);
1472
+ return newNode;
1473
+ }
1474
+ };
1475
+ _extends(Text, CharacterData);
1476
+ function Comment() {}
1477
+ Comment.prototype = {
1478
+ nodeName: "#comment",
1479
+ nodeType: COMMENT_NODE
1480
+ };
1481
+ _extends(Comment, CharacterData);
1482
+ function CDATASection() {}
1483
+ CDATASection.prototype = {
1484
+ nodeName: "#cdata-section",
1485
+ nodeType: CDATA_SECTION_NODE
1486
+ };
1487
+ _extends(CDATASection, CharacterData);
1488
+ /**
1489
+ * Represents a DocumentType node (the `<!DOCTYPE ...>` declaration).
1490
+ *
1491
+ * `name`, `publicId`, `systemId`, and `internalSubset` are plain own-property assignments.
1492
+ * xmldom does not enforce the `readonly` constraint declared by the WHATWG DOM spec —
1493
+ * direct property writes succeed silently. Values are serialized verbatim when
1494
+ * `requireWellFormed` is false (the default). When the serializer is invoked with
1495
+ * `requireWellFormed: true` (via the 4th-parameter options object), it validates each
1496
+ * field — including `name`, which is checked against the XML `Name` production — and throws
1497
+ * `DOMException` with code `INVALID_STATE_ERR` on invalid values.
1498
+ *
1499
+ * @class
1500
+ * @see https://developer.mozilla.org/docs/Web/API/DocumentType MDN
1501
+ */
1502
+ function DocumentType() {}
1503
+ DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
1504
+ _extends(DocumentType, Node);
1505
+ function Notation() {}
1506
+ Notation.prototype.nodeType = NOTATION_NODE;
1507
+ _extends(Notation, Node);
1508
+ function Entity() {}
1509
+ Entity.prototype.nodeType = ENTITY_NODE;
1510
+ _extends(Entity, Node);
1511
+ /**
1512
+ * Represents an EntityReference node, serialized as `&nodeName;`.
1513
+ *
1514
+ * `nodeName` is the referenced entity's name, stored verbatim. When serialized with
1515
+ * `requireWellFormed: true`, the serializer validates `nodeName` against the XML `Name` production
1516
+ * and throws a `DOMException` with code `INVALID_STATE_ERR` if it does not match; without that
1517
+ * option the name is emitted verbatim between `&` and `;`.
1518
+ *
1519
+ * Note: xmldom does not expand entities — the parser resolves entity references inline and never
1520
+ * constructs `EntityReference` nodes, so the only producer is `Document.createEntityReference`.
1521
+ *
1522
+ * @class
1523
+ * @see https://www.w3.org/TR/xml/#NT-Name
1524
+ */
1525
+ function EntityReference() {}
1526
+ EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
1527
+ _extends(EntityReference, Node);
1528
+ function DocumentFragment() {}
1529
+ DocumentFragment.prototype.nodeName = "#document-fragment";
1530
+ DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
1531
+ _extends(DocumentFragment, Node);
1532
+ function ProcessingInstruction() {}
1533
+ ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
1534
+ _extends(ProcessingInstruction, Node);
1535
+ function XMLSerializer() {}
1536
+ /**
1537
+ * Returns the result of serializing `node` to XML.
1538
+ *
1539
+ * When `options.requireWellFormed` is `true`, the serializer throws for content that would
1540
+ * produce ill-formed XML.
1541
+ *
1542
+ * __This implementation differs from the specification:__
1543
+ * - CDATASection nodes whose data contains `]]>` are serialized by splitting the section
1544
+ * at each `]]>` occurrence (following W3C DOM Level 3 Core `split-cdata-sections`
1545
+ * default behaviour) unless `requireWellFormed` is `true`.
1546
+ * - when `requireWellFormed` is `true`, `DOMException` with code `INVALID_STATE_ERR`
1547
+ * is only thrown to prevent injection vectors, not for all the spec mandated checks.
1548
+ *
1549
+ * @param {Node} node
1550
+ * @param {boolean} [isHtml]
1551
+ * @param {function} [nodeFilter]
1552
+ * @param {Object} [options]
1553
+ * @param {boolean} [options.requireWellFormed=false]
1554
+ * When `true`, throws for content that would produce ill-formed XML.
1555
+ * @returns {string}
1556
+ * @throws {DOMException}
1557
+ * With code `INVALID_STATE_ERR` when `requireWellFormed` is `true` and:
1558
+ * - an Element's qualified name (including any namespace prefix) is not a valid XML QName,
1559
+ * - an attribute's qualified name (including a synthesized `xmlns:` namespace declaration) is
1560
+ * not a valid XML QName,
1561
+ * - a CDATASection node's data contains `"]]>"`,
1562
+ * - a Comment node's data contains `"-->"` (bare `"--"` does not throw on this branch),
1563
+ * - a ProcessingInstruction's target is not a valid XML `NCName` (a `Name` with no colon) or is
1564
+ * an ASCII case-insensitive match for `"xml"`, or its data contains `"?>"`,
1565
+ * - a DocumentType's `name` is not a valid XML `Name` (XML 1.0 production [5]),
1566
+ * - a DocumentType's `publicId` is non-empty and does not match the XML `PubidLiteral`
1567
+ * production,
1568
+ * - a DocumentType's `systemId` is non-empty and does not match the XML `SystemLiteral`
1569
+ * production,
1570
+ * - a DocumentType's `internalSubset` contains `"]>"`, or
1571
+ * - an EntityReference's `nodeName` is not a valid XML `Name` (XML 1.0 production [5]).
1572
+ * Note: xmldom does not enforce `readonly` on DocumentType fields — direct property
1573
+ * writes succeed and are covered by the serializer-level checks above.
1574
+ * @see https://html.spec.whatwg.org/#dom-xmlserializer-serializetostring
1575
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serialization
1576
+ * @see https://github.com/w3c/DOM-Parsing/issues/84
1577
+ */
1578
+ XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter, options) {
1579
+ return nodeSerializeToString.call(node, isHtml, nodeFilter, options);
1580
+ };
1581
+ Node.prototype.toString = nodeSerializeToString;
1582
+ function nodeSerializeToString(isHtml, nodeFilter, options) {
1583
+ var requireWellFormed = !!options && !!options.requireWellFormed;
1584
+ var buf = [];
1585
+ var refNode = this.nodeType == 9 && this.documentElement || this;
1586
+ var prefix = refNode.prefix;
1587
+ var uri = refNode.namespaceURI;
1588
+ if (uri && prefix == null) {
1589
+ var prefix = refNode.lookupPrefix(uri);
1590
+ if (prefix == null) var visibleNamespaces = [{
1591
+ namespace: uri,
1592
+ prefix: null
1593
+ }];
1594
+ }
1595
+ serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces, requireWellFormed);
1596
+ return buf.join("");
1597
+ }
1598
+ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
1599
+ var prefix = node.prefix || "";
1600
+ var uri = node.namespaceURI;
1601
+ if (!uri) return false;
1602
+ if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) return false;
1603
+ var i = visibleNamespaces.length;
1604
+ while (i--) {
1605
+ var ns = visibleNamespaces[i];
1606
+ if (ns.prefix === prefix) return ns.namespace !== uri;
1607
+ }
1608
+ return true;
1609
+ }
1610
+ /**
1611
+ * Well-formed constraint: No < in Attribute Values
1612
+ * > The replacement text of any entity referred to directly or indirectly
1613
+ * > in an attribute value must not contain a <.
1614
+ * @see https://www.w3.org/TR/xml11/#CleanAttrVals
1615
+ * @see https://www.w3.org/TR/xml11/#NT-AttValue
1616
+ *
1617
+ * Literal whitespace other than space that appear in attribute values
1618
+ * are serialized as their entity references, so they will be preserved.
1619
+ * (In contrast to whitespace literals in the input which are normalized to spaces)
1620
+ * @see https://www.w3.org/TR/xml11/#AVNormalize
1621
+ * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes
1622
+ */
1623
+ function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
1624
+ if (requireWellFormed && !tagNamePattern.test(qualifiedName)) throw new DOMException(INVALID_STATE_ERR, "The attribute name \"" + qualifiedName + "\" is not a valid XML QName");
1625
+ buf.push(" ", qualifiedName, "=\"", value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), "\"");
1626
+ }
1627
+ function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
1628
+ if (!visibleNamespaces) visibleNamespaces = [];
1629
+ walkDOM(node, {
1630
+ ns: visibleNamespaces,
1631
+ isHTML
1632
+ }, {
1633
+ enter: function(n, ctx) {
1634
+ var ns = ctx.ns;
1635
+ var html = ctx.isHTML;
1636
+ if (nodeFilter) {
1637
+ n = nodeFilter(n);
1638
+ if (n) {
1639
+ if (typeof n == "string") {
1640
+ buf.push(n);
1641
+ return null;
1642
+ }
1643
+ } else return null;
1644
+ }
1645
+ switch (n.nodeType) {
1646
+ case ELEMENT_NODE:
1647
+ var attrs = n.attributes;
1648
+ var len = attrs.length;
1649
+ var nodeName = n.tagName;
1650
+ html = NAMESPACE.isHTML(n.namespaceURI) || html;
1651
+ var prefixedNodeName = nodeName;
1652
+ if (!html && !n.prefix && n.namespaceURI) {
1653
+ var defaultNS;
1654
+ for (var ai = 0; ai < attrs.length; ai++) if (attrs.item(ai).name === "xmlns") {
1655
+ defaultNS = attrs.item(ai).value;
1656
+ break;
1657
+ }
1658
+ if (!defaultNS) for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
1659
+ var nsEntry = ns[nsi];
1660
+ if (nsEntry.prefix === "" && nsEntry.namespace === n.namespaceURI) {
1661
+ defaultNS = nsEntry.namespace;
1662
+ break;
1663
+ }
1664
+ }
1665
+ if (defaultNS !== n.namespaceURI) for (var nsi = ns.length - 1; nsi >= 0; nsi--) {
1666
+ var nsEntry = ns[nsi];
1667
+ if (nsEntry.namespace === n.namespaceURI) {
1668
+ if (nsEntry.prefix) prefixedNodeName = nsEntry.prefix + ":" + nodeName;
1669
+ break;
1670
+ }
1671
+ }
1672
+ }
1673
+ if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) throw new DOMException(INVALID_STATE_ERR, "The element name \"" + prefixedNodeName + "\" is not a valid XML QName");
1674
+ buf.push("<", prefixedNodeName);
1675
+ var childNs = ns.slice();
1676
+ for (var i = 0; i < len; i++) {
1677
+ var attr = attrs.item(i);
1678
+ if (attr.prefix == "xmlns") childNs.push({
1679
+ prefix: attr.localName,
1680
+ namespace: attr.value
1681
+ });
1682
+ else if (attr.nodeName == "xmlns") childNs.push({
1683
+ prefix: "",
1684
+ namespace: attr.value
1685
+ });
1686
+ }
1687
+ for (var i = 0; i < len; i++) {
1688
+ var attr = attrs.item(i);
1689
+ if (needNamespaceDefine(attr, html, childNs)) {
1690
+ var attrPrefix = attr.prefix || "";
1691
+ var uri = attr.namespaceURI;
1692
+ addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri, requireWellFormed);
1693
+ childNs.push({
1694
+ prefix: attrPrefix,
1695
+ namespace: uri
1696
+ });
1697
+ }
1698
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
1699
+ if (filteredAttr) {
1700
+ if (typeof filteredAttr === "string") buf.push(filteredAttr);
1701
+ else addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
1702
+ }
1703
+ }
1704
+ if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
1705
+ var nodePrefix = n.prefix || "";
1706
+ var uri = n.namespaceURI;
1707
+ addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri, requireWellFormed);
1708
+ childNs.push({
1709
+ prefix: nodePrefix,
1710
+ namespace: uri
1711
+ });
1712
+ }
1713
+ var child = n.firstChild;
1714
+ if (child || html && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
1715
+ buf.push(">");
1716
+ if (html && /^script$/i.test(nodeName)) {
1717
+ while (child) {
1718
+ if (child.data) buf.push(child.data);
1719
+ else serializeToString(child, buf, html, nodeFilter, childNs.slice(), requireWellFormed);
1720
+ child = child.nextSibling;
1721
+ }
1722
+ buf.push("</", nodeName, ">");
1723
+ return null;
1724
+ }
1725
+ return {
1726
+ ns: childNs,
1727
+ isHTML: html,
1728
+ tag: prefixedNodeName
1729
+ };
1730
+ } else {
1731
+ buf.push("/>");
1732
+ return null;
1733
+ }
1734
+ case DOCUMENT_NODE:
1735
+ case DOCUMENT_FRAGMENT_NODE: return {
1736
+ ns: ns.slice(),
1737
+ isHTML: html,
1738
+ tag: null
1739
+ };
1740
+ case ATTRIBUTE_NODE:
1741
+ addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
1742
+ return null;
1743
+ case TEXT_NODE:
1744
+ /**
1745
+ * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
1746
+ * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
1747
+ * If they are needed elsewhere, they must be escaped using either numeric character references or the strings
1748
+ * `&amp;` and `&lt;` respectively.
1749
+ * The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
1750
+ * be escaped using either `&gt;` or a character reference when it appears in the string `]]>` in content,
1751
+ * when that string is not marking the end of a CDATA section.
1752
+ *
1753
+ * In the content of elements, character data is any string of characters
1754
+ * which does not contain the start-delimiter of any markup
1755
+ * and does not include the CDATA-section-close delimiter, `]]>`.
1756
+ *
1757
+ * @see https://www.w3.org/TR/xml/#NT-CharData
1758
+ * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node
1759
+ */
1760
+ buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
1761
+ return null;
1762
+ case CDATA_SECTION_NODE:
1763
+ if (requireWellFormed && n.data.indexOf("]]>") !== -1) throw new DOMException(INVALID_STATE_ERR, "The CDATASection data contains \"]]>\"");
1764
+ buf.push("<![CDATA[", n.data.replace(/]]>/g, "]]]]><![CDATA[>"), "]]>");
1765
+ return null;
1766
+ case COMMENT_NODE:
1767
+ if (requireWellFormed && n.data.indexOf("-->") !== -1) throw new DOMException(INVALID_STATE_ERR, "The comment node data contains \"-->\"");
1768
+ buf.push("<!--", n.data, "-->");
1769
+ return null;
1770
+ case DOCUMENT_TYPE_NODE:
1771
+ if (requireWellFormed) {
1772
+ if (!tagNamePattern.test(n.name)) throw new DOMException(INVALID_STATE_ERR, "The doctype name \"" + n.name + "\" is not a valid XML Name");
1773
+ if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) throw new DOMException(INVALID_STATE_ERR, "DocumentType publicId is not a valid PubidLiteral");
1774
+ if (n.systemId && !/^("[^"]*"|'[^']*')$/.test(n.systemId)) throw new DOMException(INVALID_STATE_ERR, "DocumentType systemId is not a valid SystemLiteral");
1775
+ if (n.internalSubset && n.internalSubset.indexOf("]>") !== -1) throw new DOMException(INVALID_STATE_ERR, "DocumentType internalSubset contains \"]>\"");
1776
+ }
1777
+ var pubid = n.publicId;
1778
+ var sysid = n.systemId;
1779
+ buf.push("<!DOCTYPE ", n.name);
1780
+ if (pubid) {
1781
+ buf.push(" PUBLIC ", pubid);
1782
+ if (sysid && sysid != ".") buf.push(" ", sysid);
1783
+ buf.push(">");
1784
+ } else if (sysid && sysid != ".") buf.push(" SYSTEM ", sysid, ">");
1785
+ else {
1786
+ var sub = n.internalSubset;
1787
+ if (sub) buf.push(" [", sub, "]");
1788
+ buf.push(">");
1789
+ }
1790
+ return null;
1791
+ case PROCESSING_INSTRUCTION_NODE:
1792
+ if (requireWellFormed) {
1793
+ if (!tagNamePattern.test(n.target) || n.target.indexOf(":") !== -1 || n.target.toLowerCase() === "xml") throw new DOMException(INVALID_STATE_ERR, "The processing instruction target \"" + n.target + "\" is not a valid XML NCName or is reserved");
1794
+ if (n.data.indexOf("?>") !== -1) throw new DOMException(INVALID_STATE_ERR, "The ProcessingInstruction data contains \"?>\"");
1795
+ }
1796
+ buf.push("<?", n.target, " ", n.data, "?>");
1797
+ return null;
1798
+ case ENTITY_REFERENCE_NODE:
1799
+ if (requireWellFormed && !tagNamePattern.test(n.nodeName)) throw new DOMException(INVALID_STATE_ERR, "The entity reference name \"" + n.nodeName + "\" is not a valid XML Name");
1800
+ buf.push("&", n.nodeName, ";");
1801
+ return null;
1802
+ default:
1803
+ buf.push("??", n.nodeName);
1804
+ return null;
1805
+ }
1806
+ },
1807
+ exit: function(n, childCtx) {
1808
+ if (childCtx && childCtx.tag) buf.push("</", childCtx.tag, ">");
1809
+ }
1810
+ });
1811
+ }
1812
+ /**
1813
+ * Imports a node from a different document into `doc`, creating a new copy.
1814
+ * Delegates to {@link walkDOM} for traversal. Each node in the subtree is shallow-cloned,
1815
+ * stamped with `doc` as its `ownerDocument`, and detached (`parentNode` set to `null`).
1816
+ * Children are imported recursively when `deep` is `true`; for {@link Attr} nodes `deep` is
1817
+ * always forced to `true`
1818
+ * because an attribute's value lives in a child text node.
1819
+ *
1820
+ * @param {Document} doc
1821
+ * The document that will own the imported node.
1822
+ * @param {Node} node
1823
+ * The node to import.
1824
+ * @param {boolean} deep
1825
+ * If `true`, descendants are imported recursively.
1826
+ * @returns {Node}
1827
+ * The newly imported node, now owned by `doc`.
1828
+ */
1829
+ function importNode(doc, node, deep) {
1830
+ var destRoot;
1831
+ walkDOM(node, null, { enter: function(srcNode, destParent) {
1832
+ var destNode = srcNode.cloneNode(false);
1833
+ destNode.ownerDocument = doc;
1834
+ destNode.parentNode = null;
1835
+ if (destParent === null) destRoot = destNode;
1836
+ else destParent.appendChild(destNode);
1837
+ return srcNode.nodeType === ATTRIBUTE_NODE || deep ? destNode : null;
1838
+ } });
1839
+ return destRoot;
1840
+ }
1841
+ function cloneNode(doc, node, deep) {
1842
+ var destRoot;
1843
+ walkDOM(node, null, { enter: function(srcNode, destParent) {
1844
+ var destNode = new srcNode.constructor();
1845
+ for (var n in srcNode) if (Object.prototype.hasOwnProperty.call(srcNode, n)) {
1846
+ var v = srcNode[n];
1847
+ if (typeof v != "object") {
1848
+ if (v != destNode[n]) destNode[n] = v;
1849
+ }
1850
+ }
1851
+ if (srcNode.childNodes) destNode.childNodes = new NodeList();
1852
+ destNode.ownerDocument = doc;
1853
+ var shouldDeep = deep;
1854
+ switch (destNode.nodeType) {
1855
+ case ELEMENT_NODE:
1856
+ var attrs = srcNode.attributes;
1857
+ var attrs2 = destNode.attributes = new NamedNodeMap();
1858
+ var len = attrs.length;
1859
+ attrs2._ownerElement = destNode;
1860
+ for (var i = 0; i < len; i++) destNode.setAttributeNode(cloneNode(doc, attrs.item(i), true));
1861
+ break;
1862
+ case ATTRIBUTE_NODE: shouldDeep = true;
1863
+ }
1864
+ if (destParent !== null) destParent.appendChild(destNode);
1865
+ else destRoot = destNode;
1866
+ return shouldDeep ? destNode : null;
1867
+ } });
1868
+ return destRoot;
1869
+ }
1870
+ function __set__(object, key, value) {
1871
+ object[key] = value;
1872
+ }
1873
+ try {
1874
+ if (Object.defineProperty) {
1875
+ Object.defineProperty(LiveNodeList.prototype, "length", { get: function() {
1876
+ _updateLiveList(this);
1877
+ return this.$$length;
1878
+ } });
1879
+ /**
1880
+ * The text content of this node and its descendants.
1881
+ *
1882
+ * Setting `textContent` on an element or document fragment replaces all child nodes with a
1883
+ * single text node; on other nodes it sets `data`, `value`, and `nodeValue` directly.
1884
+ *
1885
+ * @type {string | null}
1886
+ * @see {@link https://dom.spec.whatwg.org/#dom-node-textcontent}
1887
+ */
1888
+ Object.defineProperty(Node.prototype, "textContent", {
1889
+ get: function() {
1890
+ if (this.nodeType === ELEMENT_NODE || this.nodeType === DOCUMENT_FRAGMENT_NODE) {
1891
+ var buf = [];
1892
+ walkDOM(this, null, { enter: function(n) {
1893
+ if (n.nodeType === ELEMENT_NODE || n.nodeType === DOCUMENT_FRAGMENT_NODE) return true;
1894
+ if (n.nodeType === PROCESSING_INSTRUCTION_NODE || n.nodeType === COMMENT_NODE) return null;
1895
+ buf.push(n.nodeValue);
1896
+ } });
1897
+ return buf.join("");
1898
+ }
1899
+ return this.nodeValue;
1900
+ },
1901
+ set: function(data) {
1902
+ switch (this.nodeType) {
1903
+ case ELEMENT_NODE:
1904
+ case DOCUMENT_FRAGMENT_NODE:
1905
+ while (this.firstChild) this.removeChild(this.firstChild);
1906
+ if (data || String(data)) this.appendChild(this.ownerDocument.createTextNode(data));
1907
+ break;
1908
+ default:
1909
+ this.data = data;
1910
+ this.value = data;
1911
+ this.nodeValue = data;
1912
+ }
1913
+ }
1914
+ });
1915
+ __set__ = function(object, key, value) {
1916
+ object["$$" + key] = value;
1917
+ };
1918
+ }
1919
+ } catch (e) {}
1920
+ exports.DocumentType = DocumentType;
1921
+ exports.DOMException = DOMException;
1922
+ exports.DOMImplementation = DOMImplementation;
1923
+ exports.Element = Element;
1924
+ exports.Node = Node;
1925
+ exports.NodeList = NodeList;
1926
+ exports.walkDOM = walkDOM;
1927
+ exports.XMLSerializer = XMLSerializer;
1928
+ }));
1929
+ //#endregion
1930
+ //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/entities.js
1931
+ var require_entities = /* @__PURE__ */ __commonJSMin(((exports) => {
1932
+ var freeze = require_conventions().freeze;
1933
+ /**
1934
+ * The entities that are predefined in every XML document.
1935
+ *
1936
+ * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
1937
+ * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
1938
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
1939
+ */
1940
+ exports.XML_ENTITIES = freeze({
1941
+ amp: "&",
1942
+ apos: "'",
1943
+ gt: ">",
1944
+ lt: "<",
1945
+ quot: "\""
1946
+ });
1947
+ /**
1948
+ * A map of all entities that are detected in an HTML document.
1949
+ * They contain all entries from `XML_ENTITIES`.
1950
+ *
1951
+ * @see XML_ENTITIES
1952
+ * @see DOMParser.parseFromString
1953
+ * @see DOMImplementation.prototype.createHTMLDocument
1954
+ * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
1955
+ * @see https://html.spec.whatwg.org/entities.json JSON
1956
+ * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
1957
+ * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
1958
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
1959
+ * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
1960
+ */
1961
+ exports.HTML_ENTITIES = freeze({
1962
+ Aacute: "Á",
1963
+ aacute: "á",
1964
+ Abreve: "Ă",
1965
+ abreve: "ă",
1966
+ ac: "∾",
1967
+ acd: "∿",
1968
+ acE: "∾̳",
1969
+ Acirc: "Â",
1970
+ acirc: "â",
1971
+ acute: "´",
1972
+ Acy: "А",
1973
+ acy: "а",
1974
+ AElig: "Æ",
1975
+ aelig: "æ",
1976
+ af: "⁡",
1977
+ Afr: "𝔄",
1978
+ afr: "𝔞",
1979
+ Agrave: "À",
1980
+ agrave: "à",
1981
+ alefsym: "ℵ",
1982
+ aleph: "ℵ",
1983
+ Alpha: "Α",
1984
+ alpha: "α",
1985
+ Amacr: "Ā",
1986
+ amacr: "ā",
1987
+ amalg: "⨿",
1988
+ AMP: "&",
1989
+ amp: "&",
1990
+ And: "⩓",
1991
+ and: "∧",
1992
+ andand: "⩕",
1993
+ andd: "⩜",
1994
+ andslope: "⩘",
1995
+ andv: "⩚",
1996
+ ang: "∠",
1997
+ ange: "⦤",
1998
+ angle: "∠",
1999
+ angmsd: "∡",
2000
+ angmsdaa: "⦨",
2001
+ angmsdab: "⦩",
2002
+ angmsdac: "⦪",
2003
+ angmsdad: "⦫",
2004
+ angmsdae: "⦬",
2005
+ angmsdaf: "⦭",
2006
+ angmsdag: "⦮",
2007
+ angmsdah: "⦯",
2008
+ angrt: "∟",
2009
+ angrtvb: "⊾",
2010
+ angrtvbd: "⦝",
2011
+ angsph: "∢",
2012
+ angst: "Å",
2013
+ angzarr: "⍼",
2014
+ Aogon: "Ą",
2015
+ aogon: "ą",
2016
+ Aopf: "𝔸",
2017
+ aopf: "𝕒",
2018
+ ap: "≈",
2019
+ apacir: "⩯",
2020
+ apE: "⩰",
2021
+ ape: "≊",
2022
+ apid: "≋",
2023
+ apos: "'",
2024
+ ApplyFunction: "⁡",
2025
+ approx: "≈",
2026
+ approxeq: "≊",
2027
+ Aring: "Å",
2028
+ aring: "å",
2029
+ Ascr: "𝒜",
2030
+ ascr: "𝒶",
2031
+ Assign: "≔",
2032
+ ast: "*",
2033
+ asymp: "≈",
2034
+ asympeq: "≍",
2035
+ Atilde: "Ã",
2036
+ atilde: "ã",
2037
+ Auml: "Ä",
2038
+ auml: "ä",
2039
+ awconint: "∳",
2040
+ awint: "⨑",
2041
+ backcong: "≌",
2042
+ backepsilon: "϶",
2043
+ backprime: "‵",
2044
+ backsim: "∽",
2045
+ backsimeq: "⋍",
2046
+ Backslash: "∖",
2047
+ Barv: "⫧",
2048
+ barvee: "⊽",
2049
+ Barwed: "⌆",
2050
+ barwed: "⌅",
2051
+ barwedge: "⌅",
2052
+ bbrk: "⎵",
2053
+ bbrktbrk: "⎶",
2054
+ bcong: "≌",
2055
+ Bcy: "Б",
2056
+ bcy: "б",
2057
+ bdquo: "„",
2058
+ becaus: "∵",
2059
+ Because: "∵",
2060
+ because: "∵",
2061
+ bemptyv: "⦰",
2062
+ bepsi: "϶",
2063
+ bernou: "ℬ",
2064
+ Bernoullis: "ℬ",
2065
+ Beta: "Β",
2066
+ beta: "β",
2067
+ beth: "ℶ",
2068
+ between: "≬",
2069
+ Bfr: "𝔅",
2070
+ bfr: "𝔟",
2071
+ bigcap: "⋂",
2072
+ bigcirc: "◯",
2073
+ bigcup: "⋃",
2074
+ bigodot: "⨀",
2075
+ bigoplus: "⨁",
2076
+ bigotimes: "⨂",
2077
+ bigsqcup: "⨆",
2078
+ bigstar: "★",
2079
+ bigtriangledown: "▽",
2080
+ bigtriangleup: "△",
2081
+ biguplus: "⨄",
2082
+ bigvee: "⋁",
2083
+ bigwedge: "⋀",
2084
+ bkarow: "⤍",
2085
+ blacklozenge: "⧫",
2086
+ blacksquare: "▪",
2087
+ blacktriangle: "▴",
2088
+ blacktriangledown: "▾",
2089
+ blacktriangleleft: "◂",
2090
+ blacktriangleright: "▸",
2091
+ blank: "␣",
2092
+ blk12: "▒",
2093
+ blk14: "░",
2094
+ blk34: "▓",
2095
+ block: "█",
2096
+ bne: "=⃥",
2097
+ bnequiv: "≡⃥",
2098
+ bNot: "⫭",
2099
+ bnot: "⌐",
2100
+ Bopf: "𝔹",
2101
+ bopf: "𝕓",
2102
+ bot: "⊥",
2103
+ bottom: "⊥",
2104
+ bowtie: "⋈",
2105
+ boxbox: "⧉",
2106
+ boxDL: "╗",
2107
+ boxDl: "╖",
2108
+ boxdL: "╕",
2109
+ boxdl: "┐",
2110
+ boxDR: "╔",
2111
+ boxDr: "╓",
2112
+ boxdR: "╒",
2113
+ boxdr: "┌",
2114
+ boxH: "═",
2115
+ boxh: "─",
2116
+ boxHD: "╦",
2117
+ boxHd: "╤",
2118
+ boxhD: "╥",
2119
+ boxhd: "┬",
2120
+ boxHU: "╩",
2121
+ boxHu: "╧",
2122
+ boxhU: "╨",
2123
+ boxhu: "┴",
2124
+ boxminus: "⊟",
2125
+ boxplus: "⊞",
2126
+ boxtimes: "⊠",
2127
+ boxUL: "╝",
2128
+ boxUl: "╜",
2129
+ boxuL: "╛",
2130
+ boxul: "┘",
2131
+ boxUR: "╚",
2132
+ boxUr: "╙",
2133
+ boxuR: "╘",
2134
+ boxur: "└",
2135
+ boxV: "║",
2136
+ boxv: "│",
2137
+ boxVH: "╬",
2138
+ boxVh: "╫",
2139
+ boxvH: "╪",
2140
+ boxvh: "┼",
2141
+ boxVL: "╣",
2142
+ boxVl: "╢",
2143
+ boxvL: "╡",
2144
+ boxvl: "┤",
2145
+ boxVR: "╠",
2146
+ boxVr: "╟",
2147
+ boxvR: "╞",
2148
+ boxvr: "├",
2149
+ bprime: "‵",
2150
+ Breve: "˘",
2151
+ breve: "˘",
2152
+ brvbar: "¦",
2153
+ Bscr: "ℬ",
2154
+ bscr: "𝒷",
2155
+ bsemi: "⁏",
2156
+ bsim: "∽",
2157
+ bsime: "⋍",
2158
+ bsol: "\\",
2159
+ bsolb: "⧅",
2160
+ bsolhsub: "⟈",
2161
+ bull: "•",
2162
+ bullet: "•",
2163
+ bump: "≎",
2164
+ bumpE: "⪮",
2165
+ bumpe: "≏",
2166
+ Bumpeq: "≎",
2167
+ bumpeq: "≏",
2168
+ Cacute: "Ć",
2169
+ cacute: "ć",
2170
+ Cap: "⋒",
2171
+ cap: "∩",
2172
+ capand: "⩄",
2173
+ capbrcup: "⩉",
2174
+ capcap: "⩋",
2175
+ capcup: "⩇",
2176
+ capdot: "⩀",
2177
+ CapitalDifferentialD: "ⅅ",
2178
+ caps: "∩︀",
2179
+ caret: "⁁",
2180
+ caron: "ˇ",
2181
+ Cayleys: "ℭ",
2182
+ ccaps: "⩍",
2183
+ Ccaron: "Č",
2184
+ ccaron: "č",
2185
+ Ccedil: "Ç",
2186
+ ccedil: "ç",
2187
+ Ccirc: "Ĉ",
2188
+ ccirc: "ĉ",
2189
+ Cconint: "∰",
2190
+ ccups: "⩌",
2191
+ ccupssm: "⩐",
2192
+ Cdot: "Ċ",
2193
+ cdot: "ċ",
2194
+ cedil: "¸",
2195
+ Cedilla: "¸",
2196
+ cemptyv: "⦲",
2197
+ cent: "¢",
2198
+ CenterDot: "·",
2199
+ centerdot: "·",
2200
+ Cfr: "ℭ",
2201
+ cfr: "𝔠",
2202
+ CHcy: "Ч",
2203
+ chcy: "ч",
2204
+ check: "✓",
2205
+ checkmark: "✓",
2206
+ Chi: "Χ",
2207
+ chi: "χ",
2208
+ cir: "○",
2209
+ circ: "ˆ",
2210
+ circeq: "≗",
2211
+ circlearrowleft: "↺",
2212
+ circlearrowright: "↻",
2213
+ circledast: "⊛",
2214
+ circledcirc: "⊚",
2215
+ circleddash: "⊝",
2216
+ CircleDot: "⊙",
2217
+ circledR: "®",
2218
+ circledS: "Ⓢ",
2219
+ CircleMinus: "⊖",
2220
+ CirclePlus: "⊕",
2221
+ CircleTimes: "⊗",
2222
+ cirE: "⧃",
2223
+ cire: "≗",
2224
+ cirfnint: "⨐",
2225
+ cirmid: "⫯",
2226
+ cirscir: "⧂",
2227
+ ClockwiseContourIntegral: "∲",
2228
+ CloseCurlyDoubleQuote: "”",
2229
+ CloseCurlyQuote: "’",
2230
+ clubs: "♣",
2231
+ clubsuit: "♣",
2232
+ Colon: "∷",
2233
+ colon: ":",
2234
+ Colone: "⩴",
2235
+ colone: "≔",
2236
+ coloneq: "≔",
2237
+ comma: ",",
2238
+ commat: "@",
2239
+ comp: "∁",
2240
+ compfn: "∘",
2241
+ complement: "∁",
2242
+ complexes: "ℂ",
2243
+ cong: "≅",
2244
+ congdot: "⩭",
2245
+ Congruent: "≡",
2246
+ Conint: "∯",
2247
+ conint: "∮",
2248
+ ContourIntegral: "∮",
2249
+ Copf: "ℂ",
2250
+ copf: "𝕔",
2251
+ coprod: "∐",
2252
+ Coproduct: "∐",
2253
+ COPY: "©",
2254
+ copy: "©",
2255
+ copysr: "℗",
2256
+ CounterClockwiseContourIntegral: "∳",
2257
+ crarr: "↵",
2258
+ Cross: "⨯",
2259
+ cross: "✗",
2260
+ Cscr: "𝒞",
2261
+ cscr: "𝒸",
2262
+ csub: "⫏",
2263
+ csube: "⫑",
2264
+ csup: "⫐",
2265
+ csupe: "⫒",
2266
+ ctdot: "⋯",
2267
+ cudarrl: "⤸",
2268
+ cudarrr: "⤵",
2269
+ cuepr: "⋞",
2270
+ cuesc: "⋟",
2271
+ cularr: "↶",
2272
+ cularrp: "⤽",
2273
+ Cup: "⋓",
2274
+ cup: "∪",
2275
+ cupbrcap: "⩈",
2276
+ CupCap: "≍",
2277
+ cupcap: "⩆",
2278
+ cupcup: "⩊",
2279
+ cupdot: "⊍",
2280
+ cupor: "⩅",
2281
+ cups: "∪︀",
2282
+ curarr: "↷",
2283
+ curarrm: "⤼",
2284
+ curlyeqprec: "⋞",
2285
+ curlyeqsucc: "⋟",
2286
+ curlyvee: "⋎",
2287
+ curlywedge: "⋏",
2288
+ curren: "¤",
2289
+ curvearrowleft: "↶",
2290
+ curvearrowright: "↷",
2291
+ cuvee: "⋎",
2292
+ cuwed: "⋏",
2293
+ cwconint: "∲",
2294
+ cwint: "∱",
2295
+ cylcty: "⌭",
2296
+ Dagger: "‡",
2297
+ dagger: "†",
2298
+ daleth: "ℸ",
2299
+ Darr: "↡",
2300
+ dArr: "⇓",
2301
+ darr: "↓",
2302
+ dash: "‐",
2303
+ Dashv: "⫤",
2304
+ dashv: "⊣",
2305
+ dbkarow: "⤏",
2306
+ dblac: "˝",
2307
+ Dcaron: "Ď",
2308
+ dcaron: "ď",
2309
+ Dcy: "Д",
2310
+ dcy: "д",
2311
+ DD: "ⅅ",
2312
+ dd: "ⅆ",
2313
+ ddagger: "‡",
2314
+ ddarr: "⇊",
2315
+ DDotrahd: "⤑",
2316
+ ddotseq: "⩷",
2317
+ deg: "°",
2318
+ Del: "∇",
2319
+ Delta: "Δ",
2320
+ delta: "δ",
2321
+ demptyv: "⦱",
2322
+ dfisht: "⥿",
2323
+ Dfr: "𝔇",
2324
+ dfr: "𝔡",
2325
+ dHar: "⥥",
2326
+ dharl: "⇃",
2327
+ dharr: "⇂",
2328
+ DiacriticalAcute: "´",
2329
+ DiacriticalDot: "˙",
2330
+ DiacriticalDoubleAcute: "˝",
2331
+ DiacriticalGrave: "`",
2332
+ DiacriticalTilde: "˜",
2333
+ diam: "⋄",
2334
+ Diamond: "⋄",
2335
+ diamond: "⋄",
2336
+ diamondsuit: "♦",
2337
+ diams: "♦",
2338
+ die: "¨",
2339
+ DifferentialD: "ⅆ",
2340
+ digamma: "ϝ",
2341
+ disin: "⋲",
2342
+ div: "÷",
2343
+ divide: "÷",
2344
+ divideontimes: "⋇",
2345
+ divonx: "⋇",
2346
+ DJcy: "Ђ",
2347
+ djcy: "ђ",
2348
+ dlcorn: "⌞",
2349
+ dlcrop: "⌍",
2350
+ dollar: "$",
2351
+ Dopf: "𝔻",
2352
+ dopf: "𝕕",
2353
+ Dot: "¨",
2354
+ dot: "˙",
2355
+ DotDot: "⃜",
2356
+ doteq: "≐",
2357
+ doteqdot: "≑",
2358
+ DotEqual: "≐",
2359
+ dotminus: "∸",
2360
+ dotplus: "∔",
2361
+ dotsquare: "⊡",
2362
+ doublebarwedge: "⌆",
2363
+ DoubleContourIntegral: "∯",
2364
+ DoubleDot: "¨",
2365
+ DoubleDownArrow: "⇓",
2366
+ DoubleLeftArrow: "⇐",
2367
+ DoubleLeftRightArrow: "⇔",
2368
+ DoubleLeftTee: "⫤",
2369
+ DoubleLongLeftArrow: "⟸",
2370
+ DoubleLongLeftRightArrow: "⟺",
2371
+ DoubleLongRightArrow: "⟹",
2372
+ DoubleRightArrow: "⇒",
2373
+ DoubleRightTee: "⊨",
2374
+ DoubleUpArrow: "⇑",
2375
+ DoubleUpDownArrow: "⇕",
2376
+ DoubleVerticalBar: "∥",
2377
+ DownArrow: "↓",
2378
+ Downarrow: "⇓",
2379
+ downarrow: "↓",
2380
+ DownArrowBar: "⤓",
2381
+ DownArrowUpArrow: "⇵",
2382
+ DownBreve: "̑",
2383
+ downdownarrows: "⇊",
2384
+ downharpoonleft: "⇃",
2385
+ downharpoonright: "⇂",
2386
+ DownLeftRightVector: "⥐",
2387
+ DownLeftTeeVector: "⥞",
2388
+ DownLeftVector: "↽",
2389
+ DownLeftVectorBar: "⥖",
2390
+ DownRightTeeVector: "⥟",
2391
+ DownRightVector: "⇁",
2392
+ DownRightVectorBar: "⥗",
2393
+ DownTee: "⊤",
2394
+ DownTeeArrow: "↧",
2395
+ drbkarow: "⤐",
2396
+ drcorn: "⌟",
2397
+ drcrop: "⌌",
2398
+ Dscr: "𝒟",
2399
+ dscr: "𝒹",
2400
+ DScy: "Ѕ",
2401
+ dscy: "ѕ",
2402
+ dsol: "⧶",
2403
+ Dstrok: "Đ",
2404
+ dstrok: "đ",
2405
+ dtdot: "⋱",
2406
+ dtri: "▿",
2407
+ dtrif: "▾",
2408
+ duarr: "⇵",
2409
+ duhar: "⥯",
2410
+ dwangle: "⦦",
2411
+ DZcy: "Џ",
2412
+ dzcy: "џ",
2413
+ dzigrarr: "⟿",
2414
+ Eacute: "É",
2415
+ eacute: "é",
2416
+ easter: "⩮",
2417
+ Ecaron: "Ě",
2418
+ ecaron: "ě",
2419
+ ecir: "≖",
2420
+ Ecirc: "Ê",
2421
+ ecirc: "ê",
2422
+ ecolon: "≕",
2423
+ Ecy: "Э",
2424
+ ecy: "э",
2425
+ eDDot: "⩷",
2426
+ Edot: "Ė",
2427
+ eDot: "≑",
2428
+ edot: "ė",
2429
+ ee: "ⅇ",
2430
+ efDot: "≒",
2431
+ Efr: "𝔈",
2432
+ efr: "𝔢",
2433
+ eg: "⪚",
2434
+ Egrave: "È",
2435
+ egrave: "è",
2436
+ egs: "⪖",
2437
+ egsdot: "⪘",
2438
+ el: "⪙",
2439
+ Element: "∈",
2440
+ elinters: "⏧",
2441
+ ell: "ℓ",
2442
+ els: "⪕",
2443
+ elsdot: "⪗",
2444
+ Emacr: "Ē",
2445
+ emacr: "ē",
2446
+ empty: "∅",
2447
+ emptyset: "∅",
2448
+ EmptySmallSquare: "◻",
2449
+ emptyv: "∅",
2450
+ EmptyVerySmallSquare: "▫",
2451
+ emsp: " ",
2452
+ emsp13: " ",
2453
+ emsp14: " ",
2454
+ ENG: "Ŋ",
2455
+ eng: "ŋ",
2456
+ ensp: " ",
2457
+ Eogon: "Ę",
2458
+ eogon: "ę",
2459
+ Eopf: "𝔼",
2460
+ eopf: "𝕖",
2461
+ epar: "⋕",
2462
+ eparsl: "⧣",
2463
+ eplus: "⩱",
2464
+ epsi: "ε",
2465
+ Epsilon: "Ε",
2466
+ epsilon: "ε",
2467
+ epsiv: "ϵ",
2468
+ eqcirc: "≖",
2469
+ eqcolon: "≕",
2470
+ eqsim: "≂",
2471
+ eqslantgtr: "⪖",
2472
+ eqslantless: "⪕",
2473
+ Equal: "⩵",
2474
+ equals: "=",
2475
+ EqualTilde: "≂",
2476
+ equest: "≟",
2477
+ Equilibrium: "⇌",
2478
+ equiv: "≡",
2479
+ equivDD: "⩸",
2480
+ eqvparsl: "⧥",
2481
+ erarr: "⥱",
2482
+ erDot: "≓",
2483
+ Escr: "ℰ",
2484
+ escr: "ℯ",
2485
+ esdot: "≐",
2486
+ Esim: "⩳",
2487
+ esim: "≂",
2488
+ Eta: "Η",
2489
+ eta: "η",
2490
+ ETH: "Ð",
2491
+ eth: "ð",
2492
+ Euml: "Ë",
2493
+ euml: "ë",
2494
+ euro: "€",
2495
+ excl: "!",
2496
+ exist: "∃",
2497
+ Exists: "∃",
2498
+ expectation: "ℰ",
2499
+ ExponentialE: "ⅇ",
2500
+ exponentiale: "ⅇ",
2501
+ fallingdotseq: "≒",
2502
+ Fcy: "Ф",
2503
+ fcy: "ф",
2504
+ female: "♀",
2505
+ ffilig: "ffi",
2506
+ fflig: "ff",
2507
+ ffllig: "ffl",
2508
+ Ffr: "𝔉",
2509
+ ffr: "𝔣",
2510
+ filig: "fi",
2511
+ FilledSmallSquare: "◼",
2512
+ FilledVerySmallSquare: "▪",
2513
+ fjlig: "fj",
2514
+ flat: "♭",
2515
+ fllig: "fl",
2516
+ fltns: "▱",
2517
+ fnof: "ƒ",
2518
+ Fopf: "𝔽",
2519
+ fopf: "𝕗",
2520
+ ForAll: "∀",
2521
+ forall: "∀",
2522
+ fork: "⋔",
2523
+ forkv: "⫙",
2524
+ Fouriertrf: "ℱ",
2525
+ fpartint: "⨍",
2526
+ frac12: "½",
2527
+ frac13: "⅓",
2528
+ frac14: "¼",
2529
+ frac15: "⅕",
2530
+ frac16: "⅙",
2531
+ frac18: "⅛",
2532
+ frac23: "⅔",
2533
+ frac25: "⅖",
2534
+ frac34: "¾",
2535
+ frac35: "⅗",
2536
+ frac38: "⅜",
2537
+ frac45: "⅘",
2538
+ frac56: "⅚",
2539
+ frac58: "⅝",
2540
+ frac78: "⅞",
2541
+ frasl: "⁄",
2542
+ frown: "⌢",
2543
+ Fscr: "ℱ",
2544
+ fscr: "𝒻",
2545
+ gacute: "ǵ",
2546
+ Gamma: "Γ",
2547
+ gamma: "γ",
2548
+ Gammad: "Ϝ",
2549
+ gammad: "ϝ",
2550
+ gap: "⪆",
2551
+ Gbreve: "Ğ",
2552
+ gbreve: "ğ",
2553
+ Gcedil: "Ģ",
2554
+ Gcirc: "Ĝ",
2555
+ gcirc: "ĝ",
2556
+ Gcy: "Г",
2557
+ gcy: "г",
2558
+ Gdot: "Ġ",
2559
+ gdot: "ġ",
2560
+ gE: "≧",
2561
+ ge: "≥",
2562
+ gEl: "⪌",
2563
+ gel: "⋛",
2564
+ geq: "≥",
2565
+ geqq: "≧",
2566
+ geqslant: "⩾",
2567
+ ges: "⩾",
2568
+ gescc: "⪩",
2569
+ gesdot: "⪀",
2570
+ gesdoto: "⪂",
2571
+ gesdotol: "⪄",
2572
+ gesl: "⋛︀",
2573
+ gesles: "⪔",
2574
+ Gfr: "𝔊",
2575
+ gfr: "𝔤",
2576
+ Gg: "⋙",
2577
+ gg: "≫",
2578
+ ggg: "⋙",
2579
+ gimel: "ℷ",
2580
+ GJcy: "Ѓ",
2581
+ gjcy: "ѓ",
2582
+ gl: "≷",
2583
+ gla: "⪥",
2584
+ glE: "⪒",
2585
+ glj: "⪤",
2586
+ gnap: "⪊",
2587
+ gnapprox: "⪊",
2588
+ gnE: "≩",
2589
+ gne: "⪈",
2590
+ gneq: "⪈",
2591
+ gneqq: "≩",
2592
+ gnsim: "⋧",
2593
+ Gopf: "𝔾",
2594
+ gopf: "𝕘",
2595
+ grave: "`",
2596
+ GreaterEqual: "≥",
2597
+ GreaterEqualLess: "⋛",
2598
+ GreaterFullEqual: "≧",
2599
+ GreaterGreater: "⪢",
2600
+ GreaterLess: "≷",
2601
+ GreaterSlantEqual: "⩾",
2602
+ GreaterTilde: "≳",
2603
+ Gscr: "𝒢",
2604
+ gscr: "ℊ",
2605
+ gsim: "≳",
2606
+ gsime: "⪎",
2607
+ gsiml: "⪐",
2608
+ Gt: "≫",
2609
+ GT: ">",
2610
+ gt: ">",
2611
+ gtcc: "⪧",
2612
+ gtcir: "⩺",
2613
+ gtdot: "⋗",
2614
+ gtlPar: "⦕",
2615
+ gtquest: "⩼",
2616
+ gtrapprox: "⪆",
2617
+ gtrarr: "⥸",
2618
+ gtrdot: "⋗",
2619
+ gtreqless: "⋛",
2620
+ gtreqqless: "⪌",
2621
+ gtrless: "≷",
2622
+ gtrsim: "≳",
2623
+ gvertneqq: "≩︀",
2624
+ gvnE: "≩︀",
2625
+ Hacek: "ˇ",
2626
+ hairsp: " ",
2627
+ half: "½",
2628
+ hamilt: "ℋ",
2629
+ HARDcy: "Ъ",
2630
+ hardcy: "ъ",
2631
+ hArr: "⇔",
2632
+ harr: "↔",
2633
+ harrcir: "⥈",
2634
+ harrw: "↭",
2635
+ Hat: "^",
2636
+ hbar: "ℏ",
2637
+ Hcirc: "Ĥ",
2638
+ hcirc: "ĥ",
2639
+ hearts: "♥",
2640
+ heartsuit: "♥",
2641
+ hellip: "…",
2642
+ hercon: "⊹",
2643
+ Hfr: "ℌ",
2644
+ hfr: "𝔥",
2645
+ HilbertSpace: "ℋ",
2646
+ hksearow: "⤥",
2647
+ hkswarow: "⤦",
2648
+ hoarr: "⇿",
2649
+ homtht: "∻",
2650
+ hookleftarrow: "↩",
2651
+ hookrightarrow: "↪",
2652
+ Hopf: "ℍ",
2653
+ hopf: "𝕙",
2654
+ horbar: "―",
2655
+ HorizontalLine: "─",
2656
+ Hscr: "ℋ",
2657
+ hscr: "𝒽",
2658
+ hslash: "ℏ",
2659
+ Hstrok: "Ħ",
2660
+ hstrok: "ħ",
2661
+ HumpDownHump: "≎",
2662
+ HumpEqual: "≏",
2663
+ hybull: "⁃",
2664
+ hyphen: "‐",
2665
+ Iacute: "Í",
2666
+ iacute: "í",
2667
+ ic: "⁣",
2668
+ Icirc: "Î",
2669
+ icirc: "î",
2670
+ Icy: "И",
2671
+ icy: "и",
2672
+ Idot: "İ",
2673
+ IEcy: "Е",
2674
+ iecy: "е",
2675
+ iexcl: "¡",
2676
+ iff: "⇔",
2677
+ Ifr: "ℑ",
2678
+ ifr: "𝔦",
2679
+ Igrave: "Ì",
2680
+ igrave: "ì",
2681
+ ii: "ⅈ",
2682
+ iiiint: "⨌",
2683
+ iiint: "∭",
2684
+ iinfin: "⧜",
2685
+ iiota: "℩",
2686
+ IJlig: "IJ",
2687
+ ijlig: "ij",
2688
+ Im: "ℑ",
2689
+ Imacr: "Ī",
2690
+ imacr: "ī",
2691
+ image: "ℑ",
2692
+ ImaginaryI: "ⅈ",
2693
+ imagline: "ℐ",
2694
+ imagpart: "ℑ",
2695
+ imath: "ı",
2696
+ imof: "⊷",
2697
+ imped: "Ƶ",
2698
+ Implies: "⇒",
2699
+ in: "∈",
2700
+ incare: "℅",
2701
+ infin: "∞",
2702
+ infintie: "⧝",
2703
+ inodot: "ı",
2704
+ Int: "∬",
2705
+ int: "∫",
2706
+ intcal: "⊺",
2707
+ integers: "ℤ",
2708
+ Integral: "∫",
2709
+ intercal: "⊺",
2710
+ Intersection: "⋂",
2711
+ intlarhk: "⨗",
2712
+ intprod: "⨼",
2713
+ InvisibleComma: "⁣",
2714
+ InvisibleTimes: "⁢",
2715
+ IOcy: "Ё",
2716
+ iocy: "ё",
2717
+ Iogon: "Į",
2718
+ iogon: "į",
2719
+ Iopf: "𝕀",
2720
+ iopf: "𝕚",
2721
+ Iota: "Ι",
2722
+ iota: "ι",
2723
+ iprod: "⨼",
2724
+ iquest: "¿",
2725
+ Iscr: "ℐ",
2726
+ iscr: "𝒾",
2727
+ isin: "∈",
2728
+ isindot: "⋵",
2729
+ isinE: "⋹",
2730
+ isins: "⋴",
2731
+ isinsv: "⋳",
2732
+ isinv: "∈",
2733
+ it: "⁢",
2734
+ Itilde: "Ĩ",
2735
+ itilde: "ĩ",
2736
+ Iukcy: "І",
2737
+ iukcy: "і",
2738
+ Iuml: "Ï",
2739
+ iuml: "ï",
2740
+ Jcirc: "Ĵ",
2741
+ jcirc: "ĵ",
2742
+ Jcy: "Й",
2743
+ jcy: "й",
2744
+ Jfr: "𝔍",
2745
+ jfr: "𝔧",
2746
+ jmath: "ȷ",
2747
+ Jopf: "𝕁",
2748
+ jopf: "𝕛",
2749
+ Jscr: "𝒥",
2750
+ jscr: "𝒿",
2751
+ Jsercy: "Ј",
2752
+ jsercy: "ј",
2753
+ Jukcy: "Є",
2754
+ jukcy: "є",
2755
+ Kappa: "Κ",
2756
+ kappa: "κ",
2757
+ kappav: "ϰ",
2758
+ Kcedil: "Ķ",
2759
+ kcedil: "ķ",
2760
+ Kcy: "К",
2761
+ kcy: "к",
2762
+ Kfr: "𝔎",
2763
+ kfr: "𝔨",
2764
+ kgreen: "ĸ",
2765
+ KHcy: "Х",
2766
+ khcy: "х",
2767
+ KJcy: "Ќ",
2768
+ kjcy: "ќ",
2769
+ Kopf: "𝕂",
2770
+ kopf: "𝕜",
2771
+ Kscr: "𝒦",
2772
+ kscr: "𝓀",
2773
+ lAarr: "⇚",
2774
+ Lacute: "Ĺ",
2775
+ lacute: "ĺ",
2776
+ laemptyv: "⦴",
2777
+ lagran: "ℒ",
2778
+ Lambda: "Λ",
2779
+ lambda: "λ",
2780
+ Lang: "⟪",
2781
+ lang: "⟨",
2782
+ langd: "⦑",
2783
+ langle: "⟨",
2784
+ lap: "⪅",
2785
+ Laplacetrf: "ℒ",
2786
+ laquo: "«",
2787
+ Larr: "↞",
2788
+ lArr: "⇐",
2789
+ larr: "←",
2790
+ larrb: "⇤",
2791
+ larrbfs: "⤟",
2792
+ larrfs: "⤝",
2793
+ larrhk: "↩",
2794
+ larrlp: "↫",
2795
+ larrpl: "⤹",
2796
+ larrsim: "⥳",
2797
+ larrtl: "↢",
2798
+ lat: "⪫",
2799
+ lAtail: "⤛",
2800
+ latail: "⤙",
2801
+ late: "⪭",
2802
+ lates: "⪭︀",
2803
+ lBarr: "⤎",
2804
+ lbarr: "⤌",
2805
+ lbbrk: "❲",
2806
+ lbrace: "{",
2807
+ lbrack: "[",
2808
+ lbrke: "⦋",
2809
+ lbrksld: "⦏",
2810
+ lbrkslu: "⦍",
2811
+ Lcaron: "Ľ",
2812
+ lcaron: "ľ",
2813
+ Lcedil: "Ļ",
2814
+ lcedil: "ļ",
2815
+ lceil: "⌈",
2816
+ lcub: "{",
2817
+ Lcy: "Л",
2818
+ lcy: "л",
2819
+ ldca: "⤶",
2820
+ ldquo: "“",
2821
+ ldquor: "„",
2822
+ ldrdhar: "⥧",
2823
+ ldrushar: "⥋",
2824
+ ldsh: "↲",
2825
+ lE: "≦",
2826
+ le: "≤",
2827
+ LeftAngleBracket: "⟨",
2828
+ LeftArrow: "←",
2829
+ Leftarrow: "⇐",
2830
+ leftarrow: "←",
2831
+ LeftArrowBar: "⇤",
2832
+ LeftArrowRightArrow: "⇆",
2833
+ leftarrowtail: "↢",
2834
+ LeftCeiling: "⌈",
2835
+ LeftDoubleBracket: "⟦",
2836
+ LeftDownTeeVector: "⥡",
2837
+ LeftDownVector: "⇃",
2838
+ LeftDownVectorBar: "⥙",
2839
+ LeftFloor: "⌊",
2840
+ leftharpoondown: "↽",
2841
+ leftharpoonup: "↼",
2842
+ leftleftarrows: "⇇",
2843
+ LeftRightArrow: "↔",
2844
+ Leftrightarrow: "⇔",
2845
+ leftrightarrow: "↔",
2846
+ leftrightarrows: "⇆",
2847
+ leftrightharpoons: "⇋",
2848
+ leftrightsquigarrow: "↭",
2849
+ LeftRightVector: "⥎",
2850
+ LeftTee: "⊣",
2851
+ LeftTeeArrow: "↤",
2852
+ LeftTeeVector: "⥚",
2853
+ leftthreetimes: "⋋",
2854
+ LeftTriangle: "⊲",
2855
+ LeftTriangleBar: "⧏",
2856
+ LeftTriangleEqual: "⊴",
2857
+ LeftUpDownVector: "⥑",
2858
+ LeftUpTeeVector: "⥠",
2859
+ LeftUpVector: "↿",
2860
+ LeftUpVectorBar: "⥘",
2861
+ LeftVector: "↼",
2862
+ LeftVectorBar: "⥒",
2863
+ lEg: "⪋",
2864
+ leg: "⋚",
2865
+ leq: "≤",
2866
+ leqq: "≦",
2867
+ leqslant: "⩽",
2868
+ les: "⩽",
2869
+ lescc: "⪨",
2870
+ lesdot: "⩿",
2871
+ lesdoto: "⪁",
2872
+ lesdotor: "⪃",
2873
+ lesg: "⋚︀",
2874
+ lesges: "⪓",
2875
+ lessapprox: "⪅",
2876
+ lessdot: "⋖",
2877
+ lesseqgtr: "⋚",
2878
+ lesseqqgtr: "⪋",
2879
+ LessEqualGreater: "⋚",
2880
+ LessFullEqual: "≦",
2881
+ LessGreater: "≶",
2882
+ lessgtr: "≶",
2883
+ LessLess: "⪡",
2884
+ lesssim: "≲",
2885
+ LessSlantEqual: "⩽",
2886
+ LessTilde: "≲",
2887
+ lfisht: "⥼",
2888
+ lfloor: "⌊",
2889
+ Lfr: "𝔏",
2890
+ lfr: "𝔩",
2891
+ lg: "≶",
2892
+ lgE: "⪑",
2893
+ lHar: "⥢",
2894
+ lhard: "↽",
2895
+ lharu: "↼",
2896
+ lharul: "⥪",
2897
+ lhblk: "▄",
2898
+ LJcy: "Љ",
2899
+ ljcy: "љ",
2900
+ Ll: "⋘",
2901
+ ll: "≪",
2902
+ llarr: "⇇",
2903
+ llcorner: "⌞",
2904
+ Lleftarrow: "⇚",
2905
+ llhard: "⥫",
2906
+ lltri: "◺",
2907
+ Lmidot: "Ŀ",
2908
+ lmidot: "ŀ",
2909
+ lmoust: "⎰",
2910
+ lmoustache: "⎰",
2911
+ lnap: "⪉",
2912
+ lnapprox: "⪉",
2913
+ lnE: "≨",
2914
+ lne: "⪇",
2915
+ lneq: "⪇",
2916
+ lneqq: "≨",
2917
+ lnsim: "⋦",
2918
+ loang: "⟬",
2919
+ loarr: "⇽",
2920
+ lobrk: "⟦",
2921
+ LongLeftArrow: "⟵",
2922
+ Longleftarrow: "⟸",
2923
+ longleftarrow: "⟵",
2924
+ LongLeftRightArrow: "⟷",
2925
+ Longleftrightarrow: "⟺",
2926
+ longleftrightarrow: "⟷",
2927
+ longmapsto: "⟼",
2928
+ LongRightArrow: "⟶",
2929
+ Longrightarrow: "⟹",
2930
+ longrightarrow: "⟶",
2931
+ looparrowleft: "↫",
2932
+ looparrowright: "↬",
2933
+ lopar: "⦅",
2934
+ Lopf: "𝕃",
2935
+ lopf: "𝕝",
2936
+ loplus: "⨭",
2937
+ lotimes: "⨴",
2938
+ lowast: "∗",
2939
+ lowbar: "_",
2940
+ LowerLeftArrow: "↙",
2941
+ LowerRightArrow: "↘",
2942
+ loz: "◊",
2943
+ lozenge: "◊",
2944
+ lozf: "⧫",
2945
+ lpar: "(",
2946
+ lparlt: "⦓",
2947
+ lrarr: "⇆",
2948
+ lrcorner: "⌟",
2949
+ lrhar: "⇋",
2950
+ lrhard: "⥭",
2951
+ lrm: "‎",
2952
+ lrtri: "⊿",
2953
+ lsaquo: "‹",
2954
+ Lscr: "ℒ",
2955
+ lscr: "𝓁",
2956
+ Lsh: "↰",
2957
+ lsh: "↰",
2958
+ lsim: "≲",
2959
+ lsime: "⪍",
2960
+ lsimg: "⪏",
2961
+ lsqb: "[",
2962
+ lsquo: "‘",
2963
+ lsquor: "‚",
2964
+ Lstrok: "Ł",
2965
+ lstrok: "ł",
2966
+ Lt: "≪",
2967
+ LT: "<",
2968
+ lt: "<",
2969
+ ltcc: "⪦",
2970
+ ltcir: "⩹",
2971
+ ltdot: "⋖",
2972
+ lthree: "⋋",
2973
+ ltimes: "⋉",
2974
+ ltlarr: "⥶",
2975
+ ltquest: "⩻",
2976
+ ltri: "◃",
2977
+ ltrie: "⊴",
2978
+ ltrif: "◂",
2979
+ ltrPar: "⦖",
2980
+ lurdshar: "⥊",
2981
+ luruhar: "⥦",
2982
+ lvertneqq: "≨︀",
2983
+ lvnE: "≨︀",
2984
+ macr: "¯",
2985
+ male: "♂",
2986
+ malt: "✠",
2987
+ maltese: "✠",
2988
+ Map: "⤅",
2989
+ map: "↦",
2990
+ mapsto: "↦",
2991
+ mapstodown: "↧",
2992
+ mapstoleft: "↤",
2993
+ mapstoup: "↥",
2994
+ marker: "▮",
2995
+ mcomma: "⨩",
2996
+ Mcy: "М",
2997
+ mcy: "м",
2998
+ mdash: "—",
2999
+ mDDot: "∺",
3000
+ measuredangle: "∡",
3001
+ MediumSpace: " ",
3002
+ Mellintrf: "ℳ",
3003
+ Mfr: "𝔐",
3004
+ mfr: "𝔪",
3005
+ mho: "℧",
3006
+ micro: "µ",
3007
+ mid: "∣",
3008
+ midast: "*",
3009
+ midcir: "⫰",
3010
+ middot: "·",
3011
+ minus: "−",
3012
+ minusb: "⊟",
3013
+ minusd: "∸",
3014
+ minusdu: "⨪",
3015
+ MinusPlus: "∓",
3016
+ mlcp: "⫛",
3017
+ mldr: "…",
3018
+ mnplus: "∓",
3019
+ models: "⊧",
3020
+ Mopf: "𝕄",
3021
+ mopf: "𝕞",
3022
+ mp: "∓",
3023
+ Mscr: "ℳ",
3024
+ mscr: "𝓂",
3025
+ mstpos: "∾",
3026
+ Mu: "Μ",
3027
+ mu: "μ",
3028
+ multimap: "⊸",
3029
+ mumap: "⊸",
3030
+ nabla: "∇",
3031
+ Nacute: "Ń",
3032
+ nacute: "ń",
3033
+ nang: "∠⃒",
3034
+ nap: "≉",
3035
+ napE: "⩰̸",
3036
+ napid: "≋̸",
3037
+ napos: "ʼn",
3038
+ napprox: "≉",
3039
+ natur: "♮",
3040
+ natural: "♮",
3041
+ naturals: "ℕ",
3042
+ nbsp: "\xA0",
3043
+ nbump: "≎̸",
3044
+ nbumpe: "≏̸",
3045
+ ncap: "⩃",
3046
+ Ncaron: "Ň",
3047
+ ncaron: "ň",
3048
+ Ncedil: "Ņ",
3049
+ ncedil: "ņ",
3050
+ ncong: "≇",
3051
+ ncongdot: "⩭̸",
3052
+ ncup: "⩂",
3053
+ Ncy: "Н",
3054
+ ncy: "н",
3055
+ ndash: "–",
3056
+ ne: "≠",
3057
+ nearhk: "⤤",
3058
+ neArr: "⇗",
3059
+ nearr: "↗",
3060
+ nearrow: "↗",
3061
+ nedot: "≐̸",
3062
+ NegativeMediumSpace: "​",
3063
+ NegativeThickSpace: "​",
3064
+ NegativeThinSpace: "​",
3065
+ NegativeVeryThinSpace: "​",
3066
+ nequiv: "≢",
3067
+ nesear: "⤨",
3068
+ nesim: "≂̸",
3069
+ NestedGreaterGreater: "≫",
3070
+ NestedLessLess: "≪",
3071
+ NewLine: "\n",
3072
+ nexist: "∄",
3073
+ nexists: "∄",
3074
+ Nfr: "𝔑",
3075
+ nfr: "𝔫",
3076
+ ngE: "≧̸",
3077
+ nge: "≱",
3078
+ ngeq: "≱",
3079
+ ngeqq: "≧̸",
3080
+ ngeqslant: "⩾̸",
3081
+ nges: "⩾̸",
3082
+ nGg: "⋙̸",
3083
+ ngsim: "≵",
3084
+ nGt: "≫⃒",
3085
+ ngt: "≯",
3086
+ ngtr: "≯",
3087
+ nGtv: "≫̸",
3088
+ nhArr: "⇎",
3089
+ nharr: "↮",
3090
+ nhpar: "⫲",
3091
+ ni: "∋",
3092
+ nis: "⋼",
3093
+ nisd: "⋺",
3094
+ niv: "∋",
3095
+ NJcy: "Њ",
3096
+ njcy: "њ",
3097
+ nlArr: "⇍",
3098
+ nlarr: "↚",
3099
+ nldr: "‥",
3100
+ nlE: "≦̸",
3101
+ nle: "≰",
3102
+ nLeftarrow: "⇍",
3103
+ nleftarrow: "↚",
3104
+ nLeftrightarrow: "⇎",
3105
+ nleftrightarrow: "↮",
3106
+ nleq: "≰",
3107
+ nleqq: "≦̸",
3108
+ nleqslant: "⩽̸",
3109
+ nles: "⩽̸",
3110
+ nless: "≮",
3111
+ nLl: "⋘̸",
3112
+ nlsim: "≴",
3113
+ nLt: "≪⃒",
3114
+ nlt: "≮",
3115
+ nltri: "⋪",
3116
+ nltrie: "⋬",
3117
+ nLtv: "≪̸",
3118
+ nmid: "∤",
3119
+ NoBreak: "⁠",
3120
+ NonBreakingSpace: "\xA0",
3121
+ Nopf: "ℕ",
3122
+ nopf: "𝕟",
3123
+ Not: "⫬",
3124
+ not: "¬",
3125
+ NotCongruent: "≢",
3126
+ NotCupCap: "≭",
3127
+ NotDoubleVerticalBar: "∦",
3128
+ NotElement: "∉",
3129
+ NotEqual: "≠",
3130
+ NotEqualTilde: "≂̸",
3131
+ NotExists: "∄",
3132
+ NotGreater: "≯",
3133
+ NotGreaterEqual: "≱",
3134
+ NotGreaterFullEqual: "≧̸",
3135
+ NotGreaterGreater: "≫̸",
3136
+ NotGreaterLess: "≹",
3137
+ NotGreaterSlantEqual: "⩾̸",
3138
+ NotGreaterTilde: "≵",
3139
+ NotHumpDownHump: "≎̸",
3140
+ NotHumpEqual: "≏̸",
3141
+ notin: "∉",
3142
+ notindot: "⋵̸",
3143
+ notinE: "⋹̸",
3144
+ notinva: "∉",
3145
+ notinvb: "⋷",
3146
+ notinvc: "⋶",
3147
+ NotLeftTriangle: "⋪",
3148
+ NotLeftTriangleBar: "⧏̸",
3149
+ NotLeftTriangleEqual: "⋬",
3150
+ NotLess: "≮",
3151
+ NotLessEqual: "≰",
3152
+ NotLessGreater: "≸",
3153
+ NotLessLess: "≪̸",
3154
+ NotLessSlantEqual: "⩽̸",
3155
+ NotLessTilde: "≴",
3156
+ NotNestedGreaterGreater: "⪢̸",
3157
+ NotNestedLessLess: "⪡̸",
3158
+ notni: "∌",
3159
+ notniva: "∌",
3160
+ notnivb: "⋾",
3161
+ notnivc: "⋽",
3162
+ NotPrecedes: "⊀",
3163
+ NotPrecedesEqual: "⪯̸",
3164
+ NotPrecedesSlantEqual: "⋠",
3165
+ NotReverseElement: "∌",
3166
+ NotRightTriangle: "⋫",
3167
+ NotRightTriangleBar: "⧐̸",
3168
+ NotRightTriangleEqual: "⋭",
3169
+ NotSquareSubset: "⊏̸",
3170
+ NotSquareSubsetEqual: "⋢",
3171
+ NotSquareSuperset: "⊐̸",
3172
+ NotSquareSupersetEqual: "⋣",
3173
+ NotSubset: "⊂⃒",
3174
+ NotSubsetEqual: "⊈",
3175
+ NotSucceeds: "⊁",
3176
+ NotSucceedsEqual: "⪰̸",
3177
+ NotSucceedsSlantEqual: "⋡",
3178
+ NotSucceedsTilde: "≿̸",
3179
+ NotSuperset: "⊃⃒",
3180
+ NotSupersetEqual: "⊉",
3181
+ NotTilde: "≁",
3182
+ NotTildeEqual: "≄",
3183
+ NotTildeFullEqual: "≇",
3184
+ NotTildeTilde: "≉",
3185
+ NotVerticalBar: "∤",
3186
+ npar: "∦",
3187
+ nparallel: "∦",
3188
+ nparsl: "⫽⃥",
3189
+ npart: "∂̸",
3190
+ npolint: "⨔",
3191
+ npr: "⊀",
3192
+ nprcue: "⋠",
3193
+ npre: "⪯̸",
3194
+ nprec: "⊀",
3195
+ npreceq: "⪯̸",
3196
+ nrArr: "⇏",
3197
+ nrarr: "↛",
3198
+ nrarrc: "⤳̸",
3199
+ nrarrw: "↝̸",
3200
+ nRightarrow: "⇏",
3201
+ nrightarrow: "↛",
3202
+ nrtri: "⋫",
3203
+ nrtrie: "⋭",
3204
+ nsc: "⊁",
3205
+ nsccue: "⋡",
3206
+ nsce: "⪰̸",
3207
+ Nscr: "𝒩",
3208
+ nscr: "𝓃",
3209
+ nshortmid: "∤",
3210
+ nshortparallel: "∦",
3211
+ nsim: "≁",
3212
+ nsime: "≄",
3213
+ nsimeq: "≄",
3214
+ nsmid: "∤",
3215
+ nspar: "∦",
3216
+ nsqsube: "⋢",
3217
+ nsqsupe: "⋣",
3218
+ nsub: "⊄",
3219
+ nsubE: "⫅̸",
3220
+ nsube: "⊈",
3221
+ nsubset: "⊂⃒",
3222
+ nsubseteq: "⊈",
3223
+ nsubseteqq: "⫅̸",
3224
+ nsucc: "⊁",
3225
+ nsucceq: "⪰̸",
3226
+ nsup: "⊅",
3227
+ nsupE: "⫆̸",
3228
+ nsupe: "⊉",
3229
+ nsupset: "⊃⃒",
3230
+ nsupseteq: "⊉",
3231
+ nsupseteqq: "⫆̸",
3232
+ ntgl: "≹",
3233
+ Ntilde: "Ñ",
3234
+ ntilde: "ñ",
3235
+ ntlg: "≸",
3236
+ ntriangleleft: "⋪",
3237
+ ntrianglelefteq: "⋬",
3238
+ ntriangleright: "⋫",
3239
+ ntrianglerighteq: "⋭",
3240
+ Nu: "Ν",
3241
+ nu: "ν",
3242
+ num: "#",
3243
+ numero: "№",
3244
+ numsp: " ",
3245
+ nvap: "≍⃒",
3246
+ nVDash: "⊯",
3247
+ nVdash: "⊮",
3248
+ nvDash: "⊭",
3249
+ nvdash: "⊬",
3250
+ nvge: "≥⃒",
3251
+ nvgt: ">⃒",
3252
+ nvHarr: "⤄",
3253
+ nvinfin: "⧞",
3254
+ nvlArr: "⤂",
3255
+ nvle: "≤⃒",
3256
+ nvlt: "<⃒",
3257
+ nvltrie: "⊴⃒",
3258
+ nvrArr: "⤃",
3259
+ nvrtrie: "⊵⃒",
3260
+ nvsim: "∼⃒",
3261
+ nwarhk: "⤣",
3262
+ nwArr: "⇖",
3263
+ nwarr: "↖",
3264
+ nwarrow: "↖",
3265
+ nwnear: "⤧",
3266
+ Oacute: "Ó",
3267
+ oacute: "ó",
3268
+ oast: "⊛",
3269
+ ocir: "⊚",
3270
+ Ocirc: "Ô",
3271
+ ocirc: "ô",
3272
+ Ocy: "О",
3273
+ ocy: "о",
3274
+ odash: "⊝",
3275
+ Odblac: "Ő",
3276
+ odblac: "ő",
3277
+ odiv: "⨸",
3278
+ odot: "⊙",
3279
+ odsold: "⦼",
3280
+ OElig: "Œ",
3281
+ oelig: "œ",
3282
+ ofcir: "⦿",
3283
+ Ofr: "𝔒",
3284
+ ofr: "𝔬",
3285
+ ogon: "˛",
3286
+ Ograve: "Ò",
3287
+ ograve: "ò",
3288
+ ogt: "⧁",
3289
+ ohbar: "⦵",
3290
+ ohm: "Ω",
3291
+ oint: "∮",
3292
+ olarr: "↺",
3293
+ olcir: "⦾",
3294
+ olcross: "⦻",
3295
+ oline: "‾",
3296
+ olt: "⧀",
3297
+ Omacr: "Ō",
3298
+ omacr: "ō",
3299
+ Omega: "Ω",
3300
+ omega: "ω",
3301
+ Omicron: "Ο",
3302
+ omicron: "ο",
3303
+ omid: "⦶",
3304
+ ominus: "⊖",
3305
+ Oopf: "𝕆",
3306
+ oopf: "𝕠",
3307
+ opar: "⦷",
3308
+ OpenCurlyDoubleQuote: "“",
3309
+ OpenCurlyQuote: "‘",
3310
+ operp: "⦹",
3311
+ oplus: "⊕",
3312
+ Or: "⩔",
3313
+ or: "∨",
3314
+ orarr: "↻",
3315
+ ord: "⩝",
3316
+ order: "ℴ",
3317
+ orderof: "ℴ",
3318
+ ordf: "ª",
3319
+ ordm: "º",
3320
+ origof: "⊶",
3321
+ oror: "⩖",
3322
+ orslope: "⩗",
3323
+ orv: "⩛",
3324
+ oS: "Ⓢ",
3325
+ Oscr: "𝒪",
3326
+ oscr: "ℴ",
3327
+ Oslash: "Ø",
3328
+ oslash: "ø",
3329
+ osol: "⊘",
3330
+ Otilde: "Õ",
3331
+ otilde: "õ",
3332
+ Otimes: "⨷",
3333
+ otimes: "⊗",
3334
+ otimesas: "⨶",
3335
+ Ouml: "Ö",
3336
+ ouml: "ö",
3337
+ ovbar: "⌽",
3338
+ OverBar: "‾",
3339
+ OverBrace: "⏞",
3340
+ OverBracket: "⎴",
3341
+ OverParenthesis: "⏜",
3342
+ par: "∥",
3343
+ para: "¶",
3344
+ parallel: "∥",
3345
+ parsim: "⫳",
3346
+ parsl: "⫽",
3347
+ part: "∂",
3348
+ PartialD: "∂",
3349
+ Pcy: "П",
3350
+ pcy: "п",
3351
+ percnt: "%",
3352
+ period: ".",
3353
+ permil: "‰",
3354
+ perp: "⊥",
3355
+ pertenk: "‱",
3356
+ Pfr: "𝔓",
3357
+ pfr: "𝔭",
3358
+ Phi: "Φ",
3359
+ phi: "φ",
3360
+ phiv: "ϕ",
3361
+ phmmat: "ℳ",
3362
+ phone: "☎",
3363
+ Pi: "Π",
3364
+ pi: "π",
3365
+ pitchfork: "⋔",
3366
+ piv: "ϖ",
3367
+ planck: "ℏ",
3368
+ planckh: "ℎ",
3369
+ plankv: "ℏ",
3370
+ plus: "+",
3371
+ plusacir: "⨣",
3372
+ plusb: "⊞",
3373
+ pluscir: "⨢",
3374
+ plusdo: "∔",
3375
+ plusdu: "⨥",
3376
+ pluse: "⩲",
3377
+ PlusMinus: "±",
3378
+ plusmn: "±",
3379
+ plussim: "⨦",
3380
+ plustwo: "⨧",
3381
+ pm: "±",
3382
+ Poincareplane: "ℌ",
3383
+ pointint: "⨕",
3384
+ Popf: "ℙ",
3385
+ popf: "𝕡",
3386
+ pound: "£",
3387
+ Pr: "⪻",
3388
+ pr: "≺",
3389
+ prap: "⪷",
3390
+ prcue: "≼",
3391
+ prE: "⪳",
3392
+ pre: "⪯",
3393
+ prec: "≺",
3394
+ precapprox: "⪷",
3395
+ preccurlyeq: "≼",
3396
+ Precedes: "≺",
3397
+ PrecedesEqual: "⪯",
3398
+ PrecedesSlantEqual: "≼",
3399
+ PrecedesTilde: "≾",
3400
+ preceq: "⪯",
3401
+ precnapprox: "⪹",
3402
+ precneqq: "⪵",
3403
+ precnsim: "⋨",
3404
+ precsim: "≾",
3405
+ Prime: "″",
3406
+ prime: "′",
3407
+ primes: "ℙ",
3408
+ prnap: "⪹",
3409
+ prnE: "⪵",
3410
+ prnsim: "⋨",
3411
+ prod: "∏",
3412
+ Product: "∏",
3413
+ profalar: "⌮",
3414
+ profline: "⌒",
3415
+ profsurf: "⌓",
3416
+ prop: "∝",
3417
+ Proportion: "∷",
3418
+ Proportional: "∝",
3419
+ propto: "∝",
3420
+ prsim: "≾",
3421
+ prurel: "⊰",
3422
+ Pscr: "𝒫",
3423
+ pscr: "𝓅",
3424
+ Psi: "Ψ",
3425
+ psi: "ψ",
3426
+ puncsp: " ",
3427
+ Qfr: "𝔔",
3428
+ qfr: "𝔮",
3429
+ qint: "⨌",
3430
+ Qopf: "ℚ",
3431
+ qopf: "𝕢",
3432
+ qprime: "⁗",
3433
+ Qscr: "𝒬",
3434
+ qscr: "𝓆",
3435
+ quaternions: "ℍ",
3436
+ quatint: "⨖",
3437
+ quest: "?",
3438
+ questeq: "≟",
3439
+ QUOT: "\"",
3440
+ quot: "\"",
3441
+ rAarr: "⇛",
3442
+ race: "∽̱",
3443
+ Racute: "Ŕ",
3444
+ racute: "ŕ",
3445
+ radic: "√",
3446
+ raemptyv: "⦳",
3447
+ Rang: "⟫",
3448
+ rang: "⟩",
3449
+ rangd: "⦒",
3450
+ range: "⦥",
3451
+ rangle: "⟩",
3452
+ raquo: "»",
3453
+ Rarr: "↠",
3454
+ rArr: "⇒",
3455
+ rarr: "→",
3456
+ rarrap: "⥵",
3457
+ rarrb: "⇥",
3458
+ rarrbfs: "⤠",
3459
+ rarrc: "⤳",
3460
+ rarrfs: "⤞",
3461
+ rarrhk: "↪",
3462
+ rarrlp: "↬",
3463
+ rarrpl: "⥅",
3464
+ rarrsim: "⥴",
3465
+ Rarrtl: "⤖",
3466
+ rarrtl: "↣",
3467
+ rarrw: "↝",
3468
+ rAtail: "⤜",
3469
+ ratail: "⤚",
3470
+ ratio: "∶",
3471
+ rationals: "ℚ",
3472
+ RBarr: "⤐",
3473
+ rBarr: "⤏",
3474
+ rbarr: "⤍",
3475
+ rbbrk: "❳",
3476
+ rbrace: "}",
3477
+ rbrack: "]",
3478
+ rbrke: "⦌",
3479
+ rbrksld: "⦎",
3480
+ rbrkslu: "⦐",
3481
+ Rcaron: "Ř",
3482
+ rcaron: "ř",
3483
+ Rcedil: "Ŗ",
3484
+ rcedil: "ŗ",
3485
+ rceil: "⌉",
3486
+ rcub: "}",
3487
+ Rcy: "Р",
3488
+ rcy: "р",
3489
+ rdca: "⤷",
3490
+ rdldhar: "⥩",
3491
+ rdquo: "”",
3492
+ rdquor: "”",
3493
+ rdsh: "↳",
3494
+ Re: "ℜ",
3495
+ real: "ℜ",
3496
+ realine: "ℛ",
3497
+ realpart: "ℜ",
3498
+ reals: "ℝ",
3499
+ rect: "▭",
3500
+ REG: "®",
3501
+ reg: "®",
3502
+ ReverseElement: "∋",
3503
+ ReverseEquilibrium: "⇋",
3504
+ ReverseUpEquilibrium: "⥯",
3505
+ rfisht: "⥽",
3506
+ rfloor: "⌋",
3507
+ Rfr: "ℜ",
3508
+ rfr: "𝔯",
3509
+ rHar: "⥤",
3510
+ rhard: "⇁",
3511
+ rharu: "⇀",
3512
+ rharul: "⥬",
3513
+ Rho: "Ρ",
3514
+ rho: "ρ",
3515
+ rhov: "ϱ",
3516
+ RightAngleBracket: "⟩",
3517
+ RightArrow: "→",
3518
+ Rightarrow: "⇒",
3519
+ rightarrow: "→",
3520
+ RightArrowBar: "⇥",
3521
+ RightArrowLeftArrow: "⇄",
3522
+ rightarrowtail: "↣",
3523
+ RightCeiling: "⌉",
3524
+ RightDoubleBracket: "⟧",
3525
+ RightDownTeeVector: "⥝",
3526
+ RightDownVector: "⇂",
3527
+ RightDownVectorBar: "⥕",
3528
+ RightFloor: "⌋",
3529
+ rightharpoondown: "⇁",
3530
+ rightharpoonup: "⇀",
3531
+ rightleftarrows: "⇄",
3532
+ rightleftharpoons: "⇌",
3533
+ rightrightarrows: "⇉",
3534
+ rightsquigarrow: "↝",
3535
+ RightTee: "⊢",
3536
+ RightTeeArrow: "↦",
3537
+ RightTeeVector: "⥛",
3538
+ rightthreetimes: "⋌",
3539
+ RightTriangle: "⊳",
3540
+ RightTriangleBar: "⧐",
3541
+ RightTriangleEqual: "⊵",
3542
+ RightUpDownVector: "⥏",
3543
+ RightUpTeeVector: "⥜",
3544
+ RightUpVector: "↾",
3545
+ RightUpVectorBar: "⥔",
3546
+ RightVector: "⇀",
3547
+ RightVectorBar: "⥓",
3548
+ ring: "˚",
3549
+ risingdotseq: "≓",
3550
+ rlarr: "⇄",
3551
+ rlhar: "⇌",
3552
+ rlm: "‏",
3553
+ rmoust: "⎱",
3554
+ rmoustache: "⎱",
3555
+ rnmid: "⫮",
3556
+ roang: "⟭",
3557
+ roarr: "⇾",
3558
+ robrk: "⟧",
3559
+ ropar: "⦆",
3560
+ Ropf: "ℝ",
3561
+ ropf: "𝕣",
3562
+ roplus: "⨮",
3563
+ rotimes: "⨵",
3564
+ RoundImplies: "⥰",
3565
+ rpar: ")",
3566
+ rpargt: "⦔",
3567
+ rppolint: "⨒",
3568
+ rrarr: "⇉",
3569
+ Rrightarrow: "⇛",
3570
+ rsaquo: "›",
3571
+ Rscr: "ℛ",
3572
+ rscr: "𝓇",
3573
+ Rsh: "↱",
3574
+ rsh: "↱",
3575
+ rsqb: "]",
3576
+ rsquo: "’",
3577
+ rsquor: "’",
3578
+ rthree: "⋌",
3579
+ rtimes: "⋊",
3580
+ rtri: "▹",
3581
+ rtrie: "⊵",
3582
+ rtrif: "▸",
3583
+ rtriltri: "⧎",
3584
+ RuleDelayed: "⧴",
3585
+ ruluhar: "⥨",
3586
+ rx: "℞",
3587
+ Sacute: "Ś",
3588
+ sacute: "ś",
3589
+ sbquo: "‚",
3590
+ Sc: "⪼",
3591
+ sc: "≻",
3592
+ scap: "⪸",
3593
+ Scaron: "Š",
3594
+ scaron: "š",
3595
+ sccue: "≽",
3596
+ scE: "⪴",
3597
+ sce: "⪰",
3598
+ Scedil: "Ş",
3599
+ scedil: "ş",
3600
+ Scirc: "Ŝ",
3601
+ scirc: "ŝ",
3602
+ scnap: "⪺",
3603
+ scnE: "⪶",
3604
+ scnsim: "⋩",
3605
+ scpolint: "⨓",
3606
+ scsim: "≿",
3607
+ Scy: "С",
3608
+ scy: "с",
3609
+ sdot: "⋅",
3610
+ sdotb: "⊡",
3611
+ sdote: "⩦",
3612
+ searhk: "⤥",
3613
+ seArr: "⇘",
3614
+ searr: "↘",
3615
+ searrow: "↘",
3616
+ sect: "§",
3617
+ semi: ";",
3618
+ seswar: "⤩",
3619
+ setminus: "∖",
3620
+ setmn: "∖",
3621
+ sext: "✶",
3622
+ Sfr: "𝔖",
3623
+ sfr: "𝔰",
3624
+ sfrown: "⌢",
3625
+ sharp: "♯",
3626
+ SHCHcy: "Щ",
3627
+ shchcy: "щ",
3628
+ SHcy: "Ш",
3629
+ shcy: "ш",
3630
+ ShortDownArrow: "↓",
3631
+ ShortLeftArrow: "←",
3632
+ shortmid: "∣",
3633
+ shortparallel: "∥",
3634
+ ShortRightArrow: "→",
3635
+ ShortUpArrow: "↑",
3636
+ shy: "­",
3637
+ Sigma: "Σ",
3638
+ sigma: "σ",
3639
+ sigmaf: "ς",
3640
+ sigmav: "ς",
3641
+ sim: "∼",
3642
+ simdot: "⩪",
3643
+ sime: "≃",
3644
+ simeq: "≃",
3645
+ simg: "⪞",
3646
+ simgE: "⪠",
3647
+ siml: "⪝",
3648
+ simlE: "⪟",
3649
+ simne: "≆",
3650
+ simplus: "⨤",
3651
+ simrarr: "⥲",
3652
+ slarr: "←",
3653
+ SmallCircle: "∘",
3654
+ smallsetminus: "∖",
3655
+ smashp: "⨳",
3656
+ smeparsl: "⧤",
3657
+ smid: "∣",
3658
+ smile: "⌣",
3659
+ smt: "⪪",
3660
+ smte: "⪬",
3661
+ smtes: "⪬︀",
3662
+ SOFTcy: "Ь",
3663
+ softcy: "ь",
3664
+ sol: "/",
3665
+ solb: "⧄",
3666
+ solbar: "⌿",
3667
+ Sopf: "𝕊",
3668
+ sopf: "𝕤",
3669
+ spades: "♠",
3670
+ spadesuit: "♠",
3671
+ spar: "∥",
3672
+ sqcap: "⊓",
3673
+ sqcaps: "⊓︀",
3674
+ sqcup: "⊔",
3675
+ sqcups: "⊔︀",
3676
+ Sqrt: "√",
3677
+ sqsub: "⊏",
3678
+ sqsube: "⊑",
3679
+ sqsubset: "⊏",
3680
+ sqsubseteq: "⊑",
3681
+ sqsup: "⊐",
3682
+ sqsupe: "⊒",
3683
+ sqsupset: "⊐",
3684
+ sqsupseteq: "⊒",
3685
+ squ: "□",
3686
+ Square: "□",
3687
+ square: "□",
3688
+ SquareIntersection: "⊓",
3689
+ SquareSubset: "⊏",
3690
+ SquareSubsetEqual: "⊑",
3691
+ SquareSuperset: "⊐",
3692
+ SquareSupersetEqual: "⊒",
3693
+ SquareUnion: "⊔",
3694
+ squarf: "▪",
3695
+ squf: "▪",
3696
+ srarr: "→",
3697
+ Sscr: "𝒮",
3698
+ sscr: "𝓈",
3699
+ ssetmn: "∖",
3700
+ ssmile: "⌣",
3701
+ sstarf: "⋆",
3702
+ Star: "⋆",
3703
+ star: "☆",
3704
+ starf: "★",
3705
+ straightepsilon: "ϵ",
3706
+ straightphi: "ϕ",
3707
+ strns: "¯",
3708
+ Sub: "⋐",
3709
+ sub: "⊂",
3710
+ subdot: "⪽",
3711
+ subE: "⫅",
3712
+ sube: "⊆",
3713
+ subedot: "⫃",
3714
+ submult: "⫁",
3715
+ subnE: "⫋",
3716
+ subne: "⊊",
3717
+ subplus: "⪿",
3718
+ subrarr: "⥹",
3719
+ Subset: "⋐",
3720
+ subset: "⊂",
3721
+ subseteq: "⊆",
3722
+ subseteqq: "⫅",
3723
+ SubsetEqual: "⊆",
3724
+ subsetneq: "⊊",
3725
+ subsetneqq: "⫋",
3726
+ subsim: "⫇",
3727
+ subsub: "⫕",
3728
+ subsup: "⫓",
3729
+ succ: "≻",
3730
+ succapprox: "⪸",
3731
+ succcurlyeq: "≽",
3732
+ Succeeds: "≻",
3733
+ SucceedsEqual: "⪰",
3734
+ SucceedsSlantEqual: "≽",
3735
+ SucceedsTilde: "≿",
3736
+ succeq: "⪰",
3737
+ succnapprox: "⪺",
3738
+ succneqq: "⪶",
3739
+ succnsim: "⋩",
3740
+ succsim: "≿",
3741
+ SuchThat: "∋",
3742
+ Sum: "∑",
3743
+ sum: "∑",
3744
+ sung: "♪",
3745
+ Sup: "⋑",
3746
+ sup: "⊃",
3747
+ sup1: "¹",
3748
+ sup2: "²",
3749
+ sup3: "³",
3750
+ supdot: "⪾",
3751
+ supdsub: "⫘",
3752
+ supE: "⫆",
3753
+ supe: "⊇",
3754
+ supedot: "⫄",
3755
+ Superset: "⊃",
3756
+ SupersetEqual: "⊇",
3757
+ suphsol: "⟉",
3758
+ suphsub: "⫗",
3759
+ suplarr: "⥻",
3760
+ supmult: "⫂",
3761
+ supnE: "⫌",
3762
+ supne: "⊋",
3763
+ supplus: "⫀",
3764
+ Supset: "⋑",
3765
+ supset: "⊃",
3766
+ supseteq: "⊇",
3767
+ supseteqq: "⫆",
3768
+ supsetneq: "⊋",
3769
+ supsetneqq: "⫌",
3770
+ supsim: "⫈",
3771
+ supsub: "⫔",
3772
+ supsup: "⫖",
3773
+ swarhk: "⤦",
3774
+ swArr: "⇙",
3775
+ swarr: "↙",
3776
+ swarrow: "↙",
3777
+ swnwar: "⤪",
3778
+ szlig: "ß",
3779
+ Tab: " ",
3780
+ target: "⌖",
3781
+ Tau: "Τ",
3782
+ tau: "τ",
3783
+ tbrk: "⎴",
3784
+ Tcaron: "Ť",
3785
+ tcaron: "ť",
3786
+ Tcedil: "Ţ",
3787
+ tcedil: "ţ",
3788
+ Tcy: "Т",
3789
+ tcy: "т",
3790
+ tdot: "⃛",
3791
+ telrec: "⌕",
3792
+ Tfr: "𝔗",
3793
+ tfr: "𝔱",
3794
+ there4: "∴",
3795
+ Therefore: "∴",
3796
+ therefore: "∴",
3797
+ Theta: "Θ",
3798
+ theta: "θ",
3799
+ thetasym: "ϑ",
3800
+ thetav: "ϑ",
3801
+ thickapprox: "≈",
3802
+ thicksim: "∼",
3803
+ ThickSpace: "  ",
3804
+ thinsp: " ",
3805
+ ThinSpace: " ",
3806
+ thkap: "≈",
3807
+ thksim: "∼",
3808
+ THORN: "Þ",
3809
+ thorn: "þ",
3810
+ Tilde: "∼",
3811
+ tilde: "˜",
3812
+ TildeEqual: "≃",
3813
+ TildeFullEqual: "≅",
3814
+ TildeTilde: "≈",
3815
+ times: "×",
3816
+ timesb: "⊠",
3817
+ timesbar: "⨱",
3818
+ timesd: "⨰",
3819
+ tint: "∭",
3820
+ toea: "⤨",
3821
+ top: "⊤",
3822
+ topbot: "⌶",
3823
+ topcir: "⫱",
3824
+ Topf: "𝕋",
3825
+ topf: "𝕥",
3826
+ topfork: "⫚",
3827
+ tosa: "⤩",
3828
+ tprime: "‴",
3829
+ TRADE: "™",
3830
+ trade: "™",
3831
+ triangle: "▵",
3832
+ triangledown: "▿",
3833
+ triangleleft: "◃",
3834
+ trianglelefteq: "⊴",
3835
+ triangleq: "≜",
3836
+ triangleright: "▹",
3837
+ trianglerighteq: "⊵",
3838
+ tridot: "◬",
3839
+ trie: "≜",
3840
+ triminus: "⨺",
3841
+ TripleDot: "⃛",
3842
+ triplus: "⨹",
3843
+ trisb: "⧍",
3844
+ tritime: "⨻",
3845
+ trpezium: "⏢",
3846
+ Tscr: "𝒯",
3847
+ tscr: "𝓉",
3848
+ TScy: "Ц",
3849
+ tscy: "ц",
3850
+ TSHcy: "Ћ",
3851
+ tshcy: "ћ",
3852
+ Tstrok: "Ŧ",
3853
+ tstrok: "ŧ",
3854
+ twixt: "≬",
3855
+ twoheadleftarrow: "↞",
3856
+ twoheadrightarrow: "↠",
3857
+ Uacute: "Ú",
3858
+ uacute: "ú",
3859
+ Uarr: "↟",
3860
+ uArr: "⇑",
3861
+ uarr: "↑",
3862
+ Uarrocir: "⥉",
3863
+ Ubrcy: "Ў",
3864
+ ubrcy: "ў",
3865
+ Ubreve: "Ŭ",
3866
+ ubreve: "ŭ",
3867
+ Ucirc: "Û",
3868
+ ucirc: "û",
3869
+ Ucy: "У",
3870
+ ucy: "у",
3871
+ udarr: "⇅",
3872
+ Udblac: "Ű",
3873
+ udblac: "ű",
3874
+ udhar: "⥮",
3875
+ ufisht: "⥾",
3876
+ Ufr: "𝔘",
3877
+ ufr: "𝔲",
3878
+ Ugrave: "Ù",
3879
+ ugrave: "ù",
3880
+ uHar: "⥣",
3881
+ uharl: "↿",
3882
+ uharr: "↾",
3883
+ uhblk: "▀",
3884
+ ulcorn: "⌜",
3885
+ ulcorner: "⌜",
3886
+ ulcrop: "⌏",
3887
+ ultri: "◸",
3888
+ Umacr: "Ū",
3889
+ umacr: "ū",
3890
+ uml: "¨",
3891
+ UnderBar: "_",
3892
+ UnderBrace: "⏟",
3893
+ UnderBracket: "⎵",
3894
+ UnderParenthesis: "⏝",
3895
+ Union: "⋃",
3896
+ UnionPlus: "⊎",
3897
+ Uogon: "Ų",
3898
+ uogon: "ų",
3899
+ Uopf: "𝕌",
3900
+ uopf: "𝕦",
3901
+ UpArrow: "↑",
3902
+ Uparrow: "⇑",
3903
+ uparrow: "↑",
3904
+ UpArrowBar: "⤒",
3905
+ UpArrowDownArrow: "⇅",
3906
+ UpDownArrow: "↕",
3907
+ Updownarrow: "⇕",
3908
+ updownarrow: "↕",
3909
+ UpEquilibrium: "⥮",
3910
+ upharpoonleft: "↿",
3911
+ upharpoonright: "↾",
3912
+ uplus: "⊎",
3913
+ UpperLeftArrow: "↖",
3914
+ UpperRightArrow: "↗",
3915
+ Upsi: "ϒ",
3916
+ upsi: "υ",
3917
+ upsih: "ϒ",
3918
+ Upsilon: "Υ",
3919
+ upsilon: "υ",
3920
+ UpTee: "⊥",
3921
+ UpTeeArrow: "↥",
3922
+ upuparrows: "⇈",
3923
+ urcorn: "⌝",
3924
+ urcorner: "⌝",
3925
+ urcrop: "⌎",
3926
+ Uring: "Ů",
3927
+ uring: "ů",
3928
+ urtri: "◹",
3929
+ Uscr: "𝒰",
3930
+ uscr: "𝓊",
3931
+ utdot: "⋰",
3932
+ Utilde: "Ũ",
3933
+ utilde: "ũ",
3934
+ utri: "▵",
3935
+ utrif: "▴",
3936
+ uuarr: "⇈",
3937
+ Uuml: "Ü",
3938
+ uuml: "ü",
3939
+ uwangle: "⦧",
3940
+ vangrt: "⦜",
3941
+ varepsilon: "ϵ",
3942
+ varkappa: "ϰ",
3943
+ varnothing: "∅",
3944
+ varphi: "ϕ",
3945
+ varpi: "ϖ",
3946
+ varpropto: "∝",
3947
+ vArr: "⇕",
3948
+ varr: "↕",
3949
+ varrho: "ϱ",
3950
+ varsigma: "ς",
3951
+ varsubsetneq: "⊊︀",
3952
+ varsubsetneqq: "⫋︀",
3953
+ varsupsetneq: "⊋︀",
3954
+ varsupsetneqq: "⫌︀",
3955
+ vartheta: "ϑ",
3956
+ vartriangleleft: "⊲",
3957
+ vartriangleright: "⊳",
3958
+ Vbar: "⫫",
3959
+ vBar: "⫨",
3960
+ vBarv: "⫩",
3961
+ Vcy: "В",
3962
+ vcy: "в",
3963
+ VDash: "⊫",
3964
+ Vdash: "⊩",
3965
+ vDash: "⊨",
3966
+ vdash: "⊢",
3967
+ Vdashl: "⫦",
3968
+ Vee: "⋁",
3969
+ vee: "∨",
3970
+ veebar: "⊻",
3971
+ veeeq: "≚",
3972
+ vellip: "⋮",
3973
+ Verbar: "‖",
3974
+ verbar: "|",
3975
+ Vert: "‖",
3976
+ vert: "|",
3977
+ VerticalBar: "∣",
3978
+ VerticalLine: "|",
3979
+ VerticalSeparator: "❘",
3980
+ VerticalTilde: "≀",
3981
+ VeryThinSpace: " ",
3982
+ Vfr: "𝔙",
3983
+ vfr: "𝔳",
3984
+ vltri: "⊲",
3985
+ vnsub: "⊂⃒",
3986
+ vnsup: "⊃⃒",
3987
+ Vopf: "𝕍",
3988
+ vopf: "𝕧",
3989
+ vprop: "∝",
3990
+ vrtri: "⊳",
3991
+ Vscr: "𝒱",
3992
+ vscr: "𝓋",
3993
+ vsubnE: "⫋︀",
3994
+ vsubne: "⊊︀",
3995
+ vsupnE: "⫌︀",
3996
+ vsupne: "⊋︀",
3997
+ Vvdash: "⊪",
3998
+ vzigzag: "⦚",
3999
+ Wcirc: "Ŵ",
4000
+ wcirc: "ŵ",
4001
+ wedbar: "⩟",
4002
+ Wedge: "⋀",
4003
+ wedge: "∧",
4004
+ wedgeq: "≙",
4005
+ weierp: "℘",
4006
+ Wfr: "𝔚",
4007
+ wfr: "𝔴",
4008
+ Wopf: "𝕎",
4009
+ wopf: "𝕨",
4010
+ wp: "℘",
4011
+ wr: "≀",
4012
+ wreath: "≀",
4013
+ Wscr: "𝒲",
4014
+ wscr: "𝓌",
4015
+ xcap: "⋂",
4016
+ xcirc: "◯",
4017
+ xcup: "⋃",
4018
+ xdtri: "▽",
4019
+ Xfr: "𝔛",
4020
+ xfr: "𝔵",
4021
+ xhArr: "⟺",
4022
+ xharr: "⟷",
4023
+ Xi: "Ξ",
4024
+ xi: "ξ",
4025
+ xlArr: "⟸",
4026
+ xlarr: "⟵",
4027
+ xmap: "⟼",
4028
+ xnis: "⋻",
4029
+ xodot: "⨀",
4030
+ Xopf: "𝕏",
4031
+ xopf: "𝕩",
4032
+ xoplus: "⨁",
4033
+ xotime: "⨂",
4034
+ xrArr: "⟹",
4035
+ xrarr: "⟶",
4036
+ Xscr: "𝒳",
4037
+ xscr: "𝓍",
4038
+ xsqcup: "⨆",
4039
+ xuplus: "⨄",
4040
+ xutri: "△",
4041
+ xvee: "⋁",
4042
+ xwedge: "⋀",
4043
+ Yacute: "Ý",
4044
+ yacute: "ý",
4045
+ YAcy: "Я",
4046
+ yacy: "я",
4047
+ Ycirc: "Ŷ",
4048
+ ycirc: "ŷ",
4049
+ Ycy: "Ы",
4050
+ ycy: "ы",
4051
+ yen: "¥",
4052
+ Yfr: "𝔜",
4053
+ yfr: "𝔶",
4054
+ YIcy: "Ї",
4055
+ yicy: "ї",
4056
+ Yopf: "𝕐",
4057
+ yopf: "𝕪",
4058
+ Yscr: "𝒴",
4059
+ yscr: "𝓎",
4060
+ YUcy: "Ю",
4061
+ yucy: "ю",
4062
+ Yuml: "Ÿ",
4063
+ yuml: "ÿ",
4064
+ Zacute: "Ź",
4065
+ zacute: "ź",
4066
+ Zcaron: "Ž",
4067
+ zcaron: "ž",
4068
+ Zcy: "З",
4069
+ zcy: "з",
4070
+ Zdot: "Ż",
4071
+ zdot: "ż",
4072
+ zeetrf: "ℨ",
4073
+ ZeroWidthSpace: "​",
4074
+ Zeta: "Ζ",
4075
+ zeta: "ζ",
4076
+ Zfr: "ℨ",
4077
+ zfr: "𝔷",
4078
+ ZHcy: "Ж",
4079
+ zhcy: "ж",
4080
+ zigrarr: "⇝",
4081
+ Zopf: "ℤ",
4082
+ zopf: "𝕫",
4083
+ Zscr: "𝒵",
4084
+ zscr: "𝓏",
4085
+ zwj: "‍",
4086
+ zwnj: "‌"
4087
+ });
4088
+ /**
4089
+ * @deprecated use `HTML_ENTITIES` instead
4090
+ * @see HTML_ENTITIES
4091
+ */
4092
+ exports.entityMap = exports.HTML_ENTITIES;
4093
+ }));
4094
+ //#endregion
4095
+ //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/sax.js
4096
+ var require_sax = /* @__PURE__ */ __commonJSMin(((exports) => {
4097
+ var NAMESPACE = require_conventions().NAMESPACE;
4098
+ var tagNamePattern = require_conventions().tagNamePattern;
4099
+ var S_TAG = 0;
4100
+ var S_ATTR = 1;
4101
+ var S_ATTR_SPACE = 2;
4102
+ var S_EQ = 3;
4103
+ var S_ATTR_NOQUOT_VALUE = 4;
4104
+ var S_ATTR_END = 5;
4105
+ var S_TAG_SPACE = 6;
4106
+ var S_TAG_CLOSE = 7;
4107
+ /**
4108
+ * Creates an error that will not be caught by XMLReader aka the SAX parser.
4109
+ *
4110
+ * @param {string} message
4111
+ * @param {any?} locator Optional, can provide details about the location in the source
4112
+ * @constructor
4113
+ */
4114
+ function ParseError(message, locator) {
4115
+ this.message = message;
4116
+ this.locator = locator;
4117
+ if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
4118
+ }
4119
+ ParseError.prototype = /* @__PURE__ */ new Error();
4120
+ ParseError.prototype.name = ParseError.name;
4121
+ function XMLReader() {}
4122
+ XMLReader.prototype = { parse: function(source, defaultNSMap, entityMap) {
4123
+ var domBuilder = this.domBuilder;
4124
+ domBuilder.startDocument();
4125
+ _copy(defaultNSMap, defaultNSMap = {});
4126
+ parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);
4127
+ domBuilder.endDocument();
4128
+ } };
4129
+ function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
4130
+ function fixedFromCharCode(code) {
4131
+ if (code > 65535) {
4132
+ code -= 65536;
4133
+ var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
4134
+ return String.fromCharCode(surrogate1, surrogate2);
4135
+ } else return String.fromCharCode(code);
4136
+ }
4137
+ function entityReplacer(a) {
4138
+ var k = a.slice(1, -1);
4139
+ if (Object.hasOwnProperty.call(entityMap, k)) return entityMap[k];
4140
+ else if (k.charAt(0) === "#") return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
4141
+ else {
4142
+ errorHandler.error("entity not found:" + a);
4143
+ return a;
4144
+ }
4145
+ }
4146
+ function appendText(end) {
4147
+ if (end > start) {
4148
+ var xt = source.substring(start, end).replace(/&#?\w+;/g, entityReplacer);
4149
+ locator && position(start);
4150
+ domBuilder.characters(xt, 0, end - start);
4151
+ start = end;
4152
+ }
4153
+ }
4154
+ function position(p, m) {
4155
+ while (p >= lineEnd && (m = linePattern.exec(source))) {
4156
+ lineStart = m.index;
4157
+ lineEnd = lineStart + m[0].length;
4158
+ locator.lineNumber++;
4159
+ }
4160
+ locator.columnNumber = p - lineStart + 1;
4161
+ }
4162
+ var lineStart = 0;
4163
+ var lineEnd = 0;
4164
+ var linePattern = /.*(?:\r\n?|\n)|.*$/g;
4165
+ var locator = domBuilder.locator;
4166
+ var parseStack = [{ currentNSMap: defaultNSMapCopy }];
4167
+ var closeMap = {};
4168
+ var start = 0;
4169
+ while (true) {
4170
+ try {
4171
+ var tagStart = source.indexOf("<", start);
4172
+ if (tagStart < 0) {
4173
+ if (!source.substr(start).match(/^\s*$/)) {
4174
+ var doc = domBuilder.doc;
4175
+ var text = doc.createTextNode(source.substr(start));
4176
+ doc.appendChild(text);
4177
+ domBuilder.currentElement = text;
4178
+ }
4179
+ return;
4180
+ }
4181
+ if (tagStart > start) appendText(tagStart);
4182
+ switch (source.charAt(tagStart + 1)) {
4183
+ case "/":
4184
+ var end = source.indexOf(">", tagStart + 3);
4185
+ var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, "$1");
4186
+ var config = parseStack.pop();
4187
+ if (end < 0) {
4188
+ tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
4189
+ errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
4190
+ end = tagStart + 1 + tagName.length;
4191
+ } else if (tagName.match(/\s</)) {
4192
+ tagName = tagName.replace(/[\s<].*/, "");
4193
+ errorHandler.error("end tag name: " + tagName + " maybe not complete");
4194
+ end = tagStart + 1 + tagName.length;
4195
+ } else if (/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])) errorHandler.error("end tag name is followed by whitespace and trailing content: \"" + tagName + "\"");
4196
+ var localNSMap = config.localNSMap;
4197
+ var endMatch = config.tagName == tagName;
4198
+ if (endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase()) {
4199
+ domBuilder.endElement(config.uri, config.localName, tagName);
4200
+ if (localNSMap) {
4201
+ for (var prefix in localNSMap) if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) domBuilder.endPrefixMapping(prefix);
4202
+ }
4203
+ if (!endMatch) errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
4204
+ } else parseStack.push(config);
4205
+ end++;
4206
+ break;
4207
+ case "?":
4208
+ locator && position(tagStart);
4209
+ end = parseInstruction(source, tagStart, domBuilder);
4210
+ break;
4211
+ case "!":
4212
+ locator && position(tagStart);
4213
+ end = parseDCC(source, tagStart, domBuilder, errorHandler);
4214
+ break;
4215
+ default:
4216
+ locator && position(tagStart);
4217
+ var el = new ElementAttributes();
4218
+ var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
4219
+ var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
4220
+ var len = el.length;
4221
+ if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
4222
+ el.closed = true;
4223
+ if (!entityMap.nbsp) errorHandler.warning("unclosed xml attribute");
4224
+ }
4225
+ if (locator && len) {
4226
+ var locator2 = copyLocator(locator, {});
4227
+ for (var i = 0; i < len; i++) {
4228
+ var a = el[i];
4229
+ position(a.offset);
4230
+ a.locator = copyLocator(locator, {});
4231
+ }
4232
+ domBuilder.locator = locator2;
4233
+ if (appendElement(el, domBuilder, currentNSMap)) parseStack.push(el);
4234
+ domBuilder.locator = locator;
4235
+ } else if (appendElement(el, domBuilder, currentNSMap)) parseStack.push(el);
4236
+ if (NAMESPACE.isHTML(el.uri) && !el.closed) end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
4237
+ else end++;
4238
+ }
4239
+ } catch (e) {
4240
+ if (e instanceof ParseError) throw e;
4241
+ errorHandler.error("element parse error: " + e);
4242
+ end = -1;
4243
+ }
4244
+ if (end > start) start = end;
4245
+ else appendText(Math.max(tagStart, start) + 1);
4246
+ }
4247
+ }
4248
+ function copyLocator(f, t) {
4249
+ t.lineNumber = f.lineNumber;
4250
+ t.columnNumber = f.columnNumber;
4251
+ return t;
4252
+ }
4253
+ /**
4254
+ * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
4255
+ * @return end of the elementStartPart(end of elementEndPart for selfClosed el)
4256
+ */
4257
+ function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {
4258
+ /**
4259
+ * @param {string} qname
4260
+ * @param {string} value
4261
+ * @param {number} startIndex
4262
+ */
4263
+ function addAttribute(qname, value, startIndex) {
4264
+ if (el.attributeNames.hasOwnProperty(qname)) errorHandler.fatalError("Attribute " + qname + " redefined");
4265
+ el.addValue(qname, value.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer), startIndex);
4266
+ }
4267
+ var attrName;
4268
+ var value;
4269
+ var p = ++start;
4270
+ var s = S_TAG;
4271
+ while (true) {
4272
+ var c = source.charAt(p);
4273
+ if (s === S_TAG && c === "<") throw new Error("unexpected < in tag name: " + source.slice(start, p));
4274
+ switch (c) {
4275
+ case "=":
4276
+ if (s === S_ATTR) {
4277
+ attrName = source.slice(start, p);
4278
+ s = S_EQ;
4279
+ } else if (s === S_ATTR_SPACE) s = S_EQ;
4280
+ else throw new Error("attribute equal must after attrName");
4281
+ break;
4282
+ case "'":
4283
+ case "\"":
4284
+ if (s === S_EQ || s === S_ATTR) {
4285
+ if (s === S_ATTR) {
4286
+ errorHandler.warning("attribute value must after \"=\"");
4287
+ attrName = source.slice(start, p);
4288
+ }
4289
+ start = p + 1;
4290
+ p = source.indexOf(c, start);
4291
+ if (p > 0) {
4292
+ value = source.slice(start, p);
4293
+ addAttribute(attrName, value, start - 1);
4294
+ s = S_ATTR_END;
4295
+ } else throw new Error("attribute value no end '" + c + "' match");
4296
+ } else if (s == S_ATTR_NOQUOT_VALUE) {
4297
+ value = source.slice(start, p);
4298
+ addAttribute(attrName, value, start);
4299
+ errorHandler.warning("attribute \"" + attrName + "\" missed start quot(" + c + ")!!");
4300
+ start = p + 1;
4301
+ s = S_ATTR_END;
4302
+ } else throw new Error("attribute value must after \"=\"");
4303
+ break;
4304
+ case "/":
4305
+ switch (s) {
4306
+ case S_TAG: el.setTagName(source.slice(start, p));
4307
+ case S_ATTR_END:
4308
+ case S_TAG_SPACE:
4309
+ case S_TAG_CLOSE:
4310
+ s = S_TAG_CLOSE;
4311
+ el.closed = true;
4312
+ case S_ATTR_NOQUOT_VALUE:
4313
+ case S_ATTR: break;
4314
+ case S_ATTR_SPACE:
4315
+ el.closed = true;
4316
+ break;
4317
+ default: throw new Error("attribute invalid close char('/')");
4318
+ }
4319
+ break;
4320
+ case "":
4321
+ errorHandler.error("unexpected end of input");
4322
+ if (s == S_TAG) el.setTagName(source.slice(start, p));
4323
+ return p;
4324
+ case ">":
4325
+ switch (s) {
4326
+ case S_TAG: el.setTagName(source.slice(start, p));
4327
+ case S_ATTR_END:
4328
+ case S_TAG_SPACE:
4329
+ case S_TAG_CLOSE: break;
4330
+ case S_ATTR_NOQUOT_VALUE:
4331
+ case S_ATTR:
4332
+ value = source.slice(start, p);
4333
+ if (value.slice(-1) === "/") {
4334
+ el.closed = true;
4335
+ value = value.slice(0, -1);
4336
+ }
4337
+ case S_ATTR_SPACE:
4338
+ if (s === S_ATTR_SPACE) value = attrName;
4339
+ if (s == S_ATTR_NOQUOT_VALUE) {
4340
+ errorHandler.warning("attribute \"" + value + "\" missed quot(\")!");
4341
+ addAttribute(attrName, value, start);
4342
+ } else {
4343
+ if (!NAMESPACE.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) errorHandler.warning("attribute \"" + value + "\" missed value!! \"" + value + "\" instead!!");
4344
+ addAttribute(value, value, start);
4345
+ }
4346
+ break;
4347
+ case S_EQ: throw new Error("attribute value missed!!");
4348
+ }
4349
+ return p;
4350
+ case "€": c = " ";
4351
+ default: if (c <= " ") switch (s) {
4352
+ case S_TAG:
4353
+ el.setTagName(source.slice(start, p));
4354
+ s = S_TAG_SPACE;
4355
+ break;
4356
+ case S_ATTR:
4357
+ attrName = source.slice(start, p);
4358
+ s = S_ATTR_SPACE;
4359
+ break;
4360
+ case S_ATTR_NOQUOT_VALUE:
4361
+ var value = source.slice(start, p);
4362
+ errorHandler.warning("attribute \"" + value + "\" missed quot(\")!!");
4363
+ addAttribute(attrName, value, start);
4364
+ case S_ATTR_END: s = S_TAG_SPACE;
4365
+ }
4366
+ else switch (s) {
4367
+ case S_ATTR_SPACE:
4368
+ el.tagName;
4369
+ if (!NAMESPACE.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) errorHandler.warning("attribute \"" + attrName + "\" missed value!! \"" + attrName + "\" instead2!!");
4370
+ addAttribute(attrName, attrName, start);
4371
+ start = p;
4372
+ s = S_ATTR;
4373
+ break;
4374
+ case S_ATTR_END: errorHandler.warning("attribute space is required\"" + attrName + "\"!!");
4375
+ case S_TAG_SPACE:
4376
+ s = S_ATTR;
4377
+ start = p;
4378
+ break;
4379
+ case S_EQ:
4380
+ s = S_ATTR_NOQUOT_VALUE;
4381
+ start = p;
4382
+ break;
4383
+ case S_TAG_CLOSE: throw new Error("elements closed character '/' and '>' must be connected to");
4384
+ }
4385
+ }
4386
+ p++;
4387
+ }
4388
+ }
4389
+ /**
4390
+ * @return true if has new namespace define
4391
+ */
4392
+ function appendElement(el, domBuilder, currentNSMap) {
4393
+ var tagName = el.tagName;
4394
+ var localNSMap = null;
4395
+ var i = el.length;
4396
+ while (i--) {
4397
+ var a = el[i];
4398
+ var qName = a.qName;
4399
+ var value = a.value;
4400
+ var nsp = qName.indexOf(":");
4401
+ if (nsp > 0) {
4402
+ var prefix = a.prefix = qName.slice(0, nsp);
4403
+ var localName = qName.slice(nsp + 1);
4404
+ var nsPrefix = prefix === "xmlns" && localName;
4405
+ } else {
4406
+ localName = qName;
4407
+ prefix = null;
4408
+ nsPrefix = qName === "xmlns" && "";
4409
+ }
4410
+ a.localName = localName;
4411
+ if (nsPrefix !== false) {
4412
+ if (localNSMap == null) {
4413
+ localNSMap = {};
4414
+ currentNSMap = Object.create(currentNSMap);
4415
+ }
4416
+ currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
4417
+ a.uri = NAMESPACE.XMLNS;
4418
+ domBuilder.startPrefixMapping(nsPrefix, value);
4419
+ }
4420
+ }
4421
+ var i = el.length;
4422
+ while (i--) {
4423
+ a = el[i];
4424
+ var prefix = a.prefix;
4425
+ if (prefix) {
4426
+ if (prefix === "xml") a.uri = NAMESPACE.XML;
4427
+ if (prefix !== "xmlns") a.uri = currentNSMap[prefix || ""];
4428
+ }
4429
+ }
4430
+ var nsp = tagName.indexOf(":");
4431
+ if (nsp > 0) {
4432
+ prefix = el.prefix = tagName.slice(0, nsp);
4433
+ localName = el.localName = tagName.slice(nsp + 1);
4434
+ } else {
4435
+ prefix = null;
4436
+ localName = el.localName = tagName;
4437
+ }
4438
+ var ns = el.uri = currentNSMap[prefix || ""];
4439
+ domBuilder.startElement(ns, localName, tagName, el);
4440
+ if (el.closed) {
4441
+ domBuilder.endElement(ns, localName, tagName);
4442
+ if (localNSMap) {
4443
+ for (prefix in localNSMap) if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) domBuilder.endPrefixMapping(prefix);
4444
+ }
4445
+ } else {
4446
+ el.currentNSMap = currentNSMap;
4447
+ el.localNSMap = localNSMap;
4448
+ return true;
4449
+ }
4450
+ }
4451
+ function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
4452
+ if (/^(?:script|textarea)$/i.test(tagName)) {
4453
+ var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
4454
+ var text = source.substring(elStartEnd + 1, elEndStart);
4455
+ if (/[&<]/.test(text)) {
4456
+ if (/^script$/i.test(tagName)) {
4457
+ domBuilder.characters(text, 0, text.length);
4458
+ return elEndStart;
4459
+ }
4460
+ text = text.replace(/&#?\w+;/g, entityReplacer);
4461
+ domBuilder.characters(text, 0, text.length);
4462
+ return elEndStart;
4463
+ }
4464
+ }
4465
+ return elStartEnd + 1;
4466
+ }
4467
+ function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
4468
+ var pos = closeMap[tagName];
4469
+ if (pos == null) {
4470
+ pos = source.lastIndexOf("</" + tagName + ">");
4471
+ if (pos < elStartEnd) pos = source.lastIndexOf("</" + tagName);
4472
+ closeMap[tagName] = pos;
4473
+ }
4474
+ return pos < elStartEnd;
4475
+ }
4476
+ function _copy(source, target) {
4477
+ for (var n in source) if (Object.prototype.hasOwnProperty.call(source, n)) target[n] = source[n];
4478
+ }
4479
+ function parseDCC(source, start, domBuilder, errorHandler) {
4480
+ switch (source.charAt(start + 2)) {
4481
+ case "-": if (source.charAt(start + 3) === "-") {
4482
+ var end = source.indexOf("-->", start + 4);
4483
+ if (end > start) {
4484
+ domBuilder.comment(source, start + 4, end - start - 4);
4485
+ return end + 3;
4486
+ } else {
4487
+ errorHandler.error("Unclosed comment");
4488
+ return -1;
4489
+ }
4490
+ } else return -1;
4491
+ default:
4492
+ if (source.substr(start + 3, 6) == "CDATA[") {
4493
+ var end = source.indexOf("]]>", start + 9);
4494
+ domBuilder.startCDATA();
4495
+ domBuilder.characters(source, start + 9, end - start - 9);
4496
+ domBuilder.endCDATA();
4497
+ return end + 3;
4498
+ }
4499
+ var matchs = split(source, start);
4500
+ var len = matchs.length;
4501
+ if (len > 1 && /!doctype/i.test(matchs[0][0])) {
4502
+ var name = matchs[1][0];
4503
+ var pubid = false;
4504
+ var sysid = false;
4505
+ if (len > 3) {
4506
+ if (/^public$/i.test(matchs[2][0])) {
4507
+ pubid = matchs[3][0];
4508
+ sysid = len > 4 && matchs[4][0];
4509
+ } else if (/^system$/i.test(matchs[2][0])) sysid = matchs[3][0];
4510
+ }
4511
+ var lastMatch = matchs[len - 1];
4512
+ domBuilder.startDTD(name, pubid, sysid);
4513
+ domBuilder.endDTD();
4514
+ return lastMatch.index + lastMatch[0].length;
4515
+ }
4516
+ }
4517
+ return -1;
4518
+ }
4519
+ function parseInstruction(source, start, domBuilder) {
4520
+ var end = source.indexOf("?>", start);
4521
+ if (end) {
4522
+ var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)$/);
4523
+ if (match) {
4524
+ match[0].length;
4525
+ domBuilder.processingInstruction(match[1], match[2]);
4526
+ return end + 2;
4527
+ } else return -1;
4528
+ }
4529
+ return -1;
4530
+ }
4531
+ function ElementAttributes() {
4532
+ this.attributeNames = {};
4533
+ }
4534
+ ElementAttributes.prototype = {
4535
+ setTagName: function(tagName) {
4536
+ if (!tagNamePattern.test(tagName)) throw new Error("invalid tagName:" + tagName);
4537
+ this.tagName = tagName;
4538
+ },
4539
+ addValue: function(qName, value, offset) {
4540
+ if (!tagNamePattern.test(qName)) throw new Error("invalid attribute:" + qName);
4541
+ this.attributeNames[qName] = this.length;
4542
+ this[this.length++] = {
4543
+ qName,
4544
+ value,
4545
+ offset
4546
+ };
4547
+ },
4548
+ length: 0,
4549
+ getLocalName: function(i) {
4550
+ return this[i].localName;
4551
+ },
4552
+ getLocator: function(i) {
4553
+ return this[i].locator;
4554
+ },
4555
+ getQName: function(i) {
4556
+ return this[i].qName;
4557
+ },
4558
+ getURI: function(i) {
4559
+ return this[i].uri;
4560
+ },
4561
+ getValue: function(i) {
4562
+ return this[i].value;
4563
+ }
4564
+ };
4565
+ function split(source, start) {
4566
+ var match;
4567
+ var buf = [];
4568
+ var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
4569
+ reg.lastIndex = start;
4570
+ reg.exec(source);
4571
+ while (match = reg.exec(source)) {
4572
+ buf.push(match);
4573
+ if (match[1]) return buf;
4574
+ }
4575
+ }
4576
+ exports.XMLReader = XMLReader;
4577
+ exports.ParseError = ParseError;
4578
+ }));
4579
+ //#endregion
4580
+ //#region ../../node_modules/.pnpm/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/dom-parser.js
4581
+ var require_dom_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
4582
+ var conventions = require_conventions();
4583
+ var dom = require_dom();
4584
+ var entities = require_entities();
4585
+ var sax = require_sax();
4586
+ var DOMImplementation = dom.DOMImplementation;
4587
+ var NAMESPACE = conventions.NAMESPACE;
4588
+ var ParseError = sax.ParseError;
4589
+ var XMLReader = sax.XMLReader;
4590
+ /**
4591
+ * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:
4592
+ *
4593
+ * > XML parsed entities are often stored in computer files which,
4594
+ * > for editing convenience, are organized into lines.
4595
+ * > These lines are typically separated by some combination
4596
+ * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).
4597
+ * >
4598
+ * > To simplify the tasks of applications, the XML processor must behave
4599
+ * > as if it normalized all line breaks in external parsed entities (including the document entity)
4600
+ * > on input, before parsing, by translating all of the following to a single #xA character:
4601
+ * >
4602
+ * > 1. the two-character sequence #xD #xA
4603
+ * > 2. the two-character sequence #xD #x85
4604
+ * > 3. the single character #x85
4605
+ * > 4. the single character #x2028
4606
+ * > 5. any #xD character that is not immediately followed by #xA or #x85.
4607
+ *
4608
+ * @param {string} input
4609
+ * @returns {string}
4610
+ */
4611
+ function normalizeLineEndings(input) {
4612
+ return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
4613
+ }
4614
+ /**
4615
+ * @typedef Locator
4616
+ * @property {number} [columnNumber]
4617
+ * @property {number} [lineNumber]
4618
+ */
4619
+ /**
4620
+ * @typedef DOMParserOptions
4621
+ * @property {DOMHandler} [domBuilder]
4622
+ * @property {Function} [errorHandler]
4623
+ * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing
4624
+ * defaults to `normalizeLineEndings`
4625
+ * @property {Locator} [locator]
4626
+ * @property {Record<string, string>} [xmlns]
4627
+ *
4628
+ * @see normalizeLineEndings
4629
+ */
4630
+ /**
4631
+ * The DOMParser interface provides the ability to parse XML or HTML source code
4632
+ * from a string into a DOM `Document`.
4633
+ *
4634
+ * _xmldom is different from the spec in that it allows an `options` parameter,
4635
+ * to override the default behavior._
4636
+ *
4637
+ * @param {DOMParserOptions} [options]
4638
+ * @constructor
4639
+ *
4640
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
4641
+ * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization
4642
+ */
4643
+ function DOMParser(options) {
4644
+ this.options = options || { locator: {} };
4645
+ }
4646
+ DOMParser.prototype.parseFromString = function(source, mimeType) {
4647
+ var options = this.options;
4648
+ var sax = new XMLReader();
4649
+ var domBuilder = options.domBuilder || new DOMHandler();
4650
+ var errorHandler = options.errorHandler;
4651
+ var locator = options.locator;
4652
+ var defaultNSMap = options.xmlns || {};
4653
+ var isHTML = /\/x?html?$/.test(mimeType);
4654
+ var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
4655
+ if (locator) domBuilder.setDocumentLocator(locator);
4656
+ sax.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
4657
+ sax.domBuilder = options.domBuilder || domBuilder;
4658
+ if (isHTML) defaultNSMap[""] = NAMESPACE.HTML;
4659
+ defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
4660
+ var normalize = options.normalizeLineEndings || normalizeLineEndings;
4661
+ if (source && typeof source === "string") sax.parse(normalize(source), defaultNSMap, entityMap);
4662
+ else sax.errorHandler.error("invalid doc source");
4663
+ return domBuilder.doc;
4664
+ };
4665
+ function buildErrorHandler(errorImpl, domBuilder, locator) {
4666
+ if (!errorImpl) {
4667
+ if (domBuilder instanceof DOMHandler) return domBuilder;
4668
+ errorImpl = domBuilder;
4669
+ }
4670
+ var errorHandler = {};
4671
+ var isCallback = errorImpl instanceof Function;
4672
+ locator = locator || {};
4673
+ function build(key) {
4674
+ var fn = errorImpl[key];
4675
+ if (!fn && isCallback) fn = errorImpl.length == 2 ? function(msg) {
4676
+ errorImpl(key, msg);
4677
+ } : errorImpl;
4678
+ errorHandler[key] = fn && function(msg) {
4679
+ fn("[xmldom " + key + "] " + msg + _locator(locator));
4680
+ } || function() {};
4681
+ }
4682
+ build("warning");
4683
+ build("error");
4684
+ build("fatalError");
4685
+ return errorHandler;
4686
+ }
4687
+ /**
4688
+ * +ContentHandler+ErrorHandler
4689
+ * +LexicalHandler+EntityResolver2
4690
+ * -DeclHandler-DTDHandler
4691
+ *
4692
+ * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
4693
+ * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
4694
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
4695
+ */
4696
+ function DOMHandler() {
4697
+ this.cdata = false;
4698
+ }
4699
+ function position(locator, node) {
4700
+ node.lineNumber = locator.lineNumber;
4701
+ node.columnNumber = locator.columnNumber;
4702
+ }
4703
+ /**
4704
+ * @see org.xml.sax.ContentHandler#startDocument
4705
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
4706
+ */
4707
+ DOMHandler.prototype = {
4708
+ startDocument: function() {
4709
+ this.doc = new DOMImplementation().createDocument(null, null, null);
4710
+ if (this.locator) this.doc.documentURI = this.locator.systemId;
4711
+ },
4712
+ startElement: function(namespaceURI, localName, qName, attrs) {
4713
+ var doc = this.doc;
4714
+ var el = doc.createElementNS(namespaceURI, qName || localName);
4715
+ var len = attrs.length;
4716
+ appendElement(this, el);
4717
+ this.currentElement = el;
4718
+ this.locator && position(this.locator, el);
4719
+ for (var i = 0; i < len; i++) {
4720
+ var namespaceURI = attrs.getURI(i);
4721
+ var value = attrs.getValue(i);
4722
+ var qName = attrs.getQName(i);
4723
+ var attr = doc.createAttributeNS(namespaceURI, qName);
4724
+ this.locator && position(attrs.getLocator(i), attr);
4725
+ attr.value = attr.nodeValue = value;
4726
+ el.setAttributeNode(attr);
4727
+ }
4728
+ },
4729
+ endElement: function(namespaceURI, localName, qName) {
4730
+ var current = this.currentElement;
4731
+ current.tagName;
4732
+ this.currentElement = current.parentNode;
4733
+ },
4734
+ startPrefixMapping: function(prefix, uri) {},
4735
+ endPrefixMapping: function(prefix) {},
4736
+ processingInstruction: function(target, data) {
4737
+ var ins = this.doc.createProcessingInstruction(target, data);
4738
+ this.locator && position(this.locator, ins);
4739
+ appendElement(this, ins);
4740
+ },
4741
+ ignorableWhitespace: function(ch, start, length) {},
4742
+ characters: function(chars, start, length) {
4743
+ chars = _toString.apply(this, arguments);
4744
+ if (chars) {
4745
+ if (this.cdata) var charNode = this.doc.createCDATASection(chars);
4746
+ else var charNode = this.doc.createTextNode(chars);
4747
+ if (this.currentElement) this.currentElement.appendChild(charNode);
4748
+ else if (/^\s*$/.test(chars)) this.doc.appendChild(charNode);
4749
+ this.locator && position(this.locator, charNode);
4750
+ }
4751
+ },
4752
+ skippedEntity: function(name) {},
4753
+ endDocument: function() {
4754
+ this.doc.normalize();
4755
+ },
4756
+ setDocumentLocator: function(locator) {
4757
+ if (this.locator = locator) locator.lineNumber = 0;
4758
+ },
4759
+ comment: function(chars, start, length) {
4760
+ chars = _toString.apply(this, arguments);
4761
+ var comm = this.doc.createComment(chars);
4762
+ this.locator && position(this.locator, comm);
4763
+ appendElement(this, comm);
4764
+ },
4765
+ startCDATA: function() {
4766
+ this.cdata = true;
4767
+ },
4768
+ endCDATA: function() {
4769
+ this.cdata = false;
4770
+ },
4771
+ startDTD: function(name, publicId, systemId) {
4772
+ var impl = this.doc.implementation;
4773
+ if (impl && impl.createDocumentType) {
4774
+ var dt = impl.createDocumentType(name, publicId, systemId);
4775
+ this.locator && position(this.locator, dt);
4776
+ appendElement(this, dt);
4777
+ this.doc.doctype = dt;
4778
+ }
4779
+ },
4780
+ /**
4781
+ * @see org.xml.sax.ErrorHandler
4782
+ * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
4783
+ */
4784
+ warning: function(error) {
4785
+ console.warn("[xmldom warning] " + error, _locator(this.locator));
4786
+ },
4787
+ error: function(error) {
4788
+ console.error("[xmldom error] " + error, _locator(this.locator));
4789
+ },
4790
+ fatalError: function(error) {
4791
+ throw new ParseError(error, this.locator);
4792
+ }
4793
+ };
4794
+ function _locator(l) {
4795
+ if (l) return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
4796
+ }
4797
+ function _toString(chars, start, length) {
4798
+ if (typeof chars == "string") return chars.substr(start, length);
4799
+ else {
4800
+ if (chars.length >= start + length || start) return new java.lang.String(chars, start, length) + "";
4801
+ return chars;
4802
+ }
4803
+ }
4804
+ "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
4805
+ DOMHandler.prototype[key] = function() {
4806
+ return null;
4807
+ };
4808
+ });
4809
+ function appendElement(hander, node) {
4810
+ if (!hander.currentElement) hander.doc.appendChild(node);
4811
+ else hander.currentElement.appendChild(node);
4812
+ }
4813
+ exports.__DOMHandler = DOMHandler;
4814
+ exports.normalizeLineEndings = normalizeLineEndings;
4815
+ exports.DOMParser = DOMParser;
4816
+ }));
4817
+ //#endregion
4818
+ //#region ../../packages/content/dist/epub-BXQPqTFk.js
4819
+ var import_lib = (/* @__PURE__ */ __commonJSMin(((exports) => {
4820
+ var dom = require_dom();
4821
+ exports.DOMImplementation = dom.DOMImplementation;
4822
+ exports.XMLSerializer = dom.XMLSerializer;
4823
+ exports.DOMParser = require_dom_parser().DOMParser;
4824
+ })))();
4825
+ function epubXML(bytes) {
4826
+ const encoding = bytes[0] === 255 && bytes[1] === 254 ? "utf-16le" : bytes[0] === 254 && bytes[1] === 255 ? "utf-16be" : "utf-8";
4827
+ const text = safeXMLText(decodeText(bytes, encoding));
4828
+ const reject = () => {
4829
+ assert(false, "INVALID_EPUB", "EPUB XML 格式不正确");
4830
+ };
4831
+ const doc = new import_lib.DOMParser({ errorHandler: {
4832
+ warning: reject,
4833
+ error: reject,
4834
+ fatalError: reject
4835
+ } }).parseFromString(text, "application/xml");
4836
+ assert(doc.documentElement, "INVALID_EPUB", "缺少 XML 根元素");
4837
+ assert(!doc.getElementsByTagNameNS("http://www.w3.org/2001/XInclude", "*").length, "EPUB_ENTITY", "EPUB 不支持 XInclude");
4838
+ return {
4839
+ text,
4840
+ doc
4841
+ };
4842
+ }
4843
+ function epubPath(reference, base = "") {
4844
+ assert(reference && !/^[a-z][a-z0-9+.-]*:|^[/\\]|%(?:2f|5c|25|00)/i.test(reference), "INVALID_PATH", "EPUB 资源必须位于书籍内部");
4845
+ const url = new URL(reference, `https://epub.invalid/book/${base}`);
4846
+ assert(url.origin === "https://epub.invalid" && url.pathname.startsWith("/book/") && !url.search && !url.hash, "INVALID_PATH", "EPUB 资源路径越界或包含歧义");
4847
+ return safePath(decodeURIComponent(url.pathname.slice(6)));
4848
+ }
4849
+ const fonts = /* @__PURE__ */ new Set([
4850
+ "font/otf",
4851
+ "font/ttf",
4852
+ "font/woff",
4853
+ "font/woff2",
4854
+ "application/vnd.ms-opentype",
4855
+ "application/font-sfnt",
4856
+ "application/font-woff"
4857
+ ]);
4858
+ /** W3C EPUB 3.3 §4.4: IDPF font obfuscation is not DRM. Original ZIP stays intact. */
4859
+ async function restoreFonts(files, xml, opfPath) {
4860
+ const encryption = xml.get("META-INF/encryption.xml")?.doc;
4861
+ if (!encryption) return;
4862
+ const doc = xml.get(opfPath)?.doc;
4863
+ assert(doc, "INVALID_EPUB", "缺少 EPUB 包文档");
4864
+ const uid = doc.documentElement.getAttribute("unique-identifier");
4865
+ const identifier = Array.from(doc.getElementsByTagNameNS("*", "identifier")).find((item) => item.getAttribute("id") === uid)?.textContent?.replace(/[ \t\r\n]/g, "");
4866
+ const entries = Array.from(encryption.getElementsByTagNameNS("*", "EncryptedData"));
4867
+ assert(identifier && entries.length, "EPUB_DRM", "无法识别字体混淆元数据");
4868
+ const key = new Uint8Array(await crypto.subtle.digest("SHA-1", encoder.encode(identifier)));
4869
+ const media = new Map(Array.from(doc.getElementsByTagNameNS("*", "item")).filter((item) => !/^https:\/\//i.test(item.getAttribute("href") ?? "")).map((item) => [epubPath(item.getAttribute("href") ?? "", opfPath), item.getAttribute("media-type")]));
4870
+ const seen = /* @__PURE__ */ new Set();
4871
+ for (const entry of entries) {
4872
+ const methods = entry.getElementsByTagNameNS("*", "EncryptionMethod");
4873
+ const references = entry.getElementsByTagNameNS("*", "CipherReference");
4874
+ assert(methods.length === 1 && references.length === 1 && methods[0].getAttribute("Algorithm") === "http://www.idpf.org/2008/embedding", "EPUB_DRM", "不支持 DRM 或非标准字体加密");
4875
+ const path = epubPath(references[0].getAttribute("URI") ?? "");
4876
+ const original = files.get(path);
4877
+ assert(original && fonts.has(media.get(path) ?? "") && !seen.has(path), "INVALID_EPUB", "字体混淆必须引用唯一的书内字体资源");
4878
+ seen.add(path);
4879
+ const restored = original.slice();
4880
+ for (let i = 0; i < Math.min(1040, restored.length); i++) restored[i] ^= key[i % key.length];
4881
+ files.set(path, restored);
4882
+ }
4883
+ files.delete("META-INF/encryption.xml");
4884
+ }
4885
+ async function prepareEPUB(data, title, limits, digestValue) {
4886
+ const expanded = unzipSafe(data, limits);
4887
+ const container = expanded.get("META-INF/container.xml");
4888
+ assert(container, "INVALID_EPUB", "缺少 EPUB container.xml");
4889
+ const xml = new Map([...expanded].filter(([path]) => /\.(xml|opf|ncx|xhtml|html|svg)$/i.test(path)).map(([path, bytes]) => [path, epubXML(bytes)]));
4890
+ const opfPath = xml.get("META-INF/container.xml")?.doc.getElementsByTagNameNS("*", "rootfile")[0]?.getAttribute("full-path");
4891
+ assert(opfPath && expanded.has(opfPath), "INVALID_EPUB", "缺少 EPUB 包文档");
4892
+ safePath(opfPath);
4893
+ const packageDocument = xml.get(opfPath)?.doc;
4894
+ assert(packageDocument, "INVALID_EPUB", "缺少 EPUB 包文档");
4895
+ for (const item of Array.from(packageDocument.getElementsByTagNameNS("*", "item"))) {
4896
+ const href = item.getAttribute("href") ?? "";
4897
+ if (/^https:\/\//i.test(href)) continue;
4898
+ assert(expanded.has(epubPath(href, opfPath)), "INVALID_EPUB", `EPUB 缺少资源:${href}`);
4899
+ }
4900
+ await restoreFonts(expanded, xml, opfPath);
4901
+ const output = /* @__PURE__ */ new Map();
4902
+ for (const [path, bytes] of expanded) if (/\.(x?html?)$/i.test(path)) output.set(`_book/${path}`, encoder.encode(sanitizeEPUB(xml.get(path)?.text ?? "", path)));
4903
+ else if (!/\.(js|mjs)$/i.test(path)) {
4904
+ const document = xml.get(path);
4905
+ output.set(`_book/${path}`, document ? encoder.encode(document.text) : bytes);
4906
+ }
4907
+ output.set("index.html", encoder.encode(document(title, "<div id=\"viewer\"></div>", "epub", {
4908
+ title,
4909
+ opf: `_book/${opfPath}`,
4910
+ digest: digestValue
4911
+ })));
4912
+ return output;
4913
+ }
4914
+ //#endregion
4915
+ export { prepareEPUB };