@uiw/react-md-editor 4.1.1 → 4.1.2

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.
package/dist/mdeditor.js CHANGED
@@ -15,7 +15,7 @@ return /******/ (() => { // webpackBootstrap
15
15
  (module) {
16
16
 
17
17
  /**!
18
- * @uiw/copy-to-clipboard v1.0.20
18
+ * @uiw/copy-to-clipboard v1.0.21
19
19
  * Copy to clipboard.
20
20
  *
21
21
  * Copyright (c) 2026 Kenny Wang
@@ -91,1206 +91,912 @@ return /******/ (() => { // webpackBootstrap
91
91
 
92
92
  /***/ },
93
93
 
94
- /***/ 740
95
- (module) {
96
-
97
- module.exports = {
98
- trueFunc: function trueFunc(){
99
- return true;
100
- },
101
- falseFunc: function falseFunc(){
102
- return false;
103
- }
104
- };
105
-
106
- /***/ },
107
-
108
- /***/ 909
109
- (module) {
94
+ /***/ 993
95
+ (module, __webpack_exports__, __webpack_require__) {
110
96
 
111
97
  "use strict";
98
+ // ESM COMPAT FLAG
99
+ __webpack_require__.r(__webpack_exports__);
112
100
 
101
+ // EXPORTS
102
+ __webpack_require__.d(__webpack_exports__, {
103
+ EditorContext: () => (/* reexport */ EditorContext),
104
+ MarkdownUtil: () => (/* reexport */ markdownUtils_namespaceObject),
105
+ TextAreaCommandOrchestrator: () => (/* reexport */ TextAreaCommandOrchestrator),
106
+ TextAreaTextApi: () => (/* reexport */ TextAreaTextApi),
107
+ bold: () => (/* reexport */ bold),
108
+ checkedListCommand: () => (/* reexport */ checkedListCommand),
109
+ code: () => (/* reexport */ commands_code_code),
110
+ codeBlock: () => (/* reexport */ codeBlock),
111
+ codeEdit: () => (/* reexport */ codeEdit),
112
+ codeLive: () => (/* reexport */ codeLive),
113
+ codePreview: () => (/* reexport */ codePreview),
114
+ commands: () => (/* reexport */ commands_namespaceObject),
115
+ comment: () => (/* reexport */ commands_comment_comment),
116
+ "default": () => (/* binding */ src_0),
117
+ divider: () => (/* reexport */ divider),
118
+ executeCommand: () => (/* reexport */ executeCommand),
119
+ fullscreen: () => (/* reexport */ fullscreen),
120
+ getBreaksNeededForEmptyLineAfter: () => (/* reexport */ getBreaksNeededForEmptyLineAfter),
121
+ getBreaksNeededForEmptyLineBefore: () => (/* reexport */ getBreaksNeededForEmptyLineBefore),
122
+ getCommands: () => (/* reexport */ commands_getCommands),
123
+ getExtraCommands: () => (/* reexport */ getExtraCommands),
124
+ getStateFromTextArea: () => (/* reexport */ getStateFromTextArea),
125
+ getSurroundingWord: () => (/* reexport */ getSurroundingWord),
126
+ group: () => (/* reexport */ group),
127
+ handleKeyDown: () => (/* reexport */ handleKeyDown),
128
+ heading: () => (/* reexport */ title_heading),
129
+ heading1: () => (/* reexport */ heading1),
130
+ heading2: () => (/* reexport */ heading2),
131
+ heading3: () => (/* reexport */ heading3),
132
+ heading4: () => (/* reexport */ heading4),
133
+ heading5: () => (/* reexport */ heading5),
134
+ heading6: () => (/* reexport */ heading6),
135
+ headingExecute: () => (/* reexport */ headingExecute),
136
+ help: () => (/* reexport */ help),
137
+ hr: () => (/* reexport */ hr),
138
+ image: () => (/* reexport */ commands_image_image),
139
+ insertBeforeEachLine: () => (/* reexport */ insertBeforeEachLine),
140
+ insertTextAtPosition: () => (/* reexport */ insertTextAtPosition),
141
+ issue: () => (/* reexport */ issue),
142
+ italic: () => (/* reexport */ italic),
143
+ link: () => (/* reexport */ commands_link_link),
144
+ orderedListCommand: () => (/* reexport */ orderedListCommand),
145
+ quote: () => (/* reexport */ quote),
146
+ reducer: () => (/* reexport */ reducer),
147
+ selectLine: () => (/* reexport */ selectLine),
148
+ selectWord: () => (/* reexport */ selectWord),
149
+ shortcuts: () => (/* reexport */ shortcutsHandle),
150
+ strikethrough: () => (/* reexport */ strikeThrough_strikethrough),
151
+ table: () => (/* reexport */ table_table),
152
+ title: () => (/* reexport */ title),
153
+ title1: () => (/* reexport */ title1),
154
+ title2: () => (/* reexport */ title2),
155
+ title3: () => (/* reexport */ title3),
156
+ title4: () => (/* reexport */ title4),
157
+ title5: () => (/* reexport */ title5),
158
+ title6: () => (/* reexport */ title6),
159
+ unorderedListCommand: () => (/* reexport */ unorderedListCommand)
160
+ });
113
161
 
114
- var hasOwn = Object.prototype.hasOwnProperty;
115
- var toStr = Object.prototype.toString;
116
- var defineProperty = Object.defineProperty;
117
- var gOPD = Object.getOwnPropertyDescriptor;
118
-
119
- var isArray = function isArray(arr) {
120
- if (typeof Array.isArray === 'function') {
121
- return Array.isArray(arr);
122
- }
123
-
124
- return toStr.call(arr) === '[object Array]';
125
- };
126
-
127
- var isPlainObject = function isPlainObject(obj) {
128
- if (!obj || toStr.call(obj) !== '[object Object]') {
129
- return false;
130
- }
131
-
132
- var hasOwnConstructor = hasOwn.call(obj, 'constructor');
133
- var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
134
- // Not own constructor property must be Object
135
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
136
- return false;
137
- }
162
+ // NAMESPACE OBJECT (decoupled): ../node_modules/property-information/lib/util/types.js
163
+ var types_namespaceObject = {};
164
+ __webpack_require__.r(types_namespaceObject);
165
+ __webpack_require__.d(types_namespaceObject, {
166
+ boolean: () => (types_boolean),
167
+ booleanish: () => (booleanish),
168
+ commaOrSpaceSeparated: () => (commaOrSpaceSeparated),
169
+ commaSeparated: () => (commaSeparated),
170
+ number: () => (number),
171
+ overloadedBoolean: () => (overloadedBoolean),
172
+ spaceSeparated: () => (spaceSeparated)
173
+ });
138
174
 
139
- // Own properties are enumerated firstly, so to speed up,
140
- // if last one is own, then all properties are own.
141
- var key;
142
- for (key in obj) { /**/ }
175
+ // NAMESPACE OBJECT (decoupled): ../node_modules/remark-parse/node_modules/micromark/lib/constructs.js
176
+ var constructs_namespaceObject = {};
177
+ __webpack_require__.r(constructs_namespaceObject);
178
+ __webpack_require__.d(constructs_namespaceObject, {
179
+ attentionMarkers: () => (attentionMarkers),
180
+ contentInitial: () => (contentInitial),
181
+ disable: () => (disable),
182
+ document: () => (constructs_document),
183
+ flow: () => (constructs_flow),
184
+ flowInitial: () => (flowInitial),
185
+ insideSpan: () => (insideSpan),
186
+ string: () => (constructs_string),
187
+ text: () => (constructs_text)
188
+ });
143
189
 
144
- return typeof key === 'undefined' || hasOwn.call(obj, key);
145
- };
190
+ // NAMESPACE OBJECT: ./src/utils/markdownUtils.ts
191
+ var markdownUtils_namespaceObject = {};
192
+ __webpack_require__.r(markdownUtils_namespaceObject);
193
+ __webpack_require__.d(markdownUtils_namespaceObject, {
194
+ executeCommand: () => (executeCommand),
195
+ getBreaksNeededForEmptyLineAfter: () => (getBreaksNeededForEmptyLineAfter),
196
+ getBreaksNeededForEmptyLineBefore: () => (getBreaksNeededForEmptyLineBefore),
197
+ getSurroundingWord: () => (getSurroundingWord),
198
+ insertBeforeEachLine: () => (insertBeforeEachLine),
199
+ selectLine: () => (selectLine),
200
+ selectWord: () => (selectWord)
201
+ });
146
202
 
147
- // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
148
- var setProperty = function setProperty(target, options) {
149
- if (defineProperty && options.name === '__proto__') {
150
- defineProperty(target, options.name, {
151
- enumerable: true,
152
- configurable: true,
153
- value: options.newValue,
154
- writable: true
155
- });
156
- } else {
157
- target[options.name] = options.newValue;
158
- }
159
- };
203
+ // NAMESPACE OBJECT: ./src/commands/index.ts
204
+ var commands_namespaceObject = {};
205
+ __webpack_require__.r(commands_namespaceObject);
206
+ __webpack_require__.d(commands_namespaceObject, {
207
+ TextAreaCommandOrchestrator: () => (TextAreaCommandOrchestrator),
208
+ TextAreaTextApi: () => (TextAreaTextApi),
209
+ bold: () => (bold),
210
+ checkedListCommand: () => (checkedListCommand),
211
+ code: () => (commands_code_code),
212
+ codeBlock: () => (codeBlock),
213
+ codeEdit: () => (codeEdit),
214
+ codeLive: () => (codeLive),
215
+ codePreview: () => (codePreview),
216
+ comment: () => (commands_comment_comment),
217
+ divider: () => (divider),
218
+ fullscreen: () => (fullscreen),
219
+ getCommands: () => (commands_getCommands),
220
+ getExtraCommands: () => (getExtraCommands),
221
+ getStateFromTextArea: () => (getStateFromTextArea),
222
+ group: () => (group),
223
+ heading: () => (title_heading),
224
+ heading1: () => (heading1),
225
+ heading2: () => (heading2),
226
+ heading3: () => (heading3),
227
+ heading4: () => (heading4),
228
+ heading5: () => (heading5),
229
+ heading6: () => (heading6),
230
+ help: () => (help),
231
+ hr: () => (hr),
232
+ image: () => (commands_image_image),
233
+ issue: () => (issue),
234
+ italic: () => (italic),
235
+ link: () => (commands_link_link),
236
+ orderedListCommand: () => (orderedListCommand),
237
+ quote: () => (quote),
238
+ strikethrough: () => (strikeThrough_strikethrough),
239
+ table: () => (table_table),
240
+ title: () => (title),
241
+ title1: () => (title1),
242
+ title2: () => (title2),
243
+ title3: () => (title3),
244
+ title4: () => (title4),
245
+ title5: () => (title5),
246
+ title6: () => (title6),
247
+ unorderedListCommand: () => (unorderedListCommand)
248
+ });
160
249
 
161
- // Return undefined instead of __proto__ if '__proto__' is not an own property
162
- var getProperty = function getProperty(obj, name) {
163
- if (name === '__proto__') {
164
- if (!hasOwn.call(obj, name)) {
165
- return void 0;
166
- } else if (gOPD) {
167
- // In early versions of node, obj['__proto__'] is buggy when obj has
168
- // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
169
- return gOPD(obj, name).value;
170
- }
171
- }
250
+ ;// ../node_modules/@babel/runtime/helpers/esm/extends.js
251
+ function _extends() {
252
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
253
+ for (var e = 1; e < arguments.length; e++) {
254
+ var t = arguments[e];
255
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
256
+ }
257
+ return n;
258
+ }, _extends.apply(null, arguments);
259
+ }
172
260
 
173
- return obj[name];
174
- };
261
+ // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
262
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
263
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
264
+ ;// ../node_modules/unist-util-is/lib/index.js
265
+ /**
266
+ * @import {Node, Parent} from 'unist'
267
+ */
175
268
 
176
- module.exports = function extend() {
177
- var options, name, src, copy, copyIsArray, clone;
178
- var target = arguments[0];
179
- var i = 1;
180
- var length = arguments.length;
181
- var deep = false;
269
+ /**
270
+ * @template Fn
271
+ * @template Fallback
272
+ * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate
273
+ */
182
274
 
183
- // Handle a deep copy situation
184
- if (typeof target === 'boolean') {
185
- deep = target;
186
- target = arguments[1] || {};
187
- // skip the boolean and the target
188
- i = 2;
189
- }
190
- if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
191
- target = {};
192
- }
275
+ /**
276
+ * @callback Check
277
+ * Check that an arbitrary value is a node.
278
+ * @param {unknown} this
279
+ * The given context.
280
+ * @param {unknown} [node]
281
+ * Anything (typically a node).
282
+ * @param {number | null | undefined} [index]
283
+ * The node’s position in its parent.
284
+ * @param {Parent | null | undefined} [parent]
285
+ * The node’s parent.
286
+ * @returns {boolean}
287
+ * Whether this is a node and passes a test.
288
+ *
289
+ * @typedef {Record<string, unknown> | Node} Props
290
+ * Object to check for equivalence.
291
+ *
292
+ * Note: `Node` is included as it is common but is not indexable.
293
+ *
294
+ * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
295
+ * Check for an arbitrary node.
296
+ *
297
+ * @callback TestFunction
298
+ * Check if a node passes a test.
299
+ * @param {unknown} this
300
+ * The given context.
301
+ * @param {Node} node
302
+ * A node.
303
+ * @param {number | undefined} [index]
304
+ * The node’s position in its parent.
305
+ * @param {Parent | undefined} [parent]
306
+ * The node’s parent.
307
+ * @returns {boolean | undefined | void}
308
+ * Whether this node passes the test.
309
+ *
310
+ * Note: `void` is included until TS sees no return as `undefined`.
311
+ */
193
312
 
194
- for (; i < length; ++i) {
195
- options = arguments[i];
196
- // Only deal with non-null/undefined values
197
- if (options != null) {
198
- // Extend the base object
199
- for (name in options) {
200
- src = getProperty(target, name);
201
- copy = getProperty(options, name);
313
+ /**
314
+ * Check if `node` is a `Node` and whether it passes the given test.
315
+ *
316
+ * @param {unknown} node
317
+ * Thing to check, typically `Node`.
318
+ * @param {Test} test
319
+ * A check for a specific node.
320
+ * @param {number | null | undefined} index
321
+ * The node’s position in its parent.
322
+ * @param {Parent | null | undefined} parent
323
+ * The node’s parent.
324
+ * @param {unknown} context
325
+ * Context object (`this`) to pass to `test` functions.
326
+ * @returns {boolean}
327
+ * Whether `node` is a node and passes a test.
328
+ */
329
+ const is =
330
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
331
+ /**
332
+ * @type {(
333
+ * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
334
+ * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
335
+ * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
336
+ * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
337
+ * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
338
+ * ((node?: null | undefined) => false) &
339
+ * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
340
+ * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)
341
+ * )}
342
+ */
343
+ (
344
+ /**
345
+ * @param {unknown} [node]
346
+ * @param {Test} [test]
347
+ * @param {number | null | undefined} [index]
348
+ * @param {Parent | null | undefined} [parent]
349
+ * @param {unknown} [context]
350
+ * @returns {boolean}
351
+ */
352
+ // eslint-disable-next-line max-params
353
+ function (node, test, index, parent, context) {
354
+ const check = convert(test)
202
355
 
203
- // Prevent never-ending loop
204
- if (target !== copy) {
205
- // Recurse if we're merging plain objects or arrays
206
- if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
207
- if (copyIsArray) {
208
- copyIsArray = false;
209
- clone = src && isArray(src) ? src : [];
210
- } else {
211
- clone = src && isPlainObject(src) ? src : {};
212
- }
356
+ if (
357
+ index !== undefined &&
358
+ index !== null &&
359
+ (typeof index !== 'number' ||
360
+ index < 0 ||
361
+ index === Number.POSITIVE_INFINITY)
362
+ ) {
363
+ throw new Error('Expected positive finite index')
364
+ }
213
365
 
214
- // Never move original objects, clone them
215
- setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
366
+ if (
367
+ parent !== undefined &&
368
+ parent !== null &&
369
+ (!is(parent) || !parent.children)
370
+ ) {
371
+ throw new Error('Expected parent node')
372
+ }
216
373
 
217
- // Don't bring in undefined values
218
- } else if (typeof copy !== 'undefined') {
219
- setProperty(target, { name: name, newValue: copy });
220
- }
221
- }
222
- }
223
- }
224
- }
374
+ if (
375
+ (parent === undefined || parent === null) !==
376
+ (index === undefined || index === null)
377
+ ) {
378
+ throw new Error('Expected both parent and index')
379
+ }
225
380
 
226
- // Return the modified object
227
- return target;
228
- };
381
+ return looksLikeANode(node)
382
+ ? check.call(context, node, index, parent)
383
+ : false
384
+ }
385
+ )
229
386
 
387
+ /**
388
+ * Generate an assertion from a test.
389
+ *
390
+ * Useful if you’re going to test many nodes, for example when creating a
391
+ * utility where something else passes a compatible test.
392
+ *
393
+ * The created function is a bit faster because it expects valid input only:
394
+ * a `node`, `index`, and `parent`.
395
+ *
396
+ * @param {Test} test
397
+ * * when nullish, checks if `node` is a `Node`.
398
+ * * when `string`, works like passing `(node) => node.type === test`.
399
+ * * when `function` checks if function passed the node is true.
400
+ * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
401
+ * * when `array`, checks if any one of the subtests pass.
402
+ * @returns {Check}
403
+ * An assertion.
404
+ */
405
+ const convert =
406
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
407
+ /**
408
+ * @type {(
409
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
410
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
411
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
412
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
413
+ * ((test?: Test) => Check)
414
+ * )}
415
+ */
416
+ (
417
+ /**
418
+ * @param {Test} [test]
419
+ * @returns {Check}
420
+ */
421
+ function (test) {
422
+ if (test === null || test === undefined) {
423
+ return ok
424
+ }
230
425
 
231
- /***/ },
426
+ if (typeof test === 'function') {
427
+ return castFactory(test)
428
+ }
232
429
 
233
- /***/ 689
234
- (module) {
430
+ if (typeof test === 'object') {
431
+ return Array.isArray(test)
432
+ ? anyFactory(test)
433
+ : // Cast because `ReadonlyArray` goes into the above but `isArray`
434
+ // narrows to `Array`.
435
+ propertiesFactory(/** @type {Props} */ (test))
436
+ }
235
437
 
236
- "use strict";
438
+ if (typeof test === 'string') {
439
+ return typeFactory(test)
440
+ }
237
441
 
442
+ throw new Error('Expected function, string, or object as test')
443
+ }
444
+ )
238
445
 
239
- // http://www.w3.org/TR/CSS21/grammar.html
240
- // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
241
- var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
446
+ /**
447
+ * @param {Array<Props | TestFunction | string>} tests
448
+ * @returns {Check}
449
+ */
450
+ function anyFactory(tests) {
451
+ /** @type {Array<Check>} */
452
+ const checks = []
453
+ let index = -1
242
454
 
243
- var NEWLINE_REGEX = /\n/g;
244
- var WHITESPACE_REGEX = /^\s*/;
455
+ while (++index < tests.length) {
456
+ checks[index] = convert(tests[index])
457
+ }
245
458
 
246
- // declaration
247
- var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
248
- var COLON_REGEX = /^:\s*/;
249
- var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
250
- var SEMICOLON_REGEX = /^[;\s]*/;
459
+ return castFactory(any)
251
460
 
252
- // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
253
- var TRIM_REGEX = /^\s+|\s+$/g;
461
+ /**
462
+ * @this {unknown}
463
+ * @type {TestFunction}
464
+ */
465
+ function any(...parameters) {
466
+ let index = -1
254
467
 
255
- // strings
256
- var NEWLINE = '\n';
257
- var FORWARD_SLASH = '/';
258
- var ASTERISK = '*';
259
- var EMPTY_STRING = '';
468
+ while (++index < checks.length) {
469
+ if (checks[index].apply(this, parameters)) return true
470
+ }
260
471
 
261
- // types
262
- var TYPE_COMMENT = 'comment';
263
- var TYPE_DECLARATION = 'declaration';
472
+ return false
473
+ }
474
+ }
264
475
 
265
476
  /**
266
- * @param {String} style
267
- * @param {Object} [options]
268
- * @return {Object[]}
269
- * @throws {TypeError}
270
- * @throws {Error}
477
+ * Turn an object into a test for a node with a certain fields.
478
+ *
479
+ * @param {Props} check
480
+ * @returns {Check}
271
481
  */
272
- function index (style, options) {
273
- if (typeof style !== 'string') {
274
- throw new TypeError('First argument must be a string');
275
- }
276
-
277
- if (!style) return [];
482
+ function propertiesFactory(check) {
483
+ const checkAsRecord = /** @type {Record<string, unknown>} */ (check)
278
484
 
279
- options = options || {};
485
+ return castFactory(all)
280
486
 
281
487
  /**
282
- * Positional.
283
- */
284
- var lineno = 1;
285
- var column = 1;
286
-
287
- /**
288
- * Update lineno and column based on `str`.
289
- *
290
- * @param {String} str
291
- */
292
- function updatePosition(str) {
293
- var lines = str.match(NEWLINE_REGEX);
294
- if (lines) lineno += lines.length;
295
- var i = str.lastIndexOf(NEWLINE);
296
- column = ~i ? str.length - i : column + str.length;
297
- }
298
-
299
- /**
300
- * Mark position and patch `node.position`.
301
- *
302
- * @return {Function}
303
- */
304
- function position() {
305
- var start = { line: lineno, column: column };
306
- return function (node) {
307
- node.position = new Position(start);
308
- whitespace();
309
- return node;
310
- };
311
- }
312
-
313
- /**
314
- * Store position information for a node.
315
- *
316
- * @constructor
317
- * @property {Object} start
318
- * @property {Object} end
319
- * @property {undefined|String} source
320
- */
321
- function Position(start) {
322
- this.start = start;
323
- this.end = { line: lineno, column: column };
324
- this.source = options.source;
325
- }
326
-
327
- /**
328
- * Non-enumerable source string.
488
+ * @param {Node} node
489
+ * @returns {boolean}
329
490
  */
330
- Position.prototype.content = style;
491
+ function all(node) {
492
+ const nodeAsRecord = /** @type {Record<string, unknown>} */ (
493
+ /** @type {unknown} */ (node)
494
+ )
331
495
 
332
- /**
333
- * Error `msg`.
334
- *
335
- * @param {String} msg
336
- * @throws {Error}
337
- */
338
- function error(msg) {
339
- var err = new Error(
340
- options.source + ':' + lineno + ':' + column + ': ' + msg
341
- );
342
- err.reason = msg;
343
- err.filename = options.source;
344
- err.line = lineno;
345
- err.column = column;
346
- err.source = style;
496
+ /** @type {string} */
497
+ let key
347
498
 
348
- if (options.silent) ; else {
349
- throw err;
499
+ for (key in check) {
500
+ if (nodeAsRecord[key] !== checkAsRecord[key]) return false
350
501
  }
351
- }
352
-
353
- /**
354
- * Match `re` and return captures.
355
- *
356
- * @param {RegExp} re
357
- * @return {undefined|Array}
358
- */
359
- function match(re) {
360
- var m = re.exec(style);
361
- if (!m) return;
362
- var str = m[0];
363
- updatePosition(str);
364
- style = style.slice(str.length);
365
- return m;
366
- }
367
502
 
368
- /**
369
- * Parse whitespace.
370
- */
371
- function whitespace() {
372
- match(WHITESPACE_REGEX);
503
+ return true
373
504
  }
505
+ }
374
506
 
375
- /**
376
- * Parse comments.
377
- *
378
- * @param {Object[]} [rules]
379
- * @return {Object[]}
380
- */
381
- function comments(rules) {
382
- var c;
383
- rules = rules || [];
384
- while ((c = comment())) {
385
- if (c !== false) {
386
- rules.push(c);
387
- }
388
- }
389
- return rules;
390
- }
507
+ /**
508
+ * Turn a string into a test for a node with a certain type.
509
+ *
510
+ * @param {string} check
511
+ * @returns {Check}
512
+ */
513
+ function typeFactory(check) {
514
+ return castFactory(type)
391
515
 
392
516
  /**
393
- * Parse comment.
394
- *
395
- * @return {Object}
396
- * @throws {Error}
517
+ * @param {Node} node
397
518
  */
398
- function comment() {
399
- var pos = position();
400
- if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
401
-
402
- var i = 2;
403
- while (
404
- EMPTY_STRING != style.charAt(i) &&
405
- (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
406
- ) {
407
- ++i;
408
- }
409
- i += 2;
410
-
411
- if (EMPTY_STRING === style.charAt(i - 1)) {
412
- return error('End of comment missing');
413
- }
414
-
415
- var str = style.slice(2, i - 2);
416
- column += 2;
417
- updatePosition(str);
418
- style = style.slice(i);
419
- column += 2;
420
-
421
- return pos({
422
- type: TYPE_COMMENT,
423
- comment: str
424
- });
519
+ function type(node) {
520
+ return node && node.type === check
425
521
  }
522
+ }
426
523
 
427
- /**
428
- * Parse declaration.
429
- *
430
- * @return {Object}
431
- * @throws {Error}
432
- */
433
- function declaration() {
434
- var pos = position();
435
-
436
- // prop
437
- var prop = match(PROPERTY_REGEX);
438
- if (!prop) return;
439
- comment();
440
-
441
- // :
442
- if (!match(COLON_REGEX)) return error("property missing ':'");
443
-
444
- // val
445
- var val = match(VALUE_REGEX);
446
-
447
- var ret = pos({
448
- type: TYPE_DECLARATION,
449
- property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
450
- value: val
451
- ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
452
- : EMPTY_STRING
453
- });
454
-
455
- // ;
456
- match(SEMICOLON_REGEX);
457
-
458
- return ret;
459
- }
524
+ /**
525
+ * Turn a custom test into a test for a node that passes that test.
526
+ *
527
+ * @param {TestFunction} testFunction
528
+ * @returns {Check}
529
+ */
530
+ function castFactory(testFunction) {
531
+ return check
460
532
 
461
533
  /**
462
- * Parse declarations.
463
- *
464
- * @return {Object[]}
534
+ * @this {unknown}
535
+ * @type {Check}
465
536
  */
466
- function declarations() {
467
- var decls = [];
468
-
469
- comments(decls);
470
-
471
- // declarations
472
- var decl;
473
- while ((decl = declaration())) {
474
- if (decl !== false) {
475
- decls.push(decl);
476
- comments(decls);
477
- }
478
- }
479
-
480
- return decls;
537
+ function check(value, index, parent) {
538
+ return Boolean(
539
+ looksLikeANode(value) &&
540
+ testFunction.call(
541
+ this,
542
+ value,
543
+ typeof index === 'number' ? index : undefined,
544
+ parent || undefined
545
+ )
546
+ )
481
547
  }
548
+ }
482
549
 
483
- whitespace();
484
- return declarations();
550
+ function ok() {
551
+ return true
485
552
  }
486
553
 
487
554
  /**
488
- * Trim `str`.
489
- *
490
- * @param {String} str
491
- * @return {String}
555
+ * @param {unknown} value
556
+ * @returns {value is Node}
492
557
  */
493
- function trim(str) {
494
- return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
558
+ function looksLikeANode(value) {
559
+ return value !== null && typeof value === 'object' && 'type' in value
495
560
  }
496
561
 
497
- module.exports = index;
498
- //# sourceMappingURL=index.js.map
562
+ ;// ../node_modules/unist-util-visit-parents/lib/color.js
563
+ /**
564
+ * @param {string} d
565
+ * @returns {string}
566
+ */
567
+ function color(d) {
568
+ return d
569
+ }
499
570
 
571
+ ;// ../node_modules/unist-util-visit-parents/lib/index.js
572
+ /**
573
+ * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
574
+ */
500
575
 
501
- /***/ },
576
+ /**
577
+ * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
578
+ * Test from `unist-util-is`.
579
+ *
580
+ * Note: we have remove and add `undefined`, because otherwise when generating
581
+ * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
582
+ * which doesn’t work when publishing on npm.
583
+ */
502
584
 
503
- /***/ 934
504
- (module, exports) {
585
+ /**
586
+ * @typedef {(
587
+ * Fn extends (value: any) => value is infer Thing
588
+ * ? Thing
589
+ * : Fallback
590
+ * )} Predicate
591
+ * Get the value of a type guard `Fn`.
592
+ * @template Fn
593
+ * Value; typically function that is a type guard (such as `(x): x is Y`).
594
+ * @template Fallback
595
+ * Value to yield if `Fn` is not a type guard.
596
+ */
505
597
 
506
598
  /**
507
- * @param {string} string The string to parse
508
- * @returns {Array<number>} Returns an energetic array.
599
+ * @typedef {(
600
+ * Check extends null | undefined // No test.
601
+ * ? Value
602
+ * : Value extends {type: Check} // String (type) test.
603
+ * ? Value
604
+ * : Value extends Check // Partial test.
605
+ * ? Value
606
+ * : Check extends Function // Function test.
607
+ * ? Predicate<Check, Value> extends Value
608
+ * ? Predicate<Check, Value>
609
+ * : never
610
+ * : never // Some other test?
611
+ * )} MatchesOne
612
+ * Check whether a node matches a primitive check in the type system.
613
+ * @template Value
614
+ * Value; typically unist `Node`.
615
+ * @template Check
616
+ * Value; typically `unist-util-is`-compatible test, but not arrays.
509
617
  */
510
- function parsePart(string) {
511
- let res = [];
512
- let m;
513
618
 
514
- for (let str of string.split(",").map((str) => str.trim())) {
515
- // just a number
516
- if (/^-?\d+$/.test(str)) {
517
- res.push(parseInt(str, 10));
518
- } else if (
519
- (m = str.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/))
520
- ) {
521
- // 1-5 or 1..5 (equivalent) or 1...5 (doesn't include 5)
522
- let [_, lhs, sep, rhs] = m;
619
+ /**
620
+ * @typedef {(
621
+ * Check extends ReadonlyArray<infer T>
622
+ * ? MatchesOne<Value, T>
623
+ * : Check extends Array<infer T>
624
+ * ? MatchesOne<Value, T>
625
+ * : MatchesOne<Value, Check>
626
+ * )} Matches
627
+ * Check whether a node matches a check in the type system.
628
+ * @template Value
629
+ * Value; typically unist `Node`.
630
+ * @template Check
631
+ * Value; typically `unist-util-is`-compatible test.
632
+ */
523
633
 
524
- if (lhs && rhs) {
525
- lhs = parseInt(lhs);
526
- rhs = parseInt(rhs);
527
- const incr = lhs < rhs ? 1 : -1;
634
+ /**
635
+ * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint
636
+ * Number; capped reasonably.
637
+ */
528
638
 
529
- // Make it inclusive by moving the right 'stop-point' away by one.
530
- if (sep === "-" || sep === ".." || sep === "\u2025") rhs += incr;
639
+ /**
640
+ * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment
641
+ * Increment a number in the type system.
642
+ * @template {Uint} [I=0]
643
+ * Index.
644
+ */
531
645
 
532
- for (let i = lhs; i !== rhs; i += incr) res.push(i);
533
- }
534
- }
535
- }
646
+ /**
647
+ * @typedef {(
648
+ * Node extends UnistParent
649
+ * ? Node extends {children: Array<infer Children>}
650
+ * ? Child extends Children ? Node : never
651
+ * : never
652
+ * : never
653
+ * )} InternalParent
654
+ * Collect nodes that can be parents of `Child`.
655
+ * @template {UnistNode} Node
656
+ * All node types in a tree.
657
+ * @template {UnistNode} Child
658
+ * Node to search for.
659
+ */
536
660
 
537
- return res;
538
- }
661
+ /**
662
+ * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent
663
+ * Collect nodes in `Tree` that can be parents of `Child`.
664
+ * @template {UnistNode} Tree
665
+ * All node types in a tree.
666
+ * @template {UnistNode} Child
667
+ * Node to search for.
668
+ */
539
669
 
540
- exports["default"] = parsePart;
541
- module.exports = parsePart;
670
+ /**
671
+ * @typedef {(
672
+ * Depth extends Max
673
+ * ? never
674
+ * :
675
+ * | InternalParent<Node, Child>
676
+ * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>
677
+ * )} InternalAncestor
678
+ * Collect nodes in `Tree` that can be ancestors of `Child`.
679
+ * @template {UnistNode} Node
680
+ * All node types in a tree.
681
+ * @template {UnistNode} Child
682
+ * Node to search for.
683
+ * @template {Uint} [Max=10]
684
+ * Max; searches up to this depth.
685
+ * @template {Uint} [Depth=0]
686
+ * Current depth.
687
+ */
542
688
 
689
+ /**
690
+ * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor
691
+ * Collect nodes in `Tree` that can be ancestors of `Child`.
692
+ * @template {UnistNode} Tree
693
+ * All node types in a tree.
694
+ * @template {UnistNode} Child
695
+ * Node to search for.
696
+ */
543
697
 
544
- /***/ },
698
+ /**
699
+ * @typedef {(
700
+ * Tree extends UnistParent
701
+ * ? Depth extends Max
702
+ * ? Tree
703
+ * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
704
+ * : Tree
705
+ * )} InclusiveDescendant
706
+ * Collect all (inclusive) descendants of `Tree`.
707
+ *
708
+ * > 👉 **Note**: for performance reasons, this seems to be the fastest way to
709
+ * > recurse without actually running into an infinite loop, which the
710
+ * > previous version did.
711
+ * >
712
+ * > Practically, a max of `2` is typically enough assuming a `Root` is
713
+ * > passed, but it doesn’t improve performance.
714
+ * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.
715
+ * > Using up to `10` doesn’t hurt or help either.
716
+ * @template {UnistNode} Tree
717
+ * Tree type.
718
+ * @template {Uint} [Max=10]
719
+ * Max; searches up to this depth.
720
+ * @template {Uint} [Depth=0]
721
+ * Current depth.
722
+ */
545
723
 
546
- /***/ 192
547
- (__unused_webpack_module, exports, __webpack_require__) {
724
+ /**
725
+ * @typedef {'skip' | boolean} Action
726
+ * Union of the action types.
727
+ *
728
+ * @typedef {number} Index
729
+ * Move to the sibling at `index` next (after node itself is completely
730
+ * traversed).
731
+ *
732
+ * Useful if mutating the tree, such as removing the node the visitor is
733
+ * currently on, or any of its previous siblings.
734
+ * Results less than 0 or greater than or equal to `children.length` stop
735
+ * traversing the parent.
736
+ *
737
+ * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple
738
+ * List with one or two values, the first an action, the second an index.
739
+ *
740
+ * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult
741
+ * Any value that can be returned from a visitor.
742
+ */
548
743
 
549
- "use strict";
550
744
  /**
551
- * @license React
552
- * react-jsx-runtime.production.min.js
745
+ * @callback Visitor
746
+ * Handle a node (matching `test`, if given).
553
747
  *
554
- * Copyright (c) Facebook, Inc. and its affiliates.
748
+ * Visitors are free to transform `node`.
749
+ * They can also transform the parent of node (the last of `ancestors`).
555
750
  *
556
- * This source code is licensed under the MIT license found in the
557
- * LICENSE file in the root directory of this source tree.
751
+ * Replacing `node` itself, if `SKIP` is not returned, still causes its
752
+ * descendants to be walked (which is a bug).
753
+ *
754
+ * When adding or removing previous siblings of `node` (or next siblings, in
755
+ * case of reverse), the `Visitor` should return a new `Index` to specify the
756
+ * sibling to traverse after `node` is traversed.
757
+ * Adding or removing next siblings of `node` (or previous siblings, in case
758
+ * of reverse) is handled as expected without needing to return a new `Index`.
759
+ *
760
+ * Removing the children property of an ancestor still results in them being
761
+ * traversed.
762
+ * @param {Visited} node
763
+ * Found node.
764
+ * @param {Array<VisitedParents>} ancestors
765
+ * Ancestors of `node`.
766
+ * @returns {VisitorResult}
767
+ * What to do next.
768
+ *
769
+ * An `Index` is treated as a tuple of `[CONTINUE, Index]`.
770
+ * An `Action` is treated as a tuple of `[Action]`.
771
+ *
772
+ * Passing a tuple back only makes sense if the `Action` is `SKIP`.
773
+ * When the `Action` is `EXIT`, that action can be returned.
774
+ * When the `Action` is `CONTINUE`, `Index` can be returned.
775
+ * @template {UnistNode} [Visited=UnistNode]
776
+ * Visited node type.
777
+ * @template {UnistParent} [VisitedParents=UnistParent]
778
+ * Ancestor type.
558
779
  */
559
- var f=__webpack_require__(442),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
560
- function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
561
780
 
781
+ /**
782
+ * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor
783
+ * Build a typed `Visitor` function from a tree and a test.
784
+ *
785
+ * It will infer which values are passed as `node` and which as `parents`.
786
+ * @template {UnistNode} [Tree=UnistNode]
787
+ * Tree type.
788
+ * @template {Test} [Check=Test]
789
+ * Test type.
790
+ */
562
791
 
563
- /***/ },
564
792
 
565
- /***/ 540
566
- (module, __unused_webpack_exports, __webpack_require__) {
567
793
 
568
- "use strict";
569
794
 
795
+ /** @type {Readonly<ActionTuple>} */
796
+ const empty = []
570
797
 
571
- if (true) {
572
- module.exports = __webpack_require__(192);
573
- } else // removed by dead control flow
574
- {}
798
+ /**
799
+ * Continue traversing as normal.
800
+ */
801
+ const CONTINUE = true
575
802
 
803
+ /**
804
+ * Stop traversing immediately.
805
+ */
806
+ const EXIT = false
576
807
 
577
- /***/ },
578
-
579
- /***/ 321
580
- (module, __unused_webpack_exports, __webpack_require__) {
581
-
582
- "use strict";
808
+ /**
809
+ * Do not traverse this node’s children.
810
+ */
811
+ const SKIP = 'skip'
583
812
 
584
- var __importDefault = (this && this.__importDefault) || function (mod) {
585
- return (mod && mod.__esModule) ? mod : { "default": mod };
586
- };
587
- var style_to_object_1 = __importDefault(__webpack_require__(857));
588
- var utilities_1 = __webpack_require__(969);
589
813
  /**
590
- * Parses CSS inline style to JavaScript object (camelCased).
814
+ * Visit nodes, with ancestral information.
815
+ *
816
+ * This algorithm performs *depth-first* *tree traversal* in *preorder*
817
+ * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
818
+ *
819
+ * You can choose for which nodes `visitor` is called by passing a `test`.
820
+ * For complex tests, you should test yourself in `visitor`, as it will be
821
+ * faster and will have improved type information.
822
+ *
823
+ * Walking the tree is an intensive task.
824
+ * Make use of the return values of the visitor when possible.
825
+ * Instead of walking a tree multiple times, walk it once, use `unist-util-is`
826
+ * to check if a node matches, and then perform different operations.
827
+ *
828
+ * You can change the tree.
829
+ * See `Visitor` for more info.
830
+ *
831
+ * @overload
832
+ * @param {Tree} tree
833
+ * @param {Check} check
834
+ * @param {BuildVisitor<Tree, Check>} visitor
835
+ * @param {boolean | null | undefined} [reverse]
836
+ * @returns {undefined}
837
+ *
838
+ * @overload
839
+ * @param {Tree} tree
840
+ * @param {BuildVisitor<Tree>} visitor
841
+ * @param {boolean | null | undefined} [reverse]
842
+ * @returns {undefined}
843
+ *
844
+ * @param {UnistNode} tree
845
+ * Tree to traverse.
846
+ * @param {Visitor | Test} test
847
+ * `unist-util-is`-compatible test
848
+ * @param {Visitor | boolean | null | undefined} [visitor]
849
+ * Handle each node.
850
+ * @param {boolean | null | undefined} [reverse]
851
+ * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
852
+ * @returns {undefined}
853
+ * Nothing.
854
+ *
855
+ * @template {UnistNode} Tree
856
+ * Node type.
857
+ * @template {Test} Check
858
+ * `unist-util-is`-compatible test.
591
859
  */
592
- function StyleToJS(style, options) {
593
- var output = {};
594
- if (!style || typeof style !== 'string') {
595
- return output;
596
- }
597
- (0, style_to_object_1.default)(style, function (property, value) {
598
- // skip CSS comment
599
- if (property && value) {
600
- output[(0, utilities_1.camelCase)(property, options)] = value;
601
- }
602
- });
603
- return output;
604
- }
605
- StyleToJS.default = StyleToJS;
606
- module.exports = StyleToJS;
607
- //# sourceMappingURL=index.js.map
860
+ function visitParents(tree, test, visitor, reverse) {
861
+ /** @type {Test} */
862
+ let check
608
863
 
609
- /***/ },
864
+ if (typeof test === 'function' && typeof visitor !== 'function') {
865
+ reverse = visitor
866
+ // @ts-expect-error no visitor given, so `visitor` is test.
867
+ visitor = test
868
+ } else {
869
+ // @ts-expect-error visitor given, so `test` isn’t a visitor.
870
+ check = test
871
+ }
610
872
 
611
- /***/ 969
612
- (__unused_webpack_module, exports) {
873
+ const is = convert(check)
874
+ const step = reverse ? -1 : 1
613
875
 
614
- "use strict";
876
+ factory(tree, undefined, [])()
615
877
 
616
- Object.defineProperty(exports, "__esModule", ({ value: true }));
617
- exports.camelCase = void 0;
618
- var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
619
- var HYPHEN_REGEX = /-([a-z])/g;
620
- var NO_HYPHEN_REGEX = /^[^-]+$/;
621
- var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
622
- var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
623
- /**
624
- * Checks whether to skip camelCase.
625
- */
626
- var skipCamelCase = function (property) {
627
- return !property ||
628
- NO_HYPHEN_REGEX.test(property) ||
629
- CUSTOM_PROPERTY_REGEX.test(property);
630
- };
631
- /**
632
- * Replacer that capitalizes first character.
633
- */
634
- var capitalize = function (match, character) {
635
- return character.toUpperCase();
636
- };
637
- /**
638
- * Replacer that removes beginning hyphen of vendor prefix property.
639
- */
640
- var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
641
- /**
642
- * CamelCases a CSS property.
643
- */
644
- var camelCase = function (property, options) {
645
- if (options === void 0) { options = {}; }
646
- if (skipCamelCase(property)) {
647
- return property;
648
- }
649
- property = property.toLowerCase();
650
- if (options.reactCompat) {
651
- // `-ms` vendor prefix should not be capitalized
652
- property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
653
- }
654
- else {
655
- // for non-React, remove first hyphen so vendor prefix is not capitalized
656
- property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
878
+ /**
879
+ * @param {UnistNode} node
880
+ * @param {number | undefined} index
881
+ * @param {Array<UnistParent>} parents
882
+ */
883
+ function factory(node, index, parents) {
884
+ const value = /** @type {Record<string, unknown>} */ (
885
+ node && typeof node === 'object' ? node : {}
886
+ )
887
+
888
+ if (typeof value.type === 'string') {
889
+ const name =
890
+ // `hast`
891
+ typeof value.tagName === 'string'
892
+ ? value.tagName
893
+ : // `xast`
894
+ typeof value.name === 'string'
895
+ ? value.name
896
+ : undefined
897
+
898
+ Object.defineProperty(visit, 'name', {
899
+ value:
900
+ 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'
901
+ })
657
902
  }
658
- return property.replace(HYPHEN_REGEX, capitalize);
659
- };
660
- exports.camelCase = camelCase;
661
- //# sourceMappingURL=utilities.js.map
662
903
 
663
- /***/ },
904
+ return visit
664
905
 
665
- /***/ 857
666
- (__unused_webpack_module, exports, __webpack_require__) {
906
+ function visit() {
907
+ /** @type {Readonly<ActionTuple>} */
908
+ let result = empty
909
+ /** @type {Readonly<ActionTuple>} */
910
+ let subresult
911
+ /** @type {number} */
912
+ let offset
913
+ /** @type {Array<UnistParent>} */
914
+ let grandparents
667
915
 
668
- "use strict";
916
+ if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
917
+ // @ts-expect-error: `visitor` is now a visitor.
918
+ result = toResult(visitor(node, parents))
669
919
 
670
- var __importDefault = (this && this.__importDefault) || function (mod) {
671
- return (mod && mod.__esModule) ? mod : { "default": mod };
672
- };
673
- Object.defineProperty(exports, "__esModule", ({ value: true }));
674
- exports["default"] = StyleToObject;
675
- const inline_style_parser_1 = __importDefault(__webpack_require__(689));
676
- /**
677
- * Parses inline style to object.
678
- *
679
- * @param style - Inline style.
680
- * @param iterator - Iterator.
681
- * @returns - Style object or null.
682
- *
683
- * @example Parsing inline style to object:
684
- *
685
- * ```js
686
- * import parse from 'style-to-object';
687
- * parse('line-height: 42;'); // { 'line-height': '42' }
688
- * ```
689
- */
690
- function StyleToObject(style, iterator) {
691
- let styleObject = null;
692
- if (!style || typeof style !== 'string') {
693
- return styleObject;
694
- }
695
- const declarations = (0, inline_style_parser_1.default)(style);
696
- const hasIterator = typeof iterator === 'function';
697
- declarations.forEach((declaration) => {
698
- if (declaration.type !== 'declaration') {
699
- return;
700
- }
701
- const { property, value } = declaration;
702
- if (hasIterator) {
703
- iterator(property, value, declaration);
704
- }
705
- else if (value) {
706
- styleObject = styleObject || {};
707
- styleObject[property] = value;
920
+ if (result[0] === EXIT) {
921
+ return result
708
922
  }
709
- });
710
- return styleObject;
711
- }
712
- //# sourceMappingURL=index.js.map
713
-
714
- /***/ },
923
+ }
715
924
 
716
- /***/ 442
717
- (module) {
925
+ if ('children' in node && node.children) {
926
+ const nodeAsParent = /** @type {UnistParent} */ (node)
718
927
 
719
- "use strict";
720
- module.exports = __WEBPACK_EXTERNAL_MODULE__442__;
928
+ if (nodeAsParent.children && result[0] !== SKIP) {
929
+ offset = (reverse ? nodeAsParent.children.length : -1) + step
930
+ grandparents = parents.concat(nodeAsParent)
721
931
 
722
- /***/ }
932
+ while (offset > -1 && offset < nodeAsParent.children.length) {
933
+ const child = nodeAsParent.children[offset]
723
934
 
724
- /******/ });
725
- /************************************************************************/
726
- /******/ // The module cache
727
- /******/ var __webpack_module_cache__ = {};
728
- /******/
729
- /******/ // The require function
730
- /******/ function __webpack_require__(moduleId) {
731
- /******/ // Check if module is in cache
732
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
733
- /******/ if (cachedModule !== undefined) {
734
- /******/ return cachedModule.exports;
735
- /******/ }
736
- /******/ // Create a new module (and put it into the cache)
737
- /******/ var module = __webpack_module_cache__[moduleId] = {
738
- /******/ // no module.id needed
739
- /******/ // no module.loaded needed
740
- /******/ exports: {}
741
- /******/ };
742
- /******/
743
- /******/ // Execute the module function
744
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
745
- /******/
746
- /******/ // Return the exports of the module
747
- /******/ return module.exports;
748
- /******/ }
749
- /******/
750
- /************************************************************************/
751
- /******/ /* webpack/runtime/compat get default export */
752
- /******/ (() => {
753
- /******/ // getDefaultExport function for compatibility with non-harmony modules
754
- /******/ __webpack_require__.n = (module) => {
755
- /******/ var getter = module && module.__esModule ?
756
- /******/ () => (module['default']) :
757
- /******/ () => (module);
758
- /******/ __webpack_require__.d(getter, { a: getter });
759
- /******/ return getter;
760
- /******/ };
761
- /******/ })();
762
- /******/
763
- /******/ /* webpack/runtime/define property getters */
764
- /******/ (() => {
765
- /******/ // define getter functions for harmony exports
766
- /******/ __webpack_require__.d = (exports, definition) => {
767
- /******/ for(var key in definition) {
768
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
769
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
770
- /******/ }
771
- /******/ }
772
- /******/ };
773
- /******/ })();
774
- /******/
775
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
776
- /******/ (() => {
777
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
778
- /******/ })();
779
- /******/
780
- /******/ /* webpack/runtime/make namespace object */
781
- /******/ (() => {
782
- /******/ // define __esModule on exports
783
- /******/ __webpack_require__.r = (exports) => {
784
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
785
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
786
- /******/ }
787
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
788
- /******/ };
789
- /******/ })();
790
- /******/
791
- /************************************************************************/
792
- var __webpack_exports__ = {};
793
- // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
794
- (() => {
795
- "use strict";
796
- // ESM COMPAT FLAG
797
- __webpack_require__.r(__webpack_exports__);
935
+ subresult = factory(child, offset, grandparents)()
798
936
 
799
- // EXPORTS
800
- __webpack_require__.d(__webpack_exports__, {
801
- EditorContext: () => (/* reexport */ EditorContext),
802
- MarkdownUtil: () => (/* reexport */ markdownUtils_namespaceObject),
803
- TextAreaCommandOrchestrator: () => (/* reexport */ TextAreaCommandOrchestrator),
804
- TextAreaTextApi: () => (/* reexport */ TextAreaTextApi),
805
- bold: () => (/* reexport */ bold),
806
- checkedListCommand: () => (/* reexport */ checkedListCommand),
807
- code: () => (/* reexport */ commands_code_code),
808
- codeBlock: () => (/* reexport */ codeBlock),
809
- codeEdit: () => (/* reexport */ codeEdit),
810
- codeLive: () => (/* reexport */ codeLive),
811
- codePreview: () => (/* reexport */ codePreview),
812
- commands: () => (/* reexport */ commands_namespaceObject),
813
- comment: () => (/* reexport */ commands_comment_comment),
814
- "default": () => (/* binding */ src_0),
815
- divider: () => (/* reexport */ divider),
816
- executeCommand: () => (/* reexport */ executeCommand),
817
- fullscreen: () => (/* reexport */ fullscreen),
818
- getBreaksNeededForEmptyLineAfter: () => (/* reexport */ getBreaksNeededForEmptyLineAfter),
819
- getBreaksNeededForEmptyLineBefore: () => (/* reexport */ getBreaksNeededForEmptyLineBefore),
820
- getCommands: () => (/* reexport */ commands_getCommands),
821
- getExtraCommands: () => (/* reexport */ getExtraCommands),
822
- getStateFromTextArea: () => (/* reexport */ getStateFromTextArea),
823
- getSurroundingWord: () => (/* reexport */ getSurroundingWord),
824
- group: () => (/* reexport */ group),
825
- handleKeyDown: () => (/* reexport */ handleKeyDown),
826
- heading: () => (/* reexport */ title_heading),
827
- heading1: () => (/* reexport */ heading1),
828
- heading2: () => (/* reexport */ heading2),
829
- heading3: () => (/* reexport */ heading3),
830
- heading4: () => (/* reexport */ heading4),
831
- heading5: () => (/* reexport */ heading5),
832
- heading6: () => (/* reexport */ heading6),
833
- headingExecute: () => (/* reexport */ headingExecute),
834
- help: () => (/* reexport */ help),
835
- hr: () => (/* reexport */ hr),
836
- image: () => (/* reexport */ commands_image_image),
837
- insertBeforeEachLine: () => (/* reexport */ insertBeforeEachLine),
838
- insertTextAtPosition: () => (/* reexport */ insertTextAtPosition),
839
- issue: () => (/* reexport */ issue),
840
- italic: () => (/* reexport */ italic),
841
- link: () => (/* reexport */ commands_link_link),
842
- orderedListCommand: () => (/* reexport */ orderedListCommand),
843
- quote: () => (/* reexport */ quote),
844
- reducer: () => (/* reexport */ reducer),
845
- selectLine: () => (/* reexport */ selectLine),
846
- selectWord: () => (/* reexport */ selectWord),
847
- shortcuts: () => (/* reexport */ shortcutsHandle),
848
- strikethrough: () => (/* reexport */ strikeThrough_strikethrough),
849
- table: () => (/* reexport */ table_table),
850
- title: () => (/* reexport */ title),
851
- title1: () => (/* reexport */ title1),
852
- title2: () => (/* reexport */ title2),
853
- title3: () => (/* reexport */ title3),
854
- title4: () => (/* reexport */ title4),
855
- title5: () => (/* reexport */ title5),
856
- title6: () => (/* reexport */ title6),
857
- unorderedListCommand: () => (/* reexport */ unorderedListCommand)
858
- });
937
+ if (subresult[0] === EXIT) {
938
+ return subresult
939
+ }
859
940
 
860
- // NAMESPACE OBJECT: ../node_modules/property-information/lib/util/types.js
861
- var types_namespaceObject = {};
862
- __webpack_require__.r(types_namespaceObject);
863
- __webpack_require__.d(types_namespaceObject, {
864
- boolean: () => (types_boolean),
865
- booleanish: () => (booleanish),
866
- commaOrSpaceSeparated: () => (commaOrSpaceSeparated),
867
- commaSeparated: () => (commaSeparated),
868
- number: () => (number),
869
- overloadedBoolean: () => (overloadedBoolean),
870
- spaceSeparated: () => (spaceSeparated)
871
- });
941
+ offset =
942
+ typeof subresult[1] === 'number' ? subresult[1] : offset + step
943
+ }
944
+ }
945
+ }
872
946
 
873
- // NAMESPACE OBJECT: ../node_modules/remark-parse/node_modules/micromark/lib/constructs.js
874
- var constructs_namespaceObject = {};
875
- __webpack_require__.r(constructs_namespaceObject);
876
- __webpack_require__.d(constructs_namespaceObject, {
877
- attentionMarkers: () => (attentionMarkers),
878
- contentInitial: () => (contentInitial),
879
- disable: () => (disable),
880
- document: () => (constructs_document),
881
- flow: () => (constructs_flow),
882
- flowInitial: () => (flowInitial),
883
- insideSpan: () => (insideSpan),
884
- string: () => (constructs_string),
885
- text: () => (constructs_text)
886
- });
947
+ return result
948
+ }
949
+ }
950
+ }
887
951
 
888
- // NAMESPACE OBJECT: ./src/utils/markdownUtils.ts
889
- var markdownUtils_namespaceObject = {};
890
- __webpack_require__.r(markdownUtils_namespaceObject);
891
- __webpack_require__.d(markdownUtils_namespaceObject, {
892
- executeCommand: () => (executeCommand),
893
- getBreaksNeededForEmptyLineAfter: () => (getBreaksNeededForEmptyLineAfter),
894
- getBreaksNeededForEmptyLineBefore: () => (getBreaksNeededForEmptyLineBefore),
895
- getSurroundingWord: () => (getSurroundingWord),
896
- insertBeforeEachLine: () => (insertBeforeEachLine),
897
- selectLine: () => (selectLine),
898
- selectWord: () => (selectWord)
899
- });
952
+ /**
953
+ * Turn a return value into a clean result.
954
+ *
955
+ * @param {VisitorResult} value
956
+ * Valid return values from visitors.
957
+ * @returns {Readonly<ActionTuple>}
958
+ * Clean result.
959
+ */
960
+ function toResult(value) {
961
+ if (Array.isArray(value)) {
962
+ return value
963
+ }
900
964
 
901
- // NAMESPACE OBJECT: ./src/commands/index.ts
902
- var commands_namespaceObject = {};
903
- __webpack_require__.r(commands_namespaceObject);
904
- __webpack_require__.d(commands_namespaceObject, {
905
- TextAreaCommandOrchestrator: () => (TextAreaCommandOrchestrator),
906
- TextAreaTextApi: () => (TextAreaTextApi),
907
- bold: () => (bold),
908
- checkedListCommand: () => (checkedListCommand),
909
- code: () => (commands_code_code),
910
- codeBlock: () => (codeBlock),
911
- codeEdit: () => (codeEdit),
912
- codeLive: () => (codeLive),
913
- codePreview: () => (codePreview),
914
- comment: () => (commands_comment_comment),
915
- divider: () => (divider),
916
- fullscreen: () => (fullscreen),
917
- getCommands: () => (commands_getCommands),
918
- getExtraCommands: () => (getExtraCommands),
919
- getStateFromTextArea: () => (getStateFromTextArea),
920
- group: () => (group),
921
- heading: () => (title_heading),
922
- heading1: () => (heading1),
923
- heading2: () => (heading2),
924
- heading3: () => (heading3),
925
- heading4: () => (heading4),
926
- heading5: () => (heading5),
927
- heading6: () => (heading6),
928
- help: () => (help),
929
- hr: () => (hr),
930
- image: () => (commands_image_image),
931
- issue: () => (issue),
932
- italic: () => (italic),
933
- link: () => (commands_link_link),
934
- orderedListCommand: () => (orderedListCommand),
935
- quote: () => (quote),
936
- strikethrough: () => (strikeThrough_strikethrough),
937
- table: () => (table_table),
938
- title: () => (title),
939
- title1: () => (title1),
940
- title2: () => (title2),
941
- title3: () => (title3),
942
- title4: () => (title4),
943
- title5: () => (title5),
944
- title6: () => (title6),
945
- unorderedListCommand: () => (unorderedListCommand)
946
- });
965
+ if (typeof value === 'number') {
966
+ return [CONTINUE, value]
967
+ }
947
968
 
948
- ;// ../node_modules/@babel/runtime/helpers/esm/extends.js
949
- function _extends() {
950
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
951
- for (var e = 1; e < arguments.length; e++) {
952
- var t = arguments[e];
953
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
954
- }
955
- return n;
956
- }, _extends.apply(null, arguments);
969
+ return value === null || value === undefined ? empty : [value]
957
970
  }
958
971
 
959
- // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
960
- var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(442);
961
- var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
962
- ;// ../node_modules/unist-util-is/lib/index.js
972
+ ;// ../node_modules/unist-util-visit/lib/index.js
963
973
  /**
964
- * @import {Node, Parent} from 'unist'
974
+ * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
975
+ * @import {VisitorResult} from 'unist-util-visit-parents'
976
+ */
977
+
978
+ /**
979
+ * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
980
+ * Test from `unist-util-is`.
981
+ *
982
+ * Note: we have remove and add `undefined`, because otherwise when generating
983
+ * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
984
+ * which doesn’t work when publishing on npm.
965
985
  */
966
986
 
987
+ // To do: use types from `unist-util-visit-parents` when it’s released.
988
+
967
989
  /**
990
+ * @typedef {(
991
+ * Fn extends (value: any) => value is infer Thing
992
+ * ? Thing
993
+ * : Fallback
994
+ * )} Predicate
995
+ * Get the value of a type guard `Fn`.
968
996
  * @template Fn
997
+ * Value; typically function that is a type guard (such as `(x): x is Y`).
969
998
  * @template Fallback
970
- * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate
971
- */
972
-
973
- /**
974
- * @callback Check
975
- * Check that an arbitrary value is a node.
976
- * @param {unknown} this
977
- * The given context.
978
- * @param {unknown} [node]
979
- * Anything (typically a node).
980
- * @param {number | null | undefined} [index]
981
- * The node’s position in its parent.
982
- * @param {Parent | null | undefined} [parent]
983
- * The node’s parent.
984
- * @returns {boolean}
985
- * Whether this is a node and passes a test.
986
- *
987
- * @typedef {Record<string, unknown> | Node} Props
988
- * Object to check for equivalence.
989
- *
990
- * Note: `Node` is included as it is common but is not indexable.
991
- *
992
- * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
993
- * Check for an arbitrary node.
994
- *
995
- * @callback TestFunction
996
- * Check if a node passes a test.
997
- * @param {unknown} this
998
- * The given context.
999
- * @param {Node} node
1000
- * A node.
1001
- * @param {number | undefined} [index]
1002
- * The node’s position in its parent.
1003
- * @param {Parent | undefined} [parent]
1004
- * The node’s parent.
1005
- * @returns {boolean | undefined | void}
1006
- * Whether this node passes the test.
1007
- *
1008
- * Note: `void` is included until TS sees no return as `undefined`.
1009
- */
1010
-
1011
- /**
1012
- * Check if `node` is a `Node` and whether it passes the given test.
1013
- *
1014
- * @param {unknown} node
1015
- * Thing to check, typically `Node`.
1016
- * @param {Test} test
1017
- * A check for a specific node.
1018
- * @param {number | null | undefined} index
1019
- * The node’s position in its parent.
1020
- * @param {Parent | null | undefined} parent
1021
- * The node’s parent.
1022
- * @param {unknown} context
1023
- * Context object (`this`) to pass to `test` functions.
1024
- * @returns {boolean}
1025
- * Whether `node` is a node and passes a test.
1026
- */
1027
- const is =
1028
- // Note: overloads in JSDoc can’t yet use different `@template`s.
1029
- /**
1030
- * @type {(
1031
- * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
1032
- * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &
1033
- * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
1034
- * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
1035
- * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
1036
- * ((node?: null | undefined) => false) &
1037
- * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
1038
- * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)
1039
- * )}
1040
- */
1041
- (
1042
- /**
1043
- * @param {unknown} [node]
1044
- * @param {Test} [test]
1045
- * @param {number | null | undefined} [index]
1046
- * @param {Parent | null | undefined} [parent]
1047
- * @param {unknown} [context]
1048
- * @returns {boolean}
1049
- */
1050
- // eslint-disable-next-line max-params
1051
- function (node, test, index, parent, context) {
1052
- const check = convert(test)
1053
-
1054
- if (
1055
- index !== undefined &&
1056
- index !== null &&
1057
- (typeof index !== 'number' ||
1058
- index < 0 ||
1059
- index === Number.POSITIVE_INFINITY)
1060
- ) {
1061
- throw new Error('Expected positive finite index')
1062
- }
1063
-
1064
- if (
1065
- parent !== undefined &&
1066
- parent !== null &&
1067
- (!is(parent) || !parent.children)
1068
- ) {
1069
- throw new Error('Expected parent node')
1070
- }
1071
-
1072
- if (
1073
- (parent === undefined || parent === null) !==
1074
- (index === undefined || index === null)
1075
- ) {
1076
- throw new Error('Expected both parent and index')
1077
- }
1078
-
1079
- return looksLikeANode(node)
1080
- ? check.call(context, node, index, parent)
1081
- : false
1082
- }
1083
- )
1084
-
1085
- /**
1086
- * Generate an assertion from a test.
1087
- *
1088
- * Useful if you’re going to test many nodes, for example when creating a
1089
- * utility where something else passes a compatible test.
1090
- *
1091
- * The created function is a bit faster because it expects valid input only:
1092
- * a `node`, `index`, and `parent`.
1093
- *
1094
- * @param {Test} test
1095
- * * when nullish, checks if `node` is a `Node`.
1096
- * * when `string`, works like passing `(node) => node.type === test`.
1097
- * * when `function` checks if function passed the node is true.
1098
- * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
1099
- * * when `array`, checks if any one of the subtests pass.
1100
- * @returns {Check}
1101
- * An assertion.
1102
- */
1103
- const convert =
1104
- // Note: overloads in JSDoc can’t yet use different `@template`s.
1105
- /**
1106
- * @type {(
1107
- * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
1108
- * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
1109
- * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
1110
- * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
1111
- * ((test?: Test) => Check)
1112
- * )}
1113
- */
1114
- (
1115
- /**
1116
- * @param {Test} [test]
1117
- * @returns {Check}
1118
- */
1119
- function (test) {
1120
- if (test === null || test === undefined) {
1121
- return ok
1122
- }
1123
-
1124
- if (typeof test === 'function') {
1125
- return castFactory(test)
1126
- }
1127
-
1128
- if (typeof test === 'object') {
1129
- return Array.isArray(test)
1130
- ? anyFactory(test)
1131
- : // Cast because `ReadonlyArray` goes into the above but `isArray`
1132
- // narrows to `Array`.
1133
- propertiesFactory(/** @type {Props} */ (test))
1134
- }
1135
-
1136
- if (typeof test === 'string') {
1137
- return typeFactory(test)
1138
- }
1139
-
1140
- throw new Error('Expected function, string, or object as test')
1141
- }
1142
- )
1143
-
1144
- /**
1145
- * @param {Array<Props | TestFunction | string>} tests
1146
- * @returns {Check}
1147
- */
1148
- function anyFactory(tests) {
1149
- /** @type {Array<Check>} */
1150
- const checks = []
1151
- let index = -1
1152
-
1153
- while (++index < tests.length) {
1154
- checks[index] = convert(tests[index])
1155
- }
1156
-
1157
- return castFactory(any)
1158
-
1159
- /**
1160
- * @this {unknown}
1161
- * @type {TestFunction}
1162
- */
1163
- function any(...parameters) {
1164
- let index = -1
1165
-
1166
- while (++index < checks.length) {
1167
- if (checks[index].apply(this, parameters)) return true
1168
- }
1169
-
1170
- return false
1171
- }
1172
- }
1173
-
1174
- /**
1175
- * Turn an object into a test for a node with a certain fields.
1176
- *
1177
- * @param {Props} check
1178
- * @returns {Check}
1179
- */
1180
- function propertiesFactory(check) {
1181
- const checkAsRecord = /** @type {Record<string, unknown>} */ (check)
1182
-
1183
- return castFactory(all)
1184
-
1185
- /**
1186
- * @param {Node} node
1187
- * @returns {boolean}
1188
- */
1189
- function all(node) {
1190
- const nodeAsRecord = /** @type {Record<string, unknown>} */ (
1191
- /** @type {unknown} */ (node)
1192
- )
1193
-
1194
- /** @type {string} */
1195
- let key
1196
-
1197
- for (key in check) {
1198
- if (nodeAsRecord[key] !== checkAsRecord[key]) return false
1199
- }
1200
-
1201
- return true
1202
- }
1203
- }
1204
-
1205
- /**
1206
- * Turn a string into a test for a node with a certain type.
1207
- *
1208
- * @param {string} check
1209
- * @returns {Check}
1210
- */
1211
- function typeFactory(check) {
1212
- return castFactory(type)
1213
-
1214
- /**
1215
- * @param {Node} node
1216
- */
1217
- function type(node) {
1218
- return node && node.type === check
1219
- }
1220
- }
1221
-
1222
- /**
1223
- * Turn a custom test into a test for a node that passes that test.
1224
- *
1225
- * @param {TestFunction} testFunction
1226
- * @returns {Check}
1227
- */
1228
- function castFactory(testFunction) {
1229
- return check
1230
-
1231
- /**
1232
- * @this {unknown}
1233
- * @type {Check}
1234
- */
1235
- function check(value, index, parent) {
1236
- return Boolean(
1237
- looksLikeANode(value) &&
1238
- testFunction.call(
1239
- this,
1240
- value,
1241
- typeof index === 'number' ? index : undefined,
1242
- parent || undefined
1243
- )
1244
- )
1245
- }
1246
- }
1247
-
1248
- function ok() {
1249
- return true
1250
- }
1251
-
1252
- /**
1253
- * @param {unknown} value
1254
- * @returns {value is Node}
1255
- */
1256
- function looksLikeANode(value) {
1257
- return value !== null && typeof value === 'object' && 'type' in value
1258
- }
1259
-
1260
- ;// ../node_modules/unist-util-visit-parents/lib/color.js
1261
- /**
1262
- * @param {string} d
1263
- * @returns {string}
1264
- */
1265
- function color(d) {
1266
- return d
1267
- }
1268
-
1269
- ;// ../node_modules/unist-util-visit-parents/lib/index.js
1270
- /**
1271
- * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
1272
- */
1273
-
1274
- /**
1275
- * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
1276
- * Test from `unist-util-is`.
1277
- *
1278
- * Note: we have remove and add `undefined`, because otherwise when generating
1279
- * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
1280
- * which doesn’t work when publishing on npm.
1281
- */
1282
-
1283
- /**
1284
- * @typedef {(
1285
- * Fn extends (value: any) => value is infer Thing
1286
- * ? Thing
1287
- * : Fallback
1288
- * )} Predicate
1289
- * Get the value of a type guard `Fn`.
1290
- * @template Fn
1291
- * Value; typically function that is a type guard (such as `(x): x is Y`).
1292
- * @template Fallback
1293
- * Value to yield if `Fn` is not a type guard.
999
+ * Value to yield if `Fn` is not a type guard.
1294
1000
  */
1295
1001
 
1296
1002
  /**
@@ -1316,10 +1022,8 @@ function color(d) {
1316
1022
 
1317
1023
  /**
1318
1024
  * @typedef {(
1319
- * Check extends ReadonlyArray<infer T>
1320
- * ? MatchesOne<Value, T>
1321
- * : Check extends Array<infer T>
1322
- * ? MatchesOne<Value, T>
1025
+ * Check extends ReadonlyArray<any>
1026
+ * ? MatchesOne<Value, Check[number]>
1323
1027
  * : MatchesOne<Value, Check>
1324
1028
  * )} Matches
1325
1029
  * Check whether a node matches a check in the type system.
@@ -1384,15 +1088,6 @@ function color(d) {
1384
1088
  * Current depth.
1385
1089
  */
1386
1090
 
1387
- /**
1388
- * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor
1389
- * Collect nodes in `Tree` that can be ancestors of `Child`.
1390
- * @template {UnistNode} Tree
1391
- * All node types in a tree.
1392
- * @template {UnistNode} Child
1393
- * Node to search for.
1394
- */
1395
-
1396
1091
  /**
1397
1092
  * @typedef {(
1398
1093
  * Tree extends UnistParent
@@ -1419,32 +1114,12 @@ function color(d) {
1419
1114
  * Current depth.
1420
1115
  */
1421
1116
 
1422
- /**
1423
- * @typedef {'skip' | boolean} Action
1424
- * Union of the action types.
1425
- *
1426
- * @typedef {number} Index
1427
- * Move to the sibling at `index` next (after node itself is completely
1428
- * traversed).
1429
- *
1430
- * Useful if mutating the tree, such as removing the node the visitor is
1431
- * currently on, or any of its previous siblings.
1432
- * Results less than 0 or greater than or equal to `children.length` stop
1433
- * traversing the parent.
1434
- *
1435
- * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple
1436
- * List with one or two values, the first an action, the second an index.
1437
- *
1438
- * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult
1439
- * Any value that can be returned from a visitor.
1440
- */
1441
-
1442
1117
  /**
1443
1118
  * @callback Visitor
1444
1119
  * Handle a node (matching `test`, if given).
1445
1120
  *
1446
1121
  * Visitors are free to transform `node`.
1447
- * They can also transform the parent of node (the last of `ancestors`).
1122
+ * They can also transform `parent`.
1448
1123
  *
1449
1124
  * Replacing `node` itself, if `SKIP` is not returned, still causes its
1450
1125
  * descendants to be walked (which is a bug).
@@ -1455,12 +1130,14 @@ function color(d) {
1455
1130
  * Adding or removing next siblings of `node` (or previous siblings, in case
1456
1131
  * of reverse) is handled as expected without needing to return a new `Index`.
1457
1132
  *
1458
- * Removing the children property of an ancestor still results in them being
1133
+ * Removing the children property of `parent` still results in them being
1459
1134
  * traversed.
1460
1135
  * @param {Visited} node
1461
1136
  * Found node.
1462
- * @param {Array<VisitedParents>} ancestors
1463
- * Ancestors of `node`.
1137
+ * @param {Visited extends UnistNode ? number | undefined : never} index
1138
+ * Index of `node` in `parent`.
1139
+ * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent
1140
+ * Parent of `node`.
1464
1141
  * @returns {VisitorResult}
1465
1142
  * What to do next.
1466
1143
  *
@@ -1472,17 +1149,49 @@ function color(d) {
1472
1149
  * When the `Action` is `CONTINUE`, `Index` can be returned.
1473
1150
  * @template {UnistNode} [Visited=UnistNode]
1474
1151
  * Visited node type.
1475
- * @template {UnistParent} [VisitedParents=UnistParent]
1152
+ * @template {UnistParent} [Ancestor=UnistParent]
1476
1153
  * Ancestor type.
1477
1154
  */
1478
1155
 
1479
1156
  /**
1480
- * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor
1157
+ * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch
1158
+ * Build a typed `Visitor` function from a node and all possible parents.
1159
+ *
1160
+ * It will infer which values are passed as `node` and which as `parent`.
1161
+ * @template {UnistNode} Visited
1162
+ * Node type.
1163
+ * @template {UnistParent} Ancestor
1164
+ * Parent type.
1165
+ */
1166
+
1167
+ /**
1168
+ * @typedef {(
1169
+ * BuildVisitorFromMatch<
1170
+ * Matches<Descendant, Check>,
1171
+ * Extract<Descendant, UnistParent>
1172
+ * >
1173
+ * )} BuildVisitorFromDescendants
1174
+ * Build a typed `Visitor` function from a list of descendants and a test.
1175
+ *
1176
+ * It will infer which values are passed as `node` and which as `parent`.
1177
+ * @template {UnistNode} Descendant
1178
+ * Node type.
1179
+ * @template {Test} Check
1180
+ * Test type.
1181
+ */
1182
+
1183
+ /**
1184
+ * @typedef {(
1185
+ * BuildVisitorFromDescendants<
1186
+ * InclusiveDescendant<Tree>,
1187
+ * Check
1188
+ * >
1189
+ * )} BuildVisitor
1481
1190
  * Build a typed `Visitor` function from a tree and a test.
1482
1191
  *
1483
- * It will infer which values are passed as `node` and which as `parents`.
1192
+ * It will infer which values are passed as `node` and which as `parent`.
1484
1193
  * @template {UnistNode} [Tree=UnistNode]
1485
- * Tree type.
1194
+ * Node type.
1486
1195
  * @template {Test} [Check=Test]
1487
1196
  * Test type.
1488
1197
  */
@@ -1490,26 +1199,9 @@ function color(d) {
1490
1199
 
1491
1200
 
1492
1201
 
1493
- /** @type {Readonly<ActionTuple>} */
1494
- const empty = []
1495
-
1496
- /**
1497
- * Continue traversing as normal.
1498
- */
1499
- const CONTINUE = true
1500
-
1501
- /**
1502
- * Stop traversing immediately.
1503
- */
1504
- const EXIT = false
1505
-
1506
- /**
1507
- * Do not traverse this node’s children.
1508
- */
1509
- const SKIP = 'skip'
1510
1202
 
1511
1203
  /**
1512
- * Visit nodes, with ancestral information.
1204
+ * Visit nodes.
1513
1205
  *
1514
1206
  * This algorithm performs *depth-first* *tree traversal* in *preorder*
1515
1207
  * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
@@ -1541,11 +1233,11 @@ const SKIP = 'skip'
1541
1233
  *
1542
1234
  * @param {UnistNode} tree
1543
1235
  * Tree to traverse.
1544
- * @param {Visitor | Test} test
1545
- * `unist-util-is`-compatible test
1546
- * @param {Visitor | boolean | null | undefined} [visitor]
1547
- * Handle each node.
1548
- * @param {boolean | null | undefined} [reverse]
1236
+ * @param {Visitor | Test} testOrVisitor
1237
+ * `unist-util-is`-compatible test (optional, omit to pass a visitor).
1238
+ * @param {Visitor | boolean | null | undefined} [visitorOrReverse]
1239
+ * Handle each node (when test is omitted, pass `reverse`).
1240
+ * @param {boolean | null | undefined} [maybeReverse=false]
1549
1241
  * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
1550
1242
  * @returns {undefined}
1551
1243
  * Nothing.
@@ -1555,451 +1247,61 @@ const SKIP = 'skip'
1555
1247
  * @template {Test} Check
1556
1248
  * `unist-util-is`-compatible test.
1557
1249
  */
1558
- function visitParents(tree, test, visitor, reverse) {
1250
+ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
1251
+ /** @type {boolean | null | undefined} */
1252
+ let reverse
1559
1253
  /** @type {Test} */
1560
- let check
1254
+ let test
1255
+ /** @type {Visitor} */
1256
+ let visitor
1561
1257
 
1562
- if (typeof test === 'function' && typeof visitor !== 'function') {
1563
- reverse = visitor
1564
- // @ts-expect-error no visitor given, so `visitor` is test.
1565
- visitor = test
1258
+ if (
1259
+ typeof testOrVisitor === 'function' &&
1260
+ typeof visitorOrReverse !== 'function'
1261
+ ) {
1262
+ test = undefined
1263
+ visitor = testOrVisitor
1264
+ reverse = visitorOrReverse
1566
1265
  } else {
1567
- // @ts-expect-error visitor given, so `test` isn’t a visitor.
1568
- check = test
1266
+ // @ts-expect-error: assume the overload with test was given.
1267
+ test = testOrVisitor
1268
+ // @ts-expect-error: assume the overload with test was given.
1269
+ visitor = visitorOrReverse
1270
+ reverse = maybeReverse
1569
1271
  }
1570
1272
 
1571
- const is = convert(check)
1572
- const step = reverse ? -1 : 1
1573
-
1574
- factory(tree, undefined, [])()
1273
+ visitParents(tree, test, overload, reverse)
1575
1274
 
1576
1275
  /**
1577
1276
  * @param {UnistNode} node
1578
- * @param {number | undefined} index
1579
1277
  * @param {Array<UnistParent>} parents
1580
1278
  */
1581
- function factory(node, index, parents) {
1582
- const value = /** @type {Record<string, unknown>} */ (
1583
- node && typeof node === 'object' ? node : {}
1584
- )
1585
-
1586
- if (typeof value.type === 'string') {
1587
- const name =
1588
- // `hast`
1589
- typeof value.tagName === 'string'
1590
- ? value.tagName
1591
- : // `xast`
1592
- typeof value.name === 'string'
1593
- ? value.name
1594
- : undefined
1279
+ function overload(node, parents) {
1280
+ const parent = parents[parents.length - 1]
1281
+ const index = parent ? parent.children.indexOf(node) : undefined
1282
+ return visitor(node, index, parent)
1283
+ }
1284
+ }
1595
1285
 
1596
- Object.defineProperty(visit, 'name', {
1597
- value:
1598
- 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'
1599
- })
1600
- }
1286
+ ;// ../node_modules/hast-util-to-string/lib/index.js
1287
+ /**
1288
+ * @import {Nodes, Parents} from 'hast'
1289
+ */
1601
1290
 
1602
- return visit
1603
-
1604
- function visit() {
1605
- /** @type {Readonly<ActionTuple>} */
1606
- let result = empty
1607
- /** @type {Readonly<ActionTuple>} */
1608
- let subresult
1609
- /** @type {number} */
1610
- let offset
1611
- /** @type {Array<UnistParent>} */
1612
- let grandparents
1613
-
1614
- if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
1615
- // @ts-expect-error: `visitor` is now a visitor.
1616
- result = toResult(visitor(node, parents))
1617
-
1618
- if (result[0] === EXIT) {
1619
- return result
1620
- }
1621
- }
1622
-
1623
- if ('children' in node && node.children) {
1624
- const nodeAsParent = /** @type {UnistParent} */ (node)
1625
-
1626
- if (nodeAsParent.children && result[0] !== SKIP) {
1627
- offset = (reverse ? nodeAsParent.children.length : -1) + step
1628
- grandparents = parents.concat(nodeAsParent)
1629
-
1630
- while (offset > -1 && offset < nodeAsParent.children.length) {
1631
- const child = nodeAsParent.children[offset]
1632
-
1633
- subresult = factory(child, offset, grandparents)()
1634
-
1635
- if (subresult[0] === EXIT) {
1636
- return subresult
1637
- }
1638
-
1639
- offset =
1640
- typeof subresult[1] === 'number' ? subresult[1] : offset + step
1641
- }
1642
- }
1643
- }
1644
-
1645
- return result
1646
- }
1647
- }
1648
- }
1649
-
1650
- /**
1651
- * Turn a return value into a clean result.
1652
- *
1653
- * @param {VisitorResult} value
1654
- * Valid return values from visitors.
1655
- * @returns {Readonly<ActionTuple>}
1656
- * Clean result.
1657
- */
1658
- function toResult(value) {
1659
- if (Array.isArray(value)) {
1660
- return value
1661
- }
1662
-
1663
- if (typeof value === 'number') {
1664
- return [CONTINUE, value]
1665
- }
1666
-
1667
- return value === null || value === undefined ? empty : [value]
1668
- }
1669
-
1670
- ;// ../node_modules/unist-util-visit/lib/index.js
1671
- /**
1672
- * @import {Node as UnistNode, Parent as UnistParent} from 'unist'
1673
- * @import {VisitorResult} from 'unist-util-visit-parents'
1674
- */
1675
-
1676
- /**
1677
- * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test
1678
- * Test from `unist-util-is`.
1679
- *
1680
- * Note: we have remove and add `undefined`, because otherwise when generating
1681
- * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,
1682
- * which doesn’t work when publishing on npm.
1683
- */
1684
-
1685
- // To do: use types from `unist-util-visit-parents` when it’s released.
1686
-
1687
- /**
1688
- * @typedef {(
1689
- * Fn extends (value: any) => value is infer Thing
1690
- * ? Thing
1691
- * : Fallback
1692
- * )} Predicate
1693
- * Get the value of a type guard `Fn`.
1694
- * @template Fn
1695
- * Value; typically function that is a type guard (such as `(x): x is Y`).
1696
- * @template Fallback
1697
- * Value to yield if `Fn` is not a type guard.
1698
- */
1699
-
1700
- /**
1701
- * @typedef {(
1702
- * Check extends null | undefined // No test.
1703
- * ? Value
1704
- * : Value extends {type: Check} // String (type) test.
1705
- * ? Value
1706
- * : Value extends Check // Partial test.
1707
- * ? Value
1708
- * : Check extends Function // Function test.
1709
- * ? Predicate<Check, Value> extends Value
1710
- * ? Predicate<Check, Value>
1711
- * : never
1712
- * : never // Some other test?
1713
- * )} MatchesOne
1714
- * Check whether a node matches a primitive check in the type system.
1715
- * @template Value
1716
- * Value; typically unist `Node`.
1717
- * @template Check
1718
- * Value; typically `unist-util-is`-compatible test, but not arrays.
1719
- */
1720
-
1721
- /**
1722
- * @typedef {(
1723
- * Check extends ReadonlyArray<any>
1724
- * ? MatchesOne<Value, Check[number]>
1725
- * : MatchesOne<Value, Check>
1726
- * )} Matches
1727
- * Check whether a node matches a check in the type system.
1728
- * @template Value
1729
- * Value; typically unist `Node`.
1730
- * @template Check
1731
- * Value; typically `unist-util-is`-compatible test.
1732
- */
1733
-
1734
- /**
1735
- * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint
1736
- * Number; capped reasonably.
1737
- */
1738
-
1739
- /**
1740
- * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment
1741
- * Increment a number in the type system.
1742
- * @template {Uint} [I=0]
1743
- * Index.
1744
- */
1745
-
1746
- /**
1747
- * @typedef {(
1748
- * Node extends UnistParent
1749
- * ? Node extends {children: Array<infer Children>}
1750
- * ? Child extends Children ? Node : never
1751
- * : never
1752
- * : never
1753
- * )} InternalParent
1754
- * Collect nodes that can be parents of `Child`.
1755
- * @template {UnistNode} Node
1756
- * All node types in a tree.
1757
- * @template {UnistNode} Child
1758
- * Node to search for.
1759
- */
1760
-
1761
- /**
1762
- * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent
1763
- * Collect nodes in `Tree` that can be parents of `Child`.
1764
- * @template {UnistNode} Tree
1765
- * All node types in a tree.
1766
- * @template {UnistNode} Child
1767
- * Node to search for.
1768
- */
1769
-
1770
- /**
1771
- * @typedef {(
1772
- * Depth extends Max
1773
- * ? never
1774
- * :
1775
- * | InternalParent<Node, Child>
1776
- * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>
1777
- * )} InternalAncestor
1778
- * Collect nodes in `Tree` that can be ancestors of `Child`.
1779
- * @template {UnistNode} Node
1780
- * All node types in a tree.
1781
- * @template {UnistNode} Child
1782
- * Node to search for.
1783
- * @template {Uint} [Max=10]
1784
- * Max; searches up to this depth.
1785
- * @template {Uint} [Depth=0]
1786
- * Current depth.
1787
- */
1788
-
1789
- /**
1790
- * @typedef {(
1791
- * Tree extends UnistParent
1792
- * ? Depth extends Max
1793
- * ? Tree
1794
- * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
1795
- * : Tree
1796
- * )} InclusiveDescendant
1797
- * Collect all (inclusive) descendants of `Tree`.
1798
- *
1799
- * > 👉 **Note**: for performance reasons, this seems to be the fastest way to
1800
- * > recurse without actually running into an infinite loop, which the
1801
- * > previous version did.
1802
- * >
1803
- * > Practically, a max of `2` is typically enough assuming a `Root` is
1804
- * > passed, but it doesn’t improve performance.
1805
- * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.
1806
- * > Using up to `10` doesn’t hurt or help either.
1807
- * @template {UnistNode} Tree
1808
- * Tree type.
1809
- * @template {Uint} [Max=10]
1810
- * Max; searches up to this depth.
1811
- * @template {Uint} [Depth=0]
1812
- * Current depth.
1813
- */
1814
-
1815
- /**
1816
- * @callback Visitor
1817
- * Handle a node (matching `test`, if given).
1818
- *
1819
- * Visitors are free to transform `node`.
1820
- * They can also transform `parent`.
1821
- *
1822
- * Replacing `node` itself, if `SKIP` is not returned, still causes its
1823
- * descendants to be walked (which is a bug).
1824
- *
1825
- * When adding or removing previous siblings of `node` (or next siblings, in
1826
- * case of reverse), the `Visitor` should return a new `Index` to specify the
1827
- * sibling to traverse after `node` is traversed.
1828
- * Adding or removing next siblings of `node` (or previous siblings, in case
1829
- * of reverse) is handled as expected without needing to return a new `Index`.
1830
- *
1831
- * Removing the children property of `parent` still results in them being
1832
- * traversed.
1833
- * @param {Visited} node
1834
- * Found node.
1835
- * @param {Visited extends UnistNode ? number | undefined : never} index
1836
- * Index of `node` in `parent`.
1837
- * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent
1838
- * Parent of `node`.
1839
- * @returns {VisitorResult}
1840
- * What to do next.
1841
- *
1842
- * An `Index` is treated as a tuple of `[CONTINUE, Index]`.
1843
- * An `Action` is treated as a tuple of `[Action]`.
1844
- *
1845
- * Passing a tuple back only makes sense if the `Action` is `SKIP`.
1846
- * When the `Action` is `EXIT`, that action can be returned.
1847
- * When the `Action` is `CONTINUE`, `Index` can be returned.
1848
- * @template {UnistNode} [Visited=UnistNode]
1849
- * Visited node type.
1850
- * @template {UnistParent} [Ancestor=UnistParent]
1851
- * Ancestor type.
1852
- */
1853
-
1854
- /**
1855
- * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch
1856
- * Build a typed `Visitor` function from a node and all possible parents.
1857
- *
1858
- * It will infer which values are passed as `node` and which as `parent`.
1859
- * @template {UnistNode} Visited
1860
- * Node type.
1861
- * @template {UnistParent} Ancestor
1862
- * Parent type.
1863
- */
1864
-
1865
- /**
1866
- * @typedef {(
1867
- * BuildVisitorFromMatch<
1868
- * Matches<Descendant, Check>,
1869
- * Extract<Descendant, UnistParent>
1870
- * >
1871
- * )} BuildVisitorFromDescendants
1872
- * Build a typed `Visitor` function from a list of descendants and a test.
1873
- *
1874
- * It will infer which values are passed as `node` and which as `parent`.
1875
- * @template {UnistNode} Descendant
1876
- * Node type.
1877
- * @template {Test} Check
1878
- * Test type.
1879
- */
1880
-
1881
- /**
1882
- * @typedef {(
1883
- * BuildVisitorFromDescendants<
1884
- * InclusiveDescendant<Tree>,
1885
- * Check
1886
- * >
1887
- * )} BuildVisitor
1888
- * Build a typed `Visitor` function from a tree and a test.
1889
- *
1890
- * It will infer which values are passed as `node` and which as `parent`.
1891
- * @template {UnistNode} [Tree=UnistNode]
1892
- * Node type.
1893
- * @template {Test} [Check=Test]
1894
- * Test type.
1895
- */
1896
-
1897
-
1898
-
1899
-
1900
-
1901
- /**
1902
- * Visit nodes.
1903
- *
1904
- * This algorithm performs *depth-first* *tree traversal* in *preorder*
1905
- * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).
1906
- *
1907
- * You can choose for which nodes `visitor` is called by passing a `test`.
1908
- * For complex tests, you should test yourself in `visitor`, as it will be
1909
- * faster and will have improved type information.
1910
- *
1911
- * Walking the tree is an intensive task.
1912
- * Make use of the return values of the visitor when possible.
1913
- * Instead of walking a tree multiple times, walk it once, use `unist-util-is`
1914
- * to check if a node matches, and then perform different operations.
1915
- *
1916
- * You can change the tree.
1917
- * See `Visitor` for more info.
1918
- *
1919
- * @overload
1920
- * @param {Tree} tree
1921
- * @param {Check} check
1922
- * @param {BuildVisitor<Tree, Check>} visitor
1923
- * @param {boolean | null | undefined} [reverse]
1924
- * @returns {undefined}
1925
- *
1926
- * @overload
1927
- * @param {Tree} tree
1928
- * @param {BuildVisitor<Tree>} visitor
1929
- * @param {boolean | null | undefined} [reverse]
1930
- * @returns {undefined}
1931
- *
1932
- * @param {UnistNode} tree
1933
- * Tree to traverse.
1934
- * @param {Visitor | Test} testOrVisitor
1935
- * `unist-util-is`-compatible test (optional, omit to pass a visitor).
1936
- * @param {Visitor | boolean | null | undefined} [visitorOrReverse]
1937
- * Handle each node (when test is omitted, pass `reverse`).
1938
- * @param {boolean | null | undefined} [maybeReverse=false]
1939
- * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).
1940
- * @returns {undefined}
1941
- * Nothing.
1942
- *
1943
- * @template {UnistNode} Tree
1944
- * Node type.
1945
- * @template {Test} Check
1946
- * `unist-util-is`-compatible test.
1947
- */
1948
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
1949
- /** @type {boolean | null | undefined} */
1950
- let reverse
1951
- /** @type {Test} */
1952
- let test
1953
- /** @type {Visitor} */
1954
- let visitor
1955
-
1956
- if (
1957
- typeof testOrVisitor === 'function' &&
1958
- typeof visitorOrReverse !== 'function'
1959
- ) {
1960
- test = undefined
1961
- visitor = testOrVisitor
1962
- reverse = visitorOrReverse
1963
- } else {
1964
- // @ts-expect-error: assume the overload with test was given.
1965
- test = testOrVisitor
1966
- // @ts-expect-error: assume the overload with test was given.
1967
- visitor = visitorOrReverse
1968
- reverse = maybeReverse
1969
- }
1970
-
1971
- visitParents(tree, test, overload, reverse)
1972
-
1973
- /**
1974
- * @param {UnistNode} node
1975
- * @param {Array<UnistParent>} parents
1976
- */
1977
- function overload(node, parents) {
1978
- const parent = parents[parents.length - 1]
1979
- const index = parent ? parent.children.indexOf(node) : undefined
1980
- return visitor(node, index, parent)
1981
- }
1982
- }
1983
-
1984
- ;// ../node_modules/hast-util-to-string/lib/index.js
1985
- /**
1986
- * @import {Nodes, Parents} from 'hast'
1987
- */
1988
-
1989
- /**
1990
- * Get the plain-text value of a hast node.
1991
- *
1992
- * @param {Nodes} node
1993
- * Node to serialize.
1994
- * @returns {string}
1995
- * Serialized node.
1996
- */
1997
- function lib_toString(node) {
1998
- // “The concatenation of data of all the Text node descendants of the context
1999
- // object, in tree order.”
2000
- if ('children' in node) {
2001
- return lib_all(node)
2002
- }
1291
+ /**
1292
+ * Get the plain-text value of a hast node.
1293
+ *
1294
+ * @param {Nodes} node
1295
+ * Node to serialize.
1296
+ * @returns {string}
1297
+ * Serialized node.
1298
+ */
1299
+ function lib_toString(node) {
1300
+ // “The concatenation of data of all the Text node descendants of the context
1301
+ // object, in tree order.”
1302
+ if ('children' in node) {
1303
+ return lib_all(node)
1304
+ }
2003
1305
 
2004
1306
  // “Context object’s data.”
2005
1307
  return 'value' in node ? node.value : ''
@@ -7057,6 +6359,7 @@ const html = create({
7057
6359
  allowFullScreen: types_boolean,
7058
6360
  allowPaymentRequest: types_boolean,
7059
6361
  allowUserMedia: types_boolean,
6362
+ alpha: types_boolean,
7060
6363
  alt: null,
7061
6364
  as: null,
7062
6365
  async: types_boolean,
@@ -7070,8 +6373,12 @@ const html = create({
7070
6373
  checked: types_boolean,
7071
6374
  cite: null,
7072
6375
  className: spaceSeparated,
6376
+ closedBy: null,
6377
+ colorSpace: null,
7073
6378
  cols: number,
7074
- colSpan: null,
6379
+ colSpan: number,
6380
+ command: null,
6381
+ commandFor: null,
7075
6382
  content: null,
7076
6383
  contentEditable: booleanish,
7077
6384
  controls: types_boolean,
@@ -7251,8 +6558,10 @@ const html = create({
7251
6558
  seamless: types_boolean,
7252
6559
  selected: types_boolean,
7253
6560
  shadowRootClonable: types_boolean,
6561
+ shadowRootCustomElementRegistry: types_boolean,
7254
6562
  shadowRootDelegatesFocus: types_boolean,
7255
6563
  shadowRootMode: null,
6564
+ shadowRootSerializable: types_boolean,
7256
6565
  shape: null,
7257
6566
  size: number,
7258
6567
  sizes: null,
@@ -7338,8 +6647,11 @@ const html = create({
7338
6647
  allowTransparency: null,
7339
6648
  autoCorrect: null,
7340
6649
  autoSave: null,
6650
+ credentialless: types_boolean,
7341
6651
  disablePictureInPicture: types_boolean,
7342
6652
  disableRemotePlayback: types_boolean,
6653
+ exportParts: commaSeparated,
6654
+ part: spaceSeparated,
7343
6655
  prefix: null,
7344
6656
  property: null,
7345
6657
  results: number,
@@ -7397,6 +6709,7 @@ const svg = create({
7397
6709
  markerEnd: 'marker-end',
7398
6710
  markerMid: 'marker-mid',
7399
6711
  markerStart: 'marker-start',
6712
+ maskType: 'mask-type',
7400
6713
  navDown: 'nav-down',
7401
6714
  navDownLeft: 'nav-down-left',
7402
6715
  navDownRight: 'nav-down-right',
@@ -7664,6 +6977,7 @@ const svg = create({
7664
6977
  markerWidth: null,
7665
6978
  mask: null,
7666
6979
  maskContentUnits: null,
6980
+ maskType: null,
7667
6981
  maskUnits: null,
7668
6982
  mathematical: null,
7669
6983
  max: null,
@@ -33877,7 +33191,7 @@ function enterState(state, node) {
33877
33191
  function inferDirectionality(child) {
33878
33192
  if (child.type === 'text') {
33879
33193
  directionInferred = directionBidi(child.value)
33880
- return directionInferred ? EXIT : undefined
33194
+ return directionInferred ? (/* inlined export .EXIT */false) : undefined
33881
33195
  }
33882
33196
 
33883
33197
  if (
@@ -33889,7 +33203,7 @@ function enterState(state, node) {
33889
33203
  child.tagName === 'textare' ||
33890
33204
  directionProperty(child))
33891
33205
  ) {
33892
- return SKIP
33206
+ return (/* inlined export .SKIP */"skip")
33893
33207
  }
33894
33208
  }
33895
33209
  }
@@ -36571,19 +35885,6 @@ const rehypeAttrs = (options = {}) => {
36571
35885
  };
36572
35886
  /* harmony default export */ const rehype_attr_lib = (rehypeAttrs);
36573
35887
  //# sourceMappingURL=index.js.map
36574
- ;// ../node_modules/@ungap/structured-clone/esm/types.js
36575
- const VOID = -1;
36576
- const PRIMITIVE = 0;
36577
- const ARRAY = 1;
36578
- const OBJECT = 2;
36579
- const DATE = 3;
36580
- const REGEXP = 4;
36581
- const MAP = 5;
36582
- const SET = 6;
36583
- const ERROR = 7;
36584
- const BIGINT = 8;
36585
- // export const SYMBOL = 9;
36586
-
36587
35888
  ;// ../node_modules/@ungap/structured-clone/esm/deserialize.js
36588
35889
 
36589
35890
 
@@ -36614,44 +35915,49 @@ const deserializer = ($, _) => {
36614
35915
 
36615
35916
  const [type, value] = _[index];
36616
35917
  switch (type) {
36617
- case PRIMITIVE:
36618
- case VOID:
35918
+ case (/* inlined export .PRIMITIVE */0):
35919
+ case (/* inlined export .VOID */-1):
36619
35920
  return as(value, index);
36620
- case ARRAY: {
35921
+ case (/* inlined export .ARRAY */1): {
36621
35922
  const arr = as([], index);
36622
35923
  for (const index of value)
36623
35924
  arr.push(unpair(index));
36624
35925
  return arr;
36625
35926
  }
36626
- case OBJECT: {
35927
+ case (/* inlined export .OBJECT */2): {
36627
35928
  const object = as({}, index);
36628
35929
  for (const [key, index] of value)
36629
35930
  object[unpair(key)] = unpair(index);
36630
35931
  return object;
36631
35932
  }
36632
- case DATE:
35933
+ case (/* inlined export .DATE */3):
36633
35934
  return as(new Date(value), index);
36634
- case REGEXP: {
35935
+ case (/* inlined export .REGEXP */4): {
36635
35936
  const {source, flags} = value;
36636
35937
  return as(new RegExp(source, flags), index);
36637
35938
  }
36638
- case MAP: {
35939
+ case (/* inlined export .MAP */5): {
36639
35940
  const map = as(new Map, index);
36640
35941
  for (const [key, index] of value)
36641
35942
  map.set(unpair(key), unpair(index));
36642
35943
  return map;
36643
35944
  }
36644
- case SET: {
35945
+ case (/* inlined export .SET */6): {
36645
35946
  const set = as(new Set, index);
36646
35947
  for (const index of value)
36647
35948
  set.add(unpair(index));
36648
35949
  return set;
36649
35950
  }
36650
- case ERROR: {
35951
+ case (/* inlined export .ERROR */7): {
36651
35952
  const {name, message} = value;
36652
- return as(guard(name, message), index);
36653
- }
36654
- case BIGINT:
35953
+ return as(
35954
+ typeof env[name] === 'function' ?
35955
+ guard(name, message) :
35956
+ new Error(message),
35957
+ index
35958
+ );
35959
+ }
35960
+ case (/* inlined export .BIGINT */8):
36655
35961
  return as(BigInt(value), index);
36656
35962
  case 'BigInt':
36657
35963
  return as(Object(BigInt(value)), index);
@@ -36690,37 +35996,37 @@ const {keys} = Object;
36690
35996
  const typeOf = value => {
36691
35997
  const type = typeof value;
36692
35998
  if (type !== 'object' || !value)
36693
- return [PRIMITIVE, type];
35999
+ return [(/* inlined export .PRIMITIVE */0), type];
36694
36000
 
36695
36001
  const asString = serialize_toString.call(value).slice(8, -1);
36696
36002
  switch (asString) {
36697
36003
  case 'Array':
36698
- return [ARRAY, EMPTY];
36004
+ return [(/* inlined export .ARRAY */1), EMPTY];
36699
36005
  case 'Object':
36700
- return [OBJECT, EMPTY];
36006
+ return [(/* inlined export .OBJECT */2), EMPTY];
36701
36007
  case 'Date':
36702
- return [DATE, EMPTY];
36008
+ return [(/* inlined export .DATE */3), EMPTY];
36703
36009
  case 'RegExp':
36704
- return [REGEXP, EMPTY];
36010
+ return [(/* inlined export .REGEXP */4), EMPTY];
36705
36011
  case 'Map':
36706
- return [MAP, EMPTY];
36012
+ return [(/* inlined export .MAP */5), EMPTY];
36707
36013
  case 'Set':
36708
- return [SET, EMPTY];
36014
+ return [(/* inlined export .SET */6), EMPTY];
36709
36015
  case 'DataView':
36710
- return [ARRAY, asString];
36016
+ return [(/* inlined export .ARRAY */1), asString];
36711
36017
  }
36712
36018
 
36713
36019
  if (asString.includes('Array'))
36714
- return [ARRAY, asString];
36020
+ return [(/* inlined export .ARRAY */1), asString];
36715
36021
 
36716
- if (asString.includes('Error'))
36717
- return [ERROR, asString];
36022
+ if (value instanceof Error)
36023
+ return [(/* inlined export .ERROR */7), value.name || 'Error'];
36718
36024
 
36719
- return [OBJECT, asString];
36025
+ return [(/* inlined export .OBJECT */2), asString];
36720
36026
  };
36721
36027
 
36722
36028
  const shouldSkip = ([TYPE, type]) => (
36723
- TYPE === PRIMITIVE &&
36029
+ TYPE === (/* inlined export .PRIMITIVE */0) &&
36724
36030
  (type === 'function' || type === 'symbol')
36725
36031
  );
36726
36032
 
@@ -36738,11 +36044,11 @@ const serializer = (strict, json, $, _) => {
36738
36044
 
36739
36045
  let [TYPE, type] = typeOf(value);
36740
36046
  switch (TYPE) {
36741
- case PRIMITIVE: {
36047
+ case (/* inlined export .PRIMITIVE */0): {
36742
36048
  let entry = value;
36743
36049
  switch (type) {
36744
36050
  case 'bigint':
36745
- TYPE = BIGINT;
36051
+ TYPE = (/* inlined export .BIGINT */8);
36746
36052
  entry = value.toString();
36747
36053
  break;
36748
36054
  case 'function':
@@ -36752,11 +36058,11 @@ const serializer = (strict, json, $, _) => {
36752
36058
  entry = null;
36753
36059
  break;
36754
36060
  case 'undefined':
36755
- return as([VOID], value);
36061
+ return as([(/* inlined export .VOID */-1)], value);
36756
36062
  }
36757
36063
  return as([TYPE, entry], value);
36758
36064
  }
36759
- case ARRAY: {
36065
+ case (/* inlined export .ARRAY */1): {
36760
36066
  if (type) {
36761
36067
  let spread = value;
36762
36068
  if (type === 'DataView') {
@@ -36774,7 +36080,7 @@ const serializer = (strict, json, $, _) => {
36774
36080
  arr.push(pair(entry));
36775
36081
  return index;
36776
36082
  }
36777
- case OBJECT: {
36083
+ case (/* inlined export .OBJECT */2): {
36778
36084
  if (type) {
36779
36085
  switch (type) {
36780
36086
  case 'BigInt':
@@ -36797,13 +36103,13 @@ const serializer = (strict, json, $, _) => {
36797
36103
  }
36798
36104
  return index;
36799
36105
  }
36800
- case DATE:
36801
- return as([TYPE, value.toISOString()], value);
36802
- case REGEXP: {
36106
+ case (/* inlined export .DATE */3):
36107
+ return as([TYPE, isNaN(value.getTime()) ? EMPTY : value.toISOString()], value);
36108
+ case (/* inlined export .REGEXP */4): {
36803
36109
  const {source, flags} = value;
36804
36110
  return as([TYPE, {source, flags}], value);
36805
36111
  }
36806
- case MAP: {
36112
+ case (/* inlined export .MAP */5): {
36807
36113
  const entries = [];
36808
36114
  const index = as([TYPE, entries], value);
36809
36115
  for (const [key, entry] of value) {
@@ -36812,7 +36118,7 @@ const serializer = (strict, json, $, _) => {
36812
36118
  }
36813
36119
  return index;
36814
36120
  }
36815
- case SET: {
36121
+ case (/* inlined export .SET */6): {
36816
36122
  const entries = [];
36817
36123
  const index = as([TYPE, entries], value);
36818
36124
  for (const entry of value) {
@@ -39972,7 +39278,7 @@ class Tokenizer {
39972
39278
  }
39973
39279
  case CODE_POINTS.NULL: {
39974
39280
  this._err(ERR.unexpectedNullCharacter);
39975
- this._emitChars(REPLACEMENT_CHARACTER);
39281
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
39976
39282
  break;
39977
39283
  }
39978
39284
  case CODE_POINTS.EOF: {
@@ -39994,7 +39300,7 @@ class Tokenizer {
39994
39300
  }
39995
39301
  case CODE_POINTS.NULL: {
39996
39302
  this._err(ERR.unexpectedNullCharacter);
39997
- this._emitChars(REPLACEMENT_CHARACTER);
39303
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
39998
39304
  break;
39999
39305
  }
40000
39306
  case CODE_POINTS.EOF: {
@@ -40016,7 +39322,7 @@ class Tokenizer {
40016
39322
  }
40017
39323
  case CODE_POINTS.NULL: {
40018
39324
  this._err(ERR.unexpectedNullCharacter);
40019
- this._emitChars(REPLACEMENT_CHARACTER);
39325
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40020
39326
  break;
40021
39327
  }
40022
39328
  case CODE_POINTS.EOF: {
@@ -40034,7 +39340,7 @@ class Tokenizer {
40034
39340
  switch (cp) {
40035
39341
  case CODE_POINTS.NULL: {
40036
39342
  this._err(ERR.unexpectedNullCharacter);
40037
- this._emitChars(REPLACEMENT_CHARACTER);
39343
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40038
39344
  break;
40039
39345
  }
40040
39346
  case CODE_POINTS.EOF: {
@@ -40137,7 +39443,7 @@ class Tokenizer {
40137
39443
  }
40138
39444
  case CODE_POINTS.NULL: {
40139
39445
  this._err(ERR.unexpectedNullCharacter);
40140
- token.tagName += REPLACEMENT_CHARACTER;
39446
+ token.tagName += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40141
39447
  break;
40142
39448
  }
40143
39449
  case CODE_POINTS.EOF: {
@@ -40332,7 +39638,7 @@ class Tokenizer {
40332
39638
  }
40333
39639
  case CODE_POINTS.NULL: {
40334
39640
  this._err(ERR.unexpectedNullCharacter);
40335
- this._emitChars(REPLACEMENT_CHARACTER);
39641
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40336
39642
  break;
40337
39643
  }
40338
39644
  case CODE_POINTS.EOF: {
@@ -40361,7 +39667,7 @@ class Tokenizer {
40361
39667
  case CODE_POINTS.NULL: {
40362
39668
  this._err(ERR.unexpectedNullCharacter);
40363
39669
  this.state = State.SCRIPT_DATA_ESCAPED;
40364
- this._emitChars(REPLACEMENT_CHARACTER);
39670
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40365
39671
  break;
40366
39672
  }
40367
39673
  case CODE_POINTS.EOF: {
@@ -40395,7 +39701,7 @@ class Tokenizer {
40395
39701
  case CODE_POINTS.NULL: {
40396
39702
  this._err(ERR.unexpectedNullCharacter);
40397
39703
  this.state = State.SCRIPT_DATA_ESCAPED;
40398
- this._emitChars(REPLACEMENT_CHARACTER);
39704
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40399
39705
  break;
40400
39706
  }
40401
39707
  case CODE_POINTS.EOF: {
@@ -40480,7 +39786,7 @@ class Tokenizer {
40480
39786
  }
40481
39787
  case CODE_POINTS.NULL: {
40482
39788
  this._err(ERR.unexpectedNullCharacter);
40483
- this._emitChars(REPLACEMENT_CHARACTER);
39789
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40484
39790
  break;
40485
39791
  }
40486
39792
  case CODE_POINTS.EOF: {
@@ -40510,7 +39816,7 @@ class Tokenizer {
40510
39816
  case CODE_POINTS.NULL: {
40511
39817
  this._err(ERR.unexpectedNullCharacter);
40512
39818
  this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
40513
- this._emitChars(REPLACEMENT_CHARACTER);
39819
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40514
39820
  break;
40515
39821
  }
40516
39822
  case CODE_POINTS.EOF: {
@@ -40545,7 +39851,7 @@ class Tokenizer {
40545
39851
  case CODE_POINTS.NULL: {
40546
39852
  this._err(ERR.unexpectedNullCharacter);
40547
39853
  this.state = State.SCRIPT_DATA_DOUBLE_ESCAPED;
40548
- this._emitChars(REPLACEMENT_CHARACTER);
39854
+ this._emitChars((/* inlined export .REPLACEMENT_CHARACTER */"�"));
40549
39855
  break;
40550
39856
  }
40551
39857
  case CODE_POINTS.EOF: {
@@ -40648,7 +39954,7 @@ class Tokenizer {
40648
39954
  }
40649
39955
  case CODE_POINTS.NULL: {
40650
39956
  this._err(ERR.unexpectedNullCharacter);
40651
- this.currentAttr.name += REPLACEMENT_CHARACTER;
39957
+ this.currentAttr.name += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40652
39958
  break;
40653
39959
  }
40654
39960
  default: {
@@ -40737,7 +40043,7 @@ class Tokenizer {
40737
40043
  }
40738
40044
  case CODE_POINTS.NULL: {
40739
40045
  this._err(ERR.unexpectedNullCharacter);
40740
- this.currentAttr.value += REPLACEMENT_CHARACTER;
40046
+ this.currentAttr.value += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40741
40047
  break;
40742
40048
  }
40743
40049
  case CODE_POINTS.EOF: {
@@ -40764,7 +40070,7 @@ class Tokenizer {
40764
40070
  }
40765
40071
  case CODE_POINTS.NULL: {
40766
40072
  this._err(ERR.unexpectedNullCharacter);
40767
- this.currentAttr.value += REPLACEMENT_CHARACTER;
40073
+ this.currentAttr.value += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40768
40074
  break;
40769
40075
  }
40770
40076
  case CODE_POINTS.EOF: {
@@ -40801,7 +40107,7 @@ class Tokenizer {
40801
40107
  }
40802
40108
  case CODE_POINTS.NULL: {
40803
40109
  this._err(ERR.unexpectedNullCharacter);
40804
- this.currentAttr.value += REPLACEMENT_CHARACTER;
40110
+ this.currentAttr.value += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40805
40111
  break;
40806
40112
  }
40807
40113
  case CODE_POINTS.QUOTATION_MARK:
@@ -40898,7 +40204,7 @@ class Tokenizer {
40898
40204
  }
40899
40205
  case CODE_POINTS.NULL: {
40900
40206
  this._err(ERR.unexpectedNullCharacter);
40901
- token.data += REPLACEMENT_CHARACTER;
40207
+ token.data += (/* inlined export .REPLACEMENT_CHARACTER */"�");
40902
40208
  break;
40903
40209
  }
40904
40210
  default: {
@@ -41003,7 +40309,7 @@ class Tokenizer {
41003
40309
  }
41004
40310
  case CODE_POINTS.NULL: {
41005
40311
  this._err(ERR.unexpectedNullCharacter);
41006
- token.data += REPLACEMENT_CHARACTER;
40312
+ token.data += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41007
40313
  break;
41008
40314
  }
41009
40315
  case CODE_POINTS.EOF: {
@@ -41200,7 +40506,7 @@ class Tokenizer {
41200
40506
  }
41201
40507
  case CODE_POINTS.NULL: {
41202
40508
  this._err(ERR.unexpectedNullCharacter);
41203
- this._createDoctypeToken(REPLACEMENT_CHARACTER);
40509
+ this._createDoctypeToken((/* inlined export .REPLACEMENT_CHARACTER */"�"));
41204
40510
  this.state = State.DOCTYPE_NAME;
41205
40511
  break;
41206
40512
  }
@@ -41247,7 +40553,7 @@ class Tokenizer {
41247
40553
  }
41248
40554
  case CODE_POINTS.NULL: {
41249
40555
  this._err(ERR.unexpectedNullCharacter);
41250
- token.name += REPLACEMENT_CHARACTER;
40556
+ token.name += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41251
40557
  break;
41252
40558
  }
41253
40559
  case CODE_POINTS.EOF: {
@@ -41405,7 +40711,7 @@ class Tokenizer {
41405
40711
  }
41406
40712
  case CODE_POINTS.NULL: {
41407
40713
  this._err(ERR.unexpectedNullCharacter);
41408
- token.publicId += REPLACEMENT_CHARACTER;
40714
+ token.publicId += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41409
40715
  break;
41410
40716
  }
41411
40717
  case CODE_POINTS.GREATER_THAN_SIGN: {
@@ -41438,7 +40744,7 @@ class Tokenizer {
41438
40744
  }
41439
40745
  case CODE_POINTS.NULL: {
41440
40746
  this._err(ERR.unexpectedNullCharacter);
41441
- token.publicId += REPLACEMENT_CHARACTER;
40747
+ token.publicId += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41442
40748
  break;
41443
40749
  }
41444
40750
  case CODE_POINTS.GREATER_THAN_SIGN: {
@@ -41647,7 +40953,7 @@ class Tokenizer {
41647
40953
  }
41648
40954
  case CODE_POINTS.NULL: {
41649
40955
  this._err(ERR.unexpectedNullCharacter);
41650
- token.systemId += REPLACEMENT_CHARACTER;
40956
+ token.systemId += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41651
40957
  break;
41652
40958
  }
41653
40959
  case CODE_POINTS.GREATER_THAN_SIGN: {
@@ -41680,7 +40986,7 @@ class Tokenizer {
41680
40986
  }
41681
40987
  case CODE_POINTS.NULL: {
41682
40988
  this._err(ERR.unexpectedNullCharacter);
41683
- token.systemId += REPLACEMENT_CHARACTER;
40989
+ token.systemId += (/* inlined export .REPLACEMENT_CHARACTER */"�");
41684
40990
  break;
41685
40991
  }
41686
40992
  case CODE_POINTS.GREATER_THAN_SIGN: {
@@ -45999,7 +45305,7 @@ function startTagAfterAfterFrameset(p, token) {
45999
45305
  // The rules for parsing tokens in foreign content
46000
45306
  //------------------------------------------------------------------
46001
45307
  function nullCharacterInForeignContent(p, token) {
46002
- token.chars = REPLACEMENT_CHARACTER;
45308
+ token.chars = (/* inlined export .REPLACEMENT_CHARACTER */"�");
46003
45309
  p._insertCharacters(token);
46004
45310
  }
46005
45311
  function characterInForeignContent(p, token) {
@@ -61212,8 +60518,128 @@ function bail(error) {
61212
60518
  }
61213
60519
  }
61214
60520
 
61215
- // EXTERNAL MODULE: ../node_modules/extend/index.js
61216
- var extend = __webpack_require__(909);
60521
+ ;// ../node_modules/extend/index.js
60522
+ var extend_namespaceObject = /*#__PURE__*/__webpack_require__.cjs(function(module, exports) {
60523
+
60524
+
60525
+ var hasOwn = Object.prototype.hasOwnProperty;
60526
+ var toStr = Object.prototype.toString;
60527
+ var defineProperty = Object.defineProperty;
60528
+ var gOPD = Object.getOwnPropertyDescriptor;
60529
+
60530
+ var isArray = function isArray(arr) {
60531
+ if (typeof Array.isArray === 'function') {
60532
+ return Array.isArray(arr);
60533
+ }
60534
+
60535
+ return toStr.call(arr) === '[object Array]';
60536
+ };
60537
+
60538
+ var isPlainObject = function isPlainObject(obj) {
60539
+ if (!obj || toStr.call(obj) !== '[object Object]') {
60540
+ return false;
60541
+ }
60542
+
60543
+ var hasOwnConstructor = hasOwn.call(obj, 'constructor');
60544
+ var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
60545
+ // Not own constructor property must be Object
60546
+ if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
60547
+ return false;
60548
+ }
60549
+
60550
+ // Own properties are enumerated firstly, so to speed up,
60551
+ // if last one is own, then all properties are own.
60552
+ var key;
60553
+ for (key in obj) { /**/ }
60554
+
60555
+ return typeof key === 'undefined' || hasOwn.call(obj, key);
60556
+ };
60557
+
60558
+ // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
60559
+ var setProperty = function setProperty(target, options) {
60560
+ if (defineProperty && options.name === '__proto__') {
60561
+ defineProperty(target, options.name, {
60562
+ enumerable: true,
60563
+ configurable: true,
60564
+ value: options.newValue,
60565
+ writable: true
60566
+ });
60567
+ } else {
60568
+ target[options.name] = options.newValue;
60569
+ }
60570
+ };
60571
+
60572
+ // Return undefined instead of __proto__ if '__proto__' is not an own property
60573
+ var getProperty = function getProperty(obj, name) {
60574
+ if (name === '__proto__') {
60575
+ if (!hasOwn.call(obj, name)) {
60576
+ return void 0;
60577
+ } else if (gOPD) {
60578
+ // In early versions of node, obj['__proto__'] is buggy when obj has
60579
+ // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
60580
+ return gOPD(obj, name).value;
60581
+ }
60582
+ }
60583
+
60584
+ return obj[name];
60585
+ };
60586
+
60587
+ module.exports = function extend() {
60588
+ var options, name, src, copy, copyIsArray, clone;
60589
+ var target = arguments[0];
60590
+ var i = 1;
60591
+ var length = arguments.length;
60592
+ var deep = false;
60593
+
60594
+ // Handle a deep copy situation
60595
+ if (typeof target === 'boolean') {
60596
+ deep = target;
60597
+ target = arguments[1] || {};
60598
+ // skip the boolean and the target
60599
+ i = 2;
60600
+ }
60601
+ if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
60602
+ target = {};
60603
+ }
60604
+
60605
+ for (; i < length; ++i) {
60606
+ options = arguments[i];
60607
+ // Only deal with non-null/undefined values
60608
+ if (options != null) {
60609
+ // Extend the base object
60610
+ for (name in options) {
60611
+ src = getProperty(target, name);
60612
+ copy = getProperty(options, name);
60613
+
60614
+ // Prevent never-ending loop
60615
+ if (target !== copy) {
60616
+ // Recurse if we're merging plain objects or arrays
60617
+ if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
60618
+ if (copyIsArray) {
60619
+ copyIsArray = false;
60620
+ clone = src && isArray(src) ? src : [];
60621
+ } else {
60622
+ clone = src && isPlainObject(src) ? src : {};
60623
+ }
60624
+
60625
+ // Never move original objects, clone them
60626
+ setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
60627
+
60628
+ // Don't bring in undefined values
60629
+ } else if (typeof copy !== 'undefined') {
60630
+ setProperty(target, { name: name, newValue: copy });
60631
+ }
60632
+ }
60633
+ }
60634
+ }
60635
+ }
60636
+
60637
+ // Return the modified object
60638
+ return target;
60639
+ };
60640
+
60641
+ });
60642
+
61217
60643
  ;// ../node_modules/unified/node_modules/is-plain-obj/index.js
61218
60644
  function isPlainObject(value) {
61219
60645
  if (typeof value !== 'object' || value === null) {
@@ -63182,7 +62608,7 @@ class Processor extends CallableInstance {
63182
62608
  destination.use(...attacher)
63183
62609
  }
63184
62610
 
63185
- destination.data(extend(true, {}, this.namespace))
62611
+ destination.data(extend_namespaceObject(true, {}, this.namespace))
63186
62612
 
63187
62613
  return destination
63188
62614
  }
@@ -63790,7 +63216,7 @@ class Processor extends CallableInstance {
63790
63216
  addList(result.plugins)
63791
63217
 
63792
63218
  if (result.settings) {
63793
- namespace.settings = extend(true, namespace.settings, result.settings)
63219
+ namespace.settings = extend_namespaceObject(true, namespace.settings, result.settings)
63794
63220
  }
63795
63221
  }
63796
63222
 
@@ -63838,7 +63264,7 @@ class Processor extends CallableInstance {
63838
63264
  let [primary, ...rest] = parameters
63839
63265
  const currentPrimary = attachers[entryIndex][1]
63840
63266
  if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
63841
- primary = extend(true, currentPrimary, primary)
63267
+ primary = extend_namespaceObject(true, currentPrimary, primary)
63842
63268
  }
63843
63269
 
63844
63270
  attachers[entryIndex] = [plugin, primary, ...rest]
@@ -67000,7 +66426,7 @@ function formatHeadingAsSetext(node, state) {
67000
66426
  node.type === 'break'
67001
66427
  ) {
67002
66428
  literalWithBreak = true
67003
- return EXIT
66429
+ return (/* inlined export .EXIT */false)
67004
66430
  }
67005
66431
  })
67006
66432
 
@@ -73546,20 +72972,24 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "sk
73546
72972
 
73547
72973
  var preview_defaultUrlTransform = url => url;
73548
72974
  /* harmony default export */ const preview = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef((props, ref) => {
73549
- var {
73550
- prefixCls = 'wmde-markdown wmde-markdown-color',
73551
- className,
73552
- source,
73553
- style,
73554
- disableCopy = false,
73555
- skipHtml = true,
73556
- onScroll,
73557
- onMouseOver,
73558
- pluginsFilter,
73559
- wrapperElement = {},
73560
- warpperElement = {},
73561
- urlTransform
73562
- } = props,
72975
+ var _props$prefixCls = props.prefixCls,
72976
+ prefixCls = _props$prefixCls === void 0 ? 'wmde-markdown wmde-markdown-color' : _props$prefixCls,
72977
+ className = props.className,
72978
+ source = props.source,
72979
+ style = props.style,
72980
+ _props$disableCopy = props.disableCopy,
72981
+ disableCopy = _props$disableCopy === void 0 ? false : _props$disableCopy,
72982
+ _props$skipHtml = props.skipHtml,
72983
+ skipHtml = _props$skipHtml === void 0 ? true : _props$skipHtml,
72984
+ onScroll = props.onScroll,
72985
+ onMouseOver = props.onMouseOver,
72986
+ pluginsFilter = props.pluginsFilter,
72987
+ rewrite = props.rehypeRewrite,
72988
+ _props$wrapperElement = props.wrapperElement,
72989
+ wrapperElement = _props$wrapperElement === void 0 ? {} : _props$wrapperElement,
72990
+ _props$warpperElement = props.warpperElement,
72991
+ warpperElement = _props$warpperElement === void 0 ? {} : _props$warpperElement,
72992
+ urlTransform = props.urlTransform,
73563
72993
  other = _objectWithoutPropertiesLoose(props, _excluded);
73564
72994
  var mdp = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
73565
72995
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref, () => _extends({}, props, {
@@ -74221,7 +73651,7 @@ function rehypeAutolinkHeadings(options) {
74221
73651
  lib_create(node, toProperties(properties, node), children)
74222
73652
  )
74223
73653
 
74224
- return [SKIP]
73654
+ return [(/* inlined export .SKIP */"skip")]
74225
73655
  }
74226
73656
 
74227
73657
  /** @type {import('unist-util-visit').Visitor<Element>} */
@@ -74244,7 +73674,7 @@ function rehypeAutolinkHeadings(options) {
74244
73674
 
74245
73675
  parent.children.splice(index, 1, ...nodes)
74246
73676
 
74247
- return [SKIP, index + nodes.length]
73677
+ return [(/* inlined export .SKIP */"skip"), index + nodes.length]
74248
73678
  }
74249
73679
 
74250
73680
  /** @type {import('unist-util-visit').Visitor<Element>} */
@@ -74269,7 +73699,7 @@ function rehypeAutolinkHeadings(options) {
74269
73699
  )
74270
73700
  ]
74271
73701
 
74272
- return [SKIP]
73702
+ return [(/* inlined export .SKIP */"skip")]
74273
73703
  }
74274
73704
  }
74275
73705
 
@@ -77340,7 +76770,8 @@ var value=input.value;input.value=value.slice(0,start)+text+value.slice(end);}}/
77340
76770
  input.setSelectionRange(start+text.length,start+text.length);// Notify any possible listeners of the change
77341
76771
  var e=document.createEvent('UIEvent');e.initEvent('input',true,false);input.dispatchEvent(e);}}
77342
76772
  ;// ./src/utils/markdownUtils.ts
77343
- function selectWord(_ref){var text=_ref.text,selection=_ref.selection,prefix=_ref.prefix,_ref$suffix=_ref.suffix,suffix=_ref$suffix===void 0?prefix:_ref$suffix;var result=selection;if(text&&text.length&&selection.start===selection.end){result=getSurroundingWord(text,selection.start);}if(result.start>=prefix.length&&result.end<=text.length-suffix.length){var selectedTextContext=text.slice(result.start-prefix.length,result.end+suffix.length);if(selectedTextContext.startsWith(prefix)&&selectedTextContext.endsWith(suffix)){return{start:result.start-prefix.length,end:result.end+suffix.length};}}return result;}function selectLine(_ref2){var text=_ref2.text,selection=_ref2.selection;var start=text.slice(0,selection.start).lastIndexOf('\n')+1;var end=text.slice(selection.end).indexOf('\n')+selection.end;if(end===selection.end-1){end=text.length;}return{start:start,end:end};}/**
76773
+ // `*` is a prefix of `**`, so `**text**` is bold-only and `***text***` is bold+italic.
76774
+ function isItalicInsideBoldOnly(text,start,end){var insideBold=start>=2&&end+2<=text.length&&text.slice(start-2,start)==='**'&&text.slice(end,end+2)==='**';if(!insideBold){return false;}var insideBoldItalic=start>=3&&end+3<=text.length&&text.slice(start-3,start)==='***'&&text.slice(end,end+3)==='***';return!insideBoldItalic;}function isAlreadyWrapped(selectedText,prefix,suffix){if(selectedText.length<prefix.length+suffix.length||!selectedText.startsWith(prefix)||!selectedText.endsWith(suffix)){return false;}if(prefix==='*'&&suffix==='*'){var isBold=selectedText.startsWith('**')&&selectedText.endsWith('**');var isBoldItalic=selectedText.startsWith('***')&&selectedText.endsWith('***');if(isBold&&!isBoldItalic){return false;}}return true;}function selectWord(_ref){var text=_ref.text,selection=_ref.selection,prefix=_ref.prefix,_ref$suffix=_ref.suffix,suffix=_ref$suffix===void 0?prefix:_ref$suffix;var result=selection;if(text&&text.length&&selection.start===selection.end){result=getSurroundingWord(text,selection.start);}if(result.start>=prefix.length&&result.end<=text.length-suffix.length){var selectedTextContext=text.slice(result.start-prefix.length,result.end+suffix.length);if(selectedTextContext.startsWith(prefix)&&selectedTextContext.endsWith(suffix)){if(prefix==='*'&&suffix==='*'&&isItalicInsideBoldOnly(text,result.start,result.end)){return result;}return{start:result.start-prefix.length,end:result.end+suffix.length};}}return result;}function selectLine(_ref2){var text=_ref2.text,selection=_ref2.selection;var start=text.slice(0,selection.start).lastIndexOf('\n')+1;var end=text.slice(selection.end).indexOf('\n')+selection.end;if(end===selection.end-1){end=text.length;}return{start:start,end:end};}/**
77344
76775
  * Gets the number of line-breaks that would have to be inserted before the given 'startPosition'
77345
76776
  * to make sure there's an empty line between 'startPosition' and the previous text
77346
76777
  */function getBreaksNeededForEmptyLineBefore(){var text=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';var startPosition=arguments.length>1?arguments[1]:undefined;if(startPosition===0)return 0;// rules:
@@ -77360,7 +76791,7 @@ var neededBreaks=2;var isInLastLine=true;for(var i=startPosition;i<text.length&&
77360
76791
  var start=0;// rightIndex is initialized to text.length because if selection is equal to text.length it won't even enter the interation
77361
76792
  var end=text.length;// iterate to the left
77362
76793
  for(var i=position;i-1>-1;i--){if(isWordDelimiter(text[i-1])){start=i;break;}}// iterate to the right
77363
- for(var _i=position;_i<text.length;_i++){if(isWordDelimiter(text[_i])){end=_i;break;}}return{start:start,end:end};}function executeCommand(_ref3){var api=_ref3.api,selectedText=_ref3.selectedText,selection=_ref3.selection,prefix=_ref3.prefix,_ref3$suffix=_ref3.suffix,suffix=_ref3$suffix===void 0?prefix:_ref3$suffix;if(selectedText.length>=prefix.length+suffix.length&&selectedText.startsWith(prefix)&&selectedText.endsWith(suffix)){api.replaceSelection(selectedText.slice(prefix.length,suffix.length?-suffix.length:undefined));api.setSelectionRange({start:selection.start-prefix.length,end:selection.end-prefix.length});}else{api.replaceSelection("".concat(prefix).concat(selectedText).concat(suffix));api.setSelectionRange({start:selection.start+prefix.length,end:selection.end+prefix.length});}}/**
76794
+ for(var _i=position;_i<text.length;_i++){if(isWordDelimiter(text[_i])){end=_i;break;}}return{start:start,end:end};}function executeCommand(_ref3){var api=_ref3.api,selectedText=_ref3.selectedText,selection=_ref3.selection,prefix=_ref3.prefix,_ref3$suffix=_ref3.suffix,suffix=_ref3$suffix===void 0?prefix:_ref3$suffix;if(isAlreadyWrapped(selectedText,prefix,suffix)){api.replaceSelection(selectedText.slice(prefix.length,suffix.length?-suffix.length:undefined));api.setSelectionRange({start:selection.start-prefix.length,end:selection.end-prefix.length});}else{api.replaceSelection("".concat(prefix).concat(selectedText).concat(suffix));api.setSelectionRange({start:selection.start+prefix.length,end:selection.end+prefix.length});}}/**
77364
76795
  * Inserts insertionString before each line
77365
76796
  */function insertBeforeEachLine(selectedText,insertBefore){var lines=selectedText.split(/\n/);var insertionLength=0;var modifiedText=lines.map(function(item,index){if(typeof insertBefore==='string'){if(item.startsWith(insertBefore)){insertionLength-=insertBefore.length;return item.slice(insertBefore.length);}insertionLength+=insertBefore.length;return insertBefore+item;}if(typeof insertBefore==='function'){if(item.startsWith(insertBefore(item,index))){insertionLength-=insertBefore(item,index).length;return item.slice(insertBefore(item,index).length);}var insertionResult=insertBefore(item,index);insertionLength+=insertionResult.length;return insertBefore(item,index)+item;}throw Error('insertion is expected to be either a string or a function');}).join('\n');return{modifiedText:modifiedText,insertionLength:insertionLength};}
77366
76797
  ;// ./src/commands/bold.tsx
@@ -77546,7 +76977,7 @@ function Child_Child(props){var _ref=props||{},prefixCls=_ref.prefixCls,groupNam
77546
76977
  // extracted by mini-css-extract-plugin
77547
76978
  /* harmony default export */ const Toolbar = ((/* unused pure expression or super */ null && ({})));
77548
76979
  ;// ./src/components/Toolbar/index.tsx
77549
- function ToolbarItems(props){var prefixCls=props.prefixCls,overflow=props.overflow;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),fullscreen=_useContext.fullscreen,preview=_useContext.preview,_useContext$barPopup=_useContext.barPopup,barPopup=_useContext$barPopup===void 0?{}:_useContext$barPopup,components=_useContext.components,commandOrchestrator=_useContext.commandOrchestrator,dispatch=_useContext.dispatch;var originalOverflow=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('');function handleClick(command,name){if(!dispatch)return;var state={barPopup:_objectSpread2({},barPopup)};if(command.keyCommand==='preview'){state.preview=command.value;}if(command.keyCommand==='fullscreen'){state.fullscreen=!fullscreen;}if(props.commands&&command.keyCommand==='group'){props.commands.forEach(function(item){if(name===item.groupName){state.barPopup[name]=true;}else if(item.keyCommand){state.barPopup[item.groupName]=false;}});}else if(name||command.parent){Object.keys(state.barPopup||{}).forEach(function(keyName){state.barPopup[keyName]=false;});}if(Object.keys(state).length){dispatch(_objectSpread2({},state));}commandOrchestrator&&commandOrchestrator.executeCommand(command);}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document&&overflow){if(fullscreen){// prevent scroll on fullscreen
76980
+ function ToolbarItems(props){var prefixCls=props.prefixCls,overflow=props.overflow;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),fullscreen=_useContext.fullscreen,preview=_useContext.preview,_useContext$barPopup=_useContext.barPopup,barPopup=_useContext$barPopup===void 0?{}:_useContext$barPopup,components=_useContext.components,commandOrchestrator=_useContext.commandOrchestrator,dispatch=_useContext.dispatch;var originalOverflow=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('');function handleClick(command,name){if(!dispatch)return;var state={barPopup:_objectSpread2({},barPopup)};if(command.keyCommand==='preview'){state.preview=command.value;}if(command.keyCommand==='fullscreen'){state.fullscreen=!fullscreen;}if(props.commands&&command.keyCommand==='group'){props.commands.forEach(function(item){if(name===item.groupName){state.barPopup[name]=true;}else if(item.keyCommand){state.barPopup[item.groupName]=false;}});}else if(name||command.parent){Object.keys(state.barPopup||{}).forEach(function(keyName){state.barPopup[keyName]=false;});}if(Object.keys(state).length){dispatch(_objectSpread2({},state));}commandOrchestrator&&commandOrchestrator.executeCommand(command);};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document&&overflow){if(fullscreen){// prevent scroll on fullscreen
77550
76981
  document.body.style.overflow='hidden';}else{// get the original overflow only the first time
77551
76982
  if(!originalOverflow.current){originalOverflow.current=window.getComputedStyle(document.body,null).overflow;}// reset to the original overflow
77552
76983
  document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOverflow,overflow]);return/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:(props.commands||[]).map(function(item,idx){if(item.keyCommand==='divider'){return/*#__PURE__*/(0,jsx_runtime.jsx)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:"".concat(prefixCls,"-toolbar-divider")}),idx);}if(!item.keyCommand)return/*#__PURE__*/(0,jsx_runtime.jsx)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{},idx);var activeBtn=fullscreen&&item.keyCommand==='fullscreen'||item.keyCommand==='preview'&&preview===item.value;var childNode=item.children&&typeof item.children==='function'?item.children({getState:function getState(){return commandOrchestrator.getState();},textApi:commandOrchestrator?commandOrchestrator.textApi:undefined,close:function close(){return handleClick({},item.groupName);},execute:function execute(){return handleClick({execute:item.execute});},dispatch:dispatch}):undefined;var disabled=barPopup&&preview&&preview==='preview'&&!/(preview|fullscreen)/.test(item.keyCommand);var render=(components===null||components===void 0?void 0:components.toolbar)||item.render;var com=render&&typeof render==='function'?render(item,!!disabled,handleClick,idx):null;return/*#__PURE__*/(0,jsx_runtime.jsxs)("li",_objectSpread2(_objectSpread2({},item.liProps),{},{className:activeBtn?"active":'',children:[com&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(com)&&com,!com&&!item.buttonProps&&item.icon,!com&&item.buttonProps&&/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('button',_objectSpread2(_objectSpread2({type:'button',key:idx,disabled:disabled,'data-name':item.name},item.buttonProps),{},{onClick:function onClick(evn){evn.stopPropagation();handleClick(item,item.groupName);}}),item.icon),item.children&&/*#__PURE__*/(0,jsx_runtime.jsx)(Child_Child,{overflow:overflow,groupName:item.groupName,prefixCls:prefixCls,children:childNode,commands:Array.isArray(item.children)?item.children:undefined})]}),idx);})});}function Toolbar_Toolbar(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var prefixCls=props.prefixCls,isChild=props.isChild,className=props.className;var _useContext2=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),commands=_useContext2.commands,extraCommands=_useContext2.extraCommands;return/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{className:"".concat(prefixCls,"-toolbar ").concat(className),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:props.commands||commands||[]})),!isChild&&/*#__PURE__*/(0,jsx_runtime.jsx)(ToolbarItems,_objectSpread2(_objectSpread2({},props),{},{commands:extraCommands||[]}))]});}function ToolbarVisibility(props){var hideToolbar=props.hideToolbar,toolbarBottom=props.toolbarBottom,placement=props.placement,overflow=props.overflow,prefixCls=props.prefixCls;if(hideToolbar||placement==='bottom'&&!toolbarBottom||placement==='top'&&toolbarBottom){return null;}var cls=toolbarBottom?'bottom':'';return/*#__PURE__*/(0,jsx_runtime.jsx)(Toolbar_Toolbar,{prefixCls:prefixCls,overflow:overflow,className:cls});}
@@ -77554,7 +76985,7 @@ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOv
77554
76985
  // extracted by mini-css-extract-plugin
77555
76986
  /* harmony default export */ const DragBar = ((/* unused pure expression or super */ null && ({})));
77556
76987
  ;// ./src/components/DragBar/index.tsx
77557
- var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
76988
+ var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
77558
76989
  },[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})});},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
77559
76990
  ;// ./src/Editor.factory.tsx
77560
76991
  var Editor_factory_excluded=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}function createMDEditor(options){var MarkdownPreview=options.MarkdownPreview,TextArea=options.TextArea;var PreviewComponent=MarkdownPreview;var TextAreaComponent=TextArea;var InternalMDEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,direction=_ref.direction,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$autoFocusEnd=_ref.autoFocusEnd,autoFocusEnd=_ref$autoFocusEnd===void 0?false:_ref$autoFocusEnd,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,onChange=_ref.onChange,onStatistics=_ref.onStatistics,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_factory_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,minHeight:minHeight,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2(_objectSpread2({},state),{},{container:container.current,dispatch:dispatch});});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -77574,8 +77005,613 @@ var Editor_factory_excluded=["prefixCls","className","value","commands","command
77574
77005
  /* harmony default export */ const src = ((/* unused pure expression or super */ null && ({})));
77575
77006
  ;// ./src/index.tsx
77576
77007
  /* harmony default export */ const src_0 = (Editor);
77577
- })();
77578
77008
 
77009
+ /***/ },
77010
+
77011
+ /***/ 740
77012
+ (module) {
77013
+
77014
+ module.exports = {
77015
+ trueFunc: function trueFunc(){
77016
+ return true;
77017
+ },
77018
+ falseFunc: function falseFunc(){
77019
+ return false;
77020
+ }
77021
+ };
77022
+
77023
+ /***/ },
77024
+
77025
+ /***/ 689
77026
+ (module) {
77027
+
77028
+ "use strict";
77029
+
77030
+
77031
+ // http://www.w3.org/TR/CSS21/grammar.html
77032
+ // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
77033
+ var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
77034
+
77035
+ var NEWLINE_REGEX = /\n/g;
77036
+ var WHITESPACE_REGEX = /^\s*/;
77037
+
77038
+ // declaration
77039
+ var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
77040
+ var COLON_REGEX = /^:\s*/;
77041
+ var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
77042
+ var SEMICOLON_REGEX = /^[;\s]*/;
77043
+
77044
+ // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
77045
+ var TRIM_REGEX = /^\s+|\s+$/g;
77046
+
77047
+ // strings
77048
+ var NEWLINE = '\n';
77049
+ var FORWARD_SLASH = '/';
77050
+ var ASTERISK = '*';
77051
+ var EMPTY_STRING = '';
77052
+
77053
+ // types
77054
+ var TYPE_COMMENT = 'comment';
77055
+ var TYPE_DECLARATION = 'declaration';
77056
+
77057
+ /**
77058
+ * @param {String} style
77059
+ * @param {Object} [options]
77060
+ * @return {Object[]}
77061
+ * @throws {TypeError}
77062
+ * @throws {Error}
77063
+ */
77064
+ function index (style, options) {
77065
+ if (typeof style !== 'string') {
77066
+ throw new TypeError('First argument must be a string');
77067
+ }
77068
+
77069
+ if (!style) return [];
77070
+
77071
+ options = options || {};
77072
+
77073
+ /**
77074
+ * Positional.
77075
+ */
77076
+ var lineno = 1;
77077
+ var column = 1;
77078
+
77079
+ /**
77080
+ * Update lineno and column based on `str`.
77081
+ *
77082
+ * @param {String} str
77083
+ */
77084
+ function updatePosition(str) {
77085
+ var lines = str.match(NEWLINE_REGEX);
77086
+ if (lines) lineno += lines.length;
77087
+ var i = str.lastIndexOf(NEWLINE);
77088
+ column = ~i ? str.length - i : column + str.length;
77089
+ }
77090
+
77091
+ /**
77092
+ * Mark position and patch `node.position`.
77093
+ *
77094
+ * @return {Function}
77095
+ */
77096
+ function position() {
77097
+ var start = { line: lineno, column: column };
77098
+ return function (node) {
77099
+ node.position = new Position(start);
77100
+ whitespace();
77101
+ return node;
77102
+ };
77103
+ }
77104
+
77105
+ /**
77106
+ * Store position information for a node.
77107
+ *
77108
+ * @constructor
77109
+ * @property {Object} start
77110
+ * @property {Object} end
77111
+ * @property {undefined|String} source
77112
+ */
77113
+ function Position(start) {
77114
+ this.start = start;
77115
+ this.end = { line: lineno, column: column };
77116
+ this.source = options.source;
77117
+ }
77118
+
77119
+ /**
77120
+ * Non-enumerable source string.
77121
+ */
77122
+ Position.prototype.content = style;
77123
+
77124
+ /**
77125
+ * Error `msg`.
77126
+ *
77127
+ * @param {String} msg
77128
+ * @throws {Error}
77129
+ */
77130
+ function error(msg) {
77131
+ var err = new Error(
77132
+ options.source + ':' + lineno + ':' + column + ': ' + msg
77133
+ );
77134
+ err.reason = msg;
77135
+ err.filename = options.source;
77136
+ err.line = lineno;
77137
+ err.column = column;
77138
+ err.source = style;
77139
+
77140
+ if (options.silent) ; else {
77141
+ throw err;
77142
+ }
77143
+ }
77144
+
77145
+ /**
77146
+ * Match `re` and return captures.
77147
+ *
77148
+ * @param {RegExp} re
77149
+ * @return {undefined|Array}
77150
+ */
77151
+ function match(re) {
77152
+ var m = re.exec(style);
77153
+ if (!m) return;
77154
+ var str = m[0];
77155
+ updatePosition(str);
77156
+ style = style.slice(str.length);
77157
+ return m;
77158
+ }
77159
+
77160
+ /**
77161
+ * Parse whitespace.
77162
+ */
77163
+ function whitespace() {
77164
+ match(WHITESPACE_REGEX);
77165
+ }
77166
+
77167
+ /**
77168
+ * Parse comments.
77169
+ *
77170
+ * @param {Object[]} [rules]
77171
+ * @return {Object[]}
77172
+ */
77173
+ function comments(rules) {
77174
+ var c;
77175
+ rules = rules || [];
77176
+ while ((c = comment())) {
77177
+ if (c !== false) {
77178
+ rules.push(c);
77179
+ }
77180
+ }
77181
+ return rules;
77182
+ }
77183
+
77184
+ /**
77185
+ * Parse comment.
77186
+ *
77187
+ * @return {Object}
77188
+ * @throws {Error}
77189
+ */
77190
+ function comment() {
77191
+ var pos = position();
77192
+ if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
77193
+
77194
+ var i = 2;
77195
+ while (
77196
+ EMPTY_STRING != style.charAt(i) &&
77197
+ (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
77198
+ ) {
77199
+ ++i;
77200
+ }
77201
+ i += 2;
77202
+
77203
+ if (EMPTY_STRING === style.charAt(i - 1)) {
77204
+ return error('End of comment missing');
77205
+ }
77206
+
77207
+ var str = style.slice(2, i - 2);
77208
+ column += 2;
77209
+ updatePosition(str);
77210
+ style = style.slice(i);
77211
+ column += 2;
77212
+
77213
+ return pos({
77214
+ type: TYPE_COMMENT,
77215
+ comment: str
77216
+ });
77217
+ }
77218
+
77219
+ /**
77220
+ * Parse declaration.
77221
+ *
77222
+ * @return {Object}
77223
+ * @throws {Error}
77224
+ */
77225
+ function declaration() {
77226
+ var pos = position();
77227
+
77228
+ // prop
77229
+ var prop = match(PROPERTY_REGEX);
77230
+ if (!prop) return;
77231
+ comment();
77232
+
77233
+ // :
77234
+ if (!match(COLON_REGEX)) return error("property missing ':'");
77235
+
77236
+ // val
77237
+ var val = match(VALUE_REGEX);
77238
+
77239
+ var ret = pos({
77240
+ type: TYPE_DECLARATION,
77241
+ property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
77242
+ value: val
77243
+ ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
77244
+ : EMPTY_STRING
77245
+ });
77246
+
77247
+ // ;
77248
+ match(SEMICOLON_REGEX);
77249
+
77250
+ return ret;
77251
+ }
77252
+
77253
+ /**
77254
+ * Parse declarations.
77255
+ *
77256
+ * @return {Object[]}
77257
+ */
77258
+ function declarations() {
77259
+ var decls = [];
77260
+
77261
+ comments(decls);
77262
+
77263
+ // declarations
77264
+ var decl;
77265
+ while ((decl = declaration())) {
77266
+ if (decl !== false) {
77267
+ decls.push(decl);
77268
+ comments(decls);
77269
+ }
77270
+ }
77271
+
77272
+ return decls;
77273
+ }
77274
+
77275
+ whitespace();
77276
+ return declarations();
77277
+ }
77278
+
77279
+ /**
77280
+ * Trim `str`.
77281
+ *
77282
+ * @param {String} str
77283
+ * @return {String}
77284
+ */
77285
+ function trim(str) {
77286
+ return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
77287
+ }
77288
+
77289
+ module.exports = index;
77290
+ //# sourceMappingURL=index.js.map
77291
+
77292
+
77293
+ /***/ },
77294
+
77295
+ /***/ 934
77296
+ (module, exports) {
77297
+
77298
+ /**
77299
+ * @param {string} string The string to parse
77300
+ * @returns {Array<number>} Returns an energetic array.
77301
+ */
77302
+ function parsePart(string) {
77303
+ let res = [];
77304
+ let m;
77305
+
77306
+ for (let str of string.split(",").map((str) => str.trim())) {
77307
+ // just a number
77308
+ if (/^-?\d+$/.test(str)) {
77309
+ res.push(parseInt(str, 10));
77310
+ } else if (
77311
+ (m = str.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/))
77312
+ ) {
77313
+ // 1-5 or 1..5 (equivalent) or 1...5 (doesn't include 5)
77314
+ let [_, lhs, sep, rhs] = m;
77315
+
77316
+ if (lhs && rhs) {
77317
+ lhs = parseInt(lhs);
77318
+ rhs = parseInt(rhs);
77319
+ const incr = lhs < rhs ? 1 : -1;
77320
+
77321
+ // Make it inclusive by moving the right 'stop-point' away by one.
77322
+ if (sep === "-" || sep === ".." || sep === "\u2025") rhs += incr;
77323
+
77324
+ for (let i = lhs; i !== rhs; i += incr) res.push(i);
77325
+ }
77326
+ }
77327
+ }
77328
+
77329
+ return res;
77330
+ }
77331
+
77332
+ exports["default"] = parsePart;
77333
+ module.exports = parsePart;
77334
+
77335
+
77336
+ /***/ },
77337
+
77338
+ /***/ 192
77339
+ (__unused_webpack_module, exports, __webpack_require__) {
77340
+
77341
+ "use strict";
77342
+ /**
77343
+ * @license React
77344
+ * react-jsx-runtime.production.min.js
77345
+ *
77346
+ * Copyright (c) Facebook, Inc. and its affiliates.
77347
+ *
77348
+ * This source code is licensed under the MIT license found in the
77349
+ * LICENSE file in the root directory of this source tree.
77350
+ */
77351
+ var f=__webpack_require__(442),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
77352
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
77353
+
77354
+
77355
+ /***/ },
77356
+
77357
+ /***/ 540
77358
+ (module, __unused_webpack_exports, __webpack_require__) {
77359
+
77360
+ "use strict";
77361
+
77362
+
77363
+ if (true) {
77364
+ module.exports = __webpack_require__(192);
77365
+ } else // removed by dead control flow
77366
+ {}
77367
+
77368
+
77369
+ /***/ },
77370
+
77371
+ /***/ 321
77372
+ (module, __unused_webpack_exports, __webpack_require__) {
77373
+
77374
+ "use strict";
77375
+
77376
+ var __importDefault = (this && this.__importDefault) || function (mod) {
77377
+ return (mod && mod.__esModule) ? mod : { "default": mod };
77378
+ };
77379
+ var style_to_object_1 = __importDefault(__webpack_require__(857));
77380
+ var utilities_1 = __webpack_require__(969);
77381
+ /**
77382
+ * Parses CSS inline style to JavaScript object (camelCased).
77383
+ */
77384
+ function StyleToJS(style, options) {
77385
+ var output = {};
77386
+ if (!style || typeof style !== 'string') {
77387
+ return output;
77388
+ }
77389
+ (0, style_to_object_1.default)(style, function (property, value) {
77390
+ // skip CSS comment
77391
+ if (property && value) {
77392
+ output[(0, utilities_1.camelCase)(property, options)] = value;
77393
+ }
77394
+ });
77395
+ return output;
77396
+ }
77397
+ StyleToJS.default = StyleToJS;
77398
+ module.exports = StyleToJS;
77399
+ //# sourceMappingURL=index.js.map
77400
+
77401
+ /***/ },
77402
+
77403
+ /***/ 969
77404
+ (__unused_webpack_module, exports) {
77405
+
77406
+ "use strict";
77407
+
77408
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
77409
+ exports.camelCase = void 0;
77410
+ var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
77411
+ var HYPHEN_REGEX = /-([a-z])/g;
77412
+ var NO_HYPHEN_REGEX = /^[^-]+$/;
77413
+ var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
77414
+ var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
77415
+ /**
77416
+ * Checks whether to skip camelCase.
77417
+ */
77418
+ var skipCamelCase = function (property) {
77419
+ return !property ||
77420
+ NO_HYPHEN_REGEX.test(property) ||
77421
+ CUSTOM_PROPERTY_REGEX.test(property);
77422
+ };
77423
+ /**
77424
+ * Replacer that capitalizes first character.
77425
+ */
77426
+ var capitalize = function (match, character) {
77427
+ return character.toUpperCase();
77428
+ };
77429
+ /**
77430
+ * Replacer that removes beginning hyphen of vendor prefix property.
77431
+ */
77432
+ var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
77433
+ /**
77434
+ * CamelCases a CSS property.
77435
+ */
77436
+ var camelCase = function (property, options) {
77437
+ if (options === void 0) { options = {}; }
77438
+ if (skipCamelCase(property)) {
77439
+ return property;
77440
+ }
77441
+ property = property.toLowerCase();
77442
+ if (options.reactCompat) {
77443
+ // `-ms` vendor prefix should not be capitalized
77444
+ property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
77445
+ }
77446
+ else {
77447
+ // for non-React, remove first hyphen so vendor prefix is not capitalized
77448
+ property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
77449
+ }
77450
+ return property.replace(HYPHEN_REGEX, capitalize);
77451
+ };
77452
+ exports.camelCase = camelCase;
77453
+ //# sourceMappingURL=utilities.js.map
77454
+
77455
+ /***/ },
77456
+
77457
+ /***/ 857
77458
+ (__unused_webpack_module, exports, __webpack_require__) {
77459
+
77460
+ "use strict";
77461
+
77462
+ var __importDefault = (this && this.__importDefault) || function (mod) {
77463
+ return (mod && mod.__esModule) ? mod : { "default": mod };
77464
+ };
77465
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
77466
+ exports["default"] = StyleToObject;
77467
+ const inline_style_parser_1 = __importDefault(__webpack_require__(689));
77468
+ /**
77469
+ * Parses inline style to object.
77470
+ *
77471
+ * @param style - Inline style.
77472
+ * @param iterator - Iterator.
77473
+ * @returns - Style object or null.
77474
+ *
77475
+ * @example Parsing inline style to object:
77476
+ *
77477
+ * ```js
77478
+ * import parse from 'style-to-object';
77479
+ * parse('line-height: 42;'); // { 'line-height': '42' }
77480
+ * ```
77481
+ */
77482
+ function StyleToObject(style, iterator) {
77483
+ let styleObject = null;
77484
+ if (!style || typeof style !== 'string') {
77485
+ return styleObject;
77486
+ }
77487
+ const declarations = (0, inline_style_parser_1.default)(style);
77488
+ const hasIterator = typeof iterator === 'function';
77489
+ declarations.forEach((declaration) => {
77490
+ if (declaration.type !== 'declaration') {
77491
+ return;
77492
+ }
77493
+ const { property, value } = declaration;
77494
+ if (hasIterator) {
77495
+ iterator(property, value, declaration);
77496
+ }
77497
+ else if (value) {
77498
+ styleObject = styleObject || {};
77499
+ styleObject[property] = value;
77500
+ }
77501
+ });
77502
+ return styleObject;
77503
+ }
77504
+ //# sourceMappingURL=index.js.map
77505
+
77506
+ /***/ },
77507
+
77508
+ /***/ 442
77509
+ (module) {
77510
+
77511
+ "use strict";
77512
+ module.exports = __WEBPACK_EXTERNAL_MODULE__442__;
77513
+
77514
+ /***/ }
77515
+
77516
+ /******/ });
77517
+ /************************************************************************/
77518
+ /******/ // The module cache
77519
+ /******/ const __webpack_module_cache__ = {};
77520
+ /******/
77521
+ /******/ // The require function
77522
+ /******/ function __webpack_require__(moduleId) {
77523
+ /******/ // Check if module is in cache
77524
+ /******/ const cachedModule = __webpack_module_cache__[moduleId];
77525
+ /******/ if (cachedModule !== undefined) {
77526
+ /******/ return cachedModule.exports;
77527
+ /******/ }
77528
+ /******/ // Create a new module (and put it into the cache)
77529
+ /******/ const module = __webpack_module_cache__[moduleId] = {
77530
+ /******/ // no module.id needed
77531
+ /******/ // no module.loaded needed
77532
+ /******/ exports: {}
77533
+ /******/ };
77534
+ /******/
77535
+ /******/ // Execute the module function
77536
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
77537
+ /******/
77538
+ /******/ // Return the exports of the module
77539
+ /******/ return module.exports;
77540
+ /******/ }
77541
+ /******/
77542
+ /************************************************************************/
77543
+ /******/ /* webpack/runtime/compat get default export */
77544
+ /******/ (() => {
77545
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
77546
+ /******/ __webpack_require__.n = (module) => {
77547
+ /******/ const getter = module && module.__esModule ?
77548
+ /******/ () => (module['default']) :
77549
+ /******/ () => (module);
77550
+ /******/ __webpack_require__.d(getter, { a: getter });
77551
+ /******/ return getter;
77552
+ /******/ };
77553
+ /******/ })();
77554
+ /******/
77555
+ /******/ /* webpack/runtime/define property getters */
77556
+ /******/ (() => {
77557
+ /******/ // define getter/value functions for harmony exports
77558
+ /******/ __webpack_require__.d = (exports, definition) => {
77559
+ /******/ if(Array.isArray(definition)) {
77560
+ /******/ var i = 0;
77561
+ /******/ while(i < definition.length) {
77562
+ /******/ var key = definition[i++];
77563
+ /******/ var binding = definition[i++];
77564
+ /******/ if(!__webpack_require__.o(exports, key)) {
77565
+ /******/ if(binding === 0) {
77566
+ /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
77567
+ /******/ } else {
77568
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
77569
+ /******/ }
77570
+ /******/ } else if(binding === 0) { i++; }
77571
+ /******/ }
77572
+ /******/ } else {
77573
+ /******/ for(var key in definition) {
77574
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
77575
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
77576
+ /******/ }
77577
+ /******/ }
77578
+ /******/ }
77579
+ /******/ };
77580
+ /******/ })();
77581
+ /******/
77582
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
77583
+ /******/ (() => {
77584
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
77585
+ /******/ })();
77586
+ /******/
77587
+ /******/ /* webpack/runtime/make namespace object */
77588
+ /******/ (() => {
77589
+ /******/ // define __esModule on exports
77590
+ /******/ __webpack_require__.r = (exports) => {
77591
+ /******/ if(Symbol.toStringTag) {
77592
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
77593
+ /******/ }
77594
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
77595
+ /******/ };
77596
+ /******/ })();
77597
+ /******/
77598
+ /******/ /* webpack/runtime/wrap commonjs module */
77599
+ /******/ (() => {
77600
+ /******/ // execute a CommonJS module body with real module/exports objects, returning the final exports
77601
+ /******/ __webpack_require__.cjs = (body) => {
77602
+ /******/ const mod = { exports: {} };
77603
+ /******/ body.call(mod.exports, mod, mod.exports);
77604
+ /******/ return mod.exports;
77605
+ /******/ };
77606
+ /******/ })();
77607
+ /******/
77608
+ /************************************************************************/
77609
+ /******/
77610
+ /******/ // startup
77611
+ /******/ // Load entry module and return exports
77612
+ /******/ // This entry module used 'module' so it can't be inlined
77613
+ /******/ let __webpack_exports__ = __webpack_require__(993);
77614
+ /******/
77579
77615
  /******/ return __webpack_exports__;
77580
77616
  /******/ })()
77581
77617
  ;