document-model 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/browser/cjs/document-model.js +2 -2
  2. package/dist/browser/cjs/document.js +2 -2
  3. package/dist/browser/cjs/index.js +2 -2
  4. package/dist/{node/cjs/internal/index-D3g-pNfj.js → browser/cjs/internal/index-C1zE8gB2.js} +2 -2
  5. package/dist/browser/cjs/internal/index-C1zE8gB2.js.map +1 -0
  6. package/dist/browser/cjs/internal/{index-Bw5CBBzd.js → index-lPRldkww.js} +2 -2
  7. package/dist/browser/cjs/internal/{index-Bw5CBBzd.js.map → index-lPRldkww.js.map} +1 -1
  8. package/dist/browser/cjs/internal/{object--q7pfp1w.js → object-Cwxm4B8F.js} +514 -502
  9. package/dist/browser/cjs/internal/object-Cwxm4B8F.js.map +1 -0
  10. package/dist/browser/es/document-model.js +2 -2
  11. package/dist/browser/es/document.js +2 -2
  12. package/dist/browser/es/index.js +2 -2
  13. package/dist/browser/es/internal/{index-BxwF1TSy.js → index-D7g8OoD_.js} +2 -2
  14. package/dist/browser/es/internal/{index-BxwF1TSy.js.map → index-D7g8OoD_.js.map} +1 -1
  15. package/dist/browser/es/internal/{index-CAeTm1rC.js → index-DB3PHVmg.js} +2 -2
  16. package/dist/browser/es/internal/index-DB3PHVmg.js.map +1 -0
  17. package/dist/browser/es/internal/{object-Ce5PU4Jl.js → object-ivG479sP.js} +514 -502
  18. package/dist/browser/es/internal/object-ivG479sP.js.map +1 -0
  19. package/dist/browser/src/document/utils/crypto.d.ts +1 -1
  20. package/dist/browser/src/document/utils/node.d.ts +2 -2
  21. package/dist/browser/src/document-model/gen/schema/zod.d.ts +42 -42
  22. package/dist/node/cjs/document-model.js +2 -2
  23. package/dist/node/cjs/document.js +2 -2
  24. package/dist/node/cjs/index.js +2 -2
  25. package/dist/node/cjs/internal/{index-DN4JFG8x.js → index-5zAjb9ey.js} +2 -2
  26. package/dist/node/cjs/internal/{index-DN4JFG8x.js.map → index-5zAjb9ey.js.map} +1 -1
  27. package/dist/{browser/cjs/internal/index-D4hLw2sB.js → node/cjs/internal/index-Dsv6Zoey.js} +2 -2
  28. package/dist/node/cjs/internal/index-Dsv6Zoey.js.map +1 -0
  29. package/dist/node/cjs/internal/{object-BQxrSeG7.js → object-DgmfygmD.js} +511 -499
  30. package/dist/node/cjs/internal/object-DgmfygmD.js.map +1 -0
  31. package/dist/node/es/document-model.js +2 -2
  32. package/dist/node/es/document.js +2 -2
  33. package/dist/node/es/index.js +2 -2
  34. package/dist/node/es/internal/{index-BFweBcJ_.js → index-CA0xV5XL.js} +2 -2
  35. package/dist/node/es/internal/index-CA0xV5XL.js.map +1 -0
  36. package/dist/node/es/internal/{index-DqBMm_QB.js → index-CmgkUOei.js} +2 -2
  37. package/dist/node/es/internal/{index-DqBMm_QB.js.map → index-CmgkUOei.js.map} +1 -1
  38. package/dist/node/es/internal/{object-BFAL5P1X.js → object-890lc6IO.js} +511 -499
  39. package/dist/node/es/internal/object-890lc6IO.js.map +1 -0
  40. package/dist/node/src/document/utils/crypto.d.ts +1 -1
  41. package/dist/node/src/document/utils/node.d.ts +2 -2
  42. package/dist/node/src/document-model/gen/schema/zod.d.ts +42 -42
  43. package/package.json +9 -9
  44. package/dist/browser/cjs/internal/index-D4hLw2sB.js.map +0 -1
  45. package/dist/browser/cjs/internal/object--q7pfp1w.js.map +0 -1
  46. package/dist/browser/es/internal/index-CAeTm1rC.js.map +0 -1
  47. package/dist/browser/es/internal/object-Ce5PU4Jl.js.map +0 -1
  48. package/dist/node/cjs/internal/index-D3g-pNfj.js.map +0 -1
  49. package/dist/node/cjs/internal/object-BQxrSeG7.js.map +0 -1
  50. package/dist/node/es/internal/index-BFweBcJ_.js.map +0 -1
  51. package/dist/node/es/internal/object-BFAL5P1X.js.map +0 -1
@@ -144,594 +144,604 @@ function getDefaultExportFromCjs(x) {
144
144
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
145
145
  }
146
146
  var safeStableStringify = { exports: {} };
147
- (function(module, exports) {
148
- const { hasOwnProperty } = Object.prototype;
149
- const stringify = configure();
150
- stringify.configure = configure;
151
- stringify.stringify = stringify;
152
- stringify.default = stringify;
153
- exports.stringify = stringify;
154
- exports.configure = configure;
155
- module.exports = stringify;
156
- const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
157
- function strEscape(str) {
158
- if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
159
- return `"${str}"`;
160
- }
161
- return JSON.stringify(str);
162
- }
163
- function sort(array, comparator) {
164
- if (array.length > 200 || comparator) {
165
- return array.sort(comparator);
166
- }
167
- for (let i = 1; i < array.length; i++) {
168
- const currentValue = array[i];
169
- let position = i;
170
- while (position !== 0 && array[position - 1] > currentValue) {
171
- array[position] = array[position - 1];
172
- position--;
147
+ var hasRequiredSafeStableStringify;
148
+ function requireSafeStableStringify() {
149
+ if (hasRequiredSafeStableStringify) return safeStableStringify.exports;
150
+ hasRequiredSafeStableStringify = 1;
151
+ (function(module, exports) {
152
+ const { hasOwnProperty } = Object.prototype;
153
+ const stringify = configure();
154
+ stringify.configure = configure;
155
+ stringify.stringify = stringify;
156
+ stringify.default = stringify;
157
+ exports.stringify = stringify;
158
+ exports.configure = configure;
159
+ module.exports = stringify;
160
+ const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
161
+ function strEscape(str) {
162
+ if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
163
+ return `"${str}"`;
173
164
  }
174
- array[position] = currentValue;
165
+ return JSON.stringify(str);
175
166
  }
176
- return array;
177
- }
178
- const typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(
179
- Object.getPrototypeOf(
180
- Object.getPrototypeOf(
181
- new Int8Array()
182
- )
183
- ),
184
- Symbol.toStringTag
185
- ).get;
186
- function isTypedArrayWithEntries(value) {
187
- return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
188
- }
189
- function stringifyTypedArray(array, separator, maximumBreadth) {
190
- if (array.length < maximumBreadth) {
191
- maximumBreadth = array.length;
192
- }
193
- const whitespace = separator === "," ? "" : " ";
194
- let res = `"0":${whitespace}${array[0]}`;
195
- for (let i = 1; i < maximumBreadth; i++) {
196
- res += `${separator}"${i}":${whitespace}${array[i]}`;
197
- }
198
- return res;
199
- }
200
- function getCircularValueOption(options) {
201
- if (hasOwnProperty.call(options, "circularValue")) {
202
- const circularValue = options.circularValue;
203
- if (typeof circularValue === "string") {
204
- return `"${circularValue}"`;
167
+ function sort(array, comparator) {
168
+ if (array.length > 200 || comparator) {
169
+ return array.sort(comparator);
205
170
  }
206
- if (circularValue == null) {
207
- return circularValue;
208
- }
209
- if (circularValue === Error || circularValue === TypeError) {
210
- return {
211
- toString() {
212
- throw new TypeError("Converting circular structure to JSON");
213
- }
214
- };
171
+ for (let i = 1; i < array.length; i++) {
172
+ const currentValue = array[i];
173
+ let position = i;
174
+ while (position !== 0 && array[position - 1] > currentValue) {
175
+ array[position] = array[position - 1];
176
+ position--;
177
+ }
178
+ array[position] = currentValue;
215
179
  }
216
- throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
180
+ return array;
217
181
  }
218
- return '"[Circular]"';
219
- }
220
- function getDeterministicOption(options) {
221
- let value;
222
- if (hasOwnProperty.call(options, "deterministic")) {
223
- value = options.deterministic;
224
- if (typeof value !== "boolean" && typeof value !== "function") {
225
- throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
182
+ const typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(
183
+ Object.getPrototypeOf(
184
+ Object.getPrototypeOf(
185
+ new Int8Array()
186
+ )
187
+ ),
188
+ Symbol.toStringTag
189
+ ).get;
190
+ function isTypedArrayWithEntries(value) {
191
+ return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
192
+ }
193
+ function stringifyTypedArray(array, separator, maximumBreadth) {
194
+ if (array.length < maximumBreadth) {
195
+ maximumBreadth = array.length;
226
196
  }
227
- }
228
- return value === void 0 ? true : value;
229
- }
230
- function getBooleanOption(options, key) {
231
- let value;
232
- if (hasOwnProperty.call(options, key)) {
233
- value = options[key];
234
- if (typeof value !== "boolean") {
235
- throw new TypeError(`The "${key}" argument must be of type boolean`);
197
+ const whitespace = separator === "," ? "" : " ";
198
+ let res = `"0":${whitespace}${array[0]}`;
199
+ for (let i = 1; i < maximumBreadth; i++) {
200
+ res += `${separator}"${i}":${whitespace}${array[i]}`;
236
201
  }
202
+ return res;
237
203
  }
238
- return value === void 0 ? true : value;
239
- }
240
- function getPositiveIntegerOption(options, key) {
241
- let value;
242
- if (hasOwnProperty.call(options, key)) {
243
- value = options[key];
244
- if (typeof value !== "number") {
245
- throw new TypeError(`The "${key}" argument must be of type number`);
204
+ function getCircularValueOption(options) {
205
+ if (hasOwnProperty.call(options, "circularValue")) {
206
+ const circularValue = options.circularValue;
207
+ if (typeof circularValue === "string") {
208
+ return `"${circularValue}"`;
209
+ }
210
+ if (circularValue == null) {
211
+ return circularValue;
212
+ }
213
+ if (circularValue === Error || circularValue === TypeError) {
214
+ return {
215
+ toString() {
216
+ throw new TypeError("Converting circular structure to JSON");
217
+ }
218
+ };
219
+ }
220
+ throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
246
221
  }
247
- if (!Number.isInteger(value)) {
248
- throw new TypeError(`The "${key}" argument must be an integer`);
222
+ return '"[Circular]"';
223
+ }
224
+ function getDeterministicOption(options) {
225
+ let value;
226
+ if (hasOwnProperty.call(options, "deterministic")) {
227
+ value = options.deterministic;
228
+ if (typeof value !== "boolean" && typeof value !== "function") {
229
+ throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
230
+ }
249
231
  }
250
- if (value < 1) {
251
- throw new RangeError(`The "${key}" argument must be >= 1`);
232
+ return value === void 0 ? true : value;
233
+ }
234
+ function getBooleanOption(options, key) {
235
+ let value;
236
+ if (hasOwnProperty.call(options, key)) {
237
+ value = options[key];
238
+ if (typeof value !== "boolean") {
239
+ throw new TypeError(`The "${key}" argument must be of type boolean`);
240
+ }
252
241
  }
253
- }
254
- return value === void 0 ? Infinity : value;
255
- }
256
- function getItemCount(number) {
257
- if (number === 1) {
258
- return "1 item";
259
- }
260
- return `${number} items`;
261
- }
262
- function getUniqueReplacerSet(replacerArray) {
263
- const replacerSet = /* @__PURE__ */ new Set();
264
- for (const value of replacerArray) {
265
- if (typeof value === "string" || typeof value === "number") {
266
- replacerSet.add(String(value));
242
+ return value === void 0 ? true : value;
243
+ }
244
+ function getPositiveIntegerOption(options, key) {
245
+ let value;
246
+ if (hasOwnProperty.call(options, key)) {
247
+ value = options[key];
248
+ if (typeof value !== "number") {
249
+ throw new TypeError(`The "${key}" argument must be of type number`);
250
+ }
251
+ if (!Number.isInteger(value)) {
252
+ throw new TypeError(`The "${key}" argument must be an integer`);
253
+ }
254
+ if (value < 1) {
255
+ throw new RangeError(`The "${key}" argument must be >= 1`);
256
+ }
267
257
  }
258
+ return value === void 0 ? Infinity : value;
268
259
  }
269
- return replacerSet;
270
- }
271
- function getStrictOption(options) {
272
- if (hasOwnProperty.call(options, "strict")) {
273
- const value = options.strict;
274
- if (typeof value !== "boolean") {
275
- throw new TypeError('The "strict" argument must be of type boolean');
276
- }
277
- if (value) {
278
- return (value2) => {
279
- let message = `Object can not safely be stringified. Received type ${typeof value2}`;
280
- if (typeof value2 !== "function") message += ` (${value2.toString()})`;
281
- throw new Error(message);
282
- };
260
+ function getItemCount(number) {
261
+ if (number === 1) {
262
+ return "1 item";
283
263
  }
264
+ return `${number} items`;
284
265
  }
285
- }
286
- function configure(options) {
287
- options = { ...options };
288
- const fail = getStrictOption(options);
289
- if (fail) {
290
- if (options.bigint === void 0) {
291
- options.bigint = false;
266
+ function getUniqueReplacerSet(replacerArray) {
267
+ const replacerSet = /* @__PURE__ */ new Set();
268
+ for (const value of replacerArray) {
269
+ if (typeof value === "string" || typeof value === "number") {
270
+ replacerSet.add(String(value));
271
+ }
292
272
  }
293
- if (!("circularValue" in options)) {
294
- options.circularValue = Error;
273
+ return replacerSet;
274
+ }
275
+ function getStrictOption(options) {
276
+ if (hasOwnProperty.call(options, "strict")) {
277
+ const value = options.strict;
278
+ if (typeof value !== "boolean") {
279
+ throw new TypeError('The "strict" argument must be of type boolean');
280
+ }
281
+ if (value) {
282
+ return (value2) => {
283
+ let message = `Object can not safely be stringified. Received type ${typeof value2}`;
284
+ if (typeof value2 !== "function") message += ` (${value2.toString()})`;
285
+ throw new Error(message);
286
+ };
287
+ }
295
288
  }
296
289
  }
297
- const circularValue = getCircularValueOption(options);
298
- const bigint = getBooleanOption(options, "bigint");
299
- const deterministic = getDeterministicOption(options);
300
- const comparator = typeof deterministic === "function" ? deterministic : void 0;
301
- const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
302
- const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
303
- function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
304
- let value = parent[key];
305
- if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
306
- value = value.toJSON(key);
290
+ function configure(options) {
291
+ options = { ...options };
292
+ const fail = getStrictOption(options);
293
+ if (fail) {
294
+ if (options.bigint === void 0) {
295
+ options.bigint = false;
296
+ }
297
+ if (!("circularValue" in options)) {
298
+ options.circularValue = Error;
299
+ }
307
300
  }
308
- value = replacer.call(parent, key, value);
309
- switch (typeof value) {
310
- case "string":
311
- return strEscape(value);
312
- case "object": {
313
- if (value === null) {
314
- return "null";
315
- }
316
- if (stack.indexOf(value) !== -1) {
317
- return circularValue;
318
- }
319
- let res = "";
320
- let join = ",";
321
- const originalIndentation = indentation;
322
- if (Array.isArray(value)) {
323
- if (value.length === 0) {
324
- return "[]";
301
+ const circularValue = getCircularValueOption(options);
302
+ const bigint = getBooleanOption(options, "bigint");
303
+ const deterministic = getDeterministicOption(options);
304
+ const comparator = typeof deterministic === "function" ? deterministic : void 0;
305
+ const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
306
+ const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
307
+ function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
308
+ let value = parent[key];
309
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
310
+ value = value.toJSON(key);
311
+ }
312
+ value = replacer.call(parent, key, value);
313
+ switch (typeof value) {
314
+ case "string":
315
+ return strEscape(value);
316
+ case "object": {
317
+ if (value === null) {
318
+ return "null";
319
+ }
320
+ if (stack.indexOf(value) !== -1) {
321
+ return circularValue;
322
+ }
323
+ let res = "";
324
+ let join = ",";
325
+ const originalIndentation = indentation;
326
+ if (Array.isArray(value)) {
327
+ if (value.length === 0) {
328
+ return "[]";
329
+ }
330
+ if (maximumDepth < stack.length + 1) {
331
+ return '"[Array]"';
332
+ }
333
+ stack.push(value);
334
+ if (spacer !== "") {
335
+ indentation += spacer;
336
+ res += `
337
+ ${indentation}`;
338
+ join = `,
339
+ ${indentation}`;
340
+ }
341
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
342
+ let i = 0;
343
+ for (; i < maximumValuesToStringify - 1; i++) {
344
+ const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
345
+ res += tmp2 !== void 0 ? tmp2 : "null";
346
+ res += join;
347
+ }
348
+ const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
349
+ res += tmp !== void 0 ? tmp : "null";
350
+ if (value.length - 1 > maximumBreadth) {
351
+ const removedKeys = value.length - maximumBreadth - 1;
352
+ res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
353
+ }
354
+ if (spacer !== "") {
355
+ res += `
356
+ ${originalIndentation}`;
357
+ }
358
+ stack.pop();
359
+ return `[${res}]`;
360
+ }
361
+ let keys = Object.keys(value);
362
+ const keyLength = keys.length;
363
+ if (keyLength === 0) {
364
+ return "{}";
325
365
  }
326
366
  if (maximumDepth < stack.length + 1) {
327
- return '"[Array]"';
367
+ return '"[Object]"';
328
368
  }
329
- stack.push(value);
369
+ let whitespace = "";
370
+ let separator = "";
330
371
  if (spacer !== "") {
331
372
  indentation += spacer;
332
- res += `
333
- ${indentation}`;
334
373
  join = `,
335
374
  ${indentation}`;
375
+ whitespace = " ";
336
376
  }
337
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
338
- let i = 0;
339
- for (; i < maximumValuesToStringify - 1; i++) {
340
- const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
341
- res += tmp2 !== void 0 ? tmp2 : "null";
342
- res += join;
377
+ const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
378
+ if (deterministic && !isTypedArrayWithEntries(value)) {
379
+ keys = sort(keys, comparator);
343
380
  }
344
- const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
345
- res += tmp !== void 0 ? tmp : "null";
346
- if (value.length - 1 > maximumBreadth) {
347
- const removedKeys = value.length - maximumBreadth - 1;
348
- res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
349
- }
350
- if (spacer !== "") {
351
- res += `
352
- ${originalIndentation}`;
381
+ stack.push(value);
382
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
383
+ const key2 = keys[i];
384
+ const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
385
+ if (tmp !== void 0) {
386
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
387
+ separator = join;
388
+ }
353
389
  }
354
- stack.pop();
355
- return `[${res}]`;
356
- }
357
- let keys = Object.keys(value);
358
- const keyLength = keys.length;
359
- if (keyLength === 0) {
360
- return "{}";
361
- }
362
- if (maximumDepth < stack.length + 1) {
363
- return '"[Object]"';
364
- }
365
- let whitespace = "";
366
- let separator = "";
367
- if (spacer !== "") {
368
- indentation += spacer;
369
- join = `,
370
- ${indentation}`;
371
- whitespace = " ";
372
- }
373
- const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
374
- if (deterministic && !isTypedArrayWithEntries(value)) {
375
- keys = sort(keys, comparator);
376
- }
377
- stack.push(value);
378
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
379
- const key2 = keys[i];
380
- const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
381
- if (tmp !== void 0) {
382
- res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
390
+ if (keyLength > maximumBreadth) {
391
+ const removedKeys = keyLength - maximumBreadth;
392
+ res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
383
393
  separator = join;
384
394
  }
385
- }
386
- if (keyLength > maximumBreadth) {
387
- const removedKeys = keyLength - maximumBreadth;
388
- res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
389
- separator = join;
390
- }
391
- if (spacer !== "" && separator.length > 1) {
392
- res = `
395
+ if (spacer !== "" && separator.length > 1) {
396
+ res = `
393
397
  ${indentation}${res}
394
398
  ${originalIndentation}`;
399
+ }
400
+ stack.pop();
401
+ return `{${res}}`;
395
402
  }
396
- stack.pop();
397
- return `{${res}}`;
403
+ case "number":
404
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
405
+ case "boolean":
406
+ return value === true ? "true" : "false";
407
+ case "undefined":
408
+ return void 0;
409
+ case "bigint":
410
+ if (bigint) {
411
+ return String(value);
412
+ }
413
+ // fallthrough
414
+ default:
415
+ return fail ? fail(value) : void 0;
398
416
  }
399
- case "number":
400
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
401
- case "boolean":
402
- return value === true ? "true" : "false";
403
- case "undefined":
404
- return void 0;
405
- case "bigint":
406
- if (bigint) {
407
- return String(value);
408
- }
409
- default:
410
- return fail ? fail(value) : void 0;
411
417
  }
412
- }
413
- function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
414
- if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
415
- value = value.toJSON(key);
416
- }
417
- switch (typeof value) {
418
- case "string":
419
- return strEscape(value);
420
- case "object": {
421
- if (value === null) {
422
- return "null";
423
- }
424
- if (stack.indexOf(value) !== -1) {
425
- return circularValue;
426
- }
427
- const originalIndentation = indentation;
428
- let res = "";
429
- let join = ",";
430
- if (Array.isArray(value)) {
431
- if (value.length === 0) {
432
- return "[]";
418
+ function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
419
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
420
+ value = value.toJSON(key);
421
+ }
422
+ switch (typeof value) {
423
+ case "string":
424
+ return strEscape(value);
425
+ case "object": {
426
+ if (value === null) {
427
+ return "null";
433
428
  }
434
- if (maximumDepth < stack.length + 1) {
435
- return '"[Array]"';
429
+ if (stack.indexOf(value) !== -1) {
430
+ return circularValue;
431
+ }
432
+ const originalIndentation = indentation;
433
+ let res = "";
434
+ let join = ",";
435
+ if (Array.isArray(value)) {
436
+ if (value.length === 0) {
437
+ return "[]";
438
+ }
439
+ if (maximumDepth < stack.length + 1) {
440
+ return '"[Array]"';
441
+ }
442
+ stack.push(value);
443
+ if (spacer !== "") {
444
+ indentation += spacer;
445
+ res += `
446
+ ${indentation}`;
447
+ join = `,
448
+ ${indentation}`;
449
+ }
450
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
451
+ let i = 0;
452
+ for (; i < maximumValuesToStringify - 1; i++) {
453
+ const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
454
+ res += tmp2 !== void 0 ? tmp2 : "null";
455
+ res += join;
456
+ }
457
+ const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
458
+ res += tmp !== void 0 ? tmp : "null";
459
+ if (value.length - 1 > maximumBreadth) {
460
+ const removedKeys = value.length - maximumBreadth - 1;
461
+ res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
462
+ }
463
+ if (spacer !== "") {
464
+ res += `
465
+ ${originalIndentation}`;
466
+ }
467
+ stack.pop();
468
+ return `[${res}]`;
436
469
  }
437
470
  stack.push(value);
471
+ let whitespace = "";
438
472
  if (spacer !== "") {
439
473
  indentation += spacer;
440
- res += `
441
- ${indentation}`;
442
474
  join = `,
443
475
  ${indentation}`;
476
+ whitespace = " ";
444
477
  }
445
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
446
- let i = 0;
447
- for (; i < maximumValuesToStringify - 1; i++) {
448
- const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
449
- res += tmp2 !== void 0 ? tmp2 : "null";
450
- res += join;
451
- }
452
- const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
453
- res += tmp !== void 0 ? tmp : "null";
454
- if (value.length - 1 > maximumBreadth) {
455
- const removedKeys = value.length - maximumBreadth - 1;
456
- res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
478
+ let separator = "";
479
+ for (const key2 of replacer) {
480
+ const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
481
+ if (tmp !== void 0) {
482
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
483
+ separator = join;
484
+ }
457
485
  }
458
- if (spacer !== "") {
459
- res += `
486
+ if (spacer !== "" && separator.length > 1) {
487
+ res = `
488
+ ${indentation}${res}
460
489
  ${originalIndentation}`;
461
490
  }
462
491
  stack.pop();
463
- return `[${res}]`;
464
- }
465
- stack.push(value);
466
- let whitespace = "";
467
- if (spacer !== "") {
468
- indentation += spacer;
469
- join = `,
470
- ${indentation}`;
471
- whitespace = " ";
492
+ return `{${res}}`;
472
493
  }
473
- let separator = "";
474
- for (const key2 of replacer) {
475
- const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
476
- if (tmp !== void 0) {
477
- res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
478
- separator = join;
494
+ case "number":
495
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
496
+ case "boolean":
497
+ return value === true ? "true" : "false";
498
+ case "undefined":
499
+ return void 0;
500
+ case "bigint":
501
+ if (bigint) {
502
+ return String(value);
479
503
  }
480
- }
481
- if (spacer !== "" && separator.length > 1) {
482
- res = `
483
- ${indentation}${res}
484
- ${originalIndentation}`;
485
- }
486
- stack.pop();
487
- return `{${res}}`;
504
+ // fallthrough
505
+ default:
506
+ return fail ? fail(value) : void 0;
488
507
  }
489
- case "number":
490
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
491
- case "boolean":
492
- return value === true ? "true" : "false";
493
- case "undefined":
494
- return void 0;
495
- case "bigint":
496
- if (bigint) {
497
- return String(value);
498
- }
499
- default:
500
- return fail ? fail(value) : void 0;
501
508
  }
502
- }
503
- function stringifyIndent(key, value, stack, spacer, indentation) {
504
- switch (typeof value) {
505
- case "string":
506
- return strEscape(value);
507
- case "object": {
508
- if (value === null) {
509
- return "null";
510
- }
511
- if (typeof value.toJSON === "function") {
512
- value = value.toJSON(key);
513
- if (typeof value !== "object") {
514
- return stringifyIndent(key, value, stack, spacer, indentation);
515
- }
509
+ function stringifyIndent(key, value, stack, spacer, indentation) {
510
+ switch (typeof value) {
511
+ case "string":
512
+ return strEscape(value);
513
+ case "object": {
516
514
  if (value === null) {
517
515
  return "null";
518
516
  }
519
- }
520
- if (stack.indexOf(value) !== -1) {
521
- return circularValue;
522
- }
523
- const originalIndentation = indentation;
524
- if (Array.isArray(value)) {
525
- if (value.length === 0) {
526
- return "[]";
517
+ if (typeof value.toJSON === "function") {
518
+ value = value.toJSON(key);
519
+ if (typeof value !== "object") {
520
+ return stringifyIndent(key, value, stack, spacer, indentation);
521
+ }
522
+ if (value === null) {
523
+ return "null";
524
+ }
527
525
  }
528
- if (maximumDepth < stack.length + 1) {
529
- return '"[Array]"';
526
+ if (stack.indexOf(value) !== -1) {
527
+ return circularValue;
530
528
  }
531
- stack.push(value);
532
- indentation += spacer;
533
- let res2 = `
529
+ const originalIndentation = indentation;
530
+ if (Array.isArray(value)) {
531
+ if (value.length === 0) {
532
+ return "[]";
533
+ }
534
+ if (maximumDepth < stack.length + 1) {
535
+ return '"[Array]"';
536
+ }
537
+ stack.push(value);
538
+ indentation += spacer;
539
+ let res2 = `
534
540
  ${indentation}`;
535
- const join2 = `,
541
+ const join2 = `,
536
542
  ${indentation}`;
537
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
538
- let i = 0;
539
- for (; i < maximumValuesToStringify - 1; i++) {
540
- const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
541
- res2 += tmp2 !== void 0 ? tmp2 : "null";
542
- res2 += join2;
543
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
544
+ let i = 0;
545
+ for (; i < maximumValuesToStringify - 1; i++) {
546
+ const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
547
+ res2 += tmp2 !== void 0 ? tmp2 : "null";
548
+ res2 += join2;
549
+ }
550
+ const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
551
+ res2 += tmp !== void 0 ? tmp : "null";
552
+ if (value.length - 1 > maximumBreadth) {
553
+ const removedKeys = value.length - maximumBreadth - 1;
554
+ res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
555
+ }
556
+ res2 += `
557
+ ${originalIndentation}`;
558
+ stack.pop();
559
+ return `[${res2}]`;
543
560
  }
544
- const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
545
- res2 += tmp !== void 0 ? tmp : "null";
546
- if (value.length - 1 > maximumBreadth) {
547
- const removedKeys = value.length - maximumBreadth - 1;
548
- res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
561
+ let keys = Object.keys(value);
562
+ const keyLength = keys.length;
563
+ if (keyLength === 0) {
564
+ return "{}";
549
565
  }
550
- res2 += `
551
- ${originalIndentation}`;
552
- stack.pop();
553
- return `[${res2}]`;
554
- }
555
- let keys = Object.keys(value);
556
- const keyLength = keys.length;
557
- if (keyLength === 0) {
558
- return "{}";
559
- }
560
- if (maximumDepth < stack.length + 1) {
561
- return '"[Object]"';
562
- }
563
- indentation += spacer;
564
- const join = `,
566
+ if (maximumDepth < stack.length + 1) {
567
+ return '"[Object]"';
568
+ }
569
+ indentation += spacer;
570
+ const join = `,
565
571
  ${indentation}`;
566
- let res = "";
567
- let separator = "";
568
- let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
569
- if (isTypedArrayWithEntries(value)) {
570
- res += stringifyTypedArray(value, join, maximumBreadth);
571
- keys = keys.slice(value.length);
572
- maximumPropertiesToStringify -= value.length;
573
- separator = join;
574
- }
575
- if (deterministic) {
576
- keys = sort(keys, comparator);
577
- }
578
- stack.push(value);
579
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
580
- const key2 = keys[i];
581
- const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
582
- if (tmp !== void 0) {
583
- res += `${separator}${strEscape(key2)}: ${tmp}`;
572
+ let res = "";
573
+ let separator = "";
574
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
575
+ if (isTypedArrayWithEntries(value)) {
576
+ res += stringifyTypedArray(value, join, maximumBreadth);
577
+ keys = keys.slice(value.length);
578
+ maximumPropertiesToStringify -= value.length;
584
579
  separator = join;
585
580
  }
586
- }
587
- if (keyLength > maximumBreadth) {
588
- const removedKeys = keyLength - maximumBreadth;
589
- res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
590
- separator = join;
591
- }
592
- if (separator !== "") {
593
- res = `
581
+ if (deterministic) {
582
+ keys = sort(keys, comparator);
583
+ }
584
+ stack.push(value);
585
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
586
+ const key2 = keys[i];
587
+ const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
588
+ if (tmp !== void 0) {
589
+ res += `${separator}${strEscape(key2)}: ${tmp}`;
590
+ separator = join;
591
+ }
592
+ }
593
+ if (keyLength > maximumBreadth) {
594
+ const removedKeys = keyLength - maximumBreadth;
595
+ res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
596
+ separator = join;
597
+ }
598
+ if (separator !== "") {
599
+ res = `
594
600
  ${indentation}${res}
595
601
  ${originalIndentation}`;
602
+ }
603
+ stack.pop();
604
+ return `{${res}}`;
596
605
  }
597
- stack.pop();
598
- return `{${res}}`;
606
+ case "number":
607
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
608
+ case "boolean":
609
+ return value === true ? "true" : "false";
610
+ case "undefined":
611
+ return void 0;
612
+ case "bigint":
613
+ if (bigint) {
614
+ return String(value);
615
+ }
616
+ // fallthrough
617
+ default:
618
+ return fail ? fail(value) : void 0;
599
619
  }
600
- case "number":
601
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
602
- case "boolean":
603
- return value === true ? "true" : "false";
604
- case "undefined":
605
- return void 0;
606
- case "bigint":
607
- if (bigint) {
608
- return String(value);
609
- }
610
- default:
611
- return fail ? fail(value) : void 0;
612
620
  }
613
- }
614
- function stringifySimple(key, value, stack) {
615
- switch (typeof value) {
616
- case "string":
617
- return strEscape(value);
618
- case "object": {
619
- if (value === null) {
620
- return "null";
621
- }
622
- if (typeof value.toJSON === "function") {
623
- value = value.toJSON(key);
624
- if (typeof value !== "object") {
625
- return stringifySimple(key, value, stack);
626
- }
621
+ function stringifySimple(key, value, stack) {
622
+ switch (typeof value) {
623
+ case "string":
624
+ return strEscape(value);
625
+ case "object": {
627
626
  if (value === null) {
628
627
  return "null";
629
628
  }
630
- }
631
- if (stack.indexOf(value) !== -1) {
632
- return circularValue;
633
- }
634
- let res = "";
635
- const hasLength = value.length !== void 0;
636
- if (hasLength && Array.isArray(value)) {
637
- if (value.length === 0) {
638
- return "[]";
629
+ if (typeof value.toJSON === "function") {
630
+ value = value.toJSON(key);
631
+ if (typeof value !== "object") {
632
+ return stringifySimple(key, value, stack);
633
+ }
634
+ if (value === null) {
635
+ return "null";
636
+ }
637
+ }
638
+ if (stack.indexOf(value) !== -1) {
639
+ return circularValue;
640
+ }
641
+ let res = "";
642
+ const hasLength = value.length !== void 0;
643
+ if (hasLength && Array.isArray(value)) {
644
+ if (value.length === 0) {
645
+ return "[]";
646
+ }
647
+ if (maximumDepth < stack.length + 1) {
648
+ return '"[Array]"';
649
+ }
650
+ stack.push(value);
651
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
652
+ let i = 0;
653
+ for (; i < maximumValuesToStringify - 1; i++) {
654
+ const tmp2 = stringifySimple(String(i), value[i], stack);
655
+ res += tmp2 !== void 0 ? tmp2 : "null";
656
+ res += ",";
657
+ }
658
+ const tmp = stringifySimple(String(i), value[i], stack);
659
+ res += tmp !== void 0 ? tmp : "null";
660
+ if (value.length - 1 > maximumBreadth) {
661
+ const removedKeys = value.length - maximumBreadth - 1;
662
+ res += `,"... ${getItemCount(removedKeys)} not stringified"`;
663
+ }
664
+ stack.pop();
665
+ return `[${res}]`;
666
+ }
667
+ let keys = Object.keys(value);
668
+ const keyLength = keys.length;
669
+ if (keyLength === 0) {
670
+ return "{}";
639
671
  }
640
672
  if (maximumDepth < stack.length + 1) {
641
- return '"[Array]"';
673
+ return '"[Object]"';
674
+ }
675
+ let separator = "";
676
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
677
+ if (hasLength && isTypedArrayWithEntries(value)) {
678
+ res += stringifyTypedArray(value, ",", maximumBreadth);
679
+ keys = keys.slice(value.length);
680
+ maximumPropertiesToStringify -= value.length;
681
+ separator = ",";
682
+ }
683
+ if (deterministic) {
684
+ keys = sort(keys, comparator);
642
685
  }
643
686
  stack.push(value);
644
- const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
645
- let i = 0;
646
- for (; i < maximumValuesToStringify - 1; i++) {
647
- const tmp2 = stringifySimple(String(i), value[i], stack);
648
- res += tmp2 !== void 0 ? tmp2 : "null";
649
- res += ",";
687
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
688
+ const key2 = keys[i];
689
+ const tmp = stringifySimple(key2, value[key2], stack);
690
+ if (tmp !== void 0) {
691
+ res += `${separator}${strEscape(key2)}:${tmp}`;
692
+ separator = ",";
693
+ }
650
694
  }
651
- const tmp = stringifySimple(String(i), value[i], stack);
652
- res += tmp !== void 0 ? tmp : "null";
653
- if (value.length - 1 > maximumBreadth) {
654
- const removedKeys = value.length - maximumBreadth - 1;
655
- res += `,"... ${getItemCount(removedKeys)} not stringified"`;
695
+ if (keyLength > maximumBreadth) {
696
+ const removedKeys = keyLength - maximumBreadth;
697
+ res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
656
698
  }
657
699
  stack.pop();
658
- return `[${res}]`;
659
- }
660
- let keys = Object.keys(value);
661
- const keyLength = keys.length;
662
- if (keyLength === 0) {
663
- return "{}";
664
- }
665
- if (maximumDepth < stack.length + 1) {
666
- return '"[Object]"';
667
- }
668
- let separator = "";
669
- let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
670
- if (hasLength && isTypedArrayWithEntries(value)) {
671
- res += stringifyTypedArray(value, ",", maximumBreadth);
672
- keys = keys.slice(value.length);
673
- maximumPropertiesToStringify -= value.length;
674
- separator = ",";
700
+ return `{${res}}`;
675
701
  }
676
- if (deterministic) {
677
- keys = sort(keys, comparator);
678
- }
679
- stack.push(value);
680
- for (let i = 0; i < maximumPropertiesToStringify; i++) {
681
- const key2 = keys[i];
682
- const tmp = stringifySimple(key2, value[key2], stack);
683
- if (tmp !== void 0) {
684
- res += `${separator}${strEscape(key2)}:${tmp}`;
685
- separator = ",";
702
+ case "number":
703
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
704
+ case "boolean":
705
+ return value === true ? "true" : "false";
706
+ case "undefined":
707
+ return void 0;
708
+ case "bigint":
709
+ if (bigint) {
710
+ return String(value);
686
711
  }
687
- }
688
- if (keyLength > maximumBreadth) {
689
- const removedKeys = keyLength - maximumBreadth;
690
- res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
691
- }
692
- stack.pop();
693
- return `{${res}}`;
712
+ // fallthrough
713
+ default:
714
+ return fail ? fail(value) : void 0;
694
715
  }
695
- case "number":
696
- return isFinite(value) ? String(value) : fail ? fail(value) : "null";
697
- case "boolean":
698
- return value === true ? "true" : "false";
699
- case "undefined":
700
- return void 0;
701
- case "bigint":
702
- if (bigint) {
703
- return String(value);
704
- }
705
- default:
706
- return fail ? fail(value) : void 0;
707
716
  }
708
- }
709
- function stringify2(value, replacer, space) {
710
- if (arguments.length > 1) {
711
- let spacer = "";
712
- if (typeof space === "number") {
713
- spacer = " ".repeat(Math.min(space, 10));
714
- } else if (typeof space === "string") {
715
- spacer = space.slice(0, 10);
716
- }
717
- if (replacer != null) {
718
- if (typeof replacer === "function") {
719
- return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
717
+ function stringify2(value, replacer, space) {
718
+ if (arguments.length > 1) {
719
+ let spacer = "";
720
+ if (typeof space === "number") {
721
+ spacer = " ".repeat(Math.min(space, 10));
722
+ } else if (typeof space === "string") {
723
+ spacer = space.slice(0, 10);
720
724
  }
721
- if (Array.isArray(replacer)) {
722
- return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
725
+ if (replacer != null) {
726
+ if (typeof replacer === "function") {
727
+ return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
728
+ }
729
+ if (Array.isArray(replacer)) {
730
+ return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
731
+ }
732
+ }
733
+ if (spacer.length !== 0) {
734
+ return stringifyIndent("", value, [], spacer, "");
723
735
  }
724
736
  }
725
- if (spacer.length !== 0) {
726
- return stringifyIndent("", value, [], spacer, "");
727
- }
737
+ return stringifySimple("", value, []);
728
738
  }
729
- return stringifySimple("", value, []);
739
+ return stringify2;
730
740
  }
731
- return stringify2;
732
- }
733
- })(safeStableStringify, safeStableStringify.exports);
734
- var safeStableStringifyExports = safeStableStringify.exports;
741
+ })(safeStableStringify, safeStableStringify.exports);
742
+ return safeStableStringify.exports;
743
+ }
744
+ var safeStableStringifyExports = requireSafeStableStringify();
735
745
  const cjsModule = /* @__PURE__ */ getDefaultExportFromCjs(safeStableStringifyExports);
736
746
  cjsModule.configure;
737
747
  let getRandomValues;
@@ -1866,6 +1876,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
1866
1876
  const latestOperation = operations.at(-1);
1867
1877
  const lastOperationIndex = (latestOperation == null ? void 0 : latestOperation.index) ?? -1;
1868
1878
  let nextIndex = reuseLastOperationIndex ? lastOperationIndex : lastOperationIndex + 1;
1879
+ let timestamp = (/* @__PURE__ */ new Date()).toISOString();
1869
1880
  if ("index" in action) {
1870
1881
  if (action.index - skip > nextIndex) {
1871
1882
  throw new Error(
@@ -1874,6 +1885,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
1874
1885
  }
1875
1886
  nextIndex = action.index;
1876
1887
  operationId = action.id;
1888
+ timestamp = action.timestamp;
1877
1889
  } else {
1878
1890
  operationId = "id" in action ? action.id : v4();
1879
1891
  }
@@ -1881,7 +1893,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
1881
1893
  ...action,
1882
1894
  id: operationId,
1883
1895
  index: nextIndex,
1884
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1896
+ timestamp,
1885
1897
  hash: "",
1886
1898
  scope,
1887
1899
  skip,
@@ -2693,4 +2705,4 @@ export {
2693
2705
  hex2ab as y,
2694
2706
  isNoopOperation as z
2695
2707
  };
2696
- //# sourceMappingURL=object-Ce5PU4Jl.js.map
2708
+ //# sourceMappingURL=object-ivG479sP.js.map