@ai-react-markdown/core 1.4.2 → 1.4.3

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
@@ -2858,8 +2858,7 @@ var ExtraSyntaxRemarkPluginMap = {
2858
2858
  };
2859
2859
  var DefaultCustomComponents = {};
2860
2860
  var BlockMemoizedRenderer = memo2(
2861
- ({ content, usedComponents, remarkPlugins, rehypePlugins, remarkRehypeOptions }) => {
2862
- const urlTransform = void 0;
2861
+ ({ content, usedComponents, remarkPlugins, rehypePlugins, remarkRehypeOptions, urlTransform }) => {
2863
2862
  const allowedElements = void 0;
2864
2863
  const disallowedElements = void 0;
2865
2864
  const allowElement = void 0;
@@ -3108,108 +3107,116 @@ var BlockMemoizedRenderer = memo2(
3108
3107
  );
3109
3108
  BlockMemoizedRenderer.displayName = "BlockMemoizedRenderer";
3110
3109
  var LegacyRenderer = memo2(
3111
- ({ content, usedComponents, remarkPlugins, rehypePlugins, remarkRehypeOptions }) => /* @__PURE__ */ jsx6(
3110
+ ({ content, usedComponents, remarkPlugins, rehypePlugins, remarkRehypeOptions, urlTransform }) => /* @__PURE__ */ jsx6(
3112
3111
  Markdown_default,
3113
3112
  {
3114
3113
  remarkPlugins,
3115
3114
  rehypePlugins,
3116
3115
  remarkRehypeOptions,
3117
3116
  components: usedComponents,
3117
+ urlTransform,
3118
3118
  children: content
3119
3119
  }
3120
3120
  )
3121
3121
  );
3122
3122
  LegacyRenderer.displayName = "LegacyRenderer";
3123
- var AIMarkdownContent = memo2(({ content, customComponents }) => {
3124
- const { config, clobberPrefix } = useAIMarkdownRenderState();
3125
- const { extraSyntaxRemarkPlugins, enableDefinitionList } = useMemo4(
3126
- () => ({
3127
- extraSyntaxRemarkPlugins: config.extraSyntaxSupported.map((syntax) => ExtraSyntaxRemarkPluginMap[syntax]),
3128
- enableDefinitionList: config.extraSyntaxSupported.includes("DEFINITION_LIST" /* DEFINITION_LIST */)
3129
- }),
3130
- [config.extraSyntaxSupported]
3131
- );
3132
- const displayOptimizeRemarkPlugins = useMemo4(() => {
3133
- return config.displayOptimizeAbilities.map((ability) => DisplayOptimizeRemarkPluginMap[ability]);
3134
- }, [config.displayOptimizeAbilities]);
3135
- const usedComponents = useMemo4(() => {
3136
- return customComponents ? { ...DefaultCustomComponents, ...customComponents } : DefaultCustomComponents;
3137
- }, [customComponents]);
3138
- const remarkPlugins = useMemo4(
3139
- () => [
3140
- // --- Core plugins (always active) ---
3141
- remarkGfm2,
3142
- [
3143
- remarkMath,
3144
- {
3145
- // Disable single-dollar inline math to avoid conflicts with currency
3146
- // signs and other dollar usages; the preprocessor converts $...$ to $$...$$.
3147
- singleDollarTextMath: false
3148
- }
3123
+ var AIMarkdownContent = memo2(
3124
+ ({ content, customComponents, urlTransform, sanitizeSchema: customSanitizeSchema }) => {
3125
+ const { config, clobberPrefix } = useAIMarkdownRenderState();
3126
+ const usedSanitizeSchema = customSanitizeSchema ?? sanitizeSchema;
3127
+ const { extraSyntaxRemarkPlugins, enableDefinitionList } = useMemo4(
3128
+ () => ({
3129
+ extraSyntaxRemarkPlugins: config.extraSyntaxSupported.map((syntax) => ExtraSyntaxRemarkPluginMap[syntax]),
3130
+ enableDefinitionList: config.extraSyntaxSupported.includes("DEFINITION_LIST" /* DEFINITION_LIST */)
3131
+ }),
3132
+ [config.extraSyntaxSupported]
3133
+ );
3134
+ const displayOptimizeRemarkPlugins = useMemo4(() => {
3135
+ return config.displayOptimizeAbilities.map((ability) => DisplayOptimizeRemarkPluginMap[ability]);
3136
+ }, [config.displayOptimizeAbilities]);
3137
+ const usedComponents = useMemo4(() => {
3138
+ return customComponents ? { ...DefaultCustomComponents, ...customComponents } : DefaultCustomComponents;
3139
+ }, [customComponents]);
3140
+ const remarkPlugins = useMemo4(
3141
+ () => [
3142
+ // --- Core plugins (always active) ---
3143
+ remarkGfm2,
3144
+ [
3145
+ remarkMath,
3146
+ {
3147
+ // Disable single-dollar inline math to avoid conflicts with currency
3148
+ // signs and other dollar usages; the preprocessor converts $...$ to $$...$$.
3149
+ singleDollarTextMath: false
3150
+ }
3151
+ ],
3152
+ // --- Configurable extra syntax plugins ---
3153
+ ...extraSyntaxRemarkPlugins,
3154
+ // --- Formatting & normalization ---
3155
+ remarkBreaks,
3156
+ remarkEmoji,
3157
+ remarkSqueezeParagraphs,
3158
+ remarkCjkFriendly,
3159
+ remarkCjkFriendlyGfmStrikethrough,
3160
+ // --- Configurable display optimizations ---
3161
+ ...displayOptimizeRemarkPlugins
3149
3162
  ],
3150
- // --- Configurable extra syntax plugins ---
3151
- ...extraSyntaxRemarkPlugins,
3152
- // --- Formatting & normalization ---
3153
- remarkBreaks,
3154
- remarkEmoji,
3155
- remarkSqueezeParagraphs,
3156
- remarkCjkFriendly,
3157
- remarkCjkFriendlyGfmStrikethrough,
3158
- // --- Configurable display optimizations ---
3159
- ...displayOptimizeRemarkPlugins
3160
- ],
3161
- [extraSyntaxRemarkPlugins, displayOptimizeRemarkPlugins]
3162
- );
3163
- const rehypePlugins = useMemo4(
3164
- () => [
3165
- // Allow raw HTML through so rehype-sanitize can handle it.
3166
- [rehypeRaw, { passThrough: [] }],
3167
- // Sanitize HTML while allowing <mark> (highlight) and KaTeX class names.
3168
- // Override `clobberPrefix` with the instance-scoped value so every id
3169
- // and clobberable attribute is namespaced to this `<AIMarkdown>` instance.
3170
- [rehypeSanitize, { ...sanitizeSchema, clobberPrefix }],
3171
- // Normalize the auto-generated `<section data-footnotes>`: strip the
3172
- // sr-only `<h2>Footnotes</h2>` label and prepend `<hr>`. Keeps standalone
3173
- // single-doc rendering visually consistent with the cross-chunk aggregate
3174
- // footer (which builds the same shape from scratch).
3175
- rehypeFooterAdorn,
3176
- // Re-prefix intra-document hash hrefs so they match the ids that
3177
- // rehype-sanitize just clobbered. Must use the SAME prefix as the schema
3178
- // above — that's why both read from `clobberPrefix`.
3179
- [rehypeRebaseHashLinks_default, { prefix: clobberPrefix }],
3180
- rehypeKatex,
3181
- rehypeUnwrapImages
3182
- ],
3183
- [clobberPrefix]
3184
- );
3185
- const remarkRehypeOptions = useMemo4(
3186
- () => ({
3187
- allowDangerousHtml: true,
3188
- // Suppress mdast-util-to-hast's `user-content-` prefix on footnote
3189
- // ids/hrefs; rehype-sanitize will apply the same prefix downstream
3190
- // and `rehypeRebaseHashLinks` mirrors it onto matching hash hrefs.
3191
- // Without this, ids would end up double-prefixed
3192
- // (`user-content-user-content-fn-x`).
3193
- clobberPrefix: "",
3194
- handlers: {
3195
- // Inject definition-list HAST handlers when the extension is active.
3196
- ...enableDefinitionList ? defListHastHandlers : {}
3163
+ [extraSyntaxRemarkPlugins, displayOptimizeRemarkPlugins]
3164
+ );
3165
+ const rehypePlugins = useMemo4(
3166
+ () => [
3167
+ // Allow raw HTML through so rehype-sanitize can handle it.
3168
+ [rehypeRaw, { passThrough: [] }],
3169
+ // Sanitize HTML while allowing <mark> (highlight), KaTeX class names,
3170
+ // and any extra protocols the caller permitted via the `sanitizeSchema`
3171
+ // prop. Override `clobberPrefix` with the instance-scoped value so every
3172
+ // id and clobberable attribute is namespaced to this `<AIMarkdown>`
3173
+ // instance — the spread order is intentional: our prefix wins over any
3174
+ // caller-supplied prefix on the schema.
3175
+ [rehypeSanitize, { ...usedSanitizeSchema, clobberPrefix }],
3176
+ // Normalize the auto-generated `<section data-footnotes>`: strip the
3177
+ // sr-only `<h2>Footnotes</h2>` label and prepend `<hr>`. Keeps standalone
3178
+ // single-doc rendering visually consistent with the cross-chunk aggregate
3179
+ // footer (which builds the same shape from scratch).
3180
+ rehypeFooterAdorn,
3181
+ // Re-prefix intra-document hash hrefs so they match the ids that
3182
+ // rehype-sanitize just clobbered. Must use the SAME prefix as the schema
3183
+ // above that's why both read from `clobberPrefix`.
3184
+ [rehypeRebaseHashLinks_default, { prefix: clobberPrefix }],
3185
+ rehypeKatex,
3186
+ rehypeUnwrapImages
3187
+ ],
3188
+ [clobberPrefix, usedSanitizeSchema]
3189
+ );
3190
+ const remarkRehypeOptions = useMemo4(
3191
+ () => ({
3192
+ allowDangerousHtml: true,
3193
+ // Suppress mdast-util-to-hast's `user-content-` prefix on footnote
3194
+ // ids/hrefs; rehype-sanitize will apply the same prefix downstream
3195
+ // and `rehypeRebaseHashLinks` mirrors it onto matching hash hrefs.
3196
+ // Without this, ids would end up double-prefixed
3197
+ // (`user-content-user-content-fn-x`).
3198
+ clobberPrefix: "",
3199
+ handlers: {
3200
+ // Inject definition-list HAST handlers when the extension is active.
3201
+ ...enableDefinitionList ? defListHastHandlers : {}
3202
+ }
3203
+ }),
3204
+ [enableDefinitionList]
3205
+ );
3206
+ const Renderer = config.blockMemoEnabled ? BlockMemoizedRenderer : LegacyRenderer;
3207
+ return /* @__PURE__ */ jsx6(
3208
+ Renderer,
3209
+ {
3210
+ content,
3211
+ usedComponents,
3212
+ remarkPlugins,
3213
+ rehypePlugins,
3214
+ remarkRehypeOptions,
3215
+ urlTransform
3197
3216
  }
3198
- }),
3199
- [enableDefinitionList]
3200
- );
3201
- const Renderer = config.blockMemoEnabled ? BlockMemoizedRenderer : LegacyRenderer;
3202
- return /* @__PURE__ */ jsx6(
3203
- Renderer,
3204
- {
3205
- content,
3206
- usedComponents,
3207
- remarkPlugins,
3208
- rehypePlugins,
3209
- remarkRehypeOptions
3210
- }
3211
- );
3212
- });
3217
+ );
3218
+ }
3219
+ );
3213
3220
  AIMarkdownContent.displayName = "AIMarkdownContent";
3214
3221
  var MarkdownContent_default = AIMarkdownContent;
3215
3222
 
@@ -3645,6 +3652,28 @@ function useStableValue(value) {
3645
3652
  return stableValue;
3646
3653
  }
3647
3654
 
3655
+ // src/hooks/useReferenceFlipWarning.ts
3656
+ import { useRef as useRef4 } from "react";
3657
+ var __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
3658
+ var FLIP_THRESHOLD = 3;
3659
+ var WARN_COOLDOWN_MS = 5e3;
3660
+ function trackFlip(state, value, propName, now) {
3661
+ if (state.prev === value) return;
3662
+ state.flips++;
3663
+ state.prev = value;
3664
+ if (state.flips < FLIP_THRESHOLD) return;
3665
+ if (now - state.lastWarnAt < WARN_COOLDOWN_MS) return;
3666
+ state.lastWarnAt = now;
3667
+ console.warn(
3668
+ `[AIMarkdown] \`${propName}\` reference is changing on every render. Define it at module scope or wrap with useMemo/useCallback to avoid discarding the per-block memo cache on every parent re-render.`
3669
+ );
3670
+ }
3671
+ function useReferenceFlipWarning(value, propName) {
3672
+ const stateRef = useRef4({ prev: value, flips: 0, lastWarnAt: -Infinity });
3673
+ if (!__DEV__) return;
3674
+ trackFlip(stateRef.current, value, propName, Date.now());
3675
+ }
3676
+
3648
3677
  // src/components/typography/Default.tsx
3649
3678
  import { memo as memo3, useMemo as useMemo5 } from "react";
3650
3679
  import { jsx as jsx7 } from "react/jsx-runtime";
@@ -3659,6 +3688,286 @@ var DefaultTypography = memo3(({ children, fontSize, variant, colorScheme, style
3659
3688
  DefaultTypography.displayName = "DefaultTypography";
3660
3689
  var Default_default = DefaultTypography;
3661
3690
 
3691
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js
3692
+ function arrayEach(array, iteratee) {
3693
+ var index = -1, length = array == null ? 0 : array.length;
3694
+ while (++index < length) {
3695
+ if (iteratee(array[index], index, array) === false) {
3696
+ break;
3697
+ }
3698
+ }
3699
+ return array;
3700
+ }
3701
+ var arrayEach_default = arrayEach;
3702
+
3703
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js
3704
+ function baseAssign(object, source) {
3705
+ return object && copyObject_default(source, keys_default(source), object);
3706
+ }
3707
+ var baseAssign_default = baseAssign;
3708
+
3709
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js
3710
+ function baseAssignIn(object, source) {
3711
+ return object && copyObject_default(source, keysIn_default(source), object);
3712
+ }
3713
+ var baseAssignIn_default = baseAssignIn;
3714
+
3715
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js
3716
+ function copySymbols(source, object) {
3717
+ return copyObject_default(source, getSymbols_default(source), object);
3718
+ }
3719
+ var copySymbols_default = copySymbols;
3720
+
3721
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js
3722
+ var nativeGetSymbols2 = Object.getOwnPropertySymbols;
3723
+ var getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) {
3724
+ var result = [];
3725
+ while (object) {
3726
+ arrayPush_default(result, getSymbols_default(object));
3727
+ object = getPrototype_default(object);
3728
+ }
3729
+ return result;
3730
+ };
3731
+ var getSymbolsIn_default = getSymbolsIn;
3732
+
3733
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js
3734
+ function copySymbolsIn(source, object) {
3735
+ return copyObject_default(source, getSymbolsIn_default(source), object);
3736
+ }
3737
+ var copySymbolsIn_default = copySymbolsIn;
3738
+
3739
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js
3740
+ function getAllKeysIn(object) {
3741
+ return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default);
3742
+ }
3743
+ var getAllKeysIn_default = getAllKeysIn;
3744
+
3745
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js
3746
+ var objectProto16 = Object.prototype;
3747
+ var hasOwnProperty13 = objectProto16.hasOwnProperty;
3748
+ function initCloneArray(array) {
3749
+ var length = array.length, result = new array.constructor(length);
3750
+ if (length && typeof array[0] == "string" && hasOwnProperty13.call(array, "index")) {
3751
+ result.index = array.index;
3752
+ result.input = array.input;
3753
+ }
3754
+ return result;
3755
+ }
3756
+ var initCloneArray_default = initCloneArray;
3757
+
3758
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js
3759
+ function cloneDataView(dataView, isDeep) {
3760
+ var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
3761
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
3762
+ }
3763
+ var cloneDataView_default = cloneDataView;
3764
+
3765
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js
3766
+ var reFlags = /\w*$/;
3767
+ function cloneRegExp(regexp) {
3768
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
3769
+ result.lastIndex = regexp.lastIndex;
3770
+ return result;
3771
+ }
3772
+ var cloneRegExp_default = cloneRegExp;
3773
+
3774
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js
3775
+ var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
3776
+ var symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : void 0;
3777
+ function cloneSymbol(symbol) {
3778
+ return symbolValueOf2 ? Object(symbolValueOf2.call(symbol)) : {};
3779
+ }
3780
+ var cloneSymbol_default = cloneSymbol;
3781
+
3782
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js
3783
+ var boolTag3 = "[object Boolean]";
3784
+ var dateTag3 = "[object Date]";
3785
+ var mapTag4 = "[object Map]";
3786
+ var numberTag3 = "[object Number]";
3787
+ var regexpTag3 = "[object RegExp]";
3788
+ var setTag4 = "[object Set]";
3789
+ var stringTag3 = "[object String]";
3790
+ var symbolTag2 = "[object Symbol]";
3791
+ var arrayBufferTag3 = "[object ArrayBuffer]";
3792
+ var dataViewTag4 = "[object DataView]";
3793
+ var float32Tag2 = "[object Float32Array]";
3794
+ var float64Tag2 = "[object Float64Array]";
3795
+ var int8Tag2 = "[object Int8Array]";
3796
+ var int16Tag2 = "[object Int16Array]";
3797
+ var int32Tag2 = "[object Int32Array]";
3798
+ var uint8Tag2 = "[object Uint8Array]";
3799
+ var uint8ClampedTag2 = "[object Uint8ClampedArray]";
3800
+ var uint16Tag2 = "[object Uint16Array]";
3801
+ var uint32Tag2 = "[object Uint32Array]";
3802
+ function initCloneByTag(object, tag, isDeep) {
3803
+ var Ctor = object.constructor;
3804
+ switch (tag) {
3805
+ case arrayBufferTag3:
3806
+ return cloneArrayBuffer_default(object);
3807
+ case boolTag3:
3808
+ case dateTag3:
3809
+ return new Ctor(+object);
3810
+ case dataViewTag4:
3811
+ return cloneDataView_default(object, isDeep);
3812
+ case float32Tag2:
3813
+ case float64Tag2:
3814
+ case int8Tag2:
3815
+ case int16Tag2:
3816
+ case int32Tag2:
3817
+ case uint8Tag2:
3818
+ case uint8ClampedTag2:
3819
+ case uint16Tag2:
3820
+ case uint32Tag2:
3821
+ return cloneTypedArray_default(object, isDeep);
3822
+ case mapTag4:
3823
+ return new Ctor();
3824
+ case numberTag3:
3825
+ case stringTag3:
3826
+ return new Ctor(object);
3827
+ case regexpTag3:
3828
+ return cloneRegExp_default(object);
3829
+ case setTag4:
3830
+ return new Ctor();
3831
+ case symbolTag2:
3832
+ return cloneSymbol_default(object);
3833
+ }
3834
+ }
3835
+ var initCloneByTag_default = initCloneByTag;
3836
+
3837
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js
3838
+ var mapTag5 = "[object Map]";
3839
+ function baseIsMap(value) {
3840
+ return isObjectLike_default(value) && getTag_default(value) == mapTag5;
3841
+ }
3842
+ var baseIsMap_default = baseIsMap;
3843
+
3844
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js
3845
+ var nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
3846
+ var isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
3847
+ var isMap_default = isMap;
3848
+
3849
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js
3850
+ var setTag5 = "[object Set]";
3851
+ function baseIsSet(value) {
3852
+ return isObjectLike_default(value) && getTag_default(value) == setTag5;
3853
+ }
3854
+ var baseIsSet_default = baseIsSet;
3855
+
3856
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js
3857
+ var nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
3858
+ var isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
3859
+ var isSet_default = isSet;
3860
+
3861
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js
3862
+ var CLONE_DEEP_FLAG = 1;
3863
+ var CLONE_FLAT_FLAG = 2;
3864
+ var CLONE_SYMBOLS_FLAG = 4;
3865
+ var argsTag4 = "[object Arguments]";
3866
+ var arrayTag3 = "[object Array]";
3867
+ var boolTag4 = "[object Boolean]";
3868
+ var dateTag4 = "[object Date]";
3869
+ var errorTag3 = "[object Error]";
3870
+ var funcTag3 = "[object Function]";
3871
+ var genTag2 = "[object GeneratorFunction]";
3872
+ var mapTag6 = "[object Map]";
3873
+ var numberTag4 = "[object Number]";
3874
+ var objectTag5 = "[object Object]";
3875
+ var regexpTag4 = "[object RegExp]";
3876
+ var setTag6 = "[object Set]";
3877
+ var stringTag4 = "[object String]";
3878
+ var symbolTag3 = "[object Symbol]";
3879
+ var weakMapTag3 = "[object WeakMap]";
3880
+ var arrayBufferTag4 = "[object ArrayBuffer]";
3881
+ var dataViewTag5 = "[object DataView]";
3882
+ var float32Tag3 = "[object Float32Array]";
3883
+ var float64Tag3 = "[object Float64Array]";
3884
+ var int8Tag3 = "[object Int8Array]";
3885
+ var int16Tag3 = "[object Int16Array]";
3886
+ var int32Tag3 = "[object Int32Array]";
3887
+ var uint8Tag3 = "[object Uint8Array]";
3888
+ var uint8ClampedTag3 = "[object Uint8ClampedArray]";
3889
+ var uint16Tag3 = "[object Uint16Array]";
3890
+ var uint32Tag3 = "[object Uint32Array]";
3891
+ var cloneableTags = {};
3892
+ cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag4] = cloneableTags[dataViewTag5] = cloneableTags[boolTag4] = cloneableTags[dateTag4] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag6] = cloneableTags[numberTag4] = cloneableTags[objectTag5] = cloneableTags[regexpTag4] = cloneableTags[setTag6] = cloneableTags[stringTag4] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
3893
+ cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
3894
+ function baseClone(value, bitmask, customizer, key, object, stack) {
3895
+ var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
3896
+ if (customizer) {
3897
+ result = object ? customizer(value, key, object, stack) : customizer(value);
3898
+ }
3899
+ if (result !== void 0) {
3900
+ return result;
3901
+ }
3902
+ if (!isObject_default(value)) {
3903
+ return value;
3904
+ }
3905
+ var isArr = isArray_default(value);
3906
+ if (isArr) {
3907
+ result = initCloneArray_default(value);
3908
+ if (!isDeep) {
3909
+ return copyArray_default(value, result);
3910
+ }
3911
+ } else {
3912
+ var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2;
3913
+ if (isBuffer_default(value)) {
3914
+ return cloneBuffer_default(value, isDeep);
3915
+ }
3916
+ if (tag == objectTag5 || tag == argsTag4 || isFunc && !object) {
3917
+ result = isFlat || isFunc ? {} : initCloneObject_default(value);
3918
+ if (!isDeep) {
3919
+ return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value));
3920
+ }
3921
+ } else {
3922
+ if (!cloneableTags[tag]) {
3923
+ return object ? value : {};
3924
+ }
3925
+ result = initCloneByTag_default(value, tag, isDeep);
3926
+ }
3927
+ }
3928
+ stack || (stack = new Stack_default());
3929
+ var stacked = stack.get(value);
3930
+ if (stacked) {
3931
+ return stacked;
3932
+ }
3933
+ stack.set(value, result);
3934
+ if (isSet_default(value)) {
3935
+ value.forEach(function(subValue) {
3936
+ result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
3937
+ });
3938
+ } else if (isMap_default(value)) {
3939
+ value.forEach(function(subValue, key2) {
3940
+ result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
3941
+ });
3942
+ }
3943
+ var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
3944
+ var props = isArr ? void 0 : keysFunc(value);
3945
+ arrayEach_default(props || value, function(subValue, key2) {
3946
+ if (props) {
3947
+ key2 = subValue;
3948
+ subValue = value[key2];
3949
+ }
3950
+ assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
3951
+ });
3952
+ return result;
3953
+ }
3954
+ var baseClone_default = baseClone;
3955
+
3956
+ // ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js
3957
+ var CLONE_DEEP_FLAG2 = 1;
3958
+ var CLONE_SYMBOLS_FLAG2 = 4;
3959
+ function cloneDeep(value) {
3960
+ return baseClone_default(value, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2);
3961
+ }
3962
+ var cloneDeep_default = cloneDeep;
3963
+
3964
+ // src/components/extendSanitizeSchema.ts
3965
+ function extendSanitizeSchema(modifier) {
3966
+ const draft = cloneDeep_default(sanitizeSchema);
3967
+ const result = modifier(draft);
3968
+ return result ?? draft;
3969
+ }
3970
+
3662
3971
  // src/index.tsx
3663
3972
  import { jsx as jsx8 } from "react/jsx-runtime";
3664
3973
  var AIMarkdownComponent = ({
@@ -3674,15 +3983,20 @@ var AIMarkdownComponent = ({
3674
3983
  ExtraStyles,
3675
3984
  variant = "default",
3676
3985
  colorScheme = "light",
3677
- documentId
3986
+ documentId,
3987
+ urlTransform,
3988
+ sanitizeSchema: sanitizeSchema2
3678
3989
  }) => {
3679
3990
  const usedFontSize = fontSize === void 0 ? "0.9375rem" : typeof fontSize === "number" ? `${fontSize}px` : fontSize;
3680
3991
  const generatedId = useId3();
3681
3992
  const usedDocumentId = documentId && documentId.length > 0 ? documentId : generatedId;
3993
+ useReferenceFlipWarning(urlTransform, "urlTransform");
3994
+ useReferenceFlipWarning(sanitizeSchema2, "sanitizeSchema");
3682
3995
  const stableDefaultConfig = useStableValue(defaultConfig);
3683
3996
  const stableConfig = useStableValue(config);
3684
3997
  const stablePreprocessors = useStableValue(contentPreprocessors);
3685
3998
  const stableCustomComponents = useStableValue(customComponents);
3999
+ const stableSanitizeSchema = useStableValue(sanitizeSchema2);
3686
4000
  const usedContent = useMemo6(
3687
4001
  () => content ? preprocessAIMDContent(content, stablePreprocessors) : content,
3688
4002
  [content, stablePreprocessors]
@@ -3705,7 +4019,23 @@ var AIMarkdownComponent = ({
3705
4019
  variant,
3706
4020
  colorScheme,
3707
4021
  style: typographyStyle,
3708
- children: ExtraStyles ? /* @__PURE__ */ jsx8(ExtraStyles, { children: /* @__PURE__ */ jsx8(MarkdownContent_default, { content: usedContent, customComponents: stableCustomComponents }) }) : /* @__PURE__ */ jsx8(MarkdownContent_default, { content: usedContent, customComponents: stableCustomComponents })
4022
+ children: ExtraStyles ? /* @__PURE__ */ jsx8(ExtraStyles, { children: /* @__PURE__ */ jsx8(
4023
+ MarkdownContent_default,
4024
+ {
4025
+ content: usedContent,
4026
+ customComponents: stableCustomComponents,
4027
+ urlTransform: urlTransform ?? void 0,
4028
+ sanitizeSchema: stableSanitizeSchema
4029
+ }
4030
+ ) }) : /* @__PURE__ */ jsx8(
4031
+ MarkdownContent_default,
4032
+ {
4033
+ content: usedContent,
4034
+ customComponents: stableCustomComponents,
4035
+ urlTransform: urlTransform ?? void 0,
4036
+ sanitizeSchema: stableSanitizeSchema
4037
+ }
4038
+ )
3709
4039
  }
3710
4040
  )
3711
4041
  }
@@ -3720,6 +4050,9 @@ export {
3720
4050
  AIMarkdownRenderExtraSyntax,
3721
4051
  index_default as default,
3722
4052
  defaultAIMarkdownRenderConfig,
4053
+ defaultUrlTransform,
4054
+ extendSanitizeSchema,
4055
+ sanitizeSchema,
3723
4056
  useAIMarkdownMetadata,
3724
4057
  useAIMarkdownRenderState,
3725
4058
  useDocumentRegistry,