@ai-react-markdown/engine 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2876,8 +2876,8 @@ function initCloneArray(array) {
2876
2876
  var initCloneArray_default = initCloneArray;
2877
2877
 
2878
2878
  // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js
2879
- var Uint8Array = root_default.Uint8Array;
2880
- var Uint8Array_default = Uint8Array;
2879
+ var Uint8Array2 = root_default.Uint8Array;
2880
+ var Uint8Array_default = Uint8Array2;
2881
2881
 
2882
2882
  // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js
2883
2883
  function cloneArrayBuffer(arrayBuffer) {
@@ -3229,7 +3229,9 @@ var C1 = 3432918353;
3229
3229
  var C2 = 461845907;
3230
3230
  var UTF8_ENCODER = /* @__PURE__ */ new TextEncoder();
3231
3231
  function murmur3_32(s, seed = 0) {
3232
- const bytes = UTF8_ENCODER.encode(s);
3232
+ return murmur3_32_bytes(UTF8_ENCODER.encode(s), seed);
3233
+ }
3234
+ function murmur3_32_bytes(bytes, seed = 0) {
3233
3235
  const len = bytes.length;
3234
3236
  let h1 = seed >>> 0;
3235
3237
  const nblocks = len >>> 2;
@@ -3263,7 +3265,22 @@ function murmur3_32(s, seed = 0) {
3263
3265
  h1 ^= h1 >>> 16;
3264
3266
  return h1 >>> 0;
3265
3267
  }
3268
+ var LONE_SURROGATE_RE = /[\uD800-\uDFFF]/u;
3269
+ function hasLoneSurrogate(id) {
3270
+ return LONE_SURROGATE_RE.test(id);
3271
+ }
3272
+ var ILL_FORMED_SEED = 1;
3273
+ function utf16leBytes(s) {
3274
+ const bytes = new Uint8Array(s.length * 2);
3275
+ for (let i = 0; i < s.length; i++) {
3276
+ const c = s.charCodeAt(i);
3277
+ bytes[i * 2] = c & 255;
3278
+ bytes[i * 2 + 1] = c >>> 8;
3279
+ }
3280
+ return bytes;
3281
+ }
3266
3282
  function shortenDocumentId(id, threshold = 16) {
3283
+ if (hasLoneSurrogate(id)) return toBase62(murmur3_32_bytes(utf16leBytes(id), ILL_FORMED_SEED));
3267
3284
  if (id.length <= threshold) return id;
3268
3285
  return toBase62(murmur3_32(id));
3269
3286
  }
@@ -4020,6 +4037,7 @@ export {
4020
4037
  extractContributions,
4021
4038
  extractDefBodiesFromHast,
4022
4039
  getEnginePluginInternals,
4040
+ hasLoneSurrogate,
4023
4041
  highlight,
4024
4042
  isFootnoteSection,
4025
4043
  lastRegionStart,