@jobber/components 6.123.1 → 6.123.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.
Files changed (230) hide show
  1. package/dist/AtlantisThemeContext-cjs.js +1 -1
  2. package/dist/AtlantisThemeContext-es.js +9 -9
  3. package/dist/Autocomplete/Autocomplete.types.d.ts +33 -0
  4. package/dist/Autocomplete/index.cjs +5 -5
  5. package/dist/Autocomplete/index.mjs +8 -8
  6. package/dist/Autocomplete/useAutocomplete.d.ts +2 -57
  7. package/dist/Body-cjs.js +1 -1
  8. package/dist/Body-es.js +2 -2
  9. package/dist/BottomSheet-cjs.js +1 -1
  10. package/dist/BottomSheet-es.js +1 -1
  11. package/dist/Box-cjs.js +2 -2
  12. package/dist/Box-es.js +2 -2
  13. package/dist/Button/index.mjs +1 -1
  14. package/dist/Button-es.js +1 -1
  15. package/dist/Card-cjs.js +1 -1
  16. package/dist/Card-es.js +1 -1
  17. package/dist/Checkbox/index.cjs +1 -1
  18. package/dist/Checkbox/index.mjs +1 -1
  19. package/dist/Chip/index.mjs +1 -1
  20. package/dist/Chip-cjs.js +2 -2
  21. package/dist/Chip-es.js +2 -2
  22. package/dist/ChipDismissible-es.js +1 -1
  23. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +1 -1
  24. package/dist/Combobox-cjs.js +1 -1
  25. package/dist/Combobox-es.js +1 -1
  26. package/dist/ComboboxAction-cjs.js +1 -1
  27. package/dist/ComboboxAction-es.js +1 -1
  28. package/dist/ComboboxContent-cjs.js +1 -1
  29. package/dist/ComboboxContent-es.js +2 -2
  30. package/dist/ComboboxContentHeader-cjs.js +1 -1
  31. package/dist/ComboboxContentHeader-es.js +1 -1
  32. package/dist/ComboboxContentList-es.js +1 -1
  33. package/dist/ComboboxContentSearch-cjs.js +1 -1
  34. package/dist/ComboboxContentSearch-es.js +1 -1
  35. package/dist/ComboboxLoadMore-cjs.js +1 -1
  36. package/dist/ComboboxLoadMore-es.js +1 -1
  37. package/dist/ComboboxOption-cjs.js +1 -1
  38. package/dist/ComboboxOption-es.js +1 -1
  39. package/dist/Container-cjs.js +1 -1
  40. package/dist/Container-es.js +1 -1
  41. package/dist/Content-cjs.js +1 -1
  42. package/dist/Content-es.js +1 -1
  43. package/dist/ContentBlock-cjs.js +1 -1
  44. package/dist/ContentBlock-es.js +1 -1
  45. package/dist/Countdown-cjs.js +7 -3
  46. package/dist/Countdown-es.js +8 -4
  47. package/dist/Cover-cjs.js +1 -1
  48. package/dist/Cover-es.js +1 -1
  49. package/dist/DataList-es.js +3 -3
  50. package/dist/DataList.const-cjs.js +0 -1
  51. package/dist/DataList.const-es.js +1 -2
  52. package/dist/DataList.module-cjs.js +1 -1
  53. package/dist/DataList.module-es.js +1 -1
  54. package/dist/DataList.utils-es.js +6 -6
  55. package/dist/DataListAction-cjs.js +1 -1
  56. package/dist/DataListAction-es.js +1 -1
  57. package/dist/DataListActionsMenu-cjs.js +1 -1
  58. package/dist/DataListActionsMenu-es.js +2 -2
  59. package/dist/DataListBulkActions-cjs.js +1 -1
  60. package/dist/DataListBulkActions-es.js +1 -1
  61. package/dist/DataListContext-cjs.js +6 -5
  62. package/dist/DataListContext-es.js +6 -5
  63. package/dist/DataListEmptyState-cjs.js +1 -1
  64. package/dist/DataListEmptyState-es.js +1 -1
  65. package/dist/DataListHeaderTile-cjs.js +2 -2
  66. package/dist/DataListHeaderTile-es.js +2 -2
  67. package/dist/DataListItemActions-cjs.js +1 -1
  68. package/dist/DataListItemActions-es.js +2 -2
  69. package/dist/DataListLayoutActions-cjs.js +1 -1
  70. package/dist/DataListLayoutActions-es.js +2 -2
  71. package/dist/DataListLoadMore-cjs.js +1 -1
  72. package/dist/DataListLoadMore-es.js +1 -1
  73. package/dist/DataListLoadingState-cjs.js +1 -1
  74. package/dist/DataListLoadingState-es.js +2 -2
  75. package/dist/DataListOverflowFade-cjs.js +1 -1
  76. package/dist/DataListOverflowFade-es.js +1 -1
  77. package/dist/DataListSearch-cjs.js +1 -1
  78. package/dist/DataListSearch-es.js +1 -1
  79. package/dist/DataListSortingOptions-cjs.js +1 -1
  80. package/dist/DataListSortingOptions-es.js +1 -1
  81. package/dist/DataListStickyHeader-cjs.js +1 -1
  82. package/dist/DataListStickyHeader-es.js +1 -1
  83. package/dist/DataListTags-cjs.js +1 -1
  84. package/dist/DataListTags-es.js +1 -1
  85. package/dist/DataListTotalCount-cjs.js +1 -1
  86. package/dist/DataListTotalCount-es.js +2 -2
  87. package/dist/DataTable/index.mjs +1 -1
  88. package/dist/DataTable-cjs.js +3 -3
  89. package/dist/DataTable-es.js +5 -5
  90. package/dist/DataTableTable-cjs.js +2 -2
  91. package/dist/DataTableTable-es.js +3 -3
  92. package/dist/DatePicker-cjs.js +266 -81
  93. package/dist/DatePicker-es.js +268 -83
  94. package/dist/DayOfMonthSelect-cjs.js +5 -5
  95. package/dist/DayOfMonthSelect-es.js +6 -6
  96. package/dist/DescriptionList-cjs.js +1 -1
  97. package/dist/DescriptionList-es.js +1 -1
  98. package/dist/Disclosure-cjs.js +1 -1
  99. package/dist/Disclosure-es.js +1 -1
  100. package/dist/Divider-cjs.js +1 -1
  101. package/dist/Divider-es.js +1 -1
  102. package/dist/DrawerGrid-cjs.js +2 -2
  103. package/dist/DrawerGrid-es.js +2 -2
  104. package/dist/DrawerRoot-cjs.js +10 -48
  105. package/dist/DrawerRoot-es.js +12 -50
  106. package/dist/FeatureSwitch-cjs.js +1 -1
  107. package/dist/FeatureSwitch-es.js +1 -1
  108. package/dist/FormField/index.mjs +1 -1
  109. package/dist/FormField-cjs.js +1 -1
  110. package/dist/FormField-es.js +2 -2
  111. package/dist/FormatEmail-cjs.js +1 -1
  112. package/dist/FormatEmail-es.js +1 -1
  113. package/dist/FormatFile-cjs.js +1 -6
  114. package/dist/FormatFile-es.js +1 -6
  115. package/dist/Frame-cjs.js +1 -1
  116. package/dist/Frame-es.js +1 -1
  117. package/dist/Glimmer/index.mjs +1 -1
  118. package/dist/Glimmer-cjs.js +1 -1
  119. package/dist/Glimmer-es.js +2 -2
  120. package/dist/Grid-cjs.js +1 -1
  121. package/dist/Grid-es.js +1 -1
  122. package/dist/GridCell-cjs.js +1 -1
  123. package/dist/GridCell-es.js +1 -1
  124. package/dist/InputAvatar-cjs.js +1 -1
  125. package/dist/InputAvatar-es.js +1 -1
  126. package/dist/InputDate/index.mjs +1 -1
  127. package/dist/InputEmail/index.mjs +1 -1
  128. package/dist/InputFile-cjs.js +8 -3
  129. package/dist/InputFile-es.js +8 -3
  130. package/dist/InputNumber/index.cjs +181 -69
  131. package/dist/InputNumber/index.mjs +184 -72
  132. package/dist/InputPassword-es.js +1 -1
  133. package/dist/InputPhoneNumber/index.cjs +1 -1
  134. package/dist/InputPhoneNumber/index.mjs +2 -2
  135. package/dist/InputText/InputText.d.ts +2 -70
  136. package/dist/InputText/index.mjs +1 -1
  137. package/dist/InputTime/index.cjs +0 -1
  138. package/dist/InputTime/index.mjs +1 -2
  139. package/dist/InputValidation-cjs.js +1 -1
  140. package/dist/InputValidation-es.js +1 -1
  141. package/dist/InternalChipDismissible-cjs.js +1 -1
  142. package/dist/InternalChipDismissible-es.js +2 -2
  143. package/dist/LightBox-cjs.js +1 -1
  144. package/dist/LightBox-es.js +1 -1
  145. package/dist/Link-cjs.js +1 -1
  146. package/dist/Link-es.js +1 -1
  147. package/dist/List-cjs.js +3 -3
  148. package/dist/List-es.js +7 -7
  149. package/dist/Markdown-cjs.js +604 -961
  150. package/dist/Markdown-es.js +610 -967
  151. package/dist/Menu/Menu.d.ts +1 -1
  152. package/dist/Menu-cjs.js +859 -629
  153. package/dist/Menu-es.js +855 -625
  154. package/dist/Modal/index.cjs +2 -2
  155. package/dist/Modal/index.mjs +2 -2
  156. package/dist/Modal/useModal.d.ts +9 -29
  157. package/dist/MultiSelect-cjs.js +2 -2
  158. package/dist/MultiSelect-es.js +2 -2
  159. package/dist/OverlaySeparator-cjs.js +1 -1
  160. package/dist/OverlaySeparator-es.js +1 -1
  161. package/dist/Popover-cjs.js +1 -1
  162. package/dist/Popover-es.js +2 -2
  163. package/dist/ProgressBar-cjs.js +1 -1
  164. package/dist/ProgressBar-es.js +1 -1
  165. package/dist/RadioGroup-cjs.js +1 -1
  166. package/dist/RadioGroup-es.js +1 -1
  167. package/dist/RecurringSelect/components/index.mjs +1 -1
  168. package/dist/RecurringSelect/index.cjs +1 -0
  169. package/dist/RecurringSelect/index.mjs +1 -0
  170. package/dist/RecurringSelect-cjs.js +1 -1
  171. package/dist/RecurringSelect-es.js +2 -2
  172. package/dist/SegmentedControl-cjs.js +1 -1
  173. package/dist/SegmentedControl-es.js +2 -2
  174. package/dist/Select/index.cjs +1 -1
  175. package/dist/Select/index.mjs +2 -2
  176. package/dist/SideDrawer-cjs.js +1 -1
  177. package/dist/SideDrawer-es.js +1 -1
  178. package/dist/Spinner-cjs.js +1 -1
  179. package/dist/Spinner-es.js +1 -1
  180. package/dist/StatusIndicator-cjs.js +1 -1
  181. package/dist/StatusIndicator-es.js +1 -1
  182. package/dist/Switch-cjs.js +1 -1
  183. package/dist/Switch-es.js +1 -1
  184. package/dist/Table/index.mjs +1 -1
  185. package/dist/Tabs/index.mjs +1 -1
  186. package/dist/Tabs-cjs.js +1 -1
  187. package/dist/Tabs-es.js +6 -6
  188. package/dist/Text-cjs2.js +365 -175
  189. package/dist/Text-es2.js +361 -175
  190. package/dist/Thumbnail-cjs.js +1 -1
  191. package/dist/Thumbnail-es.js +2 -2
  192. package/dist/Tiles-cjs.js +1 -1
  193. package/dist/Tiles-es.js +1 -1
  194. package/dist/Tooltip-cjs.js +1 -1
  195. package/dist/Tooltip-es.js +2 -2
  196. package/dist/Typography-cjs.js +3 -3
  197. package/dist/Typography-es.js +3 -3
  198. package/dist/_baseEach-cjs.js +1 -1
  199. package/dist/_baseEach-es.js +7 -7
  200. package/dist/_baseFlatten-es.js +1 -1
  201. package/dist/_getAllKeys-cjs.js +2 -8
  202. package/dist/_getAllKeys-es.js +4 -10
  203. package/dist/_getTag-es.js +1 -1
  204. package/dist/_isIterateeCall-es.js +3 -3
  205. package/dist/_setToString-es.js +2 -2
  206. package/dist/debounce-es.js +4 -4
  207. package/dist/floating-ui.react-cjs.js +35 -16
  208. package/dist/floating-ui.react-dom-es.js +2 -2
  209. package/dist/floating-ui.react-es.js +37 -18
  210. package/dist/identity-es.js +5 -5
  211. package/dist/index-cjs.js +6 -6
  212. package/dist/index-es.js +6 -6
  213. package/dist/index.esm-es.js +1 -1
  214. package/dist/index.mjs +6 -6
  215. package/dist/isSymbol-es.js +1 -1
  216. package/dist/isTypedArray-cjs.js +4 -4
  217. package/dist/isTypedArray-es.js +6 -6
  218. package/dist/keysIn-cjs.js +2 -2
  219. package/dist/keysIn-es.js +5 -5
  220. package/dist/noop-es.js +4 -4
  221. package/dist/omit-cjs.js +37 -5
  222. package/dist/omit-es.js +46 -14
  223. package/dist/showToast-cjs.js +1 -1
  224. package/dist/showToast-es.js +1 -1
  225. package/dist/styles.css +56 -124
  226. package/dist/unstyledPrimitives/index.mjs +3 -3
  227. package/dist/useScrollToActive-cjs.js +1 -1
  228. package/dist/useScrollToActive-es.js +8 -8
  229. package/package.json +32 -15
  230. package/rollup.config.mjs +4 -1
@@ -3,7 +3,7 @@ import { T as Text } from './Text-es.js';
3
3
  import { E as Emphasis } from './Emphasis-es.js';
4
4
  import { H as Heading } from './Heading-es.js';
5
5
  import { C as Content } from './Content-es.js';
6
- import { Fragment, jsx, jsxs } from 'react/jsx-runtime';
6
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
7
  import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-es.js';
8
8
 
9
9
  function ok$1() {}
@@ -110,93 +110,107 @@ function empty$1(value) {
110
110
  }
111
111
 
112
112
  /**
113
- * @typedef {import('./info.js').Info} Info
114
- * @typedef {Record<string, Info>} Properties
115
- * @typedef {Record<string, string>} Normal
113
+ * @import {Schema as SchemaType, Space} from 'property-information'
116
114
  */
117
115
 
116
+ /** @type {SchemaType} */
118
117
  class Schema {
119
118
  /**
120
- * @constructor
121
- * @param {Properties} property
122
- * @param {Normal} normal
123
- * @param {string} [space]
119
+ * @param {SchemaType['property']} property
120
+ * Property.
121
+ * @param {SchemaType['normal']} normal
122
+ * Normal.
123
+ * @param {Space | undefined} [space]
124
+ * Space.
125
+ * @returns
126
+ * Schema.
124
127
  */
125
128
  constructor(property, normal, space) {
126
- this.property = property;
127
129
  this.normal = normal;
130
+ this.property = property;
131
+
128
132
  if (space) {
129
133
  this.space = space;
130
134
  }
131
135
  }
132
136
  }
133
137
 
134
- /** @type {Properties} */
135
- Schema.prototype.property = {};
136
- /** @type {Normal} */
137
138
  Schema.prototype.normal = {};
138
- /** @type {string|null} */
139
- Schema.prototype.space = null;
139
+ Schema.prototype.property = {};
140
+ Schema.prototype.space = undefined;
140
141
 
141
142
  /**
142
- * @typedef {import('./schema.js').Properties} Properties
143
- * @typedef {import('./schema.js').Normal} Normal
143
+ * @import {Info, Space} from 'property-information'
144
144
  */
145
145
 
146
146
 
147
147
  /**
148
- * @param {Schema[]} definitions
149
- * @param {string} [space]
148
+ * @param {ReadonlyArray<Schema>} definitions
149
+ * Definitions.
150
+ * @param {Space | undefined} [space]
151
+ * Space.
150
152
  * @returns {Schema}
153
+ * Schema.
151
154
  */
152
155
  function merge(definitions, space) {
153
- /** @type {Properties} */
156
+ /** @type {Record<string, Info>} */
154
157
  const property = {};
155
- /** @type {Normal} */
158
+ /** @type {Record<string, string>} */
156
159
  const normal = {};
157
- let index = -1;
158
160
 
159
- while (++index < definitions.length) {
160
- Object.assign(property, definitions[index].property);
161
- Object.assign(normal, definitions[index].normal);
161
+ for (const definition of definitions) {
162
+ Object.assign(property, definition.property);
163
+ Object.assign(normal, definition.normal);
162
164
  }
163
165
 
164
166
  return new Schema(property, normal, space)
165
167
  }
166
168
 
167
169
  /**
170
+ * Get the cleaned case insensitive form of an attribute or property.
171
+ *
168
172
  * @param {string} value
173
+ * An attribute-like or property-like name.
169
174
  * @returns {string}
175
+ * Value that can be used to look up the properly cased property on a
176
+ * `Schema`.
170
177
  */
171
178
  function normalize$1(value) {
172
179
  return value.toLowerCase()
173
180
  }
174
181
 
182
+ /**
183
+ * @import {Info as InfoType} from 'property-information'
184
+ */
185
+
186
+ /** @type {InfoType} */
175
187
  class Info {
176
188
  /**
177
- * @constructor
178
189
  * @param {string} property
190
+ * Property.
179
191
  * @param {string} attribute
192
+ * Attribute.
193
+ * @returns
194
+ * Info.
180
195
  */
181
196
  constructor(property, attribute) {
182
- /** @type {string} */
183
- this.property = property;
184
- /** @type {string} */
185
197
  this.attribute = attribute;
198
+ this.property = property;
186
199
  }
187
200
  }
188
201
 
189
- /** @type {string|null} */
190
- Info.prototype.space = null;
191
- Info.prototype.boolean = false;
202
+ Info.prototype.attribute = '';
192
203
  Info.prototype.booleanish = false;
193
- Info.prototype.overloadedBoolean = false;
194
- Info.prototype.number = false;
195
- Info.prototype.commaSeparated = false;
196
- Info.prototype.spaceSeparated = false;
204
+ Info.prototype.boolean = false;
197
205
  Info.prototype.commaOrSpaceSeparated = false;
198
- Info.prototype.mustUseProperty = false;
206
+ Info.prototype.commaSeparated = false;
199
207
  Info.prototype.defined = false;
208
+ Info.prototype.mustUseProperty = false;
209
+ Info.prototype.number = false;
210
+ Info.prototype.overloadedBoolean = false;
211
+ Info.prototype.property = '';
212
+ Info.prototype.spaceSeparated = false;
213
+ Info.prototype.space = undefined;
200
214
 
201
215
  let powers = 0;
202
216
 
@@ -223,17 +237,28 @@ var types = /*#__PURE__*/Object.freeze({
223
237
  spaceSeparated: spaceSeparated
224
238
  });
225
239
 
226
- /** @type {Array<keyof types>} */
227
- // @ts-expect-error: hush.
228
- const checks = Object.keys(types);
240
+ /**
241
+ * @import {Space} from 'property-information'
242
+ */
243
+
244
+
245
+ const checks = /** @type {ReadonlyArray<keyof typeof types>} */ (
246
+ Object.keys(types)
247
+ );
229
248
 
230
249
  class DefinedInfo extends Info {
231
250
  /**
232
251
  * @constructor
233
252
  * @param {string} property
253
+ * Property.
234
254
  * @param {string} attribute
235
- * @param {number|null} [mask]
236
- * @param {string} [space]
255
+ * Attribute.
256
+ * @param {number | null | undefined} [mask]
257
+ * Mask.
258
+ * @param {Space | undefined} [space]
259
+ * Space.
260
+ * @returns
261
+ * Info.
237
262
  */
238
263
  constructor(property, attribute, mask, space) {
239
264
  let index = -1;
@@ -254,126 +279,65 @@ class DefinedInfo extends Info {
254
279
  DefinedInfo.prototype.defined = true;
255
280
 
256
281
  /**
282
+ * @template {keyof DefinedInfo} Key
283
+ * Key type.
257
284
  * @param {DefinedInfo} values
258
- * @param {string} key
259
- * @param {unknown} value
285
+ * Info.
286
+ * @param {Key} key
287
+ * Key.
288
+ * @param {DefinedInfo[Key]} value
289
+ * Value.
290
+ * @returns {undefined}
291
+ * Nothing.
260
292
  */
261
293
  function mark(values, key, value) {
262
294
  if (value) {
263
- // @ts-expect-error: assume `value` matches the expected value of `key`.
264
295
  values[key] = value;
265
296
  }
266
297
  }
267
298
 
268
299
  /**
269
- * @typedef {import('./schema.js').Properties} Properties
270
- * @typedef {import('./schema.js').Normal} Normal
271
- *
272
- * @typedef {Record<string, string>} Attributes
273
- *
274
- * @typedef {Object} Definition
275
- * @property {Record<string, number|null>} properties
276
- * @property {(attributes: Attributes, property: string) => string} transform
277
- * @property {string} [space]
278
- * @property {Attributes} [attributes]
279
- * @property {Array<string>} [mustUseProperty]
300
+ * @import {Info, Space} from 'property-information'
280
301
  */
281
302
 
282
303
 
283
- const own$5 = {}.hasOwnProperty;
284
-
285
304
  /**
286
305
  * @param {Definition} definition
306
+ * Definition.
287
307
  * @returns {Schema}
308
+ * Schema.
288
309
  */
289
310
  function create(definition) {
290
- /** @type {Properties} */
291
- const property = {};
292
- /** @type {Normal} */
293
- const normal = {};
294
- /** @type {string} */
295
- let prop;
296
-
297
- for (prop in definition.properties) {
298
- if (own$5.call(definition.properties, prop)) {
299
- const value = definition.properties[prop];
300
- const info = new DefinedInfo(
301
- prop,
302
- definition.transform(definition.attributes || {}, prop),
303
- value,
304
- definition.space
305
- );
306
-
307
- if (
308
- definition.mustUseProperty &&
309
- definition.mustUseProperty.includes(prop)
310
- ) {
311
- info.mustUseProperty = true;
312
- }
313
-
314
- property[prop] = info;
311
+ /** @type {Record<string, Info>} */
312
+ const properties = {};
313
+ /** @type {Record<string, string>} */
314
+ const normals = {};
315
+
316
+ for (const [property, value] of Object.entries(definition.properties)) {
317
+ const info = new DefinedInfo(
318
+ property,
319
+ definition.transform(definition.attributes || {}, property),
320
+ value,
321
+ definition.space
322
+ );
315
323
 
316
- normal[normalize$1(prop)] = prop;
317
- normal[normalize$1(info.attribute)] = prop;
324
+ if (
325
+ definition.mustUseProperty &&
326
+ definition.mustUseProperty.includes(property)
327
+ ) {
328
+ info.mustUseProperty = true;
318
329
  }
319
- }
320
330
 
321
- return new Schema(property, normal, definition.space)
322
- }
331
+ properties[property] = info;
323
332
 
324
- const xlink = create({
325
- space: 'xlink',
326
- transform(_, prop) {
327
- return 'xlink:' + prop.slice(5).toLowerCase()
328
- },
329
- properties: {
330
- xLinkActuate: null,
331
- xLinkArcRole: null,
332
- xLinkHref: null,
333
- xLinkRole: null,
334
- xLinkShow: null,
335
- xLinkTitle: null,
336
- xLinkType: null
333
+ normals[normalize$1(property)] = property;
334
+ normals[normalize$1(info.attribute)] = property;
337
335
  }
338
- });
339
-
340
- const xml = create({
341
- space: 'xml',
342
- transform(_, prop) {
343
- return 'xml:' + prop.slice(3).toLowerCase()
344
- },
345
- properties: {xmlLang: null, xmlBase: null, xmlSpace: null}
346
- });
347
-
348
- /**
349
- * @param {Record<string, string>} attributes
350
- * @param {string} attribute
351
- * @returns {string}
352
- */
353
- function caseSensitiveTransform(attributes, attribute) {
354
- return attribute in attributes ? attributes[attribute] : attribute
355
- }
356
336
 
357
- /**
358
- * @param {Record<string, string>} attributes
359
- * @param {string} property
360
- * @returns {string}
361
- */
362
- function caseInsensitiveTransform(attributes, property) {
363
- return caseSensitiveTransform(attributes, property.toLowerCase())
337
+ return new Schema(properties, normals, definition.space)
364
338
  }
365
339
 
366
- const xmlns = create({
367
- space: 'xmlns',
368
- attributes: {xmlnsxlink: 'xmlns:xlink'},
369
- transform: caseInsensitiveTransform,
370
- properties: {xmlns: null, xmlnsXLink: null}
371
- });
372
-
373
340
  const aria = create({
374
- transform(_, prop) {
375
- return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()
376
- },
377
341
  properties: {
378
342
  ariaActiveDescendant: null,
379
343
  ariaAtomic: booleanish,
@@ -424,18 +388,45 @@ const aria = create({
424
388
  ariaValueNow: number,
425
389
  ariaValueText: null,
426
390
  role: null
391
+ },
392
+ transform(_, property) {
393
+ return property === 'role'
394
+ ? property
395
+ : 'aria-' + property.slice(4).toLowerCase()
427
396
  }
428
397
  });
429
398
 
399
+ /**
400
+ * @param {Record<string, string>} attributes
401
+ * Attributes.
402
+ * @param {string} attribute
403
+ * Attribute.
404
+ * @returns {string}
405
+ * Transformed attribute.
406
+ */
407
+ function caseSensitiveTransform(attributes, attribute) {
408
+ return attribute in attributes ? attributes[attribute] : attribute
409
+ }
410
+
411
+ /**
412
+ * @param {Record<string, string>} attributes
413
+ * Attributes.
414
+ * @param {string} property
415
+ * Property.
416
+ * @returns {string}
417
+ * Transformed property.
418
+ */
419
+ function caseInsensitiveTransform(attributes, property) {
420
+ return caseSensitiveTransform(attributes, property.toLowerCase())
421
+ }
422
+
430
423
  const html$2 = create({
431
- space: 'html',
432
424
  attributes: {
433
425
  acceptcharset: 'accept-charset',
434
426
  classname: 'class',
435
427
  htmlfor: 'for',
436
428
  httpequiv: 'http-equiv'
437
429
  },
438
- transform: caseInsensitiveTransform,
439
430
  mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
440
431
  properties: {
441
432
  // Standard Properties.
@@ -490,7 +481,7 @@ const html$2 = create({
490
481
  formTarget: null,
491
482
  headers: spaceSeparated,
492
483
  height: number,
493
- hidden: boolean,
484
+ hidden: overloadedBoolean,
494
485
  high: number,
495
486
  href: null,
496
487
  hrefLang: null,
@@ -736,11 +727,12 @@ const html$2 = create({
736
727
  results: number,
737
728
  security: null,
738
729
  unselectable: null
739
- }
730
+ },
731
+ space: 'html',
732
+ transform: caseInsensitiveTransform
740
733
  });
741
734
 
742
735
  const svg$1 = create({
743
- space: 'svg',
744
736
  attributes: {
745
737
  accentHeight: 'accent-height',
746
738
  alignmentBaseline: 'alignment-baseline',
@@ -916,7 +908,6 @@ const svg$1 = create({
916
908
  playbackOrder: 'playbackorder',
917
909
  timelineBegin: 'timelinebegin'
918
910
  },
919
- transform: caseSensitiveTransform,
920
911
  properties: {
921
912
  about: commaOrSpaceSeparated,
922
913
  accentHeight: number,
@@ -1294,26 +1285,115 @@ const svg$1 = create({
1294
1285
  yChannelSelector: null,
1295
1286
  z: null,
1296
1287
  zoomAndPan: null
1288
+ },
1289
+ space: 'svg',
1290
+ transform: caseSensitiveTransform
1291
+ });
1292
+
1293
+ const xlink = create({
1294
+ properties: {
1295
+ xLinkActuate: null,
1296
+ xLinkArcRole: null,
1297
+ xLinkHref: null,
1298
+ xLinkRole: null,
1299
+ xLinkShow: null,
1300
+ xLinkTitle: null,
1301
+ xLinkType: null
1302
+ },
1303
+ space: 'xlink',
1304
+ transform(_, property) {
1305
+ return 'xlink:' + property.slice(5).toLowerCase()
1306
+ }
1307
+ });
1308
+
1309
+ const xmlns = create({
1310
+ attributes: {xmlnsxlink: 'xmlns:xlink'},
1311
+ properties: {xmlnsXLink: null, xmlns: null},
1312
+ space: 'xmlns',
1313
+ transform: caseInsensitiveTransform
1314
+ });
1315
+
1316
+ const xml = create({
1317
+ properties: {xmlBase: null, xmlLang: null, xmlSpace: null},
1318
+ space: 'xml',
1319
+ transform(_, property) {
1320
+ return 'xml:' + property.slice(3).toLowerCase()
1297
1321
  }
1298
1322
  });
1299
1323
 
1300
1324
  /**
1301
- * @typedef {import('./util/schema.js').Schema} Schema
1325
+ * Special cases for React (`Record<string, string>`).
1326
+ *
1327
+ * `hast` is close to `React` but differs in a couple of cases.
1328
+ * To get a React property from a hast property,
1329
+ * check if it is in `hastToReact`.
1330
+ * If it is, use the corresponding value;
1331
+ * otherwise, use the hast property.
1332
+ *
1333
+ * @type {Record<string, string>}
1334
+ */
1335
+ const hastToReact = {
1336
+ classId: 'classID',
1337
+ dataType: 'datatype',
1338
+ itemId: 'itemID',
1339
+ strokeDashArray: 'strokeDasharray',
1340
+ strokeDashOffset: 'strokeDashoffset',
1341
+ strokeLineCap: 'strokeLinecap',
1342
+ strokeLineJoin: 'strokeLinejoin',
1343
+ strokeMiterLimit: 'strokeMiterlimit',
1344
+ typeOf: 'typeof',
1345
+ xLinkActuate: 'xlinkActuate',
1346
+ xLinkArcRole: 'xlinkArcrole',
1347
+ xLinkHref: 'xlinkHref',
1348
+ xLinkRole: 'xlinkRole',
1349
+ xLinkShow: 'xlinkShow',
1350
+ xLinkTitle: 'xlinkTitle',
1351
+ xLinkType: 'xlinkType',
1352
+ xmlnsXLink: 'xmlnsXlink'
1353
+ };
1354
+
1355
+ /**
1356
+ * @import {Schema} from 'property-information'
1302
1357
  */
1303
1358
 
1304
1359
 
1305
- const valid = /^data[-\w.:]+$/i;
1306
- const dash = /-[a-z]/g;
1307
1360
  const cap$1 = /[A-Z]/g;
1361
+ const dash = /-[a-z]/g;
1362
+ const valid = /^data[-\w.:]+$/i;
1308
1363
 
1309
1364
  /**
1365
+ * Look up info on a property.
1366
+ *
1367
+ * In most cases the given `schema` contains info on the property.
1368
+ * All standard,
1369
+ * most legacy,
1370
+ * and some non-standard properties are supported.
1371
+ * For these cases,
1372
+ * the returned `Info` has hints about the value of the property.
1373
+ *
1374
+ * `name` can also be a valid data attribute or property,
1375
+ * in which case an `Info` object with the correctly cased `attribute` and
1376
+ * `property` is returned.
1377
+ *
1378
+ * `name` can be an unknown attribute,
1379
+ * in which case an `Info` object with `attribute` and `property` set to the
1380
+ * given name is returned.
1381
+ * It is not recommended to provide unsupported legacy or recently specced
1382
+ * properties.
1383
+ *
1384
+ *
1310
1385
  * @param {Schema} schema
1386
+ * Schema;
1387
+ * either the `html` or `svg` export.
1311
1388
  * @param {string} value
1389
+ * An attribute-like or property-like name;
1390
+ * it will be passed through `normalize` to hopefully find the correct info.
1312
1391
  * @returns {Info}
1392
+ * Info.
1313
1393
  */
1314
1394
  function find(schema, value) {
1315
1395
  const normal = normalize$1(value);
1316
- let prop = value;
1396
+ let property = value;
1317
1397
  let Type = Info;
1318
1398
 
1319
1399
  if (normal in schema.normal) {
@@ -1325,7 +1405,7 @@ function find(schema, value) {
1325
1405
  if (value.charAt(4) === '-') {
1326
1406
  // Turn it into a property.
1327
1407
  const rest = value.slice(5).replace(dash, camelcase);
1328
- prop = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1);
1408
+ property = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1);
1329
1409
  } else {
1330
1410
  // Turn it into an attribute.
1331
1411
  const rest = value.slice(4);
@@ -1344,12 +1424,14 @@ function find(schema, value) {
1344
1424
  Type = DefinedInfo;
1345
1425
  }
1346
1426
 
1347
- return new Type(prop, value)
1427
+ return new Type(property, value)
1348
1428
  }
1349
1429
 
1350
1430
  /**
1351
1431
  * @param {string} $0
1432
+ * Value.
1352
1433
  * @returns {string}
1434
+ * Kebab.
1353
1435
  */
1354
1436
  function kebab($0) {
1355
1437
  return '-' + $0.toLowerCase()
@@ -1357,48 +1439,19 @@ function kebab($0) {
1357
1439
 
1358
1440
  /**
1359
1441
  * @param {string} $0
1442
+ * Value.
1360
1443
  * @returns {string}
1444
+ * Camel.
1361
1445
  */
1362
1446
  function camelcase($0) {
1363
1447
  return $0.charAt(1).toUpperCase()
1364
1448
  }
1365
1449
 
1366
- /**
1367
- * `hast` is close to `React`, but differs in a couple of cases.
1368
- *
1369
- * To get a React property from a hast property, check if it is in
1370
- * `hastToReact`, if it is, then use the corresponding value,
1371
- * otherwise, use the hast property.
1372
- *
1373
- * @type {Record<string, string>}
1374
- */
1375
- const hastToReact = {
1376
- classId: 'classID',
1377
- dataType: 'datatype',
1378
- itemId: 'itemID',
1379
- strokeDashArray: 'strokeDasharray',
1380
- strokeDashOffset: 'strokeDashoffset',
1381
- strokeLineCap: 'strokeLinecap',
1382
- strokeLineJoin: 'strokeLinejoin',
1383
- strokeMiterLimit: 'strokeMiterlimit',
1384
- typeOf: 'typeof',
1385
- xLinkActuate: 'xlinkActuate',
1386
- xLinkArcRole: 'xlinkArcrole',
1387
- xLinkHref: 'xlinkHref',
1388
- xLinkRole: 'xlinkRole',
1389
- xLinkShow: 'xlinkShow',
1390
- xLinkTitle: 'xlinkTitle',
1391
- xLinkType: 'xlinkType',
1392
- xmlnsXLink: 'xmlnsXlink'
1393
- };
1450
+ // Note: types exposed from `index.d.ts`.
1394
1451
 
1395
- /**
1396
- * @typedef {import('./lib/util/info.js').Info} Info
1397
- * @typedef {import('./lib/util/schema.js').Schema} Schema
1398
- */
1452
+ const html$1 = merge([aria, html$2, xlink, xmlns, xml], 'html');
1399
1453
 
1400
- const html$1 = merge([xml, xlink, xmlns, aria, html$2], 'html');
1401
- const svg = merge([xml, xlink, xmlns, aria, svg$1], 'svg');
1454
+ const svg = merge([aria, svg$1, xlink, xmlns, xml], 'svg');
1402
1455
 
1403
1456
  /**
1404
1457
  * Parse space-separated tokens to an array of strings.
@@ -1421,7 +1474,7 @@ function stringify(values) {
1421
1474
  return values.join(' ').trim()
1422
1475
  }
1423
1476
 
1424
- var cjs = {};
1477
+ var cjs$2 = {};
1425
1478
 
1426
1479
  // http://www.w3.org/TR/CSS21/grammar.html
1427
1480
  // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
@@ -1456,7 +1509,7 @@ var TYPE_DECLARATION = 'declaration';
1456
1509
  * @throws {TypeError}
1457
1510
  * @throws {Error}
1458
1511
  */
1459
- var inlineStyleParser = function (style, options) {
1512
+ function index$1 (style, options) {
1460
1513
  if (typeof style !== 'string') {
1461
1514
  throw new TypeError('First argument must be a string');
1462
1515
  }
@@ -1669,7 +1722,7 @@ var inlineStyleParser = function (style, options) {
1669
1722
 
1670
1723
  whitespace();
1671
1724
  return declarations();
1672
- };
1725
+ }
1673
1726
 
1674
1727
  /**
1675
1728
  * Trim `str`.
@@ -1681,12 +1734,14 @@ function trim(str) {
1681
1734
  return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
1682
1735
  }
1683
1736
 
1684
- var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1737
+ var cjs$1 = index$1;
1738
+
1739
+ var __importDefault$1 = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1685
1740
  return (mod && mod.__esModule) ? mod : { "default": mod };
1686
1741
  };
1687
- Object.defineProperty(cjs, "__esModule", { value: true });
1688
- var _default = cjs.default = StyleToObject;
1689
- var inline_style_parser_1 = __importDefault(inlineStyleParser);
1742
+ Object.defineProperty(cjs$2, "__esModule", { value: true });
1743
+ cjs$2.default = StyleToObject;
1744
+ const inline_style_parser_1 = __importDefault$1(cjs$1);
1690
1745
  /**
1691
1746
  * Parses inline style to object.
1692
1747
  *
@@ -1702,17 +1757,17 @@ var inline_style_parser_1 = __importDefault(inlineStyleParser);
1702
1757
  * ```
1703
1758
  */
1704
1759
  function StyleToObject(style, iterator) {
1705
- var styleObject = null;
1760
+ let styleObject = null;
1706
1761
  if (!style || typeof style !== 'string') {
1707
1762
  return styleObject;
1708
1763
  }
1709
- var declarations = (0, inline_style_parser_1.default)(style);
1710
- var hasIterator = typeof iterator === 'function';
1711
- declarations.forEach(function (declaration) {
1764
+ const declarations = (0, inline_style_parser_1.default)(style);
1765
+ const hasIterator = typeof iterator === 'function';
1766
+ declarations.forEach((declaration) => {
1712
1767
  if (declaration.type !== 'declaration') {
1713
1768
  return;
1714
1769
  }
1715
- var property = declaration.property, value = declaration.value;
1770
+ const { property, value } = declaration;
1716
1771
  if (hasIterator) {
1717
1772
  iterator(property, value, declaration);
1718
1773
  }
@@ -1724,8 +1779,80 @@ function StyleToObject(style, iterator) {
1724
1779
  return styleObject;
1725
1780
  }
1726
1781
 
1727
- // ensure compatibility with rollup umd build
1728
- var styleToObject = _default.default || _default;
1782
+ var utilities = {};
1783
+
1784
+ Object.defineProperty(utilities, "__esModule", { value: true });
1785
+ utilities.camelCase = void 0;
1786
+ var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
1787
+ var HYPHEN_REGEX = /-([a-z])/g;
1788
+ var NO_HYPHEN_REGEX = /^[^-]+$/;
1789
+ var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
1790
+ var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
1791
+ /**
1792
+ * Checks whether to skip camelCase.
1793
+ */
1794
+ var skipCamelCase = function (property) {
1795
+ return !property ||
1796
+ NO_HYPHEN_REGEX.test(property) ||
1797
+ CUSTOM_PROPERTY_REGEX.test(property);
1798
+ };
1799
+ /**
1800
+ * Replacer that capitalizes first character.
1801
+ */
1802
+ var capitalize = function (match, character) {
1803
+ return character.toUpperCase();
1804
+ };
1805
+ /**
1806
+ * Replacer that removes beginning hyphen of vendor prefix property.
1807
+ */
1808
+ var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
1809
+ /**
1810
+ * CamelCases a CSS property.
1811
+ */
1812
+ var camelCase = function (property, options) {
1813
+ if (options === void 0) { options = {}; }
1814
+ if (skipCamelCase(property)) {
1815
+ return property;
1816
+ }
1817
+ property = property.toLowerCase();
1818
+ if (options.reactCompat) {
1819
+ // `-ms` vendor prefix should not be capitalized
1820
+ property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
1821
+ }
1822
+ else {
1823
+ // for non-React, remove first hyphen so vendor prefix is not capitalized
1824
+ property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
1825
+ }
1826
+ return property.replace(HYPHEN_REGEX, capitalize);
1827
+ };
1828
+ utilities.camelCase = camelCase;
1829
+
1830
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
1831
+ return (mod && mod.__esModule) ? mod : { "default": mod };
1832
+ };
1833
+ var style_to_object_1 = __importDefault(cjs$2);
1834
+ var utilities_1 = utilities;
1835
+ /**
1836
+ * Parses CSS inline style to JavaScript object (camelCased).
1837
+ */
1838
+ function StyleToJS(style, options) {
1839
+ var output = {};
1840
+ if (!style || typeof style !== 'string') {
1841
+ return output;
1842
+ }
1843
+ (0, style_to_object_1.default)(style, function (property, value) {
1844
+ // skip CSS comment
1845
+ if (property && value) {
1846
+ output[(0, utilities_1.camelCase)(property, options)] = value;
1847
+ }
1848
+ });
1849
+ return output;
1850
+ }
1851
+ StyleToJS.default = StyleToJS;
1852
+ var cjs = StyleToJS;
1853
+
1854
+
1855
+ var styleToJs = /*@__PURE__*/getDefaultExportFromCjs(cjs);
1729
1856
 
1730
1857
  /**
1731
1858
  * @typedef {import('unist').Node} Node
@@ -1756,7 +1883,7 @@ var styleToObject = _default.default || _default;
1756
1883
  * @returns
1757
1884
  * Point.
1758
1885
  */
1759
- const pointEnd = point$3('end');
1886
+ const pointEnd = point$2('end');
1760
1887
 
1761
1888
  /**
1762
1889
  * Get the starting point of `node`.
@@ -1766,7 +1893,7 @@ const pointEnd = point$3('end');
1766
1893
  * @returns
1767
1894
  * Point.
1768
1895
  */
1769
- const pointStart = point$3('start');
1896
+ const pointStart = point$2('start');
1770
1897
 
1771
1898
  /**
1772
1899
  * Get the positional info of `node`.
@@ -1776,7 +1903,7 @@ const pointStart = point$3('start');
1776
1903
  * @returns
1777
1904
  * Getter.
1778
1905
  */
1779
- function point$3(type) {
1906
+ function point$2(type) {
1780
1907
  return point
1781
1908
 
1782
1909
  /**
@@ -1814,7 +1941,7 @@ function point$3(type) {
1814
1941
  * @returns {Position | undefined}
1815
1942
  * Position.
1816
1943
  */
1817
- function position$2(node) {
1944
+ function position$1(node) {
1818
1945
  const start = pointStart(node);
1819
1946
  const end = pointEnd(node);
1820
1947
 
@@ -1859,7 +1986,7 @@ function position$2(node) {
1859
1986
  * An empty string (`''`) is returned if the given value is neither `node`,
1860
1987
  * `position`, nor `point`.
1861
1988
  */
1862
- function stringifyPosition$1(value) {
1989
+ function stringifyPosition(value) {
1863
1990
  // Nothing.
1864
1991
  if (!value || typeof value !== 'object') {
1865
1992
  return ''
@@ -1867,17 +1994,17 @@ function stringifyPosition$1(value) {
1867
1994
 
1868
1995
  // Node.
1869
1996
  if ('position' in value || 'type' in value) {
1870
- return position$1(value.position)
1997
+ return position(value.position)
1871
1998
  }
1872
1999
 
1873
2000
  // Position.
1874
2001
  if ('start' in value || 'end' in value) {
1875
- return position$1(value)
2002
+ return position(value)
1876
2003
  }
1877
2004
 
1878
2005
  // Point.
1879
2006
  if ('line' in value || 'column' in value) {
1880
- return point$2(value)
2007
+ return point$1(value)
1881
2008
  }
1882
2009
 
1883
2010
  // ?
@@ -1888,37 +2015,35 @@ function stringifyPosition$1(value) {
1888
2015
  * @param {Point | PointLike | null | undefined} point
1889
2016
  * @returns {string}
1890
2017
  */
1891
- function point$2(point) {
1892
- return index$1(point && point.line) + ':' + index$1(point && point.column)
2018
+ function point$1(point) {
2019
+ return index(point && point.line) + ':' + index(point && point.column)
1893
2020
  }
1894
2021
 
1895
2022
  /**
1896
2023
  * @param {Position | PositionLike | null | undefined} pos
1897
2024
  * @returns {string}
1898
2025
  */
1899
- function position$1(pos) {
1900
- return point$2(pos && pos.start) + '-' + point$2(pos && pos.end)
2026
+ function position(pos) {
2027
+ return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
1901
2028
  }
1902
2029
 
1903
2030
  /**
1904
2031
  * @param {number | null | undefined} value
1905
2032
  * @returns {number}
1906
2033
  */
1907
- function index$1(value) {
2034
+ function index(value) {
1908
2035
  return value && typeof value === 'number' ? value : 1
1909
2036
  }
1910
2037
 
1911
2038
  /**
1912
- * @typedef {import('unist').Node} Node
1913
- * @typedef {import('unist').Point} Point
1914
- * @typedef {import('unist').Position} Position
2039
+ * @import {Node, Point, Position} from 'unist'
1915
2040
  */
1916
2041
 
1917
2042
 
1918
2043
  /**
1919
2044
  * Message.
1920
2045
  */
1921
- let VFileMessage$1 = class VFileMessage extends Error {
2046
+ class VFileMessage extends Error {
1922
2047
  /**
1923
2048
  * Create a message for `reason`.
1924
2049
  *
@@ -2050,7 +2175,6 @@ let VFileMessage$1 = class VFileMessage extends Error {
2050
2175
  ? options.place.start
2051
2176
  : options.place;
2052
2177
 
2053
- /* eslint-disable no-unused-expressions */
2054
2178
  /**
2055
2179
  * Stack of ancestor nodes surrounding the message.
2056
2180
  *
@@ -2088,7 +2212,7 @@ let VFileMessage$1 = class VFileMessage extends Error {
2088
2212
  *
2089
2213
  * @type {string | undefined}
2090
2214
  */
2091
- this.file;
2215
+ this.file = '';
2092
2216
 
2093
2217
  // Field from `Error`.
2094
2218
  /**
@@ -2112,7 +2236,7 @@ let VFileMessage$1 = class VFileMessage extends Error {
2112
2236
  * On normal errors, this would be something like `ParseError`, buit in
2113
2237
  * `VFile` messages we use this space to show where an error happened.
2114
2238
  */
2115
- this.name = stringifyPosition$1(options.place) || '1:1';
2239
+ this.name = stringifyPosition(options.place) || '1:1';
2116
2240
 
2117
2241
  /**
2118
2242
  * Place of message.
@@ -2166,21 +2290,21 @@ let VFileMessage$1 = class VFileMessage extends Error {
2166
2290
  *
2167
2291
  * @type {string | undefined}
2168
2292
  */
2169
- this.actual;
2293
+ this.actual = undefined;
2170
2294
 
2171
2295
  /**
2172
2296
  * Suggest acceptable values that can be used instead of `actual`.
2173
2297
  *
2174
2298
  * @type {Array<string> | undefined}
2175
2299
  */
2176
- this.expected;
2300
+ this.expected = undefined;
2177
2301
 
2178
2302
  /**
2179
2303
  * Long form description of the message (you should use markdown).
2180
2304
  *
2181
2305
  * @type {string | undefined}
2182
2306
  */
2183
- this.note;
2307
+ this.note = undefined;
2184
2308
 
2185
2309
  /**
2186
2310
  * Link to docs for the message.
@@ -2190,24 +2314,23 @@ let VFileMessage$1 = class VFileMessage extends Error {
2190
2314
  *
2191
2315
  * @type {string | undefined}
2192
2316
  */
2193
- this.url;
2194
- /* eslint-enable no-unused-expressions */
2317
+ this.url = undefined;
2195
2318
  }
2196
- };
2319
+ }
2197
2320
 
2198
- VFileMessage$1.prototype.file = '';
2199
- VFileMessage$1.prototype.name = '';
2200
- VFileMessage$1.prototype.reason = '';
2201
- VFileMessage$1.prototype.message = '';
2202
- VFileMessage$1.prototype.stack = '';
2203
- VFileMessage$1.prototype.column = undefined;
2204
- VFileMessage$1.prototype.line = undefined;
2205
- VFileMessage$1.prototype.ancestors = undefined;
2206
- VFileMessage$1.prototype.cause = undefined;
2207
- VFileMessage$1.prototype.fatal = undefined;
2208
- VFileMessage$1.prototype.place = undefined;
2209
- VFileMessage$1.prototype.ruleId = undefined;
2210
- VFileMessage$1.prototype.source = undefined;
2321
+ VFileMessage.prototype.file = '';
2322
+ VFileMessage.prototype.name = '';
2323
+ VFileMessage.prototype.reason = '';
2324
+ VFileMessage.prototype.message = '';
2325
+ VFileMessage.prototype.stack = '';
2326
+ VFileMessage.prototype.column = undefined;
2327
+ VFileMessage.prototype.line = undefined;
2328
+ VFileMessage.prototype.ancestors = undefined;
2329
+ VFileMessage.prototype.cause = undefined;
2330
+ VFileMessage.prototype.fatal = undefined;
2331
+ VFileMessage.prototype.place = undefined;
2332
+ VFileMessage.prototype.ruleId = undefined;
2333
+ VFileMessage.prototype.source = undefined;
2211
2334
 
2212
2335
  /**
2213
2336
  * @import {Identifier, Literal, MemberExpression} from 'estree'
@@ -2217,7 +2340,7 @@ VFileMessage$1.prototype.source = undefined;
2217
2340
  * @import {MdxJsxFlowElementHast, MdxJsxTextElementHast} from 'mdast-util-mdx-jsx'
2218
2341
  * @import {MdxjsEsmHast} from 'mdast-util-mdxjs-esm'
2219
2342
  * @import {Position} from 'unist'
2220
- * @import {Child, Create, Field, State, Style} from './types.js'
2343
+ * @import {Child, Create, Field, JsxElement, State, Style} from './types.js'
2221
2344
  */
2222
2345
 
2223
2346
 
@@ -2228,7 +2351,6 @@ const own$4 = {}.hasOwnProperty;
2228
2351
  const emptyMap = new Map();
2229
2352
 
2230
2353
  const cap = /[A-Z]/g;
2231
- const dashSomething = /-([a-z])/g;
2232
2354
 
2233
2355
  // `react-dom` triggers a warning for *any* white space in tables.
2234
2356
  // To follow GFM, `mdast-util-to-hast` injects line endings between elements.
@@ -2255,7 +2377,7 @@ const docs = 'https://github.com/syntax-tree/hast-util-to-jsx-runtime';
2255
2377
  * Tree to transform.
2256
2378
  * @param {Options} options
2257
2379
  * Configuration (required).
2258
- * @returns {JSX.Element}
2380
+ * @returns {JsxElement}
2259
2381
  * JSX element.
2260
2382
  */
2261
2383
 
@@ -2837,49 +2959,24 @@ function createProperty(state, prop, value) {
2837
2959
  * Throws `VFileMessage` when CSS cannot be parsed.
2838
2960
  */
2839
2961
  function parseStyle(state, value) {
2840
- /** @type {Style} */
2841
- const result = {};
2842
-
2843
2962
  try {
2844
- styleToObject(value, replacer);
2963
+ return styleToJs(value, {reactCompat: true})
2845
2964
  } catch (error) {
2846
- if (!state.ignoreInvalidStyle) {
2847
- const cause = /** @type {Error} */ (error);
2848
- const message = new VFileMessage$1('Cannot parse `style` attribute', {
2849
- ancestors: state.ancestors,
2850
- cause,
2851
- ruleId: 'style',
2852
- source: 'hast-util-to-jsx-runtime'
2853
- });
2854
- message.file = state.filePath || undefined;
2855
- message.url = docs + '#cannot-parse-style-attribute';
2856
-
2857
- throw message
2965
+ if (state.ignoreInvalidStyle) {
2966
+ return {}
2858
2967
  }
2859
- }
2860
-
2861
- return result
2862
-
2863
- /**
2864
- * Add a CSS property (normal, so with dashes) to `result` as a DOM CSS
2865
- * property.
2866
- *
2867
- * @param {string} name
2868
- * Key.
2869
- * @param {string} value
2870
- * Value
2871
- * @returns {undefined}
2872
- * Nothing.
2873
- */
2874
- function replacer(name, value) {
2875
- let key = name;
2876
2968
 
2877
- if (key.slice(0, 2) !== '--') {
2878
- if (key.slice(0, 4) === '-ms-') key = 'ms-' + key.slice(4);
2879
- key = key.replace(dashSomething, toCamel);
2880
- }
2969
+ const cause = /** @type {Error} */ (error);
2970
+ const message = new VFileMessage('Cannot parse `style` attribute', {
2971
+ ancestors: state.ancestors,
2972
+ cause,
2973
+ ruleId: 'style',
2974
+ source: 'hast-util-to-jsx-runtime'
2975
+ });
2976
+ message.file = state.filePath || undefined;
2977
+ message.url = docs + '#cannot-parse-style-attribute';
2881
2978
 
2882
- result[key] = value;
2979
+ throw message
2883
2980
  }
2884
2981
  }
2885
2982
 
@@ -2933,8 +3030,7 @@ function findComponentFromName(state, name$1, allowExpression) {
2933
3030
  // Only literals can be passed in `components` currently.
2934
3031
  // No identifiers / member expressions.
2935
3032
  if (result.type === 'Literal') {
2936
- const name = /** @type {keyof JSX.IntrinsicElements} */ (result.value);
2937
-
3033
+ const name = /** @type {string | number} */ (result.value);
2938
3034
  return own$4.call(state.components, name) ? state.components[name] : name
2939
3035
  }
2940
3036
 
@@ -2952,7 +3048,7 @@ function findComponentFromName(state, name$1, allowExpression) {
2952
3048
  * @returns {never}
2953
3049
  */
2954
3050
  function crashEstree(state, place) {
2955
- const message = new VFileMessage$1(
3051
+ const message = new VFileMessage(
2956
3052
  'Cannot handle MDX estrees without `createEvaluater`',
2957
3053
  {
2958
3054
  ancestors: state.ancestors,
@@ -3001,20 +3097,6 @@ function transformStyleToCssCasing(from) {
3001
3097
  return to
3002
3098
  }
3003
3099
 
3004
- /**
3005
- * Make `$1` capitalized.
3006
- *
3007
- * @param {string} _
3008
- * Whatever.
3009
- * @param {string} $1
3010
- * Single ASCII alphabetical.
3011
- * @returns {string}
3012
- * Capitalized `$1`.
3013
- */
3014
- function toCamel(_, $1) {
3015
- return $1.toUpperCase()
3016
- }
3017
-
3018
3100
  /**
3019
3101
  * Make `$0` dash cased.
3020
3102
  *
@@ -5301,6 +5383,7 @@ const characterEntities = {
5301
5383
  zwnj: '‌'
5302
5384
  };
5303
5385
 
5386
+ // To do: next major: use `Object.hasOwn`.
5304
5387
  const own$3 = {}.hasOwnProperty;
5305
5388
 
5306
5389
  /**
@@ -5580,7 +5663,7 @@ function normalizeIdentifier(value) {
5580
5663
  * @returns {boolean}
5581
5664
  * Whether it matches.
5582
5665
  */
5583
- const asciiAlpha = regexCheck$1(/[A-Za-z]/);
5666
+ const asciiAlpha = regexCheck(/[A-Za-z]/);
5584
5667
 
5585
5668
  /**
5586
5669
  * Check whether the character code represents an ASCII alphanumeric (`a`
@@ -5594,7 +5677,7 @@ const asciiAlpha = regexCheck$1(/[A-Za-z]/);
5594
5677
  * @returns {boolean}
5595
5678
  * Whether it matches.
5596
5679
  */
5597
- const asciiAlphanumeric$1 = regexCheck$1(/[\dA-Za-z]/);
5680
+ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
5598
5681
 
5599
5682
  /**
5600
5683
  * Check whether the character code represents an ASCII atext.
@@ -5617,7 +5700,7 @@ const asciiAlphanumeric$1 = regexCheck$1(/[\dA-Za-z]/);
5617
5700
  * @returns {boolean}
5618
5701
  * Whether it matches.
5619
5702
  */
5620
- const asciiAtext = regexCheck$1(/[#-'*+\--9=?A-Z^-~]/);
5703
+ const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
5621
5704
 
5622
5705
  /**
5623
5706
  * Check whether a character code is an ASCII control character.
@@ -5649,7 +5732,7 @@ function asciiControl(code) {
5649
5732
  * @returns {boolean}
5650
5733
  * Whether it matches.
5651
5734
  */
5652
- const asciiDigit = regexCheck$1(/\d/);
5735
+ const asciiDigit = regexCheck(/\d/);
5653
5736
 
5654
5737
  /**
5655
5738
  * Check whether the character code represents an ASCII hex digit (`a` through
@@ -5669,7 +5752,7 @@ const asciiDigit = regexCheck$1(/\d/);
5669
5752
  * @returns {boolean}
5670
5753
  * Whether it matches.
5671
5754
  */
5672
- const asciiHexDigit = regexCheck$1(/[\dA-Fa-f]/);
5755
+ const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
5673
5756
 
5674
5757
  /**
5675
5758
  * Check whether the character code represents ASCII punctuation.
@@ -5684,7 +5767,7 @@ const asciiHexDigit = regexCheck$1(/[\dA-Fa-f]/);
5684
5767
  * @returns {boolean}
5685
5768
  * Whether it matches.
5686
5769
  */
5687
- const asciiPunctuation = regexCheck$1(/[!-/:-@[-`{-~]/);
5770
+ const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
5688
5771
 
5689
5772
  /**
5690
5773
  * Check whether a character code is a markdown line ending.
@@ -5758,7 +5841,7 @@ function markdownSpace(code) {
5758
5841
  * @returns
5759
5842
  * Whether it matches.
5760
5843
  */
5761
- const unicodePunctuation = regexCheck$1(/\p{P}|\p{S}/u);
5844
+ const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
5762
5845
 
5763
5846
  /**
5764
5847
  * Check whether the character code represents Unicode whitespace.
@@ -5780,7 +5863,7 @@ const unicodePunctuation = regexCheck$1(/\p{P}|\p{S}/u);
5780
5863
  * @returns
5781
5864
  * Whether it matches.
5782
5865
  */
5783
- const unicodeWhitespace = regexCheck$1(/\s/);
5866
+ const unicodeWhitespace = regexCheck(/\s/);
5784
5867
 
5785
5868
  /**
5786
5869
  * Create a code check from a regex.
@@ -5790,7 +5873,7 @@ const unicodeWhitespace = regexCheck$1(/\s/);
5790
5873
  * @returns {(code: Code) => boolean}
5791
5874
  * Check.
5792
5875
  */
5793
- function regexCheck$1(regex) {
5876
+ function regexCheck(regex) {
5794
5877
  return check;
5795
5878
 
5796
5879
  /**
@@ -5806,6 +5889,69 @@ function regexCheck$1(regex) {
5806
5889
  }
5807
5890
  }
5808
5891
 
5892
+ /**
5893
+ * Normalize a URL.
5894
+ *
5895
+ * Encode unsafe characters with percent-encoding, skipping already encoded
5896
+ * sequences.
5897
+ *
5898
+ * @param {string} value
5899
+ * URI to normalize.
5900
+ * @returns {string}
5901
+ * Normalized URI.
5902
+ */
5903
+ function normalizeUri(value) {
5904
+ /** @type {Array<string>} */
5905
+ const result = [];
5906
+ let index = -1;
5907
+ let start = 0;
5908
+ let skip = 0;
5909
+ while (++index < value.length) {
5910
+ const code = value.charCodeAt(index);
5911
+ /** @type {string} */
5912
+ let replace = '';
5913
+
5914
+ // A correct percent encoded value.
5915
+ if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) {
5916
+ skip = 2;
5917
+ }
5918
+ // ASCII.
5919
+ else if (code < 128) {
5920
+ if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
5921
+ replace = String.fromCharCode(code);
5922
+ }
5923
+ }
5924
+ // Astral.
5925
+ else if (code > 55_295 && code < 57_344) {
5926
+ const next = value.charCodeAt(index + 1);
5927
+
5928
+ // A correct surrogate pair.
5929
+ if (code < 56_320 && next > 56_319 && next < 57_344) {
5930
+ replace = String.fromCharCode(code, next);
5931
+ skip = 1;
5932
+ }
5933
+ // Lone surrogate.
5934
+ else {
5935
+ replace = "\uFFFD";
5936
+ }
5937
+ }
5938
+ // Unicode.
5939
+ else {
5940
+ replace = String.fromCharCode(code);
5941
+ }
5942
+ if (replace) {
5943
+ result.push(value.slice(start, index), encodeURIComponent(replace));
5944
+ start = index + skip + 1;
5945
+ replace = '';
5946
+ }
5947
+ if (skip) {
5948
+ index += skip;
5949
+ skip = 0;
5950
+ }
5951
+ }
5952
+ return result.join('') + value.slice(start);
5953
+ }
5954
+
5809
5955
  /**
5810
5956
  * @import {Effects, State, TokenType} from 'micromark-util-types'
5811
5957
  */
@@ -6684,7 +6830,7 @@ function tokenizeAutolink(effects, ok, nok) {
6684
6830
  */
6685
6831
  function schemeOrEmailAtext(code) {
6686
6832
  // ASCII alphanumeric and `+`, `-`, and `.`.
6687
- if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric$1(code)) {
6833
+ if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
6688
6834
  // Count the previous alphabetical from `open` too.
6689
6835
  size = 1;
6690
6836
  return schemeInsideOrEmailAtext(code);
@@ -6712,7 +6858,7 @@ function tokenizeAutolink(effects, ok, nok) {
6712
6858
  }
6713
6859
 
6714
6860
  // ASCII alphanumeric and `+`, `-`, and `.`.
6715
- if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric$1(code)) && size++ < 32) {
6861
+ if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {
6716
6862
  effects.consume(code);
6717
6863
  return schemeInsideOrEmailAtext;
6718
6864
  }
@@ -6781,7 +6927,7 @@ function tokenizeAutolink(effects, ok, nok) {
6781
6927
  * @type {State}
6782
6928
  */
6783
6929
  function emailAtSignOrDot(code) {
6784
- return asciiAlphanumeric$1(code) ? emailLabel(code) : nok(code);
6930
+ return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);
6785
6931
  }
6786
6932
 
6787
6933
  /**
@@ -6826,7 +6972,7 @@ function tokenizeAutolink(effects, ok, nok) {
6826
6972
  */
6827
6973
  function emailValue(code) {
6828
6974
  // ASCII alphanumeric or `-`.
6829
- if ((code === 45 || asciiAlphanumeric$1(code)) && size++ < 63) {
6975
+ if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
6830
6976
  const next = code === 45 ? emailValue : emailLabel;
6831
6977
  effects.consume(code);
6832
6978
  return next;
@@ -7177,7 +7323,7 @@ function tokenizeCharacterReference(effects, ok, nok) {
7177
7323
  }
7178
7324
  effects.enter("characterReferenceValue");
7179
7325
  max = 31;
7180
- test = asciiAlphanumeric$1;
7326
+ test = asciiAlphanumeric;
7181
7327
  return value(code);
7182
7328
  }
7183
7329
 
@@ -7229,7 +7375,7 @@ function tokenizeCharacterReference(effects, ok, nok) {
7229
7375
  function value(code) {
7230
7376
  if (code === 59 && size) {
7231
7377
  const token = effects.exit("characterReferenceValue");
7232
- if (test === asciiAlphanumeric$1 && !decodeNamedCharacterReference(self.sliceSerialize(token))) {
7378
+ if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) {
7233
7379
  return nok(code);
7234
7380
  }
7235
7381
 
@@ -10178,7 +10324,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
10178
10324
  }
10179
10325
 
10180
10326
  // ASCII alphanumerical and `-`.
10181
- if (code === 45 || asciiAlphanumeric$1(code)) {
10327
+ if (code === 45 || asciiAlphanumeric(code)) {
10182
10328
  effects.consume(code);
10183
10329
  buffer += String.fromCharCode(code);
10184
10330
  return tagName;
@@ -10281,7 +10427,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
10281
10427
  */
10282
10428
  function completeAttributeName(code) {
10283
10429
  // ASCII alphanumerical and `-`, `.`, `:`, and `_`.
10284
- if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric$1(code)) {
10430
+ if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
10285
10431
  effects.consume(code);
10286
10432
  return completeAttributeName;
10287
10433
  }
@@ -11134,7 +11280,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11134
11280
  */
11135
11281
  function tagClose(code) {
11136
11282
  // ASCII alphanumerical and `-`.
11137
- if (code === 45 || asciiAlphanumeric$1(code)) {
11283
+ if (code === 45 || asciiAlphanumeric(code)) {
11138
11284
  effects.consume(code);
11139
11285
  return tagClose;
11140
11286
  }
@@ -11175,7 +11321,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11175
11321
  */
11176
11322
  function tagOpen(code) {
11177
11323
  // ASCII alphanumerical and `-`.
11178
- if (code === 45 || asciiAlphanumeric$1(code)) {
11324
+ if (code === 45 || asciiAlphanumeric(code)) {
11179
11325
  effects.consume(code);
11180
11326
  return tagOpen;
11181
11327
  }
@@ -11229,7 +11375,7 @@ function tokenizeHtmlText(effects, ok, nok) {
11229
11375
  */
11230
11376
  function tagOpenAttributeName(code) {
11231
11377
  // ASCII alphabetical and `-`, `.`, `:`, and `_`.
11232
- if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric$1(code)) {
11378
+ if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
11233
11379
  effects.consume(code);
11234
11380
  return tagOpenAttributeName;
11235
11381
  }
@@ -13842,91 +13988,6 @@ function decode($0, $1, $2) {
13842
13988
  return decodeNamedCharacterReference($2) || $0;
13843
13989
  }
13844
13990
 
13845
- /**
13846
- * @typedef {import('unist').Node} Node
13847
- * @typedef {import('unist').Point} Point
13848
- * @typedef {import('unist').Position} Position
13849
- */
13850
-
13851
- /**
13852
- * @typedef NodeLike
13853
- * @property {string} type
13854
- * @property {PositionLike | null | undefined} [position]
13855
- *
13856
- * @typedef PointLike
13857
- * @property {number | null | undefined} [line]
13858
- * @property {number | null | undefined} [column]
13859
- * @property {number | null | undefined} [offset]
13860
- *
13861
- * @typedef PositionLike
13862
- * @property {PointLike | null | undefined} [start]
13863
- * @property {PointLike | null | undefined} [end]
13864
- */
13865
-
13866
- /**
13867
- * Serialize the positional info of a point, position (start and end points),
13868
- * or node.
13869
- *
13870
- * @param {Node | NodeLike | Point | PointLike | Position | PositionLike | null | undefined} [value]
13871
- * Node, position, or point.
13872
- * @returns {string}
13873
- * Pretty printed positional info of a node (`string`).
13874
- *
13875
- * In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
13876
- * or a point `l:c` (when given `point`), where `l` stands for line, `c` for
13877
- * column, `s` for `start`, and `e` for end.
13878
- * An empty string (`''`) is returned if the given value is neither `node`,
13879
- * `position`, nor `point`.
13880
- */
13881
- function stringifyPosition(value) {
13882
- // Nothing.
13883
- if (!value || typeof value !== 'object') {
13884
- return ''
13885
- }
13886
-
13887
- // Node.
13888
- if ('position' in value || 'type' in value) {
13889
- return position(value.position)
13890
- }
13891
-
13892
- // Position.
13893
- if ('start' in value || 'end' in value) {
13894
- return position(value)
13895
- }
13896
-
13897
- // Point.
13898
- if ('line' in value || 'column' in value) {
13899
- return point$1(value)
13900
- }
13901
-
13902
- // ?
13903
- return ''
13904
- }
13905
-
13906
- /**
13907
- * @param {Point | PointLike | null | undefined} point
13908
- * @returns {string}
13909
- */
13910
- function point$1(point) {
13911
- return index(point && point.line) + ':' + index(point && point.column)
13912
- }
13913
-
13914
- /**
13915
- * @param {Position | PositionLike | null | undefined} pos
13916
- * @returns {string}
13917
- */
13918
- function position(pos) {
13919
- return point$1(pos && pos.start) + '-' + point$1(pos && pos.end)
13920
- }
13921
-
13922
- /**
13923
- * @param {number | null | undefined} value
13924
- * @returns {number}
13925
- */
13926
- function index(value) {
13927
- return value && typeof value === 'number' ? value : 1
13928
- }
13929
-
13930
13991
  /**
13931
13992
  * @import {
13932
13993
  * Break,
@@ -13994,7 +14055,7 @@ const own$2 = {}.hasOwnProperty;
13994
14055
  * mdast tree.
13995
14056
  */
13996
14057
  function fromMarkdown(value, encoding, options) {
13997
- if (typeof encoding !== 'string') {
14058
+ if (encoding && typeof encoding === 'object') {
13998
14059
  options = encoding;
13999
14060
  encoding = undefined;
14000
14061
  }
@@ -15136,12 +15197,11 @@ function remarkParse(options) {
15136
15197
  }
15137
15198
 
15138
15199
  /**
15139
- * @typedef {import('hast').Element} Element
15140
- * @typedef {import('mdast').Blockquote} Blockquote
15141
- * @typedef {import('../state.js').State} State
15200
+ * @import {Element} from 'hast'
15201
+ * @import {Blockquote} from 'mdast'
15202
+ * @import {State} from '../state.js'
15142
15203
  */
15143
15204
 
15144
-
15145
15205
  /**
15146
15206
  * Turn an mdast `blockquote` node into hast.
15147
15207
  *
@@ -15165,13 +15225,11 @@ function blockquote(state, node) {
15165
15225
  }
15166
15226
 
15167
15227
  /**
15168
- * @typedef {import('hast').Element} Element
15169
- * @typedef {import('hast').Text} Text
15170
- * @typedef {import('mdast').Break} Break
15171
- * @typedef {import('../state.js').State} State
15228
+ * @import {Element, Text} from 'hast'
15229
+ * @import {Break} from 'mdast'
15230
+ * @import {State} from '../state.js'
15172
15231
  */
15173
15232
 
15174
-
15175
15233
  /**
15176
15234
  * Turn an mdast `break` node into hast.
15177
15235
  *
@@ -15190,13 +15248,11 @@ function hardBreak(state, node) {
15190
15248
  }
15191
15249
 
15192
15250
  /**
15193
- * @typedef {import('hast').Element} Element
15194
- * @typedef {import('hast').Properties} Properties
15195
- * @typedef {import('mdast').Code} Code
15196
- * @typedef {import('../state.js').State} State
15251
+ * @import {Element, Properties} from 'hast'
15252
+ * @import {Code} from 'mdast'
15253
+ * @import {State} from '../state.js'
15197
15254
  */
15198
15255
 
15199
-
15200
15256
  /**
15201
15257
  * Turn an mdast `code` node into hast.
15202
15258
  *
@@ -15211,9 +15267,12 @@ function code(state, node) {
15211
15267
  const value = node.value ? node.value + '\n' : '';
15212
15268
  /** @type {Properties} */
15213
15269
  const properties = {};
15270
+ // Someone can write `js&#x20;python&#x9;ruby`.
15271
+ const language = node.lang ? node.lang.split(/\s+/) : [];
15214
15272
 
15215
- if (node.lang) {
15216
- properties.className = ['language-' + node.lang];
15273
+ // GH/CM still drop the non-first languages.
15274
+ if (language.length > 0) {
15275
+ properties.className = ['language-' + language[0]];
15217
15276
  }
15218
15277
 
15219
15278
  // Create `<code>`.
@@ -15239,12 +15298,11 @@ function code(state, node) {
15239
15298
  }
15240
15299
 
15241
15300
  /**
15242
- * @typedef {import('hast').Element} Element
15243
- * @typedef {import('mdast').Delete} Delete
15244
- * @typedef {import('../state.js').State} State
15301
+ * @import {Element} from 'hast'
15302
+ * @import {Delete} from 'mdast'
15303
+ * @import {State} from '../state.js'
15245
15304
  */
15246
15305
 
15247
-
15248
15306
  /**
15249
15307
  * Turn an mdast `delete` node into hast.
15250
15308
  *
@@ -15268,12 +15326,11 @@ function strikethrough(state, node) {
15268
15326
  }
15269
15327
 
15270
15328
  /**
15271
- * @typedef {import('hast').Element} Element
15272
- * @typedef {import('mdast').Emphasis} Emphasis
15273
- * @typedef {import('../state.js').State} State
15329
+ * @import {Element} from 'hast'
15330
+ * @import {Emphasis} from 'mdast'
15331
+ * @import {State} from '../state.js'
15274
15332
  */
15275
15333
 
15276
-
15277
15334
  /**
15278
15335
  * Turn an mdast `emphasis` node into hast.
15279
15336
  *
@@ -15297,142 +15354,34 @@ function emphasis(state, node) {
15297
15354
  }
15298
15355
 
15299
15356
  /**
15300
- * @typedef {import('micromark-util-types').Code} Code
15357
+ * @import {Element} from 'hast'
15358
+ * @import {FootnoteReference} from 'mdast'
15359
+ * @import {State} from '../state.js'
15301
15360
  */
15302
15361
 
15303
15362
 
15304
15363
  /**
15305
- * Check whether the character code represents an ASCII alphanumeric (`a`
15306
- * through `z`, case insensitive, or `0` through `9`).
15307
- *
15308
- * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
15309
- * (see `asciiAlpha`).
15364
+ * Turn an mdast `footnoteReference` node into hast.
15310
15365
  *
15311
- * @param code
15312
- * Code.
15313
- * @returns {boolean}
15314
- * Whether it matches.
15366
+ * @param {State} state
15367
+ * Info passed around.
15368
+ * @param {FootnoteReference} node
15369
+ * mdast node.
15370
+ * @returns {Element}
15371
+ * hast node.
15315
15372
  */
15316
- const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
15373
+ function footnoteReference(state, node) {
15374
+ const clobberPrefix =
15375
+ typeof state.options.clobberPrefix === 'string'
15376
+ ? state.options.clobberPrefix
15377
+ : 'user-content-';
15378
+ const id = String(node.identifier).toUpperCase();
15379
+ const safeId = normalizeUri(id.toLowerCase());
15380
+ const index = state.footnoteOrder.indexOf(id);
15381
+ /** @type {number} */
15382
+ let counter;
15317
15383
 
15318
- /**
15319
- * Create a code check from a regex.
15320
- *
15321
- * @param {RegExp} regex
15322
- * @returns {(code: Code) => boolean}
15323
- */
15324
- function regexCheck(regex) {
15325
- return check;
15326
-
15327
- /**
15328
- * Check whether a code matches the bound regex.
15329
- *
15330
- * @param {Code} code
15331
- * Character code.
15332
- * @returns {boolean}
15333
- * Whether the character code matches the bound regex.
15334
- */
15335
- function check(code) {
15336
- return code !== null && code > -1 && regex.test(String.fromCharCode(code));
15337
- }
15338
- }
15339
-
15340
- /**
15341
- * Normalize a URL.
15342
- *
15343
- * Encode unsafe characters with percent-encoding, skipping already encoded
15344
- * sequences.
15345
- *
15346
- * @param {string} value
15347
- * URI to normalize.
15348
- * @returns {string}
15349
- * Normalized URI.
15350
- */
15351
- function normalizeUri(value) {
15352
- /** @type {Array<string>} */
15353
- const result = [];
15354
- let index = -1;
15355
- let start = 0;
15356
- let skip = 0;
15357
- while (++index < value.length) {
15358
- const code = value.charCodeAt(index);
15359
- /** @type {string} */
15360
- let replace = '';
15361
-
15362
- // A correct percent encoded value.
15363
- if (
15364
- code === 37 &&
15365
- asciiAlphanumeric(value.charCodeAt(index + 1)) &&
15366
- asciiAlphanumeric(value.charCodeAt(index + 2))
15367
- ) {
15368
- skip = 2;
15369
- }
15370
- // ASCII.
15371
- else if (code < 128) {
15372
- if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
15373
- replace = String.fromCharCode(code);
15374
- }
15375
- }
15376
- // Astral.
15377
- else if (code > 55_295 && code < 57_344) {
15378
- const next = value.charCodeAt(index + 1);
15379
-
15380
- // A correct surrogate pair.
15381
- if (code < 56_320 && next > 56_319 && next < 57_344) {
15382
- replace = String.fromCharCode(code, next);
15383
- skip = 1;
15384
- }
15385
- // Lone surrogate.
15386
- else {
15387
- replace = '\uFFFD';
15388
- }
15389
- }
15390
- // Unicode.
15391
- else {
15392
- replace = String.fromCharCode(code);
15393
- }
15394
- if (replace) {
15395
- result.push(value.slice(start, index), encodeURIComponent(replace));
15396
- start = index + skip + 1;
15397
- replace = '';
15398
- }
15399
- if (skip) {
15400
- index += skip;
15401
- skip = 0;
15402
- }
15403
- }
15404
- return result.join('') + value.slice(start)
15405
- }
15406
-
15407
- /**
15408
- * @typedef {import('hast').Element} Element
15409
- * @typedef {import('mdast').FootnoteReference} FootnoteReference
15410
- * @typedef {import('../state.js').State} State
15411
- */
15412
-
15413
-
15414
- /**
15415
- * Turn an mdast `footnoteReference` node into hast.
15416
- *
15417
- * @param {State} state
15418
- * Info passed around.
15419
- * @param {FootnoteReference} node
15420
- * mdast node.
15421
- * @returns {Element}
15422
- * hast node.
15423
- */
15424
- function footnoteReference(state, node) {
15425
- const clobberPrefix =
15426
- typeof state.options.clobberPrefix === 'string'
15427
- ? state.options.clobberPrefix
15428
- : 'user-content-';
15429
- const id = String(node.identifier).toUpperCase();
15430
- const safeId = normalizeUri(id.toLowerCase());
15431
- const index = state.footnoteOrder.indexOf(id);
15432
- /** @type {number} */
15433
- let counter;
15434
-
15435
- let reuseCounter = state.footnoteCounts.get(id);
15384
+ let reuseCounter = state.footnoteCounts.get(id);
15436
15385
 
15437
15386
  if (reuseCounter === undefined) {
15438
15387
  reuseCounter = 0;
@@ -15475,12 +15424,11 @@ function footnoteReference(state, node) {
15475
15424
  }
15476
15425
 
15477
15426
  /**
15478
- * @typedef {import('hast').Element} Element
15479
- * @typedef {import('mdast').Heading} Heading
15480
- * @typedef {import('../state.js').State} State
15427
+ * @import {Element} from 'hast'
15428
+ * @import {Heading} from 'mdast'
15429
+ * @import {State} from '../state.js'
15481
15430
  */
15482
15431
 
15483
-
15484
15432
  /**
15485
15433
  * Turn an mdast `heading` node into hast.
15486
15434
  *
@@ -15504,13 +15452,12 @@ function heading(state, node) {
15504
15452
  }
15505
15453
 
15506
15454
  /**
15507
- * @typedef {import('hast').Element} Element
15508
- * @typedef {import('mdast').Html} Html
15509
- * @typedef {import('../state.js').State} State
15510
- * @typedef {import('../../index.js').Raw} Raw
15455
+ * @import {Element} from 'hast'
15456
+ * @import {Html} from 'mdast'
15457
+ * @import {State} from '../state.js'
15458
+ * @import {Raw} from '../../index.js'
15511
15459
  */
15512
15460
 
15513
-
15514
15461
  /**
15515
15462
  * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise
15516
15463
  * nothing).
@@ -15534,15 +15481,11 @@ function html(state, node) {
15534
15481
  }
15535
15482
 
15536
15483
  /**
15537
- * @typedef {import('hast').ElementContent} ElementContent
15538
- *
15539
- * @typedef {import('mdast').Nodes} Nodes
15540
- * @typedef {import('mdast').Reference} Reference
15541
- *
15542
- * @typedef {import('./state.js').State} State
15484
+ * @import {ElementContent} from 'hast'
15485
+ * @import {Reference, Nodes} from 'mdast'
15486
+ * @import {State} from './state.js'
15543
15487
  */
15544
15488
 
15545
-
15546
15489
  /**
15547
15490
  * Return the content of a reference without definition as plain text.
15548
15491
  *
@@ -15588,11 +15531,9 @@ function revert(state, node) {
15588
15531
  }
15589
15532
 
15590
15533
  /**
15591
- * @typedef {import('hast').Element} Element
15592
- * @typedef {import('hast').ElementContent} ElementContent
15593
- * @typedef {import('hast').Properties} Properties
15594
- * @typedef {import('mdast').ImageReference} ImageReference
15595
- * @typedef {import('../state.js').State} State
15534
+ * @import {ElementContent, Element, Properties} from 'hast'
15535
+ * @import {ImageReference} from 'mdast'
15536
+ * @import {State} from '../state.js'
15596
15537
  */
15597
15538
 
15598
15539
 
@@ -15628,10 +15569,9 @@ function imageReference(state, node) {
15628
15569
  }
15629
15570
 
15630
15571
  /**
15631
- * @typedef {import('hast').Element} Element
15632
- * @typedef {import('hast').Properties} Properties
15633
- * @typedef {import('mdast').Image} Image
15634
- * @typedef {import('../state.js').State} State
15572
+ * @import {Element, Properties} from 'hast'
15573
+ * @import {Image} from 'mdast'
15574
+ * @import {State} from '../state.js'
15635
15575
  */
15636
15576
 
15637
15577
 
@@ -15664,13 +15604,11 @@ function image(state, node) {
15664
15604
  }
15665
15605
 
15666
15606
  /**
15667
- * @typedef {import('hast').Element} Element
15668
- * @typedef {import('hast').Text} Text
15669
- * @typedef {import('mdast').InlineCode} InlineCode
15670
- * @typedef {import('../state.js').State} State
15607
+ * @import {Element, Text} from 'hast'
15608
+ * @import {InlineCode} from 'mdast'
15609
+ * @import {State} from '../state.js'
15671
15610
  */
15672
15611
 
15673
-
15674
15612
  /**
15675
15613
  * Turn an mdast `inlineCode` node into hast.
15676
15614
  *
@@ -15698,11 +15636,9 @@ function inlineCode(state, node) {
15698
15636
  }
15699
15637
 
15700
15638
  /**
15701
- * @typedef {import('hast').Element} Element
15702
- * @typedef {import('hast').ElementContent} ElementContent
15703
- * @typedef {import('hast').Properties} Properties
15704
- * @typedef {import('mdast').LinkReference} LinkReference
15705
- * @typedef {import('../state.js').State} State
15639
+ * @import {ElementContent, Element, Properties} from 'hast'
15640
+ * @import {LinkReference} from 'mdast'
15641
+ * @import {State} from '../state.js'
15706
15642
  */
15707
15643
 
15708
15644
 
@@ -15743,10 +15679,9 @@ function linkReference(state, node) {
15743
15679
  }
15744
15680
 
15745
15681
  /**
15746
- * @typedef {import('hast').Element} Element
15747
- * @typedef {import('hast').Properties} Properties
15748
- * @typedef {import('mdast').Link} Link
15749
- * @typedef {import('../state.js').State} State
15682
+ * @import {Element, Properties} from 'hast'
15683
+ * @import {Link} from 'mdast'
15684
+ * @import {State} from '../state.js'
15750
15685
  */
15751
15686
 
15752
15687
 
@@ -15780,15 +15715,11 @@ function link(state, node) {
15780
15715
  }
15781
15716
 
15782
15717
  /**
15783
- * @typedef {import('hast').Element} Element
15784
- * @typedef {import('hast').ElementContent} ElementContent
15785
- * @typedef {import('hast').Properties} Properties
15786
- * @typedef {import('mdast').ListItem} ListItem
15787
- * @typedef {import('mdast').Parents} Parents
15788
- * @typedef {import('../state.js').State} State
15718
+ * @import {ElementContent, Element, Properties} from 'hast'
15719
+ * @import {ListItem, Parents} from 'mdast'
15720
+ * @import {State} from '../state.js'
15789
15721
  */
15790
15722
 
15791
-
15792
15723
  /**
15793
15724
  * Turn an mdast `listItem` node into hast.
15794
15725
  *
@@ -15904,13 +15835,11 @@ function listItemLoose(node) {
15904
15835
  }
15905
15836
 
15906
15837
  /**
15907
- * @typedef {import('hast').Element} Element
15908
- * @typedef {import('hast').Properties} Properties
15909
- * @typedef {import('mdast').List} List
15910
- * @typedef {import('../state.js').State} State
15838
+ * @import {Element, Properties} from 'hast'
15839
+ * @import {List} from 'mdast'
15840
+ * @import {State} from '../state.js'
15911
15841
  */
15912
15842
 
15913
-
15914
15843
  /**
15915
15844
  * Turn an mdast `list` node into hast.
15916
15845
  *
@@ -15959,12 +15888,11 @@ function list(state, node) {
15959
15888
  }
15960
15889
 
15961
15890
  /**
15962
- * @typedef {import('hast').Element} Element
15963
- * @typedef {import('mdast').Paragraph} Paragraph
15964
- * @typedef {import('../state.js').State} State
15891
+ * @import {Element} from 'hast'
15892
+ * @import {Paragraph} from 'mdast'
15893
+ * @import {State} from '../state.js'
15965
15894
  */
15966
15895
 
15967
-
15968
15896
  /**
15969
15897
  * Turn an mdast `paragraph` node into hast.
15970
15898
  *
@@ -15988,13 +15916,11 @@ function paragraph(state, node) {
15988
15916
  }
15989
15917
 
15990
15918
  /**
15991
- * @typedef {import('hast').Parents} HastParents
15992
- * @typedef {import('hast').Root} HastRoot
15993
- * @typedef {import('mdast').Root} MdastRoot
15994
- * @typedef {import('../state.js').State} State
15919
+ * @import {Parents as HastParents, Root as HastRoot} from 'hast'
15920
+ * @import {Root as MdastRoot} from 'mdast'
15921
+ * @import {State} from '../state.js'
15995
15922
  */
15996
15923
 
15997
-
15998
15924
  /**
15999
15925
  * Turn an mdast `root` node into hast.
16000
15926
  *
@@ -16013,12 +15939,11 @@ function root(state, node) {
16013
15939
  }
16014
15940
 
16015
15941
  /**
16016
- * @typedef {import('hast').Element} Element
16017
- * @typedef {import('mdast').Strong} Strong
16018
- * @typedef {import('../state.js').State} State
15942
+ * @import {Element} from 'hast'
15943
+ * @import {Strong} from 'mdast'
15944
+ * @import {State} from '../state.js'
16019
15945
  */
16020
15946
 
16021
-
16022
15947
  /**
16023
15948
  * Turn an mdast `strong` node into hast.
16024
15949
  *
@@ -16042,9 +15967,9 @@ function strong(state, node) {
16042
15967
  }
16043
15968
 
16044
15969
  /**
16045
- * @typedef {import('hast').Element} Element
16046
- * @typedef {import('mdast').Table} Table
16047
- * @typedef {import('../state.js').State} State
15970
+ * @import {Table} from 'mdast'
15971
+ * @import {Element} from 'hast'
15972
+ * @import {State} from '../state.js'
16048
15973
  */
16049
15974
 
16050
15975
 
@@ -16103,15 +16028,11 @@ function table(state, node) {
16103
16028
  }
16104
16029
 
16105
16030
  /**
16106
- * @typedef {import('hast').Element} Element
16107
- * @typedef {import('hast').ElementContent} ElementContent
16108
- * @typedef {import('hast').Properties} Properties
16109
- * @typedef {import('mdast').Parents} Parents
16110
- * @typedef {import('mdast').TableRow} TableRow
16111
- * @typedef {import('../state.js').State} State
16031
+ * @import {Element, ElementContent, Properties} from 'hast'
16032
+ * @import {Parents, TableRow} from 'mdast'
16033
+ * @import {State} from '../state.js'
16112
16034
  */
16113
16035
 
16114
-
16115
16036
  /**
16116
16037
  * Turn an mdast `tableRow` node into hast.
16117
16038
  *
@@ -16171,12 +16092,11 @@ function tableRow(state, node, parent) {
16171
16092
  }
16172
16093
 
16173
16094
  /**
16174
- * @typedef {import('hast').Element} Element
16175
- * @typedef {import('mdast').TableCell} TableCell
16176
- * @typedef {import('../state.js').State} State
16095
+ * @import {Element} from 'hast'
16096
+ * @import {TableCell} from 'mdast'
16097
+ * @import {State} from '../state.js'
16177
16098
  */
16178
16099
 
16179
-
16180
16100
  /**
16181
16101
  * Turn an mdast `tableCell` node into hast.
16182
16102
  *
@@ -16272,10 +16192,9 @@ function trimLine(value, start, end) {
16272
16192
  }
16273
16193
 
16274
16194
  /**
16275
- * @typedef {import('hast').Element} HastElement
16276
- * @typedef {import('hast').Text} HastText
16277
- * @typedef {import('mdast').Text} MdastText
16278
- * @typedef {import('../state.js').State} State
16195
+ * @import {Element as HastElement, Text as HastText} from 'hast'
16196
+ * @import {Text as MdastText} from 'mdast'
16197
+ * @import {State} from '../state.js'
16279
16198
  */
16280
16199
 
16281
16200
 
@@ -16297,12 +16216,11 @@ function text(state, node) {
16297
16216
  }
16298
16217
 
16299
16218
  /**
16300
- * @typedef {import('hast').Element} Element
16301
- * @typedef {import('mdast').ThematicBreak} ThematicBreak
16302
- * @typedef {import('../state.js').State} State
16219
+ * @import {Element} from 'hast'
16220
+ * @import {ThematicBreak} from 'mdast'
16221
+ * @import {State} from '../state.js'
16303
16222
  */
16304
16223
 
16305
-
16306
16224
  /**
16307
16225
  * Turn an mdast `thematicBreak` node into hast.
16308
16226
  *
@@ -16325,10 +16243,15 @@ function thematicBreak(state, node) {
16325
16243
  return state.applyData(node, result)
16326
16244
  }
16327
16245
 
16246
+ /**
16247
+ * @import {Handlers} from '../state.js'
16248
+ */
16249
+
16250
+
16328
16251
  /**
16329
16252
  * Default handlers for nodes.
16330
16253
  *
16331
- * @satisfies {import('../state.js').Handlers}
16254
+ * @satisfies {Handlers}
16332
16255
  */
16333
16256
  const handlers = {
16334
16257
  blockquote,
@@ -16433,6 +16356,12 @@ const deserializer = ($, _) => {
16433
16356
  return as(BigInt(value), index);
16434
16357
  case 'BigInt':
16435
16358
  return as(Object(BigInt(value)), index);
16359
+ case 'ArrayBuffer':
16360
+ return as(new Uint8Array(value).buffer, value);
16361
+ case 'DataView': {
16362
+ const { buffer } = new Uint8Array(value);
16363
+ return as(new DataView(buffer), value);
16364
+ }
16436
16365
  }
16437
16366
  return as(new env[type](value), index);
16438
16367
  };
@@ -16475,6 +16404,8 @@ const typeOf = value => {
16475
16404
  return [MAP, EMPTY];
16476
16405
  case 'Set':
16477
16406
  return [SET, EMPTY];
16407
+ case 'DataView':
16408
+ return [ARRAY, asString];
16478
16409
  }
16479
16410
 
16480
16411
  if (asString.includes('Array'))
@@ -16524,9 +16455,17 @@ const serializer = (strict, json, $, _) => {
16524
16455
  return as([TYPE, entry], value);
16525
16456
  }
16526
16457
  case ARRAY: {
16527
- if (type)
16528
- return as([type, [...value]], value);
16529
-
16458
+ if (type) {
16459
+ let spread = value;
16460
+ if (type === 'DataView') {
16461
+ spread = new Uint8Array(value.buffer);
16462
+ }
16463
+ else if (type === 'ArrayBuffer') {
16464
+ spread = new Uint8Array(value);
16465
+ }
16466
+ return as([type, [...spread]], value);
16467
+ }
16468
+
16530
16469
  const arr = [];
16531
16470
  const index = as([TYPE, arr], value);
16532
16471
  for (const entry of value)
@@ -16627,10 +16566,8 @@ var structuredClone$1 = typeof structuredClone === "function" ?
16627
16566
  (any, options) => deserialize(serialize(any, options));
16628
16567
 
16629
16568
  /**
16630
- * @typedef {import('hast').Element} Element
16631
- * @typedef {import('hast').ElementContent} ElementContent
16632
- *
16633
- * @typedef {import('./state.js').State} State
16569
+ * @import {ElementContent, Element} from 'hast'
16570
+ * @import {State} from './state.js'
16634
16571
  */
16635
16572
 
16636
16573
 
@@ -17278,22 +17215,25 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
17278
17215
  }
17279
17216
 
17280
17217
  /**
17281
- * @typedef {import('hast').Element} HastElement
17282
- * @typedef {import('hast').ElementContent} HastElementContent
17283
- * @typedef {import('hast').Nodes} HastNodes
17284
- * @typedef {import('hast').Properties} HastProperties
17285
- * @typedef {import('hast').RootContent} HastRootContent
17286
- * @typedef {import('hast').Text} HastText
17287
- *
17288
- * @typedef {import('mdast').Definition} MdastDefinition
17289
- * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition
17290
- * @typedef {import('mdast').Nodes} MdastNodes
17291
- * @typedef {import('mdast').Parents} MdastParents
17292
- *
17293
- * @typedef {import('vfile').VFile} VFile
17294
- *
17295
- * @typedef {import('./footer.js').FootnoteBackContentTemplate} FootnoteBackContentTemplate
17296
- * @typedef {import('./footer.js').FootnoteBackLabelTemplate} FootnoteBackLabelTemplate
17218
+ * @import {
17219
+ * ElementContent as HastElementContent,
17220
+ * Element as HastElement,
17221
+ * Nodes as HastNodes,
17222
+ * Properties as HastProperties,
17223
+ * RootContent as HastRootContent,
17224
+ * Text as HastText
17225
+ * } from 'hast'
17226
+ * @import {
17227
+ * Definition as MdastDefinition,
17228
+ * FootnoteDefinition as MdastFootnoteDefinition,
17229
+ * Nodes as MdastNodes,
17230
+ * Parents as MdastParents
17231
+ * } from 'mdast'
17232
+ * @import {VFile} from 'vfile'
17233
+ * @import {
17234
+ * FootnoteBackContentTemplate,
17235
+ * FootnoteBackLabelTemplate
17236
+ * } from './footer.js'
17297
17237
  */
17298
17238
 
17299
17239
 
@@ -17451,7 +17391,7 @@ function createState(tree, options) {
17451
17391
  * Nothing.
17452
17392
  */
17453
17393
  function patch(from, to) {
17454
- if (from.position) to.position = position$2(from);
17394
+ if (from.position) to.position = position$1(from);
17455
17395
  }
17456
17396
 
17457
17397
  /**
@@ -17593,9 +17533,9 @@ function trimMarkdownSpaceStart(value) {
17593
17533
  }
17594
17534
 
17595
17535
  /**
17596
- * @typedef {import('hast').Nodes} HastNodes
17597
- * @typedef {import('mdast').Nodes} MdastNodes
17598
- * @typedef {import('./state.js').Options} Options
17536
+ * @import {Nodes as HastNodes} from 'hast'
17537
+ * @import {Nodes as MdastNodes} from 'mdast'
17538
+ * @import {Options} from './state.js'
17599
17539
  */
17600
17540
 
17601
17541
 
@@ -17915,7 +17855,7 @@ var getProperty = function getProperty(obj, name) {
17915
17855
  return obj[name];
17916
17856
  };
17917
17857
 
17918
- var extend = function extend() {
17858
+ var extend$1 = function extend() {
17919
17859
  var options, name, src, copy, copyIsArray, clone;
17920
17860
  var target = arguments[0];
17921
17861
  var i = 1;
@@ -17969,7 +17909,7 @@ var extend = function extend() {
17969
17909
  return target;
17970
17910
  };
17971
17911
 
17972
- var extend$1 = /*@__PURE__*/getDefaultExportFromCjs(extend);
17912
+ var extend = /*@__PURE__*/getDefaultExportFromCjs(extend$1);
17973
17913
 
17974
17914
  function isPlainObject(value) {
17975
17915
  if (typeof value !== 'object' || value === null) {
@@ -18187,303 +18127,6 @@ function wrap(middleware, callback) {
18187
18127
  }
18188
18128
  }
18189
18129
 
18190
- /**
18191
- * @import {Node, Point, Position} from 'unist'
18192
- */
18193
-
18194
-
18195
- /**
18196
- * Message.
18197
- */
18198
- class VFileMessage extends Error {
18199
- /**
18200
- * Create a message for `reason`.
18201
- *
18202
- * > 🪦 **Note**: also has obsolete signatures.
18203
- *
18204
- * @overload
18205
- * @param {string} reason
18206
- * @param {Options | null | undefined} [options]
18207
- * @returns
18208
- *
18209
- * @overload
18210
- * @param {string} reason
18211
- * @param {Node | NodeLike | null | undefined} parent
18212
- * @param {string | null | undefined} [origin]
18213
- * @returns
18214
- *
18215
- * @overload
18216
- * @param {string} reason
18217
- * @param {Point | Position | null | undefined} place
18218
- * @param {string | null | undefined} [origin]
18219
- * @returns
18220
- *
18221
- * @overload
18222
- * @param {string} reason
18223
- * @param {string | null | undefined} [origin]
18224
- * @returns
18225
- *
18226
- * @overload
18227
- * @param {Error | VFileMessage} cause
18228
- * @param {Node | NodeLike | null | undefined} parent
18229
- * @param {string | null | undefined} [origin]
18230
- * @returns
18231
- *
18232
- * @overload
18233
- * @param {Error | VFileMessage} cause
18234
- * @param {Point | Position | null | undefined} place
18235
- * @param {string | null | undefined} [origin]
18236
- * @returns
18237
- *
18238
- * @overload
18239
- * @param {Error | VFileMessage} cause
18240
- * @param {string | null | undefined} [origin]
18241
- * @returns
18242
- *
18243
- * @param {Error | VFileMessage | string} causeOrReason
18244
- * Reason for message, should use markdown.
18245
- * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
18246
- * Configuration (optional).
18247
- * @param {string | null | undefined} [origin]
18248
- * Place in code where the message originates (example:
18249
- * `'my-package:my-rule'` or `'my-rule'`).
18250
- * @returns
18251
- * Instance of `VFileMessage`.
18252
- */
18253
- // eslint-disable-next-line complexity
18254
- constructor(causeOrReason, optionsOrParentOrPlace, origin) {
18255
- super();
18256
-
18257
- if (typeof optionsOrParentOrPlace === 'string') {
18258
- origin = optionsOrParentOrPlace;
18259
- optionsOrParentOrPlace = undefined;
18260
- }
18261
-
18262
- /** @type {string} */
18263
- let reason = '';
18264
- /** @type {Options} */
18265
- let options = {};
18266
- let legacyCause = false;
18267
-
18268
- if (optionsOrParentOrPlace) {
18269
- // Point.
18270
- if (
18271
- 'line' in optionsOrParentOrPlace &&
18272
- 'column' in optionsOrParentOrPlace
18273
- ) {
18274
- options = {place: optionsOrParentOrPlace};
18275
- }
18276
- // Position.
18277
- else if (
18278
- 'start' in optionsOrParentOrPlace &&
18279
- 'end' in optionsOrParentOrPlace
18280
- ) {
18281
- options = {place: optionsOrParentOrPlace};
18282
- }
18283
- // Node.
18284
- else if ('type' in optionsOrParentOrPlace) {
18285
- options = {
18286
- ancestors: [optionsOrParentOrPlace],
18287
- place: optionsOrParentOrPlace.position
18288
- };
18289
- }
18290
- // Options.
18291
- else {
18292
- options = {...optionsOrParentOrPlace};
18293
- }
18294
- }
18295
-
18296
- if (typeof causeOrReason === 'string') {
18297
- reason = causeOrReason;
18298
- }
18299
- // Error.
18300
- else if (!options.cause && causeOrReason) {
18301
- legacyCause = true;
18302
- reason = causeOrReason.message;
18303
- options.cause = causeOrReason;
18304
- }
18305
-
18306
- if (!options.ruleId && !options.source && typeof origin === 'string') {
18307
- const index = origin.indexOf(':');
18308
-
18309
- if (index === -1) {
18310
- options.ruleId = origin;
18311
- } else {
18312
- options.source = origin.slice(0, index);
18313
- options.ruleId = origin.slice(index + 1);
18314
- }
18315
- }
18316
-
18317
- if (!options.place && options.ancestors && options.ancestors) {
18318
- const parent = options.ancestors[options.ancestors.length - 1];
18319
-
18320
- if (parent) {
18321
- options.place = parent.position;
18322
- }
18323
- }
18324
-
18325
- const start =
18326
- options.place && 'start' in options.place
18327
- ? options.place.start
18328
- : options.place;
18329
-
18330
- /**
18331
- * Stack of ancestor nodes surrounding the message.
18332
- *
18333
- * @type {Array<Node> | undefined}
18334
- */
18335
- this.ancestors = options.ancestors || undefined;
18336
-
18337
- /**
18338
- * Original error cause of the message.
18339
- *
18340
- * @type {Error | undefined}
18341
- */
18342
- this.cause = options.cause || undefined;
18343
-
18344
- /**
18345
- * Starting column of message.
18346
- *
18347
- * @type {number | undefined}
18348
- */
18349
- this.column = start ? start.column : undefined;
18350
-
18351
- /**
18352
- * State of problem.
18353
- *
18354
- * * `true` — error, file not usable
18355
- * * `false` — warning, change may be needed
18356
- * * `undefined` — change likely not needed
18357
- *
18358
- * @type {boolean | null | undefined}
18359
- */
18360
- this.fatal = undefined;
18361
-
18362
- /**
18363
- * Path of a file (used throughout the `VFile` ecosystem).
18364
- *
18365
- * @type {string | undefined}
18366
- */
18367
- this.file = '';
18368
-
18369
- // Field from `Error`.
18370
- /**
18371
- * Reason for message.
18372
- *
18373
- * @type {string}
18374
- */
18375
- this.message = reason;
18376
-
18377
- /**
18378
- * Starting line of error.
18379
- *
18380
- * @type {number | undefined}
18381
- */
18382
- this.line = start ? start.line : undefined;
18383
-
18384
- // Field from `Error`.
18385
- /**
18386
- * Serialized positional info of message.
18387
- *
18388
- * On normal errors, this would be something like `ParseError`, buit in
18389
- * `VFile` messages we use this space to show where an error happened.
18390
- */
18391
- this.name = stringifyPosition(options.place) || '1:1';
18392
-
18393
- /**
18394
- * Place of message.
18395
- *
18396
- * @type {Point | Position | undefined}
18397
- */
18398
- this.place = options.place || undefined;
18399
-
18400
- /**
18401
- * Reason for message, should use markdown.
18402
- *
18403
- * @type {string}
18404
- */
18405
- this.reason = this.message;
18406
-
18407
- /**
18408
- * Category of message (example: `'my-rule'`).
18409
- *
18410
- * @type {string | undefined}
18411
- */
18412
- this.ruleId = options.ruleId || undefined;
18413
-
18414
- /**
18415
- * Namespace of message (example: `'my-package'`).
18416
- *
18417
- * @type {string | undefined}
18418
- */
18419
- this.source = options.source || undefined;
18420
-
18421
- // Field from `Error`.
18422
- /**
18423
- * Stack of message.
18424
- *
18425
- * This is used by normal errors to show where something happened in
18426
- * programming code, irrelevant for `VFile` messages,
18427
- *
18428
- * @type {string}
18429
- */
18430
- this.stack =
18431
- legacyCause && options.cause && typeof options.cause.stack === 'string'
18432
- ? options.cause.stack
18433
- : '';
18434
-
18435
- // The following fields are “well known”.
18436
- // Not standard.
18437
- // Feel free to add other non-standard fields to your messages.
18438
-
18439
- /**
18440
- * Specify the source value that’s being reported, which is deemed
18441
- * incorrect.
18442
- *
18443
- * @type {string | undefined}
18444
- */
18445
- this.actual = undefined;
18446
-
18447
- /**
18448
- * Suggest acceptable values that can be used instead of `actual`.
18449
- *
18450
- * @type {Array<string> | undefined}
18451
- */
18452
- this.expected = undefined;
18453
-
18454
- /**
18455
- * Long form description of the message (you should use markdown).
18456
- *
18457
- * @type {string | undefined}
18458
- */
18459
- this.note = undefined;
18460
-
18461
- /**
18462
- * Link to docs for the message.
18463
- *
18464
- * > 👉 **Note**: this must be an absolute URL that can be passed as `x`
18465
- * > to `new URL(x)`.
18466
- *
18467
- * @type {string | undefined}
18468
- */
18469
- this.url = undefined;
18470
- }
18471
- }
18472
-
18473
- VFileMessage.prototype.file = '';
18474
- VFileMessage.prototype.name = '';
18475
- VFileMessage.prototype.reason = '';
18476
- VFileMessage.prototype.message = '';
18477
- VFileMessage.prototype.stack = '';
18478
- VFileMessage.prototype.column = undefined;
18479
- VFileMessage.prototype.line = undefined;
18480
- VFileMessage.prototype.ancestors = undefined;
18481
- VFileMessage.prototype.cause = undefined;
18482
- VFileMessage.prototype.fatal = undefined;
18483
- VFileMessage.prototype.place = undefined;
18484
- VFileMessage.prototype.ruleId = undefined;
18485
- VFileMessage.prototype.source = undefined;
18486
-
18487
18130
  // A derivative work based on:
18488
18131
  // <https://github.com/browserify/path-browserify>.
18489
18132
  // Which is licensed:
@@ -19871,7 +19514,7 @@ class Processor extends CallableInstance {
19871
19514
  destination.use(...attacher);
19872
19515
  }
19873
19516
 
19874
- destination.data(extend$1(true, {}, this.namespace));
19517
+ destination.data(extend(true, {}, this.namespace));
19875
19518
 
19876
19519
  return destination
19877
19520
  }
@@ -20469,7 +20112,7 @@ class Processor extends CallableInstance {
20469
20112
  addList(result.plugins);
20470
20113
 
20471
20114
  if (result.settings) {
20472
- namespace.settings = extend$1(true, namespace.settings, result.settings);
20115
+ namespace.settings = extend(true, namespace.settings, result.settings);
20473
20116
  }
20474
20117
  }
20475
20118
 
@@ -20515,7 +20158,7 @@ class Processor extends CallableInstance {
20515
20158
  let [primary, ...rest] = parameters;
20516
20159
  const currentPrimary = attachers[entryIndex][1];
20517
20160
  if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
20518
- primary = extend$1(true, currentPrimary, primary);
20161
+ primary = extend(true, currentPrimary, primary);
20519
20162
  }
20520
20163
 
20521
20164
  attachers[entryIndex] = [plugin, primary, ...rest];